@cesium/engine 0.1.0 → 1.0.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.
Files changed (31) hide show
  1. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +95 -76
  2. package/README.md +9 -9
  3. package/Source/Core/Ion.js +1 -1
  4. package/Source/Renderer/Context.js +213 -178
  5. package/Source/Scene/I3SDataProvider.js +2 -1
  6. package/Source/Scene/I3SFeature.js +1 -1
  7. package/Source/Scene/I3SLayer.js +64 -2
  8. package/Source/Scene/I3SNode.js +50 -6
  9. package/Source/Scene/Model/Model.js +36 -3
  10. package/Source/Scene/Scene.js +3 -50
  11. package/Source/Shaders/Builtin/CzmBuiltins.js +15 -15
  12. package/Source/ThirdParty/Workers/draco_decoder_nodejs.js +100 -101
  13. package/Source/ThirdParty/Workers/pako_deflate.min.js +2 -2
  14. package/Source/ThirdParty/Workers/pako_inflate.min.js +2 -2
  15. package/Source/ThirdParty/Workers/z-worker-pako.js +0 -0
  16. package/Source/ThirdParty/draco_decoder.wasm +0 -0
  17. package/Source/Widget/CesiumWidget.js +1 -1
  18. package/index.d.ts +2402 -2334
  19. package/index.js +1085 -1085
  20. package/package.json +4 -1
  21. package/Build/ThirdParty/Workers/basis_transcoder.js +0 -2233
  22. package/Build/ThirdParty/Workers/draco_decoder_nodejs.js +0 -1872
  23. package/Build/ThirdParty/Workers/package.json +0 -1
  24. package/Build/ThirdParty/Workers/pako_deflate.min.js +0 -589
  25. package/Build/ThirdParty/Workers/pako_inflate.min.js +0 -798
  26. package/Build/ThirdParty/Workers/z-worker-pako.js +0 -503
  27. package/Build/ThirdParty/basis_transcoder.wasm +0 -0
  28. package/Build/ThirdParty/draco_decoder.wasm +0 -0
  29. package/Build/ThirdParty/google-earth-dbroot-parser.js +0 -8019
  30. package/Build/Widget/CesiumWidget.css +0 -120
  31. package/Build/Widget/lighter.css +0 -13
@@ -1,503 +0,0 @@
1
- undefined
2
- !function() {
3
- "use strict";
4
- const { Array: t, Object: e, Math: n, Error: s, Uint8Array: r, Uint16Array: a, Uint32Array: i, Int32Array: c, DataView: o, TextEncoder: l, crypto: h, postMessage: p } = globalThis, d = [];
5
- for (let t2 = 0; 256 > t2; t2++) {
6
- let e2 = t2;
7
- for (let t3 = 0; 8 > t3; t3++)
8
- 1 & e2 ? e2 = e2 >>> 1 ^ 3988292384 : e2 >>>= 1;
9
- d[t2] = e2;
10
- }
11
- class u {
12
- constructor(t2) {
13
- this.crc = t2 || -1;
14
- }
15
- append(t2) {
16
- let e2 = 0 | this.crc;
17
- for (let n2 = 0, s2 = 0 | t2.length; s2 > n2; n2++)
18
- e2 = e2 >>> 8 ^ d[255 & (e2 ^ t2[n2])];
19
- this.crc = e2;
20
- }
21
- get() {
22
- return ~this.crc;
23
- }
24
- }
25
- const f = { concat(t2, e2) {
26
- if (0 === t2.length || 0 === e2.length)
27
- return t2.concat(e2);
28
- const n2 = t2[t2.length - 1], s2 = f.getPartial(n2);
29
- return 32 === s2 ? t2.concat(e2) : f._shiftRight(e2, s2, 0 | n2, t2.slice(0, t2.length - 1));
30
- }, bitLength(t2) {
31
- const e2 = t2.length;
32
- if (0 === e2)
33
- return 0;
34
- const n2 = t2[e2 - 1];
35
- return 32 * (e2 - 1) + f.getPartial(n2);
36
- }, clamp(t2, e2) {
37
- if (32 * t2.length < e2)
38
- return t2;
39
- const s2 = (t2 = t2.slice(0, n.ceil(e2 / 32))).length;
40
- return e2 &= 31, s2 > 0 && e2 && (t2[s2 - 1] = f.partial(e2, t2[s2 - 1] & 2147483648 >> e2 - 1, 1)), t2;
41
- }, partial: (t2, e2, n2) => 32 === t2 ? e2 : (n2 ? 0 | e2 : e2 << 32 - t2) + 1099511627776 * t2, getPartial: (t2) => n.round(t2 / 1099511627776) || 32, _shiftRight(t2, e2, n2, s2) {
42
- for (void 0 === s2 && (s2 = []); e2 >= 32; e2 -= 32)
43
- s2.push(n2), n2 = 0;
44
- if (0 === e2)
45
- return s2.concat(t2);
46
- for (let r3 = 0; r3 < t2.length; r3++)
47
- s2.push(n2 | t2[r3] >>> e2), n2 = t2[r3] << 32 - e2;
48
- const r2 = t2.length ? t2[t2.length - 1] : 0, a2 = f.getPartial(r2);
49
- return s2.push(f.partial(e2 + a2 & 31, e2 + a2 > 32 ? n2 : s2.pop(), 1)), s2;
50
- } }, g = { bytes: { fromBits(t2) {
51
- const e2 = f.bitLength(t2) / 8, n2 = new r(e2);
52
- let s2;
53
- for (let r2 = 0; e2 > r2; r2++)
54
- 0 == (3 & r2) && (s2 = t2[r2 / 4]), n2[r2] = s2 >>> 24, s2 <<= 8;
55
- return n2;
56
- }, toBits(t2) {
57
- const e2 = [];
58
- let n2, s2 = 0;
59
- for (n2 = 0; n2 < t2.length; n2++)
60
- s2 = s2 << 8 | t2[n2], 3 == (3 & n2) && (e2.push(s2), s2 = 0);
61
- return 3 & n2 && e2.push(f.partial(8 * (3 & n2), s2)), e2;
62
- } } }, w = { sha1: function(t2) {
63
- t2 ? (this._h = t2._h.slice(0), this._buffer = t2._buffer.slice(0), this._length = t2._length) : this.reset();
64
- } };
65
- w.sha1.prototype = { blockSize: 512, reset: function() {
66
- const t2 = this;
67
- return t2._h = this._init.slice(0), t2._buffer = [], t2._length = 0, t2;
68
- }, update: function(t2) {
69
- const e2 = this;
70
- "string" == typeof t2 && (t2 = g.utf8String.toBits(t2));
71
- const n2 = e2._buffer = f.concat(e2._buffer, t2), r2 = e2._length, a2 = e2._length = r2 + f.bitLength(t2);
72
- if (a2 > 9007199254740991)
73
- throw new s("Cannot hash more than 2^53 - 1 bits");
74
- const c2 = new i(n2);
75
- let o2 = 0;
76
- for (let t3 = e2.blockSize + r2 - (e2.blockSize + r2 & e2.blockSize - 1); a2 >= t3; t3 += e2.blockSize)
77
- e2._block(c2.subarray(16 * o2, 16 * (o2 + 1))), o2 += 1;
78
- return n2.splice(0, 16 * o2), e2;
79
- }, finalize: function() {
80
- const t2 = this;
81
- let e2 = t2._buffer;
82
- const s2 = t2._h;
83
- e2 = f.concat(e2, [f.partial(1, 1)]);
84
- for (let t3 = e2.length + 2; 15 & t3; t3++)
85
- e2.push(0);
86
- for (e2.push(n.floor(t2._length / 4294967296)), e2.push(0 | t2._length); e2.length; )
87
- t2._block(e2.splice(0, 16));
88
- return t2.reset(), s2;
89
- }, _init: [1732584193, 4023233417, 2562383102, 271733878, 3285377520], _key: [1518500249, 1859775393, 2400959708, 3395469782], _f: (t2, e2, n2, s2) => t2 > 19 ? t2 > 39 ? t2 > 59 ? t2 > 79 ? void 0 : e2 ^ n2 ^ s2 : e2 & n2 | e2 & s2 | n2 & s2 : e2 ^ n2 ^ s2 : e2 & n2 | ~e2 & s2, _S: (t2, e2) => e2 << t2 | e2 >>> 32 - t2, _block: function(e2) {
90
- const s2 = this, r2 = s2._h, a2 = t(80);
91
- for (let t2 = 0; 16 > t2; t2++)
92
- a2[t2] = e2[t2];
93
- let i2 = r2[0], c2 = r2[1], o2 = r2[2], l2 = r2[3], h2 = r2[4];
94
- for (let t2 = 0; 79 >= t2; t2++) {
95
- 16 > t2 || (a2[t2] = s2._S(1, a2[t2 - 3] ^ a2[t2 - 8] ^ a2[t2 - 14] ^ a2[t2 - 16]));
96
- const e3 = s2._S(5, i2) + s2._f(t2, c2, o2, l2) + h2 + a2[t2] + s2._key[n.floor(t2 / 20)] | 0;
97
- h2 = l2, l2 = o2, o2 = s2._S(30, c2), c2 = i2, i2 = e3;
98
- }
99
- r2[0] = r2[0] + i2 | 0, r2[1] = r2[1] + c2 | 0, r2[2] = r2[2] + o2 | 0, r2[3] = r2[3] + l2 | 0, r2[4] = r2[4] + h2 | 0;
100
- } };
101
- const y = { getRandomValues(t2) {
102
- const e2 = new i(t2.buffer), s2 = (t3) => {
103
- let e3 = 987654321;
104
- const s3 = 4294967295;
105
- return () => (e3 = 36969 * (65535 & e3) + (e3 >> 16) & s3, (((e3 << 16) + (t3 = 18e3 * (65535 & t3) + (t3 >> 16) & s3) & s3) / 4294967296 + 0.5) * (n.random() > 0.5 ? 1 : -1));
106
- };
107
- for (let r2, a2 = 0; a2 < t2.length; a2 += 4) {
108
- const t3 = s2(4294967296 * (r2 || n.random()));
109
- r2 = 987654071 * t3(), e2[a2 / 4] = 4294967296 * t3() | 0;
110
- }
111
- return t2;
112
- } }, _ = { importKey: (t2) => new _.hmacSha1(g.bytes.toBits(t2)), pbkdf2(t2, e2, n2, r2) {
113
- if (n2 = n2 || 1e4, 0 > r2 || 0 > n2)
114
- throw new s("invalid params to pbkdf2");
115
- const a2 = 1 + (r2 >> 5) << 2;
116
- let i2, c2, l2, h2, p2;
117
- const d2 = new ArrayBuffer(a2), u2 = new o(d2);
118
- let w2 = 0;
119
- const y2 = f;
120
- for (e2 = g.bytes.toBits(e2), p2 = 1; (a2 || 1) > w2; p2++) {
121
- for (i2 = c2 = t2.encrypt(y2.concat(e2, [p2])), l2 = 1; n2 > l2; l2++)
122
- for (c2 = t2.encrypt(c2), h2 = 0; h2 < c2.length; h2++)
123
- i2[h2] ^= c2[h2];
124
- for (l2 = 0; (a2 || 1) > w2 && l2 < i2.length; l2++)
125
- u2.setInt32(w2, i2[l2]), w2 += 4;
126
- }
127
- return d2.slice(0, r2 / 8);
128
- }, hmacSha1: class {
129
- constructor(t2) {
130
- const e2 = this, n2 = e2._hash = w.sha1, s2 = [[], []], r2 = n2.prototype.blockSize / 32;
131
- e2._baseHash = [new n2(), new n2()], t2.length > r2 && (t2 = n2.hash(t2));
132
- for (let e3 = 0; r2 > e3; e3++)
133
- s2[0][e3] = 909522486 ^ t2[e3], s2[1][e3] = 1549556828 ^ t2[e3];
134
- e2._baseHash[0].update(s2[0]), e2._baseHash[1].update(s2[1]), e2._resultHash = new n2(e2._baseHash[0]);
135
- }
136
- reset() {
137
- const t2 = this;
138
- t2._resultHash = new t2._hash(t2._baseHash[0]), t2._updated = false;
139
- }
140
- update(t2) {
141
- this._updated = true, this._resultHash.update(t2);
142
- }
143
- digest() {
144
- const t2 = this, e2 = t2._resultHash.finalize(), n2 = new t2._hash(t2._baseHash[1]).update(e2).finalize();
145
- return t2.reset(), n2;
146
- }
147
- encrypt(t2) {
148
- if (this._updated)
149
- throw new s("encrypt on already updated hmac called!");
150
- return this.update(t2), this.digest(t2);
151
- }
152
- } }, m = "Invalid pasword", b = 16, k = { name: "PBKDF2" }, v = e.assign({ hash: { name: "HMAC" } }, k), z = e.assign({ iterations: 1e3, hash: { name: "SHA-1" } }, k), C = ["deriveBits"], S = [8, 12, 16], B = [16, 24, 32], I = 10, D = [0, 0, 0, 0], V = void 0 !== h, H = V && void 0 !== h.subtle, K = g.bytes, A = class {
153
- constructor(t2) {
154
- const e2 = this;
155
- e2._tables = [[[], [], [], [], []], [[], [], [], [], []]], e2._tables[0][0][0] || e2._precompute();
156
- const n2 = e2._tables[0][4], r2 = e2._tables[1], a2 = t2.length;
157
- let i2, c2, o2, l2 = 1;
158
- if (4 !== a2 && 6 !== a2 && 8 !== a2)
159
- throw new s("invalid aes key size");
160
- for (e2._key = [c2 = t2.slice(0), o2 = []], i2 = a2; 4 * a2 + 28 > i2; i2++) {
161
- let t3 = c2[i2 - 1];
162
- (i2 % a2 == 0 || 8 === a2 && i2 % a2 == 4) && (t3 = n2[t3 >>> 24] << 24 ^ n2[t3 >> 16 & 255] << 16 ^ n2[t3 >> 8 & 255] << 8 ^ n2[255 & t3], i2 % a2 == 0 && (t3 = t3 << 8 ^ t3 >>> 24 ^ l2 << 24, l2 = l2 << 1 ^ 283 * (l2 >> 7))), c2[i2] = c2[i2 - a2] ^ t3;
163
- }
164
- for (let t3 = 0; i2; t3++, i2--) {
165
- const e3 = c2[3 & t3 ? i2 : i2 - 4];
166
- o2[t3] = 4 >= i2 || 4 > t3 ? e3 : r2[0][n2[e3 >>> 24]] ^ r2[1][n2[e3 >> 16 & 255]] ^ r2[2][n2[e3 >> 8 & 255]] ^ r2[3][n2[255 & e3]];
167
- }
168
- }
169
- encrypt(t2) {
170
- return this._crypt(t2, 0);
171
- }
172
- decrypt(t2) {
173
- return this._crypt(t2, 1);
174
- }
175
- _precompute() {
176
- const t2 = this._tables[0], e2 = this._tables[1], n2 = t2[4], s2 = e2[4], r2 = [], a2 = [];
177
- let i2, c2, o2, l2;
178
- for (let t3 = 0; 256 > t3; t3++)
179
- a2[(r2[t3] = t3 << 1 ^ 283 * (t3 >> 7)) ^ t3] = t3;
180
- for (let h2 = i2 = 0; !n2[h2]; h2 ^= c2 || 1, i2 = a2[i2] || 1) {
181
- let a3 = i2 ^ i2 << 1 ^ i2 << 2 ^ i2 << 3 ^ i2 << 4;
182
- a3 = a3 >> 8 ^ 255 & a3 ^ 99, n2[h2] = a3, s2[a3] = h2, l2 = r2[o2 = r2[c2 = r2[h2]]];
183
- let p2 = 16843009 * l2 ^ 65537 * o2 ^ 257 * c2 ^ 16843008 * h2, d2 = 257 * r2[a3] ^ 16843008 * a3;
184
- for (let n3 = 0; 4 > n3; n3++)
185
- t2[n3][h2] = d2 = d2 << 24 ^ d2 >>> 8, e2[n3][a3] = p2 = p2 << 24 ^ p2 >>> 8;
186
- }
187
- for (let n3 = 0; 5 > n3; n3++)
188
- t2[n3] = t2[n3].slice(0), e2[n3] = e2[n3].slice(0);
189
- }
190
- _crypt(t2, e2) {
191
- if (4 !== t2.length)
192
- throw new s("invalid aes block size");
193
- const n2 = this._key[e2], r2 = n2.length / 4 - 2, a2 = [0, 0, 0, 0], i2 = this._tables[e2], c2 = i2[0], o2 = i2[1], l2 = i2[2], h2 = i2[3], p2 = i2[4];
194
- let d2, u2, f2, g2 = t2[0] ^ n2[0], w2 = t2[e2 ? 3 : 1] ^ n2[1], y2 = t2[2] ^ n2[2], _2 = t2[e2 ? 1 : 3] ^ n2[3], m2 = 4;
195
- for (let t3 = 0; r2 > t3; t3++)
196
- d2 = c2[g2 >>> 24] ^ o2[w2 >> 16 & 255] ^ l2[y2 >> 8 & 255] ^ h2[255 & _2] ^ n2[m2], u2 = c2[w2 >>> 24] ^ o2[y2 >> 16 & 255] ^ l2[_2 >> 8 & 255] ^ h2[255 & g2] ^ n2[m2 + 1], f2 = c2[y2 >>> 24] ^ o2[_2 >> 16 & 255] ^ l2[g2 >> 8 & 255] ^ h2[255 & w2] ^ n2[m2 + 2], _2 = c2[_2 >>> 24] ^ o2[g2 >> 16 & 255] ^ l2[w2 >> 8 & 255] ^ h2[255 & y2] ^ n2[m2 + 3], m2 += 4, g2 = d2, w2 = u2, y2 = f2;
197
- for (let t3 = 0; 4 > t3; t3++)
198
- a2[e2 ? 3 & -t3 : t3] = p2[g2 >>> 24] << 24 ^ p2[w2 >> 16 & 255] << 16 ^ p2[y2 >> 8 & 255] << 8 ^ p2[255 & _2] ^ n2[m2++], d2 = g2, g2 = w2, w2 = y2, y2 = _2, _2 = d2;
199
- return a2;
200
- }
201
- }, R = class {
202
- constructor(t2, e2) {
203
- this._prf = t2, this._initIv = e2, this._iv = e2;
204
- }
205
- reset() {
206
- this._iv = this._initIv;
207
- }
208
- update(t2) {
209
- return this.calculate(this._prf, t2, this._iv);
210
- }
211
- incWord(t2) {
212
- if (255 == (t2 >> 24 & 255)) {
213
- let e2 = t2 >> 16 & 255, n2 = t2 >> 8 & 255, s2 = 255 & t2;
214
- 255 === e2 ? (e2 = 0, 255 === n2 ? (n2 = 0, 255 === s2 ? s2 = 0 : ++s2) : ++n2) : ++e2, t2 = 0, t2 += e2 << 16, t2 += n2 << 8, t2 += s2;
215
- } else
216
- t2 += 1 << 24;
217
- return t2;
218
- }
219
- incCounter(t2) {
220
- 0 === (t2[0] = this.incWord(t2[0])) && (t2[1] = this.incWord(t2[1]));
221
- }
222
- calculate(t2, e2, n2) {
223
- let s2;
224
- if (!(s2 = e2.length))
225
- return [];
226
- const r2 = f.bitLength(e2);
227
- for (let r3 = 0; s2 > r3; r3 += 4) {
228
- this.incCounter(n2);
229
- const s3 = t2.encrypt(n2);
230
- e2[r3] ^= s3[0], e2[r3 + 1] ^= s3[1], e2[r3 + 2] ^= s3[2], e2[r3 + 3] ^= s3[3];
231
- }
232
- return f.clamp(e2, r2);
233
- }
234
- }, W = _.hmacSha1;
235
- class T {
236
- constructor(t2, n2, s2) {
237
- e.assign(this, { password: t2, signed: n2, strength: s2 - 1, pendingInput: new r(0) });
238
- }
239
- async append(e2) {
240
- const n2 = this;
241
- if (n2.password) {
242
- const r2 = E(e2, 0, S[n2.strength] + 2);
243
- await (async (t2, e3, n3) => {
244
- await L(t2, n3, E(e3, 0, S[t2.strength]));
245
- const r3 = E(e3, S[t2.strength]), a2 = t2.keys.passwordVerification;
246
- if (a2[0] != r3[0] || a2[1] != r3[1])
247
- throw new s(m);
248
- })(n2, r2, n2.password), n2.password = null, n2.aesCtrGladman = new R(new A(n2.keys.key), t.from(D)), n2.hmac = new W(n2.keys.authentication), e2 = E(e2, S[n2.strength] + 2);
249
- }
250
- return G(n2, e2, new r(e2.length - I - (e2.length - I) % b), 0, I, true);
251
- }
252
- flush() {
253
- const t2 = this, e2 = t2.pendingInput, n2 = E(e2, 0, e2.length - I), s2 = E(e2, e2.length - I);
254
- let a2 = new r(0);
255
- if (n2.length) {
256
- const e3 = K.toBits(n2);
257
- t2.hmac.update(e3);
258
- const s3 = t2.aesCtrGladman.update(e3);
259
- a2 = K.fromBits(s3);
260
- }
261
- let i2 = true;
262
- if (t2.signed) {
263
- const e3 = E(K.fromBits(t2.hmac.digest()), 0, I);
264
- for (let t3 = 0; I > t3; t3++)
265
- e3[t3] != s2[t3] && (i2 = false);
266
- }
267
- return { valid: i2, data: a2 };
268
- }
269
- }
270
- class U {
271
- constructor(t2, n2) {
272
- e.assign(this, { password: t2, strength: n2 - 1, pendingInput: new r(0) });
273
- }
274
- async append(e2) {
275
- const n2 = this;
276
- let s2 = new r(0);
277
- n2.password && (s2 = await (async (t2, e3) => {
278
- const n3 = (s3 = new r(S[t2.strength]), V && "function" == typeof h.getRandomValues ? h.getRandomValues(s3) : y.getRandomValues(s3));
279
- var s3;
280
- return await L(t2, e3, n3), P(n3, t2.keys.passwordVerification);
281
- })(n2, n2.password), n2.password = null, n2.aesCtrGladman = new R(new A(n2.keys.key), t.from(D)), n2.hmac = new W(n2.keys.authentication));
282
- const a2 = new r(s2.length + e2.length - e2.length % b);
283
- return a2.set(s2, 0), G(n2, e2, a2, s2.length, 0);
284
- }
285
- flush() {
286
- const t2 = this;
287
- let e2 = new r(0);
288
- if (t2.pendingInput.length) {
289
- const n3 = t2.aesCtrGladman.update(K.toBits(t2.pendingInput));
290
- t2.hmac.update(n3), e2 = K.fromBits(n3);
291
- }
292
- const n2 = E(K.fromBits(t2.hmac.digest()), 0, I);
293
- return { data: P(e2, n2), signature: n2 };
294
- }
295
- }
296
- function G(t2, e2, n2, s2, a2, i2) {
297
- const c2 = e2.length - a2;
298
- let o2;
299
- for (t2.pendingInput.length && (e2 = P(t2.pendingInput, e2), n2 = ((t3, e3) => {
300
- if (e3 && e3 > t3.length) {
301
- const n3 = t3;
302
- (t3 = new r(e3)).set(n3, 0);
303
- }
304
- return t3;
305
- })(n2, c2 - c2 % b)), o2 = 0; c2 - b >= o2; o2 += b) {
306
- const r2 = K.toBits(E(e2, o2, o2 + b));
307
- i2 && t2.hmac.update(r2);
308
- const a3 = t2.aesCtrGladman.update(r2);
309
- i2 || t2.hmac.update(a3), n2.set(K.fromBits(a3), o2 + s2);
310
- }
311
- return t2.pendingInput = E(e2, o2), n2;
312
- }
313
- async function L(t2, n2, s2) {
314
- const a2 = ((t3) => {
315
- if (void 0 === l) {
316
- const e2 = new r((t3 = unescape(encodeURIComponent(t3))).length);
317
- for (let n3 = 0; n3 < e2.length; n3++)
318
- e2[n3] = t3.charCodeAt(n3);
319
- return e2;
320
- }
321
- return new l().encode(t3);
322
- })(n2), i2 = await ((t3, e2, n3, s3, r2) => V && H && "function" == typeof h.subtle.importKey ? h.subtle.importKey("raw", e2, n3, false, r2) : _.importKey(e2))(0, a2, v, 0, C), c2 = await (async (t3, e2, n3) => V && H && "function" == typeof h.subtle.deriveBits ? await h.subtle.deriveBits(t3, e2, n3) : _.pbkdf2(e2, t3.salt, z.iterations, n3))(e.assign({ salt: s2 }, z), i2, 8 * (2 * B[t2.strength] + 2)), o2 = new r(c2);
323
- t2.keys = { key: K.toBits(E(o2, 0, B[t2.strength])), authentication: K.toBits(E(o2, B[t2.strength], 2 * B[t2.strength])), passwordVerification: E(o2, 2 * B[t2.strength]) };
324
- }
325
- function P(t2, e2) {
326
- let n2 = t2;
327
- return t2.length + e2.length && (n2 = new r(t2.length + e2.length), n2.set(t2, 0), n2.set(e2, t2.length)), n2;
328
- }
329
- function E(t2, e2, n2) {
330
- return t2.subarray(e2, n2);
331
- }
332
- class M {
333
- constructor(t2, n2) {
334
- e.assign(this, { password: t2, passwordVerification: n2 }), O(this, t2);
335
- }
336
- append(t2) {
337
- const e2 = this;
338
- if (e2.password) {
339
- const n2 = x(e2, t2.subarray(0, 12));
340
- if (e2.password = null, n2[11] != e2.passwordVerification)
341
- throw new s(m);
342
- t2 = t2.subarray(12);
343
- }
344
- return x(e2, t2);
345
- }
346
- flush() {
347
- return { valid: true, data: new r(0) };
348
- }
349
- }
350
- class j {
351
- constructor(t2, n2) {
352
- e.assign(this, { password: t2, passwordVerification: n2 }), O(this, t2);
353
- }
354
- append(t2) {
355
- const e2 = this;
356
- let n2, s2;
357
- if (e2.password) {
358
- e2.password = null;
359
- const a2 = h.getRandomValues(new r(12));
360
- a2[11] = e2.passwordVerification, n2 = new r(t2.length + a2.length), n2.set(F(e2, a2), 0), s2 = 12;
361
- } else
362
- n2 = new r(t2.length), s2 = 0;
363
- return n2.set(F(e2, t2), s2), n2;
364
- }
365
- flush() {
366
- return { data: new r(0) };
367
- }
368
- }
369
- function x(t2, e2) {
370
- const n2 = new r(e2.length);
371
- for (let s2 = 0; s2 < e2.length; s2++)
372
- n2[s2] = J(t2) ^ e2[s2], q(t2, n2[s2]);
373
- return n2;
374
- }
375
- function F(t2, e2) {
376
- const n2 = new r(e2.length);
377
- for (let s2 = 0; s2 < e2.length; s2++)
378
- n2[s2] = J(t2) ^ e2[s2], q(t2, e2[s2]);
379
- return n2;
380
- }
381
- function O(t2, e2) {
382
- t2.keys = [305419896, 591751049, 878082192], t2.crcKey0 = new u(t2.keys[0]), t2.crcKey2 = new u(t2.keys[2]);
383
- for (let n2 = 0; n2 < e2.length; n2++)
384
- q(t2, e2.charCodeAt(n2));
385
- }
386
- function q(t2, e2) {
387
- t2.crcKey0.append([e2]), t2.keys[0] = ~t2.crcKey0.get(), t2.keys[1] = Q(t2.keys[1] + N(t2.keys[0])), t2.keys[1] = Q(n.imul(t2.keys[1], 134775813) + 1), t2.crcKey2.append([t2.keys[1] >>> 24]), t2.keys[2] = ~t2.crcKey2.get();
388
- }
389
- function J(t2) {
390
- const e2 = 2 | t2.keys[2];
391
- return N(n.imul(e2, 1 ^ e2) >>> 8);
392
- }
393
- function N(t2) {
394
- return 255 & t2;
395
- }
396
- function Q(t2) {
397
- return 4294967295 & t2;
398
- }
399
- const X = "deflate", Y = "inflate", Z = "Invalid signature";
400
- class $ {
401
- constructor(t2, { signature: n2, password: s2, signed: r2, compressed: a2, zipCrypto: i2, passwordVerification: c2, encryptionStrength: o2 }, { chunkSize: l2 }) {
402
- const h2 = !!s2;
403
- e.assign(this, { signature: n2, encrypted: h2, signed: r2, compressed: a2, inflate: a2 && new t2({ chunkSize: l2 }), crc32: r2 && new u(), zipCrypto: i2, decrypt: h2 && i2 ? new M(s2, c2) : new T(s2, r2, o2) });
404
- }
405
- async append(t2) {
406
- const e2 = this;
407
- return e2.encrypted && t2.length && (t2 = await e2.decrypt.append(t2)), e2.compressed && t2.length && (t2 = await e2.inflate.append(t2)), (!e2.encrypted || e2.zipCrypto) && e2.signed && t2.length && e2.crc32.append(t2), t2;
408
- }
409
- async flush() {
410
- const t2 = this;
411
- let e2, n2 = new r(0);
412
- if (t2.encrypted) {
413
- const e3 = t2.decrypt.flush();
414
- if (!e3.valid)
415
- throw new s(Z);
416
- n2 = e3.data;
417
- }
418
- if ((!t2.encrypted || t2.zipCrypto) && t2.signed) {
419
- const n3 = new o(new r(4).buffer);
420
- if (e2 = t2.crc32.get(), n3.setUint32(0, e2), t2.signature != n3.getUint32(0, false))
421
- throw new s(Z);
422
- }
423
- return t2.compressed && (n2 = await t2.inflate.append(n2) || new r(0), await t2.inflate.flush()), { data: n2, signature: e2 };
424
- }
425
- }
426
- class tt {
427
- constructor(t2, { encrypted: n2, signed: s2, compressed: r2, level: a2, zipCrypto: i2, password: c2, passwordVerification: o2, encryptionStrength: l2 }, { chunkSize: h2 }) {
428
- e.assign(this, { encrypted: n2, signed: s2, compressed: r2, deflate: r2 && new t2({ level: a2 || 5, chunkSize: h2 }), crc32: s2 && new u(), zipCrypto: i2, encrypt: n2 && i2 ? new j(c2, o2) : new U(c2, l2) });
429
- }
430
- async append(t2) {
431
- const e2 = this;
432
- let n2 = t2;
433
- return e2.compressed && t2.length && (n2 = await e2.deflate.append(t2)), e2.encrypted && n2.length && (n2 = await e2.encrypt.append(n2)), (!e2.encrypted || e2.zipCrypto) && e2.signed && t2.length && e2.crc32.append(t2), n2;
434
- }
435
- async flush() {
436
- const t2 = this;
437
- let e2, n2 = new r(0);
438
- if (t2.compressed && (n2 = await t2.deflate.flush() || new r(0)), t2.encrypted) {
439
- n2 = await t2.encrypt.append(n2);
440
- const s2 = t2.encrypt.flush();
441
- e2 = s2.signature;
442
- const a2 = new r(n2.length + s2.data.length);
443
- a2.set(n2, 0), a2.set(s2.data, n2.length), n2 = a2;
444
- }
445
- return t2.encrypted && !t2.zipCrypto || !t2.signed || (e2 = t2.crc32.get()), { data: n2, signature: e2 };
446
- }
447
- }
448
- const et = { init(t2) {
449
- t2.scripts && t2.scripts.length && importScripts.apply(void 0, t2.scripts);
450
- const e2 = t2.options;
451
- let n2;
452
- self.initCodec && self.initCodec(), e2.codecType.startsWith(X) ? n2 = self.Deflate : e2.codecType.startsWith(Y) && (n2 = self.Inflate), nt = ((t3, e3, n3) => e3.codecType.startsWith(X) ? new tt(t3, e3, n3) : e3.codecType.startsWith(Y) ? new $(t3, e3, n3) : void 0)(n2, e2, t2.config);
453
- }, append: async (t2) => ({ data: await nt.append(t2.data) }), flush: () => nt.flush() };
454
- let nt;
455
- function st(t2, n2, s2) {
456
- return class {
457
- constructor(a3) {
458
- const i2 = this;
459
- i2.codec = new t2(e.assign({}, n2, a3)), s2(i2.codec, (t3) => {
460
- if (i2.pendingData) {
461
- const e2 = i2.pendingData;
462
- i2.pendingData = new r(e2.length + t3.length), i2.pendingData.set(e2, 0), i2.pendingData.set(t3, e2.length);
463
- } else
464
- i2.pendingData = new r(t3);
465
- });
466
- }
467
- append(t3) {
468
- return this.codec.push(t3), a2(this);
469
- }
470
- flush() {
471
- return this.codec.push(new r(0), true), a2(this);
472
- }
473
- };
474
- function a2(t3) {
475
- if (t3.pendingData) {
476
- const e2 = t3.pendingData;
477
- return t3.pendingData = null, e2;
478
- }
479
- return new r(0);
480
- }
481
- }
482
- addEventListener("message", async (t2) => {
483
- const e2 = t2.data, n2 = e2.type, s2 = et[n2];
484
- if (s2)
485
- try {
486
- e2.data && (e2.data = new r(e2.data));
487
- const t3 = await s2(e2) || {};
488
- if (t3.type = n2, t3.data)
489
- try {
490
- t3.data = t3.data.buffer, p(t3, [t3.data]);
491
- } catch (e3) {
492
- p(t3);
493
- }
494
- else
495
- p(t3);
496
- } catch (t3) {
497
- p({ type: n2, error: { message: t3.message, stack: t3.stack } });
498
- }
499
- }), self.initCodec = () => {
500
- const { Deflate: t2, Inflate: e2 } = ((t3, e3 = {}, n2) => ({ Deflate: st(t3.Deflate, e3.deflate, n2), Inflate: st(t3.Inflate, e3.inflate, n2) }))(pako, { deflate: { raw: true }, inflate: { raw: true } }, (t3, e3) => t3.onData = e3);
501
- self.Deflate = t2, self.Inflate = e2;
502
- };
503
- }();
Binary file