module-develop-kit 1.4.2 → 1.5.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 (39) hide show
  1. package/dist/commonjs-virtual-dir/index.js +3 -5
  2. package/dist/commonjs-virtual-dir/index2.js +5 -2
  3. package/dist/commonjs-virtual-dir/index3.js +5 -2
  4. package/dist/commonjs-virtual-dir/index4.js +2 -4
  5. package/dist/commonjs-virtual-dir/index5.js +4 -0
  6. package/dist/commonjs-virtual-dir/index6.js +4 -0
  7. package/dist/commonjs-virtual-dir/index7.js +4 -0
  8. package/dist/commonjs-virtual-dir/index8.js +4 -0
  9. package/dist/main.d.ts +92 -10
  10. package/dist/main.js +44 -40
  11. package/dist/src/outside-call/utils.js +1 -1
  12. package/dist/src/shield/crypto/const.js +4 -0
  13. package/dist/src/shield/crypto/index.js +53 -0
  14. package/dist/src/shield/crypto/sm2.js +7 -0
  15. package/dist/src/shield/crypto/sm4.js +15 -0
  16. package/dist/src/shield/crypto/util.js +29 -0
  17. package/dist/src/shield/gcm-crypto/axios-adapter.js +25 -23
  18. package/dist/src/shield/gcm-crypto/index.js +16 -15
  19. package/dist/vendor/base64-js/index.js +52 -0
  20. package/dist/vendor/file-type/source/detectors/zip.js +64 -60
  21. package/dist/vendor/file-type/source/index.js +146 -130
  22. package/dist/vendor/file-type/source/supported.js +4 -2
  23. package/dist/vendor/gm-crypt/index.js +10 -0
  24. package/dist/vendor/gm-crypt/src/crypt.js +60 -0
  25. package/dist/vendor/gm-crypt/src/sm4.js +513 -0
  26. package/dist/vendor/ieee754/index.js +1 -1
  27. package/dist/vendor/jsbn/index.js +714 -0
  28. package/dist/vendor/sdp-transform/lib/index.js +1 -1
  29. package/dist/vendor/sm-crypto/src/index.js +14 -0
  30. package/dist/vendor/sm-crypto/src/sm2/asn1.js +86 -0
  31. package/dist/vendor/sm-crypto/src/sm2/ec.js +205 -0
  32. package/dist/vendor/sm-crypto/src/sm2/index.js +114 -0
  33. package/dist/vendor/sm-crypto/src/sm2/sm3.js +71 -0
  34. package/dist/vendor/sm-crypto/src/sm2/utils.js +95 -0
  35. package/dist/vendor/sm-crypto/src/sm3/index.js +50 -0
  36. package/dist/vendor/sm-crypto/src/sm4/index.js +408 -0
  37. package/dist/vendor/token-types/lib/index.js +1 -1
  38. package/dist/vite-plugins/index.d.ts +42 -0
  39. package/package.json +13 -13
@@ -1,9 +1,9 @@
1
- import { UINT32_BE as T, UINT16_BE as p, StringType as S, UINT16_LE as g, UINT32_LE as C } from "../../token-types/lib/index.js";
2
- import { fromWebStream as z, fromBuffer as I, fromBlob as M } from "../../strtok3/lib/core.js";
1
+ import { UINT32_BE as T, UINT16_BE as p, StringType as S, UINT16_LE as g, UINT32_LE as z } from "../../token-types/lib/index.js";
2
+ import { fromWebStream as I, fromBuffer as M, fromBlob as O } from "../../strtok3/lib/core.js";
3
3
  import "../../@tokenizer/inflate/lib/ZipHandler.js";
4
- import { GzipHandler as O } from "../../@tokenizer/inflate/lib/GzipHandler.js";
5
- import { concatUint8Arrays as P } from "../../uint8array-extras/index.js";
6
- import { stringToBytes as j, uint32SyncSafeToken as R, tarHeaderChecksumMatches as L } from "./tokens.js";
4
+ import { GzipHandler as P } from "../../@tokenizer/inflate/lib/GzipHandler.js";
5
+ import { concatUint8Arrays as j } from "../../uint8array-extras/index.js";
6
+ import { stringToBytes as A, uint32SyncSafeToken as L, tarHeaderChecksumMatches as R } from "./tokens.js";
7
7
  import { mimeTypes as N, extensions as U } from "./supported.js";
8
8
  import { ParserHardLimitError as q, hasUnknownFileSize as l, checkBytes as h, safeIgnore as F, maximumUntrustedSkipSizeInBytes as b } from "./parser.js";
9
9
  import { detectZip as G } from "./detectors/zip.js";
@@ -11,71 +11,75 @@ import { detectEbml as _ } from "./detectors/ebml.js";
11
11
  import { detectPng as H } from "./detectors/png.js";
12
12
  import { detectAsf as V } from "./detectors/asf.js";
13
13
  import { EndOfStreamError as d } from "../../strtok3/lib/stream/Errors.js";
14
- const k = 4100, W = k - 2, $ = b, K = 1, A = 100, w = b, X = 512, v = 256, Z = 1024 * 1024, B = b;
15
- function J(n) {
16
- return Number.isFinite(n) ? Math.max(1, Math.trunc(n)) : k;
14
+ const k = 4100, W = k - 4, $ = b, K = 1, B = 100, w = b, X = 512, v = 256, Z = 1024 * 1024, D = b;
15
+ function J(s) {
16
+ return Number.isFinite(s) ? Math.max(1, Math.trunc(s)) : k;
17
17
  }
18
- function Q(n) {
19
- return Number.isFinite(n) ? Math.max(0, Math.min(W, Math.trunc(n))) : 0;
18
+ function Q(s) {
19
+ return Number.isFinite(s) ? Math.max(0, Math.min(W, Math.trunc(s))) : 0;
20
20
  }
21
- function Y(n) {
22
- return Number.isFinite(n) ? Math.max(0, n) : Number.MAX_SAFE_INTEGER;
21
+ function Y(s) {
22
+ return Number.isFinite(s) ? Math.max(0, s) : Number.MAX_SAFE_INTEGER;
23
23
  }
24
- function D(n) {
25
- return import(n);
24
+ function E(s) {
25
+ return import(
26
+ /* @vite-ignore */
27
+ /* webpackIgnore: true */
28
+ s
29
+ );
26
30
  }
27
- function ee(n) {
28
- return n.pipeThrough(new TransformStream());
31
+ function ee(s) {
32
+ return s.pipeThrough(new TransformStream());
29
33
  }
30
- function E(n, e) {
31
- return e === void 0 ? n.read() : (e.throwIfAborted(), Promise.race([
32
- n.read(),
33
- new Promise((t, i) => {
34
+ function C(s, e) {
35
+ return e === void 0 ? s.read() : (e.throwIfAborted(), Promise.race([
36
+ s.read(),
37
+ new Promise((i, r) => {
34
38
  e.addEventListener("abort", () => {
35
- i(e.reason), n.cancel(e.reason).catch(() => {
39
+ r(e.reason), s.cancel(e.reason).catch(() => {
36
40
  });
37
41
  }, { once: !0 });
38
42
  })
39
43
  ]));
40
44
  }
41
- function te(n, e) {
42
- const t = n.getReader();
43
- let i = 0, r = !1, s = !1;
45
+ function te(s, e) {
46
+ const i = s.getReader();
47
+ let r = 0, t = !1, n = !1;
44
48
  const c = async (x) => {
45
- r || s || (s = !0, await t.cancel(x));
49
+ t || n || (n = !0, await i.cancel(x));
46
50
  };
47
51
  return new ReadableStream({
48
52
  async pull(x) {
49
- if (i >= e) {
53
+ if (r >= e) {
50
54
  x.close(), await c();
51
55
  return;
52
56
  }
53
- const { done: f, value: a } = await t.read();
57
+ const { done: f, value: a } = await i.read();
54
58
  if (f || !a) {
55
- r = !0, x.close();
59
+ t = !0, x.close();
56
60
  return;
57
61
  }
58
- const u = e - i;
62
+ const u = e - r;
59
63
  if (a.length > u) {
60
- x.enqueue(a.subarray(0, u)), i += u, x.close(), await c();
64
+ x.enqueue(a.subarray(0, u)), r += u, x.close(), await c();
61
65
  return;
62
66
  }
63
- x.enqueue(a), i += a.length;
67
+ x.enqueue(a), r += a.length;
64
68
  },
65
69
  async cancel(x) {
66
70
  await c(x);
67
71
  }
68
72
  });
69
73
  }
70
- async function le(n, e) {
71
- return new y(e).fromStream(n);
74
+ async function le(s, e) {
75
+ return new y(e).fromStream(s);
72
76
  }
73
77
  class y {
74
78
  constructor(e) {
75
- const t = Q(e?.mpegOffsetTolerance);
79
+ const i = Q(e?.mpegOffsetTolerance);
76
80
  this.options = {
77
81
  ...e,
78
- mpegOffsetTolerance: t
82
+ mpegOffsetTolerance: i
79
83
  }, this.detectors = [
80
84
  ...this.options.customDetectors ?? [],
81
85
  { id: "core", detect: this.detectConfident },
@@ -90,23 +94,23 @@ class y {
90
94
  };
91
95
  }
92
96
  createTokenizerFromWebStream(e) {
93
- return z(ee(e), this.getTokenizerOptions());
97
+ return I(ee(e), this.getTokenizerOptions());
94
98
  }
95
- async parseTokenizer(e, t = 0) {
96
- this.detectionReentryCount = t;
97
- const i = e.position;
98
- for (const r of this.detectors) {
99
- let s;
99
+ async parseTokenizer(e, i = 0) {
100
+ this.detectionReentryCount = i;
101
+ const r = e.position;
102
+ for (const t of this.detectors) {
103
+ let n;
100
104
  try {
101
- s = await r.detect(e);
105
+ n = await t.detect(e);
102
106
  } catch (c) {
103
107
  if (c instanceof d || c instanceof q)
104
108
  return;
105
109
  throw c;
106
110
  }
107
- if (s)
108
- return s;
109
- if (i !== e.position)
111
+ if (n)
112
+ return n;
113
+ if (r !== e.position)
110
114
  return;
111
115
  }
112
116
  }
@@ -120,68 +124,68 @@ class y {
120
124
  async fromBuffer(e) {
121
125
  if (!(e instanceof Uint8Array || e instanceof ArrayBuffer))
122
126
  throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);
123
- const t = e instanceof Uint8Array ? e : new Uint8Array(e);
124
- if (t?.length > 1)
125
- return this.fromTokenizer(I(t, this.getTokenizerOptions()));
127
+ const i = e instanceof Uint8Array ? e : new Uint8Array(e);
128
+ if (i?.length > 1)
129
+ return this.fromTokenizer(M(i, this.getTokenizerOptions()));
126
130
  }
127
131
  async fromBlob(e) {
128
132
  this.options.signal?.throwIfAborted();
129
- const t = M(e, this.getTokenizerOptions());
130
- return this.fromTokenizer(t);
133
+ const i = O(e, this.getTokenizerOptions());
134
+ return this.fromTokenizer(i);
131
135
  }
132
136
  async fromStream(e) {
133
137
  this.options.signal?.throwIfAborted();
134
- const t = this.createTokenizerFromWebStream(e);
135
- return this.fromTokenizer(t);
138
+ const i = this.createTokenizerFromWebStream(e);
139
+ return this.fromTokenizer(i);
136
140
  }
137
141
  async fromFile(e) {
138
142
  this.options.signal?.throwIfAborted();
139
- const [{ default: t }, { FileTokenizer: i }] = await Promise.all([
140
- D("node:fs/promises"),
141
- D("strtok3")
142
- ]), r = await t.open(e, t.constants.O_RDONLY | t.constants.O_NONBLOCK), s = await r.stat();
143
- if (!s.isFile()) {
144
- await r.close();
143
+ const [{ default: i }, { FileTokenizer: r }] = await Promise.all([
144
+ E("node:fs/promises"),
145
+ E("strtok3")
146
+ ]), t = await i.open(e, i.constants.O_RDONLY | i.constants.O_NONBLOCK), n = await t.stat();
147
+ if (!n.isFile()) {
148
+ await t.close();
145
149
  return;
146
150
  }
147
- const c = new i(r, {
151
+ const c = new r(t, {
148
152
  ...this.getTokenizerOptions(),
149
- fileInfo: { path: e, size: s.size }
153
+ fileInfo: { path: e, size: n.size }
150
154
  });
151
155
  return this.fromTokenizer(c);
152
156
  }
153
- async toDetectionStream(e, t) {
157
+ async toDetectionStream(e, i) {
154
158
  this.options.signal?.throwIfAborted();
155
- const i = J(t?.sampleSize ?? k);
156
- let r, s = !1;
159
+ const r = J(i?.sampleSize ?? k);
160
+ let t, n = !1;
157
161
  const c = e.getReader(), x = [];
158
162
  let f = 0;
159
163
  try {
160
- for (; f < i; ) {
161
- const { value: m, done: o } = await E(c, this.options.signal);
164
+ for (; f < r; ) {
165
+ const { value: m, done: o } = await C(c, this.options.signal);
162
166
  if (o || !m) {
163
- s = !0;
167
+ n = !0;
164
168
  break;
165
169
  }
166
170
  x.push(m), f += m.length;
167
171
  }
168
- if (!s && f === i) {
169
- const { value: m, done: o } = await E(c, this.options.signal);
170
- o || !m ? s = !0 : (x.push(m), f += m.length);
172
+ if (!n && f === r) {
173
+ const { value: m, done: o } = await C(c, this.options.signal);
174
+ o || !m ? n = !0 : (x.push(m), f += m.length);
171
175
  }
172
176
  } finally {
173
177
  c.releaseLock();
174
178
  }
175
179
  if (f > 0) {
176
- const m = x.length === 1 ? x[0] : P(x);
180
+ const m = x.length === 1 ? x[0] : j(x);
177
181
  try {
178
- r = await this.fromBuffer(m.subarray(0, i));
182
+ t = await this.fromBuffer(m.subarray(0, r));
179
183
  } catch (o) {
180
184
  if (!(o instanceof d))
181
185
  throw o;
182
- r = void 0;
186
+ t = void 0;
183
187
  }
184
- !s && r?.ext === "pages" && (r = {
188
+ !n && t?.ext === "pages" && (t = {
185
189
  ext: "zip",
186
190
  mime: "application/zip"
187
191
  });
@@ -195,7 +199,7 @@ class y {
195
199
  o.enqueue(m);
196
200
  }
197
201
  }), u = e.pipeThrough(a);
198
- return u.fileType = r, u;
202
+ return u.fileType = t, u;
199
203
  }
200
204
  async detectGzip(e) {
201
205
  if (this.gzipProbeDepth >= K)
@@ -203,25 +207,25 @@ class y {
203
207
  ext: "gz",
204
208
  mime: "application/gzip"
205
209
  };
206
- const t = new O(e), i = te(t.inflate(), $), r = l(e);
207
- let s, c, x, f;
208
- if (r) {
210
+ const i = new P(e), r = te(i.inflate(), $), t = l(e);
211
+ let n, c, x, f;
212
+ if (t) {
209
213
  const a = new AbortController();
210
- s = setTimeout(() => {
211
- a.abort(new DOMException(`Operation timed out after ${A} ms`, "TimeoutError"));
212
- }, A), c = this.options.signal === void 0 ? a.signal : AbortSignal.any([this.options.signal, a.signal]), x = new y({
214
+ n = setTimeout(() => {
215
+ a.abort(new DOMException(`Operation timed out after ${B} ms`, "TimeoutError"));
216
+ }, B), c = this.options.signal === void 0 ? a.signal : AbortSignal.any([this.options.signal, a.signal]), x = new y({
213
217
  ...this.options,
214
218
  signal: c
215
219
  }), x.gzipProbeDepth = this.gzipProbeDepth + 1;
216
220
  } else
217
221
  this.gzipProbeDepth++;
218
222
  try {
219
- f = await (x ?? this).fromStream(i);
223
+ f = await (x ?? this).fromStream(r);
220
224
  } catch (a) {
221
225
  if (a?.name === "AbortError" && c?.reason?.name !== "TimeoutError")
222
226
  throw a;
223
227
  } finally {
224
- clearTimeout(s), r || this.gzipProbeDepth--;
228
+ clearTimeout(n), t || this.gzipProbeDepth--;
225
229
  }
226
230
  return f?.ext === "tar" ? {
227
231
  ext: "tar.gz",
@@ -231,11 +235,11 @@ class y {
231
235
  mime: "application/gzip"
232
236
  };
233
237
  }
234
- check(e, t) {
235
- return h(this.buffer, e, t);
238
+ check(e, i) {
239
+ return h(this.buffer, e, i);
236
240
  }
237
- checkString(e, t) {
238
- return this.check(j(e, t?.encoding), t);
241
+ checkString(e, i) {
242
+ return this.check(A(e, i?.encoding), i);
239
243
  }
240
244
  // Detections with a high degree of certainty in identifying the correct file type
241
245
  detectConfident = async (e) => {
@@ -308,23 +312,23 @@ class y {
308
312
  maximumLength: 6,
309
313
  reason: "ID3 header prefix"
310
314
  });
311
- const t = await e.readToken(R), i = l(e);
312
- if (!Number.isFinite(t) || t < 0 || i && (t > w || e.position + t > w))
315
+ const t = await e.readToken(L), n = l(e);
316
+ if (!Number.isFinite(t) || t < 0 || n && (t > w || e.position + t > w))
313
317
  return;
314
318
  if (e.position + t > e.fileInfo.size)
315
- return i ? void 0 : {
319
+ return n ? void 0 : {
316
320
  ext: "mp3",
317
321
  mime: "audio/mpeg"
318
322
  };
319
323
  try {
320
324
  await F(e, t, {
321
- maximumLength: i ? w : e.fileInfo.size,
325
+ maximumLength: n ? w : e.fileInfo.size,
322
326
  reason: "ID3 payload"
323
327
  });
324
- } catch (r) {
325
- if (r instanceof d)
328
+ } catch (c) {
329
+ if (c instanceof d)
326
330
  return;
327
- throw r;
331
+ throw c;
328
332
  }
329
333
  return this.detectionReentryCount >= v ? void 0 : (this.detectionReentryCount++, this.parseTokenizer(e, this.detectionReentryCount));
330
334
  }
@@ -608,13 +612,13 @@ class y {
608
612
  mime: "application/vnd.ms-htmlhelp"
609
613
  };
610
614
  if (this.check([202, 254, 186, 190])) {
611
- const t = T.get(this.buffer, 4), i = p.get(this.buffer, 6);
615
+ const t = T.get(this.buffer, 4), n = p.get(this.buffer, 6);
612
616
  if (t > 0 && t <= 30)
613
617
  return {
614
618
  ext: "macho",
615
619
  mime: "application/x-mach-binary"
616
620
  };
617
- if (i > 30)
621
+ if (n > 30)
618
622
  return {
619
623
  ext: "class",
620
624
  mime: "application/java-vm"
@@ -893,8 +897,8 @@ class y {
893
897
  const t = new DataView(this.buffer.buffer).getUint32(12, !0);
894
898
  if (t > 12 && this.buffer.length >= t + 16)
895
899
  try {
896
- const i = new TextDecoder().decode(this.buffer.subarray(16, t + 16));
897
- if (JSON.parse(i).files)
900
+ const n = new TextDecoder().decode(this.buffer.subarray(16, t + 16));
901
+ if (JSON.parse(n).files)
898
902
  return {
899
903
  ext: "asar",
900
904
  mime: "application/x-asar"
@@ -963,7 +967,7 @@ class y {
963
967
  ext: "jmp",
964
968
  mime: "application/x-jmp-data"
965
969
  };
966
- if (await e.peekBuffer(this.buffer, { length: Math.min(512, e.fileInfo.size), mayBeLess: !0 }), this.checkString("ustar", { offset: 257 }) && (this.checkString("\0", { offset: 262 }) || this.checkString(" ", { offset: 262 })) || this.check([0, 0, 0, 0, 0, 0], { offset: 257 }) && L(this.buffer))
970
+ if (await e.peekBuffer(this.buffer, { length: Math.min(512, e.fileInfo.size), mayBeLess: !0 }), this.checkString("ustar", { offset: 257 }) && (this.checkString("\0", { offset: 262 }) || this.checkString(" ", { offset: 262 })) || this.check([0, 0, 0, 0, 0, 0], { offset: 257 }) && R(this.buffer))
967
971
  return {
968
972
  ext: "tar",
969
973
  mime: "application/x-tar"
@@ -987,12 +991,25 @@ class y {
987
991
  ext: "pgp",
988
992
  mime: "application/pgp-encrypted"
989
993
  };
994
+ const i = 32769, r = 5;
995
+ if (e.supportsRandomAccess() && e.fileInfo.size >= i + r) {
996
+ const t = new Uint8Array(r);
997
+ if (await e.peekBuffer(t, {
998
+ position: i,
999
+ length: r,
1000
+ mayBeLess: !0
1001
+ }), h(t, A("CD001")))
1002
+ return {
1003
+ ext: "iso",
1004
+ mime: "application/x-iso9660-image"
1005
+ };
1006
+ }
990
1007
  };
991
1008
  // Detections with limited supporting data, resulting in a higher likelihood of false positives
992
1009
  detectImprecise = async (e) => {
993
1010
  this.buffer = new Uint8Array(k);
994
- const t = Y(e.fileInfo.size);
995
- if (await e.peekBuffer(this.buffer, { length: Math.min(8, t), mayBeLess: !0 }), this.check([0, 0, 1, 186]) || this.check([0, 0, 1, 179]))
1011
+ const i = Y(e.fileInfo.size);
1012
+ if (await e.peekBuffer(this.buffer, { length: Math.min(8, i), mayBeLess: !0 }), this.check([0, 0, 1, 186]) || this.check([0, 0, 1, 179]))
996
1013
  return {
997
1014
  ext: "mpg",
998
1015
  mime: "video/mpeg"
@@ -1012,16 +1029,16 @@ class y {
1012
1029
  ext: "cur",
1013
1030
  mime: "image/x-icon"
1014
1031
  };
1015
- if (await e.peekBuffer(this.buffer, { length: Math.min(2 + this.options.mpegOffsetTolerance, t), mayBeLess: !0 }), this.buffer.length >= 2 + this.options.mpegOffsetTolerance)
1016
- for (let i = 0; i <= this.options.mpegOffsetTolerance; ++i) {
1017
- const r = this.scanMpeg(i);
1018
- if (r)
1019
- return r;
1032
+ if (await e.peekBuffer(this.buffer, { length: Math.min(4 + this.options.mpegOffsetTolerance, i), mayBeLess: !0 }), this.buffer.length >= 4 + this.options.mpegOffsetTolerance)
1033
+ for (let r = 0; r <= this.options.mpegOffsetTolerance; ++r) {
1034
+ const t = this.scanMpeg(r);
1035
+ if (t)
1036
+ return t;
1020
1037
  }
1021
1038
  };
1022
1039
  async readTiffTag(e) {
1023
- const t = await this.tokenizer.readToken(e ? p : g);
1024
- switch (await this.tokenizer.ignore(10), t) {
1040
+ const i = await this.tokenizer.readToken(e ? p : g);
1041
+ switch (await this.tokenizer.ignore(10), i) {
1025
1042
  case 50341:
1026
1043
  return {
1027
1044
  ext: "arw",
@@ -1035,27 +1052,27 @@ class y {
1035
1052
  }
1036
1053
  }
1037
1054
  async readTiffIFD(e) {
1038
- const t = await this.tokenizer.readToken(e ? p : g);
1039
- if (!(t > X) && !(l(this.tokenizer) && 2 + t * 12 > B))
1040
- for (let i = 0; i < t; ++i) {
1041
- const r = await this.readTiffTag(e);
1042
- if (r)
1043
- return r;
1055
+ const i = await this.tokenizer.readToken(e ? p : g);
1056
+ if (!(i > X) && !(l(this.tokenizer) && 2 + i * 12 > D))
1057
+ for (let r = 0; r < i; ++r) {
1058
+ const t = await this.readTiffTag(e);
1059
+ if (t)
1060
+ return t;
1044
1061
  }
1045
1062
  }
1046
1063
  async readTiffHeader(e) {
1047
- const t = {
1064
+ const i = {
1048
1065
  ext: "tif",
1049
1066
  mime: "image/tiff"
1050
- }, i = (e ? p : g).get(this.buffer, 2), r = (e ? T : C).get(this.buffer, 4);
1051
- if (i === 42) {
1052
- if (r >= 6) {
1067
+ }, r = (e ? p : g).get(this.buffer, 2), t = (e ? T : z).get(this.buffer, 4);
1068
+ if (r === 42) {
1069
+ if (t >= 6) {
1053
1070
  if (this.checkString("CR", { offset: 8 }))
1054
1071
  return {
1055
1072
  ext: "cr2",
1056
1073
  mime: "image/x-canon-cr2"
1057
1074
  };
1058
- if (r >= 8) {
1075
+ if (t >= 8) {
1059
1076
  const x = (e ? p : g).get(this.buffer, 8), f = (e ? p : g).get(this.buffer, 10);
1060
1077
  if (x === 28 && f === 254 || x === 31 && f === 11)
1061
1078
  return {
@@ -1064,12 +1081,12 @@ class y {
1064
1081
  };
1065
1082
  }
1066
1083
  }
1067
- if (l(this.tokenizer) && r > Z)
1068
- return t;
1069
- const s = l(this.tokenizer) ? B : this.tokenizer.fileInfo.size;
1084
+ if (l(this.tokenizer) && t > Z)
1085
+ return i;
1086
+ const n = l(this.tokenizer) ? D : this.tokenizer.fileInfo.size;
1070
1087
  try {
1071
- await F(this.tokenizer, r, {
1072
- maximumLength: s,
1088
+ await F(this.tokenizer, t, {
1089
+ maximumLength: n,
1073
1090
  reason: "TIFF IFD offset"
1074
1091
  });
1075
1092
  } catch (x) {
@@ -1085,10 +1102,10 @@ class y {
1085
1102
  return;
1086
1103
  throw x;
1087
1104
  }
1088
- return c ?? t;
1105
+ return c ?? i;
1089
1106
  }
1090
- if (i === 43)
1091
- return t;
1107
+ if (r === 43)
1108
+ return i;
1092
1109
  }
1093
1110
  /**
1094
1111
  Scan check MPEG 1 or 2 Layer 3 header, or 'layer 0' for ADTS (MPEG sync-word 0xFFE).
@@ -1099,13 +1116,12 @@ class y {
1099
1116
  scanMpeg(e) {
1100
1117
  if (this.check([255, 224], { offset: e, mask: [255, 224] })) {
1101
1118
  if (this.check([16], { offset: e + 1, mask: [22] }))
1102
- return this.check([8], { offset: e + 1, mask: [8] }) ? {
1103
- ext: "aac",
1104
- mime: "audio/aac"
1105
- } : {
1119
+ return {
1106
1120
  ext: "aac",
1107
1121
  mime: "audio/aac"
1108
1122
  };
1123
+ if (this.check([255, 254], { offset: e }) || this.check([8], { offset: e + 1, mask: [24] }) || this.check([240], { offset: e + 2, mask: [240] }) || this.check([12], { offset: e + 2, mask: [12] }))
1124
+ return;
1109
1125
  if (this.check([2], { offset: e + 1, mask: [6] }))
1110
1126
  return {
1111
1127
  ext: "mp3",
@@ -181,7 +181,8 @@ const a = [
181
181
  "dat",
182
182
  "key",
183
183
  "numbers",
184
- "pages"
184
+ "pages",
185
+ "iso"
185
186
  ], i = [
186
187
  "image/jpeg",
187
188
  "image/png",
@@ -364,7 +365,8 @@ const a = [
364
365
  "application/x-jmp-data",
365
366
  "application/vnd.apple.keynote",
366
367
  "application/vnd.apple.numbers",
367
- "application/vnd.apple.pages"
368
+ "application/vnd.apple.pages",
369
+ "application/x-iso9660-image"
368
370
  ];
369
371
  export {
370
372
  a as extensions,
@@ -0,0 +1,10 @@
1
+ import { __require as t } from "./src/sm4.js";
2
+ var r, e;
3
+ function m() {
4
+ return e || (e = 1, r = {
5
+ sm4: t()
6
+ }), r;
7
+ }
8
+ export {
9
+ m as __require
10
+ };
@@ -0,0 +1,60 @@
1
+ import { __require as a } from "../../base64-js/index.js";
2
+ import n from "util";
3
+ var t, d;
4
+ function y() {
5
+ if (d) return t;
6
+ d = 1;
7
+ const o = a();
8
+ class c {
9
+ /**
10
+ * Converts a JS string to an UTF-8 uint8array.
11
+ *
12
+ * @static
13
+ * @param {String} str 16-bit unicode string.
14
+ * @return {Uint8Array} UTF-8 Uint8Array.
15
+ * @memberof Crypt
16
+ */
17
+ static stringToArrayBufferInUtf8(e) {
18
+ const r = typeof window > "u" ? n.TextEncoder : window.TextEncoder;
19
+ return new r().encode(e);
20
+ }
21
+ /**
22
+ * Converts an UTF-8 uint8array to a JS string.
23
+ *
24
+ * @static
25
+ * @param {Uint8Array} strBuffer UTF-8 Uint8Array.
26
+ * @return {String} 16-bit unicode string.
27
+ * @memberof Crypt
28
+ */
29
+ static utf8ArrayBufferToString(e) {
30
+ const r = typeof window > "u" ? n.TextDecoder : window.TextDecoder;
31
+ return new r("utf-8").decode(e);
32
+ }
33
+ /**
34
+ * crypt a utf8 byteArray to base64 string
35
+ *
36
+ * @static
37
+ * @param {Uint8Array} strBuffer UTF-8 Uint8Array.
38
+ * @returns {String} base64 str
39
+ * @memberof Crypt
40
+ */
41
+ static arrayBufferToBase64(e) {
42
+ return o.fromByteArray(e);
43
+ }
44
+ /**
45
+ * crypt base64 stringa to utf8 byteArray
46
+ *
47
+ * @static
48
+ * @param {String} base64 str
49
+ * @returns {Uint8Array} strBuffer UTF-8 Uint8Array.
50
+ * @memberof Crypt
51
+ */
52
+ static base64ToArrayBuffer(e) {
53
+ return o.toByteArray(e);
54
+ }
55
+ }
56
+ return t = c, t;
57
+ }
58
+ export {
59
+ y as __require
60
+ };