master-data-management-react 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/LICENSE +21 -0
- package/README.md +127 -0
- package/dist/App.d.ts +6 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/components/Pagination/Pagination.d.ts +9 -0
- package/dist/components/Pagination/Pagination.d.ts.map +1 -0
- package/dist/components/Pagination/index.d.ts +2 -0
- package/dist/components/Pagination/index.d.ts.map +1 -0
- package/dist/components/ServerSideGrid/ServerSideGrid.d.ts +33 -0
- package/dist/components/ServerSideGrid/ServerSideGrid.d.ts.map +1 -0
- package/dist/components/ServerSideGrid/index.d.ts +3 -0
- package/dist/components/ServerSideGrid/index.d.ts.map +1 -0
- package/dist/components/ServerSideGrid/styles.d.ts +13 -0
- package/dist/components/ServerSideGrid/styles.d.ts.map +1 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/constants/api.constants.d.ts +59 -0
- package/dist/constants/api.constants.d.ts.map +1 -0
- package/dist/constants/form.constants.d.ts +73 -0
- package/dist/constants/form.constants.d.ts.map +1 -0
- package/dist/constants/grid.constants.d.ts +56 -0
- package/dist/constants/grid.constants.d.ts.map +1 -0
- package/dist/constants/index.d.ts +10 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/routes.constants.d.ts +32 -0
- package/dist/constants/routes.constants.d.ts.map +1 -0
- package/dist/constants/ui.constants.d.ts +111 -0
- package/dist/constants/ui.constants.d.ts.map +1 -0
- package/dist/contexts/MasterDataContext.d.ts +51 -0
- package/dist/contexts/MasterDataContext.d.ts.map +1 -0
- package/dist/hooks/useApiService.d.ts +8 -0
- package/dist/hooks/useApiService.d.ts.map +1 -0
- package/dist/index.cjs +11 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3195 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/master-data-management-react.css +1 -0
- package/dist/pages/MasterForm/MasterForm.d.ts +4 -0
- package/dist/pages/MasterForm/MasterForm.d.ts.map +1 -0
- package/dist/pages/MasterView/MasterView.d.ts +4 -0
- package/dist/pages/MasterView/MasterView.d.ts.map +1 -0
- package/dist/pages/index.d.ts +3 -0
- package/dist/pages/index.d.ts.map +1 -0
- package/dist/routes/AppRoutes.d.ts +3 -0
- package/dist/routes/AppRoutes.d.ts.map +1 -0
- package/package.json +65 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3195 @@
|
|
|
1
|
+
import mn, { createContext as hn, useContext as Tn, useRef as Ze, useState as H, useEffect as be, useMemo as Oe, useCallback as ye } from "react";
|
|
2
|
+
import { useNavigate as Ut, useParams as Rn, Routes as Sn, Route as Te, Navigate as An } from "react-router-dom";
|
|
3
|
+
import { styled as ie, Box as M, Select as yn, FormControl as gn, CircularProgress as Pe, Divider as bn, Button as re, Typography as pe, Paper as kt, Autocomplete as et, TextField as Z, Menu as On, MenuItem as We, Alert as _n } from "@mui/material";
|
|
4
|
+
import { AgGridReact as wn } from "ag-grid-react";
|
|
5
|
+
import { ModuleRegistry as xn, ClientSideRowModelModule as Bt, AllCommunityModule as Cn } from "ag-grid-community";
|
|
6
|
+
var Ie = { exports: {} }, Re = {};
|
|
7
|
+
var ct;
|
|
8
|
+
function Nn() {
|
|
9
|
+
if (ct) return Re;
|
|
10
|
+
ct = 1;
|
|
11
|
+
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
12
|
+
function n(r, s, o) {
|
|
13
|
+
var a = null;
|
|
14
|
+
if (o !== void 0 && (a = "" + o), s.key !== void 0 && (a = "" + s.key), "key" in s) {
|
|
15
|
+
o = {};
|
|
16
|
+
for (var l in s)
|
|
17
|
+
l !== "key" && (o[l] = s[l]);
|
|
18
|
+
} else o = s;
|
|
19
|
+
return s = o.ref, {
|
|
20
|
+
$$typeof: e,
|
|
21
|
+
type: r,
|
|
22
|
+
key: a,
|
|
23
|
+
ref: s !== void 0 ? s : null,
|
|
24
|
+
props: o
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return Re.Fragment = t, Re.jsx = n, Re.jsxs = n, Re;
|
|
28
|
+
}
|
|
29
|
+
var Se = {};
|
|
30
|
+
var ut;
|
|
31
|
+
function In() {
|
|
32
|
+
return ut || (ut = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
33
|
+
function e(c) {
|
|
34
|
+
if (c == null) return null;
|
|
35
|
+
if (typeof c == "function")
|
|
36
|
+
return c.$$typeof === N ? null : c.displayName || c.name || null;
|
|
37
|
+
if (typeof c == "string") return c;
|
|
38
|
+
switch (c) {
|
|
39
|
+
case h:
|
|
40
|
+
return "Fragment";
|
|
41
|
+
case j:
|
|
42
|
+
return "Profiler";
|
|
43
|
+
case w:
|
|
44
|
+
return "StrictMode";
|
|
45
|
+
case V:
|
|
46
|
+
return "Suspense";
|
|
47
|
+
case U:
|
|
48
|
+
return "SuspenseList";
|
|
49
|
+
case g:
|
|
50
|
+
return "Activity";
|
|
51
|
+
}
|
|
52
|
+
if (typeof c == "object")
|
|
53
|
+
switch (typeof c.tag == "number" && console.error(
|
|
54
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
55
|
+
), c.$$typeof) {
|
|
56
|
+
case S:
|
|
57
|
+
return "Portal";
|
|
58
|
+
case D:
|
|
59
|
+
return c.displayName || "Context";
|
|
60
|
+
case I:
|
|
61
|
+
return (c._context.displayName || "Context") + ".Consumer";
|
|
62
|
+
case F:
|
|
63
|
+
var A = c.render;
|
|
64
|
+
return c = c.displayName, c || (c = A.displayName || A.name || "", c = c !== "" ? "ForwardRef(" + c + ")" : "ForwardRef"), c;
|
|
65
|
+
case b:
|
|
66
|
+
return A = c.displayName || null, A !== null ? A : e(c.type) || "Memo";
|
|
67
|
+
case y:
|
|
68
|
+
A = c._payload, c = c._init;
|
|
69
|
+
try {
|
|
70
|
+
return e(c(A));
|
|
71
|
+
} catch {
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
function t(c) {
|
|
77
|
+
return "" + c;
|
|
78
|
+
}
|
|
79
|
+
function n(c) {
|
|
80
|
+
try {
|
|
81
|
+
t(c);
|
|
82
|
+
var A = !1;
|
|
83
|
+
} catch {
|
|
84
|
+
A = !0;
|
|
85
|
+
}
|
|
86
|
+
if (A) {
|
|
87
|
+
A = console;
|
|
88
|
+
var p = A.error, R = typeof Symbol == "function" && Symbol.toStringTag && c[Symbol.toStringTag] || c.constructor.name || "Object";
|
|
89
|
+
return p.call(
|
|
90
|
+
A,
|
|
91
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
92
|
+
R
|
|
93
|
+
), t(c);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function r(c) {
|
|
97
|
+
if (c === h) return "<>";
|
|
98
|
+
if (typeof c == "object" && c !== null && c.$$typeof === y)
|
|
99
|
+
return "<...>";
|
|
100
|
+
try {
|
|
101
|
+
var A = e(c);
|
|
102
|
+
return A ? "<" + A + ">" : "<...>";
|
|
103
|
+
} catch {
|
|
104
|
+
return "<...>";
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function s() {
|
|
108
|
+
var c = B.A;
|
|
109
|
+
return c === null ? null : c.getOwner();
|
|
110
|
+
}
|
|
111
|
+
function o() {
|
|
112
|
+
return Error("react-stack-top-frame");
|
|
113
|
+
}
|
|
114
|
+
function a(c) {
|
|
115
|
+
if (L.call(c, "key")) {
|
|
116
|
+
var A = Object.getOwnPropertyDescriptor(c, "key").get;
|
|
117
|
+
if (A && A.isReactWarning) return !1;
|
|
118
|
+
}
|
|
119
|
+
return c.key !== void 0;
|
|
120
|
+
}
|
|
121
|
+
function l(c, A) {
|
|
122
|
+
function p() {
|
|
123
|
+
G || (G = !0, console.error(
|
|
124
|
+
"%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)",
|
|
125
|
+
A
|
|
126
|
+
));
|
|
127
|
+
}
|
|
128
|
+
p.isReactWarning = !0, Object.defineProperty(c, "key", {
|
|
129
|
+
get: p,
|
|
130
|
+
configurable: !0
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function m() {
|
|
134
|
+
var c = e(this.type);
|
|
135
|
+
return ne[c] || (ne[c] = !0, console.error(
|
|
136
|
+
"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."
|
|
137
|
+
)), c = this.props.ref, c !== void 0 ? c : null;
|
|
138
|
+
}
|
|
139
|
+
function d(c, A, p, R, C, $) {
|
|
140
|
+
var O = p.ref;
|
|
141
|
+
return c = {
|
|
142
|
+
$$typeof: f,
|
|
143
|
+
type: c,
|
|
144
|
+
key: A,
|
|
145
|
+
props: p,
|
|
146
|
+
_owner: R
|
|
147
|
+
}, (O !== void 0 ? O : null) !== null ? Object.defineProperty(c, "ref", {
|
|
148
|
+
enumerable: !1,
|
|
149
|
+
get: m
|
|
150
|
+
}) : Object.defineProperty(c, "ref", { enumerable: !1, value: null }), c._store = {}, Object.defineProperty(c._store, "validated", {
|
|
151
|
+
configurable: !1,
|
|
152
|
+
enumerable: !1,
|
|
153
|
+
writable: !0,
|
|
154
|
+
value: 0
|
|
155
|
+
}), Object.defineProperty(c, "_debugInfo", {
|
|
156
|
+
configurable: !1,
|
|
157
|
+
enumerable: !1,
|
|
158
|
+
writable: !0,
|
|
159
|
+
value: null
|
|
160
|
+
}), Object.defineProperty(c, "_debugStack", {
|
|
161
|
+
configurable: !1,
|
|
162
|
+
enumerable: !1,
|
|
163
|
+
writable: !0,
|
|
164
|
+
value: C
|
|
165
|
+
}), Object.defineProperty(c, "_debugTask", {
|
|
166
|
+
configurable: !1,
|
|
167
|
+
enumerable: !1,
|
|
168
|
+
writable: !0,
|
|
169
|
+
value: $
|
|
170
|
+
}), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c;
|
|
171
|
+
}
|
|
172
|
+
function u(c, A, p, R, C, $) {
|
|
173
|
+
var O = A.children;
|
|
174
|
+
if (O !== void 0)
|
|
175
|
+
if (R)
|
|
176
|
+
if (W(O)) {
|
|
177
|
+
for (R = 0; R < O.length; R++)
|
|
178
|
+
T(O[R]);
|
|
179
|
+
Object.freeze && Object.freeze(O);
|
|
180
|
+
} else
|
|
181
|
+
console.error(
|
|
182
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
183
|
+
);
|
|
184
|
+
else T(O);
|
|
185
|
+
if (L.call(A, "key")) {
|
|
186
|
+
O = e(c);
|
|
187
|
+
var v = Object.keys(A).filter(function(Ne) {
|
|
188
|
+
return Ne !== "key";
|
|
189
|
+
});
|
|
190
|
+
R = 0 < v.length ? "{key: someKey, " + v.join(": ..., ") + ": ...}" : "{key: someKey}", ce[O + R] || (v = 0 < v.length ? "{" + v.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
191
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
192
|
+
let props = %s;
|
|
193
|
+
<%s {...props} />
|
|
194
|
+
React keys must be passed directly to JSX without using spread:
|
|
195
|
+
let props = %s;
|
|
196
|
+
<%s key={someKey} {...props} />`,
|
|
197
|
+
R,
|
|
198
|
+
O,
|
|
199
|
+
v,
|
|
200
|
+
O
|
|
201
|
+
), ce[O + R] = !0);
|
|
202
|
+
}
|
|
203
|
+
if (O = null, p !== void 0 && (n(p), O = "" + p), a(A) && (n(A.key), O = "" + A.key), "key" in A) {
|
|
204
|
+
p = {};
|
|
205
|
+
for (var J in A)
|
|
206
|
+
J !== "key" && (p[J] = A[J]);
|
|
207
|
+
} else p = A;
|
|
208
|
+
return O && l(
|
|
209
|
+
p,
|
|
210
|
+
typeof c == "function" ? c.displayName || c.name || "Unknown" : c
|
|
211
|
+
), d(
|
|
212
|
+
c,
|
|
213
|
+
O,
|
|
214
|
+
p,
|
|
215
|
+
s(),
|
|
216
|
+
C,
|
|
217
|
+
$
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
function T(c) {
|
|
221
|
+
x(c) ? c._store && (c._store.validated = 1) : typeof c == "object" && c !== null && c.$$typeof === y && (c._payload.status === "fulfilled" ? x(c._payload.value) && c._payload.value._store && (c._payload.value._store.validated = 1) : c._store && (c._store.validated = 1));
|
|
222
|
+
}
|
|
223
|
+
function x(c) {
|
|
224
|
+
return typeof c == "object" && c !== null && c.$$typeof === f;
|
|
225
|
+
}
|
|
226
|
+
var P = mn, f = /* @__PURE__ */ Symbol.for("react.transitional.element"), S = /* @__PURE__ */ Symbol.for("react.portal"), h = /* @__PURE__ */ Symbol.for("react.fragment"), w = /* @__PURE__ */ Symbol.for("react.strict_mode"), j = /* @__PURE__ */ Symbol.for("react.profiler"), I = /* @__PURE__ */ Symbol.for("react.consumer"), D = /* @__PURE__ */ Symbol.for("react.context"), F = /* @__PURE__ */ Symbol.for("react.forward_ref"), V = /* @__PURE__ */ Symbol.for("react.suspense"), U = /* @__PURE__ */ Symbol.for("react.suspense_list"), b = /* @__PURE__ */ Symbol.for("react.memo"), y = /* @__PURE__ */ Symbol.for("react.lazy"), g = /* @__PURE__ */ Symbol.for("react.activity"), N = /* @__PURE__ */ Symbol.for("react.client.reference"), B = P.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, L = Object.prototype.hasOwnProperty, W = Array.isArray, Q = console.createTask ? console.createTask : function() {
|
|
227
|
+
return null;
|
|
228
|
+
};
|
|
229
|
+
P = {
|
|
230
|
+
react_stack_bottom_frame: function(c) {
|
|
231
|
+
return c();
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
var G, ne = {}, X = P.react_stack_bottom_frame.bind(
|
|
235
|
+
P,
|
|
236
|
+
o
|
|
237
|
+
)(), le = Q(r(o)), ce = {};
|
|
238
|
+
Se.Fragment = h, Se.jsx = function(c, A, p) {
|
|
239
|
+
var R = 1e4 > B.recentlyCreatedOwnerStacks++;
|
|
240
|
+
return u(
|
|
241
|
+
c,
|
|
242
|
+
A,
|
|
243
|
+
p,
|
|
244
|
+
!1,
|
|
245
|
+
R ? Error("react-stack-top-frame") : X,
|
|
246
|
+
R ? Q(r(c)) : le
|
|
247
|
+
);
|
|
248
|
+
}, Se.jsxs = function(c, A, p) {
|
|
249
|
+
var R = 1e4 > B.recentlyCreatedOwnerStacks++;
|
|
250
|
+
return u(
|
|
251
|
+
c,
|
|
252
|
+
A,
|
|
253
|
+
p,
|
|
254
|
+
!0,
|
|
255
|
+
R ? Error("react-stack-top-frame") : X,
|
|
256
|
+
R ? Q(r(c)) : le
|
|
257
|
+
);
|
|
258
|
+
};
|
|
259
|
+
})()), Se;
|
|
260
|
+
}
|
|
261
|
+
var dt;
|
|
262
|
+
function Dn() {
|
|
263
|
+
return dt || (dt = 1, process.env.NODE_ENV === "production" ? Ie.exports = Nn() : Ie.exports = In()), Ie.exports;
|
|
264
|
+
}
|
|
265
|
+
var E = Dn();
|
|
266
|
+
const Ln = {
|
|
267
|
+
entities: "/master/entities",
|
|
268
|
+
metadata: (e) => `/master/${e}/metadata`,
|
|
269
|
+
records: (e) => `/master/${e}/records`,
|
|
270
|
+
recordById: (e, t) => `/master/${e}/records/${t}`,
|
|
271
|
+
exportCSV: (e) => `/master/${e}/export/csv`,
|
|
272
|
+
exportExcel: (e) => `/master/${e}/export/excel`
|
|
273
|
+
}, Pn = {
|
|
274
|
+
basePath: "/master",
|
|
275
|
+
entityNew: (e) => `/master/${e}/new`,
|
|
276
|
+
entityView: (e, t) => `/master/${e}/${t}`,
|
|
277
|
+
entityEdit: (e, t) => `/master/${e}/${t}/edit`
|
|
278
|
+
}, $t = hn(null), Ds = ({
|
|
279
|
+
config: e = {},
|
|
280
|
+
children: t
|
|
281
|
+
}) => {
|
|
282
|
+
const n = {
|
|
283
|
+
apiClient: e.apiClient,
|
|
284
|
+
apiEndpoints: {
|
|
285
|
+
...Ln,
|
|
286
|
+
...e.apiEndpoints
|
|
287
|
+
},
|
|
288
|
+
routes: {
|
|
289
|
+
...Pn,
|
|
290
|
+
...e.routes
|
|
291
|
+
},
|
|
292
|
+
apiService: e.apiService
|
|
293
|
+
};
|
|
294
|
+
return /* @__PURE__ */ E.jsx($t.Provider, { value: n, children: t });
|
|
295
|
+
}, ke = () => {
|
|
296
|
+
const e = Tn($t);
|
|
297
|
+
if (!e)
|
|
298
|
+
throw new Error(
|
|
299
|
+
"useMasterDataConfig must be used within MasterDataProvider"
|
|
300
|
+
);
|
|
301
|
+
return e;
|
|
302
|
+
};
|
|
303
|
+
function Ht(e, t) {
|
|
304
|
+
return function() {
|
|
305
|
+
return e.apply(t, arguments);
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
const { toString: Fn } = Object.prototype, { getPrototypeOf: ot } = Object, { iterator: Be, toStringTag: Vt } = Symbol, $e = /* @__PURE__ */ ((e) => (t) => {
|
|
309
|
+
const n = Fn.call(t);
|
|
310
|
+
return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
|
|
311
|
+
})(/* @__PURE__ */ Object.create(null)), ee = (e) => (e = e.toLowerCase(), (t) => $e(t) === e), He = (e) => (t) => typeof t === e, { isArray: me } = Array, Ee = He("undefined");
|
|
312
|
+
function _e(e) {
|
|
313
|
+
return e !== null && !Ee(e) && e.constructor !== null && !Ee(e.constructor) && Y(e.constructor.isBuffer) && e.constructor.isBuffer(e);
|
|
314
|
+
}
|
|
315
|
+
const Gt = ee("ArrayBuffer");
|
|
316
|
+
function jn(e) {
|
|
317
|
+
let t;
|
|
318
|
+
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && Gt(e.buffer), t;
|
|
319
|
+
}
|
|
320
|
+
const vn = He("string"), Y = He("function"), Wt = He("number"), we = (e) => e !== null && typeof e == "object", Mn = (e) => e === !0 || e === !1, Fe = (e) => {
|
|
321
|
+
if ($e(e) !== "object")
|
|
322
|
+
return !1;
|
|
323
|
+
const t = ot(e);
|
|
324
|
+
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Vt in e) && !(Be in e);
|
|
325
|
+
}, Un = (e) => {
|
|
326
|
+
if (!we(e) || _e(e))
|
|
327
|
+
return !1;
|
|
328
|
+
try {
|
|
329
|
+
return Object.keys(e).length === 0 && Object.getPrototypeOf(e) === Object.prototype;
|
|
330
|
+
} catch {
|
|
331
|
+
return !1;
|
|
332
|
+
}
|
|
333
|
+
}, kn = ee("Date"), Bn = ee("File"), $n = ee("Blob"), Hn = ee("FileList"), Vn = (e) => we(e) && Y(e.pipe), Gn = (e) => {
|
|
334
|
+
let t;
|
|
335
|
+
return e && (typeof FormData == "function" && e instanceof FormData || Y(e.append) && ((t = $e(e)) === "formdata" || // detect form-data instance
|
|
336
|
+
t === "object" && Y(e.toString) && e.toString() === "[object FormData]"));
|
|
337
|
+
}, Wn = ee("URLSearchParams"), [qn, Yn, zn, Xn] = ["ReadableStream", "Request", "Response", "Headers"].map(ee), Jn = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
338
|
+
function xe(e, t, { allOwnKeys: n = !1 } = {}) {
|
|
339
|
+
if (e === null || typeof e > "u")
|
|
340
|
+
return;
|
|
341
|
+
let r, s;
|
|
342
|
+
if (typeof e != "object" && (e = [e]), me(e))
|
|
343
|
+
for (r = 0, s = e.length; r < s; r++)
|
|
344
|
+
t.call(null, e[r], r, e);
|
|
345
|
+
else {
|
|
346
|
+
if (_e(e))
|
|
347
|
+
return;
|
|
348
|
+
const o = n ? Object.getOwnPropertyNames(e) : Object.keys(e), a = o.length;
|
|
349
|
+
let l;
|
|
350
|
+
for (r = 0; r < a; r++)
|
|
351
|
+
l = o[r], t.call(null, e[l], l, e);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
function qt(e, t) {
|
|
355
|
+
if (_e(e))
|
|
356
|
+
return null;
|
|
357
|
+
t = t.toLowerCase();
|
|
358
|
+
const n = Object.keys(e);
|
|
359
|
+
let r = n.length, s;
|
|
360
|
+
for (; r-- > 0; )
|
|
361
|
+
if (s = n[r], t === s.toLowerCase())
|
|
362
|
+
return s;
|
|
363
|
+
return null;
|
|
364
|
+
}
|
|
365
|
+
const ue = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Yt = (e) => !Ee(e) && e !== ue;
|
|
366
|
+
function tt() {
|
|
367
|
+
const { caseless: e, skipUndefined: t } = Yt(this) && this || {}, n = {}, r = (s, o) => {
|
|
368
|
+
const a = e && qt(n, o) || o;
|
|
369
|
+
Fe(n[a]) && Fe(s) ? n[a] = tt(n[a], s) : Fe(s) ? n[a] = tt({}, s) : me(s) ? n[a] = s.slice() : (!t || !Ee(s)) && (n[a] = s);
|
|
370
|
+
};
|
|
371
|
+
for (let s = 0, o = arguments.length; s < o; s++)
|
|
372
|
+
arguments[s] && xe(arguments[s], r);
|
|
373
|
+
return n;
|
|
374
|
+
}
|
|
375
|
+
const Kn = (e, t, n, { allOwnKeys: r } = {}) => (xe(t, (s, o) => {
|
|
376
|
+
n && Y(s) ? e[o] = Ht(s, n) : e[o] = s;
|
|
377
|
+
}, { allOwnKeys: r }), e), Qn = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), Zn = (e, t, n, r) => {
|
|
378
|
+
e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
|
|
379
|
+
value: t.prototype
|
|
380
|
+
}), n && Object.assign(e.prototype, n);
|
|
381
|
+
}, er = (e, t, n, r) => {
|
|
382
|
+
let s, o, a;
|
|
383
|
+
const l = {};
|
|
384
|
+
if (t = t || {}, e == null) return t;
|
|
385
|
+
do {
|
|
386
|
+
for (s = Object.getOwnPropertyNames(e), o = s.length; o-- > 0; )
|
|
387
|
+
a = s[o], (!r || r(a, e, t)) && !l[a] && (t[a] = e[a], l[a] = !0);
|
|
388
|
+
e = n !== !1 && ot(e);
|
|
389
|
+
} while (e && (!n || n(e, t)) && e !== Object.prototype);
|
|
390
|
+
return t;
|
|
391
|
+
}, tr = (e, t, n) => {
|
|
392
|
+
e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
|
|
393
|
+
const r = e.indexOf(t, n);
|
|
394
|
+
return r !== -1 && r === n;
|
|
395
|
+
}, nr = (e) => {
|
|
396
|
+
if (!e) return null;
|
|
397
|
+
if (me(e)) return e;
|
|
398
|
+
let t = e.length;
|
|
399
|
+
if (!Wt(t)) return null;
|
|
400
|
+
const n = new Array(t);
|
|
401
|
+
for (; t-- > 0; )
|
|
402
|
+
n[t] = e[t];
|
|
403
|
+
return n;
|
|
404
|
+
}, rr = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && ot(Uint8Array)), sr = (e, t) => {
|
|
405
|
+
const r = (e && e[Be]).call(e);
|
|
406
|
+
let s;
|
|
407
|
+
for (; (s = r.next()) && !s.done; ) {
|
|
408
|
+
const o = s.value;
|
|
409
|
+
t.call(e, o[0], o[1]);
|
|
410
|
+
}
|
|
411
|
+
}, or = (e, t) => {
|
|
412
|
+
let n;
|
|
413
|
+
const r = [];
|
|
414
|
+
for (; (n = e.exec(t)) !== null; )
|
|
415
|
+
r.push(n);
|
|
416
|
+
return r;
|
|
417
|
+
}, ar = ee("HTMLFormElement"), ir = (e) => e.toLowerCase().replace(
|
|
418
|
+
/[-_\s]([a-z\d])(\w*)/g,
|
|
419
|
+
function(n, r, s) {
|
|
420
|
+
return r.toUpperCase() + s;
|
|
421
|
+
}
|
|
422
|
+
), ft = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), lr = ee("RegExp"), zt = (e, t) => {
|
|
423
|
+
const n = Object.getOwnPropertyDescriptors(e), r = {};
|
|
424
|
+
xe(n, (s, o) => {
|
|
425
|
+
let a;
|
|
426
|
+
(a = t(s, o, e)) !== !1 && (r[o] = a || s);
|
|
427
|
+
}), Object.defineProperties(e, r);
|
|
428
|
+
}, cr = (e) => {
|
|
429
|
+
zt(e, (t, n) => {
|
|
430
|
+
if (Y(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
|
|
431
|
+
return !1;
|
|
432
|
+
const r = e[n];
|
|
433
|
+
if (Y(r)) {
|
|
434
|
+
if (t.enumerable = !1, "writable" in t) {
|
|
435
|
+
t.writable = !1;
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
t.set || (t.set = () => {
|
|
439
|
+
throw Error("Can not rewrite read-only method '" + n + "'");
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
}, ur = (e, t) => {
|
|
444
|
+
const n = {}, r = (s) => {
|
|
445
|
+
s.forEach((o) => {
|
|
446
|
+
n[o] = !0;
|
|
447
|
+
});
|
|
448
|
+
};
|
|
449
|
+
return me(e) ? r(e) : r(String(e).split(t)), n;
|
|
450
|
+
}, dr = () => {
|
|
451
|
+
}, fr = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
|
|
452
|
+
function pr(e) {
|
|
453
|
+
return !!(e && Y(e.append) && e[Vt] === "FormData" && e[Be]);
|
|
454
|
+
}
|
|
455
|
+
const Er = (e) => {
|
|
456
|
+
const t = new Array(10), n = (r, s) => {
|
|
457
|
+
if (we(r)) {
|
|
458
|
+
if (t.indexOf(r) >= 0)
|
|
459
|
+
return;
|
|
460
|
+
if (_e(r))
|
|
461
|
+
return r;
|
|
462
|
+
if (!("toJSON" in r)) {
|
|
463
|
+
t[s] = r;
|
|
464
|
+
const o = me(r) ? [] : {};
|
|
465
|
+
return xe(r, (a, l) => {
|
|
466
|
+
const m = n(a, s + 1);
|
|
467
|
+
!Ee(m) && (o[l] = m);
|
|
468
|
+
}), t[s] = void 0, o;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
return r;
|
|
472
|
+
};
|
|
473
|
+
return n(e, 0);
|
|
474
|
+
}, mr = ee("AsyncFunction"), hr = (e) => e && (we(e) || Y(e)) && Y(e.then) && Y(e.catch), Xt = ((e, t) => e ? setImmediate : t ? ((n, r) => (ue.addEventListener("message", ({ source: s, data: o }) => {
|
|
475
|
+
s === ue && o === n && r.length && r.shift()();
|
|
476
|
+
}, !1), (s) => {
|
|
477
|
+
r.push(s), ue.postMessage(n, "*");
|
|
478
|
+
}))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
|
|
479
|
+
typeof setImmediate == "function",
|
|
480
|
+
Y(ue.postMessage)
|
|
481
|
+
), Tr = typeof queueMicrotask < "u" ? queueMicrotask.bind(ue) : typeof process < "u" && process.nextTick || Xt, Rr = (e) => e != null && Y(e[Be]), i = {
|
|
482
|
+
isArray: me,
|
|
483
|
+
isArrayBuffer: Gt,
|
|
484
|
+
isBuffer: _e,
|
|
485
|
+
isFormData: Gn,
|
|
486
|
+
isArrayBufferView: jn,
|
|
487
|
+
isString: vn,
|
|
488
|
+
isNumber: Wt,
|
|
489
|
+
isBoolean: Mn,
|
|
490
|
+
isObject: we,
|
|
491
|
+
isPlainObject: Fe,
|
|
492
|
+
isEmptyObject: Un,
|
|
493
|
+
isReadableStream: qn,
|
|
494
|
+
isRequest: Yn,
|
|
495
|
+
isResponse: zn,
|
|
496
|
+
isHeaders: Xn,
|
|
497
|
+
isUndefined: Ee,
|
|
498
|
+
isDate: kn,
|
|
499
|
+
isFile: Bn,
|
|
500
|
+
isBlob: $n,
|
|
501
|
+
isRegExp: lr,
|
|
502
|
+
isFunction: Y,
|
|
503
|
+
isStream: Vn,
|
|
504
|
+
isURLSearchParams: Wn,
|
|
505
|
+
isTypedArray: rr,
|
|
506
|
+
isFileList: Hn,
|
|
507
|
+
forEach: xe,
|
|
508
|
+
merge: tt,
|
|
509
|
+
extend: Kn,
|
|
510
|
+
trim: Jn,
|
|
511
|
+
stripBOM: Qn,
|
|
512
|
+
inherits: Zn,
|
|
513
|
+
toFlatObject: er,
|
|
514
|
+
kindOf: $e,
|
|
515
|
+
kindOfTest: ee,
|
|
516
|
+
endsWith: tr,
|
|
517
|
+
toArray: nr,
|
|
518
|
+
forEachEntry: sr,
|
|
519
|
+
matchAll: or,
|
|
520
|
+
isHTMLForm: ar,
|
|
521
|
+
hasOwnProperty: ft,
|
|
522
|
+
hasOwnProp: ft,
|
|
523
|
+
// an alias to avoid ESLint no-prototype-builtins detection
|
|
524
|
+
reduceDescriptors: zt,
|
|
525
|
+
freezeMethods: cr,
|
|
526
|
+
toObjectSet: ur,
|
|
527
|
+
toCamelCase: ir,
|
|
528
|
+
noop: dr,
|
|
529
|
+
toFiniteNumber: fr,
|
|
530
|
+
findKey: qt,
|
|
531
|
+
global: ue,
|
|
532
|
+
isContextDefined: Yt,
|
|
533
|
+
isSpecCompliantForm: pr,
|
|
534
|
+
toJSONObject: Er,
|
|
535
|
+
isAsyncFn: mr,
|
|
536
|
+
isThenable: hr,
|
|
537
|
+
setImmediate: Xt,
|
|
538
|
+
asap: Tr,
|
|
539
|
+
isIterable: Rr
|
|
540
|
+
};
|
|
541
|
+
function _(e, t, n, r, s) {
|
|
542
|
+
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), s && (this.response = s, this.status = s.status ? s.status : null);
|
|
543
|
+
}
|
|
544
|
+
i.inherits(_, Error, {
|
|
545
|
+
toJSON: function() {
|
|
546
|
+
return {
|
|
547
|
+
// Standard
|
|
548
|
+
message: this.message,
|
|
549
|
+
name: this.name,
|
|
550
|
+
// Microsoft
|
|
551
|
+
description: this.description,
|
|
552
|
+
number: this.number,
|
|
553
|
+
// Mozilla
|
|
554
|
+
fileName: this.fileName,
|
|
555
|
+
lineNumber: this.lineNumber,
|
|
556
|
+
columnNumber: this.columnNumber,
|
|
557
|
+
stack: this.stack,
|
|
558
|
+
// Axios
|
|
559
|
+
config: i.toJSONObject(this.config),
|
|
560
|
+
code: this.code,
|
|
561
|
+
status: this.status
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
const Jt = _.prototype, Kt = {};
|
|
566
|
+
[
|
|
567
|
+
"ERR_BAD_OPTION_VALUE",
|
|
568
|
+
"ERR_BAD_OPTION",
|
|
569
|
+
"ECONNABORTED",
|
|
570
|
+
"ETIMEDOUT",
|
|
571
|
+
"ERR_NETWORK",
|
|
572
|
+
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
573
|
+
"ERR_DEPRECATED",
|
|
574
|
+
"ERR_BAD_RESPONSE",
|
|
575
|
+
"ERR_BAD_REQUEST",
|
|
576
|
+
"ERR_CANCELED",
|
|
577
|
+
"ERR_NOT_SUPPORT",
|
|
578
|
+
"ERR_INVALID_URL"
|
|
579
|
+
// eslint-disable-next-line func-names
|
|
580
|
+
].forEach((e) => {
|
|
581
|
+
Kt[e] = { value: e };
|
|
582
|
+
});
|
|
583
|
+
Object.defineProperties(_, Kt);
|
|
584
|
+
Object.defineProperty(Jt, "isAxiosError", { value: !0 });
|
|
585
|
+
_.from = (e, t, n, r, s, o) => {
|
|
586
|
+
const a = Object.create(Jt);
|
|
587
|
+
i.toFlatObject(e, a, function(u) {
|
|
588
|
+
return u !== Error.prototype;
|
|
589
|
+
}, (d) => d !== "isAxiosError");
|
|
590
|
+
const l = e && e.message ? e.message : "Error", m = t == null && e ? e.code : t;
|
|
591
|
+
return _.call(a, l, m, n, r, s), e && a.cause == null && Object.defineProperty(a, "cause", { value: e, configurable: !0 }), a.name = e && e.name || "Error", o && Object.assign(a, o), a;
|
|
592
|
+
};
|
|
593
|
+
const Sr = null;
|
|
594
|
+
function nt(e) {
|
|
595
|
+
return i.isPlainObject(e) || i.isArray(e);
|
|
596
|
+
}
|
|
597
|
+
function Qt(e) {
|
|
598
|
+
return i.endsWith(e, "[]") ? e.slice(0, -2) : e;
|
|
599
|
+
}
|
|
600
|
+
function pt(e, t, n) {
|
|
601
|
+
return e ? e.concat(t).map(function(s, o) {
|
|
602
|
+
return s = Qt(s), !n && o ? "[" + s + "]" : s;
|
|
603
|
+
}).join(n ? "." : "") : t;
|
|
604
|
+
}
|
|
605
|
+
function Ar(e) {
|
|
606
|
+
return i.isArray(e) && !e.some(nt);
|
|
607
|
+
}
|
|
608
|
+
const yr = i.toFlatObject(i, {}, null, function(t) {
|
|
609
|
+
return /^is[A-Z]/.test(t);
|
|
610
|
+
});
|
|
611
|
+
function Ve(e, t, n) {
|
|
612
|
+
if (!i.isObject(e))
|
|
613
|
+
throw new TypeError("target must be an object");
|
|
614
|
+
t = t || new FormData(), n = i.toFlatObject(n, {
|
|
615
|
+
metaTokens: !0,
|
|
616
|
+
dots: !1,
|
|
617
|
+
indexes: !1
|
|
618
|
+
}, !1, function(S, h) {
|
|
619
|
+
return !i.isUndefined(h[S]);
|
|
620
|
+
});
|
|
621
|
+
const r = n.metaTokens, s = n.visitor || u, o = n.dots, a = n.indexes, m = (n.Blob || typeof Blob < "u" && Blob) && i.isSpecCompliantForm(t);
|
|
622
|
+
if (!i.isFunction(s))
|
|
623
|
+
throw new TypeError("visitor must be a function");
|
|
624
|
+
function d(f) {
|
|
625
|
+
if (f === null) return "";
|
|
626
|
+
if (i.isDate(f))
|
|
627
|
+
return f.toISOString();
|
|
628
|
+
if (i.isBoolean(f))
|
|
629
|
+
return f.toString();
|
|
630
|
+
if (!m && i.isBlob(f))
|
|
631
|
+
throw new _("Blob is not supported. Use a Buffer instead.");
|
|
632
|
+
return i.isArrayBuffer(f) || i.isTypedArray(f) ? m && typeof Blob == "function" ? new Blob([f]) : Buffer.from(f) : f;
|
|
633
|
+
}
|
|
634
|
+
function u(f, S, h) {
|
|
635
|
+
let w = f;
|
|
636
|
+
if (f && !h && typeof f == "object") {
|
|
637
|
+
if (i.endsWith(S, "{}"))
|
|
638
|
+
S = r ? S : S.slice(0, -2), f = JSON.stringify(f);
|
|
639
|
+
else if (i.isArray(f) && Ar(f) || (i.isFileList(f) || i.endsWith(S, "[]")) && (w = i.toArray(f)))
|
|
640
|
+
return S = Qt(S), w.forEach(function(I, D) {
|
|
641
|
+
!(i.isUndefined(I) || I === null) && t.append(
|
|
642
|
+
// eslint-disable-next-line no-nested-ternary
|
|
643
|
+
a === !0 ? pt([S], D, o) : a === null ? S : S + "[]",
|
|
644
|
+
d(I)
|
|
645
|
+
);
|
|
646
|
+
}), !1;
|
|
647
|
+
}
|
|
648
|
+
return nt(f) ? !0 : (t.append(pt(h, S, o), d(f)), !1);
|
|
649
|
+
}
|
|
650
|
+
const T = [], x = Object.assign(yr, {
|
|
651
|
+
defaultVisitor: u,
|
|
652
|
+
convertValue: d,
|
|
653
|
+
isVisitable: nt
|
|
654
|
+
});
|
|
655
|
+
function P(f, S) {
|
|
656
|
+
if (!i.isUndefined(f)) {
|
|
657
|
+
if (T.indexOf(f) !== -1)
|
|
658
|
+
throw Error("Circular reference detected in " + S.join("."));
|
|
659
|
+
T.push(f), i.forEach(f, function(w, j) {
|
|
660
|
+
(!(i.isUndefined(w) || w === null) && s.call(
|
|
661
|
+
t,
|
|
662
|
+
w,
|
|
663
|
+
i.isString(j) ? j.trim() : j,
|
|
664
|
+
S,
|
|
665
|
+
x
|
|
666
|
+
)) === !0 && P(w, S ? S.concat(j) : [j]);
|
|
667
|
+
}), T.pop();
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
if (!i.isObject(e))
|
|
671
|
+
throw new TypeError("data must be an object");
|
|
672
|
+
return P(e), t;
|
|
673
|
+
}
|
|
674
|
+
function Et(e) {
|
|
675
|
+
const t = {
|
|
676
|
+
"!": "%21",
|
|
677
|
+
"'": "%27",
|
|
678
|
+
"(": "%28",
|
|
679
|
+
")": "%29",
|
|
680
|
+
"~": "%7E",
|
|
681
|
+
"%20": "+",
|
|
682
|
+
"%00": "\0"
|
|
683
|
+
};
|
|
684
|
+
return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(r) {
|
|
685
|
+
return t[r];
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
function at(e, t) {
|
|
689
|
+
this._pairs = [], e && Ve(e, this, t);
|
|
690
|
+
}
|
|
691
|
+
const Zt = at.prototype;
|
|
692
|
+
Zt.append = function(t, n) {
|
|
693
|
+
this._pairs.push([t, n]);
|
|
694
|
+
};
|
|
695
|
+
Zt.toString = function(t) {
|
|
696
|
+
const n = t ? function(r) {
|
|
697
|
+
return t.call(this, r, Et);
|
|
698
|
+
} : Et;
|
|
699
|
+
return this._pairs.map(function(s) {
|
|
700
|
+
return n(s[0]) + "=" + n(s[1]);
|
|
701
|
+
}, "").join("&");
|
|
702
|
+
};
|
|
703
|
+
function gr(e) {
|
|
704
|
+
return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
|
|
705
|
+
}
|
|
706
|
+
function en(e, t, n) {
|
|
707
|
+
if (!t)
|
|
708
|
+
return e;
|
|
709
|
+
const r = n && n.encode || gr;
|
|
710
|
+
i.isFunction(n) && (n = {
|
|
711
|
+
serialize: n
|
|
712
|
+
});
|
|
713
|
+
const s = n && n.serialize;
|
|
714
|
+
let o;
|
|
715
|
+
if (s ? o = s(t, n) : o = i.isURLSearchParams(t) ? t.toString() : new at(t, n).toString(r), o) {
|
|
716
|
+
const a = e.indexOf("#");
|
|
717
|
+
a !== -1 && (e = e.slice(0, a)), e += (e.indexOf("?") === -1 ? "?" : "&") + o;
|
|
718
|
+
}
|
|
719
|
+
return e;
|
|
720
|
+
}
|
|
721
|
+
class mt {
|
|
722
|
+
constructor() {
|
|
723
|
+
this.handlers = [];
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Add a new interceptor to the stack
|
|
727
|
+
*
|
|
728
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
729
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
730
|
+
*
|
|
731
|
+
* @return {Number} An ID used to remove interceptor later
|
|
732
|
+
*/
|
|
733
|
+
use(t, n, r) {
|
|
734
|
+
return this.handlers.push({
|
|
735
|
+
fulfilled: t,
|
|
736
|
+
rejected: n,
|
|
737
|
+
synchronous: r ? r.synchronous : !1,
|
|
738
|
+
runWhen: r ? r.runWhen : null
|
|
739
|
+
}), this.handlers.length - 1;
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Remove an interceptor from the stack
|
|
743
|
+
*
|
|
744
|
+
* @param {Number} id The ID that was returned by `use`
|
|
745
|
+
*
|
|
746
|
+
* @returns {void}
|
|
747
|
+
*/
|
|
748
|
+
eject(t) {
|
|
749
|
+
this.handlers[t] && (this.handlers[t] = null);
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Clear all interceptors from the stack
|
|
753
|
+
*
|
|
754
|
+
* @returns {void}
|
|
755
|
+
*/
|
|
756
|
+
clear() {
|
|
757
|
+
this.handlers && (this.handlers = []);
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Iterate over all the registered interceptors
|
|
761
|
+
*
|
|
762
|
+
* This method is particularly useful for skipping over any
|
|
763
|
+
* interceptors that may have become `null` calling `eject`.
|
|
764
|
+
*
|
|
765
|
+
* @param {Function} fn The function to call for each interceptor
|
|
766
|
+
*
|
|
767
|
+
* @returns {void}
|
|
768
|
+
*/
|
|
769
|
+
forEach(t) {
|
|
770
|
+
i.forEach(this.handlers, function(r) {
|
|
771
|
+
r !== null && t(r);
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
const tn = {
|
|
776
|
+
silentJSONParsing: !0,
|
|
777
|
+
forcedJSONParsing: !0,
|
|
778
|
+
clarifyTimeoutError: !1
|
|
779
|
+
}, br = typeof URLSearchParams < "u" ? URLSearchParams : at, Or = typeof FormData < "u" ? FormData : null, _r = typeof Blob < "u" ? Blob : null, wr = {
|
|
780
|
+
isBrowser: !0,
|
|
781
|
+
classes: {
|
|
782
|
+
URLSearchParams: br,
|
|
783
|
+
FormData: Or,
|
|
784
|
+
Blob: _r
|
|
785
|
+
},
|
|
786
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
787
|
+
}, it = typeof window < "u" && typeof document < "u", rt = typeof navigator == "object" && navigator || void 0, xr = it && (!rt || ["ReactNative", "NativeScript", "NS"].indexOf(rt.product) < 0), Cr = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
788
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Nr = it && window.location.href || "http://localhost", Ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
789
|
+
__proto__: null,
|
|
790
|
+
hasBrowserEnv: it,
|
|
791
|
+
hasStandardBrowserEnv: xr,
|
|
792
|
+
hasStandardBrowserWebWorkerEnv: Cr,
|
|
793
|
+
navigator: rt,
|
|
794
|
+
origin: Nr
|
|
795
|
+
}, Symbol.toStringTag, { value: "Module" })), q = {
|
|
796
|
+
...Ir,
|
|
797
|
+
...wr
|
|
798
|
+
};
|
|
799
|
+
function Dr(e, t) {
|
|
800
|
+
return Ve(e, new q.classes.URLSearchParams(), {
|
|
801
|
+
visitor: function(n, r, s, o) {
|
|
802
|
+
return q.isNode && i.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
|
|
803
|
+
},
|
|
804
|
+
...t
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
function Lr(e) {
|
|
808
|
+
return i.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
|
|
809
|
+
}
|
|
810
|
+
function Pr(e) {
|
|
811
|
+
const t = {}, n = Object.keys(e);
|
|
812
|
+
let r;
|
|
813
|
+
const s = n.length;
|
|
814
|
+
let o;
|
|
815
|
+
for (r = 0; r < s; r++)
|
|
816
|
+
o = n[r], t[o] = e[o];
|
|
817
|
+
return t;
|
|
818
|
+
}
|
|
819
|
+
function nn(e) {
|
|
820
|
+
function t(n, r, s, o) {
|
|
821
|
+
let a = n[o++];
|
|
822
|
+
if (a === "__proto__") return !0;
|
|
823
|
+
const l = Number.isFinite(+a), m = o >= n.length;
|
|
824
|
+
return a = !a && i.isArray(s) ? s.length : a, m ? (i.hasOwnProp(s, a) ? s[a] = [s[a], r] : s[a] = r, !l) : ((!s[a] || !i.isObject(s[a])) && (s[a] = []), t(n, r, s[a], o) && i.isArray(s[a]) && (s[a] = Pr(s[a])), !l);
|
|
825
|
+
}
|
|
826
|
+
if (i.isFormData(e) && i.isFunction(e.entries)) {
|
|
827
|
+
const n = {};
|
|
828
|
+
return i.forEachEntry(e, (r, s) => {
|
|
829
|
+
t(Lr(r), s, n, 0);
|
|
830
|
+
}), n;
|
|
831
|
+
}
|
|
832
|
+
return null;
|
|
833
|
+
}
|
|
834
|
+
function Fr(e, t, n) {
|
|
835
|
+
if (i.isString(e))
|
|
836
|
+
try {
|
|
837
|
+
return (t || JSON.parse)(e), i.trim(e);
|
|
838
|
+
} catch (r) {
|
|
839
|
+
if (r.name !== "SyntaxError")
|
|
840
|
+
throw r;
|
|
841
|
+
}
|
|
842
|
+
return (n || JSON.stringify)(e);
|
|
843
|
+
}
|
|
844
|
+
const Ce = {
|
|
845
|
+
transitional: tn,
|
|
846
|
+
adapter: ["xhr", "http", "fetch"],
|
|
847
|
+
transformRequest: [function(t, n) {
|
|
848
|
+
const r = n.getContentType() || "", s = r.indexOf("application/json") > -1, o = i.isObject(t);
|
|
849
|
+
if (o && i.isHTMLForm(t) && (t = new FormData(t)), i.isFormData(t))
|
|
850
|
+
return s ? JSON.stringify(nn(t)) : t;
|
|
851
|
+
if (i.isArrayBuffer(t) || i.isBuffer(t) || i.isStream(t) || i.isFile(t) || i.isBlob(t) || i.isReadableStream(t))
|
|
852
|
+
return t;
|
|
853
|
+
if (i.isArrayBufferView(t))
|
|
854
|
+
return t.buffer;
|
|
855
|
+
if (i.isURLSearchParams(t))
|
|
856
|
+
return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
|
|
857
|
+
let l;
|
|
858
|
+
if (o) {
|
|
859
|
+
if (r.indexOf("application/x-www-form-urlencoded") > -1)
|
|
860
|
+
return Dr(t, this.formSerializer).toString();
|
|
861
|
+
if ((l = i.isFileList(t)) || r.indexOf("multipart/form-data") > -1) {
|
|
862
|
+
const m = this.env && this.env.FormData;
|
|
863
|
+
return Ve(
|
|
864
|
+
l ? { "files[]": t } : t,
|
|
865
|
+
m && new m(),
|
|
866
|
+
this.formSerializer
|
|
867
|
+
);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
return o || s ? (n.setContentType("application/json", !1), Fr(t)) : t;
|
|
871
|
+
}],
|
|
872
|
+
transformResponse: [function(t) {
|
|
873
|
+
const n = this.transitional || Ce.transitional, r = n && n.forcedJSONParsing, s = this.responseType === "json";
|
|
874
|
+
if (i.isResponse(t) || i.isReadableStream(t))
|
|
875
|
+
return t;
|
|
876
|
+
if (t && i.isString(t) && (r && !this.responseType || s)) {
|
|
877
|
+
const a = !(n && n.silentJSONParsing) && s;
|
|
878
|
+
try {
|
|
879
|
+
return JSON.parse(t, this.parseReviver);
|
|
880
|
+
} catch (l) {
|
|
881
|
+
if (a)
|
|
882
|
+
throw l.name === "SyntaxError" ? _.from(l, _.ERR_BAD_RESPONSE, this, null, this.response) : l;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
return t;
|
|
886
|
+
}],
|
|
887
|
+
/**
|
|
888
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
889
|
+
* timeout is not created.
|
|
890
|
+
*/
|
|
891
|
+
timeout: 0,
|
|
892
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
893
|
+
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
894
|
+
maxContentLength: -1,
|
|
895
|
+
maxBodyLength: -1,
|
|
896
|
+
env: {
|
|
897
|
+
FormData: q.classes.FormData,
|
|
898
|
+
Blob: q.classes.Blob
|
|
899
|
+
},
|
|
900
|
+
validateStatus: function(t) {
|
|
901
|
+
return t >= 200 && t < 300;
|
|
902
|
+
},
|
|
903
|
+
headers: {
|
|
904
|
+
common: {
|
|
905
|
+
Accept: "application/json, text/plain, */*",
|
|
906
|
+
"Content-Type": void 0
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
};
|
|
910
|
+
i.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
|
|
911
|
+
Ce.headers[e] = {};
|
|
912
|
+
});
|
|
913
|
+
const jr = i.toObjectSet([
|
|
914
|
+
"age",
|
|
915
|
+
"authorization",
|
|
916
|
+
"content-length",
|
|
917
|
+
"content-type",
|
|
918
|
+
"etag",
|
|
919
|
+
"expires",
|
|
920
|
+
"from",
|
|
921
|
+
"host",
|
|
922
|
+
"if-modified-since",
|
|
923
|
+
"if-unmodified-since",
|
|
924
|
+
"last-modified",
|
|
925
|
+
"location",
|
|
926
|
+
"max-forwards",
|
|
927
|
+
"proxy-authorization",
|
|
928
|
+
"referer",
|
|
929
|
+
"retry-after",
|
|
930
|
+
"user-agent"
|
|
931
|
+
]), vr = (e) => {
|
|
932
|
+
const t = {};
|
|
933
|
+
let n, r, s;
|
|
934
|
+
return e && e.split(`
|
|
935
|
+
`).forEach(function(a) {
|
|
936
|
+
s = a.indexOf(":"), n = a.substring(0, s).trim().toLowerCase(), r = a.substring(s + 1).trim(), !(!n || t[n] && jr[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
|
|
937
|
+
}), t;
|
|
938
|
+
}, ht = /* @__PURE__ */ Symbol("internals");
|
|
939
|
+
function Ae(e) {
|
|
940
|
+
return e && String(e).trim().toLowerCase();
|
|
941
|
+
}
|
|
942
|
+
function je(e) {
|
|
943
|
+
return e === !1 || e == null ? e : i.isArray(e) ? e.map(je) : String(e);
|
|
944
|
+
}
|
|
945
|
+
function Mr(e) {
|
|
946
|
+
const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
947
|
+
let r;
|
|
948
|
+
for (; r = n.exec(e); )
|
|
949
|
+
t[r[1]] = r[2];
|
|
950
|
+
return t;
|
|
951
|
+
}
|
|
952
|
+
const Ur = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
|
|
953
|
+
function qe(e, t, n, r, s) {
|
|
954
|
+
if (i.isFunction(r))
|
|
955
|
+
return r.call(this, t, n);
|
|
956
|
+
if (s && (t = n), !!i.isString(t)) {
|
|
957
|
+
if (i.isString(r))
|
|
958
|
+
return t.indexOf(r) !== -1;
|
|
959
|
+
if (i.isRegExp(r))
|
|
960
|
+
return r.test(t);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
function kr(e) {
|
|
964
|
+
return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
|
|
965
|
+
}
|
|
966
|
+
function Br(e, t) {
|
|
967
|
+
const n = i.toCamelCase(" " + t);
|
|
968
|
+
["get", "set", "has"].forEach((r) => {
|
|
969
|
+
Object.defineProperty(e, r + n, {
|
|
970
|
+
value: function(s, o, a) {
|
|
971
|
+
return this[r].call(this, t, s, o, a);
|
|
972
|
+
},
|
|
973
|
+
configurable: !0
|
|
974
|
+
});
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
let z = class {
|
|
978
|
+
constructor(t) {
|
|
979
|
+
t && this.set(t);
|
|
980
|
+
}
|
|
981
|
+
set(t, n, r) {
|
|
982
|
+
const s = this;
|
|
983
|
+
function o(l, m, d) {
|
|
984
|
+
const u = Ae(m);
|
|
985
|
+
if (!u)
|
|
986
|
+
throw new Error("header name must be a non-empty string");
|
|
987
|
+
const T = i.findKey(s, u);
|
|
988
|
+
(!T || s[T] === void 0 || d === !0 || d === void 0 && s[T] !== !1) && (s[T || m] = je(l));
|
|
989
|
+
}
|
|
990
|
+
const a = (l, m) => i.forEach(l, (d, u) => o(d, u, m));
|
|
991
|
+
if (i.isPlainObject(t) || t instanceof this.constructor)
|
|
992
|
+
a(t, n);
|
|
993
|
+
else if (i.isString(t) && (t = t.trim()) && !Ur(t))
|
|
994
|
+
a(vr(t), n);
|
|
995
|
+
else if (i.isObject(t) && i.isIterable(t)) {
|
|
996
|
+
let l = {}, m, d;
|
|
997
|
+
for (const u of t) {
|
|
998
|
+
if (!i.isArray(u))
|
|
999
|
+
throw TypeError("Object iterator must return a key-value pair");
|
|
1000
|
+
l[d = u[0]] = (m = l[d]) ? i.isArray(m) ? [...m, u[1]] : [m, u[1]] : u[1];
|
|
1001
|
+
}
|
|
1002
|
+
a(l, n);
|
|
1003
|
+
} else
|
|
1004
|
+
t != null && o(n, t, r);
|
|
1005
|
+
return this;
|
|
1006
|
+
}
|
|
1007
|
+
get(t, n) {
|
|
1008
|
+
if (t = Ae(t), t) {
|
|
1009
|
+
const r = i.findKey(this, t);
|
|
1010
|
+
if (r) {
|
|
1011
|
+
const s = this[r];
|
|
1012
|
+
if (!n)
|
|
1013
|
+
return s;
|
|
1014
|
+
if (n === !0)
|
|
1015
|
+
return Mr(s);
|
|
1016
|
+
if (i.isFunction(n))
|
|
1017
|
+
return n.call(this, s, r);
|
|
1018
|
+
if (i.isRegExp(n))
|
|
1019
|
+
return n.exec(s);
|
|
1020
|
+
throw new TypeError("parser must be boolean|regexp|function");
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
has(t, n) {
|
|
1025
|
+
if (t = Ae(t), t) {
|
|
1026
|
+
const r = i.findKey(this, t);
|
|
1027
|
+
return !!(r && this[r] !== void 0 && (!n || qe(this, this[r], r, n)));
|
|
1028
|
+
}
|
|
1029
|
+
return !1;
|
|
1030
|
+
}
|
|
1031
|
+
delete(t, n) {
|
|
1032
|
+
const r = this;
|
|
1033
|
+
let s = !1;
|
|
1034
|
+
function o(a) {
|
|
1035
|
+
if (a = Ae(a), a) {
|
|
1036
|
+
const l = i.findKey(r, a);
|
|
1037
|
+
l && (!n || qe(r, r[l], l, n)) && (delete r[l], s = !0);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
return i.isArray(t) ? t.forEach(o) : o(t), s;
|
|
1041
|
+
}
|
|
1042
|
+
clear(t) {
|
|
1043
|
+
const n = Object.keys(this);
|
|
1044
|
+
let r = n.length, s = !1;
|
|
1045
|
+
for (; r--; ) {
|
|
1046
|
+
const o = n[r];
|
|
1047
|
+
(!t || qe(this, this[o], o, t, !0)) && (delete this[o], s = !0);
|
|
1048
|
+
}
|
|
1049
|
+
return s;
|
|
1050
|
+
}
|
|
1051
|
+
normalize(t) {
|
|
1052
|
+
const n = this, r = {};
|
|
1053
|
+
return i.forEach(this, (s, o) => {
|
|
1054
|
+
const a = i.findKey(r, o);
|
|
1055
|
+
if (a) {
|
|
1056
|
+
n[a] = je(s), delete n[o];
|
|
1057
|
+
return;
|
|
1058
|
+
}
|
|
1059
|
+
const l = t ? kr(o) : String(o).trim();
|
|
1060
|
+
l !== o && delete n[o], n[l] = je(s), r[l] = !0;
|
|
1061
|
+
}), this;
|
|
1062
|
+
}
|
|
1063
|
+
concat(...t) {
|
|
1064
|
+
return this.constructor.concat(this, ...t);
|
|
1065
|
+
}
|
|
1066
|
+
toJSON(t) {
|
|
1067
|
+
const n = /* @__PURE__ */ Object.create(null);
|
|
1068
|
+
return i.forEach(this, (r, s) => {
|
|
1069
|
+
r != null && r !== !1 && (n[s] = t && i.isArray(r) ? r.join(", ") : r);
|
|
1070
|
+
}), n;
|
|
1071
|
+
}
|
|
1072
|
+
[Symbol.iterator]() {
|
|
1073
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
1074
|
+
}
|
|
1075
|
+
toString() {
|
|
1076
|
+
return Object.entries(this.toJSON()).map(([t, n]) => t + ": " + n).join(`
|
|
1077
|
+
`);
|
|
1078
|
+
}
|
|
1079
|
+
getSetCookie() {
|
|
1080
|
+
return this.get("set-cookie") || [];
|
|
1081
|
+
}
|
|
1082
|
+
get [Symbol.toStringTag]() {
|
|
1083
|
+
return "AxiosHeaders";
|
|
1084
|
+
}
|
|
1085
|
+
static from(t) {
|
|
1086
|
+
return t instanceof this ? t : new this(t);
|
|
1087
|
+
}
|
|
1088
|
+
static concat(t, ...n) {
|
|
1089
|
+
const r = new this(t);
|
|
1090
|
+
return n.forEach((s) => r.set(s)), r;
|
|
1091
|
+
}
|
|
1092
|
+
static accessor(t) {
|
|
1093
|
+
const r = (this[ht] = this[ht] = {
|
|
1094
|
+
accessors: {}
|
|
1095
|
+
}).accessors, s = this.prototype;
|
|
1096
|
+
function o(a) {
|
|
1097
|
+
const l = Ae(a);
|
|
1098
|
+
r[l] || (Br(s, a), r[l] = !0);
|
|
1099
|
+
}
|
|
1100
|
+
return i.isArray(t) ? t.forEach(o) : o(t), this;
|
|
1101
|
+
}
|
|
1102
|
+
};
|
|
1103
|
+
z.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
1104
|
+
i.reduceDescriptors(z.prototype, ({ value: e }, t) => {
|
|
1105
|
+
let n = t[0].toUpperCase() + t.slice(1);
|
|
1106
|
+
return {
|
|
1107
|
+
get: () => e,
|
|
1108
|
+
set(r) {
|
|
1109
|
+
this[n] = r;
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
});
|
|
1113
|
+
i.freezeMethods(z);
|
|
1114
|
+
function Ye(e, t) {
|
|
1115
|
+
const n = this || Ce, r = t || n, s = z.from(r.headers);
|
|
1116
|
+
let o = r.data;
|
|
1117
|
+
return i.forEach(e, function(l) {
|
|
1118
|
+
o = l.call(n, o, s.normalize(), t ? t.status : void 0);
|
|
1119
|
+
}), s.normalize(), o;
|
|
1120
|
+
}
|
|
1121
|
+
function rn(e) {
|
|
1122
|
+
return !!(e && e.__CANCEL__);
|
|
1123
|
+
}
|
|
1124
|
+
function he(e, t, n) {
|
|
1125
|
+
_.call(this, e ?? "canceled", _.ERR_CANCELED, t, n), this.name = "CanceledError";
|
|
1126
|
+
}
|
|
1127
|
+
i.inherits(he, _, {
|
|
1128
|
+
__CANCEL__: !0
|
|
1129
|
+
});
|
|
1130
|
+
function sn(e, t, n) {
|
|
1131
|
+
const r = n.config.validateStatus;
|
|
1132
|
+
!n.status || !r || r(n.status) ? e(n) : t(new _(
|
|
1133
|
+
"Request failed with status code " + n.status,
|
|
1134
|
+
[_.ERR_BAD_REQUEST, _.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
|
|
1135
|
+
n.config,
|
|
1136
|
+
n.request,
|
|
1137
|
+
n
|
|
1138
|
+
));
|
|
1139
|
+
}
|
|
1140
|
+
function $r(e) {
|
|
1141
|
+
const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
|
|
1142
|
+
return t && t[1] || "";
|
|
1143
|
+
}
|
|
1144
|
+
function Hr(e, t) {
|
|
1145
|
+
e = e || 10;
|
|
1146
|
+
const n = new Array(e), r = new Array(e);
|
|
1147
|
+
let s = 0, o = 0, a;
|
|
1148
|
+
return t = t !== void 0 ? t : 1e3, function(m) {
|
|
1149
|
+
const d = Date.now(), u = r[o];
|
|
1150
|
+
a || (a = d), n[s] = m, r[s] = d;
|
|
1151
|
+
let T = o, x = 0;
|
|
1152
|
+
for (; T !== s; )
|
|
1153
|
+
x += n[T++], T = T % e;
|
|
1154
|
+
if (s = (s + 1) % e, s === o && (o = (o + 1) % e), d - a < t)
|
|
1155
|
+
return;
|
|
1156
|
+
const P = u && d - u;
|
|
1157
|
+
return P ? Math.round(x * 1e3 / P) : void 0;
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
function Vr(e, t) {
|
|
1161
|
+
let n = 0, r = 1e3 / t, s, o;
|
|
1162
|
+
const a = (d, u = Date.now()) => {
|
|
1163
|
+
n = u, s = null, o && (clearTimeout(o), o = null), e(...d);
|
|
1164
|
+
};
|
|
1165
|
+
return [(...d) => {
|
|
1166
|
+
const u = Date.now(), T = u - n;
|
|
1167
|
+
T >= r ? a(d, u) : (s = d, o || (o = setTimeout(() => {
|
|
1168
|
+
o = null, a(s);
|
|
1169
|
+
}, r - T)));
|
|
1170
|
+
}, () => s && a(s)];
|
|
1171
|
+
}
|
|
1172
|
+
const Ue = (e, t, n = 3) => {
|
|
1173
|
+
let r = 0;
|
|
1174
|
+
const s = Hr(50, 250);
|
|
1175
|
+
return Vr((o) => {
|
|
1176
|
+
const a = o.loaded, l = o.lengthComputable ? o.total : void 0, m = a - r, d = s(m), u = a <= l;
|
|
1177
|
+
r = a;
|
|
1178
|
+
const T = {
|
|
1179
|
+
loaded: a,
|
|
1180
|
+
total: l,
|
|
1181
|
+
progress: l ? a / l : void 0,
|
|
1182
|
+
bytes: m,
|
|
1183
|
+
rate: d || void 0,
|
|
1184
|
+
estimated: d && l && u ? (l - a) / d : void 0,
|
|
1185
|
+
event: o,
|
|
1186
|
+
lengthComputable: l != null,
|
|
1187
|
+
[t ? "download" : "upload"]: !0
|
|
1188
|
+
};
|
|
1189
|
+
e(T);
|
|
1190
|
+
}, n);
|
|
1191
|
+
}, Tt = (e, t) => {
|
|
1192
|
+
const n = e != null;
|
|
1193
|
+
return [(r) => t[0]({
|
|
1194
|
+
lengthComputable: n,
|
|
1195
|
+
total: e,
|
|
1196
|
+
loaded: r
|
|
1197
|
+
}), t[1]];
|
|
1198
|
+
}, Rt = (e) => (...t) => i.asap(() => e(...t)), Gr = q.hasStandardBrowserEnv ? /* @__PURE__ */ ((e, t) => (n) => (n = new URL(n, q.origin), e.protocol === n.protocol && e.host === n.host && (t || e.port === n.port)))(
|
|
1199
|
+
new URL(q.origin),
|
|
1200
|
+
q.navigator && /(msie|trident)/i.test(q.navigator.userAgent)
|
|
1201
|
+
) : () => !0, Wr = q.hasStandardBrowserEnv ? (
|
|
1202
|
+
// Standard browser envs support document.cookie
|
|
1203
|
+
{
|
|
1204
|
+
write(e, t, n, r, s, o, a) {
|
|
1205
|
+
if (typeof document > "u") return;
|
|
1206
|
+
const l = [`${e}=${encodeURIComponent(t)}`];
|
|
1207
|
+
i.isNumber(n) && l.push(`expires=${new Date(n).toUTCString()}`), i.isString(r) && l.push(`path=${r}`), i.isString(s) && l.push(`domain=${s}`), o === !0 && l.push("secure"), i.isString(a) && l.push(`SameSite=${a}`), document.cookie = l.join("; ");
|
|
1208
|
+
},
|
|
1209
|
+
read(e) {
|
|
1210
|
+
if (typeof document > "u") return null;
|
|
1211
|
+
const t = document.cookie.match(new RegExp("(?:^|; )" + e + "=([^;]*)"));
|
|
1212
|
+
return t ? decodeURIComponent(t[1]) : null;
|
|
1213
|
+
},
|
|
1214
|
+
remove(e) {
|
|
1215
|
+
this.write(e, "", Date.now() - 864e5, "/");
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
) : (
|
|
1219
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
1220
|
+
{
|
|
1221
|
+
write() {
|
|
1222
|
+
},
|
|
1223
|
+
read() {
|
|
1224
|
+
return null;
|
|
1225
|
+
},
|
|
1226
|
+
remove() {
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
);
|
|
1230
|
+
function qr(e) {
|
|
1231
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
|
|
1232
|
+
}
|
|
1233
|
+
function Yr(e, t) {
|
|
1234
|
+
return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
|
|
1235
|
+
}
|
|
1236
|
+
function on(e, t, n) {
|
|
1237
|
+
let r = !qr(t);
|
|
1238
|
+
return e && (r || n == !1) ? Yr(e, t) : t;
|
|
1239
|
+
}
|
|
1240
|
+
const St = (e) => e instanceof z ? { ...e } : e;
|
|
1241
|
+
function fe(e, t) {
|
|
1242
|
+
t = t || {};
|
|
1243
|
+
const n = {};
|
|
1244
|
+
function r(d, u, T, x) {
|
|
1245
|
+
return i.isPlainObject(d) && i.isPlainObject(u) ? i.merge.call({ caseless: x }, d, u) : i.isPlainObject(u) ? i.merge({}, u) : i.isArray(u) ? u.slice() : u;
|
|
1246
|
+
}
|
|
1247
|
+
function s(d, u, T, x) {
|
|
1248
|
+
if (i.isUndefined(u)) {
|
|
1249
|
+
if (!i.isUndefined(d))
|
|
1250
|
+
return r(void 0, d, T, x);
|
|
1251
|
+
} else return r(d, u, T, x);
|
|
1252
|
+
}
|
|
1253
|
+
function o(d, u) {
|
|
1254
|
+
if (!i.isUndefined(u))
|
|
1255
|
+
return r(void 0, u);
|
|
1256
|
+
}
|
|
1257
|
+
function a(d, u) {
|
|
1258
|
+
if (i.isUndefined(u)) {
|
|
1259
|
+
if (!i.isUndefined(d))
|
|
1260
|
+
return r(void 0, d);
|
|
1261
|
+
} else return r(void 0, u);
|
|
1262
|
+
}
|
|
1263
|
+
function l(d, u, T) {
|
|
1264
|
+
if (T in t)
|
|
1265
|
+
return r(d, u);
|
|
1266
|
+
if (T in e)
|
|
1267
|
+
return r(void 0, d);
|
|
1268
|
+
}
|
|
1269
|
+
const m = {
|
|
1270
|
+
url: o,
|
|
1271
|
+
method: o,
|
|
1272
|
+
data: o,
|
|
1273
|
+
baseURL: a,
|
|
1274
|
+
transformRequest: a,
|
|
1275
|
+
transformResponse: a,
|
|
1276
|
+
paramsSerializer: a,
|
|
1277
|
+
timeout: a,
|
|
1278
|
+
timeoutMessage: a,
|
|
1279
|
+
withCredentials: a,
|
|
1280
|
+
withXSRFToken: a,
|
|
1281
|
+
adapter: a,
|
|
1282
|
+
responseType: a,
|
|
1283
|
+
xsrfCookieName: a,
|
|
1284
|
+
xsrfHeaderName: a,
|
|
1285
|
+
onUploadProgress: a,
|
|
1286
|
+
onDownloadProgress: a,
|
|
1287
|
+
decompress: a,
|
|
1288
|
+
maxContentLength: a,
|
|
1289
|
+
maxBodyLength: a,
|
|
1290
|
+
beforeRedirect: a,
|
|
1291
|
+
transport: a,
|
|
1292
|
+
httpAgent: a,
|
|
1293
|
+
httpsAgent: a,
|
|
1294
|
+
cancelToken: a,
|
|
1295
|
+
socketPath: a,
|
|
1296
|
+
responseEncoding: a,
|
|
1297
|
+
validateStatus: l,
|
|
1298
|
+
headers: (d, u, T) => s(St(d), St(u), T, !0)
|
|
1299
|
+
};
|
|
1300
|
+
return i.forEach(Object.keys({ ...e, ...t }), function(u) {
|
|
1301
|
+
const T = m[u] || s, x = T(e[u], t[u], u);
|
|
1302
|
+
i.isUndefined(x) && T !== l || (n[u] = x);
|
|
1303
|
+
}), n;
|
|
1304
|
+
}
|
|
1305
|
+
const an = (e) => {
|
|
1306
|
+
const t = fe({}, e);
|
|
1307
|
+
let { data: n, withXSRFToken: r, xsrfHeaderName: s, xsrfCookieName: o, headers: a, auth: l } = t;
|
|
1308
|
+
if (t.headers = a = z.from(a), t.url = en(on(t.baseURL, t.url, t.allowAbsoluteUrls), e.params, e.paramsSerializer), l && a.set(
|
|
1309
|
+
"Authorization",
|
|
1310
|
+
"Basic " + btoa((l.username || "") + ":" + (l.password ? unescape(encodeURIComponent(l.password)) : ""))
|
|
1311
|
+
), i.isFormData(n)) {
|
|
1312
|
+
if (q.hasStandardBrowserEnv || q.hasStandardBrowserWebWorkerEnv)
|
|
1313
|
+
a.setContentType(void 0);
|
|
1314
|
+
else if (i.isFunction(n.getHeaders)) {
|
|
1315
|
+
const m = n.getHeaders(), d = ["content-type", "content-length"];
|
|
1316
|
+
Object.entries(m).forEach(([u, T]) => {
|
|
1317
|
+
d.includes(u.toLowerCase()) && a.set(u, T);
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
if (q.hasStandardBrowserEnv && (r && i.isFunction(r) && (r = r(t)), r || r !== !1 && Gr(t.url))) {
|
|
1322
|
+
const m = s && o && Wr.read(o);
|
|
1323
|
+
m && a.set(s, m);
|
|
1324
|
+
}
|
|
1325
|
+
return t;
|
|
1326
|
+
}, zr = typeof XMLHttpRequest < "u", Xr = zr && function(e) {
|
|
1327
|
+
return new Promise(function(n, r) {
|
|
1328
|
+
const s = an(e);
|
|
1329
|
+
let o = s.data;
|
|
1330
|
+
const a = z.from(s.headers).normalize();
|
|
1331
|
+
let { responseType: l, onUploadProgress: m, onDownloadProgress: d } = s, u, T, x, P, f;
|
|
1332
|
+
function S() {
|
|
1333
|
+
P && P(), f && f(), s.cancelToken && s.cancelToken.unsubscribe(u), s.signal && s.signal.removeEventListener("abort", u);
|
|
1334
|
+
}
|
|
1335
|
+
let h = new XMLHttpRequest();
|
|
1336
|
+
h.open(s.method.toUpperCase(), s.url, !0), h.timeout = s.timeout;
|
|
1337
|
+
function w() {
|
|
1338
|
+
if (!h)
|
|
1339
|
+
return;
|
|
1340
|
+
const I = z.from(
|
|
1341
|
+
"getAllResponseHeaders" in h && h.getAllResponseHeaders()
|
|
1342
|
+
), F = {
|
|
1343
|
+
data: !l || l === "text" || l === "json" ? h.responseText : h.response,
|
|
1344
|
+
status: h.status,
|
|
1345
|
+
statusText: h.statusText,
|
|
1346
|
+
headers: I,
|
|
1347
|
+
config: e,
|
|
1348
|
+
request: h
|
|
1349
|
+
};
|
|
1350
|
+
sn(function(U) {
|
|
1351
|
+
n(U), S();
|
|
1352
|
+
}, function(U) {
|
|
1353
|
+
r(U), S();
|
|
1354
|
+
}, F), h = null;
|
|
1355
|
+
}
|
|
1356
|
+
"onloadend" in h ? h.onloadend = w : h.onreadystatechange = function() {
|
|
1357
|
+
!h || h.readyState !== 4 || h.status === 0 && !(h.responseURL && h.responseURL.indexOf("file:") === 0) || setTimeout(w);
|
|
1358
|
+
}, h.onabort = function() {
|
|
1359
|
+
h && (r(new _("Request aborted", _.ECONNABORTED, e, h)), h = null);
|
|
1360
|
+
}, h.onerror = function(D) {
|
|
1361
|
+
const F = D && D.message ? D.message : "Network Error", V = new _(F, _.ERR_NETWORK, e, h);
|
|
1362
|
+
V.event = D || null, r(V), h = null;
|
|
1363
|
+
}, h.ontimeout = function() {
|
|
1364
|
+
let D = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
|
|
1365
|
+
const F = s.transitional || tn;
|
|
1366
|
+
s.timeoutErrorMessage && (D = s.timeoutErrorMessage), r(new _(
|
|
1367
|
+
D,
|
|
1368
|
+
F.clarifyTimeoutError ? _.ETIMEDOUT : _.ECONNABORTED,
|
|
1369
|
+
e,
|
|
1370
|
+
h
|
|
1371
|
+
)), h = null;
|
|
1372
|
+
}, o === void 0 && a.setContentType(null), "setRequestHeader" in h && i.forEach(a.toJSON(), function(D, F) {
|
|
1373
|
+
h.setRequestHeader(F, D);
|
|
1374
|
+
}), i.isUndefined(s.withCredentials) || (h.withCredentials = !!s.withCredentials), l && l !== "json" && (h.responseType = s.responseType), d && ([x, f] = Ue(d, !0), h.addEventListener("progress", x)), m && h.upload && ([T, P] = Ue(m), h.upload.addEventListener("progress", T), h.upload.addEventListener("loadend", P)), (s.cancelToken || s.signal) && (u = (I) => {
|
|
1375
|
+
h && (r(!I || I.type ? new he(null, e, h) : I), h.abort(), h = null);
|
|
1376
|
+
}, s.cancelToken && s.cancelToken.subscribe(u), s.signal && (s.signal.aborted ? u() : s.signal.addEventListener("abort", u)));
|
|
1377
|
+
const j = $r(s.url);
|
|
1378
|
+
if (j && q.protocols.indexOf(j) === -1) {
|
|
1379
|
+
r(new _("Unsupported protocol " + j + ":", _.ERR_BAD_REQUEST, e));
|
|
1380
|
+
return;
|
|
1381
|
+
}
|
|
1382
|
+
h.send(o || null);
|
|
1383
|
+
});
|
|
1384
|
+
}, Jr = (e, t) => {
|
|
1385
|
+
const { length: n } = e = e ? e.filter(Boolean) : [];
|
|
1386
|
+
if (t || n) {
|
|
1387
|
+
let r = new AbortController(), s;
|
|
1388
|
+
const o = function(d) {
|
|
1389
|
+
if (!s) {
|
|
1390
|
+
s = !0, l();
|
|
1391
|
+
const u = d instanceof Error ? d : this.reason;
|
|
1392
|
+
r.abort(u instanceof _ ? u : new he(u instanceof Error ? u.message : u));
|
|
1393
|
+
}
|
|
1394
|
+
};
|
|
1395
|
+
let a = t && setTimeout(() => {
|
|
1396
|
+
a = null, o(new _(`timeout ${t} of ms exceeded`, _.ETIMEDOUT));
|
|
1397
|
+
}, t);
|
|
1398
|
+
const l = () => {
|
|
1399
|
+
e && (a && clearTimeout(a), a = null, e.forEach((d) => {
|
|
1400
|
+
d.unsubscribe ? d.unsubscribe(o) : d.removeEventListener("abort", o);
|
|
1401
|
+
}), e = null);
|
|
1402
|
+
};
|
|
1403
|
+
e.forEach((d) => d.addEventListener("abort", o));
|
|
1404
|
+
const { signal: m } = r;
|
|
1405
|
+
return m.unsubscribe = () => i.asap(l), m;
|
|
1406
|
+
}
|
|
1407
|
+
}, Kr = function* (e, t) {
|
|
1408
|
+
let n = e.byteLength;
|
|
1409
|
+
if (n < t) {
|
|
1410
|
+
yield e;
|
|
1411
|
+
return;
|
|
1412
|
+
}
|
|
1413
|
+
let r = 0, s;
|
|
1414
|
+
for (; r < n; )
|
|
1415
|
+
s = r + t, yield e.slice(r, s), r = s;
|
|
1416
|
+
}, Qr = async function* (e, t) {
|
|
1417
|
+
for await (const n of Zr(e))
|
|
1418
|
+
yield* Kr(n, t);
|
|
1419
|
+
}, Zr = async function* (e) {
|
|
1420
|
+
if (e[Symbol.asyncIterator]) {
|
|
1421
|
+
yield* e;
|
|
1422
|
+
return;
|
|
1423
|
+
}
|
|
1424
|
+
const t = e.getReader();
|
|
1425
|
+
try {
|
|
1426
|
+
for (; ; ) {
|
|
1427
|
+
const { done: n, value: r } = await t.read();
|
|
1428
|
+
if (n)
|
|
1429
|
+
break;
|
|
1430
|
+
yield r;
|
|
1431
|
+
}
|
|
1432
|
+
} finally {
|
|
1433
|
+
await t.cancel();
|
|
1434
|
+
}
|
|
1435
|
+
}, At = (e, t, n, r) => {
|
|
1436
|
+
const s = Qr(e, t);
|
|
1437
|
+
let o = 0, a, l = (m) => {
|
|
1438
|
+
a || (a = !0, r && r(m));
|
|
1439
|
+
};
|
|
1440
|
+
return new ReadableStream({
|
|
1441
|
+
async pull(m) {
|
|
1442
|
+
try {
|
|
1443
|
+
const { done: d, value: u } = await s.next();
|
|
1444
|
+
if (d) {
|
|
1445
|
+
l(), m.close();
|
|
1446
|
+
return;
|
|
1447
|
+
}
|
|
1448
|
+
let T = u.byteLength;
|
|
1449
|
+
if (n) {
|
|
1450
|
+
let x = o += T;
|
|
1451
|
+
n(x);
|
|
1452
|
+
}
|
|
1453
|
+
m.enqueue(new Uint8Array(u));
|
|
1454
|
+
} catch (d) {
|
|
1455
|
+
throw l(d), d;
|
|
1456
|
+
}
|
|
1457
|
+
},
|
|
1458
|
+
cancel(m) {
|
|
1459
|
+
return l(m), s.return();
|
|
1460
|
+
}
|
|
1461
|
+
}, {
|
|
1462
|
+
highWaterMark: 2
|
|
1463
|
+
});
|
|
1464
|
+
}, yt = 64 * 1024, { isFunction: De } = i, es = (({ Request: e, Response: t }) => ({
|
|
1465
|
+
Request: e,
|
|
1466
|
+
Response: t
|
|
1467
|
+
}))(i.global), {
|
|
1468
|
+
ReadableStream: gt,
|
|
1469
|
+
TextEncoder: bt
|
|
1470
|
+
} = i.global, Ot = (e, ...t) => {
|
|
1471
|
+
try {
|
|
1472
|
+
return !!e(...t);
|
|
1473
|
+
} catch {
|
|
1474
|
+
return !1;
|
|
1475
|
+
}
|
|
1476
|
+
}, ts = (e) => {
|
|
1477
|
+
e = i.merge.call({
|
|
1478
|
+
skipUndefined: !0
|
|
1479
|
+
}, es, e);
|
|
1480
|
+
const { fetch: t, Request: n, Response: r } = e, s = t ? De(t) : typeof fetch == "function", o = De(n), a = De(r);
|
|
1481
|
+
if (!s)
|
|
1482
|
+
return !1;
|
|
1483
|
+
const l = s && De(gt), m = s && (typeof bt == "function" ? /* @__PURE__ */ ((f) => (S) => f.encode(S))(new bt()) : async (f) => new Uint8Array(await new n(f).arrayBuffer())), d = o && l && Ot(() => {
|
|
1484
|
+
let f = !1;
|
|
1485
|
+
const S = new n(q.origin, {
|
|
1486
|
+
body: new gt(),
|
|
1487
|
+
method: "POST",
|
|
1488
|
+
get duplex() {
|
|
1489
|
+
return f = !0, "half";
|
|
1490
|
+
}
|
|
1491
|
+
}).headers.has("Content-Type");
|
|
1492
|
+
return f && !S;
|
|
1493
|
+
}), u = a && l && Ot(() => i.isReadableStream(new r("").body)), T = {
|
|
1494
|
+
stream: u && ((f) => f.body)
|
|
1495
|
+
};
|
|
1496
|
+
s && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((f) => {
|
|
1497
|
+
!T[f] && (T[f] = (S, h) => {
|
|
1498
|
+
let w = S && S[f];
|
|
1499
|
+
if (w)
|
|
1500
|
+
return w.call(S);
|
|
1501
|
+
throw new _(`Response type '${f}' is not supported`, _.ERR_NOT_SUPPORT, h);
|
|
1502
|
+
});
|
|
1503
|
+
});
|
|
1504
|
+
const x = async (f) => {
|
|
1505
|
+
if (f == null)
|
|
1506
|
+
return 0;
|
|
1507
|
+
if (i.isBlob(f))
|
|
1508
|
+
return f.size;
|
|
1509
|
+
if (i.isSpecCompliantForm(f))
|
|
1510
|
+
return (await new n(q.origin, {
|
|
1511
|
+
method: "POST",
|
|
1512
|
+
body: f
|
|
1513
|
+
}).arrayBuffer()).byteLength;
|
|
1514
|
+
if (i.isArrayBufferView(f) || i.isArrayBuffer(f))
|
|
1515
|
+
return f.byteLength;
|
|
1516
|
+
if (i.isURLSearchParams(f) && (f = f + ""), i.isString(f))
|
|
1517
|
+
return (await m(f)).byteLength;
|
|
1518
|
+
}, P = async (f, S) => {
|
|
1519
|
+
const h = i.toFiniteNumber(f.getContentLength());
|
|
1520
|
+
return h ?? x(S);
|
|
1521
|
+
};
|
|
1522
|
+
return async (f) => {
|
|
1523
|
+
let {
|
|
1524
|
+
url: S,
|
|
1525
|
+
method: h,
|
|
1526
|
+
data: w,
|
|
1527
|
+
signal: j,
|
|
1528
|
+
cancelToken: I,
|
|
1529
|
+
timeout: D,
|
|
1530
|
+
onDownloadProgress: F,
|
|
1531
|
+
onUploadProgress: V,
|
|
1532
|
+
responseType: U,
|
|
1533
|
+
headers: b,
|
|
1534
|
+
withCredentials: y = "same-origin",
|
|
1535
|
+
fetchOptions: g
|
|
1536
|
+
} = an(f), N = t || fetch;
|
|
1537
|
+
U = U ? (U + "").toLowerCase() : "text";
|
|
1538
|
+
let B = Jr([j, I && I.toAbortSignal()], D), L = null;
|
|
1539
|
+
const W = B && B.unsubscribe && (() => {
|
|
1540
|
+
B.unsubscribe();
|
|
1541
|
+
});
|
|
1542
|
+
let Q;
|
|
1543
|
+
try {
|
|
1544
|
+
if (V && d && h !== "get" && h !== "head" && (Q = await P(b, w)) !== 0) {
|
|
1545
|
+
let c = new n(S, {
|
|
1546
|
+
method: "POST",
|
|
1547
|
+
body: w,
|
|
1548
|
+
duplex: "half"
|
|
1549
|
+
}), A;
|
|
1550
|
+
if (i.isFormData(w) && (A = c.headers.get("content-type")) && b.setContentType(A), c.body) {
|
|
1551
|
+
const [p, R] = Tt(
|
|
1552
|
+
Q,
|
|
1553
|
+
Ue(Rt(V))
|
|
1554
|
+
);
|
|
1555
|
+
w = At(c.body, yt, p, R);
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
i.isString(y) || (y = y ? "include" : "omit");
|
|
1559
|
+
const G = o && "credentials" in n.prototype, ne = {
|
|
1560
|
+
...g,
|
|
1561
|
+
signal: B,
|
|
1562
|
+
method: h.toUpperCase(),
|
|
1563
|
+
headers: b.normalize().toJSON(),
|
|
1564
|
+
body: w,
|
|
1565
|
+
duplex: "half",
|
|
1566
|
+
credentials: G ? y : void 0
|
|
1567
|
+
};
|
|
1568
|
+
L = o && new n(S, ne);
|
|
1569
|
+
let X = await (o ? N(L, g) : N(S, ne));
|
|
1570
|
+
const le = u && (U === "stream" || U === "response");
|
|
1571
|
+
if (u && (F || le && W)) {
|
|
1572
|
+
const c = {};
|
|
1573
|
+
["status", "statusText", "headers"].forEach((C) => {
|
|
1574
|
+
c[C] = X[C];
|
|
1575
|
+
});
|
|
1576
|
+
const A = i.toFiniteNumber(X.headers.get("content-length")), [p, R] = F && Tt(
|
|
1577
|
+
A,
|
|
1578
|
+
Ue(Rt(F), !0)
|
|
1579
|
+
) || [];
|
|
1580
|
+
X = new r(
|
|
1581
|
+
At(X.body, yt, p, () => {
|
|
1582
|
+
R && R(), W && W();
|
|
1583
|
+
}),
|
|
1584
|
+
c
|
|
1585
|
+
);
|
|
1586
|
+
}
|
|
1587
|
+
U = U || "text";
|
|
1588
|
+
let ce = await T[i.findKey(T, U) || "text"](X, f);
|
|
1589
|
+
return !le && W && W(), await new Promise((c, A) => {
|
|
1590
|
+
sn(c, A, {
|
|
1591
|
+
data: ce,
|
|
1592
|
+
headers: z.from(X.headers),
|
|
1593
|
+
status: X.status,
|
|
1594
|
+
statusText: X.statusText,
|
|
1595
|
+
config: f,
|
|
1596
|
+
request: L
|
|
1597
|
+
});
|
|
1598
|
+
});
|
|
1599
|
+
} catch (G) {
|
|
1600
|
+
throw W && W(), G && G.name === "TypeError" && /Load failed|fetch/i.test(G.message) ? Object.assign(
|
|
1601
|
+
new _("Network Error", _.ERR_NETWORK, f, L),
|
|
1602
|
+
{
|
|
1603
|
+
cause: G.cause || G
|
|
1604
|
+
}
|
|
1605
|
+
) : _.from(G, G && G.code, f, L);
|
|
1606
|
+
}
|
|
1607
|
+
};
|
|
1608
|
+
}, ns = /* @__PURE__ */ new Map(), ln = (e) => {
|
|
1609
|
+
let t = e && e.env || {};
|
|
1610
|
+
const { fetch: n, Request: r, Response: s } = t, o = [
|
|
1611
|
+
r,
|
|
1612
|
+
s,
|
|
1613
|
+
n
|
|
1614
|
+
];
|
|
1615
|
+
let a = o.length, l = a, m, d, u = ns;
|
|
1616
|
+
for (; l--; )
|
|
1617
|
+
m = o[l], d = u.get(m), d === void 0 && u.set(m, d = l ? /* @__PURE__ */ new Map() : ts(t)), u = d;
|
|
1618
|
+
return d;
|
|
1619
|
+
};
|
|
1620
|
+
ln();
|
|
1621
|
+
const lt = {
|
|
1622
|
+
http: Sr,
|
|
1623
|
+
xhr: Xr,
|
|
1624
|
+
fetch: {
|
|
1625
|
+
get: ln
|
|
1626
|
+
}
|
|
1627
|
+
};
|
|
1628
|
+
i.forEach(lt, (e, t) => {
|
|
1629
|
+
if (e) {
|
|
1630
|
+
try {
|
|
1631
|
+
Object.defineProperty(e, "name", { value: t });
|
|
1632
|
+
} catch {
|
|
1633
|
+
}
|
|
1634
|
+
Object.defineProperty(e, "adapterName", { value: t });
|
|
1635
|
+
}
|
|
1636
|
+
});
|
|
1637
|
+
const _t = (e) => `- ${e}`, rs = (e) => i.isFunction(e) || e === null || e === !1;
|
|
1638
|
+
function ss(e, t) {
|
|
1639
|
+
e = i.isArray(e) ? e : [e];
|
|
1640
|
+
const { length: n } = e;
|
|
1641
|
+
let r, s;
|
|
1642
|
+
const o = {};
|
|
1643
|
+
for (let a = 0; a < n; a++) {
|
|
1644
|
+
r = e[a];
|
|
1645
|
+
let l;
|
|
1646
|
+
if (s = r, !rs(r) && (s = lt[(l = String(r)).toLowerCase()], s === void 0))
|
|
1647
|
+
throw new _(`Unknown adapter '${l}'`);
|
|
1648
|
+
if (s && (i.isFunction(s) || (s = s.get(t))))
|
|
1649
|
+
break;
|
|
1650
|
+
o[l || "#" + a] = s;
|
|
1651
|
+
}
|
|
1652
|
+
if (!s) {
|
|
1653
|
+
const a = Object.entries(o).map(
|
|
1654
|
+
([m, d]) => `adapter ${m} ` + (d === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
1655
|
+
);
|
|
1656
|
+
let l = n ? a.length > 1 ? `since :
|
|
1657
|
+
` + a.map(_t).join(`
|
|
1658
|
+
`) : " " + _t(a[0]) : "as no adapter specified";
|
|
1659
|
+
throw new _(
|
|
1660
|
+
"There is no suitable adapter to dispatch the request " + l,
|
|
1661
|
+
"ERR_NOT_SUPPORT"
|
|
1662
|
+
);
|
|
1663
|
+
}
|
|
1664
|
+
return s;
|
|
1665
|
+
}
|
|
1666
|
+
const cn = {
|
|
1667
|
+
/**
|
|
1668
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
1669
|
+
* @type {Function}
|
|
1670
|
+
*/
|
|
1671
|
+
getAdapter: ss,
|
|
1672
|
+
/**
|
|
1673
|
+
* Exposes all known adapters
|
|
1674
|
+
* @type {Object<string, Function|Object>}
|
|
1675
|
+
*/
|
|
1676
|
+
adapters: lt
|
|
1677
|
+
};
|
|
1678
|
+
function ze(e) {
|
|
1679
|
+
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
|
|
1680
|
+
throw new he(null, e);
|
|
1681
|
+
}
|
|
1682
|
+
function wt(e) {
|
|
1683
|
+
return ze(e), e.headers = z.from(e.headers), e.data = Ye.call(
|
|
1684
|
+
e,
|
|
1685
|
+
e.transformRequest
|
|
1686
|
+
), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), cn.getAdapter(e.adapter || Ce.adapter, e)(e).then(function(r) {
|
|
1687
|
+
return ze(e), r.data = Ye.call(
|
|
1688
|
+
e,
|
|
1689
|
+
e.transformResponse,
|
|
1690
|
+
r
|
|
1691
|
+
), r.headers = z.from(r.headers), r;
|
|
1692
|
+
}, function(r) {
|
|
1693
|
+
return rn(r) || (ze(e), r && r.response && (r.response.data = Ye.call(
|
|
1694
|
+
e,
|
|
1695
|
+
e.transformResponse,
|
|
1696
|
+
r.response
|
|
1697
|
+
), r.response.headers = z.from(r.response.headers))), Promise.reject(r);
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1700
|
+
const un = "1.13.2", Ge = {};
|
|
1701
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
|
|
1702
|
+
Ge[e] = function(r) {
|
|
1703
|
+
return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
|
|
1704
|
+
};
|
|
1705
|
+
});
|
|
1706
|
+
const xt = {};
|
|
1707
|
+
Ge.transitional = function(t, n, r) {
|
|
1708
|
+
function s(o, a) {
|
|
1709
|
+
return "[Axios v" + un + "] Transitional option '" + o + "'" + a + (r ? ". " + r : "");
|
|
1710
|
+
}
|
|
1711
|
+
return (o, a, l) => {
|
|
1712
|
+
if (t === !1)
|
|
1713
|
+
throw new _(
|
|
1714
|
+
s(a, " has been removed" + (n ? " in " + n : "")),
|
|
1715
|
+
_.ERR_DEPRECATED
|
|
1716
|
+
);
|
|
1717
|
+
return n && !xt[a] && (xt[a] = !0, console.warn(
|
|
1718
|
+
s(
|
|
1719
|
+
a,
|
|
1720
|
+
" has been deprecated since v" + n + " and will be removed in the near future"
|
|
1721
|
+
)
|
|
1722
|
+
)), t ? t(o, a, l) : !0;
|
|
1723
|
+
};
|
|
1724
|
+
};
|
|
1725
|
+
Ge.spelling = function(t) {
|
|
1726
|
+
return (n, r) => (console.warn(`${r} is likely a misspelling of ${t}`), !0);
|
|
1727
|
+
};
|
|
1728
|
+
function os(e, t, n) {
|
|
1729
|
+
if (typeof e != "object")
|
|
1730
|
+
throw new _("options must be an object", _.ERR_BAD_OPTION_VALUE);
|
|
1731
|
+
const r = Object.keys(e);
|
|
1732
|
+
let s = r.length;
|
|
1733
|
+
for (; s-- > 0; ) {
|
|
1734
|
+
const o = r[s], a = t[o];
|
|
1735
|
+
if (a) {
|
|
1736
|
+
const l = e[o], m = l === void 0 || a(l, o, e);
|
|
1737
|
+
if (m !== !0)
|
|
1738
|
+
throw new _("option " + o + " must be " + m, _.ERR_BAD_OPTION_VALUE);
|
|
1739
|
+
continue;
|
|
1740
|
+
}
|
|
1741
|
+
if (n !== !0)
|
|
1742
|
+
throw new _("Unknown option " + o, _.ERR_BAD_OPTION);
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
const ve = {
|
|
1746
|
+
assertOptions: os,
|
|
1747
|
+
validators: Ge
|
|
1748
|
+
}, te = ve.validators;
|
|
1749
|
+
let de = class {
|
|
1750
|
+
constructor(t) {
|
|
1751
|
+
this.defaults = t || {}, this.interceptors = {
|
|
1752
|
+
request: new mt(),
|
|
1753
|
+
response: new mt()
|
|
1754
|
+
};
|
|
1755
|
+
}
|
|
1756
|
+
/**
|
|
1757
|
+
* Dispatch a request
|
|
1758
|
+
*
|
|
1759
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
1760
|
+
* @param {?Object} config
|
|
1761
|
+
*
|
|
1762
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
1763
|
+
*/
|
|
1764
|
+
async request(t, n) {
|
|
1765
|
+
try {
|
|
1766
|
+
return await this._request(t, n);
|
|
1767
|
+
} catch (r) {
|
|
1768
|
+
if (r instanceof Error) {
|
|
1769
|
+
let s = {};
|
|
1770
|
+
Error.captureStackTrace ? Error.captureStackTrace(s) : s = new Error();
|
|
1771
|
+
const o = s.stack ? s.stack.replace(/^.+\n/, "") : "";
|
|
1772
|
+
try {
|
|
1773
|
+
r.stack ? o && !String(r.stack).endsWith(o.replace(/^.+\n.+\n/, "")) && (r.stack += `
|
|
1774
|
+
` + o) : r.stack = o;
|
|
1775
|
+
} catch {
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
throw r;
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
_request(t, n) {
|
|
1782
|
+
typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = fe(this.defaults, n);
|
|
1783
|
+
const { transitional: r, paramsSerializer: s, headers: o } = n;
|
|
1784
|
+
r !== void 0 && ve.assertOptions(r, {
|
|
1785
|
+
silentJSONParsing: te.transitional(te.boolean),
|
|
1786
|
+
forcedJSONParsing: te.transitional(te.boolean),
|
|
1787
|
+
clarifyTimeoutError: te.transitional(te.boolean)
|
|
1788
|
+
}, !1), s != null && (i.isFunction(s) ? n.paramsSerializer = {
|
|
1789
|
+
serialize: s
|
|
1790
|
+
} : ve.assertOptions(s, {
|
|
1791
|
+
encode: te.function,
|
|
1792
|
+
serialize: te.function
|
|
1793
|
+
}, !0)), n.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? n.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : n.allowAbsoluteUrls = !0), ve.assertOptions(n, {
|
|
1794
|
+
baseUrl: te.spelling("baseURL"),
|
|
1795
|
+
withXsrfToken: te.spelling("withXSRFToken")
|
|
1796
|
+
}, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
|
|
1797
|
+
let a = o && i.merge(
|
|
1798
|
+
o.common,
|
|
1799
|
+
o[n.method]
|
|
1800
|
+
);
|
|
1801
|
+
o && i.forEach(
|
|
1802
|
+
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
1803
|
+
(f) => {
|
|
1804
|
+
delete o[f];
|
|
1805
|
+
}
|
|
1806
|
+
), n.headers = z.concat(a, o);
|
|
1807
|
+
const l = [];
|
|
1808
|
+
let m = !0;
|
|
1809
|
+
this.interceptors.request.forEach(function(S) {
|
|
1810
|
+
typeof S.runWhen == "function" && S.runWhen(n) === !1 || (m = m && S.synchronous, l.unshift(S.fulfilled, S.rejected));
|
|
1811
|
+
});
|
|
1812
|
+
const d = [];
|
|
1813
|
+
this.interceptors.response.forEach(function(S) {
|
|
1814
|
+
d.push(S.fulfilled, S.rejected);
|
|
1815
|
+
});
|
|
1816
|
+
let u, T = 0, x;
|
|
1817
|
+
if (!m) {
|
|
1818
|
+
const f = [wt.bind(this), void 0];
|
|
1819
|
+
for (f.unshift(...l), f.push(...d), x = f.length, u = Promise.resolve(n); T < x; )
|
|
1820
|
+
u = u.then(f[T++], f[T++]);
|
|
1821
|
+
return u;
|
|
1822
|
+
}
|
|
1823
|
+
x = l.length;
|
|
1824
|
+
let P = n;
|
|
1825
|
+
for (; T < x; ) {
|
|
1826
|
+
const f = l[T++], S = l[T++];
|
|
1827
|
+
try {
|
|
1828
|
+
P = f(P);
|
|
1829
|
+
} catch (h) {
|
|
1830
|
+
S.call(this, h);
|
|
1831
|
+
break;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
try {
|
|
1835
|
+
u = wt.call(this, P);
|
|
1836
|
+
} catch (f) {
|
|
1837
|
+
return Promise.reject(f);
|
|
1838
|
+
}
|
|
1839
|
+
for (T = 0, x = d.length; T < x; )
|
|
1840
|
+
u = u.then(d[T++], d[T++]);
|
|
1841
|
+
return u;
|
|
1842
|
+
}
|
|
1843
|
+
getUri(t) {
|
|
1844
|
+
t = fe(this.defaults, t);
|
|
1845
|
+
const n = on(t.baseURL, t.url, t.allowAbsoluteUrls);
|
|
1846
|
+
return en(n, t.params, t.paramsSerializer);
|
|
1847
|
+
}
|
|
1848
|
+
};
|
|
1849
|
+
i.forEach(["delete", "get", "head", "options"], function(t) {
|
|
1850
|
+
de.prototype[t] = function(n, r) {
|
|
1851
|
+
return this.request(fe(r || {}, {
|
|
1852
|
+
method: t,
|
|
1853
|
+
url: n,
|
|
1854
|
+
data: (r || {}).data
|
|
1855
|
+
}));
|
|
1856
|
+
};
|
|
1857
|
+
});
|
|
1858
|
+
i.forEach(["post", "put", "patch"], function(t) {
|
|
1859
|
+
function n(r) {
|
|
1860
|
+
return function(o, a, l) {
|
|
1861
|
+
return this.request(fe(l || {}, {
|
|
1862
|
+
method: t,
|
|
1863
|
+
headers: r ? {
|
|
1864
|
+
"Content-Type": "multipart/form-data"
|
|
1865
|
+
} : {},
|
|
1866
|
+
url: o,
|
|
1867
|
+
data: a
|
|
1868
|
+
}));
|
|
1869
|
+
};
|
|
1870
|
+
}
|
|
1871
|
+
de.prototype[t] = n(), de.prototype[t + "Form"] = n(!0);
|
|
1872
|
+
});
|
|
1873
|
+
let as = class dn {
|
|
1874
|
+
constructor(t) {
|
|
1875
|
+
if (typeof t != "function")
|
|
1876
|
+
throw new TypeError("executor must be a function.");
|
|
1877
|
+
let n;
|
|
1878
|
+
this.promise = new Promise(function(o) {
|
|
1879
|
+
n = o;
|
|
1880
|
+
});
|
|
1881
|
+
const r = this;
|
|
1882
|
+
this.promise.then((s) => {
|
|
1883
|
+
if (!r._listeners) return;
|
|
1884
|
+
let o = r._listeners.length;
|
|
1885
|
+
for (; o-- > 0; )
|
|
1886
|
+
r._listeners[o](s);
|
|
1887
|
+
r._listeners = null;
|
|
1888
|
+
}), this.promise.then = (s) => {
|
|
1889
|
+
let o;
|
|
1890
|
+
const a = new Promise((l) => {
|
|
1891
|
+
r.subscribe(l), o = l;
|
|
1892
|
+
}).then(s);
|
|
1893
|
+
return a.cancel = function() {
|
|
1894
|
+
r.unsubscribe(o);
|
|
1895
|
+
}, a;
|
|
1896
|
+
}, t(function(o, a, l) {
|
|
1897
|
+
r.reason || (r.reason = new he(o, a, l), n(r.reason));
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1900
|
+
/**
|
|
1901
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
1902
|
+
*/
|
|
1903
|
+
throwIfRequested() {
|
|
1904
|
+
if (this.reason)
|
|
1905
|
+
throw this.reason;
|
|
1906
|
+
}
|
|
1907
|
+
/**
|
|
1908
|
+
* Subscribe to the cancel signal
|
|
1909
|
+
*/
|
|
1910
|
+
subscribe(t) {
|
|
1911
|
+
if (this.reason) {
|
|
1912
|
+
t(this.reason);
|
|
1913
|
+
return;
|
|
1914
|
+
}
|
|
1915
|
+
this._listeners ? this._listeners.push(t) : this._listeners = [t];
|
|
1916
|
+
}
|
|
1917
|
+
/**
|
|
1918
|
+
* Unsubscribe from the cancel signal
|
|
1919
|
+
*/
|
|
1920
|
+
unsubscribe(t) {
|
|
1921
|
+
if (!this._listeners)
|
|
1922
|
+
return;
|
|
1923
|
+
const n = this._listeners.indexOf(t);
|
|
1924
|
+
n !== -1 && this._listeners.splice(n, 1);
|
|
1925
|
+
}
|
|
1926
|
+
toAbortSignal() {
|
|
1927
|
+
const t = new AbortController(), n = (r) => {
|
|
1928
|
+
t.abort(r);
|
|
1929
|
+
};
|
|
1930
|
+
return this.subscribe(n), t.signal.unsubscribe = () => this.unsubscribe(n), t.signal;
|
|
1931
|
+
}
|
|
1932
|
+
/**
|
|
1933
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
1934
|
+
* cancels the `CancelToken`.
|
|
1935
|
+
*/
|
|
1936
|
+
static source() {
|
|
1937
|
+
let t;
|
|
1938
|
+
return {
|
|
1939
|
+
token: new dn(function(s) {
|
|
1940
|
+
t = s;
|
|
1941
|
+
}),
|
|
1942
|
+
cancel: t
|
|
1943
|
+
};
|
|
1944
|
+
}
|
|
1945
|
+
};
|
|
1946
|
+
function is(e) {
|
|
1947
|
+
return function(n) {
|
|
1948
|
+
return e.apply(null, n);
|
|
1949
|
+
};
|
|
1950
|
+
}
|
|
1951
|
+
function ls(e) {
|
|
1952
|
+
return i.isObject(e) && e.isAxiosError === !0;
|
|
1953
|
+
}
|
|
1954
|
+
const st = {
|
|
1955
|
+
Continue: 100,
|
|
1956
|
+
SwitchingProtocols: 101,
|
|
1957
|
+
Processing: 102,
|
|
1958
|
+
EarlyHints: 103,
|
|
1959
|
+
Ok: 200,
|
|
1960
|
+
Created: 201,
|
|
1961
|
+
Accepted: 202,
|
|
1962
|
+
NonAuthoritativeInformation: 203,
|
|
1963
|
+
NoContent: 204,
|
|
1964
|
+
ResetContent: 205,
|
|
1965
|
+
PartialContent: 206,
|
|
1966
|
+
MultiStatus: 207,
|
|
1967
|
+
AlreadyReported: 208,
|
|
1968
|
+
ImUsed: 226,
|
|
1969
|
+
MultipleChoices: 300,
|
|
1970
|
+
MovedPermanently: 301,
|
|
1971
|
+
Found: 302,
|
|
1972
|
+
SeeOther: 303,
|
|
1973
|
+
NotModified: 304,
|
|
1974
|
+
UseProxy: 305,
|
|
1975
|
+
Unused: 306,
|
|
1976
|
+
TemporaryRedirect: 307,
|
|
1977
|
+
PermanentRedirect: 308,
|
|
1978
|
+
BadRequest: 400,
|
|
1979
|
+
Unauthorized: 401,
|
|
1980
|
+
PaymentRequired: 402,
|
|
1981
|
+
Forbidden: 403,
|
|
1982
|
+
NotFound: 404,
|
|
1983
|
+
MethodNotAllowed: 405,
|
|
1984
|
+
NotAcceptable: 406,
|
|
1985
|
+
ProxyAuthenticationRequired: 407,
|
|
1986
|
+
RequestTimeout: 408,
|
|
1987
|
+
Conflict: 409,
|
|
1988
|
+
Gone: 410,
|
|
1989
|
+
LengthRequired: 411,
|
|
1990
|
+
PreconditionFailed: 412,
|
|
1991
|
+
PayloadTooLarge: 413,
|
|
1992
|
+
UriTooLong: 414,
|
|
1993
|
+
UnsupportedMediaType: 415,
|
|
1994
|
+
RangeNotSatisfiable: 416,
|
|
1995
|
+
ExpectationFailed: 417,
|
|
1996
|
+
ImATeapot: 418,
|
|
1997
|
+
MisdirectedRequest: 421,
|
|
1998
|
+
UnprocessableEntity: 422,
|
|
1999
|
+
Locked: 423,
|
|
2000
|
+
FailedDependency: 424,
|
|
2001
|
+
TooEarly: 425,
|
|
2002
|
+
UpgradeRequired: 426,
|
|
2003
|
+
PreconditionRequired: 428,
|
|
2004
|
+
TooManyRequests: 429,
|
|
2005
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
2006
|
+
UnavailableForLegalReasons: 451,
|
|
2007
|
+
InternalServerError: 500,
|
|
2008
|
+
NotImplemented: 501,
|
|
2009
|
+
BadGateway: 502,
|
|
2010
|
+
ServiceUnavailable: 503,
|
|
2011
|
+
GatewayTimeout: 504,
|
|
2012
|
+
HttpVersionNotSupported: 505,
|
|
2013
|
+
VariantAlsoNegotiates: 506,
|
|
2014
|
+
InsufficientStorage: 507,
|
|
2015
|
+
LoopDetected: 508,
|
|
2016
|
+
NotExtended: 510,
|
|
2017
|
+
NetworkAuthenticationRequired: 511,
|
|
2018
|
+
WebServerIsDown: 521,
|
|
2019
|
+
ConnectionTimedOut: 522,
|
|
2020
|
+
OriginIsUnreachable: 523,
|
|
2021
|
+
TimeoutOccurred: 524,
|
|
2022
|
+
SslHandshakeFailed: 525,
|
|
2023
|
+
InvalidSslCertificate: 526
|
|
2024
|
+
};
|
|
2025
|
+
Object.entries(st).forEach(([e, t]) => {
|
|
2026
|
+
st[t] = e;
|
|
2027
|
+
});
|
|
2028
|
+
function fn(e) {
|
|
2029
|
+
const t = new de(e), n = Ht(de.prototype.request, t);
|
|
2030
|
+
return i.extend(n, de.prototype, t, { allOwnKeys: !0 }), i.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
|
|
2031
|
+
return fn(fe(e, s));
|
|
2032
|
+
}, n;
|
|
2033
|
+
}
|
|
2034
|
+
const k = fn(Ce);
|
|
2035
|
+
k.Axios = de;
|
|
2036
|
+
k.CanceledError = he;
|
|
2037
|
+
k.CancelToken = as;
|
|
2038
|
+
k.isCancel = rn;
|
|
2039
|
+
k.VERSION = un;
|
|
2040
|
+
k.toFormData = Ve;
|
|
2041
|
+
k.AxiosError = _;
|
|
2042
|
+
k.Cancel = k.CanceledError;
|
|
2043
|
+
k.all = function(t) {
|
|
2044
|
+
return Promise.all(t);
|
|
2045
|
+
};
|
|
2046
|
+
k.spread = is;
|
|
2047
|
+
k.isAxiosError = ls;
|
|
2048
|
+
k.mergeConfig = fe;
|
|
2049
|
+
k.AxiosHeaders = z;
|
|
2050
|
+
k.formToJSON = (e) => nn(i.isHTMLForm(e) ? new FormData(e) : e);
|
|
2051
|
+
k.getAdapter = cn.getAdapter;
|
|
2052
|
+
k.HttpStatusCode = st;
|
|
2053
|
+
k.default = k;
|
|
2054
|
+
const {
|
|
2055
|
+
Axios: Fs,
|
|
2056
|
+
AxiosError: js,
|
|
2057
|
+
CanceledError: vs,
|
|
2058
|
+
isCancel: Ms,
|
|
2059
|
+
CancelToken: Us,
|
|
2060
|
+
VERSION: ks,
|
|
2061
|
+
all: Bs,
|
|
2062
|
+
Cancel: $s,
|
|
2063
|
+
isAxiosError: Hs,
|
|
2064
|
+
spread: Vs,
|
|
2065
|
+
toFormData: Gs,
|
|
2066
|
+
AxiosHeaders: Ws,
|
|
2067
|
+
HttpStatusCode: qs,
|
|
2068
|
+
formToJSON: Ys,
|
|
2069
|
+
getAdapter: zs,
|
|
2070
|
+
mergeConfig: Xs
|
|
2071
|
+
} = k, pn = () => {
|
|
2072
|
+
const { apiClient: e, apiEndpoints: t, apiService: n } = ke(), r = e || k.create();
|
|
2073
|
+
return n ? {
|
|
2074
|
+
...Ct(r, t),
|
|
2075
|
+
...n
|
|
2076
|
+
} : Ct(r, t);
|
|
2077
|
+
};
|
|
2078
|
+
function Ct(e, t) {
|
|
2079
|
+
return {
|
|
2080
|
+
getEntities: async () => {
|
|
2081
|
+
const n = await e.get(t.entities);
|
|
2082
|
+
return {
|
|
2083
|
+
data: n.data.data ?? n.data
|
|
2084
|
+
};
|
|
2085
|
+
},
|
|
2086
|
+
getMetadata: async (n) => {
|
|
2087
|
+
const r = await e.get(t.metadata(n));
|
|
2088
|
+
return {
|
|
2089
|
+
data: r.data.data ?? r.data
|
|
2090
|
+
};
|
|
2091
|
+
},
|
|
2092
|
+
getRecords: async (n, r) => {
|
|
2093
|
+
const s = await e.get(t.records(n), { params: r });
|
|
2094
|
+
return {
|
|
2095
|
+
data: s.data.data ?? s.data,
|
|
2096
|
+
total: s.data.total ?? s.data.count ?? 0
|
|
2097
|
+
};
|
|
2098
|
+
},
|
|
2099
|
+
getRecord: async (n, r) => {
|
|
2100
|
+
const s = await e.get(t.recordById(n, r));
|
|
2101
|
+
return {
|
|
2102
|
+
data: s.data.data ?? s.data
|
|
2103
|
+
};
|
|
2104
|
+
},
|
|
2105
|
+
createRecord: async (n, r) => {
|
|
2106
|
+
const s = await e.post(t.records(n), r);
|
|
2107
|
+
return {
|
|
2108
|
+
data: s.data.data ?? s.data
|
|
2109
|
+
};
|
|
2110
|
+
},
|
|
2111
|
+
updateRecord: async (n, r, s) => {
|
|
2112
|
+
const o = await e.put(t.recordById(n, r), s);
|
|
2113
|
+
return {
|
|
2114
|
+
data: o.data.data ?? o.data
|
|
2115
|
+
};
|
|
2116
|
+
},
|
|
2117
|
+
deleteRecord: async (n, r) => {
|
|
2118
|
+
const s = await e.delete(t.recordById(n, r));
|
|
2119
|
+
return {
|
|
2120
|
+
data: s.data.data ?? s.data
|
|
2121
|
+
};
|
|
2122
|
+
},
|
|
2123
|
+
exportCSV: async (n, r) => (await e.get(t.exportCSV(n), {
|
|
2124
|
+
params: r,
|
|
2125
|
+
responseType: "blob"
|
|
2126
|
+
})).data,
|
|
2127
|
+
exportExcel: async (n, r) => (await e.get(t.exportExcel(n), {
|
|
2128
|
+
params: r,
|
|
2129
|
+
responseType: "blob"
|
|
2130
|
+
})).data
|
|
2131
|
+
};
|
|
2132
|
+
}
|
|
2133
|
+
const cs = ie(M)(({ theme: e }) => ({
|
|
2134
|
+
width: "100%",
|
|
2135
|
+
fontFamily: e.typography.fontFamily
|
|
2136
|
+
})), Nt = ie("div")(({ theme: e }) => ({
|
|
2137
|
+
width: "100%",
|
|
2138
|
+
"& .ag-header": {
|
|
2139
|
+
borderRadius: "8px 8px 0 0"
|
|
2140
|
+
},
|
|
2141
|
+
"& .ag-theme-alpine": {
|
|
2142
|
+
fontFamily: e.typography.fontFamily
|
|
2143
|
+
},
|
|
2144
|
+
"& .ag-header-cell-text": {
|
|
2145
|
+
fontSize: "14px",
|
|
2146
|
+
fontWeight: 400,
|
|
2147
|
+
color: "#333"
|
|
2148
|
+
},
|
|
2149
|
+
"& .ag-cell": {
|
|
2150
|
+
fontSize: "14px",
|
|
2151
|
+
fontWeight: 400,
|
|
2152
|
+
color: "#000",
|
|
2153
|
+
padding: "12px 16px"
|
|
2154
|
+
},
|
|
2155
|
+
"& .right-aligned-cell": {
|
|
2156
|
+
textAlign: "right"
|
|
2157
|
+
},
|
|
2158
|
+
"& .right-aligned-clickable-cell": {
|
|
2159
|
+
textAlign: "right",
|
|
2160
|
+
cursor: "pointer",
|
|
2161
|
+
color: "#1976d2",
|
|
2162
|
+
textDecoration: "underline"
|
|
2163
|
+
},
|
|
2164
|
+
"& .ag-header-cell.right-aligned-header": {
|
|
2165
|
+
justifyContent: "flex-end"
|
|
2166
|
+
},
|
|
2167
|
+
"& .ag-header-cell.right-aligned-header .ag-header-cell-label": {
|
|
2168
|
+
justifyContent: "flex-end",
|
|
2169
|
+
display: "flex",
|
|
2170
|
+
width: "100%"
|
|
2171
|
+
},
|
|
2172
|
+
"& .ag-cell:focus, .ag-cell:focus-within": {
|
|
2173
|
+
border: "1px solid transparent !important"
|
|
2174
|
+
}
|
|
2175
|
+
}));
|
|
2176
|
+
ie(M)(() => ({
|
|
2177
|
+
position: "fixed",
|
|
2178
|
+
inset: 0,
|
|
2179
|
+
display: "flex",
|
|
2180
|
+
alignItems: "center",
|
|
2181
|
+
justifyContent: "center",
|
|
2182
|
+
zIndex: 1301,
|
|
2183
|
+
background: "rgba(255, 255, 255, 0.5)"
|
|
2184
|
+
}));
|
|
2185
|
+
const us = ie(M)(({ theme: e }) => ({
|
|
2186
|
+
display: "flex",
|
|
2187
|
+
justifyContent: "flex-end",
|
|
2188
|
+
marginTop: "16px",
|
|
2189
|
+
gap: "16px",
|
|
2190
|
+
[e.breakpoints.down("md")]: {
|
|
2191
|
+
flexWrap: "wrap",
|
|
2192
|
+
justifyContent: "center",
|
|
2193
|
+
gap: "12px"
|
|
2194
|
+
},
|
|
2195
|
+
[e.breakpoints.down("sm")]: {
|
|
2196
|
+
flexDirection: "column",
|
|
2197
|
+
alignItems: "center",
|
|
2198
|
+
gap: "16px"
|
|
2199
|
+
}
|
|
2200
|
+
})), ds = ie(yn)(() => ({
|
|
2201
|
+
fontSize: "14px",
|
|
2202
|
+
border: "none",
|
|
2203
|
+
boxShadow: "none",
|
|
2204
|
+
".MuiOutlinedInput-notchedOutline": {
|
|
2205
|
+
border: "none"
|
|
2206
|
+
},
|
|
2207
|
+
padding: "0px",
|
|
2208
|
+
"& .MuiSelect-icon": {
|
|
2209
|
+
right: 0
|
|
2210
|
+
},
|
|
2211
|
+
"& .MuiInputBase-input": {
|
|
2212
|
+
padding: 0,
|
|
2213
|
+
paddingLeft: "8px",
|
|
2214
|
+
paddingRight: "32px !important"
|
|
2215
|
+
}
|
|
2216
|
+
})), fs = ie(M)(
|
|
2217
|
+
({ height: e }) => ({
|
|
2218
|
+
...e !== void 0 && {
|
|
2219
|
+
height: `${e}px`
|
|
2220
|
+
},
|
|
2221
|
+
"&.ag-theme-alpine": {
|
|
2222
|
+
border: "none !important"
|
|
2223
|
+
},
|
|
2224
|
+
".ag-root-wrapper": {
|
|
2225
|
+
border: "none !important"
|
|
2226
|
+
},
|
|
2227
|
+
".ag-header": {
|
|
2228
|
+
borderBottom: "none !important",
|
|
2229
|
+
backgroundColor: "#f5f5f5"
|
|
2230
|
+
},
|
|
2231
|
+
".ag-body-viewport": {
|
|
2232
|
+
border: "none !important"
|
|
2233
|
+
},
|
|
2234
|
+
".ag-header-cell img[alt='sort']": {
|
|
2235
|
+
display: "none",
|
|
2236
|
+
opacity: 0,
|
|
2237
|
+
transition: "opacity 0.2s ease, visibility 0.2s ease"
|
|
2238
|
+
},
|
|
2239
|
+
".ag-header-cell:hover img[alt='sort']": {
|
|
2240
|
+
display: "block",
|
|
2241
|
+
opacity: 1
|
|
2242
|
+
},
|
|
2243
|
+
".ag-row.ag-row-pinned": {
|
|
2244
|
+
borderBottom: "2px solid #e0e0e0"
|
|
2245
|
+
},
|
|
2246
|
+
".ag-header-cell": {
|
|
2247
|
+
display: "flex",
|
|
2248
|
+
alignItems: "center",
|
|
2249
|
+
justifyContent: "space-between"
|
|
2250
|
+
}
|
|
2251
|
+
})
|
|
2252
|
+
), ps = ie(gn)(
|
|
2253
|
+
({ theme: e }) => ({
|
|
2254
|
+
display: "flex",
|
|
2255
|
+
flexDirection: "row",
|
|
2256
|
+
alignItems: "center",
|
|
2257
|
+
[e.breakpoints.down("sm")]: {
|
|
2258
|
+
flexWrap: "wrap",
|
|
2259
|
+
justifyContent: "center",
|
|
2260
|
+
gap: "8px"
|
|
2261
|
+
}
|
|
2262
|
+
})
|
|
2263
|
+
), It = ie(M)(({ theme: e }) => ({
|
|
2264
|
+
fontWeight: 300,
|
|
2265
|
+
fontSize: "14px",
|
|
2266
|
+
[e.breakpoints.down("sm")]: {
|
|
2267
|
+
fontSize: "12px"
|
|
2268
|
+
}
|
|
2269
|
+
})), Es = {
|
|
2270
|
+
DEFAULT_HEIGHT: 500,
|
|
2271
|
+
MIN_HEIGHT: 300,
|
|
2272
|
+
MAX_HEIGHT: 800,
|
|
2273
|
+
DEFAULT_ROW_HEIGHT: 50
|
|
2274
|
+
}, Js = {
|
|
2275
|
+
DEFAULT_PAGE: 1,
|
|
2276
|
+
DEFAULT_PAGE_SIZE: 10,
|
|
2277
|
+
PAGE_SIZE_OPTIONS: [10, 20, 50, 100],
|
|
2278
|
+
MIN_PAGE: 1
|
|
2279
|
+
}, Ks = {
|
|
2280
|
+
ASC: "asc",
|
|
2281
|
+
DESC: "desc"
|
|
2282
|
+
}, ms = {
|
|
2283
|
+
UI_COLUMN_SORTED: "uiColumnSorted",
|
|
2284
|
+
API: "api",
|
|
2285
|
+
COLUMN_MOVED: "columnMoved"
|
|
2286
|
+
}, Dt = {
|
|
2287
|
+
NORMAL: "normal",
|
|
2288
|
+
AUTO_HEIGHT: "autoHeight"
|
|
2289
|
+
}, En = {
|
|
2290
|
+
CLIENT_SIDE: "clientSide",
|
|
2291
|
+
SERVER_SIDE: "serverSide",
|
|
2292
|
+
INFINITE: "infinite",
|
|
2293
|
+
VIEWPORT: "viewport"
|
|
2294
|
+
}, Qs = {
|
|
2295
|
+
DEFAULT_FLEX: 1,
|
|
2296
|
+
ACTION_COLUMN_WIDTH: 150,
|
|
2297
|
+
SORTABLE: !0,
|
|
2298
|
+
FILTER: !1
|
|
2299
|
+
}, hs = {
|
|
2300
|
+
NO_DATA: "N/A",
|
|
2301
|
+
LOADING: "Loading...",
|
|
2302
|
+
NO_RECORDS: "No records found"
|
|
2303
|
+
}, Ts = {
|
|
2304
|
+
AG_THEME_ALPINE: "ag-theme-alpine",
|
|
2305
|
+
AG_THEME_BALHAM: "ag-theme-balham",
|
|
2306
|
+
AG_THEME_MATERIAL: "ag-theme-material"
|
|
2307
|
+
}, Rs = {
|
|
2308
|
+
URL_REVOKE: 100
|
|
2309
|
+
// milliseconds to wait before revoking blob URL
|
|
2310
|
+
};
|
|
2311
|
+
xn.registerModules([Bt, Cn]);
|
|
2312
|
+
const Ss = ({
|
|
2313
|
+
rows: e,
|
|
2314
|
+
totalRecords: t,
|
|
2315
|
+
currentPage: n,
|
|
2316
|
+
loading: r,
|
|
2317
|
+
onPageChange: s,
|
|
2318
|
+
columns: o,
|
|
2319
|
+
pageSize: a,
|
|
2320
|
+
pageSizeOptions: l,
|
|
2321
|
+
onPageSizeChange: m,
|
|
2322
|
+
setSort: d,
|
|
2323
|
+
sortModel: u,
|
|
2324
|
+
height: T = Es.DEFAULT_HEIGHT,
|
|
2325
|
+
domLayout: x = Dt.NORMAL,
|
|
2326
|
+
getRowHeight: P,
|
|
2327
|
+
pinnedBottomRowData: f,
|
|
2328
|
+
showLoader: S = !0,
|
|
2329
|
+
emptyDataMessage: h,
|
|
2330
|
+
...w
|
|
2331
|
+
}) => {
|
|
2332
|
+
const j = Ze(null), I = Ze([]), D = (F) => {
|
|
2333
|
+
if (F.source !== ms.UI_COLUMN_SORTED || (console.log("Sort Changed Event (User Initiated):", F), !d)) return;
|
|
2334
|
+
const V = F.api.getColumnState().filter((b) => b.sort).map((b) => ({
|
|
2335
|
+
colId: b.colId,
|
|
2336
|
+
sort: b.sort
|
|
2337
|
+
}));
|
|
2338
|
+
console.log("New Sort Model:", V), JSON.stringify(V) !== JSON.stringify(I.current) && (I.current = V, d(V));
|
|
2339
|
+
};
|
|
2340
|
+
return S && r ? /* @__PURE__ */ E.jsx(
|
|
2341
|
+
Nt,
|
|
2342
|
+
{
|
|
2343
|
+
style: {
|
|
2344
|
+
display: "flex",
|
|
2345
|
+
alignItems: "center",
|
|
2346
|
+
justifyContent: "center",
|
|
2347
|
+
height: T,
|
|
2348
|
+
minHeight: 120
|
|
2349
|
+
},
|
|
2350
|
+
children: /* @__PURE__ */ E.jsx(Pe, {})
|
|
2351
|
+
}
|
|
2352
|
+
) : /* @__PURE__ */ E.jsx(Nt, { "data-testid": "ServerSideGrid", className: Ts.AG_THEME_ALPINE, children: /* @__PURE__ */ E.jsxs(cs, { children: [
|
|
2353
|
+
/* @__PURE__ */ E.jsx(
|
|
2354
|
+
fs,
|
|
2355
|
+
{
|
|
2356
|
+
height: x === Dt.AUTO_HEIGHT ? void 0 : T,
|
|
2357
|
+
children: /* @__PURE__ */ E.jsx(
|
|
2358
|
+
wn,
|
|
2359
|
+
{
|
|
2360
|
+
ref: j,
|
|
2361
|
+
theme: "legacy",
|
|
2362
|
+
columnDefs: o,
|
|
2363
|
+
rowData: e,
|
|
2364
|
+
pinnedBottomRowData: f,
|
|
2365
|
+
domLayout: x,
|
|
2366
|
+
rowModelType: En.CLIENT_SIDE,
|
|
2367
|
+
modules: [Bt],
|
|
2368
|
+
localeText: {
|
|
2369
|
+
noRowsToShow: h || "No data to show"
|
|
2370
|
+
},
|
|
2371
|
+
...w,
|
|
2372
|
+
enableBrowserTooltips: !0,
|
|
2373
|
+
suppressMovableColumns: !0,
|
|
2374
|
+
suppressMenuHide: !0,
|
|
2375
|
+
onSortChanged: D,
|
|
2376
|
+
multiSortKey: "ctrl",
|
|
2377
|
+
alwaysMultiSort: !0,
|
|
2378
|
+
defaultColDef: {
|
|
2379
|
+
width: 170,
|
|
2380
|
+
sortable: !0,
|
|
2381
|
+
unSortIcon: !0,
|
|
2382
|
+
tooltipValueGetter: (F) => F.value ?? hs.NO_DATA
|
|
2383
|
+
},
|
|
2384
|
+
suppressRowTransform: !0,
|
|
2385
|
+
getRowHeight: P ?? (() => 54),
|
|
2386
|
+
maintainColumnOrder: !0,
|
|
2387
|
+
initialState: u && u.length > 0 ? {
|
|
2388
|
+
sort: {
|
|
2389
|
+
sortModel: u.map((F) => ({
|
|
2390
|
+
colId: F.colId,
|
|
2391
|
+
sort: F.sort
|
|
2392
|
+
}))
|
|
2393
|
+
}
|
|
2394
|
+
} : void 0
|
|
2395
|
+
}
|
|
2396
|
+
)
|
|
2397
|
+
}
|
|
2398
|
+
),
|
|
2399
|
+
t === 0 && /* @__PURE__ */ E.jsx(bn, {})
|
|
2400
|
+
] }) });
|
|
2401
|
+
}, As = ({
|
|
2402
|
+
totalRecords: e,
|
|
2403
|
+
currentPage: t,
|
|
2404
|
+
pageSize: n,
|
|
2405
|
+
onPageChange: r
|
|
2406
|
+
}) => {
|
|
2407
|
+
const s = Math.ceil(e / n);
|
|
2408
|
+
return /* @__PURE__ */ E.jsxs(M, { sx: { display: "flex", gap: 2, alignItems: "center" }, children: [
|
|
2409
|
+
/* @__PURE__ */ E.jsx(
|
|
2410
|
+
re,
|
|
2411
|
+
{
|
|
2412
|
+
size: "small",
|
|
2413
|
+
disabled: t === 1,
|
|
2414
|
+
onClick: () => r(t - 1),
|
|
2415
|
+
children: "Previous"
|
|
2416
|
+
}
|
|
2417
|
+
),
|
|
2418
|
+
/* @__PURE__ */ E.jsxs(pe, { variant: "body2", children: [
|
|
2419
|
+
"Page ",
|
|
2420
|
+
t,
|
|
2421
|
+
" of ",
|
|
2422
|
+
s || 1
|
|
2423
|
+
] }),
|
|
2424
|
+
/* @__PURE__ */ E.jsx(
|
|
2425
|
+
re,
|
|
2426
|
+
{
|
|
2427
|
+
size: "small",
|
|
2428
|
+
disabled: t >= s,
|
|
2429
|
+
onClick: () => r(t + 1),
|
|
2430
|
+
children: "Next"
|
|
2431
|
+
}
|
|
2432
|
+
)
|
|
2433
|
+
] });
|
|
2434
|
+
}, Me = {
|
|
2435
|
+
MASTER_DATA_MANAGEMENT: "Master Data Management",
|
|
2436
|
+
ADD_NEW_RECORD: "Add New Record",
|
|
2437
|
+
EDIT_RECORD: "Edit Record",
|
|
2438
|
+
VIEW_RECORD: "View Record"
|
|
2439
|
+
}, ae = {
|
|
2440
|
+
VIEW: "View",
|
|
2441
|
+
ADD_NEW_RECORD: "Add New Record",
|
|
2442
|
+
EDIT: "Edit",
|
|
2443
|
+
CREATE: "Create",
|
|
2444
|
+
UPDATE: "Update",
|
|
2445
|
+
CANCEL: "Cancel",
|
|
2446
|
+
BACK: "Back",
|
|
2447
|
+
EXPORT: "Export"
|
|
2448
|
+
}, Xe = {
|
|
2449
|
+
SELECT_ENTITY: "Select Entity",
|
|
2450
|
+
ACTIONS: "Actions",
|
|
2451
|
+
FROM: "From",
|
|
2452
|
+
TO: "To"
|
|
2453
|
+
}, ge = {
|
|
2454
|
+
SELECT_ENTITY: "Select Entity",
|
|
2455
|
+
SELECT: (e) => `Select ${e}`,
|
|
2456
|
+
FILTER_BY: (e) => `Filter by ${e}`
|
|
2457
|
+
}, Lt = {
|
|
2458
|
+
CSV: "CSV Format",
|
|
2459
|
+
EXCEL: "Excel Format"
|
|
2460
|
+
}, Pt = {
|
|
2461
|
+
CSV: "csv",
|
|
2462
|
+
EXCEL: "xlsx"
|
|
2463
|
+
}, oe = {
|
|
2464
|
+
FAILED_LOAD_ENTITIES: "Failed to load entities",
|
|
2465
|
+
FAILED_LOAD_METADATA: "Failed to load metadata",
|
|
2466
|
+
FAILED_LOAD_RECORD: "Failed to load record",
|
|
2467
|
+
FAILED_FETCH_LIST: "Failed to fetch list",
|
|
2468
|
+
FAILED_SAVE_RECORD: "Failed to save record. Please try again.",
|
|
2469
|
+
FAILED_EXPORT_CSV: "Failed to export CSV",
|
|
2470
|
+
FAILED_EXPORT_EXCEL: "Failed to export Excel",
|
|
2471
|
+
FAILED_LOAD_OPTIONS: (e) => `Failed to load options for ${e}`,
|
|
2472
|
+
FAILED_LOAD_FORM_CONFIG: "Failed to load form configuration",
|
|
2473
|
+
FIELD_REQUIRED: (e) => `${e} is required`,
|
|
2474
|
+
FIELD_MIN_VALUE: (e, t) => `${e} must be at least ${t}`,
|
|
2475
|
+
FIELD_MAX_VALUE: (e, t) => `${e} must be at most ${t}`
|
|
2476
|
+
}, Zs = {
|
|
2477
|
+
RECORD_CREATED: "Record created successfully",
|
|
2478
|
+
RECORD_UPDATED: "Record updated successfully",
|
|
2479
|
+
RECORD_DELETED: "Record deleted successfully"
|
|
2480
|
+
}, eo = {
|
|
2481
|
+
REQUIRED: "This field is required",
|
|
2482
|
+
INVALID_FORMAT: "Invalid format"
|
|
2483
|
+
}, to = {
|
|
2484
|
+
NO_DATA_AVAILABLE: "N/A",
|
|
2485
|
+
NO_RECORDS_FOUND: "No records found"
|
|
2486
|
+
}, no = {
|
|
2487
|
+
LOADING: "Loading...",
|
|
2488
|
+
PLEASE_WAIT: "Please wait..."
|
|
2489
|
+
}, Je = {
|
|
2490
|
+
SHOWING: "Showing",
|
|
2491
|
+
OF: "of",
|
|
2492
|
+
ENTRIES: "entries"
|
|
2493
|
+
}, ro = {
|
|
2494
|
+
MASTER_VIEW: "master-view",
|
|
2495
|
+
MASTER_FORM: "master-form",
|
|
2496
|
+
FILTER_SECTION: "filter-section",
|
|
2497
|
+
FORM_SECTION: "form-section",
|
|
2498
|
+
FILTERS: "filters",
|
|
2499
|
+
FILTER_FIELD: "filter-field",
|
|
2500
|
+
FORM_FIELD: "form-field",
|
|
2501
|
+
FIELD_LABEL: "field-label",
|
|
2502
|
+
FIELD_INPUT: "field-input",
|
|
2503
|
+
ACTION_BUTTONS: "action-buttons",
|
|
2504
|
+
FORM_FIELDS: "form-fields",
|
|
2505
|
+
LOADING_CONTAINER: "loading-container"
|
|
2506
|
+
}, so = {
|
|
2507
|
+
DEFAULT_TABLE_HEIGHT: 500,
|
|
2508
|
+
DEFAULT_PAGE_SIZE: 10,
|
|
2509
|
+
DEFAULT_COLUMN_WIDTH: 150,
|
|
2510
|
+
MIN_HEIGHT_LOADING: "400px",
|
|
2511
|
+
ACTION_BUTTON_GAP: 1,
|
|
2512
|
+
FORM_MARGIN_TOP: 3,
|
|
2513
|
+
FORM_MARGIN_BOTTOM: 2
|
|
2514
|
+
}, Ft = [10, 20, 50, 100], ys = " *", gs = "red", bs = "_display", oo = {
|
|
2515
|
+
ISO_DATE: "YYYY-MM-DD",
|
|
2516
|
+
DISPLAY_DATE: "DD/MM/YYYY",
|
|
2517
|
+
FILE_DATE: "YYYY-MM-DD"
|
|
2518
|
+
}, ao = {
|
|
2519
|
+
PAGE_SIZE: "Page size"
|
|
2520
|
+
}, io = {
|
|
2521
|
+
BASE_URL: "http://localhost:3000",
|
|
2522
|
+
TIMEOUT: 3e4,
|
|
2523
|
+
HEADERS: {
|
|
2524
|
+
CONTENT_TYPE: "application/json"
|
|
2525
|
+
}
|
|
2526
|
+
}, lo = {
|
|
2527
|
+
MASTER: "/master"
|
|
2528
|
+
}, co = {
|
|
2529
|
+
// Entity endpoints
|
|
2530
|
+
ENTITIES: "/master/entities",
|
|
2531
|
+
ENTITY_METADATA: (e) => `/master/${e}/metadata`,
|
|
2532
|
+
ENTITY_RECORDS: (e) => `/master/${e}/records`,
|
|
2533
|
+
ENTITY_RECORD_BY_ID: (e, t) => `/master/${e}/records/${t}`,
|
|
2534
|
+
ENTITY_OPTIONS: (e) => `/master/${e}/options`,
|
|
2535
|
+
// Export endpoints
|
|
2536
|
+
EXPORT_CSV: (e) => `/master/${e}/export/csv`,
|
|
2537
|
+
EXPORT_EXCEL: (e) => `/master/${e}/export/excel`
|
|
2538
|
+
}, uo = {
|
|
2539
|
+
GET: "GET",
|
|
2540
|
+
POST: "POST",
|
|
2541
|
+
PUT: "PUT",
|
|
2542
|
+
DELETE: "DELETE",
|
|
2543
|
+
PATCH: "PATCH"
|
|
2544
|
+
}, fo = {
|
|
2545
|
+
PAGE: "page",
|
|
2546
|
+
LIMIT: "limit",
|
|
2547
|
+
SEARCH: "search",
|
|
2548
|
+
SEARCH_BY: "searchBy",
|
|
2549
|
+
SORT_BY: "sortBy",
|
|
2550
|
+
SORT_ORDER: "sortOrder"
|
|
2551
|
+
}, jt = {
|
|
2552
|
+
ASC: "ASC",
|
|
2553
|
+
DESC: "DESC"
|
|
2554
|
+
}, po = {
|
|
2555
|
+
JSON: "json",
|
|
2556
|
+
BLOB: "blob",
|
|
2557
|
+
TEXT: "text"
|
|
2558
|
+
}, vt = {
|
|
2559
|
+
CSV: "text/csv;charset=utf-8;",
|
|
2560
|
+
EXCEL: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
2561
|
+
JSON: "application/json"
|
|
2562
|
+
}, Eo = {
|
|
2563
|
+
DATA: "data",
|
|
2564
|
+
COUNT: "count",
|
|
2565
|
+
MESSAGE: "message",
|
|
2566
|
+
ERROR: "error"
|
|
2567
|
+
}, K = {
|
|
2568
|
+
CREATE: "create",
|
|
2569
|
+
EDIT: "edit",
|
|
2570
|
+
VIEW: "view"
|
|
2571
|
+
}, Mt = {
|
|
2572
|
+
TEXT: "text",
|
|
2573
|
+
DROPDOWN: "dropdown",
|
|
2574
|
+
DATEPICKER: "datepicker",
|
|
2575
|
+
NUMBER: "number",
|
|
2576
|
+
TEXTAREA: "textarea",
|
|
2577
|
+
CHECKBOX: "checkbox",
|
|
2578
|
+
RADIO: "radio"
|
|
2579
|
+
}, Le = {
|
|
2580
|
+
STRING: "string",
|
|
2581
|
+
NUMBER: "number",
|
|
2582
|
+
FLOAT: "float",
|
|
2583
|
+
DATE: "date",
|
|
2584
|
+
DATERANGE: "daterange",
|
|
2585
|
+
BOOLEAN: "boolean",
|
|
2586
|
+
ARRAY: "array",
|
|
2587
|
+
OBJECT: "object"
|
|
2588
|
+
}, mo = {
|
|
2589
|
+
API: "API",
|
|
2590
|
+
RAW: "Raw",
|
|
2591
|
+
STATIC: "Static"
|
|
2592
|
+
}, ho = {
|
|
2593
|
+
ID: "id",
|
|
2594
|
+
NAME: "name",
|
|
2595
|
+
LABEL: "label",
|
|
2596
|
+
VALUE: "value",
|
|
2597
|
+
DISPLAY_NAME: "displayName",
|
|
2598
|
+
TABLE_NAME: "tableName"
|
|
2599
|
+
}, To = {
|
|
2600
|
+
REQUIRED: "required",
|
|
2601
|
+
MIN: "min",
|
|
2602
|
+
MAX: "max",
|
|
2603
|
+
MIN_LENGTH: "minLength",
|
|
2604
|
+
MAX_LENGTH: "maxLength",
|
|
2605
|
+
PATTERN: "pattern",
|
|
2606
|
+
EMAIL: "email",
|
|
2607
|
+
URL: "url"
|
|
2608
|
+
}, se = {
|
|
2609
|
+
FROM: "From",
|
|
2610
|
+
TO: "To"
|
|
2611
|
+
}, Ro = {
|
|
2612
|
+
TEXT: "text",
|
|
2613
|
+
NUMBER: "number",
|
|
2614
|
+
DATE: "date",
|
|
2615
|
+
EMAIL: "email",
|
|
2616
|
+
PASSWORD: "password",
|
|
2617
|
+
TEL: "tel",
|
|
2618
|
+
URL: "url"
|
|
2619
|
+
}, So = {
|
|
2620
|
+
FLOAT_STEP: 0.01,
|
|
2621
|
+
INTEGER_STEP: 1
|
|
2622
|
+
}, Ao = {
|
|
2623
|
+
ENTITY_MATCH: /\/master\/([^\/]+)\/options/
|
|
2624
|
+
}, Os = () => {
|
|
2625
|
+
const e = Ut(), { routes: t } = ke(), n = pn(), [r, s] = H([]), [o, a] = H(null), [l, m] = H([]), [d, u] = H({}), [T, x] = H([]), [P, f] = H([]), [S, h] = H(0), [w, j] = H(10), [I, D] = H(1), [F, V] = H(!1), [U, b] = H(!1), [y, g] = H({}), [N, B] = H([]), [L, W] = H(null), Q = Ze(!0);
|
|
2626
|
+
be(() => {
|
|
2627
|
+
(async () => {
|
|
2628
|
+
try {
|
|
2629
|
+
const $ = ((await n.getEntities()).data || []).map((O) => ({
|
|
2630
|
+
name: O.tableName || O.name,
|
|
2631
|
+
label: O.displayName || O.label
|
|
2632
|
+
}));
|
|
2633
|
+
s($), $.length > 0 && a($[0]);
|
|
2634
|
+
} catch (R) {
|
|
2635
|
+
console.error(oe.FAILED_LOAD_ENTITIES, R);
|
|
2636
|
+
}
|
|
2637
|
+
})();
|
|
2638
|
+
}, []), be(() => {
|
|
2639
|
+
if (!o) return;
|
|
2640
|
+
(async () => {
|
|
2641
|
+
try {
|
|
2642
|
+
const C = (await n.getMetadata(o.name)).data || {};
|
|
2643
|
+
m(C.parameterList || []), x(C.resultsList || []);
|
|
2644
|
+
const $ = {};
|
|
2645
|
+
(C.parameterList || []).forEach((v) => {
|
|
2646
|
+
$[v.name] = null;
|
|
2647
|
+
}), u($);
|
|
2648
|
+
const O = {};
|
|
2649
|
+
for (const v of C.parameterList || [])
|
|
2650
|
+
v.options && Array.isArray(v.options) && (O[v.name] = v.options);
|
|
2651
|
+
g(O), f([]), b(!1);
|
|
2652
|
+
} catch (R) {
|
|
2653
|
+
console.error(oe.FAILED_LOAD_METADATA, R);
|
|
2654
|
+
}
|
|
2655
|
+
})();
|
|
2656
|
+
}, [o]);
|
|
2657
|
+
const G = Oe(() => {
|
|
2658
|
+
const p = {}, R = [], C = [];
|
|
2659
|
+
l.forEach((O) => {
|
|
2660
|
+
if (O.dataType === Le.DATERANGE) {
|
|
2661
|
+
const J = d[`${O.name}${se.FROM}`], Ne = d[`${O.name}${se.TO}`];
|
|
2662
|
+
J && (p[`${O.name}${se.FROM}`] = J), Ne && (p[`${O.name}${se.TO}`] = Ne);
|
|
2663
|
+
return;
|
|
2664
|
+
}
|
|
2665
|
+
const v = d[O.name];
|
|
2666
|
+
v == null || v === "" || (O.options ? p[O.name] = v : (R.push(O.name), C.push(String(v).trim())));
|
|
2667
|
+
});
|
|
2668
|
+
const $ = {
|
|
2669
|
+
page: I,
|
|
2670
|
+
limit: w,
|
|
2671
|
+
filters: p
|
|
2672
|
+
};
|
|
2673
|
+
return R.length > 0 && ($.search = C.join(","), $.searchBy = R.join(",")), N.length > 0 && ($.sortBy = N.map((O) => O.colId).join(","), $.sortOrder = N.map((O) => O.sort === "desc" ? jt.DESC : jt.ASC).join(",")), $;
|
|
2674
|
+
}, [l, d, I, w, N]), ne = ye(async () => {
|
|
2675
|
+
if (!(!o || !Q.current)) {
|
|
2676
|
+
Q.current = !1, V(!0);
|
|
2677
|
+
try {
|
|
2678
|
+
console.log("Fetching with params:", G);
|
|
2679
|
+
const p = await n.getRecords(o.name, G), R = p.data || [], C = p.total || 0;
|
|
2680
|
+
f(R), h(C);
|
|
2681
|
+
} catch (p) {
|
|
2682
|
+
console.error(oe.FAILED_FETCH_LIST, p), f([]), h(0);
|
|
2683
|
+
} finally {
|
|
2684
|
+
V(!1), Q.current = !0;
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
}, [o, G]);
|
|
2688
|
+
be(() => {
|
|
2689
|
+
U && (I > 1 || N.length > 0) && ne();
|
|
2690
|
+
}, [I, w, N, U, ne]);
|
|
2691
|
+
const X = () => {
|
|
2692
|
+
D(1), b(!0), setTimeout(() => {
|
|
2693
|
+
Q.current = !0, ne();
|
|
2694
|
+
}, 0);
|
|
2695
|
+
}, le = (p) => {
|
|
2696
|
+
W(p.currentTarget);
|
|
2697
|
+
}, ce = () => {
|
|
2698
|
+
W(null);
|
|
2699
|
+
}, c = async (p) => {
|
|
2700
|
+
if (o)
|
|
2701
|
+
try {
|
|
2702
|
+
const R = p === "csv" ? await n.exportCSV(o.name, G) : await n.exportExcel(o.name, G), C = p === "csv" ? vt.CSV : vt.EXCEL, $ = p === "csv" ? Pt.CSV : Pt.EXCEL, O = new Blob([R.data], { type: C }), v = URL.createObjectURL(O), J = document.createElement("a");
|
|
2703
|
+
J.href = v, J.download = `${o.name}_${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.${$}`, J.style.visibility = "hidden", document.body.appendChild(J), J.click(), document.body.removeChild(J), setTimeout(() => URL.revokeObjectURL(v), Rs.URL_REVOKE);
|
|
2704
|
+
} catch (R) {
|
|
2705
|
+
console.error(`Failed to export ${p.toUpperCase()}:`, R);
|
|
2706
|
+
} finally {
|
|
2707
|
+
ce();
|
|
2708
|
+
}
|
|
2709
|
+
}, A = Oe(() => {
|
|
2710
|
+
const p = T.map((R) => ({
|
|
2711
|
+
field: R.name,
|
|
2712
|
+
headerName: R.label,
|
|
2713
|
+
sortable: !0,
|
|
2714
|
+
filter: !1,
|
|
2715
|
+
flex: 1
|
|
2716
|
+
}));
|
|
2717
|
+
return p.push({
|
|
2718
|
+
field: "actions",
|
|
2719
|
+
headerName: Xe.ACTIONS,
|
|
2720
|
+
sortable: !1,
|
|
2721
|
+
filter: !1,
|
|
2722
|
+
width: 150,
|
|
2723
|
+
cellRenderer: (R) => {
|
|
2724
|
+
const C = R.data;
|
|
2725
|
+
return !C || !o ? null : /* @__PURE__ */ E.jsx(M, { sx: { display: "flex", gap: 1, py: 1 }, children: /* @__PURE__ */ E.jsx(
|
|
2726
|
+
re,
|
|
2727
|
+
{
|
|
2728
|
+
size: "small",
|
|
2729
|
+
variant: "outlined",
|
|
2730
|
+
onClick: () => e(t.entityEdit(o.name, C.id)),
|
|
2731
|
+
children: ae.EDIT
|
|
2732
|
+
}
|
|
2733
|
+
) });
|
|
2734
|
+
}
|
|
2735
|
+
}), p;
|
|
2736
|
+
}, [T, o, e]);
|
|
2737
|
+
return /* @__PURE__ */ E.jsxs(M, { className: "master-view", children: [
|
|
2738
|
+
/* @__PURE__ */ E.jsxs(kt, { className: "filter-section", children: [
|
|
2739
|
+
/* @__PURE__ */ E.jsx(pe, { variant: "h5", gutterBottom: !0, children: Me.MASTER_DATA_MANAGEMENT }),
|
|
2740
|
+
/* @__PURE__ */ E.jsxs(M, { className: "filters", children: [
|
|
2741
|
+
/* @__PURE__ */ E.jsxs(M, { className: "filter-field", children: [
|
|
2742
|
+
/* @__PURE__ */ E.jsx(pe, { variant: "body2", className: "field-label", children: Xe.SELECT_ENTITY }),
|
|
2743
|
+
/* @__PURE__ */ E.jsx(
|
|
2744
|
+
et,
|
|
2745
|
+
{
|
|
2746
|
+
options: r,
|
|
2747
|
+
getOptionLabel: (p) => p.label,
|
|
2748
|
+
value: o,
|
|
2749
|
+
onChange: (p, R) => a(R),
|
|
2750
|
+
renderInput: (p) => /* @__PURE__ */ E.jsx(Z, { ...p, size: "small", placeholder: ge.SELECT_ENTITY }),
|
|
2751
|
+
className: "field-input"
|
|
2752
|
+
}
|
|
2753
|
+
)
|
|
2754
|
+
] }),
|
|
2755
|
+
l.filter((p) => p.name.toLowerCase() !== "id").map((p) => /* @__PURE__ */ E.jsxs(M, { className: "filter-field", children: [
|
|
2756
|
+
/* @__PURE__ */ E.jsx(pe, { variant: "body2", className: "field-label", children: p.label }),
|
|
2757
|
+
p.dataType === Le.DATERANGE ? /* @__PURE__ */ E.jsxs(M, { sx: { display: "flex", gap: 1, width: "100%" }, children: [
|
|
2758
|
+
/* @__PURE__ */ E.jsx(
|
|
2759
|
+
Z,
|
|
2760
|
+
{
|
|
2761
|
+
type: "date",
|
|
2762
|
+
size: "small",
|
|
2763
|
+
value: d[`${p.name}${se.FROM}`] || "",
|
|
2764
|
+
onChange: (R) => u((C) => ({ ...C, [`${p.name}${se.FROM}`]: R.target.value })),
|
|
2765
|
+
sx: { flex: 1 }
|
|
2766
|
+
}
|
|
2767
|
+
),
|
|
2768
|
+
/* @__PURE__ */ E.jsx(
|
|
2769
|
+
Z,
|
|
2770
|
+
{
|
|
2771
|
+
type: "date",
|
|
2772
|
+
size: "small",
|
|
2773
|
+
label: Xe.TO,
|
|
2774
|
+
value: d[`${p.name}${se.TO}`] || "",
|
|
2775
|
+
onChange: (R) => u((C) => ({ ...C, [`${p.name}${se.TO}`]: R.target.value })),
|
|
2776
|
+
sx: { flex: 1 }
|
|
2777
|
+
}
|
|
2778
|
+
)
|
|
2779
|
+
] }) : p.dataType === Le.DATE ? /* @__PURE__ */ E.jsx(
|
|
2780
|
+
Z,
|
|
2781
|
+
{
|
|
2782
|
+
type: "date",
|
|
2783
|
+
size: "small",
|
|
2784
|
+
value: d[p.name] || "",
|
|
2785
|
+
onChange: (R) => u((C) => ({ ...C, [p.name]: R.target.value })),
|
|
2786
|
+
className: "field-input"
|
|
2787
|
+
}
|
|
2788
|
+
) : p.options ? /* @__PURE__ */ E.jsx(
|
|
2789
|
+
et,
|
|
2790
|
+
{
|
|
2791
|
+
options: y[p.name] || p.options,
|
|
2792
|
+
getOptionLabel: (R) => R.label || String(R.value),
|
|
2793
|
+
value: y[p.name]?.find((R) => R.value === d[p.name]) || null,
|
|
2794
|
+
onChange: (R, C) => u(($) => ({ ...$, [p.name]: C?.value || null })),
|
|
2795
|
+
renderInput: (R) => /* @__PURE__ */ E.jsx(Z, { ...R, size: "small", placeholder: ge.SELECT(p.label) }),
|
|
2796
|
+
className: "field-input"
|
|
2797
|
+
}
|
|
2798
|
+
) : p.dataType === Le.NUMBER ? /* @__PURE__ */ E.jsx(
|
|
2799
|
+
Z,
|
|
2800
|
+
{
|
|
2801
|
+
type: "number",
|
|
2802
|
+
size: "small",
|
|
2803
|
+
value: d[p.name] || "",
|
|
2804
|
+
onChange: (R) => u((C) => ({ ...C, [p.name]: R.target.value })),
|
|
2805
|
+
placeholder: ge.FILTER_BY(p.label),
|
|
2806
|
+
className: "field-input"
|
|
2807
|
+
}
|
|
2808
|
+
) : /* @__PURE__ */ E.jsx(
|
|
2809
|
+
Z,
|
|
2810
|
+
{
|
|
2811
|
+
size: "small",
|
|
2812
|
+
value: d[p.name] || "",
|
|
2813
|
+
onChange: (R) => u((C) => ({ ...C, [p.name]: R.target.value })),
|
|
2814
|
+
placeholder: ge.FILTER_BY(p.label),
|
|
2815
|
+
className: "field-input"
|
|
2816
|
+
}
|
|
2817
|
+
)
|
|
2818
|
+
] }, p.name))
|
|
2819
|
+
] }),
|
|
2820
|
+
/* @__PURE__ */ E.jsxs(M, { className: "action-buttons", children: [
|
|
2821
|
+
/* @__PURE__ */ E.jsx(re, { variant: "contained", onClick: X, children: ae.VIEW }),
|
|
2822
|
+
/* @__PURE__ */ E.jsxs(
|
|
2823
|
+
re,
|
|
2824
|
+
{
|
|
2825
|
+
variant: "contained",
|
|
2826
|
+
disabled: !o,
|
|
2827
|
+
onClick: () => e(t.entityNew(o?.name || "")),
|
|
2828
|
+
children: [
|
|
2829
|
+
ae.ADD_NEW_RECORD,
|
|
2830
|
+
" seeeeee"
|
|
2831
|
+
]
|
|
2832
|
+
}
|
|
2833
|
+
)
|
|
2834
|
+
] })
|
|
2835
|
+
] }),
|
|
2836
|
+
U && /* @__PURE__ */ E.jsxs(M, { mt: 4, width: "100%", children: [
|
|
2837
|
+
/* @__PURE__ */ E.jsxs(M, { display: "flex", justifyContent: "flex-end", mb: 2, children: [
|
|
2838
|
+
/* @__PURE__ */ E.jsx(
|
|
2839
|
+
re,
|
|
2840
|
+
{
|
|
2841
|
+
variant: "outlined",
|
|
2842
|
+
onClick: le,
|
|
2843
|
+
disabled: !o,
|
|
2844
|
+
children: ae.EXPORT
|
|
2845
|
+
}
|
|
2846
|
+
),
|
|
2847
|
+
/* @__PURE__ */ E.jsxs(
|
|
2848
|
+
On,
|
|
2849
|
+
{
|
|
2850
|
+
anchorEl: L,
|
|
2851
|
+
open: !!L,
|
|
2852
|
+
onClose: ce,
|
|
2853
|
+
children: [
|
|
2854
|
+
/* @__PURE__ */ E.jsx(We, { onClick: () => c("csv"), children: Lt.CSV }),
|
|
2855
|
+
/* @__PURE__ */ E.jsx(We, { onClick: () => c("excel"), children: Lt.EXCEL })
|
|
2856
|
+
]
|
|
2857
|
+
}
|
|
2858
|
+
)
|
|
2859
|
+
] }),
|
|
2860
|
+
/* @__PURE__ */ E.jsx(
|
|
2861
|
+
Ss,
|
|
2862
|
+
{
|
|
2863
|
+
rows: P,
|
|
2864
|
+
columns: A,
|
|
2865
|
+
totalRecords: S,
|
|
2866
|
+
currentPage: I,
|
|
2867
|
+
loading: F,
|
|
2868
|
+
rowModelType: En.CLIENT_SIDE,
|
|
2869
|
+
onPageChange: D,
|
|
2870
|
+
pageSize: w,
|
|
2871
|
+
pageSizeOptions: [...Ft],
|
|
2872
|
+
onPageSizeChange: (p) => {
|
|
2873
|
+
j(p), D(1);
|
|
2874
|
+
},
|
|
2875
|
+
setSort: B,
|
|
2876
|
+
sortModel: N,
|
|
2877
|
+
height: 500
|
|
2878
|
+
},
|
|
2879
|
+
o?.name
|
|
2880
|
+
),
|
|
2881
|
+
/* @__PURE__ */ E.jsxs(us, { children: [
|
|
2882
|
+
/* @__PURE__ */ E.jsx(M, { display: "flex", alignItems: "center", gap: 1, children: /* @__PURE__ */ E.jsxs(ps, { variant: "outlined", size: "small", children: [
|
|
2883
|
+
/* @__PURE__ */ E.jsxs(It, { children: [
|
|
2884
|
+
Je.SHOWING,
|
|
2885
|
+
" "
|
|
2886
|
+
] }),
|
|
2887
|
+
/* @__PURE__ */ E.jsx(
|
|
2888
|
+
ds,
|
|
2889
|
+
{
|
|
2890
|
+
value: w,
|
|
2891
|
+
inputProps: { "aria-label": "Page size" },
|
|
2892
|
+
onChange: (p) => {
|
|
2893
|
+
j(Number(p.target.value)), D(1);
|
|
2894
|
+
},
|
|
2895
|
+
children: Ft.map((p) => /* @__PURE__ */ E.jsx(We, { value: p, children: p }, p))
|
|
2896
|
+
}
|
|
2897
|
+
),
|
|
2898
|
+
/* @__PURE__ */ E.jsxs(It, { children: [
|
|
2899
|
+
Je.OF,
|
|
2900
|
+
" ",
|
|
2901
|
+
S,
|
|
2902
|
+
" ",
|
|
2903
|
+
Je.ENTRIES
|
|
2904
|
+
] })
|
|
2905
|
+
] }) }),
|
|
2906
|
+
/* @__PURE__ */ E.jsx(
|
|
2907
|
+
As,
|
|
2908
|
+
{
|
|
2909
|
+
totalRecords: S,
|
|
2910
|
+
currentPage: I,
|
|
2911
|
+
onPageChange: D,
|
|
2912
|
+
pageSize: w
|
|
2913
|
+
}
|
|
2914
|
+
)
|
|
2915
|
+
] })
|
|
2916
|
+
] })
|
|
2917
|
+
] });
|
|
2918
|
+
}, yo = {
|
|
2919
|
+
ROOT: "/",
|
|
2920
|
+
MASTER: "/master",
|
|
2921
|
+
MASTER_ENTITY_NEW: (e) => `/master/${e}/new`,
|
|
2922
|
+
MASTER_ENTITY_VIEW: (e, t) => `/master/${e}/${t}`,
|
|
2923
|
+
MASTER_ENTITY_EDIT: (e, t) => `/master/${e}/${t}/edit`
|
|
2924
|
+
}, go = {
|
|
2925
|
+
ROOT: "/",
|
|
2926
|
+
MASTER: "/master",
|
|
2927
|
+
MASTER_ENTITY_NEW: "/master/:entity/new",
|
|
2928
|
+
MASTER_ENTITY_VIEW: "/master/:entity/:id",
|
|
2929
|
+
MASTER_ENTITY_EDIT: "/master/:entity/:id/edit"
|
|
2930
|
+
}, Ke = {
|
|
2931
|
+
NEW: "new",
|
|
2932
|
+
EDIT: "edit",
|
|
2933
|
+
VIEW: "view"
|
|
2934
|
+
}, bo = {
|
|
2935
|
+
ENTITY: "entity",
|
|
2936
|
+
ID: "id"
|
|
2937
|
+
}, _s = {
|
|
2938
|
+
NEW: "/new",
|
|
2939
|
+
EDIT: "/edit"
|
|
2940
|
+
}, Qe = () => {
|
|
2941
|
+
const e = Ut(), { entity: t, id: n } = Rn(), { routes: r } = ke(), s = pn(), o = Oe(() => n ? window.location.pathname.endsWith(_s.EDIT) ? K.EDIT : K.VIEW : K.CREATE, [n]), [a, l] = H({}), [m, d] = H({}), [u, T] = H(!1), [x, P] = H({}), [f, S] = H(!0), [h, w] = H(null), j = Oe(() => Object.keys(a), [a]), I = Oe(() => j.sort((b, y) => {
|
|
2942
|
+
const g = a[b], N = a[y];
|
|
2943
|
+
return g?.validation?.required && !N?.validation?.required ? -1 : !g?.validation?.required && N?.validation?.required ? 1 : b.localeCompare(y);
|
|
2944
|
+
}), [j, a]);
|
|
2945
|
+
be(() => {
|
|
2946
|
+
if (!t) return;
|
|
2947
|
+
let b = !0;
|
|
2948
|
+
return (async () => {
|
|
2949
|
+
S(!0), w(null);
|
|
2950
|
+
try {
|
|
2951
|
+
const g = await s.getMetadata(t);
|
|
2952
|
+
if (!b) return;
|
|
2953
|
+
const B = (g.data?.data || g.data || {}).formConfig || {};
|
|
2954
|
+
l(B), P({});
|
|
2955
|
+
} catch (g) {
|
|
2956
|
+
console.error(oe.FAILED_LOAD_METADATA, g), b && w(oe.FAILED_LOAD_FORM_CONFIG);
|
|
2957
|
+
} finally {
|
|
2958
|
+
b && S(!1);
|
|
2959
|
+
}
|
|
2960
|
+
})(), () => {
|
|
2961
|
+
b = !1;
|
|
2962
|
+
};
|
|
2963
|
+
}, [t, s]), be(() => {
|
|
2964
|
+
if (!t || !n || o === K.CREATE) {
|
|
2965
|
+
d({});
|
|
2966
|
+
return;
|
|
2967
|
+
}
|
|
2968
|
+
let b = !0;
|
|
2969
|
+
return (async () => {
|
|
2970
|
+
T(!0), w(null);
|
|
2971
|
+
try {
|
|
2972
|
+
const g = await s.getRecord(t, n);
|
|
2973
|
+
if (!b) return;
|
|
2974
|
+
const N = g.data || {}, B = {};
|
|
2975
|
+
for (const [L, W] of Object.entries(N))
|
|
2976
|
+
L.endsWith(bs) || (B[L] = W);
|
|
2977
|
+
d(B);
|
|
2978
|
+
} catch (g) {
|
|
2979
|
+
console.error(oe.FAILED_LOAD_RECORD, g), b && w(oe.FAILED_LOAD_RECORD);
|
|
2980
|
+
} finally {
|
|
2981
|
+
b && T(!1);
|
|
2982
|
+
}
|
|
2983
|
+
})(), () => {
|
|
2984
|
+
b = !1;
|
|
2985
|
+
};
|
|
2986
|
+
}, [t, n, o]);
|
|
2987
|
+
const D = ye((b, y) => {
|
|
2988
|
+
d((g) => ({ ...g, [b]: y }));
|
|
2989
|
+
}, []), F = ye(() => {
|
|
2990
|
+
const b = [];
|
|
2991
|
+
for (const [y, g] of Object.entries(a))
|
|
2992
|
+
g.validation?.required && !m[g.fieldName] && b.push(oe.FIELD_REQUIRED(y)), g.validation?.min !== void 0 && m[g.fieldName] < g.validation.min && b.push(`${y} must be at least ${g.validation.min}`), g.validation?.max !== void 0 && m[g.fieldName] > g.validation.max && b.push(`${y} must be at most ${g.validation.max}`);
|
|
2993
|
+
return b;
|
|
2994
|
+
}, [a, m]), V = ye(async () => {
|
|
2995
|
+
if (!t) return;
|
|
2996
|
+
const b = F();
|
|
2997
|
+
if (b.length > 0) {
|
|
2998
|
+
w(b.join(", "));
|
|
2999
|
+
return;
|
|
3000
|
+
}
|
|
3001
|
+
T(!0), w(null);
|
|
3002
|
+
try {
|
|
3003
|
+
const y = {};
|
|
3004
|
+
for (const g of Object.values(a)) {
|
|
3005
|
+
const N = g.fieldName;
|
|
3006
|
+
N && m[N] !== void 0 && m[N] !== "" && (y[N] = m[N]);
|
|
3007
|
+
}
|
|
3008
|
+
o === K.CREATE ? await s.createRecord(t, y) : n && await s.updateRecord(t, n, y), e(r.basePath, { replace: !0 });
|
|
3009
|
+
} catch (y) {
|
|
3010
|
+
console.error("Failed to save record:", y);
|
|
3011
|
+
const g = y?.response?.data?.message || "Failed to save record. Please try again.";
|
|
3012
|
+
w(g);
|
|
3013
|
+
} finally {
|
|
3014
|
+
T(!1);
|
|
3015
|
+
}
|
|
3016
|
+
}, [t, a, m, F, o, n, e]), U = ye((b) => {
|
|
3017
|
+
const y = a[b], g = y?.fieldName;
|
|
3018
|
+
if (!y || g === "id") return null;
|
|
3019
|
+
const N = m[g] ?? "", B = o === K.VIEW || u;
|
|
3020
|
+
return /* @__PURE__ */ E.jsxs(M, { className: "form-field", children: [
|
|
3021
|
+
/* @__PURE__ */ E.jsxs(pe, { variant: "body2", className: "field-label", children: [
|
|
3022
|
+
b,
|
|
3023
|
+
y.validation?.required && o !== K.VIEW && /* @__PURE__ */ E.jsx("span", { style: { color: gs }, children: ys })
|
|
3024
|
+
] }),
|
|
3025
|
+
y.fieldType === Mt.DROPDOWN ? /* @__PURE__ */ E.jsx(
|
|
3026
|
+
et,
|
|
3027
|
+
{
|
|
3028
|
+
options: x[g] || [],
|
|
3029
|
+
getOptionLabel: (L) => L.label || String(L.value),
|
|
3030
|
+
value: x[g]?.find((L) => L.value === N) || null,
|
|
3031
|
+
onChange: (L, W) => D(g, W?.value ?? null),
|
|
3032
|
+
disabled: B,
|
|
3033
|
+
renderInput: (L) => /* @__PURE__ */ E.jsx(
|
|
3034
|
+
Z,
|
|
3035
|
+
{
|
|
3036
|
+
...L,
|
|
3037
|
+
size: "small",
|
|
3038
|
+
placeholder: ge.SELECT(b),
|
|
3039
|
+
error: y.validation?.required && !N && o !== K.VIEW
|
|
3040
|
+
}
|
|
3041
|
+
),
|
|
3042
|
+
className: "field-input"
|
|
3043
|
+
}
|
|
3044
|
+
) : y.fieldType === Mt.DATEPICKER ? /* @__PURE__ */ E.jsx(
|
|
3045
|
+
Z,
|
|
3046
|
+
{
|
|
3047
|
+
type: "date",
|
|
3048
|
+
size: "small",
|
|
3049
|
+
value: N ? String(N).slice(0, 10) : "",
|
|
3050
|
+
onChange: (L) => D(g, L.target.value),
|
|
3051
|
+
disabled: B,
|
|
3052
|
+
error: y.validation?.required && !N && o !== "view",
|
|
3053
|
+
className: "field-input",
|
|
3054
|
+
InputLabelProps: { shrink: !0 }
|
|
3055
|
+
}
|
|
3056
|
+
) : y.dataType === "number" || y.dataType === "float" ? /* @__PURE__ */ E.jsx(
|
|
3057
|
+
Z,
|
|
3058
|
+
{
|
|
3059
|
+
type: "number",
|
|
3060
|
+
size: "small",
|
|
3061
|
+
value: N,
|
|
3062
|
+
onChange: (L) => D(g, L.target.value),
|
|
3063
|
+
disabled: B,
|
|
3064
|
+
placeholder: b,
|
|
3065
|
+
error: y.validation?.required && !N && o !== "view",
|
|
3066
|
+
inputProps: {
|
|
3067
|
+
max: y.validation?.max,
|
|
3068
|
+
min: y.validation?.min,
|
|
3069
|
+
step: y.dataType === "float" ? 0.01 : 1
|
|
3070
|
+
},
|
|
3071
|
+
className: "field-input"
|
|
3072
|
+
}
|
|
3073
|
+
) : /* @__PURE__ */ E.jsx(
|
|
3074
|
+
Z,
|
|
3075
|
+
{
|
|
3076
|
+
size: "small",
|
|
3077
|
+
value: N,
|
|
3078
|
+
onChange: (L) => D(g, L.target.value),
|
|
3079
|
+
disabled: B,
|
|
3080
|
+
placeholder: b,
|
|
3081
|
+
error: y.validation?.required && !N && o !== K.VIEW,
|
|
3082
|
+
inputProps: {
|
|
3083
|
+
maxLength: y.validation?.max
|
|
3084
|
+
},
|
|
3085
|
+
className: "field-input"
|
|
3086
|
+
}
|
|
3087
|
+
)
|
|
3088
|
+
] }, b);
|
|
3089
|
+
}, [a, m, x, D, o, u]);
|
|
3090
|
+
return f ? /* @__PURE__ */ E.jsx(M, { className: "loading-container", display: "flex", justifyContent: "center", alignItems: "center", minHeight: "400px", children: /* @__PURE__ */ E.jsx(Pe, {}) }) : /* @__PURE__ */ E.jsx(M, { className: "master-form", children: /* @__PURE__ */ E.jsxs(kt, { className: "form-section", children: [
|
|
3091
|
+
/* @__PURE__ */ E.jsxs(pe, { variant: "h5", gutterBottom: !0, children: [
|
|
3092
|
+
o === K.CREATE ? Me.ADD_NEW_RECORD : o === K.EDIT ? Me.EDIT_RECORD : Me.VIEW_RECORD,
|
|
3093
|
+
t && ` - ${t.charAt(0).toUpperCase() + t.slice(1)}`
|
|
3094
|
+
] }),
|
|
3095
|
+
h && /* @__PURE__ */ E.jsx(_n, { severity: "error", onClose: () => w(null), sx: { mb: 2 }, children: h }),
|
|
3096
|
+
u && o !== "view" && /* @__PURE__ */ E.jsx(M, { display: "flex", justifyContent: "center", my: 2, children: /* @__PURE__ */ E.jsx(Pe, { size: 24 }) }),
|
|
3097
|
+
/* @__PURE__ */ E.jsx(M, { className: "form-fields", children: I.map(U) }),
|
|
3098
|
+
/* @__PURE__ */ E.jsx(M, { className: "action-buttons", mt: 3, children: o !== K.VIEW ? /* @__PURE__ */ E.jsxs(E.Fragment, { children: [
|
|
3099
|
+
/* @__PURE__ */ E.jsx(
|
|
3100
|
+
re,
|
|
3101
|
+
{
|
|
3102
|
+
variant: "contained",
|
|
3103
|
+
onClick: V,
|
|
3104
|
+
disabled: u,
|
|
3105
|
+
children: u ? /* @__PURE__ */ E.jsx(Pe, { size: 24 }) : o === K.CREATE ? ae.CREATE : ae.UPDATE
|
|
3106
|
+
}
|
|
3107
|
+
),
|
|
3108
|
+
/* @__PURE__ */ E.jsx(
|
|
3109
|
+
re,
|
|
3110
|
+
{
|
|
3111
|
+
variant: "outlined",
|
|
3112
|
+
onClick: () => e(-1),
|
|
3113
|
+
disabled: u,
|
|
3114
|
+
children: ae.CANCEL
|
|
3115
|
+
}
|
|
3116
|
+
)
|
|
3117
|
+
] }) : /* @__PURE__ */ E.jsx(re, { variant: "outlined", onClick: () => e(-1), children: ae.BACK }) })
|
|
3118
|
+
] }) });
|
|
3119
|
+
}, Oo = () => {
|
|
3120
|
+
const { routes: e } = ke(), t = e.basePath;
|
|
3121
|
+
return /* @__PURE__ */ E.jsxs(Sn, { children: [
|
|
3122
|
+
/* @__PURE__ */ E.jsx(Te, { path: "/", element: /* @__PURE__ */ E.jsx(An, { to: t, replace: !0 }) }),
|
|
3123
|
+
/* @__PURE__ */ E.jsx(Te, { path: t, element: /* @__PURE__ */ E.jsx(Os, {}) }),
|
|
3124
|
+
/* @__PURE__ */ E.jsx(Te, { path: `${t}/:entity/new`, element: /* @__PURE__ */ E.jsx(Qe, {}, Ke.NEW) }),
|
|
3125
|
+
/* @__PURE__ */ E.jsx(Te, { path: `${t}/:entity/:id/edit`, element: /* @__PURE__ */ E.jsx(Qe, {}, Ke.EDIT) }),
|
|
3126
|
+
/* @__PURE__ */ E.jsx(Te, { path: `${t}/:entity/:id`, element: /* @__PURE__ */ E.jsx(Qe, {}, Ke.VIEW) })
|
|
3127
|
+
] });
|
|
3128
|
+
};
|
|
3129
|
+
export {
|
|
3130
|
+
lo as API_BASE_PATHS,
|
|
3131
|
+
io as API_CONFIG,
|
|
3132
|
+
co as API_ENDPOINTS,
|
|
3133
|
+
ao as ARIA_LABELS,
|
|
3134
|
+
Oo as AppRoutes,
|
|
3135
|
+
Oo as AppRoutesComponent,
|
|
3136
|
+
ae as BUTTON_LABELS,
|
|
3137
|
+
Qs as COLUMN_PROPERTIES,
|
|
3138
|
+
ro as CSS_CLASSES,
|
|
3139
|
+
Le as DATA_TYPES,
|
|
3140
|
+
oo as DATE_FORMATS,
|
|
3141
|
+
se as DATE_RANGE_SUFFIXES,
|
|
3142
|
+
bs as DISPLAY_FIELD_SUFFIX,
|
|
3143
|
+
to as EMPTY_STATE_MESSAGES,
|
|
3144
|
+
oe as ERROR_MESSAGES,
|
|
3145
|
+
Lt as EXPORT_OPTIONS,
|
|
3146
|
+
Xe as FIELD_LABELS,
|
|
3147
|
+
ho as FIELD_NAMES,
|
|
3148
|
+
Mt as FIELD_TYPES,
|
|
3149
|
+
Pt as FILE_EXTENSIONS,
|
|
3150
|
+
K as FORM_MODES,
|
|
3151
|
+
Ts as GRID_CSS_CLASSES,
|
|
3152
|
+
ms as GRID_EVENT_SOURCES,
|
|
3153
|
+
Dt as GRID_LAYOUT,
|
|
3154
|
+
hs as GRID_MESSAGES,
|
|
3155
|
+
Es as GRID_SETTINGS,
|
|
3156
|
+
Je as GRID_TEXT,
|
|
3157
|
+
Rs as GRID_TIMEOUTS,
|
|
3158
|
+
uo as HTTP_METHODS,
|
|
3159
|
+
Ro as INPUT_TYPES,
|
|
3160
|
+
no as LOADING_MESSAGES,
|
|
3161
|
+
vt as MIME_TYPES,
|
|
3162
|
+
Ds as MasterDataProvider,
|
|
3163
|
+
Qe as MasterForm,
|
|
3164
|
+
Qe as MasterFormComponent,
|
|
3165
|
+
Os as MasterView,
|
|
3166
|
+
Os as MasterViewComponent,
|
|
3167
|
+
So as NUMBER_INPUT,
|
|
3168
|
+
mo as OPTION_TYPES,
|
|
3169
|
+
Ft as PAGE_SIZE_OPTIONS,
|
|
3170
|
+
Me as PAGE_TITLES,
|
|
3171
|
+
Js as PAGINATION_SETTINGS,
|
|
3172
|
+
ge as PLACEHOLDERS,
|
|
3173
|
+
As as Pagination,
|
|
3174
|
+
fo as QUERY_PARAMS,
|
|
3175
|
+
Ao as REGEX_PATTERNS,
|
|
3176
|
+
ys as REQUIRED_INDICATOR,
|
|
3177
|
+
gs as REQUIRED_INDICATOR_COLOR,
|
|
3178
|
+
Eo as RESPONSE_KEYS,
|
|
3179
|
+
po as RESPONSE_TYPES,
|
|
3180
|
+
yo as ROUTES,
|
|
3181
|
+
Ke as ROUTE_KEYS,
|
|
3182
|
+
go as ROUTE_PATTERNS,
|
|
3183
|
+
_s as ROUTE_SUFFIXES,
|
|
3184
|
+
En as ROW_MODEL_TYPES,
|
|
3185
|
+
jt as SORT_ORDER,
|
|
3186
|
+
Ks as SORT_SETTINGS,
|
|
3187
|
+
so as STYLE_CONSTANTS,
|
|
3188
|
+
Zs as SUCCESS_MESSAGES,
|
|
3189
|
+
Ss as ServerSideGrid,
|
|
3190
|
+
bo as URL_PARAMS,
|
|
3191
|
+
eo as VALIDATION_MESSAGES,
|
|
3192
|
+
To as VALIDATION_RULES,
|
|
3193
|
+
pn as useApiService,
|
|
3194
|
+
ke as useMasterDataConfig
|
|
3195
|
+
};
|