@chatwillow/widget 0.0.1
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/README.md +73 -0
- package/dist/App.d.ts +3 -0
- package/dist/chatwillow-widget.es.js +3204 -0
- package/dist/chatwillow-widget.umd.js +11 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/alert-dialog.d.ts +18 -0
- package/dist/components/ui/alert.d.ts +9 -0
- package/dist/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/components/ui/avatar.d.ts +11 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/breadcrumb.d.ts +11 -0
- package/dist/components/ui/button-group.d.ts +11 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/calendar.d.ts +8 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/carousel.d.ts +19 -0
- package/dist/components/ui/chart.d.ts +40 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/combobox.d.ts +24 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/context-menu.d.ts +25 -0
- package/dist/components/ui/dialog.d.ts +17 -0
- package/dist/components/ui/direction.d.ts +7 -0
- package/dist/components/ui/drawer.d.ts +13 -0
- package/dist/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/components/ui/empty.d.ts +11 -0
- package/dist/components/ui/field.d.ts +24 -0
- package/dist/components/ui/form.d.ts +23 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/input-group.d.ts +16 -0
- package/dist/components/ui/input-otp.d.ts +11 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/item.d.ts +23 -0
- package/dist/components/ui/kbd.d.ts +3 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/menubar.d.ts +26 -0
- package/dist/components/ui/native-select.d.ts +7 -0
- package/dist/components/ui/navigation-menu.d.ts +14 -0
- package/dist/components/ui/pagination.d.ts +13 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/progress.d.ts +4 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/resizable.d.ts +7 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/select.d.ts +15 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/sheet.d.ts +14 -0
- package/dist/components/ui/sidebar.d.ts +69 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/sonner.d.ts +3 -0
- package/dist/components/ui/spinner.d.ts +2 -0
- package/dist/components/ui/switch.d.ts +6 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/tabs.d.ts +11 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/toggle-group.d.ts +9 -0
- package/dist/components/ui/toggle.d.ts +9 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/main.d.ts +0 -0
- package/dist/modules/ChatWidget/ChatWidget.d.ts +5 -0
- package/dist/modules/ChatWidget/components/ChatWidgetUI.d.ts +2 -0
- package/dist/modules/ChatWidget/hooks/useChatWidget.hooks.d.ts +1 -0
- package/dist/modules/ChatWidget/service/chatWidget.service.d.ts +10 -0
- package/dist/modules/ChatWidget/types/chatWidget.type.d.ts +22 -0
- package/dist/modules/ExampleModule/components/MainUi.d.ts +3 -0
- package/dist/modules/ExampleModule/example.d.ts +2 -0
- package/dist/modules/ExampleModule/hooks/useFetchExample.hooks.d.ts +2 -0
- package/dist/modules/ExampleModule/service/exampleModule.service.d.ts +8 -0
- package/dist/modules/ExampleModule/types/mainUi.type.d.ts +10 -0
- package/dist/vite.svg +1 -0
- package/dist/widget.css +2 -0
- package/package.json +79 -0
|
@@ -0,0 +1,3204 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
var __defProp = Object.defineProperty, __commonJSMin = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), __exportAll = (e, t) => {
|
|
4
|
+
let r = {};
|
|
5
|
+
for (var i in e) __defProp(r, i, {
|
|
6
|
+
get: e[i],
|
|
7
|
+
enumerable: !0
|
|
8
|
+
});
|
|
9
|
+
return t || __defProp(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
10
|
+
}, __require = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
11
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
12
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
13
|
+
}), Subscribable = class {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
16
|
+
}
|
|
17
|
+
subscribe(e) {
|
|
18
|
+
return this.listeners.add(e), this.onSubscribe(), () => {
|
|
19
|
+
this.listeners.delete(e), this.onUnsubscribe();
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
hasListeners() {
|
|
23
|
+
return this.listeners.size > 0;
|
|
24
|
+
}
|
|
25
|
+
onSubscribe() {}
|
|
26
|
+
onUnsubscribe() {}
|
|
27
|
+
}, defaultTimeoutProvider = {
|
|
28
|
+
setTimeout: (e, t) => setTimeout(e, t),
|
|
29
|
+
clearTimeout: (e) => clearTimeout(e),
|
|
30
|
+
setInterval: (e, t) => setInterval(e, t),
|
|
31
|
+
clearInterval: (e) => clearInterval(e)
|
|
32
|
+
}, timeoutManager = new class {
|
|
33
|
+
#e = defaultTimeoutProvider;
|
|
34
|
+
#t = !1;
|
|
35
|
+
setTimeoutProvider(e) {
|
|
36
|
+
process.env.NODE_ENV !== "production" && this.#t && e !== this.#e && console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.", {
|
|
37
|
+
previous: this.#e,
|
|
38
|
+
provider: e
|
|
39
|
+
}), this.#e = e, process.env.NODE_ENV !== "production" && (this.#t = !1);
|
|
40
|
+
}
|
|
41
|
+
setTimeout(e, t) {
|
|
42
|
+
return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setTimeout(e, t);
|
|
43
|
+
}
|
|
44
|
+
clearTimeout(e) {
|
|
45
|
+
this.#e.clearTimeout(e);
|
|
46
|
+
}
|
|
47
|
+
setInterval(e, t) {
|
|
48
|
+
return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setInterval(e, t);
|
|
49
|
+
}
|
|
50
|
+
clearInterval(e) {
|
|
51
|
+
this.#e.clearInterval(e);
|
|
52
|
+
}
|
|
53
|
+
}();
|
|
54
|
+
function systemSetTimeoutZero(e) {
|
|
55
|
+
setTimeout(e, 0);
|
|
56
|
+
}
|
|
57
|
+
var isServer = typeof window > "u" || "Deno" in globalThis;
|
|
58
|
+
function noop$1() {}
|
|
59
|
+
function functionalUpdate(e, t) {
|
|
60
|
+
return typeof e == "function" ? e(t) : e;
|
|
61
|
+
}
|
|
62
|
+
function isValidTimeout(e) {
|
|
63
|
+
return typeof e == "number" && e >= 0 && e !== Infinity;
|
|
64
|
+
}
|
|
65
|
+
function timeUntilStale(e, t) {
|
|
66
|
+
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
67
|
+
}
|
|
68
|
+
function resolveStaleTime(e, t) {
|
|
69
|
+
return typeof e == "function" ? e(t) : e;
|
|
70
|
+
}
|
|
71
|
+
function resolveEnabled(e, t) {
|
|
72
|
+
return typeof e == "function" ? e(t) : e;
|
|
73
|
+
}
|
|
74
|
+
function matchQuery(e, t) {
|
|
75
|
+
let { type: n = "all", exact: r, fetchStatus: i, predicate: a, queryKey: o, stale: s } = e;
|
|
76
|
+
if (o) {
|
|
77
|
+
if (r) {
|
|
78
|
+
if (t.queryHash !== hashQueryKeyByOptions(o, t.options)) return !1;
|
|
79
|
+
} else if (!partialMatchKey(t.queryKey, o)) return !1;
|
|
80
|
+
}
|
|
81
|
+
if (n !== "all") {
|
|
82
|
+
let e = t.isActive();
|
|
83
|
+
if (n === "active" && !e || n === "inactive" && e) return !1;
|
|
84
|
+
}
|
|
85
|
+
return !(typeof s == "boolean" && t.isStale() !== s || i && i !== t.state.fetchStatus || a && !a(t));
|
|
86
|
+
}
|
|
87
|
+
function matchMutation(e, t) {
|
|
88
|
+
let { exact: n, status: r, predicate: i, mutationKey: a } = e;
|
|
89
|
+
if (a) {
|
|
90
|
+
if (!t.options.mutationKey) return !1;
|
|
91
|
+
if (n) {
|
|
92
|
+
if (hashKey(t.options.mutationKey) !== hashKey(a)) return !1;
|
|
93
|
+
} else if (!partialMatchKey(t.options.mutationKey, a)) return !1;
|
|
94
|
+
}
|
|
95
|
+
return !(r && t.state.status !== r || i && !i(t));
|
|
96
|
+
}
|
|
97
|
+
function hashQueryKeyByOptions(e, t) {
|
|
98
|
+
return (t?.queryKeyHashFn || hashKey)(e);
|
|
99
|
+
}
|
|
100
|
+
function hashKey(e) {
|
|
101
|
+
return JSON.stringify(e, (e, t) => isPlainObject$1(t) ? Object.keys(t).sort().reduce((e, n) => (e[n] = t[n], e), {}) : t);
|
|
102
|
+
}
|
|
103
|
+
function partialMatchKey(e, t) {
|
|
104
|
+
return e === t ? !0 : typeof e == typeof t && e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((n) => partialMatchKey(e[n], t[n])) : !1;
|
|
105
|
+
}
|
|
106
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
107
|
+
function replaceEqualDeep(e, t, n = 0) {
|
|
108
|
+
if (e === t) return e;
|
|
109
|
+
if (n > 500) return t;
|
|
110
|
+
let r = isPlainArray(e) && isPlainArray(t);
|
|
111
|
+
if (!r && !(isPlainObject$1(e) && isPlainObject$1(t))) return t;
|
|
112
|
+
let i = (r ? e : Object.keys(e)).length, a = r ? t : Object.keys(t), o = a.length, s = r ? Array(o) : {}, c = 0;
|
|
113
|
+
for (let l = 0; l < o; l++) {
|
|
114
|
+
let o = r ? l : a[l], u = e[o], d = t[o];
|
|
115
|
+
if (u === d) {
|
|
116
|
+
s[o] = u, (r ? l < i : hasOwn.call(e, o)) && c++;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (u === null || d === null || typeof u != "object" || typeof d != "object") {
|
|
120
|
+
s[o] = d;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
let f = replaceEqualDeep(u, d, n + 1);
|
|
124
|
+
s[o] = f, f === u && c++;
|
|
125
|
+
}
|
|
126
|
+
return i === o && c === i ? e : s;
|
|
127
|
+
}
|
|
128
|
+
function shallowEqualObjects(e, t) {
|
|
129
|
+
if (!t || Object.keys(e).length !== Object.keys(t).length) return !1;
|
|
130
|
+
for (let n in e) if (e[n] !== t[n]) return !1;
|
|
131
|
+
return !0;
|
|
132
|
+
}
|
|
133
|
+
function isPlainArray(e) {
|
|
134
|
+
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
135
|
+
}
|
|
136
|
+
function isPlainObject$1(e) {
|
|
137
|
+
if (!hasObjectPrototype(e)) return !1;
|
|
138
|
+
let t = e.constructor;
|
|
139
|
+
if (t === void 0) return !0;
|
|
140
|
+
let n = t.prototype;
|
|
141
|
+
return !(!hasObjectPrototype(n) || !n.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
|
|
142
|
+
}
|
|
143
|
+
function hasObjectPrototype(e) {
|
|
144
|
+
return Object.prototype.toString.call(e) === "[object Object]";
|
|
145
|
+
}
|
|
146
|
+
function sleep(e) {
|
|
147
|
+
return new Promise((t) => {
|
|
148
|
+
timeoutManager.setTimeout(t, e);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function replaceData(e, t, n) {
|
|
152
|
+
if (typeof n.structuralSharing == "function") return n.structuralSharing(e, t);
|
|
153
|
+
if (n.structuralSharing !== !1) {
|
|
154
|
+
if (process.env.NODE_ENV !== "production") try {
|
|
155
|
+
return replaceEqualDeep(e, t);
|
|
156
|
+
} catch (e) {
|
|
157
|
+
throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${e}`), e;
|
|
158
|
+
}
|
|
159
|
+
return replaceEqualDeep(e, t);
|
|
160
|
+
}
|
|
161
|
+
return t;
|
|
162
|
+
}
|
|
163
|
+
function addToEnd(e, t, n = 0) {
|
|
164
|
+
let r = [...e, t];
|
|
165
|
+
return n && r.length > n ? r.slice(1) : r;
|
|
166
|
+
}
|
|
167
|
+
function addToStart(e, t, n = 0) {
|
|
168
|
+
let r = [t, ...e];
|
|
169
|
+
return n && r.length > n ? r.slice(0, -1) : r;
|
|
170
|
+
}
|
|
171
|
+
var skipToken = /* @__PURE__ */ Symbol();
|
|
172
|
+
function ensureQueryFn(e, t) {
|
|
173
|
+
return process.env.NODE_ENV !== "production" && e.queryFn === skipToken && console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === skipToken ? () => Promise.reject(/* @__PURE__ */ Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
|
|
174
|
+
}
|
|
175
|
+
function shouldThrowError(e, t) {
|
|
176
|
+
return typeof e == "function" ? e(...t) : !!e;
|
|
177
|
+
}
|
|
178
|
+
function addConsumeAwareSignal(e, t, n) {
|
|
179
|
+
let r = !1, i;
|
|
180
|
+
return Object.defineProperty(e, "signal", {
|
|
181
|
+
enumerable: !0,
|
|
182
|
+
get: () => (i ??= t(), r ? i : (r = !0, i.aborted ? n() : i.addEventListener("abort", n, { once: !0 }), i))
|
|
183
|
+
}), e;
|
|
184
|
+
}
|
|
185
|
+
var focusManager = new class extends Subscribable {
|
|
186
|
+
#e;
|
|
187
|
+
#t;
|
|
188
|
+
#n;
|
|
189
|
+
constructor() {
|
|
190
|
+
super(), this.#n = (e) => {
|
|
191
|
+
if (!isServer && window.addEventListener) {
|
|
192
|
+
let t = () => e();
|
|
193
|
+
return window.addEventListener("visibilitychange", t, !1), () => {
|
|
194
|
+
window.removeEventListener("visibilitychange", t);
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
onSubscribe() {
|
|
200
|
+
this.#t || this.setEventListener(this.#n);
|
|
201
|
+
}
|
|
202
|
+
onUnsubscribe() {
|
|
203
|
+
this.hasListeners() || (this.#t?.(), this.#t = void 0);
|
|
204
|
+
}
|
|
205
|
+
setEventListener(e) {
|
|
206
|
+
this.#n = e, this.#t?.(), this.#t = e((e) => {
|
|
207
|
+
typeof e == "boolean" ? this.setFocused(e) : this.onFocus();
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
setFocused(e) {
|
|
211
|
+
this.#e !== e && (this.#e = e, this.onFocus());
|
|
212
|
+
}
|
|
213
|
+
onFocus() {
|
|
214
|
+
let e = this.isFocused();
|
|
215
|
+
this.listeners.forEach((t) => {
|
|
216
|
+
t(e);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
isFocused() {
|
|
220
|
+
return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
|
|
221
|
+
}
|
|
222
|
+
}();
|
|
223
|
+
function pendingThenable() {
|
|
224
|
+
let e, t, n = new Promise((n, r) => {
|
|
225
|
+
e = n, t = r;
|
|
226
|
+
});
|
|
227
|
+
n.status = "pending", n.catch(() => {});
|
|
228
|
+
function r(e) {
|
|
229
|
+
Object.assign(n, e), delete n.resolve, delete n.reject;
|
|
230
|
+
}
|
|
231
|
+
return n.resolve = (t) => {
|
|
232
|
+
r({
|
|
233
|
+
status: "fulfilled",
|
|
234
|
+
value: t
|
|
235
|
+
}), e(t);
|
|
236
|
+
}, n.reject = (e) => {
|
|
237
|
+
r({
|
|
238
|
+
status: "rejected",
|
|
239
|
+
reason: e
|
|
240
|
+
}), t(e);
|
|
241
|
+
}, n;
|
|
242
|
+
}
|
|
243
|
+
var defaultScheduler = systemSetTimeoutZero;
|
|
244
|
+
function createNotifyManager() {
|
|
245
|
+
let e = [], t = 0, n = (e) => {
|
|
246
|
+
e();
|
|
247
|
+
}, r = (e) => {
|
|
248
|
+
e();
|
|
249
|
+
}, i = defaultScheduler, a = (r) => {
|
|
250
|
+
t ? e.push(r) : i(() => {
|
|
251
|
+
n(r);
|
|
252
|
+
});
|
|
253
|
+
}, o = () => {
|
|
254
|
+
let t = e;
|
|
255
|
+
e = [], t.length && i(() => {
|
|
256
|
+
r(() => {
|
|
257
|
+
t.forEach((e) => {
|
|
258
|
+
n(e);
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
return {
|
|
264
|
+
batch: (e) => {
|
|
265
|
+
let n;
|
|
266
|
+
t++;
|
|
267
|
+
try {
|
|
268
|
+
n = e();
|
|
269
|
+
} finally {
|
|
270
|
+
t--, t || o();
|
|
271
|
+
}
|
|
272
|
+
return n;
|
|
273
|
+
},
|
|
274
|
+
batchCalls: (e) => (...t) => {
|
|
275
|
+
a(() => {
|
|
276
|
+
e(...t);
|
|
277
|
+
});
|
|
278
|
+
},
|
|
279
|
+
schedule: a,
|
|
280
|
+
setNotifyFunction: (e) => {
|
|
281
|
+
n = e;
|
|
282
|
+
},
|
|
283
|
+
setBatchNotifyFunction: (e) => {
|
|
284
|
+
r = e;
|
|
285
|
+
},
|
|
286
|
+
setScheduler: (e) => {
|
|
287
|
+
i = e;
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
var notifyManager = createNotifyManager(), onlineManager = new class extends Subscribable {
|
|
292
|
+
#e = !0;
|
|
293
|
+
#t;
|
|
294
|
+
#n;
|
|
295
|
+
constructor() {
|
|
296
|
+
super(), this.#n = (e) => {
|
|
297
|
+
if (!isServer && window.addEventListener) {
|
|
298
|
+
let t = () => e(!0), n = () => e(!1);
|
|
299
|
+
return window.addEventListener("online", t, !1), window.addEventListener("offline", n, !1), () => {
|
|
300
|
+
window.removeEventListener("online", t), window.removeEventListener("offline", n);
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
onSubscribe() {
|
|
306
|
+
this.#t || this.setEventListener(this.#n);
|
|
307
|
+
}
|
|
308
|
+
onUnsubscribe() {
|
|
309
|
+
this.hasListeners() || (this.#t?.(), this.#t = void 0);
|
|
310
|
+
}
|
|
311
|
+
setEventListener(e) {
|
|
312
|
+
this.#n = e, this.#t?.(), this.#t = e(this.setOnline.bind(this));
|
|
313
|
+
}
|
|
314
|
+
setOnline(e) {
|
|
315
|
+
this.#e !== e && (this.#e = e, this.listeners.forEach((t) => {
|
|
316
|
+
t(e);
|
|
317
|
+
}));
|
|
318
|
+
}
|
|
319
|
+
isOnline() {
|
|
320
|
+
return this.#e;
|
|
321
|
+
}
|
|
322
|
+
}();
|
|
323
|
+
function defaultRetryDelay(e) {
|
|
324
|
+
return Math.min(1e3 * 2 ** e, 3e4);
|
|
325
|
+
}
|
|
326
|
+
function canFetch(e) {
|
|
327
|
+
return (e ?? "online") === "online" ? onlineManager.isOnline() : !0;
|
|
328
|
+
}
|
|
329
|
+
var CancelledError = class extends Error {
|
|
330
|
+
constructor(e) {
|
|
331
|
+
super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
function createRetryer(e) {
|
|
335
|
+
let t = !1, n = 0, r, i = pendingThenable(), a = () => i.status !== "pending", o = (t) => {
|
|
336
|
+
if (!a()) {
|
|
337
|
+
let n = new CancelledError(t);
|
|
338
|
+
p(n), e.onCancel?.(n);
|
|
339
|
+
}
|
|
340
|
+
}, s = () => {
|
|
341
|
+
t = !0;
|
|
342
|
+
}, c = () => {
|
|
343
|
+
t = !1;
|
|
344
|
+
}, l = () => focusManager.isFocused() && (e.networkMode === "always" || onlineManager.isOnline()) && e.canRun(), d = () => canFetch(e.networkMode) && e.canRun(), f = (e) => {
|
|
345
|
+
a() || (r?.(), i.resolve(e));
|
|
346
|
+
}, p = (e) => {
|
|
347
|
+
a() || (r?.(), i.reject(e));
|
|
348
|
+
}, m = () => new Promise((t) => {
|
|
349
|
+
r = (e) => {
|
|
350
|
+
(a() || l()) && t(e);
|
|
351
|
+
}, e.onPause?.();
|
|
352
|
+
}).then(() => {
|
|
353
|
+
r = void 0, a() || e.onContinue?.();
|
|
354
|
+
}), h = () => {
|
|
355
|
+
if (a()) return;
|
|
356
|
+
let r, i = n === 0 ? e.initialPromise : void 0;
|
|
357
|
+
try {
|
|
358
|
+
r = i ?? e.fn();
|
|
359
|
+
} catch (e) {
|
|
360
|
+
r = Promise.reject(e);
|
|
361
|
+
}
|
|
362
|
+
Promise.resolve(r).then(f).catch((r) => {
|
|
363
|
+
if (a()) return;
|
|
364
|
+
let i = e.retry ?? (isServer ? 0 : 3), o = e.retryDelay ?? defaultRetryDelay, s = typeof o == "function" ? o(n, r) : o, c = i === !0 || typeof i == "number" && n < i || typeof i == "function" && i(n, r);
|
|
365
|
+
if (t || !c) {
|
|
366
|
+
p(r);
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
n++, e.onFail?.(n, r), sleep(s).then(() => l() ? void 0 : m()).then(() => {
|
|
370
|
+
t ? p(r) : h();
|
|
371
|
+
});
|
|
372
|
+
});
|
|
373
|
+
};
|
|
374
|
+
return {
|
|
375
|
+
promise: i,
|
|
376
|
+
status: () => i.status,
|
|
377
|
+
cancel: o,
|
|
378
|
+
continue: () => (r?.(), i),
|
|
379
|
+
cancelRetry: s,
|
|
380
|
+
continueRetry: c,
|
|
381
|
+
canStart: d,
|
|
382
|
+
start: () => (d() ? h() : m().then(h), i)
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
var Removable = class {
|
|
386
|
+
#e;
|
|
387
|
+
destroy() {
|
|
388
|
+
this.clearGcTimeout();
|
|
389
|
+
}
|
|
390
|
+
scheduleGc() {
|
|
391
|
+
this.clearGcTimeout(), isValidTimeout(this.gcTime) && (this.#e = timeoutManager.setTimeout(() => {
|
|
392
|
+
this.optionalRemove();
|
|
393
|
+
}, this.gcTime));
|
|
394
|
+
}
|
|
395
|
+
updateGcTime(e) {
|
|
396
|
+
this.gcTime = Math.max(this.gcTime || 0, e ?? (isServer ? Infinity : 300 * 1e3));
|
|
397
|
+
}
|
|
398
|
+
clearGcTimeout() {
|
|
399
|
+
this.#e &&= (timeoutManager.clearTimeout(this.#e), void 0);
|
|
400
|
+
}
|
|
401
|
+
}, Query = class extends Removable {
|
|
402
|
+
#e;
|
|
403
|
+
#t;
|
|
404
|
+
#n;
|
|
405
|
+
#r;
|
|
406
|
+
#i;
|
|
407
|
+
#a;
|
|
408
|
+
#o;
|
|
409
|
+
constructor(e) {
|
|
410
|
+
super(), this.#o = !1, this.#a = e.defaultOptions, this.setOptions(e.options), this.observers = [], this.#r = e.client, this.#n = this.#r.getQueryCache(), this.queryKey = e.queryKey, this.queryHash = e.queryHash, this.#e = getDefaultState$1(this.options), this.state = e.state ?? this.#e, this.scheduleGc();
|
|
411
|
+
}
|
|
412
|
+
get meta() {
|
|
413
|
+
return this.options.meta;
|
|
414
|
+
}
|
|
415
|
+
get promise() {
|
|
416
|
+
return this.#i?.promise;
|
|
417
|
+
}
|
|
418
|
+
setOptions(e) {
|
|
419
|
+
if (this.options = {
|
|
420
|
+
...this.#a,
|
|
421
|
+
...e
|
|
422
|
+
}, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
|
|
423
|
+
let e = getDefaultState$1(this.options);
|
|
424
|
+
e.data !== void 0 && (this.setState(successState(e.data, e.dataUpdatedAt)), this.#e = e);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
optionalRemove() {
|
|
428
|
+
!this.observers.length && this.state.fetchStatus === "idle" && this.#n.remove(this);
|
|
429
|
+
}
|
|
430
|
+
setData(e, t) {
|
|
431
|
+
let n = replaceData(this.state.data, e, this.options);
|
|
432
|
+
return this.#s({
|
|
433
|
+
data: n,
|
|
434
|
+
type: "success",
|
|
435
|
+
dataUpdatedAt: t?.updatedAt,
|
|
436
|
+
manual: t?.manual
|
|
437
|
+
}), n;
|
|
438
|
+
}
|
|
439
|
+
setState(e, t) {
|
|
440
|
+
this.#s({
|
|
441
|
+
type: "setState",
|
|
442
|
+
state: e,
|
|
443
|
+
setStateOptions: t
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
cancel(e) {
|
|
447
|
+
let t = this.#i?.promise;
|
|
448
|
+
return this.#i?.cancel(e), t ? t.then(noop$1).catch(noop$1) : Promise.resolve();
|
|
449
|
+
}
|
|
450
|
+
destroy() {
|
|
451
|
+
super.destroy(), this.cancel({ silent: !0 });
|
|
452
|
+
}
|
|
453
|
+
reset() {
|
|
454
|
+
this.destroy(), this.setState(this.#e);
|
|
455
|
+
}
|
|
456
|
+
isActive() {
|
|
457
|
+
return this.observers.some((e) => resolveEnabled(e.options.enabled, this) !== !1);
|
|
458
|
+
}
|
|
459
|
+
isDisabled() {
|
|
460
|
+
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === skipToken || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
|
|
461
|
+
}
|
|
462
|
+
isStatic() {
|
|
463
|
+
return this.getObserversCount() > 0 ? this.observers.some((e) => resolveStaleTime(e.options.staleTime, this) === "static") : !1;
|
|
464
|
+
}
|
|
465
|
+
isStale() {
|
|
466
|
+
return this.getObserversCount() > 0 ? this.observers.some((e) => e.getCurrentResult().isStale) : this.state.data === void 0 || this.state.isInvalidated;
|
|
467
|
+
}
|
|
468
|
+
isStaleByTime(e = 0) {
|
|
469
|
+
return this.state.data === void 0 ? !0 : e === "static" ? !1 : this.state.isInvalidated ? !0 : !timeUntilStale(this.state.dataUpdatedAt, e);
|
|
470
|
+
}
|
|
471
|
+
onFocus() {
|
|
472
|
+
this.observers.find((e) => e.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: !1 }), this.#i?.continue();
|
|
473
|
+
}
|
|
474
|
+
onOnline() {
|
|
475
|
+
this.observers.find((e) => e.shouldFetchOnReconnect())?.refetch({ cancelRefetch: !1 }), this.#i?.continue();
|
|
476
|
+
}
|
|
477
|
+
addObserver(e) {
|
|
478
|
+
this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), this.#n.notify({
|
|
479
|
+
type: "observerAdded",
|
|
480
|
+
query: this,
|
|
481
|
+
observer: e
|
|
482
|
+
}));
|
|
483
|
+
}
|
|
484
|
+
removeObserver(e) {
|
|
485
|
+
this.observers.includes(e) && (this.observers = this.observers.filter((t) => t !== e), this.observers.length || (this.#i && (this.#o ? this.#i.cancel({ revert: !0 }) : this.#i.cancelRetry()), this.scheduleGc()), this.#n.notify({
|
|
486
|
+
type: "observerRemoved",
|
|
487
|
+
query: this,
|
|
488
|
+
observer: e
|
|
489
|
+
}));
|
|
490
|
+
}
|
|
491
|
+
getObserversCount() {
|
|
492
|
+
return this.observers.length;
|
|
493
|
+
}
|
|
494
|
+
invalidate() {
|
|
495
|
+
this.state.isInvalidated || this.#s({ type: "invalidate" });
|
|
496
|
+
}
|
|
497
|
+
async fetch(e, t) {
|
|
498
|
+
if (this.state.fetchStatus !== "idle" && this.#i?.status() !== "rejected") {
|
|
499
|
+
if (this.state.data !== void 0 && t?.cancelRefetch) this.cancel({ silent: !0 });
|
|
500
|
+
else if (this.#i) return this.#i.continueRetry(), this.#i.promise;
|
|
501
|
+
}
|
|
502
|
+
if (e && this.setOptions(e), !this.options.queryFn) {
|
|
503
|
+
let e = this.observers.find((e) => e.options.queryFn);
|
|
504
|
+
e && this.setOptions(e.options);
|
|
505
|
+
}
|
|
506
|
+
process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));
|
|
507
|
+
let n = new AbortController(), r = (e) => {
|
|
508
|
+
Object.defineProperty(e, "signal", {
|
|
509
|
+
enumerable: !0,
|
|
510
|
+
get: () => (this.#o = !0, n.signal)
|
|
511
|
+
});
|
|
512
|
+
}, i = () => {
|
|
513
|
+
let e = ensureQueryFn(this.options, t), n = (() => {
|
|
514
|
+
let e = {
|
|
515
|
+
client: this.#r,
|
|
516
|
+
queryKey: this.queryKey,
|
|
517
|
+
meta: this.meta
|
|
518
|
+
};
|
|
519
|
+
return r(e), e;
|
|
520
|
+
})();
|
|
521
|
+
return this.#o = !1, this.options.persister ? this.options.persister(e, n, this) : e(n);
|
|
522
|
+
}, a = (() => {
|
|
523
|
+
let e = {
|
|
524
|
+
fetchOptions: t,
|
|
525
|
+
options: this.options,
|
|
526
|
+
queryKey: this.queryKey,
|
|
527
|
+
client: this.#r,
|
|
528
|
+
state: this.state,
|
|
529
|
+
fetchFn: i
|
|
530
|
+
};
|
|
531
|
+
return r(e), e;
|
|
532
|
+
})();
|
|
533
|
+
this.options.behavior?.onFetch(a, this), this.#t = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== a.fetchOptions?.meta) && this.#s({
|
|
534
|
+
type: "fetch",
|
|
535
|
+
meta: a.fetchOptions?.meta
|
|
536
|
+
}), this.#i = createRetryer({
|
|
537
|
+
initialPromise: t?.initialPromise,
|
|
538
|
+
fn: a.fetchFn,
|
|
539
|
+
onCancel: (e) => {
|
|
540
|
+
e instanceof CancelledError && e.revert && this.setState({
|
|
541
|
+
...this.#t,
|
|
542
|
+
fetchStatus: "idle"
|
|
543
|
+
}), n.abort();
|
|
544
|
+
},
|
|
545
|
+
onFail: (e, t) => {
|
|
546
|
+
this.#s({
|
|
547
|
+
type: "failed",
|
|
548
|
+
failureCount: e,
|
|
549
|
+
error: t
|
|
550
|
+
});
|
|
551
|
+
},
|
|
552
|
+
onPause: () => {
|
|
553
|
+
this.#s({ type: "pause" });
|
|
554
|
+
},
|
|
555
|
+
onContinue: () => {
|
|
556
|
+
this.#s({ type: "continue" });
|
|
557
|
+
},
|
|
558
|
+
retry: a.options.retry,
|
|
559
|
+
retryDelay: a.options.retryDelay,
|
|
560
|
+
networkMode: a.options.networkMode,
|
|
561
|
+
canRun: () => !0
|
|
562
|
+
});
|
|
563
|
+
try {
|
|
564
|
+
let e = await this.#i.start();
|
|
565
|
+
if (e === void 0) throw process.env.NODE_ENV !== "production" && console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`), Error(`${this.queryHash} data is undefined`);
|
|
566
|
+
return this.setData(e), this.#n.config.onSuccess?.(e, this), this.#n.config.onSettled?.(e, this.state.error, this), e;
|
|
567
|
+
} catch (e) {
|
|
568
|
+
if (e instanceof CancelledError) {
|
|
569
|
+
if (e.silent) return this.#i.promise;
|
|
570
|
+
if (e.revert) {
|
|
571
|
+
if (this.state.data === void 0) throw e;
|
|
572
|
+
return this.state.data;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
throw this.#s({
|
|
576
|
+
type: "error",
|
|
577
|
+
error: e
|
|
578
|
+
}), this.#n.config.onError?.(e, this), this.#n.config.onSettled?.(this.state.data, e, this), e;
|
|
579
|
+
} finally {
|
|
580
|
+
this.scheduleGc();
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
#s(e) {
|
|
584
|
+
this.state = ((t) => {
|
|
585
|
+
switch (e.type) {
|
|
586
|
+
case "failed": return {
|
|
587
|
+
...t,
|
|
588
|
+
fetchFailureCount: e.failureCount,
|
|
589
|
+
fetchFailureReason: e.error
|
|
590
|
+
};
|
|
591
|
+
case "pause": return {
|
|
592
|
+
...t,
|
|
593
|
+
fetchStatus: "paused"
|
|
594
|
+
};
|
|
595
|
+
case "continue": return {
|
|
596
|
+
...t,
|
|
597
|
+
fetchStatus: "fetching"
|
|
598
|
+
};
|
|
599
|
+
case "fetch": return {
|
|
600
|
+
...t,
|
|
601
|
+
...fetchState(t.data, this.options),
|
|
602
|
+
fetchMeta: e.meta ?? null
|
|
603
|
+
};
|
|
604
|
+
case "success":
|
|
605
|
+
let n = {
|
|
606
|
+
...t,
|
|
607
|
+
...successState(e.data, e.dataUpdatedAt),
|
|
608
|
+
dataUpdateCount: t.dataUpdateCount + 1,
|
|
609
|
+
...!e.manual && {
|
|
610
|
+
fetchStatus: "idle",
|
|
611
|
+
fetchFailureCount: 0,
|
|
612
|
+
fetchFailureReason: null
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
return this.#t = e.manual ? n : void 0, n;
|
|
616
|
+
case "error":
|
|
617
|
+
let r = e.error;
|
|
618
|
+
return {
|
|
619
|
+
...t,
|
|
620
|
+
error: r,
|
|
621
|
+
errorUpdateCount: t.errorUpdateCount + 1,
|
|
622
|
+
errorUpdatedAt: Date.now(),
|
|
623
|
+
fetchFailureCount: t.fetchFailureCount + 1,
|
|
624
|
+
fetchFailureReason: r,
|
|
625
|
+
fetchStatus: "idle",
|
|
626
|
+
status: "error",
|
|
627
|
+
isInvalidated: !0
|
|
628
|
+
};
|
|
629
|
+
case "invalidate": return {
|
|
630
|
+
...t,
|
|
631
|
+
isInvalidated: !0
|
|
632
|
+
};
|
|
633
|
+
case "setState": return {
|
|
634
|
+
...t,
|
|
635
|
+
...e.state
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
})(this.state), notifyManager.batch(() => {
|
|
639
|
+
this.observers.forEach((e) => {
|
|
640
|
+
e.onQueryUpdate();
|
|
641
|
+
}), this.#n.notify({
|
|
642
|
+
query: this,
|
|
643
|
+
type: "updated",
|
|
644
|
+
action: e
|
|
645
|
+
});
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
function fetchState(e, t) {
|
|
650
|
+
return {
|
|
651
|
+
fetchFailureCount: 0,
|
|
652
|
+
fetchFailureReason: null,
|
|
653
|
+
fetchStatus: canFetch(t.networkMode) ? "fetching" : "paused",
|
|
654
|
+
...e === void 0 && {
|
|
655
|
+
error: null,
|
|
656
|
+
status: "pending"
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
function successState(e, t) {
|
|
661
|
+
return {
|
|
662
|
+
data: e,
|
|
663
|
+
dataUpdatedAt: t ?? Date.now(),
|
|
664
|
+
error: null,
|
|
665
|
+
isInvalidated: !1,
|
|
666
|
+
status: "success"
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
function getDefaultState$1(e) {
|
|
670
|
+
let t = typeof e.initialData == "function" ? e.initialData() : e.initialData, n = t !== void 0, r = n ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
|
|
671
|
+
return {
|
|
672
|
+
data: t,
|
|
673
|
+
dataUpdateCount: 0,
|
|
674
|
+
dataUpdatedAt: n ? r ?? Date.now() : 0,
|
|
675
|
+
error: null,
|
|
676
|
+
errorUpdateCount: 0,
|
|
677
|
+
errorUpdatedAt: 0,
|
|
678
|
+
fetchFailureCount: 0,
|
|
679
|
+
fetchFailureReason: null,
|
|
680
|
+
fetchMeta: null,
|
|
681
|
+
isInvalidated: !1,
|
|
682
|
+
status: n ? "success" : "pending",
|
|
683
|
+
fetchStatus: "idle"
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
function infiniteQueryBehavior(e) {
|
|
687
|
+
return { onFetch: (t, n) => {
|
|
688
|
+
let r = t.options, i = t.fetchOptions?.meta?.fetchMore?.direction, a = t.state.data?.pages || [], o = t.state.data?.pageParams || [], s = {
|
|
689
|
+
pages: [],
|
|
690
|
+
pageParams: []
|
|
691
|
+
}, c = 0, l = async () => {
|
|
692
|
+
let n = !1, l = (e) => {
|
|
693
|
+
addConsumeAwareSignal(e, () => t.signal, () => n = !0);
|
|
694
|
+
}, u = ensureQueryFn(t.options, t.fetchOptions), d = async (e, r, i) => {
|
|
695
|
+
if (n) return Promise.reject();
|
|
696
|
+
if (r == null && e.pages.length) return Promise.resolve(e);
|
|
697
|
+
let a = await u((() => {
|
|
698
|
+
let e = {
|
|
699
|
+
client: t.client,
|
|
700
|
+
queryKey: t.queryKey,
|
|
701
|
+
pageParam: r,
|
|
702
|
+
direction: i ? "backward" : "forward",
|
|
703
|
+
meta: t.options.meta
|
|
704
|
+
};
|
|
705
|
+
return l(e), e;
|
|
706
|
+
})()), { maxPages: o } = t.options, s = i ? addToStart : addToEnd;
|
|
707
|
+
return {
|
|
708
|
+
pages: s(e.pages, a, o),
|
|
709
|
+
pageParams: s(e.pageParams, r, o)
|
|
710
|
+
};
|
|
711
|
+
};
|
|
712
|
+
if (i && a.length) {
|
|
713
|
+
let e = i === "backward", t = e ? getPreviousPageParam : getNextPageParam, n = {
|
|
714
|
+
pages: a,
|
|
715
|
+
pageParams: o
|
|
716
|
+
};
|
|
717
|
+
s = await d(n, t(r, n), e);
|
|
718
|
+
} else {
|
|
719
|
+
let t = e ?? a.length;
|
|
720
|
+
do {
|
|
721
|
+
let e = c === 0 ? o[0] ?? r.initialPageParam : getNextPageParam(r, s);
|
|
722
|
+
if (c > 0 && e == null) break;
|
|
723
|
+
s = await d(s, e), c++;
|
|
724
|
+
} while (c < t);
|
|
725
|
+
}
|
|
726
|
+
return s;
|
|
727
|
+
};
|
|
728
|
+
t.options.persister ? t.fetchFn = () => t.options.persister?.(l, {
|
|
729
|
+
client: t.client,
|
|
730
|
+
queryKey: t.queryKey,
|
|
731
|
+
meta: t.options.meta,
|
|
732
|
+
signal: t.signal
|
|
733
|
+
}, n) : t.fetchFn = l;
|
|
734
|
+
} };
|
|
735
|
+
}
|
|
736
|
+
function getNextPageParam(e, { pages: t, pageParams: n }) {
|
|
737
|
+
let r = t.length - 1;
|
|
738
|
+
return t.length > 0 ? e.getNextPageParam(t[r], t, n[r], n) : void 0;
|
|
739
|
+
}
|
|
740
|
+
function getPreviousPageParam(e, { pages: t, pageParams: n }) {
|
|
741
|
+
return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, n[0], n) : void 0;
|
|
742
|
+
}
|
|
743
|
+
var Mutation = class extends Removable {
|
|
744
|
+
#e;
|
|
745
|
+
#t;
|
|
746
|
+
#n;
|
|
747
|
+
#r;
|
|
748
|
+
constructor(e) {
|
|
749
|
+
super(), this.#e = e.client, this.mutationId = e.mutationId, this.#n = e.mutationCache, this.#t = [], this.state = e.state || getDefaultState(), this.setOptions(e.options), this.scheduleGc();
|
|
750
|
+
}
|
|
751
|
+
setOptions(e) {
|
|
752
|
+
this.options = e, this.updateGcTime(this.options.gcTime);
|
|
753
|
+
}
|
|
754
|
+
get meta() {
|
|
755
|
+
return this.options.meta;
|
|
756
|
+
}
|
|
757
|
+
addObserver(e) {
|
|
758
|
+
this.#t.includes(e) || (this.#t.push(e), this.clearGcTimeout(), this.#n.notify({
|
|
759
|
+
type: "observerAdded",
|
|
760
|
+
mutation: this,
|
|
761
|
+
observer: e
|
|
762
|
+
}));
|
|
763
|
+
}
|
|
764
|
+
removeObserver(e) {
|
|
765
|
+
this.#t = this.#t.filter((t) => t !== e), this.scheduleGc(), this.#n.notify({
|
|
766
|
+
type: "observerRemoved",
|
|
767
|
+
mutation: this,
|
|
768
|
+
observer: e
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
optionalRemove() {
|
|
772
|
+
this.#t.length || (this.state.status === "pending" ? this.scheduleGc() : this.#n.remove(this));
|
|
773
|
+
}
|
|
774
|
+
continue() {
|
|
775
|
+
return this.#r?.continue() ?? this.execute(this.state.variables);
|
|
776
|
+
}
|
|
777
|
+
async execute(e) {
|
|
778
|
+
let t = () => {
|
|
779
|
+
this.#i({ type: "continue" });
|
|
780
|
+
}, n = {
|
|
781
|
+
client: this.#e,
|
|
782
|
+
meta: this.options.meta,
|
|
783
|
+
mutationKey: this.options.mutationKey
|
|
784
|
+
};
|
|
785
|
+
this.#r = createRetryer({
|
|
786
|
+
fn: () => this.options.mutationFn ? this.options.mutationFn(e, n) : Promise.reject(/* @__PURE__ */ Error("No mutationFn found")),
|
|
787
|
+
onFail: (e, t) => {
|
|
788
|
+
this.#i({
|
|
789
|
+
type: "failed",
|
|
790
|
+
failureCount: e,
|
|
791
|
+
error: t
|
|
792
|
+
});
|
|
793
|
+
},
|
|
794
|
+
onPause: () => {
|
|
795
|
+
this.#i({ type: "pause" });
|
|
796
|
+
},
|
|
797
|
+
onContinue: t,
|
|
798
|
+
retry: this.options.retry ?? 0,
|
|
799
|
+
retryDelay: this.options.retryDelay,
|
|
800
|
+
networkMode: this.options.networkMode,
|
|
801
|
+
canRun: () => this.#n.canRun(this)
|
|
802
|
+
});
|
|
803
|
+
let r = this.state.status === "pending", i = !this.#r.canStart();
|
|
804
|
+
try {
|
|
805
|
+
if (r) t();
|
|
806
|
+
else {
|
|
807
|
+
this.#i({
|
|
808
|
+
type: "pending",
|
|
809
|
+
variables: e,
|
|
810
|
+
isPaused: i
|
|
811
|
+
}), this.#n.config.onMutate && await this.#n.config.onMutate(e, this, n);
|
|
812
|
+
let t = await this.options.onMutate?.(e, n);
|
|
813
|
+
t !== this.state.context && this.#i({
|
|
814
|
+
type: "pending",
|
|
815
|
+
context: t,
|
|
816
|
+
variables: e,
|
|
817
|
+
isPaused: i
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
let a = await this.#r.start();
|
|
821
|
+
return await this.#n.config.onSuccess?.(a, e, this.state.context, this, n), await this.options.onSuccess?.(a, e, this.state.context, n), await this.#n.config.onSettled?.(a, null, this.state.variables, this.state.context, this, n), await this.options.onSettled?.(a, null, e, this.state.context, n), this.#i({
|
|
822
|
+
type: "success",
|
|
823
|
+
data: a
|
|
824
|
+
}), a;
|
|
825
|
+
} catch (t) {
|
|
826
|
+
try {
|
|
827
|
+
await this.#n.config.onError?.(t, e, this.state.context, this, n);
|
|
828
|
+
} catch (e) {
|
|
829
|
+
Promise.reject(e);
|
|
830
|
+
}
|
|
831
|
+
try {
|
|
832
|
+
await this.options.onError?.(t, e, this.state.context, n);
|
|
833
|
+
} catch (e) {
|
|
834
|
+
Promise.reject(e);
|
|
835
|
+
}
|
|
836
|
+
try {
|
|
837
|
+
await this.#n.config.onSettled?.(void 0, t, this.state.variables, this.state.context, this, n);
|
|
838
|
+
} catch (e) {
|
|
839
|
+
Promise.reject(e);
|
|
840
|
+
}
|
|
841
|
+
try {
|
|
842
|
+
await this.options.onSettled?.(void 0, t, e, this.state.context, n);
|
|
843
|
+
} catch (e) {
|
|
844
|
+
Promise.reject(e);
|
|
845
|
+
}
|
|
846
|
+
throw this.#i({
|
|
847
|
+
type: "error",
|
|
848
|
+
error: t
|
|
849
|
+
}), t;
|
|
850
|
+
} finally {
|
|
851
|
+
this.#n.runNext(this);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
#i(e) {
|
|
855
|
+
this.state = ((t) => {
|
|
856
|
+
switch (e.type) {
|
|
857
|
+
case "failed": return {
|
|
858
|
+
...t,
|
|
859
|
+
failureCount: e.failureCount,
|
|
860
|
+
failureReason: e.error
|
|
861
|
+
};
|
|
862
|
+
case "pause": return {
|
|
863
|
+
...t,
|
|
864
|
+
isPaused: !0
|
|
865
|
+
};
|
|
866
|
+
case "continue": return {
|
|
867
|
+
...t,
|
|
868
|
+
isPaused: !1
|
|
869
|
+
};
|
|
870
|
+
case "pending": return {
|
|
871
|
+
...t,
|
|
872
|
+
context: e.context,
|
|
873
|
+
data: void 0,
|
|
874
|
+
failureCount: 0,
|
|
875
|
+
failureReason: null,
|
|
876
|
+
error: null,
|
|
877
|
+
isPaused: e.isPaused,
|
|
878
|
+
status: "pending",
|
|
879
|
+
variables: e.variables,
|
|
880
|
+
submittedAt: Date.now()
|
|
881
|
+
};
|
|
882
|
+
case "success": return {
|
|
883
|
+
...t,
|
|
884
|
+
data: e.data,
|
|
885
|
+
failureCount: 0,
|
|
886
|
+
failureReason: null,
|
|
887
|
+
error: null,
|
|
888
|
+
status: "success",
|
|
889
|
+
isPaused: !1
|
|
890
|
+
};
|
|
891
|
+
case "error": return {
|
|
892
|
+
...t,
|
|
893
|
+
data: void 0,
|
|
894
|
+
error: e.error,
|
|
895
|
+
failureCount: t.failureCount + 1,
|
|
896
|
+
failureReason: e.error,
|
|
897
|
+
isPaused: !1,
|
|
898
|
+
status: "error"
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
})(this.state), notifyManager.batch(() => {
|
|
902
|
+
this.#t.forEach((t) => {
|
|
903
|
+
t.onMutationUpdate(e);
|
|
904
|
+
}), this.#n.notify({
|
|
905
|
+
mutation: this,
|
|
906
|
+
type: "updated",
|
|
907
|
+
action: e
|
|
908
|
+
});
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
};
|
|
912
|
+
function getDefaultState() {
|
|
913
|
+
return {
|
|
914
|
+
context: void 0,
|
|
915
|
+
data: void 0,
|
|
916
|
+
error: null,
|
|
917
|
+
failureCount: 0,
|
|
918
|
+
failureReason: null,
|
|
919
|
+
isPaused: !1,
|
|
920
|
+
status: "idle",
|
|
921
|
+
variables: void 0,
|
|
922
|
+
submittedAt: 0
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
var MutationCache = class extends Subscribable {
|
|
926
|
+
constructor(e = {}) {
|
|
927
|
+
super(), this.config = e, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#n = 0;
|
|
928
|
+
}
|
|
929
|
+
#e;
|
|
930
|
+
#t;
|
|
931
|
+
#n;
|
|
932
|
+
build(e, t, n) {
|
|
933
|
+
let r = new Mutation({
|
|
934
|
+
client: e,
|
|
935
|
+
mutationCache: this,
|
|
936
|
+
mutationId: ++this.#n,
|
|
937
|
+
options: e.defaultMutationOptions(t),
|
|
938
|
+
state: n
|
|
939
|
+
});
|
|
940
|
+
return this.add(r), r;
|
|
941
|
+
}
|
|
942
|
+
add(e) {
|
|
943
|
+
this.#e.add(e);
|
|
944
|
+
let t = scopeFor(e);
|
|
945
|
+
if (typeof t == "string") {
|
|
946
|
+
let n = this.#t.get(t);
|
|
947
|
+
n ? n.push(e) : this.#t.set(t, [e]);
|
|
948
|
+
}
|
|
949
|
+
this.notify({
|
|
950
|
+
type: "added",
|
|
951
|
+
mutation: e
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
remove(e) {
|
|
955
|
+
if (this.#e.delete(e)) {
|
|
956
|
+
let t = scopeFor(e);
|
|
957
|
+
if (typeof t == "string") {
|
|
958
|
+
let n = this.#t.get(t);
|
|
959
|
+
if (n) if (n.length > 1) {
|
|
960
|
+
let t = n.indexOf(e);
|
|
961
|
+
t !== -1 && n.splice(t, 1);
|
|
962
|
+
} else n[0] === e && this.#t.delete(t);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
this.notify({
|
|
966
|
+
type: "removed",
|
|
967
|
+
mutation: e
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
canRun(e) {
|
|
971
|
+
let t = scopeFor(e);
|
|
972
|
+
if (typeof t == "string") {
|
|
973
|
+
let n = this.#t.get(t)?.find((e) => e.state.status === "pending");
|
|
974
|
+
return !n || n === e;
|
|
975
|
+
} else return !0;
|
|
976
|
+
}
|
|
977
|
+
runNext(e) {
|
|
978
|
+
let t = scopeFor(e);
|
|
979
|
+
return typeof t == "string" ? (this.#t.get(t)?.find((t) => t !== e && t.state.isPaused))?.continue() ?? Promise.resolve() : Promise.resolve();
|
|
980
|
+
}
|
|
981
|
+
clear() {
|
|
982
|
+
notifyManager.batch(() => {
|
|
983
|
+
this.#e.forEach((e) => {
|
|
984
|
+
this.notify({
|
|
985
|
+
type: "removed",
|
|
986
|
+
mutation: e
|
|
987
|
+
});
|
|
988
|
+
}), this.#e.clear(), this.#t.clear();
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
getAll() {
|
|
992
|
+
return Array.from(this.#e);
|
|
993
|
+
}
|
|
994
|
+
find(e) {
|
|
995
|
+
let t = {
|
|
996
|
+
exact: !0,
|
|
997
|
+
...e
|
|
998
|
+
};
|
|
999
|
+
return this.getAll().find((e) => matchMutation(t, e));
|
|
1000
|
+
}
|
|
1001
|
+
findAll(e = {}) {
|
|
1002
|
+
return this.getAll().filter((t) => matchMutation(e, t));
|
|
1003
|
+
}
|
|
1004
|
+
notify(e) {
|
|
1005
|
+
notifyManager.batch(() => {
|
|
1006
|
+
this.listeners.forEach((t) => {
|
|
1007
|
+
t(e);
|
|
1008
|
+
});
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
resumePausedMutations() {
|
|
1012
|
+
let e = this.getAll().filter((e) => e.state.isPaused);
|
|
1013
|
+
return notifyManager.batch(() => Promise.all(e.map((e) => e.continue().catch(noop$1))));
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
function scopeFor(e) {
|
|
1017
|
+
return e.options.scope?.id;
|
|
1018
|
+
}
|
|
1019
|
+
var MutationObserver = class extends Subscribable {
|
|
1020
|
+
#e;
|
|
1021
|
+
#t = void 0;
|
|
1022
|
+
#n;
|
|
1023
|
+
#r;
|
|
1024
|
+
constructor(e, t) {
|
|
1025
|
+
super(), this.#e = e, this.setOptions(t), this.bindMethods(), this.#i();
|
|
1026
|
+
}
|
|
1027
|
+
bindMethods() {
|
|
1028
|
+
this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
|
|
1029
|
+
}
|
|
1030
|
+
setOptions(e) {
|
|
1031
|
+
let t = this.options;
|
|
1032
|
+
this.options = this.#e.defaultMutationOptions(e), shallowEqualObjects(this.options, t) || this.#e.getMutationCache().notify({
|
|
1033
|
+
type: "observerOptionsUpdated",
|
|
1034
|
+
mutation: this.#n,
|
|
1035
|
+
observer: this
|
|
1036
|
+
}), t?.mutationKey && this.options.mutationKey && hashKey(t.mutationKey) !== hashKey(this.options.mutationKey) ? this.reset() : this.#n?.state.status === "pending" && this.#n.setOptions(this.options);
|
|
1037
|
+
}
|
|
1038
|
+
onUnsubscribe() {
|
|
1039
|
+
this.hasListeners() || this.#n?.removeObserver(this);
|
|
1040
|
+
}
|
|
1041
|
+
onMutationUpdate(e) {
|
|
1042
|
+
this.#i(), this.#a(e);
|
|
1043
|
+
}
|
|
1044
|
+
getCurrentResult() {
|
|
1045
|
+
return this.#t;
|
|
1046
|
+
}
|
|
1047
|
+
reset() {
|
|
1048
|
+
this.#n?.removeObserver(this), this.#n = void 0, this.#i(), this.#a();
|
|
1049
|
+
}
|
|
1050
|
+
mutate(e, t) {
|
|
1051
|
+
return this.#r = t, this.#n?.removeObserver(this), this.#n = this.#e.getMutationCache().build(this.#e, this.options), this.#n.addObserver(this), this.#n.execute(e);
|
|
1052
|
+
}
|
|
1053
|
+
#i() {
|
|
1054
|
+
let e = this.#n?.state ?? getDefaultState();
|
|
1055
|
+
this.#t = {
|
|
1056
|
+
...e,
|
|
1057
|
+
isPending: e.status === "pending",
|
|
1058
|
+
isSuccess: e.status === "success",
|
|
1059
|
+
isError: e.status === "error",
|
|
1060
|
+
isIdle: e.status === "idle",
|
|
1061
|
+
mutate: this.mutate,
|
|
1062
|
+
reset: this.reset
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
#a(e) {
|
|
1066
|
+
notifyManager.batch(() => {
|
|
1067
|
+
if (this.#r && this.hasListeners()) {
|
|
1068
|
+
let t = this.#t.variables, n = this.#t.context, r = {
|
|
1069
|
+
client: this.#e,
|
|
1070
|
+
meta: this.options.meta,
|
|
1071
|
+
mutationKey: this.options.mutationKey
|
|
1072
|
+
};
|
|
1073
|
+
if (e?.type === "success") {
|
|
1074
|
+
try {
|
|
1075
|
+
this.#r.onSuccess?.(e.data, t, n, r);
|
|
1076
|
+
} catch (e) {
|
|
1077
|
+
Promise.reject(e);
|
|
1078
|
+
}
|
|
1079
|
+
try {
|
|
1080
|
+
this.#r.onSettled?.(e.data, null, t, n, r);
|
|
1081
|
+
} catch (e) {
|
|
1082
|
+
Promise.reject(e);
|
|
1083
|
+
}
|
|
1084
|
+
} else if (e?.type === "error") {
|
|
1085
|
+
try {
|
|
1086
|
+
this.#r.onError?.(e.error, t, n, r);
|
|
1087
|
+
} catch (e) {
|
|
1088
|
+
Promise.reject(e);
|
|
1089
|
+
}
|
|
1090
|
+
try {
|
|
1091
|
+
this.#r.onSettled?.(void 0, e.error, t, n, r);
|
|
1092
|
+
} catch (e) {
|
|
1093
|
+
Promise.reject(e);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
this.listeners.forEach((e) => {
|
|
1098
|
+
e(this.#t);
|
|
1099
|
+
});
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
}, QueryCache = class extends Subscribable {
|
|
1103
|
+
constructor(e = {}) {
|
|
1104
|
+
super(), this.config = e, this.#e = /* @__PURE__ */ new Map();
|
|
1105
|
+
}
|
|
1106
|
+
#e;
|
|
1107
|
+
build(e, t, n) {
|
|
1108
|
+
let r = t.queryKey, i = t.queryHash ?? hashQueryKeyByOptions(r, t), a = this.get(i);
|
|
1109
|
+
return a || (a = new Query({
|
|
1110
|
+
client: e,
|
|
1111
|
+
queryKey: r,
|
|
1112
|
+
queryHash: i,
|
|
1113
|
+
options: e.defaultQueryOptions(t),
|
|
1114
|
+
state: n,
|
|
1115
|
+
defaultOptions: e.getQueryDefaults(r)
|
|
1116
|
+
}), this.add(a)), a;
|
|
1117
|
+
}
|
|
1118
|
+
add(e) {
|
|
1119
|
+
this.#e.has(e.queryHash) || (this.#e.set(e.queryHash, e), this.notify({
|
|
1120
|
+
type: "added",
|
|
1121
|
+
query: e
|
|
1122
|
+
}));
|
|
1123
|
+
}
|
|
1124
|
+
remove(e) {
|
|
1125
|
+
let t = this.#e.get(e.queryHash);
|
|
1126
|
+
t && (e.destroy(), t === e && this.#e.delete(e.queryHash), this.notify({
|
|
1127
|
+
type: "removed",
|
|
1128
|
+
query: e
|
|
1129
|
+
}));
|
|
1130
|
+
}
|
|
1131
|
+
clear() {
|
|
1132
|
+
notifyManager.batch(() => {
|
|
1133
|
+
this.getAll().forEach((e) => {
|
|
1134
|
+
this.remove(e);
|
|
1135
|
+
});
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
get(e) {
|
|
1139
|
+
return this.#e.get(e);
|
|
1140
|
+
}
|
|
1141
|
+
getAll() {
|
|
1142
|
+
return [...this.#e.values()];
|
|
1143
|
+
}
|
|
1144
|
+
find(e) {
|
|
1145
|
+
let t = {
|
|
1146
|
+
exact: !0,
|
|
1147
|
+
...e
|
|
1148
|
+
};
|
|
1149
|
+
return this.getAll().find((e) => matchQuery(t, e));
|
|
1150
|
+
}
|
|
1151
|
+
findAll(e = {}) {
|
|
1152
|
+
let t = this.getAll();
|
|
1153
|
+
return Object.keys(e).length > 0 ? t.filter((t) => matchQuery(e, t)) : t;
|
|
1154
|
+
}
|
|
1155
|
+
notify(e) {
|
|
1156
|
+
notifyManager.batch(() => {
|
|
1157
|
+
this.listeners.forEach((t) => {
|
|
1158
|
+
t(e);
|
|
1159
|
+
});
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
onFocus() {
|
|
1163
|
+
notifyManager.batch(() => {
|
|
1164
|
+
this.getAll().forEach((e) => {
|
|
1165
|
+
e.onFocus();
|
|
1166
|
+
});
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
onOnline() {
|
|
1170
|
+
notifyManager.batch(() => {
|
|
1171
|
+
this.getAll().forEach((e) => {
|
|
1172
|
+
e.onOnline();
|
|
1173
|
+
});
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
}, QueryClient = class {
|
|
1177
|
+
#e;
|
|
1178
|
+
#t;
|
|
1179
|
+
#n;
|
|
1180
|
+
#r;
|
|
1181
|
+
#i;
|
|
1182
|
+
#a;
|
|
1183
|
+
#o;
|
|
1184
|
+
#s;
|
|
1185
|
+
constructor(e = {}) {
|
|
1186
|
+
this.#e = e.queryCache || new QueryCache(), this.#t = e.mutationCache || new MutationCache(), this.#n = e.defaultOptions || {}, this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Map(), this.#a = 0;
|
|
1187
|
+
}
|
|
1188
|
+
mount() {
|
|
1189
|
+
this.#a++, this.#a === 1 && (this.#o = focusManager.subscribe(async (e) => {
|
|
1190
|
+
e && (await this.resumePausedMutations(), this.#e.onFocus());
|
|
1191
|
+
}), this.#s = onlineManager.subscribe(async (e) => {
|
|
1192
|
+
e && (await this.resumePausedMutations(), this.#e.onOnline());
|
|
1193
|
+
}));
|
|
1194
|
+
}
|
|
1195
|
+
unmount() {
|
|
1196
|
+
this.#a--, this.#a === 0 && (this.#o?.(), this.#o = void 0, this.#s?.(), this.#s = void 0);
|
|
1197
|
+
}
|
|
1198
|
+
isFetching(e) {
|
|
1199
|
+
return this.#e.findAll({
|
|
1200
|
+
...e,
|
|
1201
|
+
fetchStatus: "fetching"
|
|
1202
|
+
}).length;
|
|
1203
|
+
}
|
|
1204
|
+
isMutating(e) {
|
|
1205
|
+
return this.#t.findAll({
|
|
1206
|
+
...e,
|
|
1207
|
+
status: "pending"
|
|
1208
|
+
}).length;
|
|
1209
|
+
}
|
|
1210
|
+
getQueryData(e) {
|
|
1211
|
+
let t = this.defaultQueryOptions({ queryKey: e });
|
|
1212
|
+
return this.#e.get(t.queryHash)?.state.data;
|
|
1213
|
+
}
|
|
1214
|
+
ensureQueryData(e) {
|
|
1215
|
+
let t = this.defaultQueryOptions(e), n = this.#e.build(this, t), r = n.state.data;
|
|
1216
|
+
return r === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && n.isStaleByTime(resolveStaleTime(t.staleTime, n)) && this.prefetchQuery(t), Promise.resolve(r));
|
|
1217
|
+
}
|
|
1218
|
+
getQueriesData(e) {
|
|
1219
|
+
return this.#e.findAll(e).map(({ queryKey: e, state: t }) => [e, t.data]);
|
|
1220
|
+
}
|
|
1221
|
+
setQueryData(e, t, n) {
|
|
1222
|
+
let r = this.defaultQueryOptions({ queryKey: e }), i = this.#e.get(r.queryHash)?.state.data, a = functionalUpdate(t, i);
|
|
1223
|
+
if (a !== void 0) return this.#e.build(this, r).setData(a, {
|
|
1224
|
+
...n,
|
|
1225
|
+
manual: !0
|
|
1226
|
+
});
|
|
1227
|
+
}
|
|
1228
|
+
setQueriesData(e, t, n) {
|
|
1229
|
+
return notifyManager.batch(() => this.#e.findAll(e).map(({ queryKey: e }) => [e, this.setQueryData(e, t, n)]));
|
|
1230
|
+
}
|
|
1231
|
+
getQueryState(e) {
|
|
1232
|
+
let t = this.defaultQueryOptions({ queryKey: e });
|
|
1233
|
+
return this.#e.get(t.queryHash)?.state;
|
|
1234
|
+
}
|
|
1235
|
+
removeQueries(e) {
|
|
1236
|
+
let t = this.#e;
|
|
1237
|
+
notifyManager.batch(() => {
|
|
1238
|
+
t.findAll(e).forEach((e) => {
|
|
1239
|
+
t.remove(e);
|
|
1240
|
+
});
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
resetQueries(e, t) {
|
|
1244
|
+
let n = this.#e;
|
|
1245
|
+
return notifyManager.batch(() => (n.findAll(e).forEach((e) => {
|
|
1246
|
+
e.reset();
|
|
1247
|
+
}), this.refetchQueries({
|
|
1248
|
+
type: "active",
|
|
1249
|
+
...e
|
|
1250
|
+
}, t)));
|
|
1251
|
+
}
|
|
1252
|
+
cancelQueries(e, t = {}) {
|
|
1253
|
+
let n = {
|
|
1254
|
+
revert: !0,
|
|
1255
|
+
...t
|
|
1256
|
+
}, r = notifyManager.batch(() => this.#e.findAll(e).map((e) => e.cancel(n)));
|
|
1257
|
+
return Promise.all(r).then(noop$1).catch(noop$1);
|
|
1258
|
+
}
|
|
1259
|
+
invalidateQueries(e, t = {}) {
|
|
1260
|
+
return notifyManager.batch(() => (this.#e.findAll(e).forEach((e) => {
|
|
1261
|
+
e.invalidate();
|
|
1262
|
+
}), e?.refetchType === "none" ? Promise.resolve() : this.refetchQueries({
|
|
1263
|
+
...e,
|
|
1264
|
+
type: e?.refetchType ?? e?.type ?? "active"
|
|
1265
|
+
}, t)));
|
|
1266
|
+
}
|
|
1267
|
+
refetchQueries(e, t = {}) {
|
|
1268
|
+
let n = {
|
|
1269
|
+
...t,
|
|
1270
|
+
cancelRefetch: t.cancelRefetch ?? !0
|
|
1271
|
+
}, r = notifyManager.batch(() => this.#e.findAll(e).filter((e) => !e.isDisabled() && !e.isStatic()).map((e) => {
|
|
1272
|
+
let t = e.fetch(void 0, n);
|
|
1273
|
+
return n.throwOnError || (t = t.catch(noop$1)), e.state.fetchStatus === "paused" ? Promise.resolve() : t;
|
|
1274
|
+
}));
|
|
1275
|
+
return Promise.all(r).then(noop$1);
|
|
1276
|
+
}
|
|
1277
|
+
fetchQuery(e) {
|
|
1278
|
+
let t = this.defaultQueryOptions(e);
|
|
1279
|
+
t.retry === void 0 && (t.retry = !1);
|
|
1280
|
+
let n = this.#e.build(this, t);
|
|
1281
|
+
return n.isStaleByTime(resolveStaleTime(t.staleTime, n)) ? n.fetch(t) : Promise.resolve(n.state.data);
|
|
1282
|
+
}
|
|
1283
|
+
prefetchQuery(e) {
|
|
1284
|
+
return this.fetchQuery(e).then(noop$1).catch(noop$1);
|
|
1285
|
+
}
|
|
1286
|
+
fetchInfiniteQuery(e) {
|
|
1287
|
+
return e.behavior = infiniteQueryBehavior(e.pages), this.fetchQuery(e);
|
|
1288
|
+
}
|
|
1289
|
+
prefetchInfiniteQuery(e) {
|
|
1290
|
+
return this.fetchInfiniteQuery(e).then(noop$1).catch(noop$1);
|
|
1291
|
+
}
|
|
1292
|
+
ensureInfiniteQueryData(e) {
|
|
1293
|
+
return e.behavior = infiniteQueryBehavior(e.pages), this.ensureQueryData(e);
|
|
1294
|
+
}
|
|
1295
|
+
resumePausedMutations() {
|
|
1296
|
+
return onlineManager.isOnline() ? this.#t.resumePausedMutations() : Promise.resolve();
|
|
1297
|
+
}
|
|
1298
|
+
getQueryCache() {
|
|
1299
|
+
return this.#e;
|
|
1300
|
+
}
|
|
1301
|
+
getMutationCache() {
|
|
1302
|
+
return this.#t;
|
|
1303
|
+
}
|
|
1304
|
+
getDefaultOptions() {
|
|
1305
|
+
return this.#n;
|
|
1306
|
+
}
|
|
1307
|
+
setDefaultOptions(e) {
|
|
1308
|
+
this.#n = e;
|
|
1309
|
+
}
|
|
1310
|
+
setQueryDefaults(e, t) {
|
|
1311
|
+
this.#r.set(hashKey(e), {
|
|
1312
|
+
queryKey: e,
|
|
1313
|
+
defaultOptions: t
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
getQueryDefaults(e) {
|
|
1317
|
+
let t = [...this.#r.values()], n = {};
|
|
1318
|
+
return t.forEach((t) => {
|
|
1319
|
+
partialMatchKey(e, t.queryKey) && Object.assign(n, t.defaultOptions);
|
|
1320
|
+
}), n;
|
|
1321
|
+
}
|
|
1322
|
+
setMutationDefaults(e, t) {
|
|
1323
|
+
this.#i.set(hashKey(e), {
|
|
1324
|
+
mutationKey: e,
|
|
1325
|
+
defaultOptions: t
|
|
1326
|
+
});
|
|
1327
|
+
}
|
|
1328
|
+
getMutationDefaults(e) {
|
|
1329
|
+
let t = [...this.#i.values()], n = {};
|
|
1330
|
+
return t.forEach((t) => {
|
|
1331
|
+
partialMatchKey(e, t.mutationKey) && Object.assign(n, t.defaultOptions);
|
|
1332
|
+
}), n;
|
|
1333
|
+
}
|
|
1334
|
+
defaultQueryOptions(e) {
|
|
1335
|
+
if (e._defaulted) return e;
|
|
1336
|
+
let t = {
|
|
1337
|
+
...this.#n.queries,
|
|
1338
|
+
...this.getQueryDefaults(e.queryKey),
|
|
1339
|
+
...e,
|
|
1340
|
+
_defaulted: !0
|
|
1341
|
+
};
|
|
1342
|
+
return t.queryHash ||= hashQueryKeyByOptions(t.queryKey, t), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn === skipToken && (t.enabled = !1), t;
|
|
1343
|
+
}
|
|
1344
|
+
defaultMutationOptions(e) {
|
|
1345
|
+
return e?._defaulted ? e : {
|
|
1346
|
+
...this.#n.mutations,
|
|
1347
|
+
...e?.mutationKey && this.getMutationDefaults(e.mutationKey),
|
|
1348
|
+
...e,
|
|
1349
|
+
_defaulted: !0
|
|
1350
|
+
};
|
|
1351
|
+
}
|
|
1352
|
+
clear() {
|
|
1353
|
+
this.#e.clear(), this.#t.clear();
|
|
1354
|
+
}
|
|
1355
|
+
}, require_react_jsx_runtime_production = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
1356
|
+
var t = Symbol.for("react.transitional.element");
|
|
1357
|
+
function n(e, n, r) {
|
|
1358
|
+
var i = null;
|
|
1359
|
+
if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
|
|
1360
|
+
else r = n;
|
|
1361
|
+
return n = r.ref, {
|
|
1362
|
+
$$typeof: t,
|
|
1363
|
+
type: e,
|
|
1364
|
+
key: i,
|
|
1365
|
+
ref: n === void 0 ? null : n,
|
|
1366
|
+
props: r
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
e.jsx = n, e.jsxs = n;
|
|
1370
|
+
})), require_react_jsx_runtime_development = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
1371
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
1372
|
+
function t(e) {
|
|
1373
|
+
if (e == null) return null;
|
|
1374
|
+
if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
|
|
1375
|
+
if (typeof e == "string") return e;
|
|
1376
|
+
switch (e) {
|
|
1377
|
+
case v: return "Fragment";
|
|
1378
|
+
case b: return "Profiler";
|
|
1379
|
+
case y: return "StrictMode";
|
|
1380
|
+
case w: return "Suspense";
|
|
1381
|
+
case T: return "SuspenseList";
|
|
1382
|
+
case O: return "Activity";
|
|
1383
|
+
}
|
|
1384
|
+
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
1385
|
+
case _: return "Portal";
|
|
1386
|
+
case S: return e.displayName || "Context";
|
|
1387
|
+
case x: return (e._context.displayName || "Context") + ".Consumer";
|
|
1388
|
+
case C:
|
|
1389
|
+
var n = e.render;
|
|
1390
|
+
return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
1391
|
+
case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
|
|
1392
|
+
case D:
|
|
1393
|
+
n = e._payload, e = e._init;
|
|
1394
|
+
try {
|
|
1395
|
+
return t(e(n));
|
|
1396
|
+
} catch {}
|
|
1397
|
+
}
|
|
1398
|
+
return null;
|
|
1399
|
+
}
|
|
1400
|
+
function n(e) {
|
|
1401
|
+
return "" + e;
|
|
1402
|
+
}
|
|
1403
|
+
function r(e) {
|
|
1404
|
+
try {
|
|
1405
|
+
n(e);
|
|
1406
|
+
var t = !1;
|
|
1407
|
+
} catch {
|
|
1408
|
+
t = !0;
|
|
1409
|
+
}
|
|
1410
|
+
if (t) {
|
|
1411
|
+
t = console;
|
|
1412
|
+
var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
1413
|
+
return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
function i(e) {
|
|
1417
|
+
if (e === v) return "<>";
|
|
1418
|
+
if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
|
|
1419
|
+
try {
|
|
1420
|
+
var n = t(e);
|
|
1421
|
+
return n ? "<" + n + ">" : "<...>";
|
|
1422
|
+
} catch {
|
|
1423
|
+
return "<...>";
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
function o() {
|
|
1427
|
+
var e = A.A;
|
|
1428
|
+
return e === null ? null : e.getOwner();
|
|
1429
|
+
}
|
|
1430
|
+
function s() {
|
|
1431
|
+
return Error("react-stack-top-frame");
|
|
1432
|
+
}
|
|
1433
|
+
function c(e) {
|
|
1434
|
+
if (j.call(e, "key")) {
|
|
1435
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
1436
|
+
if (t && t.isReactWarning) return !1;
|
|
1437
|
+
}
|
|
1438
|
+
return e.key !== void 0;
|
|
1439
|
+
}
|
|
1440
|
+
function l(e, t) {
|
|
1441
|
+
function n() {
|
|
1442
|
+
P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
1443
|
+
}
|
|
1444
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
1445
|
+
get: n,
|
|
1446
|
+
configurable: !0
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
function u() {
|
|
1450
|
+
var e = t(this.type);
|
|
1451
|
+
return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
1452
|
+
}
|
|
1453
|
+
function d(e, t, n, r, i, a) {
|
|
1454
|
+
var o = n.ref;
|
|
1455
|
+
return e = {
|
|
1456
|
+
$$typeof: g,
|
|
1457
|
+
type: e,
|
|
1458
|
+
key: t,
|
|
1459
|
+
props: n,
|
|
1460
|
+
_owner: r
|
|
1461
|
+
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
1462
|
+
enumerable: !1,
|
|
1463
|
+
value: null
|
|
1464
|
+
}) : Object.defineProperty(e, "ref", {
|
|
1465
|
+
enumerable: !1,
|
|
1466
|
+
get: u
|
|
1467
|
+
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
1468
|
+
configurable: !1,
|
|
1469
|
+
enumerable: !1,
|
|
1470
|
+
writable: !0,
|
|
1471
|
+
value: 0
|
|
1472
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
1473
|
+
configurable: !1,
|
|
1474
|
+
enumerable: !1,
|
|
1475
|
+
writable: !0,
|
|
1476
|
+
value: null
|
|
1477
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
1478
|
+
configurable: !1,
|
|
1479
|
+
enumerable: !1,
|
|
1480
|
+
writable: !0,
|
|
1481
|
+
value: i
|
|
1482
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
1483
|
+
configurable: !1,
|
|
1484
|
+
enumerable: !1,
|
|
1485
|
+
writable: !0,
|
|
1486
|
+
value: a
|
|
1487
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
1488
|
+
}
|
|
1489
|
+
function f(e, n, i, a, s, u) {
|
|
1490
|
+
var f = n.children;
|
|
1491
|
+
if (f !== void 0) if (a) if (M(f)) {
|
|
1492
|
+
for (a = 0; a < f.length; a++) p(f[a]);
|
|
1493
|
+
Object.freeze && Object.freeze(f);
|
|
1494
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
1495
|
+
else p(f);
|
|
1496
|
+
if (j.call(n, "key")) {
|
|
1497
|
+
f = t(e);
|
|
1498
|
+
var m = Object.keys(n).filter(function(e) {
|
|
1499
|
+
return e !== "key";
|
|
1500
|
+
});
|
|
1501
|
+
a = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[f + a] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", a, f, m, f), R[f + a] = !0);
|
|
1502
|
+
}
|
|
1503
|
+
if (f = null, i !== void 0 && (r(i), f = "" + i), c(n) && (r(n.key), f = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
1504
|
+
else i = n;
|
|
1505
|
+
return f && l(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, i, o(), s, u);
|
|
1506
|
+
}
|
|
1507
|
+
function p(e) {
|
|
1508
|
+
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
1509
|
+
}
|
|
1510
|
+
function m(e) {
|
|
1511
|
+
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
1512
|
+
}
|
|
1513
|
+
var h = __require("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
1514
|
+
return null;
|
|
1515
|
+
};
|
|
1516
|
+
h = { react_stack_bottom_frame: function(e) {
|
|
1517
|
+
return e();
|
|
1518
|
+
} };
|
|
1519
|
+
var P, F = {}, I = h.react_stack_bottom_frame.bind(h, s)(), L = N(i(s)), R = {};
|
|
1520
|
+
e.Fragment = v, e.jsx = function(e, t, n) {
|
|
1521
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
1522
|
+
return f(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
|
|
1523
|
+
}, e.jsxs = function(e, t, n) {
|
|
1524
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
1525
|
+
return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
|
|
1526
|
+
};
|
|
1527
|
+
})();
|
|
1528
|
+
})), import_jsx_runtime = (/* @__PURE__ */ __commonJSMin(((e, t) => {
|
|
1529
|
+
process.env.NODE_ENV === "production" ? t.exports = require_react_jsx_runtime_production() : t.exports = require_react_jsx_runtime_development();
|
|
1530
|
+
})))(), QueryClientContext = React.createContext(void 0), useQueryClient = (t) => {
|
|
1531
|
+
let n = React.useContext(QueryClientContext);
|
|
1532
|
+
if (t) return t;
|
|
1533
|
+
if (!n) throw Error("No QueryClient set, use QueryClientProvider to set one");
|
|
1534
|
+
return n;
|
|
1535
|
+
}, QueryClientProvider = ({ client: t, children: n }) => (React.useEffect(() => (t.mount(), () => {
|
|
1536
|
+
t.unmount();
|
|
1537
|
+
}), [t]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryClientContext.Provider, {
|
|
1538
|
+
value: t,
|
|
1539
|
+
children: n
|
|
1540
|
+
}));
|
|
1541
|
+
function useMutation(t, n) {
|
|
1542
|
+
let r = useQueryClient(n), [i] = React.useState(() => new MutationObserver(r, t));
|
|
1543
|
+
React.useEffect(() => {
|
|
1544
|
+
i.setOptions(t);
|
|
1545
|
+
}, [i, t]);
|
|
1546
|
+
let a = React.useSyncExternalStore(React.useCallback((e) => i.subscribe(notifyManager.batchCalls(e)), [i]), () => i.getCurrentResult(), () => i.getCurrentResult()), o = React.useCallback((e, t) => {
|
|
1547
|
+
i.mutate(e, t).catch(noop$1);
|
|
1548
|
+
}, [i]);
|
|
1549
|
+
if (a.error && shouldThrowError(i.options.throwOnError, [a.error])) throw a.error;
|
|
1550
|
+
return {
|
|
1551
|
+
...a,
|
|
1552
|
+
mutate: o,
|
|
1553
|
+
mutateAsync: a.mutate
|
|
1554
|
+
};
|
|
1555
|
+
}
|
|
1556
|
+
function ChatWidgetUI({ messages: e, onSendMessage: n, isSending: r, className: i, style: a }) {
|
|
1557
|
+
let [o, s] = useState("");
|
|
1558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1559
|
+
className: `fixed bottom-4 right-4 w-96 h-[500px] flex flex-col bg-white border border-gray-200 rounded-lg shadow-xl overflow-hidden font-sans ${i || ""}`,
|
|
1560
|
+
style: a,
|
|
1561
|
+
children: [
|
|
1562
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1563
|
+
className: "bg-slate-800 text-white p-4 flex justify-between items-center",
|
|
1564
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
|
|
1565
|
+
className: "font-semibold text-lg",
|
|
1566
|
+
children: "ChatWillow"
|
|
1567
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1568
|
+
className: "text-xs text-slate-300",
|
|
1569
|
+
children: "Online"
|
|
1570
|
+
})]
|
|
1571
|
+
}),
|
|
1572
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1573
|
+
className: "flex-1 p-4 overflow-y-auto bg-gray-50 flex flex-col gap-3",
|
|
1574
|
+
children: [
|
|
1575
|
+
e.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1576
|
+
className: "text-center text-gray-400 my-auto text-sm",
|
|
1577
|
+
children: "Start a conversation..."
|
|
1578
|
+
}),
|
|
1579
|
+
e.map((e) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1580
|
+
className: `flex ${e.role === "user" ? "justify-end" : "justify-start"}`,
|
|
1581
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1582
|
+
className: `max-w-[80%] p-3 rounded-lg text-sm ${e.role === "user" ? "bg-slate-800 text-white rounded-br-none" : "bg-white text-gray-800 border border-gray-200 rounded-bl-none shadow-sm"}`,
|
|
1583
|
+
children: e.content
|
|
1584
|
+
})
|
|
1585
|
+
}, e.id)),
|
|
1586
|
+
r && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1587
|
+
className: "flex justify-start",
|
|
1588
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1589
|
+
className: "bg-white text-gray-800 border border-gray-200 p-3 rounded-lg rounded-bl-none shadow-sm",
|
|
1590
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
1591
|
+
className: "flex gap-1",
|
|
1592
|
+
children: [
|
|
1593
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "w-1.5 h-1.5 bg-gray-400 rounded-full animate-bounce" }),
|
|
1594
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "w-1.5 h-1.5 bg-gray-400 rounded-full animate-bounce delay-75" }),
|
|
1595
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "w-1.5 h-1.5 bg-gray-400 rounded-full animate-bounce delay-150" })
|
|
1596
|
+
]
|
|
1597
|
+
})
|
|
1598
|
+
})
|
|
1599
|
+
})
|
|
1600
|
+
]
|
|
1601
|
+
}),
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", {
|
|
1603
|
+
onSubmit: (e) => {
|
|
1604
|
+
e.preventDefault(), o.trim() && !r && (n(o), s(""));
|
|
1605
|
+
},
|
|
1606
|
+
className: "p-3 bg-white border-t border-gray-100",
|
|
1607
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1608
|
+
className: "flex gap-2",
|
|
1609
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
1610
|
+
type: "text",
|
|
1611
|
+
value: o,
|
|
1612
|
+
onChange: (e) => s(e.target.value),
|
|
1613
|
+
disabled: r,
|
|
1614
|
+
placeholder: "Type your message...",
|
|
1615
|
+
className: "flex-1 px-4 py-2 bg-gray-100 border-0 rounded-full focus:ring-2 focus:ring-slate-800 focus:outline-none transition-all text-sm disabled:opacity-50"
|
|
1616
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
1617
|
+
type: "submit",
|
|
1618
|
+
disabled: !o.trim() || r,
|
|
1619
|
+
className: "p-2 bg-slate-800 text-white rounded-full hover:bg-slate-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
|
|
1620
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
|
|
1621
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1622
|
+
fill: "none",
|
|
1623
|
+
viewBox: "0 0 24 24",
|
|
1624
|
+
strokeWidth: 2,
|
|
1625
|
+
stroke: "currentColor",
|
|
1626
|
+
className: "w-5 h-5",
|
|
1627
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
|
|
1628
|
+
strokeLinecap: "round",
|
|
1629
|
+
strokeLinejoin: "round",
|
|
1630
|
+
d: "M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"
|
|
1631
|
+
})
|
|
1632
|
+
})
|
|
1633
|
+
})]
|
|
1634
|
+
})
|
|
1635
|
+
})
|
|
1636
|
+
]
|
|
1637
|
+
});
|
|
1638
|
+
}
|
|
1639
|
+
function bind(e, t) {
|
|
1640
|
+
return function() {
|
|
1641
|
+
return e.apply(t, arguments);
|
|
1642
|
+
};
|
|
1643
|
+
}
|
|
1644
|
+
var { toString } = Object.prototype, { getPrototypeOf } = Object, { iterator, toStringTag } = Symbol, kindOf = ((e) => (t) => {
|
|
1645
|
+
let n = toString.call(t);
|
|
1646
|
+
return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
|
|
1647
|
+
})(Object.create(null)), kindOfTest = (e) => (e = e.toLowerCase(), (t) => kindOf(t) === e), typeOfTest = (e) => (t) => typeof t === e, { isArray } = Array, isUndefined = typeOfTest("undefined");
|
|
1648
|
+
function isBuffer(e) {
|
|
1649
|
+
return e !== null && !isUndefined(e) && e.constructor !== null && !isUndefined(e.constructor) && isFunction$1(e.constructor.isBuffer) && e.constructor.isBuffer(e);
|
|
1650
|
+
}
|
|
1651
|
+
var isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
1652
|
+
function isArrayBufferView(e) {
|
|
1653
|
+
let t;
|
|
1654
|
+
return t = typeof ArrayBuffer < "u" && ArrayBuffer.isView ? ArrayBuffer.isView(e) : e && e.buffer && isArrayBuffer(e.buffer), t;
|
|
1655
|
+
}
|
|
1656
|
+
var isString = typeOfTest("string"), isFunction$1 = typeOfTest("function"), isNumber = typeOfTest("number"), isObject = (e) => typeof e == "object" && !!e, isBoolean = (e) => e === !0 || e === !1, isPlainObject = (e) => {
|
|
1657
|
+
if (kindOf(e) !== "object") return !1;
|
|
1658
|
+
let t = getPrototypeOf(e);
|
|
1659
|
+
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(toStringTag in e) && !(iterator in e);
|
|
1660
|
+
}, isEmptyObject = (e) => {
|
|
1661
|
+
if (!isObject(e) || isBuffer(e)) return !1;
|
|
1662
|
+
try {
|
|
1663
|
+
return Object.keys(e).length === 0 && Object.getPrototypeOf(e) === Object.prototype;
|
|
1664
|
+
} catch {
|
|
1665
|
+
return !1;
|
|
1666
|
+
}
|
|
1667
|
+
}, isDate = kindOfTest("Date"), isFile = kindOfTest("File"), isBlob = kindOfTest("Blob"), isFileList = kindOfTest("FileList"), isStream = (e) => isObject(e) && isFunction$1(e.pipe), isFormData = (e) => {
|
|
1668
|
+
let t;
|
|
1669
|
+
return e && (typeof FormData == "function" && e instanceof FormData || isFunction$1(e.append) && ((t = kindOf(e)) === "formdata" || t === "object" && isFunction$1(e.toString) && e.toString() === "[object FormData]"));
|
|
1670
|
+
}, isURLSearchParams = kindOfTest("URLSearchParams"), [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
1671
|
+
"ReadableStream",
|
|
1672
|
+
"Request",
|
|
1673
|
+
"Response",
|
|
1674
|
+
"Headers"
|
|
1675
|
+
].map(kindOfTest), trim = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
1676
|
+
function forEach(e, t, { allOwnKeys: n = !1 } = {}) {
|
|
1677
|
+
if (e == null) return;
|
|
1678
|
+
let r, i;
|
|
1679
|
+
if (typeof e != "object" && (e = [e]), isArray(e)) for (r = 0, i = e.length; r < i; r++) t.call(null, e[r], r, e);
|
|
1680
|
+
else {
|
|
1681
|
+
if (isBuffer(e)) return;
|
|
1682
|
+
let i = n ? Object.getOwnPropertyNames(e) : Object.keys(e), a = i.length, o;
|
|
1683
|
+
for (r = 0; r < a; r++) o = i[r], t.call(null, e[o], o, e);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
function findKey(e, t) {
|
|
1687
|
+
if (isBuffer(e)) return null;
|
|
1688
|
+
t = t.toLowerCase();
|
|
1689
|
+
let n = Object.keys(e), r = n.length, i;
|
|
1690
|
+
for (; r-- > 0;) if (i = n[r], t === i.toLowerCase()) return i;
|
|
1691
|
+
return null;
|
|
1692
|
+
}
|
|
1693
|
+
var _global = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, isContextDefined = (e) => !isUndefined(e) && e !== _global;
|
|
1694
|
+
function merge() {
|
|
1695
|
+
let { caseless: e, skipUndefined: t } = isContextDefined(this) && this || {}, n = {}, r = (r, i) => {
|
|
1696
|
+
if (i === "__proto__" || i === "constructor" || i === "prototype") return;
|
|
1697
|
+
let a = e && findKey(n, i) || i;
|
|
1698
|
+
isPlainObject(n[a]) && isPlainObject(r) ? n[a] = merge(n[a], r) : isPlainObject(r) ? n[a] = merge({}, r) : isArray(r) ? n[a] = r.slice() : (!t || !isUndefined(r)) && (n[a] = r);
|
|
1699
|
+
};
|
|
1700
|
+
for (let e = 0, t = arguments.length; e < t; e++) arguments[e] && forEach(arguments[e], r);
|
|
1701
|
+
return n;
|
|
1702
|
+
}
|
|
1703
|
+
var extend = (e, t, n, { allOwnKeys: r } = {}) => (forEach(t, (t, r) => {
|
|
1704
|
+
n && isFunction$1(t) ? Object.defineProperty(e, r, {
|
|
1705
|
+
value: bind(t, n),
|
|
1706
|
+
writable: !0,
|
|
1707
|
+
enumerable: !0,
|
|
1708
|
+
configurable: !0
|
|
1709
|
+
}) : Object.defineProperty(e, r, {
|
|
1710
|
+
value: t,
|
|
1711
|
+
writable: !0,
|
|
1712
|
+
enumerable: !0,
|
|
1713
|
+
configurable: !0
|
|
1714
|
+
});
|
|
1715
|
+
}, { allOwnKeys: r }), e), stripBOM = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), inherits = (e, t, n, r) => {
|
|
1716
|
+
e.prototype = Object.create(t.prototype, r), Object.defineProperty(e.prototype, "constructor", {
|
|
1717
|
+
value: e,
|
|
1718
|
+
writable: !0,
|
|
1719
|
+
enumerable: !1,
|
|
1720
|
+
configurable: !0
|
|
1721
|
+
}), Object.defineProperty(e, "super", { value: t.prototype }), n && Object.assign(e.prototype, n);
|
|
1722
|
+
}, toFlatObject = (e, t, n, r) => {
|
|
1723
|
+
let i, a, o, s = {};
|
|
1724
|
+
if (t ||= {}, e == null) return t;
|
|
1725
|
+
do {
|
|
1726
|
+
for (i = Object.getOwnPropertyNames(e), a = i.length; a-- > 0;) o = i[a], (!r || r(o, e, t)) && !s[o] && (t[o] = e[o], s[o] = !0);
|
|
1727
|
+
e = n !== !1 && getPrototypeOf(e);
|
|
1728
|
+
} while (e && (!n || n(e, t)) && e !== Object.prototype);
|
|
1729
|
+
return t;
|
|
1730
|
+
}, endsWith = (e, t, n) => {
|
|
1731
|
+
e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
|
|
1732
|
+
let r = e.indexOf(t, n);
|
|
1733
|
+
return r !== -1 && r === n;
|
|
1734
|
+
}, toArray = (e) => {
|
|
1735
|
+
if (!e) return null;
|
|
1736
|
+
if (isArray(e)) return e;
|
|
1737
|
+
let t = e.length;
|
|
1738
|
+
if (!isNumber(t)) return null;
|
|
1739
|
+
let n = Array(t);
|
|
1740
|
+
for (; t-- > 0;) n[t] = e[t];
|
|
1741
|
+
return n;
|
|
1742
|
+
}, isTypedArray = ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && getPrototypeOf(Uint8Array)), forEachEntry = (e, t) => {
|
|
1743
|
+
let n = (e && e[iterator]).call(e), r;
|
|
1744
|
+
for (; (r = n.next()) && !r.done;) {
|
|
1745
|
+
let n = r.value;
|
|
1746
|
+
t.call(e, n[0], n[1]);
|
|
1747
|
+
}
|
|
1748
|
+
}, matchAll = (e, t) => {
|
|
1749
|
+
let n, r = [];
|
|
1750
|
+
for (; (n = e.exec(t)) !== null;) r.push(n);
|
|
1751
|
+
return r;
|
|
1752
|
+
}, isHTMLForm = kindOfTest("HTMLFormElement"), toCamelCase = (e) => e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function(e, t, n) {
|
|
1753
|
+
return t.toUpperCase() + n;
|
|
1754
|
+
}), hasOwnProperty = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), isRegExp = kindOfTest("RegExp"), reduceDescriptors = (e, t) => {
|
|
1755
|
+
let n = Object.getOwnPropertyDescriptors(e), r = {};
|
|
1756
|
+
forEach(n, (n, i) => {
|
|
1757
|
+
let a;
|
|
1758
|
+
(a = t(n, i, e)) !== !1 && (r[i] = a || n);
|
|
1759
|
+
}), Object.defineProperties(e, r);
|
|
1760
|
+
}, freezeMethods = (e) => {
|
|
1761
|
+
reduceDescriptors(e, (t, n) => {
|
|
1762
|
+
if (isFunction$1(e) && [
|
|
1763
|
+
"arguments",
|
|
1764
|
+
"caller",
|
|
1765
|
+
"callee"
|
|
1766
|
+
].indexOf(n) !== -1) return !1;
|
|
1767
|
+
let r = e[n];
|
|
1768
|
+
if (isFunction$1(r)) {
|
|
1769
|
+
if (t.enumerable = !1, "writable" in t) {
|
|
1770
|
+
t.writable = !1;
|
|
1771
|
+
return;
|
|
1772
|
+
}
|
|
1773
|
+
t.set ||= () => {
|
|
1774
|
+
throw Error("Can not rewrite read-only method '" + n + "'");
|
|
1775
|
+
};
|
|
1776
|
+
}
|
|
1777
|
+
});
|
|
1778
|
+
}, toObjectSet = (e, t) => {
|
|
1779
|
+
let n = {}, r = (e) => {
|
|
1780
|
+
e.forEach((e) => {
|
|
1781
|
+
n[e] = !0;
|
|
1782
|
+
});
|
|
1783
|
+
};
|
|
1784
|
+
return isArray(e) ? r(e) : r(String(e).split(t)), n;
|
|
1785
|
+
}, noop = () => {}, toFiniteNumber = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
|
|
1786
|
+
function isSpecCompliantForm(e) {
|
|
1787
|
+
return !!(e && isFunction$1(e.append) && e[toStringTag] === "FormData" && e[iterator]);
|
|
1788
|
+
}
|
|
1789
|
+
var toJSONObject = (e) => {
|
|
1790
|
+
let t = Array(10), n = (e, r) => {
|
|
1791
|
+
if (isObject(e)) {
|
|
1792
|
+
if (t.indexOf(e) >= 0) return;
|
|
1793
|
+
if (isBuffer(e)) return e;
|
|
1794
|
+
if (!("toJSON" in e)) {
|
|
1795
|
+
t[r] = e;
|
|
1796
|
+
let i = isArray(e) ? [] : {};
|
|
1797
|
+
return forEach(e, (e, t) => {
|
|
1798
|
+
let a = n(e, r + 1);
|
|
1799
|
+
!isUndefined(a) && (i[t] = a);
|
|
1800
|
+
}), t[r] = void 0, i;
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
return e;
|
|
1804
|
+
};
|
|
1805
|
+
return n(e, 0);
|
|
1806
|
+
}, isAsyncFn = kindOfTest("AsyncFunction"), isThenable = (e) => e && (isObject(e) || isFunction$1(e)) && isFunction$1(e.then) && isFunction$1(e.catch), _setImmediate = ((e, t) => e ? setImmediate : t ? ((e, t) => (_global.addEventListener("message", ({ source: n, data: r }) => {
|
|
1807
|
+
n === _global && r === e && t.length && t.shift()();
|
|
1808
|
+
}, !1), (n) => {
|
|
1809
|
+
t.push(n), _global.postMessage(e, "*");
|
|
1810
|
+
}))(`axios@${Math.random()}`, []) : (e) => setTimeout(e))(typeof setImmediate == "function", isFunction$1(_global.postMessage)), utils_default = {
|
|
1811
|
+
isArray,
|
|
1812
|
+
isArrayBuffer,
|
|
1813
|
+
isBuffer,
|
|
1814
|
+
isFormData,
|
|
1815
|
+
isArrayBufferView,
|
|
1816
|
+
isString,
|
|
1817
|
+
isNumber,
|
|
1818
|
+
isBoolean,
|
|
1819
|
+
isObject,
|
|
1820
|
+
isPlainObject,
|
|
1821
|
+
isEmptyObject,
|
|
1822
|
+
isReadableStream,
|
|
1823
|
+
isRequest,
|
|
1824
|
+
isResponse,
|
|
1825
|
+
isHeaders,
|
|
1826
|
+
isUndefined,
|
|
1827
|
+
isDate,
|
|
1828
|
+
isFile,
|
|
1829
|
+
isBlob,
|
|
1830
|
+
isRegExp,
|
|
1831
|
+
isFunction: isFunction$1,
|
|
1832
|
+
isStream,
|
|
1833
|
+
isURLSearchParams,
|
|
1834
|
+
isTypedArray,
|
|
1835
|
+
isFileList,
|
|
1836
|
+
forEach,
|
|
1837
|
+
merge,
|
|
1838
|
+
extend,
|
|
1839
|
+
trim,
|
|
1840
|
+
stripBOM,
|
|
1841
|
+
inherits,
|
|
1842
|
+
toFlatObject,
|
|
1843
|
+
kindOf,
|
|
1844
|
+
kindOfTest,
|
|
1845
|
+
endsWith,
|
|
1846
|
+
toArray,
|
|
1847
|
+
forEachEntry,
|
|
1848
|
+
matchAll,
|
|
1849
|
+
isHTMLForm,
|
|
1850
|
+
hasOwnProperty,
|
|
1851
|
+
hasOwnProp: hasOwnProperty,
|
|
1852
|
+
reduceDescriptors,
|
|
1853
|
+
freezeMethods,
|
|
1854
|
+
toObjectSet,
|
|
1855
|
+
toCamelCase,
|
|
1856
|
+
noop,
|
|
1857
|
+
toFiniteNumber,
|
|
1858
|
+
findKey,
|
|
1859
|
+
global: _global,
|
|
1860
|
+
isContextDefined,
|
|
1861
|
+
isSpecCompliantForm,
|
|
1862
|
+
toJSONObject,
|
|
1863
|
+
isAsyncFn,
|
|
1864
|
+
isThenable,
|
|
1865
|
+
setImmediate: _setImmediate,
|
|
1866
|
+
asap: typeof queueMicrotask < "u" ? queueMicrotask.bind(_global) : typeof process < "u" && process.nextTick || _setImmediate,
|
|
1867
|
+
isIterable: (e) => e != null && isFunction$1(e[iterator])
|
|
1868
|
+
}, AxiosError = class e extends Error {
|
|
1869
|
+
static from(t, n, r, i, a, o) {
|
|
1870
|
+
let s = new e(t.message, n || t.code, r, i, a);
|
|
1871
|
+
return s.cause = t, s.name = t.name, o && Object.assign(s, o), s;
|
|
1872
|
+
}
|
|
1873
|
+
constructor(e, t, n, r, i) {
|
|
1874
|
+
super(e), this.name = "AxiosError", this.isAxiosError = !0, t && (this.code = t), n && (this.config = n), r && (this.request = r), i && (this.response = i, this.status = i.status);
|
|
1875
|
+
}
|
|
1876
|
+
toJSON() {
|
|
1877
|
+
return {
|
|
1878
|
+
message: this.message,
|
|
1879
|
+
name: this.name,
|
|
1880
|
+
description: this.description,
|
|
1881
|
+
number: this.number,
|
|
1882
|
+
fileName: this.fileName,
|
|
1883
|
+
lineNumber: this.lineNumber,
|
|
1884
|
+
columnNumber: this.columnNumber,
|
|
1885
|
+
stack: this.stack,
|
|
1886
|
+
config: utils_default.toJSONObject(this.config),
|
|
1887
|
+
code: this.code,
|
|
1888
|
+
status: this.status
|
|
1889
|
+
};
|
|
1890
|
+
}
|
|
1891
|
+
};
|
|
1892
|
+
AxiosError.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE", AxiosError.ERR_BAD_OPTION = "ERR_BAD_OPTION", AxiosError.ECONNABORTED = "ECONNABORTED", AxiosError.ETIMEDOUT = "ETIMEDOUT", AxiosError.ERR_NETWORK = "ERR_NETWORK", AxiosError.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS", AxiosError.ERR_DEPRECATED = "ERR_DEPRECATED", AxiosError.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE", AxiosError.ERR_BAD_REQUEST = "ERR_BAD_REQUEST", AxiosError.ERR_CANCELED = "ERR_CANCELED", AxiosError.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT", AxiosError.ERR_INVALID_URL = "ERR_INVALID_URL";
|
|
1893
|
+
function isVisitable(e) {
|
|
1894
|
+
return utils_default.isPlainObject(e) || utils_default.isArray(e);
|
|
1895
|
+
}
|
|
1896
|
+
function removeBrackets(e) {
|
|
1897
|
+
return utils_default.endsWith(e, "[]") ? e.slice(0, -2) : e;
|
|
1898
|
+
}
|
|
1899
|
+
function renderKey(e, t, n) {
|
|
1900
|
+
return e ? e.concat(t).map(function(e, t) {
|
|
1901
|
+
return e = removeBrackets(e), !n && t ? "[" + e + "]" : e;
|
|
1902
|
+
}).join(n ? "." : "") : t;
|
|
1903
|
+
}
|
|
1904
|
+
function isFlatArray(e) {
|
|
1905
|
+
return utils_default.isArray(e) && !e.some(isVisitable);
|
|
1906
|
+
}
|
|
1907
|
+
var predicates = utils_default.toFlatObject(utils_default, {}, null, function(e) {
|
|
1908
|
+
return /^is[A-Z]/.test(e);
|
|
1909
|
+
});
|
|
1910
|
+
function toFormData(e, t, n) {
|
|
1911
|
+
if (!utils_default.isObject(e)) throw TypeError("target must be an object");
|
|
1912
|
+
t ||= new FormData(), n = utils_default.toFlatObject(n, {
|
|
1913
|
+
metaTokens: !0,
|
|
1914
|
+
dots: !1,
|
|
1915
|
+
indexes: !1
|
|
1916
|
+
}, !1, function(e, t) {
|
|
1917
|
+
return !utils_default.isUndefined(t[e]);
|
|
1918
|
+
});
|
|
1919
|
+
let r = n.metaTokens, i = n.visitor || l, a = n.dots, o = n.indexes, s = (n.Blob || typeof Blob < "u" && Blob) && utils_default.isSpecCompliantForm(t);
|
|
1920
|
+
if (!utils_default.isFunction(i)) throw TypeError("visitor must be a function");
|
|
1921
|
+
function c(e) {
|
|
1922
|
+
if (e === null) return "";
|
|
1923
|
+
if (utils_default.isDate(e)) return e.toISOString();
|
|
1924
|
+
if (utils_default.isBoolean(e)) return e.toString();
|
|
1925
|
+
if (!s && utils_default.isBlob(e)) throw new AxiosError("Blob is not supported. Use a Buffer instead.");
|
|
1926
|
+
return utils_default.isArrayBuffer(e) || utils_default.isTypedArray(e) ? s && typeof Blob == "function" ? new Blob([e]) : Buffer.from(e) : e;
|
|
1927
|
+
}
|
|
1928
|
+
function l(e, n, i) {
|
|
1929
|
+
let s = e;
|
|
1930
|
+
if (e && !i && typeof e == "object") {
|
|
1931
|
+
if (utils_default.endsWith(n, "{}")) n = r ? n : n.slice(0, -2), e = JSON.stringify(e);
|
|
1932
|
+
else if (utils_default.isArray(e) && isFlatArray(e) || (utils_default.isFileList(e) || utils_default.endsWith(n, "[]")) && (s = utils_default.toArray(e))) return n = removeBrackets(n), s.forEach(function(e, r) {
|
|
1933
|
+
!(utils_default.isUndefined(e) || e === null) && t.append(o === !0 ? renderKey([n], r, a) : o === null ? n : n + "[]", c(e));
|
|
1934
|
+
}), !1;
|
|
1935
|
+
}
|
|
1936
|
+
return isVisitable(e) ? !0 : (t.append(renderKey(i, n, a), c(e)), !1);
|
|
1937
|
+
}
|
|
1938
|
+
let u = [], d = Object.assign(predicates, {
|
|
1939
|
+
defaultVisitor: l,
|
|
1940
|
+
convertValue: c,
|
|
1941
|
+
isVisitable
|
|
1942
|
+
});
|
|
1943
|
+
function f(e, n) {
|
|
1944
|
+
if (!utils_default.isUndefined(e)) {
|
|
1945
|
+
if (u.indexOf(e) !== -1) throw Error("Circular reference detected in " + n.join("."));
|
|
1946
|
+
u.push(e), utils_default.forEach(e, function(e, r) {
|
|
1947
|
+
(!(utils_default.isUndefined(e) || e === null) && i.call(t, e, utils_default.isString(r) ? r.trim() : r, n, d)) === !0 && f(e, n ? n.concat(r) : [r]);
|
|
1948
|
+
}), u.pop();
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
if (!utils_default.isObject(e)) throw TypeError("data must be an object");
|
|
1952
|
+
return f(e), t;
|
|
1953
|
+
}
|
|
1954
|
+
function encode$1(e) {
|
|
1955
|
+
let t = {
|
|
1956
|
+
"!": "%21",
|
|
1957
|
+
"'": "%27",
|
|
1958
|
+
"(": "%28",
|
|
1959
|
+
")": "%29",
|
|
1960
|
+
"~": "%7E",
|
|
1961
|
+
"%20": "+",
|
|
1962
|
+
"%00": "\0"
|
|
1963
|
+
};
|
|
1964
|
+
return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(e) {
|
|
1965
|
+
return t[e];
|
|
1966
|
+
});
|
|
1967
|
+
}
|
|
1968
|
+
function AxiosURLSearchParams(e, t) {
|
|
1969
|
+
this._pairs = [], e && toFormData(e, this, t);
|
|
1970
|
+
}
|
|
1971
|
+
var prototype = AxiosURLSearchParams.prototype;
|
|
1972
|
+
prototype.append = function(e, t) {
|
|
1973
|
+
this._pairs.push([e, t]);
|
|
1974
|
+
}, prototype.toString = function(e) {
|
|
1975
|
+
let t = e ? function(t) {
|
|
1976
|
+
return e.call(this, t, encode$1);
|
|
1977
|
+
} : encode$1;
|
|
1978
|
+
return this._pairs.map(function(e) {
|
|
1979
|
+
return t(e[0]) + "=" + t(e[1]);
|
|
1980
|
+
}, "").join("&");
|
|
1981
|
+
};
|
|
1982
|
+
function encode(e) {
|
|
1983
|
+
return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
|
|
1984
|
+
}
|
|
1985
|
+
function buildURL(e, t, n) {
|
|
1986
|
+
if (!t) return e;
|
|
1987
|
+
let r = n && n.encode || encode, i = utils_default.isFunction(n) ? { serialize: n } : n, a = i && i.serialize, o;
|
|
1988
|
+
if (o = a ? a(t, i) : utils_default.isURLSearchParams(t) ? t.toString() : new AxiosURLSearchParams(t, i).toString(r), o) {
|
|
1989
|
+
let t = e.indexOf("#");
|
|
1990
|
+
t !== -1 && (e = e.slice(0, t)), e += (e.indexOf("?") === -1 ? "?" : "&") + o;
|
|
1991
|
+
}
|
|
1992
|
+
return e;
|
|
1993
|
+
}
|
|
1994
|
+
var InterceptorManager = class {
|
|
1995
|
+
constructor() {
|
|
1996
|
+
this.handlers = [];
|
|
1997
|
+
}
|
|
1998
|
+
use(e, t, n) {
|
|
1999
|
+
return this.handlers.push({
|
|
2000
|
+
fulfilled: e,
|
|
2001
|
+
rejected: t,
|
|
2002
|
+
synchronous: n ? n.synchronous : !1,
|
|
2003
|
+
runWhen: n ? n.runWhen : null
|
|
2004
|
+
}), this.handlers.length - 1;
|
|
2005
|
+
}
|
|
2006
|
+
eject(e) {
|
|
2007
|
+
this.handlers[e] && (this.handlers[e] = null);
|
|
2008
|
+
}
|
|
2009
|
+
clear() {
|
|
2010
|
+
this.handlers &&= [];
|
|
2011
|
+
}
|
|
2012
|
+
forEach(e) {
|
|
2013
|
+
utils_default.forEach(this.handlers, function(t) {
|
|
2014
|
+
t !== null && e(t);
|
|
2015
|
+
});
|
|
2016
|
+
}
|
|
2017
|
+
}, transitional_default = {
|
|
2018
|
+
silentJSONParsing: !0,
|
|
2019
|
+
forcedJSONParsing: !0,
|
|
2020
|
+
clarifyTimeoutError: !1,
|
|
2021
|
+
legacyInterceptorReqResOrdering: !0
|
|
2022
|
+
}, browser_default = {
|
|
2023
|
+
isBrowser: !0,
|
|
2024
|
+
classes: {
|
|
2025
|
+
URLSearchParams: typeof URLSearchParams < "u" ? URLSearchParams : AxiosURLSearchParams,
|
|
2026
|
+
FormData: typeof FormData < "u" ? FormData : null,
|
|
2027
|
+
Blob: typeof Blob < "u" ? Blob : null
|
|
2028
|
+
},
|
|
2029
|
+
protocols: [
|
|
2030
|
+
"http",
|
|
2031
|
+
"https",
|
|
2032
|
+
"file",
|
|
2033
|
+
"blob",
|
|
2034
|
+
"url",
|
|
2035
|
+
"data"
|
|
2036
|
+
]
|
|
2037
|
+
}, utils_exports = /* @__PURE__ */ __exportAll({
|
|
2038
|
+
hasBrowserEnv: () => hasBrowserEnv,
|
|
2039
|
+
hasStandardBrowserEnv: () => hasStandardBrowserEnv,
|
|
2040
|
+
hasStandardBrowserWebWorkerEnv: () => hasStandardBrowserWebWorkerEnv,
|
|
2041
|
+
navigator: () => _navigator,
|
|
2042
|
+
origin: () => origin
|
|
2043
|
+
}), hasBrowserEnv = typeof window < "u" && typeof document < "u", _navigator = typeof navigator == "object" && navigator || void 0, hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || [
|
|
2044
|
+
"ReactNative",
|
|
2045
|
+
"NativeScript",
|
|
2046
|
+
"NS"
|
|
2047
|
+
].indexOf(_navigator.product) < 0), hasStandardBrowserWebWorkerEnv = typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope && typeof self.importScripts == "function", origin = hasBrowserEnv && window.location.href || "http://localhost", platform_default = {
|
|
2048
|
+
...utils_exports,
|
|
2049
|
+
...browser_default
|
|
2050
|
+
};
|
|
2051
|
+
function toURLEncodedForm(e, t) {
|
|
2052
|
+
return toFormData(e, new platform_default.classes.URLSearchParams(), {
|
|
2053
|
+
visitor: function(e, t, n, r) {
|
|
2054
|
+
return platform_default.isNode && utils_default.isBuffer(e) ? (this.append(t, e.toString("base64")), !1) : r.defaultVisitor.apply(this, arguments);
|
|
2055
|
+
},
|
|
2056
|
+
...t
|
|
2057
|
+
});
|
|
2058
|
+
}
|
|
2059
|
+
function parsePropPath(e) {
|
|
2060
|
+
return utils_default.matchAll(/\w+|\[(\w*)]/g, e).map((e) => e[0] === "[]" ? "" : e[1] || e[0]);
|
|
2061
|
+
}
|
|
2062
|
+
function arrayToObject(e) {
|
|
2063
|
+
let t = {}, n = Object.keys(e), r, i = n.length, a;
|
|
2064
|
+
for (r = 0; r < i; r++) a = n[r], t[a] = e[a];
|
|
2065
|
+
return t;
|
|
2066
|
+
}
|
|
2067
|
+
function formDataToJSON(e) {
|
|
2068
|
+
function t(e, n, r, i) {
|
|
2069
|
+
let a = e[i++];
|
|
2070
|
+
if (a === "__proto__") return !0;
|
|
2071
|
+
let o = Number.isFinite(+a), s = i >= e.length;
|
|
2072
|
+
return a = !a && utils_default.isArray(r) ? r.length : a, s ? (utils_default.hasOwnProp(r, a) ? r[a] = [r[a], n] : r[a] = n, !o) : ((!r[a] || !utils_default.isObject(r[a])) && (r[a] = []), t(e, n, r[a], i) && utils_default.isArray(r[a]) && (r[a] = arrayToObject(r[a])), !o);
|
|
2073
|
+
}
|
|
2074
|
+
if (utils_default.isFormData(e) && utils_default.isFunction(e.entries)) {
|
|
2075
|
+
let n = {};
|
|
2076
|
+
return utils_default.forEachEntry(e, (e, r) => {
|
|
2077
|
+
t(parsePropPath(e), r, n, 0);
|
|
2078
|
+
}), n;
|
|
2079
|
+
}
|
|
2080
|
+
return null;
|
|
2081
|
+
}
|
|
2082
|
+
function stringifySafely(e, t, n) {
|
|
2083
|
+
if (utils_default.isString(e)) try {
|
|
2084
|
+
return (t || JSON.parse)(e), utils_default.trim(e);
|
|
2085
|
+
} catch (e) {
|
|
2086
|
+
if (e.name !== "SyntaxError") throw e;
|
|
2087
|
+
}
|
|
2088
|
+
return (n || JSON.stringify)(e);
|
|
2089
|
+
}
|
|
2090
|
+
var defaults = {
|
|
2091
|
+
transitional: transitional_default,
|
|
2092
|
+
adapter: [
|
|
2093
|
+
"xhr",
|
|
2094
|
+
"http",
|
|
2095
|
+
"fetch"
|
|
2096
|
+
],
|
|
2097
|
+
transformRequest: [function(e, t) {
|
|
2098
|
+
let n = t.getContentType() || "", r = n.indexOf("application/json") > -1, i = utils_default.isObject(e);
|
|
2099
|
+
if (i && utils_default.isHTMLForm(e) && (e = new FormData(e)), utils_default.isFormData(e)) return r ? JSON.stringify(formDataToJSON(e)) : e;
|
|
2100
|
+
if (utils_default.isArrayBuffer(e) || utils_default.isBuffer(e) || utils_default.isStream(e) || utils_default.isFile(e) || utils_default.isBlob(e) || utils_default.isReadableStream(e)) return e;
|
|
2101
|
+
if (utils_default.isArrayBufferView(e)) return e.buffer;
|
|
2102
|
+
if (utils_default.isURLSearchParams(e)) return t.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
|
|
2103
|
+
let a;
|
|
2104
|
+
if (i) {
|
|
2105
|
+
if (n.indexOf("application/x-www-form-urlencoded") > -1) return toURLEncodedForm(e, this.formSerializer).toString();
|
|
2106
|
+
if ((a = utils_default.isFileList(e)) || n.indexOf("multipart/form-data") > -1) {
|
|
2107
|
+
let t = this.env && this.env.FormData;
|
|
2108
|
+
return toFormData(a ? { "files[]": e } : e, t && new t(), this.formSerializer);
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
return i || r ? (t.setContentType("application/json", !1), stringifySafely(e)) : e;
|
|
2112
|
+
}],
|
|
2113
|
+
transformResponse: [function(e) {
|
|
2114
|
+
let t = this.transitional || defaults.transitional, n = t && t.forcedJSONParsing, r = this.responseType === "json";
|
|
2115
|
+
if (utils_default.isResponse(e) || utils_default.isReadableStream(e)) return e;
|
|
2116
|
+
if (e && utils_default.isString(e) && (n && !this.responseType || r)) {
|
|
2117
|
+
let n = !(t && t.silentJSONParsing) && r;
|
|
2118
|
+
try {
|
|
2119
|
+
return JSON.parse(e, this.parseReviver);
|
|
2120
|
+
} catch (e) {
|
|
2121
|
+
if (n) throw e.name === "SyntaxError" ? AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response) : e;
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
return e;
|
|
2125
|
+
}],
|
|
2126
|
+
timeout: 0,
|
|
2127
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
2128
|
+
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
2129
|
+
maxContentLength: -1,
|
|
2130
|
+
maxBodyLength: -1,
|
|
2131
|
+
env: {
|
|
2132
|
+
FormData: platform_default.classes.FormData,
|
|
2133
|
+
Blob: platform_default.classes.Blob
|
|
2134
|
+
},
|
|
2135
|
+
validateStatus: function(e) {
|
|
2136
|
+
return e >= 200 && e < 300;
|
|
2137
|
+
},
|
|
2138
|
+
headers: { common: {
|
|
2139
|
+
Accept: "application/json, text/plain, */*",
|
|
2140
|
+
"Content-Type": void 0
|
|
2141
|
+
} }
|
|
2142
|
+
};
|
|
2143
|
+
utils_default.forEach([
|
|
2144
|
+
"delete",
|
|
2145
|
+
"get",
|
|
2146
|
+
"head",
|
|
2147
|
+
"post",
|
|
2148
|
+
"put",
|
|
2149
|
+
"patch"
|
|
2150
|
+
], (e) => {
|
|
2151
|
+
defaults.headers[e] = {};
|
|
2152
|
+
});
|
|
2153
|
+
var ignoreDuplicateOf = utils_default.toObjectSet([
|
|
2154
|
+
"age",
|
|
2155
|
+
"authorization",
|
|
2156
|
+
"content-length",
|
|
2157
|
+
"content-type",
|
|
2158
|
+
"etag",
|
|
2159
|
+
"expires",
|
|
2160
|
+
"from",
|
|
2161
|
+
"host",
|
|
2162
|
+
"if-modified-since",
|
|
2163
|
+
"if-unmodified-since",
|
|
2164
|
+
"last-modified",
|
|
2165
|
+
"location",
|
|
2166
|
+
"max-forwards",
|
|
2167
|
+
"proxy-authorization",
|
|
2168
|
+
"referer",
|
|
2169
|
+
"retry-after",
|
|
2170
|
+
"user-agent"
|
|
2171
|
+
]), parseHeaders_default = (e) => {
|
|
2172
|
+
let t = {}, n, r, i;
|
|
2173
|
+
return e && e.split("\n").forEach(function(e) {
|
|
2174
|
+
i = e.indexOf(":"), n = e.substring(0, i).trim().toLowerCase(), r = e.substring(i + 1).trim(), !(!n || t[n] && ignoreDuplicateOf[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
|
|
2175
|
+
}), t;
|
|
2176
|
+
}, $internals = Symbol("internals");
|
|
2177
|
+
function normalizeHeader(e) {
|
|
2178
|
+
return e && String(e).trim().toLowerCase();
|
|
2179
|
+
}
|
|
2180
|
+
function normalizeValue(e) {
|
|
2181
|
+
return e === !1 || e == null ? e : utils_default.isArray(e) ? e.map(normalizeValue) : String(e);
|
|
2182
|
+
}
|
|
2183
|
+
function parseTokens(e) {
|
|
2184
|
+
let t = Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g, r;
|
|
2185
|
+
for (; r = n.exec(e);) t[r[1]] = r[2];
|
|
2186
|
+
return t;
|
|
2187
|
+
}
|
|
2188
|
+
var isValidHeaderName = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
|
|
2189
|
+
function matchHeaderValue(e, t, n, r, i) {
|
|
2190
|
+
if (utils_default.isFunction(r)) return r.call(this, t, n);
|
|
2191
|
+
if (i && (t = n), utils_default.isString(t)) {
|
|
2192
|
+
if (utils_default.isString(r)) return t.indexOf(r) !== -1;
|
|
2193
|
+
if (utils_default.isRegExp(r)) return r.test(t);
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
function formatHeader(e) {
|
|
2197
|
+
return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, t, n) => t.toUpperCase() + n);
|
|
2198
|
+
}
|
|
2199
|
+
function buildAccessors(e, t) {
|
|
2200
|
+
let n = utils_default.toCamelCase(" " + t);
|
|
2201
|
+
[
|
|
2202
|
+
"get",
|
|
2203
|
+
"set",
|
|
2204
|
+
"has"
|
|
2205
|
+
].forEach((r) => {
|
|
2206
|
+
Object.defineProperty(e, r + n, {
|
|
2207
|
+
value: function(e, n, i) {
|
|
2208
|
+
return this[r].call(this, t, e, n, i);
|
|
2209
|
+
},
|
|
2210
|
+
configurable: !0
|
|
2211
|
+
});
|
|
2212
|
+
});
|
|
2213
|
+
}
|
|
2214
|
+
var AxiosHeaders = class {
|
|
2215
|
+
constructor(e) {
|
|
2216
|
+
e && this.set(e);
|
|
2217
|
+
}
|
|
2218
|
+
set(e, t, n) {
|
|
2219
|
+
let r = this;
|
|
2220
|
+
function i(e, t, n) {
|
|
2221
|
+
let i = normalizeHeader(t);
|
|
2222
|
+
if (!i) throw Error("header name must be a non-empty string");
|
|
2223
|
+
let a = utils_default.findKey(r, i);
|
|
2224
|
+
(!a || r[a] === void 0 || n === !0 || n === void 0 && r[a] !== !1) && (r[a || t] = normalizeValue(e));
|
|
2225
|
+
}
|
|
2226
|
+
let a = (e, t) => utils_default.forEach(e, (e, n) => i(e, n, t));
|
|
2227
|
+
if (utils_default.isPlainObject(e) || e instanceof this.constructor) a(e, t);
|
|
2228
|
+
else if (utils_default.isString(e) && (e = e.trim()) && !isValidHeaderName(e)) a(parseHeaders_default(e), t);
|
|
2229
|
+
else if (utils_default.isObject(e) && utils_default.isIterable(e)) {
|
|
2230
|
+
let n = {}, r, i;
|
|
2231
|
+
for (let t of e) {
|
|
2232
|
+
if (!utils_default.isArray(t)) throw TypeError("Object iterator must return a key-value pair");
|
|
2233
|
+
n[i = t[0]] = (r = n[i]) ? utils_default.isArray(r) ? [...r, t[1]] : [r, t[1]] : t[1];
|
|
2234
|
+
}
|
|
2235
|
+
a(n, t);
|
|
2236
|
+
} else e != null && i(t, e, n);
|
|
2237
|
+
return this;
|
|
2238
|
+
}
|
|
2239
|
+
get(e, t) {
|
|
2240
|
+
if (e = normalizeHeader(e), e) {
|
|
2241
|
+
let n = utils_default.findKey(this, e);
|
|
2242
|
+
if (n) {
|
|
2243
|
+
let e = this[n];
|
|
2244
|
+
if (!t) return e;
|
|
2245
|
+
if (t === !0) return parseTokens(e);
|
|
2246
|
+
if (utils_default.isFunction(t)) return t.call(this, e, n);
|
|
2247
|
+
if (utils_default.isRegExp(t)) return t.exec(e);
|
|
2248
|
+
throw TypeError("parser must be boolean|regexp|function");
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
has(e, t) {
|
|
2253
|
+
if (e = normalizeHeader(e), e) {
|
|
2254
|
+
let n = utils_default.findKey(this, e);
|
|
2255
|
+
return !!(n && this[n] !== void 0 && (!t || matchHeaderValue(this, this[n], n, t)));
|
|
2256
|
+
}
|
|
2257
|
+
return !1;
|
|
2258
|
+
}
|
|
2259
|
+
delete(e, t) {
|
|
2260
|
+
let n = this, r = !1;
|
|
2261
|
+
function i(e) {
|
|
2262
|
+
if (e = normalizeHeader(e), e) {
|
|
2263
|
+
let i = utils_default.findKey(n, e);
|
|
2264
|
+
i && (!t || matchHeaderValue(n, n[i], i, t)) && (delete n[i], r = !0);
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
return utils_default.isArray(e) ? e.forEach(i) : i(e), r;
|
|
2268
|
+
}
|
|
2269
|
+
clear(e) {
|
|
2270
|
+
let t = Object.keys(this), n = t.length, r = !1;
|
|
2271
|
+
for (; n--;) {
|
|
2272
|
+
let i = t[n];
|
|
2273
|
+
(!e || matchHeaderValue(this, this[i], i, e, !0)) && (delete this[i], r = !0);
|
|
2274
|
+
}
|
|
2275
|
+
return r;
|
|
2276
|
+
}
|
|
2277
|
+
normalize(e) {
|
|
2278
|
+
let t = this, n = {};
|
|
2279
|
+
return utils_default.forEach(this, (r, i) => {
|
|
2280
|
+
let a = utils_default.findKey(n, i);
|
|
2281
|
+
if (a) {
|
|
2282
|
+
t[a] = normalizeValue(r), delete t[i];
|
|
2283
|
+
return;
|
|
2284
|
+
}
|
|
2285
|
+
let o = e ? formatHeader(i) : String(i).trim();
|
|
2286
|
+
o !== i && delete t[i], t[o] = normalizeValue(r), n[o] = !0;
|
|
2287
|
+
}), this;
|
|
2288
|
+
}
|
|
2289
|
+
concat(...e) {
|
|
2290
|
+
return this.constructor.concat(this, ...e);
|
|
2291
|
+
}
|
|
2292
|
+
toJSON(e) {
|
|
2293
|
+
let t = Object.create(null);
|
|
2294
|
+
return utils_default.forEach(this, (n, r) => {
|
|
2295
|
+
n != null && n !== !1 && (t[r] = e && utils_default.isArray(n) ? n.join(", ") : n);
|
|
2296
|
+
}), t;
|
|
2297
|
+
}
|
|
2298
|
+
[Symbol.iterator]() {
|
|
2299
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
2300
|
+
}
|
|
2301
|
+
toString() {
|
|
2302
|
+
return Object.entries(this.toJSON()).map(([e, t]) => e + ": " + t).join("\n");
|
|
2303
|
+
}
|
|
2304
|
+
getSetCookie() {
|
|
2305
|
+
return this.get("set-cookie") || [];
|
|
2306
|
+
}
|
|
2307
|
+
get [Symbol.toStringTag]() {
|
|
2308
|
+
return "AxiosHeaders";
|
|
2309
|
+
}
|
|
2310
|
+
static from(e) {
|
|
2311
|
+
return e instanceof this ? e : new this(e);
|
|
2312
|
+
}
|
|
2313
|
+
static concat(e, ...t) {
|
|
2314
|
+
let n = new this(e);
|
|
2315
|
+
return t.forEach((e) => n.set(e)), n;
|
|
2316
|
+
}
|
|
2317
|
+
static accessor(e) {
|
|
2318
|
+
let t = (this[$internals] = this[$internals] = { accessors: {} }).accessors, n = this.prototype;
|
|
2319
|
+
function r(e) {
|
|
2320
|
+
let r = normalizeHeader(e);
|
|
2321
|
+
t[r] || (buildAccessors(n, e), t[r] = !0);
|
|
2322
|
+
}
|
|
2323
|
+
return utils_default.isArray(e) ? e.forEach(r) : r(e), this;
|
|
2324
|
+
}
|
|
2325
|
+
};
|
|
2326
|
+
AxiosHeaders.accessor([
|
|
2327
|
+
"Content-Type",
|
|
2328
|
+
"Content-Length",
|
|
2329
|
+
"Accept",
|
|
2330
|
+
"Accept-Encoding",
|
|
2331
|
+
"User-Agent",
|
|
2332
|
+
"Authorization"
|
|
2333
|
+
]), utils_default.reduceDescriptors(AxiosHeaders.prototype, ({ value: e }, t) => {
|
|
2334
|
+
let n = t[0].toUpperCase() + t.slice(1);
|
|
2335
|
+
return {
|
|
2336
|
+
get: () => e,
|
|
2337
|
+
set(e) {
|
|
2338
|
+
this[n] = e;
|
|
2339
|
+
}
|
|
2340
|
+
};
|
|
2341
|
+
}), utils_default.freezeMethods(AxiosHeaders);
|
|
2342
|
+
function transformData(e, t) {
|
|
2343
|
+
let n = this || defaults, r = t || n, i = AxiosHeaders.from(r.headers), a = r.data;
|
|
2344
|
+
return utils_default.forEach(e, function(e) {
|
|
2345
|
+
a = e.call(n, a, i.normalize(), t ? t.status : void 0);
|
|
2346
|
+
}), i.normalize(), a;
|
|
2347
|
+
}
|
|
2348
|
+
function isCancel(e) {
|
|
2349
|
+
return !!(e && e.__CANCEL__);
|
|
2350
|
+
}
|
|
2351
|
+
var CanceledError = class extends AxiosError {
|
|
2352
|
+
constructor(e, t, n) {
|
|
2353
|
+
super(e ?? "canceled", AxiosError.ERR_CANCELED, t, n), this.name = "CanceledError", this.__CANCEL__ = !0;
|
|
2354
|
+
}
|
|
2355
|
+
};
|
|
2356
|
+
function settle(e, t, n) {
|
|
2357
|
+
let r = n.config.validateStatus;
|
|
2358
|
+
!n.status || !r || r(n.status) ? e(n) : t(new AxiosError("Request failed with status code " + n.status, [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4], n.config, n.request, n));
|
|
2359
|
+
}
|
|
2360
|
+
function parseProtocol(e) {
|
|
2361
|
+
let t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
|
|
2362
|
+
return t && t[1] || "";
|
|
2363
|
+
}
|
|
2364
|
+
function speedometer(e, t) {
|
|
2365
|
+
e ||= 10;
|
|
2366
|
+
let n = Array(e), r = Array(e), i = 0, a = 0, o;
|
|
2367
|
+
return t = t === void 0 ? 1e3 : t, function(s) {
|
|
2368
|
+
let c = Date.now(), l = r[a];
|
|
2369
|
+
o ||= c, n[i] = s, r[i] = c;
|
|
2370
|
+
let u = a, d = 0;
|
|
2371
|
+
for (; u !== i;) d += n[u++], u %= e;
|
|
2372
|
+
if (i = (i + 1) % e, i === a && (a = (a + 1) % e), c - o < t) return;
|
|
2373
|
+
let f = l && c - l;
|
|
2374
|
+
return f ? Math.round(d * 1e3 / f) : void 0;
|
|
2375
|
+
};
|
|
2376
|
+
}
|
|
2377
|
+
function throttle(e, t) {
|
|
2378
|
+
let n = 0, r = 1e3 / t, i, a, o = (t, r = Date.now()) => {
|
|
2379
|
+
n = r, i = null, a &&= (clearTimeout(a), null), e(...t);
|
|
2380
|
+
};
|
|
2381
|
+
return [(...e) => {
|
|
2382
|
+
let t = Date.now(), s = t - n;
|
|
2383
|
+
s >= r ? o(e, t) : (i = e, a ||= setTimeout(() => {
|
|
2384
|
+
a = null, o(i);
|
|
2385
|
+
}, r - s));
|
|
2386
|
+
}, () => i && o(i)];
|
|
2387
|
+
}
|
|
2388
|
+
const progressEventReducer = (e, t, n = 3) => {
|
|
2389
|
+
let r = 0, i = speedometer(50, 250);
|
|
2390
|
+
return throttle((n) => {
|
|
2391
|
+
let a = n.loaded, o = n.lengthComputable ? n.total : void 0, s = a - r, c = i(s), l = a <= o;
|
|
2392
|
+
r = a, e({
|
|
2393
|
+
loaded: a,
|
|
2394
|
+
total: o,
|
|
2395
|
+
progress: o ? a / o : void 0,
|
|
2396
|
+
bytes: s,
|
|
2397
|
+
rate: c || void 0,
|
|
2398
|
+
estimated: c && o && l ? (o - a) / c : void 0,
|
|
2399
|
+
event: n,
|
|
2400
|
+
lengthComputable: o != null,
|
|
2401
|
+
[t ? "download" : "upload"]: !0
|
|
2402
|
+
});
|
|
2403
|
+
}, n);
|
|
2404
|
+
}, progressEventDecorator = (e, t) => {
|
|
2405
|
+
let n = e != null;
|
|
2406
|
+
return [(r) => t[0]({
|
|
2407
|
+
lengthComputable: n,
|
|
2408
|
+
total: e,
|
|
2409
|
+
loaded: r
|
|
2410
|
+
}), t[1]];
|
|
2411
|
+
}, asyncDecorator = (e) => (...t) => utils_default.asap(() => e(...t));
|
|
2412
|
+
var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? ((e, t) => (n) => (n = new URL(n, platform_default.origin), e.protocol === n.protocol && e.host === n.host && (t || e.port === n.port)))(new URL(platform_default.origin), platform_default.navigator && /(msie|trident)/i.test(platform_default.navigator.userAgent)) : () => !0, cookies_default = platform_default.hasStandardBrowserEnv ? {
|
|
2413
|
+
write(e, t, n, r, i, a, o) {
|
|
2414
|
+
if (typeof document > "u") return;
|
|
2415
|
+
let s = [`${e}=${encodeURIComponent(t)}`];
|
|
2416
|
+
utils_default.isNumber(n) && s.push(`expires=${new Date(n).toUTCString()}`), utils_default.isString(r) && s.push(`path=${r}`), utils_default.isString(i) && s.push(`domain=${i}`), a === !0 && s.push("secure"), utils_default.isString(o) && s.push(`SameSite=${o}`), document.cookie = s.join("; ");
|
|
2417
|
+
},
|
|
2418
|
+
read(e) {
|
|
2419
|
+
if (typeof document > "u") return null;
|
|
2420
|
+
let t = document.cookie.match(RegExp("(?:^|; )" + e + "=([^;]*)"));
|
|
2421
|
+
return t ? decodeURIComponent(t[1]) : null;
|
|
2422
|
+
},
|
|
2423
|
+
remove(e) {
|
|
2424
|
+
this.write(e, "", Date.now() - 864e5, "/");
|
|
2425
|
+
}
|
|
2426
|
+
} : {
|
|
2427
|
+
write() {},
|
|
2428
|
+
read() {
|
|
2429
|
+
return null;
|
|
2430
|
+
},
|
|
2431
|
+
remove() {}
|
|
2432
|
+
};
|
|
2433
|
+
function isAbsoluteURL(e) {
|
|
2434
|
+
return typeof e == "string" ? /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e) : !1;
|
|
2435
|
+
}
|
|
2436
|
+
function combineURLs(e, t) {
|
|
2437
|
+
return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
|
|
2438
|
+
}
|
|
2439
|
+
function buildFullPath(e, t, n) {
|
|
2440
|
+
let r = !isAbsoluteURL(t);
|
|
2441
|
+
return e && (r || n == 0) ? combineURLs(e, t) : t;
|
|
2442
|
+
}
|
|
2443
|
+
var headersToObject = (e) => e instanceof AxiosHeaders ? { ...e } : e;
|
|
2444
|
+
function mergeConfig(e, t) {
|
|
2445
|
+
t ||= {};
|
|
2446
|
+
let n = {};
|
|
2447
|
+
function r(e, t, n, r) {
|
|
2448
|
+
return utils_default.isPlainObject(e) && utils_default.isPlainObject(t) ? utils_default.merge.call({ caseless: r }, e, t) : utils_default.isPlainObject(t) ? utils_default.merge({}, t) : utils_default.isArray(t) ? t.slice() : t;
|
|
2449
|
+
}
|
|
2450
|
+
function i(e, t, n, i) {
|
|
2451
|
+
if (!utils_default.isUndefined(t)) return r(e, t, n, i);
|
|
2452
|
+
if (!utils_default.isUndefined(e)) return r(void 0, e, n, i);
|
|
2453
|
+
}
|
|
2454
|
+
function a(e, t) {
|
|
2455
|
+
if (!utils_default.isUndefined(t)) return r(void 0, t);
|
|
2456
|
+
}
|
|
2457
|
+
function o(e, t) {
|
|
2458
|
+
if (!utils_default.isUndefined(t)) return r(void 0, t);
|
|
2459
|
+
if (!utils_default.isUndefined(e)) return r(void 0, e);
|
|
2460
|
+
}
|
|
2461
|
+
function s(n, i, a) {
|
|
2462
|
+
if (a in t) return r(n, i);
|
|
2463
|
+
if (a in e) return r(void 0, n);
|
|
2464
|
+
}
|
|
2465
|
+
let c = {
|
|
2466
|
+
url: a,
|
|
2467
|
+
method: a,
|
|
2468
|
+
data: a,
|
|
2469
|
+
baseURL: o,
|
|
2470
|
+
transformRequest: o,
|
|
2471
|
+
transformResponse: o,
|
|
2472
|
+
paramsSerializer: o,
|
|
2473
|
+
timeout: o,
|
|
2474
|
+
timeoutMessage: o,
|
|
2475
|
+
withCredentials: o,
|
|
2476
|
+
withXSRFToken: o,
|
|
2477
|
+
adapter: o,
|
|
2478
|
+
responseType: o,
|
|
2479
|
+
xsrfCookieName: o,
|
|
2480
|
+
xsrfHeaderName: o,
|
|
2481
|
+
onUploadProgress: o,
|
|
2482
|
+
onDownloadProgress: o,
|
|
2483
|
+
decompress: o,
|
|
2484
|
+
maxContentLength: o,
|
|
2485
|
+
maxBodyLength: o,
|
|
2486
|
+
beforeRedirect: o,
|
|
2487
|
+
transport: o,
|
|
2488
|
+
httpAgent: o,
|
|
2489
|
+
httpsAgent: o,
|
|
2490
|
+
cancelToken: o,
|
|
2491
|
+
socketPath: o,
|
|
2492
|
+
responseEncoding: o,
|
|
2493
|
+
validateStatus: s,
|
|
2494
|
+
headers: (e, t, n) => i(headersToObject(e), headersToObject(t), n, !0)
|
|
2495
|
+
};
|
|
2496
|
+
return utils_default.forEach(Object.keys({
|
|
2497
|
+
...e,
|
|
2498
|
+
...t
|
|
2499
|
+
}), function(r) {
|
|
2500
|
+
if (r === "__proto__" || r === "constructor" || r === "prototype") return;
|
|
2501
|
+
let a = utils_default.hasOwnProp(c, r) ? c[r] : i, o = a(e[r], t[r], r);
|
|
2502
|
+
utils_default.isUndefined(o) && a !== s || (n[r] = o);
|
|
2503
|
+
}), n;
|
|
2504
|
+
}
|
|
2505
|
+
var resolveConfig_default = (e) => {
|
|
2506
|
+
let t = mergeConfig({}, e), { data: n, withXSRFToken: r, xsrfHeaderName: i, xsrfCookieName: a, headers: o, auth: s } = t;
|
|
2507
|
+
if (t.headers = o = AxiosHeaders.from(o), t.url = buildURL(buildFullPath(t.baseURL, t.url, t.allowAbsoluteUrls), e.params, e.paramsSerializer), s && o.set("Authorization", "Basic " + btoa((s.username || "") + ":" + (s.password ? unescape(encodeURIComponent(s.password)) : ""))), utils_default.isFormData(n)) {
|
|
2508
|
+
if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv) o.setContentType(void 0);
|
|
2509
|
+
else if (utils_default.isFunction(n.getHeaders)) {
|
|
2510
|
+
let e = n.getHeaders(), t = ["content-type", "content-length"];
|
|
2511
|
+
Object.entries(e).forEach(([e, n]) => {
|
|
2512
|
+
t.includes(e.toLowerCase()) && o.set(e, n);
|
|
2513
|
+
});
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
if (platform_default.hasStandardBrowserEnv && (r && utils_default.isFunction(r) && (r = r(t)), r || r !== !1 && isURLSameOrigin_default(t.url))) {
|
|
2517
|
+
let e = i && a && cookies_default.read(a);
|
|
2518
|
+
e && o.set(i, e);
|
|
2519
|
+
}
|
|
2520
|
+
return t;
|
|
2521
|
+
}, xhr_default = typeof XMLHttpRequest < "u" && function(e) {
|
|
2522
|
+
return new Promise(function(t, n) {
|
|
2523
|
+
let r = resolveConfig_default(e), i = r.data, a = AxiosHeaders.from(r.headers).normalize(), { responseType: o, onUploadProgress: s, onDownloadProgress: c } = r, l, u, d, f, p;
|
|
2524
|
+
function m() {
|
|
2525
|
+
f && f(), p && p(), r.cancelToken && r.cancelToken.unsubscribe(l), r.signal && r.signal.removeEventListener("abort", l);
|
|
2526
|
+
}
|
|
2527
|
+
let h = new XMLHttpRequest();
|
|
2528
|
+
h.open(r.method.toUpperCase(), r.url, !0), h.timeout = r.timeout;
|
|
2529
|
+
function g() {
|
|
2530
|
+
if (!h) return;
|
|
2531
|
+
let r = AxiosHeaders.from("getAllResponseHeaders" in h && h.getAllResponseHeaders());
|
|
2532
|
+
settle(function(e) {
|
|
2533
|
+
t(e), m();
|
|
2534
|
+
}, function(e) {
|
|
2535
|
+
n(e), m();
|
|
2536
|
+
}, {
|
|
2537
|
+
data: !o || o === "text" || o === "json" ? h.responseText : h.response,
|
|
2538
|
+
status: h.status,
|
|
2539
|
+
statusText: h.statusText,
|
|
2540
|
+
headers: r,
|
|
2541
|
+
config: e,
|
|
2542
|
+
request: h
|
|
2543
|
+
}), h = null;
|
|
2544
|
+
}
|
|
2545
|
+
"onloadend" in h ? h.onloadend = g : h.onreadystatechange = function() {
|
|
2546
|
+
!h || h.readyState !== 4 || h.status === 0 && !(h.responseURL && h.responseURL.indexOf("file:") === 0) || setTimeout(g);
|
|
2547
|
+
}, h.onabort = function() {
|
|
2548
|
+
h &&= (n(new AxiosError("Request aborted", AxiosError.ECONNABORTED, e, h)), null);
|
|
2549
|
+
}, h.onerror = function(t) {
|
|
2550
|
+
let r = new AxiosError(t && t.message ? t.message : "Network Error", AxiosError.ERR_NETWORK, e, h);
|
|
2551
|
+
r.event = t || null, n(r), h = null;
|
|
2552
|
+
}, h.ontimeout = function() {
|
|
2553
|
+
let t = r.timeout ? "timeout of " + r.timeout + "ms exceeded" : "timeout exceeded", i = r.transitional || transitional_default;
|
|
2554
|
+
r.timeoutErrorMessage && (t = r.timeoutErrorMessage), n(new AxiosError(t, i.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, e, h)), h = null;
|
|
2555
|
+
}, i === void 0 && a.setContentType(null), "setRequestHeader" in h && utils_default.forEach(a.toJSON(), function(e, t) {
|
|
2556
|
+
h.setRequestHeader(t, e);
|
|
2557
|
+
}), utils_default.isUndefined(r.withCredentials) || (h.withCredentials = !!r.withCredentials), o && o !== "json" && (h.responseType = r.responseType), c && ([d, p] = progressEventReducer(c, !0), h.addEventListener("progress", d)), s && h.upload && ([u, f] = progressEventReducer(s), h.upload.addEventListener("progress", u), h.upload.addEventListener("loadend", f)), (r.cancelToken || r.signal) && (l = (t) => {
|
|
2558
|
+
h &&= (n(!t || t.type ? new CanceledError(null, e, h) : t), h.abort(), null);
|
|
2559
|
+
}, r.cancelToken && r.cancelToken.subscribe(l), r.signal && (r.signal.aborted ? l() : r.signal.addEventListener("abort", l)));
|
|
2560
|
+
let _ = parseProtocol(r.url);
|
|
2561
|
+
if (_ && platform_default.protocols.indexOf(_) === -1) {
|
|
2562
|
+
n(new AxiosError("Unsupported protocol " + _ + ":", AxiosError.ERR_BAD_REQUEST, e));
|
|
2563
|
+
return;
|
|
2564
|
+
}
|
|
2565
|
+
h.send(i || null);
|
|
2566
|
+
});
|
|
2567
|
+
}, composeSignals = (e, t) => {
|
|
2568
|
+
let { length: n } = e = e ? e.filter(Boolean) : [];
|
|
2569
|
+
if (t || n) {
|
|
2570
|
+
let n = new AbortController(), r, i = function(e) {
|
|
2571
|
+
if (!r) {
|
|
2572
|
+
r = !0, o();
|
|
2573
|
+
let t = e instanceof Error ? e : this.reason;
|
|
2574
|
+
n.abort(t instanceof AxiosError ? t : new CanceledError(t instanceof Error ? t.message : t));
|
|
2575
|
+
}
|
|
2576
|
+
}, a = t && setTimeout(() => {
|
|
2577
|
+
a = null, i(new AxiosError(`timeout of ${t}ms exceeded`, AxiosError.ETIMEDOUT));
|
|
2578
|
+
}, t), o = () => {
|
|
2579
|
+
e &&= (a && clearTimeout(a), a = null, e.forEach((e) => {
|
|
2580
|
+
e.unsubscribe ? e.unsubscribe(i) : e.removeEventListener("abort", i);
|
|
2581
|
+
}), null);
|
|
2582
|
+
};
|
|
2583
|
+
e.forEach((e) => e.addEventListener("abort", i));
|
|
2584
|
+
let { signal: s } = n;
|
|
2585
|
+
return s.unsubscribe = () => utils_default.asap(o), s;
|
|
2586
|
+
}
|
|
2587
|
+
};
|
|
2588
|
+
const streamChunk = function* (e, t) {
|
|
2589
|
+
let n = e.byteLength;
|
|
2590
|
+
if (!t || n < t) {
|
|
2591
|
+
yield e;
|
|
2592
|
+
return;
|
|
2593
|
+
}
|
|
2594
|
+
let r = 0, i;
|
|
2595
|
+
for (; r < n;) i = r + t, yield e.slice(r, i), r = i;
|
|
2596
|
+
}, readBytes = async function* (e, t) {
|
|
2597
|
+
for await (let n of readStream(e)) yield* streamChunk(n, t);
|
|
2598
|
+
};
|
|
2599
|
+
var readStream = async function* (e) {
|
|
2600
|
+
if (e[Symbol.asyncIterator]) {
|
|
2601
|
+
yield* e;
|
|
2602
|
+
return;
|
|
2603
|
+
}
|
|
2604
|
+
let t = e.getReader();
|
|
2605
|
+
try {
|
|
2606
|
+
for (;;) {
|
|
2607
|
+
let { done: e, value: n } = await t.read();
|
|
2608
|
+
if (e) break;
|
|
2609
|
+
yield n;
|
|
2610
|
+
}
|
|
2611
|
+
} finally {
|
|
2612
|
+
await t.cancel();
|
|
2613
|
+
}
|
|
2614
|
+
};
|
|
2615
|
+
const trackStream = (e, t, n, r) => {
|
|
2616
|
+
let i = readBytes(e, t), a = 0, o, s = (e) => {
|
|
2617
|
+
o || (o = !0, r && r(e));
|
|
2618
|
+
};
|
|
2619
|
+
return new ReadableStream({
|
|
2620
|
+
async pull(e) {
|
|
2621
|
+
try {
|
|
2622
|
+
let { done: t, value: r } = await i.next();
|
|
2623
|
+
if (t) {
|
|
2624
|
+
s(), e.close();
|
|
2625
|
+
return;
|
|
2626
|
+
}
|
|
2627
|
+
let o = r.byteLength;
|
|
2628
|
+
n && n(a += o), e.enqueue(new Uint8Array(r));
|
|
2629
|
+
} catch (e) {
|
|
2630
|
+
throw s(e), e;
|
|
2631
|
+
}
|
|
2632
|
+
},
|
|
2633
|
+
cancel(e) {
|
|
2634
|
+
return s(e), i.return();
|
|
2635
|
+
}
|
|
2636
|
+
}, { highWaterMark: 2 });
|
|
2637
|
+
};
|
|
2638
|
+
var DEFAULT_CHUNK_SIZE = 64 * 1024, { isFunction } = utils_default, globalFetchAPI = (({ Request: e, Response: t }) => ({
|
|
2639
|
+
Request: e,
|
|
2640
|
+
Response: t
|
|
2641
|
+
}))(utils_default.global), { ReadableStream: ReadableStream$1, TextEncoder } = utils_default.global, test = (e, ...t) => {
|
|
2642
|
+
try {
|
|
2643
|
+
return !!e(...t);
|
|
2644
|
+
} catch {
|
|
2645
|
+
return !1;
|
|
2646
|
+
}
|
|
2647
|
+
}, factory = (e) => {
|
|
2648
|
+
e = utils_default.merge.call({ skipUndefined: !0 }, globalFetchAPI, e);
|
|
2649
|
+
let { fetch: t, Request: n, Response: r } = e, i = t ? isFunction(t) : typeof fetch == "function", a = isFunction(n), o = isFunction(r);
|
|
2650
|
+
if (!i) return !1;
|
|
2651
|
+
let s = i && isFunction(ReadableStream$1), c = i && (typeof TextEncoder == "function" ? ((e) => (t) => e.encode(t))(new TextEncoder()) : async (e) => new Uint8Array(await new n(e).arrayBuffer())), l = a && s && test(() => {
|
|
2652
|
+
let e = !1, t = new n(platform_default.origin, {
|
|
2653
|
+
body: new ReadableStream$1(),
|
|
2654
|
+
method: "POST",
|
|
2655
|
+
get duplex() {
|
|
2656
|
+
return e = !0, "half";
|
|
2657
|
+
}
|
|
2658
|
+
}).headers.has("Content-Type");
|
|
2659
|
+
return e && !t;
|
|
2660
|
+
}), u = o && s && test(() => utils_default.isReadableStream(new r("").body)), d = { stream: u && ((e) => e.body) };
|
|
2661
|
+
i && [
|
|
2662
|
+
"text",
|
|
2663
|
+
"arrayBuffer",
|
|
2664
|
+
"blob",
|
|
2665
|
+
"formData",
|
|
2666
|
+
"stream"
|
|
2667
|
+
].forEach((e) => {
|
|
2668
|
+
!d[e] && (d[e] = (t, n) => {
|
|
2669
|
+
let r = t && t[e];
|
|
2670
|
+
if (r) return r.call(t);
|
|
2671
|
+
throw new AxiosError(`Response type '${e}' is not supported`, AxiosError.ERR_NOT_SUPPORT, n);
|
|
2672
|
+
});
|
|
2673
|
+
});
|
|
2674
|
+
let f = async (e) => {
|
|
2675
|
+
if (e == null) return 0;
|
|
2676
|
+
if (utils_default.isBlob(e)) return e.size;
|
|
2677
|
+
if (utils_default.isSpecCompliantForm(e)) return (await new n(platform_default.origin, {
|
|
2678
|
+
method: "POST",
|
|
2679
|
+
body: e
|
|
2680
|
+
}).arrayBuffer()).byteLength;
|
|
2681
|
+
if (utils_default.isArrayBufferView(e) || utils_default.isArrayBuffer(e)) return e.byteLength;
|
|
2682
|
+
if (utils_default.isURLSearchParams(e) && (e += ""), utils_default.isString(e)) return (await c(e)).byteLength;
|
|
2683
|
+
}, p = async (e, t) => utils_default.toFiniteNumber(e.getContentLength()) ?? f(t);
|
|
2684
|
+
return async (e) => {
|
|
2685
|
+
let { url: i, method: o, data: s, signal: c, cancelToken: f, timeout: m, onDownloadProgress: h, onUploadProgress: g, responseType: _, headers: v, withCredentials: y = "same-origin", fetchOptions: b } = resolveConfig_default(e), x = t || fetch;
|
|
2686
|
+
_ = _ ? (_ + "").toLowerCase() : "text";
|
|
2687
|
+
let S = composeSignals([c, f && f.toAbortSignal()], m), C = null, w = S && S.unsubscribe && (() => {
|
|
2688
|
+
S.unsubscribe();
|
|
2689
|
+
}), T;
|
|
2690
|
+
try {
|
|
2691
|
+
if (g && l && o !== "get" && o !== "head" && (T = await p(v, s)) !== 0) {
|
|
2692
|
+
let e = new n(i, {
|
|
2693
|
+
method: "POST",
|
|
2694
|
+
body: s,
|
|
2695
|
+
duplex: "half"
|
|
2696
|
+
}), t;
|
|
2697
|
+
if (utils_default.isFormData(s) && (t = e.headers.get("content-type")) && v.setContentType(t), e.body) {
|
|
2698
|
+
let [t, n] = progressEventDecorator(T, progressEventReducer(asyncDecorator(g)));
|
|
2699
|
+
s = trackStream(e.body, DEFAULT_CHUNK_SIZE, t, n);
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
utils_default.isString(y) || (y = y ? "include" : "omit");
|
|
2703
|
+
let t = a && "credentials" in n.prototype, c = {
|
|
2704
|
+
...b,
|
|
2705
|
+
signal: S,
|
|
2706
|
+
method: o.toUpperCase(),
|
|
2707
|
+
headers: v.normalize().toJSON(),
|
|
2708
|
+
body: s,
|
|
2709
|
+
duplex: "half",
|
|
2710
|
+
credentials: t ? y : void 0
|
|
2711
|
+
};
|
|
2712
|
+
C = a && new n(i, c);
|
|
2713
|
+
let f = await (a ? x(C, b) : x(i, c)), m = u && (_ === "stream" || _ === "response");
|
|
2714
|
+
if (u && (h || m && w)) {
|
|
2715
|
+
let e = {};
|
|
2716
|
+
[
|
|
2717
|
+
"status",
|
|
2718
|
+
"statusText",
|
|
2719
|
+
"headers"
|
|
2720
|
+
].forEach((t) => {
|
|
2721
|
+
e[t] = f[t];
|
|
2722
|
+
});
|
|
2723
|
+
let t = utils_default.toFiniteNumber(f.headers.get("content-length")), [n, i] = h && progressEventDecorator(t, progressEventReducer(asyncDecorator(h), !0)) || [];
|
|
2724
|
+
f = new r(trackStream(f.body, DEFAULT_CHUNK_SIZE, n, () => {
|
|
2725
|
+
i && i(), w && w();
|
|
2726
|
+
}), e);
|
|
2727
|
+
}
|
|
2728
|
+
_ ||= "text";
|
|
2729
|
+
let E = await d[utils_default.findKey(d, _) || "text"](f, e);
|
|
2730
|
+
return !m && w && w(), await new Promise((t, n) => {
|
|
2731
|
+
settle(t, n, {
|
|
2732
|
+
data: E,
|
|
2733
|
+
headers: AxiosHeaders.from(f.headers),
|
|
2734
|
+
status: f.status,
|
|
2735
|
+
statusText: f.statusText,
|
|
2736
|
+
config: e,
|
|
2737
|
+
request: C
|
|
2738
|
+
});
|
|
2739
|
+
});
|
|
2740
|
+
} catch (t) {
|
|
2741
|
+
throw w && w(), t && t.name === "TypeError" && /Load failed|fetch/i.test(t.message) ? Object.assign(new AxiosError("Network Error", AxiosError.ERR_NETWORK, e, C, t && t.response), { cause: t.cause || t }) : AxiosError.from(t, t && t.code, e, C, t && t.response);
|
|
2742
|
+
}
|
|
2743
|
+
};
|
|
2744
|
+
}, seedCache = /* @__PURE__ */ new Map();
|
|
2745
|
+
const getFetch = (e) => {
|
|
2746
|
+
let t = e && e.env || {}, { fetch: n, Request: r, Response: i } = t, a = [
|
|
2747
|
+
r,
|
|
2748
|
+
i,
|
|
2749
|
+
n
|
|
2750
|
+
], o = a.length, s, c, l = seedCache;
|
|
2751
|
+
for (; o--;) s = a[o], c = l.get(s), c === void 0 && l.set(s, c = o ? /* @__PURE__ */ new Map() : factory(t)), l = c;
|
|
2752
|
+
return c;
|
|
2753
|
+
};
|
|
2754
|
+
getFetch();
|
|
2755
|
+
var knownAdapters = {
|
|
2756
|
+
http: null,
|
|
2757
|
+
xhr: xhr_default,
|
|
2758
|
+
fetch: { get: getFetch }
|
|
2759
|
+
};
|
|
2760
|
+
utils_default.forEach(knownAdapters, (e, t) => {
|
|
2761
|
+
if (e) {
|
|
2762
|
+
try {
|
|
2763
|
+
Object.defineProperty(e, "name", { value: t });
|
|
2764
|
+
} catch {}
|
|
2765
|
+
Object.defineProperty(e, "adapterName", { value: t });
|
|
2766
|
+
}
|
|
2767
|
+
});
|
|
2768
|
+
var renderReason = (e) => `- ${e}`, isResolvedHandle = (e) => utils_default.isFunction(e) || e === null || e === !1;
|
|
2769
|
+
function getAdapter(e, t) {
|
|
2770
|
+
e = utils_default.isArray(e) ? e : [e];
|
|
2771
|
+
let { length: n } = e, r, i, a = {};
|
|
2772
|
+
for (let o = 0; o < n; o++) {
|
|
2773
|
+
r = e[o];
|
|
2774
|
+
let n;
|
|
2775
|
+
if (i = r, !isResolvedHandle(r) && (i = knownAdapters[(n = String(r)).toLowerCase()], i === void 0)) throw new AxiosError(`Unknown adapter '${n}'`);
|
|
2776
|
+
if (i && (utils_default.isFunction(i) || (i = i.get(t)))) break;
|
|
2777
|
+
a[n || "#" + o] = i;
|
|
2778
|
+
}
|
|
2779
|
+
if (!i) {
|
|
2780
|
+
let e = Object.entries(a).map(([e, t]) => `adapter ${e} ` + (t === !1 ? "is not supported by the environment" : "is not available in the build"));
|
|
2781
|
+
throw new AxiosError("There is no suitable adapter to dispatch the request " + (n ? e.length > 1 ? "since :\n" + e.map(renderReason).join("\n") : " " + renderReason(e[0]) : "as no adapter specified"), "ERR_NOT_SUPPORT");
|
|
2782
|
+
}
|
|
2783
|
+
return i;
|
|
2784
|
+
}
|
|
2785
|
+
var adapters_default = {
|
|
2786
|
+
getAdapter,
|
|
2787
|
+
adapters: knownAdapters
|
|
2788
|
+
};
|
|
2789
|
+
function throwIfCancellationRequested(e) {
|
|
2790
|
+
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted) throw new CanceledError(null, e);
|
|
2791
|
+
}
|
|
2792
|
+
function dispatchRequest(e) {
|
|
2793
|
+
return throwIfCancellationRequested(e), e.headers = AxiosHeaders.from(e.headers), e.data = transformData.call(e, e.transformRequest), [
|
|
2794
|
+
"post",
|
|
2795
|
+
"put",
|
|
2796
|
+
"patch"
|
|
2797
|
+
].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), adapters_default.getAdapter(e.adapter || defaults.adapter, e)(e).then(function(t) {
|
|
2798
|
+
return throwIfCancellationRequested(e), t.data = transformData.call(e, e.transformResponse, t), t.headers = AxiosHeaders.from(t.headers), t;
|
|
2799
|
+
}, function(t) {
|
|
2800
|
+
return isCancel(t) || (throwIfCancellationRequested(e), t && t.response && (t.response.data = transformData.call(e, e.transformResponse, t.response), t.response.headers = AxiosHeaders.from(t.response.headers))), Promise.reject(t);
|
|
2801
|
+
});
|
|
2802
|
+
}
|
|
2803
|
+
const VERSION = "1.13.5";
|
|
2804
|
+
var validators$1 = {};
|
|
2805
|
+
[
|
|
2806
|
+
"object",
|
|
2807
|
+
"boolean",
|
|
2808
|
+
"number",
|
|
2809
|
+
"function",
|
|
2810
|
+
"string",
|
|
2811
|
+
"symbol"
|
|
2812
|
+
].forEach((e, t) => {
|
|
2813
|
+
validators$1[e] = function(n) {
|
|
2814
|
+
return typeof n === e || "a" + (t < 1 ? "n " : " ") + e;
|
|
2815
|
+
};
|
|
2816
|
+
});
|
|
2817
|
+
var deprecatedWarnings = {};
|
|
2818
|
+
validators$1.transitional = function(e, t, n) {
|
|
2819
|
+
function r(e, t) {
|
|
2820
|
+
return "[Axios v" + VERSION + "] Transitional option '" + e + "'" + t + (n ? ". " + n : "");
|
|
2821
|
+
}
|
|
2822
|
+
return (n, i, a) => {
|
|
2823
|
+
if (e === !1) throw new AxiosError(r(i, " has been removed" + (t ? " in " + t : "")), AxiosError.ERR_DEPRECATED);
|
|
2824
|
+
return t && !deprecatedWarnings[i] && (deprecatedWarnings[i] = !0, console.warn(r(i, " has been deprecated since v" + t + " and will be removed in the near future"))), e ? e(n, i, a) : !0;
|
|
2825
|
+
};
|
|
2826
|
+
}, validators$1.spelling = function(e) {
|
|
2827
|
+
return (t, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0);
|
|
2828
|
+
};
|
|
2829
|
+
function assertOptions(e, t, n) {
|
|
2830
|
+
if (typeof e != "object") throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
|
|
2831
|
+
let r = Object.keys(e), i = r.length;
|
|
2832
|
+
for (; i-- > 0;) {
|
|
2833
|
+
let a = r[i], o = t[a];
|
|
2834
|
+
if (o) {
|
|
2835
|
+
let t = e[a], n = t === void 0 || o(t, a, e);
|
|
2836
|
+
if (n !== !0) throw new AxiosError("option " + a + " must be " + n, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
2837
|
+
continue;
|
|
2838
|
+
}
|
|
2839
|
+
if (n !== !0) throw new AxiosError("Unknown option " + a, AxiosError.ERR_BAD_OPTION);
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
var validator_default = {
|
|
2843
|
+
assertOptions,
|
|
2844
|
+
validators: validators$1
|
|
2845
|
+
}, validators = validator_default.validators, Axios = class {
|
|
2846
|
+
constructor(e) {
|
|
2847
|
+
this.defaults = e || {}, this.interceptors = {
|
|
2848
|
+
request: new InterceptorManager(),
|
|
2849
|
+
response: new InterceptorManager()
|
|
2850
|
+
};
|
|
2851
|
+
}
|
|
2852
|
+
async request(e, t) {
|
|
2853
|
+
try {
|
|
2854
|
+
return await this._request(e, t);
|
|
2855
|
+
} catch (e) {
|
|
2856
|
+
if (e instanceof Error) {
|
|
2857
|
+
let t = {};
|
|
2858
|
+
Error.captureStackTrace ? Error.captureStackTrace(t) : t = /* @__PURE__ */ Error();
|
|
2859
|
+
let n = t.stack ? t.stack.replace(/^.+\n/, "") : "";
|
|
2860
|
+
try {
|
|
2861
|
+
e.stack ? n && !String(e.stack).endsWith(n.replace(/^.+\n.+\n/, "")) && (e.stack += "\n" + n) : e.stack = n;
|
|
2862
|
+
} catch {}
|
|
2863
|
+
}
|
|
2864
|
+
throw e;
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
_request(e, t) {
|
|
2868
|
+
typeof e == "string" ? (t ||= {}, t.url = e) : t = e || {}, t = mergeConfig(this.defaults, t);
|
|
2869
|
+
let { transitional: n, paramsSerializer: r, headers: i } = t;
|
|
2870
|
+
n !== void 0 && validator_default.assertOptions(n, {
|
|
2871
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
2872
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
2873
|
+
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
2874
|
+
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean)
|
|
2875
|
+
}, !1), r != null && (utils_default.isFunction(r) ? t.paramsSerializer = { serialize: r } : validator_default.assertOptions(r, {
|
|
2876
|
+
encode: validators.function,
|
|
2877
|
+
serialize: validators.function
|
|
2878
|
+
}, !0)), t.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls === void 0 ? t.allowAbsoluteUrls = !0 : t.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls), validator_default.assertOptions(t, {
|
|
2879
|
+
baseUrl: validators.spelling("baseURL"),
|
|
2880
|
+
withXsrfToken: validators.spelling("withXSRFToken")
|
|
2881
|
+
}, !0), t.method = (t.method || this.defaults.method || "get").toLowerCase();
|
|
2882
|
+
let a = i && utils_default.merge(i.common, i[t.method]);
|
|
2883
|
+
i && utils_default.forEach([
|
|
2884
|
+
"delete",
|
|
2885
|
+
"get",
|
|
2886
|
+
"head",
|
|
2887
|
+
"post",
|
|
2888
|
+
"put",
|
|
2889
|
+
"patch",
|
|
2890
|
+
"common"
|
|
2891
|
+
], (e) => {
|
|
2892
|
+
delete i[e];
|
|
2893
|
+
}), t.headers = AxiosHeaders.concat(a, i);
|
|
2894
|
+
let o = [], s = !0;
|
|
2895
|
+
this.interceptors.request.forEach(function(e) {
|
|
2896
|
+
if (typeof e.runWhen == "function" && e.runWhen(t) === !1) return;
|
|
2897
|
+
s &&= e.synchronous;
|
|
2898
|
+
let n = t.transitional || transitional_default;
|
|
2899
|
+
n && n.legacyInterceptorReqResOrdering ? o.unshift(e.fulfilled, e.rejected) : o.push(e.fulfilled, e.rejected);
|
|
2900
|
+
});
|
|
2901
|
+
let c = [];
|
|
2902
|
+
this.interceptors.response.forEach(function(e) {
|
|
2903
|
+
c.push(e.fulfilled, e.rejected);
|
|
2904
|
+
});
|
|
2905
|
+
let l, u = 0, d;
|
|
2906
|
+
if (!s) {
|
|
2907
|
+
let e = [dispatchRequest.bind(this), void 0];
|
|
2908
|
+
for (e.unshift(...o), e.push(...c), d = e.length, l = Promise.resolve(t); u < d;) l = l.then(e[u++], e[u++]);
|
|
2909
|
+
return l;
|
|
2910
|
+
}
|
|
2911
|
+
d = o.length;
|
|
2912
|
+
let f = t;
|
|
2913
|
+
for (; u < d;) {
|
|
2914
|
+
let e = o[u++], t = o[u++];
|
|
2915
|
+
try {
|
|
2916
|
+
f = e(f);
|
|
2917
|
+
} catch (e) {
|
|
2918
|
+
t.call(this, e);
|
|
2919
|
+
break;
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
try {
|
|
2923
|
+
l = dispatchRequest.call(this, f);
|
|
2924
|
+
} catch (e) {
|
|
2925
|
+
return Promise.reject(e);
|
|
2926
|
+
}
|
|
2927
|
+
for (u = 0, d = c.length; u < d;) l = l.then(c[u++], c[u++]);
|
|
2928
|
+
return l;
|
|
2929
|
+
}
|
|
2930
|
+
getUri(e) {
|
|
2931
|
+
return e = mergeConfig(this.defaults, e), buildURL(buildFullPath(e.baseURL, e.url, e.allowAbsoluteUrls), e.params, e.paramsSerializer);
|
|
2932
|
+
}
|
|
2933
|
+
};
|
|
2934
|
+
utils_default.forEach([
|
|
2935
|
+
"delete",
|
|
2936
|
+
"get",
|
|
2937
|
+
"head",
|
|
2938
|
+
"options"
|
|
2939
|
+
], function(e) {
|
|
2940
|
+
Axios.prototype[e] = function(t, n) {
|
|
2941
|
+
return this.request(mergeConfig(n || {}, {
|
|
2942
|
+
method: e,
|
|
2943
|
+
url: t,
|
|
2944
|
+
data: (n || {}).data
|
|
2945
|
+
}));
|
|
2946
|
+
};
|
|
2947
|
+
}), utils_default.forEach([
|
|
2948
|
+
"post",
|
|
2949
|
+
"put",
|
|
2950
|
+
"patch"
|
|
2951
|
+
], function(e) {
|
|
2952
|
+
function t(t) {
|
|
2953
|
+
return function(n, r, i) {
|
|
2954
|
+
return this.request(mergeConfig(i || {}, {
|
|
2955
|
+
method: e,
|
|
2956
|
+
headers: t ? { "Content-Type": "multipart/form-data" } : {},
|
|
2957
|
+
url: n,
|
|
2958
|
+
data: r
|
|
2959
|
+
}));
|
|
2960
|
+
};
|
|
2961
|
+
}
|
|
2962
|
+
Axios.prototype[e] = t(), Axios.prototype[e + "Form"] = t(!0);
|
|
2963
|
+
});
|
|
2964
|
+
var CancelToken = class e {
|
|
2965
|
+
constructor(e) {
|
|
2966
|
+
if (typeof e != "function") throw TypeError("executor must be a function.");
|
|
2967
|
+
let t;
|
|
2968
|
+
this.promise = new Promise(function(e) {
|
|
2969
|
+
t = e;
|
|
2970
|
+
});
|
|
2971
|
+
let n = this;
|
|
2972
|
+
this.promise.then((e) => {
|
|
2973
|
+
if (!n._listeners) return;
|
|
2974
|
+
let t = n._listeners.length;
|
|
2975
|
+
for (; t-- > 0;) n._listeners[t](e);
|
|
2976
|
+
n._listeners = null;
|
|
2977
|
+
}), this.promise.then = (e) => {
|
|
2978
|
+
let t, r = new Promise((e) => {
|
|
2979
|
+
n.subscribe(e), t = e;
|
|
2980
|
+
}).then(e);
|
|
2981
|
+
return r.cancel = function() {
|
|
2982
|
+
n.unsubscribe(t);
|
|
2983
|
+
}, r;
|
|
2984
|
+
}, e(function(e, r, i) {
|
|
2985
|
+
n.reason || (n.reason = new CanceledError(e, r, i), t(n.reason));
|
|
2986
|
+
});
|
|
2987
|
+
}
|
|
2988
|
+
throwIfRequested() {
|
|
2989
|
+
if (this.reason) throw this.reason;
|
|
2990
|
+
}
|
|
2991
|
+
subscribe(e) {
|
|
2992
|
+
if (this.reason) {
|
|
2993
|
+
e(this.reason);
|
|
2994
|
+
return;
|
|
2995
|
+
}
|
|
2996
|
+
this._listeners ? this._listeners.push(e) : this._listeners = [e];
|
|
2997
|
+
}
|
|
2998
|
+
unsubscribe(e) {
|
|
2999
|
+
if (!this._listeners) return;
|
|
3000
|
+
let t = this._listeners.indexOf(e);
|
|
3001
|
+
t !== -1 && this._listeners.splice(t, 1);
|
|
3002
|
+
}
|
|
3003
|
+
toAbortSignal() {
|
|
3004
|
+
let e = new AbortController(), t = (t) => {
|
|
3005
|
+
e.abort(t);
|
|
3006
|
+
};
|
|
3007
|
+
return this.subscribe(t), e.signal.unsubscribe = () => this.unsubscribe(t), e.signal;
|
|
3008
|
+
}
|
|
3009
|
+
static source() {
|
|
3010
|
+
let t;
|
|
3011
|
+
return {
|
|
3012
|
+
token: new e(function(e) {
|
|
3013
|
+
t = e;
|
|
3014
|
+
}),
|
|
3015
|
+
cancel: t
|
|
3016
|
+
};
|
|
3017
|
+
}
|
|
3018
|
+
};
|
|
3019
|
+
function spread(e) {
|
|
3020
|
+
return function(t) {
|
|
3021
|
+
return e.apply(null, t);
|
|
3022
|
+
};
|
|
3023
|
+
}
|
|
3024
|
+
function isAxiosError(e) {
|
|
3025
|
+
return utils_default.isObject(e) && e.isAxiosError === !0;
|
|
3026
|
+
}
|
|
3027
|
+
var HttpStatusCode = {
|
|
3028
|
+
Continue: 100,
|
|
3029
|
+
SwitchingProtocols: 101,
|
|
3030
|
+
Processing: 102,
|
|
3031
|
+
EarlyHints: 103,
|
|
3032
|
+
Ok: 200,
|
|
3033
|
+
Created: 201,
|
|
3034
|
+
Accepted: 202,
|
|
3035
|
+
NonAuthoritativeInformation: 203,
|
|
3036
|
+
NoContent: 204,
|
|
3037
|
+
ResetContent: 205,
|
|
3038
|
+
PartialContent: 206,
|
|
3039
|
+
MultiStatus: 207,
|
|
3040
|
+
AlreadyReported: 208,
|
|
3041
|
+
ImUsed: 226,
|
|
3042
|
+
MultipleChoices: 300,
|
|
3043
|
+
MovedPermanently: 301,
|
|
3044
|
+
Found: 302,
|
|
3045
|
+
SeeOther: 303,
|
|
3046
|
+
NotModified: 304,
|
|
3047
|
+
UseProxy: 305,
|
|
3048
|
+
Unused: 306,
|
|
3049
|
+
TemporaryRedirect: 307,
|
|
3050
|
+
PermanentRedirect: 308,
|
|
3051
|
+
BadRequest: 400,
|
|
3052
|
+
Unauthorized: 401,
|
|
3053
|
+
PaymentRequired: 402,
|
|
3054
|
+
Forbidden: 403,
|
|
3055
|
+
NotFound: 404,
|
|
3056
|
+
MethodNotAllowed: 405,
|
|
3057
|
+
NotAcceptable: 406,
|
|
3058
|
+
ProxyAuthenticationRequired: 407,
|
|
3059
|
+
RequestTimeout: 408,
|
|
3060
|
+
Conflict: 409,
|
|
3061
|
+
Gone: 410,
|
|
3062
|
+
LengthRequired: 411,
|
|
3063
|
+
PreconditionFailed: 412,
|
|
3064
|
+
PayloadTooLarge: 413,
|
|
3065
|
+
UriTooLong: 414,
|
|
3066
|
+
UnsupportedMediaType: 415,
|
|
3067
|
+
RangeNotSatisfiable: 416,
|
|
3068
|
+
ExpectationFailed: 417,
|
|
3069
|
+
ImATeapot: 418,
|
|
3070
|
+
MisdirectedRequest: 421,
|
|
3071
|
+
UnprocessableEntity: 422,
|
|
3072
|
+
Locked: 423,
|
|
3073
|
+
FailedDependency: 424,
|
|
3074
|
+
TooEarly: 425,
|
|
3075
|
+
UpgradeRequired: 426,
|
|
3076
|
+
PreconditionRequired: 428,
|
|
3077
|
+
TooManyRequests: 429,
|
|
3078
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
3079
|
+
UnavailableForLegalReasons: 451,
|
|
3080
|
+
InternalServerError: 500,
|
|
3081
|
+
NotImplemented: 501,
|
|
3082
|
+
BadGateway: 502,
|
|
3083
|
+
ServiceUnavailable: 503,
|
|
3084
|
+
GatewayTimeout: 504,
|
|
3085
|
+
HttpVersionNotSupported: 505,
|
|
3086
|
+
VariantAlsoNegotiates: 506,
|
|
3087
|
+
InsufficientStorage: 507,
|
|
3088
|
+
LoopDetected: 508,
|
|
3089
|
+
NotExtended: 510,
|
|
3090
|
+
NetworkAuthenticationRequired: 511,
|
|
3091
|
+
WebServerIsDown: 521,
|
|
3092
|
+
ConnectionTimedOut: 522,
|
|
3093
|
+
OriginIsUnreachable: 523,
|
|
3094
|
+
TimeoutOccurred: 524,
|
|
3095
|
+
SslHandshakeFailed: 525,
|
|
3096
|
+
InvalidSslCertificate: 526
|
|
3097
|
+
};
|
|
3098
|
+
Object.entries(HttpStatusCode).forEach(([e, t]) => {
|
|
3099
|
+
HttpStatusCode[t] = e;
|
|
3100
|
+
});
|
|
3101
|
+
function createInstance(e) {
|
|
3102
|
+
let t = new Axios(e), n = bind(Axios.prototype.request, t);
|
|
3103
|
+
return utils_default.extend(n, Axios.prototype, t, { allOwnKeys: !0 }), utils_default.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(t) {
|
|
3104
|
+
return createInstance(mergeConfig(e, t));
|
|
3105
|
+
}, n;
|
|
3106
|
+
}
|
|
3107
|
+
var axios = createInstance(defaults);
|
|
3108
|
+
axios.Axios = Axios, axios.CanceledError = CanceledError, axios.CancelToken = CancelToken, axios.isCancel = isCancel, axios.VERSION = VERSION, axios.toFormData = toFormData, axios.AxiosError = AxiosError, axios.Cancel = axios.CanceledError, axios.all = function(e) {
|
|
3109
|
+
return Promise.all(e);
|
|
3110
|
+
}, axios.spread = spread, axios.isAxiosError = isAxiosError, axios.mergeConfig = mergeConfig, axios.AxiosHeaders = AxiosHeaders, axios.formToJSON = (e) => formDataToJSON(utils_default.isHTMLForm(e) ? new FormData(e) : e), axios.getAdapter = adapters_default.getAdapter, axios.HttpStatusCode = HttpStatusCode, axios.default = axios;
|
|
3111
|
+
const chatWidgetService = new class {
|
|
3112
|
+
baseUrl = "http://localhost:9999";
|
|
3113
|
+
async sendMessage(e) {
|
|
3114
|
+
return (await axios.post(`${this.baseUrl}/chat-module/send-message`, { message: e })).data;
|
|
3115
|
+
}
|
|
3116
|
+
}();
|
|
3117
|
+
function useSendMessage() {
|
|
3118
|
+
return useMutation({ mutationFn: (e) => chatWidgetService.sendMessage(e) });
|
|
3119
|
+
}
|
|
3120
|
+
var byteToHex = [];
|
|
3121
|
+
for (let e = 0; e < 256; ++e) byteToHex.push((e + 256).toString(16).slice(1));
|
|
3122
|
+
function unsafeStringify(e, t = 0) {
|
|
3123
|
+
return (byteToHex[e[t + 0]] + byteToHex[e[t + 1]] + byteToHex[e[t + 2]] + byteToHex[e[t + 3]] + "-" + byteToHex[e[t + 4]] + byteToHex[e[t + 5]] + "-" + byteToHex[e[t + 6]] + byteToHex[e[t + 7]] + "-" + byteToHex[e[t + 8]] + byteToHex[e[t + 9]] + "-" + byteToHex[e[t + 10]] + byteToHex[e[t + 11]] + byteToHex[e[t + 12]] + byteToHex[e[t + 13]] + byteToHex[e[t + 14]] + byteToHex[e[t + 15]]).toLowerCase();
|
|
3124
|
+
}
|
|
3125
|
+
var getRandomValues, rnds8 = new Uint8Array(16);
|
|
3126
|
+
function rng() {
|
|
3127
|
+
if (!getRandomValues) {
|
|
3128
|
+
if (typeof crypto > "u" || !crypto.getRandomValues) throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
3129
|
+
getRandomValues = crypto.getRandomValues.bind(crypto);
|
|
3130
|
+
}
|
|
3131
|
+
return getRandomValues(rnds8);
|
|
3132
|
+
}
|
|
3133
|
+
var _state = {};
|
|
3134
|
+
function v7(e, t, n) {
|
|
3135
|
+
let r;
|
|
3136
|
+
if (e) r = v7Bytes(e.random ?? e.rng?.() ?? rng(), e.msecs, e.seq, t, n);
|
|
3137
|
+
else {
|
|
3138
|
+
let e = Date.now(), i = rng();
|
|
3139
|
+
updateV7State(_state, e, i), r = v7Bytes(i, _state.msecs, _state.seq, t, n);
|
|
3140
|
+
}
|
|
3141
|
+
return t ?? unsafeStringify(r);
|
|
3142
|
+
}
|
|
3143
|
+
function updateV7State(e, t, n) {
|
|
3144
|
+
return e.msecs ??= -Infinity, e.seq ??= 0, t > e.msecs ? (e.seq = n[6] << 23 | n[7] << 16 | n[8] << 8 | n[9], e.msecs = t) : (e.seq = e.seq + 1 | 0, e.seq === 0 && e.msecs++), e;
|
|
3145
|
+
}
|
|
3146
|
+
function v7Bytes(e, t, n, r, i = 0) {
|
|
3147
|
+
if (e.length < 16) throw Error("Random bytes length must be >= 16");
|
|
3148
|
+
if (!r) r = new Uint8Array(16), i = 0;
|
|
3149
|
+
else if (i < 0 || i + 16 > r.length) throw RangeError(`UUID byte range ${i}:${i + 15} is out of buffer bounds`);
|
|
3150
|
+
return t ??= Date.now(), n ??= e[6] * 127 << 24 | e[7] << 16 | e[8] << 8 | e[9], r[i++] = t / 1099511627776 & 255, r[i++] = t / 4294967296 & 255, r[i++] = t / 16777216 & 255, r[i++] = t / 65536 & 255, r[i++] = t / 256 & 255, r[i++] = t & 255, r[i++] = 112 | n >>> 28 & 15, r[i++] = n >>> 20 & 255, r[i++] = 128 | n >>> 14 & 63, r[i++] = n >>> 6 & 255, r[i++] = n << 2 & 255 | e[10] & 3, r[i++] = e[11], r[i++] = e[12], r[i++] = e[13], r[i++] = e[14], r[i++] = e[15], r;
|
|
3151
|
+
}
|
|
3152
|
+
function ChatWidget({ className: e, style: n }) {
|
|
3153
|
+
let [r, i] = useState([{
|
|
3154
|
+
id: "1",
|
|
3155
|
+
role: "assistant",
|
|
3156
|
+
content: "Hi there! I'm ChatWillow. How can I help you today?",
|
|
3157
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
3158
|
+
}]), { mutate: a, isPending: o } = useSendMessage();
|
|
3159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChatWidgetUI, {
|
|
3160
|
+
messages: r,
|
|
3161
|
+
onSendMessage: (e) => {
|
|
3162
|
+
let t = {
|
|
3163
|
+
id: v7(),
|
|
3164
|
+
role: "user",
|
|
3165
|
+
content: e,
|
|
3166
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
3167
|
+
};
|
|
3168
|
+
i((e) => [...e, t]), a(e, {
|
|
3169
|
+
onSuccess: (e) => {
|
|
3170
|
+
let t = typeof e.data == "string" ? e.data : e.message || "Error parsing response", n = {
|
|
3171
|
+
id: v7(),
|
|
3172
|
+
role: "assistant",
|
|
3173
|
+
content: t,
|
|
3174
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
3175
|
+
};
|
|
3176
|
+
i((e) => [...e, n]);
|
|
3177
|
+
},
|
|
3178
|
+
onError: (e) => {
|
|
3179
|
+
let t = {
|
|
3180
|
+
id: v7(),
|
|
3181
|
+
role: "assistant",
|
|
3182
|
+
content: "Sorry, something went wrong. Please try again.",
|
|
3183
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
3184
|
+
};
|
|
3185
|
+
i((e) => [...e, t]), console.error("Failed to send message:", e);
|
|
3186
|
+
}
|
|
3187
|
+
});
|
|
3188
|
+
},
|
|
3189
|
+
isSending: o,
|
|
3190
|
+
className: e,
|
|
3191
|
+
style: n
|
|
3192
|
+
});
|
|
3193
|
+
}
|
|
3194
|
+
var queryClient = new QueryClient({ defaultOptions: { queries: {
|
|
3195
|
+
retry: 1,
|
|
3196
|
+
refetchOnWindowFocus: !1
|
|
3197
|
+
} } });
|
|
3198
|
+
function App(e) {
|
|
3199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryClientProvider, {
|
|
3200
|
+
client: queryClient,
|
|
3201
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChatWidget, { ...e })
|
|
3202
|
+
});
|
|
3203
|
+
}
|
|
3204
|
+
export { App as ChatWillowWidget };
|