@shipengine/react-api 0.4.3 → 0.4.4

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 (3) hide show
  1. package/index.js +12 -16
  2. package/index.mjs +519 -3142
  3. package/package.json +2 -1
package/index.mjs CHANGED
@@ -1,1282 +1,58 @@
1
- import { QueryClient as On, QueryClientProvider as Pn, useMutation as R, useQuery as $, useQueryClient as In } from "react-query";
2
- import { jsx as Ue } from "react/jsx-runtime";
3
- import { createContext as Rn, useState as xn, useContext as Cn } from "react";
4
- class j {
5
- constructor(e, t) {
6
- this.errorCode = t?.errorCode ?? "unknown", this.errorSource = t?.errorSource ?? "client", this.errorType = t?.errorType ?? "unknown", this.message = e;
7
- }
8
- static fromObject({ message: e, ...t }) {
9
- return new j(e, t);
10
- }
11
- }
12
- var kt = /* @__PURE__ */ ((r) => (r.AMERICAN_EXPRESS = "americanexpress", r.DISCOVER = "discover", r.MASTERCARD = "mastercard", r.VISA = "visa", r))(kt || {}), Tt = /* @__PURE__ */ ((r) => (r.USD = "usd", r.CAD = "cad", r.AUD = "aud", r.GBP = "gbp", r.EUR = "eur", r.NZD = "nzd", r))(Tt || {}), Bt = /* @__PURE__ */ ((r) => (r.DELIVERY = "delivery", r.SIGNATURE = "signature", r.ADULT_SIGNATURE = "adult_signature", r.DIRECT_SIGNATURE = "direct_signature", r.VERBAL_CONFIRMATION = "verbal_confirmation", r.DELIVERY_MAILED = "delivery_mailed", r.NONE = "none", r))(Bt || {}), Lt = /* @__PURE__ */ ((r) => (r.DOCUMENTS = "documents", r.GIFT = "gift", r.MERCHANDISE = "merchandise", r.RETURNED_GOODS = "returned_goods", r.SAMPLE = "sample", r))(Lt || {}), Ut = /* @__PURE__ */ ((r) => (r.RETURN_TO_SENDER = "return_to_sender", r.TREAT_AS_ABANDONED = "treat_as_abandoned", r))(Ut || {}), qt = /* @__PURE__ */ ((r) => (r.SHIPSURANCE = "shipsurance", r.CARRIER = "carrier", r.THIRD_PARTY = "third_party", r.NONE = "none", r))(qt || {});
13
- const Vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
14
- __proto__: null,
15
- CodedError: j,
16
- ConfirmationType: Bt,
17
- CreditCardVendor: kt,
18
- Currency: Tt,
19
- CustomsContentsType: Lt,
20
- CustomsNonDeliveryType: Ut,
21
- InsuranceProviderType: qt
22
- }, Symbol.toStringTag, { value: "Module" }));
23
- class Fn {
24
- constructor(e) {
25
- this.client = e, this.get = () => this.client.get("/v1/account/settings"), this.update = (t) => this.client.put("/v1/account/settings", t), this.client = e;
26
- }
27
- }
28
- class Nn {
29
- constructor(e) {
30
- this.client = e, this.validate = (t) => this.client.post("/v1/addresses/validate", t), this.parse = (t, n) => this.client.put("/v1/addresses/recognize", {
31
- address: n,
32
- text: t
33
- }), this.client = e;
34
- }
35
- }
36
- var Mt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
37
- function $n(r) {
38
- return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
39
- }
40
- function _n(r) {
41
- if (r.__esModule)
42
- return r;
43
- var e = r.default;
44
- if (typeof e == "function") {
45
- var t = function n() {
46
- if (this instanceof n) {
47
- var a = [null];
48
- a.push.apply(a, arguments);
49
- var i = Function.bind.apply(e, a);
50
- return new i();
51
- }
52
- return e.apply(this, arguments);
53
- };
54
- t.prototype = e.prototype;
55
- } else
56
- t = {};
57
- return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(r).forEach(function(n) {
58
- var a = Object.getOwnPropertyDescriptor(r, n);
59
- Object.defineProperty(t, n, a.get ? a : {
60
- enumerable: !0,
61
- get: function() {
62
- return r[n];
63
- }
64
- });
65
- }), t;
66
- }
67
- var hr = {}, Dn = {
68
- get exports() {
69
- return hr;
70
- },
71
- set exports(r) {
72
- hr = r;
73
- }
74
- }, Ce = {}, kn = {
75
- get exports() {
76
- return Ce;
77
- },
78
- set exports(r) {
79
- Ce = r;
80
- }
81
- }, zt = function(e, t) {
82
- return function() {
83
- for (var a = new Array(arguments.length), i = 0; i < a.length; i++)
84
- a[i] = arguments[i];
85
- return e.apply(t, a);
86
- };
87
- }, Tn = zt, Q = Object.prototype.toString;
88
- function Nr(r) {
89
- return Array.isArray(r);
90
- }
91
- function yr(r) {
92
- return typeof r > "u";
93
- }
94
- function Bn(r) {
95
- return r !== null && !yr(r) && r.constructor !== null && !yr(r.constructor) && typeof r.constructor.isBuffer == "function" && r.constructor.isBuffer(r);
96
- }
97
- function jt(r) {
98
- return Q.call(r) === "[object ArrayBuffer]";
99
- }
100
- function Ln(r) {
101
- return Q.call(r) === "[object FormData]";
102
- }
103
- function Un(r) {
104
- var e;
105
- return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(r) : e = r && r.buffer && jt(r.buffer), e;
106
- }
107
- function qn(r) {
108
- return typeof r == "string";
109
- }
110
- function Mn(r) {
111
- return typeof r == "number";
112
- }
113
- function Wt(r) {
114
- return r !== null && typeof r == "object";
115
- }
116
- function Ie(r) {
117
- if (Q.call(r) !== "[object Object]")
118
- return !1;
119
- var e = Object.getPrototypeOf(r);
120
- return e === null || e === Object.prototype;
121
- }
122
- function zn(r) {
123
- return Q.call(r) === "[object Date]";
124
- }
125
- function jn(r) {
126
- return Q.call(r) === "[object File]";
127
- }
128
- function Wn(r) {
129
- return Q.call(r) === "[object Blob]";
130
- }
131
- function Gt(r) {
132
- return Q.call(r) === "[object Function]";
133
- }
134
- function Gn(r) {
135
- return Wt(r) && Gt(r.pipe);
136
- }
137
- function Hn(r) {
138
- return Q.call(r) === "[object URLSearchParams]";
139
- }
140
- function Kn(r) {
141
- return r.trim ? r.trim() : r.replace(/^\s+|\s+$/g, "");
142
- }
143
- function Vn() {
144
- return typeof navigator < "u" && (navigator.product === "ReactNative" || navigator.product === "NativeScript" || navigator.product === "NS") ? !1 : typeof window < "u" && typeof document < "u";
145
- }
146
- function $r(r, e) {
147
- if (!(r === null || typeof r > "u"))
148
- if (typeof r != "object" && (r = [r]), Nr(r))
149
- for (var t = 0, n = r.length; t < n; t++)
150
- e.call(null, r[t], t, r);
151
- else
152
- for (var a in r)
153
- Object.prototype.hasOwnProperty.call(r, a) && e.call(null, r[a], a, r);
154
- }
155
- function vr() {
156
- var r = {};
157
- function e(a, i) {
158
- Ie(r[i]) && Ie(a) ? r[i] = vr(r[i], a) : Ie(a) ? r[i] = vr({}, a) : Nr(a) ? r[i] = a.slice() : r[i] = a;
159
- }
160
- for (var t = 0, n = arguments.length; t < n; t++)
161
- $r(arguments[t], e);
162
- return r;
163
- }
164
- function Jn(r, e, t) {
165
- return $r(e, function(a, i) {
166
- t && typeof a == "function" ? r[i] = Tn(a, t) : r[i] = a;
167
- }), r;
168
- }
169
- function Qn(r) {
170
- return r.charCodeAt(0) === 65279 && (r = r.slice(1)), r;
171
- }
172
- var D = {
173
- isArray: Nr,
174
- isArrayBuffer: jt,
175
- isBuffer: Bn,
176
- isFormData: Ln,
177
- isArrayBufferView: Un,
178
- isString: qn,
179
- isNumber: Mn,
180
- isObject: Wt,
181
- isPlainObject: Ie,
182
- isUndefined: yr,
183
- isDate: zn,
184
- isFile: jn,
185
- isBlob: Wn,
186
- isFunction: Gt,
187
- isStream: Gn,
188
- isURLSearchParams: Hn,
189
- isStandardBrowserEnv: Vn,
190
- forEach: $r,
191
- merge: vr,
192
- extend: Jn,
193
- trim: Kn,
194
- stripBOM: Qn
195
- }, ie = D;
196
- function Gr(r) {
197
- return encodeURIComponent(r).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
198
- }
199
- var Ht = function(e, t, n) {
200
- if (!t)
201
- return e;
202
- var a;
203
- if (n)
204
- a = n(t);
205
- else if (ie.isURLSearchParams(t))
206
- a = t.toString();
207
- else {
208
- var i = [];
209
- ie.forEach(t, function(c, d) {
210
- c === null || typeof c > "u" || (ie.isArray(c) ? d = d + "[]" : c = [c], ie.forEach(c, function(o) {
211
- ie.isDate(o) ? o = o.toISOString() : ie.isObject(o) && (o = JSON.stringify(o)), i.push(Gr(d) + "=" + Gr(o));
212
- }));
213
- }), a = i.join("&");
214
- }
215
- if (a) {
216
- var s = e.indexOf("#");
217
- s !== -1 && (e = e.slice(0, s)), e += (e.indexOf("?") === -1 ? "?" : "&") + a;
218
- }
219
- return e;
220
- }, Xn = D;
221
- function ke() {
222
- this.handlers = [];
223
- }
224
- ke.prototype.use = function(e, t, n) {
225
- return this.handlers.push({
226
- fulfilled: e,
227
- rejected: t,
228
- synchronous: n ? n.synchronous : !1,
229
- runWhen: n ? n.runWhen : null
230
- }), this.handlers.length - 1;
231
- };
232
- ke.prototype.eject = function(e) {
233
- this.handlers[e] && (this.handlers[e] = null);
234
- };
235
- ke.prototype.forEach = function(e) {
236
- Xn.forEach(this.handlers, function(n) {
237
- n !== null && e(n);
238
- });
239
- };
240
- var Yn = ke, Zn = D, ea = function(e, t) {
241
- Zn.forEach(e, function(a, i) {
242
- i !== t && i.toUpperCase() === t.toUpperCase() && (e[t] = a, delete e[i]);
243
- });
244
- }, Kt = function(e, t, n, a, i) {
245
- return e.config = t, n && (e.code = n), e.request = a, e.response = i, e.isAxiosError = !0, e.toJSON = function() {
246
- return {
247
- // Standard
248
- message: this.message,
249
- name: this.name,
250
- // Microsoft
251
- description: this.description,
252
- number: this.number,
253
- // Mozilla
254
- fileName: this.fileName,
255
- lineNumber: this.lineNumber,
256
- columnNumber: this.columnNumber,
257
- stack: this.stack,
258
- // Axios
259
- config: this.config,
260
- code: this.code,
261
- status: this.response && this.response.status ? this.response.status : null
262
- };
263
- }, e;
264
- }, Vt = {
265
- silentJSONParsing: !0,
266
- forcedJSONParsing: !0,
267
- clarifyTimeoutError: !1
268
- }, qe, Hr;
269
- function Jt() {
270
- if (Hr)
271
- return qe;
272
- Hr = 1;
273
- var r = Kt;
274
- return qe = function(t, n, a, i, s) {
275
- var l = new Error(t);
276
- return r(l, n, a, i, s);
277
- }, qe;
278
- }
279
- var Me, Kr;
280
- function ra() {
281
- if (Kr)
282
- return Me;
283
- Kr = 1;
284
- var r = Jt();
285
- return Me = function(t, n, a) {
286
- var i = a.config.validateStatus;
287
- !a.status || !i || i(a.status) ? t(a) : n(r(
288
- "Request failed with status code " + a.status,
289
- a.config,
290
- null,
291
- a.request,
292
- a
293
- ));
294
- }, Me;
295
- }
296
- var ze, Vr;
297
- function ta() {
298
- if (Vr)
299
- return ze;
300
- Vr = 1;
301
- var r = D;
302
- return ze = r.isStandardBrowserEnv() ? (
303
- // Standard browser envs support document.cookie
304
- function() {
305
- return {
306
- write: function(n, a, i, s, l, c) {
307
- var d = [];
308
- d.push(n + "=" + encodeURIComponent(a)), r.isNumber(i) && d.push("expires=" + new Date(i).toGMTString()), r.isString(s) && d.push("path=" + s), r.isString(l) && d.push("domain=" + l), c === !0 && d.push("secure"), document.cookie = d.join("; ");
309
- },
310
- read: function(n) {
311
- var a = document.cookie.match(new RegExp("(^|;\\s*)(" + n + ")=([^;]*)"));
312
- return a ? decodeURIComponent(a[3]) : null;
313
- },
314
- remove: function(n) {
315
- this.write(n, "", Date.now() - 864e5);
316
- }
317
- };
318
- }()
319
- ) : (
320
- // Non standard browser env (web workers, react-native) lack needed support.
321
- function() {
322
- return {
323
- write: function() {
324
- },
325
- read: function() {
326
- return null;
327
- },
328
- remove: function() {
329
- }
330
- };
331
- }()
332
- ), ze;
333
- }
334
- var je, Jr;
335
- function na() {
336
- return Jr || (Jr = 1, je = function(e) {
337
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
338
- }), je;
339
- }
340
- var We, Qr;
341
- function aa() {
342
- return Qr || (Qr = 1, We = function(e, t) {
343
- return t ? e.replace(/\/+$/, "") + "/" + t.replace(/^\/+/, "") : e;
344
- }), We;
345
- }
346
- var Ge, Xr;
347
- function ia() {
348
- if (Xr)
349
- return Ge;
350
- Xr = 1;
351
- var r = na(), e = aa();
352
- return Ge = function(n, a) {
353
- return n && !r(a) ? e(n, a) : a;
354
- }, Ge;
355
- }
356
- var He, Yr;
357
- function oa() {
358
- if (Yr)
359
- return He;
360
- Yr = 1;
361
- var r = D, e = [
362
- "age",
363
- "authorization",
364
- "content-length",
365
- "content-type",
366
- "etag",
367
- "expires",
368
- "from",
369
- "host",
370
- "if-modified-since",
371
- "if-unmodified-since",
372
- "last-modified",
373
- "location",
374
- "max-forwards",
375
- "proxy-authorization",
376
- "referer",
377
- "retry-after",
378
- "user-agent"
379
- ];
380
- return He = function(n) {
381
- var a = {}, i, s, l;
382
- return n && r.forEach(n.split(`
383
- `), function(d) {
384
- if (l = d.indexOf(":"), i = r.trim(d.substr(0, l)).toLowerCase(), s = r.trim(d.substr(l + 1)), i) {
385
- if (a[i] && e.indexOf(i) >= 0)
386
- return;
387
- i === "set-cookie" ? a[i] = (a[i] ? a[i] : []).concat([s]) : a[i] = a[i] ? a[i] + ", " + s : s;
388
- }
389
- }), a;
390
- }, He;
391
- }
392
- var Ke, Zr;
393
- function sa() {
394
- if (Zr)
395
- return Ke;
396
- Zr = 1;
397
- var r = D;
398
- return Ke = r.isStandardBrowserEnv() ? (
399
- // Standard browser envs have full support of the APIs needed to test
400
- // whether the request URL is of the same origin as current location.
401
- function() {
402
- var t = /(msie|trident)/i.test(navigator.userAgent), n = document.createElement("a"), a;
403
- function i(s) {
404
- var l = s;
405
- return t && (n.setAttribute("href", l), l = n.href), n.setAttribute("href", l), {
406
- href: n.href,
407
- protocol: n.protocol ? n.protocol.replace(/:$/, "") : "",
408
- host: n.host,
409
- search: n.search ? n.search.replace(/^\?/, "") : "",
410
- hash: n.hash ? n.hash.replace(/^#/, "") : "",
411
- hostname: n.hostname,
412
- port: n.port,
413
- pathname: n.pathname.charAt(0) === "/" ? n.pathname : "/" + n.pathname
414
- };
415
- }
416
- return a = i(window.location.href), function(l) {
417
- var c = r.isString(l) ? i(l) : l;
418
- return c.protocol === a.protocol && c.host === a.host;
419
- };
420
- }()
421
- ) : (
422
- // Non standard browser envs (web workers, react-native) lack needed support.
423
- function() {
424
- return function() {
425
- return !0;
426
- };
427
- }()
428
- ), Ke;
429
- }
430
- var Ve, et;
431
- function Te() {
432
- if (et)
433
- return Ve;
434
- et = 1;
435
- function r(e) {
436
- this.message = e;
437
- }
438
- return r.prototype.toString = function() {
439
- return "Cancel" + (this.message ? ": " + this.message : "");
440
- }, r.prototype.__CANCEL__ = !0, Ve = r, Ve;
441
- }
442
- var Je, rt;
443
- function tt() {
444
- if (rt)
445
- return Je;
446
- rt = 1;
447
- var r = D, e = ra(), t = ta(), n = Ht, a = ia(), i = oa(), s = sa(), l = Jt(), c = Vt, d = Te();
448
- return Je = function(o) {
449
- return new Promise(function(p, y) {
450
- var v = o.data, m = o.headers, h = o.responseType, g;
451
- function A() {
452
- o.cancelToken && o.cancelToken.unsubscribe(g), o.signal && o.signal.removeEventListener("abort", g);
453
- }
454
- r.isFormData(v) && delete m["Content-Type"];
455
- var S = new XMLHttpRequest();
456
- if (o.auth) {
457
- var x = o.auth.username || "", G = o.auth.password ? unescape(encodeURIComponent(o.auth.password)) : "";
458
- m.Authorization = "Basic " + btoa(x + ":" + G);
459
- }
460
- var _ = a(o.baseURL, o.url);
461
- S.open(o.method.toUpperCase(), n(_, o.params, o.paramsSerializer), !0), S.timeout = o.timeout;
462
- function B() {
463
- if (S) {
464
- var P = "getAllResponseHeaders" in S ? i(S.getAllResponseHeaders()) : null, T = !h || h === "text" || h === "json" ? S.responseText : S.response, O = {
465
- data: T,
466
- status: S.status,
467
- statusText: S.statusText,
468
- headers: P,
469
- config: o,
470
- request: S
471
- };
472
- e(function(U) {
473
- p(U), A();
474
- }, function(U) {
475
- y(U), A();
476
- }, O), S = null;
477
- }
478
- }
479
- if ("onloadend" in S ? S.onloadend = B : S.onreadystatechange = function() {
480
- !S || S.readyState !== 4 || S.status === 0 && !(S.responseURL && S.responseURL.indexOf("file:") === 0) || setTimeout(B);
481
- }, S.onabort = function() {
482
- S && (y(l("Request aborted", o, "ECONNABORTED", S)), S = null);
483
- }, S.onerror = function() {
484
- y(l("Network Error", o, null, S)), S = null;
485
- }, S.ontimeout = function() {
486
- var T = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded", O = o.transitional || c;
487
- o.timeoutErrorMessage && (T = o.timeoutErrorMessage), y(l(
488
- T,
489
- o,
490
- O.clarifyTimeoutError ? "ETIMEDOUT" : "ECONNABORTED",
491
- S
492
- )), S = null;
493
- }, r.isStandardBrowserEnv()) {
494
- var H = (o.withCredentials || s(_)) && o.xsrfCookieName ? t.read(o.xsrfCookieName) : void 0;
495
- H && (m[o.xsrfHeaderName] = H);
496
- }
497
- "setRequestHeader" in S && r.forEach(m, function(T, O) {
498
- typeof v > "u" && O.toLowerCase() === "content-type" ? delete m[O] : S.setRequestHeader(O, T);
499
- }), r.isUndefined(o.withCredentials) || (S.withCredentials = !!o.withCredentials), h && h !== "json" && (S.responseType = o.responseType), typeof o.onDownloadProgress == "function" && S.addEventListener("progress", o.onDownloadProgress), typeof o.onUploadProgress == "function" && S.upload && S.upload.addEventListener("progress", o.onUploadProgress), (o.cancelToken || o.signal) && (g = function(P) {
500
- S && (y(!P || P && P.type ? new d("canceled") : P), S.abort(), S = null);
501
- }, o.cancelToken && o.cancelToken.subscribe(g), o.signal && (o.signal.aborted ? g() : o.signal.addEventListener("abort", g))), v || (v = null), S.send(v);
502
- });
503
- }, Je;
504
- }
505
- var C = D, nt = ea, ua = Kt, la = Vt, ca = {
506
- "Content-Type": "application/x-www-form-urlencoded"
507
- };
508
- function at(r, e) {
509
- !C.isUndefined(r) && C.isUndefined(r["Content-Type"]) && (r["Content-Type"] = e);
510
- }
511
- function fa() {
512
- var r;
513
- return (typeof XMLHttpRequest < "u" || typeof process < "u" && Object.prototype.toString.call(process) === "[object process]") && (r = tt()), r;
514
- }
515
- function pa(r, e, t) {
516
- if (C.isString(r))
517
- try {
518
- return (e || JSON.parse)(r), C.trim(r);
519
- } catch (n) {
520
- if (n.name !== "SyntaxError")
521
- throw n;
522
- }
523
- return (t || JSON.stringify)(r);
524
- }
525
- var Be = {
526
- transitional: la,
527
- adapter: fa(),
528
- transformRequest: [function(e, t) {
529
- return nt(t, "Accept"), nt(t, "Content-Type"), C.isFormData(e) || C.isArrayBuffer(e) || C.isBuffer(e) || C.isStream(e) || C.isFile(e) || C.isBlob(e) ? e : C.isArrayBufferView(e) ? e.buffer : C.isURLSearchParams(e) ? (at(t, "application/x-www-form-urlencoded;charset=utf-8"), e.toString()) : C.isObject(e) || t && t["Content-Type"] === "application/json" ? (at(t, "application/json"), pa(e)) : e;
530
- }],
531
- transformResponse: [function(e) {
532
- var t = this.transitional || Be.transitional, n = t && t.silentJSONParsing, a = t && t.forcedJSONParsing, i = !n && this.responseType === "json";
533
- if (i || a && C.isString(e) && e.length)
534
- try {
535
- return JSON.parse(e);
536
- } catch (s) {
537
- if (i)
538
- throw s.name === "SyntaxError" ? ua(s, this, "E_JSON_PARSE") : s;
539
- }
540
- return e;
541
- }],
542
- /**
543
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
544
- * timeout is not created.
545
- */
546
- timeout: 0,
547
- xsrfCookieName: "XSRF-TOKEN",
548
- xsrfHeaderName: "X-XSRF-TOKEN",
549
- maxContentLength: -1,
550
- maxBodyLength: -1,
551
- validateStatus: function(e) {
552
- return e >= 200 && e < 300;
553
- },
554
- headers: {
555
- common: {
556
- Accept: "application/json, text/plain, */*"
557
- }
558
- }
559
- };
560
- C.forEach(["delete", "get", "head"], function(e) {
561
- Be.headers[e] = {};
562
- });
563
- C.forEach(["post", "put", "patch"], function(e) {
564
- Be.headers[e] = C.merge(ca);
565
- });
566
- var _r = Be, da = D, ha = _r, ya = function(e, t, n) {
567
- var a = this || ha;
568
- return da.forEach(n, function(s) {
569
- e = s.call(a, e, t);
570
- }), e;
571
- }, Qe, it;
572
- function Qt() {
573
- return it || (it = 1, Qe = function(e) {
574
- return !!(e && e.__CANCEL__);
575
- }), Qe;
576
- }
577
- var ot = D, Xe = ya, va = Qt(), ma = _r, ga = Te();
578
- function Ye(r) {
579
- if (r.cancelToken && r.cancelToken.throwIfRequested(), r.signal && r.signal.aborted)
580
- throw new ga("canceled");
581
- }
582
- var Sa = function(e) {
583
- Ye(e), e.headers = e.headers || {}, e.data = Xe.call(
584
- e,
585
- e.data,
586
- e.headers,
587
- e.transformRequest
588
- ), e.headers = ot.merge(
589
- e.headers.common || {},
590
- e.headers[e.method] || {},
591
- e.headers
592
- ), ot.forEach(
593
- ["delete", "get", "head", "post", "put", "patch", "common"],
594
- function(a) {
595
- delete e.headers[a];
596
- }
597
- );
598
- var t = e.adapter || ma.adapter;
599
- return t(e).then(function(a) {
600
- return Ye(e), a.data = Xe.call(
601
- e,
602
- a.data,
603
- a.headers,
604
- e.transformResponse
605
- ), a;
606
- }, function(a) {
607
- return va(a) || (Ye(e), a && a.response && (a.response.data = Xe.call(
608
- e,
609
- a.response.data,
610
- a.response.headers,
611
- e.transformResponse
612
- ))), Promise.reject(a);
613
- });
614
- }, k = D, Xt = function(e, t) {
615
- t = t || {};
616
- var n = {};
617
- function a(u, o) {
618
- return k.isPlainObject(u) && k.isPlainObject(o) ? k.merge(u, o) : k.isPlainObject(o) ? k.merge({}, o) : k.isArray(o) ? o.slice() : o;
619
- }
620
- function i(u) {
621
- if (k.isUndefined(t[u])) {
622
- if (!k.isUndefined(e[u]))
623
- return a(void 0, e[u]);
624
- } else
625
- return a(e[u], t[u]);
626
- }
627
- function s(u) {
628
- if (!k.isUndefined(t[u]))
629
- return a(void 0, t[u]);
630
- }
631
- function l(u) {
632
- if (k.isUndefined(t[u])) {
633
- if (!k.isUndefined(e[u]))
634
- return a(void 0, e[u]);
635
- } else
636
- return a(void 0, t[u]);
637
- }
638
- function c(u) {
639
- if (u in t)
640
- return a(e[u], t[u]);
641
- if (u in e)
642
- return a(void 0, e[u]);
643
- }
644
- var d = {
645
- url: s,
646
- method: s,
647
- data: s,
648
- baseURL: l,
649
- transformRequest: l,
650
- transformResponse: l,
651
- paramsSerializer: l,
652
- timeout: l,
653
- timeoutMessage: l,
654
- withCredentials: l,
655
- adapter: l,
656
- responseType: l,
657
- xsrfCookieName: l,
658
- xsrfHeaderName: l,
659
- onUploadProgress: l,
660
- onDownloadProgress: l,
661
- decompress: l,
662
- maxContentLength: l,
663
- maxBodyLength: l,
664
- transport: l,
665
- httpAgent: l,
666
- httpsAgent: l,
667
- cancelToken: l,
668
- socketPath: l,
669
- responseEncoding: l,
670
- validateStatus: c
671
- };
672
- return k.forEach(Object.keys(e).concat(Object.keys(t)), function(o) {
673
- var f = d[o] || i, p = f(o);
674
- k.isUndefined(p) && f !== c || (n[o] = p);
675
- }), n;
676
- }, Ze, st;
677
- function Yt() {
678
- return st || (st = 1, Ze = {
679
- version: "0.26.1"
680
- }), Ze;
681
- }
682
- var wa = Yt().version, Dr = {};
683
- ["object", "boolean", "number", "function", "string", "symbol"].forEach(function(r, e) {
684
- Dr[r] = function(n) {
685
- return typeof n === r || "a" + (e < 1 ? "n " : " ") + r;
686
- };
687
- });
688
- var ut = {};
689
- Dr.transitional = function(e, t, n) {
690
- function a(i, s) {
691
- return "[Axios v" + wa + "] Transitional option '" + i + "'" + s + (n ? ". " + n : "");
692
- }
693
- return function(i, s, l) {
694
- if (e === !1)
695
- throw new Error(a(s, " has been removed" + (t ? " in " + t : "")));
696
- return t && !ut[s] && (ut[s] = !0, console.warn(
697
- a(
698
- s,
699
- " has been deprecated since v" + t + " and will be removed in the near future"
1
+ import { QueryClient as N, QueryClientProvider as x, useMutation as h, useQuery as y, useQueryClient as B } from "react-query";
2
+ import { jsx as O } from "react/jsx-runtime";
3
+ import { createContext as T, useState as D, useContext as U } from "react";
4
+ import { ShipEngineAPI as K, SE as W } from "@shipengine/js-api";
5
+ export * from "@shipengine/js-api";
6
+ const R = T(void 0), ne = ({ baseURL: e, children: r, headers: t, getToken: s }) => {
7
+ const [i, n] = D(() => {
8
+ const d = s();
9
+ if (typeof d == "string")
10
+ return new K(d, {
11
+ baseURL: e,
12
+ getToken: s,
13
+ headers: t ?? {}
14
+ });
15
+ d.then(
16
+ (o) => n(
17
+ new K(o, {
18
+ baseURL: e,
19
+ getToken: s,
20
+ headers: t ?? {}
21
+ })
700
22
  )
701
- )), e ? e(i, s, l) : !0;
702
- };
703
- };
704
- function ba(r, e, t) {
705
- if (typeof r != "object")
706
- throw new TypeError("options must be an object");
707
- for (var n = Object.keys(r), a = n.length; a-- > 0; ) {
708
- var i = n[a], s = e[i];
709
- if (s) {
710
- var l = r[i], c = l === void 0 || s(l, i, r);
711
- if (c !== !0)
712
- throw new TypeError("option " + i + " must be " + c);
713
- continue;
714
- }
715
- if (t !== !0)
716
- throw Error("Unknown option " + i);
717
- }
718
- }
719
- var Ea = {
720
- assertOptions: ba,
721
- validators: Dr
722
- }, Zt = D, Aa = Ht, lt = Yn, ct = Sa, Le = Xt, en = Ea, oe = en.validators;
723
- function we(r) {
724
- this.defaults = r, this.interceptors = {
725
- request: new lt(),
726
- response: new lt()
727
- };
728
- }
729
- we.prototype.request = function(e, t) {
730
- typeof e == "string" ? (t = t || {}, t.url = e) : t = e || {}, t = Le(this.defaults, t), t.method ? t.method = t.method.toLowerCase() : this.defaults.method ? t.method = this.defaults.method.toLowerCase() : t.method = "get";
731
- var n = t.transitional;
732
- n !== void 0 && en.assertOptions(n, {
733
- silentJSONParsing: oe.transitional(oe.boolean),
734
- forcedJSONParsing: oe.transitional(oe.boolean),
735
- clarifyTimeoutError: oe.transitional(oe.boolean)
736
- }, !1);
737
- var a = [], i = !0;
738
- this.interceptors.request.forEach(function(p) {
739
- typeof p.runWhen == "function" && p.runWhen(t) === !1 || (i = i && p.synchronous, a.unshift(p.fulfilled, p.rejected));
740
- });
741
- var s = [];
742
- this.interceptors.response.forEach(function(p) {
743
- s.push(p.fulfilled, p.rejected);
744
- });
745
- var l;
746
- if (!i) {
747
- var c = [ct, void 0];
748
- for (Array.prototype.unshift.apply(c, a), c = c.concat(s), l = Promise.resolve(t); c.length; )
749
- l = l.then(c.shift(), c.shift());
750
- return l;
751
- }
752
- for (var d = t; a.length; ) {
753
- var u = a.shift(), o = a.shift();
754
- try {
755
- d = u(d);
756
- } catch (f) {
757
- o(f);
758
- break;
759
- }
760
- }
761
- try {
762
- l = ct(d);
763
- } catch (f) {
764
- return Promise.reject(f);
765
- }
766
- for (; s.length; )
767
- l = l.then(s.shift(), s.shift());
768
- return l;
769
- };
770
- we.prototype.getUri = function(e) {
771
- return e = Le(this.defaults, e), Aa(e.url, e.params, e.paramsSerializer).replace(/^\?/, "");
772
- };
773
- Zt.forEach(["delete", "get", "head", "options"], function(e) {
774
- we.prototype[e] = function(t, n) {
775
- return this.request(Le(n || {}, {
776
- method: e,
777
- url: t,
778
- data: (n || {}).data
779
- }));
780
- };
781
- });
782
- Zt.forEach(["post", "put", "patch"], function(e) {
783
- we.prototype[e] = function(t, n, a) {
784
- return this.request(Le(a || {}, {
785
- method: e,
786
- url: t,
787
- data: n
788
- }));
789
- };
790
- });
791
- var Oa = we, er, ft;
792
- function Pa() {
793
- if (ft)
794
- return er;
795
- ft = 1;
796
- var r = Te();
797
- function e(t) {
798
- if (typeof t != "function")
799
- throw new TypeError("executor must be a function.");
800
- var n;
801
- this.promise = new Promise(function(s) {
802
- n = s;
803
- });
804
- var a = this;
805
- this.promise.then(function(i) {
806
- if (a._listeners) {
807
- var s, l = a._listeners.length;
808
- for (s = 0; s < l; s++)
809
- a._listeners[s](i);
810
- a._listeners = null;
811
- }
812
- }), this.promise.then = function(i) {
813
- var s, l = new Promise(function(c) {
814
- a.subscribe(c), s = c;
815
- }).then(i);
816
- return l.cancel = function() {
817
- a.unsubscribe(s);
818
- }, l;
819
- }, t(function(s) {
820
- a.reason || (a.reason = new r(s), n(a.reason));
821
- });
822
- }
823
- return e.prototype.throwIfRequested = function() {
824
- if (this.reason)
825
- throw this.reason;
826
- }, e.prototype.subscribe = function(n) {
827
- if (this.reason) {
828
- n(this.reason);
829
- return;
830
- }
831
- this._listeners ? this._listeners.push(n) : this._listeners = [n];
832
- }, e.prototype.unsubscribe = function(n) {
833
- if (this._listeners) {
834
- var a = this._listeners.indexOf(n);
835
- a !== -1 && this._listeners.splice(a, 1);
23
+ );
24
+ }), a = new N();
25
+ return i ? /* @__PURE__ */ O(R.Provider, { value: { client: i }, children: /* @__PURE__ */ O(x, { client: a, children: r }) }) : /* @__PURE__ */ O(
26
+ "div",
27
+ {
28
+ style: {
29
+ alignItems: "center",
30
+ display: "flex",
31
+ height: "100%",
32
+ justifyContent: "center",
33
+ width: "100%"
34
+ },
35
+ children: "Loading..."
836
36
  }
837
- }, e.source = function() {
838
- var n, a = new e(function(s) {
839
- n = s;
840
- });
841
- return {
842
- token: a,
843
- cancel: n
844
- };
845
- }, er = e, er;
846
- }
847
- var rr, pt;
848
- function Ia() {
849
- return pt || (pt = 1, rr = function(e) {
850
- return function(n) {
851
- return e.apply(null, n);
852
- };
853
- }), rr;
854
- }
855
- var tr, dt;
856
- function Ra() {
857
- if (dt)
858
- return tr;
859
- dt = 1;
860
- var r = D;
861
- return tr = function(t) {
862
- return r.isObject(t) && t.isAxiosError === !0;
863
- }, tr;
864
- }
865
- var ht = D, xa = zt, Re = Oa, Ca = Xt, Fa = _r;
866
- function rn(r) {
867
- var e = new Re(r), t = xa(Re.prototype.request, e);
868
- return ht.extend(t, Re.prototype, e), ht.extend(t, e), t.create = function(a) {
869
- return rn(Ca(r, a));
870
- }, t;
871
- }
872
- var W = rn(Fa);
873
- W.Axios = Re;
874
- W.Cancel = Te();
875
- W.CancelToken = Pa();
876
- W.isCancel = Qt();
877
- W.VERSION = Yt().version;
878
- W.all = function(e) {
879
- return Promise.all(e);
880
- };
881
- W.spread = Ia();
882
- W.isAxiosError = Ra();
883
- kn.exports = W;
884
- Ce.default = W;
885
- (function(r) {
886
- r.exports = Ce;
887
- })(Dn);
888
- const mr = /* @__PURE__ */ $n(hr);
889
- var Fe = {}, Na = {
890
- get exports() {
891
- return Fe;
892
- },
893
- set exports(r) {
894
- Fe = r;
895
- }
896
- };
897
- (function(r) {
898
- (function() {
899
- var e, t, n, a, i, s, l, c, d;
900
- t = {}, c = this, r !== null && r.exports ? r.exports = t : c.ipaddr = t, l = function(u, o, f, p) {
901
- var y, v;
902
- if (u.length !== o.length)
903
- throw new Error("ipaddr: cannot match CIDR for objects with different lengths");
904
- for (y = 0; p > 0; ) {
905
- if (v = f - p, v < 0 && (v = 0), u[y] >> v !== o[y] >> v)
906
- return !1;
907
- p -= f, y += 1;
908
- }
909
- return !0;
910
- }, t.subnetMatch = function(u, o, f) {
911
- var p, y, v, m, h;
912
- f == null && (f = "unicast");
913
- for (v in o)
914
- for (m = o[v], m[0] && !(m[0] instanceof Array) && (m = [m]), p = 0, y = m.length; p < y; p++)
915
- if (h = m[p], u.kind() === h[0].kind() && u.match.apply(u, h))
916
- return v;
917
- return f;
918
- }, t.IPv4 = function() {
919
- function u(o) {
920
- var f, p, y;
921
- if (o.length !== 4)
922
- throw new Error("ipaddr: ipv4 octet count should be 4");
923
- for (f = 0, p = o.length; f < p; f++)
924
- if (y = o[f], !(0 <= y && y <= 255))
925
- throw new Error("ipaddr: ipv4 octet should fit in 8 bits");
926
- this.octets = o;
927
- }
928
- return u.prototype.kind = function() {
929
- return "ipv4";
930
- }, u.prototype.toString = function() {
931
- return this.octets.join(".");
932
- }, u.prototype.toNormalizedString = function() {
933
- return this.toString();
934
- }, u.prototype.toByteArray = function() {
935
- return this.octets.slice(0);
936
- }, u.prototype.match = function(o, f) {
937
- var p;
938
- if (f === void 0 && (p = o, o = p[0], f = p[1]), o.kind() !== "ipv4")
939
- throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");
940
- return l(this.octets, o.octets, 8, f);
941
- }, u.prototype.SpecialRanges = {
942
- unspecified: [[new u([0, 0, 0, 0]), 8]],
943
- broadcast: [[new u([255, 255, 255, 255]), 32]],
944
- multicast: [[new u([224, 0, 0, 0]), 4]],
945
- linkLocal: [[new u([169, 254, 0, 0]), 16]],
946
- loopback: [[new u([127, 0, 0, 0]), 8]],
947
- carrierGradeNat: [[new u([100, 64, 0, 0]), 10]],
948
- private: [[new u([10, 0, 0, 0]), 8], [new u([172, 16, 0, 0]), 12], [new u([192, 168, 0, 0]), 16]],
949
- reserved: [[new u([192, 0, 0, 0]), 24], [new u([192, 0, 2, 0]), 24], [new u([192, 88, 99, 0]), 24], [new u([198, 51, 100, 0]), 24], [new u([203, 0, 113, 0]), 24], [new u([240, 0, 0, 0]), 4]]
950
- }, u.prototype.range = function() {
951
- return t.subnetMatch(this, this.SpecialRanges);
952
- }, u.prototype.toIPv4MappedAddress = function() {
953
- return t.IPv6.parse("::ffff:" + this.toString());
954
- }, u.prototype.prefixLengthFromSubnetMask = function() {
955
- var o, f, p, y, v, m, h;
956
- for (h = {
957
- 0: 8,
958
- 128: 7,
959
- 192: 6,
960
- 224: 5,
961
- 240: 4,
962
- 248: 3,
963
- 252: 2,
964
- 254: 1,
965
- 255: 0
966
- }, o = 0, v = !1, f = p = 3; p >= 0; f = p += -1)
967
- if (y = this.octets[f], y in h) {
968
- if (m = h[y], v && m !== 0)
969
- return null;
970
- m !== 8 && (v = !0), o += m;
971
- } else
972
- return null;
973
- return 32 - o;
974
- }, u;
975
- }(), n = "(0?\\d+|0x[a-f0-9]+)", a = {
976
- fourOctet: new RegExp("^" + n + "\\." + n + "\\." + n + "\\." + n + "$", "i"),
977
- longValue: new RegExp("^" + n + "$", "i")
978
- }, t.IPv4.parser = function(u) {
979
- var o, f, p, y, v;
980
- if (f = function(m) {
981
- return m[0] === "0" && m[1] !== "x" ? parseInt(m, 8) : parseInt(m);
982
- }, o = u.match(a.fourOctet))
983
- return function() {
984
- var m, h, g, A;
985
- for (g = o.slice(1, 6), A = [], m = 0, h = g.length; m < h; m++)
986
- p = g[m], A.push(f(p));
987
- return A;
988
- }();
989
- if (o = u.match(a.longValue)) {
990
- if (v = f(o[1]), v > 4294967295 || v < 0)
991
- throw new Error("ipaddr: address outside defined range");
992
- return function() {
993
- var m, h;
994
- for (h = [], y = m = 0; m <= 24; y = m += 8)
995
- h.push(v >> y & 255);
996
- return h;
997
- }().reverse();
998
- } else
999
- return null;
1000
- }, t.IPv6 = function() {
1001
- function u(o, f) {
1002
- var p, y, v, m, h, g;
1003
- if (o.length === 16)
1004
- for (this.parts = [], p = y = 0; y <= 14; p = y += 2)
1005
- this.parts.push(o[p] << 8 | o[p + 1]);
1006
- else if (o.length === 8)
1007
- this.parts = o;
1008
- else
1009
- throw new Error("ipaddr: ipv6 part count should be 8 or 16");
1010
- for (g = this.parts, v = 0, m = g.length; v < m; v++)
1011
- if (h = g[v], !(0 <= h && h <= 65535))
1012
- throw new Error("ipaddr: ipv6 part should fit in 16 bits");
1013
- f && (this.zoneId = f);
1014
- }
1015
- return u.prototype.kind = function() {
1016
- return "ipv6";
1017
- }, u.prototype.toString = function() {
1018
- return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/, "::");
1019
- }, u.prototype.toRFC5952String = function() {
1020
- var o, f, p, y, v;
1021
- for (y = /((^|:)(0(:|$)){2,})/g, v = this.toNormalizedString(), o = 0, f = -1; p = y.exec(v); )
1022
- p[0].length > f && (o = p.index, f = p[0].length);
1023
- return f < 0 ? v : v.substring(0, o) + "::" + v.substring(o + f);
1024
- }, u.prototype.toByteArray = function() {
1025
- var o, f, p, y, v;
1026
- for (o = [], v = this.parts, f = 0, p = v.length; f < p; f++)
1027
- y = v[f], o.push(y >> 8), o.push(y & 255);
1028
- return o;
1029
- }, u.prototype.toNormalizedString = function() {
1030
- var o, f, p;
1031
- return o = function() {
1032
- var y, v, m, h;
1033
- for (m = this.parts, h = [], y = 0, v = m.length; y < v; y++)
1034
- f = m[y], h.push(f.toString(16));
1035
- return h;
1036
- }.call(this).join(":"), p = "", this.zoneId && (p = "%" + this.zoneId), o + p;
1037
- }, u.prototype.toFixedLengthString = function() {
1038
- var o, f, p;
1039
- return o = function() {
1040
- var y, v, m, h;
1041
- for (m = this.parts, h = [], y = 0, v = m.length; y < v; y++)
1042
- f = m[y], h.push(f.toString(16).padStart(4, "0"));
1043
- return h;
1044
- }.call(this).join(":"), p = "", this.zoneId && (p = "%" + this.zoneId), o + p;
1045
- }, u.prototype.match = function(o, f) {
1046
- var p;
1047
- if (f === void 0 && (p = o, o = p[0], f = p[1]), o.kind() !== "ipv6")
1048
- throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");
1049
- return l(this.parts, o.parts, 16, f);
1050
- }, u.prototype.SpecialRanges = {
1051
- unspecified: [new u([0, 0, 0, 0, 0, 0, 0, 0]), 128],
1052
- linkLocal: [new u([65152, 0, 0, 0, 0, 0, 0, 0]), 10],
1053
- multicast: [new u([65280, 0, 0, 0, 0, 0, 0, 0]), 8],
1054
- loopback: [new u([0, 0, 0, 0, 0, 0, 0, 1]), 128],
1055
- uniqueLocal: [new u([64512, 0, 0, 0, 0, 0, 0, 0]), 7],
1056
- ipv4Mapped: [new u([0, 0, 0, 0, 0, 65535, 0, 0]), 96],
1057
- rfc6145: [new u([0, 0, 0, 0, 65535, 0, 0, 0]), 96],
1058
- rfc6052: [new u([100, 65435, 0, 0, 0, 0, 0, 0]), 96],
1059
- "6to4": [new u([8194, 0, 0, 0, 0, 0, 0, 0]), 16],
1060
- teredo: [new u([8193, 0, 0, 0, 0, 0, 0, 0]), 32],
1061
- reserved: [[new u([8193, 3512, 0, 0, 0, 0, 0, 0]), 32]]
1062
- }, u.prototype.range = function() {
1063
- return t.subnetMatch(this, this.SpecialRanges);
1064
- }, u.prototype.isIPv4MappedAddress = function() {
1065
- return this.range() === "ipv4Mapped";
1066
- }, u.prototype.toIPv4Address = function() {
1067
- var o, f, p;
1068
- if (!this.isIPv4MappedAddress())
1069
- throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");
1070
- return p = this.parts.slice(-2), o = p[0], f = p[1], new t.IPv4([o >> 8, o & 255, f >> 8, f & 255]);
1071
- }, u.prototype.prefixLengthFromSubnetMask = function() {
1072
- var o, f, p, y, v, m, h;
1073
- for (h = {
1074
- 0: 16,
1075
- 32768: 15,
1076
- 49152: 14,
1077
- 57344: 13,
1078
- 61440: 12,
1079
- 63488: 11,
1080
- 64512: 10,
1081
- 65024: 9,
1082
- 65280: 8,
1083
- 65408: 7,
1084
- 65472: 6,
1085
- 65504: 5,
1086
- 65520: 4,
1087
- 65528: 3,
1088
- 65532: 2,
1089
- 65534: 1,
1090
- 65535: 0
1091
- }, o = 0, v = !1, f = p = 7; p >= 0; f = p += -1)
1092
- if (y = this.parts[f], y in h) {
1093
- if (m = h[y], v && m !== 0)
1094
- return null;
1095
- m !== 16 && (v = !0), o += m;
1096
- } else
1097
- return null;
1098
- return 128 - o;
1099
- }, u;
1100
- }(), i = "(?:[0-9a-f]+::?)+", d = "%[0-9a-z]{1,}", s = {
1101
- zoneIndex: new RegExp(d, "i"),
1102
- native: new RegExp("^(::)?(" + i + ")?([0-9a-f]+)?(::)?(" + d + ")?$", "i"),
1103
- transitional: new RegExp("^((?:" + i + ")|(?:::)(?:" + i + ")?)" + (n + "\\." + n + "\\." + n + "\\." + n) + ("(" + d + ")?$"), "i")
1104
- }, e = function(u, o) {
1105
- var f, p, y, v, m, h;
1106
- if (u.indexOf("::") !== u.lastIndexOf("::"))
1107
- return null;
1108
- for (h = (u.match(s.zoneIndex) || [])[0], h && (h = h.substring(1), u = u.replace(/%.+$/, "")), f = 0, p = -1; (p = u.indexOf(":", p + 1)) >= 0; )
1109
- f++;
1110
- if (u.substr(0, 2) === "::" && f--, u.substr(-2, 2) === "::" && f--, f > o)
1111
- return null;
1112
- for (m = o - f, v = ":"; m--; )
1113
- v += "0:";
1114
- return u = u.replace("::", v), u[0] === ":" && (u = u.slice(1)), u[u.length - 1] === ":" && (u = u.slice(0, -1)), o = function() {
1115
- var g, A, S, x;
1116
- for (S = u.split(":"), x = [], g = 0, A = S.length; g < A; g++)
1117
- y = S[g], x.push(parseInt(y, 16));
1118
- return x;
1119
- }(), {
1120
- parts: o,
1121
- zoneId: h
1122
- };
1123
- }, t.IPv6.parser = function(u) {
1124
- var o, f, p, y, v, m, h;
1125
- if (s.native.test(u))
1126
- return e(u, 8);
1127
- if ((y = u.match(s.transitional)) && (h = y[6] || "", o = e(y[1].slice(0, -1) + h, 6), o.parts)) {
1128
- for (m = [parseInt(y[2]), parseInt(y[3]), parseInt(y[4]), parseInt(y[5])], f = 0, p = m.length; f < p; f++)
1129
- if (v = m[f], !(0 <= v && v <= 255))
1130
- return null;
1131
- return o.parts.push(m[0] << 8 | m[1]), o.parts.push(m[2] << 8 | m[3]), {
1132
- parts: o.parts,
1133
- zoneId: o.zoneId
1134
- };
1135
- }
1136
- return null;
1137
- }, t.IPv4.isIPv4 = t.IPv6.isIPv6 = function(u) {
1138
- return this.parser(u) !== null;
1139
- }, t.IPv4.isValid = function(u) {
1140
- try {
1141
- return new this(this.parser(u)), !0;
1142
- } catch {
1143
- return !1;
1144
- }
1145
- }, t.IPv4.isValidFourPartDecimal = function(u) {
1146
- return !!(t.IPv4.isValid(u) && u.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/));
1147
- }, t.IPv6.isValid = function(u) {
1148
- var o;
1149
- if (typeof u == "string" && u.indexOf(":") === -1)
1150
- return !1;
1151
- try {
1152
- return o = this.parser(u), new this(o.parts, o.zoneId), !0;
1153
- } catch {
1154
- return !1;
1155
- }
1156
- }, t.IPv4.parse = function(u) {
1157
- var o;
1158
- if (o = this.parser(u), o === null)
1159
- throw new Error("ipaddr: string is not formatted like ip address");
1160
- return new this(o);
1161
- }, t.IPv6.parse = function(u) {
1162
- var o;
1163
- if (o = this.parser(u), o.parts === null)
1164
- throw new Error("ipaddr: string is not formatted like ip address");
1165
- return new this(o.parts, o.zoneId);
1166
- }, t.IPv4.parseCIDR = function(u) {
1167
- var o, f, p;
1168
- if ((f = u.match(/^(.+)\/(\d+)$/)) && (o = parseInt(f[2]), o >= 0 && o <= 32))
1169
- return p = [this.parse(f[1]), o], Object.defineProperty(p, "toString", {
1170
- value: function() {
1171
- return this.join("/");
1172
- }
1173
- }), p;
1174
- throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range");
1175
- }, t.IPv4.subnetMaskFromPrefixLength = function(u) {
1176
- var o, f, p;
1177
- if (u = parseInt(u), u < 0 || u > 32)
1178
- throw new Error("ipaddr: invalid IPv4 prefix length");
1179
- for (p = [0, 0, 0, 0], f = 0, o = Math.floor(u / 8); f < o; )
1180
- p[f] = 255, f++;
1181
- return o < 4 && (p[o] = Math.pow(2, u % 8) - 1 << 8 - u % 8), new this(p);
1182
- }, t.IPv4.broadcastAddressFromCIDR = function(u) {
1183
- var o, f, p, y, v;
1184
- try {
1185
- for (o = this.parseCIDR(u), p = o[0].toByteArray(), v = this.subnetMaskFromPrefixLength(o[1]).toByteArray(), y = [], f = 0; f < 4; )
1186
- y.push(parseInt(p[f], 10) | parseInt(v[f], 10) ^ 255), f++;
1187
- return new this(y);
1188
- } catch {
1189
- throw new Error("ipaddr: the address does not have IPv4 CIDR format");
1190
- }
1191
- }, t.IPv4.networkAddressFromCIDR = function(u) {
1192
- var o, f, p, y, v;
1193
- try {
1194
- for (o = this.parseCIDR(u), p = o[0].toByteArray(), v = this.subnetMaskFromPrefixLength(o[1]).toByteArray(), y = [], f = 0; f < 4; )
1195
- y.push(parseInt(p[f], 10) & parseInt(v[f], 10)), f++;
1196
- return new this(y);
1197
- } catch {
1198
- throw new Error("ipaddr: the address does not have IPv4 CIDR format");
1199
- }
1200
- }, t.IPv6.parseCIDR = function(u) {
1201
- var o, f, p;
1202
- if ((f = u.match(/^(.+)\/(\d+)$/)) && (o = parseInt(f[2]), o >= 0 && o <= 128))
1203
- return p = [this.parse(f[1]), o], Object.defineProperty(p, "toString", {
1204
- value: function() {
1205
- return this.join("/");
1206
- }
1207
- }), p;
1208
- throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range");
1209
- }, t.isValid = function(u) {
1210
- return t.IPv6.isValid(u) || t.IPv4.isValid(u);
1211
- }, t.parse = function(u) {
1212
- if (t.IPv6.isValid(u))
1213
- return t.IPv6.parse(u);
1214
- if (t.IPv4.isValid(u))
1215
- return t.IPv4.parse(u);
1216
- throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format");
1217
- }, t.parseCIDR = function(u) {
1218
- try {
1219
- return t.IPv6.parseCIDR(u);
1220
- } catch {
1221
- try {
1222
- return t.IPv4.parseCIDR(u);
1223
- } catch {
1224
- throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format");
1225
- }
1226
- }
1227
- }, t.fromByteArray = function(u) {
1228
- var o;
1229
- if (o = u.length, o === 4)
1230
- return new t.IPv4(u);
1231
- if (o === 16)
1232
- return new t.IPv6(u);
1233
- throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address");
1234
- }, t.process = function(u) {
1235
- var o;
1236
- return o = this.parse(u), o.kind() === "ipv6" && o.isIPv4MappedAddress() ? o.toIPv4Address() : o;
1237
- };
1238
- }).call(Mt);
1239
- })(Na);
1240
- const tn = (r) => Array.isArray(r) && r.every((e) => nn(e)), nn = (r) => !!r.errorCode, $a = async () => {
1241
- try {
1242
- const r = await mr.get("https://api.ipify.org/?format=json");
1243
- return r.data.ip && Fe.isValid(r.data.ip) ? Fe.parse(r.data.ip).toString() : void 0;
1244
- } catch {
1245
- return;
1246
- }
1247
- };
1248
- class _a {
1249
- constructor(e) {
1250
- this.client = e, this.list = () => this.client.get("/v1/carriers"), this.get = (t) => this.client.get(`/v1/carriers/${t}`), this.connect = async ({ carrierCode: t, ...n }) => {
1251
- const a = await $a();
1252
- return a ? await this.client.post(`/v1/registration/${t}`, {
1253
- ...n,
1254
- endUserIpAddress: a
1255
- }) : Promise.reject([new j("Unable to get IP address")]);
1256
- }, this.addFunds = (t, n) => this.client.put(`/v1/carriers/${t}/add_funds`, n), this.updateAutoFunding = (t, n) => this.client.post(
1257
- `/v1/carriers/${t}/auto_funding`,
1258
- n
1259
- ), this.getAutoFunding = (t) => this.client.get(
1260
- `/v1/carriers/${t}/auto_funding`
1261
- ), this.getWalletHistory = (t, n, a) => this.client.get("/v1/carriers/wallet_history", {
1262
- params: {
1263
- endDate: n.toISOString(),
1264
- page: a,
1265
- startDate: t.toISOString()
1266
- }
1267
- }), this.client = e;
1268
- }
1269
- }
1270
- var gr = { trace: 10, debug: 20, info: 30, warn: 40, error: 50, fatal: 60 }, kr = {};
1271
- function nr(r) {
1272
- return typeof r == "string" ? gr[r.toLowerCase()] : r;
1273
- }
1274
- function Sr(r, e) {
1275
- return Sr = Object.setPrototypeOf || function(t, n) {
1276
- return t.__proto__ = n, t;
1277
- }, Sr(r, e);
1278
- }
1279
- function Da() {
37
+ );
38
+ }, c = () => {
39
+ const e = U(R);
40
+ if (!e)
41
+ throw new Error("useShipEngine must be called within a ShipEngineProvider");
42
+ return e;
43
+ }, V = (e) => new Promise((r) => {
44
+ setTimeout(() => r(!0), e);
45
+ }), u = (e) => e.forEach(console.log);
46
+ var F = { trace: 10, debug: 20, info: 30, warn: 40, error: 50, fatal: 60 }, z = {};
47
+ function E(e) {
48
+ return typeof e == "string" ? F[e.toLowerCase()] : e;
49
+ }
50
+ function j(e, r) {
51
+ return j = Object.setPrototypeOf || function(t, s) {
52
+ return t.__proto__ = s, t;
53
+ }, j(e, r);
54
+ }
55
+ function J() {
1280
56
  if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
1281
57
  return !1;
1282
58
  if (typeof Proxy == "function")
@@ -1288,110 +64,110 @@ function Da() {
1288
64
  return !1;
1289
65
  }
1290
66
  }
1291
- function wr(r, e, t) {
1292
- return wr = Da() ? Reflect.construct : function(n, a, i) {
1293
- var s = [null];
1294
- s.push.apply(s, a);
1295
- var l = new (Function.bind.apply(n, s))();
1296
- return i && Sr(l, i.prototype), l;
1297
- }, wr.apply(null, arguments);
67
+ function q(e, r, t) {
68
+ return q = J() ? Reflect.construct : function(s, i, n) {
69
+ var a = [null];
70
+ a.push.apply(a, i);
71
+ var d = new (Function.bind.apply(s, a))();
72
+ return n && j(d, n.prototype), d;
73
+ }, q.apply(null, arguments);
1298
74
  }
1299
- function ee(r) {
1300
- if (r == null)
1301
- return r;
1302
- if (Array.isArray(r))
1303
- return r.slice();
1304
- if (typeof r == "object") {
1305
- var e = {};
1306
- return Object.keys(r).forEach(function(t) {
1307
- e[t] = r[t];
1308
- }), e;
75
+ function g(e) {
76
+ if (e == null)
77
+ return e;
78
+ if (Array.isArray(e))
79
+ return e.slice();
80
+ if (typeof e == "object") {
81
+ var r = {};
82
+ return Object.keys(e).forEach(function(t) {
83
+ r[t] = e[t];
84
+ }), r;
1309
85
  }
1310
- return r;
86
+ return e;
1311
87
  }
1312
- function br(r) {
1313
- return r === void 0 ? "undefined" : r === null ? "null" : Array.isArray(r) ? "[ " + r.map(function(e) {
1314
- return br(e);
1315
- }).join(", ") + " ]" : typeof r == "object" ? JSON.stringify(r) : typeof r == "function" ? "[Function: " + r.name + "]" : typeof r == "boolean" || typeof r == "number" ? r : "'" + r.toString() + "'";
88
+ function A(e) {
89
+ return e === void 0 ? "undefined" : e === null ? "null" : Array.isArray(e) ? "[ " + e.map(function(r) {
90
+ return A(r);
91
+ }).join(", ") + " ]" : typeof e == "object" ? JSON.stringify(e) : typeof e == "function" ? "[Function: " + e.name + "]" : typeof e == "boolean" || typeof e == "number" ? e : "'" + e.toString() + "'";
1316
92
  }
1317
- function Y(r) {
1318
- if (typeof r != "string") {
1319
- for (var e = new Array(arguments.length), t = 0; t < arguments.length; t++)
1320
- e[t] = br(arguments[t]);
1321
- return e.join(" ");
93
+ function p(e) {
94
+ if (typeof e != "string") {
95
+ for (var r = new Array(arguments.length), t = 0; t < arguments.length; t++)
96
+ r[t] = A(arguments[t]);
97
+ return r.join(" ");
1322
98
  }
1323
- for (var n = /%[sdj%]/g, a = 1, i = arguments, s = i.length, l = String(r).replace(n, function(d) {
1324
- if (d === "%%")
99
+ for (var s = /%[sdj%]/g, i = 1, n = arguments, a = n.length, d = String(e).replace(s, function(f) {
100
+ if (f === "%%")
1325
101
  return "%";
1326
- if (a >= s)
1327
- return d;
1328
- switch (d) {
102
+ if (i >= a)
103
+ return f;
104
+ switch (f) {
1329
105
  case "%s":
1330
- return String(i[a++]);
106
+ return String(n[i++]);
1331
107
  case "%d":
1332
- return Number(i[a++]);
108
+ return Number(n[i++]);
1333
109
  case "%j":
1334
110
  try {
1335
- return JSON.stringify(i[a++]);
111
+ return JSON.stringify(n[i++]);
1336
112
  } catch {
1337
113
  return "[Circular]";
1338
114
  }
1339
115
  default:
1340
- return d;
116
+ return f;
1341
117
  }
1342
- }), c = i[a]; a < s; c = i[++a])
1343
- l += c === null || typeof c != "object" ? " " + c : " " + br(c);
1344
- return l;
118
+ }), o = n[i]; i < a; o = n[++i])
119
+ d += o === null || typeof o != "object" ? " " + o : " " + A(o);
120
+ return d;
1345
121
  }
1346
- function ka(r, e) {
1347
- var t = r.split(`
122
+ function Q(e, r) {
123
+ var t = e.split(`
1348
124
  `);
1349
125
  t[0] && t[0].indexOf("call-stack-error") >= 0 && t.shift();
1350
- var n = t[e], a = null;
1351
- if (n) {
1352
- var i = /^\s*(at|.*@)\s*(.+)?$/.exec(n);
1353
- a = Array.isArray(i) && i[2] ? i[2] : n;
126
+ var s = t[r], i = null;
127
+ if (s) {
128
+ var n = /^\s*(at|.*@)\s*(.+)?$/.exec(s);
129
+ i = Array.isArray(n) && n[2] ? n[2] : s;
1354
130
  }
1355
- return a;
131
+ return i;
1356
132
  }
1357
- Object.keys(gr).forEach(function(r) {
1358
- kr[gr[r]] = r;
133
+ Object.keys(F).forEach(function(e) {
134
+ z[F[e]] = e;
1359
135
  });
1360
- var Er = {};
1361
- function Ar(r, e) {
1362
- if (e) {
1363
- if (Er[e])
136
+ var C = {};
137
+ function k(e, r) {
138
+ if (r) {
139
+ if (C[r])
1364
140
  return;
1365
- Er[e] = !0;
141
+ C[r] = !0;
1366
142
  }
1367
- console.error(r + `
143
+ console.error(e + `
1368
144
  `);
1369
145
  }
1370
- function Ta(r) {
1371
- return Er[r];
146
+ function H(e) {
147
+ return C[e];
1372
148
  }
1373
- function Ba() {
1374
- var r = [];
1375
- return function(e, t) {
1376
- return t && typeof t == "object" ? r.indexOf(t) !== -1 ? "[Circular]" : (r.push(t), t) : t;
149
+ function M() {
150
+ var e = [];
151
+ return function(r, t) {
152
+ return t && typeof t == "object" ? e.indexOf(t) !== -1 ? "[Circular]" : (e.push(t), t) : t;
1377
153
  };
1378
154
  }
1379
- var La = /* @__PURE__ */ function() {
1380
- function r() {
155
+ var Y = /* @__PURE__ */ function() {
156
+ function e() {
1381
157
  }
1382
- return r.prototype.write = function(e) {
1383
- e.level < 30 ? console.log(e) : e.level < 40 ? console.info(e) : e.level < 50 ? console.warn(e) : console.error(e), e.err && e.err.stack && console.error(e.err.stack), e.obj && console.log(e.obj);
1384
- }, r;
1385
- }(), Z = /* @__PURE__ */ function() {
1386
- function r(t, n, a) {
1387
- var i, s, l, c, d = this;
1388
- if (!(this instanceof r))
1389
- return new r(t, n);
1390
- if (n !== void 0 && (i = t, t = n, !(i instanceof r)))
158
+ return e.prototype.write = function(r) {
159
+ r.level < 30 ? console.log(r) : r.level < 40 ? console.info(r) : r.level < 50 ? console.warn(r) : console.error(r), r.err && r.err.stack && console.error(r.err.stack), r.obj && console.log(r.obj);
160
+ }, e;
161
+ }(), v = /* @__PURE__ */ function() {
162
+ function e(t, s, i) {
163
+ var n, a, d, o, f = this;
164
+ if (!(this instanceof e))
165
+ return new e(t, s);
166
+ if (s !== void 0 && (n = t, t = s, !(n instanceof e)))
1391
167
  throw new TypeError("invalid Logger creation: do not pass a second arg");
1392
168
  if (!t)
1393
169
  throw new TypeError("options (object) is required");
1394
- if (i) {
170
+ if (n) {
1395
171
  if (t.name)
1396
172
  throw new TypeError("invalid options.name: child cannot set logger name");
1397
173
  } else if (!t.name)
@@ -1402,1927 +178,528 @@ var La = /* @__PURE__ */ function() {
1402
178
  throw new TypeError("invalid options.streams: must be an array");
1403
179
  if (t.serializers && (typeof t.serializers != "object" || Array.isArray(t.serializers)))
1404
180
  throw new TypeError("invalid options.serializers: must be an object");
1405
- if (i && a) {
1406
- this._level = i._level, this.streams = i.streams, this.serializers = i.serializers, this.src = i.src, s = this.fields = {};
1407
- var u = Object.keys(i.fields);
1408
- for (c = 0; c < u.length; c++)
1409
- s[l = u[c]] = i.fields[l];
1410
- var o = Object.keys(t);
1411
- for (c = 0; c < o.length; c++)
1412
- s[l = o[c]] = t[l];
181
+ if (n && i) {
182
+ this._level = n._level, this.streams = n.streams, this.serializers = n.serializers, this.src = n.src, a = this.fields = {};
183
+ var m = Object.keys(n.fields);
184
+ for (o = 0; o < m.length; o++)
185
+ a[d = m[o]] = n.fields[d];
186
+ var l = Object.keys(t);
187
+ for (o = 0; o < l.length; o++)
188
+ a[d = l[o]] = t[d];
1413
189
  } else {
1414
- if (i) {
1415
- for (this._level = i._level, this.streams = [], c = 0; c < i.streams.length; c++) {
1416
- var f = ee(i.streams[c]);
1417
- this.streams.push(f);
190
+ if (n) {
191
+ for (this._level = n._level, this.streams = [], o = 0; o < n.streams.length; o++) {
192
+ var b = g(n.streams[o]);
193
+ this.streams.push(b);
1418
194
  }
1419
- this.serializers = ee(i.serializers), this.src = i.src, this.fields = ee(i.fields), t.level && this.level(t.level);
195
+ this.serializers = g(n.serializers), this.src = n.src, this.fields = g(n.fields), t.level && this.level(t.level);
1420
196
  } else
1421
197
  this._level = Number.POSITIVE_INFINITY, this.streams = [], this.serializers = null, this.src = !1, this.fields = {};
1422
- t.stream ? this.addStream({ type: "stream", stream: t.stream, level: t.level }) : t.streams ? t.streams.forEach(function(p) {
1423
- d.addStream(p, t.level);
1424
- }) : i && t.level ? this.level(t.level) : i || this.addStream({ type: "raw", stream: new La(), level: t.level }), t.serializers && this.addSerializers(t.serializers), t.src && (this.src = !0), delete (s = ee(t)).stream, delete s.level, delete s.streams, delete s.serializers, delete s.src, this.serializers && this._applySerializers(s), Object.keys(s).forEach(function(p) {
1425
- d.fields[p] = s[p];
198
+ t.stream ? this.addStream({ type: "stream", stream: t.stream, level: t.level }) : t.streams ? t.streams.forEach(function(w) {
199
+ f.addStream(w, t.level);
200
+ }) : n && t.level ? this.level(t.level) : n || this.addStream({ type: "raw", stream: new Y(), level: t.level }), t.serializers && this.addSerializers(t.serializers), t.src && (this.src = !0), delete (a = g(t)).stream, delete a.level, delete a.streams, delete a.serializers, delete a.src, this.serializers && this._applySerializers(a), Object.keys(a).forEach(function(w) {
201
+ f.fields[w] = a[w];
1426
202
  });
1427
203
  }
1428
204
  }
1429
- var e = r.prototype;
1430
- return e.addStream = function(t, n) {
1431
- n === void 0 && (n = 30), (t = ee(t)).type = "raw", t.level = nr(t.level || n), t.level < this._level && (this._level = t.level), this.streams.push(t), delete this.haveNonRawStreams;
1432
- }, e.addSerializers = function(t) {
1433
- var n = this;
1434
- this.serializers || (this.serializers = {}), Object.keys(t).forEach(function(a) {
1435
- var i = t[a];
1436
- if (typeof i != "function")
1437
- throw new TypeError(Y('invalid serializer for "%s" field: must be a function', a));
1438
- n.serializers[a] = i;
205
+ var r = e.prototype;
206
+ return r.addStream = function(t, s) {
207
+ s === void 0 && (s = 30), (t = g(t)).type = "raw", t.level = E(t.level || s), t.level < this._level && (this._level = t.level), this.streams.push(t), delete this.haveNonRawStreams;
208
+ }, r.addSerializers = function(t) {
209
+ var s = this;
210
+ this.serializers || (this.serializers = {}), Object.keys(t).forEach(function(i) {
211
+ var n = t[i];
212
+ if (typeof n != "function")
213
+ throw new TypeError(p('invalid serializer for "%s" field: must be a function', i));
214
+ s.serializers[i] = n;
1439
215
  });
1440
- }, e.child = function(t, n) {
1441
- return new this.constructor(this, t || {}, n);
1442
- }, e.level = function(t) {
216
+ }, r.child = function(t, s) {
217
+ return new this.constructor(this, t || {}, s);
218
+ }, r.level = function(t) {
1443
219
  if (t === void 0)
1444
220
  return this._level;
1445
- for (var n = nr(t), a = this.streams.length, i = 0; i < a; i++)
1446
- this.streams[i].level = n;
1447
- this._level = n;
1448
- }, e.levels = function(t, n) {
221
+ for (var s = E(t), i = this.streams.length, n = 0; n < i; n++)
222
+ this.streams[n].level = s;
223
+ this._level = s;
224
+ }, r.levels = function(t, s) {
1449
225
  if (t === void 0)
1450
- return this.streams.map(function(d) {
1451
- return d.level;
226
+ return this.streams.map(function(f) {
227
+ return f.level;
1452
228
  });
1453
- var a;
229
+ var i;
1454
230
  if (typeof t == "number") {
1455
- if ((a = this.streams[t]) === void 0)
231
+ if ((i = this.streams[t]) === void 0)
1456
232
  throw new Error("invalid stream index: " + t);
1457
233
  } else {
1458
- for (var i = this.streams.length, s = 0; s < i; s++) {
1459
- var l = this.streams[s];
1460
- if (l.name === t) {
1461
- a = l;
234
+ for (var n = this.streams.length, a = 0; a < n; a++) {
235
+ var d = this.streams[a];
236
+ if (d.name === t) {
237
+ i = d;
1462
238
  break;
1463
239
  }
1464
240
  }
1465
- if (!a)
1466
- throw new Error(Y('no stream with name "%s"', t));
1467
- }
1468
- if (n === void 0)
1469
- return a.level;
1470
- var c = nr(n);
1471
- a.level = c, c < this._level && (this._level = c);
1472
- }, e._applySerializers = function(t, n) {
1473
- var a = this;
1474
- Object.keys(this.serializers).forEach(function(i) {
1475
- if (!(t[i] === void 0 || n && n[i]))
241
+ if (!i)
242
+ throw new Error(p('no stream with name "%s"', t));
243
+ }
244
+ if (s === void 0)
245
+ return i.level;
246
+ var o = E(s);
247
+ i.level = o, o < this._level && (this._level = o);
248
+ }, r._applySerializers = function(t, s) {
249
+ var i = this;
250
+ Object.keys(this.serializers).forEach(function(n) {
251
+ if (!(t[n] === void 0 || s && s[n]))
1476
252
  try {
1477
- t[i] = a.serializers[i](t[i]);
1478
- } catch (s) {
1479
- Ar(Y(`bunyan: ERROR: Exception thrown from the "%s" Bunyan serializer. This should never happen. This is a bugin that serializer function.
1480
- %s`, i, s.stack || s)), t[i] = Y('(Error in Bunyan log "%s" serializer broke field. See stderr for details.)', i);
253
+ t[n] = i.serializers[n](t[n]);
254
+ } catch (a) {
255
+ k(p(`bunyan: ERROR: Exception thrown from the "%s" Bunyan serializer. This should never happen. This is a bugin that serializer function.
256
+ %s`, n, a.stack || a)), t[n] = p('(Error in Bunyan log "%s" serializer broke field. See stderr for details.)', n);
1481
257
  }
1482
258
  });
1483
- }, e._emit = function(t, n) {
1484
- var a, i;
259
+ }, r._emit = function(t, s) {
260
+ var i, n;
1485
261
  if (this.haveNonRawStreams === void 0) {
1486
- for (this.haveNonRawStreams = !1, a = 0; a < this.streams.length; a++)
1487
- if (!this.streams[a].raw) {
262
+ for (this.haveNonRawStreams = !1, i = 0; i < this.streams.length; i++)
263
+ if (!this.streams[i].raw) {
1488
264
  this.haveNonRawStreams = !0;
1489
265
  break;
1490
266
  }
1491
267
  }
1492
- if (n || this.haveNonRawStreams)
268
+ if (s || this.haveNonRawStreams)
1493
269
  try {
1494
- i = JSON.stringify(t, Ba()) + `
270
+ n = JSON.stringify(t, M()) + `
1495
271
  `;
1496
- } catch (d) {
1497
- var s = d.stack.split(/\n/g, 2).join(`
272
+ } catch (f) {
273
+ var a = f.stack.split(/\n/g, 2).join(`
1498
274
  `);
1499
- Ar('bunyan: ERROR: Exception in `JSON.stringify(rec)`. You can install the "safe-json-stringify" module to have Bunyan fallback to safer stringification. Record:\n' + function(u, o) {
1500
- return o || (o = " "), o + u.split(/\r?\n/g).join(`
1501
- ` + o);
1502
- }(Y(`%s
1503
- %s`, t, d.stack)), s), i = Y(`(Exception in JSON.stringify(rec): %j. See stderr for details.)
1504
- `, d.message);
275
+ k('bunyan: ERROR: Exception in `JSON.stringify(rec)`. You can install the "safe-json-stringify" module to have Bunyan fallback to safer stringification. Record:\n' + function(m, l) {
276
+ return l || (l = " "), l + m.split(/\r?\n/g).join(`
277
+ ` + l);
278
+ }(p(`%s
279
+ %s`, t, f.stack)), a), n = p(`(Exception in JSON.stringify(rec): %j. See stderr for details.)
280
+ `, f.message);
1505
281
  }
1506
- if (n)
1507
- return i;
1508
- var l = t.level;
1509
- for (a = 0; a < this.streams.length; a++) {
1510
- var c = this.streams[a];
1511
- c.level <= l && c.stream.write(t);
282
+ if (s)
283
+ return n;
284
+ var d = t.level;
285
+ for (i = 0; i < this.streams.length; i++) {
286
+ var o = this.streams[i];
287
+ o.level <= d && o.stream.write(t);
1512
288
  }
1513
- return i;
1514
- }, r;
289
+ return n;
290
+ }, e;
1515
291
  }();
1516
- function se(r) {
292
+ function S(e) {
1517
293
  return function() {
1518
- var e = this;
1519
- function t(s) {
1520
- var l;
1521
- s[0] instanceof Error ? (n = { err: e.serializers && e.serializers.err ? e.serializers.err(s[0]) : Tr.err(s[0]) }, l = { err: !0 }, a = s.length === 1 ? [n.err.message] : Array.prototype.slice.call(s, 1)) : typeof s[0] != "object" && s[0] !== null || Array.isArray(s[0]) ? (n = null, a = Array.prototype.slice.call(s)) : (n = s[0], a = s.length === 1 && n.err && n.err instanceof Error ? [n.err.message] : Array.prototype.slice.call(s, 1));
1522
- var c = ee(e.fields);
1523
- c.level = r;
1524
- var d = n ? ee(n) : null;
1525
- if (d && (e.serializers && e._applySerializers(d, l), Object.keys(d).forEach(function(o) {
1526
- c[o] = d[o];
1527
- })), c.levelName = kr[r], c.msg = a.length ? Y.apply(e, a) : "", c.time || (c.time = new Date()), e.src && !c.src)
294
+ var r = this;
295
+ function t(a) {
296
+ var d;
297
+ a[0] instanceof Error ? (s = { err: r.serializers && r.serializers.err ? r.serializers.err(a[0]) : P.err(a[0]) }, d = { err: !0 }, i = a.length === 1 ? [s.err.message] : Array.prototype.slice.call(a, 1)) : typeof a[0] != "object" && a[0] !== null || Array.isArray(a[0]) ? (s = null, i = Array.prototype.slice.call(a)) : (s = a[0], i = a.length === 1 && s.err && s.err instanceof Error ? [s.err.message] : Array.prototype.slice.call(a, 1));
298
+ var o = g(r.fields);
299
+ o.level = e;
300
+ var f = s ? g(s) : null;
301
+ if (f && (r.serializers && r._applySerializers(f, d), Object.keys(f).forEach(function(l) {
302
+ o[l] = f[l];
303
+ })), o.levelName = z[e], o.msg = i.length ? p.apply(r, i) : "", o.time || (o.time = new Date()), r.src && !o.src)
1528
304
  try {
1529
305
  throw new Error("call-stack-error");
1530
- } catch (o) {
1531
- var u = o.stack ? ka(o.stack, 2) : "";
1532
- u || Ta("src") || Ar("Unable to determine src line info", "src"), c.src = u || "";
306
+ } catch (l) {
307
+ var m = l.stack ? Q(l.stack, 2) : "";
308
+ m || H("src") || k("Unable to determine src line info", "src"), o.src = m || "";
1533
309
  }
1534
- return c.v = 1, c;
310
+ return o.v = 1, o;
1535
311
  }
1536
- var n = null, a = arguments, i = null;
312
+ var s = null, i = arguments, n = null;
1537
313
  if (arguments.length === 0)
1538
- return this._level <= r;
1539
- this._level > r || (i = t(a), this._emit(i));
314
+ return this._level <= e;
315
+ this._level > e || (n = t(i), this._emit(n));
1540
316
  };
1541
317
  }
1542
- function an(r) {
1543
- var e = r.stack || r.toString();
1544
- if (r.cause && typeof r.cause == "function") {
1545
- var t = r.cause();
1546
- t && (e += `
1547
- Caused by: ` + an(t));
1548
- }
1549
- return e;
1550
- }
1551
- Z.prototype.trace = se(10), Z.prototype.debug = se(20), Z.prototype.info = se(30), Z.prototype.warn = se(40), Z.prototype.error = se(50), Z.prototype.fatal = se(60);
1552
- var Tr = { err: function(r) {
1553
- return r && r.stack ? { message: r.message, name: r.name, stack: an(r), code: r.code, signal: r.signal } : r;
1554
- } };
1555
- function on() {
1556
- return wr(Z, [].slice.call(arguments));
1557
- }
1558
- var yt = { levels: { trace: "color: DeepPink", debug: "color: GoldenRod", info: "color: DarkTurquoise", warn: "color: Purple", error: "color: Crimson", fatal: "color: Black" }, def: "color: DimGray", msg: "color: SteelBlue", src: "color: DimGray; font-style: italic; font-size: 0.9em" }, sn = /* @__PURE__ */ function() {
1559
- function r(e) {
1560
- var t = e === void 0 ? {} : e, n = t.logByLevel, a = t.css, i = a === void 0 ? yt : a;
1561
- this.logByLevel = n !== void 0 && n, this.css = i;
1562
- }
1563
- return r.prototype.write = function(e) {
1564
- var t, n, a = this.css.def, i = this.css.msg, s = this.css.src, l = e.childName ? e.name + "/" + e.childName : e.name, c = kr[e.level], d = (Array(6 - c.length).join(" ") + c).toUpperCase();
1565
- this.logByLevel ? (e.level === 10 ? c = "debug" : e.level === 60 && (c = "error"), n = typeof console[c] == "function" ? console[c] : console.log) : n = console.log, t = e.level < 20 ? this.css.levels.trace : e.level < 30 ? this.css.levels.debug : e.level < 40 ? this.css.levels.info : e.level < 50 ? this.css.levels.warn : e.level < 60 ? this.css.levels.error : this.css.levels.fatal;
1566
- var u = function(f, p) {
1567
- return Array(p + 1 - (f + "").length).join("0") + f;
1568
- }, o = [];
1569
- o.push("[%s:%s:%s:%s] %c%s%c: %s: %c%s " + (e.src ? "%c%s" : "")), o.push(u(e.time.getHours(), 2)), o.push(u(e.time.getMinutes(), 2)), o.push(u(e.time.getSeconds(), 2)), o.push(u(e.time.getMilliseconds(), 4)), o.push(t), o.push(d), o.push(a), o.push(l), o.push(i), o.push(e.msg), e.src && (o.push(s), o.push(e.src)), e.obj && (o.push(`
1570
- `), o.push(e.obj)), e.err && e.err.stack && (o.push(`
1571
- `), o.push(e.err.stack)), n.apply(console, o);
1572
- }, r.getDefaultCss = function() {
1573
- return yt;
1574
- }, r;
1575
- }(), ve = {}, Ua = {
1576
- get exports() {
1577
- return ve;
1578
- },
1579
- set exports(r) {
1580
- ve = r;
1581
- }
1582
- };
1583
- (function(r) {
1584
- (function(e) {
1585
- var t = function(h, g, A) {
1586
- if (!d(g) || o(g) || f(g) || p(g) || c(g))
1587
- return g;
1588
- var S, x = 0, G = 0;
1589
- if (u(g))
1590
- for (S = [], G = g.length; x < G; x++)
1591
- S.push(t(h, g[x], A));
1592
- else {
1593
- S = {};
1594
- for (var _ in g)
1595
- Object.prototype.hasOwnProperty.call(g, _) && (S[h(_, A)] = t(h, g[_], A));
1596
- }
1597
- return S;
1598
- }, n = function(h, g) {
1599
- g = g || {};
1600
- var A = g.separator || "_", S = g.split || /(?=[A-Z])/;
1601
- return h.split(S).join(A);
1602
- }, a = function(h) {
1603
- return y(h) ? h : (h = h.replace(/[\-_\s]+(.)?/g, function(g, A) {
1604
- return A ? A.toUpperCase() : "";
1605
- }), h.substr(0, 1).toLowerCase() + h.substr(1));
1606
- }, i = function(h) {
1607
- var g = a(h);
1608
- return g.substr(0, 1).toUpperCase() + g.substr(1);
1609
- }, s = function(h, g) {
1610
- return n(h, g).toLowerCase();
1611
- }, l = Object.prototype.toString, c = function(h) {
1612
- return typeof h == "function";
1613
- }, d = function(h) {
1614
- return h === Object(h);
1615
- }, u = function(h) {
1616
- return l.call(h) == "[object Array]";
1617
- }, o = function(h) {
1618
- return l.call(h) == "[object Date]";
1619
- }, f = function(h) {
1620
- return l.call(h) == "[object RegExp]";
1621
- }, p = function(h) {
1622
- return l.call(h) == "[object Boolean]";
1623
- }, y = function(h) {
1624
- return h = h - 0, h === h;
1625
- }, v = function(h, g) {
1626
- var A = g && "process" in g ? g.process : g;
1627
- return typeof A != "function" ? h : function(S, x) {
1628
- return A(S, h, x);
1629
- };
1630
- }, m = {
1631
- camelize: a,
1632
- decamelize: s,
1633
- pascalize: i,
1634
- depascalize: s,
1635
- camelizeKeys: function(h, g) {
1636
- return t(v(a, g), h);
1637
- },
1638
- decamelizeKeys: function(h, g) {
1639
- return t(v(s, g), h, g);
1640
- },
1641
- pascalizeKeys: function(h, g) {
1642
- return t(v(i, g), h);
1643
- },
1644
- depascalizeKeys: function() {
1645
- return this.decamelizeKeys.apply(this, arguments);
1646
- }
1647
- };
1648
- r.exports ? r.exports = m : e.humps = m;
1649
- })(Mt);
1650
- })(Ua);
1651
- var qa = function() {
1652
- if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function")
1653
- return !1;
1654
- if (typeof Symbol.iterator == "symbol")
1655
- return !0;
1656
- var e = {}, t = Symbol("test"), n = Object(t);
1657
- if (typeof t == "string" || Object.prototype.toString.call(t) !== "[object Symbol]" || Object.prototype.toString.call(n) !== "[object Symbol]")
1658
- return !1;
1659
- var a = 42;
1660
- e[t] = a;
1661
- for (t in e)
1662
- return !1;
1663
- if (typeof Object.keys == "function" && Object.keys(e).length !== 0 || typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(e).length !== 0)
1664
- return !1;
1665
- var i = Object.getOwnPropertySymbols(e);
1666
- if (i.length !== 1 || i[0] !== t || !Object.prototype.propertyIsEnumerable.call(e, t))
1667
- return !1;
1668
- if (typeof Object.getOwnPropertyDescriptor == "function") {
1669
- var s = Object.getOwnPropertyDescriptor(e, t);
1670
- if (s.value !== a || s.enumerable !== !0)
1671
- return !1;
1672
- }
1673
- return !0;
1674
- }, vt = typeof Symbol < "u" && Symbol, Ma = qa, za = function() {
1675
- return typeof vt != "function" || typeof Symbol != "function" || typeof vt("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? !1 : Ma();
1676
- }, ja = "Function.prototype.bind called on incompatible ", ar = Array.prototype.slice, Wa = Object.prototype.toString, Ga = "[object Function]", Ha = function(e) {
1677
- var t = this;
1678
- if (typeof t != "function" || Wa.call(t) !== Ga)
1679
- throw new TypeError(ja + t);
1680
- for (var n = ar.call(arguments, 1), a, i = function() {
1681
- if (this instanceof a) {
1682
- var u = t.apply(
1683
- this,
1684
- n.concat(ar.call(arguments))
1685
- );
1686
- return Object(u) === u ? u : this;
1687
- } else
1688
- return t.apply(
1689
- e,
1690
- n.concat(ar.call(arguments))
1691
- );
1692
- }, s = Math.max(0, t.length - n.length), l = [], c = 0; c < s; c++)
1693
- l.push("$" + c);
1694
- if (a = Function("binder", "return function (" + l.join(",") + "){ return binder.apply(this,arguments); }")(i), t.prototype) {
1695
- var d = function() {
1696
- };
1697
- d.prototype = t.prototype, a.prototype = new d(), d.prototype = null;
1698
- }
1699
- return a;
1700
- }, Ka = Ha, Br = Function.prototype.bind || Ka, Va = Br, Ja = Va.call(Function.call, Object.prototype.hasOwnProperty), w, fe = SyntaxError, un = Function, ce = TypeError, ir = function(r) {
1701
- try {
1702
- return un('"use strict"; return (' + r + ").constructor;")();
1703
- } catch {
318
+ function _(e) {
319
+ var r = e.stack || e.toString();
320
+ if (e.cause && typeof e.cause == "function") {
321
+ var t = e.cause();
322
+ t && (r += `
323
+ Caused by: ` + _(t));
1704
324
  }
1705
- }, te = Object.getOwnPropertyDescriptor;
1706
- if (te)
1707
- try {
1708
- te({}, "");
1709
- } catch {
1710
- te = null;
1711
- }
1712
- var or = function() {
1713
- throw new ce();
1714
- }, Qa = te ? function() {
1715
- try {
1716
- return arguments.callee, or;
1717
- } catch {
1718
- try {
1719
- return te(arguments, "callee").get;
1720
- } catch {
1721
- return or;
1722
- }
1723
- }
1724
- }() : or, ue = za(), M = Object.getPrototypeOf || function(r) {
1725
- return r.__proto__;
1726
- }, le = {}, Xa = typeof Uint8Array > "u" ? w : M(Uint8Array), ne = {
1727
- "%AggregateError%": typeof AggregateError > "u" ? w : AggregateError,
1728
- "%Array%": Array,
1729
- "%ArrayBuffer%": typeof ArrayBuffer > "u" ? w : ArrayBuffer,
1730
- "%ArrayIteratorPrototype%": ue ? M([][Symbol.iterator]()) : w,
1731
- "%AsyncFromSyncIteratorPrototype%": w,
1732
- "%AsyncFunction%": le,
1733
- "%AsyncGenerator%": le,
1734
- "%AsyncGeneratorFunction%": le,
1735
- "%AsyncIteratorPrototype%": le,
1736
- "%Atomics%": typeof Atomics > "u" ? w : Atomics,
1737
- "%BigInt%": typeof BigInt > "u" ? w : BigInt,
1738
- "%BigInt64Array%": typeof BigInt64Array > "u" ? w : BigInt64Array,
1739
- "%BigUint64Array%": typeof BigUint64Array > "u" ? w : BigUint64Array,
1740
- "%Boolean%": Boolean,
1741
- "%DataView%": typeof DataView > "u" ? w : DataView,
1742
- "%Date%": Date,
1743
- "%decodeURI%": decodeURI,
1744
- "%decodeURIComponent%": decodeURIComponent,
1745
- "%encodeURI%": encodeURI,
1746
- "%encodeURIComponent%": encodeURIComponent,
1747
- "%Error%": Error,
1748
- "%eval%": eval,
1749
- // eslint-disable-line no-eval
1750
- "%EvalError%": EvalError,
1751
- "%Float32Array%": typeof Float32Array > "u" ? w : Float32Array,
1752
- "%Float64Array%": typeof Float64Array > "u" ? w : Float64Array,
1753
- "%FinalizationRegistry%": typeof FinalizationRegistry > "u" ? w : FinalizationRegistry,
1754
- "%Function%": un,
1755
- "%GeneratorFunction%": le,
1756
- "%Int8Array%": typeof Int8Array > "u" ? w : Int8Array,
1757
- "%Int16Array%": typeof Int16Array > "u" ? w : Int16Array,
1758
- "%Int32Array%": typeof Int32Array > "u" ? w : Int32Array,
1759
- "%isFinite%": isFinite,
1760
- "%isNaN%": isNaN,
1761
- "%IteratorPrototype%": ue ? M(M([][Symbol.iterator]())) : w,
1762
- "%JSON%": typeof JSON == "object" ? JSON : w,
1763
- "%Map%": typeof Map > "u" ? w : Map,
1764
- "%MapIteratorPrototype%": typeof Map > "u" || !ue ? w : M((/* @__PURE__ */ new Map())[Symbol.iterator]()),
1765
- "%Math%": Math,
1766
- "%Number%": Number,
1767
- "%Object%": Object,
1768
- "%parseFloat%": parseFloat,
1769
- "%parseInt%": parseInt,
1770
- "%Promise%": typeof Promise > "u" ? w : Promise,
1771
- "%Proxy%": typeof Proxy > "u" ? w : Proxy,
1772
- "%RangeError%": RangeError,
1773
- "%ReferenceError%": ReferenceError,
1774
- "%Reflect%": typeof Reflect > "u" ? w : Reflect,
1775
- "%RegExp%": RegExp,
1776
- "%Set%": typeof Set > "u" ? w : Set,
1777
- "%SetIteratorPrototype%": typeof Set > "u" || !ue ? w : M((/* @__PURE__ */ new Set())[Symbol.iterator]()),
1778
- "%SharedArrayBuffer%": typeof SharedArrayBuffer > "u" ? w : SharedArrayBuffer,
1779
- "%String%": String,
1780
- "%StringIteratorPrototype%": ue ? M(""[Symbol.iterator]()) : w,
1781
- "%Symbol%": ue ? Symbol : w,
1782
- "%SyntaxError%": fe,
1783
- "%ThrowTypeError%": Qa,
1784
- "%TypedArray%": Xa,
1785
- "%TypeError%": ce,
1786
- "%Uint8Array%": typeof Uint8Array > "u" ? w : Uint8Array,
1787
- "%Uint8ClampedArray%": typeof Uint8ClampedArray > "u" ? w : Uint8ClampedArray,
1788
- "%Uint16Array%": typeof Uint16Array > "u" ? w : Uint16Array,
1789
- "%Uint32Array%": typeof Uint32Array > "u" ? w : Uint32Array,
1790
- "%URIError%": URIError,
1791
- "%WeakMap%": typeof WeakMap > "u" ? w : WeakMap,
1792
- "%WeakRef%": typeof WeakRef > "u" ? w : WeakRef,
1793
- "%WeakSet%": typeof WeakSet > "u" ? w : WeakSet
1794
- };
1795
- try {
1796
- null.error;
1797
- } catch (r) {
1798
- var Ya = M(M(r));
1799
- ne["%Error.prototype%"] = Ya;
1800
- }
1801
- var Za = function r(e) {
1802
- var t;
1803
- if (e === "%AsyncFunction%")
1804
- t = ir("async function () {}");
1805
- else if (e === "%GeneratorFunction%")
1806
- t = ir("function* () {}");
1807
- else if (e === "%AsyncGeneratorFunction%")
1808
- t = ir("async function* () {}");
1809
- else if (e === "%AsyncGenerator%") {
1810
- var n = r("%AsyncGeneratorFunction%");
1811
- n && (t = n.prototype);
1812
- } else if (e === "%AsyncIteratorPrototype%") {
1813
- var a = r("%AsyncGenerator%");
1814
- a && (t = M(a.prototype));
1815
- }
1816
- return ne[e] = t, t;
1817
- }, mt = {
1818
- "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
1819
- "%ArrayPrototype%": ["Array", "prototype"],
1820
- "%ArrayProto_entries%": ["Array", "prototype", "entries"],
1821
- "%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
1822
- "%ArrayProto_keys%": ["Array", "prototype", "keys"],
1823
- "%ArrayProto_values%": ["Array", "prototype", "values"],
1824
- "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
1825
- "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
1826
- "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
1827
- "%BooleanPrototype%": ["Boolean", "prototype"],
1828
- "%DataViewPrototype%": ["DataView", "prototype"],
1829
- "%DatePrototype%": ["Date", "prototype"],
1830
- "%ErrorPrototype%": ["Error", "prototype"],
1831
- "%EvalErrorPrototype%": ["EvalError", "prototype"],
1832
- "%Float32ArrayPrototype%": ["Float32Array", "prototype"],
1833
- "%Float64ArrayPrototype%": ["Float64Array", "prototype"],
1834
- "%FunctionPrototype%": ["Function", "prototype"],
1835
- "%Generator%": ["GeneratorFunction", "prototype"],
1836
- "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
1837
- "%Int8ArrayPrototype%": ["Int8Array", "prototype"],
1838
- "%Int16ArrayPrototype%": ["Int16Array", "prototype"],
1839
- "%Int32ArrayPrototype%": ["Int32Array", "prototype"],
1840
- "%JSONParse%": ["JSON", "parse"],
1841
- "%JSONStringify%": ["JSON", "stringify"],
1842
- "%MapPrototype%": ["Map", "prototype"],
1843
- "%NumberPrototype%": ["Number", "prototype"],
1844
- "%ObjectPrototype%": ["Object", "prototype"],
1845
- "%ObjProto_toString%": ["Object", "prototype", "toString"],
1846
- "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
1847
- "%PromisePrototype%": ["Promise", "prototype"],
1848
- "%PromiseProto_then%": ["Promise", "prototype", "then"],
1849
- "%Promise_all%": ["Promise", "all"],
1850
- "%Promise_reject%": ["Promise", "reject"],
1851
- "%Promise_resolve%": ["Promise", "resolve"],
1852
- "%RangeErrorPrototype%": ["RangeError", "prototype"],
1853
- "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
1854
- "%RegExpPrototype%": ["RegExp", "prototype"],
1855
- "%SetPrototype%": ["Set", "prototype"],
1856
- "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
1857
- "%StringPrototype%": ["String", "prototype"],
1858
- "%SymbolPrototype%": ["Symbol", "prototype"],
1859
- "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
1860
- "%TypedArrayPrototype%": ["TypedArray", "prototype"],
1861
- "%TypeErrorPrototype%": ["TypeError", "prototype"],
1862
- "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
1863
- "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
1864
- "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
1865
- "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
1866
- "%URIErrorPrototype%": ["URIError", "prototype"],
1867
- "%WeakMapPrototype%": ["WeakMap", "prototype"],
1868
- "%WeakSetPrototype%": ["WeakSet", "prototype"]
1869
- }, be = Br, Ne = Ja, ei = be.call(Function.call, Array.prototype.concat), ri = be.call(Function.apply, Array.prototype.splice), gt = be.call(Function.call, String.prototype.replace), $e = be.call(Function.call, String.prototype.slice), ti = be.call(Function.call, RegExp.prototype.exec), ni = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, ai = /\\(\\)?/g, ii = function(e) {
1870
- var t = $e(e, 0, 1), n = $e(e, -1);
1871
- if (t === "%" && n !== "%")
1872
- throw new fe("invalid intrinsic syntax, expected closing `%`");
1873
- if (n === "%" && t !== "%")
1874
- throw new fe("invalid intrinsic syntax, expected opening `%`");
1875
- var a = [];
1876
- return gt(e, ni, function(i, s, l, c) {
1877
- a[a.length] = l ? gt(c, ai, "$1") : s || i;
1878
- }), a;
1879
- }, oi = function(e, t) {
1880
- var n = e, a;
1881
- if (Ne(mt, n) && (a = mt[n], n = "%" + a[0] + "%"), Ne(ne, n)) {
1882
- var i = ne[n];
1883
- if (i === le && (i = Za(n)), typeof i > "u" && !t)
1884
- throw new ce("intrinsic " + e + " exists, but is not available. Please file an issue!");
1885
- return {
1886
- alias: a,
1887
- name: n,
1888
- value: i
1889
- };
1890
- }
1891
- throw new fe("intrinsic " + e + " does not exist!");
1892
- }, Lr = function(e, t) {
1893
- if (typeof e != "string" || e.length === 0)
1894
- throw new ce("intrinsic name must be a non-empty string");
1895
- if (arguments.length > 1 && typeof t != "boolean")
1896
- throw new ce('"allowMissing" argument must be a boolean');
1897
- if (ti(/^%?[^%]*%?$/, e) === null)
1898
- throw new fe("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
1899
- var n = ii(e), a = n.length > 0 ? n[0] : "", i = oi("%" + a + "%", t), s = i.name, l = i.value, c = !1, d = i.alias;
1900
- d && (a = d[0], ri(n, ei([0, 1], d)));
1901
- for (var u = 1, o = !0; u < n.length; u += 1) {
1902
- var f = n[u], p = $e(f, 0, 1), y = $e(f, -1);
1903
- if ((p === '"' || p === "'" || p === "`" || y === '"' || y === "'" || y === "`") && p !== y)
1904
- throw new fe("property names with quotes must have matching quotes");
1905
- if ((f === "constructor" || !o) && (c = !0), a += "." + f, s = "%" + a + "%", Ne(ne, s))
1906
- l = ne[s];
1907
- else if (l != null) {
1908
- if (!(f in l)) {
1909
- if (!t)
1910
- throw new ce("base intrinsic for " + e + " exists, but the property is not available.");
1911
- return;
1912
- }
1913
- if (te && u + 1 >= n.length) {
1914
- var v = te(l, f);
1915
- o = !!v, o && "get" in v && !("originalValue" in v.get) ? l = v.get : l = l[f];
1916
- } else
1917
- o = Ne(l, f), l = l[f];
1918
- o && !c && (ne[s] = l);
1919
- }
1920
- }
1921
- return l;
1922
- }, Or = {}, si = {
1923
- get exports() {
1924
- return Or;
1925
- },
1926
- set exports(r) {
1927
- Or = r;
1928
- }
1929
- };
1930
- (function(r) {
1931
- var e = Br, t = Lr, n = t("%Function.prototype.apply%"), a = t("%Function.prototype.call%"), i = t("%Reflect.apply%", !0) || e.call(a, n), s = t("%Object.getOwnPropertyDescriptor%", !0), l = t("%Object.defineProperty%", !0), c = t("%Math.max%");
1932
- if (l)
1933
- try {
1934
- l({}, "a", { value: 1 });
1935
- } catch {
1936
- l = null;
1937
- }
1938
- r.exports = function(o) {
1939
- var f = i(e, a, arguments);
1940
- if (s && l) {
1941
- var p = s(f, "length");
1942
- p.configurable && l(
1943
- f,
1944
- "length",
1945
- { value: 1 + c(0, o.length - (arguments.length - 1)) }
1946
- );
1947
- }
1948
- return f;
1949
- };
1950
- var d = function() {
1951
- return i(e, n, arguments);
1952
- };
1953
- l ? l(r.exports, "apply", { value: d }) : r.exports.apply = d;
1954
- })(si);
1955
- var ln = Lr, cn = Or, ui = cn(ln("String.prototype.indexOf")), li = function(e, t) {
1956
- var n = ln(e, !!t);
1957
- return typeof n == "function" && ui(e, ".prototype.") > -1 ? cn(n) : n;
1958
- };
1959
- const ci = {}, fi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1960
- __proto__: null,
1961
- default: ci
1962
- }, Symbol.toStringTag, { value: "Module" })), pi = /* @__PURE__ */ _n(fi);
1963
- var Ur = typeof Map == "function" && Map.prototype, sr = Object.getOwnPropertyDescriptor && Ur ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, _e = Ur && sr && typeof sr.get == "function" ? sr.get : null, St = Ur && Map.prototype.forEach, qr = typeof Set == "function" && Set.prototype, ur = Object.getOwnPropertyDescriptor && qr ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, De = qr && ur && typeof ur.get == "function" ? ur.get : null, wt = qr && Set.prototype.forEach, di = typeof WeakMap == "function" && WeakMap.prototype, me = di ? WeakMap.prototype.has : null, hi = typeof WeakSet == "function" && WeakSet.prototype, ge = hi ? WeakSet.prototype.has : null, yi = typeof WeakRef == "function" && WeakRef.prototype, bt = yi ? WeakRef.prototype.deref : null, vi = Boolean.prototype.valueOf, mi = Object.prototype.toString, gi = Function.prototype.toString, Si = String.prototype.match, Mr = String.prototype.slice, J = String.prototype.replace, wi = String.prototype.toUpperCase, Et = String.prototype.toLowerCase, fn = RegExp.prototype.test, At = Array.prototype.concat, z = Array.prototype.join, bi = Array.prototype.slice, Ot = Math.floor, Pr = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, lr = Object.getOwnPropertySymbols, Ir = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, pe = typeof Symbol == "function" && typeof Symbol.iterator == "object", N = typeof Symbol == "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === pe || "symbol") ? Symbol.toStringTag : null, pn = Object.prototype.propertyIsEnumerable, Pt = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(r) {
1964
- return r.__proto__;
1965
- } : null);
1966
- function It(r, e) {
1967
- if (r === 1 / 0 || r === -1 / 0 || r !== r || r && r > -1e3 && r < 1e3 || fn.call(/e/, e))
1968
- return e;
1969
- var t = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
1970
- if (typeof r == "number") {
1971
- var n = r < 0 ? -Ot(-r) : Ot(r);
1972
- if (n !== r) {
1973
- var a = String(n), i = Mr.call(e, a.length + 1);
1974
- return J.call(a, t, "$&_") + "." + J.call(J.call(i, /([0-9]{3})/g, "$&_"), /_$/, "");
1975
- }
1976
- }
1977
- return J.call(e, t, "$&_");
1978
- }
1979
- var Rr = pi, Rt = Rr.custom, xt = hn(Rt) ? Rt : null, Ei = function r(e, t, n, a) {
1980
- var i = t || {};
1981
- if (V(i, "quoteStyle") && i.quoteStyle !== "single" && i.quoteStyle !== "double")
1982
- throw new TypeError('option "quoteStyle" must be "single" or "double"');
1983
- if (V(i, "maxStringLength") && (typeof i.maxStringLength == "number" ? i.maxStringLength < 0 && i.maxStringLength !== 1 / 0 : i.maxStringLength !== null))
1984
- throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
1985
- var s = V(i, "customInspect") ? i.customInspect : !0;
1986
- if (typeof s != "boolean" && s !== "symbol")
1987
- throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
1988
- if (V(i, "indent") && i.indent !== null && i.indent !== " " && !(parseInt(i.indent, 10) === i.indent && i.indent > 0))
1989
- throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
1990
- if (V(i, "numericSeparator") && typeof i.numericSeparator != "boolean")
1991
- throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
1992
- var l = i.numericSeparator;
1993
- if (typeof e > "u")
1994
- return "undefined";
1995
- if (e === null)
1996
- return "null";
1997
- if (typeof e == "boolean")
1998
- return e ? "true" : "false";
1999
- if (typeof e == "string")
2000
- return vn(e, i);
2001
- if (typeof e == "number") {
2002
- if (e === 0)
2003
- return 1 / 0 / e > 0 ? "0" : "-0";
2004
- var c = String(e);
2005
- return l ? It(e, c) : c;
2006
- }
2007
- if (typeof e == "bigint") {
2008
- var d = String(e) + "n";
2009
- return l ? It(e, d) : d;
2010
- }
2011
- var u = typeof i.depth > "u" ? 5 : i.depth;
2012
- if (typeof n > "u" && (n = 0), n >= u && u > 0 && typeof e == "object")
2013
- return xr(e) ? "[Array]" : "[Object]";
2014
- var o = qi(i, n);
2015
- if (typeof a > "u")
2016
- a = [];
2017
- else if (yn(a, e) >= 0)
2018
- return "[Circular]";
2019
- function f(L, U, Ee) {
2020
- if (U && (a = bi.call(a), a.push(U)), Ee) {
2021
- var ae = {
2022
- depth: i.depth
2023
- };
2024
- return V(i, "quoteStyle") && (ae.quoteStyle = i.quoteStyle), r(L, ae, n + 1, a);
2025
- }
2026
- return r(L, i, n + 1, a);
2027
- }
2028
- if (typeof e == "function" && !Ct(e)) {
2029
- var p = Ni(e), y = Ae(e, f);
2030
- return "[Function" + (p ? ": " + p : " (anonymous)") + "]" + (y.length > 0 ? " { " + z.call(y, ", ") + " }" : "");
2031
- }
2032
- if (hn(e)) {
2033
- var v = pe ? J.call(String(e), /^(Symbol\(.*\))_[^)]*$/, "$1") : Ir.call(e);
2034
- return typeof e == "object" && !pe ? ye(v) : v;
2035
- }
2036
- if (Bi(e)) {
2037
- for (var m = "<" + Et.call(String(e.nodeName)), h = e.attributes || [], g = 0; g < h.length; g++)
2038
- m += " " + h[g].name + "=" + dn(Ai(h[g].value), "double", i);
2039
- return m += ">", e.childNodes && e.childNodes.length && (m += "..."), m += "</" + Et.call(String(e.nodeName)) + ">", m;
2040
- }
2041
- if (xr(e)) {
2042
- if (e.length === 0)
2043
- return "[]";
2044
- var A = Ae(e, f);
2045
- return o && !Ui(A) ? "[" + Cr(A, o) + "]" : "[ " + z.call(A, ", ") + " ]";
2046
- }
2047
- if (Pi(e)) {
2048
- var S = Ae(e, f);
2049
- return !("cause" in Error.prototype) && "cause" in e && !pn.call(e, "cause") ? "{ [" + String(e) + "] " + z.call(At.call("[cause]: " + f(e.cause), S), ", ") + " }" : S.length === 0 ? "[" + String(e) + "]" : "{ [" + String(e) + "] " + z.call(S, ", ") + " }";
2050
- }
2051
- if (typeof e == "object" && s) {
2052
- if (xt && typeof e[xt] == "function" && Rr)
2053
- return Rr(e, { depth: u - n });
2054
- if (s !== "symbol" && typeof e.inspect == "function")
2055
- return e.inspect();
2056
- }
2057
- if ($i(e)) {
2058
- var x = [];
2059
- return St && St.call(e, function(L, U) {
2060
- x.push(f(U, e, !0) + " => " + f(L, e));
2061
- }), Ft("Map", _e.call(e), x, o);
2062
- }
2063
- if (ki(e)) {
2064
- var G = [];
2065
- return wt && wt.call(e, function(L) {
2066
- G.push(f(L, e));
2067
- }), Ft("Set", De.call(e), G, o);
2068
- }
2069
- if (_i(e))
2070
- return cr("WeakMap");
2071
- if (Ti(e))
2072
- return cr("WeakSet");
2073
- if (Di(e))
2074
- return cr("WeakRef");
2075
- if (Ri(e))
2076
- return ye(f(Number(e)));
2077
- if (Ci(e))
2078
- return ye(f(Pr.call(e)));
2079
- if (xi(e))
2080
- return ye(vi.call(e));
2081
- if (Ii(e))
2082
- return ye(f(String(e)));
2083
- if (!Oi(e) && !Ct(e)) {
2084
- var _ = Ae(e, f), B = Pt ? Pt(e) === Object.prototype : e instanceof Object || e.constructor === Object, H = e instanceof Object ? "" : "null prototype", P = !B && N && Object(e) === e && N in e ? Mr.call(X(e), 8, -1) : H ? "Object" : "", T = B || typeof e.constructor != "function" ? "" : e.constructor.name ? e.constructor.name + " " : "", O = T + (P || H ? "[" + z.call(At.call([], P || [], H || []), ": ") + "] " : "");
2085
- return _.length === 0 ? O + "{}" : o ? O + "{" + Cr(_, o) + "}" : O + "{ " + z.call(_, ", ") + " }";
2086
- }
2087
- return String(e);
2088
- };
2089
- function dn(r, e, t) {
2090
- var n = (t.quoteStyle || e) === "double" ? '"' : "'";
2091
- return n + r + n;
2092
- }
2093
- function Ai(r) {
2094
- return J.call(String(r), /"/g, "&quot;");
2095
- }
2096
- function xr(r) {
2097
- return X(r) === "[object Array]" && (!N || !(typeof r == "object" && N in r));
2098
- }
2099
- function Oi(r) {
2100
- return X(r) === "[object Date]" && (!N || !(typeof r == "object" && N in r));
2101
- }
2102
- function Ct(r) {
2103
- return X(r) === "[object RegExp]" && (!N || !(typeof r == "object" && N in r));
2104
- }
2105
- function Pi(r) {
2106
- return X(r) === "[object Error]" && (!N || !(typeof r == "object" && N in r));
2107
- }
2108
- function Ii(r) {
2109
- return X(r) === "[object String]" && (!N || !(typeof r == "object" && N in r));
2110
- }
2111
- function Ri(r) {
2112
- return X(r) === "[object Number]" && (!N || !(typeof r == "object" && N in r));
2113
- }
2114
- function xi(r) {
2115
- return X(r) === "[object Boolean]" && (!N || !(typeof r == "object" && N in r));
2116
- }
2117
- function hn(r) {
2118
- if (pe)
2119
- return r && typeof r == "object" && r instanceof Symbol;
2120
- if (typeof r == "symbol")
2121
- return !0;
2122
- if (!r || typeof r != "object" || !Ir)
2123
- return !1;
2124
- try {
2125
- return Ir.call(r), !0;
2126
- } catch {
2127
- }
2128
- return !1;
2129
- }
2130
- function Ci(r) {
2131
- if (!r || typeof r != "object" || !Pr)
2132
- return !1;
2133
- try {
2134
- return Pr.call(r), !0;
2135
- } catch {
2136
- }
2137
- return !1;
2138
- }
2139
- var Fi = Object.prototype.hasOwnProperty || function(r) {
2140
- return r in this;
2141
- };
2142
- function V(r, e) {
2143
- return Fi.call(r, e);
2144
- }
2145
- function X(r) {
2146
- return mi.call(r);
2147
- }
2148
- function Ni(r) {
2149
- if (r.name)
2150
- return r.name;
2151
- var e = Si.call(gi.call(r), /^function\s*([\w$]+)/);
2152
- return e ? e[1] : null;
2153
- }
2154
- function yn(r, e) {
2155
- if (r.indexOf)
2156
- return r.indexOf(e);
2157
- for (var t = 0, n = r.length; t < n; t++)
2158
- if (r[t] === e)
2159
- return t;
2160
- return -1;
2161
- }
2162
- function $i(r) {
2163
- if (!_e || !r || typeof r != "object")
2164
- return !1;
2165
- try {
2166
- _e.call(r);
2167
- try {
2168
- De.call(r);
2169
- } catch {
2170
- return !0;
2171
- }
2172
- return r instanceof Map;
2173
- } catch {
2174
- }
2175
- return !1;
2176
- }
2177
- function _i(r) {
2178
- if (!me || !r || typeof r != "object")
2179
- return !1;
2180
- try {
2181
- me.call(r, me);
2182
- try {
2183
- ge.call(r, ge);
2184
- } catch {
2185
- return !0;
2186
- }
2187
- return r instanceof WeakMap;
2188
- } catch {
2189
- }
2190
- return !1;
2191
- }
2192
- function Di(r) {
2193
- if (!bt || !r || typeof r != "object")
2194
- return !1;
2195
- try {
2196
- return bt.call(r), !0;
2197
- } catch {
2198
- }
2199
- return !1;
2200
- }
2201
- function ki(r) {
2202
- if (!De || !r || typeof r != "object")
2203
- return !1;
2204
- try {
2205
- De.call(r);
2206
- try {
2207
- _e.call(r);
2208
- } catch {
2209
- return !0;
2210
- }
2211
- return r instanceof Set;
2212
- } catch {
2213
- }
2214
- return !1;
2215
- }
2216
- function Ti(r) {
2217
- if (!ge || !r || typeof r != "object")
2218
- return !1;
2219
- try {
2220
- ge.call(r, ge);
2221
- try {
2222
- me.call(r, me);
2223
- } catch {
2224
- return !0;
2225
- }
2226
- return r instanceof WeakSet;
2227
- } catch {
2228
- }
2229
- return !1;
2230
- }
2231
- function Bi(r) {
2232
- return !r || typeof r != "object" ? !1 : typeof HTMLElement < "u" && r instanceof HTMLElement ? !0 : typeof r.nodeName == "string" && typeof r.getAttribute == "function";
2233
- }
2234
- function vn(r, e) {
2235
- if (r.length > e.maxStringLength) {
2236
- var t = r.length - e.maxStringLength, n = "... " + t + " more character" + (t > 1 ? "s" : "");
2237
- return vn(Mr.call(r, 0, e.maxStringLength), e) + n;
2238
- }
2239
- var a = J.call(J.call(r, /(['\\])/g, "\\$1"), /[\x00-\x1f]/g, Li);
2240
- return dn(a, "single", e);
2241
- }
2242
- function Li(r) {
2243
- var e = r.charCodeAt(0), t = {
2244
- 8: "b",
2245
- 9: "t",
2246
- 10: "n",
2247
- 12: "f",
2248
- 13: "r"
2249
- }[e];
2250
- return t ? "\\" + t : "\\x" + (e < 16 ? "0" : "") + wi.call(e.toString(16));
2251
- }
2252
- function ye(r) {
2253
- return "Object(" + r + ")";
2254
- }
2255
- function cr(r) {
2256
- return r + " { ? }";
2257
- }
2258
- function Ft(r, e, t, n) {
2259
- var a = n ? Cr(t, n) : z.call(t, ", ");
2260
- return r + " (" + e + ") {" + a + "}";
2261
- }
2262
- function Ui(r) {
2263
- for (var e = 0; e < r.length; e++)
2264
- if (yn(r[e], `
2265
- `) >= 0)
2266
- return !1;
2267
- return !0;
2268
- }
2269
- function qi(r, e) {
2270
- var t;
2271
- if (r.indent === " ")
2272
- t = " ";
2273
- else if (typeof r.indent == "number" && r.indent > 0)
2274
- t = z.call(Array(r.indent + 1), " ");
2275
- else
2276
- return null;
2277
- return {
2278
- base: t,
2279
- prev: z.call(Array(e + 1), t)
2280
- };
2281
- }
2282
- function Cr(r, e) {
2283
- if (r.length === 0)
2284
- return "";
2285
- var t = `
2286
- ` + e.prev + e.base;
2287
- return t + z.call(r, "," + t) + `
2288
- ` + e.prev;
2289
- }
2290
- function Ae(r, e) {
2291
- var t = xr(r), n = [];
2292
- if (t) {
2293
- n.length = r.length;
2294
- for (var a = 0; a < r.length; a++)
2295
- n[a] = V(r, a) ? e(r[a], r) : "";
2296
- }
2297
- var i = typeof lr == "function" ? lr(r) : [], s;
2298
- if (pe) {
2299
- s = {};
2300
- for (var l = 0; l < i.length; l++)
2301
- s["$" + i[l]] = i[l];
2302
- }
2303
- for (var c in r)
2304
- V(r, c) && (t && String(Number(c)) === c && c < r.length || pe && s["$" + c] instanceof Symbol || (fn.call(/[^\w$]/, c) ? n.push(e(c, r) + ": " + e(r[c], r)) : n.push(c + ": " + e(r[c], r))));
2305
- if (typeof lr == "function")
2306
- for (var d = 0; d < i.length; d++)
2307
- pn.call(r, i[d]) && n.push("[" + e(i[d]) + "]: " + e(r[i[d]], r));
2308
- return n;
2309
- }
2310
- var zr = Lr, he = li, Mi = Ei, zi = zr("%TypeError%"), Oe = zr("%WeakMap%", !0), Pe = zr("%Map%", !0), ji = he("WeakMap.prototype.get", !0), Wi = he("WeakMap.prototype.set", !0), Gi = he("WeakMap.prototype.has", !0), Hi = he("Map.prototype.get", !0), Ki = he("Map.prototype.set", !0), Vi = he("Map.prototype.has", !0), jr = function(r, e) {
2311
- for (var t = r, n; (n = t.next) !== null; t = n)
2312
- if (n.key === e)
2313
- return t.next = n.next, n.next = r.next, r.next = n, n;
2314
- }, Ji = function(r, e) {
2315
- var t = jr(r, e);
2316
- return t && t.value;
2317
- }, Qi = function(r, e, t) {
2318
- var n = jr(r, e);
2319
- n ? n.value = t : r.next = {
2320
- // eslint-disable-line no-param-reassign
2321
- key: e,
2322
- next: r.next,
2323
- value: t
2324
- };
2325
- }, Xi = function(r, e) {
2326
- return !!jr(r, e);
2327
- }, Yi = function() {
2328
- var e, t, n, a = {
2329
- assert: function(i) {
2330
- if (!a.has(i))
2331
- throw new zi("Side channel does not contain " + Mi(i));
2332
- },
2333
- get: function(i) {
2334
- if (Oe && i && (typeof i == "object" || typeof i == "function")) {
2335
- if (e)
2336
- return ji(e, i);
2337
- } else if (Pe) {
2338
- if (t)
2339
- return Hi(t, i);
2340
- } else if (n)
2341
- return Ji(n, i);
2342
- },
2343
- has: function(i) {
2344
- if (Oe && i && (typeof i == "object" || typeof i == "function")) {
2345
- if (e)
2346
- return Gi(e, i);
2347
- } else if (Pe) {
2348
- if (t)
2349
- return Vi(t, i);
2350
- } else if (n)
2351
- return Xi(n, i);
2352
- return !1;
2353
- },
2354
- set: function(i, s) {
2355
- Oe && i && (typeof i == "object" || typeof i == "function") ? (e || (e = new Oe()), Wi(e, i, s)) : Pe ? (t || (t = new Pe()), Ki(t, i, s)) : (n || (n = { key: {}, next: null }), Qi(n, i, s));
2356
- }
2357
- };
2358
- return a;
2359
- }, Zi = String.prototype.replace, eo = /%20/g, fr = {
2360
- RFC1738: "RFC1738",
2361
- RFC3986: "RFC3986"
2362
- }, Wr = {
2363
- default: fr.RFC3986,
2364
- formatters: {
2365
- RFC1738: function(r) {
2366
- return Zi.call(r, eo, "+");
2367
- },
2368
- RFC3986: function(r) {
2369
- return String(r);
2370
- }
2371
- },
2372
- RFC1738: fr.RFC1738,
2373
- RFC3986: fr.RFC3986
2374
- }, ro = Wr, pr = Object.prototype.hasOwnProperty, re = Array.isArray, q = function() {
2375
- for (var r = [], e = 0; e < 256; ++e)
2376
- r.push("%" + ((e < 16 ? "0" : "") + e.toString(16)).toUpperCase());
2377
325
  return r;
2378
- }(), to = function(e) {
2379
- for (; e.length > 1; ) {
2380
- var t = e.pop(), n = t.obj[t.prop];
2381
- if (re(n)) {
2382
- for (var a = [], i = 0; i < n.length; ++i)
2383
- typeof n[i] < "u" && a.push(n[i]);
2384
- t.obj[t.prop] = a;
2385
- }
2386
- }
2387
- }, mn = function(e, t) {
2388
- for (var n = t && t.plainObjects ? /* @__PURE__ */ Object.create(null) : {}, a = 0; a < e.length; ++a)
2389
- typeof e[a] < "u" && (n[a] = e[a]);
2390
- return n;
2391
- }, no = function r(e, t, n) {
2392
- if (!t)
2393
- return e;
2394
- if (typeof t != "object") {
2395
- if (re(e))
2396
- e.push(t);
2397
- else if (e && typeof e == "object")
2398
- (n && (n.plainObjects || n.allowPrototypes) || !pr.call(Object.prototype, t)) && (e[t] = !0);
2399
- else
2400
- return [e, t];
2401
- return e;
2402
- }
2403
- if (!e || typeof e != "object")
2404
- return [e].concat(t);
2405
- var a = e;
2406
- return re(e) && !re(t) && (a = mn(e, n)), re(e) && re(t) ? (t.forEach(function(i, s) {
2407
- if (pr.call(e, s)) {
2408
- var l = e[s];
2409
- l && typeof l == "object" && i && typeof i == "object" ? e[s] = r(l, i, n) : e.push(i);
2410
- } else
2411
- e[s] = i;
2412
- }), e) : Object.keys(t).reduce(function(i, s) {
2413
- var l = t[s];
2414
- return pr.call(i, s) ? i[s] = r(i[s], l, n) : i[s] = l, i;
2415
- }, a);
2416
- }, ao = function(e, t) {
2417
- return Object.keys(t).reduce(function(n, a) {
2418
- return n[a] = t[a], n;
2419
- }, e);
2420
- }, io = function(r, e, t) {
2421
- var n = r.replace(/\+/g, " ");
2422
- if (t === "iso-8859-1")
2423
- return n.replace(/%[0-9a-f]{2}/gi, unescape);
2424
- try {
2425
- return decodeURIComponent(n);
2426
- } catch {
2427
- return n;
2428
- }
2429
- }, oo = function(e, t, n, a, i) {
2430
- if (e.length === 0)
2431
- return e;
2432
- var s = e;
2433
- if (typeof e == "symbol" ? s = Symbol.prototype.toString.call(e) : typeof e != "string" && (s = String(e)), n === "iso-8859-1")
2434
- return escape(s).replace(/%u[0-9a-f]{4}/gi, function(u) {
2435
- return "%26%23" + parseInt(u.slice(2), 16) + "%3B";
2436
- });
2437
- for (var l = "", c = 0; c < s.length; ++c) {
2438
- var d = s.charCodeAt(c);
2439
- if (d === 45 || d === 46 || d === 95 || d === 126 || d >= 48 && d <= 57 || d >= 65 && d <= 90 || d >= 97 && d <= 122 || i === ro.RFC1738 && (d === 40 || d === 41)) {
2440
- l += s.charAt(c);
2441
- continue;
2442
- }
2443
- if (d < 128) {
2444
- l = l + q[d];
2445
- continue;
2446
- }
2447
- if (d < 2048) {
2448
- l = l + (q[192 | d >> 6] + q[128 | d & 63]);
2449
- continue;
2450
- }
2451
- if (d < 55296 || d >= 57344) {
2452
- l = l + (q[224 | d >> 12] + q[128 | d >> 6 & 63] + q[128 | d & 63]);
2453
- continue;
2454
- }
2455
- c += 1, d = 65536 + ((d & 1023) << 10 | s.charCodeAt(c) & 1023), l += q[240 | d >> 18] + q[128 | d >> 12 & 63] + q[128 | d >> 6 & 63] + q[128 | d & 63];
2456
- }
2457
- return l;
2458
- }, so = function(e) {
2459
- for (var t = [{ obj: { o: e }, prop: "o" }], n = [], a = 0; a < t.length; ++a)
2460
- for (var i = t[a], s = i.obj[i.prop], l = Object.keys(s), c = 0; c < l.length; ++c) {
2461
- var d = l[c], u = s[d];
2462
- typeof u == "object" && u !== null && n.indexOf(u) === -1 && (t.push({ obj: s, prop: d }), n.push(u));
2463
- }
2464
- return to(t), e;
2465
- }, uo = function(e) {
2466
- return Object.prototype.toString.call(e) === "[object RegExp]";
2467
- }, lo = function(e) {
2468
- return !e || typeof e != "object" ? !1 : !!(e.constructor && e.constructor.isBuffer && e.constructor.isBuffer(e));
2469
- }, co = function(e, t) {
2470
- return [].concat(e, t);
2471
- }, fo = function(e, t) {
2472
- if (re(e)) {
2473
- for (var n = [], a = 0; a < e.length; a += 1)
2474
- n.push(t(e[a]));
2475
- return n;
2476
- }
2477
- return t(e);
2478
- }, gn = {
2479
- arrayToObject: mn,
2480
- assign: ao,
2481
- combine: co,
2482
- compact: so,
2483
- decode: io,
2484
- encode: oo,
2485
- isBuffer: lo,
2486
- isRegExp: uo,
2487
- maybeMap: fo,
2488
- merge: no
2489
- }, Sn = Yi, xe = gn, Se = Wr, po = Object.prototype.hasOwnProperty, Nt = {
2490
- brackets: function(e) {
2491
- return e + "[]";
2492
- },
2493
- comma: "comma",
2494
- indices: function(e, t) {
2495
- return e + "[" + t + "]";
2496
- },
2497
- repeat: function(e) {
2498
- return e;
2499
- }
2500
- }, K = Array.isArray, ho = Array.prototype.push, wn = function(r, e) {
2501
- ho.apply(r, K(e) ? e : [e]);
2502
- }, yo = Date.prototype.toISOString, $t = Se.default, F = {
2503
- addQueryPrefix: !1,
2504
- allowDots: !1,
2505
- charset: "utf-8",
2506
- charsetSentinel: !1,
2507
- delimiter: "&",
2508
- encode: !0,
2509
- encoder: xe.encode,
2510
- encodeValuesOnly: !1,
2511
- format: $t,
2512
- formatter: Se.formatters[$t],
2513
- // deprecated
2514
- indices: !1,
2515
- serializeDate: function(e) {
2516
- return yo.call(e);
2517
- },
2518
- skipNulls: !1,
2519
- strictNullHandling: !1
2520
- }, vo = function(e) {
2521
- return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "symbol" || typeof e == "bigint";
2522
- }, dr = {}, mo = function r(e, t, n, a, i, s, l, c, d, u, o, f, p, y, v, m) {
2523
- for (var h = e, g = m, A = 0, S = !1; (g = g.get(dr)) !== void 0 && !S; ) {
2524
- var x = g.get(e);
2525
- if (A += 1, typeof x < "u") {
2526
- if (x === A)
2527
- throw new RangeError("Cyclic object value");
2528
- S = !0;
2529
- }
2530
- typeof g.get(dr) > "u" && (A = 0);
2531
- }
2532
- if (typeof c == "function" ? h = c(t, h) : h instanceof Date ? h = o(h) : n === "comma" && K(h) && (h = xe.maybeMap(h, function(ae) {
2533
- return ae instanceof Date ? o(ae) : ae;
2534
- })), h === null) {
2535
- if (i)
2536
- return l && !y ? l(t, F.encoder, v, "key", f) : t;
2537
- h = "";
2538
- }
2539
- if (vo(h) || xe.isBuffer(h)) {
2540
- if (l) {
2541
- var G = y ? t : l(t, F.encoder, v, "key", f);
2542
- return [p(G) + "=" + p(l(h, F.encoder, v, "value", f))];
2543
- }
2544
- return [p(t) + "=" + p(String(h))];
2545
- }
2546
- var _ = [];
2547
- if (typeof h > "u")
2548
- return _;
2549
- var B;
2550
- if (n === "comma" && K(h))
2551
- y && l && (h = xe.maybeMap(h, l)), B = [{ value: h.length > 0 ? h.join(",") || null : void 0 }];
2552
- else if (K(c))
2553
- B = c;
2554
- else {
2555
- var H = Object.keys(h);
2556
- B = d ? H.sort(d) : H;
2557
- }
2558
- for (var P = a && K(h) && h.length === 1 ? t + "[]" : t, T = 0; T < B.length; ++T) {
2559
- var O = B[T], L = typeof O == "object" && typeof O.value < "u" ? O.value : h[O];
2560
- if (!(s && L === null)) {
2561
- var U = K(h) ? typeof n == "function" ? n(P, O) : P : P + (u ? "." + O : "[" + O + "]");
2562
- m.set(e, A);
2563
- var Ee = Sn();
2564
- Ee.set(dr, m), wn(_, r(
2565
- L,
2566
- U,
2567
- n,
2568
- a,
2569
- i,
2570
- s,
2571
- n === "comma" && y && K(h) ? null : l,
2572
- c,
2573
- d,
2574
- u,
2575
- o,
2576
- f,
2577
- p,
2578
- y,
2579
- v,
2580
- Ee
2581
- ));
2582
- }
2583
- }
2584
- return _;
2585
- }, go = function(e) {
2586
- if (!e)
2587
- return F;
2588
- if (e.encoder !== null && typeof e.encoder < "u" && typeof e.encoder != "function")
2589
- throw new TypeError("Encoder has to be a function.");
2590
- var t = e.charset || F.charset;
2591
- if (typeof e.charset < "u" && e.charset !== "utf-8" && e.charset !== "iso-8859-1")
2592
- throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
2593
- var n = Se.default;
2594
- if (typeof e.format < "u") {
2595
- if (!po.call(Se.formatters, e.format))
2596
- throw new TypeError("Unknown format option provided.");
2597
- n = e.format;
2598
- }
2599
- var a = Se.formatters[n], i = F.filter;
2600
- return (typeof e.filter == "function" || K(e.filter)) && (i = e.filter), {
2601
- addQueryPrefix: typeof e.addQueryPrefix == "boolean" ? e.addQueryPrefix : F.addQueryPrefix,
2602
- allowDots: typeof e.allowDots > "u" ? F.allowDots : !!e.allowDots,
2603
- charset: t,
2604
- charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel : F.charsetSentinel,
2605
- delimiter: typeof e.delimiter > "u" ? F.delimiter : e.delimiter,
2606
- encode: typeof e.encode == "boolean" ? e.encode : F.encode,
2607
- encoder: typeof e.encoder == "function" ? e.encoder : F.encoder,
2608
- encodeValuesOnly: typeof e.encodeValuesOnly == "boolean" ? e.encodeValuesOnly : F.encodeValuesOnly,
2609
- filter: i,
2610
- format: n,
2611
- formatter: a,
2612
- serializeDate: typeof e.serializeDate == "function" ? e.serializeDate : F.serializeDate,
2613
- skipNulls: typeof e.skipNulls == "boolean" ? e.skipNulls : F.skipNulls,
2614
- sort: typeof e.sort == "function" ? e.sort : null,
2615
- strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling : F.strictNullHandling
2616
- };
2617
- }, So = function(r, e) {
2618
- var t = r, n = go(e), a, i;
2619
- typeof n.filter == "function" ? (i = n.filter, t = i("", t)) : K(n.filter) && (i = n.filter, a = i);
2620
- var s = [];
2621
- if (typeof t != "object" || t === null)
2622
- return "";
2623
- var l;
2624
- e && e.arrayFormat in Nt ? l = e.arrayFormat : e && "indices" in e ? l = e.indices ? "indices" : "repeat" : l = "indices";
2625
- var c = Nt[l];
2626
- if (e && "commaRoundTrip" in e && typeof e.commaRoundTrip != "boolean")
2627
- throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
2628
- var d = c === "comma" && e && e.commaRoundTrip;
2629
- a || (a = Object.keys(t)), n.sort && a.sort(n.sort);
2630
- for (var u = Sn(), o = 0; o < a.length; ++o) {
2631
- var f = a[o];
2632
- n.skipNulls && t[f] === null || wn(s, mo(
2633
- t[f],
2634
- f,
2635
- c,
2636
- d,
2637
- n.strictNullHandling,
2638
- n.skipNulls,
2639
- n.encode ? n.encoder : null,
2640
- n.filter,
2641
- n.sort,
2642
- n.allowDots,
2643
- n.serializeDate,
2644
- n.format,
2645
- n.formatter,
2646
- n.encodeValuesOnly,
2647
- n.charset,
2648
- u
2649
- ));
2650
- }
2651
- var p = s.join(n.delimiter), y = n.addQueryPrefix === !0 ? "?" : "";
2652
- return n.charsetSentinel && (n.charset === "iso-8859-1" ? y += "utf8=%26%2310003%3B&" : y += "utf8=%E2%9C%93&"), p.length > 0 ? y + p : "";
2653
- }, de = gn, Fr = Object.prototype.hasOwnProperty, wo = Array.isArray, I = {
2654
- allowDots: !1,
2655
- allowPrototypes: !1,
2656
- allowSparse: !1,
2657
- arrayLimit: 20,
2658
- charset: "utf-8",
2659
- charsetSentinel: !1,
2660
- comma: !1,
2661
- decoder: de.decode,
2662
- delimiter: "&",
2663
- depth: 5,
2664
- ignoreQueryPrefix: !1,
2665
- interpretNumericEntities: !1,
2666
- parameterLimit: 1e3,
2667
- parseArrays: !0,
2668
- plainObjects: !1,
2669
- strictNullHandling: !1
2670
- }, bo = function(r) {
2671
- return r.replace(/&#(\d+);/g, function(e, t) {
2672
- return String.fromCharCode(parseInt(t, 10));
2673
- });
2674
- }, bn = function(r, e) {
2675
- return r && typeof r == "string" && e.comma && r.indexOf(",") > -1 ? r.split(",") : r;
2676
- }, Eo = "utf8=%26%2310003%3B", Ao = "utf8=%E2%9C%93", Oo = function(e, t) {
2677
- var n = {}, a = t.ignoreQueryPrefix ? e.replace(/^\?/, "") : e, i = t.parameterLimit === 1 / 0 ? void 0 : t.parameterLimit, s = a.split(t.delimiter, i), l = -1, c, d = t.charset;
2678
- if (t.charsetSentinel)
2679
- for (c = 0; c < s.length; ++c)
2680
- s[c].indexOf("utf8=") === 0 && (s[c] === Ao ? d = "utf-8" : s[c] === Eo && (d = "iso-8859-1"), l = c, c = s.length);
2681
- for (c = 0; c < s.length; ++c)
2682
- if (c !== l) {
2683
- var u = s[c], o = u.indexOf("]="), f = o === -1 ? u.indexOf("=") : o + 1, p, y;
2684
- f === -1 ? (p = t.decoder(u, I.decoder, d, "key"), y = t.strictNullHandling ? null : "") : (p = t.decoder(u.slice(0, f), I.decoder, d, "key"), y = de.maybeMap(
2685
- bn(u.slice(f + 1), t),
2686
- function(v) {
2687
- return t.decoder(v, I.decoder, d, "value");
2688
- }
2689
- )), y && t.interpretNumericEntities && d === "iso-8859-1" && (y = bo(y)), u.indexOf("[]=") > -1 && (y = wo(y) ? [y] : y), Fr.call(n, p) ? n[p] = de.combine(n[p], y) : n[p] = y;
2690
- }
2691
- return n;
2692
- }, Po = function(r, e, t, n) {
2693
- for (var a = n ? e : bn(e, t), i = r.length - 1; i >= 0; --i) {
2694
- var s, l = r[i];
2695
- if (l === "[]" && t.parseArrays)
2696
- s = [].concat(a);
2697
- else {
2698
- s = t.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
2699
- var c = l.charAt(0) === "[" && l.charAt(l.length - 1) === "]" ? l.slice(1, -1) : l, d = parseInt(c, 10);
2700
- !t.parseArrays && c === "" ? s = { 0: a } : !isNaN(d) && l !== c && String(d) === c && d >= 0 && t.parseArrays && d <= t.arrayLimit ? (s = [], s[d] = a) : c !== "__proto__" && (s[c] = a);
2701
- }
2702
- a = s;
2703
- }
2704
- return a;
2705
- }, Io = function(e, t, n, a) {
2706
- if (e) {
2707
- var i = n.allowDots ? e.replace(/\.([^.[]+)/g, "[$1]") : e, s = /(\[[^[\]]*])/, l = /(\[[^[\]]*])/g, c = n.depth > 0 && s.exec(i), d = c ? i.slice(0, c.index) : i, u = [];
2708
- if (d) {
2709
- if (!n.plainObjects && Fr.call(Object.prototype, d) && !n.allowPrototypes)
2710
- return;
2711
- u.push(d);
2712
- }
2713
- for (var o = 0; n.depth > 0 && (c = l.exec(i)) !== null && o < n.depth; ) {
2714
- if (o += 1, !n.plainObjects && Fr.call(Object.prototype, c[1].slice(1, -1)) && !n.allowPrototypes)
2715
- return;
2716
- u.push(c[1]);
2717
- }
2718
- return c && u.push("[" + i.slice(c.index) + "]"), Po(u, t, n, a);
2719
- }
2720
- }, Ro = function(e) {
2721
- if (!e)
2722
- return I;
2723
- if (e.decoder !== null && e.decoder !== void 0 && typeof e.decoder != "function")
2724
- throw new TypeError("Decoder has to be a function.");
2725
- if (typeof e.charset < "u" && e.charset !== "utf-8" && e.charset !== "iso-8859-1")
2726
- throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
2727
- var t = typeof e.charset > "u" ? I.charset : e.charset;
2728
- return {
2729
- allowDots: typeof e.allowDots > "u" ? I.allowDots : !!e.allowDots,
2730
- allowPrototypes: typeof e.allowPrototypes == "boolean" ? e.allowPrototypes : I.allowPrototypes,
2731
- allowSparse: typeof e.allowSparse == "boolean" ? e.allowSparse : I.allowSparse,
2732
- arrayLimit: typeof e.arrayLimit == "number" ? e.arrayLimit : I.arrayLimit,
2733
- charset: t,
2734
- charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel : I.charsetSentinel,
2735
- comma: typeof e.comma == "boolean" ? e.comma : I.comma,
2736
- decoder: typeof e.decoder == "function" ? e.decoder : I.decoder,
2737
- delimiter: typeof e.delimiter == "string" || de.isRegExp(e.delimiter) ? e.delimiter : I.delimiter,
2738
- // eslint-disable-next-line no-implicit-coercion, no-extra-parens
2739
- depth: typeof e.depth == "number" || e.depth === !1 ? +e.depth : I.depth,
2740
- ignoreQueryPrefix: e.ignoreQueryPrefix === !0,
2741
- interpretNumericEntities: typeof e.interpretNumericEntities == "boolean" ? e.interpretNumericEntities : I.interpretNumericEntities,
2742
- parameterLimit: typeof e.parameterLimit == "number" ? e.parameterLimit : I.parameterLimit,
2743
- parseArrays: e.parseArrays !== !1,
2744
- plainObjects: typeof e.plainObjects == "boolean" ? e.plainObjects : I.plainObjects,
2745
- strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling : I.strictNullHandling
2746
- };
2747
- }, xo = function(r, e) {
2748
- var t = Ro(e);
2749
- if (r === "" || r === null || typeof r > "u")
2750
- return t.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
2751
- for (var n = typeof r == "string" ? Oo(r, t) : r, a = t.plainObjects ? /* @__PURE__ */ Object.create(null) : {}, i = Object.keys(n), s = 0; s < i.length; ++s) {
2752
- var l = i[s], c = Io(l, n[l], t, typeof r == "string");
2753
- a = de.merge(a, c, t);
2754
- }
2755
- return t.allowSparse === !0 ? a : de.compact(a);
2756
- }, Co = So, Fo = xo, No = Wr, $o = {
2757
- formats: No,
2758
- parse: Fo,
2759
- stringify: Co
2760
- };
2761
- class _o {
2762
- constructor(e) {
2763
- this.client = e, this.list = () => this.client.get("/v1/packages"), this.client = e;
2764
- }
2765
- }
2766
- class Do {
2767
- constructor(e) {
2768
- this.client = e, this.get = (t) => this.client.get(`/v1/insurance/${t}/balance`), this.client = e;
2769
- }
2770
- }
2771
- class ko {
2772
- constructor(e) {
2773
- this.client = e, this.get = (t) => this.client.get(`/v1/labels/${t}`), this.list = (t = {}) => this.client.get("/v1/labels", { params: t }), this.createByRateId = (t, n) => this.client.post(`/v1/labels/rates/${t}`, n), this.void = (t) => this.client.put(`/v1/labels/${t}/void`), this.client = e;
2774
- }
2775
- }
2776
- class To {
2777
- constructor(e) {
2778
- this.client = e, this.list = () => this.client.get("/v-beta/order_sources"), this.get = (t) => this.client.get(`/v-beta/order_sources/${t}`), this.refresh = (t) => this.client.put(`/v-beta/order_sources/${t}/refresh`), this.client = e;
2779
- }
2780
- }
2781
- class Bo {
2782
- constructor(e) {
2783
- this.client = e, this.calculateByShipmentId = (t, n) => this.client.post("/v1/rates", {
2784
- rateOptions: n,
2785
- shipmentId: t
2786
- }), this.client = e;
2787
- }
2788
- }
2789
- class Lo {
2790
- constructor(e) {
2791
- this.client = e, this.list = (t = {}) => this.client.post("/v-beta/shipments/list", t), this.get = (t) => this.client.get(`/v-beta/shipments/${t}`), this.create = (t, n) => this.client.post(
2792
- `/v-beta/shipments/sales_order/${t}`,
2793
- n
2794
- ), this.update = (t, n) => this.client.put(`/v-beta/shipments/${t}`, n), this.client = e;
2795
- }
2796
326
  }
2797
- class Uo {
2798
- constructor(e) {
2799
- this.client = e, this.list = (t = {}) => this.client.get("/v-beta/sales_orders", { params: t }), this.get = (t) => this.client.get(`/v-beta/sales_orders/${t}`), this.notifyShipped = (t, n) => this.client.post(`/v-beta/sales_orders/${t}/notify`, n), this.client = e;
2800
- }
2801
- }
2802
- class qo {
2803
- constructor(e) {
2804
- this.client = e, this.list = () => this.client.get("/v1/warehouses"), this.create = (t) => this.client.post("/v1/warehouses", t), this.update = (t, n) => this.client.put(`/v1/warehouses/${t}`, n), this.delete = (t) => this.client.delete(`/v1/warehouses/${t}`), this.client = e;
2805
- }
2806
- }
2807
- const _t = on({
2808
- name: "shipengine-api",
2809
- serializers: {
2810
- ...Tr,
2811
- req: (r) => ({
2812
- headers: r.headers,
2813
- method: r.method,
2814
- url: r.url
2815
- }),
2816
- res: (r) => ({
2817
- data: r.data,
2818
- headers: r.config.headers,
2819
- method: r.config.method,
2820
- statusCode: r.status,
2821
- url: r.config.url
2822
- })
2823
- },
2824
- streams: [
2825
- {
2826
- stream: new sn()
2827
- }
2828
- ]
2829
- }), Mo = (r) => !!r.errors && tn(r.errors);
2830
- class Dt {
2831
- constructor(e, { baseURL: t, headers: n, getToken: a }) {
2832
- const i = mr.create({
2833
- baseURL: t,
2834
- headers: {
2835
- ...n,
2836
- Authorization: `Bearer ${e}`,
2837
- "Content-Type": "application/json"
2838
- },
2839
- paramsSerializer: (s) => $o.stringify(ve.decamelizeKeys(s), { arrayFormat: "brackets" }),
2840
- transformRequest: [(s) => ve.decamelizeKeys(s), (s) => JSON.stringify(s)],
2841
- transformResponse: [
2842
- (s) => {
2843
- if (s)
2844
- return JSON.parse(s);
2845
- },
2846
- (s) => ve.camelizeKeys(s)
2847
- ]
2848
- });
2849
- i.interceptors.response.use(
2850
- (s) => (_t.info(
2851
- { req: s.config, res: s },
2852
- "%s %s: %s %s",
2853
- s.config.method?.toUpperCase(),
2854
- s.config.url,
2855
- s.status,
2856
- s.statusText
2857
- ), s),
2858
- async (s) => {
2859
- if (_t.error(
2860
- { err: s, req: s.config, res: s.response },
2861
- "%s %s: %s %s - %s",
2862
- s.config?.method?.toUpperCase(),
2863
- s.config?.url,
2864
- s.response?.status,
2865
- s.response?.statusText,
2866
- s.message
2867
- ), s.response?.status === 401) {
2868
- const l = await a(), c = s.config;
2869
- return c && (c.headers ||= {}, c.headers.Authorization = `Bearer ${l}`), mr(c);
2870
- }
2871
- return s.response?.data ? Mo(s.response.data) ? Promise.reject(
2872
- s.response.data.errors.map((l) => j.fromObject(l))
2873
- ) : tn(s.response.data) ? Promise.reject(s.response.data.map((l) => j.fromObject(l))) : nn(s.response.data) ? Promise.reject([j.fromObject(s.response.data)]) : Promise.reject([new j(s.response.data)]) : Promise.reject([new j(s.message)]);
2874
- }
2875
- ), this.client = i;
2876
- }
2877
- set token(e) {
2878
- this.client.defaults.headers.common.Authorization = `Bearer ${e}`;
2879
- }
2880
- get accountSettings() {
2881
- return new Fn(this.client);
2882
- }
2883
- get addresses() {
2884
- return new Nn(this.client);
2885
- }
2886
- get carriers() {
2887
- return new _a(this.client);
2888
- }
2889
- get customPackages() {
2890
- return new _o(this.client);
2891
- }
2892
- get insurance() {
2893
- return new Do(this.client);
2894
- }
2895
- get labels() {
2896
- return new ko(this.client);
2897
- }
2898
- get orderSources() {
2899
- return new To(this.client);
2900
- }
2901
- get rates() {
2902
- return new Bo(this.client);
2903
- }
2904
- get salesOrderShipments() {
2905
- return new Lo(this.client);
2906
- }
2907
- get salesOrders() {
2908
- return new Uo(this.client);
2909
- }
2910
- get warehouses() {
2911
- return new qo(this.client);
2912
- }
2913
- }
2914
- const En = Rn(void 0), Jo = ({ baseURL: r, children: e, headers: t, getToken: n }) => {
2915
- const [a, i] = xn(() => {
2916
- const l = n();
2917
- if (typeof l == "string")
2918
- return new Dt(l, {
2919
- baseURL: r,
2920
- getToken: n,
2921
- headers: t ?? {}
2922
- });
2923
- l.then(
2924
- (c) => i(
2925
- new Dt(c, {
2926
- baseURL: r,
2927
- getToken: n,
2928
- headers: t ?? {}
2929
- })
2930
- )
2931
- );
2932
- }), s = new On();
2933
- return a ? /* @__PURE__ */ Ue(En.Provider, { value: { client: a }, children: /* @__PURE__ */ Ue(Pn, { client: s, children: e }) }) : /* @__PURE__ */ Ue(
2934
- "div",
2935
- {
2936
- style: {
2937
- alignItems: "center",
2938
- display: "flex",
2939
- height: "100%",
2940
- justifyContent: "center",
2941
- width: "100%"
2942
- },
2943
- children: "Loading..."
2944
- }
2945
- );
2946
- }, E = () => {
2947
- const r = Cn(En);
2948
- if (!r)
2949
- throw new Error("useShipEngine must be called within a ShipEngineProvider");
2950
- return r;
2951
- }, zo = (r) => new Promise((e) => {
2952
- setTimeout(() => e(!0), r);
2953
- }), b = (r) => r.forEach(console.log), An = [];
2954
- process.env.NODE_ENV === "production" && An.push({
2955
- stream: new sn()
327
+ v.prototype.trace = S(10), v.prototype.debug = S(20), v.prototype.info = S(30), v.prototype.warn = S(40), v.prototype.error = S(50), v.prototype.fatal = S(60);
328
+ var P = { err: function(e) {
329
+ return e && e.stack ? { message: e.message, name: e.name, stack: _(e), code: e.code, signal: e.signal } : e;
330
+ } };
331
+ function $() {
332
+ return q(v, [].slice.call(arguments));
333
+ }
334
+ var L = { levels: { trace: "color: DeepPink", debug: "color: GoldenRod", info: "color: DarkTurquoise", warn: "color: Purple", error: "color: Crimson", fatal: "color: Black" }, def: "color: DimGray", msg: "color: SteelBlue", src: "color: DimGray; font-style: italic; font-size: 0.9em" }, I = /* @__PURE__ */ function() {
335
+ function e(r) {
336
+ var t = r === void 0 ? {} : r, s = t.logByLevel, i = t.css, n = i === void 0 ? L : i;
337
+ this.logByLevel = s !== void 0 && s, this.css = n;
338
+ }
339
+ return e.prototype.write = function(r) {
340
+ var t, s, i = this.css.def, n = this.css.msg, a = this.css.src, d = r.childName ? r.name + "/" + r.childName : r.name, o = z[r.level], f = (Array(6 - o.length).join(" ") + o).toUpperCase();
341
+ this.logByLevel ? (r.level === 10 ? o = "debug" : r.level === 60 && (o = "error"), s = typeof console[o] == "function" ? console[o] : console.log) : s = console.log, t = r.level < 20 ? this.css.levels.trace : r.level < 30 ? this.css.levels.debug : r.level < 40 ? this.css.levels.info : r.level < 50 ? this.css.levels.warn : r.level < 60 ? this.css.levels.error : this.css.levels.fatal;
342
+ var m = function(b, w) {
343
+ return Array(w + 1 - (b + "").length).join("0") + b;
344
+ }, l = [];
345
+ l.push("[%s:%s:%s:%s] %c%s%c: %s: %c%s " + (r.src ? "%c%s" : "")), l.push(m(r.time.getHours(), 2)), l.push(m(r.time.getMinutes(), 2)), l.push(m(r.time.getSeconds(), 2)), l.push(m(r.time.getMilliseconds(), 4)), l.push(t), l.push(f), l.push(i), l.push(d), l.push(n), l.push(r.msg), r.src && (l.push(a), l.push(r.src)), r.obj && (l.push(`
346
+ `), l.push(r.obj)), r.err && r.err.stack && (l.push(`
347
+ `), l.push(r.err.stack)), s.apply(console, l);
348
+ }, e.getDefaultCss = function() {
349
+ return L;
350
+ }, e;
351
+ }();
352
+ const G = [];
353
+ process.env.NODE_ENV === "production" && G.push({
354
+ stream: new I()
2956
355
  });
2957
- const Qo = on({
356
+ const ie = $({
2958
357
  name: "shipengine",
2959
358
  serializers: {
2960
- ...Tr,
2961
- req: (r) => ({
2962
- headers: r.headers,
2963
- method: r.method,
2964
- url: r.url
359
+ ...P,
360
+ req: (e) => ({
361
+ headers: e.headers,
362
+ method: e.method,
363
+ url: e.url
2965
364
  }),
2966
- res: (r) => ({
2967
- data: r.data,
2968
- headers: r.config.headers,
2969
- method: r.config.method,
2970
- statusCode: r.status,
2971
- url: r.config.url
365
+ res: (e) => ({
366
+ data: e.data,
367
+ headers: e.config.headers,
368
+ method: e.config.method,
369
+ statusCode: e.status,
370
+ url: e.config.url
2972
371
  })
2973
372
  },
2974
- streams: An
2975
- }), jo = (r, e = 10, t = 1e3) => Promise.resolve().then(r).catch(function n(a) {
2976
- if (e -= 1, e > 0)
2977
- return zo(t).then(r).catch(n);
2978
- throw a;
2979
- }), Xo = (r) => {
2980
- const { client: e } = E();
2981
- return R({
2982
- mutationFn: async (t) => (await e.carriers.addFunds(r, t)).data,
373
+ streams: G
374
+ }), X = (e, r = 10, t = 1e3) => Promise.resolve().then(e).catch(function s(i) {
375
+ if (r -= 1, r > 0)
376
+ return V(t).then(e).catch(s);
377
+ throw i;
378
+ }), ae = (e) => {
379
+ const { client: r } = c();
380
+ return h({
381
+ mutationFn: async (t) => (await r.carriers.addFunds(e, t)).data,
2983
382
  mutationKey: ["useAddFunds"],
2984
- onError: b
383
+ onError: u
2985
384
  });
2986
- }, Yo = () => {
2987
- const { client: r } = E();
2988
- return R({
2989
- mutationFn: async ({ rateOptions: e, shipmentId: t }) => (await r.rates.calculateByShipmentId(t, e)).data,
385
+ }, oe = () => {
386
+ const { client: e } = c();
387
+ return h({
388
+ mutationFn: async ({ rateOptions: r, shipmentId: t }) => (await e.rates.calculateByShipmentId(t, r)).data,
2990
389
  mutationKey: ["useCalculateRates"],
2991
- onError: b
390
+ onError: u
2992
391
  });
2993
- }, Zo = () => {
2994
- const { client: r } = E();
2995
- return R({
2996
- mutationFn: async (e) => (await r.carriers.connect(e)).data,
392
+ }, ue = () => {
393
+ const { client: e } = c();
394
+ return h({
395
+ mutationFn: async (r) => (await e.carriers.connect(r)).data,
2997
396
  mutationKey: ["useConnectCarrier"],
2998
- onError: b
397
+ onError: u
2999
398
  });
3000
- }, es = () => {
3001
- const { client: r } = E();
3002
- return R({
3003
- mutationFn: async ({ rateId: e, ...t }) => (await r.labels.createByRateId(e, t)).data,
399
+ }, le = () => {
400
+ const { client: e } = c();
401
+ return h({
402
+ mutationFn: async ({ rateId: r, ...t }) => (await e.labels.createByRateId(r, t)).data,
3004
403
  mutationKey: ["useCreateLabel"],
3005
- onError: b
404
+ onError: u
3006
405
  });
3007
- }, rs = () => {
3008
- const { client: r } = E();
3009
- return R({
3010
- mutationFn: async ({ salesOrderId: e, ...t }) => (await r.salesOrderShipments.create(e, t)).data,
406
+ }, ce = () => {
407
+ const { client: e } = c();
408
+ return h({
409
+ mutationFn: async ({ salesOrderId: r, ...t }) => (await e.salesOrderShipments.create(r, t)).data,
3011
410
  mutationKey: ["useCreateSalesOrderShipment"],
3012
- onError: b
411
+ onError: u
3013
412
  });
3014
- }, ts = () => {
3015
- const { client: r } = E();
3016
- return R({
3017
- mutationFn: async (e) => (await r.warehouses.create(e)).data,
413
+ }, de = () => {
414
+ const { client: e } = c();
415
+ return h({
416
+ mutationFn: async (r) => (await e.warehouses.create(r)).data,
3018
417
  mutationKey: ["useCreateWarehouse"],
3019
- onError: b
418
+ onError: u
3020
419
  });
3021
- }, ns = () => {
3022
- const { client: r } = E();
3023
- return R({
3024
- mutationFn: async ({ warehouseId: e }) => (await r.warehouses.delete(e)).data,
420
+ }, fe = () => {
421
+ const { client: e } = c();
422
+ return h({
423
+ mutationFn: async ({ warehouseId: r }) => (await e.warehouses.delete(r)).data,
3025
424
  mutationKey: ["useDeleteWarehouse"],
3026
- onError: b
425
+ onError: u
3027
426
  });
3028
- }, as = () => {
3029
- const { client: r } = E();
3030
- return $({
3031
- onError: b,
3032
- queryFn: () => r.accountSettings.get(),
427
+ }, he = () => {
428
+ const { client: e } = c();
429
+ return y({
430
+ onError: u,
431
+ queryFn: () => e.accountSettings.get(),
3033
432
  queryKey: ["getAccountSettings"],
3034
- select: (e) => e.data
3035
- });
3036
- }, is = (r) => {
3037
- const { client: e } = E();
3038
- return $({
3039
- enabled: r !== void 0,
3040
- onError: b,
3041
- queryFn: () => r ? e.carriers.getAutoFunding(r) : Promise.reject(new Error("carrierId is required.")),
3042
- queryKey: ["useGetAutoFundingConfiguration", r],
433
+ select: (r) => r.data
434
+ });
435
+ }, ye = (e) => {
436
+ const { client: r } = c();
437
+ return y({
438
+ enabled: e !== void 0,
439
+ onError: u,
440
+ queryFn: () => e ? r.carriers.getAutoFunding(e) : Promise.reject(new Error("carrierId is required.")),
441
+ queryKey: ["useGetAutoFundingConfiguration", e],
3043
442
  select: (t) => t.data
3044
443
  });
3045
- }, os = (r) => {
3046
- const { client: e } = E();
3047
- return $({
3048
- enabled: !!r,
3049
- onError: b,
3050
- queryFn: () => r ? e.carriers.get(r) : Promise.reject(new Error("carrierId is require")),
3051
- queryKey: ["useGetCarrierById", r],
444
+ }, me = (e) => {
445
+ const { client: r } = c();
446
+ return y({
447
+ enabled: !!e,
448
+ onError: u,
449
+ queryFn: () => e ? r.carriers.get(e) : Promise.reject(new Error("carrierId is require")),
450
+ queryKey: ["useGetCarrierById", e],
3052
451
  select: (t) => t.data,
3053
452
  // Fresh for 5 minutes
3054
453
  staleTime: 5 * 60 * 1e3
3055
454
  });
3056
- }, ss = (r) => {
3057
- const { client: e } = E();
3058
- return $({
3059
- enabled: r !== void 0,
3060
- onError: b,
3061
- queryFn: () => r ? e.insurance.get(r) : Promise.reject(new Error("insuranceProvider is required")),
3062
- queryKey: ["useGetInsuranceAccount", r],
455
+ }, pe = (e) => {
456
+ const { client: r } = c();
457
+ return y({
458
+ enabled: e !== void 0,
459
+ onError: u,
460
+ queryFn: () => e ? r.insurance.get(e) : Promise.reject(new Error("insuranceProvider is required")),
461
+ queryKey: ["useGetInsuranceAccount", e],
3063
462
  select: (t) => t.data
3064
463
  });
3065
- }, us = (r) => {
3066
- const { client: e } = E();
3067
- return $({
3068
- enabled: r !== void 0,
3069
- onError: b,
3070
- queryFn: () => r ? e.labels.get(r) : Promise.reject(new Error("labelId is require")),
3071
- queryKey: ["useGetLabel", r],
464
+ }, ve = (e) => {
465
+ const { client: r } = c();
466
+ return y({
467
+ enabled: e !== void 0,
468
+ onError: u,
469
+ queryFn: () => e ? r.labels.get(e) : Promise.reject(new Error("labelId is require")),
470
+ queryKey: ["useGetLabel", e],
3072
471
  select: (t) => t.data
3073
472
  });
3074
- }, ls = (r) => {
3075
- const { client: e } = E();
3076
- return $({
3077
- enabled: r !== void 0,
3078
- onError: b,
3079
- queryFn: () => r ? e.salesOrders.get(r) : Promise.reject(new Error("salesOrderId is required")),
3080
- queryKey: ["useGetSalesOrder", r],
473
+ }, ge = (e) => {
474
+ const { client: r } = c();
475
+ return y({
476
+ enabled: e !== void 0,
477
+ onError: u,
478
+ queryFn: () => e ? r.salesOrders.get(e) : Promise.reject(new Error("salesOrderId is required")),
479
+ queryKey: ["useGetSalesOrder", e],
3081
480
  select: (t) => t.data
3082
481
  });
3083
- }, cs = (r) => {
3084
- const { client: e } = E();
3085
- return $({
3086
- enabled: r !== void 0,
3087
- onError: b,
3088
- queryFn: () => r ? e.salesOrderShipments.get(r) : Promise.reject(new Error("shipmentId is required")),
3089
- queryKey: ["useGetSalesOrderShipment", r],
482
+ }, we = (e) => {
483
+ const { client: r } = c();
484
+ return y({
485
+ enabled: e !== void 0,
486
+ onError: u,
487
+ queryFn: () => e ? r.salesOrderShipments.get(e) : Promise.reject(new Error("shipmentId is required")),
488
+ queryKey: ["useGetSalesOrderShipment", e],
3090
489
  select: (t) => t.data
3091
490
  });
3092
- }, fs = (r) => {
3093
- const { client: e } = E();
3094
- return $({
3095
- enabled: r !== void 0,
3096
- onError: b,
3097
- queryFn: () => r ? e.salesOrderShipments.get(r) : Promise.reject(new Error("shipmentId is required")),
3098
- queryKey: ["useGetShipment", r],
491
+ }, Se = (e) => {
492
+ const { client: r } = c();
493
+ return y({
494
+ enabled: e !== void 0,
495
+ onError: u,
496
+ queryFn: () => e ? r.salesOrderShipments.get(e) : Promise.reject(new Error("shipmentId is required")),
497
+ queryKey: ["useGetShipment", e],
3099
498
  select: (t) => t.data
3100
499
  });
3101
- }, ps = ({
3102
- enabled: r,
3103
- page: e,
500
+ }, be = ({
501
+ enabled: e,
502
+ page: r,
3104
503
  range: t
3105
504
  }) => {
3106
- const { client: n } = E(), [a, i] = t;
3107
- return $({
3108
- enabled: r,
505
+ const { client: s } = c(), [i, n] = t;
506
+ return y({
507
+ enabled: e,
3109
508
  keepPreviousData: !0,
3110
509
  // See https://react-query-v3.tanstack.com/guides/paginated-queries#better-paginated-queries-with-keeppreviousdata
3111
- onError: b,
3112
- queryFn: () => n.carriers.getWalletHistory(a, i, e),
3113
- queryKey: ["useGetWalletHistory", a, i, e],
3114
- select: (s) => s.data
3115
- });
3116
- }, ds = () => {
3117
- const { client: r } = E();
3118
- return $({
3119
- onError: b,
3120
- queryFn: () => r.carriers.list(),
510
+ onError: u,
511
+ queryFn: () => s.carriers.getWalletHistory(i, n, r),
512
+ queryKey: ["useGetWalletHistory", i, n, r],
513
+ select: (a) => a.data
514
+ });
515
+ }, Oe = () => {
516
+ const { client: e } = c();
517
+ return y({
518
+ onError: u,
519
+ queryFn: () => e.carriers.list(),
3121
520
  queryKey: ["useListCarriers"],
3122
- select: (e) => e.data.carriers
521
+ select: (r) => r.data.carriers
3123
522
  });
3124
- }, hs = () => {
3125
- const { client: r } = E();
3126
- return $({
3127
- onError: b,
3128
- queryFn: () => r.customPackages.list(),
523
+ }, Ee = () => {
524
+ const { client: e } = c();
525
+ return y({
526
+ onError: u,
527
+ queryFn: () => e.customPackages.list(),
3129
528
  queryKey: ["useListCustomPackageTypes"],
3130
- select: (e) => e.data.packages
3131
- });
3132
- }, ys = (r) => {
3133
- const { client: e } = E();
3134
- return $({
3135
- enabled: r && Object.values(r).some((t) => t !== void 0),
3136
- onError: b,
3137
- queryFn: () => e.labels.list(r),
3138
- queryKey: ["useListLabels", r],
529
+ select: (r) => r.data.packages
530
+ });
531
+ }, Fe = (e) => {
532
+ const { client: r } = c();
533
+ return y({
534
+ enabled: e && Object.values(e).some((t) => t !== void 0),
535
+ onError: u,
536
+ queryFn: () => r.labels.list(e),
537
+ queryKey: ["useListLabels", e],
3139
538
  select: (t) => t.data.labels
3140
539
  });
3141
- }, vs = () => {
3142
- const { client: r } = E();
3143
- return $({
3144
- onError: b,
3145
- queryFn: () => r.orderSources.list(),
540
+ }, je = () => {
541
+ const { client: e } = c();
542
+ return y({
543
+ onError: u,
544
+ queryFn: () => e.orderSources.list(),
3146
545
  queryKey: ["useListOrderSources"],
3147
- select: (e) => e.data.orderSources
3148
- });
3149
- }, ms = (r) => {
3150
- const { client: e } = E();
3151
- return $({
3152
- enabled: r && Object.values(r).some((t) => t !== void 0),
3153
- onError: b,
3154
- queryFn: () => e.salesOrderShipments.list(r),
3155
- queryKey: ["useListSalesOrderShipments", r],
546
+ select: (r) => r.data.orderSources
547
+ });
548
+ }, qe = (e) => {
549
+ const { client: r } = c();
550
+ return y({
551
+ enabled: e && Object.values(e).some((t) => t !== void 0),
552
+ onError: u,
553
+ queryFn: () => r.salesOrderShipments.list(e),
554
+ queryKey: ["useListSalesOrderShipments", e],
3156
555
  select: (t) => t.data.shipments
3157
556
  });
3158
- }, gs = (r = {}) => {
3159
- const { client: e } = E();
3160
- return $({
3161
- enabled: r && Object.values(r).some((t) => t !== void 0),
3162
- onError: b,
3163
- queryFn: () => e.salesOrders.list(r),
3164
- queryKey: ["useListSalesOrders", r],
557
+ }, Ae = (e = {}) => {
558
+ const { client: r } = c();
559
+ return y({
560
+ enabled: e && Object.values(e).some((t) => t !== void 0),
561
+ onError: u,
562
+ queryFn: () => r.salesOrders.list(e),
563
+ queryKey: ["useListSalesOrders", e],
3165
564
  select: (t) => t.data.salesOrders
3166
565
  });
3167
- }, Ss = () => {
3168
- const { client: r } = E();
3169
- return $({
3170
- onError: b,
3171
- queryFn: () => r.warehouses.list(),
566
+ }, Ce = () => {
567
+ const { client: e } = c();
568
+ return y({
569
+ onError: u,
570
+ queryFn: () => e.warehouses.list(),
3172
571
  queryKey: ["useListWarehouses"],
3173
- select: (e) => e.data.warehouses
572
+ select: (r) => r.data.warehouses
3174
573
  });
3175
- }, ws = () => {
3176
- const { client: r } = E();
3177
- return R({
3178
- mutationFn: async ({ salesOrderId: e, ...t }) => (await r.salesOrders.notifyShipped(e, t)).data,
574
+ }, ke = () => {
575
+ const { client: e } = c();
576
+ return h({
577
+ mutationFn: async ({ salesOrderId: r, ...t }) => (await e.salesOrders.notifyShipped(r, t)).data,
3179
578
  mutationKey: ["useNotifySalesOrder"],
3180
- onError: b
579
+ onError: u
3181
580
  });
3182
- }, bs = () => {
3183
- const { client: r } = E();
3184
- return R({
3185
- mutationFn: async ({ address: e, text: t }) => (await r.addresses.parse(t, e)).data,
581
+ }, ze = () => {
582
+ const { client: e } = c();
583
+ return h({
584
+ mutationFn: async ({ address: r, text: t }) => (await e.addresses.parse(t, r)).data,
3186
585
  mutationKey: ["useParseAddress"],
3187
- onError: b
586
+ onError: u
3188
587
  });
3189
- }, Wo = () => {
3190
- const { client: r } = E();
3191
- return R({
3192
- mutationFn: async (e) => (await r.orderSources.refresh(e)).data,
588
+ }, Z = () => {
589
+ const { client: e } = c();
590
+ return h({
591
+ mutationFn: async (r) => (await e.orderSources.refresh(r)).data,
3193
592
  mutationKey: ["useRefreshOrderSourceAsync"]
3194
593
  });
3195
- }, Es = () => {
3196
- const { client: r } = E(), { mutateAsync: e } = Wo();
3197
- return R({
3198
- mutationFn: async (t) => (await e(t), await jo(async () => {
3199
- const { data: a } = await r.orderSources.get(t);
3200
- if (["preparing_update", "updating"].includes(a.refreshInfo.status))
3201
- throw new j("Order source is still refreshing");
3202
- return a;
594
+ }, Ke = () => {
595
+ const { client: e } = c(), { mutateAsync: r } = Z();
596
+ return h({
597
+ mutationFn: async (t) => (await r(t), await X(async () => {
598
+ const { data: i } = await e.orderSources.get(t);
599
+ if (["preparing_update", "updating"].includes(i.refreshInfo.status))
600
+ throw new W.CodedError("Order source is still refreshing");
601
+ return i;
3203
602
  }, 20)),
3204
603
  mutationKey: ["useRefreshOrderSource"],
3205
- onError: b
604
+ onError: u
3206
605
  });
3207
- }, As = () => R({
3208
- mutationFn: async (r) => (await Promise.resolve({
606
+ }, Le = () => h({
607
+ mutationFn: async (e) => (await Promise.resolve({
3209
608
  data: { defaultLabelLayout: "4x6", dimension: "inch", weight: "ounce" },
3210
609
  errors: [],
3211
610
  isLoading: !1,
3212
611
  isValidating: !1
3213
612
  })).data,
3214
613
  mutationKey: ["useUpdateAccountSettings"],
3215
- onError: b
3216
- }), Os = (r) => {
3217
- const { client: e } = E(), t = In();
3218
- return R({
3219
- mutationFn: async (n) => (await e.carriers.updateAutoFunding(r, n)).data,
614
+ onError: u
615
+ }), Re = (e) => {
616
+ const { client: r } = c(), t = B();
617
+ return h({
618
+ mutationFn: async (s) => (await r.carriers.updateAutoFunding(e, s)).data,
3220
619
  mutationKey: ["useUpdateAutoFunding"],
3221
- onError: b,
3222
- onSuccess: (n) => {
3223
- t.invalidateQueries(["useGetAutoFunding", r], { exact: !0 });
620
+ onError: u,
621
+ onSuccess: (s) => {
622
+ t.invalidateQueries(["useGetAutoFunding", e], { exact: !0 });
3224
623
  }
3225
624
  });
3226
- }, Ps = () => R({
3227
- mutationFn: async (r) => (await Promise.resolve({
625
+ }, _e = () => h({
626
+ mutationFn: async (e) => (await Promise.resolve({
3228
627
  data: {},
3229
628
  errors: [],
3230
629
  isLoading: !1,
3231
630
  isValidating: !1
3232
631
  })).data,
3233
632
  mutationKey: ["useUpdateBilling"],
3234
- onError: b
3235
- }), Is = () => {
3236
- const { client: r } = E();
3237
- return R({
3238
- mutationFn: async ({ shipmentId: e, ...t }) => (await r.salesOrderShipments.update(e, t)).data,
633
+ onError: u
634
+ }), Pe = () => {
635
+ const { client: e } = c();
636
+ return h({
637
+ mutationFn: async ({ shipmentId: r, ...t }) => (await e.salesOrderShipments.update(r, t)).data,
3239
638
  mutationKey: ["useUpdateSalesOrderShipment"],
3240
- onError: b
639
+ onError: u
3241
640
  });
3242
- }, Rs = () => {
3243
- const { client: r } = E();
3244
- return R({
3245
- mutationFn: async ({ warehouseId: e, ...t }) => (await r.warehouses.update(e, t)).data,
641
+ }, Ge = () => {
642
+ const { client: e } = c();
643
+ return h({
644
+ mutationFn: async ({ warehouseId: r, ...t }) => (await e.warehouses.update(r, t)).data,
3246
645
  mutationKey: ["useUpdateWarehouse"],
3247
- onError: b
646
+ onError: u
3248
647
  });
3249
- }, xs = () => {
3250
- const { client: r } = E();
3251
- return R({
3252
- mutationFn: async (e) => (await r.addresses.validate(e)).data,
648
+ }, Ne = () => {
649
+ const { client: e } = c();
650
+ return h({
651
+ mutationFn: async (r) => (await e.addresses.validate(r)).data,
3253
652
  mutationKey: ["useValidateAddresses"],
3254
- onError: b
653
+ onError: u
3255
654
  });
3256
- }, Cs = () => {
3257
- const { client: r } = E();
3258
- return R({
3259
- mutationFn: async (e) => (await r.labels.void(e)).data,
655
+ }, xe = () => {
656
+ const { client: e } = c();
657
+ return h({
658
+ mutationFn: async (r) => (await e.labels.void(r)).data,
3260
659
  mutationKey: ["useVoidLabel"],
3261
- onError: b
660
+ onError: u
3262
661
  });
3263
662
  };
3264
663
  export {
3265
- Fn as AccountSettingsAPI,
3266
- Nn as AddressesAPI,
3267
- _a as CarriersAPI,
3268
- j as CodedError,
3269
- Bt as ConfirmationType,
3270
- kt as CreditCardVendor,
3271
- Tt as Currency,
3272
- _o as CustomPackagesAPI,
3273
- Lt as CustomsContentsType,
3274
- Ut as CustomsNonDeliveryType,
3275
- Do as InsuranceAPI,
3276
- qt as InsuranceProviderType,
3277
- ko as LabelsAPI,
3278
- To as OrderSourcesAPI,
3279
- Bo as RatesAPI,
3280
- Vo as SE,
3281
- Lo as SalesOrderShipmentsAPI,
3282
- Uo as SalesOrdersAPI,
3283
- Jo as ShipEngine,
3284
- Dt as ShipEngineAPI,
3285
- En as ShipEngineContext,
3286
- qo as WarehousesAPI,
3287
- zo as delay,
3288
- nn as isCodedError,
3289
- tn as isCodedErrors,
3290
- Qo as logger,
3291
- b as onError,
3292
- jo as retryUntil,
3293
- Xo as useAddFunds,
3294
- Yo as useCalculateRates,
3295
- Zo as useConnectCarrier,
3296
- es as useCreateLabel,
3297
- rs as useCreateSalesOrderShipment,
3298
- ts as useCreateWarehouse,
3299
- ns as useDeleteWarehouse,
3300
- as as useGetAccountSettings,
3301
- is as useGetAutoFundingConfiguration,
3302
- os as useGetCarrierById,
3303
- ss as useGetInsuranceAccount,
3304
- us as useGetLabel,
3305
- ls as useGetSalesOrder,
3306
- cs as useGetSalesOrderShipment,
3307
- fs as useGetShipment,
3308
- ps as useGetWalletHistory,
3309
- ds as useListCarriers,
3310
- hs as useListCustomPackageTypes,
3311
- ys as useListLabels,
3312
- vs as useListOrderSources,
3313
- ms as useListSalesOrderShipments,
3314
- gs as useListSalesOrders,
3315
- Ss as useListWarehouses,
3316
- ws as useNotifySalesOrderShipped,
3317
- bs as useParseAddress,
3318
- Es as useRefreshOrderSource,
3319
- Wo as useRefreshOrderSourceAsync,
3320
- E as useShipEngine,
3321
- As as useUpdateAccountSettings,
3322
- Os as useUpdateAutoFunding,
3323
- Ps as useUpdateBilling,
3324
- Is as useUpdateSalesOrderShipment,
3325
- Rs as useUpdateWarehouse,
3326
- xs as useValidateAddresses,
3327
- Cs as useVoidLabel
664
+ ne as ShipEngine,
665
+ R as ShipEngineContext,
666
+ V as delay,
667
+ ie as logger,
668
+ u as onError,
669
+ X as retryUntil,
670
+ ae as useAddFunds,
671
+ oe as useCalculateRates,
672
+ ue as useConnectCarrier,
673
+ le as useCreateLabel,
674
+ ce as useCreateSalesOrderShipment,
675
+ de as useCreateWarehouse,
676
+ fe as useDeleteWarehouse,
677
+ he as useGetAccountSettings,
678
+ ye as useGetAutoFundingConfiguration,
679
+ me as useGetCarrierById,
680
+ pe as useGetInsuranceAccount,
681
+ ve as useGetLabel,
682
+ ge as useGetSalesOrder,
683
+ we as useGetSalesOrderShipment,
684
+ Se as useGetShipment,
685
+ be as useGetWalletHistory,
686
+ Oe as useListCarriers,
687
+ Ee as useListCustomPackageTypes,
688
+ Fe as useListLabels,
689
+ je as useListOrderSources,
690
+ qe as useListSalesOrderShipments,
691
+ Ae as useListSalesOrders,
692
+ Ce as useListWarehouses,
693
+ ke as useNotifySalesOrderShipped,
694
+ ze as useParseAddress,
695
+ Ke as useRefreshOrderSource,
696
+ Z as useRefreshOrderSourceAsync,
697
+ c as useShipEngine,
698
+ Le as useUpdateAccountSettings,
699
+ Re as useUpdateAutoFunding,
700
+ _e as useUpdateBilling,
701
+ Pe as useUpdateSalesOrderShipment,
702
+ Ge as useUpdateWarehouse,
703
+ Ne as useValidateAddresses,
704
+ xe as useVoidLabel
3328
705
  };