@nebula-spatial/cad-loader 0.2.3 → 0.3.0
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 +13 -0
- package/README.md +22 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +1398 -1322
- package/dist/core/parser/bin-parser.d.ts +17 -4
- package/dist/core/parser/types.d.ts +2 -1
- package/dist/core/types.d.ts +6 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1096 -1053
- 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-node.d.ts +4 -0
- package/dist/loader/internal/geo-prepare-worker-types.d.ts +1 -0
- package/dist/render-resource/cad-render-node.d.ts +9 -0
- package/dist/session/cad-document-session.d.ts +8 -1
- package/dist/shared/text-builder.d.ts +25 -0
- package/dist/workers/geo-prepare.worker.js +1048 -974
- 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,27 @@ 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:
|
|
611
|
-
texts: o
|
|
610
|
+
layers: Qe(t.layers ?? []),
|
|
611
|
+
texts: o,
|
|
612
|
+
units: t.units
|
|
612
613
|
};
|
|
613
614
|
}
|
|
614
|
-
function
|
|
615
|
-
const n = t == null ? void 0 : t.maxExpandedInstanceVertices, e = typeof n == "number" && Number.isFinite(n) && n >= 0 ? Math.floor(n) :
|
|
615
|
+
function Dn(t) {
|
|
616
|
+
const n = t == null ? void 0 : t.maxExpandedInstanceVertices, e = typeof n == "number" && Number.isFinite(n) && n >= 0 ? Math.floor(n) : Fe;
|
|
616
617
|
return {
|
|
617
618
|
hiddenInstanceIds: t != null && t.hiddenInstanceIds ? new Set(t.hiddenInstanceIds) : /* @__PURE__ */ new Set(),
|
|
618
619
|
keepTextsForHiddenInstances: (t == null ? void 0 : t.keepTextsForHiddenInstances) === !0,
|
|
@@ -623,281 +624,282 @@ function On(t) {
|
|
|
623
624
|
externalVariantBuffers: t == null ? void 0 : t.externalVariantBuffers,
|
|
624
625
|
requiredExternalVariantIds: t == null ? void 0 : t.requiredExternalVariantIds,
|
|
625
626
|
externalVariantDeltaOnly: (t == null ? void 0 : t.externalVariantDeltaOnly) === !0,
|
|
626
|
-
deferExternalVariantGeometry: (t == null ? void 0 : t.deferExternalVariantGeometry) === !0
|
|
627
|
+
deferExternalVariantGeometry: (t == null ? void 0 : t.deferExternalVariantGeometry) === !0,
|
|
628
|
+
cacheDocument: (t == null ? void 0 : t.cacheDocument) === !0
|
|
627
629
|
};
|
|
628
630
|
}
|
|
629
|
-
function
|
|
631
|
+
function to(t) {
|
|
630
632
|
return t.loadBlocks && !t.suppressExpandedInsertGeometry;
|
|
631
633
|
}
|
|
632
634
|
function Nt(t, n) {
|
|
633
|
-
return
|
|
635
|
+
return to(n) && !n.hiddenInstanceIds.has(t);
|
|
634
636
|
}
|
|
635
|
-
function
|
|
637
|
+
function Xn(t, n, e) {
|
|
636
638
|
if (e <= 0)
|
|
637
639
|
return;
|
|
638
640
|
const o = t.expandedInstanceVertices + e;
|
|
639
641
|
if (o > t.maxExpandedInstanceVertices)
|
|
640
|
-
throw new
|
|
642
|
+
throw new u(
|
|
641
643
|
"E_EXPANSION_BUDGET",
|
|
642
644
|
`CPU-expanded ${n} instance vertices exceed budget: ${o}/${t.maxExpandedInstanceVertices}. Disable block loading or raise maxExpandedInstanceVertices.`
|
|
643
645
|
);
|
|
644
646
|
t.expandedInstanceVertices = o;
|
|
645
647
|
}
|
|
646
|
-
function
|
|
648
|
+
function no(t, n, e) {
|
|
647
649
|
return e.loadBlocks ? e.hiddenInstanceIds.size === 0 || e.keepTextsForHiddenInstances ? t : t.filter((o) => {
|
|
648
650
|
if (!Number.isInteger(o.iv) || !Number.isInteger(o.io))
|
|
649
651
|
return !0;
|
|
650
|
-
const
|
|
651
|
-
return
|
|
652
|
+
const i = n.get(`${o.iv}:${o.io}`);
|
|
653
|
+
return i === void 0 || !e.hiddenInstanceIds.has(i);
|
|
652
654
|
}) : t.filter((o) => !Number.isInteger(o.iv) || !Number.isInteger(o.io));
|
|
653
655
|
}
|
|
654
|
-
function
|
|
656
|
+
function eo(t, n) {
|
|
655
657
|
const e = /* @__PURE__ */ new Map();
|
|
656
|
-
return t.forEach((o,
|
|
658
|
+
return t.forEach((o, i) => {
|
|
657
659
|
if (!Number.isInteger(o.iv) || !Number.isInteger(o.io))
|
|
658
660
|
return;
|
|
659
661
|
const r = n.get(`${o.iv}:${o.io}`);
|
|
660
662
|
if (r === void 0)
|
|
661
663
|
return;
|
|
662
|
-
const
|
|
663
|
-
|
|
664
|
+
const s = e.get(r);
|
|
665
|
+
s ? s.push(i) : e.set(r, [i]);
|
|
664
666
|
}), e;
|
|
665
667
|
}
|
|
666
|
-
function
|
|
667
|
-
const
|
|
668
|
-
id:
|
|
669
|
-
blockName:
|
|
670
|
-
line: e[
|
|
671
|
-
fill: e[
|
|
672
|
-
dot: e[
|
|
673
|
-
texts: o.get(
|
|
668
|
+
function oo(t, n, e, o, i, r, s) {
|
|
669
|
+
const l = n.map((a, c) => ({
|
|
670
|
+
id: a.id,
|
|
671
|
+
blockName: Ln(a, c),
|
|
672
|
+
line: e[c].line,
|
|
673
|
+
fill: e[c].fill,
|
|
674
|
+
dot: e[c].dot,
|
|
675
|
+
texts: o.get(a.id) ?? []
|
|
674
676
|
}));
|
|
675
677
|
return {
|
|
676
678
|
layer0Index: t,
|
|
677
|
-
variants:
|
|
678
|
-
instances:
|
|
679
|
-
textIndexesByInstanceId:
|
|
680
|
-
ownerInstanceIdByVariantOrdinal:
|
|
679
|
+
variants: l,
|
|
680
|
+
instances: i,
|
|
681
|
+
textIndexesByInstanceId: eo(r, s),
|
|
682
|
+
ownerInstanceIdByVariantOrdinal: s
|
|
681
683
|
};
|
|
682
684
|
}
|
|
683
|
-
function
|
|
685
|
+
function ro(t) {
|
|
684
686
|
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
|
|
687
|
+
throw new u("E_HEADER", "Payload too small: missing header length");
|
|
688
|
+
const n = new DataView(t), e = n.getUint32(0, !0), o = 4, i = o + e;
|
|
689
|
+
if (i > t.byteLength)
|
|
690
|
+
throw new u("E_HEADER", "Header length exceeds payload length");
|
|
689
691
|
let r;
|
|
690
692
|
try {
|
|
691
|
-
r = JSON.parse(
|
|
692
|
-
} catch (
|
|
693
|
-
throw new
|
|
693
|
+
r = JSON.parse(nn.decode(new Uint8Array(t, o, e)));
|
|
694
|
+
} catch (s) {
|
|
695
|
+
throw new u("E_HEADER_JSON", `Invalid JSON header: ${s.message}`);
|
|
694
696
|
}
|
|
695
697
|
return {
|
|
696
698
|
meta: r,
|
|
697
|
-
header:
|
|
698
|
-
dataOffset:
|
|
699
|
+
header: en(r),
|
|
700
|
+
dataOffset: i,
|
|
699
701
|
view: n
|
|
700
702
|
};
|
|
701
703
|
}
|
|
702
|
-
function
|
|
703
|
-
var r,
|
|
704
|
+
function Ln(t, n) {
|
|
705
|
+
var r, s, l;
|
|
704
706
|
const e = (r = t.name) == null ? void 0 : r.trim();
|
|
705
707
|
if (e)
|
|
706
708
|
return e;
|
|
707
|
-
const o = (
|
|
709
|
+
const o = (s = t.block_name) == null ? void 0 : s.trim();
|
|
708
710
|
if (o)
|
|
709
711
|
return o;
|
|
710
|
-
const
|
|
711
|
-
return
|
|
712
|
+
const i = (l = t.blockName) == null ? void 0 : l.trim();
|
|
713
|
+
return i || `block_${n}`;
|
|
712
714
|
}
|
|
713
|
-
function
|
|
715
|
+
function io(t) {
|
|
714
716
|
const n = Number(t.version ?? 1), e = String(t.encoding ?? "").toLowerCase();
|
|
715
717
|
if (n === 2) {
|
|
716
718
|
const o = e ? ` ${e}` : "";
|
|
717
|
-
throw new
|
|
719
|
+
throw new u(
|
|
718
720
|
"E_UNSUPPORTED_PACK_VERSION",
|
|
719
721
|
`当前文件是 V2${o} pack,前端不再兼容解析;请升级到最新版本后再打开。`
|
|
720
722
|
);
|
|
721
723
|
}
|
|
722
724
|
}
|
|
723
|
-
function
|
|
724
|
-
const n =
|
|
725
|
-
return
|
|
725
|
+
function on(t) {
|
|
726
|
+
const n = ro(t);
|
|
727
|
+
return io(n.meta), n;
|
|
726
728
|
}
|
|
727
|
-
function
|
|
729
|
+
function Q(t) {
|
|
728
730
|
if (t.byteLength < 4)
|
|
729
731
|
return !1;
|
|
730
732
|
const n = new Uint8Array(t, 0, 4);
|
|
731
733
|
return n[0] === 68 && n[1] === 88 && n[2] === 66 && n[3] === 51;
|
|
732
734
|
}
|
|
733
|
-
function
|
|
735
|
+
function Nn(t, n) {
|
|
734
736
|
if (t > BigInt(Number.MAX_SAFE_INTEGER))
|
|
735
|
-
throw new
|
|
737
|
+
throw new u("E_GROUP_RANGE", `${n} exceeds safe integer range`);
|
|
736
738
|
return Number(t);
|
|
737
739
|
}
|
|
738
|
-
function
|
|
740
|
+
function _t(t, n, e, o) {
|
|
739
741
|
if (!Number.isInteger(t) || !Number.isInteger(n) || t < 0 || n < 0 || t + n > e)
|
|
740
|
-
throw new
|
|
742
|
+
throw new u("E_GROUP_RANGE", `${o} exceeds payload length`);
|
|
741
743
|
}
|
|
742
|
-
function
|
|
744
|
+
function Et(t) {
|
|
743
745
|
if (t.byteLength < 20)
|
|
744
|
-
throw new
|
|
745
|
-
const n = new DataView(t), e = n.getUint16(4, !0), o = n.getUint16(6, !0),
|
|
746
|
+
throw new u("E_HEADER", "V3 payload too small: missing container header");
|
|
747
|
+
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
748
|
if (e !== 3 || o > 6)
|
|
747
|
-
throw new
|
|
748
|
-
if (
|
|
749
|
-
throw new
|
|
749
|
+
throw new u("E_GROUP_RANGE", `Unsupported V3 version: ${e}.${o}`);
|
|
750
|
+
if (i !== 0)
|
|
751
|
+
throw new u("E_GROUP_RANGE", `Unsupported V3 file flags: ${i}`);
|
|
750
752
|
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
|
-
|
|
753
|
+
throw new u("E_GROUP_RANGE", `Invalid V3 directory entry size: ${r}`);
|
|
754
|
+
if (l !== r * s)
|
|
755
|
+
throw new u("E_GROUP_RANGE", "V3 directory byte size mismatch");
|
|
756
|
+
const a = 20;
|
|
757
|
+
_t(a, l, t.byteLength, "V3 section directory");
|
|
758
|
+
const c = /* @__PURE__ */ new Map();
|
|
759
|
+
for (let _ = 0; _ < s; _ += 1) {
|
|
760
|
+
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");
|
|
761
|
+
if (m !== 0)
|
|
762
|
+
throw new u("E_GROUP_RANGE", `Unsupported V3 section flags for type ${d}: ${m}`);
|
|
763
|
+
if (A !== 0)
|
|
764
|
+
throw new u("E_GROUP_RANGE", `Invalid V3 section reserved field for type ${d}: ${A}`);
|
|
765
|
+
_t(y, x, t.byteLength, `V3 section ${d}`), c.set(d, { type: d, flags: m, offset: y, length: x });
|
|
764
766
|
}
|
|
765
|
-
return { versionMinor: o, sections:
|
|
767
|
+
return { versionMinor: o, sections: c };
|
|
766
768
|
}
|
|
767
|
-
function
|
|
769
|
+
function P(t, n, e) {
|
|
768
770
|
const o = t.get(n);
|
|
769
771
|
if (!o)
|
|
770
|
-
throw new
|
|
772
|
+
throw new u("E_GROUP_RANGE", `Missing V3 section ${e}`);
|
|
771
773
|
return o;
|
|
772
774
|
}
|
|
773
|
-
function
|
|
775
|
+
function dt(t, n) {
|
|
774
776
|
return t.get(n) ?? { type: n, flags: 0, offset: 0, length: 0 };
|
|
775
777
|
}
|
|
776
|
-
function
|
|
778
|
+
function xt(t, n, e) {
|
|
777
779
|
try {
|
|
778
|
-
return JSON.parse(
|
|
780
|
+
return JSON.parse(nn.decode(new Uint8Array(t, n.offset, n.length)));
|
|
779
781
|
} catch (o) {
|
|
780
|
-
throw new
|
|
782
|
+
throw new u("E_HEADER_JSON", `Invalid V3 ${e} JSON: ${o.message}`);
|
|
781
783
|
}
|
|
782
784
|
}
|
|
783
|
-
function
|
|
785
|
+
function rn(t) {
|
|
784
786
|
const n = String(t.encoding ?? "").toLowerCase();
|
|
785
787
|
return n === "nested_instanced_external" || n === "nested_instanced_external_annotations";
|
|
786
788
|
}
|
|
787
|
-
function
|
|
789
|
+
function sn(t) {
|
|
788
790
|
return String(t.encoding ?? "").toLowerCase() === "nested_instanced_external_annotations";
|
|
789
791
|
}
|
|
790
|
-
function
|
|
791
|
-
const o = t.features,
|
|
792
|
-
return n && (
|
|
792
|
+
function so(t, n, e) {
|
|
793
|
+
const o = t.features, i = o && typeof o == "object" && !Array.isArray(o) ? { ...o } : {};
|
|
794
|
+
return n && (i.has_external_variant_geometry = !0), e && (i.has_external_annotations = !0), Object.keys(i).length ? i : void 0;
|
|
793
795
|
}
|
|
794
|
-
function
|
|
796
|
+
function K(t, n) {
|
|
795
797
|
if (!Number.isInteger(t) || Number(t) < 0)
|
|
796
|
-
throw new
|
|
798
|
+
throw new u("E_HEADER", `${n} must be a non-negative integer`);
|
|
797
799
|
return Number(t);
|
|
798
800
|
}
|
|
799
|
-
function
|
|
801
|
+
function kn(t, n) {
|
|
800
802
|
if (typeof t != "string" || !t.trim())
|
|
801
|
-
throw new
|
|
803
|
+
throw new u("E_HEADER", `${n} must be a non-empty string`);
|
|
802
804
|
return t;
|
|
803
805
|
}
|
|
804
|
-
function
|
|
806
|
+
function pn(t, n) {
|
|
805
807
|
if (t == null)
|
|
806
808
|
return null;
|
|
807
809
|
if (!Array.isArray(t) || t.length !== 4 || t.some((e) => typeof e != "number" || !Number.isFinite(e)))
|
|
808
|
-
throw new
|
|
810
|
+
throw new u("E_HEADER", `${n} must be null or [minX, minY, maxX, maxY]`);
|
|
809
811
|
return [t[0], t[1], t[2], t[3]];
|
|
810
812
|
}
|
|
811
|
-
function
|
|
812
|
-
if (!
|
|
813
|
-
throw new
|
|
813
|
+
function Kt(t, n) {
|
|
814
|
+
if (!ut(t) || Array.isArray(t))
|
|
815
|
+
throw new u("E_HEADER", `${n} must be an object`);
|
|
814
816
|
return {
|
|
815
|
-
line_count:
|
|
816
|
-
fill_count:
|
|
817
|
-
dot_count:
|
|
818
|
-
bbox:
|
|
819
|
-
own_bbox:
|
|
817
|
+
line_count: K(t.line_count, `${n}.line_count`),
|
|
818
|
+
fill_count: K(t.fill_count, `${n}.fill_count`),
|
|
819
|
+
dot_count: K(t.dot_count, `${n}.dot_count`),
|
|
820
|
+
bbox: pn(t.bbox, `${n}.bbox`),
|
|
821
|
+
own_bbox: pn(t.own_bbox, `${n}.own_bbox`)
|
|
820
822
|
};
|
|
821
823
|
}
|
|
822
|
-
function
|
|
824
|
+
function ao(t) {
|
|
823
825
|
return t ? { minX: t[0], minY: t[1], maxX: t[2], maxY: t[3] } : null;
|
|
824
826
|
}
|
|
825
|
-
function
|
|
827
|
+
function Tt(t, n) {
|
|
826
828
|
const e = t.external_variants;
|
|
827
829
|
if (!Array.isArray(e))
|
|
828
|
-
throw new
|
|
830
|
+
throw new u("E_HEADER", "V3 external SCENE_META.external_variants must be an array");
|
|
829
831
|
if (e.length !== n)
|
|
830
|
-
throw new
|
|
832
|
+
throw new u(
|
|
831
833
|
"E_GROUP_RANGE",
|
|
832
834
|
`V3 external variant manifest count mismatch: manifest=${e.length}, table=${n}`
|
|
833
835
|
);
|
|
834
|
-
return e.map((o,
|
|
835
|
-
if (!
|
|
836
|
-
throw new
|
|
837
|
-
const r =
|
|
838
|
-
if (r !==
|
|
839
|
-
throw new
|
|
840
|
-
const
|
|
836
|
+
return e.map((o, i) => {
|
|
837
|
+
if (!ut(o) || Array.isArray(o))
|
|
838
|
+
throw new u("E_HEADER", `V3 external_variants[${i}] must be an object`);
|
|
839
|
+
const r = K(o.id, `V3 external_variants[${i}].id`);
|
|
840
|
+
if (r !== i)
|
|
841
|
+
throw new u("E_GROUP_RANGE", `V3 external_variants[${i}].id must equal ${i}, found ${r}`);
|
|
842
|
+
const s = kn(o.href, `V3 external_variants[${i}].href`), l = K(o.raw_size, `V3 external_variants[${i}].raw_size`);
|
|
841
843
|
if ("normal" in o || "annotation" in o) {
|
|
842
|
-
const
|
|
844
|
+
const a = Kt(o.annotation, `V3 external_variants[${i}].annotation`);
|
|
843
845
|
return {
|
|
844
846
|
id: r,
|
|
845
|
-
href:
|
|
846
|
-
raw_size:
|
|
847
|
-
normal:
|
|
847
|
+
href: s,
|
|
848
|
+
raw_size: l,
|
|
849
|
+
normal: Kt(o.normal, `V3 external_variants[${i}].normal`),
|
|
848
850
|
annotation: {
|
|
849
|
-
...
|
|
850
|
-
text_count:
|
|
851
|
-
|
|
852
|
-
`V3 external_variants[${
|
|
851
|
+
...a,
|
|
852
|
+
text_count: K(
|
|
853
|
+
ut(o.annotation) && !Array.isArray(o.annotation) ? o.annotation.text_count : void 0,
|
|
854
|
+
`V3 external_variants[${i}].annotation.text_count`
|
|
853
855
|
)
|
|
854
856
|
}
|
|
855
857
|
};
|
|
856
858
|
}
|
|
857
859
|
return {
|
|
858
860
|
id: r,
|
|
859
|
-
href:
|
|
860
|
-
raw_size:
|
|
861
|
-
line_count:
|
|
862
|
-
fill_count:
|
|
863
|
-
dot_count:
|
|
861
|
+
href: s,
|
|
862
|
+
raw_size: l,
|
|
863
|
+
line_count: K(o.line_count, `V3 external_variants[${i}].line_count`),
|
|
864
|
+
fill_count: K(o.fill_count, `V3 external_variants[${i}].fill_count`),
|
|
865
|
+
dot_count: K(o.dot_count, `V3 external_variants[${i}].dot_count`)
|
|
864
866
|
};
|
|
865
867
|
});
|
|
866
868
|
}
|
|
867
|
-
function
|
|
869
|
+
function Yn(t) {
|
|
868
870
|
const n = t.external_annotations;
|
|
869
871
|
if (n == null) return null;
|
|
870
|
-
if (!
|
|
871
|
-
throw new
|
|
872
|
+
if (!ut(n) || Array.isArray(n))
|
|
873
|
+
throw new u("E_HEADER", "V3 external_annotations must be an object");
|
|
872
874
|
const e = n.scene;
|
|
873
875
|
if (e == null) return {};
|
|
874
|
-
if (!
|
|
875
|
-
throw new
|
|
876
|
-
const o =
|
|
876
|
+
if (!ut(e) || Array.isArray(e))
|
|
877
|
+
throw new u("E_HEADER", "V3 external_annotations.scene must be an object");
|
|
878
|
+
const o = Kt(e, "V3 external_annotations.scene");
|
|
877
879
|
return {
|
|
878
880
|
scene: {
|
|
879
|
-
href:
|
|
880
|
-
raw_size:
|
|
881
|
+
href: kn(e.href, "V3 external_annotations.scene.href"),
|
|
882
|
+
raw_size: K(e.raw_size, "V3 external_annotations.scene.raw_size"),
|
|
881
883
|
...o,
|
|
882
|
-
text_count:
|
|
884
|
+
text_count: K(e.text_count, "V3 external_annotations.scene.text_count")
|
|
883
885
|
}
|
|
884
886
|
};
|
|
885
887
|
}
|
|
886
|
-
function
|
|
887
|
-
const { sections: n } =
|
|
888
|
-
return
|
|
888
|
+
function Fn(t) {
|
|
889
|
+
const { sections: n } = Et(t), e = P(n, 1, "SCENE_META");
|
|
890
|
+
return xt(t, e, "SCENE_META");
|
|
889
891
|
}
|
|
890
|
-
function
|
|
891
|
-
if (!
|
|
892
|
+
function Xo(t) {
|
|
893
|
+
if (!Q(t))
|
|
892
894
|
return [];
|
|
893
|
-
const { sections: n } =
|
|
894
|
-
if (!
|
|
895
|
+
const { sections: n } = Et(t), e = P(n, 1, "SCENE_META"), o = P(n, 5, "VARIANT_TABLE"), i = xt(t, e, "SCENE_META");
|
|
896
|
+
if (!rn(i))
|
|
895
897
|
return [];
|
|
896
898
|
if (o.length % 60 !== 0)
|
|
897
|
-
throw new
|
|
898
|
-
return
|
|
899
|
+
throw new u("E_GROUP_RANGE", "V3 VARIANT_TABLE length must be a multiple of 60");
|
|
900
|
+
return Tt(i, o.length / 60);
|
|
899
901
|
}
|
|
900
|
-
function
|
|
902
|
+
function In() {
|
|
901
903
|
return {
|
|
902
904
|
manifest: [],
|
|
903
905
|
requiredVariantIds: [],
|
|
@@ -906,288 +908,288 @@ function An() {
|
|
|
906
908
|
skippedVariantIds: []
|
|
907
909
|
};
|
|
908
910
|
}
|
|
909
|
-
function
|
|
910
|
-
return
|
|
911
|
+
function lo(t, n) {
|
|
912
|
+
return Ve(t, n);
|
|
911
913
|
}
|
|
912
|
-
function
|
|
913
|
-
return
|
|
914
|
+
function Wt(t, n) {
|
|
915
|
+
return Cn(t, n);
|
|
914
916
|
}
|
|
915
|
-
function
|
|
916
|
-
return
|
|
917
|
+
function uo(t, n) {
|
|
918
|
+
return Ie(t, n);
|
|
917
919
|
}
|
|
918
|
-
function
|
|
920
|
+
function co(t, n, e, o) {
|
|
919
921
|
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 &&
|
|
922
|
+
const i = uo(n, t);
|
|
923
|
+
if (!i) return !0;
|
|
924
|
+
const r = Math.max(0, i.maxX - i.minX) / e, s = Math.max(0, i.maxY - i.minY) / e;
|
|
925
|
+
return r < o && s < o;
|
|
924
926
|
}
|
|
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,
|
|
927
|
+
function zn(t) {
|
|
928
|
+
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);
|
|
929
|
+
return [n, e, o, i].every(Number.isFinite) ? { minX: n, minY: o, maxX: e, maxY: i } : null;
|
|
928
930
|
}
|
|
929
|
-
function
|
|
931
|
+
function fo(t) {
|
|
930
932
|
return Math.max(1, Math.abs(t.maxX - t.minX), Math.abs(t.maxY - t.minY));
|
|
931
933
|
}
|
|
932
|
-
function
|
|
934
|
+
function Hn(t, n) {
|
|
933
935
|
return `${t}:${n}`;
|
|
934
936
|
}
|
|
935
|
-
function
|
|
936
|
-
const n = t.map((o) => o.worldBBox && !o.unknownBBox ?
|
|
937
|
-
return Math.max(1, e *
|
|
937
|
+
function mo(t) {
|
|
938
|
+
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;
|
|
939
|
+
return Math.max(1, e * je);
|
|
938
940
|
}
|
|
939
|
-
function
|
|
940
|
-
const e = t.map((
|
|
941
|
-
const
|
|
941
|
+
function _o(t, n) {
|
|
942
|
+
const e = t.map((s, l) => {
|
|
943
|
+
const a = n(s), c = a.worldBBox ? zn(a.worldBBox) : null;
|
|
942
944
|
return {
|
|
943
|
-
sceneInstanceId:
|
|
944
|
-
sceneInstance:
|
|
945
|
-
worldBBox:
|
|
946
|
-
unknownBBox:
|
|
945
|
+
sceneInstanceId: l,
|
|
946
|
+
sceneInstance: s,
|
|
947
|
+
worldBBox: c,
|
|
948
|
+
unknownBBox: a.unknownBBox || !c
|
|
947
949
|
};
|
|
948
|
-
}), o =
|
|
949
|
-
for (const
|
|
950
|
-
if (
|
|
951
|
-
r.push(
|
|
950
|
+
}), o = mo(e), i = /* @__PURE__ */ new Map(), r = [];
|
|
951
|
+
for (const s of e) {
|
|
952
|
+
if (s.unknownBBox || !s.worldBBox) {
|
|
953
|
+
r.push(s);
|
|
952
954
|
continue;
|
|
953
955
|
}
|
|
954
|
-
const
|
|
955
|
-
if (!Number.isFinite(
|
|
956
|
-
r.push(
|
|
956
|
+
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);
|
|
957
|
+
if (!Number.isFinite(f) || f > qe) {
|
|
958
|
+
r.push(s);
|
|
957
959
|
continue;
|
|
958
960
|
}
|
|
959
|
-
for (let
|
|
960
|
-
for (let
|
|
961
|
-
const
|
|
962
|
-
y ? y.push(
|
|
961
|
+
for (let d = l; d <= a; d += 1)
|
|
962
|
+
for (let m = c; m <= _; m += 1) {
|
|
963
|
+
const A = Hn(d, m), y = i.get(A);
|
|
964
|
+
y ? y.push(s) : i.set(A, [s]);
|
|
963
965
|
}
|
|
964
966
|
}
|
|
965
|
-
return { cellSize: o, cells:
|
|
967
|
+
return { cellSize: o, cells: i, overflow: r, records: e };
|
|
966
968
|
}
|
|
967
|
-
function
|
|
968
|
-
const o =
|
|
969
|
+
function Eo(t, n, e) {
|
|
970
|
+
const o = Rn.get(t);
|
|
969
971
|
if (o && o.records.length === n.length)
|
|
970
972
|
return o;
|
|
971
|
-
const
|
|
972
|
-
return
|
|
973
|
+
const i = _o(n, e);
|
|
974
|
+
return Rn.set(t, i), i;
|
|
973
975
|
}
|
|
974
|
-
function
|
|
975
|
-
const e =
|
|
976
|
+
function xo(t, n) {
|
|
977
|
+
const e = zn(n);
|
|
976
978
|
if (!e)
|
|
977
979
|
return t.records;
|
|
978
|
-
const o = /* @__PURE__ */ new Set(),
|
|
979
|
-
for (let
|
|
980
|
-
for (let
|
|
981
|
-
const
|
|
982
|
-
if (
|
|
983
|
-
for (const
|
|
984
|
-
|
|
980
|
+
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);
|
|
981
|
+
for (let a = i; a <= r; a += 1)
|
|
982
|
+
for (let c = s; c <= l; c += 1) {
|
|
983
|
+
const _ = t.cells.get(Hn(a, c));
|
|
984
|
+
if (_)
|
|
985
|
+
for (const f of _)
|
|
986
|
+
f.worldBBox && Wt(e, f.worldBBox) && o.add(f);
|
|
985
987
|
}
|
|
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:
|
|
988
|
+
for (const a of t.overflow)
|
|
989
|
+
(!a.worldBBox || Wt(e, a.worldBBox)) && o.add(a);
|
|
990
|
+
return Array.from(o).sort((a, c) => a.sceneInstanceId - c.sceneInstanceId);
|
|
991
|
+
}
|
|
992
|
+
function Lo(t, n = {}) {
|
|
993
|
+
if (!Q(t))
|
|
994
|
+
return In();
|
|
995
|
+
const e = new DataView(t), { sections: o } = Et(t), i = P(o, 1, "SCENE_META"), r = xt(t, i, "SCENE_META");
|
|
996
|
+
if (!rn(r))
|
|
997
|
+
return In();
|
|
998
|
+
const s = P(o, 5, "VARIANT_TABLE");
|
|
999
|
+
if (s.length % 60 !== 0)
|
|
1000
|
+
throw new u("E_GROUP_RANGE", "V3 VARIANT_TABLE length must be a multiple of 60");
|
|
1001
|
+
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) => {
|
|
1002
|
+
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) => {
|
|
1003
|
+
var j;
|
|
1004
|
+
return B + (((j = a[O]) == null ? void 0 : j.raw_size) ?? 0);
|
|
1005
|
+
}, 0), b = {
|
|
1006
|
+
manifest: a,
|
|
1007
|
+
requiredVariantIds: V,
|
|
1008
|
+
requiredNormalBytes: C,
|
|
1009
|
+
totalManifestBytes: c,
|
|
1010
|
+
skippedVariantIds: T,
|
|
1009
1011
|
includedSceneInstanceIds: [...E]
|
|
1010
1012
|
};
|
|
1011
|
-
return
|
|
1013
|
+
return _ === void 0 ? b : { ...b, viewport: _ };
|
|
1012
1014
|
};
|
|
1013
1015
|
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
|
|
1016
|
+
return f(/* @__PURE__ */ new Set(), []);
|
|
1017
|
+
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");
|
|
1018
|
+
if (Number(r.variant_count ?? l) !== l)
|
|
1019
|
+
throw new u("E_GROUP_RANGE", "V3 variant count mismatch");
|
|
1020
|
+
if (Number(r.scene_instance_count ?? A.length) !== A.length)
|
|
1021
|
+
throw new u("E_GROUP_RANGE", "V3 scene instance count mismatch");
|
|
1020
1022
|
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:
|
|
1023
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance count mismatch");
|
|
1024
|
+
const x = /* @__PURE__ */ new Map(), h = [];
|
|
1025
|
+
for (let N = 0; N < l; N += 1) {
|
|
1026
|
+
const E = s.offset + N * 60, V = e.getUint32(E + 32, !0), T = e.getUint32(E + 36, !0);
|
|
1027
|
+
if (V + T > y.length)
|
|
1028
|
+
throw new u("E_GROUP_RANGE", `V3 variant ${N} nested range exceeds table`);
|
|
1029
|
+
const C = a[N], b = Ut(C);
|
|
1030
|
+
h[N] = {
|
|
1031
|
+
id: N,
|
|
1032
|
+
nestedStart: V,
|
|
1033
|
+
nestedCount: T,
|
|
1032
1034
|
precisionOriginX: e.getFloat32(E + 48, !0),
|
|
1033
1035
|
precisionOriginY: e.getFloat32(E + 52, !0),
|
|
1034
|
-
bbox:
|
|
1035
|
-
ownBBox:
|
|
1036
|
+
bbox: b,
|
|
1037
|
+
ownBBox: b
|
|
1036
1038
|
};
|
|
1037
|
-
const
|
|
1038
|
-
for (let
|
|
1039
|
-
|
|
1040
|
-
|
|
1039
|
+
const B = [];
|
|
1040
|
+
for (let O = 0; O < T; O += 1)
|
|
1041
|
+
B.push(y[V + O].variantId);
|
|
1042
|
+
x.set(N, B);
|
|
1041
1043
|
}
|
|
1042
|
-
|
|
1043
|
-
if (!
|
|
1044
|
-
throw new
|
|
1044
|
+
Rt(A, y, (N) => {
|
|
1045
|
+
if (!a[N.variantId])
|
|
1046
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${N.variantId}`);
|
|
1045
1047
|
});
|
|
1046
|
-
const
|
|
1048
|
+
const R = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), p = (N, E, V) => {
|
|
1047
1049
|
if (E > 64)
|
|
1048
|
-
throw new
|
|
1049
|
-
if (
|
|
1050
|
-
throw new
|
|
1051
|
-
if (!
|
|
1052
|
-
throw new
|
|
1053
|
-
if (!
|
|
1054
|
-
|
|
1055
|
-
for (const
|
|
1056
|
-
|
|
1057
|
-
|
|
1050
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance depth exceeds limit");
|
|
1051
|
+
if (V.has(N))
|
|
1052
|
+
throw new u("E_GROUP_RANGE", `V3 nested variant cycle detected at ${N}`);
|
|
1053
|
+
if (!a[N])
|
|
1054
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${N}`);
|
|
1055
|
+
if (!w.has(N)) {
|
|
1056
|
+
R.add(N), V.add(N);
|
|
1057
|
+
for (const T of x.get(N) ?? [])
|
|
1058
|
+
p(T, E + 1, V);
|
|
1059
|
+
V.delete(N), w.add(N);
|
|
1058
1060
|
}
|
|
1059
|
-
},
|
|
1061
|
+
}, v = n.hiddenInstanceIds ?? /* @__PURE__ */ new Set(), U = n.viewport == null ? null : lo(
|
|
1060
1062
|
n.viewport,
|
|
1061
|
-
n.viewportPaddingRatio ??
|
|
1062
|
-
), D = n.minViewportPixelSize ??
|
|
1063
|
+
n.viewportPaddingRatio ?? ze
|
|
1064
|
+
), D = n.minViewportPixelSize ?? He, $ = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Set(), Y = (N, E, V) => {
|
|
1063
1065
|
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 ((!
|
|
1066
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance depth exceeds limit");
|
|
1067
|
+
if (V.has(N))
|
|
1068
|
+
throw new u("E_GROUP_RANGE", `V3 nested variant cycle detected at ${N}`);
|
|
1069
|
+
if ($.has(N))
|
|
1070
|
+
return $.get(N) ?? null;
|
|
1071
|
+
const T = h[N];
|
|
1072
|
+
if (!T)
|
|
1073
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${N}`);
|
|
1074
|
+
V.add(N);
|
|
1075
|
+
let C = T.ownBBox, b = !1;
|
|
1076
|
+
for (let B = 0; B < T.nestedCount; B += 1) {
|
|
1077
|
+
const O = y[T.nestedStart + B], j = h[O.variantId];
|
|
1078
|
+
if (!j)
|
|
1079
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${O.variantId}`);
|
|
1080
|
+
const H = Y(O.variantId, E + 1, V);
|
|
1081
|
+
if ((!H || M.has(O.variantId)) && (b = !0), !H)
|
|
1080
1082
|
continue;
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1083
|
+
const X = ln(O, T, j);
|
|
1084
|
+
C = pt(C, It(H, X));
|
|
1083
1085
|
}
|
|
1084
|
-
return
|
|
1085
|
-
},
|
|
1086
|
-
|
|
1087
|
-
|
|
1086
|
+
return V.delete(N), $.set(N, C), (!C || b) && M.add(N), C;
|
|
1087
|
+
}, z = [], S = (N, E, V) => {
|
|
1088
|
+
v.has(E) || U && V && (!Wt(U, V) || co(
|
|
1089
|
+
V,
|
|
1088
1090
|
n.viewport ?? null,
|
|
1089
1091
|
n.worldUnitsPerPixel,
|
|
1090
1092
|
D
|
|
1091
|
-
)) || (
|
|
1093
|
+
)) || (z.push(E), p(N.variantId, 0, /* @__PURE__ */ new Set()));
|
|
1092
1094
|
};
|
|
1093
|
-
if (
|
|
1094
|
-
const
|
|
1095
|
-
const
|
|
1095
|
+
if (U) {
|
|
1096
|
+
const N = Eo(t, A, (E) => {
|
|
1097
|
+
const V = Y(E.variantId, 0, /* @__PURE__ */ new Set()), T = !V || M.has(E.variantId);
|
|
1096
1098
|
return {
|
|
1097
|
-
worldBBox:
|
|
1098
|
-
unknownBBox:
|
|
1099
|
+
worldBBox: V ? It(V, E) : null,
|
|
1100
|
+
unknownBBox: T
|
|
1099
1101
|
};
|
|
1100
1102
|
});
|
|
1101
|
-
for (const E of
|
|
1102
|
-
|
|
1103
|
+
for (const E of xo(N, U))
|
|
1104
|
+
S(E.sceneInstance, E.sceneInstanceId, E.unknownBBox ? null : E.worldBBox);
|
|
1103
1105
|
} else
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
+
A.forEach((N, E) => {
|
|
1107
|
+
S(N, E, null);
|
|
1106
1108
|
});
|
|
1107
|
-
return
|
|
1109
|
+
return f(R, z);
|
|
1108
1110
|
}
|
|
1109
|
-
function
|
|
1110
|
-
if (!
|
|
1111
|
+
function ko(t) {
|
|
1112
|
+
if (!Q(t))
|
|
1111
1113
|
return null;
|
|
1112
|
-
const n =
|
|
1113
|
-
return
|
|
1114
|
+
const n = Fn(t);
|
|
1115
|
+
return sn(n) ? Yn(n) : null;
|
|
1114
1116
|
}
|
|
1115
|
-
function
|
|
1117
|
+
function go(t, n) {
|
|
1116
1118
|
if (!Array.isArray(t) || t.length !== 4)
|
|
1117
|
-
throw new
|
|
1119
|
+
throw new u("E_HEADER", `${n} must be a four-number array`);
|
|
1118
1120
|
const e = t.map(Number);
|
|
1119
1121
|
if (!e.every(Number.isFinite))
|
|
1120
|
-
throw new
|
|
1122
|
+
throw new u("E_HEADER", `${n} must contain finite numbers`);
|
|
1121
1123
|
return [e[0], e[1], e[2], e[3]];
|
|
1122
1124
|
}
|
|
1123
|
-
function
|
|
1124
|
-
return
|
|
1125
|
+
function bt(t, n, e, o) {
|
|
1126
|
+
return _t(n, e, t.byteLength, o), nn.decode(t.subarray(n, n + e));
|
|
1125
1127
|
}
|
|
1126
|
-
function
|
|
1128
|
+
function jn(t, n, e) {
|
|
1127
1129
|
if (n.length % 20 !== 0)
|
|
1128
|
-
throw new
|
|
1129
|
-
const o = new DataView(t),
|
|
1130
|
+
throw new u("E_GROUP_RANGE", "V3 LAYER_TABLE length must be a multiple of 20");
|
|
1131
|
+
const o = new DataView(t), i = [];
|
|
1130
1132
|
for (let r = n.offset; r < n.offset + n.length; r += 20) {
|
|
1131
|
-
const
|
|
1132
|
-
|
|
1133
|
-
name:
|
|
1133
|
+
const s = o.getUint32(r, !0), l = o.getUint32(r + 4, !0);
|
|
1134
|
+
i.push({
|
|
1135
|
+
name: bt(e, s, l, "V3 layer name"),
|
|
1134
1136
|
color: [o.getUint8(r + 8), o.getUint8(r + 9), o.getUint8(r + 10)],
|
|
1135
1137
|
visible: o.getUint8(r + 11) !== 0,
|
|
1136
1138
|
lw_px: o.getFloat32(r + 12, !0)
|
|
1137
1139
|
});
|
|
1138
1140
|
}
|
|
1139
|
-
return
|
|
1141
|
+
return i;
|
|
1140
1142
|
}
|
|
1141
|
-
function
|
|
1143
|
+
function wt(t, n, e, o, i, r) {
|
|
1142
1144
|
if (e + 4 > o)
|
|
1143
|
-
throw new
|
|
1144
|
-
const
|
|
1145
|
-
if (
|
|
1146
|
-
throw new
|
|
1145
|
+
throw new u("E_GROUP_RANGE", `Missing ${i} vertex_count`);
|
|
1146
|
+
const s = n.getUint32(e, !0), l = e + 4, a = ft(t, n, l, s, o, r);
|
|
1147
|
+
if (a.offset > o)
|
|
1148
|
+
throw new u("E_GROUP_RANGE", `${i} exceeds section bounds`);
|
|
1147
1149
|
return {
|
|
1148
|
-
chunk:
|
|
1149
|
-
offset:
|
|
1150
|
+
chunk: a.chunk,
|
|
1151
|
+
offset: a.offset
|
|
1150
1152
|
};
|
|
1151
1153
|
}
|
|
1152
|
-
function
|
|
1153
|
-
const
|
|
1154
|
+
function qn(t, n, e, o, i, r) {
|
|
1155
|
+
const s = wt(t, n, e, o, i, r), l = e + 4;
|
|
1154
1156
|
return {
|
|
1155
|
-
chunk:
|
|
1157
|
+
chunk: s.chunk,
|
|
1156
1158
|
snapshot: {
|
|
1157
|
-
count:
|
|
1158
|
-
raw: new Uint8Array(t,
|
|
1159
|
+
count: s.chunk.count,
|
|
1160
|
+
raw: new Uint8Array(t, l, s.offset - l).slice(),
|
|
1159
1161
|
groupLayerEncoding: r
|
|
1160
1162
|
},
|
|
1161
|
-
offset:
|
|
1163
|
+
offset: s.offset
|
|
1162
1164
|
};
|
|
1163
1165
|
}
|
|
1164
|
-
function
|
|
1166
|
+
function At(t = "u8") {
|
|
1165
1167
|
return {
|
|
1166
1168
|
chunk: { pos: new Float32Array(0), col: new Uint8Array(0), lay: new Uint8Array(0), count: 0 },
|
|
1167
1169
|
snapshot: { count: 0, raw: new Uint8Array(0), groupLayerEncoding: t }
|
|
1168
1170
|
};
|
|
1169
1171
|
}
|
|
1170
|
-
function
|
|
1172
|
+
function Kn(t = "u8") {
|
|
1171
1173
|
return {
|
|
1172
|
-
line:
|
|
1173
|
-
fill:
|
|
1174
|
-
dot:
|
|
1174
|
+
line: At(t),
|
|
1175
|
+
fill: At(t),
|
|
1176
|
+
dot: At(t)
|
|
1175
1177
|
};
|
|
1176
1178
|
}
|
|
1177
|
-
function
|
|
1179
|
+
function Wn(t, n, e) {
|
|
1178
1180
|
var o;
|
|
1179
1181
|
return !!(n && e && t.deferExternalVariantGeometry && !((o = t.externalVariantBuffers) != null && o.has(n.id)));
|
|
1180
1182
|
}
|
|
1181
|
-
function
|
|
1182
|
-
if (
|
|
1183
|
-
return
|
|
1184
|
-
|
|
1185
|
-
const
|
|
1186
|
-
if (
|
|
1187
|
-
throw new
|
|
1188
|
-
return { chunk:
|
|
1183
|
+
function Ot(t, n, e, o, i, r, s) {
|
|
1184
|
+
if (i === 0)
|
|
1185
|
+
return At(s);
|
|
1186
|
+
_t(o, i, e.length, r);
|
|
1187
|
+
const l = e.offset + o, a = l + i, c = qn(t, n, l, a, r, s);
|
|
1188
|
+
if (c.offset !== a)
|
|
1189
|
+
throw new u("E_GROUP_RANGE", `${r} has trailing bytes`);
|
|
1190
|
+
return { chunk: c.chunk, snapshot: c.snapshot };
|
|
1189
1191
|
}
|
|
1190
|
-
function
|
|
1192
|
+
function an(t, n, e) {
|
|
1191
1193
|
if ([
|
|
1192
1194
|
t.getUint32(n + 8, !0),
|
|
1193
1195
|
t.getUint32(n + 12, !0),
|
|
@@ -1195,206 +1197,233 @@ function kn(t, n, e) {
|
|
|
1195
1197
|
t.getUint32(n + 20, !0),
|
|
1196
1198
|
t.getUint32(n + 24, !0),
|
|
1197
1199
|
t.getUint32(n + 28, !0)
|
|
1198
|
-
].some((
|
|
1199
|
-
throw new
|
|
1200
|
+
].some((i) => i !== 0))
|
|
1201
|
+
throw new u("E_GROUP_RANGE", `V3 external variant ${e} must use zero inline geometry offsets`);
|
|
1200
1202
|
}
|
|
1201
|
-
function
|
|
1202
|
-
const
|
|
1203
|
-
if (
|
|
1204
|
-
throw new
|
|
1203
|
+
function lt(t, n, e, o, i, r) {
|
|
1204
|
+
const s = qn(t, n, e, t.byteLength, i, r);
|
|
1205
|
+
if (s.chunk.count !== o)
|
|
1206
|
+
throw new u(
|
|
1205
1207
|
"E_GROUP_RANGE",
|
|
1206
|
-
`${
|
|
1208
|
+
`${i} vertex_count mismatch: manifest=${o}, sidecar=${s.chunk.count}`
|
|
1207
1209
|
);
|
|
1208
|
-
return
|
|
1210
|
+
return s;
|
|
1209
1211
|
}
|
|
1210
|
-
function
|
|
1212
|
+
function Bt(t) {
|
|
1211
1213
|
return "normal" in t ? t.normal : t;
|
|
1212
1214
|
}
|
|
1213
|
-
function
|
|
1214
|
-
const o =
|
|
1215
|
+
function ho(t, n, e) {
|
|
1216
|
+
const o = Bt(t), i = new DataView(n);
|
|
1215
1217
|
let r = 0;
|
|
1216
|
-
const
|
|
1217
|
-
r =
|
|
1218
|
-
const
|
|
1219
|
-
r =
|
|
1220
|
-
const
|
|
1221
|
-
if (r =
|
|
1222
|
-
throw new
|
|
1218
|
+
const s = lt(n, i, r, o.line_count, `V3 external variant ${t.id} line blob`, e);
|
|
1219
|
+
r = s.offset;
|
|
1220
|
+
const l = lt(n, i, r, o.fill_count, `V3 external variant ${t.id} fill blob`, e);
|
|
1221
|
+
r = l.offset;
|
|
1222
|
+
const a = lt(n, i, r, o.dot_count, `V3 external variant ${t.id} dot blob`, e);
|
|
1223
|
+
if (r = a.offset, r !== n.byteLength)
|
|
1224
|
+
throw new u("E_GROUP_RANGE", `V3 external variant ${t.id} sidecar has trailing bytes`);
|
|
1223
1225
|
return {
|
|
1224
|
-
line: { chunk:
|
|
1225
|
-
fill: { chunk:
|
|
1226
|
-
dot: { chunk:
|
|
1226
|
+
line: { chunk: s.chunk, snapshot: s.snapshot },
|
|
1227
|
+
fill: { chunk: l.chunk, snapshot: l.snapshot },
|
|
1228
|
+
dot: { chunk: a.chunk, snapshot: a.snapshot }
|
|
1227
1229
|
};
|
|
1228
1230
|
}
|
|
1229
|
-
function
|
|
1230
|
-
const e =
|
|
1231
|
+
function yo(t, n) {
|
|
1232
|
+
const e = tn(n), o = ot(e, 257, "BLOCK_NORMAL_GEOMETRY"), i = new DataView(n);
|
|
1231
1233
|
let r = o.offset;
|
|
1232
|
-
const
|
|
1233
|
-
r =
|
|
1234
|
-
const
|
|
1235
|
-
r =
|
|
1236
|
-
const
|
|
1237
|
-
if (r =
|
|
1238
|
-
throw new
|
|
1234
|
+
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);
|
|
1235
|
+
r = a.offset;
|
|
1236
|
+
const c = lt(n, i, r, t.normal.fill_count, `V3.3 external variant ${t.id} normal fill blob`, l);
|
|
1237
|
+
r = c.offset;
|
|
1238
|
+
const _ = lt(n, i, r, t.normal.dot_count, `V3.3 external variant ${t.id} normal dot blob`, l);
|
|
1239
|
+
if (r = _.offset, r !== s)
|
|
1240
|
+
throw new u("E_GROUP_RANGE", `V3.3 external variant ${t.id} normal geometry section has trailing bytes`);
|
|
1239
1241
|
return {
|
|
1240
|
-
line: { chunk:
|
|
1241
|
-
fill: { chunk:
|
|
1242
|
-
dot: { chunk:
|
|
1242
|
+
line: { chunk: a.chunk, snapshot: a.snapshot },
|
|
1243
|
+
fill: { chunk: c.chunk, snapshot: c.snapshot },
|
|
1244
|
+
dot: { chunk: _.chunk, snapshot: _.snapshot }
|
|
1243
1245
|
};
|
|
1244
1246
|
}
|
|
1245
|
-
function
|
|
1247
|
+
function wo(t, n, e = "u8") {
|
|
1246
1248
|
if (n.byteLength !== t.raw_size)
|
|
1247
|
-
throw new
|
|
1249
|
+
throw new u(
|
|
1248
1250
|
"E_GROUP_RANGE",
|
|
1249
1251
|
`V3 external variant ${t.id} raw_size mismatch: manifest=${t.raw_size}, sidecar=${n.byteLength}`
|
|
1250
1252
|
);
|
|
1251
|
-
return "normal" in t ?
|
|
1253
|
+
return "normal" in t ? yo(t, n) : ho(t, n, e);
|
|
1252
1254
|
}
|
|
1253
|
-
function
|
|
1255
|
+
function Jn(t, n, e) {
|
|
1254
1256
|
const o = n == null ? void 0 : n.get(t.id);
|
|
1255
1257
|
if (!o)
|
|
1256
|
-
throw new
|
|
1257
|
-
return
|
|
1258
|
+
throw new u("E_GROUP_RANGE", `Missing V3 external sidecar buffer for variant ${t.id}`);
|
|
1259
|
+
return wo(t, o, e);
|
|
1258
1260
|
}
|
|
1259
|
-
function
|
|
1261
|
+
function $t(t, n, e, o, i) {
|
|
1260
1262
|
if (o === 0)
|
|
1261
1263
|
return 0;
|
|
1262
|
-
if (
|
|
1263
|
-
throw new
|
|
1264
|
+
if (_t(e, o, n.length, i), o < 4)
|
|
1265
|
+
throw new u("E_GROUP_RANGE", `Missing ${i} vertex_count`);
|
|
1264
1266
|
return t.getUint32(n.offset + e, !0);
|
|
1265
1267
|
}
|
|
1266
|
-
function
|
|
1267
|
-
const
|
|
1268
|
+
function Ao(t, n, e, o) {
|
|
1269
|
+
const i = e.offset + e.length;
|
|
1268
1270
|
let r = e.offset;
|
|
1269
|
-
const
|
|
1270
|
-
r =
|
|
1271
|
-
const
|
|
1272
|
-
r =
|
|
1273
|
-
const
|
|
1274
|
-
if (r =
|
|
1275
|
-
throw new
|
|
1271
|
+
const s = wt(t, n, r, i, "V3 BASE_GEOMETRY line", o);
|
|
1272
|
+
r = s.offset;
|
|
1273
|
+
const l = wt(t, n, r, i, "V3 BASE_GEOMETRY fill", o);
|
|
1274
|
+
r = l.offset;
|
|
1275
|
+
const a = wt(t, n, r, i, "V3 BASE_GEOMETRY dot", o);
|
|
1276
|
+
if (r = a.offset, r !== i)
|
|
1277
|
+
throw new u("E_GROUP_RANGE", "V3 BASE_GEOMETRY has trailing bytes");
|
|
1276
1278
|
return {
|
|
1277
|
-
line:
|
|
1278
|
-
fill:
|
|
1279
|
-
dot:
|
|
1279
|
+
line: s.chunk,
|
|
1280
|
+
fill: l.chunk,
|
|
1281
|
+
dot: a.chunk
|
|
1280
1282
|
};
|
|
1281
1283
|
}
|
|
1282
|
-
function
|
|
1283
|
-
return
|
|
1284
|
+
function Mt(t) {
|
|
1285
|
+
return Ge(t.pos, t.count, 2);
|
|
1284
1286
|
}
|
|
1285
|
-
function
|
|
1286
|
-
return
|
|
1287
|
+
function Zn(t, n, e) {
|
|
1288
|
+
return pt(pt(Mt(t), Mt(n)), Mt(e));
|
|
1287
1289
|
}
|
|
1288
|
-
function
|
|
1289
|
-
return "normal" in t ?
|
|
1290
|
+
function Ut(t) {
|
|
1291
|
+
return "normal" in t ? ao(t.normal.bbox ?? t.normal.own_bbox ?? null) : null;
|
|
1290
1292
|
}
|
|
1291
|
-
function
|
|
1293
|
+
function Ro(t, n, e, o, i, r, s, l) {
|
|
1292
1294
|
if (e.length % 60 !== 0)
|
|
1293
|
-
throw new
|
|
1294
|
-
const
|
|
1295
|
-
for (let
|
|
1296
|
-
const
|
|
1297
|
-
line:
|
|
1295
|
+
throw new u("E_GROUP_RANGE", "V3 VARIANT_TABLE length must be a multiple of 60");
|
|
1296
|
+
const a = [], c = /* @__PURE__ */ new Map(), _ = [], f = e.length / 60;
|
|
1297
|
+
for (let d = 0; d < f; d += 1) {
|
|
1298
|
+
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)) : {
|
|
1299
|
+
line: Ot(
|
|
1298
1300
|
t,
|
|
1299
1301
|
n,
|
|
1300
1302
|
o,
|
|
1301
|
-
n.getUint32(
|
|
1302
|
-
n.getUint32(
|
|
1303
|
-
`V3 variant ${
|
|
1304
|
-
|
|
1303
|
+
n.getUint32(m + 8, !0),
|
|
1304
|
+
n.getUint32(m + 12, !0),
|
|
1305
|
+
`V3 variant ${d} line blob`,
|
|
1306
|
+
s
|
|
1305
1307
|
),
|
|
1306
|
-
fill:
|
|
1308
|
+
fill: Ot(
|
|
1307
1309
|
t,
|
|
1308
1310
|
n,
|
|
1309
1311
|
o,
|
|
1310
|
-
n.getUint32(
|
|
1311
|
-
n.getUint32(
|
|
1312
|
-
`V3 variant ${
|
|
1313
|
-
|
|
1312
|
+
n.getUint32(m + 16, !0),
|
|
1313
|
+
n.getUint32(m + 20, !0),
|
|
1314
|
+
`V3 variant ${d} fill blob`,
|
|
1315
|
+
s
|
|
1314
1316
|
),
|
|
1315
|
-
dot:
|
|
1317
|
+
dot: Ot(
|
|
1316
1318
|
t,
|
|
1317
1319
|
n,
|
|
1318
1320
|
o,
|
|
1319
|
-
n.getUint32(
|
|
1320
|
-
n.getUint32(
|
|
1321
|
-
`V3 variant ${
|
|
1322
|
-
|
|
1321
|
+
n.getUint32(m + 24, !0),
|
|
1322
|
+
n.getUint32(m + 28, !0),
|
|
1323
|
+
`V3 variant ${d} dot blob`,
|
|
1324
|
+
s
|
|
1323
1325
|
)
|
|
1324
|
-
},
|
|
1325
|
-
id:
|
|
1326
|
-
name:
|
|
1327
|
-
line_count:
|
|
1328
|
-
fill_count:
|
|
1329
|
-
dot_count:
|
|
1330
|
-
sourceLineCount:
|
|
1331
|
-
sourceFillCount:
|
|
1326
|
+
}, 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 = {
|
|
1327
|
+
id: d,
|
|
1328
|
+
name: bt(i, A, y, `V3 variant ${d} name`),
|
|
1329
|
+
line_count: R ? v : w.line.chunk.count,
|
|
1330
|
+
fill_count: R ? U : w.fill.chunk.count,
|
|
1331
|
+
dot_count: R ? D : w.dot.chunk.count,
|
|
1332
|
+
sourceLineCount: v,
|
|
1333
|
+
sourceFillCount: U,
|
|
1332
1334
|
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:
|
|
1335
|
+
nestedStart: n.getUint32(m + 32, !0),
|
|
1336
|
+
nestedCount: n.getUint32(m + 36, !0),
|
|
1337
|
+
textStart: n.getUint32(m + 40, !0),
|
|
1338
|
+
textCount: n.getUint32(m + 44, !0),
|
|
1339
|
+
precisionOriginX: n.getFloat32(m + 48, !0),
|
|
1340
|
+
precisionOriginY: n.getFloat32(m + 52, !0),
|
|
1341
|
+
lineSnapshot: w.line.snapshot,
|
|
1342
|
+
fillSnapshot: w.fill.snapshot,
|
|
1343
|
+
dotSnapshot: w.dot.snapshot,
|
|
1344
|
+
bbox: $
|
|
1343
1345
|
};
|
|
1344
|
-
|
|
1346
|
+
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
1347
|
}
|
|
1346
|
-
return { variantsById:
|
|
1348
|
+
return { variantsById: a, variants: c, snapshots: _ };
|
|
1347
1349
|
}
|
|
1348
|
-
function
|
|
1350
|
+
function Jt(t, n, e, o, i) {
|
|
1349
1351
|
if (n.length % 60 !== 0)
|
|
1350
|
-
throw new
|
|
1351
|
-
const r = [],
|
|
1352
|
-
for (let
|
|
1353
|
-
const
|
|
1354
|
-
|
|
1355
|
-
const
|
|
1352
|
+
throw new u("E_GROUP_RANGE", "V3 VARIANT_TABLE length must be a multiple of 60");
|
|
1353
|
+
const r = [], s = n.length / 60;
|
|
1354
|
+
for (let l = 0; l < s; l += 1) {
|
|
1355
|
+
const a = n.offset + l * 60, c = t.getUint32(a, !0), _ = t.getUint32(a + 4, !0), f = (i == null ? void 0 : i[l]) ?? null;
|
|
1356
|
+
f && an(t, a, l);
|
|
1357
|
+
const d = f ? Bt(f) : null, m = t.getFloat32(a + 48, !0), A = t.getFloat32(a + 52, !0);
|
|
1356
1358
|
r.push({
|
|
1357
|
-
id:
|
|
1358
|
-
name:
|
|
1359
|
-
line_count:
|
|
1359
|
+
id: l,
|
|
1360
|
+
name: bt(o, c, _, `V3 variant ${l} name`),
|
|
1361
|
+
line_count: f ? d.line_count : $t(
|
|
1360
1362
|
t,
|
|
1361
1363
|
e,
|
|
1362
|
-
t.getUint32(
|
|
1363
|
-
t.getUint32(
|
|
1364
|
-
`V3 variant ${
|
|
1364
|
+
t.getUint32(a + 8, !0),
|
|
1365
|
+
t.getUint32(a + 12, !0),
|
|
1366
|
+
`V3 variant ${l} line blob`
|
|
1365
1367
|
),
|
|
1366
|
-
fill_count:
|
|
1368
|
+
fill_count: f ? d.fill_count : $t(
|
|
1367
1369
|
t,
|
|
1368
1370
|
e,
|
|
1369
|
-
t.getUint32(
|
|
1370
|
-
t.getUint32(
|
|
1371
|
-
`V3 variant ${
|
|
1371
|
+
t.getUint32(a + 16, !0),
|
|
1372
|
+
t.getUint32(a + 20, !0),
|
|
1373
|
+
`V3 variant ${l} fill blob`
|
|
1372
1374
|
),
|
|
1373
|
-
dot_count:
|
|
1375
|
+
dot_count: f ? d.dot_count : $t(
|
|
1374
1376
|
t,
|
|
1375
1377
|
e,
|
|
1376
|
-
t.getUint32(
|
|
1377
|
-
t.getUint32(
|
|
1378
|
-
`V3 variant ${
|
|
1378
|
+
t.getUint32(a + 24, !0),
|
|
1379
|
+
t.getUint32(a + 28, !0),
|
|
1380
|
+
`V3 variant ${l} dot blob`
|
|
1379
1381
|
),
|
|
1380
|
-
nestedStart: t.getUint32(
|
|
1381
|
-
nestedCount: t.getUint32(
|
|
1382
|
-
textStart: t.getUint32(
|
|
1383
|
-
textCount: t.getUint32(
|
|
1384
|
-
precisionOriginX:
|
|
1385
|
-
precisionOriginY:
|
|
1386
|
-
bbox:
|
|
1382
|
+
nestedStart: t.getUint32(a + 32, !0),
|
|
1383
|
+
nestedCount: t.getUint32(a + 36, !0),
|
|
1384
|
+
textStart: t.getUint32(a + 40, !0),
|
|
1385
|
+
textCount: t.getUint32(a + 44, !0),
|
|
1386
|
+
precisionOriginX: m,
|
|
1387
|
+
precisionOriginY: A,
|
|
1388
|
+
bbox: f ? Ut(f) : null
|
|
1387
1389
|
});
|
|
1388
1390
|
}
|
|
1389
1391
|
return r;
|
|
1390
1392
|
}
|
|
1393
|
+
function No(t, n, e) {
|
|
1394
|
+
var l;
|
|
1395
|
+
const o = new DataView(t), i = [], r = /* @__PURE__ */ new Map(), s = [];
|
|
1396
|
+
for (const a of n.variantHeaders) {
|
|
1397
|
+
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 ? (() => {
|
|
1398
|
+
const w = n.sections.get(5).offset + a.id * 60;
|
|
1399
|
+
return an(o, w, a.id), !_ || f ? Kn(n.groupLayerEncoding) : Jn(c, e.externalVariantBuffers, n.groupLayerEncoding);
|
|
1400
|
+
})() : n.internalVariants.get(a.id);
|
|
1401
|
+
if (!d)
|
|
1402
|
+
throw new u("E_GROUP_RANGE", `Missing cached V3 variant geometry for variant ${a.id}`);
|
|
1403
|
+
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 = {
|
|
1404
|
+
...a,
|
|
1405
|
+
line_count: f ? A : d.line.chunk.count,
|
|
1406
|
+
fill_count: f ? y : d.fill.chunk.count,
|
|
1407
|
+
dot_count: f ? x : d.dot.chunk.count,
|
|
1408
|
+
sourceLineCount: A,
|
|
1409
|
+
sourceFillCount: y,
|
|
1410
|
+
sourceDotCount: x,
|
|
1411
|
+
lineSnapshot: d.line.snapshot,
|
|
1412
|
+
fillSnapshot: d.fill.snapshot,
|
|
1413
|
+
dotSnapshot: d.dot.snapshot,
|
|
1414
|
+
bbox: h
|
|
1415
|
+
};
|
|
1416
|
+
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 });
|
|
1417
|
+
}
|
|
1418
|
+
return { variantsById: i, variants: r, snapshots: s };
|
|
1419
|
+
}
|
|
1391
1420
|
function Z(t, n, e) {
|
|
1392
1421
|
if (n.length % 32 !== 0)
|
|
1393
|
-
throw new
|
|
1394
|
-
const o = new DataView(t),
|
|
1422
|
+
throw new u("E_GROUP_RANGE", `${e} length must be a multiple of 32`);
|
|
1423
|
+
const o = new DataView(t), i = [];
|
|
1395
1424
|
for (let r = n.offset; r < n.offset + n.length; r += 32) {
|
|
1396
|
-
const
|
|
1397
|
-
|
|
1425
|
+
const s = o.getUint16(r + 30, !0);
|
|
1426
|
+
bo(s), i.push({
|
|
1398
1427
|
variantId: o.getUint32(r, !0),
|
|
1399
1428
|
matA: o.getFloat32(r + 4, !0),
|
|
1400
1429
|
matB: o.getFloat32(r + 8, !0),
|
|
@@ -1403,44 +1432,44 @@ function Z(t, n, e) {
|
|
|
1403
1432
|
tx: o.getFloat32(r + 20, !0),
|
|
1404
1433
|
ty: o.getFloat32(r + 24, !0),
|
|
1405
1434
|
insLayerIdx: o.getUint16(r + 28, !0),
|
|
1406
|
-
flags:
|
|
1435
|
+
flags: s
|
|
1407
1436
|
});
|
|
1408
1437
|
}
|
|
1409
|
-
return
|
|
1438
|
+
return i;
|
|
1410
1439
|
}
|
|
1411
|
-
function
|
|
1412
|
-
const o = t.getUint32(n, !0),
|
|
1440
|
+
function po(t, n, e) {
|
|
1441
|
+
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
1442
|
return {
|
|
1414
|
-
t:
|
|
1443
|
+
t: bt(e, o, i, "V3 text value"),
|
|
1415
1444
|
x: t.getFloat32(n + 8, !0),
|
|
1416
1445
|
y: t.getFloat32(n + 12, !0),
|
|
1417
1446
|
h: t.getFloat32(n + 16, !0),
|
|
1418
1447
|
r: t.getFloat32(n + 20, !0),
|
|
1419
1448
|
c: [t.getUint8(n + 36), t.getUint8(n + 37), t.getUint8(n + 38)],
|
|
1420
1449
|
li: t.getUint16(n + 40, !0),
|
|
1421
|
-
ha:
|
|
1422
|
-
va:
|
|
1450
|
+
ha: Ke[r & 3] ?? "left",
|
|
1451
|
+
va: We[r >> 2 & 3] ?? "alphabetic",
|
|
1423
1452
|
lh: t.getFloat32(n + 32, !0),
|
|
1424
|
-
...
|
|
1425
|
-
...
|
|
1426
|
-
...
|
|
1427
|
-
...
|
|
1453
|
+
...l ? { w: l } : {},
|
|
1454
|
+
...a !== 1 ? { wf: a } : {},
|
|
1455
|
+
...s & 1 ? { mx: !0 } : {},
|
|
1456
|
+
...s & 2 ? { my: !0 } : {}
|
|
1428
1457
|
};
|
|
1429
1458
|
}
|
|
1430
|
-
function
|
|
1459
|
+
function vt(t, n, e, o) {
|
|
1431
1460
|
if (n.length % 44 !== 0)
|
|
1432
|
-
throw new
|
|
1433
|
-
const
|
|
1434
|
-
for (let
|
|
1435
|
-
|
|
1436
|
-
return
|
|
1461
|
+
throw new u("E_GROUP_RANGE", `${o} length must be a multiple of 44`);
|
|
1462
|
+
const i = [], r = new DataView(t);
|
|
1463
|
+
for (let s = n.offset; s < n.offset + n.length; s += 44)
|
|
1464
|
+
i.push(po(r, s, e));
|
|
1465
|
+
return i;
|
|
1437
1466
|
}
|
|
1438
|
-
function
|
|
1467
|
+
function Io(t, n) {
|
|
1439
1468
|
if (t.length % 44 !== 0)
|
|
1440
|
-
throw new
|
|
1469
|
+
throw new u("E_GROUP_RANGE", `${n} length must be a multiple of 44`);
|
|
1441
1470
|
return t.length / 44;
|
|
1442
1471
|
}
|
|
1443
|
-
function
|
|
1472
|
+
function Qn(t, n, e, o) {
|
|
1444
1473
|
return {
|
|
1445
1474
|
instanceId: e,
|
|
1446
1475
|
variantId: n.variantId,
|
|
@@ -1453,187 +1482,189 @@ function Hn(t, n, e, o) {
|
|
|
1453
1482
|
insLayerIdx: o
|
|
1454
1483
|
};
|
|
1455
1484
|
}
|
|
1456
|
-
function
|
|
1485
|
+
function te(t, n, e, o) {
|
|
1457
1486
|
var y;
|
|
1458
|
-
const
|
|
1487
|
+
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
1488
|
return {
|
|
1460
|
-
...
|
|
1489
|
+
...A,
|
|
1461
1490
|
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:
|
|
1491
|
+
y: s,
|
|
1492
|
+
h: t.h * c,
|
|
1493
|
+
w: t.w === void 0 ? void 0 : t.w * c,
|
|
1494
|
+
wf: (t.wf ?? 1) * _,
|
|
1495
|
+
r: f.r,
|
|
1496
|
+
...f.mx ? { mx: !0 } : {},
|
|
1497
|
+
...f.my ? { my: !0 } : {},
|
|
1498
|
+
li: i || t.li === e ? n.insLayerIdx : t.li
|
|
1470
1499
|
};
|
|
1471
1500
|
}
|
|
1472
|
-
function
|
|
1473
|
-
const e = t.r * Math.PI / 180, o = Math.cos(e),
|
|
1474
|
-
return
|
|
1501
|
+
function Vo(t, n) {
|
|
1502
|
+
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;
|
|
1503
|
+
return f < 0 ? { r: Math.atan2(-a, -l) * 180 / Math.PI, mx: !0 } : { r: d };
|
|
1475
1504
|
}
|
|
1476
|
-
function
|
|
1477
|
-
var
|
|
1505
|
+
function Pt(t, n, e, o) {
|
|
1506
|
+
var l;
|
|
1478
1507
|
if (t.count === 0)
|
|
1479
|
-
return
|
|
1480
|
-
const
|
|
1481
|
-
for (let
|
|
1482
|
-
const
|
|
1483
|
-
|
|
1508
|
+
return Vt();
|
|
1509
|
+
const i = new Float32Array(t.count * 2);
|
|
1510
|
+
for (let a = 0; a < t.count; a += 1) {
|
|
1511
|
+
const c = a * 2, _ = t.pos[c], f = t.pos[c + 1];
|
|
1512
|
+
i[c] = n.matA * _ + n.matC * f + n.tx, i[c + 1] = n.matB * _ + n.matD * f + n.ty;
|
|
1484
1513
|
}
|
|
1485
|
-
const r = ((
|
|
1486
|
-
|
|
1487
|
-
(
|
|
1514
|
+
const r = ((l = o[n.insLayerIdx]) == null ? void 0 : l.visible) === !1, s = vn(
|
|
1515
|
+
rt(t),
|
|
1516
|
+
(a) => r || a === e ? n.insLayerIdx : a
|
|
1488
1517
|
);
|
|
1489
|
-
return { pos:
|
|
1518
|
+
return { pos: i, count: t.count, segments: s };
|
|
1490
1519
|
}
|
|
1491
|
-
function
|
|
1492
|
-
const n = t.reduce((r,
|
|
1520
|
+
function Dt(t) {
|
|
1521
|
+
const n = t.reduce((r, s) => r + s.count, 0);
|
|
1493
1522
|
if (n === 0)
|
|
1494
|
-
return
|
|
1523
|
+
return Vt();
|
|
1495
1524
|
const e = new Float32Array(n * 2), o = [];
|
|
1496
|
-
let
|
|
1525
|
+
let i = 0;
|
|
1497
1526
|
for (const r of t)
|
|
1498
|
-
e.set(r.pos,
|
|
1499
|
-
return { pos: e, count: n, segments:
|
|
1527
|
+
e.set(r.pos, i * 2), o.push(...qt(rt(r), i)), i += r.count;
|
|
1528
|
+
return { pos: e, count: n, segments: mt(o) };
|
|
1500
1529
|
}
|
|
1501
|
-
function
|
|
1530
|
+
function ne(t, n) {
|
|
1502
1531
|
return t === n ? n : t;
|
|
1503
1532
|
}
|
|
1504
|
-
function
|
|
1533
|
+
function ee(t, n, e) {
|
|
1505
1534
|
return t === e ? n : t;
|
|
1506
1535
|
}
|
|
1507
|
-
function
|
|
1508
|
-
const
|
|
1509
|
-
bounds:
|
|
1510
|
-
entity_count: Number(
|
|
1511
|
-
line_count: Number(
|
|
1512
|
-
fill_count: Number(
|
|
1513
|
-
dot_count: Number(
|
|
1514
|
-
layers:
|
|
1536
|
+
function oe(t, n, e) {
|
|
1537
|
+
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({
|
|
1538
|
+
bounds: R.bounds ?? [0, 0, 0, 0],
|
|
1539
|
+
entity_count: Number(R.entity_count ?? 0),
|
|
1540
|
+
line_count: Number(R.base_line_count ?? 0),
|
|
1541
|
+
fill_count: Number(R.base_fill_count ?? 0),
|
|
1542
|
+
dot_count: Number(R.base_dot_count ?? 0),
|
|
1543
|
+
layers: M,
|
|
1515
1544
|
texts: []
|
|
1516
1545
|
});
|
|
1517
|
-
|
|
1518
|
-
const
|
|
1546
|
+
ie(Y, z.layers);
|
|
1547
|
+
const S = (e == null ? void 0 : e.baseGeometry) ?? Ao(t, o, f, l);
|
|
1519
1548
|
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
|
|
1549
|
+
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");
|
|
1550
|
+
if (Number(R.variant_count ?? g.length) !== g.length)
|
|
1551
|
+
throw new u("E_GROUP_RANGE", "V3 variant count mismatch");
|
|
1552
|
+
if (Number(R.scene_instance_count ?? I.length) !== I.length)
|
|
1553
|
+
throw new u("E_GROUP_RANGE", "V3 scene instance count mismatch");
|
|
1554
|
+
if (Number(R.nested_instance_count ?? k.length) !== k.length)
|
|
1555
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance count mismatch");
|
|
1556
|
+
if (Number(R.scene_text_count ?? L.length) !== L.length)
|
|
1557
|
+
throw new u("E_GROUP_RANGE", "V3 scene text count mismatch");
|
|
1558
|
+
if (Number(R.variant_text_count ?? F) !== F)
|
|
1559
|
+
throw new u("E_GROUP_RANGE", "V3 variant text count mismatch");
|
|
1560
|
+
for (const G of g) {
|
|
1561
|
+
if (G.nestedStart + G.nestedCount > k.length)
|
|
1562
|
+
throw new u("E_GROUP_RANGE", `V3 variant ${G.id} nested range exceeds table`);
|
|
1563
|
+
if (G.textStart + G.textCount > F)
|
|
1564
|
+
throw new u("E_GROUP_RANGE", `V3 variant ${G.id} text range exceeds table`);
|
|
1536
1565
|
}
|
|
1537
|
-
return
|
|
1538
|
-
if (!g[
|
|
1539
|
-
throw new
|
|
1540
|
-
|
|
1566
|
+
return Rt(I, k, (G) => {
|
|
1567
|
+
if (!g[G.variantId])
|
|
1568
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${G.variantId}`);
|
|
1569
|
+
Zt(G.insLayerIdx, M.length);
|
|
1541
1570
|
}), {
|
|
1542
1571
|
meta: {
|
|
1543
|
-
bounds:
|
|
1544
|
-
entity_count: Number(
|
|
1545
|
-
line_count:
|
|
1546
|
-
fill_count:
|
|
1547
|
-
dot_count:
|
|
1572
|
+
bounds: R.bounds ?? [0, 0, 0, 0],
|
|
1573
|
+
entity_count: Number(R.entity_count ?? 0),
|
|
1574
|
+
line_count: S.line.count,
|
|
1575
|
+
fill_count: S.fill.count,
|
|
1576
|
+
dot_count: S.dot.count,
|
|
1548
1577
|
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:
|
|
1578
|
+
version_minor: r,
|
|
1579
|
+
encoding: D,
|
|
1580
|
+
...U ? { features: U } : {},
|
|
1581
|
+
...w ? { external_variants: [...w] } : {},
|
|
1582
|
+
...v ? { external_annotations: v } : {},
|
|
1583
|
+
layer0_index: Y,
|
|
1584
|
+
block_variants: g.map((G) => ({
|
|
1585
|
+
id: G.id,
|
|
1586
|
+
name: G.name,
|
|
1587
|
+
line_count: G.line_count,
|
|
1588
|
+
fill_count: G.fill_count,
|
|
1589
|
+
dot_count: G.dot_count
|
|
1561
1590
|
})),
|
|
1562
1591
|
instance_count: I.length,
|
|
1563
|
-
layers:
|
|
1592
|
+
layers: M,
|
|
1564
1593
|
texts: L
|
|
1565
1594
|
},
|
|
1566
1595
|
header: {
|
|
1567
|
-
|
|
1568
|
-
lineCount:
|
|
1569
|
-
fillCount:
|
|
1570
|
-
dotCount:
|
|
1596
|
+
...z,
|
|
1597
|
+
lineCount: S.line.count,
|
|
1598
|
+
fillCount: S.fill.count,
|
|
1599
|
+
dotCount: S.dot.count,
|
|
1571
1600
|
textCount: L.length,
|
|
1572
1601
|
texts: L
|
|
1573
1602
|
},
|
|
1574
1603
|
decoded: {
|
|
1575
|
-
baseLine:
|
|
1576
|
-
baseFill:
|
|
1577
|
-
baseDot:
|
|
1604
|
+
baseLine: S.line,
|
|
1605
|
+
baseFill: S.fill,
|
|
1606
|
+
baseDot: S.dot,
|
|
1578
1607
|
variants: /* @__PURE__ */ new Map(),
|
|
1579
1608
|
instances: [],
|
|
1580
1609
|
instanceIdByVariantOrdinal: /* @__PURE__ */ new Map()
|
|
1581
1610
|
}
|
|
1582
1611
|
};
|
|
1583
1612
|
}
|
|
1584
|
-
const
|
|
1613
|
+
const N = e ? No(t, e, n) : Ro(
|
|
1585
1614
|
t,
|
|
1586
|
-
|
|
1587
|
-
h,
|
|
1615
|
+
o,
|
|
1588
1616
|
d,
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1617
|
+
m,
|
|
1618
|
+
$,
|
|
1619
|
+
w,
|
|
1620
|
+
l,
|
|
1592
1621
|
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
|
|
1622
|
+
), { 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");
|
|
1623
|
+
if (Number(R.variant_count ?? E.length) !== E.length)
|
|
1624
|
+
throw new u("E_GROUP_RANGE", "V3 variant count mismatch");
|
|
1625
|
+
if (Number(R.scene_instance_count ?? C.length) !== C.length)
|
|
1626
|
+
throw new u("E_GROUP_RANGE", "V3 scene instance count mismatch");
|
|
1627
|
+
if (Number(R.nested_instance_count ?? b.length) !== b.length)
|
|
1628
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance count mismatch");
|
|
1629
|
+
if (Number(R.scene_text_count ?? B.length) !== B.length)
|
|
1630
|
+
throw new u("E_GROUP_RANGE", "V3 scene text count mismatch");
|
|
1631
|
+
if (Number(R.variant_text_count ?? O.length) !== O.length)
|
|
1632
|
+
throw new u("E_GROUP_RANGE", "V3 variant text count mismatch");
|
|
1633
|
+
for (const g of E) {
|
|
1634
|
+
if (g.nestedStart + g.nestedCount > b.length)
|
|
1635
|
+
throw new u("E_GROUP_RANGE", `V3 variant ${g.id} nested range exceeds table`);
|
|
1636
|
+
if (g.textStart + g.textCount > O.length)
|
|
1637
|
+
throw new u("E_GROUP_RANGE", `V3 variant ${g.id} text range exceeds table`);
|
|
1609
1638
|
}
|
|
1610
|
-
|
|
1611
|
-
if (!
|
|
1612
|
-
throw new
|
|
1613
|
-
|
|
1639
|
+
Rt(C, b, (g) => {
|
|
1640
|
+
if (!E[g.variantId])
|
|
1641
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${g.variantId}`);
|
|
1642
|
+
Zt(g.insLayerIdx, M.length);
|
|
1614
1643
|
});
|
|
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
|
-
|
|
1644
|
+
const j = (e == null ? void 0 : e.variantTextsByVariantId) ?? (() => {
|
|
1645
|
+
const g = /* @__PURE__ */ new Map();
|
|
1646
|
+
for (const I of E)
|
|
1647
|
+
g.set(
|
|
1648
|
+
I.id,
|
|
1649
|
+
O.slice(I.textStart, I.textStart + I.textCount)
|
|
1650
|
+
);
|
|
1651
|
+
return g;
|
|
1652
|
+
})(), H = [], X = n.externalVariantDeltaOnly, gt = X ? [] : [...B], ct = /* @__PURE__ */ new Map(), it = /* @__PURE__ */ new Map(), un = /* @__PURE__ */ new Map(), le = (g, I) => {
|
|
1653
|
+
ct.set(g, pt(ct.get(g) ?? null, I));
|
|
1654
|
+
}, cn = (g, I, k, L, F, tt) => {
|
|
1655
|
+
var xn;
|
|
1656
|
+
if (F > 64)
|
|
1657
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance depth exceeds limit");
|
|
1658
|
+
if (tt.has(g))
|
|
1659
|
+
throw new u("E_GROUP_RANGE", `V3 nested variant cycle detected at ${g}`);
|
|
1660
|
+
const G = E[g];
|
|
1661
|
+
if (!G)
|
|
1662
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${g}`);
|
|
1663
|
+
tt.add(g);
|
|
1664
|
+
const nt = !n.requiredExternalVariantIds || n.requiredExternalVariantIds.has(g), W = X ? ((xn = n.requiredExternalVariantIds) == null ? void 0 : xn.has(g)) === !0 : nt;
|
|
1665
|
+
let q = !1;
|
|
1666
|
+
const En = !!(G.line_count || G.fill_count || G.dot_count), de = G.textCount > 0;
|
|
1667
|
+
if (W && (En || de) && (H.push({
|
|
1637
1668
|
instanceId: I.instanceId,
|
|
1638
1669
|
variantId: g,
|
|
1639
1670
|
matA: I.matA,
|
|
@@ -1643,29 +1674,29 @@ function Wn(t, n) {
|
|
|
1643
1674
|
tx: I.tx,
|
|
1644
1675
|
ty: I.ty,
|
|
1645
1676
|
insLayerIdx: I.insLayerIdx
|
|
1646
|
-
}),
|
|
1647
|
-
|
|
1648
|
-
for (let
|
|
1649
|
-
const
|
|
1650
|
-
|
|
1651
|
-
...
|
|
1652
|
-
iv:
|
|
1677
|
+
}), En && le(I.instanceId, G.bbox ? re(G.bbox, I) : null), q = !0), W) {
|
|
1678
|
+
G.textCount > 0 && (q = !0);
|
|
1679
|
+
for (let et = 0; et < G.textCount; et += 1) {
|
|
1680
|
+
const st = te(O[G.textStart + et], I, Y, z.layers);
|
|
1681
|
+
gt.push({
|
|
1682
|
+
...st,
|
|
1683
|
+
iv: k,
|
|
1653
1684
|
io: L
|
|
1654
1685
|
});
|
|
1655
1686
|
}
|
|
1656
1687
|
}
|
|
1657
|
-
for (let
|
|
1658
|
-
const
|
|
1659
|
-
|
|
1688
|
+
for (let et = 0; et < G.nestedCount; et += 1) {
|
|
1689
|
+
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);
|
|
1690
|
+
q = cn(st.variantId, Ee, k, L, F + 1, tt) || q;
|
|
1660
1691
|
}
|
|
1661
|
-
return
|
|
1662
|
-
},
|
|
1663
|
-
|
|
1664
|
-
if (!
|
|
1665
|
-
throw new
|
|
1666
|
-
const L =
|
|
1667
|
-
|
|
1668
|
-
const
|
|
1692
|
+
return tt.delete(g), q;
|
|
1693
|
+
}, St = /* @__PURE__ */ new Map();
|
|
1694
|
+
C.forEach((g, I) => {
|
|
1695
|
+
if (!E[g.variantId])
|
|
1696
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 scene variantId ${g.variantId}`);
|
|
1697
|
+
const L = un.get(g.variantId) ?? 0;
|
|
1698
|
+
un.set(g.variantId, L + 1), it.set(`${g.variantId}:${L}`, I);
|
|
1699
|
+
const F = ne(g.insLayerIdx, Y), tt = {
|
|
1669
1700
|
instanceId: I,
|
|
1670
1701
|
variantId: g.variantId,
|
|
1671
1702
|
matA: g.matA,
|
|
@@ -1674,207 +1705,247 @@ function Wn(t, n) {
|
|
|
1674
1705
|
matD: g.matD,
|
|
1675
1706
|
tx: g.tx,
|
|
1676
1707
|
ty: g.ty,
|
|
1677
|
-
insLayerIdx:
|
|
1678
|
-
},
|
|
1679
|
-
if (
|
|
1708
|
+
insLayerIdx: F
|
|
1709
|
+
}, G = cn(g.variantId, tt, g.variantId, L, 0, /* @__PURE__ */ new Set());
|
|
1710
|
+
if (X && !G)
|
|
1680
1711
|
return;
|
|
1681
|
-
let
|
|
1682
|
-
|
|
1683
|
-
let W =
|
|
1684
|
-
W || (W = { count: 0, bboxes: [], inserts: [] },
|
|
1685
|
-
const
|
|
1686
|
-
|
|
1712
|
+
let nt = St.get(F);
|
|
1713
|
+
nt || (nt = /* @__PURE__ */ new Map(), St.set(F, nt));
|
|
1714
|
+
let W = nt.get(g.variantId);
|
|
1715
|
+
W || (W = { count: 0, bboxes: [], inserts: [] }, nt.set(g.variantId, W)), W.count += 1;
|
|
1716
|
+
const q = ct.get(I) ?? null;
|
|
1717
|
+
q && W.bboxes.push(q), W.inserts.push({
|
|
1687
1718
|
instanceId: I,
|
|
1688
1719
|
variantId: g.variantId,
|
|
1689
1720
|
label: `#${I + 1} (${g.tx.toFixed(1)}, ${g.ty.toFixed(1)})`,
|
|
1690
1721
|
tx: g.tx,
|
|
1691
1722
|
ty: g.ty,
|
|
1692
|
-
canHighlight:
|
|
1693
|
-
...
|
|
1723
|
+
canHighlight: q !== null,
|
|
1724
|
+
...q ? { bbox: q } : {}
|
|
1694
1725
|
});
|
|
1695
1726
|
});
|
|
1696
|
-
const
|
|
1697
|
-
for (const [g, I] of
|
|
1698
|
-
const
|
|
1699
|
-
for (const [L,
|
|
1700
|
-
|
|
1727
|
+
const fn = /* @__PURE__ */ new Map();
|
|
1728
|
+
for (const [g, I] of St) {
|
|
1729
|
+
const k = [];
|
|
1730
|
+
for (const [L, F] of I)
|
|
1731
|
+
k.push({
|
|
1701
1732
|
variantId: L,
|
|
1702
|
-
blockName:
|
|
1703
|
-
instanceCount:
|
|
1704
|
-
bboxes:
|
|
1705
|
-
inserts:
|
|
1733
|
+
blockName: Ln(E[L], L),
|
|
1734
|
+
instanceCount: F.count,
|
|
1735
|
+
bboxes: F.bboxes,
|
|
1736
|
+
inserts: F.inserts
|
|
1706
1737
|
});
|
|
1707
|
-
|
|
1738
|
+
k.sort((L, F) => F.instanceCount - L.instanceCount), fn.set(g, k);
|
|
1708
1739
|
}
|
|
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) || (
|
|
1740
|
+
let dn = X ? 0 : S.line.count, mn = X ? 0 : S.fill.count, _n = X ? 0 : S.dot.count;
|
|
1741
|
+
for (const g of H) {
|
|
1742
|
+
const I = E[g.variantId];
|
|
1743
|
+
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
1744
|
}
|
|
1714
|
-
const
|
|
1715
|
-
bounds:
|
|
1716
|
-
entity_count:
|
|
1717
|
-
line_count:
|
|
1718
|
-
fill_count:
|
|
1719
|
-
dot_count:
|
|
1745
|
+
const ht = no(gt, it, n), ue = {
|
|
1746
|
+
bounds: R.bounds ?? [0, 0, 0, 0],
|
|
1747
|
+
entity_count: X ? 0 : Number(R.entity_count ?? 0),
|
|
1748
|
+
line_count: S.line.count,
|
|
1749
|
+
fill_count: S.fill.count,
|
|
1750
|
+
dot_count: S.dot.count,
|
|
1720
1751
|
version: 3,
|
|
1721
|
-
version_minor:
|
|
1722
|
-
encoding:
|
|
1723
|
-
...
|
|
1724
|
-
...
|
|
1725
|
-
...
|
|
1726
|
-
layer0_index:
|
|
1727
|
-
block_variants:
|
|
1752
|
+
version_minor: r,
|
|
1753
|
+
encoding: D,
|
|
1754
|
+
...U ? { features: U } : {},
|
|
1755
|
+
...w ? { external_variants: [...w] } : {},
|
|
1756
|
+
...v ? { external_annotations: v } : {},
|
|
1757
|
+
layer0_index: Y,
|
|
1758
|
+
block_variants: E.map((g) => ({
|
|
1728
1759
|
id: g.id,
|
|
1729
1760
|
name: g.name,
|
|
1730
1761
|
line_count: g.sourceLineCount,
|
|
1731
1762
|
fill_count: g.sourceFillCount,
|
|
1732
1763
|
dot_count: g.sourceDotCount
|
|
1733
1764
|
})),
|
|
1734
|
-
instance_count:
|
|
1735
|
-
layers:
|
|
1736
|
-
texts:
|
|
1737
|
-
},
|
|
1738
|
-
|
|
1739
|
-
entityCount:
|
|
1740
|
-
lineCount:
|
|
1741
|
-
fillCount:
|
|
1742
|
-
dotCount:
|
|
1743
|
-
textCount:
|
|
1744
|
-
texts:
|
|
1765
|
+
instance_count: C.length,
|
|
1766
|
+
layers: M,
|
|
1767
|
+
texts: ht
|
|
1768
|
+
}, ce = {
|
|
1769
|
+
...z,
|
|
1770
|
+
entityCount: X ? 0 : z.entityCount,
|
|
1771
|
+
lineCount: dn,
|
|
1772
|
+
fillCount: mn,
|
|
1773
|
+
dotCount: _n,
|
|
1774
|
+
textCount: ht.length,
|
|
1775
|
+
texts: ht,
|
|
1745
1776
|
...n.loadBlocks ? {
|
|
1746
|
-
layerBlockUsages:
|
|
1747
|
-
insertRuntime:
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1777
|
+
layerBlockUsages: fn,
|
|
1778
|
+
insertRuntime: oo(
|
|
1779
|
+
Y,
|
|
1780
|
+
E,
|
|
1781
|
+
T,
|
|
1782
|
+
j,
|
|
1783
|
+
H,
|
|
1784
|
+
ht,
|
|
1785
|
+
it
|
|
1755
1786
|
)
|
|
1756
1787
|
} : {}
|
|
1757
|
-
}
|
|
1788
|
+
}, fe = e ?? (n.cacheDocument ? (() => {
|
|
1789
|
+
const g = /* @__PURE__ */ new Map();
|
|
1790
|
+
for (const [I, k] of V)
|
|
1791
|
+
w != null && w[I] || g.set(I, {
|
|
1792
|
+
line: { chunk: k.line, snapshot: T[I].line },
|
|
1793
|
+
fill: { chunk: k.fill, snapshot: T[I].fill },
|
|
1794
|
+
dot: { chunk: k.dot, snapshot: T[I].dot }
|
|
1795
|
+
});
|
|
1796
|
+
return {
|
|
1797
|
+
kind: "dxb3-v3",
|
|
1798
|
+
buffer: t,
|
|
1799
|
+
versionMinor: r,
|
|
1800
|
+
sections: s,
|
|
1801
|
+
groupLayerEncoding: l,
|
|
1802
|
+
sceneMeta: R,
|
|
1803
|
+
externalVariants: w,
|
|
1804
|
+
externalAnnotations: v,
|
|
1805
|
+
geoMetaFeatures: U,
|
|
1806
|
+
geoMetaEncoding: D,
|
|
1807
|
+
stringTable: $,
|
|
1808
|
+
layers: M,
|
|
1809
|
+
layer0Index: Y,
|
|
1810
|
+
headerForValidation: z,
|
|
1811
|
+
baseGeometry: S,
|
|
1812
|
+
variantHeaders: Jt(
|
|
1813
|
+
o,
|
|
1814
|
+
d,
|
|
1815
|
+
m,
|
|
1816
|
+
$,
|
|
1817
|
+
w
|
|
1818
|
+
),
|
|
1819
|
+
internalVariants: g,
|
|
1820
|
+
sceneInstances: C,
|
|
1821
|
+
nestedInstances: b,
|
|
1822
|
+
sceneTexts: B,
|
|
1823
|
+
variantTexts: O,
|
|
1824
|
+
variantTextCount: O.length,
|
|
1825
|
+
variantTextsByVariantId: j
|
|
1826
|
+
};
|
|
1827
|
+
})() : void 0);
|
|
1758
1828
|
return {
|
|
1759
|
-
meta:
|
|
1760
|
-
header:
|
|
1829
|
+
meta: ue,
|
|
1830
|
+
header: ce,
|
|
1831
|
+
documentCache: fe,
|
|
1761
1832
|
decoded: {
|
|
1762
|
-
baseLine:
|
|
1763
|
-
baseFill:
|
|
1764
|
-
baseDot:
|
|
1765
|
-
variants:
|
|
1766
|
-
instances:
|
|
1767
|
-
instanceIdByVariantOrdinal:
|
|
1833
|
+
baseLine: X ? kt() : S.line,
|
|
1834
|
+
baseFill: X ? kt() : S.fill,
|
|
1835
|
+
baseDot: X ? kt() : S.dot,
|
|
1836
|
+
variants: V,
|
|
1837
|
+
instances: H,
|
|
1838
|
+
instanceIdByVariantOrdinal: it
|
|
1768
1839
|
}
|
|
1769
1840
|
};
|
|
1770
1841
|
}
|
|
1771
|
-
function
|
|
1842
|
+
function Vn(t) {
|
|
1772
1843
|
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
1844
|
}
|
|
1774
|
-
function
|
|
1845
|
+
function Go(t, n) {
|
|
1775
1846
|
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
|
|
1847
|
+
throw new u(
|
|
1777
1848
|
"E_GROUP_RANGE",
|
|
1778
1849
|
`V3.3 external variant ${t.id} annotation count mismatch`
|
|
1779
1850
|
);
|
|
1780
1851
|
}
|
|
1781
|
-
function
|
|
1852
|
+
function To(t, n, e, o, i, r) {
|
|
1782
1853
|
return {
|
|
1783
|
-
line:
|
|
1784
|
-
fill:
|
|
1785
|
-
dot:
|
|
1786
|
-
texts: t.texts.map((
|
|
1787
|
-
...
|
|
1788
|
-
iv:
|
|
1854
|
+
line: Pt(t.line, n, e, o),
|
|
1855
|
+
fill: Pt(t.fill, n, e, o),
|
|
1856
|
+
dot: Pt(t.dot, n, e, o),
|
|
1857
|
+
texts: t.texts.map((s) => ({
|
|
1858
|
+
...te(s, n, e, o),
|
|
1859
|
+
iv: i,
|
|
1789
1860
|
io: r
|
|
1790
1861
|
}))
|
|
1791
1862
|
};
|
|
1792
1863
|
}
|
|
1793
|
-
function
|
|
1794
|
-
if (!
|
|
1864
|
+
function Yo(t, n) {
|
|
1865
|
+
if (!Q(t))
|
|
1795
1866
|
return null;
|
|
1796
|
-
const e = new DataView(t), { sections: o } =
|
|
1797
|
-
if (!
|
|
1867
|
+
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");
|
|
1868
|
+
if (!sn(f))
|
|
1798
1869
|
return null;
|
|
1799
|
-
const
|
|
1800
|
-
if (!
|
|
1870
|
+
const d = Tt(f, l.length / 60);
|
|
1871
|
+
if (!d.some(Vn))
|
|
1801
1872
|
return null;
|
|
1802
|
-
const
|
|
1803
|
-
bounds:
|
|
1804
|
-
entity_count: Number(
|
|
1805
|
-
line_count: Number(
|
|
1806
|
-
fill_count: Number(
|
|
1807
|
-
dot_count: Number(
|
|
1808
|
-
layers:
|
|
1873
|
+
const m = new Uint8Array(t, s.offset, s.length), A = jn(t, r, m), y = Number(f.layer0_index ?? 0), x = en({
|
|
1874
|
+
bounds: f.bounds ?? [0, 0, 0, 0],
|
|
1875
|
+
entity_count: Number(f.entity_count ?? 0),
|
|
1876
|
+
line_count: Number(f.base_line_count ?? 0),
|
|
1877
|
+
fill_count: Number(f.base_fill_count ?? 0),
|
|
1878
|
+
dot_count: Number(f.base_dot_count ?? 0),
|
|
1879
|
+
layers: A,
|
|
1809
1880
|
texts: []
|
|
1810
1881
|
});
|
|
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
|
-
|
|
1882
|
+
ie(y, x.layers);
|
|
1883
|
+
const h = Jt(e, l, a, m, d), R = Z(t, c, "V3 SCENE_INSTANCE_TABLE"), w = Z(t, _, "V3 NESTED_INSTANCE_TABLE");
|
|
1884
|
+
if (Number(f.variant_count ?? h.length) !== h.length)
|
|
1885
|
+
throw new u("E_GROUP_RANGE", "V3 variant count mismatch");
|
|
1886
|
+
if (Number(f.scene_instance_count ?? R.length) !== R.length)
|
|
1887
|
+
throw new u("E_GROUP_RANGE", "V3 scene instance count mismatch");
|
|
1888
|
+
if (Number(f.nested_instance_count ?? w.length) !== w.length)
|
|
1889
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance count mismatch");
|
|
1890
|
+
for (const E of h)
|
|
1891
|
+
if (E.nestedStart + E.nestedCount > w.length)
|
|
1892
|
+
throw new u("E_GROUP_RANGE", `V3 variant ${E.id} nested range exceeds table`);
|
|
1893
|
+
Rt(R, w, (E) => {
|
|
1894
|
+
if (!h[E.variantId])
|
|
1895
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${E.variantId}`);
|
|
1896
|
+
Zt(E.insLayerIdx, A.length);
|
|
1826
1897
|
});
|
|
1827
|
-
const
|
|
1828
|
-
var
|
|
1829
|
-
const
|
|
1830
|
-
if (!
|
|
1898
|
+
const p = /* @__PURE__ */ new Map(), v = (E) => {
|
|
1899
|
+
var B;
|
|
1900
|
+
const V = d[E];
|
|
1901
|
+
if (!V || !Vn(V))
|
|
1831
1902
|
return null;
|
|
1832
|
-
const
|
|
1833
|
-
if (
|
|
1834
|
-
return
|
|
1835
|
-
const
|
|
1836
|
-
if (!
|
|
1903
|
+
const T = p.get(E);
|
|
1904
|
+
if (T)
|
|
1905
|
+
return T;
|
|
1906
|
+
const C = (B = n == null ? void 0 : n.externalVariantBuffers) == null ? void 0 : B.get(V.id);
|
|
1907
|
+
if (!C)
|
|
1837
1908
|
return null;
|
|
1838
|
-
if (
|
|
1839
|
-
throw new
|
|
1909
|
+
if (C.byteLength !== V.raw_size)
|
|
1910
|
+
throw new u(
|
|
1840
1911
|
"E_GROUP_RANGE",
|
|
1841
|
-
`V3.3 annotation sidecar ${
|
|
1912
|
+
`V3.3 annotation sidecar ${V.id} raw_size mismatch: manifest=${V.raw_size}, sidecar=${C.byteLength}`
|
|
1842
1913
|
);
|
|
1843
|
-
const
|
|
1844
|
-
return
|
|
1845
|
-
},
|
|
1846
|
-
const
|
|
1914
|
+
const b = Xe(C);
|
|
1915
|
+
return Go(V, b), p.set(E, b), b;
|
|
1916
|
+
}, U = [], D = [], $ = [], M = [], Y = (n == null ? void 0 : n.hiddenInstanceIds) ?? /* @__PURE__ */ new Set(), z = (E, V, T, C) => {
|
|
1917
|
+
const b = To(
|
|
1847
1918
|
E,
|
|
1848
|
-
|
|
1919
|
+
V,
|
|
1849
1920
|
y,
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1921
|
+
x.layers,
|
|
1922
|
+
T,
|
|
1923
|
+
C
|
|
1853
1924
|
);
|
|
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
|
-
|
|
1925
|
+
U.push(b.line), D.push(b.fill), $.push(b.dot), M.push(...b.texts);
|
|
1926
|
+
}, S = (E, V, T, C, b, B) => {
|
|
1927
|
+
if (b > 64)
|
|
1928
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance depth exceeds limit");
|
|
1929
|
+
if (B.has(E))
|
|
1930
|
+
throw new u("E_GROUP_RANGE", `V3 nested variant cycle detected at ${E}`);
|
|
1931
|
+
const O = h[E];
|
|
1932
|
+
if (!O)
|
|
1933
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${E}`);
|
|
1934
|
+
B.add(E);
|
|
1935
|
+
const j = v(E);
|
|
1936
|
+
j && z(j, V, T, C);
|
|
1937
|
+
for (let H = 0; H < O.nestedCount; H += 1) {
|
|
1938
|
+
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);
|
|
1939
|
+
S(X.variantId, it, T, C, b + 1, B);
|
|
1869
1940
|
}
|
|
1870
|
-
|
|
1871
|
-
},
|
|
1872
|
-
return
|
|
1873
|
-
const
|
|
1874
|
-
if (
|
|
1941
|
+
B.delete(E);
|
|
1942
|
+
}, N = /* @__PURE__ */ new Map();
|
|
1943
|
+
return R.forEach((E, V) => {
|
|
1944
|
+
const T = N.get(E.variantId) ?? 0;
|
|
1945
|
+
if (N.set(E.variantId, T + 1), Y.has(V))
|
|
1875
1946
|
return;
|
|
1876
|
-
const
|
|
1877
|
-
instanceId:
|
|
1947
|
+
const C = ne(E.insLayerIdx, y), b = {
|
|
1948
|
+
instanceId: V,
|
|
1878
1949
|
variantId: E.variantId,
|
|
1879
1950
|
matA: E.matA,
|
|
1880
1951
|
matB: E.matB,
|
|
@@ -1882,30 +1953,30 @@ function Po(t, n) {
|
|
|
1882
1953
|
matD: E.matD,
|
|
1883
1954
|
tx: E.tx,
|
|
1884
1955
|
ty: E.ty,
|
|
1885
|
-
insLayerIdx:
|
|
1956
|
+
insLayerIdx: C
|
|
1886
1957
|
};
|
|
1887
|
-
|
|
1888
|
-
}),
|
|
1889
|
-
line:
|
|
1890
|
-
fill:
|
|
1891
|
-
dot:
|
|
1892
|
-
texts:
|
|
1958
|
+
S(E.variantId, b, E.variantId, T, 0, /* @__PURE__ */ new Set());
|
|
1959
|
+
}), U.every((E) => E.count === 0) && D.every((E) => E.count === 0) && $.every((E) => E.count === 0) && M.length === 0 ? null : {
|
|
1960
|
+
line: Dt(U),
|
|
1961
|
+
fill: Dt(D),
|
|
1962
|
+
dot: Dt($),
|
|
1963
|
+
texts: M
|
|
1893
1964
|
};
|
|
1894
1965
|
}
|
|
1895
|
-
function
|
|
1896
|
-
return
|
|
1966
|
+
function pt(t, n) {
|
|
1967
|
+
return pe(t, n);
|
|
1897
1968
|
}
|
|
1898
|
-
function
|
|
1899
|
-
return
|
|
1969
|
+
function re(t, n) {
|
|
1970
|
+
return On(t, n);
|
|
1900
1971
|
}
|
|
1901
|
-
function
|
|
1902
|
-
return
|
|
1972
|
+
function Gn(t) {
|
|
1973
|
+
return Te(t);
|
|
1903
1974
|
}
|
|
1904
|
-
function
|
|
1905
|
-
return
|
|
1975
|
+
function Tn(t, n) {
|
|
1976
|
+
return be(t, n);
|
|
1906
1977
|
}
|
|
1907
|
-
function
|
|
1908
|
-
return
|
|
1978
|
+
function It(t, n) {
|
|
1979
|
+
return re(t, {
|
|
1909
1980
|
variantId: n.variantId,
|
|
1910
1981
|
matA: n.matA,
|
|
1911
1982
|
matB: n.matB,
|
|
@@ -1916,168 +1987,168 @@ function pt(t, n) {
|
|
|
1916
1987
|
insLayerIdx: n.insLayerIdx
|
|
1917
1988
|
});
|
|
1918
1989
|
}
|
|
1919
|
-
function
|
|
1990
|
+
function ln(t, n, e) {
|
|
1920
1991
|
if (!(e != null && e.bbox) || !n.bbox)
|
|
1921
1992
|
return t;
|
|
1922
|
-
const o = n.precisionOriginX,
|
|
1923
|
-
if (!Number.isFinite(o) || !Number.isFinite(
|
|
1993
|
+
const o = n.precisionOriginX, i = n.precisionOriginY;
|
|
1994
|
+
if (!Number.isFinite(o) || !Number.isFinite(i) || o === 0 && i === 0)
|
|
1924
1995
|
return t;
|
|
1925
1996
|
const r = {
|
|
1926
1997
|
...t,
|
|
1927
1998
|
tx: t.tx - o,
|
|
1928
|
-
ty: t.ty -
|
|
1929
|
-
},
|
|
1930
|
-
if (
|
|
1999
|
+
ty: t.ty - i
|
|
2000
|
+
}, 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);
|
|
2001
|
+
if (c <= a * 16 || _ <= a * 16)
|
|
1931
2002
|
return t;
|
|
1932
|
-
const
|
|
1933
|
-
return
|
|
2003
|
+
const d = Tn(n.bbox, s), m = Tn(n.bbox, l);
|
|
2004
|
+
return d > a * 16 && m * 4 < d && f * 4 < _ ? r : t;
|
|
1934
2005
|
}
|
|
1935
|
-
function
|
|
2006
|
+
function Zt(t, n) {
|
|
1936
2007
|
if (t >= n)
|
|
1937
|
-
throw new
|
|
2008
|
+
throw new u("E_GROUP_RANGE", `Instance layer index ${t} exceeds layer count ${n}`);
|
|
1938
2009
|
}
|
|
1939
|
-
function
|
|
2010
|
+
function ie(t, n) {
|
|
1940
2011
|
if (!Number.isInteger(t) || t < 0 || t >= n.length)
|
|
1941
|
-
throw new
|
|
2012
|
+
throw new u("E_GROUP_RANGE", `layer0_index out of range: ${t}`);
|
|
1942
2013
|
if (n[t].name !== "0")
|
|
1943
|
-
throw new
|
|
2014
|
+
throw new u("E_GROUP_RANGE", `layer0_index must reference layer "0": ${t}`);
|
|
1944
2015
|
}
|
|
1945
|
-
function
|
|
2016
|
+
function bo(t) {
|
|
1946
2017
|
if (t !== 0)
|
|
1947
|
-
throw new
|
|
2018
|
+
throw new u("E_GROUP_RANGE", `Instance flags must be zero for Stage 1, found ${t}`);
|
|
1948
2019
|
}
|
|
1949
|
-
function*
|
|
2020
|
+
function* Bo(t, n, e, o, i) {
|
|
1950
2021
|
let r = e;
|
|
1951
|
-
const
|
|
2022
|
+
const s = [
|
|
1952
2023
|
{ kind: "line", count: o.lineCount },
|
|
1953
2024
|
{ kind: "fill", count: o.fillCount },
|
|
1954
2025
|
{ kind: "dot", count: o.dotCount }
|
|
1955
2026
|
];
|
|
1956
|
-
for (const
|
|
1957
|
-
const
|
|
2027
|
+
for (const l of s) {
|
|
2028
|
+
const a = Re(t, n, r, l.count);
|
|
1958
2029
|
for (; ; ) {
|
|
1959
|
-
const
|
|
1960
|
-
if (
|
|
1961
|
-
r =
|
|
2030
|
+
const c = a.next();
|
|
2031
|
+
if (c.done) {
|
|
2032
|
+
r = c.value;
|
|
1962
2033
|
break;
|
|
1963
2034
|
}
|
|
1964
|
-
yield { kind:
|
|
2035
|
+
yield { kind: l.kind, payload: c.value };
|
|
1965
2036
|
}
|
|
1966
2037
|
}
|
|
1967
2038
|
if (r !== t.byteLength)
|
|
1968
|
-
throw new
|
|
1969
|
-
for (const
|
|
1970
|
-
yield { kind: "text", payload:
|
|
2039
|
+
throw new u("E_GROUP_RANGE", `Trailing bytes detected: offset=${r}, size=${t.byteLength}`);
|
|
2040
|
+
for (const l of o.texts)
|
|
2041
|
+
yield { kind: "text", payload: l };
|
|
1971
2042
|
}
|
|
1972
|
-
function*
|
|
1973
|
-
yield*
|
|
2043
|
+
function* Uo(t, n, e, o) {
|
|
2044
|
+
yield* Bo(t, n, e, o);
|
|
1974
2045
|
}
|
|
1975
|
-
function
|
|
1976
|
-
let
|
|
1977
|
-
for (const
|
|
1978
|
-
if (!Nt(
|
|
2046
|
+
function Xt(t, n, e, o, i, r, s) {
|
|
2047
|
+
let l = t.count, a = 0;
|
|
2048
|
+
for (const m of e) {
|
|
2049
|
+
if (!Nt(m.instanceId, s))
|
|
1979
2050
|
continue;
|
|
1980
|
-
const
|
|
1981
|
-
if (!
|
|
1982
|
-
throw new
|
|
1983
|
-
const y =
|
|
1984
|
-
|
|
2051
|
+
const A = n.get(m.variantId);
|
|
2052
|
+
if (!A)
|
|
2053
|
+
throw new u("E_GROUP_RANGE", `Unknown variantId ${m.variantId}`);
|
|
2054
|
+
const y = A[o].count;
|
|
2055
|
+
a += y, l += y;
|
|
1985
2056
|
}
|
|
1986
|
-
if (
|
|
1987
|
-
return
|
|
1988
|
-
const
|
|
1989
|
-
let
|
|
1990
|
-
((
|
|
1991
|
-
|
|
2057
|
+
if (Xn(s, o, a), l === 0)
|
|
2058
|
+
return Vt();
|
|
2059
|
+
const c = new Float32Array(l * 2), _ = [];
|
|
2060
|
+
let f = 0;
|
|
2061
|
+
((m) => {
|
|
2062
|
+
c.set(m.pos, f * 2), _.push(...qt(rt(m), f)), f += m.count;
|
|
1992
2063
|
})(t);
|
|
1993
|
-
for (const
|
|
1994
|
-
if (!Nt(
|
|
2064
|
+
for (const m of e) {
|
|
2065
|
+
if (!Nt(m.instanceId, s))
|
|
1995
2066
|
continue;
|
|
1996
|
-
const
|
|
1997
|
-
if (!
|
|
1998
|
-
throw new
|
|
1999
|
-
const y =
|
|
2000
|
-
for (let
|
|
2001
|
-
const
|
|
2002
|
-
|
|
2067
|
+
const A = n.get(m.variantId);
|
|
2068
|
+
if (!A)
|
|
2069
|
+
throw new u("E_GROUP_RANGE", `Unknown variantId ${m.variantId}`);
|
|
2070
|
+
const y = A[o], x = r[m.insLayerIdx].visible === !1;
|
|
2071
|
+
for (let h = 0; h < y.count; h += 1) {
|
|
2072
|
+
const R = h * 2, p = (f + h) * 2, v = y.pos[R], U = y.pos[R + 1];
|
|
2073
|
+
c[p] = m.matA * v + m.matC * U + m.tx, c[p + 1] = m.matB * v + m.matD * U + m.ty;
|
|
2003
2074
|
}
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
(
|
|
2075
|
+
_.push(...qt(
|
|
2076
|
+
vn(
|
|
2077
|
+
rt(y),
|
|
2078
|
+
(h) => x || h === i ? m.insLayerIdx : h
|
|
2008
2079
|
),
|
|
2009
|
-
|
|
2010
|
-
)),
|
|
2080
|
+
f
|
|
2081
|
+
)), f += y.count;
|
|
2011
2082
|
}
|
|
2012
|
-
return { pos:
|
|
2083
|
+
return { pos: c, count: l, segments: mt(_) };
|
|
2013
2084
|
}
|
|
2014
|
-
function*
|
|
2015
|
-
if (
|
|
2016
|
-
yield { kind: t, payload:
|
|
2085
|
+
function* Lt(t, n, e, o, i, r, s, l) {
|
|
2086
|
+
if (Xn(l, t, Math.max(0, n - e.count)), n === 0) {
|
|
2087
|
+
yield { kind: t, payload: Vt() };
|
|
2017
2088
|
return;
|
|
2018
2089
|
}
|
|
2019
|
-
const
|
|
2020
|
-
let
|
|
2021
|
-
const
|
|
2022
|
-
if (
|
|
2090
|
+
const a = Yt;
|
|
2091
|
+
let c = new Float32Array(a * 2), _ = [], f = 0, d = 0;
|
|
2092
|
+
const m = function* () {
|
|
2093
|
+
if (f <= 0)
|
|
2023
2094
|
return;
|
|
2024
|
-
const
|
|
2025
|
-
yield { kind: t, payload:
|
|
2026
|
-
},
|
|
2027
|
-
if (
|
|
2095
|
+
const x = f === a ? { pos: c, count: f, segments: mt(_) } : { pos: c.slice(0, f * 2), count: f, segments: mt(_) };
|
|
2096
|
+
yield { kind: t, payload: x }, d += f, f = 0, c = new Float32Array(a * 2), _ = [];
|
|
2097
|
+
}, A = (x, h, R, w) => {
|
|
2098
|
+
if (x <= 0)
|
|
2028
2099
|
return;
|
|
2029
|
-
const
|
|
2030
|
-
if (
|
|
2031
|
-
|
|
2032
|
-
...
|
|
2033
|
-
vertexCount:
|
|
2100
|
+
const p = _[_.length - 1];
|
|
2101
|
+
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) {
|
|
2102
|
+
_[_.length - 1] = {
|
|
2103
|
+
...p,
|
|
2104
|
+
vertexCount: p.vertexCount + x
|
|
2034
2105
|
};
|
|
2035
2106
|
return;
|
|
2036
2107
|
}
|
|
2037
|
-
|
|
2038
|
-
startVertex:
|
|
2039
|
-
vertexCount:
|
|
2040
|
-
color: [
|
|
2041
|
-
layerIndex:
|
|
2042
|
-
...
|
|
2108
|
+
_.push({
|
|
2109
|
+
startVertex: f,
|
|
2110
|
+
vertexCount: x,
|
|
2111
|
+
color: [h[0], h[1], h[2]],
|
|
2112
|
+
layerIndex: R,
|
|
2113
|
+
...w === void 0 ? {} : { lineweightPx: w }
|
|
2043
2114
|
});
|
|
2044
2115
|
};
|
|
2045
2116
|
yield* function* () {
|
|
2046
|
-
for (const
|
|
2047
|
-
let
|
|
2048
|
-
const
|
|
2049
|
-
for (;
|
|
2050
|
-
const
|
|
2051
|
-
|
|
2117
|
+
for (const x of rt(e)) {
|
|
2118
|
+
let h = x.startVertex;
|
|
2119
|
+
const R = x.startVertex + x.vertexCount;
|
|
2120
|
+
for (; h < R; ) {
|
|
2121
|
+
const w = Math.min(a - f, R - h), p = h * 2, v = f * 2;
|
|
2122
|
+
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
2123
|
}
|
|
2053
2124
|
}
|
|
2054
2125
|
}();
|
|
2055
|
-
for (const
|
|
2056
|
-
if (!Nt(
|
|
2126
|
+
for (const x of i) {
|
|
2127
|
+
if (!Nt(x.instanceId, l))
|
|
2057
2128
|
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
|
-
|
|
2129
|
+
const h = o.get(x.variantId);
|
|
2130
|
+
if (!h)
|
|
2131
|
+
throw new u("E_GROUP_RANGE", `Unknown variantId ${x.variantId}`);
|
|
2132
|
+
const R = h[t], w = s[x.insLayerIdx].visible === !1;
|
|
2133
|
+
for (const p of rt(R)) {
|
|
2134
|
+
const v = w || p.layerIndex === r ? x.insLayerIdx : p.layerIndex;
|
|
2135
|
+
let U = p.startVertex;
|
|
2136
|
+
const D = p.startVertex + p.vertexCount;
|
|
2137
|
+
for (; U < D; ) {
|
|
2138
|
+
const $ = Math.min(a - f, D - U);
|
|
2139
|
+
for (let M = 0; M < $; M += 1) {
|
|
2140
|
+
const Y = (U + M) * 2, z = (f + M) * 2, S = R.pos[Y], N = R.pos[Y + 1];
|
|
2141
|
+
c[z] = x.matA * S + x.matC * N + x.tx, c[z + 1] = x.matB * S + x.matD * N + x.ty;
|
|
2071
2142
|
}
|
|
2072
|
-
|
|
2143
|
+
A($, p.color, v, p.lineweightPx), U += $, f += $, f === a && (yield* m());
|
|
2073
2144
|
}
|
|
2074
2145
|
}
|
|
2075
2146
|
}
|
|
2076
|
-
if (yield*
|
|
2077
|
-
throw new
|
|
2147
|
+
if (yield* m(), d !== n)
|
|
2148
|
+
throw new u("E_GROUP_RANGE", `Expanded ${t} count mismatch: header=${n}, emitted=${d}`);
|
|
2078
2149
|
}
|
|
2079
|
-
function*
|
|
2080
|
-
yield*
|
|
2150
|
+
function* So(t, n, e, o) {
|
|
2151
|
+
yield* Lt(
|
|
2081
2152
|
"line",
|
|
2082
2153
|
n.lineCount,
|
|
2083
2154
|
t.baseLine,
|
|
@@ -2086,7 +2157,7 @@ function* po(t, n, e, o) {
|
|
|
2086
2157
|
e.layer0_index,
|
|
2087
2158
|
n.layers,
|
|
2088
2159
|
o
|
|
2089
|
-
), yield*
|
|
2160
|
+
), yield* Lt(
|
|
2090
2161
|
"fill",
|
|
2091
2162
|
n.fillCount,
|
|
2092
2163
|
t.baseFill,
|
|
@@ -2095,7 +2166,7 @@ function* po(t, n, e, o) {
|
|
|
2095
2166
|
e.layer0_index,
|
|
2096
2167
|
n.layers,
|
|
2097
2168
|
o
|
|
2098
|
-
), yield*
|
|
2169
|
+
), yield* Lt(
|
|
2099
2170
|
"dot",
|
|
2100
2171
|
n.dotCount,
|
|
2101
2172
|
t.baseDot,
|
|
@@ -2105,44 +2176,48 @@ function* po(t, n, e, o) {
|
|
|
2105
2176
|
n.layers,
|
|
2106
2177
|
o
|
|
2107
2178
|
);
|
|
2108
|
-
for (const
|
|
2109
|
-
yield { kind: "text", payload:
|
|
2110
|
-
}
|
|
2111
|
-
function
|
|
2112
|
-
const
|
|
2113
|
-
return {
|
|
2114
|
-
header:
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2179
|
+
for (const i of n.texts)
|
|
2180
|
+
yield { kind: "text", payload: i };
|
|
2181
|
+
}
|
|
2182
|
+
function se(t, n, e) {
|
|
2183
|
+
const o = Dn(n), i = oe(t, o, e);
|
|
2184
|
+
return i.documentCache && Pn.add(i.documentCache), {
|
|
2185
|
+
header: i.header,
|
|
2186
|
+
...i.documentCache ? { documentCache: i.documentCache } : {},
|
|
2187
|
+
chunks: So(
|
|
2188
|
+
i.decoded,
|
|
2189
|
+
i.header,
|
|
2190
|
+
{ layer0_index: i.meta.layer0_index ?? 0 },
|
|
2191
|
+
o
|
|
2120
2192
|
)
|
|
2121
2193
|
};
|
|
2122
2194
|
}
|
|
2123
|
-
function
|
|
2124
|
-
if (
|
|
2125
|
-
return
|
|
2126
|
-
const e =
|
|
2195
|
+
function ae(t, n) {
|
|
2196
|
+
if (Q(t))
|
|
2197
|
+
return se(t, n);
|
|
2198
|
+
const e = on(t);
|
|
2127
2199
|
return {
|
|
2128
2200
|
header: e.header,
|
|
2129
|
-
chunks:
|
|
2201
|
+
chunks: Uo(t, e.view, e.dataOffset, e.header)
|
|
2130
2202
|
};
|
|
2131
2203
|
}
|
|
2132
|
-
function
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2204
|
+
function Fo(t, n, e) {
|
|
2205
|
+
return n.kind !== "dxb3-v3" || n.buffer !== t || !Pn.has(n) || !Q(t) ? ae(t, e) : se(t, e, n);
|
|
2206
|
+
}
|
|
2207
|
+
function zo(t) {
|
|
2208
|
+
if (Q(t)) {
|
|
2209
|
+
const n = Fn(t);
|
|
2210
|
+
return go(n.bounds, "V3 SCENE_META bounds");
|
|
2136
2211
|
}
|
|
2137
|
-
return
|
|
2212
|
+
return on(t).header.bounds;
|
|
2138
2213
|
}
|
|
2139
|
-
function*
|
|
2140
|
-
const e =
|
|
2214
|
+
function* Ho(t, n) {
|
|
2215
|
+
const e = ae(t, n);
|
|
2141
2216
|
for (const o of e.chunks)
|
|
2142
2217
|
yield o;
|
|
2143
2218
|
return e.header;
|
|
2144
2219
|
}
|
|
2145
|
-
function
|
|
2220
|
+
function kt() {
|
|
2146
2221
|
return {
|
|
2147
2222
|
pos: new Float32Array(0),
|
|
2148
2223
|
col: new Uint8Array(0),
|
|
@@ -2150,8 +2225,8 @@ function Xt() {
|
|
|
2150
2225
|
count: 0
|
|
2151
2226
|
};
|
|
2152
2227
|
}
|
|
2153
|
-
function
|
|
2154
|
-
const n =
|
|
2228
|
+
function at(t) {
|
|
2229
|
+
const n = Le(t);
|
|
2155
2230
|
return {
|
|
2156
2231
|
pos: t.pos,
|
|
2157
2232
|
col: n.col,
|
|
@@ -2159,104 +2234,105 @@ function it(t) {
|
|
|
2159
2234
|
count: t.count
|
|
2160
2235
|
};
|
|
2161
2236
|
}
|
|
2162
|
-
function
|
|
2163
|
-
if (
|
|
2164
|
-
const
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2237
|
+
function jo(t, n) {
|
|
2238
|
+
if (Q(t)) {
|
|
2239
|
+
const l = Dn(n), a = oe(t, l), c = Xt(
|
|
2240
|
+
a.decoded.baseLine,
|
|
2241
|
+
a.decoded.variants,
|
|
2242
|
+
a.decoded.instances,
|
|
2168
2243
|
"line",
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
),
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2244
|
+
a.meta.layer0_index ?? 0,
|
|
2245
|
+
a.header.layers,
|
|
2246
|
+
l
|
|
2247
|
+
), _ = Xt(
|
|
2248
|
+
a.decoded.baseFill,
|
|
2249
|
+
a.decoded.variants,
|
|
2250
|
+
a.decoded.instances,
|
|
2176
2251
|
"fill",
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
),
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2252
|
+
a.meta.layer0_index ?? 0,
|
|
2253
|
+
a.header.layers,
|
|
2254
|
+
l
|
|
2255
|
+
), f = Xt(
|
|
2256
|
+
a.decoded.baseDot,
|
|
2257
|
+
a.decoded.variants,
|
|
2258
|
+
a.decoded.instances,
|
|
2184
2259
|
"dot",
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2260
|
+
a.meta.layer0_index ?? 0,
|
|
2261
|
+
a.header.layers,
|
|
2262
|
+
l
|
|
2188
2263
|
);
|
|
2189
2264
|
return {
|
|
2190
|
-
meta:
|
|
2191
|
-
line:
|
|
2192
|
-
fill:
|
|
2193
|
-
dot:
|
|
2265
|
+
meta: a.meta,
|
|
2266
|
+
line: at(c),
|
|
2267
|
+
fill: at(_),
|
|
2268
|
+
dot: at(f),
|
|
2194
2269
|
rawBytes: t.byteLength
|
|
2195
2270
|
};
|
|
2196
2271
|
}
|
|
2197
|
-
const e =
|
|
2272
|
+
const e = on(t);
|
|
2198
2273
|
let o = e.dataOffset;
|
|
2199
|
-
const
|
|
2200
|
-
o =
|
|
2201
|
-
const r =
|
|
2274
|
+
const i = ft(t, e.view, o, e.header.lineCount);
|
|
2275
|
+
o = i.offset;
|
|
2276
|
+
const r = ft(t, e.view, o, e.header.fillCount);
|
|
2202
2277
|
o = r.offset;
|
|
2203
|
-
const
|
|
2204
|
-
if (o =
|
|
2205
|
-
throw new
|
|
2278
|
+
const s = ft(t, e.view, o, e.header.dotCount);
|
|
2279
|
+
if (o = s.offset, o !== t.byteLength)
|
|
2280
|
+
throw new u("E_GROUP_RANGE", `Trailing bytes detected: offset=${o}, size=${t.byteLength}`);
|
|
2206
2281
|
return {
|
|
2207
2282
|
meta: e.meta,
|
|
2208
|
-
line:
|
|
2209
|
-
fill:
|
|
2210
|
-
dot:
|
|
2283
|
+
line: at(i.chunk),
|
|
2284
|
+
fill: at(r.chunk),
|
|
2285
|
+
dot: at(s.chunk),
|
|
2211
2286
|
rawBytes: t.byteLength
|
|
2212
2287
|
};
|
|
2213
2288
|
}
|
|
2214
|
-
function
|
|
2215
|
-
return t ?
|
|
2289
|
+
function qo(t, n) {
|
|
2290
|
+
return t ? Ne(On(t, n)) : null;
|
|
2216
2291
|
}
|
|
2217
2292
|
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
|
-
|
|
2293
|
+
u as CadPackError,
|
|
2294
|
+
u as GeoLoaderError,
|
|
2295
|
+
Yt as STREAM_VERTEX_WINDOW,
|
|
2296
|
+
Ce as assertStrictTextRoundtrip,
|
|
2297
|
+
Oo as captureGroupSnapshot,
|
|
2298
|
+
Ft as cloneViewportRect,
|
|
2299
|
+
Ge as computeViewportRectFromPositions,
|
|
2300
|
+
Vt as emptyGeometryChunk,
|
|
2301
|
+
Le as expandGeometryChunkMetadata,
|
|
2302
|
+
Ve as expandViewportRect,
|
|
2303
|
+
ot as getDxbsSection,
|
|
2304
|
+
Qt as groupLayerEncodingForV3Minor,
|
|
2305
|
+
Ie as intersectViewportRects,
|
|
2306
|
+
ve as isDxbsPayload,
|
|
2307
|
+
Se as isStrictTextRoundtripEnabled,
|
|
2308
|
+
mt as mergeAdjacentSegments,
|
|
2309
|
+
pe as mergeViewportRects,
|
|
2310
|
+
rt as normalizeGeometrySegments,
|
|
2311
|
+
Ne as normalizeViewportRect,
|
|
2312
|
+
qt as offsetGeometrySegments,
|
|
2313
|
+
zo as parseBinBounds,
|
|
2314
|
+
jo as parseBinPayload,
|
|
2315
|
+
ae as parseBinStreaming,
|
|
2316
|
+
Fo as parseBinStreamingWithCache,
|
|
2317
|
+
Ho as parseBinToChunks,
|
|
2318
|
+
Xe as readBlockAnnotationSidecar,
|
|
2319
|
+
tn as readDxbsContainer,
|
|
2320
|
+
ko as readExternalAnnotationManifest,
|
|
2321
|
+
Yo as readExternalBlockAnnotations,
|
|
2322
|
+
Lo as readExternalVariantDependencyPlan,
|
|
2323
|
+
wo as readExternalVariantGeometrySidecar,
|
|
2324
|
+
Xo as readExternalVariantManifest,
|
|
2325
|
+
ft as readGroup,
|
|
2326
|
+
Po as readSceneAnnotationSidecar,
|
|
2327
|
+
vn as remapGeometrySegmentLayers,
|
|
2328
|
+
vo as shouldAssertStrictTextRoundtrip,
|
|
2329
|
+
Do as sliceGeometrySegments,
|
|
2330
|
+
Re as streamGroupChunks,
|
|
2331
|
+
qo as transformBBoxByInstance,
|
|
2332
|
+
On as transformViewportRect,
|
|
2333
|
+
be as viewportRectCenterDistance,
|
|
2334
|
+
$o as viewportRectContains,
|
|
2335
|
+
Te as viewportRectDiagonal,
|
|
2336
|
+
Mo as viewportRectEquals,
|
|
2337
|
+
Cn as viewportRectIntersects
|
|
2262
2338
|
};
|