@instockng/storefront-ui 1.0.14 → 1.0.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 (108) hide show
  1. package/dist/components/CartItem.d.ts +1 -1
  2. package/dist/components/CartItem.d.ts.map +1 -1
  3. package/dist/components/OrderConfirmation.d.ts.map +1 -1
  4. package/dist/contexts/CartContext.d.ts +2 -2
  5. package/dist/contexts/CartContext.d.ts.map +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index10.mjs +3 -3
  9. package/dist/index100.mjs +33 -5
  10. package/dist/index101.mjs +31 -33
  11. package/dist/index102.mjs +26 -29
  12. package/dist/index103.mjs +59 -26
  13. package/dist/index104.mjs +3 -61
  14. package/dist/index105.mjs +2 -3
  15. package/dist/index106.mjs +2 -2
  16. package/dist/index107.mjs +17 -2
  17. package/dist/index108.mjs +11 -15
  18. package/dist/index109.mjs +6 -13
  19. package/dist/index11.mjs +2 -2
  20. package/dist/index110.mjs +30 -6
  21. package/dist/index13.mjs +1 -1
  22. package/dist/index17.mjs +2 -2
  23. package/dist/index29.mjs +1 -1
  24. package/dist/index30.mjs +1 -1
  25. package/dist/index31.mjs +1 -1
  26. package/dist/index32.mjs +1 -1
  27. package/dist/index33.mjs +1433 -4
  28. package/dist/index34.mjs +2 -1433
  29. package/dist/index35.mjs +57 -2
  30. package/dist/index36.mjs +48 -54
  31. package/dist/index37.mjs +33 -51
  32. package/dist/index38.mjs +15 -33
  33. package/dist/index39.mjs +2260 -12
  34. package/dist/index4.mjs +37 -37
  35. package/dist/index40.mjs +19 -2259
  36. package/dist/index42.mjs +17 -17
  37. package/dist/index43.mjs +2 -2
  38. package/dist/index44.mjs +1 -1
  39. package/dist/index45.mjs +1 -1
  40. package/dist/index46.mjs +1 -1
  41. package/dist/index47.mjs +1 -1
  42. package/dist/index48.mjs +1 -1
  43. package/dist/index49.mjs +1 -1
  44. package/dist/index50.mjs +1 -1
  45. package/dist/index51.mjs +1 -1
  46. package/dist/index52.mjs +1 -1
  47. package/dist/index53.mjs +1 -1
  48. package/dist/index54.mjs +1 -1
  49. package/dist/index55.mjs +73 -21
  50. package/dist/index56.mjs +14 -74
  51. package/dist/index57.mjs +62 -14
  52. package/dist/index58.mjs +4 -62
  53. package/dist/index59.mjs +3 -4
  54. package/dist/index60.mjs +2 -4
  55. package/dist/index61.mjs +34 -2
  56. package/dist/index62.mjs +40 -31
  57. package/dist/index63.mjs +230 -38
  58. package/dist/index64.mjs +4 -233
  59. package/dist/index65.mjs +133 -5
  60. package/dist/index66.mjs +63 -129
  61. package/dist/index67.mjs +86 -67
  62. package/dist/index68.mjs +27 -85
  63. package/dist/index69.mjs +8 -28
  64. package/dist/index70.mjs +74 -8
  65. package/dist/index71.mjs +3 -74
  66. package/dist/index72.mjs +2 -4
  67. package/dist/index73.mjs +83 -2
  68. package/dist/index74.mjs +52 -81
  69. package/dist/index75.mjs +5 -53
  70. package/dist/index76.mjs +4 -5
  71. package/dist/index77.mjs +178 -4
  72. package/dist/index78.mjs +48 -174
  73. package/dist/index79.mjs +67 -51
  74. package/dist/index80.mjs +21 -69
  75. package/dist/index81.mjs +54 -19
  76. package/dist/index82.mjs +28 -55
  77. package/dist/index83.mjs +6 -28
  78. package/dist/index84.mjs +51 -6
  79. package/dist/index85.mjs +5 -51
  80. package/dist/index86.mjs +12 -6
  81. package/dist/index87.mjs +7 -12
  82. package/dist/index88.mjs +27 -6
  83. package/dist/index89.mjs +2 -28
  84. package/dist/index90.mjs +70 -2
  85. package/dist/index91.mjs +164 -67
  86. package/dist/index92.mjs +28 -164
  87. package/dist/index93.mjs +11 -13
  88. package/dist/index94.mjs +4 -7
  89. package/dist/index95.mjs +3 -30
  90. package/dist/index96.mjs +13 -11
  91. package/dist/index97.mjs +7 -4
  92. package/dist/index98.mjs +11 -3
  93. package/dist/index99.mjs +4 -11
  94. package/dist/test-utils/MockCartProvider.d.ts +1 -1
  95. package/dist/test-utils/MockCartProvider.d.ts.map +1 -1
  96. package/package.json +3 -4
  97. package/src/components/CartItem.stories.tsx +1 -1
  98. package/src/components/CartItem.tsx +1 -1
  99. package/src/components/Checkout.stories.tsx +1 -1
  100. package/src/components/Checkout.tsx +2 -2
  101. package/src/components/OrderConfirmation.tsx +7 -2
  102. package/src/components/ProductGrid.tsx +1 -1
  103. package/src/components/ShoppingCart.stories.tsx +1 -1
  104. package/src/contexts/CartContext.tsx +2 -2
  105. package/src/index.ts +3 -2
  106. package/src/providers/StorefrontProvider.tsx +1 -1
  107. package/src/test-utils/MockCartProvider.tsx +1 -1
  108. package/dist/index111.mjs +0 -33
package/dist/index84.mjs CHANGED
@@ -1,10 +1,55 @@
1
1
  'use client';
2
- import r from "./index97.mjs";
3
- import f from "./index98.mjs";
4
- function u(l, i, t) {
5
- let o = !r(i);
6
- return l && (o || t == !1) ? f(l, i) : i;
2
+ import { VERSION as w } from "./index72.mjs";
3
+ import s from "./index74.mjs";
4
+ const l = {};
5
+ ["object", "boolean", "number", "function", "string", "symbol"].forEach((n, t) => {
6
+ l[n] = function(o) {
7
+ return typeof o === n || "a" + (t < 1 ? "n " : " ") + n;
8
+ };
9
+ });
10
+ const f = {};
11
+ l.transitional = function(t, i, o) {
12
+ function a(r, e) {
13
+ return "[Axios v" + w + "] Transitional option '" + r + "'" + e + (o ? ". " + o : "");
14
+ }
15
+ return (r, e, u) => {
16
+ if (t === !1)
17
+ throw new s(
18
+ a(e, " has been removed" + (i ? " in " + i : "")),
19
+ s.ERR_DEPRECATED
20
+ );
21
+ return i && !f[e] && (f[e] = !0, console.warn(
22
+ a(
23
+ e,
24
+ " has been deprecated since v" + i + " and will be removed in the near future"
25
+ )
26
+ )), t ? t(r, e, u) : !0;
27
+ };
28
+ };
29
+ l.spelling = function(t) {
30
+ return (i, o) => (console.warn(`${o} is likely a misspelling of ${t}`), !0);
31
+ };
32
+ function b(n, t, i) {
33
+ if (typeof n != "object")
34
+ throw new s("options must be an object", s.ERR_BAD_OPTION_VALUE);
35
+ const o = Object.keys(n);
36
+ let a = o.length;
37
+ for (; a-- > 0; ) {
38
+ const r = o[a], e = t[r];
39
+ if (e) {
40
+ const u = n[r], c = u === void 0 || e(u, r, n);
41
+ if (c !== !0)
42
+ throw new s("option " + r + " must be " + c, s.ERR_BAD_OPTION_VALUE);
43
+ continue;
44
+ }
45
+ if (i !== !0)
46
+ throw new s("Unknown option " + r, s.ERR_BAD_OPTION);
47
+ }
7
48
  }
49
+ const m = {
50
+ assertOptions: b,
51
+ validators: l
52
+ };
8
53
  export {
9
- u as default
54
+ m as default
10
55
  };
package/dist/index85.mjs CHANGED
@@ -1,55 +1,9 @@
1
1
  'use client';
2
- import { VERSION as w } from "./index73.mjs";
3
- import s from "./index75.mjs";
4
- const l = {};
5
- ["object", "boolean", "number", "function", "string", "symbol"].forEach((n, t) => {
6
- l[n] = function(o) {
7
- return typeof o === n || "a" + (t < 1 ? "n " : " ") + n;
8
- };
9
- });
10
- const f = {};
11
- l.transitional = function(t, i, o) {
12
- function a(r, e) {
13
- return "[Axios v" + w + "] Transitional option '" + r + "'" + e + (o ? ". " + o : "");
14
- }
15
- return (r, e, u) => {
16
- if (t === !1)
17
- throw new s(
18
- a(e, " has been removed" + (i ? " in " + i : "")),
19
- s.ERR_DEPRECATED
20
- );
21
- return i && !f[e] && (f[e] = !0, console.warn(
22
- a(
23
- e,
24
- " has been deprecated since v" + i + " and will be removed in the near future"
25
- )
26
- )), t ? t(r, e, u) : !0;
27
- };
28
- };
29
- l.spelling = function(t) {
30
- return (i, o) => (console.warn(`${o} is likely a misspelling of ${t}`), !0);
31
- };
32
- function b(n, t, i) {
33
- if (typeof n != "object")
34
- throw new s("options must be an object", s.ERR_BAD_OPTION_VALUE);
35
- const o = Object.keys(n);
36
- let a = o.length;
37
- for (; a-- > 0; ) {
38
- const r = o[a], e = t[r];
39
- if (e) {
40
- const u = n[r], c = u === void 0 || e(u, r, n);
41
- if (c !== !0)
42
- throw new s("option " + r + " must be " + c, s.ERR_BAD_OPTION_VALUE);
43
- continue;
44
- }
45
- if (i !== !0)
46
- throw new s("Unknown option " + r, s.ERR_BAD_OPTION);
47
- }
48
- }
49
- const m = {
50
- assertOptions: b,
51
- validators: l
2
+ const r = {
3
+ silentJSONParsing: !0,
4
+ forcedJSONParsing: !0,
5
+ clarifyTimeoutError: !1
52
6
  };
53
7
  export {
54
- m as default
8
+ r as default
55
9
  };
package/dist/index86.mjs CHANGED
@@ -1,9 +1,15 @@
1
1
  'use client';
2
- const r = {
3
- silentJSONParsing: !0,
4
- forcedJSONParsing: !0,
5
- clarifyTimeoutError: !1
6
- };
2
+ import s from "./index63.mjs";
3
+ import f from "./index73.mjs";
4
+ import r from "./index87.mjs";
5
+ function d(o, i) {
6
+ return f(o, new r.classes.URLSearchParams(), {
7
+ visitor: function(t, a, n, e) {
8
+ return r.isNode && s.isBuffer(t) ? (this.append(a, t.toString("base64")), !1) : e.defaultVisitor.apply(this, arguments);
9
+ },
10
+ ...i
11
+ });
12
+ }
7
13
  export {
8
- r as default
14
+ d as default
9
15
  };
package/dist/index87.mjs CHANGED
@@ -1,15 +1,10 @@
1
1
  'use client';
2
- import s from "./index64.mjs";
3
- import f from "./index74.mjs";
4
- import r from "./index88.mjs";
5
- function d(o, i) {
6
- return f(o, new r.classes.URLSearchParams(), {
7
- visitor: function(t, a, n, e) {
8
- return r.isNode && s.isBuffer(t) ? (this.append(a, t.toString("base64")), !1) : e.defaultVisitor.apply(this, arguments);
9
- },
10
- ...i
11
- });
12
- }
2
+ import o from "./index96.mjs";
3
+ import * as t from "./index97.mjs";
4
+ const m = {
5
+ ...t,
6
+ ...o
7
+ };
13
8
  export {
14
- d as default
9
+ m as default
15
10
  };
package/dist/index88.mjs CHANGED
@@ -1,10 +1,31 @@
1
1
  'use client';
2
- import o from "./index93.mjs";
3
- import * as t from "./index94.mjs";
4
- const m = {
5
- ...t,
6
- ...o
2
+ import n from "./index63.mjs";
3
+ const a = n.toObjectSet([
4
+ "age",
5
+ "authorization",
6
+ "content-length",
7
+ "content-type",
8
+ "etag",
9
+ "expires",
10
+ "from",
11
+ "host",
12
+ "if-modified-since",
13
+ "if-unmodified-since",
14
+ "last-modified",
15
+ "location",
16
+ "max-forwards",
17
+ "proxy-authorization",
18
+ "referer",
19
+ "retry-after",
20
+ "user-agent"
21
+ ]), u = (s) => {
22
+ const t = {};
23
+ let e, r, i;
24
+ return s && s.split(`
25
+ `).forEach(function(o) {
26
+ i = o.indexOf(":"), e = o.substring(0, i).trim().toLowerCase(), r = o.substring(i + 1).trim(), !(!e || t[e] && a[e]) && (e === "set-cookie" ? t[e] ? t[e].push(r) : t[e] = [r] : t[e] = t[e] ? t[e] + ", " + r : r);
27
+ }), t;
7
28
  };
8
29
  export {
9
- m as default
30
+ u as default
10
31
  };
package/dist/index89.mjs CHANGED
@@ -1,31 +1,5 @@
1
1
  'use client';
2
- import n from "./index64.mjs";
3
- const a = n.toObjectSet([
4
- "age",
5
- "authorization",
6
- "content-length",
7
- "content-type",
8
- "etag",
9
- "expires",
10
- "from",
11
- "host",
12
- "if-modified-since",
13
- "if-unmodified-since",
14
- "last-modified",
15
- "location",
16
- "max-forwards",
17
- "proxy-authorization",
18
- "referer",
19
- "retry-after",
20
- "user-agent"
21
- ]), u = (s) => {
22
- const t = {};
23
- let e, r, i;
24
- return s && s.split(`
25
- `).forEach(function(o) {
26
- i = o.indexOf(":"), e = o.substring(0, i).trim().toLowerCase(), r = o.substring(i + 1).trim(), !(!e || t[e] && a[e]) && (e === "set-cookie" ? t[e] ? t[e].push(r) : t[e] = [r] : t[e] = t[e] ? t[e] + ", " + r : r);
27
- }), t;
28
- };
2
+ const t = null;
29
3
  export {
30
- u as default
4
+ t as default
31
5
  };
package/dist/index90.mjs CHANGED
@@ -1,5 +1,73 @@
1
1
  'use client';
2
- const t = null;
2
+ import H from "./index63.mjs";
3
+ import D from "./index98.mjs";
4
+ import L from "./index85.mjs";
5
+ import n from "./index74.mjs";
6
+ import y from "./index69.mjs";
7
+ import O from "./index99.mjs";
8
+ import U from "./index87.mjs";
9
+ import q from "./index77.mjs";
10
+ import { progressEventReducer as A } from "./index100.mjs";
11
+ import v from "./index101.mjs";
12
+ const N = typeof XMLHttpRequest < "u", Q = N && function(s) {
13
+ return new Promise(function(C, i) {
14
+ const t = v(s);
15
+ let E = t.data;
16
+ const T = q.from(t.headers).normalize();
17
+ let { responseType: d, onUploadProgress: R, onDownloadProgress: h } = t, l, g, w, u, f;
18
+ function x() {
19
+ u && u(), f && f(), t.cancelToken && t.cancelToken.unsubscribe(l), t.signal && t.signal.removeEventListener("abort", l);
20
+ }
21
+ let e = new XMLHttpRequest();
22
+ e.open(t.method.toUpperCase(), t.url, !0), e.timeout = t.timeout;
23
+ function b() {
24
+ if (!e)
25
+ return;
26
+ const o = q.from(
27
+ "getAllResponseHeaders" in e && e.getAllResponseHeaders()
28
+ ), a = {
29
+ data: !d || d === "text" || d === "json" ? e.responseText : e.response,
30
+ status: e.status,
31
+ statusText: e.statusText,
32
+ headers: o,
33
+ config: s,
34
+ request: e
35
+ };
36
+ D(function(c) {
37
+ C(c), x();
38
+ }, function(c) {
39
+ i(c), x();
40
+ }, a), e = null;
41
+ }
42
+ "onloadend" in e ? e.onloadend = b : e.onreadystatechange = function() {
43
+ !e || e.readyState !== 4 || e.status === 0 && !(e.responseURL && e.responseURL.indexOf("file:") === 0) || setTimeout(b);
44
+ }, e.onabort = function() {
45
+ e && (i(new n("Request aborted", n.ECONNABORTED, s, e)), e = null);
46
+ }, e.onerror = function(r) {
47
+ const a = r && r.message ? r.message : "Network Error", p = new n(a, n.ERR_NETWORK, s, e);
48
+ p.event = r || null, i(p), e = null;
49
+ }, e.ontimeout = function() {
50
+ let r = t.timeout ? "timeout of " + t.timeout + "ms exceeded" : "timeout exceeded";
51
+ const a = t.transitional || L;
52
+ t.timeoutErrorMessage && (r = t.timeoutErrorMessage), i(new n(
53
+ r,
54
+ a.clarifyTimeoutError ? n.ETIMEDOUT : n.ECONNABORTED,
55
+ s,
56
+ e
57
+ )), e = null;
58
+ }, E === void 0 && T.setContentType(null), "setRequestHeader" in e && H.forEach(T.toJSON(), function(r, a) {
59
+ e.setRequestHeader(a, r);
60
+ }), H.isUndefined(t.withCredentials) || (e.withCredentials = !!t.withCredentials), d && d !== "json" && (e.responseType = t.responseType), h && ([w, f] = A(h, !0), e.addEventListener("progress", w)), R && e.upload && ([g, u] = A(R), e.upload.addEventListener("progress", g), e.upload.addEventListener("loadend", u)), (t.cancelToken || t.signal) && (l = (o) => {
61
+ e && (i(!o || o.type ? new y(null, s, e) : o), e.abort(), e = null);
62
+ }, t.cancelToken && t.cancelToken.subscribe(l), t.signal && (t.signal.aborted ? l() : t.signal.addEventListener("abort", l)));
63
+ const m = O(t.url);
64
+ if (m && U.protocols.indexOf(m) === -1) {
65
+ i(new n("Unsupported protocol " + m + ":", n.ERR_BAD_REQUEST, s));
66
+ return;
67
+ }
68
+ e.send(E || null);
69
+ });
70
+ };
3
71
  export {
4
- t as default
72
+ Q as default
5
73
  };
package/dist/index91.mjs CHANGED
@@ -1,73 +1,170 @@
1
1
  'use client';
2
- import H from "./index64.mjs";
3
- import D from "./index99.mjs";
4
- import L from "./index86.mjs";
5
- import n from "./index75.mjs";
6
- import y from "./index70.mjs";
7
- import O from "./index100.mjs";
8
- import U from "./index88.mjs";
9
- import q from "./index78.mjs";
10
- import { progressEventReducer as A } from "./index101.mjs";
11
- import v from "./index102.mjs";
12
- const N = typeof XMLHttpRequest < "u", Q = N && function(s) {
13
- return new Promise(function(C, i) {
14
- const t = v(s);
15
- let E = t.data;
16
- const T = q.from(t.headers).normalize();
17
- let { responseType: d, onUploadProgress: R, onDownloadProgress: h } = t, l, g, w, u, f;
18
- function x() {
19
- u && u(), f && f(), t.cancelToken && t.cancelToken.unsubscribe(l), t.signal && t.signal.removeEventListener("abort", l);
20
- }
21
- let e = new XMLHttpRequest();
22
- e.open(t.method.toUpperCase(), t.url, !0), e.timeout = t.timeout;
23
- function b() {
24
- if (!e)
25
- return;
26
- const o = q.from(
27
- "getAllResponseHeaders" in e && e.getAllResponseHeaders()
28
- ), a = {
29
- data: !d || d === "text" || d === "json" ? e.responseText : e.response,
30
- status: e.status,
31
- statusText: e.statusText,
32
- headers: o,
33
- config: s,
34
- request: e
2
+ import K from "./index87.mjs";
3
+ import t from "./index63.mjs";
4
+ import b from "./index74.mjs";
5
+ import ee from "./index102.mjs";
6
+ import { trackStream as z } from "./index103.mjs";
7
+ import te from "./index77.mjs";
8
+ import { progressEventDecorator as I, progressEventReducer as M, asyncDecorator as j } from "./index100.mjs";
9
+ import se from "./index101.mjs";
10
+ import re from "./index98.mjs";
11
+ const J = 64 * 1024, { isFunction: P } = t, ne = (({ Request: r, Response: n }) => ({
12
+ Request: r,
13
+ Response: n
14
+ }))(t.global), {
15
+ ReadableStream: V,
16
+ TextEncoder: W
17
+ } = t.global, Z = (r, ...n) => {
18
+ try {
19
+ return !!r(...n);
20
+ } catch {
21
+ return !1;
22
+ }
23
+ }, oe = (r) => {
24
+ r = t.merge.call({
25
+ skipUndefined: !0
26
+ }, ne, r);
27
+ const { fetch: n, Request: o, Response: y } = r, g = n ? P(n) : typeof fetch == "function", f = P(o), F = P(y);
28
+ if (!g)
29
+ return !1;
30
+ const w = g && P(V), R = g && (typeof W == "function" ? /* @__PURE__ */ ((e) => (s) => e.encode(s))(new W()) : async (e) => new Uint8Array(await new o(e).arrayBuffer())), d = f && w && Z(() => {
31
+ let e = !1;
32
+ const s = new o(K.origin, {
33
+ body: new V(),
34
+ method: "POST",
35
+ get duplex() {
36
+ return e = !0, "half";
37
+ }
38
+ }).headers.has("Content-Type");
39
+ return e && !s;
40
+ }), h = F && w && Z(() => t.isReadableStream(new y("").body)), x = {
41
+ stream: h && ((e) => e.body)
42
+ };
43
+ g && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => {
44
+ !x[e] && (x[e] = (s, i) => {
45
+ let c = s && s[e];
46
+ if (c)
47
+ return c.call(s);
48
+ throw new b(`Response type '${e}' is not supported`, b.ERR_NOT_SUPPORT, i);
49
+ });
50
+ });
51
+ const $ = async (e) => {
52
+ if (e == null)
53
+ return 0;
54
+ if (t.isBlob(e))
55
+ return e.size;
56
+ if (t.isSpecCompliantForm(e))
57
+ return (await new o(K.origin, {
58
+ method: "POST",
59
+ body: e
60
+ }).arrayBuffer()).byteLength;
61
+ if (t.isArrayBufferView(e) || t.isArrayBuffer(e))
62
+ return e.byteLength;
63
+ if (t.isURLSearchParams(e) && (e = e + ""), t.isString(e))
64
+ return (await R(e)).byteLength;
65
+ }, G = async (e, s) => {
66
+ const i = t.toFiniteNumber(e.getContentLength());
67
+ return i ?? $(s);
68
+ };
69
+ return async (e) => {
70
+ let {
71
+ url: s,
72
+ method: i,
73
+ data: c,
74
+ signal: Q,
75
+ cancelToken: _,
76
+ timeout: X,
77
+ onDownloadProgress: O,
78
+ onUploadProgress: B,
79
+ responseType: l,
80
+ headers: q,
81
+ withCredentials: C = "same-origin",
82
+ fetchOptions: U
83
+ } = se(e), v = n || fetch;
84
+ l = l ? (l + "").toLowerCase() : "text";
85
+ let E = ee([Q, _ && _.toAbortSignal()], X), T = null;
86
+ const m = E && E.unsubscribe && (() => {
87
+ E.unsubscribe();
88
+ });
89
+ let D;
90
+ try {
91
+ if (B && d && i !== "get" && i !== "head" && (D = await G(q, c)) !== 0) {
92
+ let p = new o(s, {
93
+ method: "POST",
94
+ body: c,
95
+ duplex: "half"
96
+ }), S;
97
+ if (t.isFormData(c) && (S = p.headers.get("content-type")) && q.setContentType(S), p.body) {
98
+ const [A, L] = I(
99
+ D,
100
+ M(j(B))
101
+ );
102
+ c = z(p.body, J, A, L);
103
+ }
104
+ }
105
+ t.isString(C) || (C = C ? "include" : "omit");
106
+ const a = f && "credentials" in o.prototype, N = {
107
+ ...U,
108
+ signal: E,
109
+ method: i.toUpperCase(),
110
+ headers: q.normalize().toJSON(),
111
+ body: c,
112
+ duplex: "half",
113
+ credentials: a ? C : void 0
35
114
  };
36
- D(function(c) {
37
- C(c), x();
38
- }, function(c) {
39
- i(c), x();
40
- }, a), e = null;
115
+ T = f && new o(s, N);
116
+ let u = await (f ? v(T, U) : v(s, N));
117
+ const k = h && (l === "stream" || l === "response");
118
+ if (h && (O || k && m)) {
119
+ const p = {};
120
+ ["status", "statusText", "headers"].forEach((H) => {
121
+ p[H] = u[H];
122
+ });
123
+ const S = t.toFiniteNumber(u.headers.get("content-length")), [A, L] = O && I(
124
+ S,
125
+ M(j(O), !0)
126
+ ) || [];
127
+ u = new y(
128
+ z(u.body, J, A, () => {
129
+ L && L(), m && m();
130
+ }),
131
+ p
132
+ );
133
+ }
134
+ l = l || "text";
135
+ let Y = await x[t.findKey(x, l) || "text"](u, e);
136
+ return !k && m && m(), await new Promise((p, S) => {
137
+ re(p, S, {
138
+ data: Y,
139
+ headers: te.from(u.headers),
140
+ status: u.status,
141
+ statusText: u.statusText,
142
+ config: e,
143
+ request: T
144
+ });
145
+ });
146
+ } catch (a) {
147
+ throw m && m(), a && a.name === "TypeError" && /Load failed|fetch/i.test(a.message) ? Object.assign(
148
+ new b("Network Error", b.ERR_NETWORK, e, T),
149
+ {
150
+ cause: a.cause || a
151
+ }
152
+ ) : b.from(a, a && a.code, e, T);
41
153
  }
42
- "onloadend" in e ? e.onloadend = b : e.onreadystatechange = function() {
43
- !e || e.readyState !== 4 || e.status === 0 && !(e.responseURL && e.responseURL.indexOf("file:") === 0) || setTimeout(b);
44
- }, e.onabort = function() {
45
- e && (i(new n("Request aborted", n.ECONNABORTED, s, e)), e = null);
46
- }, e.onerror = function(r) {
47
- const a = r && r.message ? r.message : "Network Error", p = new n(a, n.ERR_NETWORK, s, e);
48
- p.event = r || null, i(p), e = null;
49
- }, e.ontimeout = function() {
50
- let r = t.timeout ? "timeout of " + t.timeout + "ms exceeded" : "timeout exceeded";
51
- const a = t.transitional || L;
52
- t.timeoutErrorMessage && (r = t.timeoutErrorMessage), i(new n(
53
- r,
54
- a.clarifyTimeoutError ? n.ETIMEDOUT : n.ECONNABORTED,
55
- s,
56
- e
57
- )), e = null;
58
- }, E === void 0 && T.setContentType(null), "setRequestHeader" in e && H.forEach(T.toJSON(), function(r, a) {
59
- e.setRequestHeader(a, r);
60
- }), H.isUndefined(t.withCredentials) || (e.withCredentials = !!t.withCredentials), d && d !== "json" && (e.responseType = t.responseType), h && ([w, f] = A(h, !0), e.addEventListener("progress", w)), R && e.upload && ([g, u] = A(R), e.upload.addEventListener("progress", g), e.upload.addEventListener("loadend", u)), (t.cancelToken || t.signal) && (l = (o) => {
61
- e && (i(!o || o.type ? new y(null, s, e) : o), e.abort(), e = null);
62
- }, t.cancelToken && t.cancelToken.subscribe(l), t.signal && (t.signal.aborted ? l() : t.signal.addEventListener("abort", l)));
63
- const m = O(t.url);
64
- if (m && U.protocols.indexOf(m) === -1) {
65
- i(new n("Unsupported protocol " + m + ":", n.ERR_BAD_REQUEST, s));
66
- return;
67
- }
68
- e.send(E || null);
69
- });
154
+ };
155
+ }, ae = /* @__PURE__ */ new Map(), ie = (r) => {
156
+ let n = r ? r.env : {};
157
+ const { fetch: o, Request: y, Response: g } = n, f = [
158
+ y,
159
+ g,
160
+ o
161
+ ];
162
+ let F = f.length, w = F, R, d, h = ae;
163
+ for (; w--; )
164
+ R = f[w], d = h.get(R), d === void 0 && h.set(R, d = w ? /* @__PURE__ */ new Map() : oe(n)), h = d;
165
+ return d;
70
166
  };
167
+ ie();
71
168
  export {
72
- Q as default
169
+ ie as getFetch
73
170
  };