@shipengine/react-api 0.23.3 → 1.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +16 -1559
- package/index.mjs +4732 -1377
- package/package.json +2 -8
- package/shipengine-api-react/src/hooks/index.d.ts +32 -0
- package/{hooks/account-settings → shipengine-api-react/src/hooks}/use-get-account-settings.d.ts +1 -1
- package/shipengine-api-react/src/hooks/use-get-shipment.d.ts +6 -0
- package/shipengine-api-react/src/hooks/use-get-wallet-transaction-history.d.ts +5 -0
- package/shipengine-api-react/src/hooks/use-list-warehouses.d.ts +7 -0
- package/shipengine-api-react/src/hooks/use-shipengine.d.ts +1 -0
- package/shipengine-api-react/src/hooks/use-update-billing.d.ts +8 -0
- package/{index.d.ts → shipengine-api-react/src/index.d.ts} +0 -1
- package/{providers → shipengine-api-react/src/providers}/shipengine.d.ts +2 -3
- package/hooks/account-settings/index.d.ts +0 -2
- package/hooks/account-settings/use-update-account-settings.d.ts +0 -5
- package/hooks/addresses/index.d.ts +0 -2
- package/hooks/carriers/index.d.ts +0 -12
- package/hooks/carriers/use-get-countries-by-carrier.d.ts +0 -5
- package/hooks/carriers/use-get-currencies-by-carrier.d.ts +0 -5
- package/hooks/carriers/use-get-package-rating-group-by-carrier.d.ts +0 -5
- package/hooks/carriers/use-get-services-by-carrier.d.ts +0 -7
- package/hooks/carriers/use-get-wallet-history.d.ts +0 -10
- package/hooks/carriers/use-get-zones-by-carrier.d.ts +0 -4
- package/hooks/custom-packages/index.d.ts +0 -1
- package/hooks/funding-sources/index.d.ts +0 -6
- package/hooks/funding-sources/use-create-funding-source.d.ts +0 -7
- package/hooks/funding-sources/use-funding-sources-add-funds.d.ts +0 -7
- package/hooks/funding-sources/use-get-funding-source-by-id.d.ts +0 -4
- package/hooks/funding-sources/use-list-funding-sources.d.ts +0 -4
- package/hooks/funding-sources/use-register-carrier.d.ts +0 -5
- package/hooks/funding-sources/use-update-funding-source.d.ts +0 -12
- package/hooks/index.d.ts +0 -15
- package/hooks/insurance/index.d.ts +0 -1
- package/hooks/labels/index.d.ts +0 -4
- package/hooks/order-sources/index.d.ts +0 -2
- package/hooks/rate-cards/index.d.ts +0 -8
- package/hooks/rate-cards/use-create-rate-card.d.ts +0 -6
- package/hooks/rate-cards/use-delete-rate-card.d.ts +0 -4
- package/hooks/rate-cards/use-download-rate-card.d.ts +0 -5
- package/hooks/rate-cards/use-get-rate-card-by-id.d.ts +0 -5
- package/hooks/rate-cards/use-list-rate-cards.d.ts +0 -5
- package/hooks/rate-cards/use-publish-rate-card.d.ts +0 -5
- package/hooks/rate-cards/use-update-rate-card.d.ts +0 -6
- package/hooks/rate-cards/use-upload-rate-card.d.ts +0 -9
- package/hooks/rates/index.d.ts +0 -1
- package/hooks/sales-orders/index.d.ts +0 -3
- package/hooks/sales-orders-shipment/index.d.ts +0 -4
- package/hooks/shipments/index.d.ts +0 -4
- package/hooks/shipments/use-create-shipment.d.ts +0 -10
- package/hooks/shipments/use-get-shipment-rates.d.ts +0 -6
- package/hooks/shipments/use-get-shipment.d.ts +0 -6
- package/hooks/shipments/use-list-shipments.d.ts +0 -7
- package/hooks/warehouses/index.d.ts +0 -4
- package/hooks/warehouses/use-list-warehouses.d.ts +0 -10
- /package/{hooks/carriers → shipengine-api-react/src/hooks}/use-add-funds.d.ts +0 -0
- /package/{hooks/rates → shipengine-api-react/src/hooks}/use-calculate-rates.d.ts +0 -0
- /package/{hooks/carriers → shipengine-api-react/src/hooks}/use-connect-carrier.d.ts +0 -0
- /package/{hooks/labels → shipengine-api-react/src/hooks}/use-create-label.d.ts +0 -0
- /package/{hooks/sales-orders-shipment → shipengine-api-react/src/hooks}/use-create-sales-order-shipment.d.ts +0 -0
- /package/{hooks/warehouses → shipengine-api-react/src/hooks}/use-create-warehouse.d.ts +0 -0
- /package/{hooks/warehouses → shipengine-api-react/src/hooks}/use-delete-warehouse.d.ts +0 -0
- /package/{hooks/carriers → shipengine-api-react/src/hooks}/use-get-auto-funding-configuration.d.ts +0 -0
- /package/{hooks/carriers → shipengine-api-react/src/hooks}/use-get-carrier-by-id.d.ts +0 -0
- /package/{hooks/insurance → shipengine-api-react/src/hooks}/use-get-insurance-account.d.ts +0 -0
- /package/{hooks/labels → shipengine-api-react/src/hooks}/use-get-label.d.ts +0 -0
- /package/{hooks/sales-orders-shipment → shipengine-api-react/src/hooks}/use-get-sales-order-shipment.d.ts +0 -0
- /package/{hooks/sales-orders → shipengine-api-react/src/hooks}/use-get-sales-order.d.ts +0 -0
- /package/{hooks/carriers → shipengine-api-react/src/hooks}/use-list-carriers.d.ts +0 -0
- /package/{hooks/custom-packages → shipengine-api-react/src/hooks}/use-list-custom-package-types.d.ts +0 -0
- /package/{hooks/labels → shipengine-api-react/src/hooks}/use-list-labels.d.ts +0 -0
- /package/{hooks/order-sources → shipengine-api-react/src/hooks}/use-list-order-sources.d.ts +0 -0
- /package/{hooks/sales-orders-shipment → shipengine-api-react/src/hooks}/use-list-sales-order-shipments.d.ts +0 -0
- /package/{hooks/sales-orders → shipengine-api-react/src/hooks}/use-list-sales-orders.d.ts +0 -0
- /package/{hooks/sales-orders → shipengine-api-react/src/hooks}/use-notify-sales-order.d.ts +0 -0
- /package/{hooks/addresses → shipengine-api-react/src/hooks}/use-parse-address.d.ts +0 -0
- /package/{hooks/order-sources → shipengine-api-react/src/hooks}/use-refresh-order-source.d.ts +0 -0
- /package/{hooks/carriers → shipengine-api-react/src/hooks}/use-update-auto-funding.d.ts +0 -0
- /package/{hooks/sales-orders-shipment → shipengine-api-react/src/hooks}/use-update-sales-order-shipment.d.ts +0 -0
- /package/{hooks/warehouses → shipengine-api-react/src/hooks}/use-update-warehouse.d.ts +0 -0
- /package/{hooks/addresses → shipengine-api-react/src/hooks}/use-validate-addresses.d.ts +0 -0
- /package/{hooks/labels → shipengine-api-react/src/hooks}/use-void-label.d.ts +0 -0
- /package/{providers → shipengine-api-react/src/providers}/index.d.ts +0 -0
- /package/{utilities → shipengine-api-react/src/utilities}/delay.d.ts +0 -0
- /package/{utilities → shipengine-api-react/src/utilities}/error.d.ts +0 -0
- /package/{utilities → shipengine-api-react/src/utilities}/index.d.ts +0 -0
- /package/{utilities → shipengine-api-react/src/utilities}/logger.d.ts +0 -0
- /package/{utilities → shipengine-api-react/src/utilities}/retry.d.ts +0 -0
package/index.js
CHANGED
|
@@ -1,1559 +1,16 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const token = getToken();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
baseURL,
|
|
17
|
-
getToken,
|
|
18
|
-
headers: headers != null ? headers : {}
|
|
19
|
-
});
|
|
20
|
-
token.then(
|
|
21
|
-
(t) => setClient(
|
|
22
|
-
new jsApi.ShipEngineAPI(t, {
|
|
23
|
-
baseURL,
|
|
24
|
-
getToken,
|
|
25
|
-
headers: headers != null ? headers : {}
|
|
26
|
-
})
|
|
27
|
-
)
|
|
28
|
-
);
|
|
29
|
-
return void 0;
|
|
30
|
-
});
|
|
31
|
-
const queryClient = new reactQuery.QueryClient();
|
|
32
|
-
if (!client) {
|
|
33
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
34
|
-
"div",
|
|
35
|
-
{
|
|
36
|
-
style: {
|
|
37
|
-
alignItems: "center",
|
|
38
|
-
display: "flex",
|
|
39
|
-
height: "100%",
|
|
40
|
-
justifyContent: "center",
|
|
41
|
-
width: "100%"
|
|
42
|
-
},
|
|
43
|
-
children: "Loading..."
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ShipEngineContext.Provider, { value: { client }, children: /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children }) });
|
|
48
|
-
};
|
|
49
|
-
const useShipEngine = () => {
|
|
50
|
-
const shipengine = react.useContext(ShipEngineContext);
|
|
51
|
-
if (!shipengine) {
|
|
52
|
-
throw new Error("useShipEngine must be called within a ShipEngineProvider");
|
|
53
|
-
}
|
|
54
|
-
return shipengine;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const delay = (ms) => new Promise((resolve) => {
|
|
58
|
-
setTimeout(() => resolve(true), ms);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const onError = (errors) => errors.forEach(console.log);
|
|
62
|
-
|
|
63
|
-
var o={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},l={};function a(e){return "string"==typeof e?o[e.toLowerCase()]:e}function c(e,r){return c=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},c(e,r)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return !1}}function f(e,r,t){return f=u()?Reflect.construct:function(e,r,t){var s=[null];s.push.apply(s,r);var i=new(Function.bind.apply(e,s));return t&&c(i,t.prototype),i},f.apply(null,arguments)}function h(e){if(null==e)return e;if(Array.isArray(e))return e.slice();if("object"==typeof e){var r={};return Object.keys(e).forEach(function(t){r[t]=e[t];}),r}return e}function v(e){return void 0===e?"undefined":null===e?"null":Array.isArray(e)?"[ "+e.map(function(e){return v(e)}).join(", ")+" ]":"object"==typeof e?JSON.stringify(e):"function"==typeof e?"[Function: "+e.name+"]":"boolean"==typeof e||"number"==typeof e?e:"'"+e.toString()+"'"}function p(e){if("string"!=typeof e){for(var r=new Array(arguments.length),t=0;t<arguments.length;t++)r[t]=v(arguments[t]);return r.join(" ")}for(var s=/%[sdj%]/g,i=1,n=arguments,o=n.length,l=String(e).replace(s,function(e){if("%%"===e)return "%";if(i>=o)return e;switch(e){case"%s":return String(n[i++]);case"%d":return Number(n[i++]);case"%j":try{return JSON.stringify(n[i++])}catch(e){return "[Circular]"}default:return e}}),a=n[i];i<o;a=n[++i])l+=null===a||"object"!=typeof a?" "+a:" "+v(a);return l}function m(e,r){var t=e.split("\n");t[0]&&t[0].indexOf("call-stack-error")>=0&&t.shift();var s=t[r],i=null;if(s){var n=/^\s*(at|.*@)\s*(.+)?$/.exec(s);i=Array.isArray(n)&&n[2]?n[2]:s;}return i}Object.keys(o).forEach(function(e){l[o[e]]=e;});var y={};function d(e,r){if(r){if(y[r])return;y[r]=!0;}console.error(e+"\n");}function g(e){return y[e]}function w(){var e=[];return function(r,t){return t&&"object"==typeof t?-1!==e.indexOf(t)?"[Circular]":(e.push(t),t):t}}var b=/*#__PURE__*/function(){function e(){}return e.prototype.write=function(e){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);},e}(),j=/*#__PURE__*/function(){function e(r,t,s){var i,n,o,l,a=this;if(!(this instanceof e))return new e(r,t);if(void 0!==t&&(i=r,r=t,!(i instanceof e)))throw new TypeError("invalid Logger creation: do not pass a second arg");if(!r)throw new TypeError("options (object) is required");if(i){if(r.name)throw new TypeError("invalid options.name: child cannot set logger name")}else if(!r.name)throw new TypeError("options.name (string) is required");if(r.stream&&r.streams)throw new TypeError('cannot mix "streams" and "stream" options');if(r.streams&&!Array.isArray(r.streams))throw new TypeError("invalid options.streams: must be an array");if(r.serializers&&("object"!=typeof r.serializers||Array.isArray(r.serializers)))throw new TypeError("invalid options.serializers: must be an object");if(i&&s){this._level=i._level,this.streams=i.streams,this.serializers=i.serializers,this.src=i.src,n=this.fields={};var c=Object.keys(i.fields);for(l=0;l<c.length;l++)n[o=c[l]]=i.fields[o];var u=Object.keys(r);for(l=0;l<u.length;l++)n[o=u[l]]=r[o];}else {if(i){for(this._level=i._level,this.streams=[],l=0;l<i.streams.length;l++){var f=h(i.streams[l]);this.streams.push(f);}this.serializers=h(i.serializers),this.src=i.src,this.fields=h(i.fields),r.level&&this.level(r.level);}else this._level=Number.POSITIVE_INFINITY,this.streams=[],this.serializers=null,this.src=!1,this.fields={};r.stream?this.addStream({type:"stream",stream:r.stream,level:r.level}):r.streams?r.streams.forEach(function(e){a.addStream(e,r.level);}):i&&r.level?this.level(r.level):i||this.addStream({type:"raw",stream:new b,level:r.level}),r.serializers&&this.addSerializers(r.serializers),r.src&&(this.src=!0),delete(n=h(r)).stream,delete n.level,delete n.streams,delete n.serializers,delete n.src,this.serializers&&this._applySerializers(n),Object.keys(n).forEach(function(e){a.fields[e]=n[e];});}}var r=e.prototype;return r.addStream=function(e,r){void 0===r&&(r=30),(e=h(e)).type="raw",e.level=a(e.level||r),e.level<this._level&&(this._level=e.level),this.streams.push(e),delete this.haveNonRawStreams;},r.addSerializers=function(e){var r=this;this.serializers||(this.serializers={}),Object.keys(e).forEach(function(t){var s=e[t];if("function"!=typeof s)throw new TypeError(p('invalid serializer for "%s" field: must be a function',t));r.serializers[t]=s;});},r.child=function(e,r){return new this.constructor(this,e||{},r)},r.level=function(e){if(void 0===e)return this._level;for(var r=a(e),t=this.streams.length,s=0;s<t;s++)this.streams[s].level=r;this._level=r;},r.levels=function(e,r){if(void 0===e)return this.streams.map(function(e){return e.level});var t;if("number"==typeof e){if(void 0===(t=this.streams[e]))throw new Error("invalid stream index: "+e)}else {for(var s=this.streams.length,i=0;i<s;i++){var n=this.streams[i];if(n.name===e){t=n;break}}if(!t)throw new Error(p('no stream with name "%s"',e))}if(void 0===r)return t.level;var o=a(r);t.level=o,o<this._level&&(this._level=o);},r._applySerializers=function(e,r){var t=this;Object.keys(this.serializers).forEach(function(s){if(!(void 0===e[s]||r&&r[s]))try{e[s]=t.serializers[s](e[s]);}catch(r){d(p('bunyan: ERROR: Exception thrown from the "%s" Bunyan serializer. This should never happen. This is a bugin that serializer function.\n%s',s,r.stack||r)),e[s]=p('(Error in Bunyan log "%s" serializer broke field. See stderr for details.)',s);}});},r._emit=function(e,r){var t,s;if(void 0===this.haveNonRawStreams)for(this.haveNonRawStreams=!1,t=0;t<this.streams.length;t++)if(!this.streams[t].raw){this.haveNonRawStreams=!0;break}if(r||this.haveNonRawStreams)try{s=JSON.stringify(e,w())+"\n";}catch(r){var i=r.stack.split(/\n/g,2).join("\n");d('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(e,r){return r||(r=" "),r+e.split(/\r?\n/g).join("\n"+r)}(p("%s\n%s",e,r.stack)),i),s=p("(Exception in JSON.stringify(rec): %j. See stderr for details.)\n",r.message);}if(r)return s;var n=e.level;for(t=0;t<this.streams.length;t++){var o=this.streams[t];o.level<=n&&o.stream.write(e);}return s},e}();function z(e){return function(){var r=this;function t(t){var n;t[0]instanceof Error?(s={err:r.serializers&&r.serializers.err?r.serializers.err(t[0]):k.err(t[0])},n={err:!0},i=1===t.length?[s.err.message]:Array.prototype.slice.call(t,1)):"object"!=typeof t[0]&&null!==t[0]||Array.isArray(t[0])?(s=null,i=Array.prototype.slice.call(t)):(s=t[0],i=1===t.length&&s.err&&s.err instanceof Error?[s.err.message]:Array.prototype.slice.call(t,1));var o=h(r.fields);o.level=e;var a=s?h(s):null;if(a&&(r.serializers&&r._applySerializers(a,n),Object.keys(a).forEach(function(e){o[e]=a[e];})),o.levelName=l[e],o.msg=i.length?p.apply(r,i):"",o.time||(o.time=new Date),r.src&&!o.src)try{throw new Error("call-stack-error")}catch(e){var c=e.stack?m(e.stack,2):"";c||g("src")||d("Unable to determine src line info","src"),o.src=c||"";}return o.v=1,o}var s=null,i=arguments,n=null;if(0===arguments.length)return this._level<=e;this._level>e||(n=t(i),this._emit(n));}}function S(e){var r=e.stack||e.toString();if(e.cause&&"function"==typeof e.cause){var t=e.cause();t&&(r+="\nCaused by: "+S(t));}return r}j.prototype.trace=z(10),j.prototype.debug=z(20),j.prototype.info=z(30),j.prototype.warn=z(40),j.prototype.error=z(50),j.prototype.fatal=z(60);var k={err:function(e){return e&&e.stack?{message:e.message,name:e.name,stack:S(e),code:e.code,signal:e.signal}:e}};function E(){return f(j,[].slice.call(arguments))}var A={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"},R=/*#__PURE__*/function(){function e(e){var r=void 0===e?{}:e,t=r.logByLevel,s=r.css,i=void 0===s?A:s;this.logByLevel=void 0!==t&&t,this.css=i;}return e.prototype.write=function(e){var r,t,s=this.css.def,i=this.css.msg,n=this.css.src,o=e.childName?e.name+"/"+e.childName:e.name,a=l[e.level],c=(Array(6-a.length).join(" ")+a).toUpperCase();this.logByLevel?(10===e.level?a="debug":60===e.level&&(a="error"),t="function"==typeof console[a]?console[a]:console.log):t=console.log,r=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;var u=function(e,r){return Array(r+1-(e+"").length).join("0")+e},f=[];f.push("[%s:%s:%s:%s] %c%s%c: %s: %c%s "+(e.src?"%c%s":"")),f.push(u(e.time.getHours(),2)),f.push(u(e.time.getMinutes(),2)),f.push(u(e.time.getSeconds(),2)),f.push(u(e.time.getMilliseconds(),4)),f.push(r),f.push(c),f.push(s),f.push(o),f.push(i),f.push(e.msg),e.src&&(f.push(n),f.push(e.src)),e.obj&&(f.push("\n"),f.push(e.obj)),e.err&&e.err.stack&&(f.push("\n"),f.push(e.err.stack)),t.apply(console,f);},e.getDefaultCss=function(){return A},e}();
|
|
64
|
-
|
|
65
|
-
var __defProp$1 = Object.defineProperty;
|
|
66
|
-
var __defProps$1 = Object.defineProperties;
|
|
67
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
68
|
-
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
69
|
-
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
70
|
-
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
71
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
72
|
-
var __spreadValues$1 = (a, b) => {
|
|
73
|
-
for (var prop in b || (b = {}))
|
|
74
|
-
if (__hasOwnProp$7.call(b, prop))
|
|
75
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
76
|
-
if (__getOwnPropSymbols$7)
|
|
77
|
-
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
78
|
-
if (__propIsEnum$7.call(b, prop))
|
|
79
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
80
|
-
}
|
|
81
|
-
return a;
|
|
82
|
-
};
|
|
83
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
84
|
-
const streams = [];
|
|
85
|
-
if (process.env.NODE_ENV === "production") {
|
|
86
|
-
streams.push({
|
|
87
|
-
stream: new R()
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
const logger = E({
|
|
91
|
-
name: "shipengine",
|
|
92
|
-
serializers: __spreadProps$1(__spreadValues$1({}, k), {
|
|
93
|
-
req: (req) => ({
|
|
94
|
-
headers: req.headers,
|
|
95
|
-
method: req.method,
|
|
96
|
-
url: req.url
|
|
97
|
-
}),
|
|
98
|
-
res: (res) => ({
|
|
99
|
-
data: res.data,
|
|
100
|
-
headers: res.config.headers,
|
|
101
|
-
method: res.config.method,
|
|
102
|
-
statusCode: res.status,
|
|
103
|
-
url: res.config.url
|
|
104
|
-
})
|
|
105
|
-
}),
|
|
106
|
-
streams
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
const retryUntil = (callbackFn, retries = 10, timeoutBetweenAttempts = 1e3) => Promise.resolve().then(callbackFn).catch(function retry(error) {
|
|
110
|
-
retries -= 1;
|
|
111
|
-
if (retries > 0) {
|
|
112
|
-
return delay(timeoutBetweenAttempts).then(callbackFn).catch(retry);
|
|
113
|
-
}
|
|
114
|
-
throw error;
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
const useGetAccountSettings = () => {
|
|
118
|
-
const { client } = useShipEngine();
|
|
119
|
-
return reactQuery.useQuery({
|
|
120
|
-
onError,
|
|
121
|
-
queryFn: () => client.accountSettings.get(),
|
|
122
|
-
queryKey: ["getAccountSettings"],
|
|
123
|
-
select: (result) => result.data
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
var __async$p = (__this, __arguments, generator) => {
|
|
128
|
-
return new Promise((resolve, reject) => {
|
|
129
|
-
var fulfilled = (value) => {
|
|
130
|
-
try {
|
|
131
|
-
step(generator.next(value));
|
|
132
|
-
} catch (e) {
|
|
133
|
-
reject(e);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
var rejected = (value) => {
|
|
137
|
-
try {
|
|
138
|
-
step(generator.throw(value));
|
|
139
|
-
} catch (e) {
|
|
140
|
-
reject(e);
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
144
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
const useUpdateAccountSettings = () => {
|
|
148
|
-
const { client } = useShipEngine();
|
|
149
|
-
return reactQuery.useMutation({
|
|
150
|
-
mutationFn: (settings) => __async$p(void 0, null, function* () {
|
|
151
|
-
const result = yield client.accountSettings.update(settings);
|
|
152
|
-
return result.data;
|
|
153
|
-
}),
|
|
154
|
-
mutationKey: ["useUpdateAccountSettings"],
|
|
155
|
-
onError
|
|
156
|
-
});
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
var __async$o = (__this, __arguments, generator) => {
|
|
160
|
-
return new Promise((resolve, reject) => {
|
|
161
|
-
var fulfilled = (value) => {
|
|
162
|
-
try {
|
|
163
|
-
step(generator.next(value));
|
|
164
|
-
} catch (e) {
|
|
165
|
-
reject(e);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
var rejected = (value) => {
|
|
169
|
-
try {
|
|
170
|
-
step(generator.throw(value));
|
|
171
|
-
} catch (e) {
|
|
172
|
-
reject(e);
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
176
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
const useParseAddress = () => {
|
|
180
|
-
const { client } = useShipEngine();
|
|
181
|
-
return reactQuery.useMutation({
|
|
182
|
-
mutationFn: (_0) => __async$o(void 0, [_0], function* ({ address, text }) {
|
|
183
|
-
const result = yield client.addresses.parse(text, address);
|
|
184
|
-
return result.data;
|
|
185
|
-
}),
|
|
186
|
-
mutationKey: ["useParseAddress"],
|
|
187
|
-
onError
|
|
188
|
-
});
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
var __async$n = (__this, __arguments, generator) => {
|
|
192
|
-
return new Promise((resolve, reject) => {
|
|
193
|
-
var fulfilled = (value) => {
|
|
194
|
-
try {
|
|
195
|
-
step(generator.next(value));
|
|
196
|
-
} catch (e) {
|
|
197
|
-
reject(e);
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
var rejected = (value) => {
|
|
201
|
-
try {
|
|
202
|
-
step(generator.throw(value));
|
|
203
|
-
} catch (e) {
|
|
204
|
-
reject(e);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
208
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
209
|
-
});
|
|
210
|
-
};
|
|
211
|
-
const useValidateAddresses = () => {
|
|
212
|
-
const { client } = useShipEngine();
|
|
213
|
-
return reactQuery.useMutation({
|
|
214
|
-
mutationFn: (addresses) => __async$n(void 0, null, function* () {
|
|
215
|
-
const result = yield client.addresses.validate(addresses);
|
|
216
|
-
return result.data;
|
|
217
|
-
}),
|
|
218
|
-
mutationKey: ["useValidateAddresses"],
|
|
219
|
-
onError
|
|
220
|
-
});
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
var __async$m = (__this, __arguments, generator) => {
|
|
224
|
-
return new Promise((resolve, reject) => {
|
|
225
|
-
var fulfilled = (value) => {
|
|
226
|
-
try {
|
|
227
|
-
step(generator.next(value));
|
|
228
|
-
} catch (e) {
|
|
229
|
-
reject(e);
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
var rejected = (value) => {
|
|
233
|
-
try {
|
|
234
|
-
step(generator.throw(value));
|
|
235
|
-
} catch (e) {
|
|
236
|
-
reject(e);
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
240
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
241
|
-
});
|
|
242
|
-
};
|
|
243
|
-
const useAddFunds = (carrierId) => {
|
|
244
|
-
const { client } = useShipEngine();
|
|
245
|
-
return reactQuery.useMutation({
|
|
246
|
-
mutationFn: (funds) => __async$m(void 0, null, function* () {
|
|
247
|
-
const result = yield client.carriers.addFunds(carrierId, funds);
|
|
248
|
-
return result.data;
|
|
249
|
-
}),
|
|
250
|
-
mutationKey: ["useAddFunds"],
|
|
251
|
-
onError
|
|
252
|
-
});
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
var __async$l = (__this, __arguments, generator) => {
|
|
256
|
-
return new Promise((resolve, reject) => {
|
|
257
|
-
var fulfilled = (value) => {
|
|
258
|
-
try {
|
|
259
|
-
step(generator.next(value));
|
|
260
|
-
} catch (e) {
|
|
261
|
-
reject(e);
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
var rejected = (value) => {
|
|
265
|
-
try {
|
|
266
|
-
step(generator.throw(value));
|
|
267
|
-
} catch (e) {
|
|
268
|
-
reject(e);
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
272
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
273
|
-
});
|
|
274
|
-
};
|
|
275
|
-
const useConnectCarrier = () => {
|
|
276
|
-
const { client } = useShipEngine();
|
|
277
|
-
return reactQuery.useMutation({
|
|
278
|
-
mutationFn: (params) => __async$l(void 0, null, function* () {
|
|
279
|
-
const result = yield client.carriers.connect(params);
|
|
280
|
-
return result.data;
|
|
281
|
-
}),
|
|
282
|
-
mutationKey: ["useConnectCarrier"],
|
|
283
|
-
onError
|
|
284
|
-
});
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
const useGetAutoFundingConfiguration = (carrierId) => {
|
|
288
|
-
const { client } = useShipEngine();
|
|
289
|
-
return reactQuery.useQuery({
|
|
290
|
-
enabled: carrierId !== void 0,
|
|
291
|
-
onError,
|
|
292
|
-
queryFn: () => {
|
|
293
|
-
if (carrierId)
|
|
294
|
-
return client.carriers.getAutoFunding(carrierId);
|
|
295
|
-
return Promise.reject(new Error("carrierId is required."));
|
|
296
|
-
},
|
|
297
|
-
queryKey: ["useGetAutoFundingConfiguration", carrierId],
|
|
298
|
-
select: (result) => result.data
|
|
299
|
-
});
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
const useGetCarrierById = (carrierId) => {
|
|
303
|
-
const { client } = useShipEngine();
|
|
304
|
-
return reactQuery.useQuery({
|
|
305
|
-
enabled: !!carrierId,
|
|
306
|
-
onError,
|
|
307
|
-
queryFn: () => {
|
|
308
|
-
if (carrierId)
|
|
309
|
-
return client.carriers.get(carrierId);
|
|
310
|
-
return Promise.reject(new Error("carrierId is require"));
|
|
311
|
-
},
|
|
312
|
-
queryKey: ["useGetCarrierById", carrierId],
|
|
313
|
-
select: (result) => result.data,
|
|
314
|
-
// Fresh for 5 minutes
|
|
315
|
-
staleTime: 5 * 60 * 1e3
|
|
316
|
-
});
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
const useGetCountriesByCarrier = (carrierId) => {
|
|
320
|
-
const { client } = useShipEngine();
|
|
321
|
-
return reactQuery.useQuery({
|
|
322
|
-
enabled: !!carrierId,
|
|
323
|
-
onError,
|
|
324
|
-
queryFn: () => {
|
|
325
|
-
if (carrierId)
|
|
326
|
-
return client.carriers.getCountries(carrierId);
|
|
327
|
-
return Promise.reject(new Error("carrierId is require"));
|
|
328
|
-
},
|
|
329
|
-
queryKey: ["useGetCountriesByCarrier", carrierId],
|
|
330
|
-
select: (result) => result.data.countries,
|
|
331
|
-
// Fresh for 5 minutes
|
|
332
|
-
staleTime: 5 * 60 * 1e3
|
|
333
|
-
});
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
const useGetCurrenciesByCarrier = (carrierId) => {
|
|
337
|
-
const { client } = useShipEngine();
|
|
338
|
-
return reactQuery.useQuery({
|
|
339
|
-
enabled: !!carrierId,
|
|
340
|
-
onError,
|
|
341
|
-
queryFn: () => {
|
|
342
|
-
if (carrierId)
|
|
343
|
-
return client.carriers.getCurrencies(carrierId);
|
|
344
|
-
return Promise.reject(new Error("carrierId is require"));
|
|
345
|
-
},
|
|
346
|
-
queryKey: ["useGetCurrenciesByCarrier", carrierId],
|
|
347
|
-
select: (result) => result.data.currencies,
|
|
348
|
-
// Fresh for 5 minutes
|
|
349
|
-
staleTime: 5 * 60 * 1e3
|
|
350
|
-
});
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
const useGetPackageRatingGroupByCarrier = (carrierId) => {
|
|
354
|
-
const { client } = useShipEngine();
|
|
355
|
-
return reactQuery.useQuery({
|
|
356
|
-
enabled: !!carrierId,
|
|
357
|
-
onError,
|
|
358
|
-
queryFn: () => {
|
|
359
|
-
if (carrierId)
|
|
360
|
-
return client.carriers.getPackageRatingGroup(carrierId);
|
|
361
|
-
return Promise.reject(new Error("carrierId is required"));
|
|
362
|
-
},
|
|
363
|
-
queryKey: ["useGetRatePackageFormatsByCarrier", carrierId],
|
|
364
|
-
select: (result) => result.data.packageRatingGroup,
|
|
365
|
-
// Fresh for 5 minutes
|
|
366
|
-
staleTime: 5 * 60 * 1e3
|
|
367
|
-
});
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
const useGetServicesByCarrier = (carrierId) => {
|
|
371
|
-
const { client } = useShipEngine();
|
|
372
|
-
return reactQuery.useQuery({
|
|
373
|
-
enabled: !!carrierId,
|
|
374
|
-
onError,
|
|
375
|
-
queryFn: () => {
|
|
376
|
-
if (carrierId)
|
|
377
|
-
return client.carriers.getServices(carrierId);
|
|
378
|
-
return Promise.reject(new Error("carrierId is required"));
|
|
379
|
-
},
|
|
380
|
-
queryKey: ["useGetServicesByCarrier", carrierId],
|
|
381
|
-
select: (result) => result.data.services,
|
|
382
|
-
// Fresh for 5 minutes
|
|
383
|
-
staleTime: 5 * 60 * 1e3
|
|
384
|
-
});
|
|
385
|
-
};
|
|
386
|
-
|
|
387
|
-
const useGetWalletHistory = ({
|
|
388
|
-
enabled,
|
|
389
|
-
page,
|
|
390
|
-
range
|
|
391
|
-
}) => {
|
|
392
|
-
const { client } = useShipEngine();
|
|
393
|
-
const [startDate, endDate] = range;
|
|
394
|
-
return reactQuery.useQuery({
|
|
395
|
-
enabled,
|
|
396
|
-
keepPreviousData: true,
|
|
397
|
-
// See https://react-query-v3.tanstack.com/guides/paginated-queries#better-paginated-queries-with-keeppreviousdata
|
|
398
|
-
onError,
|
|
399
|
-
queryFn: () => client.carriers.getWalletHistory(startDate, endDate, page),
|
|
400
|
-
queryKey: ["useGetWalletHistory", startDate, endDate, page],
|
|
401
|
-
select: (result) => result.data
|
|
402
|
-
});
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
const useListCarriers = () => {
|
|
406
|
-
const { client } = useShipEngine();
|
|
407
|
-
return reactQuery.useQuery({
|
|
408
|
-
onError,
|
|
409
|
-
queryFn: () => client.carriers.list(),
|
|
410
|
-
queryKey: ["useListCarriers"],
|
|
411
|
-
select: (result) => result.data.carriers
|
|
412
|
-
});
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
var __async$k = (__this, __arguments, generator) => {
|
|
416
|
-
return new Promise((resolve, reject) => {
|
|
417
|
-
var fulfilled = (value) => {
|
|
418
|
-
try {
|
|
419
|
-
step(generator.next(value));
|
|
420
|
-
} catch (e) {
|
|
421
|
-
reject(e);
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
var rejected = (value) => {
|
|
425
|
-
try {
|
|
426
|
-
step(generator.throw(value));
|
|
427
|
-
} catch (e) {
|
|
428
|
-
reject(e);
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
432
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
433
|
-
});
|
|
434
|
-
};
|
|
435
|
-
const useUpdateAutoFunding = (carrierId) => {
|
|
436
|
-
const { client } = useShipEngine();
|
|
437
|
-
const queryClient = reactQuery.useQueryClient();
|
|
438
|
-
return reactQuery.useMutation({
|
|
439
|
-
mutationFn: (options) => __async$k(void 0, null, function* () {
|
|
440
|
-
const result = yield client.carriers.updateAutoFunding(carrierId, options);
|
|
441
|
-
return result.data;
|
|
442
|
-
}),
|
|
443
|
-
mutationKey: ["useUpdateAutoFunding"],
|
|
444
|
-
onError,
|
|
445
|
-
onSuccess: (_) => {
|
|
446
|
-
queryClient.invalidateQueries(["useGetAutoFunding", carrierId], { exact: true });
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
const useGetZonesByCarrier = (carrierId) => {
|
|
452
|
-
const { client } = useShipEngine();
|
|
453
|
-
return reactQuery.useQuery({
|
|
454
|
-
enabled: !!carrierId,
|
|
455
|
-
onError,
|
|
456
|
-
queryFn: () => {
|
|
457
|
-
if (carrierId)
|
|
458
|
-
return client.carriers.getZones(carrierId);
|
|
459
|
-
return Promise.reject(new Error("carrierId is required"));
|
|
460
|
-
},
|
|
461
|
-
queryKey: ["useGetZonesByCarrier", carrierId],
|
|
462
|
-
select: (result) => result.data.zones,
|
|
463
|
-
// Fresh for 5 minutes
|
|
464
|
-
staleTime: 5 * 60 * 1e3
|
|
465
|
-
});
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
const useListCustomPackageTypes = () => {
|
|
469
|
-
const { client } = useShipEngine();
|
|
470
|
-
return reactQuery.useQuery({
|
|
471
|
-
onError,
|
|
472
|
-
queryFn: () => client.customPackages.list(),
|
|
473
|
-
queryKey: ["useListCustomPackageTypes"],
|
|
474
|
-
select: (result) => result.data.packages
|
|
475
|
-
});
|
|
476
|
-
};
|
|
477
|
-
|
|
478
|
-
var __async$j = (__this, __arguments, generator) => {
|
|
479
|
-
return new Promise((resolve, reject) => {
|
|
480
|
-
var fulfilled = (value) => {
|
|
481
|
-
try {
|
|
482
|
-
step(generator.next(value));
|
|
483
|
-
} catch (e) {
|
|
484
|
-
reject(e);
|
|
485
|
-
}
|
|
486
|
-
};
|
|
487
|
-
var rejected = (value) => {
|
|
488
|
-
try {
|
|
489
|
-
step(generator.throw(value));
|
|
490
|
-
} catch (e) {
|
|
491
|
-
reject(e);
|
|
492
|
-
}
|
|
493
|
-
};
|
|
494
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
495
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
496
|
-
});
|
|
497
|
-
};
|
|
498
|
-
const useCreateFundingSource = () => {
|
|
499
|
-
const { client } = useShipEngine();
|
|
500
|
-
return reactQuery.useMutation({
|
|
501
|
-
mutationFn: (fundingSource) => __async$j(void 0, null, function* () {
|
|
502
|
-
const result = yield client.fundingSources.create(fundingSource);
|
|
503
|
-
return result.data;
|
|
504
|
-
}),
|
|
505
|
-
mutationKey: ["useCreateFundingSource"],
|
|
506
|
-
onError
|
|
507
|
-
});
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
var __async$i = (__this, __arguments, generator) => {
|
|
511
|
-
return new Promise((resolve, reject) => {
|
|
512
|
-
var fulfilled = (value) => {
|
|
513
|
-
try {
|
|
514
|
-
step(generator.next(value));
|
|
515
|
-
} catch (e) {
|
|
516
|
-
reject(e);
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
var rejected = (value) => {
|
|
520
|
-
try {
|
|
521
|
-
step(generator.throw(value));
|
|
522
|
-
} catch (e) {
|
|
523
|
-
reject(e);
|
|
524
|
-
}
|
|
525
|
-
};
|
|
526
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
527
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
528
|
-
});
|
|
529
|
-
};
|
|
530
|
-
const useFundingSourcesAddFunds = (fundingSourceId) => {
|
|
531
|
-
const { client } = useShipEngine();
|
|
532
|
-
return reactQuery.useMutation({
|
|
533
|
-
mutationFn: (funds) => __async$i(void 0, null, function* () {
|
|
534
|
-
const result = yield client.fundingSources.addFunds(funds, fundingSourceId);
|
|
535
|
-
return result.data;
|
|
536
|
-
}),
|
|
537
|
-
mutationKey: ["useFundingSourcesAddFunds"],
|
|
538
|
-
onError
|
|
539
|
-
});
|
|
540
|
-
};
|
|
541
|
-
|
|
542
|
-
const useGetFundingSourceById = (fundingSourceId) => {
|
|
543
|
-
const { client } = useShipEngine();
|
|
544
|
-
return reactQuery.useQuery({
|
|
545
|
-
onError,
|
|
546
|
-
queryFn: () => client.fundingSources.get(fundingSourceId),
|
|
547
|
-
queryKey: ["getFundingSourceById"],
|
|
548
|
-
select: (result) => result.data
|
|
549
|
-
});
|
|
550
|
-
};
|
|
551
|
-
|
|
552
|
-
const useListFundingSources = () => {
|
|
553
|
-
const { client } = useShipEngine();
|
|
554
|
-
return reactQuery.useQuery({
|
|
555
|
-
onError,
|
|
556
|
-
queryFn: () => client.fundingSources.list(),
|
|
557
|
-
queryKey: ["useListFundingSources"],
|
|
558
|
-
select: (result) => result.data.fundingSources
|
|
559
|
-
});
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
var __async$h = (__this, __arguments, generator) => {
|
|
563
|
-
return new Promise((resolve, reject) => {
|
|
564
|
-
var fulfilled = (value) => {
|
|
565
|
-
try {
|
|
566
|
-
step(generator.next(value));
|
|
567
|
-
} catch (e) {
|
|
568
|
-
reject(e);
|
|
569
|
-
}
|
|
570
|
-
};
|
|
571
|
-
var rejected = (value) => {
|
|
572
|
-
try {
|
|
573
|
-
step(generator.throw(value));
|
|
574
|
-
} catch (e) {
|
|
575
|
-
reject(e);
|
|
576
|
-
}
|
|
577
|
-
};
|
|
578
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
579
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
580
|
-
});
|
|
581
|
-
};
|
|
582
|
-
const useRegisterCarrier = () => {
|
|
583
|
-
const { client } = useShipEngine();
|
|
584
|
-
return reactQuery.useMutation({
|
|
585
|
-
mutationFn: (carrier) => __async$h(void 0, null, function* () {
|
|
586
|
-
const result = yield client.fundingSources.registerCarrier(carrier);
|
|
587
|
-
return result.data;
|
|
588
|
-
}),
|
|
589
|
-
mutationKey: ["useRegisterCarrier"],
|
|
590
|
-
onError
|
|
591
|
-
});
|
|
592
|
-
};
|
|
593
|
-
|
|
594
|
-
var __async$g = (__this, __arguments, generator) => {
|
|
595
|
-
return new Promise((resolve, reject) => {
|
|
596
|
-
var fulfilled = (value) => {
|
|
597
|
-
try {
|
|
598
|
-
step(generator.next(value));
|
|
599
|
-
} catch (e) {
|
|
600
|
-
reject(e);
|
|
601
|
-
}
|
|
602
|
-
};
|
|
603
|
-
var rejected = (value) => {
|
|
604
|
-
try {
|
|
605
|
-
step(generator.throw(value));
|
|
606
|
-
} catch (e) {
|
|
607
|
-
reject(e);
|
|
608
|
-
}
|
|
609
|
-
};
|
|
610
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
611
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
612
|
-
});
|
|
613
|
-
};
|
|
614
|
-
const useUpdateFundingSource = () => {
|
|
615
|
-
const { client } = useShipEngine();
|
|
616
|
-
return reactQuery.useMutation({
|
|
617
|
-
mutationFn: (_0) => __async$g(void 0, [_0], function* ({
|
|
618
|
-
billingInfo,
|
|
619
|
-
creditCardInfo,
|
|
620
|
-
fundingSourceId
|
|
621
|
-
}) {
|
|
622
|
-
const result = yield client.fundingSources.update(
|
|
623
|
-
billingInfo,
|
|
624
|
-
creditCardInfo,
|
|
625
|
-
fundingSourceId
|
|
626
|
-
);
|
|
627
|
-
return result.data;
|
|
628
|
-
}),
|
|
629
|
-
mutationKey: ["useUpdateFundingSource"],
|
|
630
|
-
onError
|
|
631
|
-
});
|
|
632
|
-
};
|
|
633
|
-
|
|
634
|
-
const useGetInsuranceAccount = (insuranceProvider) => {
|
|
635
|
-
const { client } = useShipEngine();
|
|
636
|
-
return reactQuery.useQuery({
|
|
637
|
-
enabled: insuranceProvider !== void 0,
|
|
638
|
-
onError,
|
|
639
|
-
queryFn: () => {
|
|
640
|
-
if (insuranceProvider)
|
|
641
|
-
return client.insurance.get(insuranceProvider);
|
|
642
|
-
return Promise.reject(new Error("insuranceProvider is required"));
|
|
643
|
-
},
|
|
644
|
-
queryKey: ["useGetInsuranceAccount", insuranceProvider],
|
|
645
|
-
select: (result) => result.data
|
|
646
|
-
});
|
|
647
|
-
};
|
|
648
|
-
|
|
649
|
-
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
650
|
-
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
651
|
-
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
652
|
-
var __objRest$5 = (source, exclude) => {
|
|
653
|
-
var target = {};
|
|
654
|
-
for (var prop in source)
|
|
655
|
-
if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
656
|
-
target[prop] = source[prop];
|
|
657
|
-
if (source != null && __getOwnPropSymbols$6)
|
|
658
|
-
for (var prop of __getOwnPropSymbols$6(source)) {
|
|
659
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
|
|
660
|
-
target[prop] = source[prop];
|
|
661
|
-
}
|
|
662
|
-
return target;
|
|
663
|
-
};
|
|
664
|
-
var __async$f = (__this, __arguments, generator) => {
|
|
665
|
-
return new Promise((resolve, reject) => {
|
|
666
|
-
var fulfilled = (value) => {
|
|
667
|
-
try {
|
|
668
|
-
step(generator.next(value));
|
|
669
|
-
} catch (e) {
|
|
670
|
-
reject(e);
|
|
671
|
-
}
|
|
672
|
-
};
|
|
673
|
-
var rejected = (value) => {
|
|
674
|
-
try {
|
|
675
|
-
step(generator.throw(value));
|
|
676
|
-
} catch (e) {
|
|
677
|
-
reject(e);
|
|
678
|
-
}
|
|
679
|
-
};
|
|
680
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
681
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
682
|
-
});
|
|
683
|
-
};
|
|
684
|
-
const useCreateLabel = () => {
|
|
685
|
-
const { client } = useShipEngine();
|
|
686
|
-
return reactQuery.useMutation({
|
|
687
|
-
mutationFn: (_a) => __async$f(void 0, null, function* () {
|
|
688
|
-
var _b = _a, { rateId } = _b, options = __objRest$5(_b, ["rateId"]);
|
|
689
|
-
const result = yield client.labels.createByRateId(rateId, options);
|
|
690
|
-
return result.data;
|
|
691
|
-
}),
|
|
692
|
-
mutationKey: ["useCreateLabel"],
|
|
693
|
-
onError
|
|
694
|
-
});
|
|
695
|
-
};
|
|
696
|
-
|
|
697
|
-
const useGetLabel = (labelId) => {
|
|
698
|
-
const { client } = useShipEngine();
|
|
699
|
-
return reactQuery.useQuery({
|
|
700
|
-
enabled: labelId !== void 0,
|
|
701
|
-
onError,
|
|
702
|
-
queryFn: () => {
|
|
703
|
-
if (labelId)
|
|
704
|
-
return client.labels.get(labelId);
|
|
705
|
-
return Promise.reject(new Error("labelId is require"));
|
|
706
|
-
},
|
|
707
|
-
queryKey: ["useGetLabel", labelId],
|
|
708
|
-
select: (result) => result.data
|
|
709
|
-
});
|
|
710
|
-
};
|
|
711
|
-
|
|
712
|
-
const useListLabels = (params) => {
|
|
713
|
-
const { client } = useShipEngine();
|
|
714
|
-
return reactQuery.useQuery({
|
|
715
|
-
enabled: params && Object.values(params).some((v) => v !== void 0),
|
|
716
|
-
onError,
|
|
717
|
-
queryFn: () => client.labels.list(params),
|
|
718
|
-
queryKey: ["useListLabels", params],
|
|
719
|
-
select: (result) => result.data.labels
|
|
720
|
-
});
|
|
721
|
-
};
|
|
722
|
-
|
|
723
|
-
var __async$e = (__this, __arguments, generator) => {
|
|
724
|
-
return new Promise((resolve, reject) => {
|
|
725
|
-
var fulfilled = (value) => {
|
|
726
|
-
try {
|
|
727
|
-
step(generator.next(value));
|
|
728
|
-
} catch (e) {
|
|
729
|
-
reject(e);
|
|
730
|
-
}
|
|
731
|
-
};
|
|
732
|
-
var rejected = (value) => {
|
|
733
|
-
try {
|
|
734
|
-
step(generator.throw(value));
|
|
735
|
-
} catch (e) {
|
|
736
|
-
reject(e);
|
|
737
|
-
}
|
|
738
|
-
};
|
|
739
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
740
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
741
|
-
});
|
|
742
|
-
};
|
|
743
|
-
const useVoidLabel = () => {
|
|
744
|
-
const { client } = useShipEngine();
|
|
745
|
-
return reactQuery.useMutation({
|
|
746
|
-
mutationFn: (labelId) => __async$e(void 0, null, function* () {
|
|
747
|
-
const result = yield client.labels.void(labelId);
|
|
748
|
-
return result.data;
|
|
749
|
-
}),
|
|
750
|
-
mutationKey: ["useVoidLabel"],
|
|
751
|
-
onError
|
|
752
|
-
});
|
|
753
|
-
};
|
|
754
|
-
|
|
755
|
-
const useListOrderSources = () => {
|
|
756
|
-
const { client } = useShipEngine();
|
|
757
|
-
return reactQuery.useQuery({
|
|
758
|
-
onError,
|
|
759
|
-
queryFn: () => client.orderSources.list(),
|
|
760
|
-
queryKey: ["useListOrderSources"],
|
|
761
|
-
select: (result) => result.data.orderSources
|
|
762
|
-
});
|
|
763
|
-
};
|
|
764
|
-
|
|
765
|
-
var __async$d = (__this, __arguments, generator) => {
|
|
766
|
-
return new Promise((resolve, reject) => {
|
|
767
|
-
var fulfilled = (value) => {
|
|
768
|
-
try {
|
|
769
|
-
step(generator.next(value));
|
|
770
|
-
} catch (e) {
|
|
771
|
-
reject(e);
|
|
772
|
-
}
|
|
773
|
-
};
|
|
774
|
-
var rejected = (value) => {
|
|
775
|
-
try {
|
|
776
|
-
step(generator.throw(value));
|
|
777
|
-
} catch (e) {
|
|
778
|
-
reject(e);
|
|
779
|
-
}
|
|
780
|
-
};
|
|
781
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
782
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
783
|
-
});
|
|
784
|
-
};
|
|
785
|
-
const useRefreshOrderSourceAsync = () => {
|
|
786
|
-
const { client } = useShipEngine();
|
|
787
|
-
return reactQuery.useMutation({
|
|
788
|
-
mutationFn: (orderSourceId) => __async$d(void 0, null, function* () {
|
|
789
|
-
const result = yield client.orderSources.refresh(orderSourceId);
|
|
790
|
-
return result.data;
|
|
791
|
-
}),
|
|
792
|
-
mutationKey: ["useRefreshOrderSourceAsync"]
|
|
793
|
-
});
|
|
794
|
-
};
|
|
795
|
-
const useRefreshOrderSource = () => {
|
|
796
|
-
const { client } = useShipEngine();
|
|
797
|
-
const { mutateAsync: refreshOrderSourceAsync } = useRefreshOrderSourceAsync();
|
|
798
|
-
return reactQuery.useMutation({
|
|
799
|
-
mutationFn: (orderSourceId) => __async$d(void 0, null, function* () {
|
|
800
|
-
yield refreshOrderSourceAsync(orderSourceId);
|
|
801
|
-
const waitResult = yield retryUntil(() => __async$d(void 0, null, function* () {
|
|
802
|
-
const { data: checkResult } = yield client.orderSources.get(orderSourceId);
|
|
803
|
-
if (["preparing_update", "updating"].includes(checkResult.refreshInfo.status)) {
|
|
804
|
-
throw new jsApi.SE.CodedError("Order source is still refreshing");
|
|
805
|
-
}
|
|
806
|
-
return checkResult;
|
|
807
|
-
}), 20);
|
|
808
|
-
return waitResult;
|
|
809
|
-
}),
|
|
810
|
-
mutationKey: ["useRefreshOrderSource"],
|
|
811
|
-
onError
|
|
812
|
-
});
|
|
813
|
-
};
|
|
814
|
-
|
|
815
|
-
var __async$c = (__this, __arguments, generator) => {
|
|
816
|
-
return new Promise((resolve, reject) => {
|
|
817
|
-
var fulfilled = (value) => {
|
|
818
|
-
try {
|
|
819
|
-
step(generator.next(value));
|
|
820
|
-
} catch (e) {
|
|
821
|
-
reject(e);
|
|
822
|
-
}
|
|
823
|
-
};
|
|
824
|
-
var rejected = (value) => {
|
|
825
|
-
try {
|
|
826
|
-
step(generator.throw(value));
|
|
827
|
-
} catch (e) {
|
|
828
|
-
reject(e);
|
|
829
|
-
}
|
|
830
|
-
};
|
|
831
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
832
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
833
|
-
});
|
|
834
|
-
};
|
|
835
|
-
const useCreateRateCard = () => {
|
|
836
|
-
const { client } = useShipEngine();
|
|
837
|
-
return reactQuery.useMutation({
|
|
838
|
-
mutationFn: (rateCard) => __async$c(void 0, null, function* () {
|
|
839
|
-
const result = yield client.rateCards.create(rateCard);
|
|
840
|
-
return result.data;
|
|
841
|
-
}),
|
|
842
|
-
mutationKey: ["useCreateRateCard"],
|
|
843
|
-
onError
|
|
844
|
-
});
|
|
845
|
-
};
|
|
846
|
-
|
|
847
|
-
const useDownloadRateCard = (rateCardId) => {
|
|
848
|
-
const { client } = useShipEngine();
|
|
849
|
-
return reactQuery.useQuery({
|
|
850
|
-
enabled: !!rateCardId.length,
|
|
851
|
-
onError,
|
|
852
|
-
queryFn: () => {
|
|
853
|
-
return client.rateCards.download(rateCardId);
|
|
854
|
-
},
|
|
855
|
-
queryKey: ["useDownloadRateCard", rateCardId]
|
|
856
|
-
});
|
|
857
|
-
};
|
|
858
|
-
|
|
859
|
-
const useGetRateCardById = (rateCardId) => {
|
|
860
|
-
const { client } = useShipEngine();
|
|
861
|
-
return reactQuery.useQuery({
|
|
862
|
-
enabled: !!rateCardId,
|
|
863
|
-
onError,
|
|
864
|
-
queryFn: () => {
|
|
865
|
-
return client.rateCards.get(rateCardId);
|
|
866
|
-
},
|
|
867
|
-
queryKey: ["useGetRateCardById", rateCardId],
|
|
868
|
-
select: (result) => result.data
|
|
869
|
-
});
|
|
870
|
-
};
|
|
871
|
-
|
|
872
|
-
const useListRateCards = (carrierIds) => {
|
|
873
|
-
const { client } = useShipEngine();
|
|
874
|
-
return reactQuery.useQuery({
|
|
875
|
-
enabled: !!carrierIds.length,
|
|
876
|
-
onError,
|
|
877
|
-
queryFn: () => {
|
|
878
|
-
return client.rateCards.list(carrierIds);
|
|
879
|
-
},
|
|
880
|
-
queryKey: ["useListRateCards", carrierIds],
|
|
881
|
-
select: (result) => result.data.rateCards
|
|
882
|
-
});
|
|
883
|
-
};
|
|
884
|
-
|
|
885
|
-
var __async$b = (__this, __arguments, generator) => {
|
|
886
|
-
return new Promise((resolve, reject) => {
|
|
887
|
-
var fulfilled = (value) => {
|
|
888
|
-
try {
|
|
889
|
-
step(generator.next(value));
|
|
890
|
-
} catch (e) {
|
|
891
|
-
reject(e);
|
|
892
|
-
}
|
|
893
|
-
};
|
|
894
|
-
var rejected = (value) => {
|
|
895
|
-
try {
|
|
896
|
-
step(generator.throw(value));
|
|
897
|
-
} catch (e) {
|
|
898
|
-
reject(e);
|
|
899
|
-
}
|
|
900
|
-
};
|
|
901
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
902
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
903
|
-
});
|
|
904
|
-
};
|
|
905
|
-
const usePublishRateCard = () => {
|
|
906
|
-
const { client } = useShipEngine();
|
|
907
|
-
return reactQuery.useMutation({
|
|
908
|
-
mutationFn: (rateCardId) => __async$b(void 0, null, function* () {
|
|
909
|
-
return yield client.rateCards.publish(rateCardId);
|
|
910
|
-
}),
|
|
911
|
-
mutationKey: ["usePublishRateCard"],
|
|
912
|
-
onError
|
|
913
|
-
});
|
|
914
|
-
};
|
|
915
|
-
|
|
916
|
-
var __async$a = (__this, __arguments, generator) => {
|
|
917
|
-
return new Promise((resolve, reject) => {
|
|
918
|
-
var fulfilled = (value) => {
|
|
919
|
-
try {
|
|
920
|
-
step(generator.next(value));
|
|
921
|
-
} catch (e) {
|
|
922
|
-
reject(e);
|
|
923
|
-
}
|
|
924
|
-
};
|
|
925
|
-
var rejected = (value) => {
|
|
926
|
-
try {
|
|
927
|
-
step(generator.throw(value));
|
|
928
|
-
} catch (e) {
|
|
929
|
-
reject(e);
|
|
930
|
-
}
|
|
931
|
-
};
|
|
932
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
933
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
934
|
-
});
|
|
935
|
-
};
|
|
936
|
-
const useUpdateRateCard = () => {
|
|
937
|
-
const { client } = useShipEngine();
|
|
938
|
-
return reactQuery.useMutation({
|
|
939
|
-
mutationFn: (rateCard) => __async$a(void 0, null, function* () {
|
|
940
|
-
const result = yield client.rateCards.update(rateCard);
|
|
941
|
-
return result.data;
|
|
942
|
-
}),
|
|
943
|
-
mutationKey: ["useUpdateRateCard"],
|
|
944
|
-
onError
|
|
945
|
-
});
|
|
946
|
-
};
|
|
947
|
-
|
|
948
|
-
var __async$9 = (__this, __arguments, generator) => {
|
|
949
|
-
return new Promise((resolve, reject) => {
|
|
950
|
-
var fulfilled = (value) => {
|
|
951
|
-
try {
|
|
952
|
-
step(generator.next(value));
|
|
953
|
-
} catch (e) {
|
|
954
|
-
reject(e);
|
|
955
|
-
}
|
|
956
|
-
};
|
|
957
|
-
var rejected = (value) => {
|
|
958
|
-
try {
|
|
959
|
-
step(generator.throw(value));
|
|
960
|
-
} catch (e) {
|
|
961
|
-
reject(e);
|
|
962
|
-
}
|
|
963
|
-
};
|
|
964
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
965
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
966
|
-
});
|
|
967
|
-
};
|
|
968
|
-
const useUploadRateCard = () => {
|
|
969
|
-
const { client } = useShipEngine();
|
|
970
|
-
return reactQuery.useMutation({
|
|
971
|
-
mutationFn: (_0) => __async$9(void 0, [_0], function* ({ rateCardId, file }) {
|
|
972
|
-
const result = yield client.rateCards.upload(rateCardId, file);
|
|
973
|
-
return result.data;
|
|
974
|
-
}),
|
|
975
|
-
mutationKey: ["useUploadRateCard"],
|
|
976
|
-
onError
|
|
977
|
-
});
|
|
978
|
-
};
|
|
979
|
-
|
|
980
|
-
var __async$8 = (__this, __arguments, generator) => {
|
|
981
|
-
return new Promise((resolve, reject) => {
|
|
982
|
-
var fulfilled = (value) => {
|
|
983
|
-
try {
|
|
984
|
-
step(generator.next(value));
|
|
985
|
-
} catch (e) {
|
|
986
|
-
reject(e);
|
|
987
|
-
}
|
|
988
|
-
};
|
|
989
|
-
var rejected = (value) => {
|
|
990
|
-
try {
|
|
991
|
-
step(generator.throw(value));
|
|
992
|
-
} catch (e) {
|
|
993
|
-
reject(e);
|
|
994
|
-
}
|
|
995
|
-
};
|
|
996
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
997
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
998
|
-
});
|
|
999
|
-
};
|
|
1000
|
-
const useDeleteRateCard = () => {
|
|
1001
|
-
const { client } = useShipEngine();
|
|
1002
|
-
return reactQuery.useMutation({
|
|
1003
|
-
mutationFn: (rateCardId) => __async$8(void 0, null, function* () {
|
|
1004
|
-
const result = yield client.rateCards.delete(rateCardId);
|
|
1005
|
-
return result.data;
|
|
1006
|
-
}),
|
|
1007
|
-
mutationKey: ["useDeleteRateCard"],
|
|
1008
|
-
onError
|
|
1009
|
-
});
|
|
1010
|
-
};
|
|
1011
|
-
|
|
1012
|
-
var __async$7 = (__this, __arguments, generator) => {
|
|
1013
|
-
return new Promise((resolve, reject) => {
|
|
1014
|
-
var fulfilled = (value) => {
|
|
1015
|
-
try {
|
|
1016
|
-
step(generator.next(value));
|
|
1017
|
-
} catch (e) {
|
|
1018
|
-
reject(e);
|
|
1019
|
-
}
|
|
1020
|
-
};
|
|
1021
|
-
var rejected = (value) => {
|
|
1022
|
-
try {
|
|
1023
|
-
step(generator.throw(value));
|
|
1024
|
-
} catch (e) {
|
|
1025
|
-
reject(e);
|
|
1026
|
-
}
|
|
1027
|
-
};
|
|
1028
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1029
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
1030
|
-
});
|
|
1031
|
-
};
|
|
1032
|
-
const useCalculateRates = () => {
|
|
1033
|
-
const { client } = useShipEngine();
|
|
1034
|
-
return reactQuery.useMutation({
|
|
1035
|
-
mutationFn: (_0) => __async$7(void 0, [_0], function* ({ rateOptions, shipmentId }) {
|
|
1036
|
-
const result = yield client.rates.calculateByShipmentId(shipmentId, rateOptions);
|
|
1037
|
-
return result.data;
|
|
1038
|
-
}),
|
|
1039
|
-
mutationKey: ["useCalculateRates"],
|
|
1040
|
-
onError
|
|
1041
|
-
});
|
|
1042
|
-
};
|
|
1043
|
-
|
|
1044
|
-
const useGetSalesOrder = (salesOrderId) => {
|
|
1045
|
-
const { client } = useShipEngine();
|
|
1046
|
-
return reactQuery.useQuery({
|
|
1047
|
-
enabled: salesOrderId !== void 0,
|
|
1048
|
-
onError,
|
|
1049
|
-
queryFn: () => {
|
|
1050
|
-
if (salesOrderId)
|
|
1051
|
-
return client.salesOrders.get(salesOrderId);
|
|
1052
|
-
return Promise.reject(new Error("salesOrderId is required"));
|
|
1053
|
-
},
|
|
1054
|
-
queryKey: ["useGetSalesOrder", salesOrderId],
|
|
1055
|
-
select: (result) => result.data
|
|
1056
|
-
});
|
|
1057
|
-
};
|
|
1058
|
-
|
|
1059
|
-
const useListSalesOrders = (params = {}) => {
|
|
1060
|
-
const { client } = useShipEngine();
|
|
1061
|
-
return reactQuery.useQuery({
|
|
1062
|
-
enabled: params && Object.values(params).some((v) => v !== void 0),
|
|
1063
|
-
onError,
|
|
1064
|
-
queryFn: () => client.salesOrders.list(params),
|
|
1065
|
-
queryKey: ["useListSalesOrders", params],
|
|
1066
|
-
select: (result) => result.data.salesOrders
|
|
1067
|
-
});
|
|
1068
|
-
};
|
|
1069
|
-
|
|
1070
|
-
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1071
|
-
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1072
|
-
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1073
|
-
var __objRest$4 = (source, exclude) => {
|
|
1074
|
-
var target = {};
|
|
1075
|
-
for (var prop in source)
|
|
1076
|
-
if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1077
|
-
target[prop] = source[prop];
|
|
1078
|
-
if (source != null && __getOwnPropSymbols$5)
|
|
1079
|
-
for (var prop of __getOwnPropSymbols$5(source)) {
|
|
1080
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
|
|
1081
|
-
target[prop] = source[prop];
|
|
1082
|
-
}
|
|
1083
|
-
return target;
|
|
1084
|
-
};
|
|
1085
|
-
var __async$6 = (__this, __arguments, generator) => {
|
|
1086
|
-
return new Promise((resolve, reject) => {
|
|
1087
|
-
var fulfilled = (value) => {
|
|
1088
|
-
try {
|
|
1089
|
-
step(generator.next(value));
|
|
1090
|
-
} catch (e) {
|
|
1091
|
-
reject(e);
|
|
1092
|
-
}
|
|
1093
|
-
};
|
|
1094
|
-
var rejected = (value) => {
|
|
1095
|
-
try {
|
|
1096
|
-
step(generator.throw(value));
|
|
1097
|
-
} catch (e) {
|
|
1098
|
-
reject(e);
|
|
1099
|
-
}
|
|
1100
|
-
};
|
|
1101
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1102
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
1103
|
-
});
|
|
1104
|
-
};
|
|
1105
|
-
const useNotifySalesOrderShipped = () => {
|
|
1106
|
-
const { client } = useShipEngine();
|
|
1107
|
-
return reactQuery.useMutation({
|
|
1108
|
-
mutationFn: (_a) => __async$6(void 0, null, function* () {
|
|
1109
|
-
var _b = _a, { salesOrderId } = _b, tracking = __objRest$4(_b, ["salesOrderId"]);
|
|
1110
|
-
const result = yield client.salesOrders.notifyShipped(salesOrderId, tracking);
|
|
1111
|
-
return result.data;
|
|
1112
|
-
}),
|
|
1113
|
-
mutationKey: ["useNotifySalesOrder"],
|
|
1114
|
-
onError
|
|
1115
|
-
});
|
|
1116
|
-
};
|
|
1117
|
-
|
|
1118
|
-
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1119
|
-
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1120
|
-
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1121
|
-
var __objRest$3 = (source, exclude) => {
|
|
1122
|
-
var target = {};
|
|
1123
|
-
for (var prop in source)
|
|
1124
|
-
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1125
|
-
target[prop] = source[prop];
|
|
1126
|
-
if (source != null && __getOwnPropSymbols$4)
|
|
1127
|
-
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
1128
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
1129
|
-
target[prop] = source[prop];
|
|
1130
|
-
}
|
|
1131
|
-
return target;
|
|
1132
|
-
};
|
|
1133
|
-
var __async$5 = (__this, __arguments, generator) => {
|
|
1134
|
-
return new Promise((resolve, reject) => {
|
|
1135
|
-
var fulfilled = (value) => {
|
|
1136
|
-
try {
|
|
1137
|
-
step(generator.next(value));
|
|
1138
|
-
} catch (e) {
|
|
1139
|
-
reject(e);
|
|
1140
|
-
}
|
|
1141
|
-
};
|
|
1142
|
-
var rejected = (value) => {
|
|
1143
|
-
try {
|
|
1144
|
-
step(generator.throw(value));
|
|
1145
|
-
} catch (e) {
|
|
1146
|
-
reject(e);
|
|
1147
|
-
}
|
|
1148
|
-
};
|
|
1149
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1150
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
1151
|
-
});
|
|
1152
|
-
};
|
|
1153
|
-
const useCreateSalesOrderShipment = () => {
|
|
1154
|
-
const { client } = useShipEngine();
|
|
1155
|
-
return reactQuery.useMutation({
|
|
1156
|
-
mutationFn: (_a) => __async$5(void 0, null, function* () {
|
|
1157
|
-
var _b = _a, { salesOrderId } = _b, shipment = __objRest$3(_b, ["salesOrderId"]);
|
|
1158
|
-
const result = yield client.salesOrderShipments.create(salesOrderId, shipment);
|
|
1159
|
-
return result.data;
|
|
1160
|
-
}),
|
|
1161
|
-
mutationKey: ["useCreateSalesOrderShipment"],
|
|
1162
|
-
onError
|
|
1163
|
-
});
|
|
1164
|
-
};
|
|
1165
|
-
|
|
1166
|
-
const useGetSalesOrderShipment = (shipmentId) => {
|
|
1167
|
-
const { client } = useShipEngine();
|
|
1168
|
-
return reactQuery.useQuery({
|
|
1169
|
-
enabled: shipmentId !== void 0,
|
|
1170
|
-
onError,
|
|
1171
|
-
queryFn: () => {
|
|
1172
|
-
if (shipmentId)
|
|
1173
|
-
return client.salesOrderShipments.get(shipmentId);
|
|
1174
|
-
return Promise.reject(new Error("shipmentId is required"));
|
|
1175
|
-
},
|
|
1176
|
-
queryKey: ["useGetSalesOrderShipment", shipmentId],
|
|
1177
|
-
select: (result) => result.data
|
|
1178
|
-
});
|
|
1179
|
-
};
|
|
1180
|
-
|
|
1181
|
-
const useListSalesOrderShipments = (params) => {
|
|
1182
|
-
const { client } = useShipEngine();
|
|
1183
|
-
return reactQuery.useQuery({
|
|
1184
|
-
enabled: params && Object.values(params).some((v) => v !== void 0),
|
|
1185
|
-
onError,
|
|
1186
|
-
queryFn: () => client.salesOrderShipments.list(params),
|
|
1187
|
-
queryKey: ["useListSalesOrderShipments", params],
|
|
1188
|
-
select: (result) => result.data.shipments
|
|
1189
|
-
});
|
|
1190
|
-
};
|
|
1191
|
-
|
|
1192
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
1193
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
1194
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
1195
|
-
var __objRest$2 = (source, exclude) => {
|
|
1196
|
-
var target = {};
|
|
1197
|
-
for (var prop in source)
|
|
1198
|
-
if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1199
|
-
target[prop] = source[prop];
|
|
1200
|
-
if (source != null && __getOwnPropSymbols$3)
|
|
1201
|
-
for (var prop of __getOwnPropSymbols$3(source)) {
|
|
1202
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
|
|
1203
|
-
target[prop] = source[prop];
|
|
1204
|
-
}
|
|
1205
|
-
return target;
|
|
1206
|
-
};
|
|
1207
|
-
var __async$4 = (__this, __arguments, generator) => {
|
|
1208
|
-
return new Promise((resolve, reject) => {
|
|
1209
|
-
var fulfilled = (value) => {
|
|
1210
|
-
try {
|
|
1211
|
-
step(generator.next(value));
|
|
1212
|
-
} catch (e) {
|
|
1213
|
-
reject(e);
|
|
1214
|
-
}
|
|
1215
|
-
};
|
|
1216
|
-
var rejected = (value) => {
|
|
1217
|
-
try {
|
|
1218
|
-
step(generator.throw(value));
|
|
1219
|
-
} catch (e) {
|
|
1220
|
-
reject(e);
|
|
1221
|
-
}
|
|
1222
|
-
};
|
|
1223
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1224
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
1225
|
-
});
|
|
1226
|
-
};
|
|
1227
|
-
const useUpdateSalesOrderShipment = () => {
|
|
1228
|
-
const { client } = useShipEngine();
|
|
1229
|
-
return reactQuery.useMutation({
|
|
1230
|
-
mutationFn: (_a) => __async$4(void 0, null, function* () {
|
|
1231
|
-
var _b = _a, { shipmentId } = _b, shipment = __objRest$2(_b, ["shipmentId"]);
|
|
1232
|
-
const result = yield client.salesOrderShipments.update(shipmentId, shipment);
|
|
1233
|
-
return result.data;
|
|
1234
|
-
}),
|
|
1235
|
-
mutationKey: ["useUpdateSalesOrderShipment"],
|
|
1236
|
-
onError
|
|
1237
|
-
});
|
|
1238
|
-
};
|
|
1239
|
-
|
|
1240
|
-
var __defProp = Object.defineProperty;
|
|
1241
|
-
var __defProps = Object.defineProperties;
|
|
1242
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
1243
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
1244
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
1245
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
1246
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1247
|
-
var __spreadValues = (a, b) => {
|
|
1248
|
-
for (var prop in b || (b = {}))
|
|
1249
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
1250
|
-
__defNormalProp(a, prop, b[prop]);
|
|
1251
|
-
if (__getOwnPropSymbols$2)
|
|
1252
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
1253
|
-
if (__propIsEnum$2.call(b, prop))
|
|
1254
|
-
__defNormalProp(a, prop, b[prop]);
|
|
1255
|
-
}
|
|
1256
|
-
return a;
|
|
1257
|
-
};
|
|
1258
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1259
|
-
var __async$3 = (__this, __arguments, generator) => {
|
|
1260
|
-
return new Promise((resolve, reject) => {
|
|
1261
|
-
var fulfilled = (value) => {
|
|
1262
|
-
try {
|
|
1263
|
-
step(generator.next(value));
|
|
1264
|
-
} catch (e) {
|
|
1265
|
-
reject(e);
|
|
1266
|
-
}
|
|
1267
|
-
};
|
|
1268
|
-
var rejected = (value) => {
|
|
1269
|
-
try {
|
|
1270
|
-
step(generator.throw(value));
|
|
1271
|
-
} catch (e) {
|
|
1272
|
-
reject(e);
|
|
1273
|
-
}
|
|
1274
|
-
};
|
|
1275
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1276
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
1277
|
-
});
|
|
1278
|
-
};
|
|
1279
|
-
const useCreateShipment = () => {
|
|
1280
|
-
const { client } = useShipEngine();
|
|
1281
|
-
return reactQuery.useMutation({
|
|
1282
|
-
mutationFn: (shipment) => __async$3(void 0, null, function* () {
|
|
1283
|
-
var _a;
|
|
1284
|
-
if (shipment.warehouseId === void 0) {
|
|
1285
|
-
throw new jsApi.SE.CodedError("errorMessages.noWarehouses", {
|
|
1286
|
-
errorCode: "unknown",
|
|
1287
|
-
errorSource: "client",
|
|
1288
|
-
errorType: "business_rules"
|
|
1289
|
-
});
|
|
1290
|
-
}
|
|
1291
|
-
const shipTo = (_a = shipment.shipTo) != null ? _a : {
|
|
1292
|
-
addressLine1: "",
|
|
1293
|
-
cityLocality: "",
|
|
1294
|
-
countryCode: "",
|
|
1295
|
-
name: "",
|
|
1296
|
-
phone: "",
|
|
1297
|
-
postalCode: "",
|
|
1298
|
-
stateProvince: ""
|
|
1299
|
-
};
|
|
1300
|
-
return (yield client.shipments.create(__spreadProps(__spreadValues({}, shipment), {
|
|
1301
|
-
shipTo
|
|
1302
|
-
}))).data;
|
|
1303
|
-
}),
|
|
1304
|
-
mutationKey: ["useCreateShipment"],
|
|
1305
|
-
onError
|
|
1306
|
-
});
|
|
1307
|
-
};
|
|
1308
|
-
|
|
1309
|
-
const useGetShipmentRates = (shipmentId, createdAtStart) => {
|
|
1310
|
-
const { client } = useShipEngine();
|
|
1311
|
-
return reactQuery.useQuery({
|
|
1312
|
-
enabled: shipmentId !== void 0,
|
|
1313
|
-
onError,
|
|
1314
|
-
queryFn: () => {
|
|
1315
|
-
if (shipmentId) {
|
|
1316
|
-
return client.shipments.getShipmentRates({ createdAtStart, shipmentId });
|
|
1317
|
-
}
|
|
1318
|
-
return Promise.reject(new Error("shipmentId is required"));
|
|
1319
|
-
},
|
|
1320
|
-
queryKey: ["useGetShipmentRates", shipmentId, createdAtStart],
|
|
1321
|
-
select: (result) => result.data
|
|
1322
|
-
});
|
|
1323
|
-
};
|
|
1324
|
-
|
|
1325
|
-
const useGetShipment = (shipmentId) => {
|
|
1326
|
-
const { client } = useShipEngine();
|
|
1327
|
-
return reactQuery.useQuery({
|
|
1328
|
-
enabled: shipmentId !== void 0,
|
|
1329
|
-
onError,
|
|
1330
|
-
queryFn: () => {
|
|
1331
|
-
if (!shipmentId) {
|
|
1332
|
-
return Promise.reject(new Error("shipmentId is required"));
|
|
1333
|
-
}
|
|
1334
|
-
return client.salesOrderShipments.get(shipmentId);
|
|
1335
|
-
},
|
|
1336
|
-
queryKey: ["useGetShipment", shipmentId],
|
|
1337
|
-
select: (result) => result.data
|
|
1338
|
-
});
|
|
1339
|
-
};
|
|
1340
|
-
|
|
1341
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
1342
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
1343
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
1344
|
-
var __objRest$1 = (source, exclude) => {
|
|
1345
|
-
var target = {};
|
|
1346
|
-
for (var prop in source)
|
|
1347
|
-
if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1348
|
-
target[prop] = source[prop];
|
|
1349
|
-
if (source != null && __getOwnPropSymbols$1)
|
|
1350
|
-
for (var prop of __getOwnPropSymbols$1(source)) {
|
|
1351
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
|
|
1352
|
-
target[prop] = source[prop];
|
|
1353
|
-
}
|
|
1354
|
-
return target;
|
|
1355
|
-
};
|
|
1356
|
-
const useListShipments = (_params) => {
|
|
1357
|
-
const _a = _params || {}, { enabled = true } = _a, params = __objRest$1(_a, ["enabled"]);
|
|
1358
|
-
const { client } = useShipEngine();
|
|
1359
|
-
return reactQuery.useQuery({
|
|
1360
|
-
enabled,
|
|
1361
|
-
onError,
|
|
1362
|
-
queryFn: () => client.shipments.list(params),
|
|
1363
|
-
queryKey: ["useListShipments", params],
|
|
1364
|
-
select: (result) => result.data
|
|
1365
|
-
});
|
|
1366
|
-
};
|
|
1367
|
-
|
|
1368
|
-
var __async$2 = (__this, __arguments, generator) => {
|
|
1369
|
-
return new Promise((resolve, reject) => {
|
|
1370
|
-
var fulfilled = (value) => {
|
|
1371
|
-
try {
|
|
1372
|
-
step(generator.next(value));
|
|
1373
|
-
} catch (e) {
|
|
1374
|
-
reject(e);
|
|
1375
|
-
}
|
|
1376
|
-
};
|
|
1377
|
-
var rejected = (value) => {
|
|
1378
|
-
try {
|
|
1379
|
-
step(generator.throw(value));
|
|
1380
|
-
} catch (e) {
|
|
1381
|
-
reject(e);
|
|
1382
|
-
}
|
|
1383
|
-
};
|
|
1384
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1385
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
1386
|
-
});
|
|
1387
|
-
};
|
|
1388
|
-
const useCreateWarehouse = () => {
|
|
1389
|
-
const { client } = useShipEngine();
|
|
1390
|
-
return reactQuery.useMutation({
|
|
1391
|
-
mutationFn: (data) => __async$2(void 0, null, function* () {
|
|
1392
|
-
const result = yield client.warehouses.create(data);
|
|
1393
|
-
return result.data;
|
|
1394
|
-
}),
|
|
1395
|
-
mutationKey: ["useCreateWarehouse"],
|
|
1396
|
-
onError
|
|
1397
|
-
});
|
|
1398
|
-
};
|
|
1399
|
-
|
|
1400
|
-
var __async$1 = (__this, __arguments, generator) => {
|
|
1401
|
-
return new Promise((resolve, reject) => {
|
|
1402
|
-
var fulfilled = (value) => {
|
|
1403
|
-
try {
|
|
1404
|
-
step(generator.next(value));
|
|
1405
|
-
} catch (e) {
|
|
1406
|
-
reject(e);
|
|
1407
|
-
}
|
|
1408
|
-
};
|
|
1409
|
-
var rejected = (value) => {
|
|
1410
|
-
try {
|
|
1411
|
-
step(generator.throw(value));
|
|
1412
|
-
} catch (e) {
|
|
1413
|
-
reject(e);
|
|
1414
|
-
}
|
|
1415
|
-
};
|
|
1416
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1417
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
1418
|
-
});
|
|
1419
|
-
};
|
|
1420
|
-
const useDeleteWarehouse = () => {
|
|
1421
|
-
const { client } = useShipEngine();
|
|
1422
|
-
return reactQuery.useMutation({
|
|
1423
|
-
mutationFn: (_0) => __async$1(void 0, [_0], function* ({ warehouseId }) {
|
|
1424
|
-
const result = yield client.warehouses.delete(warehouseId);
|
|
1425
|
-
return result.data;
|
|
1426
|
-
}),
|
|
1427
|
-
mutationKey: ["useDeleteWarehouse"],
|
|
1428
|
-
onError
|
|
1429
|
-
});
|
|
1430
|
-
};
|
|
1431
|
-
|
|
1432
|
-
const useListWarehouses = (options) => {
|
|
1433
|
-
var _a;
|
|
1434
|
-
const { client } = useShipEngine();
|
|
1435
|
-
return reactQuery.useQuery({
|
|
1436
|
-
enabled: (_a = options == null ? void 0 : options.enabled) != null ? _a : true,
|
|
1437
|
-
onError,
|
|
1438
|
-
queryFn: () => client.warehouses.list(),
|
|
1439
|
-
queryKey: ["useListWarehouses"],
|
|
1440
|
-
select: (result) => result.data.warehouses
|
|
1441
|
-
});
|
|
1442
|
-
};
|
|
1443
|
-
|
|
1444
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
1445
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1446
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
1447
|
-
var __objRest = (source, exclude) => {
|
|
1448
|
-
var target = {};
|
|
1449
|
-
for (var prop in source)
|
|
1450
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1451
|
-
target[prop] = source[prop];
|
|
1452
|
-
if (source != null && __getOwnPropSymbols)
|
|
1453
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
1454
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
1455
|
-
target[prop] = source[prop];
|
|
1456
|
-
}
|
|
1457
|
-
return target;
|
|
1458
|
-
};
|
|
1459
|
-
var __async = (__this, __arguments, generator) => {
|
|
1460
|
-
return new Promise((resolve, reject) => {
|
|
1461
|
-
var fulfilled = (value) => {
|
|
1462
|
-
try {
|
|
1463
|
-
step(generator.next(value));
|
|
1464
|
-
} catch (e) {
|
|
1465
|
-
reject(e);
|
|
1466
|
-
}
|
|
1467
|
-
};
|
|
1468
|
-
var rejected = (value) => {
|
|
1469
|
-
try {
|
|
1470
|
-
step(generator.throw(value));
|
|
1471
|
-
} catch (e) {
|
|
1472
|
-
reject(e);
|
|
1473
|
-
}
|
|
1474
|
-
};
|
|
1475
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1476
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
1477
|
-
});
|
|
1478
|
-
};
|
|
1479
|
-
const useUpdateWarehouse = () => {
|
|
1480
|
-
const { client } = useShipEngine();
|
|
1481
|
-
return reactQuery.useMutation({
|
|
1482
|
-
mutationFn: (_a) => __async(void 0, null, function* () {
|
|
1483
|
-
var _b = _a, { warehouseId } = _b, warehouse = __objRest(_b, ["warehouseId"]);
|
|
1484
|
-
const result = yield client.warehouses.update(warehouseId, warehouse);
|
|
1485
|
-
return result.data;
|
|
1486
|
-
}),
|
|
1487
|
-
mutationKey: ["useUpdateWarehouse"],
|
|
1488
|
-
onError
|
|
1489
|
-
});
|
|
1490
|
-
};
|
|
1491
|
-
|
|
1492
|
-
exports.ShipEngine = ShipEngine;
|
|
1493
|
-
exports.ShipEngineContext = ShipEngineContext;
|
|
1494
|
-
exports.delay = delay;
|
|
1495
|
-
exports.logger = logger;
|
|
1496
|
-
exports.onError = onError;
|
|
1497
|
-
exports.retryUntil = retryUntil;
|
|
1498
|
-
exports.useAddFunds = useAddFunds;
|
|
1499
|
-
exports.useCalculateRates = useCalculateRates;
|
|
1500
|
-
exports.useConnectCarrier = useConnectCarrier;
|
|
1501
|
-
exports.useCreateFundingSource = useCreateFundingSource;
|
|
1502
|
-
exports.useCreateLabel = useCreateLabel;
|
|
1503
|
-
exports.useCreateRateCard = useCreateRateCard;
|
|
1504
|
-
exports.useCreateSalesOrderShipment = useCreateSalesOrderShipment;
|
|
1505
|
-
exports.useCreateShipment = useCreateShipment;
|
|
1506
|
-
exports.useCreateWarehouse = useCreateWarehouse;
|
|
1507
|
-
exports.useDeleteRateCard = useDeleteRateCard;
|
|
1508
|
-
exports.useDeleteWarehouse = useDeleteWarehouse;
|
|
1509
|
-
exports.useDownloadRateCard = useDownloadRateCard;
|
|
1510
|
-
exports.useFundingSourcesAddFunds = useFundingSourcesAddFunds;
|
|
1511
|
-
exports.useGetAccountSettings = useGetAccountSettings;
|
|
1512
|
-
exports.useGetAutoFundingConfiguration = useGetAutoFundingConfiguration;
|
|
1513
|
-
exports.useGetCarrierById = useGetCarrierById;
|
|
1514
|
-
exports.useGetCountriesByCarrier = useGetCountriesByCarrier;
|
|
1515
|
-
exports.useGetCurrenciesByCarrier = useGetCurrenciesByCarrier;
|
|
1516
|
-
exports.useGetFundingSourceById = useGetFundingSourceById;
|
|
1517
|
-
exports.useGetInsuranceAccount = useGetInsuranceAccount;
|
|
1518
|
-
exports.useGetLabel = useGetLabel;
|
|
1519
|
-
exports.useGetPackageRatingGroupByCarrier = useGetPackageRatingGroupByCarrier;
|
|
1520
|
-
exports.useGetRateCardById = useGetRateCardById;
|
|
1521
|
-
exports.useGetSalesOrder = useGetSalesOrder;
|
|
1522
|
-
exports.useGetSalesOrderShipment = useGetSalesOrderShipment;
|
|
1523
|
-
exports.useGetServicesByCarrier = useGetServicesByCarrier;
|
|
1524
|
-
exports.useGetShipment = useGetShipment;
|
|
1525
|
-
exports.useGetShipmentRates = useGetShipmentRates;
|
|
1526
|
-
exports.useGetWalletHistory = useGetWalletHistory;
|
|
1527
|
-
exports.useGetZonesByCarrier = useGetZonesByCarrier;
|
|
1528
|
-
exports.useListCarriers = useListCarriers;
|
|
1529
|
-
exports.useListCustomPackageTypes = useListCustomPackageTypes;
|
|
1530
|
-
exports.useListFundingSources = useListFundingSources;
|
|
1531
|
-
exports.useListLabels = useListLabels;
|
|
1532
|
-
exports.useListOrderSources = useListOrderSources;
|
|
1533
|
-
exports.useListRateCards = useListRateCards;
|
|
1534
|
-
exports.useListSalesOrderShipments = useListSalesOrderShipments;
|
|
1535
|
-
exports.useListSalesOrders = useListSalesOrders;
|
|
1536
|
-
exports.useListShipments = useListShipments;
|
|
1537
|
-
exports.useListWarehouses = useListWarehouses;
|
|
1538
|
-
exports.useNotifySalesOrderShipped = useNotifySalesOrderShipped;
|
|
1539
|
-
exports.useParseAddress = useParseAddress;
|
|
1540
|
-
exports.usePublishRateCard = usePublishRateCard;
|
|
1541
|
-
exports.useRefreshOrderSource = useRefreshOrderSource;
|
|
1542
|
-
exports.useRefreshOrderSourceAsync = useRefreshOrderSourceAsync;
|
|
1543
|
-
exports.useRegisterCarrier = useRegisterCarrier;
|
|
1544
|
-
exports.useShipEngine = useShipEngine;
|
|
1545
|
-
exports.useUpdateAccountSettings = useUpdateAccountSettings;
|
|
1546
|
-
exports.useUpdateAutoFunding = useUpdateAutoFunding;
|
|
1547
|
-
exports.useUpdateFundingSource = useUpdateFundingSource;
|
|
1548
|
-
exports.useUpdateRateCard = useUpdateRateCard;
|
|
1549
|
-
exports.useUpdateSalesOrderShipment = useUpdateSalesOrderShipment;
|
|
1550
|
-
exports.useUpdateWarehouse = useUpdateWarehouse;
|
|
1551
|
-
exports.useUploadRateCard = useUploadRateCard;
|
|
1552
|
-
exports.useValidateAddresses = useValidateAddresses;
|
|
1553
|
-
exports.useVoidLabel = useVoidLabel;
|
|
1554
|
-
Object.keys(jsApi).forEach(k => {
|
|
1555
|
-
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
1556
|
-
enumerable: true,
|
|
1557
|
-
get: () => jsApi[k]
|
|
1558
|
-
});
|
|
1559
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const vi=require("react-dom"),I=require("react"),ut=require("react/jsx-runtime");function Ut(t,e){return Ut=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Ut(t,e)}function Ee(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Ut(t,e)}var Ae=function(){function t(){this.listeners=[]}var e=t.prototype;return e.subscribe=function(n){var i=this,a=n||function(){};return this.listeners.push(a),this.onSubscribe(),function(){i.listeners=i.listeners.filter(function(s){return s!==a}),i.onUnsubscribe()}},e.hasListeners=function(){return this.listeners.length>0},e.onSubscribe=function(){},e.onUnsubscribe=function(){},t}();function w(){return w=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},w.apply(this,arguments)}var Ke=typeof window>"u";function U(){}function mi(t,e){return typeof t=="function"?t(e):t}function Nt(t){return typeof t=="number"&&t>=0&&t!==1/0}function Ge(t){return Array.isArray(t)?t:[t]}function On(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Qe(t,e,r){return $e(t)?typeof e=="function"?w({},r,{queryKey:t,queryFn:e}):w({},e,{queryKey:t}):t}function gi(t,e,r){return $e(t)?typeof e=="function"?w({},r,{mutationKey:t,mutationFn:e}):w({},e,{mutationKey:t}):typeof t=="function"?w({},e,{mutationFn:t}):w({},t)}function re(t,e,r){return $e(t)?[w({},e,{queryKey:t}),r]:[t||{},e]}function bi(t,e){if(t===!0&&e===!0||t==null&&e==null)return"all";if(t===!1&&e===!1)return"none";var r=t??!e;return r?"active":"inactive"}function Pr(t,e){var r=t.active,n=t.exact,i=t.fetching,a=t.inactive,s=t.predicate,o=t.queryKey,l=t.stale;if($e(o)){if(n){if(e.queryHash!==ar(o,e.options))return!1}else if(!We(e.queryKey,o))return!1}var f=bi(r,a);if(f==="none")return!1;if(f!=="all"){var c=e.isActive();if(f==="active"&&!c||f==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||typeof i=="boolean"&&e.isFetching()!==i||s&&!s(e))}function Er(t,e){var r=t.exact,n=t.fetching,i=t.predicate,a=t.mutationKey;if($e(a)){if(!e.options.mutationKey)return!1;if(r){if(he(e.options.mutationKey)!==he(a))return!1}else if(!We(e.options.mutationKey,a))return!1}return!(typeof n=="boolean"&&e.state.status==="loading"!==n||i&&!i(e))}function ar(t,e){var r=e?.queryKeyHashFn||he;return r(t)}function he(t){var e=Ge(t);return Si(e)}function Si(t){return JSON.stringify(t,function(e,r){return Lt(r)?Object.keys(r).sort().reduce(function(n,i){return n[i]=r[i],n},{}):r})}function We(t,e){return Pn(Ge(t),Ge(e))}function Pn(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(function(r){return!Pn(t[r],e[r])}):!1}function He(t,e){if(t===e)return t;var r=Array.isArray(t)&&Array.isArray(e);if(r||Lt(t)&&Lt(e)){for(var n=r?t.length:Object.keys(t).length,i=r?e:Object.keys(e),a=i.length,s=r?[]:{},o=0,l=0;l<a;l++){var f=r?l:i[l];s[f]=He(t[f],e[f]),s[f]===t[f]&&o++}return n===a&&o===n?t:s}return e}function wi(t,e){if(t&&!e||e&&!t)return!1;for(var r in t)if(t[r]!==e[r])return!1;return!0}function Lt(t){if(!Ar(t))return!1;var e=t.constructor;if(typeof e>"u")return!0;var r=e.prototype;return!(!Ar(r)||!r.hasOwnProperty("isPrototypeOf"))}function Ar(t){return Object.prototype.toString.call(t)==="[object Object]"}function $e(t){return typeof t=="string"||Array.isArray(t)}function Oi(t){return new Promise(function(e){setTimeout(e,t)})}function Rr(t){Promise.resolve().then(t).catch(function(e){return setTimeout(function(){throw e})})}function En(){if(typeof AbortController=="function")return new AbortController}var Pi=function(t){Ee(e,t);function e(){var n;return n=t.call(this)||this,n.setup=function(i){var a;if(!Ke&&((a=window)!=null&&a.addEventListener)){var s=function(){return i()};return window.addEventListener("visibilitychange",s,!1),window.addEventListener("focus",s,!1),function(){window.removeEventListener("visibilitychange",s),window.removeEventListener("focus",s)}}},n}var r=e.prototype;return r.onSubscribe=function(){this.cleanup||this.setEventListener(this.setup)},r.onUnsubscribe=function(){if(!this.hasListeners()){var i;(i=this.cleanup)==null||i.call(this),this.cleanup=void 0}},r.setEventListener=function(i){var a,s=this;this.setup=i,(a=this.cleanup)==null||a.call(this),this.cleanup=i(function(o){typeof o=="boolean"?s.setFocused(o):s.onFocus()})},r.setFocused=function(i){this.focused=i,i&&this.onFocus()},r.onFocus=function(){this.listeners.forEach(function(i){i()})},r.isFocused=function(){return typeof this.focused=="boolean"?this.focused:typeof document>"u"?!0:[void 0,"visible","prerender"].includes(document.visibilityState)},e}(Ae),Fe=new Pi,Ei=function(t){Ee(e,t);function e(){var n;return n=t.call(this)||this,n.setup=function(i){var a;if(!Ke&&((a=window)!=null&&a.addEventListener)){var s=function(){return i()};return window.addEventListener("online",s,!1),window.addEventListener("offline",s,!1),function(){window.removeEventListener("online",s),window.removeEventListener("offline",s)}}},n}var r=e.prototype;return r.onSubscribe=function(){this.cleanup||this.setEventListener(this.setup)},r.onUnsubscribe=function(){if(!this.hasListeners()){var i;(i=this.cleanup)==null||i.call(this),this.cleanup=void 0}},r.setEventListener=function(i){var a,s=this;this.setup=i,(a=this.cleanup)==null||a.call(this),this.cleanup=i(function(o){typeof o=="boolean"?s.setOnline(o):s.onOnline()})},r.setOnline=function(i){this.online=i,i&&this.onOnline()},r.onOnline=function(){this.listeners.forEach(function(i){i()})},r.isOnline=function(){return typeof this.online=="boolean"?this.online:typeof navigator>"u"||typeof navigator.onLine>"u"?!0:navigator.onLine},e}(Ae),ke=new Ei;function Ai(t){return Math.min(1e3*Math.pow(2,t),3e4)}function Ve(t){return typeof t?.cancel=="function"}var An=function(e){this.revert=e?.revert,this.silent=e?.silent};function Be(t){return t instanceof An}var Rn=function(e){var r=this,n=!1,i,a,s,o;this.abort=e.abort,this.cancel=function(h){return i?.(h)},this.cancelRetry=function(){n=!0},this.continueRetry=function(){n=!1},this.continue=function(){return a?.()},this.failureCount=0,this.isPaused=!1,this.isResolved=!1,this.isTransportCancelable=!1,this.promise=new Promise(function(h,d){s=h,o=d});var l=function(d){r.isResolved||(r.isResolved=!0,e.onSuccess==null||e.onSuccess(d),a?.(),s(d))},f=function(d){r.isResolved||(r.isResolved=!0,e.onError==null||e.onError(d),a?.(),o(d))},c=function(){return new Promise(function(d){a=d,r.isPaused=!0,e.onPause==null||e.onPause()}).then(function(){a=void 0,r.isPaused=!1,e.onContinue==null||e.onContinue()})},u=function h(){if(!r.isResolved){var d;try{d=e.fn()}catch(p){d=Promise.reject(p)}i=function(v){if(!r.isResolved&&(f(new An(v)),r.abort==null||r.abort(),Ve(d)))try{d.cancel()}catch{}},r.isTransportCancelable=Ve(d),Promise.resolve(d).then(l).catch(function(p){var v,m;if(!r.isResolved){var y=(v=e.retry)!=null?v:3,g=(m=e.retryDelay)!=null?m:Ai,S=typeof g=="function"?g(r.failureCount,p):g,b=y===!0||typeof y=="number"&&r.failureCount<y||typeof y=="function"&&y(r.failureCount,p);if(n||!b){f(p);return}r.failureCount++,e.onFail==null||e.onFail(r.failureCount,p),Oi(S).then(function(){if(!Fe.isFocused()||!ke.isOnline())return c()}).then(function(){n?f(p):h()})}})}};u()},Ri=function(){function t(){this.queue=[],this.transactions=0,this.notifyFn=function(r){r()},this.batchNotifyFn=function(r){r()}}var e=t.prototype;return e.batch=function(n){var i;this.transactions++;try{i=n()}finally{this.transactions--,this.transactions||this.flush()}return i},e.schedule=function(n){var i=this;this.transactions?this.queue.push(n):Rr(function(){i.notifyFn(n)})},e.batchCalls=function(n){var i=this;return function(){for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];i.schedule(function(){n.apply(void 0,s)})}},e.flush=function(){var n=this,i=this.queue;this.queue=[],i.length&&Rr(function(){n.batchNotifyFn(function(){i.forEach(function(a){n.notifyFn(a)})})})},e.setNotifyFunction=function(n){this.notifyFn=n},e.setBatchNotifyFunction=function(n){this.batchNotifyFn=n},t}(),F=new Ri,Cn=console;function Je(){return Cn}function Ci(t){Cn=t}var Fi=function(){function t(r){this.abortSignalConsumed=!1,this.hadObservers=!1,this.defaultOptions=r.defaultOptions,this.setOptions(r.options),this.observers=[],this.cache=r.cache,this.queryKey=r.queryKey,this.queryHash=r.queryHash,this.initialState=r.state||this.getDefaultState(this.options),this.state=this.initialState,this.meta=r.meta,this.scheduleGc()}var e=t.prototype;return e.setOptions=function(n){var i;this.options=w({},this.defaultOptions,n),this.meta=n?.meta,this.cacheTime=Math.max(this.cacheTime||0,(i=this.options.cacheTime)!=null?i:5*60*1e3)},e.setDefaultOptions=function(n){this.defaultOptions=n},e.scheduleGc=function(){var n=this;this.clearGcTimeout(),Nt(this.cacheTime)&&(this.gcTimeout=setTimeout(function(){n.optionalRemove()},this.cacheTime))},e.clearGcTimeout=function(){this.gcTimeout&&(clearTimeout(this.gcTimeout),this.gcTimeout=void 0)},e.optionalRemove=function(){this.observers.length||(this.state.isFetching?this.hadObservers&&this.scheduleGc():this.cache.remove(this))},e.setData=function(n,i){var a,s,o=this.state.data,l=mi(n,o);return(a=(s=this.options).isDataEqual)!=null&&a.call(s,o,l)?l=o:this.options.structuralSharing!==!1&&(l=He(o,l)),this.dispatch({data:l,type:"success",dataUpdatedAt:i?.updatedAt}),l},e.setState=function(n,i){this.dispatch({type:"setState",state:n,setStateOptions:i})},e.cancel=function(n){var i,a=this.promise;return(i=this.retryer)==null||i.cancel(n),a?a.then(U).catch(U):Promise.resolve()},e.destroy=function(){this.clearGcTimeout(),this.cancel({silent:!0})},e.reset=function(){this.destroy(),this.setState(this.initialState)},e.isActive=function(){return this.observers.some(function(n){return n.options.enabled!==!1})},e.isFetching=function(){return this.state.isFetching},e.isStale=function(){return this.state.isInvalidated||!this.state.dataUpdatedAt||this.observers.some(function(n){return n.getCurrentResult().isStale})},e.isStaleByTime=function(n){return n===void 0&&(n=0),this.state.isInvalidated||!this.state.dataUpdatedAt||!On(this.state.dataUpdatedAt,n)},e.onFocus=function(){var n,i=this.observers.find(function(a){return a.shouldFetchOnWindowFocus()});i&&i.refetch(),(n=this.retryer)==null||n.continue()},e.onOnline=function(){var n,i=this.observers.find(function(a){return a.shouldFetchOnReconnect()});i&&i.refetch(),(n=this.retryer)==null||n.continue()},e.addObserver=function(n){this.observers.indexOf(n)===-1&&(this.observers.push(n),this.hadObservers=!0,this.clearGcTimeout(),this.cache.notify({type:"observerAdded",query:this,observer:n}))},e.removeObserver=function(n){this.observers.indexOf(n)!==-1&&(this.observers=this.observers.filter(function(i){return i!==n}),this.observers.length||(this.retryer&&(this.retryer.isTransportCancelable||this.abortSignalConsumed?this.retryer.cancel({revert:!0}):this.retryer.cancelRetry()),this.cacheTime?this.scheduleGc():this.cache.remove(this)),this.cache.notify({type:"observerRemoved",query:this,observer:n}))},e.getObserversCount=function(){return this.observers.length},e.invalidate=function(){this.state.isInvalidated||this.dispatch({type:"invalidate"})},e.fetch=function(n,i){var a=this,s,o,l;if(this.state.isFetching){if(this.state.dataUpdatedAt&&i?.cancelRefetch)this.cancel({silent:!0});else if(this.promise){var f;return(f=this.retryer)==null||f.continueRetry(),this.promise}}if(n&&this.setOptions(n),!this.options.queryFn){var c=this.observers.find(function(g){return g.options.queryFn});c&&this.setOptions(c.options)}var u=Ge(this.queryKey),h=En(),d={queryKey:u,pageParam:void 0,meta:this.meta};Object.defineProperty(d,"signal",{enumerable:!0,get:function(){if(h)return a.abortSignalConsumed=!0,h.signal}});var p=function(){return a.options.queryFn?(a.abortSignalConsumed=!1,a.options.queryFn(d)):Promise.reject("Missing queryFn")},v={fetchOptions:i,options:this.options,queryKey:u,state:this.state,fetchFn:p,meta:this.meta};if((s=this.options.behavior)!=null&&s.onFetch){var m;(m=this.options.behavior)==null||m.onFetch(v)}if(this.revertState=this.state,!this.state.isFetching||this.state.fetchMeta!==((o=v.fetchOptions)==null?void 0:o.meta)){var y;this.dispatch({type:"fetch",meta:(y=v.fetchOptions)==null?void 0:y.meta})}return this.retryer=new Rn({fn:v.fetchFn,abort:h==null||(l=h.abort)==null?void 0:l.bind(h),onSuccess:function(S){a.setData(S),a.cache.config.onSuccess==null||a.cache.config.onSuccess(S,a),a.cacheTime===0&&a.optionalRemove()},onError:function(S){Be(S)&&S.silent||a.dispatch({type:"error",error:S}),Be(S)||(a.cache.config.onError==null||a.cache.config.onError(S,a),Je().error(S)),a.cacheTime===0&&a.optionalRemove()},onFail:function(){a.dispatch({type:"failed"})},onPause:function(){a.dispatch({type:"pause"})},onContinue:function(){a.dispatch({type:"continue"})},retry:v.options.retry,retryDelay:v.options.retryDelay}),this.promise=this.retryer.promise,this.promise},e.dispatch=function(n){var i=this;this.state=this.reducer(this.state,n),F.batch(function(){i.observers.forEach(function(a){a.onQueryUpdate(n)}),i.cache.notify({query:i,type:"queryUpdated",action:n})})},e.getDefaultState=function(n){var i=typeof n.initialData=="function"?n.initialData():n.initialData,a=typeof n.initialData<"u",s=a?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0,o=typeof i<"u";return{data:i,dataUpdateCount:0,dataUpdatedAt:o?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchMeta:null,isFetching:!1,isInvalidated:!1,isPaused:!1,status:o?"success":"idle"}},e.reducer=function(n,i){var a,s;switch(i.type){case"failed":return w({},n,{fetchFailureCount:n.fetchFailureCount+1});case"pause":return w({},n,{isPaused:!0});case"continue":return w({},n,{isPaused:!1});case"fetch":return w({},n,{fetchFailureCount:0,fetchMeta:(a=i.meta)!=null?a:null,isFetching:!0,isPaused:!1},!n.dataUpdatedAt&&{error:null,status:"loading"});case"success":return w({},n,{data:i.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:(s=i.dataUpdatedAt)!=null?s:Date.now(),error:null,fetchFailureCount:0,isFetching:!1,isInvalidated:!1,isPaused:!1,status:"success"});case"error":var o=i.error;return Be(o)&&o.revert&&this.revertState?w({},this.revertState):w({},n,{error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,isFetching:!1,isPaused:!1,status:"error"});case"invalidate":return w({},n,{isInvalidated:!0});case"setState":return w({},n,i.state);default:return n}},t}(),xi=function(t){Ee(e,t);function e(n){var i;return i=t.call(this)||this,i.config=n||{},i.queries=[],i.queriesMap={},i}var r=e.prototype;return r.build=function(i,a,s){var o,l=a.queryKey,f=(o=a.queryHash)!=null?o:ar(l,a),c=this.get(f);return c||(c=new Fi({cache:this,queryKey:l,queryHash:f,options:i.defaultQueryOptions(a),state:s,defaultOptions:i.getQueryDefaults(l),meta:a.meta}),this.add(c)),c},r.add=function(i){this.queriesMap[i.queryHash]||(this.queriesMap[i.queryHash]=i,this.queries.push(i),this.notify({type:"queryAdded",query:i}))},r.remove=function(i){var a=this.queriesMap[i.queryHash];a&&(i.destroy(),this.queries=this.queries.filter(function(s){return s!==i}),a===i&&delete this.queriesMap[i.queryHash],this.notify({type:"queryRemoved",query:i}))},r.clear=function(){var i=this;F.batch(function(){i.queries.forEach(function(a){i.remove(a)})})},r.get=function(i){return this.queriesMap[i]},r.getAll=function(){return this.queries},r.find=function(i,a){var s=re(i,a),o=s[0];return typeof o.exact>"u"&&(o.exact=!0),this.queries.find(function(l){return Pr(o,l)})},r.findAll=function(i,a){var s=re(i,a),o=s[0];return Object.keys(o).length>0?this.queries.filter(function(l){return Pr(o,l)}):this.queries},r.notify=function(i){var a=this;F.batch(function(){a.listeners.forEach(function(s){s(i)})})},r.onFocus=function(){var i=this;F.batch(function(){i.queries.forEach(function(a){a.onFocus()})})},r.onOnline=function(){var i=this;F.batch(function(){i.queries.forEach(function(a){a.onOnline()})})},e}(Ae),Ii=function(){function t(r){this.options=w({},r.defaultOptions,r.options),this.mutationId=r.mutationId,this.mutationCache=r.mutationCache,this.observers=[],this.state=r.state||Fn(),this.meta=r.meta}var e=t.prototype;return e.setState=function(n){this.dispatch({type:"setState",state:n})},e.addObserver=function(n){this.observers.indexOf(n)===-1&&this.observers.push(n)},e.removeObserver=function(n){this.observers=this.observers.filter(function(i){return i!==n})},e.cancel=function(){return this.retryer?(this.retryer.cancel(),this.retryer.promise.then(U).catch(U)):Promise.resolve()},e.continue=function(){return this.retryer?(this.retryer.continue(),this.retryer.promise):this.execute()},e.execute=function(){var n=this,i,a=this.state.status==="loading",s=Promise.resolve();return a||(this.dispatch({type:"loading",variables:this.options.variables}),s=s.then(function(){n.mutationCache.config.onMutate==null||n.mutationCache.config.onMutate(n.state.variables,n)}).then(function(){return n.options.onMutate==null?void 0:n.options.onMutate(n.state.variables)}).then(function(o){o!==n.state.context&&n.dispatch({type:"loading",context:o,variables:n.state.variables})})),s.then(function(){return n.executeMutation()}).then(function(o){i=o,n.mutationCache.config.onSuccess==null||n.mutationCache.config.onSuccess(i,n.state.variables,n.state.context,n)}).then(function(){return n.options.onSuccess==null?void 0:n.options.onSuccess(i,n.state.variables,n.state.context)}).then(function(){return n.options.onSettled==null?void 0:n.options.onSettled(i,null,n.state.variables,n.state.context)}).then(function(){return n.dispatch({type:"success",data:i}),i}).catch(function(o){return n.mutationCache.config.onError==null||n.mutationCache.config.onError(o,n.state.variables,n.state.context,n),Je().error(o),Promise.resolve().then(function(){return n.options.onError==null?void 0:n.options.onError(o,n.state.variables,n.state.context)}).then(function(){return n.options.onSettled==null?void 0:n.options.onSettled(void 0,o,n.state.variables,n.state.context)}).then(function(){throw n.dispatch({type:"error",error:o}),o})})},e.executeMutation=function(){var n=this,i;return this.retryer=new Rn({fn:function(){return n.options.mutationFn?n.options.mutationFn(n.state.variables):Promise.reject("No mutationFn found")},onFail:function(){n.dispatch({type:"failed"})},onPause:function(){n.dispatch({type:"pause"})},onContinue:function(){n.dispatch({type:"continue"})},retry:(i=this.options.retry)!=null?i:0,retryDelay:this.options.retryDelay}),this.retryer.promise},e.dispatch=function(n){var i=this;this.state=qi(this.state,n),F.batch(function(){i.observers.forEach(function(a){a.onMutationUpdate(n)}),i.mutationCache.notify(i)})},t}();function Fn(){return{context:void 0,data:void 0,error:null,failureCount:0,isPaused:!1,status:"idle",variables:void 0}}function qi(t,e){switch(e.type){case"failed":return w({},t,{failureCount:t.failureCount+1});case"pause":return w({},t,{isPaused:!0});case"continue":return w({},t,{isPaused:!1});case"loading":return w({},t,{context:e.context,data:void 0,error:null,isPaused:!1,status:"loading",variables:e.variables});case"success":return w({},t,{data:e.data,error:null,status:"success",isPaused:!1});case"error":return w({},t,{data:void 0,error:e.error,failureCount:t.failureCount+1,isPaused:!1,status:"error"});case"setState":return w({},t,e.state);default:return t}}var _i=function(t){Ee(e,t);function e(n){var i;return i=t.call(this)||this,i.config=n||{},i.mutations=[],i.mutationId=0,i}var r=e.prototype;return r.build=function(i,a,s){var o=new Ii({mutationCache:this,mutationId:++this.mutationId,options:i.defaultMutationOptions(a),state:s,defaultOptions:a.mutationKey?i.getMutationDefaults(a.mutationKey):void 0,meta:a.meta});return this.add(o),o},r.add=function(i){this.mutations.push(i),this.notify(i)},r.remove=function(i){this.mutations=this.mutations.filter(function(a){return a!==i}),i.cancel(),this.notify(i)},r.clear=function(){var i=this;F.batch(function(){i.mutations.forEach(function(a){i.remove(a)})})},r.getAll=function(){return this.mutations},r.find=function(i){return typeof i.exact>"u"&&(i.exact=!0),this.mutations.find(function(a){return Er(i,a)})},r.findAll=function(i){return this.mutations.filter(function(a){return Er(i,a)})},r.notify=function(i){var a=this;F.batch(function(){a.listeners.forEach(function(s){s(i)})})},r.onFocus=function(){this.resumePausedMutations()},r.onOnline=function(){this.resumePausedMutations()},r.resumePausedMutations=function(){var i=this.mutations.filter(function(a){return a.state.isPaused});return F.batch(function(){return i.reduce(function(a,s){return a.then(function(){return s.continue().catch(U)})},Promise.resolve())})},e}(Ae);function $i(){return{onFetch:function(e){e.fetchFn=function(){var r,n,i,a,s,o,l=(r=e.fetchOptions)==null||(n=r.meta)==null?void 0:n.refetchPage,f=(i=e.fetchOptions)==null||(a=i.meta)==null?void 0:a.fetchMore,c=f?.pageParam,u=f?.direction==="forward",h=f?.direction==="backward",d=((s=e.state.data)==null?void 0:s.pages)||[],p=((o=e.state.data)==null?void 0:o.pageParams)||[],v=En(),m=v?.signal,y=p,g=!1,S=e.options.queryFn||function(){return Promise.reject("Missing queryFn")},b=function(q,k,B,oe){return y=oe?[k].concat(y):[].concat(y,[k]),oe?[B].concat(q):[].concat(q,[B])},C=function(q,k,B,oe){if(g)return Promise.reject("Cancelled");if(typeof B>"u"&&!k&&q.length)return Promise.resolve(q);var H={queryKey:e.queryKey,signal:m,pageParam:B,meta:e.meta},V=S(H),Te=Promise.resolve(V).then(function(yi){return b(q,B,yi,oe)});if(Ve(V)){var ot=Te;ot.cancel=V.cancel}return Te},P;if(!d.length)P=C([]);else if(u){var _=typeof c<"u",W=_?c:Cr(e.options,d);P=C(d,_,W)}else if(h){var Q=typeof c<"u",R=Q?c:Mi(e.options,d);P=C(d,Q,R,!0)}else(function(){y=[];var $=typeof e.options.getNextPageParam>"u",q=l&&d[0]?l(d[0],0,d):!0;P=q?C([],$,p[0]):Promise.resolve(b([],p[0],d[0]));for(var k=function(H){P=P.then(function(V){var Te=l&&d[H]?l(d[H],H,d):!0;if(Te){var ot=$?p[H]:Cr(e.options,V);return C(V,$,ot)}return Promise.resolve(b(V,p[H],d[H]))})},B=1;B<d.length;B++)k(B)})();var M=P.then(function($){return{pages:$,pageParams:y}}),x=M;return x.cancel=function(){g=!0,v?.abort(),Ve(P)&&P.cancel()},M}}}}function Cr(t,e){return t.getNextPageParam==null?void 0:t.getNextPageParam(e[e.length-1],e)}function Mi(t,e){return t.getPreviousPageParam==null?void 0:t.getPreviousPageParam(e[0],e)}var Di=function(){function t(r){r===void 0&&(r={}),this.queryCache=r.queryCache||new xi,this.mutationCache=r.mutationCache||new _i,this.defaultOptions=r.defaultOptions||{},this.queryDefaults=[],this.mutationDefaults=[]}var e=t.prototype;return e.mount=function(){var n=this;this.unsubscribeFocus=Fe.subscribe(function(){Fe.isFocused()&&ke.isOnline()&&(n.mutationCache.onFocus(),n.queryCache.onFocus())}),this.unsubscribeOnline=ke.subscribe(function(){Fe.isFocused()&&ke.isOnline()&&(n.mutationCache.onOnline(),n.queryCache.onOnline())})},e.unmount=function(){var n,i;(n=this.unsubscribeFocus)==null||n.call(this),(i=this.unsubscribeOnline)==null||i.call(this)},e.isFetching=function(n,i){var a=re(n,i),s=a[0];return s.fetching=!0,this.queryCache.findAll(s).length},e.isMutating=function(n){return this.mutationCache.findAll(w({},n,{fetching:!0})).length},e.getQueryData=function(n,i){var a;return(a=this.queryCache.find(n,i))==null?void 0:a.state.data},e.getQueriesData=function(n){return this.getQueryCache().findAll(n).map(function(i){var a=i.queryKey,s=i.state,o=s.data;return[a,o]})},e.setQueryData=function(n,i,a){var s=Qe(n),o=this.defaultQueryOptions(s);return this.queryCache.build(this,o).setData(i,a)},e.setQueriesData=function(n,i,a){var s=this;return F.batch(function(){return s.getQueryCache().findAll(n).map(function(o){var l=o.queryKey;return[l,s.setQueryData(l,i,a)]})})},e.getQueryState=function(n,i){var a;return(a=this.queryCache.find(n,i))==null?void 0:a.state},e.removeQueries=function(n,i){var a=re(n,i),s=a[0],o=this.queryCache;F.batch(function(){o.findAll(s).forEach(function(l){o.remove(l)})})},e.resetQueries=function(n,i,a){var s=this,o=re(n,i,a),l=o[0],f=o[1],c=this.queryCache,u=w({},l,{active:!0});return F.batch(function(){return c.findAll(l).forEach(function(h){h.reset()}),s.refetchQueries(u,f)})},e.cancelQueries=function(n,i,a){var s=this,o=re(n,i,a),l=o[0],f=o[1],c=f===void 0?{}:f;typeof c.revert>"u"&&(c.revert=!0);var u=F.batch(function(){return s.queryCache.findAll(l).map(function(h){return h.cancel(c)})});return Promise.all(u).then(U).catch(U)},e.invalidateQueries=function(n,i,a){var s,o,l,f=this,c=re(n,i,a),u=c[0],h=c[1],d=w({},u,{active:(s=(o=u.refetchActive)!=null?o:u.active)!=null?s:!0,inactive:(l=u.refetchInactive)!=null?l:!1});return F.batch(function(){return f.queryCache.findAll(u).forEach(function(p){p.invalidate()}),f.refetchQueries(d,h)})},e.refetchQueries=function(n,i,a){var s=this,o=re(n,i,a),l=o[0],f=o[1],c=F.batch(function(){return s.queryCache.findAll(l).map(function(h){return h.fetch(void 0,w({},f,{meta:{refetchPage:l?.refetchPage}}))})}),u=Promise.all(c).then(U);return f?.throwOnError||(u=u.catch(U)),u},e.fetchQuery=function(n,i,a){var s=Qe(n,i,a),o=this.defaultQueryOptions(s);typeof o.retry>"u"&&(o.retry=!1);var l=this.queryCache.build(this,o);return l.isStaleByTime(o.staleTime)?l.fetch(o):Promise.resolve(l.state.data)},e.prefetchQuery=function(n,i,a){return this.fetchQuery(n,i,a).then(U).catch(U)},e.fetchInfiniteQuery=function(n,i,a){var s=Qe(n,i,a);return s.behavior=$i(),this.fetchQuery(s)},e.prefetchInfiniteQuery=function(n,i,a){return this.fetchInfiniteQuery(n,i,a).then(U).catch(U)},e.cancelMutations=function(){var n=this,i=F.batch(function(){return n.mutationCache.getAll().map(function(a){return a.cancel()})});return Promise.all(i).then(U).catch(U)},e.resumePausedMutations=function(){return this.getMutationCache().resumePausedMutations()},e.executeMutation=function(n){return this.mutationCache.build(this,n).execute()},e.getQueryCache=function(){return this.queryCache},e.getMutationCache=function(){return this.mutationCache},e.getDefaultOptions=function(){return this.defaultOptions},e.setDefaultOptions=function(n){this.defaultOptions=n},e.setQueryDefaults=function(n,i){var a=this.queryDefaults.find(function(s){return he(n)===he(s.queryKey)});a?a.defaultOptions=i:this.queryDefaults.push({queryKey:n,defaultOptions:i})},e.getQueryDefaults=function(n){var i;return n?(i=this.queryDefaults.find(function(a){return We(n,a.queryKey)}))==null?void 0:i.defaultOptions:void 0},e.setMutationDefaults=function(n,i){var a=this.mutationDefaults.find(function(s){return he(n)===he(s.mutationKey)});a?a.defaultOptions=i:this.mutationDefaults.push({mutationKey:n,defaultOptions:i})},e.getMutationDefaults=function(n){var i;return n?(i=this.mutationDefaults.find(function(a){return We(n,a.mutationKey)}))==null?void 0:i.defaultOptions:void 0},e.defaultQueryOptions=function(n){if(n?._defaulted)return n;var i=w({},this.defaultOptions.queries,this.getQueryDefaults(n?.queryKey),n,{_defaulted:!0});return!i.queryHash&&i.queryKey&&(i.queryHash=ar(i.queryKey,i)),i},e.defaultQueryObserverOptions=function(n){return this.defaultQueryOptions(n)},e.defaultMutationOptions=function(n){return n?._defaulted?n:w({},this.defaultOptions.mutations,this.getMutationDefaults(n?.mutationKey),n,{_defaulted:!0})},e.clear=function(){this.queryCache.clear(),this.mutationCache.clear()},t}(),Ti=function(t){Ee(e,t);function e(n,i){var a;return a=t.call(this)||this,a.client=n,a.options=i,a.trackedProps=[],a.selectError=null,a.bindMethods(),a.setOptions(i),a}var r=e.prototype;return r.bindMethods=function(){this.remove=this.remove.bind(this),this.refetch=this.refetch.bind(this)},r.onSubscribe=function(){this.listeners.length===1&&(this.currentQuery.addObserver(this),Fr(this.currentQuery,this.options)&&this.executeFetch(),this.updateTimers())},r.onUnsubscribe=function(){this.listeners.length||this.destroy()},r.shouldFetchOnReconnect=function(){return Qt(this.currentQuery,this.options,this.options.refetchOnReconnect)},r.shouldFetchOnWindowFocus=function(){return Qt(this.currentQuery,this.options,this.options.refetchOnWindowFocus)},r.destroy=function(){this.listeners=[],this.clearTimers(),this.currentQuery.removeObserver(this)},r.setOptions=function(i,a){var s=this.options,o=this.currentQuery;if(this.options=this.client.defaultQueryObserverOptions(i),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=s.queryKey),this.updateQuery();var l=this.hasListeners();l&&xr(this.currentQuery,o,this.options,s)&&this.executeFetch(),this.updateResult(a),l&&(this.currentQuery!==o||this.options.enabled!==s.enabled||this.options.staleTime!==s.staleTime)&&this.updateStaleTimeout();var f=this.computeRefetchInterval();l&&(this.currentQuery!==o||this.options.enabled!==s.enabled||f!==this.currentRefetchInterval)&&this.updateRefetchInterval(f)},r.getOptimisticResult=function(i){var a=this.client.defaultQueryObserverOptions(i),s=this.client.getQueryCache().build(this.client,a);return this.createResult(s,a)},r.getCurrentResult=function(){return this.currentResult},r.trackResult=function(i,a){var s=this,o={},l=function(c){s.trackedProps.includes(c)||s.trackedProps.push(c)};return Object.keys(i).forEach(function(f){Object.defineProperty(o,f,{configurable:!1,enumerable:!0,get:function(){return l(f),i[f]}})}),(a.useErrorBoundary||a.suspense)&&l("error"),o},r.getNextResult=function(i){var a=this;return new Promise(function(s,o){var l=a.subscribe(function(f){f.isFetching||(l(),f.isError&&i?.throwOnError?o(f.error):s(f))})})},r.getCurrentQuery=function(){return this.currentQuery},r.remove=function(){this.client.getQueryCache().remove(this.currentQuery)},r.refetch=function(i){return this.fetch(w({},i,{meta:{refetchPage:i?.refetchPage}}))},r.fetchOptimistic=function(i){var a=this,s=this.client.defaultQueryObserverOptions(i),o=this.client.getQueryCache().build(this.client,s);return o.fetch().then(function(){return a.createResult(o,s)})},r.fetch=function(i){var a=this;return this.executeFetch(i).then(function(){return a.updateResult(),a.currentResult})},r.executeFetch=function(i){this.updateQuery();var a=this.currentQuery.fetch(this.options,i);return i?.throwOnError||(a=a.catch(U)),a},r.updateStaleTimeout=function(){var i=this;if(this.clearStaleTimeout(),!(Ke||this.currentResult.isStale||!Nt(this.options.staleTime))){var a=On(this.currentResult.dataUpdatedAt,this.options.staleTime),s=a+1;this.staleTimeoutId=setTimeout(function(){i.currentResult.isStale||i.updateResult()},s)}},r.computeRefetchInterval=function(){var i;return typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.currentResult.data,this.currentQuery):(i=this.options.refetchInterval)!=null?i:!1},r.updateRefetchInterval=function(i){var a=this;this.clearRefetchInterval(),this.currentRefetchInterval=i,!(Ke||this.options.enabled===!1||!Nt(this.currentRefetchInterval)||this.currentRefetchInterval===0)&&(this.refetchIntervalId=setInterval(function(){(a.options.refetchIntervalInBackground||Fe.isFocused())&&a.executeFetch()},this.currentRefetchInterval))},r.updateTimers=function(){this.updateStaleTimeout(),this.updateRefetchInterval(this.computeRefetchInterval())},r.clearTimers=function(){this.clearStaleTimeout(),this.clearRefetchInterval()},r.clearStaleTimeout=function(){this.staleTimeoutId&&(clearTimeout(this.staleTimeoutId),this.staleTimeoutId=void 0)},r.clearRefetchInterval=function(){this.refetchIntervalId&&(clearInterval(this.refetchIntervalId),this.refetchIntervalId=void 0)},r.createResult=function(i,a){var s=this.currentQuery,o=this.options,l=this.currentResult,f=this.currentResultState,c=this.currentResultOptions,u=i!==s,h=u?i.state:this.currentQueryInitialState,d=u?this.currentResult:this.previousQueryResult,p=i.state,v=p.dataUpdatedAt,m=p.error,y=p.errorUpdatedAt,g=p.isFetching,S=p.status,b=!1,C=!1,P;if(a.optimisticResults){var _=this.hasListeners(),W=!_&&Fr(i,a),Q=_&&xr(i,s,a,o);(W||Q)&&(g=!0,v||(S="loading"))}if(a.keepPreviousData&&!p.dataUpdateCount&&d?.isSuccess&&S!=="error")P=d.data,v=d.dataUpdatedAt,S=d.status,b=!0;else if(a.select&&typeof p.data<"u")if(l&&p.data===f?.data&&a.select===this.selectFn)P=this.selectResult;else try{this.selectFn=a.select,P=a.select(p.data),a.structuralSharing!==!1&&(P=He(l?.data,P)),this.selectResult=P,this.selectError=null}catch(x){Je().error(x),this.selectError=x}else P=p.data;if(typeof a.placeholderData<"u"&&typeof P>"u"&&(S==="loading"||S==="idle")){var R;if(l?.isPlaceholderData&&a.placeholderData===c?.placeholderData)R=l.data;else if(R=typeof a.placeholderData=="function"?a.placeholderData():a.placeholderData,a.select&&typeof R<"u")try{R=a.select(R),a.structuralSharing!==!1&&(R=He(l?.data,R)),this.selectError=null}catch(x){Je().error(x),this.selectError=x}typeof R<"u"&&(S="success",P=R,C=!0)}this.selectError&&(m=this.selectError,P=this.selectResult,y=Date.now(),S="error");var M={status:S,isLoading:S==="loading",isSuccess:S==="success",isError:S==="error",isIdle:S==="idle",data:P,dataUpdatedAt:v,error:m,errorUpdatedAt:y,failureCount:p.fetchFailureCount,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>h.dataUpdateCount||p.errorUpdateCount>h.errorUpdateCount,isFetching:g,isRefetching:g&&S!=="loading",isLoadingError:S==="error"&&p.dataUpdatedAt===0,isPlaceholderData:C,isPreviousData:b,isRefetchError:S==="error"&&p.dataUpdatedAt!==0,isStale:sr(i,a),refetch:this.refetch,remove:this.remove};return M},r.shouldNotifyListeners=function(i,a){if(!a)return!0;var s=this.options,o=s.notifyOnChangeProps,l=s.notifyOnChangePropsExclusions;if(!o&&!l||o==="tracked"&&!this.trackedProps.length)return!0;var f=o==="tracked"?this.trackedProps:o;return Object.keys(i).some(function(c){var u=c,h=i[u]!==a[u],d=f?.some(function(v){return v===c}),p=l?.some(function(v){return v===c});return h&&!p&&(!f||d)})},r.updateResult=function(i){var a=this.currentResult;if(this.currentResult=this.createResult(this.currentQuery,this.options),this.currentResultState=this.currentQuery.state,this.currentResultOptions=this.options,!wi(this.currentResult,a)){var s={cache:!0};i?.listeners!==!1&&this.shouldNotifyListeners(this.currentResult,a)&&(s.listeners=!0),this.notify(w({},s,i))}},r.updateQuery=function(){var i=this.client.getQueryCache().build(this.client,this.options);if(i!==this.currentQuery){var a=this.currentQuery;this.currentQuery=i,this.currentQueryInitialState=i.state,this.previousQueryResult=this.currentResult,this.hasListeners()&&(a?.removeObserver(this),i.addObserver(this))}},r.onQueryUpdate=function(i){var a={};i.type==="success"?a.onSuccess=!0:i.type==="error"&&!Be(i.error)&&(a.onError=!0),this.updateResult(a),this.hasListeners()&&this.updateTimers()},r.notify=function(i){var a=this;F.batch(function(){i.onSuccess?(a.options.onSuccess==null||a.options.onSuccess(a.currentResult.data),a.options.onSettled==null||a.options.onSettled(a.currentResult.data,null)):i.onError&&(a.options.onError==null||a.options.onError(a.currentResult.error),a.options.onSettled==null||a.options.onSettled(void 0,a.currentResult.error)),i.listeners&&a.listeners.forEach(function(s){s(a.currentResult)}),i.cache&&a.client.getQueryCache().notify({query:a.currentQuery,type:"observerResultsUpdated"})})},e}(Ae);function Ui(t,e){return e.enabled!==!1&&!t.state.dataUpdatedAt&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Fr(t,e){return Ui(t,e)||t.state.dataUpdatedAt>0&&Qt(t,e,e.refetchOnMount)}function Qt(t,e,r){if(e.enabled!==!1){var n=typeof r=="function"?r(t):r;return n==="always"||n!==!1&&sr(t,e)}return!1}function xr(t,e,r,n){return r.enabled!==!1&&(t!==e||n.enabled===!1)&&(!r.suspense||t.state.status!=="error")&&sr(t,r)}function sr(t,e){return t.isStaleByTime(e.staleTime)}var Ni=function(t){Ee(e,t);function e(n,i){var a;return a=t.call(this)||this,a.client=n,a.setOptions(i),a.bindMethods(),a.updateResult(),a}var r=e.prototype;return r.bindMethods=function(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)},r.setOptions=function(i){this.options=this.client.defaultMutationOptions(i)},r.onUnsubscribe=function(){if(!this.listeners.length){var i;(i=this.currentMutation)==null||i.removeObserver(this)}},r.onMutationUpdate=function(i){this.updateResult();var a={listeners:!0};i.type==="success"?a.onSuccess=!0:i.type==="error"&&(a.onError=!0),this.notify(a)},r.getCurrentResult=function(){return this.currentResult},r.reset=function(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})},r.mutate=function(i,a){return this.mutateOptions=a,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,w({},this.options,{variables:typeof i<"u"?i:this.options.variables})),this.currentMutation.addObserver(this),this.currentMutation.execute()},r.updateResult=function(){var i=this.currentMutation?this.currentMutation.state:Fn(),a=w({},i,{isLoading:i.status==="loading",isSuccess:i.status==="success",isError:i.status==="error",isIdle:i.status==="idle",mutate:this.mutate,reset:this.reset});this.currentResult=a},r.notify=function(i){var a=this;F.batch(function(){a.mutateOptions&&(i.onSuccess?(a.mutateOptions.onSuccess==null||a.mutateOptions.onSuccess(a.currentResult.data,a.currentResult.variables,a.currentResult.context),a.mutateOptions.onSettled==null||a.mutateOptions.onSettled(a.currentResult.data,null,a.currentResult.variables,a.currentResult.context)):i.onError&&(a.mutateOptions.onError==null||a.mutateOptions.onError(a.currentResult.error,a.currentResult.variables,a.currentResult.context),a.mutateOptions.onSettled==null||a.mutateOptions.onSettled(void 0,a.currentResult.error,a.currentResult.variables,a.currentResult.context))),i.listeners&&a.listeners.forEach(function(s){s(a.currentResult)})})},e}(Ae),Li=vi.unstable_batchedUpdates;F.setBatchNotifyFunction(Li);var Qi=console;Ci(Qi);var Ir=I.createContext(void 0),xn=I.createContext(!1);function In(t){return t&&typeof window<"u"?(window.ReactQueryClientContext||(window.ReactQueryClientContext=Ir),window.ReactQueryClientContext):Ir}var or=function(){var e=I.useContext(In(I.useContext(xn)));if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},ki=function(e){var r=e.client,n=e.contextSharing,i=n===void 0?!1:n,a=e.children;I.useEffect(function(){return r.mount(),function(){r.unmount()}},[r]);var s=In(i);return I.createElement(xn.Provider,{value:i},I.createElement(s.Provider,{value:r},a))};function Bi(){var t=!1;return{clearReset:function(){t=!1},reset:function(){t=!0},isReset:function(){return t}}}var ji=I.createContext(Bi()),zi=function(){return I.useContext(ji)};function qn(t,e,r){return typeof e=="function"?e.apply(void 0,r):typeof e=="boolean"?e:!!t}function L(t,e,r){var n=I.useRef(!1),i=I.useState(0),a=i[1],s=gi(t,e,r),o=or(),l=I.useRef();l.current?l.current.setOptions(s):l.current=new Ni(o,s);var f=l.current.getCurrentResult();I.useEffect(function(){n.current=!0;var u=l.current.subscribe(F.batchCalls(function(){n.current&&a(function(h){return h+1})}));return function(){n.current=!1,u()}},[]);var c=I.useCallback(function(u,h){l.current.mutate(u,h).catch(U)},[]);if(f.error&&qn(void 0,l.current.options.useErrorBoundary,[f.error]))throw f.error;return w({},f,{mutate:c,mutateAsync:f.mutate})}function Ki(t,e){var r=I.useRef(!1),n=I.useState(0),i=n[1],a=or(),s=zi(),o=a.defaultQueryObserverOptions(t);o.optimisticResults=!0,o.onError&&(o.onError=F.batchCalls(o.onError)),o.onSuccess&&(o.onSuccess=F.batchCalls(o.onSuccess)),o.onSettled&&(o.onSettled=F.batchCalls(o.onSettled)),o.suspense&&(typeof o.staleTime!="number"&&(o.staleTime=1e3),o.cacheTime===0&&(o.cacheTime=1)),(o.suspense||o.useErrorBoundary)&&(s.isReset()||(o.retryOnMount=!1));var l=I.useState(function(){return new e(a,o)}),f=l[0],c=f.getOptimisticResult(o);if(I.useEffect(function(){r.current=!0,s.clearReset();var u=f.subscribe(F.batchCalls(function(){r.current&&i(function(h){return h+1})}));return f.updateResult(),function(){r.current=!1,u()}},[s,f]),I.useEffect(function(){f.setOptions(o,{listeners:!1})},[o,f]),o.suspense&&c.isLoading)throw f.fetchOptimistic(o).then(function(u){var h=u.data;o.onSuccess==null||o.onSuccess(h),o.onSettled==null||o.onSettled(h,null)}).catch(function(u){s.clearReset(),o.onError==null||o.onError(u),o.onSettled==null||o.onSettled(void 0,u)});if(c.isError&&!s.isReset()&&!c.isFetching&&qn(o.suspense,o.useErrorBoundary,[c.error,f.getCurrentQuery()]))throw c.error;return o.notifyOnChangeProps==="tracked"&&(c=f.trackResult(c,o)),c}function z(t,e,r){var n=Qe(t,e,r);return Ki(n,Ti)}const _n=t=>new Promise(e=>{setTimeout(()=>e(!0),t)}),E=t=>t.forEach(console.log);var kt={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},ur={};function ct(t){return typeof t=="string"?kt[t.toLowerCase()]:t}function Bt(t,e){return Bt=Object.setPrototypeOf||function(r,n){return r.__proto__=n,r},Bt(t,e)}function Gi(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function jt(t,e,r){return jt=Gi()?Reflect.construct:function(n,i,a){var s=[null];s.push.apply(s,i);var o=new(Function.bind.apply(n,s));return a&&Bt(o,a.prototype),o},jt.apply(null,arguments)}function le(t){if(t==null)return t;if(Array.isArray(t))return t.slice();if(typeof t=="object"){var e={};return Object.keys(t).forEach(function(r){e[r]=t[r]}),e}return t}function zt(t){return t===void 0?"undefined":t===null?"null":Array.isArray(t)?"[ "+t.map(function(e){return zt(e)}).join(", ")+" ]":typeof t=="object"?JSON.stringify(t):typeof t=="function"?"[Function: "+t.name+"]":typeof t=="boolean"||typeof t=="number"?t:"'"+t.toString()+"'"}function ue(t){if(typeof t!="string"){for(var e=new Array(arguments.length),r=0;r<arguments.length;r++)e[r]=zt(arguments[r]);return e.join(" ")}for(var n=/%[sdj%]/g,i=1,a=arguments,s=a.length,o=String(t).replace(n,function(f){if(f==="%%")return"%";if(i>=s)return f;switch(f){case"%s":return String(a[i++]);case"%d":return Number(a[i++]);case"%j":try{return JSON.stringify(a[i++])}catch{return"[Circular]"}default:return f}}),l=a[i];i<s;l=a[++i])o+=l===null||typeof l!="object"?" "+l:" "+zt(l);return o}function Wi(t,e){var r=t.split(`
|
|
2
|
+
`);r[0]&&r[0].indexOf("call-stack-error")>=0&&r.shift();var n=r[e],i=null;if(n){var a=/^\s*(at|.*@)\s*(.+)?$/.exec(n);i=Array.isArray(a)&&a[2]?a[2]:n}return i}Object.keys(kt).forEach(function(t){ur[kt[t]]=t});var Kt={};function Gt(t,e){if(e){if(Kt[e])return;Kt[e]=!0}console.error(t+`
|
|
3
|
+
`)}function Hi(t){return Kt[t]}function Vi(){var t=[];return function(e,r){return r&&typeof r=="object"?t.indexOf(r)!==-1?"[Circular]":(t.push(r),r):r}}var Ji=function(){function t(){}return t.prototype.write=function(e){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)},t}(),ce=function(){function t(r,n,i){var a,s,o,l,f=this;if(!(this instanceof t))return new t(r,n);if(n!==void 0&&(a=r,r=n,!(a instanceof t)))throw new TypeError("invalid Logger creation: do not pass a second arg");if(!r)throw new TypeError("options (object) is required");if(a){if(r.name)throw new TypeError("invalid options.name: child cannot set logger name")}else if(!r.name)throw new TypeError("options.name (string) is required");if(r.stream&&r.streams)throw new TypeError('cannot mix "streams" and "stream" options');if(r.streams&&!Array.isArray(r.streams))throw new TypeError("invalid options.streams: must be an array");if(r.serializers&&(typeof r.serializers!="object"||Array.isArray(r.serializers)))throw new TypeError("invalid options.serializers: must be an object");if(a&&i){this._level=a._level,this.streams=a.streams,this.serializers=a.serializers,this.src=a.src,s=this.fields={};var c=Object.keys(a.fields);for(l=0;l<c.length;l++)s[o=c[l]]=a.fields[o];var u=Object.keys(r);for(l=0;l<u.length;l++)s[o=u[l]]=r[o]}else{if(a){for(this._level=a._level,this.streams=[],l=0;l<a.streams.length;l++){var h=le(a.streams[l]);this.streams.push(h)}this.serializers=le(a.serializers),this.src=a.src,this.fields=le(a.fields),r.level&&this.level(r.level)}else this._level=Number.POSITIVE_INFINITY,this.streams=[],this.serializers=null,this.src=!1,this.fields={};r.stream?this.addStream({type:"stream",stream:r.stream,level:r.level}):r.streams?r.streams.forEach(function(d){f.addStream(d,r.level)}):a&&r.level?this.level(r.level):a||this.addStream({type:"raw",stream:new Ji,level:r.level}),r.serializers&&this.addSerializers(r.serializers),r.src&&(this.src=!0),delete(s=le(r)).stream,delete s.level,delete s.streams,delete s.serializers,delete s.src,this.serializers&&this._applySerializers(s),Object.keys(s).forEach(function(d){f.fields[d]=s[d]})}}var e=t.prototype;return e.addStream=function(r,n){n===void 0&&(n=30),(r=le(r)).type="raw",r.level=ct(r.level||n),r.level<this._level&&(this._level=r.level),this.streams.push(r),delete this.haveNonRawStreams},e.addSerializers=function(r){var n=this;this.serializers||(this.serializers={}),Object.keys(r).forEach(function(i){var a=r[i];if(typeof a!="function")throw new TypeError(ue('invalid serializer for "%s" field: must be a function',i));n.serializers[i]=a})},e.child=function(r,n){return new this.constructor(this,r||{},n)},e.level=function(r){if(r===void 0)return this._level;for(var n=ct(r),i=this.streams.length,a=0;a<i;a++)this.streams[a].level=n;this._level=n},e.levels=function(r,n){if(r===void 0)return this.streams.map(function(f){return f.level});var i;if(typeof r=="number"){if((i=this.streams[r])===void 0)throw new Error("invalid stream index: "+r)}else{for(var a=this.streams.length,s=0;s<a;s++){var o=this.streams[s];if(o.name===r){i=o;break}}if(!i)throw new Error(ue('no stream with name "%s"',r))}if(n===void 0)return i.level;var l=ct(n);i.level=l,l<this._level&&(this._level=l)},e._applySerializers=function(r,n){var i=this;Object.keys(this.serializers).forEach(function(a){if(!(r[a]===void 0||n&&n[a]))try{r[a]=i.serializers[a](r[a])}catch(s){Gt(ue(`bunyan: ERROR: Exception thrown from the "%s" Bunyan serializer. This should never happen. This is a bugin that serializer function.
|
|
4
|
+
%s`,a,s.stack||s)),r[a]=ue('(Error in Bunyan log "%s" serializer broke field. See stderr for details.)',a)}})},e._emit=function(r,n){var i,a;if(this.haveNonRawStreams===void 0){for(this.haveNonRawStreams=!1,i=0;i<this.streams.length;i++)if(!this.streams[i].raw){this.haveNonRawStreams=!0;break}}if(n||this.haveNonRawStreams)try{a=JSON.stringify(r,Vi())+`
|
|
5
|
+
`}catch(f){var s=f.stack.split(/\n/g,2).join(`
|
|
6
|
+
`);Gt('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(c,u){return u||(u=" "),u+c.split(/\r?\n/g).join(`
|
|
7
|
+
`+u)}(ue(`%s
|
|
8
|
+
%s`,r,f.stack)),s),a=ue(`(Exception in JSON.stringify(rec): %j. See stderr for details.)
|
|
9
|
+
`,f.message)}if(n)return a;var o=r.level;for(i=0;i<this.streams.length;i++){var l=this.streams[i];l.level<=o&&l.stream.write(r)}return a},t}();function ye(t){return function(){var e=this;function r(s){var o;s[0]instanceof Error?(n={err:e.serializers&&e.serializers.err?e.serializers.err(s[0]):cr.err(s[0])},o={err:!0},i=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,i=Array.prototype.slice.call(s)):(n=s[0],i=s.length===1&&n.err&&n.err instanceof Error?[n.err.message]:Array.prototype.slice.call(s,1));var l=le(e.fields);l.level=t;var f=n?le(n):null;if(f&&(e.serializers&&e._applySerializers(f,o),Object.keys(f).forEach(function(u){l[u]=f[u]})),l.levelName=ur[t],l.msg=i.length?ue.apply(e,i):"",l.time||(l.time=new Date),e.src&&!l.src)try{throw new Error("call-stack-error")}catch(u){var c=u.stack?Wi(u.stack,2):"";c||Hi("src")||Gt("Unable to determine src line info","src"),l.src=c||""}return l.v=1,l}var n=null,i=arguments,a=null;if(arguments.length===0)return this._level<=t;this._level>t||(a=r(i),this._emit(a))}}function $n(t){var e=t.stack||t.toString();if(t.cause&&typeof t.cause=="function"){var r=t.cause();r&&(e+=`
|
|
10
|
+
Caused by: `+$n(r))}return e}ce.prototype.trace=ye(10),ce.prototype.debug=ye(20),ce.prototype.info=ye(30),ce.prototype.warn=ye(40),ce.prototype.error=ye(50),ce.prototype.fatal=ye(60);var cr={err:function(t){return t&&t.stack?{message:t.message,name:t.name,stack:$n(t),code:t.code,signal:t.signal}:t}};function Mn(){return jt(ce,[].slice.call(arguments))}var qr={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"},Dn=function(){function t(e){var r=e===void 0?{}:e,n=r.logByLevel,i=r.css,a=i===void 0?qr:i;this.logByLevel=n!==void 0&&n,this.css=a}return t.prototype.write=function(e){var r,n,i=this.css.def,a=this.css.msg,s=this.css.src,o=e.childName?e.name+"/"+e.childName:e.name,l=ur[e.level],f=(Array(6-l.length).join(" ")+l).toUpperCase();this.logByLevel?(e.level===10?l="debug":e.level===60&&(l="error"),n=typeof console[l]=="function"?console[l]:console.log):n=console.log,r=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;var c=function(h,d){return Array(d+1-(h+"").length).join("0")+h},u=[];u.push("[%s:%s:%s:%s] %c%s%c: %s: %c%s "+(e.src?"%c%s":"")),u.push(c(e.time.getHours(),2)),u.push(c(e.time.getMinutes(),2)),u.push(c(e.time.getSeconds(),2)),u.push(c(e.time.getMilliseconds(),4)),u.push(r),u.push(f),u.push(i),u.push(o),u.push(a),u.push(e.msg),e.src&&(u.push(s),u.push(e.src)),e.obj&&(u.push(`
|
|
11
|
+
`),u.push(e.obj)),e.err&&e.err.stack&&(u.push(`
|
|
12
|
+
`),u.push(e.err.stack)),n.apply(console,u)},t.getDefaultCss=function(){return qr},t}();const Xi=Mn({name:"shipengine",serializers:{...cr,req:t=>({headers:t.headers,method:t.method,url:t.url}),res:t=>({data:t.data,headers:t.config.headers,method:t.config.method,statusCode:t.status,url:t.config.url})},streams:[{stream:new Dn}]}),Tn=(t,e=10,r=1e3)=>Promise.resolve().then(t).catch(function n(i){if(e-=1,e>0)return _n(r).then(t).catch(n);throw i});class te{constructor(e,r){this.errorCode=r?.errorCode??"unknown",this.errorSource=r?.errorSource??"client",this.errorType=r?.errorType??"unknown",this.message=e}static fromObject({message:e,...r}){return new te(e,r)}}class Yi{constructor(e){this.client=e,this.getAccountSettings=()=>this.client.get("/v1/account/settings"),this.client=e}}class Zi{constructor(e){this.client=e,this.validate=r=>this.client.post("/v1/addresses/validate",r),this.parse=(r,n)=>this.client.put("/v1/addresses/recognize",{address:n,text:r}),this.client=e}}var Un=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ea(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ta(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){if(this instanceof n){var i=[null];i.push.apply(i,arguments);var a=Function.bind.apply(e,i);return new a}return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Wt={},ra={get exports(){return Wt},set exports(t){Wt=t}},Xe={},na={get exports(){return Xe},set exports(t){Xe=t}},Nn=function(e,r){return function(){for(var i=new Array(arguments.length),a=0;a<i.length;a++)i[a]=arguments[a];return e.apply(r,i)}},ia=Nn,ae=Object.prototype.toString;function lr(t){return Array.isArray(t)}function Ht(t){return typeof t>"u"}function aa(t){return t!==null&&!Ht(t)&&t.constructor!==null&&!Ht(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Ln(t){return ae.call(t)==="[object ArrayBuffer]"}function sa(t){return ae.call(t)==="[object FormData]"}function oa(t){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ln(t.buffer),e}function ua(t){return typeof t=="string"}function ca(t){return typeof t=="number"}function Qn(t){return t!==null&&typeof t=="object"}function je(t){if(ae.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function la(t){return ae.call(t)==="[object Date]"}function fa(t){return ae.call(t)==="[object File]"}function ha(t){return ae.call(t)==="[object Blob]"}function kn(t){return ae.call(t)==="[object Function]"}function da(t){return Qn(t)&&kn(t.pipe)}function pa(t){return ae.call(t)==="[object URLSearchParams]"}function ya(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function va(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function fr(t,e){if(!(t===null||typeof t>"u"))if(typeof t!="object"&&(t=[t]),lr(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function Vt(){var t={};function e(i,a){je(t[a])&&je(i)?t[a]=Vt(t[a],i):je(i)?t[a]=Vt({},i):lr(i)?t[a]=i.slice():t[a]=i}for(var r=0,n=arguments.length;r<n;r++)fr(arguments[r],e);return t}function ma(t,e,r){return fr(e,function(i,a){r&&typeof i=="function"?t[a]=ia(i,r):t[a]=i}),t}function ga(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}var K={isArray:lr,isArrayBuffer:Ln,isBuffer:aa,isFormData:sa,isArrayBufferView:oa,isString:ua,isNumber:ca,isObject:Qn,isPlainObject:je,isUndefined:Ht,isDate:la,isFile:fa,isBlob:ha,isFunction:kn,isStream:da,isURLSearchParams:pa,isStandardBrowserEnv:va,forEach:fr,merge:Vt,extend:ma,trim:ya,stripBOM:ga},ve=K;function _r(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Bn=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(ve.isURLSearchParams(r))i=r.toString();else{var a=[];ve.forEach(r,function(l,f){l===null||typeof l>"u"||(ve.isArray(l)?f=f+"[]":l=[l],ve.forEach(l,function(u){ve.isDate(u)?u=u.toISOString():ve.isObject(u)&&(u=JSON.stringify(u)),a.push(_r(f)+"="+_r(u))}))}),i=a.join("&")}if(i){var s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e},ba=K;function nt(){this.handlers=[]}nt.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};nt.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};nt.prototype.forEach=function(e){ba.forEach(this.handlers,function(n){n!==null&&e(n)})};var Sa=nt,wa=K,Oa=function(e,r){wa.forEach(e,function(i,a){a!==r&&a.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[a])})},jn=function(e,r,n,i,a){return e.config=r,n&&(e.code=n),e.request=i,e.response=a,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},zn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},lt,$r;function Kn(){if($r)return lt;$r=1;var t=jn;return lt=function(r,n,i,a,s){var o=new Error(r);return t(o,n,i,a,s)},lt}var ft,Mr;function Pa(){if(Mr)return ft;Mr=1;var t=Kn();return ft=function(r,n,i){var a=i.config.validateStatus;!i.status||!a||a(i.status)?r(i):n(t("Request failed with status code "+i.status,i.config,null,i.request,i))},ft}var ht,Dr;function Ea(){if(Dr)return ht;Dr=1;var t=K;return ht=t.isStandardBrowserEnv()?function(){return{write:function(n,i,a,s,o,l){var f=[];f.push(n+"="+encodeURIComponent(i)),t.isNumber(a)&&f.push("expires="+new Date(a).toGMTString()),t.isString(s)&&f.push("path="+s),t.isString(o)&&f.push("domain="+o),l===!0&&f.push("secure"),document.cookie=f.join("; ")},read:function(n){var i=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),ht}var dt,Tr;function Aa(){return Tr||(Tr=1,dt=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}),dt}var pt,Ur;function Ra(){return Ur||(Ur=1,pt=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}),pt}var yt,Nr;function Ca(){if(Nr)return yt;Nr=1;var t=Aa(),e=Ra();return yt=function(n,i){return n&&!t(i)?e(n,i):i},yt}var vt,Lr;function Fa(){if(Lr)return vt;Lr=1;var t=K,e=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return vt=function(n){var i={},a,s,o;return n&&t.forEach(n.split(`
|
|
13
|
+
`),function(f){if(o=f.indexOf(":"),a=t.trim(f.substr(0,o)).toLowerCase(),s=t.trim(f.substr(o+1)),a){if(i[a]&&e.indexOf(a)>=0)return;a==="set-cookie"?i[a]=(i[a]?i[a]:[]).concat([s]):i[a]=i[a]?i[a]+", "+s:s}}),i},vt}var mt,Qr;function xa(){if(Qr)return mt;Qr=1;var t=K;return mt=t.isStandardBrowserEnv()?function(){var r=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a"),i;function a(s){var o=s;return r&&(n.setAttribute("href",o),o=n.href),n.setAttribute("href",o),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return i=a(window.location.href),function(o){var l=t.isString(o)?a(o):o;return l.protocol===i.protocol&&l.host===i.host}}():function(){return function(){return!0}}(),mt}var gt,kr;function it(){if(kr)return gt;kr=1;function t(e){this.message=e}return t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,gt=t,gt}var bt,Br;function jr(){if(Br)return bt;Br=1;var t=K,e=Pa(),r=Ea(),n=Bn,i=Ca(),a=Fa(),s=xa(),o=Kn(),l=zn,f=it();return bt=function(u){return new Promise(function(d,p){var v=u.data,m=u.headers,y=u.responseType,g;function S(){u.cancelToken&&u.cancelToken.unsubscribe(g),u.signal&&u.signal.removeEventListener("abort",g)}t.isFormData(v)&&delete m["Content-Type"];var b=new XMLHttpRequest;if(u.auth){var C=u.auth.username||"",P=u.auth.password?unescape(encodeURIComponent(u.auth.password)):"";m.Authorization="Basic "+btoa(C+":"+P)}var _=i(u.baseURL,u.url);b.open(u.method.toUpperCase(),n(_,u.params,u.paramsSerializer),!0),b.timeout=u.timeout;function W(){if(b){var R="getAllResponseHeaders"in b?a(b.getAllResponseHeaders()):null,M=!y||y==="text"||y==="json"?b.responseText:b.response,x={data:M,status:b.status,statusText:b.statusText,headers:R,config:u,request:b};e(function(q){d(q),S()},function(q){p(q),S()},x),b=null}}if("onloadend"in b?b.onloadend=W:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(W)},b.onabort=function(){b&&(p(o("Request aborted",u,"ECONNABORTED",b)),b=null)},b.onerror=function(){p(o("Network Error",u,null,b)),b=null},b.ontimeout=function(){var M=u.timeout?"timeout of "+u.timeout+"ms exceeded":"timeout exceeded",x=u.transitional||l;u.timeoutErrorMessage&&(M=u.timeoutErrorMessage),p(o(M,u,x.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",b)),b=null},t.isStandardBrowserEnv()){var Q=(u.withCredentials||s(_))&&u.xsrfCookieName?r.read(u.xsrfCookieName):void 0;Q&&(m[u.xsrfHeaderName]=Q)}"setRequestHeader"in b&&t.forEach(m,function(M,x){typeof v>"u"&&x.toLowerCase()==="content-type"?delete m[x]:b.setRequestHeader(x,M)}),t.isUndefined(u.withCredentials)||(b.withCredentials=!!u.withCredentials),y&&y!=="json"&&(b.responseType=u.responseType),typeof u.onDownloadProgress=="function"&&b.addEventListener("progress",u.onDownloadProgress),typeof u.onUploadProgress=="function"&&b.upload&&b.upload.addEventListener("progress",u.onUploadProgress),(u.cancelToken||u.signal)&&(g=function(R){b&&(p(!R||R&&R.type?new f("canceled"):R),b.abort(),b=null)},u.cancelToken&&u.cancelToken.subscribe(g),u.signal&&(u.signal.aborted?g():u.signal.addEventListener("abort",g))),v||(v=null),b.send(v)})},bt}var N=K,zr=Oa,Ia=jn,qa=zn,_a={"Content-Type":"application/x-www-form-urlencoded"};function Kr(t,e){!N.isUndefined(t)&&N.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function $a(){var t;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(t=jr()),t}function Ma(t,e,r){if(N.isString(t))try{return(e||JSON.parse)(t),N.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var at={transitional:qa,adapter:$a(),transformRequest:[function(e,r){return zr(r,"Accept"),zr(r,"Content-Type"),N.isFormData(e)||N.isArrayBuffer(e)||N.isBuffer(e)||N.isStream(e)||N.isFile(e)||N.isBlob(e)?e:N.isArrayBufferView(e)?e.buffer:N.isURLSearchParams(e)?(Kr(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):N.isObject(e)||r&&r["Content-Type"]==="application/json"?(Kr(r,"application/json"),Ma(e)):e}],transformResponse:[function(e){var r=this.transitional||at.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,a=!n&&this.responseType==="json";if(a||i&&N.isString(e)&&e.length)try{return JSON.parse(e)}catch(s){if(a)throw s.name==="SyntaxError"?Ia(s,this,"E_JSON_PARSE"):s}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};N.forEach(["delete","get","head"],function(e){at.headers[e]={}});N.forEach(["post","put","patch"],function(e){at.headers[e]=N.merge(_a)});var hr=at,Da=K,Ta=hr,Ua=function(e,r,n){var i=this||Ta;return Da.forEach(n,function(s){e=s.call(i,e,r)}),e},St,Gr;function Gn(){return Gr||(Gr=1,St=function(e){return!!(e&&e.__CANCEL__)}),St}var Wr=K,wt=Ua,Na=Gn(),La=hr,Qa=it();function Ot(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Qa("canceled")}var ka=function(e){Ot(e),e.headers=e.headers||{},e.data=wt.call(e,e.data,e.headers,e.transformRequest),e.headers=Wr.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Wr.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||La.adapter;return r(e).then(function(i){return Ot(e),i.data=wt.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Na(i)||(Ot(e),i&&i.response&&(i.response.data=wt.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})},G=K,Wn=function(e,r){r=r||{};var n={};function i(c,u){return G.isPlainObject(c)&&G.isPlainObject(u)?G.merge(c,u):G.isPlainObject(u)?G.merge({},u):G.isArray(u)?u.slice():u}function a(c){if(G.isUndefined(r[c])){if(!G.isUndefined(e[c]))return i(void 0,e[c])}else return i(e[c],r[c])}function s(c){if(!G.isUndefined(r[c]))return i(void 0,r[c])}function o(c){if(G.isUndefined(r[c])){if(!G.isUndefined(e[c]))return i(void 0,e[c])}else return i(void 0,r[c])}function l(c){if(c in r)return i(e[c],r[c]);if(c in e)return i(void 0,e[c])}var f={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l};return G.forEach(Object.keys(e).concat(Object.keys(r)),function(u){var h=f[u]||a,d=h(u);G.isUndefined(d)&&h!==l||(n[u]=d)}),n},Pt,Hr;function Hn(){return Hr||(Hr=1,Pt={version:"0.26.1"}),Pt}var Ba=Hn().version,dr={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){dr[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Vr={};dr.transitional=function(e,r,n){function i(a,s){return"[Axios v"+Ba+"] Transitional option '"+a+"'"+s+(n?". "+n:"")}return function(a,s,o){if(e===!1)throw new Error(i(s," has been removed"+(r?" in "+r:"")));return r&&!Vr[s]&&(Vr[s]=!0,console.warn(i(s," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(a,s,o):!0}};function ja(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var a=n[i],s=e[a];if(s){var o=t[a],l=o===void 0||s(o,a,t);if(l!==!0)throw new TypeError("option "+a+" must be "+l);continue}if(r!==!0)throw Error("Unknown option "+a)}}var za={assertOptions:ja,validators:dr},Vn=K,Ka=Bn,Jr=Sa,Xr=ka,st=Wn,Jn=za,me=Jn.validators;function Me(t){this.defaults=t,this.interceptors={request:new Jr,response:new Jr}}Me.prototype.request=function(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=st(this.defaults,r),r.method?r.method=r.method.toLowerCase():this.defaults.method?r.method=this.defaults.method.toLowerCase():r.method="get";var n=r.transitional;n!==void 0&&Jn.assertOptions(n,{silentJSONParsing:me.transitional(me.boolean),forcedJSONParsing:me.transitional(me.boolean),clarifyTimeoutError:me.transitional(me.boolean)},!1);var i=[],a=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(r)===!1||(a=a&&d.synchronous,i.unshift(d.fulfilled,d.rejected))});var s=[];this.interceptors.response.forEach(function(d){s.push(d.fulfilled,d.rejected)});var o;if(!a){var l=[Xr,void 0];for(Array.prototype.unshift.apply(l,i),l=l.concat(s),o=Promise.resolve(r);l.length;)o=o.then(l.shift(),l.shift());return o}for(var f=r;i.length;){var c=i.shift(),u=i.shift();try{f=c(f)}catch(h){u(h);break}}try{o=Xr(f)}catch(h){return Promise.reject(h)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};Me.prototype.getUri=function(e){return e=st(this.defaults,e),Ka(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};Vn.forEach(["delete","get","head","options"],function(e){Me.prototype[e]=function(r,n){return this.request(st(n||{},{method:e,url:r,data:(n||{}).data}))}});Vn.forEach(["post","put","patch"],function(e){Me.prototype[e]=function(r,n,i){return this.request(st(i||{},{method:e,url:r,data:n}))}});var Ga=Me,Et,Yr;function Wa(){if(Yr)return Et;Yr=1;var t=it();function e(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var n;this.promise=new Promise(function(s){n=s});var i=this;this.promise.then(function(a){if(i._listeners){var s,o=i._listeners.length;for(s=0;s<o;s++)i._listeners[s](a);i._listeners=null}}),this.promise.then=function(a){var s,o=new Promise(function(l){i.subscribe(l),s=l}).then(a);return o.cancel=function(){i.unsubscribe(s)},o},r(function(s){i.reason||(i.reason=new t(s),n(i.reason))})}return e.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},e.prototype.subscribe=function(n){if(this.reason){n(this.reason);return}this._listeners?this._listeners.push(n):this._listeners=[n]},e.prototype.unsubscribe=function(n){if(this._listeners){var i=this._listeners.indexOf(n);i!==-1&&this._listeners.splice(i,1)}},e.source=function(){var n,i=new e(function(s){n=s});return{token:i,cancel:n}},Et=e,Et}var At,Zr;function Ha(){return Zr||(Zr=1,At=function(e){return function(n){return e.apply(null,n)}}),At}var Rt,en;function Va(){if(en)return Rt;en=1;var t=K;return Rt=function(r){return t.isObject(r)&&r.isAxiosError===!0},Rt}var tn=K,Ja=Nn,ze=Ga,Xa=Wn,Ya=hr;function Xn(t){var e=new ze(t),r=Ja(ze.prototype.request,e);return tn.extend(r,ze.prototype,e),tn.extend(r,e),r.create=function(i){return Xn(Xa(t,i))},r}var Z=Xn(Ya);Z.Axios=ze;Z.Cancel=it();Z.CancelToken=Wa();Z.isCancel=Gn();Z.VERSION=Hn().version;Z.all=function(e){return Promise.all(e)};Z.spread=Ha();Z.isAxiosError=Va();na.exports=Z;Xe.default=Z;(function(t){t.exports=Xe})(ra);const Jt=ea(Wt);var Ye={},Za={get exports(){return Ye},set exports(t){Ye=t}};(function(t){(function(){var e,r,n,i,a,s,o,l,f;r={},l=this,t!==null&&t.exports?t.exports=r:l.ipaddr=r,o=function(c,u,h,d){var p,v;if(c.length!==u.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");for(p=0;d>0;){if(v=h-d,v<0&&(v=0),c[p]>>v!==u[p]>>v)return!1;d-=h,p+=1}return!0},r.subnetMatch=function(c,u,h){var d,p,v,m,y;h==null&&(h="unicast");for(v in u)for(m=u[v],m[0]&&!(m[0]instanceof Array)&&(m=[m]),d=0,p=m.length;d<p;d++)if(y=m[d],c.kind()===y[0].kind()&&c.match.apply(c,y))return v;return h},r.IPv4=function(){function c(u){var h,d,p;if(u.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");for(h=0,d=u.length;h<d;h++)if(p=u[h],!(0<=p&&p<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=u}return c.prototype.kind=function(){return"ipv4"},c.prototype.toString=function(){return this.octets.join(".")},c.prototype.toNormalizedString=function(){return this.toString()},c.prototype.toByteArray=function(){return this.octets.slice(0)},c.prototype.match=function(u,h){var d;if(h===void 0&&(d=u,u=d[0],h=d[1]),u.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return o(this.octets,u.octets,8,h)},c.prototype.SpecialRanges={unspecified:[[new c([0,0,0,0]),8]],broadcast:[[new c([255,255,255,255]),32]],multicast:[[new c([224,0,0,0]),4]],linkLocal:[[new c([169,254,0,0]),16]],loopback:[[new c([127,0,0,0]),8]],carrierGradeNat:[[new c([100,64,0,0]),10]],private:[[new c([10,0,0,0]),8],[new c([172,16,0,0]),12],[new c([192,168,0,0]),16]],reserved:[[new c([192,0,0,0]),24],[new c([192,0,2,0]),24],[new c([192,88,99,0]),24],[new c([198,51,100,0]),24],[new c([203,0,113,0]),24],[new c([240,0,0,0]),4]]},c.prototype.range=function(){return r.subnetMatch(this,this.SpecialRanges)},c.prototype.toIPv4MappedAddress=function(){return r.IPv6.parse("::ffff:"+this.toString())},c.prototype.prefixLengthFromSubnetMask=function(){var u,h,d,p,v,m,y;for(y={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},u=0,v=!1,h=d=3;d>=0;h=d+=-1)if(p=this.octets[h],p in y){if(m=y[p],v&&m!==0)return null;m!==8&&(v=!0),u+=m}else return null;return 32-u},c}(),n="(0?\\d+|0x[a-f0-9]+)",i={fourOctet:new RegExp("^"+n+"\\."+n+"\\."+n+"\\."+n+"$","i"),longValue:new RegExp("^"+n+"$","i")},r.IPv4.parser=function(c){var u,h,d,p,v;if(h=function(m){return m[0]==="0"&&m[1]!=="x"?parseInt(m,8):parseInt(m)},u=c.match(i.fourOctet))return function(){var m,y,g,S;for(g=u.slice(1,6),S=[],m=0,y=g.length;m<y;m++)d=g[m],S.push(h(d));return S}();if(u=c.match(i.longValue)){if(v=h(u[1]),v>4294967295||v<0)throw new Error("ipaddr: address outside defined range");return function(){var m,y;for(y=[],p=m=0;m<=24;p=m+=8)y.push(v>>p&255);return y}().reverse()}else return null},r.IPv6=function(){function c(u,h){var d,p,v,m,y,g;if(u.length===16)for(this.parts=[],d=p=0;p<=14;d=p+=2)this.parts.push(u[d]<<8|u[d+1]);else if(u.length===8)this.parts=u;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(g=this.parts,v=0,m=g.length;v<m;v++)if(y=g[v],!(0<=y&&y<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");h&&(this.zoneId=h)}return c.prototype.kind=function(){return"ipv6"},c.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},c.prototype.toRFC5952String=function(){var u,h,d,p,v;for(p=/((^|:)(0(:|$)){2,})/g,v=this.toNormalizedString(),u=0,h=-1;d=p.exec(v);)d[0].length>h&&(u=d.index,h=d[0].length);return h<0?v:v.substring(0,u)+"::"+v.substring(u+h)},c.prototype.toByteArray=function(){var u,h,d,p,v;for(u=[],v=this.parts,h=0,d=v.length;h<d;h++)p=v[h],u.push(p>>8),u.push(p&255);return u},c.prototype.toNormalizedString=function(){var u,h,d;return u=function(){var p,v,m,y;for(m=this.parts,y=[],p=0,v=m.length;p<v;p++)h=m[p],y.push(h.toString(16));return y}.call(this).join(":"),d="",this.zoneId&&(d="%"+this.zoneId),u+d},c.prototype.toFixedLengthString=function(){var u,h,d;return u=function(){var p,v,m,y;for(m=this.parts,y=[],p=0,v=m.length;p<v;p++)h=m[p],y.push(h.toString(16).padStart(4,"0"));return y}.call(this).join(":"),d="",this.zoneId&&(d="%"+this.zoneId),u+d},c.prototype.match=function(u,h){var d;if(h===void 0&&(d=u,u=d[0],h=d[1]),u.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return o(this.parts,u.parts,16,h)},c.prototype.SpecialRanges={unspecified:[new c([0,0,0,0,0,0,0,0]),128],linkLocal:[new c([65152,0,0,0,0,0,0,0]),10],multicast:[new c([65280,0,0,0,0,0,0,0]),8],loopback:[new c([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new c([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new c([0,0,0,0,0,65535,0,0]),96],rfc6145:[new c([0,0,0,0,65535,0,0,0]),96],rfc6052:[new c([100,65435,0,0,0,0,0,0]),96],"6to4":[new c([8194,0,0,0,0,0,0,0]),16],teredo:[new c([8193,0,0,0,0,0,0,0]),32],reserved:[[new c([8193,3512,0,0,0,0,0,0]),32]]},c.prototype.range=function(){return r.subnetMatch(this,this.SpecialRanges)},c.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},c.prototype.toIPv4Address=function(){var u,h,d;if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");return d=this.parts.slice(-2),u=d[0],h=d[1],new r.IPv4([u>>8,u&255,h>>8,h&255])},c.prototype.prefixLengthFromSubnetMask=function(){var u,h,d,p,v,m,y;for(y={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},u=0,v=!1,h=d=7;d>=0;h=d+=-1)if(p=this.parts[h],p in y){if(m=y[p],v&&m!==0)return null;m!==16&&(v=!0),u+=m}else return null;return 128-u},c}(),a="(?:[0-9a-f]+::?)+",f="%[0-9a-z]{1,}",s={zoneIndex:new RegExp(f,"i"),native:new RegExp("^(::)?("+a+")?([0-9a-f]+)?(::)?("+f+")?$","i"),transitional:new RegExp("^((?:"+a+")|(?:::)(?:"+a+")?)"+(n+"\\."+n+"\\."+n+"\\."+n)+("("+f+")?$"),"i")},e=function(c,u){var h,d,p,v,m,y;if(c.indexOf("::")!==c.lastIndexOf("::"))return null;for(y=(c.match(s.zoneIndex)||[])[0],y&&(y=y.substring(1),c=c.replace(/%.+$/,"")),h=0,d=-1;(d=c.indexOf(":",d+1))>=0;)h++;if(c.substr(0,2)==="::"&&h--,c.substr(-2,2)==="::"&&h--,h>u)return null;for(m=u-h,v=":";m--;)v+="0:";return c=c.replace("::",v),c[0]===":"&&(c=c.slice(1)),c[c.length-1]===":"&&(c=c.slice(0,-1)),u=function(){var g,S,b,C;for(b=c.split(":"),C=[],g=0,S=b.length;g<S;g++)p=b[g],C.push(parseInt(p,16));return C}(),{parts:u,zoneId:y}},r.IPv6.parser=function(c){var u,h,d,p,v,m,y;if(s.native.test(c))return e(c,8);if((p=c.match(s.transitional))&&(y=p[6]||"",u=e(p[1].slice(0,-1)+y,6),u.parts)){for(m=[parseInt(p[2]),parseInt(p[3]),parseInt(p[4]),parseInt(p[5])],h=0,d=m.length;h<d;h++)if(v=m[h],!(0<=v&&v<=255))return null;return u.parts.push(m[0]<<8|m[1]),u.parts.push(m[2]<<8|m[3]),{parts:u.parts,zoneId:u.zoneId}}return null},r.IPv4.isIPv4=r.IPv6.isIPv6=function(c){return this.parser(c)!==null},r.IPv4.isValid=function(c){try{return new this(this.parser(c)),!0}catch{return!1}},r.IPv4.isValidFourPartDecimal=function(c){return!!(r.IPv4.isValid(c)&&c.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},r.IPv6.isValid=function(c){var u;if(typeof c=="string"&&c.indexOf(":")===-1)return!1;try{return u=this.parser(c),new this(u.parts,u.zoneId),!0}catch{return!1}},r.IPv4.parse=function(c){var u;if(u=this.parser(c),u===null)throw new Error("ipaddr: string is not formatted like ip address");return new this(u)},r.IPv6.parse=function(c){var u;if(u=this.parser(c),u.parts===null)throw new Error("ipaddr: string is not formatted like ip address");return new this(u.parts,u.zoneId)},r.IPv4.parseCIDR=function(c){var u,h,d;if((h=c.match(/^(.+)\/(\d+)$/))&&(u=parseInt(h[2]),u>=0&&u<=32))return d=[this.parse(h[1]),u],Object.defineProperty(d,"toString",{value:function(){return this.join("/")}}),d;throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},r.IPv4.subnetMaskFromPrefixLength=function(c){var u,h,d;if(c=parseInt(c),c<0||c>32)throw new Error("ipaddr: invalid IPv4 prefix length");for(d=[0,0,0,0],h=0,u=Math.floor(c/8);h<u;)d[h]=255,h++;return u<4&&(d[u]=Math.pow(2,c%8)-1<<8-c%8),new this(d)},r.IPv4.broadcastAddressFromCIDR=function(c){var u,h,d,p,v;try{for(u=this.parseCIDR(c),d=u[0].toByteArray(),v=this.subnetMaskFromPrefixLength(u[1]).toByteArray(),p=[],h=0;h<4;)p.push(parseInt(d[h],10)|parseInt(v[h],10)^255),h++;return new this(p)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},r.IPv4.networkAddressFromCIDR=function(c){var u,h,d,p,v;try{for(u=this.parseCIDR(c),d=u[0].toByteArray(),v=this.subnetMaskFromPrefixLength(u[1]).toByteArray(),p=[],h=0;h<4;)p.push(parseInt(d[h],10)&parseInt(v[h],10)),h++;return new this(p)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},r.IPv6.parseCIDR=function(c){var u,h,d;if((h=c.match(/^(.+)\/(\d+)$/))&&(u=parseInt(h[2]),u>=0&&u<=128))return d=[this.parse(h[1]),u],Object.defineProperty(d,"toString",{value:function(){return this.join("/")}}),d;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},r.isValid=function(c){return r.IPv6.isValid(c)||r.IPv4.isValid(c)},r.parse=function(c){if(r.IPv6.isValid(c))return r.IPv6.parse(c);if(r.IPv4.isValid(c))return r.IPv4.parse(c);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},r.parseCIDR=function(c){try{return r.IPv6.parseCIDR(c)}catch{try{return r.IPv4.parseCIDR(c)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},r.fromByteArray=function(c){var u;if(u=c.length,u===4)return new r.IPv4(c);if(u===16)return new r.IPv6(c);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},r.process=function(c){var u;return u=this.parse(c),u.kind()==="ipv6"&&u.isIPv4MappedAddress()?u.toIPv4Address():u}}).call(Un)})(Za);const Yn=t=>Array.isArray(t)&&t.every(e=>Zn(e)),Zn=t=>!!t.errorCode,es=async()=>{try{const t=await Jt.get("https://api.ipify.org/?format=json");return t.data.ip&&Ye.isValid(t.data.ip)?Ye.parse(t.data.ip).toString():void 0}catch{return}};class ts{constructor(e){this.client=e,this.list=()=>this.client.get("/v1/carriers"),this.get=r=>this.client.get(`/v1/carriers/${r}`),this.connect=async({carrierCode:r,...n})=>{const i=await es();return i?await this.client.post(`/v1/registration/${r}`,{...n,endUserIpAddress:i}):Promise.reject([new te("Unable to get IP address")])},this.addFunds=(r,n)=>this.client.put(`/v1/carriers/${r}/add_funds`,n),this.updateAutoFunding=(r,n)=>this.client.post(`/v1/carriers/${r}/auto_funding`,n),this.getAutoFunding=r=>this.client.get(`/v1/carriers/${r}/auto_funding`),this.client=e}}var xe={},rs={get exports(){return xe},set exports(t){xe=t}};(function(t){(function(e){var r=function(y,g,S){if(!f(g)||u(g)||h(g)||d(g)||l(g))return g;var b,C=0,P=0;if(c(g))for(b=[],P=g.length;C<P;C++)b.push(r(y,g[C],S));else{b={};for(var _ in g)Object.prototype.hasOwnProperty.call(g,_)&&(b[y(_,S)]=r(y,g[_],S))}return b},n=function(y,g){g=g||{};var S=g.separator||"_",b=g.split||/(?=[A-Z])/;return y.split(b).join(S)},i=function(y){return p(y)?y:(y=y.replace(/[\-_\s]+(.)?/g,function(g,S){return S?S.toUpperCase():""}),y.substr(0,1).toLowerCase()+y.substr(1))},a=function(y){var g=i(y);return g.substr(0,1).toUpperCase()+g.substr(1)},s=function(y,g){return n(y,g).toLowerCase()},o=Object.prototype.toString,l=function(y){return typeof y=="function"},f=function(y){return y===Object(y)},c=function(y){return o.call(y)=="[object Array]"},u=function(y){return o.call(y)=="[object Date]"},h=function(y){return o.call(y)=="[object RegExp]"},d=function(y){return o.call(y)=="[object Boolean]"},p=function(y){return y=y-0,y===y},v=function(y,g){var S=g&&"process"in g?g.process:g;return typeof S!="function"?y:function(b,C){return S(b,y,C)}},m={camelize:i,decamelize:s,pascalize:a,depascalize:s,camelizeKeys:function(y,g){return r(v(i,g),y)},decamelizeKeys:function(y,g){return r(v(s,g),y,g)},pascalizeKeys:function(y,g){return r(v(a,g),y)},depascalizeKeys:function(){return this.decamelizeKeys.apply(this,arguments)}};t.exports?t.exports=m:e.humps=m})(Un)})(rs);var ns=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,r);if(s.value!==i||s.enumerable!==!0)return!1}return!0},rn=typeof Symbol<"u"&&Symbol,is=ns,as=function(){return typeof rn!="function"||typeof Symbol!="function"||typeof rn("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:is()},ss="Function.prototype.bind called on incompatible ",Ct=Array.prototype.slice,os=Object.prototype.toString,us="[object Function]",cs=function(e){var r=this;if(typeof r!="function"||os.call(r)!==us)throw new TypeError(ss+r);for(var n=Ct.call(arguments,1),i,a=function(){if(this instanceof i){var c=r.apply(this,n.concat(Ct.call(arguments)));return Object(c)===c?c:this}else return r.apply(e,n.concat(Ct.call(arguments)))},s=Math.max(0,r.length-n.length),o=[],l=0;l<s;l++)o.push("$"+l);if(i=Function("binder","return function ("+o.join(",")+"){ return binder.apply(this,arguments); }")(a),r.prototype){var f=function(){};f.prototype=r.prototype,i.prototype=new f,f.prototype=null}return i},ls=cs,pr=Function.prototype.bind||ls,fs=pr,hs=fs.call(Function.call,Object.prototype.hasOwnProperty),O,we=SyntaxError,ei=Function,Se=TypeError,Ft=function(t){try{return ei('"use strict"; return ('+t+").constructor;")()}catch{}},de=Object.getOwnPropertyDescriptor;if(de)try{de({},"")}catch{de=null}var xt=function(){throw new Se},ds=de?function(){try{return arguments.callee,xt}catch{try{return de(arguments,"callee").get}catch{return xt}}}():xt,ge=as(),X=Object.getPrototypeOf||function(t){return t.__proto__},be={},ps=typeof Uint8Array>"u"?O:X(Uint8Array),pe={"%AggregateError%":typeof AggregateError>"u"?O:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?O:ArrayBuffer,"%ArrayIteratorPrototype%":ge?X([][Symbol.iterator]()):O,"%AsyncFromSyncIteratorPrototype%":O,"%AsyncFunction%":be,"%AsyncGenerator%":be,"%AsyncGeneratorFunction%":be,"%AsyncIteratorPrototype%":be,"%Atomics%":typeof Atomics>"u"?O:Atomics,"%BigInt%":typeof BigInt>"u"?O:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?O:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?O:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?O:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?O:Float32Array,"%Float64Array%":typeof Float64Array>"u"?O:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?O:FinalizationRegistry,"%Function%":ei,"%GeneratorFunction%":be,"%Int8Array%":typeof Int8Array>"u"?O:Int8Array,"%Int16Array%":typeof Int16Array>"u"?O:Int16Array,"%Int32Array%":typeof Int32Array>"u"?O:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ge?X(X([][Symbol.iterator]())):O,"%JSON%":typeof JSON=="object"?JSON:O,"%Map%":typeof Map>"u"?O:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ge?O:X(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?O:Promise,"%Proxy%":typeof Proxy>"u"?O:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?O:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?O:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ge?O:X(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?O:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ge?X(""[Symbol.iterator]()):O,"%Symbol%":ge?Symbol:O,"%SyntaxError%":we,"%ThrowTypeError%":ds,"%TypedArray%":ps,"%TypeError%":Se,"%Uint8Array%":typeof Uint8Array>"u"?O:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?O:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?O:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?O:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?O:WeakMap,"%WeakRef%":typeof WeakRef>"u"?O:WeakRef,"%WeakSet%":typeof WeakSet>"u"?O:WeakSet};try{null.error}catch(t){var ys=X(X(t));pe["%Error.prototype%"]=ys}var vs=function t(e){var r;if(e==="%AsyncFunction%")r=Ft("async function () {}");else if(e==="%GeneratorFunction%")r=Ft("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Ft("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&(r=X(i.prototype))}return pe[e]=r,r},nn={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},De=pr,Ze=hs,ms=De.call(Function.call,Array.prototype.concat),gs=De.call(Function.apply,Array.prototype.splice),an=De.call(Function.call,String.prototype.replace),et=De.call(Function.call,String.prototype.slice),bs=De.call(Function.call,RegExp.prototype.exec),Ss=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ws=/\\(\\)?/g,Os=function(e){var r=et(e,0,1),n=et(e,-1);if(r==="%"&&n!=="%")throw new we("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new we("invalid intrinsic syntax, expected opening `%`");var i=[];return an(e,Ss,function(a,s,o,l){i[i.length]=o?an(l,ws,"$1"):s||a}),i},Ps=function(e,r){var n=e,i;if(Ze(nn,n)&&(i=nn[n],n="%"+i[0]+"%"),Ze(pe,n)){var a=pe[n];if(a===be&&(a=vs(n)),typeof a>"u"&&!r)throw new Se("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new we("intrinsic "+e+" does not exist!")},yr=function(e,r){if(typeof e!="string"||e.length===0)throw new Se("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Se('"allowMissing" argument must be a boolean');if(bs(/^%?[^%]*%?$/,e)===null)throw new we("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Os(e),i=n.length>0?n[0]:"",a=Ps("%"+i+"%",r),s=a.name,o=a.value,l=!1,f=a.alias;f&&(i=f[0],gs(n,ms([0,1],f)));for(var c=1,u=!0;c<n.length;c+=1){var h=n[c],d=et(h,0,1),p=et(h,-1);if((d==='"'||d==="'"||d==="`"||p==='"'||p==="'"||p==="`")&&d!==p)throw new we("property names with quotes must have matching quotes");if((h==="constructor"||!u)&&(l=!0),i+="."+h,s="%"+i+"%",Ze(pe,s))o=pe[s];else if(o!=null){if(!(h in o)){if(!r)throw new Se("base intrinsic for "+e+" exists, but the property is not available.");return}if(de&&c+1>=n.length){var v=de(o,h);u=!!v,u&&"get"in v&&!("originalValue"in v.get)?o=v.get:o=o[h]}else u=Ze(o,h),o=o[h];u&&!l&&(pe[s]=o)}}return o},Xt={},Es={get exports(){return Xt},set exports(t){Xt=t}};(function(t){var e=pr,r=yr,n=r("%Function.prototype.apply%"),i=r("%Function.prototype.call%"),a=r("%Reflect.apply%",!0)||e.call(i,n),s=r("%Object.getOwnPropertyDescriptor%",!0),o=r("%Object.defineProperty%",!0),l=r("%Math.max%");if(o)try{o({},"a",{value:1})}catch{o=null}t.exports=function(u){var h=a(e,i,arguments);if(s&&o){var d=s(h,"length");d.configurable&&o(h,"length",{value:1+l(0,u.length-(arguments.length-1))})}return h};var f=function(){return a(e,n,arguments)};o?o(t.exports,"apply",{value:f}):t.exports.apply=f})(Es);var ti=yr,ri=Xt,As=ri(ti("String.prototype.indexOf")),Rs=function(e,r){var n=ti(e,!!r);return typeof n=="function"&&As(e,".prototype.")>-1?ri(n):n};const Cs={},Fs=Object.freeze(Object.defineProperty({__proto__:null,default:Cs},Symbol.toStringTag,{value:"Module"})),xs=ta(Fs);var vr=typeof Map=="function"&&Map.prototype,It=Object.getOwnPropertyDescriptor&&vr?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,tt=vr&&It&&typeof It.get=="function"?It.get:null,sn=vr&&Map.prototype.forEach,mr=typeof Set=="function"&&Set.prototype,qt=Object.getOwnPropertyDescriptor&&mr?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,rt=mr&&qt&&typeof qt.get=="function"?qt.get:null,on=mr&&Set.prototype.forEach,Is=typeof WeakMap=="function"&&WeakMap.prototype,Ie=Is?WeakMap.prototype.has:null,qs=typeof WeakSet=="function"&&WeakSet.prototype,qe=qs?WeakSet.prototype.has:null,_s=typeof WeakRef=="function"&&WeakRef.prototype,un=_s?WeakRef.prototype.deref:null,$s=Boolean.prototype.valueOf,Ms=Object.prototype.toString,Ds=Function.prototype.toString,Ts=String.prototype.match,gr=String.prototype.slice,ie=String.prototype.replace,Us=String.prototype.toUpperCase,cn=String.prototype.toLowerCase,ni=RegExp.prototype.test,ln=Array.prototype.concat,Y=Array.prototype.join,Ns=Array.prototype.slice,fn=Math.floor,Yt=typeof BigInt=="function"?BigInt.prototype.valueOf:null,_t=Object.getOwnPropertySymbols,Zt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Oe=typeof Symbol=="function"&&typeof Symbol.iterator=="object",j=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Oe||"symbol")?Symbol.toStringTag:null,ii=Object.prototype.propertyIsEnumerable,hn=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function dn(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||ni.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-fn(-t):fn(t);if(n!==t){var i=String(n),a=gr.call(e,i.length+1);return ie.call(i,r,"$&_")+"."+ie.call(ie.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ie.call(e,r,"$&_")}var er=xs,pn=er.custom,yn=si(pn)?pn:null,Ls=function t(e,r,n,i){var a=r||{};if(ne(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ne(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=ne(a,"customInspect")?a.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ne(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ne(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var o=a.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return ui(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return o?dn(e,l):l}if(typeof e=="bigint"){var f=String(e)+"n";return o?dn(e,f):f}var c=typeof a.depth>"u"?5:a.depth;if(typeof n>"u"&&(n=0),n>=c&&c>0&&typeof e=="object")return tr(e)?"[Array]":"[Object]";var u=no(a,n);if(typeof i>"u")i=[];else if(oi(i,e)>=0)return"[Circular]";function h($,q,k){if(q&&(i=Ns.call(i),i.push(q)),k){var B={depth:a.depth};return ne(a,"quoteStyle")&&(B.quoteStyle=a.quoteStyle),t($,B,n+1,i)}return t($,a,n+1,i)}if(typeof e=="function"&&!vn(e)){var d=Hs(e),p=Ue(e,h);return"[Function"+(d?": "+d:" (anonymous)")+"]"+(p.length>0?" { "+Y.call(p,", ")+" }":"")}if(si(e)){var v=Oe?ie.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Zt.call(e);return typeof e=="object"&&!Oe?Ce(v):v}if(eo(e)){for(var m="<"+cn.call(String(e.nodeName)),y=e.attributes||[],g=0;g<y.length;g++)m+=" "+y[g].name+"="+ai(Qs(y[g].value),"double",a);return m+=">",e.childNodes&&e.childNodes.length&&(m+="..."),m+="</"+cn.call(String(e.nodeName))+">",m}if(tr(e)){if(e.length===0)return"[]";var S=Ue(e,h);return u&&!ro(S)?"["+rr(S,u)+"]":"[ "+Y.call(S,", ")+" ]"}if(Bs(e)){var b=Ue(e,h);return!("cause"in Error.prototype)&&"cause"in e&&!ii.call(e,"cause")?"{ ["+String(e)+"] "+Y.call(ln.call("[cause]: "+h(e.cause),b),", ")+" }":b.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Y.call(b,", ")+" }"}if(typeof e=="object"&&s){if(yn&&typeof e[yn]=="function"&&er)return er(e,{depth:c-n});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Vs(e)){var C=[];return sn&&sn.call(e,function($,q){C.push(h(q,e,!0)+" => "+h($,e))}),mn("Map",tt.call(e),C,u)}if(Ys(e)){var P=[];return on&&on.call(e,function($){P.push(h($,e))}),mn("Set",rt.call(e),P,u)}if(Js(e))return $t("WeakMap");if(Zs(e))return $t("WeakSet");if(Xs(e))return $t("WeakRef");if(zs(e))return Ce(h(Number(e)));if(Gs(e))return Ce(h(Yt.call(e)));if(Ks(e))return Ce($s.call(e));if(js(e))return Ce(h(String(e)));if(!ks(e)&&!vn(e)){var _=Ue(e,h),W=hn?hn(e)===Object.prototype:e instanceof Object||e.constructor===Object,Q=e instanceof Object?"":"null prototype",R=!W&&j&&Object(e)===e&&j in e?gr.call(se(e),8,-1):Q?"Object":"",M=W||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",x=M+(R||Q?"["+Y.call(ln.call([],R||[],Q||[]),": ")+"] ":"");return _.length===0?x+"{}":u?x+"{"+rr(_,u)+"}":x+"{ "+Y.call(_,", ")+" }"}return String(e)};function ai(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function Qs(t){return ie.call(String(t),/"/g,""")}function tr(t){return se(t)==="[object Array]"&&(!j||!(typeof t=="object"&&j in t))}function ks(t){return se(t)==="[object Date]"&&(!j||!(typeof t=="object"&&j in t))}function vn(t){return se(t)==="[object RegExp]"&&(!j||!(typeof t=="object"&&j in t))}function Bs(t){return se(t)==="[object Error]"&&(!j||!(typeof t=="object"&&j in t))}function js(t){return se(t)==="[object String]"&&(!j||!(typeof t=="object"&&j in t))}function zs(t){return se(t)==="[object Number]"&&(!j||!(typeof t=="object"&&j in t))}function Ks(t){return se(t)==="[object Boolean]"&&(!j||!(typeof t=="object"&&j in t))}function si(t){if(Oe)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!Zt)return!1;try{return Zt.call(t),!0}catch{}return!1}function Gs(t){if(!t||typeof t!="object"||!Yt)return!1;try{return Yt.call(t),!0}catch{}return!1}var Ws=Object.prototype.hasOwnProperty||function(t){return t in this};function ne(t,e){return Ws.call(t,e)}function se(t){return Ms.call(t)}function Hs(t){if(t.name)return t.name;var e=Ts.call(Ds.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function oi(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function Vs(t){if(!tt||!t||typeof t!="object")return!1;try{tt.call(t);try{rt.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function Js(t){if(!Ie||!t||typeof t!="object")return!1;try{Ie.call(t,Ie);try{qe.call(t,qe)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function Xs(t){if(!un||!t||typeof t!="object")return!1;try{return un.call(t),!0}catch{}return!1}function Ys(t){if(!rt||!t||typeof t!="object")return!1;try{rt.call(t);try{tt.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function Zs(t){if(!qe||!t||typeof t!="object")return!1;try{qe.call(t,qe);try{Ie.call(t,Ie)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function eo(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function ui(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return ui(gr.call(t,0,e.maxStringLength),e)+n}var i=ie.call(ie.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,to);return ai(i,"single",e)}function to(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+Us.call(e.toString(16))}function Ce(t){return"Object("+t+")"}function $t(t){return t+" { ? }"}function mn(t,e,r,n){var i=n?rr(r,n):Y.call(r,", ");return t+" ("+e+") {"+i+"}"}function ro(t){for(var e=0;e<t.length;e++)if(oi(t[e],`
|
|
14
|
+
`)>=0)return!1;return!0}function no(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Y.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Y.call(Array(e+1),r)}}function rr(t,e){if(t.length===0)return"";var r=`
|
|
15
|
+
`+e.prev+e.base;return r+Y.call(t,","+r)+`
|
|
16
|
+
`+e.prev}function Ue(t,e){var r=tr(t),n=[];if(r){n.length=t.length;for(var i=0;i<t.length;i++)n[i]=ne(t,i)?e(t[i],t):""}var a=typeof _t=="function"?_t(t):[],s;if(Oe){s={};for(var o=0;o<a.length;o++)s["$"+a[o]]=a[o]}for(var l in t)ne(t,l)&&(r&&String(Number(l))===l&&l<t.length||Oe&&s["$"+l]instanceof Symbol||(ni.call(/[^\w$]/,l)?n.push(e(l,t)+": "+e(t[l],t)):n.push(l+": "+e(t[l],t))));if(typeof _t=="function")for(var f=0;f<a.length;f++)ii.call(t,a[f])&&n.push("["+e(a[f])+"]: "+e(t[a[f]],t));return n}var br=yr,Re=Rs,io=Ls,ao=br("%TypeError%"),Ne=br("%WeakMap%",!0),Le=br("%Map%",!0),so=Re("WeakMap.prototype.get",!0),oo=Re("WeakMap.prototype.set",!0),uo=Re("WeakMap.prototype.has",!0),co=Re("Map.prototype.get",!0),lo=Re("Map.prototype.set",!0),fo=Re("Map.prototype.has",!0),Sr=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},ho=function(t,e){var r=Sr(t,e);return r&&r.value},po=function(t,e,r){var n=Sr(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},yo=function(t,e){return!!Sr(t,e)},vo=function(){var e,r,n,i={assert:function(a){if(!i.has(a))throw new ao("Side channel does not contain "+io(a))},get:function(a){if(Ne&&a&&(typeof a=="object"||typeof a=="function")){if(e)return so(e,a)}else if(Le){if(r)return co(r,a)}else if(n)return ho(n,a)},has:function(a){if(Ne&&a&&(typeof a=="object"||typeof a=="function")){if(e)return uo(e,a)}else if(Le){if(r)return fo(r,a)}else if(n)return yo(n,a);return!1},set:function(a,s){Ne&&a&&(typeof a=="object"||typeof a=="function")?(e||(e=new Ne),oo(e,a,s)):Le?(r||(r=new Le),lo(r,a,s)):(n||(n={key:{},next:null}),po(n,a,s))}};return i},mo=String.prototype.replace,go=/%20/g,Mt={RFC1738:"RFC1738",RFC3986:"RFC3986"},wr={default:Mt.RFC3986,formatters:{RFC1738:function(t){return mo.call(t,go,"+")},RFC3986:function(t){return String(t)}},RFC1738:Mt.RFC1738,RFC3986:Mt.RFC3986},bo=wr,Dt=Object.prototype.hasOwnProperty,fe=Array.isArray,J=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),So=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(fe(n)){for(var i=[],a=0;a<n.length;++a)typeof n[a]<"u"&&i.push(n[a]);r.obj[r.prop]=i}}},ci=function(e,r){for(var n=r&&r.plainObjects?Object.create(null):{},i=0;i<e.length;++i)typeof e[i]<"u"&&(n[i]=e[i]);return n},wo=function t(e,r,n){if(!r)return e;if(typeof r!="object"){if(fe(e))e.push(r);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!Dt.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object")return[e].concat(r);var i=e;return fe(e)&&!fe(r)&&(i=ci(e,n)),fe(e)&&fe(r)?(r.forEach(function(a,s){if(Dt.call(e,s)){var o=e[s];o&&typeof o=="object"&&a&&typeof a=="object"?e[s]=t(o,a,n):e.push(a)}else e[s]=a}),e):Object.keys(r).reduce(function(a,s){var o=r[s];return Dt.call(a,s)?a[s]=t(a[s],o,n):a[s]=o,a},i)},Oo=function(e,r){return Object.keys(r).reduce(function(n,i){return n[i]=r[i],n},e)},Po=function(t,e,r){var n=t.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Eo=function(e,r,n,i,a){if(e.length===0)return e;var s=e;if(typeof e=="symbol"?s=Symbol.prototype.toString.call(e):typeof e!="string"&&(s=String(e)),n==="iso-8859-1")return escape(s).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});for(var o="",l=0;l<s.length;++l){var f=s.charCodeAt(l);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||a===bo.RFC1738&&(f===40||f===41)){o+=s.charAt(l);continue}if(f<128){o=o+J[f];continue}if(f<2048){o=o+(J[192|f>>6]+J[128|f&63]);continue}if(f<55296||f>=57344){o=o+(J[224|f>>12]+J[128|f>>6&63]+J[128|f&63]);continue}l+=1,f=65536+((f&1023)<<10|s.charCodeAt(l)&1023),o+=J[240|f>>18]+J[128|f>>12&63]+J[128|f>>6&63]+J[128|f&63]}return o},Ao=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i<r.length;++i)for(var a=r[i],s=a.obj[a.prop],o=Object.keys(s),l=0;l<o.length;++l){var f=o[l],c=s[f];typeof c=="object"&&c!==null&&n.indexOf(c)===-1&&(r.push({obj:s,prop:f}),n.push(c))}return So(r),e},Ro=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Co=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Fo=function(e,r){return[].concat(e,r)},xo=function(e,r){if(fe(e)){for(var n=[],i=0;i<e.length;i+=1)n.push(r(e[i]));return n}return r(e)},li={arrayToObject:ci,assign:Oo,combine:Fo,compact:Ao,decode:Po,encode:Eo,isBuffer:Co,isRegExp:Ro,maybeMap:xo,merge:wo},fi=vo,nr=li,_e=wr,Io=Object.prototype.hasOwnProperty,gn={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},ee=Array.isArray,qo=String.prototype.split,_o=Array.prototype.push,hi=function(t,e){_o.apply(t,ee(e)?e:[e])},$o=Date.prototype.toISOString,bn=_e.default,T={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:nr.encode,encodeValuesOnly:!1,format:bn,formatter:_e.formatters[bn],indices:!1,serializeDate:function(e){return $o.call(e)},skipNulls:!1,strictNullHandling:!1},Mo=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Tt={},Do=function t(e,r,n,i,a,s,o,l,f,c,u,h,d,p,v,m){for(var y=e,g=m,S=0,b=!1;(g=g.get(Tt))!==void 0&&!b;){var C=g.get(e);if(S+=1,typeof C<"u"){if(C===S)throw new RangeError("Cyclic object value");b=!0}typeof g.get(Tt)>"u"&&(S=0)}if(typeof l=="function"?y=l(r,y):y instanceof Date?y=u(y):n==="comma"&&ee(y)&&(y=nr.maybeMap(y,function(V){return V instanceof Date?u(V):V})),y===null){if(a)return o&&!p?o(r,T.encoder,v,"key",h):r;y=""}if(Mo(y)||nr.isBuffer(y)){if(o){var P=p?r:o(r,T.encoder,v,"key",h);if(n==="comma"&&p){for(var _=qo.call(String(y),","),W="",Q=0;Q<_.length;++Q)W+=(Q===0?"":",")+d(o(_[Q],T.encoder,v,"value",h));return[d(P)+(i&&ee(y)&&_.length===1?"[]":"")+"="+W]}return[d(P)+"="+d(o(y,T.encoder,v,"value",h))]}return[d(r)+"="+d(String(y))]}var R=[];if(typeof y>"u")return R;var M;if(n==="comma"&&ee(y))M=[{value:y.length>0?y.join(",")||null:void 0}];else if(ee(l))M=l;else{var x=Object.keys(y);M=f?x.sort(f):x}for(var $=i&&ee(y)&&y.length===1?r+"[]":r,q=0;q<M.length;++q){var k=M[q],B=typeof k=="object"&&typeof k.value<"u"?k.value:y[k];if(!(s&&B===null)){var oe=ee(y)?typeof n=="function"?n($,k):$:$+(c?"."+k:"["+k+"]");m.set(e,S);var H=fi();H.set(Tt,m),hi(R,t(B,oe,n,i,a,s,o,l,f,c,u,h,d,p,v,H))}}return R},To=function(e){if(!e)return T;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||T.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=_e.default;if(typeof e.format<"u"){if(!Io.call(_e.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var i=_e.formatters[n],a=T.filter;return(typeof e.filter=="function"||ee(e.filter))&&(a=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:T.addQueryPrefix,allowDots:typeof e.allowDots>"u"?T.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:T.charsetSentinel,delimiter:typeof e.delimiter>"u"?T.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:T.encode,encoder:typeof e.encoder=="function"?e.encoder:T.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:T.encodeValuesOnly,filter:a,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:T.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:T.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:T.strictNullHandling}},Uo=function(t,e){var r=t,n=To(e),i,a;typeof n.filter=="function"?(a=n.filter,r=a("",r)):ee(n.filter)&&(a=n.filter,i=a);var s=[];if(typeof r!="object"||r===null)return"";var o;e&&e.arrayFormat in gn?o=e.arrayFormat:e&&"indices"in e?o=e.indices?"indices":"repeat":o="indices";var l=gn[o];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var f=l==="comma"&&e&&e.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var c=fi(),u=0;u<i.length;++u){var h=i[u];n.skipNulls&&r[h]===null||hi(s,Do(r[h],h,l,f,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,c))}var d=s.join(n.delimiter),p=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),d.length>0?p+d:""},Pe=li,ir=Object.prototype.hasOwnProperty,No=Array.isArray,D={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Pe.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Lo=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},di=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},Qo="utf8=%26%2310003%3B",ko="utf8=%E2%9C%93",Bo=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,a=r.parameterLimit===1/0?void 0:r.parameterLimit,s=i.split(r.delimiter,a),o=-1,l,f=r.charset;if(r.charsetSentinel)for(l=0;l<s.length;++l)s[l].indexOf("utf8=")===0&&(s[l]===ko?f="utf-8":s[l]===Qo&&(f="iso-8859-1"),o=l,l=s.length);for(l=0;l<s.length;++l)if(l!==o){var c=s[l],u=c.indexOf("]="),h=u===-1?c.indexOf("="):u+1,d,p;h===-1?(d=r.decoder(c,D.decoder,f,"key"),p=r.strictNullHandling?null:""):(d=r.decoder(c.slice(0,h),D.decoder,f,"key"),p=Pe.maybeMap(di(c.slice(h+1),r),function(v){return r.decoder(v,D.decoder,f,"value")})),p&&r.interpretNumericEntities&&f==="iso-8859-1"&&(p=Lo(p)),c.indexOf("[]=")>-1&&(p=No(p)?[p]:p),ir.call(n,d)?n[d]=Pe.combine(n[d],p):n[d]=p}return n},jo=function(t,e,r,n){for(var i=n?e:di(e,r),a=t.length-1;a>=0;--a){var s,o=t[a];if(o==="[]"&&r.parseArrays)s=[].concat(i);else{s=r.plainObjects?Object.create(null):{};var l=o.charAt(0)==="["&&o.charAt(o.length-1)==="]"?o.slice(1,-1):o,f=parseInt(l,10);!r.parseArrays&&l===""?s={0:i}:!isNaN(f)&&o!==l&&String(f)===l&&f>=0&&r.parseArrays&&f<=r.arrayLimit?(s=[],s[f]=i):l!=="__proto__"&&(s[l]=i)}i=s}return i},zo=function(e,r,n,i){if(e){var a=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/,o=/(\[[^[\]]*])/g,l=n.depth>0&&s.exec(a),f=l?a.slice(0,l.index):a,c=[];if(f){if(!n.plainObjects&&ir.call(Object.prototype,f)&&!n.allowPrototypes)return;c.push(f)}for(var u=0;n.depth>0&&(l=o.exec(a))!==null&&u<n.depth;){if(u+=1,!n.plainObjects&&ir.call(Object.prototype,l[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(l[1])}return l&&c.push("["+a.slice(l.index)+"]"),jo(c,r,n,i)}},Ko=function(e){if(!e)return D;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=typeof e.charset>"u"?D.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?D.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:D.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:D.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:D.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:D.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:D.comma,decoder:typeof e.decoder=="function"?e.decoder:D.decoder,delimiter:typeof e.delimiter=="string"||Pe.isRegExp(e.delimiter)?e.delimiter:D.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:D.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:D.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:D.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:D.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:D.strictNullHandling}},Go=function(t,e){var r=Ko(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?Bo(t,r):t,i=r.plainObjects?Object.create(null):{},a=Object.keys(n),s=0;s<a.length;++s){var o=a[s],l=zo(o,n[o],r,typeof t=="string");i=Pe.merge(i,l,r)}return r.allowSparse===!0?i:Pe.compact(i)},Wo=Uo,Ho=Go,Vo=wr,Jo={formats:Vo,parse:Ho,stringify:Wo};class Xo{constructor(e){this.client=e,this.list=()=>this.client.get("/v1/packages"),this.client=e}}class Yo{constructor(e){this.client=e,this.get=r=>this.client.get(`/v1/insurance/${r}/balance`),this.client=e}}class Zo{constructor(e){this.client=e,this.get=r=>this.client.get(`/v1/labels/${r}`),this.list=(r={})=>this.client.get("/v1/labels",{params:r}),this.createByRateId=(r,n)=>this.client.post(`/v1/labels/rates/${r}`,n),this.void=r=>this.client.put(`/v1/labels/${r}/void`),this.client=e}}class eu{constructor(e){this.client=e,this.list=()=>this.client.get("/v-beta/order_sources"),this.get=r=>this.client.get(`/v-beta/order_sources/${r}`),this.refresh=r=>this.client.put(`/v-beta/order_sources/${r}/refresh`),this.client=e}}class tu{constructor(e){this.client=e,this.calculateByShipmentId=(r,n)=>this.client.post("/v1/rates",{rateOptions:n,shipmentId:r}),this.client=e}}class ru{constructor(e){this.client=e,this.list=(r={})=>this.client.post("/v-beta/shipments/list",r),this.get=r=>this.client.get(`/v-beta/shipments/${r}`),this.create=(r,n)=>this.client.post(`/v-beta/shipments/sales_order/${r}`,n),this.update=(r,n)=>this.client.put(`/v-beta/shipments/${r}`,n),this.client=e}}class nu{constructor(e){this.client=e,this.list=(r={})=>this.client.get("/v-beta/sales_orders",{params:r}),this.get=r=>this.client.get(`/v-beta/sales_orders/${r}`),this.notifyShipped=(r,n)=>this.client.post(`/v-beta/sales_orders/${r}/notify`,n),this.client=e}}class iu{constructor(e){this.client=e,this.list=()=>this.client.get("/v1/warehouses"),this.create=r=>this.client.post("/v1/warehouses",r),this.update=(r,n)=>this.client.put(`/v1/warehouses/${r}`,n),this.delete=r=>this.client.delete(`/v1/warehouses/${r}`),this.client=e}}const Sn=Mn({name:"shipengine-api",serializers:{...cr,req:t=>({headers:t.headers,method:t.method,url:t.url}),res:t=>({data:t.data,headers:t.config.headers,method:t.config.method,statusCode:t.status,url:t.config.url})},streams:[{stream:new Dn}]}),au=t=>!!t.errors&&Yn(t.errors);class wn{constructor(e,{baseURL:r,headers:n,getToken:i}){const a=Jt.create({baseURL:r,headers:{...n,Authorization:`Bearer ${e}`,"Content-Type":"application/json"},paramsSerializer:s=>Jo.stringify(xe.decamelizeKeys(s),{arrayFormat:"brackets"}),transformRequest:[s=>xe.decamelizeKeys(s),s=>JSON.stringify(s)],transformResponse:[s=>{if(s)return JSON.parse(s)},s=>xe.camelizeKeys(s)]});a.interceptors.response.use(s=>(Sn.info({req:s.config,res:s},"%s %s: %s %s",s.config.method?.toUpperCase(),s.config.url,s.status,s.statusText),s),async s=>{if(Sn.error({err:s,req:s.config,res:s.response},"%s %s: %s %s - %s",s.config?.method?.toUpperCase(),s.config?.url,s.response?.status,s.response?.statusText,s.message),s.response?.status===401){const o=await i(),l=s.config;return l&&(l.headers||={},l.headers.Authorization=`Bearer ${o}`),Jt(l)}return s.response?.data?au(s.response.data)?Promise.reject(s.response.data.errors.map(o=>te.fromObject(o))):Yn(s.response.data)?Promise.reject(s.response.data.map(o=>te.fromObject(o))):Zn(s.response.data)?Promise.reject([te.fromObject(s.response.data)]):Promise.reject([new te(s.response.data)]):Promise.reject([new te(s.message)])}),this.client=a}set token(e){this.client.defaults.headers.common.Authorization=`Bearer ${e}`}get addresses(){return new Zi(this.client)}get accountSettings(){return new Yi(this.client)}get carriers(){return new ts(this.client)}get customPackages(){return new Xo(this.client)}get insurance(){return new Yo(this.client)}get labels(){return new Zo(this.client)}get orderSources(){return new eu(this.client)}get rates(){return new tu(this.client)}get salesOrderShipments(){return new ru(this.client)}get salesOrders(){return new nu(this.client)}get warehouses(){return new iu(this.client)}}const Or=I.createContext(void 0),su=({baseURL:t,children:e,headers:r,getToken:n})=>{const[i,a]=I.useState(()=>{const o=n();if(typeof o=="string")return new wn(o,{baseURL:t,getToken:n,headers:r??{}});o.then(l=>a(new wn(l,{baseURL:t,getToken:n,headers:r??{}})))}),s=new Di;return i?ut.jsx(Or.Provider,{value:{client:i},children:ut.jsx(ki,{client:s,children:e})}):ut.jsx("div",{style:{alignItems:"center",display:"flex",height:"100%",justifyContent:"center",width:"100%"},children:"Loading..."})},A=()=>{const t=I.useContext(Or);if(!t)throw new Error("useShipEngine must be called within a ShipEngineProvider");return t},ou=t=>{const{client:e}=A();return L({mutationFn:async r=>(await e.carriers.addFunds(t,r)).data,mutationKey:["useAddFunds"],onError:E})},uu=()=>{const{client:t}=A();return L({mutationFn:async({rateOptions:e,shipmentId:r})=>(await t.rates.calculateByShipmentId(r,e)).data,mutationKey:["useCalculateRates"],onError:E})},cu=t=>{const{client:e}=A(),r=or();return L({mutationFn:async n=>(await e.carriers.updateAutoFunding(t,n)).data,mutationKey:["useUpdateAutoFunding"],onError:E,onSuccess:n=>{r.invalidateQueries(["useGetAutoFunding",t],{exact:!0})}})},lu=()=>{const{client:t}=A();return L({mutationFn:async e=>(await t.carriers.connect(e)).data,mutationKey:["useConnectCarrier"],onError:E})},fu=()=>{const{client:t}=A();return L({mutationFn:async({rateId:e,...r})=>(await t.labels.createByRateId(e,r)).data,mutationKey:["useCreateLabel"],onError:E})},hu=()=>{const{client:t}=A();return L({mutationFn:async({salesOrderId:e,...r})=>(await t.salesOrderShipments.create(e,r)).data,mutationKey:["useCreateSalesOrderShipment"],onError:E})},du=()=>{const{client:t}=A();return L({mutationFn:async e=>(await t.warehouses.create(e)).data,mutationKey:["useCreateWarehouse"],onError:E})},pu=()=>{const{client:t}=A();return L({mutationFn:async({warehouseId:e})=>(await t.warehouses.delete(e)).data,mutationKey:["useDeleteWarehouse"],onError:E})},yu=t=>{const{client:e}=A();return z({enabled:t!==void 0,onError:E,queryFn:()=>t?e.carriers.getAutoFunding(t):Promise.reject(new Error("carrierId is required.")),queryKey:["useGetAutoFundingConfiguration",t],select:r=>r.data})},vu=t=>{const{client:e}=A();return z({enabled:!!t,onError:E,queryFn:()=>t?e.carriers.get(t):Promise.reject(new Error("carrierId is require")),queryKey:["useGetCarrierById",t],select:r=>r.data,staleTime:5*60*1e3})},mu=t=>{const{client:e}=A();return z({enabled:t!==void 0,onError:E,queryFn:()=>t?e.insurance.get(t):Promise.reject(new Error("insuranceProvider is required")),queryKey:["useGetInsuranceAccount",t],select:r=>r.data})},gu=t=>{const{client:e}=A();return z({enabled:t!==void 0,onError:E,queryFn:()=>t?e.labels.get(t):Promise.reject(new Error("labelId is require")),queryKey:["useGetLabel",t],select:r=>r.data})},bu=()=>{const{client:t}=A();return z({onError:E,queryFn:()=>t.accountSettings.getAccountSettings(),queryKey:["getAccountSettings"],select:e=>e.data})},Su=()=>({links:{transactionHistoryReport:"http://link.to.entire.dataset.as.csv"},page:1,pages:4,total:275,transactions:[{amount:50.65,balance:10,carrierId:"string",carrierProvider:"string carrier name",labelId:"string",transactionDate:"",transactionId:"string",transactionType:"fund"},{amount:50.65,balance:10,carrierId:"string",carrierProvider:"string carrier name",labelId:"string",transactionDate:"",transactionId:"string",transactionType:"purchase"}]}),wu=t=>{const{client:e}=A();return z({enabled:t!==void 0,onError:E,queryFn:()=>t?e.salesOrders.get(t):Promise.reject(new Error("salesOrderId is required")),queryKey:["useGetSalesOrder",t],select:r=>r.data})},Ou=t=>{const{client:e}=A();return z({enabled:t!==void 0,onError:E,queryFn:()=>t?e.salesOrderShipments.get(t):Promise.reject(new Error("shipmentId is required")),queryKey:["useGetSalesOrderShipment",t],select:r=>r.data})},Pu=()=>{const{client:t}=A();return z({onError:E,queryFn:()=>t.carriers.list(),queryKey:["useListCarriers"],select:e=>e.data.carriers})},Eu=t=>{const{client:e}=A();return z({enabled:t&&Object.values(t).some(r=>r!==void 0),onError:E,queryFn:()=>e.labels.list(t),queryKey:["useListLabels",t],select:r=>r.data.labels})},Au=()=>{const{client:t}=A();return z({onError:E,queryFn:()=>t.orderSources.list(),queryKey:["useListOrderSources"],select:e=>e.data.orderSources})},Ru=()=>{const{client:t}=A();return z({onError:E,queryFn:()=>t.customPackages.list(),queryKey:["useListCustomPackageTypes"],select:e=>e.data.packages})},Cu=(t={})=>{const{client:e}=A();return z({enabled:t&&Object.values(t).some(r=>r!==void 0),onError:E,queryFn:()=>e.salesOrders.list(t),queryKey:["useListSalesOrders",t],select:r=>r.data.salesOrders})},Fu=t=>{const{client:e}=A();return z({enabled:t&&Object.values(t).some(r=>r!==void 0),onError:E,queryFn:()=>e.salesOrderShipments.list(t),queryKey:["useListSalesOrderShipments",t],select:r=>r.data.shipments})},xu=()=>{const{client:t}=A();return z({onError:E,queryFn:()=>t.warehouses.list(),queryKey:["useListWarehouses"],select:e=>e.data.warehouses})},Iu=()=>{const{client:t}=A();return L({mutationFn:async({salesOrderId:e,...r})=>(await t.salesOrders.notifyShipped(e,r)).data,mutationKey:["useNotifySalesOrder"],onError:E})},qu=()=>{const{client:t}=A();return L({mutationFn:async({address:e,text:r})=>(await t.addresses.parse(r,e)).data,mutationKey:["useParseAddress"],onError:E})},pi=()=>{const{client:t}=A();return L({mutationFn:async e=>(await t.orderSources.refresh(e)).data,mutationKey:["useRefreshOrderSourceAsync"]})},_u=()=>{const{client:t}=A(),{mutateAsync:e}=pi();return L({mutationFn:async r=>(await e(r),await Tn(async()=>{const{data:i}=await t.orderSources.get(r);if(["preparing_update","updating"].includes(i.refreshInfo.status))throw new te("Order source is still refreshing");return i},20)),mutationKey:["useRefreshOrderSource"],onError:E})},$u=()=>L({mutationFn:async t=>(await Promise.resolve({data:{},errors:[],isLoading:!1,isValidating:!1})).data,mutationKey:["useUpdateBilling"],onError:E}),Mu=()=>{const{client:t}=A();return L({mutationFn:async({shipmentId:e,...r})=>(await t.salesOrderShipments.update(e,r)).data,mutationKey:["useUpdateSalesOrderShipment"],onError:E})},Du=()=>{const{client:t}=A();return L({mutationFn:async({warehouseId:e,...r})=>(await t.warehouses.update(e,r)).data,mutationKey:["useUpdateWarehouse"],onError:E})},Tu=()=>{const{client:t}=A();return L({mutationFn:async e=>(await t.addresses.validate(e)).data,mutationKey:["useValidateAddresses"],onError:E})},Uu=()=>{const{client:t}=A();return L({mutationFn:async e=>(await t.labels.void(e)).data,mutationKey:["useVoidLabel"],onError:E})},Nu=t=>{const{client:e}=A();return z({enabled:t!==void 0,onError:E,queryFn:()=>t?e.salesOrderShipments.get(t):Promise.reject(new Error("shipmentId is required")),queryKey:["useGetShipment",t],select:r=>r.data})};exports.ShipEngineContext=Or;exports.ShipEngineProvider=su;exports.delay=_n;exports.logger=Xi;exports.onError=E;exports.retryUntil=Tn;exports.useAddFunds=ou;exports.useCalculateRates=uu;exports.useConnectCarrier=lu;exports.useCreateLabel=fu;exports.useCreateSalesOrderShipment=hu;exports.useCreateWarehouse=du;exports.useDeleteWarehouse=pu;exports.useGetAccountSettings=bu;exports.useGetAutoFundingConfiguration=yu;exports.useGetCarrierById=vu;exports.useGetInsuranceAccount=mu;exports.useGetLabel=gu;exports.useGetSalesOrder=wu;exports.useGetSalesOrderShipment=Ou;exports.useGetShipment=Nu;exports.useGetWalletTransactionHistory=Su;exports.useListCarriers=Pu;exports.useListCustomPackageTypes=Ru;exports.useListLabels=Eu;exports.useListOrderSources=Au;exports.useListSalesOrderShipments=Fu;exports.useListSalesOrders=Cu;exports.useListWarehouses=xu;exports.useNotifySalesOrderShipped=Iu;exports.useParseAddress=qu;exports.useRefreshOrderSource=_u;exports.useRefreshOrderSourceAsync=pi;exports.useUpdateAutoFunding=cu;exports.useUpdateBilling=$u;exports.useUpdateSalesOrderShipment=Mu;exports.useUpdateWarehouse=Du;exports.useValidateAddresses=Tu;exports.useVoidLabel=Uu;
|