notu 0.2.0 → 0.2.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/dist/notu.js +2060 -0
- package/dist/notu.umd.cjs +5 -0
- package/package.json +3 -1
- package/src/models/Tag.test.ts +62 -0
- package/src/models/Tag.ts +15 -0
package/dist/notu.js
ADDED
|
@@ -0,0 +1,2060 @@
|
|
|
1
|
+
var Kt = Object.defineProperty;
|
|
2
|
+
var Xt = (e, n, t) => n in e ? Kt(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
3
|
+
var h = (e, n, t) => (Xt(e, typeof n != "symbol" ? n + "" : n, t), t);
|
|
4
|
+
class I {
|
|
5
|
+
constructor() {
|
|
6
|
+
h(this, "state", "NEW");
|
|
7
|
+
}
|
|
8
|
+
new() {
|
|
9
|
+
return this.state = "NEW", this;
|
|
10
|
+
}
|
|
11
|
+
clean() {
|
|
12
|
+
return this.state = "CLEAN", this;
|
|
13
|
+
}
|
|
14
|
+
dirty() {
|
|
15
|
+
return this.state = "DIRTY", this;
|
|
16
|
+
}
|
|
17
|
+
delete() {
|
|
18
|
+
return this.state = "DELETED", this;
|
|
19
|
+
}
|
|
20
|
+
get isNew() {
|
|
21
|
+
return this.state == "NEW";
|
|
22
|
+
}
|
|
23
|
+
get isClean() {
|
|
24
|
+
return this.state == "CLEAN";
|
|
25
|
+
}
|
|
26
|
+
get isDirty() {
|
|
27
|
+
return this.state == "DIRTY";
|
|
28
|
+
}
|
|
29
|
+
get isDeleted() {
|
|
30
|
+
return this.state == "DELETED";
|
|
31
|
+
}
|
|
32
|
+
validate(n = !1) {
|
|
33
|
+
return !0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
class Rt extends I {
|
|
37
|
+
constructor() {
|
|
38
|
+
super(...arguments);
|
|
39
|
+
h(this, "id", 0);
|
|
40
|
+
h(this, "_name", "");
|
|
41
|
+
h(this, "_type", "TEXT");
|
|
42
|
+
h(this, "_spaceId", 0);
|
|
43
|
+
h(this, "_space", null);
|
|
44
|
+
}
|
|
45
|
+
get name() {
|
|
46
|
+
return this._name;
|
|
47
|
+
}
|
|
48
|
+
set name(t) {
|
|
49
|
+
t !== this._name && (this._name = t, this.isClean && this.dirty());
|
|
50
|
+
}
|
|
51
|
+
get type() {
|
|
52
|
+
return this._type;
|
|
53
|
+
}
|
|
54
|
+
set type(t) {
|
|
55
|
+
if (!this.isNew)
|
|
56
|
+
throw Error("Cannot change an attribute's type once it has been created.");
|
|
57
|
+
this._type = t;
|
|
58
|
+
}
|
|
59
|
+
get isText() {
|
|
60
|
+
return this.type == "TEXT";
|
|
61
|
+
}
|
|
62
|
+
get isNumber() {
|
|
63
|
+
return this.type == "NUMBER";
|
|
64
|
+
}
|
|
65
|
+
get isBoolean() {
|
|
66
|
+
return this.type == "BOOLEAN";
|
|
67
|
+
}
|
|
68
|
+
get isDate() {
|
|
69
|
+
return this.type == "DATE";
|
|
70
|
+
}
|
|
71
|
+
asText() {
|
|
72
|
+
return this.type = "TEXT", this;
|
|
73
|
+
}
|
|
74
|
+
asNumber() {
|
|
75
|
+
return this.type = "NUMBER", this;
|
|
76
|
+
}
|
|
77
|
+
asBoolean() {
|
|
78
|
+
return this.type = "BOOLEAN", this;
|
|
79
|
+
}
|
|
80
|
+
asDate() {
|
|
81
|
+
return this.type = "DATE", this;
|
|
82
|
+
}
|
|
83
|
+
get spaceId() {
|
|
84
|
+
return this._spaceId;
|
|
85
|
+
}
|
|
86
|
+
set spaceId(t) {
|
|
87
|
+
var s;
|
|
88
|
+
t !== this._spaceId && (this._spaceId = t, t !== ((s = this.space) == null ? void 0 : s.id) && (this._space = null), this.isClean && this.dirty());
|
|
89
|
+
}
|
|
90
|
+
get space() {
|
|
91
|
+
return this._space;
|
|
92
|
+
}
|
|
93
|
+
set space(t) {
|
|
94
|
+
this._space = t, this.spaceId = (t == null ? void 0 : t.id) ?? 0;
|
|
95
|
+
}
|
|
96
|
+
duplicate() {
|
|
97
|
+
const t = new Rt();
|
|
98
|
+
return t.id = this.id, t.name = this.name, t.type = this.type, t.space = this.space, t;
|
|
99
|
+
}
|
|
100
|
+
validate(t = !1) {
|
|
101
|
+
let s = null;
|
|
102
|
+
if (this.spaceId <= 0 ? s = "Note spaceId must be greater than zero." : !this.isNew && this.id <= 0 && (s = "Attr id must be greater than zero if in non-new state."), t && s != null)
|
|
103
|
+
throw Error(s);
|
|
104
|
+
return s == null;
|
|
105
|
+
}
|
|
106
|
+
get defaultValue() {
|
|
107
|
+
switch (this.type) {
|
|
108
|
+
case "TEXT":
|
|
109
|
+
return "";
|
|
110
|
+
case "NUMBER":
|
|
111
|
+
return 0;
|
|
112
|
+
case "BOOLEAN":
|
|
113
|
+
return !1;
|
|
114
|
+
case "DATE":
|
|
115
|
+
return /* @__PURE__ */ new Date();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
class gn {
|
|
120
|
+
constructor(n) {
|
|
121
|
+
h(this, "_client", null);
|
|
122
|
+
h(this, "_spaces", []);
|
|
123
|
+
if (!n)
|
|
124
|
+
throw Error("Client must be set on Environment constructor");
|
|
125
|
+
this._client = n;
|
|
126
|
+
}
|
|
127
|
+
get client() {
|
|
128
|
+
return this._client;
|
|
129
|
+
}
|
|
130
|
+
get spaces() {
|
|
131
|
+
return this._spaces;
|
|
132
|
+
}
|
|
133
|
+
async loadSpaces() {
|
|
134
|
+
return this._spaces = await this.client.getSpaces(), this.spaces;
|
|
135
|
+
}
|
|
136
|
+
async saveSpace(n) {
|
|
137
|
+
return await this.client.saveSpace(n);
|
|
138
|
+
}
|
|
139
|
+
async getNotes(n, t) {
|
|
140
|
+
return await this.client.getNotes(n, t);
|
|
141
|
+
}
|
|
142
|
+
async getNoteCount(n, t) {
|
|
143
|
+
return await this.client.getNoteCount(n, t);
|
|
144
|
+
}
|
|
145
|
+
async saveNote(n) {
|
|
146
|
+
return (await this.client.saveNotes([n]))[0];
|
|
147
|
+
}
|
|
148
|
+
async saveNotes(n) {
|
|
149
|
+
return await this.client.saveNotes(n);
|
|
150
|
+
}
|
|
151
|
+
async customJob(n, t) {
|
|
152
|
+
return await this.client.customJob(n, t);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function St(e, n) {
|
|
156
|
+
return function() {
|
|
157
|
+
return e.apply(n, arguments);
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
const { toString: Gt } = Object.prototype, { getPrototypeOf: et } = Object, H = ((e) => (n) => {
|
|
161
|
+
const t = Gt.call(n);
|
|
162
|
+
return e[t] || (e[t] = t.slice(8, -1).toLowerCase());
|
|
163
|
+
})(/* @__PURE__ */ Object.create(null)), T = (e) => (e = e.toLowerCase(), (n) => H(n) === e), M = (e) => (n) => typeof n === e, { isArray: C } = Array, D = M("undefined");
|
|
164
|
+
function Qt(e) {
|
|
165
|
+
return e !== null && !D(e) && e.constructor !== null && !D(e.constructor) && _(e.constructor.isBuffer) && e.constructor.isBuffer(e);
|
|
166
|
+
}
|
|
167
|
+
const Tt = T("ArrayBuffer");
|
|
168
|
+
function Yt(e) {
|
|
169
|
+
let n;
|
|
170
|
+
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? n = ArrayBuffer.isView(e) : n = e && e.buffer && Tt(e.buffer), n;
|
|
171
|
+
}
|
|
172
|
+
const Zt = M("string"), _ = M("function"), Ot = M("number"), J = (e) => e !== null && typeof e == "object", vt = (e) => e === !0 || e === !1, U = (e) => {
|
|
173
|
+
if (H(e) !== "object")
|
|
174
|
+
return !1;
|
|
175
|
+
const n = et(e);
|
|
176
|
+
return (n === null || n === Object.prototype || Object.getPrototypeOf(n) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
|
|
177
|
+
}, te = T("Date"), ee = T("File"), ne = T("Blob"), se = T("FileList"), re = (e) => J(e) && _(e.pipe), ie = (e) => {
|
|
178
|
+
let n;
|
|
179
|
+
return e && (typeof FormData == "function" && e instanceof FormData || _(e.append) && ((n = H(e)) === "formdata" || // detect form-data instance
|
|
180
|
+
n === "object" && _(e.toString) && e.toString() === "[object FormData]"));
|
|
181
|
+
}, oe = T("URLSearchParams"), ae = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
182
|
+
function B(e, n, { allOwnKeys: t = !1 } = {}) {
|
|
183
|
+
if (e === null || typeof e > "u")
|
|
184
|
+
return;
|
|
185
|
+
let s, r;
|
|
186
|
+
if (typeof e != "object" && (e = [e]), C(e))
|
|
187
|
+
for (s = 0, r = e.length; s < r; s++)
|
|
188
|
+
n.call(null, e[s], s, e);
|
|
189
|
+
else {
|
|
190
|
+
const i = t ? Object.getOwnPropertyNames(e) : Object.keys(e), o = i.length;
|
|
191
|
+
let c;
|
|
192
|
+
for (s = 0; s < o; s++)
|
|
193
|
+
c = i[s], n.call(null, e[c], c, e);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function At(e, n) {
|
|
197
|
+
n = n.toLowerCase();
|
|
198
|
+
const t = Object.keys(e);
|
|
199
|
+
let s = t.length, r;
|
|
200
|
+
for (; s-- > 0; )
|
|
201
|
+
if (r = t[s], n === r.toLowerCase())
|
|
202
|
+
return r;
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
const Nt = (() => typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global)(), xt = (e) => !D(e) && e !== Nt;
|
|
206
|
+
function G() {
|
|
207
|
+
const { caseless: e } = xt(this) && this || {}, n = {}, t = (s, r) => {
|
|
208
|
+
const i = e && At(n, r) || r;
|
|
209
|
+
U(n[i]) && U(s) ? n[i] = G(n[i], s) : U(s) ? n[i] = G({}, s) : C(s) ? n[i] = s.slice() : n[i] = s;
|
|
210
|
+
};
|
|
211
|
+
for (let s = 0, r = arguments.length; s < r; s++)
|
|
212
|
+
arguments[s] && B(arguments[s], t);
|
|
213
|
+
return n;
|
|
214
|
+
}
|
|
215
|
+
const ce = (e, n, t, { allOwnKeys: s } = {}) => (B(n, (r, i) => {
|
|
216
|
+
t && _(r) ? e[i] = St(r, t) : e[i] = r;
|
|
217
|
+
}, { allOwnKeys: s }), e), ue = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), le = (e, n, t, s) => {
|
|
218
|
+
e.prototype = Object.create(n.prototype, s), e.prototype.constructor = e, Object.defineProperty(e, "super", {
|
|
219
|
+
value: n.prototype
|
|
220
|
+
}), t && Object.assign(e.prototype, t);
|
|
221
|
+
}, de = (e, n, t, s) => {
|
|
222
|
+
let r, i, o;
|
|
223
|
+
const c = {};
|
|
224
|
+
if (n = n || {}, e == null)
|
|
225
|
+
return n;
|
|
226
|
+
do {
|
|
227
|
+
for (r = Object.getOwnPropertyNames(e), i = r.length; i-- > 0; )
|
|
228
|
+
o = r[i], (!s || s(o, e, n)) && !c[o] && (n[o] = e[o], c[o] = !0);
|
|
229
|
+
e = t !== !1 && et(e);
|
|
230
|
+
} while (e && (!t || t(e, n)) && e !== Object.prototype);
|
|
231
|
+
return n;
|
|
232
|
+
}, he = (e, n, t) => {
|
|
233
|
+
e = String(e), (t === void 0 || t > e.length) && (t = e.length), t -= n.length;
|
|
234
|
+
const s = e.indexOf(n, t);
|
|
235
|
+
return s !== -1 && s === t;
|
|
236
|
+
}, fe = (e) => {
|
|
237
|
+
if (!e)
|
|
238
|
+
return null;
|
|
239
|
+
if (C(e))
|
|
240
|
+
return e;
|
|
241
|
+
let n = e.length;
|
|
242
|
+
if (!Ot(n))
|
|
243
|
+
return null;
|
|
244
|
+
const t = new Array(n);
|
|
245
|
+
for (; n-- > 0; )
|
|
246
|
+
t[n] = e[n];
|
|
247
|
+
return t;
|
|
248
|
+
}, pe = ((e) => (n) => e && n instanceof e)(typeof Uint8Array < "u" && et(Uint8Array)), me = (e, n) => {
|
|
249
|
+
const s = (e && e[Symbol.iterator]).call(e);
|
|
250
|
+
let r;
|
|
251
|
+
for (; (r = s.next()) && !r.done; ) {
|
|
252
|
+
const i = r.value;
|
|
253
|
+
n.call(e, i[0], i[1]);
|
|
254
|
+
}
|
|
255
|
+
}, ge = (e, n) => {
|
|
256
|
+
let t;
|
|
257
|
+
const s = [];
|
|
258
|
+
for (; (t = e.exec(n)) !== null; )
|
|
259
|
+
s.push(t);
|
|
260
|
+
return s;
|
|
261
|
+
}, we = T("HTMLFormElement"), ye = (e) => e.toLowerCase().replace(
|
|
262
|
+
/[-_\s]([a-z\d])(\w*)/g,
|
|
263
|
+
function(t, s, r) {
|
|
264
|
+
return s.toUpperCase() + r;
|
|
265
|
+
}
|
|
266
|
+
), lt = (({ hasOwnProperty: e }) => (n, t) => e.call(n, t))(Object.prototype), Ee = T("RegExp"), It = (e, n) => {
|
|
267
|
+
const t = Object.getOwnPropertyDescriptors(e), s = {};
|
|
268
|
+
B(t, (r, i) => {
|
|
269
|
+
let o;
|
|
270
|
+
(o = n(r, i, e)) !== !1 && (s[i] = o || r);
|
|
271
|
+
}), Object.defineProperties(e, s);
|
|
272
|
+
}, be = (e) => {
|
|
273
|
+
It(e, (n, t) => {
|
|
274
|
+
if (_(e) && ["arguments", "caller", "callee"].indexOf(t) !== -1)
|
|
275
|
+
return !1;
|
|
276
|
+
const s = e[t];
|
|
277
|
+
if (_(s)) {
|
|
278
|
+
if (n.enumerable = !1, "writable" in n) {
|
|
279
|
+
n.writable = !1;
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
n.set || (n.set = () => {
|
|
283
|
+
throw Error("Can not rewrite read-only method '" + t + "'");
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
}, _e = (e, n) => {
|
|
288
|
+
const t = {}, s = (r) => {
|
|
289
|
+
r.forEach((i) => {
|
|
290
|
+
t[i] = !0;
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
return C(e) ? s(e) : s(String(e).split(n)), t;
|
|
294
|
+
}, Re = () => {
|
|
295
|
+
}, Se = (e, n) => (e = +e, Number.isFinite(e) ? e : n), V = "abcdefghijklmnopqrstuvwxyz", dt = "0123456789", Ct = {
|
|
296
|
+
DIGIT: dt,
|
|
297
|
+
ALPHA: V,
|
|
298
|
+
ALPHA_DIGIT: V + V.toUpperCase() + dt
|
|
299
|
+
}, Te = (e = 16, n = Ct.ALPHA_DIGIT) => {
|
|
300
|
+
let t = "";
|
|
301
|
+
const { length: s } = n;
|
|
302
|
+
for (; e--; )
|
|
303
|
+
t += n[Math.random() * s | 0];
|
|
304
|
+
return t;
|
|
305
|
+
};
|
|
306
|
+
function Oe(e) {
|
|
307
|
+
return !!(e && _(e.append) && e[Symbol.toStringTag] === "FormData" && e[Symbol.iterator]);
|
|
308
|
+
}
|
|
309
|
+
const Ae = (e) => {
|
|
310
|
+
const n = new Array(10), t = (s, r) => {
|
|
311
|
+
if (J(s)) {
|
|
312
|
+
if (n.indexOf(s) >= 0)
|
|
313
|
+
return;
|
|
314
|
+
if (!("toJSON" in s)) {
|
|
315
|
+
n[r] = s;
|
|
316
|
+
const i = C(s) ? [] : {};
|
|
317
|
+
return B(s, (o, c) => {
|
|
318
|
+
const d = t(o, r + 1);
|
|
319
|
+
!D(d) && (i[c] = d);
|
|
320
|
+
}), n[r] = void 0, i;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return s;
|
|
324
|
+
};
|
|
325
|
+
return t(e, 0);
|
|
326
|
+
}, Ne = T("AsyncFunction"), xe = (e) => e && (J(e) || _(e)) && _(e.then) && _(e.catch), a = {
|
|
327
|
+
isArray: C,
|
|
328
|
+
isArrayBuffer: Tt,
|
|
329
|
+
isBuffer: Qt,
|
|
330
|
+
isFormData: ie,
|
|
331
|
+
isArrayBufferView: Yt,
|
|
332
|
+
isString: Zt,
|
|
333
|
+
isNumber: Ot,
|
|
334
|
+
isBoolean: vt,
|
|
335
|
+
isObject: J,
|
|
336
|
+
isPlainObject: U,
|
|
337
|
+
isUndefined: D,
|
|
338
|
+
isDate: te,
|
|
339
|
+
isFile: ee,
|
|
340
|
+
isBlob: ne,
|
|
341
|
+
isRegExp: Ee,
|
|
342
|
+
isFunction: _,
|
|
343
|
+
isStream: re,
|
|
344
|
+
isURLSearchParams: oe,
|
|
345
|
+
isTypedArray: pe,
|
|
346
|
+
isFileList: se,
|
|
347
|
+
forEach: B,
|
|
348
|
+
merge: G,
|
|
349
|
+
extend: ce,
|
|
350
|
+
trim: ae,
|
|
351
|
+
stripBOM: ue,
|
|
352
|
+
inherits: le,
|
|
353
|
+
toFlatObject: de,
|
|
354
|
+
kindOf: H,
|
|
355
|
+
kindOfTest: T,
|
|
356
|
+
endsWith: he,
|
|
357
|
+
toArray: fe,
|
|
358
|
+
forEachEntry: me,
|
|
359
|
+
matchAll: ge,
|
|
360
|
+
isHTMLForm: we,
|
|
361
|
+
hasOwnProperty: lt,
|
|
362
|
+
hasOwnProp: lt,
|
|
363
|
+
// an alias to avoid ESLint no-prototype-builtins detection
|
|
364
|
+
reduceDescriptors: It,
|
|
365
|
+
freezeMethods: be,
|
|
366
|
+
toObjectSet: _e,
|
|
367
|
+
toCamelCase: ye,
|
|
368
|
+
noop: Re,
|
|
369
|
+
toFiniteNumber: Se,
|
|
370
|
+
findKey: At,
|
|
371
|
+
global: Nt,
|
|
372
|
+
isContextDefined: xt,
|
|
373
|
+
ALPHABET: Ct,
|
|
374
|
+
generateString: Te,
|
|
375
|
+
isSpecCompliantForm: Oe,
|
|
376
|
+
toJSONObject: Ae,
|
|
377
|
+
isAsyncFn: Ne,
|
|
378
|
+
isThenable: xe
|
|
379
|
+
};
|
|
380
|
+
function g(e, n, t, s, r) {
|
|
381
|
+
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", n && (this.code = n), t && (this.config = t), s && (this.request = s), r && (this.response = r);
|
|
382
|
+
}
|
|
383
|
+
a.inherits(g, Error, {
|
|
384
|
+
toJSON: function() {
|
|
385
|
+
return {
|
|
386
|
+
// Standard
|
|
387
|
+
message: this.message,
|
|
388
|
+
name: this.name,
|
|
389
|
+
// Microsoft
|
|
390
|
+
description: this.description,
|
|
391
|
+
number: this.number,
|
|
392
|
+
// Mozilla
|
|
393
|
+
fileName: this.fileName,
|
|
394
|
+
lineNumber: this.lineNumber,
|
|
395
|
+
columnNumber: this.columnNumber,
|
|
396
|
+
stack: this.stack,
|
|
397
|
+
// Axios
|
|
398
|
+
config: a.toJSONObject(this.config),
|
|
399
|
+
code: this.code,
|
|
400
|
+
status: this.response && this.response.status ? this.response.status : null
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
const Pt = g.prototype, Dt = {};
|
|
405
|
+
[
|
|
406
|
+
"ERR_BAD_OPTION_VALUE",
|
|
407
|
+
"ERR_BAD_OPTION",
|
|
408
|
+
"ECONNABORTED",
|
|
409
|
+
"ETIMEDOUT",
|
|
410
|
+
"ERR_NETWORK",
|
|
411
|
+
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
412
|
+
"ERR_DEPRECATED",
|
|
413
|
+
"ERR_BAD_RESPONSE",
|
|
414
|
+
"ERR_BAD_REQUEST",
|
|
415
|
+
"ERR_CANCELED",
|
|
416
|
+
"ERR_NOT_SUPPORT",
|
|
417
|
+
"ERR_INVALID_URL"
|
|
418
|
+
// eslint-disable-next-line func-names
|
|
419
|
+
].forEach((e) => {
|
|
420
|
+
Dt[e] = { value: e };
|
|
421
|
+
});
|
|
422
|
+
Object.defineProperties(g, Dt);
|
|
423
|
+
Object.defineProperty(Pt, "isAxiosError", { value: !0 });
|
|
424
|
+
g.from = (e, n, t, s, r, i) => {
|
|
425
|
+
const o = Object.create(Pt);
|
|
426
|
+
return a.toFlatObject(e, o, function(d) {
|
|
427
|
+
return d !== Error.prototype;
|
|
428
|
+
}, (c) => c !== "isAxiosError"), g.call(o, e.message, n, t, s, r), o.cause = e, o.name = e.name, i && Object.assign(o, i), o;
|
|
429
|
+
};
|
|
430
|
+
const Ie = null;
|
|
431
|
+
function Q(e) {
|
|
432
|
+
return a.isPlainObject(e) || a.isArray(e);
|
|
433
|
+
}
|
|
434
|
+
function Bt(e) {
|
|
435
|
+
return a.endsWith(e, "[]") ? e.slice(0, -2) : e;
|
|
436
|
+
}
|
|
437
|
+
function ht(e, n, t) {
|
|
438
|
+
return e ? e.concat(n).map(function(r, i) {
|
|
439
|
+
return r = Bt(r), !t && i ? "[" + r + "]" : r;
|
|
440
|
+
}).join(t ? "." : "") : n;
|
|
441
|
+
}
|
|
442
|
+
function Ce(e) {
|
|
443
|
+
return a.isArray(e) && !e.some(Q);
|
|
444
|
+
}
|
|
445
|
+
const Pe = a.toFlatObject(a, {}, null, function(n) {
|
|
446
|
+
return /^is[A-Z]/.test(n);
|
|
447
|
+
});
|
|
448
|
+
function q(e, n, t) {
|
|
449
|
+
if (!a.isObject(e))
|
|
450
|
+
throw new TypeError("target must be an object");
|
|
451
|
+
n = n || new FormData(), t = a.toFlatObject(t, {
|
|
452
|
+
metaTokens: !0,
|
|
453
|
+
dots: !1,
|
|
454
|
+
indexes: !1
|
|
455
|
+
}, !1, function(m, b) {
|
|
456
|
+
return !a.isUndefined(b[m]);
|
|
457
|
+
});
|
|
458
|
+
const s = t.metaTokens, r = t.visitor || u, i = t.dots, o = t.indexes, d = (t.Blob || typeof Blob < "u" && Blob) && a.isSpecCompliantForm(n);
|
|
459
|
+
if (!a.isFunction(r))
|
|
460
|
+
throw new TypeError("visitor must be a function");
|
|
461
|
+
function f(l) {
|
|
462
|
+
if (l === null)
|
|
463
|
+
return "";
|
|
464
|
+
if (a.isDate(l))
|
|
465
|
+
return l.toISOString();
|
|
466
|
+
if (!d && a.isBlob(l))
|
|
467
|
+
throw new g("Blob is not supported. Use a Buffer instead.");
|
|
468
|
+
return a.isArrayBuffer(l) || a.isTypedArray(l) ? d && typeof Blob == "function" ? new Blob([l]) : Buffer.from(l) : l;
|
|
469
|
+
}
|
|
470
|
+
function u(l, m, b) {
|
|
471
|
+
let O = l;
|
|
472
|
+
if (l && !b && typeof l == "object") {
|
|
473
|
+
if (a.endsWith(m, "{}"))
|
|
474
|
+
m = s ? m : m.slice(0, -2), l = JSON.stringify(l);
|
|
475
|
+
else if (a.isArray(l) && Ce(l) || (a.isFileList(l) || a.endsWith(m, "[]")) && (O = a.toArray(l)))
|
|
476
|
+
return m = Bt(m), O.forEach(function(L, Wt) {
|
|
477
|
+
!(a.isUndefined(L) || L === null) && n.append(
|
|
478
|
+
// eslint-disable-next-line no-nested-ternary
|
|
479
|
+
o === !0 ? ht([m], Wt, i) : o === null ? m : m + "[]",
|
|
480
|
+
f(L)
|
|
481
|
+
);
|
|
482
|
+
}), !1;
|
|
483
|
+
}
|
|
484
|
+
return Q(l) ? !0 : (n.append(ht(b, m, i), f(l)), !1);
|
|
485
|
+
}
|
|
486
|
+
const p = [], y = Object.assign(Pe, {
|
|
487
|
+
defaultVisitor: u,
|
|
488
|
+
convertValue: f,
|
|
489
|
+
isVisitable: Q
|
|
490
|
+
});
|
|
491
|
+
function E(l, m) {
|
|
492
|
+
if (!a.isUndefined(l)) {
|
|
493
|
+
if (p.indexOf(l) !== -1)
|
|
494
|
+
throw Error("Circular reference detected in " + m.join("."));
|
|
495
|
+
p.push(l), a.forEach(l, function(O, R) {
|
|
496
|
+
(!(a.isUndefined(O) || O === null) && r.call(
|
|
497
|
+
n,
|
|
498
|
+
O,
|
|
499
|
+
a.isString(R) ? R.trim() : R,
|
|
500
|
+
m,
|
|
501
|
+
y
|
|
502
|
+
)) === !0 && E(O, m ? m.concat(R) : [R]);
|
|
503
|
+
}), p.pop();
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
if (!a.isObject(e))
|
|
507
|
+
throw new TypeError("data must be an object");
|
|
508
|
+
return E(e), n;
|
|
509
|
+
}
|
|
510
|
+
function ft(e) {
|
|
511
|
+
const n = {
|
|
512
|
+
"!": "%21",
|
|
513
|
+
"'": "%27",
|
|
514
|
+
"(": "%28",
|
|
515
|
+
")": "%29",
|
|
516
|
+
"~": "%7E",
|
|
517
|
+
"%20": "+",
|
|
518
|
+
"%00": "\0"
|
|
519
|
+
};
|
|
520
|
+
return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(s) {
|
|
521
|
+
return n[s];
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
function nt(e, n) {
|
|
525
|
+
this._pairs = [], e && q(e, this, n);
|
|
526
|
+
}
|
|
527
|
+
const Ft = nt.prototype;
|
|
528
|
+
Ft.append = function(n, t) {
|
|
529
|
+
this._pairs.push([n, t]);
|
|
530
|
+
};
|
|
531
|
+
Ft.toString = function(n) {
|
|
532
|
+
const t = n ? function(s) {
|
|
533
|
+
return n.call(this, s, ft);
|
|
534
|
+
} : ft;
|
|
535
|
+
return this._pairs.map(function(r) {
|
|
536
|
+
return t(r[0]) + "=" + t(r[1]);
|
|
537
|
+
}, "").join("&");
|
|
538
|
+
};
|
|
539
|
+
function De(e) {
|
|
540
|
+
return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
541
|
+
}
|
|
542
|
+
function Lt(e, n, t) {
|
|
543
|
+
if (!n)
|
|
544
|
+
return e;
|
|
545
|
+
const s = t && t.encode || De, r = t && t.serialize;
|
|
546
|
+
let i;
|
|
547
|
+
if (r ? i = r(n, t) : i = a.isURLSearchParams(n) ? n.toString() : new nt(n, t).toString(s), i) {
|
|
548
|
+
const o = e.indexOf("#");
|
|
549
|
+
o !== -1 && (e = e.slice(0, o)), e += (e.indexOf("?") === -1 ? "?" : "&") + i;
|
|
550
|
+
}
|
|
551
|
+
return e;
|
|
552
|
+
}
|
|
553
|
+
class Be {
|
|
554
|
+
constructor() {
|
|
555
|
+
this.handlers = [];
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Add a new interceptor to the stack
|
|
559
|
+
*
|
|
560
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
561
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
562
|
+
*
|
|
563
|
+
* @return {Number} An ID used to remove interceptor later
|
|
564
|
+
*/
|
|
565
|
+
use(n, t, s) {
|
|
566
|
+
return this.handlers.push({
|
|
567
|
+
fulfilled: n,
|
|
568
|
+
rejected: t,
|
|
569
|
+
synchronous: s ? s.synchronous : !1,
|
|
570
|
+
runWhen: s ? s.runWhen : null
|
|
571
|
+
}), this.handlers.length - 1;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Remove an interceptor from the stack
|
|
575
|
+
*
|
|
576
|
+
* @param {Number} id The ID that was returned by `use`
|
|
577
|
+
*
|
|
578
|
+
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
579
|
+
*/
|
|
580
|
+
eject(n) {
|
|
581
|
+
this.handlers[n] && (this.handlers[n] = null);
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Clear all interceptors from the stack
|
|
585
|
+
*
|
|
586
|
+
* @returns {void}
|
|
587
|
+
*/
|
|
588
|
+
clear() {
|
|
589
|
+
this.handlers && (this.handlers = []);
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Iterate over all the registered interceptors
|
|
593
|
+
*
|
|
594
|
+
* This method is particularly useful for skipping over any
|
|
595
|
+
* interceptors that may have become `null` calling `eject`.
|
|
596
|
+
*
|
|
597
|
+
* @param {Function} fn The function to call for each interceptor
|
|
598
|
+
*
|
|
599
|
+
* @returns {void}
|
|
600
|
+
*/
|
|
601
|
+
forEach(n) {
|
|
602
|
+
a.forEach(this.handlers, function(s) {
|
|
603
|
+
s !== null && n(s);
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
const pt = Be, Ut = {
|
|
608
|
+
silentJSONParsing: !0,
|
|
609
|
+
forcedJSONParsing: !0,
|
|
610
|
+
clarifyTimeoutError: !1
|
|
611
|
+
}, Fe = typeof URLSearchParams < "u" ? URLSearchParams : nt, Le = typeof FormData < "u" ? FormData : null, Ue = typeof Blob < "u" ? Blob : null, ke = (() => {
|
|
612
|
+
let e;
|
|
613
|
+
return typeof navigator < "u" && ((e = navigator.product) === "ReactNative" || e === "NativeScript" || e === "NS") ? !1 : typeof window < "u" && typeof document < "u";
|
|
614
|
+
})(), je = (() => typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
615
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts == "function")(), S = {
|
|
616
|
+
isBrowser: !0,
|
|
617
|
+
classes: {
|
|
618
|
+
URLSearchParams: Fe,
|
|
619
|
+
FormData: Le,
|
|
620
|
+
Blob: Ue
|
|
621
|
+
},
|
|
622
|
+
isStandardBrowserEnv: ke,
|
|
623
|
+
isStandardBrowserWebWorkerEnv: je,
|
|
624
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
625
|
+
};
|
|
626
|
+
function ze(e, n) {
|
|
627
|
+
return q(e, new S.classes.URLSearchParams(), Object.assign({
|
|
628
|
+
visitor: function(t, s, r, i) {
|
|
629
|
+
return S.isNode && a.isBuffer(t) ? (this.append(s, t.toString("base64")), !1) : i.defaultVisitor.apply(this, arguments);
|
|
630
|
+
}
|
|
631
|
+
}, n));
|
|
632
|
+
}
|
|
633
|
+
function He(e) {
|
|
634
|
+
return a.matchAll(/\w+|\[(\w*)]/g, e).map((n) => n[0] === "[]" ? "" : n[1] || n[0]);
|
|
635
|
+
}
|
|
636
|
+
function Me(e) {
|
|
637
|
+
const n = {}, t = Object.keys(e);
|
|
638
|
+
let s;
|
|
639
|
+
const r = t.length;
|
|
640
|
+
let i;
|
|
641
|
+
for (s = 0; s < r; s++)
|
|
642
|
+
i = t[s], n[i] = e[i];
|
|
643
|
+
return n;
|
|
644
|
+
}
|
|
645
|
+
function kt(e) {
|
|
646
|
+
function n(t, s, r, i) {
|
|
647
|
+
let o = t[i++];
|
|
648
|
+
const c = Number.isFinite(+o), d = i >= t.length;
|
|
649
|
+
return o = !o && a.isArray(r) ? r.length : o, d ? (a.hasOwnProp(r, o) ? r[o] = [r[o], s] : r[o] = s, !c) : ((!r[o] || !a.isObject(r[o])) && (r[o] = []), n(t, s, r[o], i) && a.isArray(r[o]) && (r[o] = Me(r[o])), !c);
|
|
650
|
+
}
|
|
651
|
+
if (a.isFormData(e) && a.isFunction(e.entries)) {
|
|
652
|
+
const t = {};
|
|
653
|
+
return a.forEachEntry(e, (s, r) => {
|
|
654
|
+
n(He(s), r, t, 0);
|
|
655
|
+
}), t;
|
|
656
|
+
}
|
|
657
|
+
return null;
|
|
658
|
+
}
|
|
659
|
+
function Je(e, n, t) {
|
|
660
|
+
if (a.isString(e))
|
|
661
|
+
try {
|
|
662
|
+
return (n || JSON.parse)(e), a.trim(e);
|
|
663
|
+
} catch (s) {
|
|
664
|
+
if (s.name !== "SyntaxError")
|
|
665
|
+
throw s;
|
|
666
|
+
}
|
|
667
|
+
return (t || JSON.stringify)(e);
|
|
668
|
+
}
|
|
669
|
+
const st = {
|
|
670
|
+
transitional: Ut,
|
|
671
|
+
adapter: ["xhr", "http"],
|
|
672
|
+
transformRequest: [function(n, t) {
|
|
673
|
+
const s = t.getContentType() || "", r = s.indexOf("application/json") > -1, i = a.isObject(n);
|
|
674
|
+
if (i && a.isHTMLForm(n) && (n = new FormData(n)), a.isFormData(n))
|
|
675
|
+
return r && r ? JSON.stringify(kt(n)) : n;
|
|
676
|
+
if (a.isArrayBuffer(n) || a.isBuffer(n) || a.isStream(n) || a.isFile(n) || a.isBlob(n))
|
|
677
|
+
return n;
|
|
678
|
+
if (a.isArrayBufferView(n))
|
|
679
|
+
return n.buffer;
|
|
680
|
+
if (a.isURLSearchParams(n))
|
|
681
|
+
return t.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), n.toString();
|
|
682
|
+
let c;
|
|
683
|
+
if (i) {
|
|
684
|
+
if (s.indexOf("application/x-www-form-urlencoded") > -1)
|
|
685
|
+
return ze(n, this.formSerializer).toString();
|
|
686
|
+
if ((c = a.isFileList(n)) || s.indexOf("multipart/form-data") > -1) {
|
|
687
|
+
const d = this.env && this.env.FormData;
|
|
688
|
+
return q(
|
|
689
|
+
c ? { "files[]": n } : n,
|
|
690
|
+
d && new d(),
|
|
691
|
+
this.formSerializer
|
|
692
|
+
);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
return i || r ? (t.setContentType("application/json", !1), Je(n)) : n;
|
|
696
|
+
}],
|
|
697
|
+
transformResponse: [function(n) {
|
|
698
|
+
const t = this.transitional || st.transitional, s = t && t.forcedJSONParsing, r = this.responseType === "json";
|
|
699
|
+
if (n && a.isString(n) && (s && !this.responseType || r)) {
|
|
700
|
+
const o = !(t && t.silentJSONParsing) && r;
|
|
701
|
+
try {
|
|
702
|
+
return JSON.parse(n);
|
|
703
|
+
} catch (c) {
|
|
704
|
+
if (o)
|
|
705
|
+
throw c.name === "SyntaxError" ? g.from(c, g.ERR_BAD_RESPONSE, this, null, this.response) : c;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
return n;
|
|
709
|
+
}],
|
|
710
|
+
/**
|
|
711
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
712
|
+
* timeout is not created.
|
|
713
|
+
*/
|
|
714
|
+
timeout: 0,
|
|
715
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
716
|
+
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
717
|
+
maxContentLength: -1,
|
|
718
|
+
maxBodyLength: -1,
|
|
719
|
+
env: {
|
|
720
|
+
FormData: S.classes.FormData,
|
|
721
|
+
Blob: S.classes.Blob
|
|
722
|
+
},
|
|
723
|
+
validateStatus: function(n) {
|
|
724
|
+
return n >= 200 && n < 300;
|
|
725
|
+
},
|
|
726
|
+
headers: {
|
|
727
|
+
common: {
|
|
728
|
+
Accept: "application/json, text/plain, */*",
|
|
729
|
+
"Content-Type": void 0
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
a.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
|
|
734
|
+
st.headers[e] = {};
|
|
735
|
+
});
|
|
736
|
+
const rt = st, qe = a.toObjectSet([
|
|
737
|
+
"age",
|
|
738
|
+
"authorization",
|
|
739
|
+
"content-length",
|
|
740
|
+
"content-type",
|
|
741
|
+
"etag",
|
|
742
|
+
"expires",
|
|
743
|
+
"from",
|
|
744
|
+
"host",
|
|
745
|
+
"if-modified-since",
|
|
746
|
+
"if-unmodified-since",
|
|
747
|
+
"last-modified",
|
|
748
|
+
"location",
|
|
749
|
+
"max-forwards",
|
|
750
|
+
"proxy-authorization",
|
|
751
|
+
"referer",
|
|
752
|
+
"retry-after",
|
|
753
|
+
"user-agent"
|
|
754
|
+
]), $e = (e) => {
|
|
755
|
+
const n = {};
|
|
756
|
+
let t, s, r;
|
|
757
|
+
return e && e.split(`
|
|
758
|
+
`).forEach(function(o) {
|
|
759
|
+
r = o.indexOf(":"), t = o.substring(0, r).trim().toLowerCase(), s = o.substring(r + 1).trim(), !(!t || n[t] && qe[t]) && (t === "set-cookie" ? n[t] ? n[t].push(s) : n[t] = [s] : n[t] = n[t] ? n[t] + ", " + s : s);
|
|
760
|
+
}), n;
|
|
761
|
+
}, mt = Symbol("internals");
|
|
762
|
+
function P(e) {
|
|
763
|
+
return e && String(e).trim().toLowerCase();
|
|
764
|
+
}
|
|
765
|
+
function k(e) {
|
|
766
|
+
return e === !1 || e == null ? e : a.isArray(e) ? e.map(k) : String(e);
|
|
767
|
+
}
|
|
768
|
+
function Ve(e) {
|
|
769
|
+
const n = /* @__PURE__ */ Object.create(null), t = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
770
|
+
let s;
|
|
771
|
+
for (; s = t.exec(e); )
|
|
772
|
+
n[s[1]] = s[2];
|
|
773
|
+
return n;
|
|
774
|
+
}
|
|
775
|
+
const We = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
|
|
776
|
+
function W(e, n, t, s, r) {
|
|
777
|
+
if (a.isFunction(s))
|
|
778
|
+
return s.call(this, n, t);
|
|
779
|
+
if (r && (n = t), !!a.isString(n)) {
|
|
780
|
+
if (a.isString(s))
|
|
781
|
+
return n.indexOf(s) !== -1;
|
|
782
|
+
if (a.isRegExp(s))
|
|
783
|
+
return s.test(n);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
function Ke(e) {
|
|
787
|
+
return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (n, t, s) => t.toUpperCase() + s);
|
|
788
|
+
}
|
|
789
|
+
function Xe(e, n) {
|
|
790
|
+
const t = a.toCamelCase(" " + n);
|
|
791
|
+
["get", "set", "has"].forEach((s) => {
|
|
792
|
+
Object.defineProperty(e, s + t, {
|
|
793
|
+
value: function(r, i, o) {
|
|
794
|
+
return this[s].call(this, n, r, i, o);
|
|
795
|
+
},
|
|
796
|
+
configurable: !0
|
|
797
|
+
});
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
class $ {
|
|
801
|
+
constructor(n) {
|
|
802
|
+
n && this.set(n);
|
|
803
|
+
}
|
|
804
|
+
set(n, t, s) {
|
|
805
|
+
const r = this;
|
|
806
|
+
function i(c, d, f) {
|
|
807
|
+
const u = P(d);
|
|
808
|
+
if (!u)
|
|
809
|
+
throw new Error("header name must be a non-empty string");
|
|
810
|
+
const p = a.findKey(r, u);
|
|
811
|
+
(!p || r[p] === void 0 || f === !0 || f === void 0 && r[p] !== !1) && (r[p || d] = k(c));
|
|
812
|
+
}
|
|
813
|
+
const o = (c, d) => a.forEach(c, (f, u) => i(f, u, d));
|
|
814
|
+
return a.isPlainObject(n) || n instanceof this.constructor ? o(n, t) : a.isString(n) && (n = n.trim()) && !We(n) ? o($e(n), t) : n != null && i(t, n, s), this;
|
|
815
|
+
}
|
|
816
|
+
get(n, t) {
|
|
817
|
+
if (n = P(n), n) {
|
|
818
|
+
const s = a.findKey(this, n);
|
|
819
|
+
if (s) {
|
|
820
|
+
const r = this[s];
|
|
821
|
+
if (!t)
|
|
822
|
+
return r;
|
|
823
|
+
if (t === !0)
|
|
824
|
+
return Ve(r);
|
|
825
|
+
if (a.isFunction(t))
|
|
826
|
+
return t.call(this, r, s);
|
|
827
|
+
if (a.isRegExp(t))
|
|
828
|
+
return t.exec(r);
|
|
829
|
+
throw new TypeError("parser must be boolean|regexp|function");
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
has(n, t) {
|
|
834
|
+
if (n = P(n), n) {
|
|
835
|
+
const s = a.findKey(this, n);
|
|
836
|
+
return !!(s && this[s] !== void 0 && (!t || W(this, this[s], s, t)));
|
|
837
|
+
}
|
|
838
|
+
return !1;
|
|
839
|
+
}
|
|
840
|
+
delete(n, t) {
|
|
841
|
+
const s = this;
|
|
842
|
+
let r = !1;
|
|
843
|
+
function i(o) {
|
|
844
|
+
if (o = P(o), o) {
|
|
845
|
+
const c = a.findKey(s, o);
|
|
846
|
+
c && (!t || W(s, s[c], c, t)) && (delete s[c], r = !0);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
return a.isArray(n) ? n.forEach(i) : i(n), r;
|
|
850
|
+
}
|
|
851
|
+
clear(n) {
|
|
852
|
+
const t = Object.keys(this);
|
|
853
|
+
let s = t.length, r = !1;
|
|
854
|
+
for (; s--; ) {
|
|
855
|
+
const i = t[s];
|
|
856
|
+
(!n || W(this, this[i], i, n, !0)) && (delete this[i], r = !0);
|
|
857
|
+
}
|
|
858
|
+
return r;
|
|
859
|
+
}
|
|
860
|
+
normalize(n) {
|
|
861
|
+
const t = this, s = {};
|
|
862
|
+
return a.forEach(this, (r, i) => {
|
|
863
|
+
const o = a.findKey(s, i);
|
|
864
|
+
if (o) {
|
|
865
|
+
t[o] = k(r), delete t[i];
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
const c = n ? Ke(i) : String(i).trim();
|
|
869
|
+
c !== i && delete t[i], t[c] = k(r), s[c] = !0;
|
|
870
|
+
}), this;
|
|
871
|
+
}
|
|
872
|
+
concat(...n) {
|
|
873
|
+
return this.constructor.concat(this, ...n);
|
|
874
|
+
}
|
|
875
|
+
toJSON(n) {
|
|
876
|
+
const t = /* @__PURE__ */ Object.create(null);
|
|
877
|
+
return a.forEach(this, (s, r) => {
|
|
878
|
+
s != null && s !== !1 && (t[r] = n && a.isArray(s) ? s.join(", ") : s);
|
|
879
|
+
}), t;
|
|
880
|
+
}
|
|
881
|
+
[Symbol.iterator]() {
|
|
882
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
883
|
+
}
|
|
884
|
+
toString() {
|
|
885
|
+
return Object.entries(this.toJSON()).map(([n, t]) => n + ": " + t).join(`
|
|
886
|
+
`);
|
|
887
|
+
}
|
|
888
|
+
get [Symbol.toStringTag]() {
|
|
889
|
+
return "AxiosHeaders";
|
|
890
|
+
}
|
|
891
|
+
static from(n) {
|
|
892
|
+
return n instanceof this ? n : new this(n);
|
|
893
|
+
}
|
|
894
|
+
static concat(n, ...t) {
|
|
895
|
+
const s = new this(n);
|
|
896
|
+
return t.forEach((r) => s.set(r)), s;
|
|
897
|
+
}
|
|
898
|
+
static accessor(n) {
|
|
899
|
+
const s = (this[mt] = this[mt] = {
|
|
900
|
+
accessors: {}
|
|
901
|
+
}).accessors, r = this.prototype;
|
|
902
|
+
function i(o) {
|
|
903
|
+
const c = P(o);
|
|
904
|
+
s[c] || (Xe(r, o), s[c] = !0);
|
|
905
|
+
}
|
|
906
|
+
return a.isArray(n) ? n.forEach(i) : i(n), this;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
$.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
910
|
+
a.reduceDescriptors($.prototype, ({ value: e }, n) => {
|
|
911
|
+
let t = n[0].toUpperCase() + n.slice(1);
|
|
912
|
+
return {
|
|
913
|
+
get: () => e,
|
|
914
|
+
set(s) {
|
|
915
|
+
this[t] = s;
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
});
|
|
919
|
+
a.freezeMethods($);
|
|
920
|
+
const A = $;
|
|
921
|
+
function K(e, n) {
|
|
922
|
+
const t = this || rt, s = n || t, r = A.from(s.headers);
|
|
923
|
+
let i = s.data;
|
|
924
|
+
return a.forEach(e, function(c) {
|
|
925
|
+
i = c.call(t, i, r.normalize(), n ? n.status : void 0);
|
|
926
|
+
}), r.normalize(), i;
|
|
927
|
+
}
|
|
928
|
+
function jt(e) {
|
|
929
|
+
return !!(e && e.__CANCEL__);
|
|
930
|
+
}
|
|
931
|
+
function F(e, n, t) {
|
|
932
|
+
g.call(this, e ?? "canceled", g.ERR_CANCELED, n, t), this.name = "CanceledError";
|
|
933
|
+
}
|
|
934
|
+
a.inherits(F, g, {
|
|
935
|
+
__CANCEL__: !0
|
|
936
|
+
});
|
|
937
|
+
function Ge(e, n, t) {
|
|
938
|
+
const s = t.config.validateStatus;
|
|
939
|
+
!t.status || !s || s(t.status) ? e(t) : n(new g(
|
|
940
|
+
"Request failed with status code " + t.status,
|
|
941
|
+
[g.ERR_BAD_REQUEST, g.ERR_BAD_RESPONSE][Math.floor(t.status / 100) - 4],
|
|
942
|
+
t.config,
|
|
943
|
+
t.request,
|
|
944
|
+
t
|
|
945
|
+
));
|
|
946
|
+
}
|
|
947
|
+
const Qe = S.isStandardBrowserEnv ? (
|
|
948
|
+
// Standard browser envs support document.cookie
|
|
949
|
+
function() {
|
|
950
|
+
return {
|
|
951
|
+
write: function(t, s, r, i, o, c) {
|
|
952
|
+
const d = [];
|
|
953
|
+
d.push(t + "=" + encodeURIComponent(s)), a.isNumber(r) && d.push("expires=" + new Date(r).toGMTString()), a.isString(i) && d.push("path=" + i), a.isString(o) && d.push("domain=" + o), c === !0 && d.push("secure"), document.cookie = d.join("; ");
|
|
954
|
+
},
|
|
955
|
+
read: function(t) {
|
|
956
|
+
const s = document.cookie.match(new RegExp("(^|;\\s*)(" + t + ")=([^;]*)"));
|
|
957
|
+
return s ? decodeURIComponent(s[3]) : null;
|
|
958
|
+
},
|
|
959
|
+
remove: function(t) {
|
|
960
|
+
this.write(t, "", Date.now() - 864e5);
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
}()
|
|
964
|
+
) : (
|
|
965
|
+
// Non standard browser env (web workers, react-native) lack needed support.
|
|
966
|
+
function() {
|
|
967
|
+
return {
|
|
968
|
+
write: function() {
|
|
969
|
+
},
|
|
970
|
+
read: function() {
|
|
971
|
+
return null;
|
|
972
|
+
},
|
|
973
|
+
remove: function() {
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
}()
|
|
977
|
+
);
|
|
978
|
+
function Ye(e) {
|
|
979
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
|
|
980
|
+
}
|
|
981
|
+
function Ze(e, n) {
|
|
982
|
+
return n ? e.replace(/\/+$/, "") + "/" + n.replace(/^\/+/, "") : e;
|
|
983
|
+
}
|
|
984
|
+
function zt(e, n) {
|
|
985
|
+
return e && !Ye(n) ? Ze(e, n) : n;
|
|
986
|
+
}
|
|
987
|
+
const ve = S.isStandardBrowserEnv ? (
|
|
988
|
+
// Standard browser envs have full support of the APIs needed to test
|
|
989
|
+
// whether the request URL is of the same origin as current location.
|
|
990
|
+
function() {
|
|
991
|
+
const n = /(msie|trident)/i.test(navigator.userAgent), t = document.createElement("a");
|
|
992
|
+
let s;
|
|
993
|
+
function r(i) {
|
|
994
|
+
let o = i;
|
|
995
|
+
return n && (t.setAttribute("href", o), o = t.href), t.setAttribute("href", o), {
|
|
996
|
+
href: t.href,
|
|
997
|
+
protocol: t.protocol ? t.protocol.replace(/:$/, "") : "",
|
|
998
|
+
host: t.host,
|
|
999
|
+
search: t.search ? t.search.replace(/^\?/, "") : "",
|
|
1000
|
+
hash: t.hash ? t.hash.replace(/^#/, "") : "",
|
|
1001
|
+
hostname: t.hostname,
|
|
1002
|
+
port: t.port,
|
|
1003
|
+
pathname: t.pathname.charAt(0) === "/" ? t.pathname : "/" + t.pathname
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
return s = r(window.location.href), function(o) {
|
|
1007
|
+
const c = a.isString(o) ? r(o) : o;
|
|
1008
|
+
return c.protocol === s.protocol && c.host === s.host;
|
|
1009
|
+
};
|
|
1010
|
+
}()
|
|
1011
|
+
) : (
|
|
1012
|
+
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
1013
|
+
function() {
|
|
1014
|
+
return function() {
|
|
1015
|
+
return !0;
|
|
1016
|
+
};
|
|
1017
|
+
}()
|
|
1018
|
+
);
|
|
1019
|
+
function tn(e) {
|
|
1020
|
+
const n = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
|
|
1021
|
+
return n && n[1] || "";
|
|
1022
|
+
}
|
|
1023
|
+
function en(e, n) {
|
|
1024
|
+
e = e || 10;
|
|
1025
|
+
const t = new Array(e), s = new Array(e);
|
|
1026
|
+
let r = 0, i = 0, o;
|
|
1027
|
+
return n = n !== void 0 ? n : 1e3, function(d) {
|
|
1028
|
+
const f = Date.now(), u = s[i];
|
|
1029
|
+
o || (o = f), t[r] = d, s[r] = f;
|
|
1030
|
+
let p = i, y = 0;
|
|
1031
|
+
for (; p !== r; )
|
|
1032
|
+
y += t[p++], p = p % e;
|
|
1033
|
+
if (r = (r + 1) % e, r === i && (i = (i + 1) % e), f - o < n)
|
|
1034
|
+
return;
|
|
1035
|
+
const E = u && f - u;
|
|
1036
|
+
return E ? Math.round(y * 1e3 / E) : void 0;
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
function gt(e, n) {
|
|
1040
|
+
let t = 0;
|
|
1041
|
+
const s = en(50, 250);
|
|
1042
|
+
return (r) => {
|
|
1043
|
+
const i = r.loaded, o = r.lengthComputable ? r.total : void 0, c = i - t, d = s(c), f = i <= o;
|
|
1044
|
+
t = i;
|
|
1045
|
+
const u = {
|
|
1046
|
+
loaded: i,
|
|
1047
|
+
total: o,
|
|
1048
|
+
progress: o ? i / o : void 0,
|
|
1049
|
+
bytes: c,
|
|
1050
|
+
rate: d || void 0,
|
|
1051
|
+
estimated: d && o && f ? (o - i) / d : void 0,
|
|
1052
|
+
event: r
|
|
1053
|
+
};
|
|
1054
|
+
u[n ? "download" : "upload"] = !0, e(u);
|
|
1055
|
+
};
|
|
1056
|
+
}
|
|
1057
|
+
const nn = typeof XMLHttpRequest < "u", sn = nn && function(e) {
|
|
1058
|
+
return new Promise(function(t, s) {
|
|
1059
|
+
let r = e.data;
|
|
1060
|
+
const i = A.from(e.headers).normalize(), o = e.responseType;
|
|
1061
|
+
let c;
|
|
1062
|
+
function d() {
|
|
1063
|
+
e.cancelToken && e.cancelToken.unsubscribe(c), e.signal && e.signal.removeEventListener("abort", c);
|
|
1064
|
+
}
|
|
1065
|
+
let f;
|
|
1066
|
+
a.isFormData(r) && (S.isStandardBrowserEnv || S.isStandardBrowserWebWorkerEnv ? i.setContentType(!1) : i.getContentType(/^\s*multipart\/form-data/) ? a.isString(f = i.getContentType()) && i.setContentType(f.replace(/^\s*(multipart\/form-data);+/, "$1")) : i.setContentType("multipart/form-data"));
|
|
1067
|
+
let u = new XMLHttpRequest();
|
|
1068
|
+
if (e.auth) {
|
|
1069
|
+
const l = e.auth.username || "", m = e.auth.password ? unescape(encodeURIComponent(e.auth.password)) : "";
|
|
1070
|
+
i.set("Authorization", "Basic " + btoa(l + ":" + m));
|
|
1071
|
+
}
|
|
1072
|
+
const p = zt(e.baseURL, e.url);
|
|
1073
|
+
u.open(e.method.toUpperCase(), Lt(p, e.params, e.paramsSerializer), !0), u.timeout = e.timeout;
|
|
1074
|
+
function y() {
|
|
1075
|
+
if (!u)
|
|
1076
|
+
return;
|
|
1077
|
+
const l = A.from(
|
|
1078
|
+
"getAllResponseHeaders" in u && u.getAllResponseHeaders()
|
|
1079
|
+
), b = {
|
|
1080
|
+
data: !o || o === "text" || o === "json" ? u.responseText : u.response,
|
|
1081
|
+
status: u.status,
|
|
1082
|
+
statusText: u.statusText,
|
|
1083
|
+
headers: l,
|
|
1084
|
+
config: e,
|
|
1085
|
+
request: u
|
|
1086
|
+
};
|
|
1087
|
+
Ge(function(R) {
|
|
1088
|
+
t(R), d();
|
|
1089
|
+
}, function(R) {
|
|
1090
|
+
s(R), d();
|
|
1091
|
+
}, b), u = null;
|
|
1092
|
+
}
|
|
1093
|
+
if ("onloadend" in u ? u.onloadend = y : u.onreadystatechange = function() {
|
|
1094
|
+
!u || u.readyState !== 4 || u.status === 0 && !(u.responseURL && u.responseURL.indexOf("file:") === 0) || setTimeout(y);
|
|
1095
|
+
}, u.onabort = function() {
|
|
1096
|
+
u && (s(new g("Request aborted", g.ECONNABORTED, e, u)), u = null);
|
|
1097
|
+
}, u.onerror = function() {
|
|
1098
|
+
s(new g("Network Error", g.ERR_NETWORK, e, u)), u = null;
|
|
1099
|
+
}, u.ontimeout = function() {
|
|
1100
|
+
let m = e.timeout ? "timeout of " + e.timeout + "ms exceeded" : "timeout exceeded";
|
|
1101
|
+
const b = e.transitional || Ut;
|
|
1102
|
+
e.timeoutErrorMessage && (m = e.timeoutErrorMessage), s(new g(
|
|
1103
|
+
m,
|
|
1104
|
+
b.clarifyTimeoutError ? g.ETIMEDOUT : g.ECONNABORTED,
|
|
1105
|
+
e,
|
|
1106
|
+
u
|
|
1107
|
+
)), u = null;
|
|
1108
|
+
}, S.isStandardBrowserEnv) {
|
|
1109
|
+
const l = (e.withCredentials || ve(p)) && e.xsrfCookieName && Qe.read(e.xsrfCookieName);
|
|
1110
|
+
l && i.set(e.xsrfHeaderName, l);
|
|
1111
|
+
}
|
|
1112
|
+
r === void 0 && i.setContentType(null), "setRequestHeader" in u && a.forEach(i.toJSON(), function(m, b) {
|
|
1113
|
+
u.setRequestHeader(b, m);
|
|
1114
|
+
}), a.isUndefined(e.withCredentials) || (u.withCredentials = !!e.withCredentials), o && o !== "json" && (u.responseType = e.responseType), typeof e.onDownloadProgress == "function" && u.addEventListener("progress", gt(e.onDownloadProgress, !0)), typeof e.onUploadProgress == "function" && u.upload && u.upload.addEventListener("progress", gt(e.onUploadProgress)), (e.cancelToken || e.signal) && (c = (l) => {
|
|
1115
|
+
u && (s(!l || l.type ? new F(null, e, u) : l), u.abort(), u = null);
|
|
1116
|
+
}, e.cancelToken && e.cancelToken.subscribe(c), e.signal && (e.signal.aborted ? c() : e.signal.addEventListener("abort", c)));
|
|
1117
|
+
const E = tn(p);
|
|
1118
|
+
if (E && S.protocols.indexOf(E) === -1) {
|
|
1119
|
+
s(new g("Unsupported protocol " + E + ":", g.ERR_BAD_REQUEST, e));
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
u.send(r || null);
|
|
1123
|
+
});
|
|
1124
|
+
}, Y = {
|
|
1125
|
+
http: Ie,
|
|
1126
|
+
xhr: sn
|
|
1127
|
+
};
|
|
1128
|
+
a.forEach(Y, (e, n) => {
|
|
1129
|
+
if (e) {
|
|
1130
|
+
try {
|
|
1131
|
+
Object.defineProperty(e, "name", { value: n });
|
|
1132
|
+
} catch {
|
|
1133
|
+
}
|
|
1134
|
+
Object.defineProperty(e, "adapterName", { value: n });
|
|
1135
|
+
}
|
|
1136
|
+
});
|
|
1137
|
+
const wt = (e) => `- ${e}`, rn = (e) => a.isFunction(e) || e === null || e === !1, Ht = {
|
|
1138
|
+
getAdapter: (e) => {
|
|
1139
|
+
e = a.isArray(e) ? e : [e];
|
|
1140
|
+
const { length: n } = e;
|
|
1141
|
+
let t, s;
|
|
1142
|
+
const r = {};
|
|
1143
|
+
for (let i = 0; i < n; i++) {
|
|
1144
|
+
t = e[i];
|
|
1145
|
+
let o;
|
|
1146
|
+
if (s = t, !rn(t) && (s = Y[(o = String(t)).toLowerCase()], s === void 0))
|
|
1147
|
+
throw new g(`Unknown adapter '${o}'`);
|
|
1148
|
+
if (s)
|
|
1149
|
+
break;
|
|
1150
|
+
r[o || "#" + i] = s;
|
|
1151
|
+
}
|
|
1152
|
+
if (!s) {
|
|
1153
|
+
const i = Object.entries(r).map(
|
|
1154
|
+
([c, d]) => `adapter ${c} ` + (d === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
1155
|
+
);
|
|
1156
|
+
let o = n ? i.length > 1 ? `since :
|
|
1157
|
+
` + i.map(wt).join(`
|
|
1158
|
+
`) : " " + wt(i[0]) : "as no adapter specified";
|
|
1159
|
+
throw new g(
|
|
1160
|
+
"There is no suitable adapter to dispatch the request " + o,
|
|
1161
|
+
"ERR_NOT_SUPPORT"
|
|
1162
|
+
);
|
|
1163
|
+
}
|
|
1164
|
+
return s;
|
|
1165
|
+
},
|
|
1166
|
+
adapters: Y
|
|
1167
|
+
};
|
|
1168
|
+
function X(e) {
|
|
1169
|
+
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
|
|
1170
|
+
throw new F(null, e);
|
|
1171
|
+
}
|
|
1172
|
+
function yt(e) {
|
|
1173
|
+
return X(e), e.headers = A.from(e.headers), e.data = K.call(
|
|
1174
|
+
e,
|
|
1175
|
+
e.transformRequest
|
|
1176
|
+
), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), Ht.getAdapter(e.adapter || rt.adapter)(e).then(function(s) {
|
|
1177
|
+
return X(e), s.data = K.call(
|
|
1178
|
+
e,
|
|
1179
|
+
e.transformResponse,
|
|
1180
|
+
s
|
|
1181
|
+
), s.headers = A.from(s.headers), s;
|
|
1182
|
+
}, function(s) {
|
|
1183
|
+
return jt(s) || (X(e), s && s.response && (s.response.data = K.call(
|
|
1184
|
+
e,
|
|
1185
|
+
e.transformResponse,
|
|
1186
|
+
s.response
|
|
1187
|
+
), s.response.headers = A.from(s.response.headers))), Promise.reject(s);
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
const Et = (e) => e instanceof A ? e.toJSON() : e;
|
|
1191
|
+
function x(e, n) {
|
|
1192
|
+
n = n || {};
|
|
1193
|
+
const t = {};
|
|
1194
|
+
function s(f, u, p) {
|
|
1195
|
+
return a.isPlainObject(f) && a.isPlainObject(u) ? a.merge.call({ caseless: p }, f, u) : a.isPlainObject(u) ? a.merge({}, u) : a.isArray(u) ? u.slice() : u;
|
|
1196
|
+
}
|
|
1197
|
+
function r(f, u, p) {
|
|
1198
|
+
if (a.isUndefined(u)) {
|
|
1199
|
+
if (!a.isUndefined(f))
|
|
1200
|
+
return s(void 0, f, p);
|
|
1201
|
+
} else
|
|
1202
|
+
return s(f, u, p);
|
|
1203
|
+
}
|
|
1204
|
+
function i(f, u) {
|
|
1205
|
+
if (!a.isUndefined(u))
|
|
1206
|
+
return s(void 0, u);
|
|
1207
|
+
}
|
|
1208
|
+
function o(f, u) {
|
|
1209
|
+
if (a.isUndefined(u)) {
|
|
1210
|
+
if (!a.isUndefined(f))
|
|
1211
|
+
return s(void 0, f);
|
|
1212
|
+
} else
|
|
1213
|
+
return s(void 0, u);
|
|
1214
|
+
}
|
|
1215
|
+
function c(f, u, p) {
|
|
1216
|
+
if (p in n)
|
|
1217
|
+
return s(f, u);
|
|
1218
|
+
if (p in e)
|
|
1219
|
+
return s(void 0, f);
|
|
1220
|
+
}
|
|
1221
|
+
const d = {
|
|
1222
|
+
url: i,
|
|
1223
|
+
method: i,
|
|
1224
|
+
data: i,
|
|
1225
|
+
baseURL: o,
|
|
1226
|
+
transformRequest: o,
|
|
1227
|
+
transformResponse: o,
|
|
1228
|
+
paramsSerializer: o,
|
|
1229
|
+
timeout: o,
|
|
1230
|
+
timeoutMessage: o,
|
|
1231
|
+
withCredentials: o,
|
|
1232
|
+
adapter: o,
|
|
1233
|
+
responseType: o,
|
|
1234
|
+
xsrfCookieName: o,
|
|
1235
|
+
xsrfHeaderName: o,
|
|
1236
|
+
onUploadProgress: o,
|
|
1237
|
+
onDownloadProgress: o,
|
|
1238
|
+
decompress: o,
|
|
1239
|
+
maxContentLength: o,
|
|
1240
|
+
maxBodyLength: o,
|
|
1241
|
+
beforeRedirect: o,
|
|
1242
|
+
transport: o,
|
|
1243
|
+
httpAgent: o,
|
|
1244
|
+
httpsAgent: o,
|
|
1245
|
+
cancelToken: o,
|
|
1246
|
+
socketPath: o,
|
|
1247
|
+
responseEncoding: o,
|
|
1248
|
+
validateStatus: c,
|
|
1249
|
+
headers: (f, u) => r(Et(f), Et(u), !0)
|
|
1250
|
+
};
|
|
1251
|
+
return a.forEach(Object.keys(Object.assign({}, e, n)), function(u) {
|
|
1252
|
+
const p = d[u] || r, y = p(e[u], n[u], u);
|
|
1253
|
+
a.isUndefined(y) && p !== c || (t[u] = y);
|
|
1254
|
+
}), t;
|
|
1255
|
+
}
|
|
1256
|
+
const Mt = "1.5.1", it = {};
|
|
1257
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((e, n) => {
|
|
1258
|
+
it[e] = function(s) {
|
|
1259
|
+
return typeof s === e || "a" + (n < 1 ? "n " : " ") + e;
|
|
1260
|
+
};
|
|
1261
|
+
});
|
|
1262
|
+
const bt = {};
|
|
1263
|
+
it.transitional = function(n, t, s) {
|
|
1264
|
+
function r(i, o) {
|
|
1265
|
+
return "[Axios v" + Mt + "] Transitional option '" + i + "'" + o + (s ? ". " + s : "");
|
|
1266
|
+
}
|
|
1267
|
+
return (i, o, c) => {
|
|
1268
|
+
if (n === !1)
|
|
1269
|
+
throw new g(
|
|
1270
|
+
r(o, " has been removed" + (t ? " in " + t : "")),
|
|
1271
|
+
g.ERR_DEPRECATED
|
|
1272
|
+
);
|
|
1273
|
+
return t && !bt[o] && (bt[o] = !0, console.warn(
|
|
1274
|
+
r(
|
|
1275
|
+
o,
|
|
1276
|
+
" has been deprecated since v" + t + " and will be removed in the near future"
|
|
1277
|
+
)
|
|
1278
|
+
)), n ? n(i, o, c) : !0;
|
|
1279
|
+
};
|
|
1280
|
+
};
|
|
1281
|
+
function on(e, n, t) {
|
|
1282
|
+
if (typeof e != "object")
|
|
1283
|
+
throw new g("options must be an object", g.ERR_BAD_OPTION_VALUE);
|
|
1284
|
+
const s = Object.keys(e);
|
|
1285
|
+
let r = s.length;
|
|
1286
|
+
for (; r-- > 0; ) {
|
|
1287
|
+
const i = s[r], o = n[i];
|
|
1288
|
+
if (o) {
|
|
1289
|
+
const c = e[i], d = c === void 0 || o(c, i, e);
|
|
1290
|
+
if (d !== !0)
|
|
1291
|
+
throw new g("option " + i + " must be " + d, g.ERR_BAD_OPTION_VALUE);
|
|
1292
|
+
continue;
|
|
1293
|
+
}
|
|
1294
|
+
if (t !== !0)
|
|
1295
|
+
throw new g("Unknown option " + i, g.ERR_BAD_OPTION);
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
const Z = {
|
|
1299
|
+
assertOptions: on,
|
|
1300
|
+
validators: it
|
|
1301
|
+
}, N = Z.validators;
|
|
1302
|
+
class z {
|
|
1303
|
+
constructor(n) {
|
|
1304
|
+
this.defaults = n, this.interceptors = {
|
|
1305
|
+
request: new pt(),
|
|
1306
|
+
response: new pt()
|
|
1307
|
+
};
|
|
1308
|
+
}
|
|
1309
|
+
/**
|
|
1310
|
+
* Dispatch a request
|
|
1311
|
+
*
|
|
1312
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
1313
|
+
* @param {?Object} config
|
|
1314
|
+
*
|
|
1315
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
1316
|
+
*/
|
|
1317
|
+
request(n, t) {
|
|
1318
|
+
typeof n == "string" ? (t = t || {}, t.url = n) : t = n || {}, t = x(this.defaults, t);
|
|
1319
|
+
const { transitional: s, paramsSerializer: r, headers: i } = t;
|
|
1320
|
+
s !== void 0 && Z.assertOptions(s, {
|
|
1321
|
+
silentJSONParsing: N.transitional(N.boolean),
|
|
1322
|
+
forcedJSONParsing: N.transitional(N.boolean),
|
|
1323
|
+
clarifyTimeoutError: N.transitional(N.boolean)
|
|
1324
|
+
}, !1), r != null && (a.isFunction(r) ? t.paramsSerializer = {
|
|
1325
|
+
serialize: r
|
|
1326
|
+
} : Z.assertOptions(r, {
|
|
1327
|
+
encode: N.function,
|
|
1328
|
+
serialize: N.function
|
|
1329
|
+
}, !0)), t.method = (t.method || this.defaults.method || "get").toLowerCase();
|
|
1330
|
+
let o = i && a.merge(
|
|
1331
|
+
i.common,
|
|
1332
|
+
i[t.method]
|
|
1333
|
+
);
|
|
1334
|
+
i && a.forEach(
|
|
1335
|
+
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
1336
|
+
(l) => {
|
|
1337
|
+
delete i[l];
|
|
1338
|
+
}
|
|
1339
|
+
), t.headers = A.concat(o, i);
|
|
1340
|
+
const c = [];
|
|
1341
|
+
let d = !0;
|
|
1342
|
+
this.interceptors.request.forEach(function(m) {
|
|
1343
|
+
typeof m.runWhen == "function" && m.runWhen(t) === !1 || (d = d && m.synchronous, c.unshift(m.fulfilled, m.rejected));
|
|
1344
|
+
});
|
|
1345
|
+
const f = [];
|
|
1346
|
+
this.interceptors.response.forEach(function(m) {
|
|
1347
|
+
f.push(m.fulfilled, m.rejected);
|
|
1348
|
+
});
|
|
1349
|
+
let u, p = 0, y;
|
|
1350
|
+
if (!d) {
|
|
1351
|
+
const l = [yt.bind(this), void 0];
|
|
1352
|
+
for (l.unshift.apply(l, c), l.push.apply(l, f), y = l.length, u = Promise.resolve(t); p < y; )
|
|
1353
|
+
u = u.then(l[p++], l[p++]);
|
|
1354
|
+
return u;
|
|
1355
|
+
}
|
|
1356
|
+
y = c.length;
|
|
1357
|
+
let E = t;
|
|
1358
|
+
for (p = 0; p < y; ) {
|
|
1359
|
+
const l = c[p++], m = c[p++];
|
|
1360
|
+
try {
|
|
1361
|
+
E = l(E);
|
|
1362
|
+
} catch (b) {
|
|
1363
|
+
m.call(this, b);
|
|
1364
|
+
break;
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
try {
|
|
1368
|
+
u = yt.call(this, E);
|
|
1369
|
+
} catch (l) {
|
|
1370
|
+
return Promise.reject(l);
|
|
1371
|
+
}
|
|
1372
|
+
for (p = 0, y = f.length; p < y; )
|
|
1373
|
+
u = u.then(f[p++], f[p++]);
|
|
1374
|
+
return u;
|
|
1375
|
+
}
|
|
1376
|
+
getUri(n) {
|
|
1377
|
+
n = x(this.defaults, n);
|
|
1378
|
+
const t = zt(n.baseURL, n.url);
|
|
1379
|
+
return Lt(t, n.params, n.paramsSerializer);
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
a.forEach(["delete", "get", "head", "options"], function(n) {
|
|
1383
|
+
z.prototype[n] = function(t, s) {
|
|
1384
|
+
return this.request(x(s || {}, {
|
|
1385
|
+
method: n,
|
|
1386
|
+
url: t,
|
|
1387
|
+
data: (s || {}).data
|
|
1388
|
+
}));
|
|
1389
|
+
};
|
|
1390
|
+
});
|
|
1391
|
+
a.forEach(["post", "put", "patch"], function(n) {
|
|
1392
|
+
function t(s) {
|
|
1393
|
+
return function(i, o, c) {
|
|
1394
|
+
return this.request(x(c || {}, {
|
|
1395
|
+
method: n,
|
|
1396
|
+
headers: s ? {
|
|
1397
|
+
"Content-Type": "multipart/form-data"
|
|
1398
|
+
} : {},
|
|
1399
|
+
url: i,
|
|
1400
|
+
data: o
|
|
1401
|
+
}));
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
z.prototype[n] = t(), z.prototype[n + "Form"] = t(!0);
|
|
1405
|
+
});
|
|
1406
|
+
const j = z;
|
|
1407
|
+
class ot {
|
|
1408
|
+
constructor(n) {
|
|
1409
|
+
if (typeof n != "function")
|
|
1410
|
+
throw new TypeError("executor must be a function.");
|
|
1411
|
+
let t;
|
|
1412
|
+
this.promise = new Promise(function(i) {
|
|
1413
|
+
t = i;
|
|
1414
|
+
});
|
|
1415
|
+
const s = this;
|
|
1416
|
+
this.promise.then((r) => {
|
|
1417
|
+
if (!s._listeners)
|
|
1418
|
+
return;
|
|
1419
|
+
let i = s._listeners.length;
|
|
1420
|
+
for (; i-- > 0; )
|
|
1421
|
+
s._listeners[i](r);
|
|
1422
|
+
s._listeners = null;
|
|
1423
|
+
}), this.promise.then = (r) => {
|
|
1424
|
+
let i;
|
|
1425
|
+
const o = new Promise((c) => {
|
|
1426
|
+
s.subscribe(c), i = c;
|
|
1427
|
+
}).then(r);
|
|
1428
|
+
return o.cancel = function() {
|
|
1429
|
+
s.unsubscribe(i);
|
|
1430
|
+
}, o;
|
|
1431
|
+
}, n(function(i, o, c) {
|
|
1432
|
+
s.reason || (s.reason = new F(i, o, c), t(s.reason));
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1435
|
+
/**
|
|
1436
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
1437
|
+
*/
|
|
1438
|
+
throwIfRequested() {
|
|
1439
|
+
if (this.reason)
|
|
1440
|
+
throw this.reason;
|
|
1441
|
+
}
|
|
1442
|
+
/**
|
|
1443
|
+
* Subscribe to the cancel signal
|
|
1444
|
+
*/
|
|
1445
|
+
subscribe(n) {
|
|
1446
|
+
if (this.reason) {
|
|
1447
|
+
n(this.reason);
|
|
1448
|
+
return;
|
|
1449
|
+
}
|
|
1450
|
+
this._listeners ? this._listeners.push(n) : this._listeners = [n];
|
|
1451
|
+
}
|
|
1452
|
+
/**
|
|
1453
|
+
* Unsubscribe from the cancel signal
|
|
1454
|
+
*/
|
|
1455
|
+
unsubscribe(n) {
|
|
1456
|
+
if (!this._listeners)
|
|
1457
|
+
return;
|
|
1458
|
+
const t = this._listeners.indexOf(n);
|
|
1459
|
+
t !== -1 && this._listeners.splice(t, 1);
|
|
1460
|
+
}
|
|
1461
|
+
/**
|
|
1462
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
1463
|
+
* cancels the `CancelToken`.
|
|
1464
|
+
*/
|
|
1465
|
+
static source() {
|
|
1466
|
+
let n;
|
|
1467
|
+
return {
|
|
1468
|
+
token: new ot(function(r) {
|
|
1469
|
+
n = r;
|
|
1470
|
+
}),
|
|
1471
|
+
cancel: n
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
const an = ot;
|
|
1476
|
+
function cn(e) {
|
|
1477
|
+
return function(t) {
|
|
1478
|
+
return e.apply(null, t);
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
function un(e) {
|
|
1482
|
+
return a.isObject(e) && e.isAxiosError === !0;
|
|
1483
|
+
}
|
|
1484
|
+
const v = {
|
|
1485
|
+
Continue: 100,
|
|
1486
|
+
SwitchingProtocols: 101,
|
|
1487
|
+
Processing: 102,
|
|
1488
|
+
EarlyHints: 103,
|
|
1489
|
+
Ok: 200,
|
|
1490
|
+
Created: 201,
|
|
1491
|
+
Accepted: 202,
|
|
1492
|
+
NonAuthoritativeInformation: 203,
|
|
1493
|
+
NoContent: 204,
|
|
1494
|
+
ResetContent: 205,
|
|
1495
|
+
PartialContent: 206,
|
|
1496
|
+
MultiStatus: 207,
|
|
1497
|
+
AlreadyReported: 208,
|
|
1498
|
+
ImUsed: 226,
|
|
1499
|
+
MultipleChoices: 300,
|
|
1500
|
+
MovedPermanently: 301,
|
|
1501
|
+
Found: 302,
|
|
1502
|
+
SeeOther: 303,
|
|
1503
|
+
NotModified: 304,
|
|
1504
|
+
UseProxy: 305,
|
|
1505
|
+
Unused: 306,
|
|
1506
|
+
TemporaryRedirect: 307,
|
|
1507
|
+
PermanentRedirect: 308,
|
|
1508
|
+
BadRequest: 400,
|
|
1509
|
+
Unauthorized: 401,
|
|
1510
|
+
PaymentRequired: 402,
|
|
1511
|
+
Forbidden: 403,
|
|
1512
|
+
NotFound: 404,
|
|
1513
|
+
MethodNotAllowed: 405,
|
|
1514
|
+
NotAcceptable: 406,
|
|
1515
|
+
ProxyAuthenticationRequired: 407,
|
|
1516
|
+
RequestTimeout: 408,
|
|
1517
|
+
Conflict: 409,
|
|
1518
|
+
Gone: 410,
|
|
1519
|
+
LengthRequired: 411,
|
|
1520
|
+
PreconditionFailed: 412,
|
|
1521
|
+
PayloadTooLarge: 413,
|
|
1522
|
+
UriTooLong: 414,
|
|
1523
|
+
UnsupportedMediaType: 415,
|
|
1524
|
+
RangeNotSatisfiable: 416,
|
|
1525
|
+
ExpectationFailed: 417,
|
|
1526
|
+
ImATeapot: 418,
|
|
1527
|
+
MisdirectedRequest: 421,
|
|
1528
|
+
UnprocessableEntity: 422,
|
|
1529
|
+
Locked: 423,
|
|
1530
|
+
FailedDependency: 424,
|
|
1531
|
+
TooEarly: 425,
|
|
1532
|
+
UpgradeRequired: 426,
|
|
1533
|
+
PreconditionRequired: 428,
|
|
1534
|
+
TooManyRequests: 429,
|
|
1535
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
1536
|
+
UnavailableForLegalReasons: 451,
|
|
1537
|
+
InternalServerError: 500,
|
|
1538
|
+
NotImplemented: 501,
|
|
1539
|
+
BadGateway: 502,
|
|
1540
|
+
ServiceUnavailable: 503,
|
|
1541
|
+
GatewayTimeout: 504,
|
|
1542
|
+
HttpVersionNotSupported: 505,
|
|
1543
|
+
VariantAlsoNegotiates: 506,
|
|
1544
|
+
InsufficientStorage: 507,
|
|
1545
|
+
LoopDetected: 508,
|
|
1546
|
+
NotExtended: 510,
|
|
1547
|
+
NetworkAuthenticationRequired: 511
|
|
1548
|
+
};
|
|
1549
|
+
Object.entries(v).forEach(([e, n]) => {
|
|
1550
|
+
v[n] = e;
|
|
1551
|
+
});
|
|
1552
|
+
const ln = v;
|
|
1553
|
+
function Jt(e) {
|
|
1554
|
+
const n = new j(e), t = St(j.prototype.request, n);
|
|
1555
|
+
return a.extend(t, j.prototype, n, { allOwnKeys: !0 }), a.extend(t, n, null, { allOwnKeys: !0 }), t.create = function(r) {
|
|
1556
|
+
return Jt(x(e, r));
|
|
1557
|
+
}, t;
|
|
1558
|
+
}
|
|
1559
|
+
const w = Jt(rt);
|
|
1560
|
+
w.Axios = j;
|
|
1561
|
+
w.CanceledError = F;
|
|
1562
|
+
w.CancelToken = an;
|
|
1563
|
+
w.isCancel = jt;
|
|
1564
|
+
w.VERSION = Mt;
|
|
1565
|
+
w.toFormData = q;
|
|
1566
|
+
w.AxiosError = g;
|
|
1567
|
+
w.Cancel = w.CanceledError;
|
|
1568
|
+
w.all = function(n) {
|
|
1569
|
+
return Promise.all(n);
|
|
1570
|
+
};
|
|
1571
|
+
w.spread = cn;
|
|
1572
|
+
w.isAxiosError = un;
|
|
1573
|
+
w.mergeConfig = x;
|
|
1574
|
+
w.AxiosHeaders = A;
|
|
1575
|
+
w.formToJSON = (e) => kt(a.isHTMLForm(e) ? new FormData(e) : e);
|
|
1576
|
+
w.getAdapter = Ht.getAdapter;
|
|
1577
|
+
w.HttpStatusCode = ln;
|
|
1578
|
+
w.default = w;
|
|
1579
|
+
const dn = w;
|
|
1580
|
+
class wn {
|
|
1581
|
+
constructor(n, t = null) {
|
|
1582
|
+
h(this, "_url", null);
|
|
1583
|
+
h(this, "_token", null);
|
|
1584
|
+
//Added for testing support
|
|
1585
|
+
h(this, "_httpRequester");
|
|
1586
|
+
if (!n)
|
|
1587
|
+
throw Error("Endpoint URL must be passed in to NotuClient constructor");
|
|
1588
|
+
this._url = n, this._httpRequester = t ?? dn;
|
|
1589
|
+
}
|
|
1590
|
+
get url() {
|
|
1591
|
+
return this._url;
|
|
1592
|
+
}
|
|
1593
|
+
get token() {
|
|
1594
|
+
return this._token;
|
|
1595
|
+
}
|
|
1596
|
+
set token(n) {
|
|
1597
|
+
this._token = n;
|
|
1598
|
+
}
|
|
1599
|
+
async login(n, t) {
|
|
1600
|
+
try {
|
|
1601
|
+
const s = await this._httpRequester({
|
|
1602
|
+
method: "post",
|
|
1603
|
+
url: (this.url + "/login").replace("//", "/"),
|
|
1604
|
+
data: { username: n, password: t }
|
|
1605
|
+
});
|
|
1606
|
+
return this._token = s.data, { success: !0, error: null, token: s.data };
|
|
1607
|
+
} catch (s) {
|
|
1608
|
+
if (s.response.status == 401)
|
|
1609
|
+
return { success: !1, error: "Invalid username & password.", token: null };
|
|
1610
|
+
throw s;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
async getSpaces() {
|
|
1614
|
+
return (await this._httpRequester({
|
|
1615
|
+
method: "get",
|
|
1616
|
+
url: (this.url + "/spaces").replace("//", "/"),
|
|
1617
|
+
headers: {
|
|
1618
|
+
Authorization: "Bearer " + this.token
|
|
1619
|
+
}
|
|
1620
|
+
})).data;
|
|
1621
|
+
}
|
|
1622
|
+
async saveSpace(n) {
|
|
1623
|
+
return (await this._httpRequester({
|
|
1624
|
+
method: "post",
|
|
1625
|
+
url: (this.url + "/spaces").replace("//", "/"),
|
|
1626
|
+
data: n,
|
|
1627
|
+
headers: {
|
|
1628
|
+
Authorization: "Bearer " + this.token
|
|
1629
|
+
}
|
|
1630
|
+
})).data;
|
|
1631
|
+
}
|
|
1632
|
+
async getNotes(n, t) {
|
|
1633
|
+
return (await this._httpRequester({
|
|
1634
|
+
method: "get",
|
|
1635
|
+
url: (this.url + "/notes").replace("//", "/"),
|
|
1636
|
+
data: { query: n, spaceId: t },
|
|
1637
|
+
headers: {
|
|
1638
|
+
Authorization: "Bearer " + this.token
|
|
1639
|
+
}
|
|
1640
|
+
})).data;
|
|
1641
|
+
}
|
|
1642
|
+
async getNoteCount(n, t) {
|
|
1643
|
+
return (await this._httpRequester({
|
|
1644
|
+
method: "get",
|
|
1645
|
+
url: (this.url + "/notes").replace("//", "/"),
|
|
1646
|
+
data: { query: n, spaceId: t },
|
|
1647
|
+
headers: {
|
|
1648
|
+
Authorization: "Bearer " + this.token
|
|
1649
|
+
}
|
|
1650
|
+
})).data;
|
|
1651
|
+
}
|
|
1652
|
+
async saveNotes(n) {
|
|
1653
|
+
return (await this._httpRequester({
|
|
1654
|
+
method: "post",
|
|
1655
|
+
url: (this.url + "/notes").replace("//", "/"),
|
|
1656
|
+
data: { notes: n },
|
|
1657
|
+
headers: {
|
|
1658
|
+
Authorization: "Bearer " + this.token
|
|
1659
|
+
}
|
|
1660
|
+
})).data;
|
|
1661
|
+
}
|
|
1662
|
+
async customJob(n, t) {
|
|
1663
|
+
return (await this._httpRequester({
|
|
1664
|
+
method: "post",
|
|
1665
|
+
url: (this.url + "customjob").replace("//", "/"),
|
|
1666
|
+
data: { name: n, data: t },
|
|
1667
|
+
headers: {
|
|
1668
|
+
Authorization: "Bearer " + this.token
|
|
1669
|
+
}
|
|
1670
|
+
})).data;
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
class at extends I {
|
|
1674
|
+
constructor() {
|
|
1675
|
+
super(...arguments);
|
|
1676
|
+
h(this, "_noteId", 0);
|
|
1677
|
+
h(this, "_note", null);
|
|
1678
|
+
h(this, "_attrId", 0);
|
|
1679
|
+
h(this, "_attr", null);
|
|
1680
|
+
h(this, "_value", null);
|
|
1681
|
+
h(this, "_tagId", null);
|
|
1682
|
+
h(this, "_tag", null);
|
|
1683
|
+
}
|
|
1684
|
+
get noteId() {
|
|
1685
|
+
return this._noteId;
|
|
1686
|
+
}
|
|
1687
|
+
set noteId(t) {
|
|
1688
|
+
var s;
|
|
1689
|
+
t !== this._noteId && (this._noteId = t, t !== ((s = this.note) == null ? void 0 : s.id) && (this._note = null), this.isClean && this.dirty());
|
|
1690
|
+
}
|
|
1691
|
+
get note() {
|
|
1692
|
+
return this._note;
|
|
1693
|
+
}
|
|
1694
|
+
set note(t) {
|
|
1695
|
+
this._note = t, this.noteId = (t == null ? void 0 : t.id) ?? 0;
|
|
1696
|
+
}
|
|
1697
|
+
get attrId() {
|
|
1698
|
+
return this._attrId;
|
|
1699
|
+
}
|
|
1700
|
+
set attrId(t) {
|
|
1701
|
+
var s;
|
|
1702
|
+
t !== this._attrId && (this._attrId = t, t !== ((s = this.attr) == null ? void 0 : s.id) && (this._attr = null), this.isClean && this.dirty());
|
|
1703
|
+
}
|
|
1704
|
+
get attr() {
|
|
1705
|
+
return this._attr;
|
|
1706
|
+
}
|
|
1707
|
+
set attr(t) {
|
|
1708
|
+
const s = this._attr;
|
|
1709
|
+
this._attr = t, t ? (!s || t.type != s.type) && (this.value = t.defaultValue) : this.value = null, this.attrId = (t == null ? void 0 : t.id) ?? 0;
|
|
1710
|
+
}
|
|
1711
|
+
get value() {
|
|
1712
|
+
return this._value;
|
|
1713
|
+
}
|
|
1714
|
+
set value(t) {
|
|
1715
|
+
t != this._value && (this._value = t, this.isClean && this.dirty());
|
|
1716
|
+
}
|
|
1717
|
+
get tagId() {
|
|
1718
|
+
return this._tagId;
|
|
1719
|
+
}
|
|
1720
|
+
set tagId(t) {
|
|
1721
|
+
var s;
|
|
1722
|
+
t !== this._tagId && (this._tagId = t, t !== ((s = this.tag) == null ? void 0 : s.id) && (this._tag = null), this.isClean && this.dirty());
|
|
1723
|
+
}
|
|
1724
|
+
get tag() {
|
|
1725
|
+
return this._tag;
|
|
1726
|
+
}
|
|
1727
|
+
set tag(t) {
|
|
1728
|
+
this._tag = t, this.tagId = (t == null ? void 0 : t.id) ?? null;
|
|
1729
|
+
}
|
|
1730
|
+
duplicate() {
|
|
1731
|
+
const t = new at();
|
|
1732
|
+
return t.noteId = this.noteId, t.note = this.note, t.attrId = this.attrId, t.attr = this.attr, t.tagId = this.tagId, t.tag = this.tag, t.value = this.value, t;
|
|
1733
|
+
}
|
|
1734
|
+
validate(t = !1) {
|
|
1735
|
+
let s = null;
|
|
1736
|
+
if (this.noteId <= 0 && !this.isNew ? s = "NoteAttr noteId must be greater than zero" : this.attrId <= 0 && (s = "NoteAttr attrId must be greater than zero"), t && s != null)
|
|
1737
|
+
throw Error(s);
|
|
1738
|
+
return s == null;
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
class ct extends I {
|
|
1742
|
+
constructor() {
|
|
1743
|
+
super(...arguments);
|
|
1744
|
+
h(this, "_noteId", 0);
|
|
1745
|
+
h(this, "_note", null);
|
|
1746
|
+
h(this, "_tagId", 0);
|
|
1747
|
+
h(this, "_tag", null);
|
|
1748
|
+
}
|
|
1749
|
+
get noteId() {
|
|
1750
|
+
return this._noteId;
|
|
1751
|
+
}
|
|
1752
|
+
set noteId(t) {
|
|
1753
|
+
var s;
|
|
1754
|
+
t !== this._noteId && (this._noteId = t, t !== ((s = this.note) == null ? void 0 : s.id) && (this._note = null), this.isClean && this.dirty());
|
|
1755
|
+
}
|
|
1756
|
+
get note() {
|
|
1757
|
+
return this._note;
|
|
1758
|
+
}
|
|
1759
|
+
set note(t) {
|
|
1760
|
+
this._note = t, this.noteId = (t == null ? void 0 : t.id) ?? 0;
|
|
1761
|
+
}
|
|
1762
|
+
get tagId() {
|
|
1763
|
+
return this._tagId;
|
|
1764
|
+
}
|
|
1765
|
+
set tagId(t) {
|
|
1766
|
+
var s;
|
|
1767
|
+
t !== this._tagId && (this._tagId = t, t !== ((s = this.tag) == null ? void 0 : s.id) && (this._tag = null), this.isClean && this.dirty());
|
|
1768
|
+
}
|
|
1769
|
+
get tag() {
|
|
1770
|
+
return this._tag;
|
|
1771
|
+
}
|
|
1772
|
+
set tag(t) {
|
|
1773
|
+
this._tag = t, this.tagId = (t == null ? void 0 : t.id) ?? 0;
|
|
1774
|
+
}
|
|
1775
|
+
get attrs() {
|
|
1776
|
+
return this.note.attrs.filter((t) => t.tagId == this.tagId);
|
|
1777
|
+
}
|
|
1778
|
+
addAttr(t) {
|
|
1779
|
+
if (!this.note)
|
|
1780
|
+
throw new Error("Cannot call addAttr on NoteTag where note property has not been set");
|
|
1781
|
+
const s = this.note.addAttr(t);
|
|
1782
|
+
return s.tag = this.tag, s;
|
|
1783
|
+
}
|
|
1784
|
+
duplicate() {
|
|
1785
|
+
const t = new ct();
|
|
1786
|
+
return t.noteId = this.noteId, t.tagId = this.tagId, t;
|
|
1787
|
+
}
|
|
1788
|
+
validate(t = !1) {
|
|
1789
|
+
let s = null;
|
|
1790
|
+
if (this.noteId <= 0 && !this.isNew ? s = "NoteTag noteId must be greater than zero" : this.tagId <= 0 ? s = "NoteTag tagId must be greater than zero" : this.noteId == this.tagId && (s = "NoteTag cannot link a note to its own tag"), t && s != null)
|
|
1791
|
+
throw Error(s);
|
|
1792
|
+
return s == null;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
class ut extends I {
|
|
1796
|
+
constructor(t = "") {
|
|
1797
|
+
super();
|
|
1798
|
+
h(this, "_id", 0);
|
|
1799
|
+
h(this, "_name", "");
|
|
1800
|
+
h(this, "_color", null);
|
|
1801
|
+
this._name = t;
|
|
1802
|
+
}
|
|
1803
|
+
get id() {
|
|
1804
|
+
return this._id;
|
|
1805
|
+
}
|
|
1806
|
+
set id(t) {
|
|
1807
|
+
t !== this._id && (this._id = t, this.isClean && this.dirty());
|
|
1808
|
+
}
|
|
1809
|
+
get name() {
|
|
1810
|
+
return this._name;
|
|
1811
|
+
}
|
|
1812
|
+
set name(t) {
|
|
1813
|
+
t !== this._name && (this._name = t, this.isClean && this.dirty());
|
|
1814
|
+
}
|
|
1815
|
+
get color() {
|
|
1816
|
+
return this._color;
|
|
1817
|
+
}
|
|
1818
|
+
set color(t) {
|
|
1819
|
+
t !== this._color && (this._color = t, this.isClean && this.dirty());
|
|
1820
|
+
}
|
|
1821
|
+
duplicate() {
|
|
1822
|
+
const t = new ut();
|
|
1823
|
+
return t.id = this.id, t.name = this.name, t.state = this.state, t;
|
|
1824
|
+
}
|
|
1825
|
+
validate(t = !1) {
|
|
1826
|
+
let s = null;
|
|
1827
|
+
if (!this.isNew && this.id <= 0 ? s = "Tag id must be greater than zero if in non-new state." : !this.name || !/^[a-zA-Z][a-zA-Z0-9 ]*[a-zA-Z0-9]?$/.test(this.name) ? s = "Tag name is invalid, must only contain letters, numbers, and spaces, starting with a letter" : this.color && !/^#?[A-z0-9]{6}$/.test(this.color) && (s = "Tag color is invalid, must be a 6 character hexadecimal."), t && s != null)
|
|
1828
|
+
throw Error(s);
|
|
1829
|
+
return s == null;
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
class qt extends I {
|
|
1833
|
+
constructor() {
|
|
1834
|
+
super(...arguments);
|
|
1835
|
+
h(this, "id", 0);
|
|
1836
|
+
h(this, "_date", /* @__PURE__ */ new Date());
|
|
1837
|
+
h(this, "_text", "");
|
|
1838
|
+
h(this, "_archived", !1);
|
|
1839
|
+
h(this, "_spaceId", 0);
|
|
1840
|
+
h(this, "_space", null);
|
|
1841
|
+
h(this, "_ownTag", null);
|
|
1842
|
+
h(this, "_tags", []);
|
|
1843
|
+
h(this, "_attrs", []);
|
|
1844
|
+
}
|
|
1845
|
+
get date() {
|
|
1846
|
+
return this._date;
|
|
1847
|
+
}
|
|
1848
|
+
set date(t) {
|
|
1849
|
+
t !== this._date && (this._date = t, this.isClean && this.dirty());
|
|
1850
|
+
}
|
|
1851
|
+
get text() {
|
|
1852
|
+
return this._text;
|
|
1853
|
+
}
|
|
1854
|
+
set text(t) {
|
|
1855
|
+
t !== this._text && (this._text = t, this.isClean && this.dirty());
|
|
1856
|
+
}
|
|
1857
|
+
get archived() {
|
|
1858
|
+
return this._archived;
|
|
1859
|
+
}
|
|
1860
|
+
set archived(t) {
|
|
1861
|
+
t !== this._archived && (this._archived = t, this.isClean && this.dirty());
|
|
1862
|
+
}
|
|
1863
|
+
get spaceId() {
|
|
1864
|
+
return this._spaceId;
|
|
1865
|
+
}
|
|
1866
|
+
set spaceId(t) {
|
|
1867
|
+
var s;
|
|
1868
|
+
t !== this._spaceId && (this._spaceId = t, t !== ((s = this.space) == null ? void 0 : s.id) && (this._space = null), this.isClean && this.dirty());
|
|
1869
|
+
}
|
|
1870
|
+
get space() {
|
|
1871
|
+
return this._space;
|
|
1872
|
+
}
|
|
1873
|
+
set space(t) {
|
|
1874
|
+
this._space = t, this.spaceId = (t == null ? void 0 : t.id) ?? 0;
|
|
1875
|
+
}
|
|
1876
|
+
get ownTag() {
|
|
1877
|
+
return this._ownTag;
|
|
1878
|
+
}
|
|
1879
|
+
setOwnTag(t) {
|
|
1880
|
+
if (typeof t == "string")
|
|
1881
|
+
this.ownTag == null && (this._ownTag = new ut()), this.ownTag.name = t, this.ownTag.id = this.id;
|
|
1882
|
+
else {
|
|
1883
|
+
if (this.ownTag)
|
|
1884
|
+
throw new Error("Note has already had its tag set. If you would like to change the tag name, call setTag with just a string specifying the new tag name.");
|
|
1885
|
+
if (t.id != 0 && t.id != this.id)
|
|
1886
|
+
throw new Error("Attempted to set tag to note with non-matching ID. Added tag id must either match the note id, which indicates that the tag has already been added to the note. Otherwise the tag id must be zero, indicating that the tag still needs to be added.");
|
|
1887
|
+
this._ownTag = t;
|
|
1888
|
+
}
|
|
1889
|
+
return this;
|
|
1890
|
+
}
|
|
1891
|
+
removeOwnTag() {
|
|
1892
|
+
this.ownTag && (this.ownTag.isNew ? this._ownTag = null : this.ownTag.delete());
|
|
1893
|
+
}
|
|
1894
|
+
get tags() {
|
|
1895
|
+
return this._tags;
|
|
1896
|
+
}
|
|
1897
|
+
addTag(t) {
|
|
1898
|
+
if (t.isDeleted)
|
|
1899
|
+
throw Error("Cannot add a tag marked as deleted to a note");
|
|
1900
|
+
if (t.isNew)
|
|
1901
|
+
throw Error("Cannot add a tag that hasn't yet been saved to a note");
|
|
1902
|
+
if (t.id == this.id)
|
|
1903
|
+
throw Error("Note cannot add its own tag as a linked tag");
|
|
1904
|
+
let s = this.tags.find((r) => r.tagId == t.id);
|
|
1905
|
+
return s ? (s.isDeleted && s.dirty(), s) : (s = new ct(), s.note = this, s.tag = t, this._tags.push(s), s);
|
|
1906
|
+
}
|
|
1907
|
+
removeTag(t) {
|
|
1908
|
+
const s = this.tags.find((r) => r.tagId == t.id);
|
|
1909
|
+
return s ? (s.isNew ? this._tags = this._tags.filter((r) => r !== s) : s.delete(), this) : this;
|
|
1910
|
+
}
|
|
1911
|
+
get attrs() {
|
|
1912
|
+
return this._attrs;
|
|
1913
|
+
}
|
|
1914
|
+
addAttr(t) {
|
|
1915
|
+
if (t.isDeleted)
|
|
1916
|
+
throw Error("Cannot add an attribute marked as deleted to a note");
|
|
1917
|
+
if (t.isNew)
|
|
1918
|
+
throw Error("Cannot add an attribute that hasn't yet been saved to a note");
|
|
1919
|
+
let s = this.attrs.find((r) => r.attrId == t.id);
|
|
1920
|
+
return s ? (s.isDeleted && s.dirty(), s) : (s = new at(), s.note = this, s.attr = t, this._attrs.push(s), s);
|
|
1921
|
+
}
|
|
1922
|
+
removeAttr(t) {
|
|
1923
|
+
const s = this.attrs.find((r) => r.attrId == t.id);
|
|
1924
|
+
return s ? (s.isNew ? this._attrs = this._attrs.filter((r) => r !== s) : s.delete(), this) : this;
|
|
1925
|
+
}
|
|
1926
|
+
duplicate() {
|
|
1927
|
+
const t = new qt();
|
|
1928
|
+
return t.id = this.id, t.date = this.date, t.text = this.text, t.archived = this.archived, t.space = this.space, t.state = this.state, t;
|
|
1929
|
+
}
|
|
1930
|
+
validate(t = !1) {
|
|
1931
|
+
let s = null;
|
|
1932
|
+
if (this.spaceId <= 0 ? s = "Note spaceId must be greater than zero." : !this.isNew && this.id <= 0 && (s = "Note id must be greater than zero if in non-new state."), t && s != null)
|
|
1933
|
+
throw Error(s);
|
|
1934
|
+
if (this.ownTag && !this.ownTag.validate(t))
|
|
1935
|
+
return !1;
|
|
1936
|
+
for (const r of this.tags)
|
|
1937
|
+
if (!r.validate(t))
|
|
1938
|
+
return !1;
|
|
1939
|
+
for (const r of this.attrs)
|
|
1940
|
+
if (!r.validate(t))
|
|
1941
|
+
return !1;
|
|
1942
|
+
return s == null;
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
class $t {
|
|
1946
|
+
constructor() {
|
|
1947
|
+
h(this, "where", null);
|
|
1948
|
+
h(this, "order", null);
|
|
1949
|
+
h(this, "tags", []);
|
|
1950
|
+
h(this, "attrs", []);
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
class hn {
|
|
1954
|
+
constructor() {
|
|
1955
|
+
h(this, "space", null);
|
|
1956
|
+
h(this, "name", null);
|
|
1957
|
+
h(this, "searchDepth", 0);
|
|
1958
|
+
h(this, "strictSearchDepth", !0);
|
|
1959
|
+
h(this, "includeOwner", !1);
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
class fn {
|
|
1963
|
+
constructor() {
|
|
1964
|
+
h(this, "space", null);
|
|
1965
|
+
h(this, "name", null);
|
|
1966
|
+
h(this, "exists", !1);
|
|
1967
|
+
h(this, "tagNameFilters", null);
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
function yn(e) {
|
|
1971
|
+
const n = pn(e);
|
|
1972
|
+
return n.where = tt(n.where, n), n.order = tt(n.order, n), n.where = _t(n.where, n), n.order = _t(n.order, n), n;
|
|
1973
|
+
}
|
|
1974
|
+
function pn(e) {
|
|
1975
|
+
e = " " + e + " ";
|
|
1976
|
+
const n = new $t(), t = e.toUpperCase().indexOf(" ORDER BY ");
|
|
1977
|
+
return t < 0 ? n.where = e.trim() : (n.where = e.substring(0, t).trim(), n.order = e.substring(t + 10).trim()), n.where == "" && (n.where = null), n;
|
|
1978
|
+
}
|
|
1979
|
+
function tt(e, n) {
|
|
1980
|
+
const t = [
|
|
1981
|
+
/(#+\??~?|~)([\w\d]+\.)?([\w\d]+)/,
|
|
1982
|
+
//Single word tags and space names
|
|
1983
|
+
/(#+\??~?|~)\[([\w\d\s]+\.)?([\w\d\s]+)\]/
|
|
1984
|
+
//Multi-word tags and space names wrapped in []
|
|
1985
|
+
];
|
|
1986
|
+
for (const s of t)
|
|
1987
|
+
for (; ; ) {
|
|
1988
|
+
const r = s.exec(e);
|
|
1989
|
+
if (!r)
|
|
1990
|
+
break;
|
|
1991
|
+
const i = r[1], o = new hn();
|
|
1992
|
+
o.space = r[2] ? r[2].substring(0, r[2].length - 1) : null, o.name = r[3], o.includeOwner = i.includes("~"), o.searchDepth = (i.match(/#/g) || []).length, o.strictSearchDepth = !i.includes("?");
|
|
1993
|
+
const c = r[0], d = e.indexOf(c), f = d + c.length;
|
|
1994
|
+
e = e.substring(0, d) + `{tag${n.tags.length}}` + e.substring(f), n.tags.push(o);
|
|
1995
|
+
}
|
|
1996
|
+
return e;
|
|
1997
|
+
}
|
|
1998
|
+
function _t(e, n) {
|
|
1999
|
+
const t = [
|
|
2000
|
+
/@([\w\d]+\.(?!Exists\(|On\())?([\w\d]+)/,
|
|
2001
|
+
/@\[([\w\d\s]+\.)?([\w\d\s]+)\]/
|
|
2002
|
+
];
|
|
2003
|
+
for (const s of t)
|
|
2004
|
+
for (; ; ) {
|
|
2005
|
+
const r = s.exec(e);
|
|
2006
|
+
if (!r)
|
|
2007
|
+
break;
|
|
2008
|
+
const i = new fn();
|
|
2009
|
+
i.space = r[1] ? r[1].substring(0, r[1].length - 1) : null, i.name = r[2];
|
|
2010
|
+
const o = e.indexOf(r[0]);
|
|
2011
|
+
let c = o + r[0].length;
|
|
2012
|
+
if (e.substring(c, c + 9) == ".Exists()" && (i.exists = !0, c += 9), e.substring(c, c + 4) == ".On(") {
|
|
2013
|
+
let d = c + 4;
|
|
2014
|
+
if (c = e.indexOf(")", d), c < 0)
|
|
2015
|
+
throw Error("Unclosed bracket detected");
|
|
2016
|
+
let f = e.substring(d, c).split("|");
|
|
2017
|
+
const u = new $t();
|
|
2018
|
+
for (let p of f)
|
|
2019
|
+
p.startsWith("~") || (p = "~" + p), tt(p, u);
|
|
2020
|
+
i.tagNameFilters = u.tags, c++;
|
|
2021
|
+
}
|
|
2022
|
+
e = e.substring(0, o) + `{attr${n.attrs.length}}` + e.substring(c), n.attrs.push(i);
|
|
2023
|
+
}
|
|
2024
|
+
return e;
|
|
2025
|
+
}
|
|
2026
|
+
class Vt extends I {
|
|
2027
|
+
constructor(t = "") {
|
|
2028
|
+
super();
|
|
2029
|
+
h(this, "id", 0);
|
|
2030
|
+
h(this, "_name", "");
|
|
2031
|
+
this._name = t;
|
|
2032
|
+
}
|
|
2033
|
+
get name() {
|
|
2034
|
+
return this._name;
|
|
2035
|
+
}
|
|
2036
|
+
set name(t) {
|
|
2037
|
+
t !== this._name && (this._name = t, this.isClean && this.dirty());
|
|
2038
|
+
}
|
|
2039
|
+
duplicate() {
|
|
2040
|
+
const t = new Vt();
|
|
2041
|
+
return t.id = this.id, t.name = this.name, t.state = this.state, t;
|
|
2042
|
+
}
|
|
2043
|
+
validate(t = !1) {
|
|
2044
|
+
let s = null;
|
|
2045
|
+
if (!this.isNew && this.id <= 0 && (s = "Space id must be greater than zero if in non-new state."), t && s != null)
|
|
2046
|
+
throw Error(s);
|
|
2047
|
+
return s == null;
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
export {
|
|
2051
|
+
Rt as Attr,
|
|
2052
|
+
gn as Environment,
|
|
2053
|
+
wn as HttpClient,
|
|
2054
|
+
qt as Note,
|
|
2055
|
+
at as NoteAttr,
|
|
2056
|
+
ct as NoteTag,
|
|
2057
|
+
Vt as Space,
|
|
2058
|
+
ut as Tag,
|
|
2059
|
+
yn as parseQuery
|
|
2060
|
+
};
|