@unicom-cloud/utils 0.1.14 → 0.1.16

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 (40) hide show
  1. package/content-disposition/index.js +34 -31
  2. package/contentDisposition.js +7 -5
  3. package/file/saveAs.js +13 -14
  4. package/lunar/lib/Holiday.js +2 -6
  5. package/lunar/lib/HolidayUtil.js +113 -99
  6. package/lunar/lib/I18n.js +395 -975
  7. package/lunar/lib/JieQi.js +12 -16
  8. package/lunar/lib/Lunar.js +224 -672
  9. package/lunar/lib/LunarMonth.js +35 -98
  10. package/lunar/lib/LunarTime.js +24 -103
  11. package/lunar/lib/LunarUtil.js +426 -1728
  12. package/lunar/lib/LunarYear.js +473 -566
  13. package/lunar/lib/ShouXingUtil.js +6714 -6690
  14. package/lunar/lib/Solar.js +24 -49
  15. package/lunar/lib/SolarHalfYear.js +0 -2
  16. package/lunar/lib/SolarMonth.js +4 -6
  17. package/lunar/lib/SolarSeason.js +0 -2
  18. package/lunar/lib/SolarUtil.js +238 -226
  19. package/lunar/lib/SolarWeek.js +7 -11
  20. package/lunar/lib/SolarYear.js +0 -1
  21. package/mock/MockWebSocket.js +2 -2
  22. package/package.json +1 -1
  23. package/snapdom/src/api/snapdom.js +72 -71
  24. package/snapdom/src/core/prepare.js +21 -21
  25. package/snapdom/src/modules/background.js +23 -17
  26. package/snapdom/src/modules/fonts.js +99 -91
  27. package/snapdom/src/modules/pseudo.js +59 -70
  28. package/tinycolor/src/conversion.js +1 -1
  29. package/tinycolor/src/index.js +2 -19
  30. package/turbo-stream/src/encode.js +5 -8
  31. package/turbo-stream/src/shared.js +117 -119
  32. package/types/file/saveAs.d.ts +1 -1
  33. package/types/lunar/lib/Lunar.d.ts +0 -98
  34. package/types/lunar/lib/LunarMonth.d.ts +0 -12
  35. package/types/lunar/lib/LunarTime.d.ts +0 -22
  36. package/types/lunar/lib/LunarUtil.d.ts +0 -90
  37. package/types/lunar/lib/LunarYear.d.ts +0 -30
  38. package/types/lunar/lib/Solar.d.ts +0 -5
  39. package/types/snapdom/src/modules/pseudo.d.ts +1 -1
  40. package/types/tinycolor/src/conversion.d.ts +1 -1
@@ -1,89 +1,78 @@
1
- import { cache as M } from "../core/cache.js";
2
- import { iconToImage as q } from "./fonts.js";
3
- import { isIconFont as v } from "./iconFonts.js";
1
+ import { cache as T } from "../core/cache.js";
2
+ import { iconToImage as O } from "./fonts.js";
3
+ import { isIconFont as X } from "./iconFonts.js";
4
4
  import { getStyleKey as $ } from "../utils/cssTools.js";
5
- import { getStyle as G, snapshotComputedStyle as z, parseContent as H, extractURL as J, fetchImage as Q, safeEncodeURI as Y, splitBackgroundImage as Z, inlineSingleBackgroundEntry as tt } from "../utils/helpers.js";
6
- async function et(c, s, p, R = !1, b) {
7
- if (!(c instanceof Element) || !(s instanceof Element)) return;
8
- for (const n of ["::before", "::after", "::first-letter"])
5
+ import { getStyle as _, snapshotComputedStyle as M, parseContent as q, extractURL as G, fetchImage as J, safeEncodeURI as Q, splitBackgroundImage as Y, inlineSingleBackgroundEntry as Z } from "../utils/helpers.js";
6
+ async function tt(i, r, d) {
7
+ if (!(i instanceof Element) || !(r instanceof Element)) return;
8
+ for (const e of ["::before", "::after", "::first-letter"])
9
9
  try {
10
- const t = G(c, n);
11
- if (!t || typeof t[Symbol.iterator] != "function") continue;
12
- if (n === "::first-letter") {
13
- const e = getComputedStyle(c);
14
- if (!(t.color !== e.color || t.fontSize !== e.fontSize || t.fontWeight !== e.fontWeight)) continue;
15
- const i = Array.from(s.childNodes).find(
16
- (C) => C.nodeType === Node.TEXT_NODE && C.textContent && C.textContent.trim().length > 0
10
+ const t = _(i, e);
11
+ if (!t || typeof t[Symbol.iterator] != "function" || t.content === "none" && t.backgroundImage === "none" && t.backgroundColor === "transparent" && (t.borderStyle === "none" || parseFloat(t.borderWidth) === 0) && (!t.transform || t.transform === "none") && t.display === "inline") continue;
12
+ if (e === "::first-letter") {
13
+ const o = getComputedStyle(i);
14
+ if (!(t.color !== o.color || t.fontSize !== o.fontSize || t.fontWeight !== o.fontWeight)) continue;
15
+ const a = Array.from(r.childNodes).find(
16
+ (W) => W.nodeType === Node.TEXT_NODE && W.textContent?.trim().length > 0
17
17
  );
18
- if (!i) continue;
19
- const N = i.textContent, d = N.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0], O = N.slice(d?.length || 0);
20
- if (!d || /[\uD800-\uDFFF]/.test(d)) continue;
21
- const f = document.createElement("span");
22
- f.textContent = d, f.dataset.snapdomPseudo = "::first-letter";
23
- const X = z(t), _ = $(X, "span", p);
24
- M.preStyleMap.set(f, _);
25
- const T = document.createTextNode(O);
26
- s.replaceChild(T, i), s.insertBefore(f, T);
18
+ if (!a) continue;
19
+ const l = a.textContent, h = l.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0], v = l.slice(h?.length || 0);
20
+ if (!h || /[\uD800-\uDFFF]/.test(h)) continue;
21
+ const p = document.createElement("span");
22
+ p.textContent = h, p.dataset.snapdomPseudo = "::first-letter";
23
+ const H = M(t), K = $(H, "span", d);
24
+ T.preStyleMap.set(p, K);
25
+ const P = document.createTextNode(v);
26
+ r.replaceChild(P, a), r.insertBefore(p, P);
27
27
  continue;
28
28
  }
29
- const h = t.getPropertyValue("content"), m = t.getPropertyValue("background-image"), l = t.getPropertyValue("background-color"), E = t.getPropertyValue("font-family"), g = parseInt(t.getPropertyValue("font-size")) || 32, U = parseInt(t.getPropertyValue("font-weight")) || !1, W = t.getPropertyValue("color") || "#000", j = t.getPropertyValue("display"), A = parseFloat(t.getPropertyValue("width")), D = parseFloat(t.getPropertyValue("height")), V = t.getPropertyValue("border-style"), w = t.getPropertyValue("transform"), S = v(E);
30
- let r;
31
- /counter\s*\(|counters\s*\(/.test(h) ? r = "- " : r = H(h);
32
- const B = h !== "none" && r !== "", u = m && m !== "none", y = l && l !== "transparent" && l !== "rgba(0, 0, 0, 0)", F = j !== "inline" && (A > 0 || D > 0), k = V && V !== "none", I = w && w !== "none";
33
- if (!(B || u || y || F || k || I)) continue;
34
- const o = document.createElement("span");
35
- o.dataset.snapdomPseudo = n;
36
- const L = z(t), K = $(L, "span", p);
37
- if (M.preStyleMap.set(o, K), S && r.length === 1) {
38
- const e = document.createElement("img");
39
- e.src = await q(
40
- r,
41
- E,
29
+ const g = t.content, c = /counter\s*\(|counters\s*\(/.test(g) ? "- " : q(g), u = t.backgroundImage, f = t.backgroundColor, x = t.fontFamily, m = parseInt(t.fontSize) || 32, U = parseInt(t.fontWeight) || !1, z = t.color || "#000", A = t.display, R = parseFloat(t.width), j = parseFloat(t.height), S = t.borderStyle, D = parseFloat(t.borderWidth), w = t.transform, F = X(x), I = g !== "none" && c !== "", y = u && u !== "none", b = f && f !== "transparent" && f !== "rgba(0, 0, 0, 0)", k = A !== "inline" && (R > 0 || j > 0), B = S && S !== "none" && D > 0, N = w && w !== "none";
30
+ if (!(I || y || b || k || B || N)) continue;
31
+ const n = document.createElement("span");
32
+ n.dataset.snapdomPseudo = e, n.style.verticalAlign = "middle";
33
+ const L = M(t), V = $(L, "span", d);
34
+ if (T.preStyleMap.set(n, V), F && c.length === 1) {
35
+ const { dataUrl: o, width: s, height: a } = await O(
36
+ c,
37
+ x,
42
38
  U,
43
- g,
44
- W
45
- ), e.style = `width:${g}px;height:auto;object-fit:contain;`, o.appendChild(e);
46
- } else if (r.startsWith("url(")) {
47
- const e = J(r);
48
- if (e && e.trim() !== "")
39
+ m,
40
+ z
41
+ ), l = document.createElement("img");
42
+ l.src = o, l.style = `height:${m}px;width:${s / a * m}px;object-fit:contain;`, n.appendChild(l), r.dataset.snapdomHasIcon = "true";
43
+ } else if (c.startsWith("url(")) {
44
+ const o = G(c);
45
+ if (o?.trim())
49
46
  try {
50
- const a = document.createElement("img"), i = await Q(
51
- Y(e, { useProxy: b })
52
- );
53
- a.src = i, a.style = `width:${g}px;height:auto;object-fit:contain;`, o.appendChild(a);
54
- } catch (a) {
55
- console.error(`[snapdom] Error in pseudo ${n} for`, c, a);
47
+ const s = document.createElement("img"), a = await J(Q(o), d);
48
+ s.src = a, s.style = `width:${m}px;height:auto;object-fit:contain;`, n.appendChild(s);
49
+ } catch (s) {
50
+ console.error(`[snapdom] Error in pseudo ${e} for`, i, s);
56
51
  }
57
- } else !S && B && (o.textContent = r);
58
- if (u)
52
+ } else !F && I && (n.textContent = c);
53
+ if (y)
59
54
  try {
60
- const e = Z(m), a = await Promise.all(
61
- e.map((i) => tt(i))
55
+ const o = Y(u), s = await Promise.all(
56
+ o.map(Z)
62
57
  );
63
- o.style.backgroundImage = a.join(", ");
64
- } catch (e) {
58
+ n.style.backgroundImage = s.join(", ");
59
+ } catch (o) {
65
60
  console.warn(
66
- `[snapdom] Failed to inline background-image for ${n}`,
67
- e
61
+ `[snapdom] Failed to inline background-image for ${e}`,
62
+ o
68
63
  );
69
64
  }
70
- if (y && (o.style.backgroundColor = l), !(o.childNodes.length > 0 || o.textContent && o.textContent.trim() !== "" || u || y || F || k || I)) continue;
71
- n === "::before" ? s.insertBefore(o, s.firstChild) : s.appendChild(o);
65
+ if (b && (n.style.backgroundColor = f), !(n.childNodes.length > 0 || n.textContent?.trim() !== "" || y || b || k || B || N)) continue;
66
+ e === "::before" ? r.insertBefore(n, r.firstChild) : r.appendChild(n);
72
67
  } catch (t) {
73
- console.warn(`[snapdom] Failed to capture ${n} for`, c, t);
68
+ console.warn(`[snapdom] Failed to capture ${e} for`, i, t);
74
69
  }
75
- const x = Array.from(c.children), P = Array.from(s.children).filter(
76
- (n) => !n.dataset.snapdomPseudo
70
+ const C = Array.from(i.children), E = Array.from(r.children).filter(
71
+ (e) => !e.dataset.snapdomPseudo
77
72
  );
78
- for (let n = 0; n < Math.min(x.length, P.length); n++)
79
- await et(
80
- x[n],
81
- P[n],
82
- p,
83
- R,
84
- b
85
- );
73
+ for (let e = 0; e < Math.min(C.length, E.length); e++)
74
+ await tt(C[e], E[e], d);
86
75
  }
87
76
  export {
88
- et as inlinePseudoElements
77
+ tt as inlinePseudoElements
89
78
  };
@@ -43,7 +43,7 @@ function k(n, r, t) {
43
43
  }
44
44
  return { r: e * 255, g: c * 255, b: o * 255 };
45
45
  }
46
- function l(n, r, t) {
46
+ function l(n = 0, r = 0, t = 0) {
47
47
  n = s(n, 255), r = s(r, 255), t = s(t, 255);
48
48
  const e = Math.max(n, r, t), c = Math.min(n, r, t);
49
49
  let o = 0;
@@ -1,25 +1,8 @@
1
1
  import { numberInputToObject as d, rgbToHsv as g, rgbToHsl as u, rgbToHex as b, rgbaToHex as m, rgbToCmyk as c } from "./conversion.js";
2
2
  import { names as $ } from "./css-color-names.js";
3
3
  import { inputToRGB as f } from "./format-input.js";
4
- import { boundAlpha as p, clamp01 as a, bound01 as l } from "./util.js";
4
+ import { boundAlpha as M, clamp01 as a, bound01 as l } from "./util.js";
5
5
  class n {
6
- /** red */
7
- r;
8
- /** green */
9
- g;
10
- /** blue */
11
- b;
12
- /** alpha */
13
- a;
14
- /** the format used to create the tinycolor instance */
15
- format;
16
- /** input passed into the constructer used to create the tinycolor instance */
17
- originalInput;
18
- /** the color was successfully parsed */
19
- isValid;
20
- gradientType;
21
- /** rounded alpha */
22
- roundA;
23
6
  constructor(t = "", s = {}) {
24
7
  if (t instanceof n)
25
8
  return t;
@@ -64,7 +47,7 @@ class n {
64
47
  * @param alpha - The new alpha value. The accepted range is 0-1.
65
48
  */
66
49
  setAlpha(t) {
67
- return this.a = p(t), this.roundA = Math.round(100 * this.a) / 100, this;
50
+ return this.a = M(t), this.roundA = Math.round(100 * this.a) / 100, this;
68
51
  }
69
52
  /**
70
53
  * Returns whether the color is monochrome.
@@ -1,5 +1,5 @@
1
- import { WaitGroup as P, STR_UNDEFINED as h, STR_NULL as M, STR_TRUE as B, STR_FALSE as C, STR_PROMISE as b, STR_READABLE_STREAM as O, STR_ASYNC_ITERABLE as F, STR_REFERENCE_SYMBOL as $, STR_DATE as x, STR_REGEXP as G, STR_URL as J, STR_ARRAY_BUFFER as V, STR_INT_8_ARRAY as j, STR_UINT_8_ARRAY as q, STR_UINT_8_ARRAY_CLAMPED as z, STR_INT_16_ARRAY as W, STR_UINT_16_ARRAY as K, STR_INT_32_ARRAY as X, STR_UINT_32_ARRAY as Z, STR_FLOAT_32_ARRAY as H, STR_FLOAT_64_ARRAY as Q, STR_BIG_INT_64_ARRAY as k, STR_BIG_UINT_64_ARRAY as ee, STR_DATA_VIEW as te, STR_FORM_DATA as ie, SUPPORTS_FILE as ne, STR_FILE as oe, STR_BLOB as se, STR_ERROR as re, STR_SET as ae, STR_MAP as fe, STR_PLUGIN as Y, STR_NaN as pe, STR_INFINITY as Re, STR_NEGATIVE_INFINITY as _e, STR_NEGATIVE_ZERO as le, STR_BIGINT as ue, STR_SYMBOL as Se, STR_REDACTED as Ae, STR_SUCCESS as L, STR_FAILURE as U } from "./shared.js";
2
- const { NEGATIVE_INFINITY: ye, POSITIVE_INFINITY: ce, isNaN: Te } = Number, v = 1, D = 2;
1
+ import { WaitGroup as v, STR_UNDEFINED as h, STR_NULL as M, STR_TRUE as B, STR_FALSE as C, STR_PROMISE as b, STR_READABLE_STREAM as O, STR_ASYNC_ITERABLE as F, STR_REFERENCE_SYMBOL as $, STR_DATE as x, STR_REGEXP as G, STR_URL as J, STR_ARRAY_BUFFER as V, STR_INT_8_ARRAY as j, STR_UINT_8_ARRAY as q, STR_UINT_8_ARRAY_CLAMPED as z, STR_INT_16_ARRAY as W, STR_UINT_16_ARRAY as K, STR_INT_32_ARRAY as X, STR_UINT_32_ARRAY as Z, STR_FLOAT_32_ARRAY as H, STR_FLOAT_64_ARRAY as Q, STR_BIG_INT_64_ARRAY as k, STR_BIG_UINT_64_ARRAY as ee, STR_DATA_VIEW as te, STR_FORM_DATA as ie, SUPPORTS_FILE as ne, STR_FILE as oe, STR_BLOB as se, STR_ERROR as re, STR_SET as ae, STR_MAP as fe, STR_PLUGIN as Y, STR_NaN as pe, STR_INFINITY as Re, STR_NEGATIVE_INFINITY as _e, STR_NEGATIVE_ZERO as le, STR_BIGINT as ue, STR_SYMBOL as Se, STR_REDACTED as Ae, STR_SUCCESS as L, STR_FAILURE as U } from "./shared.js";
2
+ const { NEGATIVE_INFINITY: ye, POSITIVE_INFINITY: ce, isNaN: Te } = Number, P = 1, D = 2;
3
3
  function Ne(f, { plugins: t = [], redactErrors: _ = !0, signal: p } = {}) {
4
4
  const y = () => p?.aborted ?? !1, c = new Promise((a, E) => {
5
5
  p?.addEventListener("abort", (r) => {
@@ -8,7 +8,7 @@ function Ne(f, { plugins: t = [], redactErrors: _ = !0, signal: p } = {}) {
8
8
  });
9
9
  return new ReadableStream({
10
10
  async start(a) {
11
- const E = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), I = { refId: 0, promiseId: 0 }, T = new P(), e = [], u = (o) => {
11
+ const E = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), I = { refId: 0, promiseId: 0 }, T = new v(), e = [], u = (o) => {
12
12
  de(
13
13
  o,
14
14
  e,
@@ -27,7 +27,7 @@ function Ne(f, { plugins: t = [], redactErrors: _ = !0, signal: p } = {}) {
27
27
  }, s = {
28
28
  push: (...o) => {
29
29
  for (const [S, d, w] of o)
30
- T.add(), S === v ? Promise.race([w, c]).then(
30
+ T.add(), S === P ? Promise.race([w, c]).then(
31
31
  i.bind(null, d),
32
32
  n.bind(null, d)
33
33
  ) : (async () => {
@@ -64,9 +64,6 @@ function Ne(f, { plugins: t = [], redactErrors: _ = !0, signal: p } = {}) {
64
64
  }
65
65
  const A = 1, m = 2;
66
66
  class l {
67
- type;
68
- prefix;
69
- value;
70
67
  constructor(t, _, p) {
71
68
  this.type = t, this.prefix = _, this.value = p;
72
69
  }
@@ -112,7 +109,7 @@ function de(f, t, _, p, y, c, a, E) {
112
109
  }
113
110
  const n = c.promiseId++;
114
111
  p.set(e, n), t.push(b, n.toString()), y.push([
115
- v,
112
+ P,
116
113
  n,
117
114
  e
118
115
  ]);
@@ -1,4 +1,4 @@
1
- const T = "A", u = "*", S = "J", f = "j", l = "b", y = "K", A = "V", p = "D", E = "E", w = "!", I = "false", N = "k", b = "H", L = "h", m = "F", B = "I", F = "L", U = "G", Y = "O", x = "M", D = "NaN", M = "i", P = "z", O = "null", z = "P", G = "$", C = "R", g = "<redacted>", v = "@", j = "r", q = "S", V = ":", W = "s", k = "true", H = "l", J = "g", K = "o", Q = "C", X = "u", Z = "U";
1
+ const u = "A", T = "*", S = "J", f = "j", y = "b", A = "K", l = "V", p = "D", E = "E", w = "!", I = "false", N = "k", b = "H", L = "h", B = "F", F = "I", U = "L", Y = "G", x = "O", m = "M", D = "NaN", M = "i", P = "z", O = "null", z = "P", G = "$", g = "R", C = "<redacted>", v = "@", j = "r", q = "S", V = ":", W = "s", k = "true", H = "l", J = "g", K = "o", Q = "C", X = "u", Z = "U";
2
2
  let a = !0;
3
3
  try {
4
4
  new File([], "");
@@ -6,154 +6,152 @@ try {
6
6
  a = !1;
7
7
  }
8
8
  class $ {
9
- p = 0;
10
- #t = [];
11
- #e(e) {
12
- this.p === 0 ? e() : this.#t.push(e);
9
+ constructor() {
10
+ this.p = 0, this.#e = [];
11
+ }
12
+ #e;
13
+ #t(t) {
14
+ this.p === 0 ? t() : this.#e.push(t);
13
15
  }
14
16
  add() {
15
17
  this.p++;
16
18
  }
17
19
  done() {
18
20
  if (--this.p === 0) {
19
- let e;
20
- for (; (e = this.#t.shift()) !== void 0; )
21
- e();
21
+ let t;
22
+ for (; (t = this.#e.shift()) !== void 0; )
23
+ t();
22
24
  }
23
25
  }
24
26
  wait() {
25
- return new Promise(this.#e.bind(this));
27
+ return new Promise(this.#t.bind(this));
26
28
  }
27
29
  }
28
30
  class c {
29
- promise;
30
- resolve;
31
- reject;
32
31
  constructor() {
33
- this.promise = new Promise((e, t) => {
34
- this.resolve = e, this.reject = t;
32
+ this.promise = new Promise((t, e) => {
33
+ this.resolve = t, this.reject = e;
35
34
  });
36
35
  }
37
36
  }
38
37
  class d {
39
- iterable;
40
- #t = new c();
41
- #e = this.#t;
38
+ #e = new c();
39
+ #t = this.#e;
42
40
  constructor() {
43
41
  this.iterable = async function* () {
44
- let e = this.#t;
42
+ let t = this.#e;
45
43
  for (; ; ) {
46
- const t = await e.promise;
47
- if (t.done)
44
+ const e = await t.promise;
45
+ if (e.done)
48
46
  return;
49
- yield t.value, e = t.next;
47
+ yield e.value, t = e.next;
50
48
  }
51
49
  }.bind(this)();
52
50
  }
53
51
  resolve() {
54
- this.#e.resolve({ done: !0 });
52
+ this.#t.resolve({ done: !0 });
55
53
  }
56
- reject(e) {
57
- this.#e.promise.catch(() => {
58
- }), this.#e.reject(e);
54
+ reject(t) {
55
+ this.#t.promise.catch(() => {
56
+ }), this.#t.reject(t);
59
57
  }
60
- yield(e) {
61
- const t = new c();
62
- this.#e.resolve({
58
+ yield(t) {
59
+ const e = new c();
60
+ this.#t.resolve({
63
61
  done: !1,
64
- value: e,
65
- next: t
66
- }), this.#e = t;
62
+ value: t,
63
+ next: e
64
+ }), this.#t = e;
67
65
  }
68
66
  }
69
- class ee extends d {
70
- readable = new ReadableStream({
71
- start: async (e) => {
72
- try {
73
- for await (const t of this.iterable)
74
- e.enqueue(t);
75
- e.close();
76
- } catch (t) {
77
- e.error(t);
67
+ class tt extends d {
68
+ constructor() {
69
+ super(...arguments), this.readable = new ReadableStream({
70
+ start: async (t) => {
71
+ try {
72
+ for await (const e of this.iterable)
73
+ t.enqueue(e);
74
+ t.close();
75
+ } catch (e) {
76
+ t.error(e);
77
+ }
78
78
  }
79
- }
80
- });
79
+ });
80
+ }
81
81
  }
82
82
  class h extends Blob {
83
- promise;
84
- #t;
85
83
  #e;
84
+ #t;
86
85
  #s = {};
87
- constructor(e, t, s, o) {
88
- if (super(), typeof e < "u") {
89
- this.promise = e.promise;
90
- let i = e.#s.start ?? 0;
91
- typeof t < "u" && (i += t), this.#s.start = i;
92
- let r = e.#s.end;
93
- typeof s < "u" && (r = (e.#s.start ?? 0) + s), this.#s.end = r, this.#e = o ?? e?.type, this.#t = (r ?? e.size) - i;
86
+ constructor(t, e, s, o) {
87
+ if (super(), typeof t < "u") {
88
+ this.promise = t.promise;
89
+ let i = t.#s.start ?? 0;
90
+ typeof e < "u" && (i += e), this.#s.start = i;
91
+ let n = t.#s.end;
92
+ typeof s < "u" && (n = (t.#s.start ?? 0) + s), this.#s.end = n, this.#t = o ?? t?.type, this.#e = (n ?? t.size) - i;
94
93
  }
95
94
  }
96
95
  get size() {
97
- if (typeof this.#t > "u")
96
+ if (typeof this.#e > "u")
98
97
  throw new Error("Size is not set");
99
- return this.#t;
98
+ return this.#e;
100
99
  }
101
- set size(e) {
102
- this.#t = e;
100
+ set size(t) {
101
+ this.#e = t;
103
102
  }
104
103
  get type() {
105
- if (typeof this.#e > "u")
104
+ if (typeof this.#t > "u")
106
105
  throw new Error("Type is not set");
107
- return this.#e;
106
+ return this.#t;
108
107
  }
109
- set type(e) {
110
- this.#e = e;
108
+ set type(t) {
109
+ this.#t = t;
111
110
  }
112
111
  async arrayBuffer() {
113
112
  if (!this.promise)
114
113
  throw new Error("Promise is not set");
115
- const e = await this.promise;
116
- return this.#s ? e.slice(
114
+ const t = await this.promise;
115
+ return this.#s ? t.slice(
117
116
  this.#s.start,
118
117
  this.#s.end
119
- ) : e;
118
+ ) : t;
120
119
  }
121
120
  bytes() {
122
- return this.arrayBuffer().then((e) => new Uint8Array(e));
121
+ return this.arrayBuffer().then((t) => new Uint8Array(t));
123
122
  }
124
- slice(e, t, s) {
125
- return new h(this, e, t, s);
123
+ slice(t, e, s) {
124
+ return new h(this, t, e, s);
126
125
  }
127
126
  stream() {
128
127
  return new ReadableStream({
129
- start: async (e) => {
128
+ start: async (t) => {
130
129
  try {
131
- e.enqueue(await this.bytes()), e.close();
132
- } catch (t) {
133
- e.error(t);
130
+ t.enqueue(await this.bytes()), t.close();
131
+ } catch (e) {
132
+ t.error(e);
134
133
  }
135
134
  }
136
135
  });
137
136
  }
138
137
  text() {
139
- return this.bytes().then((e) => new TextDecoder().decode(e));
138
+ return this.bytes().then((t) => new TextDecoder().decode(t));
140
139
  }
141
140
  }
142
141
  const _ = a ? File : Blob;
143
142
  class R extends _ {
144
- promise;
145
- #t;
146
143
  #e;
144
+ #t;
147
145
  #s;
148
- #r;
146
+ #n;
149
147
  #i = {};
150
- constructor(e, t, s, o) {
151
- if (a ? super([], "") : super([]), typeof e < "u") {
152
- this.promise = e.promise;
153
- let i = e.#i.start ?? 0;
154
- typeof t < "u" && (i += t), this.#i.start = i;
155
- let r = e.#i.end;
156
- typeof s < "u" && (r = (e.#i.start ?? 0) + s), this.#i.end = r, this.#e = o ?? e?.type, this.#s = e.name, this.#r = e.lastModified;
148
+ constructor(t, e, s, o) {
149
+ if (a ? super([], "") : super([]), typeof t < "u") {
150
+ this.promise = t.promise;
151
+ let i = t.#i.start ?? 0;
152
+ typeof e < "u" && (i += e), this.#i.start = i;
153
+ let n = t.#i.end;
154
+ typeof s < "u" && (n = (t.#i.start ?? 0) + s), this.#i.end = n, this.#t = o ?? t?.type, this.#s = t.name, this.#n = t.lastModified;
157
155
  }
158
156
  }
159
157
  get name() {
@@ -161,74 +159,74 @@ class R extends _ {
161
159
  throw new Error("Name is not set");
162
160
  return this.#s;
163
161
  }
164
- set name(e) {
165
- this.#s = e;
162
+ set name(t) {
163
+ this.#s = t;
166
164
  }
167
165
  get lastModified() {
168
- if (typeof this.#r > "u")
166
+ if (typeof this.#n > "u")
169
167
  throw new Error("Last modified is not set");
170
- return this.#r;
168
+ return this.#n;
171
169
  }
172
- set lastModified(e) {
173
- this.#r = e;
170
+ set lastModified(t) {
171
+ this.#n = t;
174
172
  }
175
173
  get size() {
176
- if (typeof this.#t > "u")
174
+ if (typeof this.#e > "u")
177
175
  throw new Error("Size is not set");
178
- return this.#t;
176
+ return this.#e;
179
177
  }
180
- set size(e) {
181
- this.#t = e;
178
+ set size(t) {
179
+ this.#e = t;
182
180
  }
183
181
  get type() {
184
- if (typeof this.#e > "u")
182
+ if (typeof this.#t > "u")
185
183
  throw new Error("Type is not set");
186
- return this.#e;
184
+ return this.#t;
187
185
  }
188
- set type(e) {
189
- this.#e = e;
186
+ set type(t) {
187
+ this.#t = t;
190
188
  }
191
189
  async arrayBuffer() {
192
190
  if (!this.promise)
193
191
  throw new Error("Promise is not set");
194
- const e = await this.promise;
195
- return this.#i ? e.slice(
192
+ const t = await this.promise;
193
+ return this.#i ? t.slice(
196
194
  this.#i.start,
197
195
  this.#i.end
198
- ) : e;
196
+ ) : t;
199
197
  }
200
198
  bytes() {
201
- return this.arrayBuffer().then((e) => new Uint8Array(e));
199
+ return this.arrayBuffer().then((t) => new Uint8Array(t));
202
200
  }
203
- slice(e, t, s) {
204
- return new R(this, e, t, s);
201
+ slice(t, e, s) {
202
+ return new R(this, t, e, s);
205
203
  }
206
204
  stream() {
207
205
  return new ReadableStream({
208
- start: async (e) => {
206
+ start: async (t) => {
209
207
  try {
210
- e.enqueue(await this.bytes()), e.close();
211
- } catch (t) {
212
- e.error(t);
208
+ t.enqueue(await this.bytes()), t.close();
209
+ } catch (e) {
210
+ t.error(e);
213
211
  }
214
212
  }
215
213
  });
216
214
  }
217
215
  text() {
218
- return this.bytes().then((e) => new TextDecoder().decode(e));
216
+ return this.bytes().then((t) => new TextDecoder().decode(t));
219
217
  }
220
218
  }
221
219
  export {
222
220
  c as Deferred,
223
221
  d as DeferredAsyncIterable,
224
- ee as DeferredReadableStream,
225
- T as STR_ARRAY_BUFFER,
226
- u as STR_ASYNC_ITERABLE,
227
- l as STR_BIGINT,
222
+ tt as DeferredReadableStream,
223
+ u as STR_ARRAY_BUFFER,
224
+ T as STR_ASYNC_ITERABLE,
225
+ y as STR_BIGINT,
228
226
  S as STR_BIG_INT_64_ARRAY,
229
227
  f as STR_BIG_UINT_64_ARRAY,
230
- y as STR_BLOB,
231
- A as STR_DATA_VIEW,
228
+ A as STR_BLOB,
229
+ l as STR_DATA_VIEW,
232
230
  p as STR_DATE,
233
231
  E as STR_ERROR,
234
232
  w as STR_FAILURE,
@@ -236,20 +234,20 @@ export {
236
234
  N as STR_FILE,
237
235
  b as STR_FLOAT_32_ARRAY,
238
236
  L as STR_FLOAT_64_ARRAY,
239
- m as STR_FORM_DATA,
240
- B as STR_INFINITY,
241
- F as STR_INT_16_ARRAY,
242
- U as STR_INT_32_ARRAY,
243
- Y as STR_INT_8_ARRAY,
244
- x as STR_MAP,
237
+ B as STR_FORM_DATA,
238
+ F as STR_INFINITY,
239
+ U as STR_INT_16_ARRAY,
240
+ Y as STR_INT_32_ARRAY,
241
+ x as STR_INT_8_ARRAY,
242
+ m as STR_MAP,
245
243
  M as STR_NEGATIVE_INFINITY,
246
244
  P as STR_NEGATIVE_ZERO,
247
245
  O as STR_NULL,
248
246
  D as STR_NaN,
249
247
  z as STR_PLUGIN,
250
248
  G as STR_PROMISE,
251
- C as STR_READABLE_STREAM,
252
- g as STR_REDACTED,
249
+ g as STR_READABLE_STREAM,
250
+ C as STR_REDACTED,
253
251
  v as STR_REFERENCE_SYMBOL,
254
252
  j as STR_REGEXP,
255
253
  q as STR_SET,
@@ -1,2 +1,2 @@
1
1
  export default saveAs;
2
- export function saveAs(blob: any, name: any): void;
2
+ export function saveAs(blob: any, name: any): Promise<void>;