notu 0.2.4 → 0.2.5

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 CHANGED
@@ -1,9 +1,9 @@
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 {
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => (__defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value), value);
4
+ class ModelWithState {
5
5
  constructor() {
6
- h(this, "state", "NEW");
6
+ __publicField(this, "state", "NEW");
7
7
  }
8
8
  new() {
9
9
  return this.state = "NEW", this;
@@ -29,32 +29,32 @@ class I {
29
29
  get isDeleted() {
30
30
  return this.state == "DELETED";
31
31
  }
32
- validate(n = !1) {
32
+ validate(throwError = !1) {
33
33
  return !0;
34
34
  }
35
35
  }
36
- class Rt extends I {
36
+ class Attr extends ModelWithState {
37
37
  constructor() {
38
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);
39
+ __publicField(this, "id", 0);
40
+ __publicField(this, "_name", "");
41
+ __publicField(this, "_type", "TEXT");
42
+ __publicField(this, "_spaceId", 0);
43
+ __publicField(this, "_space", null);
44
44
  }
45
45
  get name() {
46
46
  return this._name;
47
47
  }
48
- set name(t) {
49
- t !== this._name && (this._name = t, this.isClean && this.dirty());
48
+ set name(value) {
49
+ value !== this._name && (this._name = value, this.isClean && this.dirty());
50
50
  }
51
51
  get type() {
52
52
  return this._type;
53
53
  }
54
- set type(t) {
54
+ set type(value) {
55
55
  if (!this.isNew)
56
56
  throw Error("Cannot change an attribute's type once it has been created.");
57
- this._type = t;
57
+ this._type = value;
58
58
  }
59
59
  get isText() {
60
60
  return this.type == "TEXT";
@@ -83,25 +83,25 @@ class Rt extends I {
83
83
  get spaceId() {
84
84
  return this._spaceId;
85
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());
86
+ set spaceId(value) {
87
+ var _a;
88
+ value !== this._spaceId && (this._spaceId = value, value !== ((_a = this.space) == null ? void 0 : _a.id) && (this._space = null), this.isClean && this.dirty());
89
89
  }
90
90
  get space() {
91
91
  return this._space;
92
92
  }
93
- set space(t) {
94
- this._space = t, this.spaceId = (t == null ? void 0 : t.id) ?? 0;
93
+ set space(value) {
94
+ this._space = value, this.spaceId = (value == null ? void 0 : value.id) ?? 0;
95
95
  }
96
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;
97
+ const output = new Attr();
98
+ return output.id = this.id, output.name = this.name, output.type = this.type, output.space = this.space, output;
99
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;
100
+ validate(throwError = !1) {
101
+ let output = null;
102
+ if (this.spaceId <= 0 ? output = "Note spaceId must be greater than zero." : !this.isNew && this.id <= 0 && (output = "Attr id must be greater than zero if in non-new state."), throwError && output != null)
103
+ throw Error(output);
104
+ return output == null;
105
105
  }
106
106
  get defaultValue() {
107
107
  switch (this.type) {
@@ -116,13 +116,13 @@ class Rt extends I {
116
116
  }
117
117
  }
118
118
  }
119
- class gn {
120
- constructor(n) {
121
- h(this, "_client", null);
122
- h(this, "_spaces", []);
123
- if (!n)
119
+ class Environment {
120
+ constructor(client) {
121
+ __publicField(this, "_client", null);
122
+ __publicField(this, "_spaces", []);
123
+ if (!client)
124
124
  throw Error("Client must be set on Environment constructor");
125
- this._client = n;
125
+ this._client = client;
126
126
  }
127
127
  get client() {
128
128
  return this._client;
@@ -133,254 +133,254 @@ class gn {
133
133
  async loadSpaces() {
134
134
  return this._spaces = await this.client.getSpaces(), this.spaces;
135
135
  }
136
- async saveSpace(n) {
137
- return await this.client.saveSpace(n);
136
+ async saveSpace(space) {
137
+ return await this.client.saveSpace(space);
138
138
  }
139
- async getNotes(n, t) {
140
- return await this.client.getNotes(n, t);
139
+ async getNotes(query, spaceId) {
140
+ return await this.client.getNotes(query, spaceId);
141
141
  }
142
- async getNoteCount(n, t) {
143
- return await this.client.getNoteCount(n, t);
142
+ async getNoteCount(query, spaceId) {
143
+ return await this.client.getNoteCount(query, spaceId);
144
144
  }
145
- async saveNote(n) {
146
- return (await this.client.saveNotes([n]))[0];
145
+ async saveNote(note) {
146
+ return (await this.client.saveNotes([note]))[0];
147
147
  }
148
- async saveNotes(n) {
149
- return await this.client.saveNotes(n);
148
+ async saveNotes(notes) {
149
+ return await this.client.saveNotes(notes);
150
150
  }
151
- async customJob(n, t) {
152
- return await this.client.customJob(n, t);
151
+ async customJob(name, data) {
152
+ return await this.client.customJob(name, data);
153
153
  }
154
154
  }
155
- function St(e, n) {
155
+ function bind(fn, thisArg) {
156
156
  return function() {
157
- return e.apply(n, arguments);
157
+ return fn.apply(thisArg, arguments);
158
158
  };
159
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);
160
+ const { toString } = Object.prototype, { getPrototypeOf } = Object, kindOf = ((cache) => (thing) => {
161
+ const str = toString.call(thing);
162
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
163
+ })(/* @__PURE__ */ Object.create(null)), kindOfTest = (type) => (type = type.toLowerCase(), (thing) => kindOf(thing) === type), typeOfTest = (type) => (thing) => typeof thing === type, { isArray } = Array, isUndefined = typeOfTest("undefined");
164
+ function isBuffer(val) {
165
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
166
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;
167
+ const isArrayBuffer = kindOfTest("ArrayBuffer");
168
+ function isArrayBufferView(val) {
169
+ let result;
170
+ return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? result = ArrayBuffer.isView(val) : result = val && val.buffer && isArrayBuffer(val.buffer), result;
171
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")
172
+ const isString = typeOfTest("string"), isFunction = typeOfTest("function"), isNumber = typeOfTest("number"), isObject = (thing) => thing !== null && typeof thing == "object", isBoolean = (thing) => thing === !0 || thing === !1, isPlainObject = (val) => {
173
+ if (kindOf(val) !== "object")
174
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")
175
+ const prototype2 = getPrototypeOf(val);
176
+ return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
177
+ }, isDate = kindOfTest("Date"), isFile = kindOfTest("File"), isBlob = kindOfTest("Blob"), isFileList = kindOfTest("FileList"), isStream = (val) => isObject(val) && isFunction(val.pipe), isFormData = (thing) => {
178
+ let kind;
179
+ return thing && (typeof FormData == "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
180
+ kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
181
+ }, isURLSearchParams = kindOfTest("URLSearchParams"), trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
182
+ function forEach(obj, fn, { allOwnKeys = !1 } = {}) {
183
+ if (obj === null || typeof obj > "u")
184
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);
185
+ let i, l;
186
+ if (typeof obj != "object" && (obj = [obj]), isArray(obj))
187
+ for (i = 0, l = obj.length; i < l; i++)
188
+ fn.call(null, obj[i], i, obj);
189
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;
190
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj), len = keys.length;
191
+ let key;
192
+ for (i = 0; i < len; i++)
193
+ key = keys[i], fn.call(null, obj[key], key, obj);
194
+ }
195
+ }
196
+ function findKey(obj, key) {
197
+ key = key.toLowerCase();
198
+ const keys = Object.keys(obj);
199
+ let i = keys.length, _key;
200
+ for (; i-- > 0; )
201
+ if (_key = keys[i], key === _key.toLowerCase())
202
+ return _key;
203
203
  return null;
204
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;
205
+ const _global = (() => typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global)(), isContextDefined = (context) => !isUndefined(context) && context !== _global;
206
+ function merge() {
207
+ const { caseless } = isContextDefined(this) && this || {}, result = {}, assignValue = (val, key) => {
208
+ const targetKey = caseless && findKey(result, key) || key;
209
+ isPlainObject(result[targetKey]) && isPlainObject(val) ? result[targetKey] = merge(result[targetKey], val) : isPlainObject(val) ? result[targetKey] = merge({}, val) : isArray(val) ? result[targetKey] = val.slice() : result[targetKey] = val;
210
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;
211
+ for (let i = 0, l = arguments.length; i < l; i++)
212
+ arguments[i] && forEach(arguments[i], assignValue);
213
+ return result;
214
+ }
215
+ const extend = (a, b, thisArg, { allOwnKeys } = {}) => (forEach(b, (val, key) => {
216
+ thisArg && isFunction(val) ? a[key] = bind(val, thisArg) : a[key] = val;
217
+ }, { allOwnKeys }), a), stripBOM = (content) => (content.charCodeAt(0) === 65279 && (content = content.slice(1)), content), inherits = (constructor, superConstructor, props, descriptors2) => {
218
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors2), constructor.prototype.constructor = constructor, Object.defineProperty(constructor, "super", {
219
+ value: superConstructor.prototype
220
+ }), props && Object.assign(constructor.prototype, props);
221
+ }, toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
222
+ let props, i, prop;
223
+ const merged = {};
224
+ if (destObj = destObj || {}, sourceObj == null)
225
+ return destObj;
226
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)
227
+ for (props = Object.getOwnPropertyNames(sourceObj), i = props.length; i-- > 0; )
228
+ prop = props[i], (!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop] && (destObj[prop] = sourceObj[prop], merged[prop] = !0);
229
+ sourceObj = filter2 !== !1 && getPrototypeOf(sourceObj);
230
+ } while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
231
+ return destObj;
232
+ }, endsWith = (str, searchString, position) => {
233
+ str = String(str), (position === void 0 || position > str.length) && (position = str.length), position -= searchString.length;
234
+ const lastIndex = str.indexOf(searchString, position);
235
+ return lastIndex !== -1 && lastIndex === position;
236
+ }, toArray = (thing) => {
237
+ if (!thing)
238
238
  return null;
239
- if (C(e))
240
- return e;
241
- let n = e.length;
242
- if (!Ot(n))
239
+ if (isArray(thing))
240
+ return thing;
241
+ let i = thing.length;
242
+ if (!isNumber(i))
243
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(
244
+ const arr = new Array(i);
245
+ for (; i-- > 0; )
246
+ arr[i] = thing[i];
247
+ return arr;
248
+ }, isTypedArray = ((TypedArray) => (thing) => TypedArray && thing instanceof TypedArray)(typeof Uint8Array < "u" && getPrototypeOf(Uint8Array)), forEachEntry = (obj, fn) => {
249
+ const iterator = (obj && obj[Symbol.iterator]).call(obj);
250
+ let result;
251
+ for (; (result = iterator.next()) && !result.done; ) {
252
+ const pair = result.value;
253
+ fn.call(obj, pair[0], pair[1]);
254
+ }
255
+ }, matchAll = (regExp, str) => {
256
+ let matches;
257
+ const arr = [];
258
+ for (; (matches = regExp.exec(str)) !== null; )
259
+ arr.push(matches);
260
+ return arr;
261
+ }, isHTMLForm = kindOfTest("HTMLFormElement"), toCamelCase = (str) => str.toLowerCase().replace(
262
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)
263
+ function(m, p1, p2) {
264
+ return p1.toUpperCase() + p2;
265
+ }
266
+ ), hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype), isRegExp = kindOfTest("RegExp"), reduceDescriptors = (obj, reducer) => {
267
+ const descriptors2 = Object.getOwnPropertyDescriptors(obj), reducedDescriptors = {};
268
+ forEach(descriptors2, (descriptor, name) => {
269
+ let ret;
270
+ (ret = reducer(descriptor, name, obj)) !== !1 && (reducedDescriptors[name] = ret || descriptor);
271
+ }), Object.defineProperties(obj, reducedDescriptors);
272
+ }, freezeMethods = (obj) => {
273
+ reduceDescriptors(obj, (descriptor, name) => {
274
+ if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1)
275
275
  return !1;
276
- const s = e[t];
277
- if (_(s)) {
278
- if (n.enumerable = !1, "writable" in n) {
279
- n.writable = !1;
276
+ const value = obj[name];
277
+ if (isFunction(value)) {
278
+ if (descriptor.enumerable = !1, "writable" in descriptor) {
279
+ descriptor.writable = !1;
280
280
  return;
281
281
  }
282
- n.set || (n.set = () => {
283
- throw Error("Can not rewrite read-only method '" + t + "'");
282
+ descriptor.set || (descriptor.set = () => {
283
+ throw Error("Can not rewrite read-only method '" + name + "'");
284
284
  });
285
285
  }
286
286
  });
287
- }, _e = (e, n) => {
288
- const t = {}, s = (r) => {
289
- r.forEach((i) => {
290
- t[i] = !0;
287
+ }, toObjectSet = (arrayOrString, delimiter) => {
288
+ const obj = {}, define = (arr) => {
289
+ arr.forEach((value) => {
290
+ obj[value] = !0;
291
291
  });
292
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;
293
+ return isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)), obj;
294
+ }, noop = () => {
295
+ }, toFiniteNumber = (value, defaultValue) => (value = +value, Number.isFinite(value) ? value : defaultValue), ALPHA = "abcdefghijklmnopqrstuvwxyz", DIGIT = "0123456789", ALPHABET = {
296
+ DIGIT,
297
+ ALPHA,
298
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
299
+ }, generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
300
+ let str = "";
301
+ const { length } = alphabet;
302
+ for (; size--; )
303
+ str += alphabet[Math.random() * length | 0];
304
+ return str;
305
305
  };
306
- function Oe(e) {
307
- return !!(e && _(e.append) && e[Symbol.toStringTag] === "FormData" && e[Symbol.iterator]);
306
+ function isSpecCompliantForm(thing) {
307
+ return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]);
308
308
  }
309
- const Ae = (e) => {
310
- const n = new Array(10), t = (s, r) => {
311
- if (J(s)) {
312
- if (n.indexOf(s) >= 0)
309
+ const toJSONObject = (obj) => {
310
+ const stack = new Array(10), visit = (source, i) => {
311
+ if (isObject(source)) {
312
+ if (stack.indexOf(source) >= 0)
313
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;
314
+ if (!("toJSON" in source)) {
315
+ stack[i] = source;
316
+ const target = isArray(source) ? [] : {};
317
+ return forEach(source, (value, key) => {
318
+ const reducedValue = visit(value, i + 1);
319
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
320
+ }), stack[i] = void 0, target;
321
321
  }
322
322
  }
323
- return s;
323
+ return source;
324
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,
325
+ return visit(obj, 0);
326
+ }, isAsyncFn = kindOfTest("AsyncFunction"), isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch), utils = {
327
+ isArray,
328
+ isArrayBuffer,
329
+ isBuffer,
330
+ isFormData,
331
+ isArrayBufferView,
332
+ isString,
333
+ isNumber,
334
+ isBoolean,
335
+ isObject,
336
+ isPlainObject,
337
+ isUndefined,
338
+ isDate,
339
+ isFile,
340
+ isBlob,
341
+ isRegExp,
342
+ isFunction,
343
+ isStream,
344
+ isURLSearchParams,
345
+ isTypedArray,
346
+ isFileList,
347
+ forEach,
348
+ merge,
349
+ extend,
350
+ trim,
351
+ stripBOM,
352
+ inherits,
353
+ toFlatObject,
354
+ kindOf,
355
+ kindOfTest,
356
+ endsWith,
357
+ toArray,
358
+ forEachEntry,
359
+ matchAll,
360
+ isHTMLForm,
361
+ hasOwnProperty,
362
+ hasOwnProp: hasOwnProperty,
363
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
364
+ reduceDescriptors,
365
+ freezeMethods,
366
+ toObjectSet,
367
+ toCamelCase,
368
+ noop,
369
+ toFiniteNumber,
370
+ findKey,
371
+ global: _global,
372
+ isContextDefined,
373
+ ALPHABET,
374
+ generateString,
375
+ isSpecCompliantForm,
376
+ toJSONObject,
377
+ isAsyncFn,
378
+ isThenable
379
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);
380
+ function AxiosError(message, code, config, request, response) {
381
+ Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = message, this.name = "AxiosError", code && (this.code = code), config && (this.config = config), request && (this.request = request), response && (this.response = response);
382
382
  }
383
- a.inherits(g, Error, {
383
+ utils.inherits(AxiosError, Error, {
384
384
  toJSON: function() {
385
385
  return {
386
386
  // Standard
@@ -395,13 +395,13 @@ a.inherits(g, Error, {
395
395
  columnNumber: this.columnNumber,
396
396
  stack: this.stack,
397
397
  // Axios
398
- config: a.toJSONObject(this.config),
398
+ config: utils.toJSONObject(this.config),
399
399
  code: this.code,
400
400
  status: this.response && this.response.status ? this.response.status : null
401
401
  };
402
402
  }
403
403
  });
404
- const Pt = g.prototype, Dt = {};
404
+ const prototype$1 = AxiosError.prototype, descriptors = {};
405
405
  [
406
406
  "ERR_BAD_OPTION_VALUE",
407
407
  "ERR_BAD_OPTION",
@@ -416,99 +416,99 @@ const Pt = g.prototype, Dt = {};
416
416
  "ERR_NOT_SUPPORT",
417
417
  "ERR_INVALID_URL"
418
418
  // eslint-disable-next-line func-names
419
- ].forEach((e) => {
420
- Dt[e] = { value: e };
419
+ ].forEach((code) => {
420
+ descriptors[code] = { value: code };
421
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;
422
+ Object.defineProperties(AxiosError, descriptors);
423
+ Object.defineProperty(prototype$1, "isAxiosError", { value: !0 });
424
+ AxiosError.from = (error, code, config, request, response, customProps) => {
425
+ const axiosError = Object.create(prototype$1);
426
+ return utils.toFlatObject(error, axiosError, function(obj) {
427
+ return obj !== Error.prototype;
428
+ }, (prop) => prop !== "isAxiosError"), AxiosError.call(axiosError, error.message, code, config, request, response), axiosError.cause = error, axiosError.name = error.name, customProps && Object.assign(axiosError, customProps), axiosError;
429
429
  };
430
- const Ie = null;
431
- function Q(e) {
432
- return a.isPlainObject(e) || a.isArray(e);
430
+ const httpAdapter = null;
431
+ function isVisitable(thing) {
432
+ return utils.isPlainObject(thing) || utils.isArray(thing);
433
433
  }
434
- function Bt(e) {
435
- return a.endsWith(e, "[]") ? e.slice(0, -2) : e;
434
+ function removeBrackets(key) {
435
+ return utils.endsWith(key, "[]") ? key.slice(0, -2) : key;
436
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;
437
+ function renderKey(path, key, dots) {
438
+ return path ? path.concat(key).map(function(token, i) {
439
+ return token = removeBrackets(token), !dots && i ? "[" + token + "]" : token;
440
+ }).join(dots ? "." : "") : key;
441
441
  }
442
- function Ce(e) {
443
- return a.isArray(e) && !e.some(Q);
442
+ function isFlatArray(arr) {
443
+ return utils.isArray(arr) && !arr.some(isVisitable);
444
444
  }
445
- const Pe = a.toFlatObject(a, {}, null, function(n) {
446
- return /^is[A-Z]/.test(n);
445
+ const predicates = utils.toFlatObject(utils, {}, null, function(prop) {
446
+ return /^is[A-Z]/.test(prop);
447
447
  });
448
- function q(e, n, t) {
449
- if (!a.isObject(e))
448
+ function toFormData(obj, formData, options) {
449
+ if (!utils.isObject(obj))
450
450
  throw new TypeError("target must be an object");
451
- n = n || new FormData(), t = a.toFlatObject(t, {
451
+ formData = formData || new FormData(), options = utils.toFlatObject(options, {
452
452
  metaTokens: !0,
453
453
  dots: !1,
454
454
  indexes: !1
455
- }, !1, function(m, b) {
456
- return !a.isUndefined(b[m]);
455
+ }, !1, function(option, source) {
456
+ return !utils.isUndefined(source[option]);
457
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))
458
+ const metaTokens = options.metaTokens, visitor = options.visitor || defaultVisitor, dots = options.dots, indexes = options.indexes, useBlob = (options.Blob || typeof Blob < "u" && Blob) && utils.isSpecCompliantForm(formData);
459
+ if (!utils.isFunction(visitor))
460
460
  throw new TypeError("visitor must be a function");
461
- function f(l) {
462
- if (l === null)
461
+ function convertValue(value) {
462
+ if (value === null)
463
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(
464
+ if (utils.isDate(value))
465
+ return value.toISOString();
466
+ if (!useBlob && utils.isBlob(value))
467
+ throw new AxiosError("Blob is not supported. Use a Buffer instead.");
468
+ return utils.isArrayBuffer(value) || utils.isTypedArray(value) ? useBlob && typeof Blob == "function" ? new Blob([value]) : Buffer.from(value) : value;
469
+ }
470
+ function defaultVisitor(value, key, path) {
471
+ let arr = value;
472
+ if (value && !path && typeof value == "object") {
473
+ if (utils.endsWith(key, "{}"))
474
+ key = metaTokens ? key : key.slice(0, -2), value = JSON.stringify(value);
475
+ else if (utils.isArray(value) && isFlatArray(value) || (utils.isFileList(value) || utils.endsWith(key, "[]")) && (arr = utils.toArray(value)))
476
+ return key = removeBrackets(key), arr.forEach(function(el, index) {
477
+ !(utils.isUndefined(el) || el === null) && formData.append(
478
478
  // eslint-disable-next-line no-nested-ternary
479
- o === !0 ? ht([m], Wt, i) : o === null ? m : m + "[]",
480
- f(L)
479
+ indexes === !0 ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
480
+ convertValue(el)
481
481
  );
482
482
  }), !1;
483
483
  }
484
- return Q(l) ? !0 : (n.append(ht(b, m, i), f(l)), !1);
484
+ return isVisitable(value) ? !0 : (formData.append(renderKey(path, key, dots), convertValue(value)), !1);
485
485
  }
486
- const p = [], y = Object.assign(Pe, {
487
- defaultVisitor: u,
488
- convertValue: f,
489
- isVisitable: Q
486
+ const stack = [], exposedHelpers = Object.assign(predicates, {
487
+ defaultVisitor,
488
+ convertValue,
489
+ isVisitable
490
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();
491
+ function build(value, path) {
492
+ if (!utils.isUndefined(value)) {
493
+ if (stack.indexOf(value) !== -1)
494
+ throw Error("Circular reference detected in " + path.join("."));
495
+ stack.push(value), utils.forEach(value, function(el, key) {
496
+ (!(utils.isUndefined(el) || el === null) && visitor.call(
497
+ formData,
498
+ el,
499
+ utils.isString(key) ? key.trim() : key,
500
+ path,
501
+ exposedHelpers
502
+ )) === !0 && build(el, path ? path.concat(key) : [key]);
503
+ }), stack.pop();
504
504
  }
505
505
  }
506
- if (!a.isObject(e))
506
+ if (!utils.isObject(obj))
507
507
  throw new TypeError("data must be an object");
508
- return E(e), n;
508
+ return build(obj), formData;
509
509
  }
510
- function ft(e) {
511
- const n = {
510
+ function encode$1(str) {
511
+ const charMap = {
512
512
  "!": "%21",
513
513
  "'": "%27",
514
514
  "(": "%28",
@@ -517,40 +517,40 @@ function ft(e) {
517
517
  "%20": "+",
518
518
  "%00": "\0"
519
519
  };
520
- return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(s) {
521
- return n[s];
520
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function(match) {
521
+ return charMap[match];
522
522
  });
523
523
  }
524
- function nt(e, n) {
525
- this._pairs = [], e && q(e, this, n);
524
+ function AxiosURLSearchParams(params, options) {
525
+ this._pairs = [], params && toFormData(params, this, options);
526
526
  }
527
- const Ft = nt.prototype;
528
- Ft.append = function(n, t) {
529
- this._pairs.push([n, t]);
527
+ const prototype = AxiosURLSearchParams.prototype;
528
+ prototype.append = function(name, value) {
529
+ this._pairs.push([name, value]);
530
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]);
531
+ prototype.toString = function(encoder) {
532
+ const _encode = encoder ? function(value) {
533
+ return encoder.call(this, value, encode$1);
534
+ } : encode$1;
535
+ return this._pairs.map(function(pair) {
536
+ return _encode(pair[0]) + "=" + _encode(pair[1]);
537
537
  }, "").join("&");
538
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, "]");
539
+ function encode(val) {
540
+ return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
541
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;
542
+ function buildURL(url, params, options) {
543
+ if (!params)
544
+ return url;
545
+ const _encode = options && options.encode || encode, serializeFn = options && options.serialize;
546
+ let serializedParams;
547
+ if (serializeFn ? serializedParams = serializeFn(params, options) : serializedParams = utils.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode), serializedParams) {
548
+ const hashmarkIndex = url.indexOf("#");
549
+ hashmarkIndex !== -1 && (url = url.slice(0, hashmarkIndex)), url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
550
550
  }
551
- return e;
551
+ return url;
552
552
  }
553
- class Be {
553
+ class InterceptorManager {
554
554
  constructor() {
555
555
  this.handlers = [];
556
556
  }
@@ -562,12 +562,12 @@ class Be {
562
562
  *
563
563
  * @return {Number} An ID used to remove interceptor later
564
564
  */
565
- use(n, t, s) {
565
+ use(fulfilled, rejected, options) {
566
566
  return this.handlers.push({
567
- fulfilled: n,
568
- rejected: t,
569
- synchronous: s ? s.synchronous : !1,
570
- runWhen: s ? s.runWhen : null
567
+ fulfilled,
568
+ rejected,
569
+ synchronous: options ? options.synchronous : !1,
570
+ runWhen: options ? options.runWhen : null
571
571
  }), this.handlers.length - 1;
572
572
  }
573
573
  /**
@@ -577,8 +577,8 @@ class Be {
577
577
  *
578
578
  * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
579
579
  */
580
- eject(n) {
581
- this.handlers[n] && (this.handlers[n] = null);
580
+ eject(id) {
581
+ this.handlers[id] && (this.handlers[id] = null);
582
582
  }
583
583
  /**
584
584
  * Clear all interceptors from the stack
@@ -598,114 +598,114 @@ class Be {
598
598
  *
599
599
  * @returns {void}
600
600
  */
601
- forEach(n) {
602
- a.forEach(this.handlers, function(s) {
603
- s !== null && n(s);
601
+ forEach(fn) {
602
+ utils.forEach(this.handlers, function(h) {
603
+ h !== null && fn(h);
604
604
  });
605
605
  }
606
606
  }
607
- const pt = Be, Ut = {
607
+ const InterceptorManager$1 = InterceptorManager, transitionalDefaults = {
608
608
  silentJSONParsing: !0,
609
609
  forcedJSONParsing: !0,
610
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 = {
611
+ }, URLSearchParams$1 = typeof URLSearchParams < "u" ? URLSearchParams : AxiosURLSearchParams, FormData$1 = typeof FormData < "u" ? FormData : null, Blob$1 = typeof Blob < "u" ? Blob : null, isStandardBrowserEnv = (() => {
612
+ let product;
613
+ return typeof navigator < "u" && ((product = navigator.product) === "ReactNative" || product === "NativeScript" || product === "NS") ? !1 : typeof window < "u" && typeof document < "u";
614
+ })(), isStandardBrowserWebWorkerEnv = (() => typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
615
+ self instanceof WorkerGlobalScope && typeof self.importScripts == "function")(), platform = {
616
616
  isBrowser: !0,
617
617
  classes: {
618
- URLSearchParams: Fe,
619
- FormData: Le,
620
- Blob: Ue
618
+ URLSearchParams: URLSearchParams$1,
619
+ FormData: FormData$1,
620
+ Blob: Blob$1
621
621
  },
622
- isStandardBrowserEnv: ke,
623
- isStandardBrowserWebWorkerEnv: je,
622
+ isStandardBrowserEnv,
623
+ isStandardBrowserWebWorkerEnv,
624
624
  protocols: ["http", "https", "file", "blob", "url", "data"]
625
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);
626
+ function toURLEncodedForm(data, options) {
627
+ return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
628
+ visitor: function(value, key, path, helpers) {
629
+ return platform.isNode && utils.isBuffer(value) ? (this.append(key, value.toString("base64")), !1) : helpers.defaultVisitor.apply(this, arguments);
630
630
  }
631
- }, n));
631
+ }, options));
632
632
  }
633
- function He(e) {
634
- return a.matchAll(/\w+|\[(\w*)]/g, e).map((n) => n[0] === "[]" ? "" : n[1] || n[0]);
633
+ function parsePropPath(name) {
634
+ return utils.matchAll(/\w+|\[(\w*)]/g, name).map((match) => match[0] === "[]" ? "" : match[1] || match[0]);
635
635
  }
636
- function Me(e) {
637
- const n = {}, t = Object.keys(e);
638
- let s;
639
- const r = t.length;
636
+ function arrayToObject(arr) {
637
+ const obj = {}, keys = Object.keys(arr);
640
638
  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;
639
+ const len = keys.length;
640
+ let key;
641
+ for (i = 0; i < len; i++)
642
+ key = keys[i], obj[key] = arr[key];
643
+ return obj;
644
+ }
645
+ function formDataToJSON(formData) {
646
+ function buildPath(path, value, target, index) {
647
+ let name = path[index++];
648
+ const isNumericKey = Number.isFinite(+name), isLast = index >= path.length;
649
+ return name = !name && utils.isArray(target) ? target.length : name, isLast ? (utils.hasOwnProp(target, name) ? target[name] = [target[name], value] : target[name] = value, !isNumericKey) : ((!target[name] || !utils.isObject(target[name])) && (target[name] = []), buildPath(path, value, target[name], index) && utils.isArray(target[name]) && (target[name] = arrayToObject(target[name])), !isNumericKey);
650
+ }
651
+ if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
652
+ const obj = {};
653
+ return utils.forEachEntry(formData, (name, value) => {
654
+ buildPath(parsePropPath(name), value, obj, 0);
655
+ }), obj;
656
656
  }
657
657
  return null;
658
658
  }
659
- function Je(e, n, t) {
660
- if (a.isString(e))
659
+ function stringifySafely(rawValue, parser, encoder) {
660
+ if (utils.isString(rawValue))
661
661
  try {
662
- return (n || JSON.parse)(e), a.trim(e);
663
- } catch (s) {
664
- if (s.name !== "SyntaxError")
665
- throw s;
662
+ return (parser || JSON.parse)(rawValue), utils.trim(rawValue);
663
+ } catch (e) {
664
+ if (e.name !== "SyntaxError")
665
+ throw e;
666
666
  }
667
- return (t || JSON.stringify)(e);
667
+ return (encoder || JSON.stringify)(rawValue);
668
668
  }
669
- const st = {
670
- transitional: Ut,
669
+ const defaults = {
670
+ transitional: transitionalDefaults,
671
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(),
672
+ transformRequest: [function(data, headers) {
673
+ const contentType = headers.getContentType() || "", hasJSONContentType = contentType.indexOf("application/json") > -1, isObjectPayload = utils.isObject(data);
674
+ if (isObjectPayload && utils.isHTMLForm(data) && (data = new FormData(data)), utils.isFormData(data))
675
+ return hasJSONContentType && hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
676
+ if (utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data))
677
+ return data;
678
+ if (utils.isArrayBufferView(data))
679
+ return data.buffer;
680
+ if (utils.isURLSearchParams(data))
681
+ return headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), data.toString();
682
+ let isFileList2;
683
+ if (isObjectPayload) {
684
+ if (contentType.indexOf("application/x-www-form-urlencoded") > -1)
685
+ return toURLEncodedForm(data, this.formSerializer).toString();
686
+ if ((isFileList2 = utils.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
687
+ const _FormData = this.env && this.env.FormData;
688
+ return toFormData(
689
+ isFileList2 ? { "files[]": data } : data,
690
+ _FormData && new _FormData(),
691
691
  this.formSerializer
692
692
  );
693
693
  }
694
694
  }
695
- return i || r ? (t.setContentType("application/json", !1), Je(n)) : n;
695
+ return isObjectPayload || hasJSONContentType ? (headers.setContentType("application/json", !1), stringifySafely(data)) : data;
696
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;
697
+ transformResponse: [function(data) {
698
+ const transitional2 = this.transitional || defaults.transitional, forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing, JSONRequested = this.responseType === "json";
699
+ if (data && utils.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
700
+ const strictJSONParsing = !(transitional2 && transitional2.silentJSONParsing) && JSONRequested;
701
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;
702
+ return JSON.parse(data);
703
+ } catch (e) {
704
+ if (strictJSONParsing)
705
+ throw e.name === "SyntaxError" ? AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response) : e;
706
706
  }
707
707
  }
708
- return n;
708
+ return data;
709
709
  }],
710
710
  /**
711
711
  * A timeout in milliseconds to abort a request. If set to 0 (default) a
@@ -717,11 +717,11 @@ const st = {
717
717
  maxContentLength: -1,
718
718
  maxBodyLength: -1,
719
719
  env: {
720
- FormData: S.classes.FormData,
721
- Blob: S.classes.Blob
720
+ FormData: platform.classes.FormData,
721
+ Blob: platform.classes.Blob
722
722
  },
723
- validateStatus: function(n) {
724
- return n >= 200 && n < 300;
723
+ validateStatus: function(status) {
724
+ return status >= 200 && status < 300;
725
725
  },
726
726
  headers: {
727
727
  common: {
@@ -730,10 +730,10 @@ const st = {
730
730
  }
731
731
  }
732
732
  };
733
- a.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
734
- st.headers[e] = {};
733
+ utils.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
734
+ defaults.headers[method] = {};
735
735
  });
736
- const rt = st, qe = a.toObjectSet([
736
+ const defaults$1 = defaults, ignoreDuplicateOf = utils.toObjectSet([
737
737
  "age",
738
738
  "authorization",
739
739
  "content-length",
@@ -751,213 +751,213 @@ const rt = st, qe = a.toObjectSet([
751
751
  "referer",
752
752
  "retry-after",
753
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);
754
+ ]), parseHeaders = (rawHeaders) => {
755
+ const parsed = {};
756
+ let key, val, i;
757
+ return rawHeaders && rawHeaders.split(`
758
+ `).forEach(function(line) {
759
+ i = line.indexOf(":"), key = line.substring(0, i).trim().toLowerCase(), val = line.substring(i + 1).trim(), !(!key || parsed[key] && ignoreDuplicateOf[key]) && (key === "set-cookie" ? parsed[key] ? parsed[key].push(val) : parsed[key] = [val] : parsed[key] = parsed[key] ? parsed[key] + ", " + val : val);
760
+ }), parsed;
761
+ }, $internals = Symbol("internals");
762
+ function normalizeHeader(header) {
763
+ return header && String(header).trim().toLowerCase();
764
+ }
765
+ function normalizeValue(value) {
766
+ return value === !1 || value == null ? value : utils.isArray(value) ? value.map(normalizeValue) : String(value);
767
+ }
768
+ function parseTokens(str) {
769
+ const tokens = /* @__PURE__ */ Object.create(null), tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
770
+ let match;
771
+ for (; match = tokensRE.exec(str); )
772
+ tokens[match[1]] = match[2];
773
+ return tokens;
774
+ }
775
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
776
+ function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
777
+ if (utils.isFunction(filter2))
778
+ return filter2.call(this, value, header);
779
+ if (isHeaderNameFilter && (value = header), !!utils.isString(value)) {
780
+ if (utils.isString(filter2))
781
+ return value.indexOf(filter2) !== -1;
782
+ if (utils.isRegExp(filter2))
783
+ return filter2.test(value);
784
+ }
785
+ }
786
+ function formatHeader(header) {
787
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => char.toUpperCase() + str);
788
+ }
789
+ function buildAccessors(obj, header) {
790
+ const accessorName = utils.toCamelCase(" " + header);
791
+ ["get", "set", "has"].forEach((methodName) => {
792
+ Object.defineProperty(obj, methodName + accessorName, {
793
+ value: function(arg1, arg2, arg3) {
794
+ return this[methodName].call(this, header, arg1, arg2, arg3);
795
795
  },
796
796
  configurable: !0
797
797
  });
798
798
  });
799
799
  }
800
- class $ {
801
- constructor(n) {
802
- n && this.set(n);
800
+ class AxiosHeaders {
801
+ constructor(headers) {
802
+ headers && this.set(headers);
803
803
  }
804
- set(n, t, s) {
805
- const r = this;
806
- function i(c, d, f) {
807
- const u = P(d);
808
- if (!u)
804
+ set(header, valueOrRewrite, rewrite) {
805
+ const self2 = this;
806
+ function setHeader(_value, _header, _rewrite) {
807
+ const lHeader = normalizeHeader(_header);
808
+ if (!lHeader)
809
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));
810
+ const key = utils.findKey(self2, lHeader);
811
+ (!key || self2[key] === void 0 || _rewrite === !0 || _rewrite === void 0 && self2[key] !== !1) && (self2[key || _header] = normalizeValue(_value));
812
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);
813
+ const setHeaders = (headers, _rewrite) => utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
814
+ return utils.isPlainObject(header) || header instanceof this.constructor ? setHeaders(header, valueOrRewrite) : utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header) ? setHeaders(parseHeaders(header), valueOrRewrite) : header != null && setHeader(valueOrRewrite, header, rewrite), this;
815
+ }
816
+ get(header, parser) {
817
+ if (header = normalizeHeader(header), header) {
818
+ const key = utils.findKey(this, header);
819
+ if (key) {
820
+ const value = this[key];
821
+ if (!parser)
822
+ return value;
823
+ if (parser === !0)
824
+ return parseTokens(value);
825
+ if (utils.isFunction(parser))
826
+ return parser.call(this, value, key);
827
+ if (utils.isRegExp(parser))
828
+ return parser.exec(value);
829
829
  throw new TypeError("parser must be boolean|regexp|function");
830
830
  }
831
831
  }
832
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)));
833
+ has(header, matcher) {
834
+ if (header = normalizeHeader(header), header) {
835
+ const key = utils.findKey(this, header);
836
+ return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
837
837
  }
838
838
  return !1;
839
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);
840
+ delete(header, matcher) {
841
+ const self2 = this;
842
+ let deleted = !1;
843
+ function deleteHeader(_header) {
844
+ if (_header = normalizeHeader(_header), _header) {
845
+ const key = utils.findKey(self2, _header);
846
+ key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher)) && (delete self2[key], deleted = !0);
847
847
  }
848
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);
849
+ return utils.isArray(header) ? header.forEach(deleteHeader) : deleteHeader(header), deleted;
850
+ }
851
+ clear(matcher) {
852
+ const keys = Object.keys(this);
853
+ let i = keys.length, deleted = !1;
854
+ for (; i--; ) {
855
+ const key = keys[i];
856
+ (!matcher || matchHeaderValue(this, this[key], key, matcher, !0)) && (delete this[key], deleted = !0);
857
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];
858
+ return deleted;
859
+ }
860
+ normalize(format) {
861
+ const self2 = this, headers = {};
862
+ return utils.forEach(this, (value, header) => {
863
+ const key = utils.findKey(headers, header);
864
+ if (key) {
865
+ self2[key] = normalizeValue(value), delete self2[header];
866
866
  return;
867
867
  }
868
- const c = n ? Ke(i) : String(i).trim();
869
- c !== i && delete t[i], t[c] = k(r), s[c] = !0;
868
+ const normalized = format ? formatHeader(header) : String(header).trim();
869
+ normalized !== header && delete self2[header], self2[normalized] = normalizeValue(value), headers[normalized] = !0;
870
870
  }), this;
871
871
  }
872
- concat(...n) {
873
- return this.constructor.concat(this, ...n);
872
+ concat(...targets) {
873
+ return this.constructor.concat(this, ...targets);
874
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;
875
+ toJSON(asStrings) {
876
+ const obj = /* @__PURE__ */ Object.create(null);
877
+ return utils.forEach(this, (value, header) => {
878
+ value != null && value !== !1 && (obj[header] = asStrings && utils.isArray(value) ? value.join(", ") : value);
879
+ }), obj;
880
880
  }
881
881
  [Symbol.iterator]() {
882
882
  return Object.entries(this.toJSON())[Symbol.iterator]();
883
883
  }
884
884
  toString() {
885
- return Object.entries(this.toJSON()).map(([n, t]) => n + ": " + t).join(`
885
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join(`
886
886
  `);
887
887
  }
888
888
  get [Symbol.toStringTag]() {
889
889
  return "AxiosHeaders";
890
890
  }
891
- static from(n) {
892
- return n instanceof this ? n : new this(n);
891
+ static from(thing) {
892
+ return thing instanceof this ? thing : new this(thing);
893
893
  }
894
- static concat(n, ...t) {
895
- const s = new this(n);
896
- return t.forEach((r) => s.set(r)), s;
894
+ static concat(first, ...targets) {
895
+ const computed = new this(first);
896
+ return targets.forEach((target) => computed.set(target)), computed;
897
897
  }
898
- static accessor(n) {
899
- const s = (this[mt] = this[mt] = {
898
+ static accessor(header) {
899
+ const accessors = (this[$internals] = this[$internals] = {
900
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);
901
+ }).accessors, prototype2 = this.prototype;
902
+ function defineAccessor(_header) {
903
+ const lHeader = normalizeHeader(_header);
904
+ accessors[lHeader] || (buildAccessors(prototype2, _header), accessors[lHeader] = !0);
905
905
  }
906
- return a.isArray(n) ? n.forEach(i) : i(n), this;
906
+ return utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header), this;
907
907
  }
908
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);
909
+ AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
910
+ utils.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
911
+ let mapped = key[0].toUpperCase() + key.slice(1);
912
912
  return {
913
- get: () => e,
914
- set(s) {
915
- this[t] = s;
913
+ get: () => value,
914
+ set(headerValue) {
915
+ this[mapped] = headerValue;
916
916
  }
917
917
  };
918
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, {
919
+ utils.freezeMethods(AxiosHeaders);
920
+ const AxiosHeaders$1 = AxiosHeaders;
921
+ function transformData(fns, response) {
922
+ const config = this || defaults$1, context = response || config, headers = AxiosHeaders$1.from(context.headers);
923
+ let data = context.data;
924
+ return utils.forEach(fns, function(fn) {
925
+ data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
926
+ }), headers.normalize(), data;
927
+ }
928
+ function isCancel(value) {
929
+ return !!(value && value.__CANCEL__);
930
+ }
931
+ function CanceledError(message, config, request) {
932
+ AxiosError.call(this, message ?? "canceled", AxiosError.ERR_CANCELED, config, request), this.name = "CanceledError";
933
+ }
934
+ utils.inherits(CanceledError, AxiosError, {
935
935
  __CANCEL__: !0
936
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
937
+ function settle(resolve, reject, response) {
938
+ const validateStatus2 = response.config.validateStatus;
939
+ !response.status || !validateStatus2 || validateStatus2(response.status) ? resolve(response) : reject(new AxiosError(
940
+ "Request failed with status code " + response.status,
941
+ [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
942
+ response.config,
943
+ response.request,
944
+ response
945
945
  ));
946
946
  }
947
- const Qe = S.isStandardBrowserEnv ? (
947
+ const cookies = platform.isStandardBrowserEnv ? (
948
948
  // Standard browser envs support document.cookie
949
949
  function() {
950
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("; ");
951
+ write: function(name, value, expires, path, domain, secure) {
952
+ const cookie = [];
953
+ cookie.push(name + "=" + encodeURIComponent(value)), utils.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString()), utils.isString(path) && cookie.push("path=" + path), utils.isString(domain) && cookie.push("domain=" + domain), secure === !0 && cookie.push("secure"), document.cookie = cookie.join("; ");
954
954
  },
955
- read: function(t) {
956
- const s = document.cookie.match(new RegExp("(^|;\\s*)(" + t + ")=([^;]*)"));
957
- return s ? decodeURIComponent(s[3]) : null;
955
+ read: function(name) {
956
+ const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
957
+ return match ? decodeURIComponent(match[3]) : null;
958
958
  },
959
- remove: function(t) {
960
- this.write(t, "", Date.now() - 864e5);
959
+ remove: function(name) {
960
+ this.write(name, "", Date.now() - 864e5);
961
961
  }
962
962
  };
963
963
  }()
@@ -975,37 +975,37 @@ const Qe = S.isStandardBrowserEnv ? (
975
975
  };
976
976
  }()
977
977
  );
978
- function Ye(e) {
979
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
978
+ function isAbsoluteURL(url) {
979
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
980
980
  }
981
- function Ze(e, n) {
982
- return n ? e.replace(/\/+$/, "") + "/" + n.replace(/^\/+/, "") : e;
981
+ function combineURLs(baseURL, relativeURL) {
982
+ return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
983
983
  }
984
- function zt(e, n) {
985
- return e && !Ye(n) ? Ze(e, n) : n;
984
+ function buildFullPath(baseURL, requestedURL) {
985
+ return baseURL && !isAbsoluteURL(requestedURL) ? combineURLs(baseURL, requestedURL) : requestedURL;
986
986
  }
987
- const ve = S.isStandardBrowserEnv ? (
987
+ const isURLSameOrigin = platform.isStandardBrowserEnv ? (
988
988
  // Standard browser envs have full support of the APIs needed to test
989
989
  // whether the request URL is of the same origin as current location.
990
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
991
+ const msie = /(msie|trident)/i.test(navigator.userAgent), urlParsingNode = document.createElement("a");
992
+ let originURL;
993
+ function resolveURL(url) {
994
+ let href = url;
995
+ return msie && (urlParsingNode.setAttribute("href", href), href = urlParsingNode.href), urlParsingNode.setAttribute("href", href), {
996
+ href: urlParsingNode.href,
997
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
998
+ host: urlParsingNode.host,
999
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
1000
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
1001
+ hostname: urlParsingNode.hostname,
1002
+ port: urlParsingNode.port,
1003
+ pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
1004
1004
  };
1005
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;
1006
+ return originURL = resolveURL(window.location.href), function(requestURL) {
1007
+ const parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL;
1008
+ return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
1009
1009
  };
1010
1010
  }()
1011
1011
  ) : (
@@ -1016,294 +1016,294 @@ const ve = S.isStandardBrowserEnv ? (
1016
1016
  };
1017
1017
  }()
1018
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)
1019
+ function parseProtocol(url) {
1020
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1021
+ return match && match[1] || "";
1022
+ }
1023
+ function speedometer(samplesCount, min) {
1024
+ samplesCount = samplesCount || 10;
1025
+ const bytes = new Array(samplesCount), timestamps = new Array(samplesCount);
1026
+ let head = 0, tail = 0, firstSampleTS;
1027
+ return min = min !== void 0 ? min : 1e3, function(chunkLength) {
1028
+ const now = Date.now(), startedAt = timestamps[tail];
1029
+ firstSampleTS || (firstSampleTS = now), bytes[head] = chunkLength, timestamps[head] = now;
1030
+ let i = tail, bytesCount = 0;
1031
+ for (; i !== head; )
1032
+ bytesCount += bytes[i++], i = i % samplesCount;
1033
+ if (head = (head + 1) % samplesCount, head === tail && (tail = (tail + 1) % samplesCount), now - firstSampleTS < min)
1034
1034
  return;
1035
- const E = u && f - u;
1036
- return E ? Math.round(y * 1e3 / E) : void 0;
1035
+ const passed = startedAt && now - startedAt;
1036
+ return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
1037
1037
  };
1038
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
1039
+ function progressEventReducer(listener, isDownloadStream) {
1040
+ let bytesNotified = 0;
1041
+ const _speedometer = speedometer(50, 250);
1042
+ return (e) => {
1043
+ const loaded = e.loaded, total = e.lengthComputable ? e.total : void 0, progressBytes = loaded - bytesNotified, rate = _speedometer(progressBytes), inRange = loaded <= total;
1044
+ bytesNotified = loaded;
1045
+ const data = {
1046
+ loaded,
1047
+ total,
1048
+ progress: total ? loaded / total : void 0,
1049
+ bytes: progressBytes,
1050
+ rate: rate || void 0,
1051
+ estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
1052
+ event: e
1053
1053
  };
1054
- u[n ? "download" : "upload"] = !0, e(u);
1054
+ data[isDownloadStream ? "download" : "upload"] = !0, listener(data);
1055
1055
  };
1056
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);
1057
+ const isXHRAdapterSupported = typeof XMLHttpRequest < "u", xhrAdapter = isXHRAdapterSupported && function(config) {
1058
+ return new Promise(function(resolve, reject) {
1059
+ let requestData = config.data;
1060
+ const requestHeaders = AxiosHeaders$1.from(config.headers).normalize(), responseType = config.responseType;
1061
+ let onCanceled;
1062
+ function done() {
1063
+ config.cancelToken && config.cancelToken.unsubscribe(onCanceled), config.signal && config.signal.removeEventListener("abort", onCanceled);
1064
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));
1065
+ let contentType;
1066
+ utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv ? requestHeaders.setContentType(!1) : requestHeaders.getContentType(/^\s*multipart\/form-data/) ? utils.isString(contentType = requestHeaders.getContentType()) && requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, "$1")) : requestHeaders.setContentType("multipart/form-data"));
1067
+ let request = new XMLHttpRequest();
1068
+ if (config.auth) {
1069
+ const username = config.auth.username || "", password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : "";
1070
+ requestHeaders.set("Authorization", "Basic " + btoa(username + ":" + password));
1071
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)
1072
+ const fullPath = buildFullPath(config.baseURL, config.url);
1073
+ request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), !0), request.timeout = config.timeout;
1074
+ function onloadend() {
1075
+ if (!request)
1076
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
1077
+ const responseHeaders = AxiosHeaders$1.from(
1078
+ "getAllResponseHeaders" in request && request.getAllResponseHeaders()
1079
+ ), response = {
1080
+ data: !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response,
1081
+ status: request.status,
1082
+ statusText: request.statusText,
1083
+ headers: responseHeaders,
1084
+ config,
1085
+ request
1086
1086
  };
1087
- Ge(function(R) {
1088
- t(R), d();
1089
- }, function(R) {
1090
- s(R), d();
1091
- }, b), u = null;
1087
+ settle(function(value) {
1088
+ resolve(value), done();
1089
+ }, function(err) {
1090
+ reject(err), done();
1091
+ }, response), request = null;
1092
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);
1093
+ if ("onloadend" in request ? request.onloadend = onloadend : request.onreadystatechange = function() {
1094
+ !request || request.readyState !== 4 || request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0) || setTimeout(onloadend);
1095
+ }, request.onabort = function() {
1096
+ request && (reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config, request)), request = null);
1097
+ }, request.onerror = function() {
1098
+ reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request)), request = null;
1099
+ }, request.ontimeout = function() {
1100
+ let timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded";
1101
+ const transitional2 = config.transitional || transitionalDefaults;
1102
+ config.timeoutErrorMessage && (timeoutErrorMessage = config.timeoutErrorMessage), reject(new AxiosError(
1103
+ timeoutErrorMessage,
1104
+ transitional2.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
1105
+ config,
1106
+ request
1107
+ )), request = null;
1108
+ }, platform.isStandardBrowserEnv) {
1109
+ const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
1110
+ xsrfValue && requestHeaders.set(config.xsrfHeaderName, xsrfValue);
1111
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));
1112
+ requestData === void 0 && requestHeaders.setContentType(null), "setRequestHeader" in request && utils.forEach(requestHeaders.toJSON(), function(val, key) {
1113
+ request.setRequestHeader(key, val);
1114
+ }), utils.isUndefined(config.withCredentials) || (request.withCredentials = !!config.withCredentials), responseType && responseType !== "json" && (request.responseType = config.responseType), typeof config.onDownloadProgress == "function" && request.addEventListener("progress", progressEventReducer(config.onDownloadProgress, !0)), typeof config.onUploadProgress == "function" && request.upload && request.upload.addEventListener("progress", progressEventReducer(config.onUploadProgress)), (config.cancelToken || config.signal) && (onCanceled = (cancel) => {
1115
+ request && (reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel), request.abort(), request = null);
1116
+ }, config.cancelToken && config.cancelToken.subscribe(onCanceled), config.signal && (config.signal.aborted ? onCanceled() : config.signal.addEventListener("abort", onCanceled)));
1117
+ const protocol = parseProtocol(fullPath);
1118
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
1119
+ reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config));
1120
1120
  return;
1121
1121
  }
1122
- u.send(r || null);
1122
+ request.send(requestData || null);
1123
1123
  });
1124
- }, Y = {
1125
- http: Ie,
1126
- xhr: sn
1124
+ }, knownAdapters = {
1125
+ http: httpAdapter,
1126
+ xhr: xhrAdapter
1127
1127
  };
1128
- a.forEach(Y, (e, n) => {
1129
- if (e) {
1128
+ utils.forEach(knownAdapters, (fn, value) => {
1129
+ if (fn) {
1130
1130
  try {
1131
- Object.defineProperty(e, "name", { value: n });
1131
+ Object.defineProperty(fn, "name", { value });
1132
1132
  } catch {
1133
1133
  }
1134
- Object.defineProperty(e, "adapterName", { value: n });
1134
+ Object.defineProperty(fn, "adapterName", { value });
1135
1135
  }
1136
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)
1137
+ const renderReason = (reason) => `- ${reason}`, isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === !1, adapters = {
1138
+ getAdapter: (adapters2) => {
1139
+ adapters2 = utils.isArray(adapters2) ? adapters2 : [adapters2];
1140
+ const { length } = adapters2;
1141
+ let nameOrAdapter, adapter;
1142
+ const rejectedReasons = {};
1143
+ for (let i = 0; i < length; i++) {
1144
+ nameOrAdapter = adapters2[i];
1145
+ let id;
1146
+ if (adapter = nameOrAdapter, !isResolvedHandle(nameOrAdapter) && (adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()], adapter === void 0))
1147
+ throw new AxiosError(`Unknown adapter '${id}'`);
1148
+ if (adapter)
1149
1149
  break;
1150
- r[o || "#" + i] = s;
1150
+ rejectedReasons[id || "#" + i] = adapter;
1151
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")
1152
+ if (!adapter) {
1153
+ const reasons = Object.entries(rejectedReasons).map(
1154
+ ([id, state]) => `adapter ${id} ` + (state === !1 ? "is not supported by the environment" : "is not available in the build")
1155
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,
1156
+ let s = length ? reasons.length > 1 ? `since :
1157
+ ` + reasons.map(renderReason).join(`
1158
+ `) : " " + renderReason(reasons[0]) : "as no adapter specified";
1159
+ throw new AxiosError(
1160
+ "There is no suitable adapter to dispatch the request " + s,
1161
1161
  "ERR_NOT_SUPPORT"
1162
1162
  );
1163
1163
  }
1164
- return s;
1164
+ return adapter;
1165
1165
  },
1166
- adapters: Y
1166
+ adapters: knownAdapters
1167
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);
1168
+ function throwIfCancellationRequested(config) {
1169
+ if (config.cancelToken && config.cancelToken.throwIfRequested(), config.signal && config.signal.aborted)
1170
+ throw new CanceledError(null, config);
1171
+ }
1172
+ function dispatchRequest(config) {
1173
+ return throwIfCancellationRequested(config), config.headers = AxiosHeaders$1.from(config.headers), config.data = transformData.call(
1174
+ config,
1175
+ config.transformRequest
1176
+ ), ["post", "put", "patch"].indexOf(config.method) !== -1 && config.headers.setContentType("application/x-www-form-urlencoded", !1), adapters.getAdapter(config.adapter || defaults$1.adapter)(config).then(function(response) {
1177
+ return throwIfCancellationRequested(config), response.data = transformData.call(
1178
+ config,
1179
+ config.transformResponse,
1180
+ response
1181
+ ), response.headers = AxiosHeaders$1.from(response.headers), response;
1182
+ }, function(reason) {
1183
+ return isCancel(reason) || (throwIfCancellationRequested(config), reason && reason.response && (reason.response.data = transformData.call(
1184
+ config,
1185
+ config.transformResponse,
1186
+ reason.response
1187
+ ), reason.response.headers = AxiosHeaders$1.from(reason.response.headers))), Promise.reject(reason);
1188
1188
  });
1189
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);
1190
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
1191
+ function mergeConfig(config1, config2) {
1192
+ config2 = config2 || {};
1193
+ const config = {};
1194
+ function getMergedValue(target, source, caseless) {
1195
+ return utils.isPlainObject(target) && utils.isPlainObject(source) ? utils.merge.call({ caseless }, target, source) : utils.isPlainObject(source) ? utils.merge({}, source) : utils.isArray(source) ? source.slice() : source;
1196
+ }
1197
+ function mergeDeepProperties(a, b, caseless) {
1198
+ if (utils.isUndefined(b)) {
1199
+ if (!utils.isUndefined(a))
1200
+ return getMergedValue(void 0, a, caseless);
1201
1201
  } else
1202
- return s(f, u, p);
1202
+ return getMergedValue(a, b, caseless);
1203
1203
  }
1204
- function i(f, u) {
1205
- if (!a.isUndefined(u))
1206
- return s(void 0, u);
1204
+ function valueFromConfig2(a, b) {
1205
+ if (!utils.isUndefined(b))
1206
+ return getMergedValue(void 0, b);
1207
1207
  }
1208
- function o(f, u) {
1209
- if (a.isUndefined(u)) {
1210
- if (!a.isUndefined(f))
1211
- return s(void 0, f);
1208
+ function defaultToConfig2(a, b) {
1209
+ if (utils.isUndefined(b)) {
1210
+ if (!utils.isUndefined(a))
1211
+ return getMergedValue(void 0, a);
1212
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)
1213
+ return getMergedValue(void 0, b);
1214
+ }
1215
+ function mergeDirectKeys(a, b, prop) {
1216
+ if (prop in config2)
1217
+ return getMergedValue(a, b);
1218
+ if (prop in config1)
1219
+ return getMergedValue(void 0, a);
1220
+ }
1221
+ const mergeMap = {
1222
+ url: valueFromConfig2,
1223
+ method: valueFromConfig2,
1224
+ data: valueFromConfig2,
1225
+ baseURL: defaultToConfig2,
1226
+ transformRequest: defaultToConfig2,
1227
+ transformResponse: defaultToConfig2,
1228
+ paramsSerializer: defaultToConfig2,
1229
+ timeout: defaultToConfig2,
1230
+ timeoutMessage: defaultToConfig2,
1231
+ withCredentials: defaultToConfig2,
1232
+ adapter: defaultToConfig2,
1233
+ responseType: defaultToConfig2,
1234
+ xsrfCookieName: defaultToConfig2,
1235
+ xsrfHeaderName: defaultToConfig2,
1236
+ onUploadProgress: defaultToConfig2,
1237
+ onDownloadProgress: defaultToConfig2,
1238
+ decompress: defaultToConfig2,
1239
+ maxContentLength: defaultToConfig2,
1240
+ maxBodyLength: defaultToConfig2,
1241
+ beforeRedirect: defaultToConfig2,
1242
+ transport: defaultToConfig2,
1243
+ httpAgent: defaultToConfig2,
1244
+ httpsAgent: defaultToConfig2,
1245
+ cancelToken: defaultToConfig2,
1246
+ socketPath: defaultToConfig2,
1247
+ responseEncoding: defaultToConfig2,
1248
+ validateStatus: mergeDirectKeys,
1249
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), !0)
1250
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;
1251
+ return utils.forEach(Object.keys(Object.assign({}, config1, config2)), function(prop) {
1252
+ const merge2 = mergeMap[prop] || mergeDeepProperties, configValue = merge2(config1[prop], config2[prop], prop);
1253
+ utils.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
1254
+ }), config;
1255
+ }
1256
+ const VERSION = "1.5.1", validators$1 = {};
1257
+ ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
1258
+ validators$1[type] = function(thing) {
1259
+ return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
1260
1260
  };
1261
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
1262
+ const deprecatedWarnings = {};
1263
+ validators$1.transitional = function(validator2, version, message) {
1264
+ function formatMessage(opt, desc) {
1265
+ return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
1266
+ }
1267
+ return (value, opt, opts) => {
1268
+ if (validator2 === !1)
1269
+ throw new AxiosError(
1270
+ formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
1271
+ AxiosError.ERR_DEPRECATED
1272
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"
1273
+ return version && !deprecatedWarnings[opt] && (deprecatedWarnings[opt] = !0, console.warn(
1274
+ formatMessage(
1275
+ opt,
1276
+ " has been deprecated since v" + version + " and will be removed in the near future"
1277
1277
  )
1278
- )), n ? n(i, o, c) : !0;
1278
+ )), validator2 ? validator2(value, opt, opts) : !0;
1279
1279
  };
1280
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);
1281
+ function assertOptions(options, schema, allowUnknown) {
1282
+ if (typeof options != "object")
1283
+ throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
1284
+ const keys = Object.keys(options);
1285
+ let i = keys.length;
1286
+ for (; i-- > 0; ) {
1287
+ const opt = keys[i], validator2 = schema[opt];
1288
+ if (validator2) {
1289
+ const value = options[opt], result = value === void 0 || validator2(value, opt, options);
1290
+ if (result !== !0)
1291
+ throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
1292
1292
  continue;
1293
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()
1294
+ if (allowUnknown !== !0)
1295
+ throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
1296
+ }
1297
+ }
1298
+ const validator = {
1299
+ assertOptions,
1300
+ validators: validators$1
1301
+ }, validators = validator.validators;
1302
+ class Axios {
1303
+ constructor(instanceConfig) {
1304
+ this.defaults = instanceConfig, this.interceptors = {
1305
+ request: new InterceptorManager$1(),
1306
+ response: new InterceptorManager$1()
1307
1307
  };
1308
1308
  }
1309
1309
  /**
@@ -1314,122 +1314,122 @@ class z {
1314
1314
  *
1315
1315
  * @returns {Promise} The Promise to be fulfilled
1316
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]
1317
+ request(configOrUrl, config) {
1318
+ typeof configOrUrl == "string" ? (config = config || {}, config.url = configOrUrl) : config = configOrUrl || {}, config = mergeConfig(this.defaults, config);
1319
+ const { transitional: transitional2, paramsSerializer, headers } = config;
1320
+ transitional2 !== void 0 && validator.assertOptions(transitional2, {
1321
+ silentJSONParsing: validators.transitional(validators.boolean),
1322
+ forcedJSONParsing: validators.transitional(validators.boolean),
1323
+ clarifyTimeoutError: validators.transitional(validators.boolean)
1324
+ }, !1), paramsSerializer != null && (utils.isFunction(paramsSerializer) ? config.paramsSerializer = {
1325
+ serialize: paramsSerializer
1326
+ } : validator.assertOptions(paramsSerializer, {
1327
+ encode: validators.function,
1328
+ serialize: validators.function
1329
+ }, !0)), config.method = (config.method || this.defaults.method || "get").toLowerCase();
1330
+ let contextHeaders = headers && utils.merge(
1331
+ headers.common,
1332
+ headers[config.method]
1333
1333
  );
1334
- i && a.forEach(
1334
+ headers && utils.forEach(
1335
1335
  ["delete", "get", "head", "post", "put", "patch", "common"],
1336
- (l) => {
1337
- delete i[l];
1336
+ (method) => {
1337
+ delete headers[method];
1338
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));
1339
+ ), config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
1340
+ const requestInterceptorChain = [];
1341
+ let synchronousRequestInterceptors = !0;
1342
+ this.interceptors.request.forEach(function(interceptor) {
1343
+ typeof interceptor.runWhen == "function" && interceptor.runWhen(config) === !1 || (synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous, requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected));
1344
1344
  });
1345
- const f = [];
1346
- this.interceptors.response.forEach(function(m) {
1347
- f.push(m.fulfilled, m.rejected);
1345
+ const responseInterceptorChain = [];
1346
+ this.interceptors.response.forEach(function(interceptor) {
1347
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
1348
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;
1349
+ let promise, i = 0, len;
1350
+ if (!synchronousRequestInterceptors) {
1351
+ const chain = [dispatchRequest.bind(this), void 0];
1352
+ for (chain.unshift.apply(chain, requestInterceptorChain), chain.push.apply(chain, responseInterceptorChain), len = chain.length, promise = Promise.resolve(config); i < len; )
1353
+ promise = promise.then(chain[i++], chain[i++]);
1354
+ return promise;
1355
1355
  }
1356
- y = c.length;
1357
- let E = t;
1358
- for (p = 0; p < y; ) {
1359
- const l = c[p++], m = c[p++];
1356
+ len = requestInterceptorChain.length;
1357
+ let newConfig = config;
1358
+ for (i = 0; i < len; ) {
1359
+ const onFulfilled = requestInterceptorChain[i++], onRejected = requestInterceptorChain[i++];
1360
1360
  try {
1361
- E = l(E);
1362
- } catch (b) {
1363
- m.call(this, b);
1361
+ newConfig = onFulfilled(newConfig);
1362
+ } catch (error) {
1363
+ onRejected.call(this, error);
1364
1364
  break;
1365
1365
  }
1366
1366
  }
1367
1367
  try {
1368
- u = yt.call(this, E);
1369
- } catch (l) {
1370
- return Promise.reject(l);
1368
+ promise = dispatchRequest.call(this, newConfig);
1369
+ } catch (error) {
1370
+ return Promise.reject(error);
1371
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
1372
+ for (i = 0, len = responseInterceptorChain.length; i < len; )
1373
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
1374
+ return promise;
1375
+ }
1376
+ getUri(config) {
1377
+ config = mergeConfig(this.defaults, config);
1378
+ const fullPath = buildFullPath(config.baseURL, config.url);
1379
+ return buildURL(fullPath, config.params, config.paramsSerializer);
1380
+ }
1381
+ }
1382
+ utils.forEach(["delete", "get", "head", "options"], function(method) {
1383
+ Axios.prototype[method] = function(url, config) {
1384
+ return this.request(mergeConfig(config || {}, {
1385
+ method,
1386
+ url,
1387
+ data: (config || {}).data
1388
1388
  }));
1389
1389
  };
1390
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 ? {
1391
+ utils.forEach(["post", "put", "patch"], function(method) {
1392
+ function generateHTTPMethod(isForm) {
1393
+ return function(url, data, config) {
1394
+ return this.request(mergeConfig(config || {}, {
1395
+ method,
1396
+ headers: isForm ? {
1397
1397
  "Content-Type": "multipart/form-data"
1398
1398
  } : {},
1399
- url: i,
1400
- data: o
1399
+ url,
1400
+ data
1401
1401
  }));
1402
1402
  };
1403
1403
  }
1404
- z.prototype[n] = t(), z.prototype[n + "Form"] = t(!0);
1404
+ Axios.prototype[method] = generateHTTPMethod(), Axios.prototype[method + "Form"] = generateHTTPMethod(!0);
1405
1405
  });
1406
- const j = z;
1407
- class ot {
1408
- constructor(n) {
1409
- if (typeof n != "function")
1406
+ const Axios$1 = Axios;
1407
+ class CancelToken {
1408
+ constructor(executor) {
1409
+ if (typeof executor != "function")
1410
1410
  throw new TypeError("executor must be a function.");
1411
- let t;
1412
- this.promise = new Promise(function(i) {
1413
- t = i;
1411
+ let resolvePromise;
1412
+ this.promise = new Promise(function(resolve) {
1413
+ resolvePromise = resolve;
1414
1414
  });
1415
- const s = this;
1416
- this.promise.then((r) => {
1417
- if (!s._listeners)
1415
+ const token = this;
1416
+ this.promise.then((cancel) => {
1417
+ if (!token._listeners)
1418
1418
  return;
1419
- let i = s._listeners.length;
1419
+ let i = token._listeners.length;
1420
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));
1421
+ token._listeners[i](cancel);
1422
+ token._listeners = null;
1423
+ }), this.promise.then = (onfulfilled) => {
1424
+ let _resolve;
1425
+ const promise = new Promise((resolve) => {
1426
+ token.subscribe(resolve), _resolve = resolve;
1427
+ }).then(onfulfilled);
1428
+ return promise.cancel = function() {
1429
+ token.unsubscribe(_resolve);
1430
+ }, promise;
1431
+ }, executor(function(message, config, request) {
1432
+ token.reason || (token.reason = new CanceledError(message, config, request), resolvePromise(token.reason));
1433
1433
  });
1434
1434
  }
1435
1435
  /**
@@ -1442,46 +1442,46 @@ class ot {
1442
1442
  /**
1443
1443
  * Subscribe to the cancel signal
1444
1444
  */
1445
- subscribe(n) {
1445
+ subscribe(listener) {
1446
1446
  if (this.reason) {
1447
- n(this.reason);
1447
+ listener(this.reason);
1448
1448
  return;
1449
1449
  }
1450
- this._listeners ? this._listeners.push(n) : this._listeners = [n];
1450
+ this._listeners ? this._listeners.push(listener) : this._listeners = [listener];
1451
1451
  }
1452
1452
  /**
1453
1453
  * Unsubscribe from the cancel signal
1454
1454
  */
1455
- unsubscribe(n) {
1455
+ unsubscribe(listener) {
1456
1456
  if (!this._listeners)
1457
1457
  return;
1458
- const t = this._listeners.indexOf(n);
1459
- t !== -1 && this._listeners.splice(t, 1);
1458
+ const index = this._listeners.indexOf(listener);
1459
+ index !== -1 && this._listeners.splice(index, 1);
1460
1460
  }
1461
1461
  /**
1462
1462
  * Returns an object that contains a new `CancelToken` and a function that, when called,
1463
1463
  * cancels the `CancelToken`.
1464
1464
  */
1465
1465
  static source() {
1466
- let n;
1466
+ let cancel;
1467
1467
  return {
1468
- token: new ot(function(r) {
1469
- n = r;
1468
+ token: new CancelToken(function(c) {
1469
+ cancel = c;
1470
1470
  }),
1471
- cancel: n
1471
+ cancel
1472
1472
  };
1473
1473
  }
1474
1474
  }
1475
- const an = ot;
1476
- function cn(e) {
1477
- return function(t) {
1478
- return e.apply(null, t);
1475
+ const CancelToken$1 = CancelToken;
1476
+ function spread(callback) {
1477
+ return function(arr) {
1478
+ return callback.apply(null, arr);
1479
1479
  };
1480
1480
  }
1481
- function un(e) {
1482
- return a.isObject(e) && e.isAxiosError === !0;
1481
+ function isAxiosError(payload) {
1482
+ return utils.isObject(payload) && payload.isAxiosError === !0;
1483
1483
  }
1484
- const v = {
1484
+ const HttpStatusCode = {
1485
1485
  Continue: 100,
1486
1486
  SwitchingProtocols: 101,
1487
1487
  Processing: 102,
@@ -1546,46 +1546,46 @@ const v = {
1546
1546
  NotExtended: 510,
1547
1547
  NetworkAuthenticationRequired: 511
1548
1548
  };
1549
- Object.entries(v).forEach(([e, n]) => {
1550
- v[n] = e;
1549
+ Object.entries(HttpStatusCode).forEach(([key, value]) => {
1550
+ HttpStatusCode[value] = key;
1551
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);
1552
+ const HttpStatusCode$1 = HttpStatusCode;
1553
+ function createInstance(defaultConfig) {
1554
+ const context = new Axios$1(defaultConfig), instance = bind(Axios$1.prototype.request, context);
1555
+ return utils.extend(instance, Axios$1.prototype, context, { allOwnKeys: !0 }), utils.extend(instance, context, null, { allOwnKeys: !0 }), instance.create = function(instanceConfig) {
1556
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
1557
+ }, instance;
1558
+ }
1559
+ const axios = createInstance(defaults$1);
1560
+ axios.Axios = Axios$1;
1561
+ axios.CanceledError = CanceledError;
1562
+ axios.CancelToken = CancelToken$1;
1563
+ axios.isCancel = isCancel;
1564
+ axios.VERSION = VERSION;
1565
+ axios.toFormData = toFormData;
1566
+ axios.AxiosError = AxiosError;
1567
+ axios.Cancel = axios.CanceledError;
1568
+ axios.all = function(promises) {
1569
+ return Promise.all(promises);
1570
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);
1571
+ axios.spread = spread;
1572
+ axios.isAxiosError = isAxiosError;
1573
+ axios.mergeConfig = mergeConfig;
1574
+ axios.AxiosHeaders = AxiosHeaders$1;
1575
+ axios.formToJSON = (thing) => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
1576
+ axios.getAdapter = adapters.getAdapter;
1577
+ axios.HttpStatusCode = HttpStatusCode$1;
1578
+ axios.default = axios;
1579
+ const axios$1 = axios;
1580
+ class HttpClient {
1581
+ constructor(url, httpRequester = null) {
1582
+ __publicField(this, "_url", null);
1583
+ __publicField(this, "_token", null);
1584
1584
  //Added for testing support
1585
- h(this, "_httpRequester");
1586
- if (!n)
1585
+ __publicField(this, "_httpRequester");
1586
+ if (!url)
1587
1587
  throw Error("Endpoint URL must be passed in to NotuClient constructor");
1588
- this._url = n, this._httpRequester = t ?? dn;
1588
+ this._url = url, this._httpRequester = httpRequester ?? axios$1;
1589
1589
  }
1590
1590
  get url() {
1591
1591
  return this._url;
@@ -1593,21 +1593,21 @@ class wn {
1593
1593
  get token() {
1594
1594
  return this._token;
1595
1595
  }
1596
- set token(n) {
1597
- this._token = n;
1596
+ set token(value) {
1597
+ this._token = value;
1598
1598
  }
1599
- async login(n, t) {
1599
+ async login(username, password) {
1600
1600
  try {
1601
- const s = await this._httpRequester({
1601
+ const result = await this._httpRequester({
1602
1602
  method: "post",
1603
1603
  url: (this.url + "/login").replace("//", "/"),
1604
- data: { username: n, password: t }
1604
+ data: { username, password }
1605
1605
  });
1606
- return this._token = s.data, { success: !0, error: null, token: s.data };
1607
- } catch (s) {
1608
- if (s.response.status == 401)
1606
+ return this._token = result.data, { success: !0, error: null, token: result.data };
1607
+ } catch (ex) {
1608
+ if (ex.response.status == 401)
1609
1609
  return { success: !1, error: "Invalid username & password.", token: null };
1610
- throw s;
1610
+ throw ex;
1611
1611
  }
1612
1612
  }
1613
1613
  async getSpaces() {
@@ -1619,272 +1619,272 @@ class wn {
1619
1619
  }
1620
1620
  })).data;
1621
1621
  }
1622
- async saveSpace(n) {
1622
+ async saveSpace(space) {
1623
1623
  return (await this._httpRequester({
1624
1624
  method: "post",
1625
1625
  url: (this.url + "/spaces").replace("//", "/"),
1626
- data: n,
1626
+ data: space,
1627
1627
  headers: {
1628
1628
  Authorization: "Bearer " + this.token
1629
1629
  }
1630
1630
  })).data;
1631
1631
  }
1632
- async getNotes(n, t) {
1632
+ async getNotes(query, spaceId) {
1633
1633
  return (await this._httpRequester({
1634
1634
  method: "get",
1635
1635
  url: (this.url + "/notes").replace("//", "/"),
1636
- data: { query: n, spaceId: t },
1636
+ data: { query, spaceId },
1637
1637
  headers: {
1638
1638
  Authorization: "Bearer " + this.token
1639
1639
  }
1640
1640
  })).data;
1641
1641
  }
1642
- async getNoteCount(n, t) {
1642
+ async getNoteCount(query, spaceId) {
1643
1643
  return (await this._httpRequester({
1644
1644
  method: "get",
1645
1645
  url: (this.url + "/notes").replace("//", "/"),
1646
- data: { query: n, spaceId: t },
1646
+ data: { query, spaceId },
1647
1647
  headers: {
1648
1648
  Authorization: "Bearer " + this.token
1649
1649
  }
1650
1650
  })).data;
1651
1651
  }
1652
- async saveNotes(n) {
1652
+ async saveNotes(notes) {
1653
1653
  return (await this._httpRequester({
1654
1654
  method: "post",
1655
1655
  url: (this.url + "/notes").replace("//", "/"),
1656
- data: { notes: n },
1656
+ data: { notes },
1657
1657
  headers: {
1658
1658
  Authorization: "Bearer " + this.token
1659
1659
  }
1660
1660
  })).data;
1661
1661
  }
1662
- async customJob(n, t) {
1662
+ async customJob(name, data) {
1663
1663
  return (await this._httpRequester({
1664
1664
  method: "post",
1665
1665
  url: (this.url + "customjob").replace("//", "/"),
1666
- data: { name: n, data: t },
1666
+ data: { name, data },
1667
1667
  headers: {
1668
1668
  Authorization: "Bearer " + this.token
1669
1669
  }
1670
1670
  })).data;
1671
1671
  }
1672
1672
  }
1673
- class at extends I {
1673
+ class NoteAttr extends ModelWithState {
1674
1674
  constructor() {
1675
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);
1676
+ __publicField(this, "_noteId", 0);
1677
+ __publicField(this, "_note", null);
1678
+ __publicField(this, "_attrId", 0);
1679
+ __publicField(this, "_attr", null);
1680
+ __publicField(this, "_value", null);
1681
+ __publicField(this, "_tagId", null);
1682
+ __publicField(this, "_tag", null);
1683
1683
  }
1684
1684
  get noteId() {
1685
1685
  return this._noteId;
1686
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());
1687
+ set noteId(value) {
1688
+ var _a;
1689
+ value !== this._noteId && (this._noteId = value, value !== ((_a = this.note) == null ? void 0 : _a.id) && (this._note = null), this.isClean && this.dirty());
1690
1690
  }
1691
1691
  get note() {
1692
1692
  return this._note;
1693
1693
  }
1694
- set note(t) {
1695
- this._note = t, this.noteId = (t == null ? void 0 : t.id) ?? 0;
1694
+ set note(value) {
1695
+ this._note = value, this.noteId = (value == null ? void 0 : value.id) ?? 0;
1696
1696
  }
1697
1697
  get attrId() {
1698
1698
  return this._attrId;
1699
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());
1700
+ set attrId(value) {
1701
+ var _a;
1702
+ value !== this._attrId && (this._attrId = value, value !== ((_a = this.attr) == null ? void 0 : _a.id) && (this._attr = null), this.isClean && this.dirty());
1703
1703
  }
1704
1704
  get attr() {
1705
1705
  return this._attr;
1706
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;
1707
+ set attr(newAttr) {
1708
+ const oldAttr = this._attr;
1709
+ this._attr = newAttr, newAttr ? (!oldAttr || newAttr.type != oldAttr.type) && (this.value = newAttr.defaultValue) : this.value = null, this.attrId = (newAttr == null ? void 0 : newAttr.id) ?? 0;
1710
1710
  }
1711
1711
  get value() {
1712
1712
  return this._value;
1713
1713
  }
1714
- set value(t) {
1715
- t != this._value && (this._value = t, this.isClean && this.dirty());
1714
+ set value(newVal) {
1715
+ newVal != this._value && (this._value = newVal, this.isClean && this.dirty());
1716
1716
  }
1717
1717
  get tagId() {
1718
1718
  return this._tagId;
1719
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());
1720
+ set tagId(value) {
1721
+ var _a;
1722
+ value !== this._tagId && (this._tagId = value, value !== ((_a = this.tag) == null ? void 0 : _a.id) && (this._tag = null), this.isClean && this.dirty());
1723
1723
  }
1724
1724
  get tag() {
1725
1725
  return this._tag;
1726
1726
  }
1727
- set tag(t) {
1728
- this._tag = t, this.tagId = (t == null ? void 0 : t.id) ?? null;
1727
+ set tag(value) {
1728
+ this._tag = value, this.tagId = (value == null ? void 0 : value.id) ?? null;
1729
1729
  }
1730
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;
1731
+ const output = new NoteAttr();
1732
+ return output.noteId = this.noteId, output.note = this.note, output.attrId = this.attrId, output.attr = this.attr, output.tagId = this.tagId, output.tag = this.tag, output.value = this.value, output;
1733
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;
1734
+ validate(throwError = !1) {
1735
+ let output = null;
1736
+ if (this.noteId <= 0 && !this.isNew ? output = "NoteAttr noteId must be greater than zero" : this.attrId <= 0 && (output = "NoteAttr attrId must be greater than zero"), throwError && output != null)
1737
+ throw Error(output);
1738
+ return output == null;
1739
1739
  }
1740
1740
  }
1741
- class ct extends I {
1741
+ class NoteTag extends ModelWithState {
1742
1742
  constructor() {
1743
1743
  super(...arguments);
1744
- h(this, "_noteId", 0);
1745
- h(this, "_note", null);
1746
- h(this, "_tagId", 0);
1747
- h(this, "_tag", null);
1744
+ __publicField(this, "_noteId", 0);
1745
+ __publicField(this, "_note", null);
1746
+ __publicField(this, "_tagId", 0);
1747
+ __publicField(this, "_tag", null);
1748
1748
  }
1749
1749
  get noteId() {
1750
1750
  return this._noteId;
1751
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());
1752
+ set noteId(value) {
1753
+ var _a;
1754
+ value !== this._noteId && (this._noteId = value, value !== ((_a = this.note) == null ? void 0 : _a.id) && (this._note = null), this.isClean && this.dirty());
1755
1755
  }
1756
1756
  get note() {
1757
1757
  return this._note;
1758
1758
  }
1759
- set note(t) {
1760
- this._note = t, this.noteId = (t == null ? void 0 : t.id) ?? 0;
1759
+ set note(value) {
1760
+ this._note = value, this.noteId = (value == null ? void 0 : value.id) ?? 0;
1761
1761
  }
1762
1762
  get tagId() {
1763
1763
  return this._tagId;
1764
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());
1765
+ set tagId(value) {
1766
+ var _a;
1767
+ value !== this._tagId && (this._tagId = value, value !== ((_a = this.tag) == null ? void 0 : _a.id) && (this._tag = null), this.isClean && this.dirty());
1768
1768
  }
1769
1769
  get tag() {
1770
1770
  return this._tag;
1771
1771
  }
1772
- set tag(t) {
1773
- this._tag = t, this.tagId = (t == null ? void 0 : t.id) ?? 0;
1772
+ set tag(value) {
1773
+ this._tag = value, this.tagId = (value == null ? void 0 : value.id) ?? 0;
1774
1774
  }
1775
1775
  get attrs() {
1776
- return this.note.attrs.filter((t) => t.tagId == this.tagId);
1776
+ return this.note.attrs.filter((x) => x.tagId == this.tagId);
1777
1777
  }
1778
- addAttr(t) {
1778
+ addAttr(attr) {
1779
1779
  if (!this.note)
1780
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;
1781
+ const na = this.note.addAttr(attr);
1782
+ return na.tag = this.tag, na;
1783
1783
  }
1784
1784
  duplicate() {
1785
- const t = new ct();
1786
- return t.noteId = this.noteId, t.tagId = this.tagId, t;
1785
+ const output = new NoteTag();
1786
+ return output.noteId = this.noteId, output.tagId = this.tagId, output;
1787
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;
1788
+ validate(throwError = !1) {
1789
+ let output = null;
1790
+ if (this.noteId <= 0 && !this.isNew ? output = "NoteTag noteId must be greater than zero" : this.tagId <= 0 ? output = "NoteTag tagId must be greater than zero" : this.noteId == this.tagId && (output = "NoteTag cannot link a note to its own tag"), throwError && output != null)
1791
+ throw Error(output);
1792
+ return output == null;
1793
1793
  }
1794
1794
  }
1795
- class ut extends I {
1796
- constructor(t = "") {
1795
+ class Tag extends ModelWithState {
1796
+ constructor(name = "") {
1797
1797
  super();
1798
- h(this, "_id", 0);
1799
- h(this, "_name", "");
1800
- h(this, "_color", null);
1801
- this._name = t;
1798
+ __publicField(this, "_id", 0);
1799
+ __publicField(this, "_name", "");
1800
+ __publicField(this, "_color", null);
1801
+ this._name = name;
1802
1802
  }
1803
1803
  get id() {
1804
1804
  return this._id;
1805
1805
  }
1806
- set id(t) {
1807
- t !== this._id && (this._id = t, this.isClean && this.dirty());
1806
+ set id(value) {
1807
+ value !== this._id && (this._id = value, this.isClean && this.dirty());
1808
1808
  }
1809
1809
  get name() {
1810
1810
  return this._name;
1811
1811
  }
1812
- set name(t) {
1813
- t !== this._name && (this._name = t, this.isClean && this.dirty());
1812
+ set name(value) {
1813
+ value !== this._name && (this._name = value, this.isClean && this.dirty());
1814
1814
  }
1815
1815
  get color() {
1816
1816
  return this._color;
1817
1817
  }
1818
- set color(t) {
1819
- t !== this._color && (this._color = t, this.isClean && this.dirty());
1818
+ set color(value) {
1819
+ value !== this._color && (this._color = value, this.isClean && this.dirty());
1820
1820
  }
1821
1821
  duplicate() {
1822
- const t = new ut();
1823
- return t.id = this.id, t.name = this.name, t.state = this.state, t;
1822
+ const output = new Tag();
1823
+ return output.id = this.id, output.name = this.name, output.state = this.state, output;
1824
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;
1825
+ validate(throwError = !1) {
1826
+ let output = null;
1827
+ if (!this.isNew && this.id <= 0 ? output = "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) ? output = "Tag name is invalid, must only contain letters, numbers, and spaces, starting with a letter" : this.color && !/^#?[A-z0-9]{6}$/.test(this.color) && (output = "Tag color is invalid, must be a 6 character hexadecimal."), throwError && output != null)
1828
+ throw Error(output);
1829
+ return output == null;
1830
1830
  }
1831
1831
  }
1832
- class qt extends I {
1832
+ class Note extends ModelWithState {
1833
1833
  constructor() {
1834
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", []);
1835
+ __publicField(this, "id", 0);
1836
+ __publicField(this, "_date", /* @__PURE__ */ new Date());
1837
+ __publicField(this, "_text", "");
1838
+ __publicField(this, "_archived", !1);
1839
+ __publicField(this, "_spaceId", 0);
1840
+ __publicField(this, "_space", null);
1841
+ __publicField(this, "_ownTag", null);
1842
+ __publicField(this, "_tags", []);
1843
+ __publicField(this, "_attrs", []);
1844
1844
  }
1845
1845
  get date() {
1846
1846
  return this._date;
1847
1847
  }
1848
- set date(t) {
1849
- t !== this._date && (this._date = t, this.isClean && this.dirty());
1848
+ set date(value) {
1849
+ value !== this._date && (this._date = value, this.isClean && this.dirty());
1850
1850
  }
1851
1851
  get text() {
1852
1852
  return this._text;
1853
1853
  }
1854
- set text(t) {
1855
- t !== this._text && (this._text = t, this.isClean && this.dirty());
1854
+ set text(value) {
1855
+ value !== this._text && (this._text = value, this.isClean && this.dirty());
1856
1856
  }
1857
1857
  get archived() {
1858
1858
  return this._archived;
1859
1859
  }
1860
- set archived(t) {
1861
- t !== this._archived && (this._archived = t, this.isClean && this.dirty());
1860
+ set archived(value) {
1861
+ value !== this._archived && (this._archived = value, this.isClean && this.dirty());
1862
1862
  }
1863
1863
  get spaceId() {
1864
1864
  return this._spaceId;
1865
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());
1866
+ set spaceId(value) {
1867
+ var _a;
1868
+ value !== this._spaceId && (this._spaceId = value, value !== ((_a = this.space) == null ? void 0 : _a.id) && (this._space = null), this.isClean && this.dirty());
1869
1869
  }
1870
1870
  get space() {
1871
1871
  return this._space;
1872
1872
  }
1873
- set space(t) {
1874
- this._space = t, this.spaceId = (t == null ? void 0 : t.id) ?? 0;
1873
+ set space(value) {
1874
+ this._space = value, this.spaceId = (value == null ? void 0 : value.id) ?? 0;
1875
1875
  }
1876
1876
  get ownTag() {
1877
1877
  return this._ownTag;
1878
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;
1879
+ setOwnTag(tag) {
1880
+ if (typeof tag == "string")
1881
+ this.ownTag == null && (this._ownTag = new Tag()), this.ownTag.name = tag, this.ownTag.id = this.id;
1882
1882
  else {
1883
1883
  if (this.ownTag)
1884
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)
1885
+ if (tag.id != 0 && tag.id != this.id)
1886
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;
1887
+ this._ownTag = tag;
1888
1888
  }
1889
1889
  return this;
1890
1890
  }
@@ -1894,167 +1894,167 @@ class qt extends I {
1894
1894
  get tags() {
1895
1895
  return this._tags;
1896
1896
  }
1897
- addTag(t) {
1898
- if (t.isDeleted)
1897
+ addTag(tag) {
1898
+ if (tag.isDeleted)
1899
1899
  throw Error("Cannot add a tag marked as deleted to a note");
1900
- if (t.isNew)
1900
+ if (tag.isNew)
1901
1901
  throw Error("Cannot add a tag that hasn't yet been saved to a note");
1902
- if (t.id == this.id)
1902
+ if (tag.id == this.id)
1903
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);
1904
+ let nt = this.tags.find((x) => x.tagId == tag.id);
1905
+ return nt ? (nt.isDeleted && nt.dirty(), nt) : (nt = new NoteTag(), nt.note = this, nt.tag = tag, this._tags.push(nt), nt);
1906
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;
1907
+ removeTag(tag) {
1908
+ const nt = this.tags.find((x) => x.tagId == tag.id);
1909
+ return nt ? (nt.isNew ? this._tags = this._tags.filter((x) => x !== nt) : nt.delete(), this) : this;
1910
1910
  }
1911
1911
  get attrs() {
1912
1912
  return this._attrs;
1913
1913
  }
1914
- addAttr(t) {
1915
- if (t.isDeleted)
1914
+ addAttr(attr) {
1915
+ if (attr.isDeleted)
1916
1916
  throw Error("Cannot add an attribute marked as deleted to a note");
1917
- if (t.isNew)
1917
+ if (attr.isNew)
1918
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);
1919
+ let na = this.attrs.find((x) => x.attrId == attr.id);
1920
+ return na ? (na.isDeleted && na.dirty(), na) : (na = new NoteAttr(), na.note = this, na.attr = attr, this._attrs.push(na), na);
1921
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;
1922
+ removeAttr(attr) {
1923
+ const na = this.attrs.find((x) => x.attrId == attr.id);
1924
+ return na ? (na.isNew ? this._attrs = this._attrs.filter((x) => x !== na) : na.delete(), this) : this;
1925
1925
  }
1926
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))
1927
+ const output = new Note();
1928
+ return output.id = this.id, output.date = this.date, output.text = this.text, output.archived = this.archived, output.space = this.space, output.state = this.state, output;
1929
+ }
1930
+ validate(throwError = !1) {
1931
+ let output = null;
1932
+ if (this.spaceId <= 0 ? output = "Note spaceId must be greater than zero." : !this.isNew && this.id <= 0 && (output = "Note id must be greater than zero if in non-new state."), throwError && output != null)
1933
+ throw Error(output);
1934
+ if (this.ownTag && !this.ownTag.validate(throwError))
1935
1935
  return !1;
1936
- for (const r of this.tags)
1937
- if (!r.validate(t))
1936
+ for (const nt of this.tags)
1937
+ if (!nt.validate(throwError))
1938
1938
  return !1;
1939
- for (const r of this.attrs)
1940
- if (!r.validate(t))
1939
+ for (const na of this.attrs)
1940
+ if (!na.validate(throwError))
1941
1941
  return !1;
1942
- return s == null;
1942
+ return output == null;
1943
1943
  }
1944
1944
  }
1945
- class $t {
1945
+ class ParsedQuery {
1946
1946
  constructor() {
1947
- h(this, "where", null);
1948
- h(this, "order", null);
1949
- h(this, "tags", []);
1950
- h(this, "attrs", []);
1947
+ __publicField(this, "where", null);
1948
+ __publicField(this, "order", null);
1949
+ __publicField(this, "tags", []);
1950
+ __publicField(this, "attrs", []);
1951
1951
  }
1952
1952
  }
1953
- class hn {
1953
+ class ParsedTag {
1954
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);
1955
+ __publicField(this, "space", null);
1956
+ __publicField(this, "name", null);
1957
+ __publicField(this, "searchDepth", 0);
1958
+ __publicField(this, "strictSearchDepth", !0);
1959
+ __publicField(this, "includeOwner", !1);
1960
1960
  }
1961
1961
  }
1962
- class fn {
1962
+ class ParsedAttr {
1963
1963
  constructor() {
1964
- h(this, "space", null);
1965
- h(this, "name", null);
1966
- h(this, "exists", !1);
1967
- h(this, "tagNameFilters", null);
1964
+ __publicField(this, "space", null);
1965
+ __publicField(this, "name", null);
1966
+ __publicField(this, "exists", !1);
1967
+ __publicField(this, "tagNameFilters", null);
1968
1968
  }
1969
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;
1970
+ function parseQuery(query) {
1971
+ const output = splitQuery(query);
1972
+ return output.where = identifyTags(output.where, output), output.order = identifyTags(output.order, output), output.where = identifyAttrs(output.where, output), output.order = identifyAttrs(output.order, output), output;
1973
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;
1974
+ function splitQuery(query) {
1975
+ query = " " + query + " ";
1976
+ const output = new ParsedQuery(), orderByIndex = query.toUpperCase().indexOf(" ORDER BY ");
1977
+ return orderByIndex < 0 ? output.where = query.trim() : (output.where = query.substring(0, orderByIndex).trim(), output.order = query.substring(orderByIndex + 10).trim()), output.where == "" && (output.where = null), output;
1978
1978
  }
1979
- function tt(e, n) {
1980
- const t = [
1979
+ function identifyTags(query, parsedQuery) {
1980
+ const regexes = [
1981
1981
  /(#+\??~?|~)([\w\d]+\.)?([\w\d]+)/,
1982
1982
  //Single word tags and space names
1983
1983
  /(#+\??~?|~)\[([\w\d\s]+\.)?([\w\d\s]+)\]/
1984
1984
  //Multi-word tags and space names wrapped in []
1985
1985
  ];
1986
- for (const s of t)
1986
+ for (const regex of regexes)
1987
1987
  for (; ; ) {
1988
- const r = s.exec(e);
1989
- if (!r)
1988
+ const match = regex.exec(query);
1989
+ if (!match)
1990
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);
1991
+ const hashPrefix = match[1], parsedTag = new ParsedTag();
1992
+ parsedTag.space = match[2] ? match[2].substring(0, match[2].length - 1) : null, parsedTag.name = match[3], parsedTag.includeOwner = hashPrefix.includes("~"), parsedTag.searchDepth = (hashPrefix.match(/#/g) || []).length, parsedTag.strictSearchDepth = !hashPrefix.includes("?");
1993
+ const fullMatch = match[0], matchStart = query.indexOf(fullMatch), matchEnd = matchStart + fullMatch.length;
1994
+ query = query.substring(0, matchStart) + `{tag${parsedQuery.tags.length}}` + query.substring(matchEnd), parsedQuery.tags.push(parsedTag);
1995
1995
  }
1996
- return e;
1996
+ return query;
1997
1997
  }
1998
- function _t(e, n) {
1999
- const t = [
1998
+ function identifyAttrs(query, parsedQuery) {
1999
+ const regexes = [
2000
2000
  /@([\w\d]+\.(?!Exists\(|On\())?([\w\d]+)/,
2001
2001
  /@\[([\w\d\s]+\.)?([\w\d\s]+)\]/
2002
2002
  ];
2003
- for (const s of t)
2003
+ for (const regex of regexes)
2004
2004
  for (; ; ) {
2005
- const r = s.exec(e);
2006
- if (!r)
2005
+ const match = regex.exec(query);
2006
+ if (!match)
2007
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)
2008
+ const parsedAttr = new ParsedAttr();
2009
+ parsedAttr.space = match[1] ? match[1].substring(0, match[1].length - 1) : null, parsedAttr.name = match[2];
2010
+ const matchStart = query.indexOf(match[0]);
2011
+ let matchEnd = matchStart + match[0].length;
2012
+ if (query.substring(matchEnd, matchEnd + 9) == ".Exists()" && (parsedAttr.exists = !0, matchEnd += 9), query.substring(matchEnd, matchEnd + 4) == ".On(") {
2013
+ let tagFilterStart = matchEnd + 4;
2014
+ if (matchEnd = query.indexOf(")", tagFilterStart), matchEnd < 0)
2015
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++;
2016
+ let tagNameFilters = query.substring(tagFilterStart, matchEnd).split("|");
2017
+ const dummyParsedQuery = new ParsedQuery();
2018
+ for (let tagNameFilter of tagNameFilters)
2019
+ tagNameFilter.startsWith("~") || (tagNameFilter = "~" + tagNameFilter), identifyTags(tagNameFilter, dummyParsedQuery);
2020
+ parsedAttr.tagNameFilters = dummyParsedQuery.tags, matchEnd++;
2021
2021
  }
2022
- e = e.substring(0, o) + `{attr${n.attrs.length}}` + e.substring(c), n.attrs.push(i);
2022
+ query = query.substring(0, matchStart) + `{attr${parsedQuery.attrs.length}}` + query.substring(matchEnd), parsedQuery.attrs.push(parsedAttr);
2023
2023
  }
2024
- return e;
2024
+ return query;
2025
2025
  }
2026
- class Vt extends I {
2027
- constructor(t = "") {
2026
+ class Space extends ModelWithState {
2027
+ constructor(name = "") {
2028
2028
  super();
2029
- h(this, "id", 0);
2030
- h(this, "_name", "");
2031
- this._name = t;
2029
+ __publicField(this, "id", 0);
2030
+ __publicField(this, "_name", "");
2031
+ this._name = name;
2032
2032
  }
2033
2033
  get name() {
2034
2034
  return this._name;
2035
2035
  }
2036
- set name(t) {
2037
- t !== this._name && (this._name = t, this.isClean && this.dirty());
2036
+ set name(value) {
2037
+ value !== this._name && (this._name = value, this.isClean && this.dirty());
2038
2038
  }
2039
2039
  duplicate() {
2040
- const t = new Vt();
2041
- return t.id = this.id, t.name = this.name, t.state = this.state, t;
2040
+ const output = new Space();
2041
+ return output.id = this.id, output.name = this.name, output.state = this.state, output;
2042
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;
2043
+ validate(throwError = !1) {
2044
+ let output = null;
2045
+ if (!this.isNew && this.id <= 0 && (output = "Space id must be greater than zero if in non-new state."), throwError && output != null)
2046
+ throw Error(output);
2047
+ return output == null;
2048
2048
  }
2049
2049
  }
2050
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
2051
+ Attr,
2052
+ Environment,
2053
+ HttpClient,
2054
+ Note,
2055
+ NoteAttr,
2056
+ NoteTag,
2057
+ Space,
2058
+ Tag,
2059
+ parseQuery
2060
2060
  };