@edifice.io/client 2.0.0-develop-pedago.1 → 2.0.0-develop-pedago.3
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/index.cjs +1 -6
- package/dist/index.js +828 -2640
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var v = Object.defineProperty;
|
|
2
|
+
var T = (o, e, t) => e in o ? v(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var n = (o, e, t) => T(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import axios from "axios";
|
|
5
|
+
import { MimeTypeUtils } from "@edifice.io/utilities";
|
|
4
6
|
const ERROR_CODE = {
|
|
5
7
|
SUCCESS: "0000",
|
|
6
8
|
UNKNOWN: "0010",
|
|
@@ -95,7 +97,7 @@ const ERROR_CODE = {
|
|
|
95
97
|
};
|
|
96
98
|
class Subscription {
|
|
97
99
|
constructor(e, t) {
|
|
98
|
-
|
|
100
|
+
n(this, "revoke");
|
|
99
101
|
this._channel = e, this.revoke = this.setReceiver(
|
|
100
102
|
(s) => t == null ? void 0 : t(s.data)
|
|
101
103
|
);
|
|
@@ -113,7 +115,7 @@ class Subject {
|
|
|
113
115
|
* => We maintain here channels for *sending* messages.
|
|
114
116
|
* *Receiving* channels will be instantiated while subscribing.
|
|
115
117
|
*/
|
|
116
|
-
|
|
118
|
+
n(this, "publishChannels", /* @__PURE__ */ new Map());
|
|
117
119
|
}
|
|
118
120
|
getChannelName(e) {
|
|
119
121
|
return "Subject:" + e;
|
|
@@ -125,7 +127,7 @@ class Subject {
|
|
|
125
127
|
}
|
|
126
128
|
newChannel(e) {
|
|
127
129
|
const t = this.getChannelName(e), s = new BroadcastChannel(t);
|
|
128
|
-
return s.addEventListener("messageerror", (
|
|
130
|
+
return s.addEventListener("messageerror", (r) => console.log(r.data)), s;
|
|
129
131
|
}
|
|
130
132
|
publish(e, t) {
|
|
131
133
|
typeof e == "string" && this.getPublishChannel(e).postMessage(t);
|
|
@@ -148,9 +150,9 @@ const ASYNC_DATA_NAME = {
|
|
|
148
150
|
class Promisified {
|
|
149
151
|
constructor() {
|
|
150
152
|
//-------------------------------------
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
n(this, "_resolution");
|
|
154
|
+
n(this, "_rejection");
|
|
155
|
+
n(this, "_promise", new Promise((e, t) => {
|
|
154
156
|
this._resolution = e, this._rejection = t;
|
|
155
157
|
}));
|
|
156
158
|
}
|
|
@@ -167,8 +169,8 @@ class Promisified {
|
|
|
167
169
|
class NotifyFramework {
|
|
168
170
|
constructor() {
|
|
169
171
|
//-------------------------------------
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
n(this, "promises", {});
|
|
173
|
+
n(this, "subject", new Subject());
|
|
172
174
|
}
|
|
173
175
|
asyncData(e) {
|
|
174
176
|
return typeof this.promises[e] > "u" && (this.promises[e] = new Promisified()), this.promises[e];
|
|
@@ -195,1696 +197,12 @@ class NotifyFramework {
|
|
|
195
197
|
return this.subject;
|
|
196
198
|
}
|
|
197
199
|
}
|
|
198
|
-
const notify = new NotifyFramework();
|
|
199
|
-
function bind(r, e) {
|
|
200
|
-
return function() {
|
|
201
|
-
return r.apply(e, arguments);
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
const { toString } = Object.prototype, { getPrototypeOf } = Object, kindOf = /* @__PURE__ */ ((r) => (e) => {
|
|
205
|
-
const t = toString.call(e);
|
|
206
|
-
return r[t] || (r[t] = t.slice(8, -1).toLowerCase());
|
|
207
|
-
})(/* @__PURE__ */ Object.create(null)), kindOfTest = (r) => (r = r.toLowerCase(), (e) => kindOf(e) === r), typeOfTest = (r) => (e) => typeof e === r, { isArray } = Array, isUndefined = typeOfTest("undefined");
|
|
208
|
-
function isBuffer(r) {
|
|
209
|
-
return r !== null && !isUndefined(r) && r.constructor !== null && !isUndefined(r.constructor) && isFunction(r.constructor.isBuffer) && r.constructor.isBuffer(r);
|
|
210
|
-
}
|
|
211
|
-
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
212
|
-
function isArrayBufferView(r) {
|
|
213
|
-
let e;
|
|
214
|
-
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(r) : e = r && r.buffer && isArrayBuffer(r.buffer), e;
|
|
215
|
-
}
|
|
216
|
-
const isString = typeOfTest("string"), isFunction = typeOfTest("function"), isNumber = typeOfTest("number"), isObject = (r) => r !== null && typeof r == "object", isBoolean = (r) => r === !0 || r === !1, isPlainObject = (r) => {
|
|
217
|
-
if (kindOf(r) !== "object")
|
|
218
|
-
return !1;
|
|
219
|
-
const e = getPrototypeOf(r);
|
|
220
|
-
return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in r) && !(Symbol.iterator in r);
|
|
221
|
-
}, isDate = kindOfTest("Date"), isFile = kindOfTest("File"), isBlob = kindOfTest("Blob"), isFileList = kindOfTest("FileList"), isStream = (r) => isObject(r) && isFunction(r.pipe), isFormData = (r) => {
|
|
222
|
-
let e;
|
|
223
|
-
return r && (typeof FormData == "function" && r instanceof FormData || isFunction(r.append) && ((e = kindOf(r)) === "formdata" || // detect form-data instance
|
|
224
|
-
e === "object" && isFunction(r.toString) && r.toString() === "[object FormData]"));
|
|
225
|
-
}, isURLSearchParams = kindOfTest("URLSearchParams"), [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest), trim = (r) => r.trim ? r.trim() : r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
226
|
-
function forEach(r, e, { allOwnKeys: t = !1 } = {}) {
|
|
227
|
-
if (r === null || typeof r > "u")
|
|
228
|
-
return;
|
|
229
|
-
let s, i;
|
|
230
|
-
if (typeof r != "object" && (r = [r]), isArray(r))
|
|
231
|
-
for (s = 0, i = r.length; s < i; s++)
|
|
232
|
-
e.call(null, r[s], s, r);
|
|
233
|
-
else {
|
|
234
|
-
const u = t ? Object.getOwnPropertyNames(r) : Object.keys(r), c = u.length;
|
|
235
|
-
let l;
|
|
236
|
-
for (s = 0; s < c; s++)
|
|
237
|
-
l = u[s], e.call(null, r[l], l, r);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
function findKey(r, e) {
|
|
241
|
-
e = e.toLowerCase();
|
|
242
|
-
const t = Object.keys(r);
|
|
243
|
-
let s = t.length, i;
|
|
244
|
-
for (; s-- > 0; )
|
|
245
|
-
if (i = t[s], e === i.toLowerCase())
|
|
246
|
-
return i;
|
|
247
|
-
return null;
|
|
248
|
-
}
|
|
249
|
-
const _global = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, isContextDefined = (r) => !isUndefined(r) && r !== _global;
|
|
250
|
-
function merge() {
|
|
251
|
-
const { caseless: r } = isContextDefined(this) && this || {}, e = {}, t = (s, i) => {
|
|
252
|
-
const u = r && findKey(e, i) || i;
|
|
253
|
-
isPlainObject(e[u]) && isPlainObject(s) ? e[u] = merge(e[u], s) : isPlainObject(s) ? e[u] = merge({}, s) : isArray(s) ? e[u] = s.slice() : e[u] = s;
|
|
254
|
-
};
|
|
255
|
-
for (let s = 0, i = arguments.length; s < i; s++)
|
|
256
|
-
arguments[s] && forEach(arguments[s], t);
|
|
257
|
-
return e;
|
|
258
|
-
}
|
|
259
|
-
const extend = (r, e, t, { allOwnKeys: s } = {}) => (forEach(e, (i, u) => {
|
|
260
|
-
t && isFunction(i) ? r[u] = bind(i, t) : r[u] = i;
|
|
261
|
-
}, { allOwnKeys: s }), r), stripBOM = (r) => (r.charCodeAt(0) === 65279 && (r = r.slice(1)), r), inherits = (r, e, t, s) => {
|
|
262
|
-
r.prototype = Object.create(e.prototype, s), r.prototype.constructor = r, Object.defineProperty(r, "super", {
|
|
263
|
-
value: e.prototype
|
|
264
|
-
}), t && Object.assign(r.prototype, t);
|
|
265
|
-
}, toFlatObject = (r, e, t, s) => {
|
|
266
|
-
let i, u, c;
|
|
267
|
-
const l = {};
|
|
268
|
-
if (e = e || {}, r == null) return e;
|
|
269
|
-
do {
|
|
270
|
-
for (i = Object.getOwnPropertyNames(r), u = i.length; u-- > 0; )
|
|
271
|
-
c = i[u], (!s || s(c, r, e)) && !l[c] && (e[c] = r[c], l[c] = !0);
|
|
272
|
-
r = t !== !1 && getPrototypeOf(r);
|
|
273
|
-
} while (r && (!t || t(r, e)) && r !== Object.prototype);
|
|
274
|
-
return e;
|
|
275
|
-
}, endsWith = (r, e, t) => {
|
|
276
|
-
r = String(r), (t === void 0 || t > r.length) && (t = r.length), t -= e.length;
|
|
277
|
-
const s = r.indexOf(e, t);
|
|
278
|
-
return s !== -1 && s === t;
|
|
279
|
-
}, toArray = (r) => {
|
|
280
|
-
if (!r) return null;
|
|
281
|
-
if (isArray(r)) return r;
|
|
282
|
-
let e = r.length;
|
|
283
|
-
if (!isNumber(e)) return null;
|
|
284
|
-
const t = new Array(e);
|
|
285
|
-
for (; e-- > 0; )
|
|
286
|
-
t[e] = r[e];
|
|
287
|
-
return t;
|
|
288
|
-
}, isTypedArray = /* @__PURE__ */ ((r) => (e) => r && e instanceof r)(typeof Uint8Array < "u" && getPrototypeOf(Uint8Array)), forEachEntry = (r, e) => {
|
|
289
|
-
const s = (r && r[Symbol.iterator]).call(r);
|
|
290
|
-
let i;
|
|
291
|
-
for (; (i = s.next()) && !i.done; ) {
|
|
292
|
-
const u = i.value;
|
|
293
|
-
e.call(r, u[0], u[1]);
|
|
294
|
-
}
|
|
295
|
-
}, matchAll = (r, e) => {
|
|
296
|
-
let t;
|
|
297
|
-
const s = [];
|
|
298
|
-
for (; (t = r.exec(e)) !== null; )
|
|
299
|
-
s.push(t);
|
|
300
|
-
return s;
|
|
301
|
-
}, isHTMLForm = kindOfTest("HTMLFormElement"), toCamelCase = (r) => r.toLowerCase().replace(
|
|
302
|
-
/[-_\s]([a-z\d])(\w*)/g,
|
|
303
|
-
function(t, s, i) {
|
|
304
|
-
return s.toUpperCase() + i;
|
|
305
|
-
}
|
|
306
|
-
), hasOwnProperty = (({ hasOwnProperty: r }) => (e, t) => r.call(e, t))(Object.prototype), isRegExp = kindOfTest("RegExp"), reduceDescriptors = (r, e) => {
|
|
307
|
-
const t = Object.getOwnPropertyDescriptors(r), s = {};
|
|
308
|
-
forEach(t, (i, u) => {
|
|
309
|
-
let c;
|
|
310
|
-
(c = e(i, u, r)) !== !1 && (s[u] = c || i);
|
|
311
|
-
}), Object.defineProperties(r, s);
|
|
312
|
-
}, freezeMethods = (r) => {
|
|
313
|
-
reduceDescriptors(r, (e, t) => {
|
|
314
|
-
if (isFunction(r) && ["arguments", "caller", "callee"].indexOf(t) !== -1)
|
|
315
|
-
return !1;
|
|
316
|
-
const s = r[t];
|
|
317
|
-
if (isFunction(s)) {
|
|
318
|
-
if (e.enumerable = !1, "writable" in e) {
|
|
319
|
-
e.writable = !1;
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
e.set || (e.set = () => {
|
|
323
|
-
throw Error("Can not rewrite read-only method '" + t + "'");
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
}, toObjectSet = (r, e) => {
|
|
328
|
-
const t = {}, s = (i) => {
|
|
329
|
-
i.forEach((u) => {
|
|
330
|
-
t[u] = !0;
|
|
331
|
-
});
|
|
332
|
-
};
|
|
333
|
-
return isArray(r) ? s(r) : s(String(r).split(e)), t;
|
|
334
|
-
}, noop = () => {
|
|
335
|
-
}, toFiniteNumber = (r, e) => r != null && Number.isFinite(r = +r) ? r : e, ALPHA = "abcdefghijklmnopqrstuvwxyz", DIGIT = "0123456789", ALPHABET = {
|
|
336
|
-
DIGIT,
|
|
337
|
-
ALPHA,
|
|
338
|
-
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
|
339
|
-
}, generateString = (r = 16, e = ALPHABET.ALPHA_DIGIT) => {
|
|
340
|
-
let t = "";
|
|
341
|
-
const { length: s } = e;
|
|
342
|
-
for (; r--; )
|
|
343
|
-
t += e[Math.random() * s | 0];
|
|
344
|
-
return t;
|
|
345
|
-
};
|
|
346
|
-
function isSpecCompliantForm(r) {
|
|
347
|
-
return !!(r && isFunction(r.append) && r[Symbol.toStringTag] === "FormData" && r[Symbol.iterator]);
|
|
348
|
-
}
|
|
349
|
-
const toJSONObject = (r) => {
|
|
350
|
-
const e = new Array(10), t = (s, i) => {
|
|
351
|
-
if (isObject(s)) {
|
|
352
|
-
if (e.indexOf(s) >= 0)
|
|
353
|
-
return;
|
|
354
|
-
if (!("toJSON" in s)) {
|
|
355
|
-
e[i] = s;
|
|
356
|
-
const u = isArray(s) ? [] : {};
|
|
357
|
-
return forEach(s, (c, l) => {
|
|
358
|
-
const E = t(c, i + 1);
|
|
359
|
-
!isUndefined(E) && (u[l] = E);
|
|
360
|
-
}), e[i] = void 0, u;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
return s;
|
|
364
|
-
};
|
|
365
|
-
return t(r, 0);
|
|
366
|
-
}, isAsyncFn = kindOfTest("AsyncFunction"), isThenable = (r) => r && (isObject(r) || isFunction(r)) && isFunction(r.then) && isFunction(r.catch), _setImmediate = ((r, e) => r ? setImmediate : e ? ((t, s) => (_global.addEventListener("message", ({ source: i, data: u }) => {
|
|
367
|
-
i === _global && u === t && s.length && s.shift()();
|
|
368
|
-
}, !1), (i) => {
|
|
369
|
-
s.push(i), _global.postMessage(t, "*");
|
|
370
|
-
}))(`axios@${Math.random()}`, []) : (t) => setTimeout(t))(
|
|
371
|
-
typeof setImmediate == "function",
|
|
372
|
-
isFunction(_global.postMessage)
|
|
373
|
-
), asap = typeof queueMicrotask < "u" ? queueMicrotask.bind(_global) : typeof process < "u" && process.nextTick || _setImmediate, utils$1 = {
|
|
374
|
-
isArray,
|
|
375
|
-
isArrayBuffer,
|
|
376
|
-
isBuffer,
|
|
377
|
-
isFormData,
|
|
378
|
-
isArrayBufferView,
|
|
379
|
-
isString,
|
|
380
|
-
isNumber,
|
|
381
|
-
isBoolean,
|
|
382
|
-
isObject,
|
|
383
|
-
isPlainObject,
|
|
384
|
-
isReadableStream,
|
|
385
|
-
isRequest,
|
|
386
|
-
isResponse,
|
|
387
|
-
isHeaders,
|
|
388
|
-
isUndefined,
|
|
389
|
-
isDate,
|
|
390
|
-
isFile,
|
|
391
|
-
isBlob,
|
|
392
|
-
isRegExp,
|
|
393
|
-
isFunction,
|
|
394
|
-
isStream,
|
|
395
|
-
isURLSearchParams,
|
|
396
|
-
isTypedArray,
|
|
397
|
-
isFileList,
|
|
398
|
-
forEach,
|
|
399
|
-
merge,
|
|
400
|
-
extend,
|
|
401
|
-
trim,
|
|
402
|
-
stripBOM,
|
|
403
|
-
inherits,
|
|
404
|
-
toFlatObject,
|
|
405
|
-
kindOf,
|
|
406
|
-
kindOfTest,
|
|
407
|
-
endsWith,
|
|
408
|
-
toArray,
|
|
409
|
-
forEachEntry,
|
|
410
|
-
matchAll,
|
|
411
|
-
isHTMLForm,
|
|
412
|
-
hasOwnProperty,
|
|
413
|
-
hasOwnProp: hasOwnProperty,
|
|
414
|
-
// an alias to avoid ESLint no-prototype-builtins detection
|
|
415
|
-
reduceDescriptors,
|
|
416
|
-
freezeMethods,
|
|
417
|
-
toObjectSet,
|
|
418
|
-
toCamelCase,
|
|
419
|
-
noop,
|
|
420
|
-
toFiniteNumber,
|
|
421
|
-
findKey,
|
|
422
|
-
global: _global,
|
|
423
|
-
isContextDefined,
|
|
424
|
-
ALPHABET,
|
|
425
|
-
generateString,
|
|
426
|
-
isSpecCompliantForm,
|
|
427
|
-
toJSONObject,
|
|
428
|
-
isAsyncFn,
|
|
429
|
-
isThenable,
|
|
430
|
-
setImmediate: _setImmediate,
|
|
431
|
-
asap
|
|
432
|
-
};
|
|
433
|
-
function AxiosError(r, e, t, s, i) {
|
|
434
|
-
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = r, this.name = "AxiosError", e && (this.code = e), t && (this.config = t), s && (this.request = s), i && (this.response = i, this.status = i.status ? i.status : null);
|
|
435
|
-
}
|
|
436
|
-
utils$1.inherits(AxiosError, Error, {
|
|
437
|
-
toJSON: function() {
|
|
438
|
-
return {
|
|
439
|
-
// Standard
|
|
440
|
-
message: this.message,
|
|
441
|
-
name: this.name,
|
|
442
|
-
// Microsoft
|
|
443
|
-
description: this.description,
|
|
444
|
-
number: this.number,
|
|
445
|
-
// Mozilla
|
|
446
|
-
fileName: this.fileName,
|
|
447
|
-
lineNumber: this.lineNumber,
|
|
448
|
-
columnNumber: this.columnNumber,
|
|
449
|
-
stack: this.stack,
|
|
450
|
-
// Axios
|
|
451
|
-
config: utils$1.toJSONObject(this.config),
|
|
452
|
-
code: this.code,
|
|
453
|
-
status: this.status
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
});
|
|
457
|
-
const prototype$1 = AxiosError.prototype, descriptors = {};
|
|
458
|
-
[
|
|
459
|
-
"ERR_BAD_OPTION_VALUE",
|
|
460
|
-
"ERR_BAD_OPTION",
|
|
461
|
-
"ECONNABORTED",
|
|
462
|
-
"ETIMEDOUT",
|
|
463
|
-
"ERR_NETWORK",
|
|
464
|
-
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
465
|
-
"ERR_DEPRECATED",
|
|
466
|
-
"ERR_BAD_RESPONSE",
|
|
467
|
-
"ERR_BAD_REQUEST",
|
|
468
|
-
"ERR_CANCELED",
|
|
469
|
-
"ERR_NOT_SUPPORT",
|
|
470
|
-
"ERR_INVALID_URL"
|
|
471
|
-
// eslint-disable-next-line func-names
|
|
472
|
-
].forEach((r) => {
|
|
473
|
-
descriptors[r] = { value: r };
|
|
474
|
-
});
|
|
475
|
-
Object.defineProperties(AxiosError, descriptors);
|
|
476
|
-
Object.defineProperty(prototype$1, "isAxiosError", { value: !0 });
|
|
477
|
-
AxiosError.from = (r, e, t, s, i, u) => {
|
|
478
|
-
const c = Object.create(prototype$1);
|
|
479
|
-
return utils$1.toFlatObject(r, c, function(E) {
|
|
480
|
-
return E !== Error.prototype;
|
|
481
|
-
}, (l) => l !== "isAxiosError"), AxiosError.call(c, r.message, e, t, s, i), c.cause = r, c.name = r.name, u && Object.assign(c, u), c;
|
|
482
|
-
};
|
|
483
|
-
const httpAdapter = null;
|
|
484
|
-
function isVisitable(r) {
|
|
485
|
-
return utils$1.isPlainObject(r) || utils$1.isArray(r);
|
|
486
|
-
}
|
|
487
|
-
function removeBrackets(r) {
|
|
488
|
-
return utils$1.endsWith(r, "[]") ? r.slice(0, -2) : r;
|
|
489
|
-
}
|
|
490
|
-
function renderKey(r, e, t) {
|
|
491
|
-
return r ? r.concat(e).map(function(i, u) {
|
|
492
|
-
return i = removeBrackets(i), !t && u ? "[" + i + "]" : i;
|
|
493
|
-
}).join(t ? "." : "") : e;
|
|
494
|
-
}
|
|
495
|
-
function isFlatArray(r) {
|
|
496
|
-
return utils$1.isArray(r) && !r.some(isVisitable);
|
|
497
|
-
}
|
|
498
|
-
const predicates = utils$1.toFlatObject(utils$1, {}, null, function(e) {
|
|
499
|
-
return /^is[A-Z]/.test(e);
|
|
500
|
-
});
|
|
501
|
-
function toFormData(r, e, t) {
|
|
502
|
-
if (!utils$1.isObject(r))
|
|
503
|
-
throw new TypeError("target must be an object");
|
|
504
|
-
e = e || new FormData(), t = utils$1.toFlatObject(t, {
|
|
505
|
-
metaTokens: !0,
|
|
506
|
-
dots: !1,
|
|
507
|
-
indexes: !1
|
|
508
|
-
}, !1, function(R, y) {
|
|
509
|
-
return !utils$1.isUndefined(y[R]);
|
|
510
|
-
});
|
|
511
|
-
const s = t.metaTokens, i = t.visitor || h, u = t.dots, c = t.indexes, E = (t.Blob || typeof Blob < "u" && Blob) && utils$1.isSpecCompliantForm(e);
|
|
512
|
-
if (!utils$1.isFunction(i))
|
|
513
|
-
throw new TypeError("visitor must be a function");
|
|
514
|
-
function f(A) {
|
|
515
|
-
if (A === null) return "";
|
|
516
|
-
if (utils$1.isDate(A))
|
|
517
|
-
return A.toISOString();
|
|
518
|
-
if (!E && utils$1.isBlob(A))
|
|
519
|
-
throw new AxiosError("Blob is not supported. Use a Buffer instead.");
|
|
520
|
-
return utils$1.isArrayBuffer(A) || utils$1.isTypedArray(A) ? E && typeof Blob == "function" ? new Blob([A]) : Buffer.from(A) : A;
|
|
521
|
-
}
|
|
522
|
-
function h(A, R, y) {
|
|
523
|
-
let C = A;
|
|
524
|
-
if (A && !y && typeof A == "object") {
|
|
525
|
-
if (utils$1.endsWith(R, "{}"))
|
|
526
|
-
R = s ? R : R.slice(0, -2), A = JSON.stringify(A);
|
|
527
|
-
else if (utils$1.isArray(A) && isFlatArray(A) || (utils$1.isFileList(A) || utils$1.endsWith(R, "[]")) && (C = utils$1.toArray(A)))
|
|
528
|
-
return R = removeBrackets(R), C.forEach(function(F, D) {
|
|
529
|
-
!(utils$1.isUndefined(F) || F === null) && e.append(
|
|
530
|
-
// eslint-disable-next-line no-nested-ternary
|
|
531
|
-
c === !0 ? renderKey([R], D, u) : c === null ? R : R + "[]",
|
|
532
|
-
f(F)
|
|
533
|
-
);
|
|
534
|
-
}), !1;
|
|
535
|
-
}
|
|
536
|
-
return isVisitable(A) ? !0 : (e.append(renderKey(y, R, u), f(A)), !1);
|
|
537
|
-
}
|
|
538
|
-
const g = [], b = Object.assign(predicates, {
|
|
539
|
-
defaultVisitor: h,
|
|
540
|
-
convertValue: f,
|
|
541
|
-
isVisitable
|
|
542
|
-
});
|
|
543
|
-
function w(A, R) {
|
|
544
|
-
if (!utils$1.isUndefined(A)) {
|
|
545
|
-
if (g.indexOf(A) !== -1)
|
|
546
|
-
throw Error("Circular reference detected in " + R.join("."));
|
|
547
|
-
g.push(A), utils$1.forEach(A, function(C, x) {
|
|
548
|
-
(!(utils$1.isUndefined(C) || C === null) && i.call(
|
|
549
|
-
e,
|
|
550
|
-
C,
|
|
551
|
-
utils$1.isString(x) ? x.trim() : x,
|
|
552
|
-
R,
|
|
553
|
-
b
|
|
554
|
-
)) === !0 && w(C, R ? R.concat(x) : [x]);
|
|
555
|
-
}), g.pop();
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
if (!utils$1.isObject(r))
|
|
559
|
-
throw new TypeError("data must be an object");
|
|
560
|
-
return w(r), e;
|
|
561
|
-
}
|
|
562
|
-
function encode$1(r) {
|
|
563
|
-
const e = {
|
|
564
|
-
"!": "%21",
|
|
565
|
-
"'": "%27",
|
|
566
|
-
"(": "%28",
|
|
567
|
-
")": "%29",
|
|
568
|
-
"~": "%7E",
|
|
569
|
-
"%20": "+",
|
|
570
|
-
"%00": "\0"
|
|
571
|
-
};
|
|
572
|
-
return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g, function(s) {
|
|
573
|
-
return e[s];
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
function AxiosURLSearchParams(r, e) {
|
|
577
|
-
this._pairs = [], r && toFormData(r, this, e);
|
|
578
|
-
}
|
|
579
|
-
const prototype = AxiosURLSearchParams.prototype;
|
|
580
|
-
prototype.append = function(e, t) {
|
|
581
|
-
this._pairs.push([e, t]);
|
|
582
|
-
};
|
|
583
|
-
prototype.toString = function(e) {
|
|
584
|
-
const t = e ? function(s) {
|
|
585
|
-
return e.call(this, s, encode$1);
|
|
586
|
-
} : encode$1;
|
|
587
|
-
return this._pairs.map(function(i) {
|
|
588
|
-
return t(i[0]) + "=" + t(i[1]);
|
|
589
|
-
}, "").join("&");
|
|
590
|
-
};
|
|
591
|
-
function encode(r) {
|
|
592
|
-
return encodeURIComponent(r).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
593
|
-
}
|
|
594
|
-
function buildURL(r, e, t) {
|
|
595
|
-
if (!e)
|
|
596
|
-
return r;
|
|
597
|
-
const s = t && t.encode || encode;
|
|
598
|
-
utils$1.isFunction(t) && (t = {
|
|
599
|
-
serialize: t
|
|
600
|
-
});
|
|
601
|
-
const i = t && t.serialize;
|
|
602
|
-
let u;
|
|
603
|
-
if (i ? u = i(e, t) : u = utils$1.isURLSearchParams(e) ? e.toString() : new AxiosURLSearchParams(e, t).toString(s), u) {
|
|
604
|
-
const c = r.indexOf("#");
|
|
605
|
-
c !== -1 && (r = r.slice(0, c)), r += (r.indexOf("?") === -1 ? "?" : "&") + u;
|
|
606
|
-
}
|
|
607
|
-
return r;
|
|
608
|
-
}
|
|
609
|
-
class InterceptorManager {
|
|
610
|
-
constructor() {
|
|
611
|
-
this.handlers = [];
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* Add a new interceptor to the stack
|
|
615
|
-
*
|
|
616
|
-
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
617
|
-
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
618
|
-
*
|
|
619
|
-
* @return {Number} An ID used to remove interceptor later
|
|
620
|
-
*/
|
|
621
|
-
use(e, t, s) {
|
|
622
|
-
return this.handlers.push({
|
|
623
|
-
fulfilled: e,
|
|
624
|
-
rejected: t,
|
|
625
|
-
synchronous: s ? s.synchronous : !1,
|
|
626
|
-
runWhen: s ? s.runWhen : null
|
|
627
|
-
}), this.handlers.length - 1;
|
|
628
|
-
}
|
|
629
|
-
/**
|
|
630
|
-
* Remove an interceptor from the stack
|
|
631
|
-
*
|
|
632
|
-
* @param {Number} id The ID that was returned by `use`
|
|
633
|
-
*
|
|
634
|
-
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
635
|
-
*/
|
|
636
|
-
eject(e) {
|
|
637
|
-
this.handlers[e] && (this.handlers[e] = null);
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* Clear all interceptors from the stack
|
|
641
|
-
*
|
|
642
|
-
* @returns {void}
|
|
643
|
-
*/
|
|
644
|
-
clear() {
|
|
645
|
-
this.handlers && (this.handlers = []);
|
|
646
|
-
}
|
|
647
|
-
/**
|
|
648
|
-
* Iterate over all the registered interceptors
|
|
649
|
-
*
|
|
650
|
-
* This method is particularly useful for skipping over any
|
|
651
|
-
* interceptors that may have become `null` calling `eject`.
|
|
652
|
-
*
|
|
653
|
-
* @param {Function} fn The function to call for each interceptor
|
|
654
|
-
*
|
|
655
|
-
* @returns {void}
|
|
656
|
-
*/
|
|
657
|
-
forEach(e) {
|
|
658
|
-
utils$1.forEach(this.handlers, function(s) {
|
|
659
|
-
s !== null && e(s);
|
|
660
|
-
});
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
const transitionalDefaults = {
|
|
664
|
-
silentJSONParsing: !0,
|
|
665
|
-
forcedJSONParsing: !0,
|
|
666
|
-
clarifyTimeoutError: !1
|
|
667
|
-
}, URLSearchParams$1 = typeof URLSearchParams < "u" ? URLSearchParams : AxiosURLSearchParams, FormData$1 = typeof FormData < "u" ? FormData : null, Blob$1 = typeof Blob < "u" ? Blob : null, platform$1 = {
|
|
668
|
-
isBrowser: !0,
|
|
669
|
-
classes: {
|
|
670
|
-
URLSearchParams: URLSearchParams$1,
|
|
671
|
-
FormData: FormData$1,
|
|
672
|
-
Blob: Blob$1
|
|
673
|
-
},
|
|
674
|
-
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
675
|
-
}, hasBrowserEnv = typeof window < "u" && typeof document < "u", _navigator = typeof navigator == "object" && navigator || void 0, hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0), hasStandardBrowserWebWorkerEnv = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
676
|
-
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", origin = hasBrowserEnv && window.location.href || "http://localhost", utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
677
|
-
__proto__: null,
|
|
678
|
-
hasBrowserEnv,
|
|
679
|
-
hasStandardBrowserEnv,
|
|
680
|
-
hasStandardBrowserWebWorkerEnv,
|
|
681
|
-
navigator: _navigator,
|
|
682
|
-
origin
|
|
683
|
-
}, Symbol.toStringTag, { value: "Module" })), platform = {
|
|
684
|
-
...utils,
|
|
685
|
-
...platform$1
|
|
686
|
-
};
|
|
687
|
-
function toURLEncodedForm(r, e) {
|
|
688
|
-
return toFormData(r, new platform.classes.URLSearchParams(), Object.assign({
|
|
689
|
-
visitor: function(t, s, i, u) {
|
|
690
|
-
return platform.isNode && utils$1.isBuffer(t) ? (this.append(s, t.toString("base64")), !1) : u.defaultVisitor.apply(this, arguments);
|
|
691
|
-
}
|
|
692
|
-
}, e));
|
|
693
|
-
}
|
|
694
|
-
function parsePropPath(r) {
|
|
695
|
-
return utils$1.matchAll(/\w+|\[(\w*)]/g, r).map((e) => e[0] === "[]" ? "" : e[1] || e[0]);
|
|
696
|
-
}
|
|
697
|
-
function arrayToObject(r) {
|
|
698
|
-
const e = {}, t = Object.keys(r);
|
|
699
|
-
let s;
|
|
700
|
-
const i = t.length;
|
|
701
|
-
let u;
|
|
702
|
-
for (s = 0; s < i; s++)
|
|
703
|
-
u = t[s], e[u] = r[u];
|
|
704
|
-
return e;
|
|
705
|
-
}
|
|
706
|
-
function formDataToJSON(r) {
|
|
707
|
-
function e(t, s, i, u) {
|
|
708
|
-
let c = t[u++];
|
|
709
|
-
if (c === "__proto__") return !0;
|
|
710
|
-
const l = Number.isFinite(+c), E = u >= t.length;
|
|
711
|
-
return c = !c && utils$1.isArray(i) ? i.length : c, E ? (utils$1.hasOwnProp(i, c) ? i[c] = [i[c], s] : i[c] = s, !l) : ((!i[c] || !utils$1.isObject(i[c])) && (i[c] = []), e(t, s, i[c], u) && utils$1.isArray(i[c]) && (i[c] = arrayToObject(i[c])), !l);
|
|
712
|
-
}
|
|
713
|
-
if (utils$1.isFormData(r) && utils$1.isFunction(r.entries)) {
|
|
714
|
-
const t = {};
|
|
715
|
-
return utils$1.forEachEntry(r, (s, i) => {
|
|
716
|
-
e(parsePropPath(s), i, t, 0);
|
|
717
|
-
}), t;
|
|
718
|
-
}
|
|
719
|
-
return null;
|
|
720
|
-
}
|
|
721
|
-
function stringifySafely(r, e, t) {
|
|
722
|
-
if (utils$1.isString(r))
|
|
723
|
-
try {
|
|
724
|
-
return (e || JSON.parse)(r), utils$1.trim(r);
|
|
725
|
-
} catch (s) {
|
|
726
|
-
if (s.name !== "SyntaxError")
|
|
727
|
-
throw s;
|
|
728
|
-
}
|
|
729
|
-
return (t || JSON.stringify)(r);
|
|
730
|
-
}
|
|
731
|
-
const defaults = {
|
|
732
|
-
transitional: transitionalDefaults,
|
|
733
|
-
adapter: ["xhr", "http", "fetch"],
|
|
734
|
-
transformRequest: [function(e, t) {
|
|
735
|
-
const s = t.getContentType() || "", i = s.indexOf("application/json") > -1, u = utils$1.isObject(e);
|
|
736
|
-
if (u && utils$1.isHTMLForm(e) && (e = new FormData(e)), utils$1.isFormData(e))
|
|
737
|
-
return i ? JSON.stringify(formDataToJSON(e)) : e;
|
|
738
|
-
if (utils$1.isArrayBuffer(e) || utils$1.isBuffer(e) || utils$1.isStream(e) || utils$1.isFile(e) || utils$1.isBlob(e) || utils$1.isReadableStream(e))
|
|
739
|
-
return e;
|
|
740
|
-
if (utils$1.isArrayBufferView(e))
|
|
741
|
-
return e.buffer;
|
|
742
|
-
if (utils$1.isURLSearchParams(e))
|
|
743
|
-
return t.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
|
|
744
|
-
let l;
|
|
745
|
-
if (u) {
|
|
746
|
-
if (s.indexOf("application/x-www-form-urlencoded") > -1)
|
|
747
|
-
return toURLEncodedForm(e, this.formSerializer).toString();
|
|
748
|
-
if ((l = utils$1.isFileList(e)) || s.indexOf("multipart/form-data") > -1) {
|
|
749
|
-
const E = this.env && this.env.FormData;
|
|
750
|
-
return toFormData(
|
|
751
|
-
l ? { "files[]": e } : e,
|
|
752
|
-
E && new E(),
|
|
753
|
-
this.formSerializer
|
|
754
|
-
);
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
return u || i ? (t.setContentType("application/json", !1), stringifySafely(e)) : e;
|
|
758
|
-
}],
|
|
759
|
-
transformResponse: [function(e) {
|
|
760
|
-
const t = this.transitional || defaults.transitional, s = t && t.forcedJSONParsing, i = this.responseType === "json";
|
|
761
|
-
if (utils$1.isResponse(e) || utils$1.isReadableStream(e))
|
|
762
|
-
return e;
|
|
763
|
-
if (e && utils$1.isString(e) && (s && !this.responseType || i)) {
|
|
764
|
-
const c = !(t && t.silentJSONParsing) && i;
|
|
765
|
-
try {
|
|
766
|
-
return JSON.parse(e);
|
|
767
|
-
} catch (l) {
|
|
768
|
-
if (c)
|
|
769
|
-
throw l.name === "SyntaxError" ? AxiosError.from(l, AxiosError.ERR_BAD_RESPONSE, this, null, this.response) : l;
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
return e;
|
|
773
|
-
}],
|
|
774
|
-
/**
|
|
775
|
-
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
776
|
-
* timeout is not created.
|
|
777
|
-
*/
|
|
778
|
-
timeout: 0,
|
|
779
|
-
xsrfCookieName: "XSRF-TOKEN",
|
|
780
|
-
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
781
|
-
maxContentLength: -1,
|
|
782
|
-
maxBodyLength: -1,
|
|
783
|
-
env: {
|
|
784
|
-
FormData: platform.classes.FormData,
|
|
785
|
-
Blob: platform.classes.Blob
|
|
786
|
-
},
|
|
787
|
-
validateStatus: function(e) {
|
|
788
|
-
return e >= 200 && e < 300;
|
|
789
|
-
},
|
|
790
|
-
headers: {
|
|
791
|
-
common: {
|
|
792
|
-
Accept: "application/json, text/plain, */*",
|
|
793
|
-
"Content-Type": void 0
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
};
|
|
797
|
-
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (r) => {
|
|
798
|
-
defaults.headers[r] = {};
|
|
799
|
-
});
|
|
800
|
-
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
801
|
-
"age",
|
|
802
|
-
"authorization",
|
|
803
|
-
"content-length",
|
|
804
|
-
"content-type",
|
|
805
|
-
"etag",
|
|
806
|
-
"expires",
|
|
807
|
-
"from",
|
|
808
|
-
"host",
|
|
809
|
-
"if-modified-since",
|
|
810
|
-
"if-unmodified-since",
|
|
811
|
-
"last-modified",
|
|
812
|
-
"location",
|
|
813
|
-
"max-forwards",
|
|
814
|
-
"proxy-authorization",
|
|
815
|
-
"referer",
|
|
816
|
-
"retry-after",
|
|
817
|
-
"user-agent"
|
|
818
|
-
]), parseHeaders = (r) => {
|
|
819
|
-
const e = {};
|
|
820
|
-
let t, s, i;
|
|
821
|
-
return r && r.split(`
|
|
822
|
-
`).forEach(function(c) {
|
|
823
|
-
i = c.indexOf(":"), t = c.substring(0, i).trim().toLowerCase(), s = c.substring(i + 1).trim(), !(!t || e[t] && ignoreDuplicateOf[t]) && (t === "set-cookie" ? e[t] ? e[t].push(s) : e[t] = [s] : e[t] = e[t] ? e[t] + ", " + s : s);
|
|
824
|
-
}), e;
|
|
825
|
-
}, $internals = Symbol("internals");
|
|
826
|
-
function normalizeHeader(r) {
|
|
827
|
-
return r && String(r).trim().toLowerCase();
|
|
828
|
-
}
|
|
829
|
-
function normalizeValue(r) {
|
|
830
|
-
return r === !1 || r == null ? r : utils$1.isArray(r) ? r.map(normalizeValue) : String(r);
|
|
831
|
-
}
|
|
832
|
-
function parseTokens(r) {
|
|
833
|
-
const e = /* @__PURE__ */ Object.create(null), t = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
834
|
-
let s;
|
|
835
|
-
for (; s = t.exec(r); )
|
|
836
|
-
e[s[1]] = s[2];
|
|
837
|
-
return e;
|
|
838
|
-
}
|
|
839
|
-
const isValidHeaderName = (r) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());
|
|
840
|
-
function matchHeaderValue(r, e, t, s, i) {
|
|
841
|
-
if (utils$1.isFunction(s))
|
|
842
|
-
return s.call(this, e, t);
|
|
843
|
-
if (i && (e = t), !!utils$1.isString(e)) {
|
|
844
|
-
if (utils$1.isString(s))
|
|
845
|
-
return e.indexOf(s) !== -1;
|
|
846
|
-
if (utils$1.isRegExp(s))
|
|
847
|
-
return s.test(e);
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
function formatHeader(r) {
|
|
851
|
-
return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, t, s) => t.toUpperCase() + s);
|
|
852
|
-
}
|
|
853
|
-
function buildAccessors(r, e) {
|
|
854
|
-
const t = utils$1.toCamelCase(" " + e);
|
|
855
|
-
["get", "set", "has"].forEach((s) => {
|
|
856
|
-
Object.defineProperty(r, s + t, {
|
|
857
|
-
value: function(i, u, c) {
|
|
858
|
-
return this[s].call(this, e, i, u, c);
|
|
859
|
-
},
|
|
860
|
-
configurable: !0
|
|
861
|
-
});
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
class AxiosHeaders {
|
|
865
|
-
constructor(e) {
|
|
866
|
-
e && this.set(e);
|
|
867
|
-
}
|
|
868
|
-
set(e, t, s) {
|
|
869
|
-
const i = this;
|
|
870
|
-
function u(l, E, f) {
|
|
871
|
-
const h = normalizeHeader(E);
|
|
872
|
-
if (!h)
|
|
873
|
-
throw new Error("header name must be a non-empty string");
|
|
874
|
-
const g = utils$1.findKey(i, h);
|
|
875
|
-
(!g || i[g] === void 0 || f === !0 || f === void 0 && i[g] !== !1) && (i[g || E] = normalizeValue(l));
|
|
876
|
-
}
|
|
877
|
-
const c = (l, E) => utils$1.forEach(l, (f, h) => u(f, h, E));
|
|
878
|
-
if (utils$1.isPlainObject(e) || e instanceof this.constructor)
|
|
879
|
-
c(e, t);
|
|
880
|
-
else if (utils$1.isString(e) && (e = e.trim()) && !isValidHeaderName(e))
|
|
881
|
-
c(parseHeaders(e), t);
|
|
882
|
-
else if (utils$1.isHeaders(e))
|
|
883
|
-
for (const [l, E] of e.entries())
|
|
884
|
-
u(E, l, s);
|
|
885
|
-
else
|
|
886
|
-
e != null && u(t, e, s);
|
|
887
|
-
return this;
|
|
888
|
-
}
|
|
889
|
-
get(e, t) {
|
|
890
|
-
if (e = normalizeHeader(e), e) {
|
|
891
|
-
const s = utils$1.findKey(this, e);
|
|
892
|
-
if (s) {
|
|
893
|
-
const i = this[s];
|
|
894
|
-
if (!t)
|
|
895
|
-
return i;
|
|
896
|
-
if (t === !0)
|
|
897
|
-
return parseTokens(i);
|
|
898
|
-
if (utils$1.isFunction(t))
|
|
899
|
-
return t.call(this, i, s);
|
|
900
|
-
if (utils$1.isRegExp(t))
|
|
901
|
-
return t.exec(i);
|
|
902
|
-
throw new TypeError("parser must be boolean|regexp|function");
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
has(e, t) {
|
|
907
|
-
if (e = normalizeHeader(e), e) {
|
|
908
|
-
const s = utils$1.findKey(this, e);
|
|
909
|
-
return !!(s && this[s] !== void 0 && (!t || matchHeaderValue(this, this[s], s, t)));
|
|
910
|
-
}
|
|
911
|
-
return !1;
|
|
912
|
-
}
|
|
913
|
-
delete(e, t) {
|
|
914
|
-
const s = this;
|
|
915
|
-
let i = !1;
|
|
916
|
-
function u(c) {
|
|
917
|
-
if (c = normalizeHeader(c), c) {
|
|
918
|
-
const l = utils$1.findKey(s, c);
|
|
919
|
-
l && (!t || matchHeaderValue(s, s[l], l, t)) && (delete s[l], i = !0);
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
return utils$1.isArray(e) ? e.forEach(u) : u(e), i;
|
|
923
|
-
}
|
|
924
|
-
clear(e) {
|
|
925
|
-
const t = Object.keys(this);
|
|
926
|
-
let s = t.length, i = !1;
|
|
927
|
-
for (; s--; ) {
|
|
928
|
-
const u = t[s];
|
|
929
|
-
(!e || matchHeaderValue(this, this[u], u, e, !0)) && (delete this[u], i = !0);
|
|
930
|
-
}
|
|
931
|
-
return i;
|
|
932
|
-
}
|
|
933
|
-
normalize(e) {
|
|
934
|
-
const t = this, s = {};
|
|
935
|
-
return utils$1.forEach(this, (i, u) => {
|
|
936
|
-
const c = utils$1.findKey(s, u);
|
|
937
|
-
if (c) {
|
|
938
|
-
t[c] = normalizeValue(i), delete t[u];
|
|
939
|
-
return;
|
|
940
|
-
}
|
|
941
|
-
const l = e ? formatHeader(u) : String(u).trim();
|
|
942
|
-
l !== u && delete t[u], t[l] = normalizeValue(i), s[l] = !0;
|
|
943
|
-
}), this;
|
|
944
|
-
}
|
|
945
|
-
concat(...e) {
|
|
946
|
-
return this.constructor.concat(this, ...e);
|
|
947
|
-
}
|
|
948
|
-
toJSON(e) {
|
|
949
|
-
const t = /* @__PURE__ */ Object.create(null);
|
|
950
|
-
return utils$1.forEach(this, (s, i) => {
|
|
951
|
-
s != null && s !== !1 && (t[i] = e && utils$1.isArray(s) ? s.join(", ") : s);
|
|
952
|
-
}), t;
|
|
953
|
-
}
|
|
954
|
-
[Symbol.iterator]() {
|
|
955
|
-
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
956
|
-
}
|
|
957
|
-
toString() {
|
|
958
|
-
return Object.entries(this.toJSON()).map(([e, t]) => e + ": " + t).join(`
|
|
959
|
-
`);
|
|
960
|
-
}
|
|
961
|
-
get [Symbol.toStringTag]() {
|
|
962
|
-
return "AxiosHeaders";
|
|
963
|
-
}
|
|
964
|
-
static from(e) {
|
|
965
|
-
return e instanceof this ? e : new this(e);
|
|
966
|
-
}
|
|
967
|
-
static concat(e, ...t) {
|
|
968
|
-
const s = new this(e);
|
|
969
|
-
return t.forEach((i) => s.set(i)), s;
|
|
970
|
-
}
|
|
971
|
-
static accessor(e) {
|
|
972
|
-
const s = (this[$internals] = this[$internals] = {
|
|
973
|
-
accessors: {}
|
|
974
|
-
}).accessors, i = this.prototype;
|
|
975
|
-
function u(c) {
|
|
976
|
-
const l = normalizeHeader(c);
|
|
977
|
-
s[l] || (buildAccessors(i, c), s[l] = !0);
|
|
978
|
-
}
|
|
979
|
-
return utils$1.isArray(e) ? e.forEach(u) : u(e), this;
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
983
|
-
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value: r }, e) => {
|
|
984
|
-
let t = e[0].toUpperCase() + e.slice(1);
|
|
985
|
-
return {
|
|
986
|
-
get: () => r,
|
|
987
|
-
set(s) {
|
|
988
|
-
this[t] = s;
|
|
989
|
-
}
|
|
990
|
-
};
|
|
991
|
-
});
|
|
992
|
-
utils$1.freezeMethods(AxiosHeaders);
|
|
993
|
-
function transformData(r, e) {
|
|
994
|
-
const t = this || defaults, s = e || t, i = AxiosHeaders.from(s.headers);
|
|
995
|
-
let u = s.data;
|
|
996
|
-
return utils$1.forEach(r, function(l) {
|
|
997
|
-
u = l.call(t, u, i.normalize(), e ? e.status : void 0);
|
|
998
|
-
}), i.normalize(), u;
|
|
999
|
-
}
|
|
1000
|
-
function isCancel(r) {
|
|
1001
|
-
return !!(r && r.__CANCEL__);
|
|
1002
|
-
}
|
|
1003
|
-
function CanceledError(r, e, t) {
|
|
1004
|
-
AxiosError.call(this, r ?? "canceled", AxiosError.ERR_CANCELED, e, t), this.name = "CanceledError";
|
|
1005
|
-
}
|
|
1006
|
-
utils$1.inherits(CanceledError, AxiosError, {
|
|
1007
|
-
__CANCEL__: !0
|
|
1008
|
-
});
|
|
1009
|
-
function settle(r, e, t) {
|
|
1010
|
-
const s = t.config.validateStatus;
|
|
1011
|
-
!t.status || !s || s(t.status) ? r(t) : e(new AxiosError(
|
|
1012
|
-
"Request failed with status code " + t.status,
|
|
1013
|
-
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(t.status / 100) - 4],
|
|
1014
|
-
t.config,
|
|
1015
|
-
t.request,
|
|
1016
|
-
t
|
|
1017
|
-
));
|
|
1018
|
-
}
|
|
1019
|
-
function parseProtocol(r) {
|
|
1020
|
-
const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(r);
|
|
1021
|
-
return e && e[1] || "";
|
|
1022
|
-
}
|
|
1023
|
-
function speedometer(r, e) {
|
|
1024
|
-
r = r || 10;
|
|
1025
|
-
const t = new Array(r), s = new Array(r);
|
|
1026
|
-
let i = 0, u = 0, c;
|
|
1027
|
-
return e = e !== void 0 ? e : 1e3, function(E) {
|
|
1028
|
-
const f = Date.now(), h = s[u];
|
|
1029
|
-
c || (c = f), t[i] = E, s[i] = f;
|
|
1030
|
-
let g = u, b = 0;
|
|
1031
|
-
for (; g !== i; )
|
|
1032
|
-
b += t[g++], g = g % r;
|
|
1033
|
-
if (i = (i + 1) % r, i === u && (u = (u + 1) % r), f - c < e)
|
|
1034
|
-
return;
|
|
1035
|
-
const w = h && f - h;
|
|
1036
|
-
return w ? Math.round(b * 1e3 / w) : void 0;
|
|
1037
|
-
};
|
|
1038
|
-
}
|
|
1039
|
-
function throttle(r, e) {
|
|
1040
|
-
let t = 0, s = 1e3 / e, i, u;
|
|
1041
|
-
const c = (f, h = Date.now()) => {
|
|
1042
|
-
t = h, i = null, u && (clearTimeout(u), u = null), r.apply(null, f);
|
|
1043
|
-
};
|
|
1044
|
-
return [(...f) => {
|
|
1045
|
-
const h = Date.now(), g = h - t;
|
|
1046
|
-
g >= s ? c(f, h) : (i = f, u || (u = setTimeout(() => {
|
|
1047
|
-
u = null, c(i);
|
|
1048
|
-
}, s - g)));
|
|
1049
|
-
}, () => i && c(i)];
|
|
1050
|
-
}
|
|
1051
|
-
const progressEventReducer = (r, e, t = 3) => {
|
|
1052
|
-
let s = 0;
|
|
1053
|
-
const i = speedometer(50, 250);
|
|
1054
|
-
return throttle((u) => {
|
|
1055
|
-
const c = u.loaded, l = u.lengthComputable ? u.total : void 0, E = c - s, f = i(E), h = c <= l;
|
|
1056
|
-
s = c;
|
|
1057
|
-
const g = {
|
|
1058
|
-
loaded: c,
|
|
1059
|
-
total: l,
|
|
1060
|
-
progress: l ? c / l : void 0,
|
|
1061
|
-
bytes: E,
|
|
1062
|
-
rate: f || void 0,
|
|
1063
|
-
estimated: f && l && h ? (l - c) / f : void 0,
|
|
1064
|
-
event: u,
|
|
1065
|
-
lengthComputable: l != null,
|
|
1066
|
-
[e ? "download" : "upload"]: !0
|
|
1067
|
-
};
|
|
1068
|
-
r(g);
|
|
1069
|
-
}, t);
|
|
1070
|
-
}, progressEventDecorator = (r, e) => {
|
|
1071
|
-
const t = r != null;
|
|
1072
|
-
return [(s) => e[0]({
|
|
1073
|
-
lengthComputable: t,
|
|
1074
|
-
total: r,
|
|
1075
|
-
loaded: s
|
|
1076
|
-
}), e[1]];
|
|
1077
|
-
}, asyncDecorator = (r) => (...e) => utils$1.asap(() => r(...e)), isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((r, e) => (t) => (t = new URL(t, platform.origin), r.protocol === t.protocol && r.host === t.host && (e || r.port === t.port)))(
|
|
1078
|
-
new URL(platform.origin),
|
|
1079
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
1080
|
-
) : () => !0, cookies = platform.hasStandardBrowserEnv ? (
|
|
1081
|
-
// Standard browser envs support document.cookie
|
|
1082
|
-
{
|
|
1083
|
-
write(r, e, t, s, i, u) {
|
|
1084
|
-
const c = [r + "=" + encodeURIComponent(e)];
|
|
1085
|
-
utils$1.isNumber(t) && c.push("expires=" + new Date(t).toGMTString()), utils$1.isString(s) && c.push("path=" + s), utils$1.isString(i) && c.push("domain=" + i), u === !0 && c.push("secure"), document.cookie = c.join("; ");
|
|
1086
|
-
},
|
|
1087
|
-
read(r) {
|
|
1088
|
-
const e = document.cookie.match(new RegExp("(^|;\\s*)(" + r + ")=([^;]*)"));
|
|
1089
|
-
return e ? decodeURIComponent(e[3]) : null;
|
|
1090
|
-
},
|
|
1091
|
-
remove(r) {
|
|
1092
|
-
this.write(r, "", Date.now() - 864e5);
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
) : (
|
|
1096
|
-
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
1097
|
-
{
|
|
1098
|
-
write() {
|
|
1099
|
-
},
|
|
1100
|
-
read() {
|
|
1101
|
-
return null;
|
|
1102
|
-
},
|
|
1103
|
-
remove() {
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
);
|
|
1107
|
-
function isAbsoluteURL(r) {
|
|
1108
|
-
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(r);
|
|
1109
|
-
}
|
|
1110
|
-
function combineURLs(r, e) {
|
|
1111
|
-
return e ? r.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : r;
|
|
1112
|
-
}
|
|
1113
|
-
function buildFullPath(r, e) {
|
|
1114
|
-
return r && !isAbsoluteURL(e) ? combineURLs(r, e) : e;
|
|
1115
|
-
}
|
|
1116
|
-
const headersToObject = (r) => r instanceof AxiosHeaders ? { ...r } : r;
|
|
1117
|
-
function mergeConfig(r, e) {
|
|
1118
|
-
e = e || {};
|
|
1119
|
-
const t = {};
|
|
1120
|
-
function s(f, h, g, b) {
|
|
1121
|
-
return utils$1.isPlainObject(f) && utils$1.isPlainObject(h) ? utils$1.merge.call({ caseless: b }, f, h) : utils$1.isPlainObject(h) ? utils$1.merge({}, h) : utils$1.isArray(h) ? h.slice() : h;
|
|
1122
|
-
}
|
|
1123
|
-
function i(f, h, g, b) {
|
|
1124
|
-
if (utils$1.isUndefined(h)) {
|
|
1125
|
-
if (!utils$1.isUndefined(f))
|
|
1126
|
-
return s(void 0, f, g, b);
|
|
1127
|
-
} else return s(f, h, g, b);
|
|
1128
|
-
}
|
|
1129
|
-
function u(f, h) {
|
|
1130
|
-
if (!utils$1.isUndefined(h))
|
|
1131
|
-
return s(void 0, h);
|
|
1132
|
-
}
|
|
1133
|
-
function c(f, h) {
|
|
1134
|
-
if (utils$1.isUndefined(h)) {
|
|
1135
|
-
if (!utils$1.isUndefined(f))
|
|
1136
|
-
return s(void 0, f);
|
|
1137
|
-
} else return s(void 0, h);
|
|
1138
|
-
}
|
|
1139
|
-
function l(f, h, g) {
|
|
1140
|
-
if (g in e)
|
|
1141
|
-
return s(f, h);
|
|
1142
|
-
if (g in r)
|
|
1143
|
-
return s(void 0, f);
|
|
1144
|
-
}
|
|
1145
|
-
const E = {
|
|
1146
|
-
url: u,
|
|
1147
|
-
method: u,
|
|
1148
|
-
data: u,
|
|
1149
|
-
baseURL: c,
|
|
1150
|
-
transformRequest: c,
|
|
1151
|
-
transformResponse: c,
|
|
1152
|
-
paramsSerializer: c,
|
|
1153
|
-
timeout: c,
|
|
1154
|
-
timeoutMessage: c,
|
|
1155
|
-
withCredentials: c,
|
|
1156
|
-
withXSRFToken: c,
|
|
1157
|
-
adapter: c,
|
|
1158
|
-
responseType: c,
|
|
1159
|
-
xsrfCookieName: c,
|
|
1160
|
-
xsrfHeaderName: c,
|
|
1161
|
-
onUploadProgress: c,
|
|
1162
|
-
onDownloadProgress: c,
|
|
1163
|
-
decompress: c,
|
|
1164
|
-
maxContentLength: c,
|
|
1165
|
-
maxBodyLength: c,
|
|
1166
|
-
beforeRedirect: c,
|
|
1167
|
-
transport: c,
|
|
1168
|
-
httpAgent: c,
|
|
1169
|
-
httpsAgent: c,
|
|
1170
|
-
cancelToken: c,
|
|
1171
|
-
socketPath: c,
|
|
1172
|
-
responseEncoding: c,
|
|
1173
|
-
validateStatus: l,
|
|
1174
|
-
headers: (f, h, g) => i(headersToObject(f), headersToObject(h), g, !0)
|
|
1175
|
-
};
|
|
1176
|
-
return utils$1.forEach(Object.keys(Object.assign({}, r, e)), function(h) {
|
|
1177
|
-
const g = E[h] || i, b = g(r[h], e[h], h);
|
|
1178
|
-
utils$1.isUndefined(b) && g !== l || (t[h] = b);
|
|
1179
|
-
}), t;
|
|
1180
|
-
}
|
|
1181
|
-
const resolveConfig = (r) => {
|
|
1182
|
-
const e = mergeConfig({}, r);
|
|
1183
|
-
let { data: t, withXSRFToken: s, xsrfHeaderName: i, xsrfCookieName: u, headers: c, auth: l } = e;
|
|
1184
|
-
e.headers = c = AxiosHeaders.from(c), e.url = buildURL(buildFullPath(e.baseURL, e.url), r.params, r.paramsSerializer), l && c.set(
|
|
1185
|
-
"Authorization",
|
|
1186
|
-
"Basic " + btoa((l.username || "") + ":" + (l.password ? unescape(encodeURIComponent(l.password)) : ""))
|
|
1187
|
-
);
|
|
1188
|
-
let E;
|
|
1189
|
-
if (utils$1.isFormData(t)) {
|
|
1190
|
-
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv)
|
|
1191
|
-
c.setContentType(void 0);
|
|
1192
|
-
else if ((E = c.getContentType()) !== !1) {
|
|
1193
|
-
const [f, ...h] = E ? E.split(";").map((g) => g.trim()).filter(Boolean) : [];
|
|
1194
|
-
c.setContentType([f || "multipart/form-data", ...h].join("; "));
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
if (platform.hasStandardBrowserEnv && (s && utils$1.isFunction(s) && (s = s(e)), s || s !== !1 && isURLSameOrigin(e.url))) {
|
|
1198
|
-
const f = i && u && cookies.read(u);
|
|
1199
|
-
f && c.set(i, f);
|
|
1200
|
-
}
|
|
1201
|
-
return e;
|
|
1202
|
-
}, isXHRAdapterSupported = typeof XMLHttpRequest < "u", xhrAdapter = isXHRAdapterSupported && function(r) {
|
|
1203
|
-
return new Promise(function(t, s) {
|
|
1204
|
-
const i = resolveConfig(r);
|
|
1205
|
-
let u = i.data;
|
|
1206
|
-
const c = AxiosHeaders.from(i.headers).normalize();
|
|
1207
|
-
let { responseType: l, onUploadProgress: E, onDownloadProgress: f } = i, h, g, b, w, A;
|
|
1208
|
-
function R() {
|
|
1209
|
-
w && w(), A && A(), i.cancelToken && i.cancelToken.unsubscribe(h), i.signal && i.signal.removeEventListener("abort", h);
|
|
1210
|
-
}
|
|
1211
|
-
let y = new XMLHttpRequest();
|
|
1212
|
-
y.open(i.method.toUpperCase(), i.url, !0), y.timeout = i.timeout;
|
|
1213
|
-
function C() {
|
|
1214
|
-
if (!y)
|
|
1215
|
-
return;
|
|
1216
|
-
const F = AxiosHeaders.from(
|
|
1217
|
-
"getAllResponseHeaders" in y && y.getAllResponseHeaders()
|
|
1218
|
-
), _ = {
|
|
1219
|
-
data: !l || l === "text" || l === "json" ? y.responseText : y.response,
|
|
1220
|
-
status: y.status,
|
|
1221
|
-
statusText: y.statusText,
|
|
1222
|
-
headers: F,
|
|
1223
|
-
config: r,
|
|
1224
|
-
request: y
|
|
1225
|
-
};
|
|
1226
|
-
settle(function(O) {
|
|
1227
|
-
t(O), R();
|
|
1228
|
-
}, function(O) {
|
|
1229
|
-
s(O), R();
|
|
1230
|
-
}, _), y = null;
|
|
1231
|
-
}
|
|
1232
|
-
"onloadend" in y ? y.onloadend = C : y.onreadystatechange = function() {
|
|
1233
|
-
!y || y.readyState !== 4 || y.status === 0 && !(y.responseURL && y.responseURL.indexOf("file:") === 0) || setTimeout(C);
|
|
1234
|
-
}, y.onabort = function() {
|
|
1235
|
-
y && (s(new AxiosError("Request aborted", AxiosError.ECONNABORTED, r, y)), y = null);
|
|
1236
|
-
}, y.onerror = function() {
|
|
1237
|
-
s(new AxiosError("Network Error", AxiosError.ERR_NETWORK, r, y)), y = null;
|
|
1238
|
-
}, y.ontimeout = function() {
|
|
1239
|
-
let D = i.timeout ? "timeout of " + i.timeout + "ms exceeded" : "timeout exceeded";
|
|
1240
|
-
const _ = i.transitional || transitionalDefaults;
|
|
1241
|
-
i.timeoutErrorMessage && (D = i.timeoutErrorMessage), s(new AxiosError(
|
|
1242
|
-
D,
|
|
1243
|
-
_.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
1244
|
-
r,
|
|
1245
|
-
y
|
|
1246
|
-
)), y = null;
|
|
1247
|
-
}, u === void 0 && c.setContentType(null), "setRequestHeader" in y && utils$1.forEach(c.toJSON(), function(D, _) {
|
|
1248
|
-
y.setRequestHeader(_, D);
|
|
1249
|
-
}), utils$1.isUndefined(i.withCredentials) || (y.withCredentials = !!i.withCredentials), l && l !== "json" && (y.responseType = i.responseType), f && ([b, A] = progressEventReducer(f, !0), y.addEventListener("progress", b)), E && y.upload && ([g, w] = progressEventReducer(E), y.upload.addEventListener("progress", g), y.upload.addEventListener("loadend", w)), (i.cancelToken || i.signal) && (h = (F) => {
|
|
1250
|
-
y && (s(!F || F.type ? new CanceledError(null, r, y) : F), y.abort(), y = null);
|
|
1251
|
-
}, i.cancelToken && i.cancelToken.subscribe(h), i.signal && (i.signal.aborted ? h() : i.signal.addEventListener("abort", h)));
|
|
1252
|
-
const x = parseProtocol(i.url);
|
|
1253
|
-
if (x && platform.protocols.indexOf(x) === -1) {
|
|
1254
|
-
s(new AxiosError("Unsupported protocol " + x + ":", AxiosError.ERR_BAD_REQUEST, r));
|
|
1255
|
-
return;
|
|
1256
|
-
}
|
|
1257
|
-
y.send(u || null);
|
|
1258
|
-
});
|
|
1259
|
-
}, composeSignals = (r, e) => {
|
|
1260
|
-
const { length: t } = r = r ? r.filter(Boolean) : [];
|
|
1261
|
-
if (e || t) {
|
|
1262
|
-
let s = new AbortController(), i;
|
|
1263
|
-
const u = function(f) {
|
|
1264
|
-
if (!i) {
|
|
1265
|
-
i = !0, l();
|
|
1266
|
-
const h = f instanceof Error ? f : this.reason;
|
|
1267
|
-
s.abort(h instanceof AxiosError ? h : new CanceledError(h instanceof Error ? h.message : h));
|
|
1268
|
-
}
|
|
1269
|
-
};
|
|
1270
|
-
let c = e && setTimeout(() => {
|
|
1271
|
-
c = null, u(new AxiosError(`timeout ${e} of ms exceeded`, AxiosError.ETIMEDOUT));
|
|
1272
|
-
}, e);
|
|
1273
|
-
const l = () => {
|
|
1274
|
-
r && (c && clearTimeout(c), c = null, r.forEach((f) => {
|
|
1275
|
-
f.unsubscribe ? f.unsubscribe(u) : f.removeEventListener("abort", u);
|
|
1276
|
-
}), r = null);
|
|
1277
|
-
};
|
|
1278
|
-
r.forEach((f) => f.addEventListener("abort", u));
|
|
1279
|
-
const { signal: E } = s;
|
|
1280
|
-
return E.unsubscribe = () => utils$1.asap(l), E;
|
|
1281
|
-
}
|
|
1282
|
-
}, streamChunk = function* (r, e) {
|
|
1283
|
-
let t = r.byteLength;
|
|
1284
|
-
if (t < e) {
|
|
1285
|
-
yield r;
|
|
1286
|
-
return;
|
|
1287
|
-
}
|
|
1288
|
-
let s = 0, i;
|
|
1289
|
-
for (; s < t; )
|
|
1290
|
-
i = s + e, yield r.slice(s, i), s = i;
|
|
1291
|
-
}, readBytes = async function* (r, e) {
|
|
1292
|
-
for await (const t of readStream(r))
|
|
1293
|
-
yield* streamChunk(t, e);
|
|
1294
|
-
}, readStream = async function* (r) {
|
|
1295
|
-
if (r[Symbol.asyncIterator]) {
|
|
1296
|
-
yield* r;
|
|
1297
|
-
return;
|
|
1298
|
-
}
|
|
1299
|
-
const e = r.getReader();
|
|
1300
|
-
try {
|
|
1301
|
-
for (; ; ) {
|
|
1302
|
-
const { done: t, value: s } = await e.read();
|
|
1303
|
-
if (t)
|
|
1304
|
-
break;
|
|
1305
|
-
yield s;
|
|
1306
|
-
}
|
|
1307
|
-
} finally {
|
|
1308
|
-
await e.cancel();
|
|
1309
|
-
}
|
|
1310
|
-
}, trackStream = (r, e, t, s) => {
|
|
1311
|
-
const i = readBytes(r, e);
|
|
1312
|
-
let u = 0, c, l = (E) => {
|
|
1313
|
-
c || (c = !0, s && s(E));
|
|
1314
|
-
};
|
|
1315
|
-
return new ReadableStream({
|
|
1316
|
-
async pull(E) {
|
|
1317
|
-
try {
|
|
1318
|
-
const { done: f, value: h } = await i.next();
|
|
1319
|
-
if (f) {
|
|
1320
|
-
l(), E.close();
|
|
1321
|
-
return;
|
|
1322
|
-
}
|
|
1323
|
-
let g = h.byteLength;
|
|
1324
|
-
if (t) {
|
|
1325
|
-
let b = u += g;
|
|
1326
|
-
t(b);
|
|
1327
|
-
}
|
|
1328
|
-
E.enqueue(new Uint8Array(h));
|
|
1329
|
-
} catch (f) {
|
|
1330
|
-
throw l(f), f;
|
|
1331
|
-
}
|
|
1332
|
-
},
|
|
1333
|
-
cancel(E) {
|
|
1334
|
-
return l(E), i.return();
|
|
1335
|
-
}
|
|
1336
|
-
}, {
|
|
1337
|
-
highWaterMark: 2
|
|
1338
|
-
});
|
|
1339
|
-
}, isFetchSupported = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", isReadableStreamSupported = isFetchSupported && typeof ReadableStream == "function", encodeText = isFetchSupported && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((r) => (e) => r.encode(e))(new TextEncoder()) : async (r) => new Uint8Array(await new Response(r).arrayBuffer())), test = (r, ...e) => {
|
|
1340
|
-
try {
|
|
1341
|
-
return !!r(...e);
|
|
1342
|
-
} catch {
|
|
1343
|
-
return !1;
|
|
1344
|
-
}
|
|
1345
|
-
}, supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
1346
|
-
let r = !1;
|
|
1347
|
-
const e = new Request(platform.origin, {
|
|
1348
|
-
body: new ReadableStream(),
|
|
1349
|
-
method: "POST",
|
|
1350
|
-
get duplex() {
|
|
1351
|
-
return r = !0, "half";
|
|
1352
|
-
}
|
|
1353
|
-
}).headers.has("Content-Type");
|
|
1354
|
-
return r && !e;
|
|
1355
|
-
}), DEFAULT_CHUNK_SIZE = 64 * 1024, supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body)), resolvers = {
|
|
1356
|
-
stream: supportsResponseStream && ((r) => r.body)
|
|
1357
|
-
};
|
|
1358
|
-
isFetchSupported && ((r) => {
|
|
1359
|
-
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => {
|
|
1360
|
-
!resolvers[e] && (resolvers[e] = utils$1.isFunction(r[e]) ? (t) => t[e]() : (t, s) => {
|
|
1361
|
-
throw new AxiosError(`Response type '${e}' is not supported`, AxiosError.ERR_NOT_SUPPORT, s);
|
|
1362
|
-
});
|
|
1363
|
-
});
|
|
1364
|
-
})(new Response());
|
|
1365
|
-
const getBodyLength = async (r) => {
|
|
1366
|
-
if (r == null)
|
|
1367
|
-
return 0;
|
|
1368
|
-
if (utils$1.isBlob(r))
|
|
1369
|
-
return r.size;
|
|
1370
|
-
if (utils$1.isSpecCompliantForm(r))
|
|
1371
|
-
return (await new Request(platform.origin, {
|
|
1372
|
-
method: "POST",
|
|
1373
|
-
body: r
|
|
1374
|
-
}).arrayBuffer()).byteLength;
|
|
1375
|
-
if (utils$1.isArrayBufferView(r) || utils$1.isArrayBuffer(r))
|
|
1376
|
-
return r.byteLength;
|
|
1377
|
-
if (utils$1.isURLSearchParams(r) && (r = r + ""), utils$1.isString(r))
|
|
1378
|
-
return (await encodeText(r)).byteLength;
|
|
1379
|
-
}, resolveBodyLength = async (r, e) => {
|
|
1380
|
-
const t = utils$1.toFiniteNumber(r.getContentLength());
|
|
1381
|
-
return t ?? getBodyLength(e);
|
|
1382
|
-
}, fetchAdapter = isFetchSupported && (async (r) => {
|
|
1383
|
-
let {
|
|
1384
|
-
url: e,
|
|
1385
|
-
method: t,
|
|
1386
|
-
data: s,
|
|
1387
|
-
signal: i,
|
|
1388
|
-
cancelToken: u,
|
|
1389
|
-
timeout: c,
|
|
1390
|
-
onDownloadProgress: l,
|
|
1391
|
-
onUploadProgress: E,
|
|
1392
|
-
responseType: f,
|
|
1393
|
-
headers: h,
|
|
1394
|
-
withCredentials: g = "same-origin",
|
|
1395
|
-
fetchOptions: b
|
|
1396
|
-
} = resolveConfig(r);
|
|
1397
|
-
f = f ? (f + "").toLowerCase() : "text";
|
|
1398
|
-
let w = composeSignals([i, u && u.toAbortSignal()], c), A;
|
|
1399
|
-
const R = w && w.unsubscribe && (() => {
|
|
1400
|
-
w.unsubscribe();
|
|
1401
|
-
});
|
|
1402
|
-
let y;
|
|
1403
|
-
try {
|
|
1404
|
-
if (E && supportsRequestStream && t !== "get" && t !== "head" && (y = await resolveBodyLength(h, s)) !== 0) {
|
|
1405
|
-
let _ = new Request(e, {
|
|
1406
|
-
method: "POST",
|
|
1407
|
-
body: s,
|
|
1408
|
-
duplex: "half"
|
|
1409
|
-
}), S;
|
|
1410
|
-
if (utils$1.isFormData(s) && (S = _.headers.get("content-type")) && h.setContentType(S), _.body) {
|
|
1411
|
-
const [O, k] = progressEventDecorator(
|
|
1412
|
-
y,
|
|
1413
|
-
progressEventReducer(asyncDecorator(E))
|
|
1414
|
-
);
|
|
1415
|
-
s = trackStream(_.body, DEFAULT_CHUNK_SIZE, O, k);
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
utils$1.isString(g) || (g = g ? "include" : "omit");
|
|
1419
|
-
const C = "credentials" in Request.prototype;
|
|
1420
|
-
A = new Request(e, {
|
|
1421
|
-
...b,
|
|
1422
|
-
signal: w,
|
|
1423
|
-
method: t.toUpperCase(),
|
|
1424
|
-
headers: h.normalize().toJSON(),
|
|
1425
|
-
body: s,
|
|
1426
|
-
duplex: "half",
|
|
1427
|
-
credentials: C ? g : void 0
|
|
1428
|
-
});
|
|
1429
|
-
let x = await fetch(A);
|
|
1430
|
-
const F = supportsResponseStream && (f === "stream" || f === "response");
|
|
1431
|
-
if (supportsResponseStream && (l || F && R)) {
|
|
1432
|
-
const _ = {};
|
|
1433
|
-
["status", "statusText", "headers"].forEach((B) => {
|
|
1434
|
-
_[B] = x[B];
|
|
1435
|
-
});
|
|
1436
|
-
const S = utils$1.toFiniteNumber(x.headers.get("content-length")), [O, k] = l && progressEventDecorator(
|
|
1437
|
-
S,
|
|
1438
|
-
progressEventReducer(asyncDecorator(l), !0)
|
|
1439
|
-
) || [];
|
|
1440
|
-
x = new Response(
|
|
1441
|
-
trackStream(x.body, DEFAULT_CHUNK_SIZE, O, () => {
|
|
1442
|
-
k && k(), R && R();
|
|
1443
|
-
}),
|
|
1444
|
-
_
|
|
1445
|
-
);
|
|
1446
|
-
}
|
|
1447
|
-
f = f || "text";
|
|
1448
|
-
let D = await resolvers[utils$1.findKey(resolvers, f) || "text"](x, r);
|
|
1449
|
-
return !F && R && R(), await new Promise((_, S) => {
|
|
1450
|
-
settle(_, S, {
|
|
1451
|
-
data: D,
|
|
1452
|
-
headers: AxiosHeaders.from(x.headers),
|
|
1453
|
-
status: x.status,
|
|
1454
|
-
statusText: x.statusText,
|
|
1455
|
-
config: r,
|
|
1456
|
-
request: A
|
|
1457
|
-
});
|
|
1458
|
-
});
|
|
1459
|
-
} catch (C) {
|
|
1460
|
-
throw R && R(), C && C.name === "TypeError" && /fetch/i.test(C.message) ? Object.assign(
|
|
1461
|
-
new AxiosError("Network Error", AxiosError.ERR_NETWORK, r, A),
|
|
1462
|
-
{
|
|
1463
|
-
cause: C.cause || C
|
|
1464
|
-
}
|
|
1465
|
-
) : AxiosError.from(C, C && C.code, r, A);
|
|
1466
|
-
}
|
|
1467
|
-
}), knownAdapters = {
|
|
1468
|
-
http: httpAdapter,
|
|
1469
|
-
xhr: xhrAdapter,
|
|
1470
|
-
fetch: fetchAdapter
|
|
1471
|
-
};
|
|
1472
|
-
utils$1.forEach(knownAdapters, (r, e) => {
|
|
1473
|
-
if (r) {
|
|
1474
|
-
try {
|
|
1475
|
-
Object.defineProperty(r, "name", { value: e });
|
|
1476
|
-
} catch {
|
|
1477
|
-
}
|
|
1478
|
-
Object.defineProperty(r, "adapterName", { value: e });
|
|
1479
|
-
}
|
|
1480
|
-
});
|
|
1481
|
-
const renderReason = (r) => `- ${r}`, isResolvedHandle = (r) => utils$1.isFunction(r) || r === null || r === !1, adapters = {
|
|
1482
|
-
getAdapter: (r) => {
|
|
1483
|
-
r = utils$1.isArray(r) ? r : [r];
|
|
1484
|
-
const { length: e } = r;
|
|
1485
|
-
let t, s;
|
|
1486
|
-
const i = {};
|
|
1487
|
-
for (let u = 0; u < e; u++) {
|
|
1488
|
-
t = r[u];
|
|
1489
|
-
let c;
|
|
1490
|
-
if (s = t, !isResolvedHandle(t) && (s = knownAdapters[(c = String(t)).toLowerCase()], s === void 0))
|
|
1491
|
-
throw new AxiosError(`Unknown adapter '${c}'`);
|
|
1492
|
-
if (s)
|
|
1493
|
-
break;
|
|
1494
|
-
i[c || "#" + u] = s;
|
|
1495
|
-
}
|
|
1496
|
-
if (!s) {
|
|
1497
|
-
const u = Object.entries(i).map(
|
|
1498
|
-
([l, E]) => `adapter ${l} ` + (E === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
1499
|
-
);
|
|
1500
|
-
let c = e ? u.length > 1 ? `since :
|
|
1501
|
-
` + u.map(renderReason).join(`
|
|
1502
|
-
`) : " " + renderReason(u[0]) : "as no adapter specified";
|
|
1503
|
-
throw new AxiosError(
|
|
1504
|
-
"There is no suitable adapter to dispatch the request " + c,
|
|
1505
|
-
"ERR_NOT_SUPPORT"
|
|
1506
|
-
);
|
|
1507
|
-
}
|
|
1508
|
-
return s;
|
|
1509
|
-
},
|
|
1510
|
-
adapters: knownAdapters
|
|
1511
|
-
};
|
|
1512
|
-
function throwIfCancellationRequested(r) {
|
|
1513
|
-
if (r.cancelToken && r.cancelToken.throwIfRequested(), r.signal && r.signal.aborted)
|
|
1514
|
-
throw new CanceledError(null, r);
|
|
1515
|
-
}
|
|
1516
|
-
function dispatchRequest(r) {
|
|
1517
|
-
return throwIfCancellationRequested(r), r.headers = AxiosHeaders.from(r.headers), r.data = transformData.call(
|
|
1518
|
-
r,
|
|
1519
|
-
r.transformRequest
|
|
1520
|
-
), ["post", "put", "patch"].indexOf(r.method) !== -1 && r.headers.setContentType("application/x-www-form-urlencoded", !1), adapters.getAdapter(r.adapter || defaults.adapter)(r).then(function(s) {
|
|
1521
|
-
return throwIfCancellationRequested(r), s.data = transformData.call(
|
|
1522
|
-
r,
|
|
1523
|
-
r.transformResponse,
|
|
1524
|
-
s
|
|
1525
|
-
), s.headers = AxiosHeaders.from(s.headers), s;
|
|
1526
|
-
}, function(s) {
|
|
1527
|
-
return isCancel(s) || (throwIfCancellationRequested(r), s && s.response && (s.response.data = transformData.call(
|
|
1528
|
-
r,
|
|
1529
|
-
r.transformResponse,
|
|
1530
|
-
s.response
|
|
1531
|
-
), s.response.headers = AxiosHeaders.from(s.response.headers))), Promise.reject(s);
|
|
1532
|
-
});
|
|
1533
|
-
}
|
|
1534
|
-
const VERSION = "1.7.9", validators$1 = {};
|
|
1535
|
-
["object", "boolean", "number", "function", "string", "symbol"].forEach((r, e) => {
|
|
1536
|
-
validators$1[r] = function(s) {
|
|
1537
|
-
return typeof s === r || "a" + (e < 1 ? "n " : " ") + r;
|
|
1538
|
-
};
|
|
1539
|
-
});
|
|
1540
|
-
const deprecatedWarnings = {};
|
|
1541
|
-
validators$1.transitional = function(e, t, s) {
|
|
1542
|
-
function i(u, c) {
|
|
1543
|
-
return "[Axios v" + VERSION + "] Transitional option '" + u + "'" + c + (s ? ". " + s : "");
|
|
1544
|
-
}
|
|
1545
|
-
return (u, c, l) => {
|
|
1546
|
-
if (e === !1)
|
|
1547
|
-
throw new AxiosError(
|
|
1548
|
-
i(c, " has been removed" + (t ? " in " + t : "")),
|
|
1549
|
-
AxiosError.ERR_DEPRECATED
|
|
1550
|
-
);
|
|
1551
|
-
return t && !deprecatedWarnings[c] && (deprecatedWarnings[c] = !0, console.warn(
|
|
1552
|
-
i(
|
|
1553
|
-
c,
|
|
1554
|
-
" has been deprecated since v" + t + " and will be removed in the near future"
|
|
1555
|
-
)
|
|
1556
|
-
)), e ? e(u, c, l) : !0;
|
|
1557
|
-
};
|
|
1558
|
-
};
|
|
1559
|
-
validators$1.spelling = function(e) {
|
|
1560
|
-
return (t, s) => (console.warn(`${s} is likely a misspelling of ${e}`), !0);
|
|
1561
|
-
};
|
|
1562
|
-
function assertOptions(r, e, t) {
|
|
1563
|
-
if (typeof r != "object")
|
|
1564
|
-
throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
|
|
1565
|
-
const s = Object.keys(r);
|
|
1566
|
-
let i = s.length;
|
|
1567
|
-
for (; i-- > 0; ) {
|
|
1568
|
-
const u = s[i], c = e[u];
|
|
1569
|
-
if (c) {
|
|
1570
|
-
const l = r[u], E = l === void 0 || c(l, u, r);
|
|
1571
|
-
if (E !== !0)
|
|
1572
|
-
throw new AxiosError("option " + u + " must be " + E, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
1573
|
-
continue;
|
|
1574
|
-
}
|
|
1575
|
-
if (t !== !0)
|
|
1576
|
-
throw new AxiosError("Unknown option " + u, AxiosError.ERR_BAD_OPTION);
|
|
1577
|
-
}
|
|
1578
|
-
}
|
|
1579
|
-
const validator = {
|
|
1580
|
-
assertOptions,
|
|
1581
|
-
validators: validators$1
|
|
1582
|
-
}, validators = validator.validators;
|
|
1583
|
-
class Axios {
|
|
1584
|
-
constructor(e) {
|
|
1585
|
-
this.defaults = e, this.interceptors = {
|
|
1586
|
-
request: new InterceptorManager(),
|
|
1587
|
-
response: new InterceptorManager()
|
|
1588
|
-
};
|
|
1589
|
-
}
|
|
1590
|
-
/**
|
|
1591
|
-
* Dispatch a request
|
|
1592
|
-
*
|
|
1593
|
-
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
1594
|
-
* @param {?Object} config
|
|
1595
|
-
*
|
|
1596
|
-
* @returns {Promise} The Promise to be fulfilled
|
|
1597
|
-
*/
|
|
1598
|
-
async request(e, t) {
|
|
1599
|
-
try {
|
|
1600
|
-
return await this._request(e, t);
|
|
1601
|
-
} catch (s) {
|
|
1602
|
-
if (s instanceof Error) {
|
|
1603
|
-
let i = {};
|
|
1604
|
-
Error.captureStackTrace ? Error.captureStackTrace(i) : i = new Error();
|
|
1605
|
-
const u = i.stack ? i.stack.replace(/^.+\n/, "") : "";
|
|
1606
|
-
try {
|
|
1607
|
-
s.stack ? u && !String(s.stack).endsWith(u.replace(/^.+\n.+\n/, "")) && (s.stack += `
|
|
1608
|
-
` + u) : s.stack = u;
|
|
1609
|
-
} catch {
|
|
1610
|
-
}
|
|
1611
|
-
}
|
|
1612
|
-
throw s;
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
|
-
_request(e, t) {
|
|
1616
|
-
typeof e == "string" ? (t = t || {}, t.url = e) : t = e || {}, t = mergeConfig(this.defaults, t);
|
|
1617
|
-
const { transitional: s, paramsSerializer: i, headers: u } = t;
|
|
1618
|
-
s !== void 0 && validator.assertOptions(s, {
|
|
1619
|
-
silentJSONParsing: validators.transitional(validators.boolean),
|
|
1620
|
-
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
1621
|
-
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
1622
|
-
}, !1), i != null && (utils$1.isFunction(i) ? t.paramsSerializer = {
|
|
1623
|
-
serialize: i
|
|
1624
|
-
} : validator.assertOptions(i, {
|
|
1625
|
-
encode: validators.function,
|
|
1626
|
-
serialize: validators.function
|
|
1627
|
-
}, !0)), validator.assertOptions(t, {
|
|
1628
|
-
baseUrl: validators.spelling("baseURL"),
|
|
1629
|
-
withXsrfToken: validators.spelling("withXSRFToken")
|
|
1630
|
-
}, !0), t.method = (t.method || this.defaults.method || "get").toLowerCase();
|
|
1631
|
-
let c = u && utils$1.merge(
|
|
1632
|
-
u.common,
|
|
1633
|
-
u[t.method]
|
|
1634
|
-
);
|
|
1635
|
-
u && utils$1.forEach(
|
|
1636
|
-
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
1637
|
-
(A) => {
|
|
1638
|
-
delete u[A];
|
|
1639
|
-
}
|
|
1640
|
-
), t.headers = AxiosHeaders.concat(c, u);
|
|
1641
|
-
const l = [];
|
|
1642
|
-
let E = !0;
|
|
1643
|
-
this.interceptors.request.forEach(function(R) {
|
|
1644
|
-
typeof R.runWhen == "function" && R.runWhen(t) === !1 || (E = E && R.synchronous, l.unshift(R.fulfilled, R.rejected));
|
|
1645
|
-
});
|
|
1646
|
-
const f = [];
|
|
1647
|
-
this.interceptors.response.forEach(function(R) {
|
|
1648
|
-
f.push(R.fulfilled, R.rejected);
|
|
1649
|
-
});
|
|
1650
|
-
let h, g = 0, b;
|
|
1651
|
-
if (!E) {
|
|
1652
|
-
const A = [dispatchRequest.bind(this), void 0];
|
|
1653
|
-
for (A.unshift.apply(A, l), A.push.apply(A, f), b = A.length, h = Promise.resolve(t); g < b; )
|
|
1654
|
-
h = h.then(A[g++], A[g++]);
|
|
1655
|
-
return h;
|
|
1656
|
-
}
|
|
1657
|
-
b = l.length;
|
|
1658
|
-
let w = t;
|
|
1659
|
-
for (g = 0; g < b; ) {
|
|
1660
|
-
const A = l[g++], R = l[g++];
|
|
1661
|
-
try {
|
|
1662
|
-
w = A(w);
|
|
1663
|
-
} catch (y) {
|
|
1664
|
-
R.call(this, y);
|
|
1665
|
-
break;
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
try {
|
|
1669
|
-
h = dispatchRequest.call(this, w);
|
|
1670
|
-
} catch (A) {
|
|
1671
|
-
return Promise.reject(A);
|
|
1672
|
-
}
|
|
1673
|
-
for (g = 0, b = f.length; g < b; )
|
|
1674
|
-
h = h.then(f[g++], f[g++]);
|
|
1675
|
-
return h;
|
|
1676
|
-
}
|
|
1677
|
-
getUri(e) {
|
|
1678
|
-
e = mergeConfig(this.defaults, e);
|
|
1679
|
-
const t = buildFullPath(e.baseURL, e.url);
|
|
1680
|
-
return buildURL(t, e.params, e.paramsSerializer);
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
utils$1.forEach(["delete", "get", "head", "options"], function(e) {
|
|
1684
|
-
Axios.prototype[e] = function(t, s) {
|
|
1685
|
-
return this.request(mergeConfig(s || {}, {
|
|
1686
|
-
method: e,
|
|
1687
|
-
url: t,
|
|
1688
|
-
data: (s || {}).data
|
|
1689
|
-
}));
|
|
1690
|
-
};
|
|
1691
|
-
});
|
|
1692
|
-
utils$1.forEach(["post", "put", "patch"], function(e) {
|
|
1693
|
-
function t(s) {
|
|
1694
|
-
return function(u, c, l) {
|
|
1695
|
-
return this.request(mergeConfig(l || {}, {
|
|
1696
|
-
method: e,
|
|
1697
|
-
headers: s ? {
|
|
1698
|
-
"Content-Type": "multipart/form-data"
|
|
1699
|
-
} : {},
|
|
1700
|
-
url: u,
|
|
1701
|
-
data: c
|
|
1702
|
-
}));
|
|
1703
|
-
};
|
|
1704
|
-
}
|
|
1705
|
-
Axios.prototype[e] = t(), Axios.prototype[e + "Form"] = t(!0);
|
|
1706
|
-
});
|
|
1707
|
-
class CancelToken {
|
|
1708
|
-
constructor(e) {
|
|
1709
|
-
if (typeof e != "function")
|
|
1710
|
-
throw new TypeError("executor must be a function.");
|
|
1711
|
-
let t;
|
|
1712
|
-
this.promise = new Promise(function(u) {
|
|
1713
|
-
t = u;
|
|
1714
|
-
});
|
|
1715
|
-
const s = this;
|
|
1716
|
-
this.promise.then((i) => {
|
|
1717
|
-
if (!s._listeners) return;
|
|
1718
|
-
let u = s._listeners.length;
|
|
1719
|
-
for (; u-- > 0; )
|
|
1720
|
-
s._listeners[u](i);
|
|
1721
|
-
s._listeners = null;
|
|
1722
|
-
}), this.promise.then = (i) => {
|
|
1723
|
-
let u;
|
|
1724
|
-
const c = new Promise((l) => {
|
|
1725
|
-
s.subscribe(l), u = l;
|
|
1726
|
-
}).then(i);
|
|
1727
|
-
return c.cancel = function() {
|
|
1728
|
-
s.unsubscribe(u);
|
|
1729
|
-
}, c;
|
|
1730
|
-
}, e(function(u, c, l) {
|
|
1731
|
-
s.reason || (s.reason = new CanceledError(u, c, l), t(s.reason));
|
|
1732
|
-
});
|
|
1733
|
-
}
|
|
1734
|
-
/**
|
|
1735
|
-
* Throws a `CanceledError` if cancellation has been requested.
|
|
1736
|
-
*/
|
|
1737
|
-
throwIfRequested() {
|
|
1738
|
-
if (this.reason)
|
|
1739
|
-
throw this.reason;
|
|
1740
|
-
}
|
|
1741
|
-
/**
|
|
1742
|
-
* Subscribe to the cancel signal
|
|
1743
|
-
*/
|
|
1744
|
-
subscribe(e) {
|
|
1745
|
-
if (this.reason) {
|
|
1746
|
-
e(this.reason);
|
|
1747
|
-
return;
|
|
1748
|
-
}
|
|
1749
|
-
this._listeners ? this._listeners.push(e) : this._listeners = [e];
|
|
1750
|
-
}
|
|
1751
|
-
/**
|
|
1752
|
-
* Unsubscribe from the cancel signal
|
|
1753
|
-
*/
|
|
1754
|
-
unsubscribe(e) {
|
|
1755
|
-
if (!this._listeners)
|
|
1756
|
-
return;
|
|
1757
|
-
const t = this._listeners.indexOf(e);
|
|
1758
|
-
t !== -1 && this._listeners.splice(t, 1);
|
|
1759
|
-
}
|
|
1760
|
-
toAbortSignal() {
|
|
1761
|
-
const e = new AbortController(), t = (s) => {
|
|
1762
|
-
e.abort(s);
|
|
1763
|
-
};
|
|
1764
|
-
return this.subscribe(t), e.signal.unsubscribe = () => this.unsubscribe(t), e.signal;
|
|
1765
|
-
}
|
|
1766
|
-
/**
|
|
1767
|
-
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
1768
|
-
* cancels the `CancelToken`.
|
|
1769
|
-
*/
|
|
1770
|
-
static source() {
|
|
1771
|
-
let e;
|
|
1772
|
-
return {
|
|
1773
|
-
token: new CancelToken(function(i) {
|
|
1774
|
-
e = i;
|
|
1775
|
-
}),
|
|
1776
|
-
cancel: e
|
|
1777
|
-
};
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
function spread(r) {
|
|
1781
|
-
return function(t) {
|
|
1782
|
-
return r.apply(null, t);
|
|
1783
|
-
};
|
|
1784
|
-
}
|
|
1785
|
-
function isAxiosError(r) {
|
|
1786
|
-
return utils$1.isObject(r) && r.isAxiosError === !0;
|
|
1787
|
-
}
|
|
1788
|
-
const HttpStatusCode = {
|
|
1789
|
-
Continue: 100,
|
|
1790
|
-
SwitchingProtocols: 101,
|
|
1791
|
-
Processing: 102,
|
|
1792
|
-
EarlyHints: 103,
|
|
1793
|
-
Ok: 200,
|
|
1794
|
-
Created: 201,
|
|
1795
|
-
Accepted: 202,
|
|
1796
|
-
NonAuthoritativeInformation: 203,
|
|
1797
|
-
NoContent: 204,
|
|
1798
|
-
ResetContent: 205,
|
|
1799
|
-
PartialContent: 206,
|
|
1800
|
-
MultiStatus: 207,
|
|
1801
|
-
AlreadyReported: 208,
|
|
1802
|
-
ImUsed: 226,
|
|
1803
|
-
MultipleChoices: 300,
|
|
1804
|
-
MovedPermanently: 301,
|
|
1805
|
-
Found: 302,
|
|
1806
|
-
SeeOther: 303,
|
|
1807
|
-
NotModified: 304,
|
|
1808
|
-
UseProxy: 305,
|
|
1809
|
-
Unused: 306,
|
|
1810
|
-
TemporaryRedirect: 307,
|
|
1811
|
-
PermanentRedirect: 308,
|
|
1812
|
-
BadRequest: 400,
|
|
1813
|
-
Unauthorized: 401,
|
|
1814
|
-
PaymentRequired: 402,
|
|
1815
|
-
Forbidden: 403,
|
|
1816
|
-
NotFound: 404,
|
|
1817
|
-
MethodNotAllowed: 405,
|
|
1818
|
-
NotAcceptable: 406,
|
|
1819
|
-
ProxyAuthenticationRequired: 407,
|
|
1820
|
-
RequestTimeout: 408,
|
|
1821
|
-
Conflict: 409,
|
|
1822
|
-
Gone: 410,
|
|
1823
|
-
LengthRequired: 411,
|
|
1824
|
-
PreconditionFailed: 412,
|
|
1825
|
-
PayloadTooLarge: 413,
|
|
1826
|
-
UriTooLong: 414,
|
|
1827
|
-
UnsupportedMediaType: 415,
|
|
1828
|
-
RangeNotSatisfiable: 416,
|
|
1829
|
-
ExpectationFailed: 417,
|
|
1830
|
-
ImATeapot: 418,
|
|
1831
|
-
MisdirectedRequest: 421,
|
|
1832
|
-
UnprocessableEntity: 422,
|
|
1833
|
-
Locked: 423,
|
|
1834
|
-
FailedDependency: 424,
|
|
1835
|
-
TooEarly: 425,
|
|
1836
|
-
UpgradeRequired: 426,
|
|
1837
|
-
PreconditionRequired: 428,
|
|
1838
|
-
TooManyRequests: 429,
|
|
1839
|
-
RequestHeaderFieldsTooLarge: 431,
|
|
1840
|
-
UnavailableForLegalReasons: 451,
|
|
1841
|
-
InternalServerError: 500,
|
|
1842
|
-
NotImplemented: 501,
|
|
1843
|
-
BadGateway: 502,
|
|
1844
|
-
ServiceUnavailable: 503,
|
|
1845
|
-
GatewayTimeout: 504,
|
|
1846
|
-
HttpVersionNotSupported: 505,
|
|
1847
|
-
VariantAlsoNegotiates: 506,
|
|
1848
|
-
InsufficientStorage: 507,
|
|
1849
|
-
LoopDetected: 508,
|
|
1850
|
-
NotExtended: 510,
|
|
1851
|
-
NetworkAuthenticationRequired: 511
|
|
1852
|
-
};
|
|
1853
|
-
Object.entries(HttpStatusCode).forEach(([r, e]) => {
|
|
1854
|
-
HttpStatusCode[e] = r;
|
|
1855
|
-
});
|
|
1856
|
-
function createInstance(r) {
|
|
1857
|
-
const e = new Axios(r), t = bind(Axios.prototype.request, e);
|
|
1858
|
-
return utils$1.extend(t, Axios.prototype, e, { allOwnKeys: !0 }), utils$1.extend(t, e, null, { allOwnKeys: !0 }), t.create = function(i) {
|
|
1859
|
-
return createInstance(mergeConfig(r, i));
|
|
1860
|
-
}, t;
|
|
1861
|
-
}
|
|
1862
|
-
const axios = createInstance(defaults);
|
|
1863
|
-
axios.Axios = Axios;
|
|
1864
|
-
axios.CanceledError = CanceledError;
|
|
1865
|
-
axios.CancelToken = CancelToken;
|
|
1866
|
-
axios.isCancel = isCancel;
|
|
1867
|
-
axios.VERSION = VERSION;
|
|
1868
|
-
axios.toFormData = toFormData;
|
|
1869
|
-
axios.AxiosError = AxiosError;
|
|
1870
|
-
axios.Cancel = axios.CanceledError;
|
|
1871
|
-
axios.all = function(e) {
|
|
1872
|
-
return Promise.all(e);
|
|
1873
|
-
};
|
|
1874
|
-
axios.spread = spread;
|
|
1875
|
-
axios.isAxiosError = isAxiosError;
|
|
1876
|
-
axios.mergeConfig = mergeConfig;
|
|
1877
|
-
axios.AxiosHeaders = AxiosHeaders;
|
|
1878
|
-
axios.formToJSON = (r) => formDataToJSON(utils$1.isHTMLForm(r) ? new FormData(r) : r);
|
|
1879
|
-
axios.getAdapter = adapters.getAdapter;
|
|
1880
|
-
axios.HttpStatusCode = HttpStatusCode;
|
|
1881
|
-
axios.default = axios;
|
|
1882
|
-
const loadedScripts$1 = {};
|
|
200
|
+
const notify = new NotifyFramework(), loadedScripts$1 = {};
|
|
1883
201
|
class Http {
|
|
1884
202
|
constructor(e) {
|
|
1885
203
|
// Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
|
|
1886
|
-
|
|
1887
|
-
|
|
204
|
+
n(this, "axios");
|
|
205
|
+
n(this, "_latestResponse");
|
|
1888
206
|
this.axios = axios.create(e);
|
|
1889
207
|
}
|
|
1890
208
|
setCdn(e) {
|
|
@@ -1931,18 +249,18 @@ class Http {
|
|
|
1931
249
|
return this.axios.get(this.toCdnUrl(e), this.toAxiosConfig(t)).then((s) => this.mapAxiosResponse(s, t)).catch((s) => this.mapAxiosError(s, t));
|
|
1932
250
|
}
|
|
1933
251
|
post(e, t, s) {
|
|
1934
|
-
return this.axios.post(e, t, this.toAxiosConfig(s)).then((
|
|
252
|
+
return this.axios.post(e, t, this.toAxiosConfig(s)).then((r) => this.mapAxiosResponse(r, s)).catch((r) => this.mapAxiosError(r, s));
|
|
1935
253
|
}
|
|
1936
254
|
postFile(e, t, s) {
|
|
1937
|
-
const
|
|
1938
|
-
return
|
|
255
|
+
const r = this.toAxiosConfig(s);
|
|
256
|
+
return r.headers && r.headers["Content-Type"] && delete r.headers["Content-Type"], this.axios.post(e, t, r).then((i) => this.mapAxiosResponse(i, s)).catch((i) => this.mapAxiosError(i, s));
|
|
1939
257
|
}
|
|
1940
258
|
postJson(e, t, s) {
|
|
1941
|
-
const
|
|
1942
|
-
return
|
|
259
|
+
const r = this.toAxiosConfig();
|
|
260
|
+
return r.headers && (r.headers["Content-Type"] = "application/json"), this.axios.post(e, t, this.toAxiosConfig(s)).then((i) => this.mapAxiosResponse(i, s)).catch((i) => this.mapAxiosError(i, s));
|
|
1943
261
|
}
|
|
1944
262
|
put(e, t, s) {
|
|
1945
|
-
return this.axios.put(e, t, this.toAxiosConfig(s)).then((
|
|
263
|
+
return this.axios.put(e, t, this.toAxiosConfig(s)).then((r) => this.mapAxiosResponse(r, s)).catch((r) => this.mapAxiosError(r, s));
|
|
1946
264
|
}
|
|
1947
265
|
/*
|
|
1948
266
|
putFile(url: string, data:FormData, opt?:any) {
|
|
@@ -1951,8 +269,8 @@ class Http {
|
|
|
1951
269
|
}
|
|
1952
270
|
*/
|
|
1953
271
|
putJson(e, t, s) {
|
|
1954
|
-
const
|
|
1955
|
-
return
|
|
272
|
+
const r = this.toAxiosConfig(s);
|
|
273
|
+
return r.headers && (r.headers["Content-Type"] = "application/json"), this.axios.put(e, t, r).then((i) => this.mapAxiosResponse(i, s)).catch((i) => this.mapAxiosError(i, s));
|
|
1956
274
|
}
|
|
1957
275
|
delete(e, t) {
|
|
1958
276
|
return this.axios.delete(e, this.toAxiosConfig(t)).then((s) => this.mapAxiosResponse(s, t)).catch((s) => this.mapAxiosError(s, t));
|
|
@@ -1961,16 +279,16 @@ class Http {
|
|
|
1961
279
|
return this.axios.delete(e, { data: t }).then((s) => this.mapAxiosResponse(s)).catch((s) => this.mapAxiosError(s));
|
|
1962
280
|
}
|
|
1963
281
|
getScript(e, t, s) {
|
|
1964
|
-
const
|
|
1965
|
-
return
|
|
282
|
+
const r = s ?? "exports", i = this.toAxiosConfig(t);
|
|
283
|
+
return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((u) => this.mapAxiosResponse(u, t)).then((u) => {
|
|
1966
284
|
try {
|
|
1967
|
-
const
|
|
1968
|
-
return Function(
|
|
285
|
+
const a = `"use strict";var ${r.split(".")[0]}={};${u};return ${r};`;
|
|
286
|
+
return Function(a)();
|
|
1969
287
|
} catch {
|
|
1970
|
-
return
|
|
288
|
+
return u;
|
|
1971
289
|
}
|
|
1972
|
-
}).catch((
|
|
1973
|
-
throw this.mapAxiosError(
|
|
290
|
+
}).catch((u) => {
|
|
291
|
+
throw this.mapAxiosError(u, t), u;
|
|
1974
292
|
});
|
|
1975
293
|
}
|
|
1976
294
|
loadScript(e, t) {
|
|
@@ -1981,7 +299,7 @@ class Http {
|
|
|
1981
299
|
}
|
|
1982
300
|
class TransportFramework {
|
|
1983
301
|
constructor() {
|
|
1984
|
-
|
|
302
|
+
n(this, "_http", new Http());
|
|
1985
303
|
}
|
|
1986
304
|
get http() {
|
|
1987
305
|
return this._http;
|
|
@@ -2000,11 +318,11 @@ class ConfigurationFrameworkFactory {
|
|
|
2000
318
|
const http$2 = transport.http;
|
|
2001
319
|
class Session {
|
|
2002
320
|
constructor() {
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
321
|
+
n(this, "_me", null);
|
|
322
|
+
n(this, "_currentLanguage", "");
|
|
323
|
+
n(this, "_notLoggedIn", !0);
|
|
324
|
+
n(this, "_description");
|
|
325
|
+
n(this, "_profile");
|
|
2008
326
|
}
|
|
2009
327
|
get currentLanguage() {
|
|
2010
328
|
return this._currentLanguage;
|
|
@@ -2049,8 +367,8 @@ class Session {
|
|
|
2049
367
|
hasRight(e, t) {
|
|
2050
368
|
if (t === "owner")
|
|
2051
369
|
return e.owner && e.owner.userId === this._me.userId;
|
|
2052
|
-
const s = t.right || t,
|
|
2053
|
-
return
|
|
370
|
+
const s = t.right || t, i = e.shared.filter((a) => (this._me.groupsIds || []).indexOf(a.groupId) !== -1 || a.userId === this._me.userId).find((a) => a[s] || a.manager) !== void 0, u = t.workflow ? this.hasWorkflow(t.workflow) : !0;
|
|
371
|
+
return i && u;
|
|
2054
372
|
}
|
|
2055
373
|
////////////////////////////////////////////////////////// Storage management
|
|
2056
374
|
get latestQuotaAndUsage() {
|
|
@@ -2122,14 +440,14 @@ class Session {
|
|
|
2122
440
|
}
|
|
2123
441
|
class SessionFramework {
|
|
2124
442
|
constructor() {
|
|
2125
|
-
|
|
443
|
+
n(this, "session", new Session());
|
|
2126
444
|
}
|
|
2127
445
|
initialize() {
|
|
2128
446
|
return this.session.initialize();
|
|
2129
447
|
}
|
|
2130
|
-
login(e, t, s,
|
|
2131
|
-
const
|
|
2132
|
-
return
|
|
448
|
+
login(e, t, s, r) {
|
|
449
|
+
const i = new FormData();
|
|
450
|
+
return i.append("email", e), i.append("password", t), typeof s < "u" && i.append("rememberMe", "" + s), typeof r < "u" && i.append("secureLocation", "" + r), transport.http.post("/auth/login", i, {
|
|
2133
451
|
headers: { "content-type": "application/x-www-form-urlencoded" }
|
|
2134
452
|
}).finally(() => {
|
|
2135
453
|
switch (transport.http.latestResponse.status) {
|
|
@@ -2146,22 +464,22 @@ class SessionFramework {
|
|
|
2146
464
|
const session = new SessionFramework();
|
|
2147
465
|
class Theme {
|
|
2148
466
|
constructor() {
|
|
2149
|
-
|
|
2150
|
-
|
|
467
|
+
n(this, "_conf");
|
|
468
|
+
n(this, "_loaded");
|
|
2151
469
|
// legacy (readonly)
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
470
|
+
n(this, "skinName", "");
|
|
471
|
+
n(this, "themeName", "");
|
|
472
|
+
n(this, "skin", "raw");
|
|
473
|
+
n(this, "themeUrl", "/assets/themes/raw/default/");
|
|
474
|
+
n(this, "templateOverrides", {});
|
|
475
|
+
n(this, "portalTemplate", "/assets/themes/raw/portal.html");
|
|
476
|
+
n(this, "basePath", "");
|
|
477
|
+
n(this, "logoutCallback", "/");
|
|
478
|
+
n(this, "skins", []);
|
|
479
|
+
n(this, "is1D", !1);
|
|
480
|
+
n(this, "is2D", !1);
|
|
481
|
+
n(this, "_onSkinReady", notify.onSkinReady());
|
|
482
|
+
n(this, "_onOverrideReady", notify.onOverridesReady());
|
|
2165
483
|
}
|
|
2166
484
|
initialize(e) {
|
|
2167
485
|
return notify.onSessionReady().promise.then(() => this.load(e));
|
|
@@ -2190,27 +508,27 @@ class Theme {
|
|
|
2190
508
|
}
|
|
2191
509
|
load(e) {
|
|
2192
510
|
return e = e ?? this.version, this._loaded || (this._loaded = (session.session.notLoggedIn ? this.loadDisconnected(e) : this.loadConnected(e)).then(async () => {
|
|
2193
|
-
var s,
|
|
511
|
+
var s, r;
|
|
2194
512
|
const t = await this.listSkins();
|
|
2195
|
-
this.is1D = ((s = t.find((
|
|
513
|
+
this.is1D = ((s = t.find((i) => i.child === this.skin)) == null ? void 0 : s.parent) === "panda", this.is2D = ((r = t.find((i) => i.child === this.skin)) == null ? void 0 : r.parent) === "theme-open-ent";
|
|
2196
514
|
})), this._loaded;
|
|
2197
515
|
}
|
|
2198
516
|
loadDisconnected(e) {
|
|
2199
517
|
return new Promise((t, s) => {
|
|
2200
|
-
transport.http.get("/skin", { queryParams: { v: this.version } }).then((
|
|
2201
|
-
this.skin =
|
|
518
|
+
transport.http.get("/skin", { queryParams: { v: this.version } }).then((r) => {
|
|
519
|
+
this.skin = r.skin, this.themeUrl = `${this.cdnDomain}/assets/themes/${r.skin}/skins/default/`, this.basePath = this.themeUrl + "../../", this._onSkinReady.resolve(this), transport.http.get(`/assets/themes/${r.skin}/template/override.json`, {
|
|
2202
520
|
disableNotifications: !0,
|
|
2203
521
|
queryParams: { v: e }
|
|
2204
|
-
}).then((
|
|
2205
|
-
this.templateOverrides =
|
|
2206
|
-
}).catch((
|
|
522
|
+
}).then((i) => {
|
|
523
|
+
this.templateOverrides = i, this._onOverrideReady.resolve(i), t();
|
|
524
|
+
}).catch((i) => {
|
|
2207
525
|
if (transport.http.latestResponse.status === 404)
|
|
2208
526
|
t();
|
|
2209
527
|
else
|
|
2210
|
-
throw
|
|
528
|
+
throw i;
|
|
2211
529
|
});
|
|
2212
|
-
}).catch((
|
|
2213
|
-
this._onSkinReady.reject(
|
|
530
|
+
}).catch((r) => {
|
|
531
|
+
this._onSkinReady.reject(r), this._onOverrideReady.reject(r), s();
|
|
2214
532
|
});
|
|
2215
533
|
});
|
|
2216
534
|
}
|
|
@@ -2220,13 +538,13 @@ class Theme {
|
|
|
2220
538
|
this._onSkinReady.resolve(this), transport.http.get(`/assets/themes/${this.skin}/template/override.json`, {
|
|
2221
539
|
disableNotifications: !0,
|
|
2222
540
|
queryParams: { v: e }
|
|
2223
|
-
}).then((
|
|
2224
|
-
this.templateOverrides =
|
|
2225
|
-
}).catch((
|
|
541
|
+
}).then((r) => {
|
|
542
|
+
this.templateOverrides = r, this._onOverrideReady.resolve(r), t();
|
|
543
|
+
}).catch((r) => {
|
|
2226
544
|
if (transport.http.latestResponse.status === 404)
|
|
2227
|
-
t(), this._onSkinReady.reject(
|
|
545
|
+
t(), this._onSkinReady.reject(r), this._onOverrideReady.reject(r);
|
|
2228
546
|
else
|
|
2229
|
-
throw
|
|
547
|
+
throw r;
|
|
2230
548
|
});
|
|
2231
549
|
});
|
|
2232
550
|
});
|
|
@@ -2471,10 +789,10 @@ class Idiom {
|
|
|
2471
789
|
e = e ?? "";
|
|
2472
790
|
let s = bundle$1[e] === void 0 ? e : bundle$1[e];
|
|
2473
791
|
if (t && typeof t == "object")
|
|
2474
|
-
for (let
|
|
2475
|
-
typeof t[
|
|
2476
|
-
new RegExp("\\${" +
|
|
2477
|
-
"" + t[
|
|
792
|
+
for (let r in t)
|
|
793
|
+
typeof t[r] < "u" && (s = s.replace(
|
|
794
|
+
new RegExp("\\${" + r + "}", "g"),
|
|
795
|
+
"" + t[r]
|
|
2478
796
|
));
|
|
2479
797
|
return s;
|
|
2480
798
|
}
|
|
@@ -2488,17 +806,17 @@ class Idiom {
|
|
|
2488
806
|
return this.loadBundle(e, t), promises$1[t];
|
|
2489
807
|
}
|
|
2490
808
|
loadBundle(e, t, s) {
|
|
2491
|
-
const
|
|
2492
|
-
if (
|
|
2493
|
-
s &&
|
|
809
|
+
const r = promises$1[t];
|
|
810
|
+
if (r)
|
|
811
|
+
s && r.then(s).catch(s);
|
|
2494
812
|
else {
|
|
2495
|
-
const
|
|
2496
|
-
promises$1[t] =
|
|
2497
|
-
const
|
|
2498
|
-
e && (
|
|
2499
|
-
Object.assign(bundle$1,
|
|
2500
|
-
}).catch((
|
|
2501
|
-
typeof s == "function" && s(),
|
|
813
|
+
const i = new Promisified();
|
|
814
|
+
promises$1[t] = i.promise;
|
|
815
|
+
const u = {};
|
|
816
|
+
e && (u["Accept-Language"] = e), transport.http.get(t, { headers: u }).then((a) => {
|
|
817
|
+
Object.assign(bundle$1, a), typeof s == "function" && s(), i.resolve();
|
|
818
|
+
}).catch((a) => {
|
|
819
|
+
typeof s == "function" && s(), i.reject();
|
|
2502
820
|
});
|
|
2503
821
|
}
|
|
2504
822
|
}
|
|
@@ -2533,7 +851,7 @@ class Idiom {
|
|
|
2533
851
|
class UserPreferences {
|
|
2534
852
|
constructor() {
|
|
2535
853
|
//-------------------------------------
|
|
2536
|
-
|
|
854
|
+
n(this, "data", {});
|
|
2537
855
|
}
|
|
2538
856
|
get(e) {
|
|
2539
857
|
return this.data[e];
|
|
@@ -2560,10 +878,10 @@ class UserPreferences {
|
|
|
2560
878
|
class User {
|
|
2561
879
|
constructor() {
|
|
2562
880
|
//-------------------------------------
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
881
|
+
n(this, "_me", null);
|
|
882
|
+
n(this, "_keepOpenOnLogout", !1);
|
|
883
|
+
n(this, "_preferences", new UserPreferences());
|
|
884
|
+
n(this, "_bookmarkedApps", []);
|
|
2567
885
|
}
|
|
2568
886
|
get keepOpenOnLogout() {
|
|
2569
887
|
return this._keepOpenOnLogout;
|
|
@@ -2595,7 +913,7 @@ class User {
|
|
|
2595
913
|
let s;
|
|
2596
914
|
if (t && t.length && typeof t.concat == "function") {
|
|
2597
915
|
this._bookmarkedApps = t, s = {
|
|
2598
|
-
bookmarks: t.map((
|
|
916
|
+
bookmarks: t.map((u) => u.name),
|
|
2599
917
|
applications: []
|
|
2600
918
|
}, transport.http.putJson("/userbook/preference/apps", s);
|
|
2601
919
|
return;
|
|
@@ -2605,19 +923,19 @@ class User {
|
|
|
2605
923
|
bookmarks: [],
|
|
2606
924
|
applications: []
|
|
2607
925
|
});
|
|
2608
|
-
let
|
|
2609
|
-
const
|
|
2610
|
-
s.bookmarks.forEach((
|
|
2611
|
-
const
|
|
2612
|
-
if (
|
|
2613
|
-
let
|
|
2614
|
-
this._bookmarkedApps.push(
|
|
926
|
+
let r = !0;
|
|
927
|
+
const i = [];
|
|
928
|
+
s.bookmarks.forEach((u, a) => {
|
|
929
|
+
const c = this._me.apps.find((h) => h.name === u);
|
|
930
|
+
if (c) {
|
|
931
|
+
let h = Object.assign({}, c);
|
|
932
|
+
this._bookmarkedApps.push(h);
|
|
2615
933
|
} else
|
|
2616
|
-
|
|
2617
|
-
}),
|
|
2618
|
-
let
|
|
2619
|
-
|
|
2620
|
-
}),
|
|
934
|
+
i.push(u), r = !1;
|
|
935
|
+
}), i.forEach((u) => {
|
|
936
|
+
let a = s.bookmarks.indexOf(u);
|
|
937
|
+
a !== -1 && s.bookmarks.splice(a, 1);
|
|
938
|
+
}), r || transport.http.putJson("/userbook/preference/apps", s);
|
|
2621
939
|
});
|
|
2622
940
|
}
|
|
2623
941
|
loadAppPrefs(e) {
|
|
@@ -2637,9 +955,9 @@ const http$1 = transport == null ? void 0 : transport.http;
|
|
|
2637
955
|
class AppConf {
|
|
2638
956
|
constructor() {
|
|
2639
957
|
//-------------------------------------
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
958
|
+
n(this, "_publicConf", {});
|
|
959
|
+
n(this, "_currentApp");
|
|
960
|
+
n(this, "_appConf", {});
|
|
2643
961
|
}
|
|
2644
962
|
/**
|
|
2645
963
|
* Get the currently initialized App.
|
|
@@ -2663,11 +981,11 @@ class AppConf {
|
|
|
2663
981
|
let t;
|
|
2664
982
|
return this._appConf[e] || (await http$1.get(
|
|
2665
983
|
"/applications-list"
|
|
2666
|
-
)).apps.forEach((
|
|
2667
|
-
if (
|
|
2668
|
-
const
|
|
2669
|
-
this._appConf[
|
|
2670
|
-
} else
|
|
984
|
+
)).apps.forEach((r) => {
|
|
985
|
+
if (r != null && r.prefix) {
|
|
986
|
+
const i = r.prefix.replace("/", "");
|
|
987
|
+
this._appConf[i] = r;
|
|
988
|
+
} else r != null && r.name && r.name.toLowerCase() == e && (t = r);
|
|
2671
989
|
}), this._appConf[e] ?? t;
|
|
2672
990
|
}
|
|
2673
991
|
async loadI18n(e) {
|
|
@@ -2677,8 +995,8 @@ class AppConf {
|
|
|
2677
995
|
class Analytics {
|
|
2678
996
|
constructor() {
|
|
2679
997
|
//-------------------------------------
|
|
2680
|
-
|
|
2681
|
-
|
|
998
|
+
n(this, "_status", "void");
|
|
999
|
+
n(this, "_params");
|
|
2682
1000
|
}
|
|
2683
1001
|
get status() {
|
|
2684
1002
|
return this._status;
|
|
@@ -2717,28 +1035,28 @@ class Analytics {
|
|
|
2717
1035
|
async initializeXiti(e) {
|
|
2718
1036
|
if (!e.structureMap || !configure.Platform.apps.currentApp) return;
|
|
2719
1037
|
const t = await notify.onSessionReady().promise, s = session.session.description;
|
|
2720
|
-
let
|
|
2721
|
-
for (let
|
|
2722
|
-
const
|
|
2723
|
-
if (
|
|
2724
|
-
|
|
1038
|
+
let r;
|
|
1039
|
+
for (let h of t.structures) {
|
|
1040
|
+
const l = e.structureMap[h];
|
|
1041
|
+
if (l && l.collectiviteId && l.UAI) {
|
|
1042
|
+
r = l;
|
|
2725
1043
|
break;
|
|
2726
1044
|
}
|
|
2727
1045
|
}
|
|
2728
|
-
if (!
|
|
2729
|
-
const
|
|
1046
|
+
if (!r || !r.active) return;
|
|
1047
|
+
const i = await configure.Platform.apps.getPublicConf(
|
|
2730
1048
|
configure.Platform.apps.currentApp
|
|
2731
1049
|
);
|
|
2732
|
-
if (!
|
|
2733
|
-
const
|
|
2734
|
-
if (!
|
|
2735
|
-
function
|
|
2736
|
-
let
|
|
2737
|
-
for (let
|
|
2738
|
-
|
|
2739
|
-
return
|
|
1050
|
+
if (!i) return;
|
|
1051
|
+
const u = i.xiti;
|
|
1052
|
+
if (!u || !u.LIBELLE_SERVICE || !r.UAI) return;
|
|
1053
|
+
function a(h) {
|
|
1054
|
+
let l = "";
|
|
1055
|
+
for (let E = 0; E < h.length; E++)
|
|
1056
|
+
l += h.charCodeAt(E);
|
|
1057
|
+
return l;
|
|
2740
1058
|
}
|
|
2741
|
-
const
|
|
1059
|
+
const c = {
|
|
2742
1060
|
Student: "ELEVE",
|
|
2743
1061
|
Teacher: "ENSEIGNANT",
|
|
2744
1062
|
Relative: "PARENT",
|
|
@@ -2746,24 +1064,24 @@ class Analytics {
|
|
|
2746
1064
|
Guest: "AUTRE"
|
|
2747
1065
|
};
|
|
2748
1066
|
return {
|
|
2749
|
-
LIBELLE_SERVICE:
|
|
1067
|
+
LIBELLE_SERVICE: u.LIBELLE_SERVICE,
|
|
2750
1068
|
// Which property of LIBELLE_SERVICE to use depends on the frontend.
|
|
2751
|
-
TYPE:
|
|
2752
|
-
OUTIL:
|
|
2753
|
-
STRUCT_ID:
|
|
2754
|
-
STRUCT_UAI:
|
|
2755
|
-
PROJET:
|
|
1069
|
+
TYPE: u.OUTIL ? "TIERS" : "NATIF",
|
|
1070
|
+
OUTIL: u.OUTIL ? u.OUTIL : "",
|
|
1071
|
+
STRUCT_ID: r.collectiviteId,
|
|
1072
|
+
STRUCT_UAI: r.UAI,
|
|
1073
|
+
PROJET: r.projetId ? r.projetId : e.ID_PROJET,
|
|
2756
1074
|
EXPLOITANT: e.ID_EXPLOITANT,
|
|
2757
|
-
PLATFORME:
|
|
2758
|
-
ID_PERSO:
|
|
2759
|
-
PROFILE: s.profiles && s.profiles.length > 0 ?
|
|
1075
|
+
PLATFORME: r.plateformeId ? r.plateformeId : e.ID_PLATEFORME,
|
|
1076
|
+
ID_PERSO: a(t.userId),
|
|
1077
|
+
PROFILE: s.profiles && s.profiles.length > 0 ? c[s.profiles[0]] ?? "" : ""
|
|
2760
1078
|
};
|
|
2761
1079
|
}
|
|
2762
1080
|
}
|
|
2763
1081
|
class ConfigurationFramework {
|
|
2764
1082
|
constructor() {
|
|
2765
1083
|
//-------------------------------------
|
|
2766
|
-
|
|
1084
|
+
n(this, "Platform", {
|
|
2767
1085
|
deploymentTag: "",
|
|
2768
1086
|
cdnDomain: "",
|
|
2769
1087
|
apps: new AppConf(),
|
|
@@ -2772,21 +1090,21 @@ class ConfigurationFramework {
|
|
|
2772
1090
|
idiom: new Idiom(),
|
|
2773
1091
|
listLanguages: () => transport.http.get("/languages")
|
|
2774
1092
|
});
|
|
2775
|
-
|
|
1093
|
+
n(this, "School", {
|
|
2776
1094
|
//apps; -> pinnedApps;
|
|
2777
1095
|
});
|
|
2778
|
-
|
|
1096
|
+
n(this, "User", new User());
|
|
2779
1097
|
}
|
|
2780
1098
|
async initialize(e, t) {
|
|
2781
1099
|
if (!e) {
|
|
2782
|
-
const
|
|
2783
|
-
e = `${
|
|
1100
|
+
const r = (h) => (h < 10 ? "0" : "") + h.toFixed(0), i = /* @__PURE__ */ new Date(), u = i.getFullYear(), a = i.getMonth() + 1, c = i.getDate();
|
|
1101
|
+
e = `${u}${r(a)}${r(c)}`;
|
|
2784
1102
|
}
|
|
2785
1103
|
const s = e;
|
|
2786
1104
|
this.Platform.deploymentTag = e, typeof t == "string" && t.length > 0 && (this.Platform.cdnDomain = t), transport.http.setCdn(this.Platform.cdnDomain), await Promise.all([
|
|
2787
1105
|
this.Platform.theme.initialize(s),
|
|
2788
1106
|
notify.onSessionReady().promise.then(
|
|
2789
|
-
(
|
|
1107
|
+
(r) => this.Platform.idiom.addBundlePromise("/i18n")
|
|
2790
1108
|
),
|
|
2791
1109
|
//TODO this.School.initialize( v ),
|
|
2792
1110
|
this.User.initialize(s)
|
|
@@ -2818,12 +1136,12 @@ class ConfigurationFramework {
|
|
|
2818
1136
|
// }
|
|
2819
1137
|
}
|
|
2820
1138
|
const configure = new ConfigurationFramework(), http = transport == null ? void 0 : transport.http;
|
|
2821
|
-
var
|
|
2822
|
-
const me = (
|
|
1139
|
+
var _;
|
|
1140
|
+
const me = (_ = session == null ? void 0 : session.session) == null ? void 0 : _.user;
|
|
2823
1141
|
class Notification {
|
|
2824
1142
|
constructor(e) {
|
|
2825
|
-
|
|
2826
|
-
|
|
1143
|
+
n(this, "_id");
|
|
1144
|
+
n(this, "model");
|
|
2827
1145
|
e.reported = e.reporters && e.reporters.length > 0, this._id = e._id, this.model = e;
|
|
2828
1146
|
}
|
|
2829
1147
|
isUnread() {
|
|
@@ -2843,14 +1161,14 @@ class Notification {
|
|
|
2843
1161
|
class TimelineApp {
|
|
2844
1162
|
constructor() {
|
|
2845
1163
|
//-------------------------------------
|
|
2846
|
-
|
|
2847
|
-
|
|
1164
|
+
n(this, "_notifications", []);
|
|
1165
|
+
n(this, "_notificationTypes", []);
|
|
2848
1166
|
// ex: ["BLOG"]
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
1167
|
+
n(this, "_flashMessages", []);
|
|
1168
|
+
n(this, "_pageNumber", 0);
|
|
1169
|
+
n(this, "_lastPage", !1);
|
|
1170
|
+
n(this, "_loading", !1);
|
|
1171
|
+
n(this, "showMine", !1);
|
|
2854
1172
|
}
|
|
2855
1173
|
get notifications() {
|
|
2856
1174
|
return this._notifications;
|
|
@@ -2904,19 +1222,19 @@ class TimelineApp {
|
|
|
2904
1222
|
return this.showMine || delete s.mine, this._loading = !0, transport.http.get(`/timeline/lastNotifications?type=${t.join("&type=")}`, {
|
|
2905
1223
|
queryParams: s
|
|
2906
1224
|
}).then(
|
|
2907
|
-
(
|
|
2908
|
-
if (this._loading = !1,
|
|
2909
|
-
if (
|
|
2910
|
-
const
|
|
2911
|
-
(
|
|
2912
|
-
(
|
|
1225
|
+
(r) => {
|
|
1226
|
+
if (this._loading = !1, r.status === "ok")
|
|
1227
|
+
if (r.number && r.results) {
|
|
1228
|
+
const i = r.results.filter(
|
|
1229
|
+
(u) => this._notifications.findIndex(
|
|
1230
|
+
(a) => a._id === u._id
|
|
2913
1231
|
) === -1
|
|
2914
|
-
).map((
|
|
2915
|
-
this._notifications = this._notifications.concat(
|
|
1232
|
+
).map((u) => new Notification(u));
|
|
1233
|
+
this._notifications = this._notifications.concat(i), this._pageNumber++;
|
|
2916
1234
|
} else
|
|
2917
1235
|
this._lastPage = !0;
|
|
2918
1236
|
}
|
|
2919
|
-
).catch((
|
|
1237
|
+
).catch((r) => {
|
|
2920
1238
|
this._loading = !1;
|
|
2921
1239
|
});
|
|
2922
1240
|
}
|
|
@@ -2985,13 +1303,13 @@ class ServiceRegistry extends Map {
|
|
|
2985
1303
|
application: e,
|
|
2986
1304
|
resourceType: t
|
|
2987
1305
|
}, s) {
|
|
2988
|
-
const
|
|
2989
|
-
if (
|
|
1306
|
+
const r = this.get(`${e}:${t}`);
|
|
1307
|
+
if (r === void 0)
|
|
2990
1308
|
throw `Service not found: ${e}:${t}`;
|
|
2991
|
-
return
|
|
1309
|
+
return r(s);
|
|
2992
1310
|
}
|
|
2993
1311
|
}
|
|
2994
|
-
const
|
|
1312
|
+
const f = class f {
|
|
2995
1313
|
//
|
|
2996
1314
|
// IMPLEMENTATION
|
|
2997
1315
|
//
|
|
@@ -2999,7 +1317,7 @@ const T = class T {
|
|
|
2999
1317
|
//
|
|
3000
1318
|
// PROTECTED HELPERS
|
|
3001
1319
|
//
|
|
3002
|
-
|
|
1320
|
+
n(this, "checkHttpResponse", (e) => {
|
|
3003
1321
|
if (this.http.latestResponse.status >= 300)
|
|
3004
1322
|
throw this.http.latestResponse.statusText;
|
|
3005
1323
|
return e;
|
|
@@ -3024,14 +1342,14 @@ const T = class T {
|
|
|
3024
1342
|
), t.append(
|
|
3025
1343
|
"teacherAvatarType",
|
|
3026
1344
|
e.teacherAvatar.type
|
|
3027
|
-
), t.append("language", e.language), e.activityType.forEach((
|
|
3028
|
-
t.append("activityType[]",
|
|
3029
|
-
}), e.subjectArea.forEach((
|
|
3030
|
-
t.append("subjectArea[]",
|
|
3031
|
-
}), e.age.forEach((
|
|
3032
|
-
t.append("age[]",
|
|
3033
|
-
}), t.append("description", e.description), e.keyWords.split(",").forEach((
|
|
3034
|
-
t.append("keyWords[]",
|
|
1345
|
+
), t.append("language", e.language), e.activityType.forEach((i) => {
|
|
1346
|
+
t.append("activityType[]", i);
|
|
1347
|
+
}), e.subjectArea.forEach((i) => {
|
|
1348
|
+
t.append("subjectArea[]", i);
|
|
1349
|
+
}), e.age.forEach((i) => {
|
|
1350
|
+
t.append("age[]", i.toString());
|
|
1351
|
+
}), t.append("description", e.description), e.keyWords.split(",").forEach((i) => {
|
|
1352
|
+
t.append("keyWords[]", i.trim());
|
|
3035
1353
|
}), t.append("licence", e.licence), t.append(
|
|
3036
1354
|
"pdfUri",
|
|
3037
1355
|
`${window.location.origin}${this.getPrintUrl(e.resourceEntId)}`
|
|
@@ -3120,11 +1438,11 @@ const T = class T {
|
|
|
3120
1438
|
application: t.application,
|
|
3121
1439
|
assetIds: t.resourceIds
|
|
3122
1440
|
}) : t.resourceIds;
|
|
3123
|
-
const
|
|
1441
|
+
const r = await this.http.putJson(
|
|
3124
1442
|
"/explorer/trash",
|
|
3125
1443
|
t
|
|
3126
1444
|
);
|
|
3127
|
-
return this.checkHttpResponse(
|
|
1445
|
+
return this.checkHttpResponse(r);
|
|
3128
1446
|
}
|
|
3129
1447
|
/** Trash folders and/or resources. */
|
|
3130
1448
|
async restoreAll({ resourceType: e, ...t }, s = !1) {
|
|
@@ -3132,11 +1450,11 @@ const T = class T {
|
|
|
3132
1450
|
application: t.application,
|
|
3133
1451
|
assetIds: t.resourceIds
|
|
3134
1452
|
}) : t.resourceIds;
|
|
3135
|
-
const
|
|
1453
|
+
const r = await this.http.putJson(
|
|
3136
1454
|
"/explorer/restore",
|
|
3137
1455
|
t
|
|
3138
1456
|
);
|
|
3139
|
-
return this.checkHttpResponse(
|
|
1457
|
+
return this.checkHttpResponse(r);
|
|
3140
1458
|
}
|
|
3141
1459
|
async mapAssetIdToIds({
|
|
3142
1460
|
application: e,
|
|
@@ -3149,13 +1467,13 @@ const T = class T {
|
|
|
3149
1467
|
filters: {},
|
|
3150
1468
|
asset_id: t
|
|
3151
1469
|
});
|
|
3152
|
-
return t.map((
|
|
3153
|
-
const
|
|
3154
|
-
(
|
|
1470
|
+
return t.map((r) => {
|
|
1471
|
+
const i = s.resources.find(
|
|
1472
|
+
(u) => u.assetId === r
|
|
3155
1473
|
);
|
|
3156
|
-
if (
|
|
1474
|
+
if (i === void 0)
|
|
3157
1475
|
throw "explorer.assetid.notfound";
|
|
3158
|
-
return
|
|
1476
|
+
return i.id;
|
|
3159
1477
|
});
|
|
3160
1478
|
}
|
|
3161
1479
|
async getThumbnailPath(e) {
|
|
@@ -3163,7 +1481,7 @@ const T = class T {
|
|
|
3163
1481
|
return e;
|
|
3164
1482
|
if (typeof e == "string")
|
|
3165
1483
|
if (e.startsWith("blob:")) {
|
|
3166
|
-
const t = await fetch(e).then((
|
|
1484
|
+
const t = await fetch(e).then((r) => r.blob());
|
|
3167
1485
|
return `/workspace/document/${(await this.context.workspace().saveFile(t, {
|
|
3168
1486
|
visibility: "protected",
|
|
3169
1487
|
application: this.getApplication()
|
|
@@ -3187,8 +1505,8 @@ const T = class T {
|
|
|
3187
1505
|
trashed: e.trashed
|
|
3188
1506
|
};
|
|
3189
1507
|
if (e.types.length > 0 && (t.resource_type = e.types[0]), e.orders && Object.entries(e.orders).length) {
|
|
3190
|
-
const [[s,
|
|
3191
|
-
t.order_by = `${s}:${
|
|
1508
|
+
const [[s, r]] = Object.entries(e.orders);
|
|
1509
|
+
t.order_by = `${s}:${r}`;
|
|
3192
1510
|
}
|
|
3193
1511
|
return e.filters && Object.assign(t, e.filters), typeof e.search == "string" && (t.search = e.search), typeof e.asset_id < "u" && (t.asset_id = [...e.asset_id]), typeof e.id < "u" && (t.id = e.id), t;
|
|
3194
1512
|
}
|
|
@@ -3217,9 +1535,9 @@ const T = class T {
|
|
|
3217
1535
|
//
|
|
3218
1536
|
// STATIC REGISTRY
|
|
3219
1537
|
//
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
let ResourceService =
|
|
1538
|
+
n(f, "registry", new ServiceRegistry()), // Expose some useful functions
|
|
1539
|
+
n(f, "register", f.registry.register.bind(f.registry)), n(f, "findService", f.registry.findService.bind(f.registry)), n(f, "findMainService", f.registry.findMainService.bind(f.registry)), n(f, "isRegistered", f.registry.isRegistered.bind(f.registry));
|
|
1540
|
+
let ResourceService = f;
|
|
3223
1541
|
const APP = "scrapbook", RESOURCE = "scrapbook";
|
|
3224
1542
|
class ScrapbookResourceService extends ResourceService {
|
|
3225
1543
|
create(e) {
|
|
@@ -3261,7 +1579,7 @@ class ScrapbookResourceService extends ResourceService {
|
|
|
3261
1579
|
}
|
|
3262
1580
|
ResourceService.register(
|
|
3263
1581
|
{ application: RESOURCE, resourceType: RESOURCE },
|
|
3264
|
-
(
|
|
1582
|
+
(o) => new ScrapbookResourceService(o)
|
|
3265
1583
|
);
|
|
3266
1584
|
const globalCache = {}, mutexPromise = {};
|
|
3267
1585
|
class CacheService {
|
|
@@ -3275,12 +1593,12 @@ class CacheService {
|
|
|
3275
1593
|
if (mutexPromise[e] && await mutexPromise[e], globalCache[e])
|
|
3276
1594
|
return globalCache[e];
|
|
3277
1595
|
try {
|
|
3278
|
-
const
|
|
3279
|
-
mutexPromise[e] =
|
|
3280
|
-
const
|
|
3281
|
-
return s(
|
|
3282
|
-
} catch (
|
|
3283
|
-
throw console.error(`Failed to retrieve value for: ${e}`,
|
|
1596
|
+
const r = t();
|
|
1597
|
+
mutexPromise[e] = r;
|
|
1598
|
+
const i = await r;
|
|
1599
|
+
return s(i) && (globalCache[e] = i), i;
|
|
1600
|
+
} catch (r) {
|
|
1601
|
+
throw console.error(`Failed to retrieve value for: ${e}`, r), r;
|
|
3284
1602
|
}
|
|
3285
1603
|
}
|
|
3286
1604
|
clearCache(e) {
|
|
@@ -3294,17 +1612,17 @@ class CacheService {
|
|
|
3294
1612
|
return this.fromCacheIfPossible(
|
|
3295
1613
|
e,
|
|
3296
1614
|
async () => {
|
|
3297
|
-
const s = await this.http.get(e, t),
|
|
3298
|
-
return { value: s, response:
|
|
1615
|
+
const s = await this.http.get(e, t), r = { ...this.http.latestResponse };
|
|
1616
|
+
return { value: s, response: r };
|
|
3299
1617
|
},
|
|
3300
1618
|
({ response: s }) => !(s.status < 200 || s.status >= 300)
|
|
3301
1619
|
);
|
|
3302
1620
|
}
|
|
3303
1621
|
async httpGetJson(e, t) {
|
|
3304
|
-
const { response: s, value:
|
|
1622
|
+
const { response: s, value: r } = await this.httpGet(e, t);
|
|
3305
1623
|
if (s.status < 200 || s.status >= 300)
|
|
3306
1624
|
throw `Bad http status (${s.status}) for url: ${e}`;
|
|
3307
|
-
return
|
|
1625
|
+
return r;
|
|
3308
1626
|
}
|
|
3309
1627
|
}
|
|
3310
1628
|
class ConfService {
|
|
@@ -3327,17 +1645,17 @@ class ConfService {
|
|
|
3327
1645
|
const [t, s] = await Promise.all([
|
|
3328
1646
|
this.getThemeConf(),
|
|
3329
1647
|
this.getApplicationsList()
|
|
3330
|
-
]), [
|
|
1648
|
+
]), [r, i] = await Promise.all([
|
|
3331
1649
|
this.getTheme({ conf: t, publicTheme: s === void 0 }),
|
|
3332
1650
|
this.getWebAppConf({ app: e, applications: s ?? [] })
|
|
3333
|
-
]),
|
|
1651
|
+
]), u = {
|
|
3334
1652
|
app: e,
|
|
3335
1653
|
applications: s ?? [],
|
|
3336
1654
|
conf: t,
|
|
3337
|
-
currentApp:
|
|
3338
|
-
theme:
|
|
1655
|
+
currentApp: i,
|
|
1656
|
+
theme: r
|
|
3339
1657
|
};
|
|
3340
|
-
return this.notify.onAppConfReady().resolve(
|
|
1658
|
+
return this.notify.onAppConfReady().resolve(u), u;
|
|
3341
1659
|
}
|
|
3342
1660
|
async getPublicConf(e) {
|
|
3343
1661
|
const { response: t, value: s } = await this.cache.httpGet(
|
|
@@ -3379,9 +1697,9 @@ class ConfService {
|
|
|
3379
1697
|
app: e,
|
|
3380
1698
|
applications: t
|
|
3381
1699
|
}) {
|
|
3382
|
-
return t.find((
|
|
3383
|
-
if (
|
|
3384
|
-
return (
|
|
1700
|
+
return t.find((r) => {
|
|
1701
|
+
if (r != null && r.prefix)
|
|
1702
|
+
return (r == null ? void 0 : r.prefix.replace("/", "")) === e;
|
|
3385
1703
|
});
|
|
3386
1704
|
}
|
|
3387
1705
|
async getTheme({
|
|
@@ -3389,25 +1707,25 @@ class ConfService {
|
|
|
3389
1707
|
conf: t,
|
|
3390
1708
|
publicTheme: s
|
|
3391
1709
|
}) {
|
|
3392
|
-
const { value:
|
|
1710
|
+
const { value: r } = await this.cache.httpGet("/theme", {
|
|
3393
1711
|
queryParams: { _: e }
|
|
3394
|
-
}),
|
|
3395
|
-
(
|
|
1712
|
+
}), i = s ? null : r, u = t == null ? void 0 : t.overriding.find(
|
|
1713
|
+
(p) => (
|
|
3396
1714
|
// Public access => simply use the 1st override
|
|
3397
|
-
|
|
1715
|
+
i === null || p.child === i.themeName
|
|
3398
1716
|
)
|
|
3399
|
-
),
|
|
1717
|
+
), a = (i == null ? void 0 : i.skinName) || u.skins[0], c = (i == null ? void 0 : i.skin) || `/assets/themes/${u.child}/skins/${a}/`, h = u.skins, l = u.bootstrapVersion.split("-").slice(-1)[0], E = u.parent === "panda";
|
|
3400
1718
|
return {
|
|
3401
|
-
basePath: `${this.cdnDomain}${
|
|
3402
|
-
bootstrapVersion:
|
|
3403
|
-
is1d:
|
|
3404
|
-
logoutCallback: (
|
|
3405
|
-
skin:
|
|
3406
|
-
skinName:
|
|
3407
|
-
skins:
|
|
3408
|
-
themeName:
|
|
3409
|
-
themeUrl:
|
|
3410
|
-
npmTheme:
|
|
1719
|
+
basePath: `${this.cdnDomain}${c}../../`,
|
|
1720
|
+
bootstrapVersion: l,
|
|
1721
|
+
is1d: E,
|
|
1722
|
+
logoutCallback: (i == null ? void 0 : i.logoutCallback) || "/",
|
|
1723
|
+
skin: u.child,
|
|
1724
|
+
skinName: a,
|
|
1725
|
+
skins: h,
|
|
1726
|
+
themeName: u.child,
|
|
1727
|
+
themeUrl: c,
|
|
1728
|
+
npmTheme: u.npmTheme ?? void 0
|
|
3411
1729
|
};
|
|
3412
1730
|
}
|
|
3413
1731
|
async getLogoutCallback(e) {
|
|
@@ -3446,54 +1764,54 @@ class DirectoryService {
|
|
|
3446
1764
|
}));
|
|
3447
1765
|
}
|
|
3448
1766
|
async getBookMarkById(e) {
|
|
3449
|
-
const { groups: t, id: s, name:
|
|
1767
|
+
const { groups: t, id: s, name: r, users: i } = await this.http.get(
|
|
3450
1768
|
`/directory/sharebookmark/${e}`
|
|
3451
1769
|
);
|
|
3452
1770
|
return {
|
|
3453
1771
|
id: s,
|
|
3454
|
-
displayName:
|
|
3455
|
-
groups: t.map(({ name:
|
|
3456
|
-
displayName:
|
|
3457
|
-
id:
|
|
1772
|
+
displayName: r,
|
|
1773
|
+
groups: t.map(({ name: u, id: a }) => ({
|
|
1774
|
+
displayName: u,
|
|
1775
|
+
id: a
|
|
3458
1776
|
})),
|
|
3459
|
-
users:
|
|
3460
|
-
profile:
|
|
3461
|
-
displayName:
|
|
1777
|
+
users: i.map(({ displayName: u, id: a, profile: c }) => ({
|
|
1778
|
+
profile: c,
|
|
1779
|
+
displayName: u,
|
|
3462
1780
|
// these info are missing from api
|
|
3463
1781
|
firstName: "",
|
|
3464
1782
|
lastName: "",
|
|
3465
1783
|
login: "",
|
|
3466
|
-
id:
|
|
1784
|
+
id: a
|
|
3467
1785
|
}))
|
|
3468
1786
|
};
|
|
3469
1787
|
}
|
|
3470
1788
|
async saveBookmarks(e, {
|
|
3471
1789
|
bookmarks: t,
|
|
3472
1790
|
groups: s,
|
|
3473
|
-
users:
|
|
1791
|
+
users: r
|
|
3474
1792
|
}) {
|
|
3475
1793
|
this.cache.clearCache("/directory/sharebookmark/all");
|
|
3476
|
-
const
|
|
3477
|
-
if (typeof
|
|
3478
|
-
const { displayName:
|
|
1794
|
+
const i = r.map((p) => typeof p == "string" ? p : p.id), u = s.map((p) => typeof p == "string" ? p : p.id), a = t.map(async (p) => {
|
|
1795
|
+
if (typeof p == "string") {
|
|
1796
|
+
const { displayName: d, groups: g, id: A, users: m } = await this.getBookMarkById(p), b = m.map((F) => F.id), R = g.map((F) => F.id);
|
|
3479
1797
|
return {
|
|
3480
|
-
displayName:
|
|
3481
|
-
id:
|
|
3482
|
-
members: [...
|
|
1798
|
+
displayName: d,
|
|
1799
|
+
id: A,
|
|
1800
|
+
members: [...R, ...b]
|
|
3483
1801
|
};
|
|
3484
1802
|
} else
|
|
3485
|
-
return Promise.resolve(
|
|
3486
|
-
}),
|
|
1803
|
+
return Promise.resolve(p);
|
|
1804
|
+
}), h = (await Promise.all(a)).map((p) => p.members).reduce((p, d) => [...p, ...d], []), l = {
|
|
3487
1805
|
name: e,
|
|
3488
|
-
members: [...
|
|
3489
|
-
}, { id:
|
|
1806
|
+
members: [...i, ...u, ...h]
|
|
1807
|
+
}, { id: E } = await this.http.postJson(
|
|
3490
1808
|
"/directory/sharebookmark",
|
|
3491
|
-
|
|
1809
|
+
l
|
|
3492
1810
|
);
|
|
3493
1811
|
return {
|
|
3494
|
-
id:
|
|
1812
|
+
id: E,
|
|
3495
1813
|
displayName: e,
|
|
3496
|
-
members:
|
|
1814
|
+
members: l.members
|
|
3497
1815
|
};
|
|
3498
1816
|
}
|
|
3499
1817
|
}
|
|
@@ -3501,10 +1819,10 @@ const loadedScripts = {};
|
|
|
3501
1819
|
class HttpService {
|
|
3502
1820
|
constructor(e, t) {
|
|
3503
1821
|
// Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
1822
|
+
n(this, "axios");
|
|
1823
|
+
n(this, "baseUrl");
|
|
1824
|
+
n(this, "headers", {});
|
|
1825
|
+
n(this, "_latestResponse");
|
|
3508
1826
|
this.context = e, this.axios = axios.create(t);
|
|
3509
1827
|
}
|
|
3510
1828
|
fixBaseUrl(e) {
|
|
@@ -3549,15 +1867,15 @@ class HttpService {
|
|
|
3549
1867
|
status: 500,
|
|
3550
1868
|
statusText: ERROR_CODE.UNKNOWN
|
|
3551
1869
|
};
|
|
3552
|
-
const { status: s, statusText:
|
|
1870
|
+
const { status: s, statusText: r, headers: i, data: u } = this._latestResponse;
|
|
3553
1871
|
return t != null && t.disableNotifications || notify.events().publish(LAYER_NAME.TRANSPORT, {
|
|
3554
1872
|
name: EVENT_NAME.ERROR_OCCURED,
|
|
3555
1873
|
data: {
|
|
3556
1874
|
params: t,
|
|
3557
|
-
response: { status: s, statusText:
|
|
3558
|
-
payload:
|
|
1875
|
+
response: { status: s, statusText: r, headers: i },
|
|
1876
|
+
payload: u
|
|
3559
1877
|
}
|
|
3560
|
-
}),
|
|
1878
|
+
}), u;
|
|
3561
1879
|
}
|
|
3562
1880
|
mapAxiosResponse(e, t) {
|
|
3563
1881
|
return this._latestResponse = e, e.data;
|
|
@@ -3581,80 +1899,80 @@ class HttpService {
|
|
|
3581
1899
|
}
|
|
3582
1900
|
async post(e, t, s) {
|
|
3583
1901
|
try {
|
|
3584
|
-
const
|
|
1902
|
+
const r = await this.axios.post(
|
|
3585
1903
|
this.fixBaseUrl(e),
|
|
3586
1904
|
t,
|
|
3587
1905
|
this.toAxiosConfig(s)
|
|
3588
1906
|
);
|
|
3589
|
-
return this.mapAxiosResponse(
|
|
3590
|
-
} catch (
|
|
3591
|
-
throw this.mapAxiosError(
|
|
1907
|
+
return this.mapAxiosResponse(r, s);
|
|
1908
|
+
} catch (r) {
|
|
1909
|
+
throw this.mapAxiosError(r, s);
|
|
3592
1910
|
}
|
|
3593
1911
|
}
|
|
3594
1912
|
async postFile(e, t, s) {
|
|
3595
|
-
const
|
|
3596
|
-
|
|
1913
|
+
const r = this.toAxiosConfig(s);
|
|
1914
|
+
r.headers && r.headers["Content-Type"] && delete r.headers["Content-Type"];
|
|
3597
1915
|
try {
|
|
3598
|
-
const
|
|
3599
|
-
...
|
|
1916
|
+
const i = await this.axios.post(this.fixBaseUrl(e), t, {
|
|
1917
|
+
...r,
|
|
3600
1918
|
headers: {
|
|
3601
1919
|
"Content-Type": "multipart/form-data"
|
|
3602
1920
|
}
|
|
3603
1921
|
});
|
|
3604
|
-
return this.mapAxiosResponse(
|
|
3605
|
-
} catch (
|
|
3606
|
-
throw this.mapAxiosError(
|
|
1922
|
+
return this.mapAxiosResponse(i, s);
|
|
1923
|
+
} catch (i) {
|
|
1924
|
+
throw this.mapAxiosError(i, s);
|
|
3607
1925
|
}
|
|
3608
1926
|
}
|
|
3609
1927
|
async postJson(e, t, s) {
|
|
3610
|
-
const
|
|
3611
|
-
|
|
1928
|
+
const r = this.toAxiosConfig();
|
|
1929
|
+
r.headers && (r.headers["Content-Type"] = "application/json");
|
|
3612
1930
|
try {
|
|
3613
|
-
const
|
|
1931
|
+
const i = await this.axios.post(
|
|
3614
1932
|
this.fixBaseUrl(e),
|
|
3615
1933
|
t,
|
|
3616
1934
|
this.toAxiosConfig(s)
|
|
3617
1935
|
);
|
|
3618
|
-
return this.mapAxiosResponse(
|
|
3619
|
-
} catch (
|
|
3620
|
-
throw this.mapAxiosError(
|
|
1936
|
+
return this.mapAxiosResponse(i, s);
|
|
1937
|
+
} catch (i) {
|
|
1938
|
+
throw this.mapAxiosError(i, s);
|
|
3621
1939
|
}
|
|
3622
1940
|
}
|
|
3623
1941
|
async put(e, t, s) {
|
|
3624
1942
|
try {
|
|
3625
|
-
const
|
|
1943
|
+
const r = await this.axios.put(
|
|
3626
1944
|
this.fixBaseUrl(e),
|
|
3627
1945
|
t,
|
|
3628
1946
|
this.toAxiosConfig(s)
|
|
3629
1947
|
);
|
|
3630
|
-
return this.mapAxiosResponse(
|
|
3631
|
-
} catch (
|
|
3632
|
-
throw this.mapAxiosError(
|
|
1948
|
+
return this.mapAxiosResponse(r, s);
|
|
1949
|
+
} catch (r) {
|
|
1950
|
+
throw this.mapAxiosError(r, s);
|
|
3633
1951
|
}
|
|
3634
1952
|
}
|
|
3635
1953
|
async putFile(e, t, s) {
|
|
3636
1954
|
try {
|
|
3637
|
-
const
|
|
3638
|
-
|
|
3639
|
-
const
|
|
3640
|
-
...
|
|
1955
|
+
const r = this.toAxiosConfig(s);
|
|
1956
|
+
r.headers && r.headers["Content-Type"] && delete r.headers["Content-Type"];
|
|
1957
|
+
const i = await this.axios.put(this.fixBaseUrl(e), t, {
|
|
1958
|
+
...r,
|
|
3641
1959
|
headers: {
|
|
3642
1960
|
"Content-Type": "multipart/form-data"
|
|
3643
1961
|
}
|
|
3644
1962
|
});
|
|
3645
|
-
return this.mapAxiosResponse(
|
|
3646
|
-
} catch (
|
|
3647
|
-
throw this.mapAxiosError(
|
|
1963
|
+
return this.mapAxiosResponse(i, s);
|
|
1964
|
+
} catch (r) {
|
|
1965
|
+
throw this.mapAxiosError(r, s);
|
|
3648
1966
|
}
|
|
3649
1967
|
}
|
|
3650
1968
|
async putJson(e, t, s) {
|
|
3651
|
-
const
|
|
3652
|
-
|
|
1969
|
+
const r = this.toAxiosConfig(s);
|
|
1970
|
+
r.headers && (r.headers["Content-Type"] = "application/json");
|
|
3653
1971
|
try {
|
|
3654
|
-
const
|
|
3655
|
-
return this.mapAxiosResponse(
|
|
3656
|
-
} catch (
|
|
3657
|
-
throw this.mapAxiosError(
|
|
1972
|
+
const i = await this.axios.put(this.fixBaseUrl(e), t, r);
|
|
1973
|
+
return this.mapAxiosResponse(i, s);
|
|
1974
|
+
} catch (i) {
|
|
1975
|
+
throw this.mapAxiosError(i, s);
|
|
3658
1976
|
}
|
|
3659
1977
|
}
|
|
3660
1978
|
async delete(e, t) {
|
|
@@ -3679,16 +1997,16 @@ class HttpService {
|
|
|
3679
1997
|
}
|
|
3680
1998
|
}
|
|
3681
1999
|
getScript(e, t, s) {
|
|
3682
|
-
const
|
|
3683
|
-
return
|
|
2000
|
+
const r = s ?? "exports", i = this.toAxiosConfig(t);
|
|
2001
|
+
return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((u) => this.mapAxiosResponse(u, t)).then((u) => {
|
|
3684
2002
|
try {
|
|
3685
|
-
const
|
|
3686
|
-
return Function(
|
|
2003
|
+
const a = `"use strict";var ${r.split(".")[0]}={};${u};return ${r};`;
|
|
2004
|
+
return Function(a)();
|
|
3687
2005
|
} catch {
|
|
3688
|
-
return
|
|
2006
|
+
return u;
|
|
3689
2007
|
}
|
|
3690
|
-
}).catch((
|
|
3691
|
-
throw this.mapAxiosError(
|
|
2008
|
+
}).catch((u) => {
|
|
2009
|
+
throw this.mapAxiosError(u, t), u;
|
|
3692
2010
|
});
|
|
3693
2011
|
}
|
|
3694
2012
|
loadScript(e, t) {
|
|
@@ -3747,14 +2065,14 @@ class RightService {
|
|
|
3747
2065
|
* @param rights array of Right for the resource
|
|
3748
2066
|
* @returns true if has rights
|
|
3749
2067
|
*/
|
|
3750
|
-
hasResourceRight({ id: e, groupIds: t }, s,
|
|
3751
|
-
const
|
|
3752
|
-
for (const
|
|
3753
|
-
if (
|
|
2068
|
+
hasResourceRight({ id: e, groupIds: t }, s, r) {
|
|
2069
|
+
const i = r.map((u) => typeof u == "string" ? this.parseResourceRight(u) : u).filter((u) => u !== void 0);
|
|
2070
|
+
for (const u of i) {
|
|
2071
|
+
if (u.id === e && u.type === "creator")
|
|
3754
2072
|
return !0;
|
|
3755
|
-
if (
|
|
2073
|
+
if (u.id === e && u.type === "user" && u.right === s)
|
|
3756
2074
|
return !0;
|
|
3757
|
-
if (t.includes(
|
|
2075
|
+
if (t.includes(u.id) && u.type === "group" && u.right === s)
|
|
3758
2076
|
return !0;
|
|
3759
2077
|
}
|
|
3760
2078
|
return !1;
|
|
@@ -3797,8 +2115,8 @@ class RightService {
|
|
|
3797
2115
|
*/
|
|
3798
2116
|
async sessionHasResourceRightForEachList(e, t) {
|
|
3799
2117
|
let s = 0;
|
|
3800
|
-
for (const
|
|
3801
|
-
await this.sessionHasResourceRight(e,
|
|
2118
|
+
for (const r of t)
|
|
2119
|
+
await this.sessionHasResourceRight(e, r) && s++;
|
|
3802
2120
|
return s === t.length;
|
|
3803
2121
|
}
|
|
3804
2122
|
/**
|
|
@@ -3809,10 +2127,10 @@ class RightService {
|
|
|
3809
2127
|
*/
|
|
3810
2128
|
async sessionHasAtLeastOneResourceRightForEachList(e, t) {
|
|
3811
2129
|
for (const s of e) {
|
|
3812
|
-
let
|
|
3813
|
-
for (const
|
|
3814
|
-
await this.sessionHasResourceRight(s,
|
|
3815
|
-
if (
|
|
2130
|
+
let r = 0;
|
|
2131
|
+
for (const i of t)
|
|
2132
|
+
await this.sessionHasResourceRight(s, i) && r++;
|
|
2133
|
+
if (r === t.length)
|
|
3816
2134
|
return !0;
|
|
3817
2135
|
}
|
|
3818
2136
|
return !1;
|
|
@@ -3845,17 +2163,17 @@ class RightService {
|
|
|
3845
2163
|
const t = {};
|
|
3846
2164
|
try {
|
|
3847
2165
|
const s = await this.session.getUser();
|
|
3848
|
-
for (const
|
|
3849
|
-
t[
|
|
3850
|
-
|
|
2166
|
+
for (const r of e)
|
|
2167
|
+
t[r] = !!s && this.hasWorkflowRight(
|
|
2168
|
+
r,
|
|
3851
2169
|
s.authorizedActions.map(
|
|
3852
|
-
(
|
|
2170
|
+
(i) => i.name
|
|
3853
2171
|
)
|
|
3854
2172
|
);
|
|
3855
2173
|
} catch (s) {
|
|
3856
2174
|
console.error(`Unexpected error ${s} in sessionHasWorkflowRights()`);
|
|
3857
|
-
for (const
|
|
3858
|
-
t[
|
|
2175
|
+
for (const r of e)
|
|
2176
|
+
t[r] = !1;
|
|
3859
2177
|
}
|
|
3860
2178
|
return t;
|
|
3861
2179
|
}
|
|
@@ -3889,9 +2207,9 @@ class SessionService {
|
|
|
3889
2207
|
const e = await this.getUser(), [
|
|
3890
2208
|
t,
|
|
3891
2209
|
s,
|
|
2210
|
+
r,
|
|
3892
2211
|
i,
|
|
3893
|
-
u
|
|
3894
|
-
c
|
|
2212
|
+
u
|
|
3895
2213
|
] = await Promise.all([
|
|
3896
2214
|
this.getCurrentLanguage(e),
|
|
3897
2215
|
this.latestQuotaAndUsage(e),
|
|
@@ -3903,14 +2221,14 @@ class SessionService {
|
|
|
3903
2221
|
user: e,
|
|
3904
2222
|
quotaAndUsage: s,
|
|
3905
2223
|
currentLanguage: t,
|
|
3906
|
-
userDescription:
|
|
3907
|
-
userProfile:
|
|
3908
|
-
bookmarkedApps:
|
|
2224
|
+
userDescription: r,
|
|
2225
|
+
userProfile: i,
|
|
2226
|
+
bookmarkedApps: u
|
|
3909
2227
|
};
|
|
3910
2228
|
}
|
|
3911
|
-
login(e, t, s,
|
|
3912
|
-
const
|
|
3913
|
-
return
|
|
2229
|
+
login(e, t, s, r) {
|
|
2230
|
+
const i = new FormData();
|
|
2231
|
+
return i.append("email", e), i.append("password", t), typeof s < "u" && i.append("rememberMe", "" + s), typeof r < "u" && i.append("secureLocation", "" + r), this.http.post("/auth/login", i, {
|
|
3914
2232
|
headers: { "content-type": "application/x-www-form-urlencoded" }
|
|
3915
2233
|
}).finally(() => {
|
|
3916
2234
|
switch (this.http.latestResponse.status) {
|
|
@@ -3993,26 +2311,26 @@ class SessionService {
|
|
|
3993
2311
|
const t = await this.http.get("/userbook/preference/apps");
|
|
3994
2312
|
t.preference || (t.preference = null);
|
|
3995
2313
|
const s = JSON.parse(t.preference);
|
|
3996
|
-
let
|
|
3997
|
-
|
|
2314
|
+
let r;
|
|
2315
|
+
r = s, r || (r = {
|
|
3998
2316
|
bookmarks: [],
|
|
3999
2317
|
applications: []
|
|
4000
2318
|
});
|
|
4001
|
-
const
|
|
4002
|
-
return
|
|
4003
|
-
const
|
|
4004
|
-
(
|
|
2319
|
+
const i = [];
|
|
2320
|
+
return r.bookmarks.forEach((u, a) => {
|
|
2321
|
+
const c = ((e == null ? void 0 : e.apps) || []).find(
|
|
2322
|
+
(h) => h.name === u
|
|
4005
2323
|
);
|
|
4006
|
-
if (
|
|
4007
|
-
const
|
|
4008
|
-
|
|
2324
|
+
if (c) {
|
|
2325
|
+
const h = Object.assign({}, c);
|
|
2326
|
+
i.push(h);
|
|
4009
2327
|
}
|
|
4010
|
-
}),
|
|
2328
|
+
}), i;
|
|
4011
2329
|
}
|
|
4012
2330
|
async getUserProfile(e = {}) {
|
|
4013
|
-
var
|
|
4014
|
-
const { options: t = {}, params: s = {} } = e,
|
|
4015
|
-
return
|
|
2331
|
+
var c, h;
|
|
2332
|
+
const { options: t = {}, params: s = {} } = e, r = new URLSearchParams(s).toString(), i = `/userbook/api/person${r ? `?${r}` : ""}`, { response: u, value: a } = await this.cache.httpGet(i, t);
|
|
2333
|
+
return u.status < 200 || u.status >= 300 || typeof a == "string" ? ["Guest"] : ((h = (c = a == null ? void 0 : a.result) == null ? void 0 : c[0]) == null ? void 0 : h.type) || ["Guest"];
|
|
4016
2334
|
}
|
|
4017
2335
|
async isAdml() {
|
|
4018
2336
|
const e = await this.getUser();
|
|
@@ -4025,8 +2343,8 @@ class SessionService {
|
|
|
4025
2343
|
async getWebApp(e) {
|
|
4026
2344
|
const t = await this.getUser();
|
|
4027
2345
|
return t == null ? void 0 : t.apps.find((s) => {
|
|
4028
|
-
var
|
|
4029
|
-
return s != null && s.prefix ? (s == null ? void 0 : s.prefix.replace("/", "")) === e || !1 : s != null && s.address && ((
|
|
2346
|
+
var r;
|
|
2347
|
+
return s != null && s.prefix ? (s == null ? void 0 : s.prefix.replace("/", "")) === e || !1 : s != null && s.address && ((r = s.address) == null ? void 0 : r.split("/")[1]) === e || !1;
|
|
4030
2348
|
});
|
|
4031
2349
|
}
|
|
4032
2350
|
}
|
|
@@ -4057,42 +2375,42 @@ class ShareService {
|
|
|
4057
2375
|
return this.context.cache();
|
|
4058
2376
|
}
|
|
4059
2377
|
async searchShareSubjects(e, t, s) {
|
|
4060
|
-
const
|
|
2378
|
+
const r = StringUtils.removeAccents(s).toLowerCase(), i = await this.cache.httpGetJson(
|
|
4061
2379
|
`/${e}/share/json/${t}?search=${s}`
|
|
4062
|
-
),
|
|
4063
|
-
const
|
|
4064
|
-
|
|
4065
|
-
).toLowerCase(),
|
|
4066
|
-
|
|
4067
|
-
).toLowerCase(),
|
|
4068
|
-
|
|
4069
|
-
).toLowerCase(),
|
|
4070
|
-
return
|
|
4071
|
-
}).map((
|
|
4072
|
-
avatarUrl: this.directory.getAvatarUrl(
|
|
4073
|
-
directoryUrl: this.directory.getDirectoryUrl(
|
|
4074
|
-
displayName:
|
|
4075
|
-
id:
|
|
4076
|
-
profile:
|
|
2380
|
+
), u = i.users.visibles.filter(({ username: l, firstName: E, lastName: p, login: d }) => {
|
|
2381
|
+
const g = StringUtils.removeAccents(
|
|
2382
|
+
p || ""
|
|
2383
|
+
).toLowerCase(), A = StringUtils.removeAccents(
|
|
2384
|
+
E || ""
|
|
2385
|
+
).toLowerCase(), m = StringUtils.removeAccents(
|
|
2386
|
+
l || ""
|
|
2387
|
+
).toLowerCase(), b = StringUtils.removeAccents(d || "").toLowerCase();
|
|
2388
|
+
return m.includes(r) || A.includes(r) || g.includes(r) || b.includes(r);
|
|
2389
|
+
}).map((l) => ({
|
|
2390
|
+
avatarUrl: this.directory.getAvatarUrl(l.id, "user"),
|
|
2391
|
+
directoryUrl: this.directory.getDirectoryUrl(l.id, "user"),
|
|
2392
|
+
displayName: l.username,
|
|
2393
|
+
id: l.id,
|
|
2394
|
+
profile: l.profile,
|
|
4077
2395
|
type: "user"
|
|
4078
|
-
})),
|
|
4079
|
-
avatarUrl: this.directory.getAvatarUrl(
|
|
4080
|
-
directoryUrl: this.directory.getDirectoryUrl(
|
|
4081
|
-
displayName:
|
|
4082
|
-
id:
|
|
2396
|
+
})), a = i.groups.visibles.filter(({ name: l }) => StringUtils.removeAccents(l || "").toLowerCase().includes(r)).map((l) => ({
|
|
2397
|
+
avatarUrl: this.directory.getAvatarUrl(l.id, "group"),
|
|
2398
|
+
directoryUrl: this.directory.getDirectoryUrl(l.id, "group"),
|
|
2399
|
+
displayName: l.name,
|
|
2400
|
+
id: l.id,
|
|
4083
2401
|
type: "group",
|
|
4084
|
-
structureName:
|
|
2402
|
+
structureName: l.structureName
|
|
4085
2403
|
}));
|
|
4086
|
-
return [...(await this.directory.getBookMarks()).filter(({ displayName:
|
|
4087
|
-
|
|
4088
|
-
).toLowerCase().includes(
|
|
2404
|
+
return [...(await this.directory.getBookMarks()).filter(({ displayName: l }) => StringUtils.removeAccents(
|
|
2405
|
+
l || ""
|
|
2406
|
+
).toLowerCase().includes(r)).map((l) => ({
|
|
4089
2407
|
avatarUrl: "",
|
|
4090
2408
|
directoryUrl: "",
|
|
4091
2409
|
profile: "",
|
|
4092
|
-
displayName:
|
|
4093
|
-
id:
|
|
2410
|
+
displayName: l.displayName,
|
|
2411
|
+
id: l.id,
|
|
4094
2412
|
type: "sharebookmark"
|
|
4095
|
-
})), ...
|
|
2413
|
+
})), ...u, ...a];
|
|
4096
2414
|
}
|
|
4097
2415
|
async getShareMapping(e) {
|
|
4098
2416
|
const t = await this.cache.httpGetJson(
|
|
@@ -4100,292 +2418,162 @@ class ShareService {
|
|
|
4100
2418
|
);
|
|
4101
2419
|
for (const s of Object.keys(t))
|
|
4102
2420
|
if (s.includes(".")) {
|
|
4103
|
-
const
|
|
4104
|
-
delete t[s], t[
|
|
2421
|
+
const r = s.split(".")[1], i = t[s];
|
|
2422
|
+
delete t[s], t[r] = i;
|
|
4105
2423
|
}
|
|
4106
2424
|
return t;
|
|
4107
2425
|
}
|
|
4108
|
-
getActionsAvailableFor({ id: e, type: t }, s,
|
|
4109
|
-
const
|
|
4110
|
-
for (const
|
|
4111
|
-
|
|
4112
|
-
(
|
|
4113
|
-
).length > 0 &&
|
|
4114
|
-
return
|
|
2426
|
+
getActionsAvailableFor({ id: e, type: t }, s, r) {
|
|
2427
|
+
const u = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], a = Object.keys(r), c = [];
|
|
2428
|
+
for (const h of a)
|
|
2429
|
+
r[h].filter(
|
|
2430
|
+
(p) => u.includes(p)
|
|
2431
|
+
).length > 0 && c.push(h);
|
|
2432
|
+
return c;
|
|
4115
2433
|
}
|
|
4116
2434
|
async getRightsForResource(e, t) {
|
|
4117
|
-
const s = await this.directory.getBookMarks(),
|
|
2435
|
+
const s = await this.directory.getBookMarks(), r = `/${e}/share/json/${t}?search=`, i = await this.cache.httpGetJson(r), u = await this.getShareMapping(e), a = await this.cache.httpGetJson(
|
|
4118
2436
|
"/infra/public/json/sharing-rights.json"
|
|
4119
|
-
),
|
|
4120
|
-
(
|
|
4121
|
-
)).filter((
|
|
4122
|
-
const
|
|
4123
|
-
{ id:
|
|
4124
|
-
|
|
4125
|
-
|
|
2437
|
+
), c = Object.keys(i.users.checked).map((d) => i.users.visibles.find(
|
|
2438
|
+
(A) => A.id === d
|
|
2439
|
+
)).filter((d) => d !== void 0).map((d) => {
|
|
2440
|
+
const g = this.getActionsAvailableFor(
|
|
2441
|
+
{ id: d.id, type: "user" },
|
|
2442
|
+
i,
|
|
2443
|
+
u
|
|
4126
2444
|
);
|
|
4127
2445
|
return {
|
|
4128
|
-
id:
|
|
2446
|
+
id: d.id,
|
|
4129
2447
|
type: "user",
|
|
4130
|
-
displayName:
|
|
4131
|
-
profile:
|
|
4132
|
-
avatarUrl: this.directory.getAvatarUrl(
|
|
4133
|
-
directoryUrl: this.directory.getDirectoryUrl(
|
|
4134
|
-
actions:
|
|
4135
|
-
const
|
|
2448
|
+
displayName: d.username,
|
|
2449
|
+
profile: d.profile,
|
|
2450
|
+
avatarUrl: this.directory.getAvatarUrl(d.id, "user"),
|
|
2451
|
+
directoryUrl: this.directory.getDirectoryUrl(d.id, "user"),
|
|
2452
|
+
actions: g.map((m) => {
|
|
2453
|
+
const b = a[m];
|
|
4136
2454
|
return {
|
|
4137
|
-
displayName:
|
|
4138
|
-
id:
|
|
4139
|
-
priority:
|
|
2455
|
+
displayName: m,
|
|
2456
|
+
id: m,
|
|
2457
|
+
priority: b.priority
|
|
4140
2458
|
};
|
|
4141
2459
|
})
|
|
4142
2460
|
};
|
|
4143
|
-
}).sort((
|
|
4144
|
-
(
|
|
4145
|
-
)).filter((
|
|
4146
|
-
const
|
|
4147
|
-
{ id:
|
|
4148
|
-
|
|
4149
|
-
|
|
2461
|
+
}).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), h = Object.keys(i.groups.checked).map((d) => i.groups.visibles.find(
|
|
2462
|
+
(A) => A.id === d
|
|
2463
|
+
)).filter((d) => d !== void 0).map((d) => {
|
|
2464
|
+
const g = this.getActionsAvailableFor(
|
|
2465
|
+
{ id: d.id, type: "group" },
|
|
2466
|
+
i,
|
|
2467
|
+
u
|
|
4150
2468
|
);
|
|
4151
2469
|
return {
|
|
4152
|
-
id:
|
|
2470
|
+
id: d.id,
|
|
4153
2471
|
type: "group",
|
|
4154
|
-
displayName:
|
|
2472
|
+
displayName: d.name,
|
|
4155
2473
|
profile: void 0,
|
|
4156
|
-
avatarUrl: this.directory.getAvatarUrl(
|
|
4157
|
-
directoryUrl: this.directory.getDirectoryUrl(
|
|
4158
|
-
actions:
|
|
4159
|
-
const
|
|
2474
|
+
avatarUrl: this.directory.getAvatarUrl(d.id, "group"),
|
|
2475
|
+
directoryUrl: this.directory.getDirectoryUrl(d.id, "group"),
|
|
2476
|
+
actions: g.map((m) => {
|
|
2477
|
+
const b = a[m];
|
|
4160
2478
|
return {
|
|
4161
|
-
displayName:
|
|
4162
|
-
id:
|
|
4163
|
-
priority:
|
|
2479
|
+
displayName: m,
|
|
2480
|
+
id: m,
|
|
2481
|
+
priority: b.priority
|
|
4164
2482
|
};
|
|
4165
2483
|
})
|
|
4166
2484
|
};
|
|
4167
|
-
}).sort((
|
|
4168
|
-
({ groupDisplayName:
|
|
4169
|
-
displayName:
|
|
4170
|
-
id:
|
|
2485
|
+
}).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), l = [...c, ...h], E = i.groups.visibles.map(
|
|
2486
|
+
({ groupDisplayName: d, id: g, name: A }) => ({
|
|
2487
|
+
displayName: d || A,
|
|
2488
|
+
id: g
|
|
4171
2489
|
})
|
|
4172
|
-
),
|
|
4173
|
-
({ id:
|
|
4174
|
-
displayName:
|
|
4175
|
-
firstName:
|
|
4176
|
-
lastName:
|
|
4177
|
-
login:
|
|
4178
|
-
profile:
|
|
4179
|
-
id:
|
|
2490
|
+
), p = i.users.visibles.map(
|
|
2491
|
+
({ id: d, profile: g, username: A, firstName: m, lastName: b, login: R }) => ({
|
|
2492
|
+
displayName: A,
|
|
2493
|
+
firstName: m,
|
|
2494
|
+
lastName: b,
|
|
2495
|
+
login: R,
|
|
2496
|
+
profile: g,
|
|
2497
|
+
id: d
|
|
4180
2498
|
})
|
|
4181
2499
|
);
|
|
4182
2500
|
return {
|
|
4183
|
-
rights:
|
|
2501
|
+
rights: l,
|
|
4184
2502
|
visibleBookmarks: s,
|
|
4185
|
-
visibleGroups:
|
|
4186
|
-
visibleUsers:
|
|
2503
|
+
visibleGroups: E,
|
|
2504
|
+
visibleUsers: p
|
|
4187
2505
|
};
|
|
4188
2506
|
}
|
|
4189
2507
|
async saveRights(e, t, s) {
|
|
4190
|
-
const
|
|
2508
|
+
const r = await this.getShareMapping(e), i = {
|
|
4191
2509
|
bookmarks: {},
|
|
4192
2510
|
groups: {},
|
|
4193
2511
|
users: {}
|
|
4194
2512
|
};
|
|
4195
|
-
for (const
|
|
4196
|
-
const
|
|
4197
|
-
|
|
2513
|
+
for (const c of s) {
|
|
2514
|
+
const h = c.actions.map((E) => r[E.id]).reduce((E, p) => Array.isArray(p) ? [...E, ...p] : E, []), l = [...new Set(h)];
|
|
2515
|
+
l.length > 0 && (c.type === "user" ? i.users[c.id] = l : c.type === "group" ? i.groups[c.id] = l : i.bookmarks[c.id] = l);
|
|
4198
2516
|
}
|
|
4199
|
-
const
|
|
4200
|
-
return this.cache.clearCache(`/${e}/share/json/${t}?search=`), await this.http.putJson(
|
|
2517
|
+
const u = `/${e}/share/resource/${t}`;
|
|
2518
|
+
return this.cache.clearCache(`/${e}/share/json/${t}?search=`), await this.http.putJson(u, i);
|
|
4201
2519
|
}
|
|
4202
2520
|
async getActionsForApp(e) {
|
|
4203
2521
|
const t = await this.cache.httpGetJson(
|
|
4204
2522
|
"/infra/public/json/sharing-rights.json"
|
|
4205
2523
|
), s = await this.getShareMapping(e);
|
|
4206
|
-
return Object.keys(t).map((
|
|
4207
|
-
const
|
|
2524
|
+
return Object.keys(t).map((i) => {
|
|
2525
|
+
const u = t[i];
|
|
4208
2526
|
return {
|
|
4209
|
-
displayName:
|
|
4210
|
-
id:
|
|
4211
|
-
priority:
|
|
4212
|
-
requires:
|
|
2527
|
+
displayName: i,
|
|
2528
|
+
id: i,
|
|
2529
|
+
priority: u.priority,
|
|
2530
|
+
requires: u.requires
|
|
4213
2531
|
};
|
|
4214
|
-
}).filter((
|
|
4215
|
-
var
|
|
4216
|
-
return ((
|
|
4217
|
-
}).sort((
|
|
2532
|
+
}).filter((i) => {
|
|
2533
|
+
var u;
|
|
2534
|
+
return ((u = s[i.id]) == null ? void 0 : u.length) > 0;
|
|
2535
|
+
}).sort((i, u) => i.priority - u.priority);
|
|
4218
2536
|
}
|
|
4219
2537
|
}
|
|
4220
|
-
var p = Object.defineProperty, d = (r, e, t) => e in r ? p(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, n = (r, e, t) => d(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4221
|
-
const o = class {
|
|
4222
|
-
constructor() {
|
|
4223
|
-
n(this, "wordExtensions", /* @__PURE__ */ new Set()), n(this, "excelExtensions", /* @__PURE__ */ new Set()), n(this, "pptExtensions", /* @__PURE__ */ new Set()), n(this, "fileExtensionMap", /* @__PURE__ */ new Map()), n(this, "csvContentType", /* @__PURE__ */ new Set()), n(this, "csvExtensions", /* @__PURE__ */ new Set()), n(this, "txtExtensions", /* @__PURE__ */ new Set()), n(this, "mdExtensions", /* @__PURE__ */ new Set()), n(this, "PDF", "application/pdf"), n(this, "OCTET_STREAM", "application/octet-stream"), this.txtExtensions.add("txt"), this.mdExtensions.add("md"), this.wordExtensions.add("doc"), this.wordExtensions.add("dot"), this.wordExtensions.add("docx"), this.wordExtensions.add("dotx"), this.wordExtensions.add("docm"), this.wordExtensions.add("dotm"), this.wordExtensions.add("odt"), this.wordExtensions.add("ott"), this.wordExtensions.add("oth"), this.wordExtensions.add("odm"), this.excelExtensions.add("xls"), this.excelExtensions.add("xlt"), this.excelExtensions.add("xla"), this.excelExtensions.add("xlsx"), this.excelExtensions.add("xltx"), this.excelExtensions.add("xlsm"), this.excelExtensions.add("xltm"), this.excelExtensions.add("xlam"), this.excelExtensions.add("xlsb"), this.excelExtensions.add("ods"), this.excelExtensions.add("ots"), this.pptExtensions.add("ppt"), this.pptExtensions.add("pot"), this.pptExtensions.add("pps"), this.pptExtensions.add("ppa"), this.pptExtensions.add("pptx"), this.pptExtensions.add("potx"), this.pptExtensions.add("ppsx"), this.pptExtensions.add("ppam"), this.pptExtensions.add("pptm"), this.pptExtensions.add("potm"), this.pptExtensions.add("ppsm"), this.pptExtensions.add("odp"), this.pptExtensions.add("otp"), this.csvExtensions.add("csv"), this.fileExtensionMap.set("doc", "application/msword"), this.fileExtensionMap.set("dot", "application/msword"), this.fileExtensionMap.set(
|
|
4224
|
-
"docx",
|
|
4225
|
-
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
4226
|
-
), this.fileExtensionMap.set(
|
|
4227
|
-
"dotx",
|
|
4228
|
-
"application/vnd.openxmlformats-officedocument.wordprocessingml.template"
|
|
4229
|
-
), this.fileExtensionMap.set(
|
|
4230
|
-
"docm",
|
|
4231
|
-
"application/vnd.ms-word.document.macroEnabled.12"
|
|
4232
|
-
), this.fileExtensionMap.set(
|
|
4233
|
-
"dotm",
|
|
4234
|
-
"application/vnd.ms-word.template.macroEnabled.12"
|
|
4235
|
-
), this.fileExtensionMap.set("xls", "application/vnd.ms-excel"), this.fileExtensionMap.set("xlt", "application/vnd.ms-excel"), this.fileExtensionMap.set("xla", "application/vnd.ms-excel"), this.fileExtensionMap.set(
|
|
4236
|
-
"xlsx",
|
|
4237
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
4238
|
-
), this.fileExtensionMap.set(
|
|
4239
|
-
"xltx",
|
|
4240
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.template"
|
|
4241
|
-
), this.fileExtensionMap.set(
|
|
4242
|
-
"xlsm",
|
|
4243
|
-
"application/vnd.ms-excel.sheet.macroEnabled.12"
|
|
4244
|
-
), this.fileExtensionMap.set(
|
|
4245
|
-
"xltm",
|
|
4246
|
-
"application/vnd.ms-excel.template.macroEnabled.12"
|
|
4247
|
-
), this.fileExtensionMap.set(
|
|
4248
|
-
"xlam",
|
|
4249
|
-
"application/vnd.ms-excel.addin.macroEnabled.12"
|
|
4250
|
-
), this.fileExtensionMap.set(
|
|
4251
|
-
"xlsb",
|
|
4252
|
-
"application/vnd.ms-excel.sheet.binary.macroEnabled.12"
|
|
4253
|
-
), this.fileExtensionMap.set("ppt", "application/vnd.ms-powerpoint"), this.fileExtensionMap.set("pot", "application/vnd.ms-powerpoint"), this.fileExtensionMap.set("pps", "application/vnd.ms-powerpoint"), this.fileExtensionMap.set("ppa", "application/vnd.ms-powerpoint"), this.fileExtensionMap.set(
|
|
4254
|
-
"pptx",
|
|
4255
|
-
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
4256
|
-
), this.fileExtensionMap.set(
|
|
4257
|
-
"potx",
|
|
4258
|
-
"application/vnd.openxmlformats-officedocument.presentationml.template"
|
|
4259
|
-
), this.fileExtensionMap.set(
|
|
4260
|
-
"ppsx",
|
|
4261
|
-
"application/vnd.openxmlformats-officedocument.presentationml.slideshow"
|
|
4262
|
-
), this.fileExtensionMap.set(
|
|
4263
|
-
"ppam",
|
|
4264
|
-
"application/vnd.ms-powerpoint.addin.macroEnabled.12"
|
|
4265
|
-
), this.fileExtensionMap.set(
|
|
4266
|
-
"pptm",
|
|
4267
|
-
"application/vnd.ms-powerpoint.presentation.macroEnabled.12"
|
|
4268
|
-
), this.fileExtensionMap.set(
|
|
4269
|
-
"potm",
|
|
4270
|
-
"application/vnd.ms-powerpoint.presentation.macroEnabled.12"
|
|
4271
|
-
), this.fileExtensionMap.set(
|
|
4272
|
-
"ppsm",
|
|
4273
|
-
"application/vnd.ms-powerpoint.slideshow.macroEnabled.12"
|
|
4274
|
-
), this.fileExtensionMap.set("odt", "application/vnd.oasis.opendocument.text"), this.fileExtensionMap.set(
|
|
4275
|
-
"ott",
|
|
4276
|
-
"application/vnd.oasis.opendocument.text-template"
|
|
4277
|
-
), this.fileExtensionMap.set(
|
|
4278
|
-
"oth",
|
|
4279
|
-
"application/vnd.oasis.opendocument.text-web"
|
|
4280
|
-
), this.fileExtensionMap.set(
|
|
4281
|
-
"odm",
|
|
4282
|
-
"application/vnd.oasis.opendocument.text-master"
|
|
4283
|
-
), this.fileExtensionMap.set(
|
|
4284
|
-
"odg",
|
|
4285
|
-
"application/vnd.oasis.opendocument.graphics"
|
|
4286
|
-
), this.fileExtensionMap.set(
|
|
4287
|
-
"otg",
|
|
4288
|
-
"application/vnd.oasis.opendocument.graphics-template"
|
|
4289
|
-
), this.fileExtensionMap.set(
|
|
4290
|
-
"odp",
|
|
4291
|
-
"application/vnd.oasis.opendocument.presentation"
|
|
4292
|
-
), this.fileExtensionMap.set(
|
|
4293
|
-
"otp",
|
|
4294
|
-
"application/vnd.oasis.opendocument.presentation-template"
|
|
4295
|
-
), this.fileExtensionMap.set(
|
|
4296
|
-
"ods",
|
|
4297
|
-
"application/vnd.oasis.opendocument.spreadsheet"
|
|
4298
|
-
), this.fileExtensionMap.set(
|
|
4299
|
-
"ots",
|
|
4300
|
-
"application/vnd.oasis.opendocument.spreadsheet-template"
|
|
4301
|
-
), this.fileExtensionMap.set(
|
|
4302
|
-
"odc",
|
|
4303
|
-
"application/vnd.oasis.opendocument.chart"
|
|
4304
|
-
), this.fileExtensionMap.set(
|
|
4305
|
-
"odf",
|
|
4306
|
-
"application/vnd.oasis.opendocument.formula"
|
|
4307
|
-
), this.fileExtensionMap.set(
|
|
4308
|
-
"odb",
|
|
4309
|
-
"application/vnd.oasis.opendocument.database"
|
|
4310
|
-
), this.fileExtensionMap.set(
|
|
4311
|
-
"odi",
|
|
4312
|
-
"application/vnd.oasis.opendocument.image"
|
|
4313
|
-
), this.fileExtensionMap.set("oxt", "application/vnd.openofficeorg.extension"), this.fileExtensionMap.set("txt", "text/plain"), this.fileExtensionMap.set("md", "text/markdown"), this.csvContentType.add("text/comma-separated-values"), this.csvContentType.add("text/csv"), this.csvContentType.add("application/csv");
|
|
4314
|
-
}
|
|
4315
|
-
getContentTypeForExtension(e) {
|
|
4316
|
-
return this.fileExtensionMap.has(e) ? this.fileExtensionMap.get(e) ?? null : null;
|
|
4317
|
-
}
|
|
4318
|
-
getExtensionForContentType(e) {
|
|
4319
|
-
for (const t of Array.from(this.fileExtensionMap.keys()))
|
|
4320
|
-
if ((this.fileExtensionMap.get(t) || "").toLowerCase() == (e || "").toLowerCase())
|
|
4321
|
-
return t;
|
|
4322
|
-
return null;
|
|
4323
|
-
}
|
|
4324
|
-
isWordLike(e, t) {
|
|
4325
|
-
const s = this.getExtensionForContentType(e);
|
|
4326
|
-
return s ? this.wordExtensions.has(s) : e == this.OCTET_STREAM && t ? this.wordExtensions.has(t) : !1;
|
|
4327
|
-
}
|
|
4328
|
-
isExcelLike(e, t) {
|
|
4329
|
-
const s = this.getExtensionForContentType(e);
|
|
4330
|
-
return s ? this.excelExtensions.has(s) : e == this.OCTET_STREAM && t ? this.excelExtensions.has(t) : !1;
|
|
4331
|
-
}
|
|
4332
|
-
isCsvLike(e, t) {
|
|
4333
|
-
return this.csvContentType.has(e) ? !0 : e == this.OCTET_STREAM && t ? this.csvExtensions.has(t) : !1;
|
|
4334
|
-
}
|
|
4335
|
-
isPowerpointLike(e, t) {
|
|
4336
|
-
const s = this.getExtensionForContentType(e);
|
|
4337
|
-
return s ? this.pptExtensions.has(s) : e == this.OCTET_STREAM && t ? this.pptExtensions.has(t) : !1;
|
|
4338
|
-
}
|
|
4339
|
-
isTxtLike(e, t) {
|
|
4340
|
-
const s = this.getExtensionForContentType(e);
|
|
4341
|
-
return s ? this.txtExtensions.has(s) : e == this.OCTET_STREAM && t ? this.txtExtensions.has(t) : !1;
|
|
4342
|
-
}
|
|
4343
|
-
isMdLike(e, t) {
|
|
4344
|
-
const s = this.getExtensionForContentType(e);
|
|
4345
|
-
return s ? this.mdExtensions.has(s) : e == this.OCTET_STREAM && t ? this.mdExtensions.has(t) : !1;
|
|
4346
|
-
}
|
|
4347
|
-
};
|
|
4348
|
-
n(o, "INSTANCE", new o());
|
|
4349
|
-
let a = o;
|
|
4350
2538
|
const defaultMappers = {
|
|
4351
|
-
csv: function({ type:
|
|
4352
|
-
return
|
|
2539
|
+
csv: function({ type: o, extension: e }) {
|
|
2540
|
+
return MimeTypeUtils.INSTANCE.isCsvLike(o, e);
|
|
4353
2541
|
},
|
|
4354
|
-
doc: function({ type:
|
|
4355
|
-
return
|
|
2542
|
+
doc: function({ type: o, extension: e }) {
|
|
2543
|
+
return MimeTypeUtils.INSTANCE.isWordLike(o, e) ? !0 : o.indexOf("document") !== -1 && o.indexOf("wordprocessing") !== -1;
|
|
4356
2544
|
},
|
|
4357
|
-
xls: function({ type:
|
|
4358
|
-
return
|
|
2545
|
+
xls: function({ type: o, extension: e }) {
|
|
2546
|
+
return MimeTypeUtils.INSTANCE.isExcelLike(o, e) ? !0 : o.indexOf("document") !== -1 && o.indexOf("spreadsheet") !== -1 || o.indexOf("ms-excel") !== -1;
|
|
4359
2547
|
},
|
|
4360
|
-
img: function({ type:
|
|
4361
|
-
return
|
|
2548
|
+
img: function({ type: o }) {
|
|
2549
|
+
return o.indexOf("image") !== -1;
|
|
4362
2550
|
},
|
|
4363
|
-
pdf: function({ type:
|
|
4364
|
-
return
|
|
2551
|
+
pdf: function({ type: o }) {
|
|
2552
|
+
return o.indexOf("pdf") !== -1 || o === "application/x-download";
|
|
4365
2553
|
},
|
|
4366
|
-
ppt: function({ type:
|
|
4367
|
-
return
|
|
2554
|
+
ppt: function({ type: o, extension: e }) {
|
|
2555
|
+
return MimeTypeUtils.INSTANCE.isPowerpointLike(o, e) ? !0 : o.indexOf("document") !== -1 && o.indexOf("presentation") !== -1 || o.indexOf("powerpoint") !== -1;
|
|
4368
2556
|
},
|
|
4369
|
-
txt: function({ type:
|
|
4370
|
-
return
|
|
2557
|
+
txt: function({ type: o, extension: e }) {
|
|
2558
|
+
return MimeTypeUtils.INSTANCE.isTxtLike(o, e);
|
|
4371
2559
|
},
|
|
4372
|
-
md: function({ type:
|
|
4373
|
-
return
|
|
2560
|
+
md: function({ type: o, extension: e }) {
|
|
2561
|
+
return MimeTypeUtils.INSTANCE.isMdLike(o, e);
|
|
4374
2562
|
},
|
|
4375
|
-
video: function({ type:
|
|
4376
|
-
return
|
|
2563
|
+
video: function({ type: o }) {
|
|
2564
|
+
return o.indexOf("video") !== -1;
|
|
4377
2565
|
},
|
|
4378
|
-
audio: function({ type:
|
|
4379
|
-
return
|
|
2566
|
+
audio: function({ type: o }) {
|
|
2567
|
+
return o.indexOf("audio") !== -1;
|
|
4380
2568
|
},
|
|
4381
|
-
zip: function({ type:
|
|
4382
|
-
return
|
|
2569
|
+
zip: function({ type: o }) {
|
|
2570
|
+
return o.indexOf("zip") !== -1 || o.indexOf("rar") !== -1 || o.indexOf("tar") !== -1 || o.indexOf("7z") !== -1;
|
|
4383
2571
|
}
|
|
4384
|
-
},
|
|
2572
|
+
}, w = class w {
|
|
4385
2573
|
/* Similar role notion as in infra-front > workspace > Model.ts */
|
|
4386
2574
|
static getRole(e) {
|
|
4387
2575
|
var t, s;
|
|
4388
|
-
return
|
|
2576
|
+
return w.role(
|
|
4389
2577
|
(t = e.metadata) == null ? void 0 : t["content-type"],
|
|
4390
2578
|
!1,
|
|
4391
2579
|
(s = e.metadata) == null ? void 0 : s.extension
|
|
@@ -4395,20 +2583,20 @@ const defaultMappers = {
|
|
|
4395
2583
|
static role(e, t = !1, s) {
|
|
4396
2584
|
if (s && (s = s.trim()), !e) return "unknown";
|
|
4397
2585
|
this.roleMappers || console.warn("[DocumentHelper.role] should not have empty roles", this);
|
|
4398
|
-
const
|
|
4399
|
-
for (const
|
|
4400
|
-
const
|
|
4401
|
-
if (
|
|
4402
|
-
return
|
|
2586
|
+
const r = { type: e, previewRole: t, extension: s };
|
|
2587
|
+
for (const i of this.roleMappers) {
|
|
2588
|
+
const u = i(r);
|
|
2589
|
+
if (u)
|
|
2590
|
+
return u;
|
|
4403
2591
|
}
|
|
4404
2592
|
return "unknown";
|
|
4405
2593
|
}
|
|
4406
2594
|
};
|
|
4407
2595
|
// FIXME add edumedia support
|
|
4408
|
-
|
|
2596
|
+
n(w, "roleMappers", [
|
|
4409
2597
|
(e) => Object.keys(defaultMappers).find((s) => defaultMappers[s](e))
|
|
4410
2598
|
]);
|
|
4411
|
-
let DocumentHelper =
|
|
2599
|
+
let DocumentHelper = w;
|
|
4412
2600
|
class WorkspaceService {
|
|
4413
2601
|
constructor(e) {
|
|
4414
2602
|
this.context = e;
|
|
@@ -4417,40 +2605,40 @@ class WorkspaceService {
|
|
|
4417
2605
|
return this.context.http();
|
|
4418
2606
|
}
|
|
4419
2607
|
extractMetadata(e) {
|
|
4420
|
-
const t = e.name || "", s = t.split("."),
|
|
4421
|
-
"content-type":
|
|
2608
|
+
const t = e.name || "", s = t.split("."), r = e.type || "application/octet-stream", i = s.length > 1 ? s[s.length - 1] : "", u = {
|
|
2609
|
+
"content-type": r,
|
|
4422
2610
|
filename: t,
|
|
4423
2611
|
size: e.size,
|
|
4424
|
-
extension:
|
|
4425
|
-
role: DocumentHelper.role(
|
|
4426
|
-
},
|
|
4427
|
-
return { basename:
|
|
2612
|
+
extension: i,
|
|
2613
|
+
role: DocumentHelper.role(r, !1, i)
|
|
2614
|
+
}, a = t.replace("." + u.extension, ""), c = u.extension ? a + "." + u.extension : a;
|
|
2615
|
+
return { basename: a, fullname: c, metadata: u };
|
|
4428
2616
|
}
|
|
4429
2617
|
async saveFile(e, t) {
|
|
4430
|
-
const { fullname: s, metadata:
|
|
4431
|
-
|
|
4432
|
-
const
|
|
4433
|
-
((t == null ? void 0 : t.visibility) === "public" || (t == null ? void 0 : t.visibility) === "protected") &&
|
|
4434
|
-
const
|
|
4435
|
-
`/workspace/document?${
|
|
4436
|
-
|
|
2618
|
+
const { fullname: s, metadata: r } = this.extractMetadata(e), i = new FormData();
|
|
2619
|
+
i.append("file", e, s);
|
|
2620
|
+
const u = [];
|
|
2621
|
+
((t == null ? void 0 : t.visibility) === "public" || (t == null ? void 0 : t.visibility) === "protected") && u.push(`${t.visibility}=true`), t != null && t.application && u.push(`application=${t.application}`), r.role === "img" && u.push("quality=1"), t != null && t.parentId && u.push(`parentId=${t.parentId}`);
|
|
2622
|
+
const a = await this.http.postFile(
|
|
2623
|
+
`/workspace/document?${u.join("&")}`,
|
|
2624
|
+
i
|
|
4437
2625
|
);
|
|
4438
2626
|
if (this.http.isResponseError())
|
|
4439
2627
|
throw this.http.latestResponse.statusText;
|
|
4440
|
-
return
|
|
2628
|
+
return a;
|
|
4441
2629
|
}
|
|
4442
2630
|
async updateFile(e, t, s) {
|
|
4443
|
-
const { fullname:
|
|
4444
|
-
|
|
4445
|
-
const
|
|
4446
|
-
|
|
4447
|
-
const
|
|
4448
|
-
`/workspace/document/${e}?${
|
|
4449
|
-
|
|
2631
|
+
const { fullname: r, metadata: i } = this.extractMetadata(t), u = new FormData();
|
|
2632
|
+
u.append("file", t, r);
|
|
2633
|
+
const a = [];
|
|
2634
|
+
i.role === "img" && a.push("quality=1"), s != null && s.alt && a.push(`alt=${s.alt}`), s != null && s.legend && a.push(`legend=${s.legend}`), s != null && s.name && a.push(`name=${s.name}`);
|
|
2635
|
+
const c = await this.http.putFile(
|
|
2636
|
+
`/workspace/document/${e}?${a.join("&")}`,
|
|
2637
|
+
u
|
|
4450
2638
|
);
|
|
4451
2639
|
if (this.http.isResponseError())
|
|
4452
2640
|
throw this.http.latestResponse.statusText;
|
|
4453
|
-
return
|
|
2641
|
+
return c;
|
|
4454
2642
|
}
|
|
4455
2643
|
async deleteFile(e) {
|
|
4456
2644
|
const t = e.map((s) => s._id);
|
|
@@ -4482,26 +2670,26 @@ class WorkspaceService {
|
|
|
4482
2670
|
* @returns A Promise that resolves to an array of transferred WorkspaceElements.
|
|
4483
2671
|
*/
|
|
4484
2672
|
async transferDocuments(e, t, s = "protected") {
|
|
4485
|
-
const
|
|
4486
|
-
if (e.forEach((
|
|
4487
|
-
(s === "public" && !
|
|
4488
|
-
}),
|
|
4489
|
-
const
|
|
2673
|
+
const r = [];
|
|
2674
|
+
if (e.forEach((i) => {
|
|
2675
|
+
(s === "public" && !i.public || !i.public && !i.protected) && r.push(i);
|
|
2676
|
+
}), r.length > 0) {
|
|
2677
|
+
const i = await this.http.post(
|
|
4490
2678
|
"/workspace/documents/transfer",
|
|
4491
2679
|
{
|
|
4492
2680
|
application: t,
|
|
4493
2681
|
visibility: s,
|
|
4494
|
-
ids:
|
|
2682
|
+
ids: r.map((u) => u._id)
|
|
4495
2683
|
}
|
|
4496
2684
|
);
|
|
4497
2685
|
if (this.http.isResponseError())
|
|
4498
2686
|
throw this.http.latestResponse.statusText;
|
|
4499
|
-
return
|
|
4500
|
-
const
|
|
4501
|
-
(
|
|
2687
|
+
return r.forEach((u, a) => {
|
|
2688
|
+
const c = e.findIndex(
|
|
2689
|
+
(h) => h._id === u._id
|
|
4502
2690
|
);
|
|
4503
|
-
0 <=
|
|
4504
|
-
}), e.filter((
|
|
2691
|
+
0 <= c && c < e.length && (e[c] = i[a]);
|
|
2692
|
+
}), e.filter((u) => !!u);
|
|
4505
2693
|
}
|
|
4506
2694
|
return e;
|
|
4507
2695
|
}
|
|
@@ -4510,17 +2698,17 @@ class WorkspaceService {
|
|
|
4510
2698
|
* or `null` if none exists or can be created.
|
|
4511
2699
|
*/
|
|
4512
2700
|
getThumbnailUrl(e, t = 0, s = 0) {
|
|
4513
|
-
var
|
|
4514
|
-
const
|
|
2701
|
+
var i, u;
|
|
2702
|
+
const r = t > 0 || s > 0 ? `${t}x${s}` : "120x120";
|
|
4515
2703
|
if (typeof e == "string")
|
|
4516
|
-
return e.includes("data:image") || e.includes("thumbnail") ? e : `${e}${e.includes("?") ? "&" : "?"}thumbnail=${
|
|
2704
|
+
return e.includes("data:image") || e.includes("thumbnail") ? e : `${e}${e.includes("?") ? "&" : "?"}thumbnail=${r}`;
|
|
4517
2705
|
{
|
|
4518
|
-
const
|
|
4519
|
-
if ((
|
|
4520
|
-
const
|
|
4521
|
-
return
|
|
2706
|
+
const a = `/workspace/${e.public ? "pub/" : ""}document/${e._id}?thumbnail=`, c = e.thumbnails;
|
|
2707
|
+
if ((u = (i = e.metadata) == null ? void 0 : i["content-type"]) != null && u.includes("video")) {
|
|
2708
|
+
const h = c && Object.keys(c).length > 0 ? Object.keys(c)[0] : null;
|
|
2709
|
+
return h ? a + h : null;
|
|
4522
2710
|
} else
|
|
4523
|
-
return
|
|
2711
|
+
return a + r;
|
|
4524
2712
|
}
|
|
4525
2713
|
}
|
|
4526
2714
|
}
|
|
@@ -4747,10 +2935,10 @@ class IdiomService {
|
|
|
4747
2935
|
e = e ?? "";
|
|
4748
2936
|
let s = bundle[e] === void 0 ? e : bundle[e];
|
|
4749
2937
|
if (t && typeof t == "object")
|
|
4750
|
-
for (let
|
|
4751
|
-
typeof t[
|
|
4752
|
-
new RegExp("\\${" +
|
|
4753
|
-
"" + t[
|
|
2938
|
+
for (let r in t)
|
|
2939
|
+
typeof t[r] < "u" && (s = s.replace(
|
|
2940
|
+
new RegExp("\\${" + r + "}", "g"),
|
|
2941
|
+
"" + t[r]
|
|
4754
2942
|
));
|
|
4755
2943
|
return s;
|
|
4756
2944
|
}
|
|
@@ -4764,17 +2952,17 @@ class IdiomService {
|
|
|
4764
2952
|
return this.loadBundle(e, t), promises[t];
|
|
4765
2953
|
}
|
|
4766
2954
|
loadBundle(e, t, s) {
|
|
4767
|
-
const
|
|
4768
|
-
if (
|
|
4769
|
-
s &&
|
|
2955
|
+
const r = promises[t];
|
|
2956
|
+
if (r)
|
|
2957
|
+
s && r.then(s).catch(s);
|
|
4770
2958
|
else {
|
|
4771
|
-
const
|
|
4772
|
-
promises[t] =
|
|
4773
|
-
const
|
|
4774
|
-
e && (
|
|
4775
|
-
Object.assign(bundle,
|
|
4776
|
-
}).catch((
|
|
4777
|
-
typeof s == "function" && s(),
|
|
2959
|
+
const i = new Promisified();
|
|
2960
|
+
promises[t] = i.promise;
|
|
2961
|
+
const u = {};
|
|
2962
|
+
e && (u["Accept-Language"] = e), this.http.get(t, { headers: u }).then((a) => {
|
|
2963
|
+
Object.assign(bundle, a), typeof s == "function" && s(), i.resolve();
|
|
2964
|
+
}).catch((a) => {
|
|
2965
|
+
typeof s == "function" && s(), i.reject();
|
|
4778
2966
|
});
|
|
4779
2967
|
}
|
|
4780
2968
|
}
|
|
@@ -4808,8 +2996,8 @@ class IdiomService {
|
|
|
4808
2996
|
}
|
|
4809
2997
|
let ATTag;
|
|
4810
2998
|
class AnalyticsService {
|
|
4811
|
-
constructor(
|
|
4812
|
-
this.context =
|
|
2999
|
+
constructor(o) {
|
|
3000
|
+
this.context = o;
|
|
4813
3001
|
}
|
|
4814
3002
|
get http() {
|
|
4815
3003
|
return this.context.http();
|
|
@@ -4822,7 +3010,7 @@ class AnalyticsService {
|
|
|
4822
3010
|
* @param locationPath
|
|
4823
3011
|
* @param app
|
|
4824
3012
|
*/
|
|
4825
|
-
async trackPageLoad(
|
|
3013
|
+
async trackPageLoad(o, e) {
|
|
4826
3014
|
const [t] = await Promise.all([
|
|
4827
3015
|
// get Xiti configuration
|
|
4828
3016
|
this.getXitiConfig(e.name.toLowerCase()),
|
|
@@ -4831,9 +3019,9 @@ class AnalyticsService {
|
|
|
4831
3019
|
]);
|
|
4832
3020
|
if (!t || !ATInternet) return;
|
|
4833
3021
|
let s = t.LIBELLE_SERVICE.default || null;
|
|
4834
|
-
for (const
|
|
4835
|
-
if (
|
|
4836
|
-
s = t.LIBELLE_SERVICE[
|
|
3022
|
+
for (const r in t.LIBELLE_SERVICE)
|
|
3023
|
+
if (r !== "default" && o.indexOf(r) >= 0) {
|
|
3024
|
+
s = t.LIBELLE_SERVICE[r];
|
|
4837
3025
|
break;
|
|
4838
3026
|
}
|
|
4839
3027
|
ATTag = new ATInternet.Tracker.Tag({ site: t.STRUCT_ID }), ATTag.setProps(
|
|
@@ -4859,7 +3047,7 @@ class AnalyticsService {
|
|
|
4859
3047
|
level2: t.STRUCT_UAI
|
|
4860
3048
|
}), ATTag.dispatch();
|
|
4861
3049
|
}
|
|
4862
|
-
async getXitiConfig(
|
|
3050
|
+
async getXitiConfig(o) {
|
|
4863
3051
|
const [e, t] = await Promise.all([
|
|
4864
3052
|
this.http.get("/analyticsConf"),
|
|
4865
3053
|
//FIXME change servers config to only keep the "all-in-one" query to /analyticsConf.
|
|
@@ -4867,7 +3055,7 @@ class AnalyticsService {
|
|
|
4867
3055
|
]);
|
|
4868
3056
|
if (!(e != null && e.type))
|
|
4869
3057
|
throw ERROR_CODE.MALFORMED_DATA;
|
|
4870
|
-
return t != null && t.active && (e.xiti = await this.getXitiTrackingParams(t,
|
|
3058
|
+
return t != null && t.active && (e.xiti = await this.getXitiTrackingParams(t, o)), e.xiti;
|
|
4871
3059
|
}
|
|
4872
3060
|
async loadXitiScript() {
|
|
4873
3061
|
if (typeof ATInternet > "u") {
|
|
@@ -4879,30 +3067,30 @@ class AnalyticsService {
|
|
|
4879
3067
|
eval(response);
|
|
4880
3068
|
}
|
|
4881
3069
|
}
|
|
4882
|
-
async getXitiTrackingParams(
|
|
4883
|
-
if (!
|
|
3070
|
+
async getXitiTrackingParams(o, e) {
|
|
3071
|
+
if (!o.structureMap || !e) return;
|
|
4884
3072
|
const t = await this.session.getUser(), s = await this.session.getUserProfile();
|
|
4885
|
-
let
|
|
3073
|
+
let r;
|
|
4886
3074
|
if (!(t != null && t.structures)) return;
|
|
4887
|
-
for (const
|
|
4888
|
-
const
|
|
4889
|
-
if (
|
|
4890
|
-
|
|
3075
|
+
for (const h of t.structures) {
|
|
3076
|
+
const l = o.structureMap[h];
|
|
3077
|
+
if (l && l.collectiviteId && l.UAI) {
|
|
3078
|
+
r = l;
|
|
4891
3079
|
break;
|
|
4892
3080
|
}
|
|
4893
3081
|
}
|
|
4894
|
-
if (!
|
|
4895
|
-
const
|
|
4896
|
-
if (!
|
|
4897
|
-
const
|
|
4898
|
-
if (!
|
|
4899
|
-
function
|
|
4900
|
-
let
|
|
4901
|
-
for (let
|
|
4902
|
-
|
|
4903
|
-
return
|
|
3082
|
+
if (!r || !r.active) return;
|
|
3083
|
+
const i = await configure.Platform.apps.getPublicConf(e);
|
|
3084
|
+
if (!i) return;
|
|
3085
|
+
const u = i.xiti;
|
|
3086
|
+
if (!u || !u.LIBELLE_SERVICE || !r.UAI) return;
|
|
3087
|
+
function a(h) {
|
|
3088
|
+
let l = "";
|
|
3089
|
+
for (let E = 0; E < h.length; E++)
|
|
3090
|
+
l += h.charCodeAt(E);
|
|
3091
|
+
return l;
|
|
4904
3092
|
}
|
|
4905
|
-
const
|
|
3093
|
+
const c = {
|
|
4906
3094
|
Student: "ELEVE",
|
|
4907
3095
|
Teacher: "ENSEIGNANT",
|
|
4908
3096
|
Relative: "PARENT",
|
|
@@ -4910,21 +3098,21 @@ class AnalyticsService {
|
|
|
4910
3098
|
Guest: "AUTRE"
|
|
4911
3099
|
};
|
|
4912
3100
|
return {
|
|
4913
|
-
LIBELLE_SERVICE:
|
|
3101
|
+
LIBELLE_SERVICE: u.LIBELLE_SERVICE,
|
|
4914
3102
|
// Which property of LIBELLE_SERVICE to use depends on the frontend.
|
|
4915
|
-
TYPE:
|
|
4916
|
-
OUTIL:
|
|
4917
|
-
STRUCT_ID:
|
|
4918
|
-
STRUCT_UAI:
|
|
4919
|
-
PROJET:
|
|
4920
|
-
EXPLOITANT:
|
|
4921
|
-
PLATFORME:
|
|
4922
|
-
ID_PERSO:
|
|
4923
|
-
PROFILE: s && s.length > 0 ?
|
|
3103
|
+
TYPE: u.OUTIL ? "TIERS" : "NATIF",
|
|
3104
|
+
OUTIL: u.OUTIL ? u.OUTIL : "",
|
|
3105
|
+
STRUCT_ID: r.collectiviteId,
|
|
3106
|
+
STRUCT_UAI: r.UAI,
|
|
3107
|
+
PROJET: r.projetId ? r.projetId : o.ID_PROJET,
|
|
3108
|
+
EXPLOITANT: o.ID_EXPLOITANT,
|
|
3109
|
+
PLATFORME: r.plateformeId ? r.plateformeId : o.ID_PLATEFORME,
|
|
3110
|
+
ID_PERSO: a(t.userId),
|
|
3111
|
+
PROFILE: s && s.length > 0 ? c[s[0]] ?? "" : ""
|
|
4924
3112
|
};
|
|
4925
3113
|
}
|
|
4926
3114
|
}
|
|
4927
|
-
const
|
|
3115
|
+
const C = class C {
|
|
4928
3116
|
// in minutes. Applies to recorded videos.
|
|
4929
3117
|
constructor(e) {
|
|
4930
3118
|
this.context = e;
|
|
@@ -4945,8 +3133,8 @@ const P = class P {
|
|
|
4945
3133
|
APP$1.VIDEO
|
|
4946
3134
|
);
|
|
4947
3135
|
return {
|
|
4948
|
-
maxWeight: (e == null ? void 0 : e["max-videosize-mbytes"]) ??
|
|
4949
|
-
maxDuration: (e == null ? void 0 : e["max-videoduration-minutes"]) ??
|
|
3136
|
+
maxWeight: (e == null ? void 0 : e["max-videosize-mbytes"]) ?? C.MAX_WEIGHT,
|
|
3137
|
+
maxDuration: (e == null ? void 0 : e["max-videoduration-minutes"]) ?? C.MAX_DURATION,
|
|
4950
3138
|
acceptVideoUploadExtensions: ((t = e == null ? void 0 : e["accept-videoupload-extensions"]) == null ? void 0 : t.map(
|
|
4951
3139
|
(s) => s.toUpperCase()
|
|
4952
3140
|
)) ?? []
|
|
@@ -4961,51 +3149,51 @@ const P = class P {
|
|
|
4961
3149
|
data: e,
|
|
4962
3150
|
appCode: t,
|
|
4963
3151
|
captation: s,
|
|
4964
|
-
duration:
|
|
3152
|
+
duration: r
|
|
4965
3153
|
}) {
|
|
4966
3154
|
if (!e.file)
|
|
4967
3155
|
throw new Error("Invalid video file.");
|
|
4968
3156
|
if (!e.filename)
|
|
4969
3157
|
throw new Error("Invalid video filename");
|
|
4970
|
-
const
|
|
4971
|
-
|
|
4972
|
-
let
|
|
4973
|
-
|
|
4974
|
-
const
|
|
4975
|
-
|
|
4976
|
-
|
|
3158
|
+
const i = `${e.browser.name} ${e.browser.version}`, u = new FormData();
|
|
3159
|
+
u.append("device", e.device || ""), u.append("browser", i), u.append("url", e.url), u.append("app", t), u.append("file", e.file, e.filename), u.append("weight", "" + e.file.size), u.append("captation", "" + s);
|
|
3160
|
+
let a = `/video/encode?captation=${s}`;
|
|
3161
|
+
r && (a += `&duration=${r}`);
|
|
3162
|
+
const c = await this.http.post(
|
|
3163
|
+
a,
|
|
3164
|
+
u,
|
|
4977
3165
|
{ headers: { "Content-Type": "multipart/form-data" } }
|
|
4978
3166
|
);
|
|
4979
|
-
if (
|
|
4980
|
-
let
|
|
3167
|
+
if (c.state == "running") {
|
|
3168
|
+
let h = 0, l = 1;
|
|
4981
3169
|
do {
|
|
4982
|
-
const
|
|
3170
|
+
const E = l + h;
|
|
4983
3171
|
await new Promise(
|
|
4984
|
-
(
|
|
4985
|
-
),
|
|
4986
|
-
const
|
|
4987
|
-
`/video/status/${
|
|
3172
|
+
(d) => setTimeout(d, E * 1e3)
|
|
3173
|
+
), h = l, l = Math.min(8, E);
|
|
3174
|
+
const p = await this.http.get(
|
|
3175
|
+
`/video/status/${c.processid}`
|
|
4988
3176
|
);
|
|
4989
|
-
if (
|
|
4990
|
-
return
|
|
4991
|
-
|
|
4992
|
-
Math.round(
|
|
4993
|
-
|
|
3177
|
+
if (p.state == "succeed")
|
|
3178
|
+
return p.videoworkspaceid && p.videosize && this.context.data().trackVideoSave(
|
|
3179
|
+
p.videoworkspaceid,
|
|
3180
|
+
Math.round(r),
|
|
3181
|
+
p.videosize,
|
|
4994
3182
|
s,
|
|
4995
3183
|
e.url,
|
|
4996
|
-
|
|
3184
|
+
i,
|
|
4997
3185
|
e.device
|
|
4998
|
-
),
|
|
4999
|
-
if (
|
|
3186
|
+
), p;
|
|
3187
|
+
if (p.state == "error")
|
|
5000
3188
|
break;
|
|
5001
3189
|
} while (!0);
|
|
5002
3190
|
}
|
|
5003
3191
|
throw new Error("Video cannot be uploaded.");
|
|
5004
3192
|
}
|
|
5005
3193
|
};
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
let VideoService =
|
|
3194
|
+
n(C, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
|
|
3195
|
+
n(C, "MAX_DURATION", 3);
|
|
3196
|
+
let VideoService = C;
|
|
5009
3197
|
class EmbedderService {
|
|
5010
3198
|
constructor(e) {
|
|
5011
3199
|
this.context = e;
|
|
@@ -5039,17 +3227,17 @@ class EmbedderService {
|
|
|
5039
3227
|
return s;
|
|
5040
3228
|
}
|
|
5041
3229
|
urlIsFromPattern(e, t) {
|
|
5042
|
-
const s = new RegExp("[^{}]+(?=(?:[^{}]*{[^}]*})*[^}]*$)", "g"),
|
|
5043
|
-
let
|
|
5044
|
-
const
|
|
5045
|
-
return (t.match(
|
|
5046
|
-
|
|
5047
|
-
}),
|
|
5048
|
-
if (!e.includes(
|
|
5049
|
-
|
|
3230
|
+
const s = new RegExp("[^{}]+(?=(?:[^{}]*{[^}]*})*[^}]*$)", "g"), r = new RegExp("{[^}]*}", "g");
|
|
3231
|
+
let i = !0;
|
|
3232
|
+
const u = t.match(s) || [], a = [];
|
|
3233
|
+
return (t.match(r) || []).forEach((h, l) => {
|
|
3234
|
+
h.includes("ignore") || a.push(u[l]);
|
|
3235
|
+
}), a.forEach((h) => {
|
|
3236
|
+
if (!e.includes(h)) {
|
|
3237
|
+
i = !1;
|
|
5050
3238
|
return;
|
|
5051
3239
|
}
|
|
5052
|
-
}),
|
|
3240
|
+
}), i;
|
|
5053
3241
|
}
|
|
5054
3242
|
/**
|
|
5055
3243
|
* Check if a given URL correspond to one of the URL pattern of the provider
|
|
@@ -5073,21 +3261,21 @@ class EmbedderService {
|
|
|
5073
3261
|
getEmbedCodeForProvider(e, t) {
|
|
5074
3262
|
for (const s of e.url)
|
|
5075
3263
|
if (this.urlIsFromPattern(t, s)) {
|
|
5076
|
-
const
|
|
5077
|
-
let
|
|
5078
|
-
for (const
|
|
5079
|
-
let
|
|
5080
|
-
const
|
|
5081
|
-
|
|
5082
|
-
let
|
|
5083
|
-
if (!
|
|
3264
|
+
const r = new RegExp("{[a-zA-Z0-9_.]+}", "g"), i = s.match(r) || [];
|
|
3265
|
+
let u = e.embed;
|
|
3266
|
+
for (const a of i) {
|
|
3267
|
+
let c = s.split(a)[0];
|
|
3268
|
+
const h = c.split("}");
|
|
3269
|
+
h.length > 1 && (c = h[h.length - 1]);
|
|
3270
|
+
let l = t.split(c)[1];
|
|
3271
|
+
if (!l)
|
|
5084
3272
|
continue;
|
|
5085
|
-
const
|
|
5086
|
-
|
|
5087
|
-
const
|
|
5088
|
-
|
|
3273
|
+
const E = s.split(a)[1].split("{")[0];
|
|
3274
|
+
E && (l = l.split(E)[0]);
|
|
3275
|
+
const p = new RegExp("\\" + a.replace(/}/, "\\}"), "g");
|
|
3276
|
+
u = u.replace(p, l);
|
|
5089
3277
|
}
|
|
5090
|
-
return
|
|
3278
|
+
return u;
|
|
5091
3279
|
}
|
|
5092
3280
|
return "";
|
|
5093
3281
|
}
|
|
@@ -5100,7 +3288,7 @@ class AbstractBehaviourService {
|
|
|
5100
3288
|
//-----------------
|
|
5101
3289
|
//--- Utilities ---
|
|
5102
3290
|
//-----------------
|
|
5103
|
-
|
|
3291
|
+
n(this, "_cache");
|
|
5104
3292
|
this.context = e, this._cache = new CacheService(this.context);
|
|
5105
3293
|
}
|
|
5106
3294
|
getApplication() {
|
|
@@ -5134,19 +3322,19 @@ class AbstractBehaviourService {
|
|
|
5134
3322
|
class ActualitesBehaviour extends AbstractBehaviourService {
|
|
5135
3323
|
constructor() {
|
|
5136
3324
|
super(...arguments);
|
|
5137
|
-
|
|
5138
|
-
|
|
3325
|
+
n(this, "APP", "actualites");
|
|
3326
|
+
n(this, "RESOURCE", "actualites");
|
|
5139
3327
|
}
|
|
5140
3328
|
async loadResources() {
|
|
5141
3329
|
return (await this.httpGet(
|
|
5142
3330
|
"/actualites/linker/infos"
|
|
5143
3331
|
)).map((s) => {
|
|
5144
|
-
var
|
|
5145
|
-
return s.thread_icon ?
|
|
3332
|
+
var r;
|
|
3333
|
+
return s.thread_icon ? r = s.thread_icon + "?thumbnail=48x48" : r = "/img/icons/glyphicons_036_file.png", this.dataToResource({
|
|
5146
3334
|
title: s.title + " [" + s.thread_title + "]",
|
|
5147
3335
|
ownerName: s.username,
|
|
5148
3336
|
owner: s.owner,
|
|
5149
|
-
icon:
|
|
3337
|
+
icon: r,
|
|
5150
3338
|
path: "/actualites#/view/thread/" + s.thread_id + "/info/" + s._id,
|
|
5151
3339
|
_id: `${s.thread_id}#${s._id}`,
|
|
5152
3340
|
shared: !!(s.shared && s.shared.length >= 0),
|
|
@@ -5158,29 +3346,29 @@ class ActualitesBehaviour extends AbstractBehaviourService {
|
|
|
5158
3346
|
class BlogBehaviour extends AbstractBehaviourService {
|
|
5159
3347
|
constructor() {
|
|
5160
3348
|
super(...arguments);
|
|
5161
|
-
|
|
5162
|
-
|
|
3349
|
+
n(this, "APP", "blog");
|
|
3350
|
+
n(this, "RESOURCE", "blog");
|
|
5163
3351
|
}
|
|
5164
3352
|
loadResources() {
|
|
5165
3353
|
return new Promise(async (t, s) => {
|
|
5166
3354
|
try {
|
|
5167
|
-
const
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
const
|
|
5171
|
-
owner:
|
|
5172
|
-
ownerName:
|
|
5173
|
-
title:
|
|
5174
|
-
_id: `${
|
|
5175
|
-
icon:
|
|
5176
|
-
path: `/blog/id/${
|
|
5177
|
-
shared: !!(
|
|
5178
|
-
modified:
|
|
3355
|
+
const r = await this.httpGet("/blog/linker"), i = [];
|
|
3356
|
+
r.forEach((u) => {
|
|
3357
|
+
u.thumbnail ? u.thumbnail = u.thumbnail + "?thumbnail=48x48" : u.thumbnail = "/img/illustrations/blog.svg";
|
|
3358
|
+
const a = u.fetchPosts.map((c) => this.dataToResource({
|
|
3359
|
+
owner: u.author.userId,
|
|
3360
|
+
ownerName: u.author.username,
|
|
3361
|
+
title: c.title + " [" + u.title + "]",
|
|
3362
|
+
_id: `${u._id}#${c._id}`,
|
|
3363
|
+
icon: u.thumbnail,
|
|
3364
|
+
path: `/blog/id/${u._id}/post/${c._id}`,
|
|
3365
|
+
shared: !!(u.shared && u.shared.length >= 0),
|
|
3366
|
+
modified: u.modified
|
|
5179
3367
|
}));
|
|
5180
|
-
|
|
5181
|
-
}), t(
|
|
5182
|
-
} catch (
|
|
5183
|
-
s(
|
|
3368
|
+
i.push(...a);
|
|
3369
|
+
}), t(i);
|
|
3370
|
+
} catch (r) {
|
|
3371
|
+
s(r);
|
|
5184
3372
|
}
|
|
5185
3373
|
});
|
|
5186
3374
|
}
|
|
@@ -5188,8 +3376,8 @@ class BlogBehaviour extends AbstractBehaviourService {
|
|
|
5188
3376
|
class CollaborativewallBehaviour extends AbstractBehaviourService {
|
|
5189
3377
|
constructor() {
|
|
5190
3378
|
super(...arguments);
|
|
5191
|
-
|
|
5192
|
-
|
|
3379
|
+
n(this, "APP", "collaborativewall");
|
|
3380
|
+
n(this, "RESOURCE", "collaborativewall");
|
|
5193
3381
|
}
|
|
5194
3382
|
async loadResources() {
|
|
5195
3383
|
return (await this.httpGet(
|
|
@@ -5211,17 +3399,17 @@ class CollaborativewallBehaviour extends AbstractBehaviourService {
|
|
|
5211
3399
|
class CommunityBehaviour extends AbstractBehaviourService {
|
|
5212
3400
|
constructor() {
|
|
5213
3401
|
super(...arguments);
|
|
5214
|
-
|
|
5215
|
-
|
|
3402
|
+
n(this, "APP", "community");
|
|
3403
|
+
n(this, "RESOURCE", "community");
|
|
5216
3404
|
}
|
|
5217
3405
|
async loadResources() {
|
|
5218
3406
|
return (await this.httpGet(
|
|
5219
3407
|
"/community/listallpages"
|
|
5220
3408
|
)).map((s) => {
|
|
5221
|
-
var
|
|
5222
|
-
return typeof s.thumbnail > "u" || s.thumbnail === "" ?
|
|
3409
|
+
var r;
|
|
3410
|
+
return typeof s.thumbnail > "u" || s.thumbnail === "" ? r = "/img/icons/glyphicons_036_file.png" : r = s.thumbnail + "?thumbnail=48x48", this.dataToResource({
|
|
5223
3411
|
title: s.name,
|
|
5224
|
-
icon:
|
|
3412
|
+
icon: r,
|
|
5225
3413
|
path: "/community#/view/" + s.id,
|
|
5226
3414
|
_id: s.id,
|
|
5227
3415
|
owner: "",
|
|
@@ -5236,23 +3424,23 @@ class CommunityBehaviour extends AbstractBehaviourService {
|
|
|
5236
3424
|
class ExercizerBehaviour extends AbstractBehaviourService {
|
|
5237
3425
|
constructor() {
|
|
5238
3426
|
super(...arguments);
|
|
5239
|
-
|
|
5240
|
-
|
|
3427
|
+
n(this, "APP", "exercizer");
|
|
3428
|
+
n(this, "RESOURCE", "exercizer");
|
|
5241
3429
|
}
|
|
5242
3430
|
async loadResources() {
|
|
5243
3431
|
return (await this.httpGet(
|
|
5244
3432
|
"/exercizer/subjects-scheduled"
|
|
5245
3433
|
)).map((s) => {
|
|
5246
|
-
const
|
|
5247
|
-
let
|
|
5248
|
-
return
|
|
3434
|
+
const r = s.picture ? s.picture + "?thumbnail=48x48" : "/img/illustrations/exercizer.svg";
|
|
3435
|
+
let i, u = !1, a = JSON.parse(s.scheduled_at);
|
|
3436
|
+
return a.groupList.length > 0 ? (u = !0, i = a.groupList[0].name) : a.userList.length > 0 ? (u = !0, i = a.userList[0].name) : i = "", a.groupList.length + a.userList.length > 1 && (i += "..."), this.dataToResource({
|
|
5249
3437
|
title: s.title,
|
|
5250
3438
|
owner: s.owner,
|
|
5251
|
-
ownerName:
|
|
5252
|
-
icon:
|
|
3439
|
+
ownerName: i,
|
|
3440
|
+
icon: r,
|
|
5253
3441
|
path: "/exercizer#/linker/" + s.id,
|
|
5254
3442
|
_id: "" + s.id,
|
|
5255
|
-
shared:
|
|
3443
|
+
shared: u,
|
|
5256
3444
|
modified: s.modified
|
|
5257
3445
|
});
|
|
5258
3446
|
});
|
|
@@ -5261,8 +3449,8 @@ class ExercizerBehaviour extends AbstractBehaviourService {
|
|
|
5261
3449
|
class FormulaireBehaviour extends AbstractBehaviourService {
|
|
5262
3450
|
constructor() {
|
|
5263
3451
|
super(...arguments);
|
|
5264
|
-
|
|
5265
|
-
|
|
3452
|
+
n(this, "APP", "formulaire");
|
|
3453
|
+
n(this, "RESOURCE", "formulaire");
|
|
5266
3454
|
}
|
|
5267
3455
|
async loadResources() {
|
|
5268
3456
|
return (await this.httpGet(
|
|
@@ -5282,8 +3470,8 @@ class FormulaireBehaviour extends AbstractBehaviourService {
|
|
|
5282
3470
|
class ForumBehaviour extends AbstractBehaviourService {
|
|
5283
3471
|
constructor() {
|
|
5284
3472
|
super(...arguments);
|
|
5285
|
-
|
|
5286
|
-
|
|
3473
|
+
n(this, "APP", "forum");
|
|
3474
|
+
n(this, "RESOURCE", "forum");
|
|
5287
3475
|
}
|
|
5288
3476
|
async loadResources() {
|
|
5289
3477
|
return (await this.httpGet("/forum/categories")).map(
|
|
@@ -5303,8 +3491,8 @@ class ForumBehaviour extends AbstractBehaviourService {
|
|
|
5303
3491
|
class HomeworksBehaviour extends AbstractBehaviourService {
|
|
5304
3492
|
constructor() {
|
|
5305
3493
|
super(...arguments);
|
|
5306
|
-
|
|
5307
|
-
|
|
3494
|
+
n(this, "APP", "homeworks");
|
|
3495
|
+
n(this, "RESOURCE", "homeworks");
|
|
5308
3496
|
}
|
|
5309
3497
|
async loadResources() {
|
|
5310
3498
|
return (await this.httpGet("/homeworks/list")).filter((t) => t.owner && t.trashed === 0).map((t) => this.dataToResource({
|
|
@@ -5322,8 +3510,8 @@ class HomeworksBehaviour extends AbstractBehaviourService {
|
|
|
5322
3510
|
class MagnetoBehaviour extends AbstractBehaviourService {
|
|
5323
3511
|
constructor() {
|
|
5324
3512
|
super(...arguments);
|
|
5325
|
-
|
|
5326
|
-
|
|
3513
|
+
n(this, "APP", "magneto");
|
|
3514
|
+
n(this, "RESOURCE", "magneto");
|
|
5327
3515
|
}
|
|
5328
3516
|
async loadResources() {
|
|
5329
3517
|
const { all: t } = await this.httpGet(
|
|
@@ -5344,8 +3532,8 @@ class MagnetoBehaviour extends AbstractBehaviourService {
|
|
|
5344
3532
|
class MindmapBehaviour extends AbstractBehaviourService {
|
|
5345
3533
|
constructor() {
|
|
5346
3534
|
super(...arguments);
|
|
5347
|
-
|
|
5348
|
-
|
|
3535
|
+
n(this, "APP", "mindmap");
|
|
3536
|
+
n(this, "RESOURCE", "mindmap");
|
|
5349
3537
|
}
|
|
5350
3538
|
async loadResources() {
|
|
5351
3539
|
return (await this.httpGet("/mindmap/list/all")).map(
|
|
@@ -5365,36 +3553,36 @@ class MindmapBehaviour extends AbstractBehaviourService {
|
|
|
5365
3553
|
class PagesBehaviour extends AbstractBehaviourService {
|
|
5366
3554
|
constructor() {
|
|
5367
3555
|
super(...arguments);
|
|
5368
|
-
|
|
5369
|
-
|
|
3556
|
+
n(this, "APP", "pages");
|
|
3557
|
+
n(this, "RESOURCE", "pages");
|
|
5370
3558
|
}
|
|
5371
3559
|
async loadResources() {
|
|
5372
3560
|
const t = await this.httpGet("/pages/list/all"), s = [];
|
|
5373
|
-
return t.forEach((
|
|
5374
|
-
var
|
|
5375
|
-
const
|
|
3561
|
+
return t.forEach((r) => {
|
|
3562
|
+
var u;
|
|
3563
|
+
const i = r.thumbnail ? r.thumbnail + "?thumbnail=48x48" : "/img/illustrations/pages.svg";
|
|
5376
3564
|
s.push(
|
|
5377
3565
|
this.dataToResource({
|
|
5378
|
-
title:
|
|
5379
|
-
owner:
|
|
5380
|
-
ownerName:
|
|
5381
|
-
icon:
|
|
5382
|
-
path: "/pages#/website/" +
|
|
5383
|
-
_id:
|
|
5384
|
-
shared: typeof
|
|
5385
|
-
modified:
|
|
3566
|
+
title: r.title,
|
|
3567
|
+
owner: r.owner.userId,
|
|
3568
|
+
ownerName: r.owner.displayName,
|
|
3569
|
+
icon: i,
|
|
3570
|
+
path: "/pages#/website/" + r._id,
|
|
3571
|
+
_id: r._id,
|
|
3572
|
+
shared: typeof r.shared < "u",
|
|
3573
|
+
modified: r.modified
|
|
5386
3574
|
})
|
|
5387
|
-
), (
|
|
3575
|
+
), (u = r.pages) == null || u.forEach((a) => {
|
|
5388
3576
|
s.push(
|
|
5389
3577
|
this.dataToResource({
|
|
5390
|
-
title:
|
|
5391
|
-
owner:
|
|
5392
|
-
ownerName:
|
|
5393
|
-
icon:
|
|
5394
|
-
path: "/pages#/website/" +
|
|
5395
|
-
_id:
|
|
5396
|
-
shared: typeof
|
|
5397
|
-
modified:
|
|
3578
|
+
title: a.title,
|
|
3579
|
+
owner: r.owner.userId,
|
|
3580
|
+
ownerName: r.owner.displayName,
|
|
3581
|
+
icon: i,
|
|
3582
|
+
path: "/pages#/website/" + r._id + "/" + a.titleLink,
|
|
3583
|
+
_id: r._id + "/" + a.titleLink,
|
|
3584
|
+
shared: typeof r.shared < "u",
|
|
3585
|
+
modified: r.modified
|
|
5398
3586
|
})
|
|
5399
3587
|
);
|
|
5400
3588
|
});
|
|
@@ -5404,16 +3592,16 @@ class PagesBehaviour extends AbstractBehaviourService {
|
|
|
5404
3592
|
class PollBehaviour extends AbstractBehaviourService {
|
|
5405
3593
|
constructor() {
|
|
5406
3594
|
super(...arguments);
|
|
5407
|
-
|
|
5408
|
-
|
|
3595
|
+
n(this, "APP", "poll");
|
|
3596
|
+
n(this, "RESOURCE", "poll");
|
|
5409
3597
|
}
|
|
5410
3598
|
async loadResources() {
|
|
5411
3599
|
return (await this.httpGet("/poll/list/all")).map((s) => {
|
|
5412
|
-
const
|
|
3600
|
+
const r = s.icon ? s.icon + "?thumbnail=48x48" : "/img/icons/glyphicons_036_file.png";
|
|
5413
3601
|
return this.dataToResource({
|
|
5414
3602
|
title: s.question,
|
|
5415
3603
|
ownerName: s.owner.displayName,
|
|
5416
|
-
icon:
|
|
3604
|
+
icon: r,
|
|
5417
3605
|
path: "/poll#/view/" + s._id,
|
|
5418
3606
|
_id: s._id,
|
|
5419
3607
|
owner: s.owner.userId,
|
|
@@ -5426,19 +3614,19 @@ class PollBehaviour extends AbstractBehaviourService {
|
|
|
5426
3614
|
class ScrapbookBehaviour extends AbstractBehaviourService {
|
|
5427
3615
|
constructor() {
|
|
5428
3616
|
super(...arguments);
|
|
5429
|
-
|
|
5430
|
-
|
|
3617
|
+
n(this, "APP", "scrapbook");
|
|
3618
|
+
n(this, "RESOURCE", "scrapbook");
|
|
5431
3619
|
}
|
|
5432
3620
|
async loadResources() {
|
|
5433
3621
|
return (await this.httpGet(
|
|
5434
3622
|
"/scrapbook/list/all"
|
|
5435
3623
|
)).map((s) => {
|
|
5436
|
-
const
|
|
3624
|
+
const r = s.icon || "/img/illustrations/scrapbook.svg";
|
|
5437
3625
|
return this.dataToResource({
|
|
5438
3626
|
title: s.name,
|
|
5439
3627
|
owner: s.owner.userId,
|
|
5440
3628
|
ownerName: s.owner.displayName,
|
|
5441
|
-
icon:
|
|
3629
|
+
icon: r,
|
|
5442
3630
|
path: "/scrapbook#/view-scrapbook/" + s._id,
|
|
5443
3631
|
_id: s._id,
|
|
5444
3632
|
shared: !!(s.shared && s.shared.length >= 0),
|
|
@@ -5450,30 +3638,30 @@ class ScrapbookBehaviour extends AbstractBehaviourService {
|
|
|
5450
3638
|
class TimelinegeneratorBehaviour extends AbstractBehaviourService {
|
|
5451
3639
|
constructor() {
|
|
5452
3640
|
super(...arguments);
|
|
5453
|
-
|
|
5454
|
-
|
|
3641
|
+
n(this, "APP", "timelinegenerator");
|
|
3642
|
+
n(this, "RESOURCE", "timelinegenerator");
|
|
5455
3643
|
}
|
|
5456
3644
|
loadResources() {
|
|
5457
3645
|
return new Promise(async (t, s) => {
|
|
5458
3646
|
try {
|
|
5459
|
-
const
|
|
3647
|
+
const i = (await this.httpGet(
|
|
5460
3648
|
"/timelinegenerator/timelines"
|
|
5461
|
-
)).map((
|
|
5462
|
-
const
|
|
3649
|
+
)).map((u) => {
|
|
3650
|
+
const a = u.icon || "/img/illustrations/timeline-default.png";
|
|
5463
3651
|
return this.dataToResource({
|
|
5464
|
-
title:
|
|
5465
|
-
ownerName:
|
|
5466
|
-
owner:
|
|
5467
|
-
icon:
|
|
5468
|
-
path: "/timelinegenerator#/view/" +
|
|
5469
|
-
_id:
|
|
5470
|
-
shared: typeof
|
|
5471
|
-
modified:
|
|
3652
|
+
title: u.headline,
|
|
3653
|
+
ownerName: u.owner.displayName,
|
|
3654
|
+
owner: u.owner.userId,
|
|
3655
|
+
icon: a,
|
|
3656
|
+
path: "/timelinegenerator#/view/" + u._id,
|
|
3657
|
+
_id: u._id,
|
|
3658
|
+
shared: typeof u.shared < "u",
|
|
3659
|
+
modified: u.modified
|
|
5472
3660
|
});
|
|
5473
3661
|
});
|
|
5474
|
-
t(
|
|
5475
|
-
} catch (
|
|
5476
|
-
s(
|
|
3662
|
+
t(i);
|
|
3663
|
+
} catch (r) {
|
|
3664
|
+
s(r);
|
|
5477
3665
|
}
|
|
5478
3666
|
});
|
|
5479
3667
|
}
|
|
@@ -5481,21 +3669,21 @@ class TimelinegeneratorBehaviour extends AbstractBehaviourService {
|
|
|
5481
3669
|
class WikiBehaviour extends AbstractBehaviourService {
|
|
5482
3670
|
constructor() {
|
|
5483
3671
|
super(...arguments);
|
|
5484
|
-
|
|
5485
|
-
|
|
3672
|
+
n(this, "APP", "wiki");
|
|
3673
|
+
n(this, "RESOURCE", "wiki");
|
|
5486
3674
|
}
|
|
5487
3675
|
async loadResources() {
|
|
5488
|
-
return (await this.httpGet("/wiki/listallpages")).map((s) => s.pages.map((
|
|
5489
|
-
let
|
|
5490
|
-
return typeof s.thumbnail > "u" || s.thumbnail === "" ?
|
|
5491
|
-
title:
|
|
3676
|
+
return (await this.httpGet("/wiki/listallpages")).map((s) => s.pages.map((r) => {
|
|
3677
|
+
let i;
|
|
3678
|
+
return typeof s.thumbnail > "u" || s.thumbnail === "" ? i = "/img/icons/glyphicons_036_file.png" : i = s.thumbnail + "?thumbnail=48x48", this.dataToResource({
|
|
3679
|
+
title: r.title + " [" + s.title + "]",
|
|
5492
3680
|
ownerName: s.owner.displayName,
|
|
5493
3681
|
owner: s.owner.userId,
|
|
5494
|
-
icon:
|
|
5495
|
-
path: "/wiki#/view/" + s._id + "/" +
|
|
5496
|
-
_id: `${s._id}#${
|
|
3682
|
+
icon: i,
|
|
3683
|
+
path: "/wiki#/view/" + s._id + "/" + r._id,
|
|
3684
|
+
_id: `${s._id}#${r._id}`,
|
|
5497
3685
|
shared: typeof s.shared < "u",
|
|
5498
|
-
modified:
|
|
3686
|
+
modified: r.modified
|
|
5499
3687
|
});
|
|
5500
3688
|
})).flat();
|
|
5501
3689
|
}
|
|
@@ -5503,50 +3691,50 @@ class WikiBehaviour extends AbstractBehaviourService {
|
|
|
5503
3691
|
class WorkspaceBehaviour extends AbstractBehaviourService {
|
|
5504
3692
|
constructor() {
|
|
5505
3693
|
super(...arguments);
|
|
5506
|
-
|
|
5507
|
-
|
|
3694
|
+
n(this, "APP", "workspace");
|
|
3695
|
+
n(this, "RESOURCE", "workspace");
|
|
5508
3696
|
}
|
|
5509
3697
|
loadResources({ search: t, asset_id: s }) {
|
|
5510
|
-
return new Promise(async (
|
|
3698
|
+
return new Promise(async (r, i) => {
|
|
5511
3699
|
try {
|
|
5512
|
-
let
|
|
5513
|
-
s && s.length ?
|
|
5514
|
-
const
|
|
5515
|
-
const
|
|
3700
|
+
let u = "/workspace/documents?filter=all&hierarchical=true";
|
|
3701
|
+
s && s.length ? u += `&search=${t}` : t && t.length && (u += `&search=${t}`);
|
|
3702
|
+
const c = (await this.httpGet(u)).filter((h) => !h.deleted).map((h) => {
|
|
3703
|
+
const l = h.metadata["content-type"] && h.metadata["content-type"].indexOf("image") !== -1 ? `/workspace/document/${h._id}?thumbnail=120x120` : "/img/icons/unknown-large.png";
|
|
5516
3704
|
return this.dataToResource({
|
|
5517
|
-
title:
|
|
5518
|
-
ownerName:
|
|
5519
|
-
owner:
|
|
5520
|
-
icon:
|
|
5521
|
-
path: `/workspace/document/${
|
|
5522
|
-
_id:
|
|
5523
|
-
shared: !!(
|
|
5524
|
-
modified:
|
|
3705
|
+
title: h.name,
|
|
3706
|
+
ownerName: h.ownerName,
|
|
3707
|
+
owner: h.owner,
|
|
3708
|
+
icon: l,
|
|
3709
|
+
path: `/workspace/document/${h._id}`,
|
|
3710
|
+
_id: h._id,
|
|
3711
|
+
shared: !!(h.shared && h.shared.length >= 0),
|
|
3712
|
+
modified: h.modified
|
|
5525
3713
|
});
|
|
5526
3714
|
});
|
|
5527
|
-
|
|
5528
|
-
} catch (
|
|
5529
|
-
u
|
|
3715
|
+
r(c);
|
|
3716
|
+
} catch (u) {
|
|
3717
|
+
i(u);
|
|
5530
3718
|
}
|
|
5531
3719
|
});
|
|
5532
3720
|
}
|
|
5533
3721
|
}
|
|
5534
|
-
const
|
|
3722
|
+
const y = class y {
|
|
5535
3723
|
static async initialize(e, t) {
|
|
5536
3724
|
const s = e.http();
|
|
5537
|
-
return new Promise((
|
|
5538
|
-
this.resourceProducingApps.length ?
|
|
3725
|
+
return new Promise((r) => {
|
|
3726
|
+
this.resourceProducingApps.length ? r(this.resourceProducingApps) : (this.resourceProducingApps = [t, "workspace"], (async () => {
|
|
5539
3727
|
try {
|
|
5540
|
-
const [
|
|
3728
|
+
const [i, u] = await Promise.all([
|
|
5541
3729
|
s.get("/resources-applications"),
|
|
5542
3730
|
e.session().getUser()
|
|
5543
3731
|
]);
|
|
5544
|
-
|
|
5545
|
-
(
|
|
3732
|
+
u && u.apps && (i != null && i.length) && (this.resourceProducingApps = i.filter(
|
|
3733
|
+
(a) => u.apps.some((c) => c.address.includes(a))
|
|
5546
3734
|
));
|
|
5547
3735
|
} catch {
|
|
5548
3736
|
}
|
|
5549
|
-
|
|
3737
|
+
r(this.resourceProducingApps);
|
|
5550
3738
|
})());
|
|
5551
3739
|
});
|
|
5552
3740
|
}
|
|
@@ -5555,77 +3743,77 @@ const v = class v {
|
|
|
5555
3743
|
const s = { application: e, resourceType: t };
|
|
5556
3744
|
this.registry.register(
|
|
5557
3745
|
s,
|
|
5558
|
-
(
|
|
3746
|
+
(r) => this.serviceFor(r, e, t)
|
|
5559
3747
|
);
|
|
5560
3748
|
});
|
|
5561
3749
|
}
|
|
5562
3750
|
static serviceFor(e, t, s) {
|
|
5563
|
-
let
|
|
3751
|
+
let r;
|
|
5564
3752
|
switch (s) {
|
|
5565
3753
|
case "timelinegenerator":
|
|
5566
|
-
|
|
3754
|
+
r = new TimelinegeneratorBehaviour(e);
|
|
5567
3755
|
break;
|
|
5568
3756
|
case "workspace":
|
|
5569
|
-
|
|
3757
|
+
r = new WorkspaceBehaviour(e);
|
|
5570
3758
|
break;
|
|
5571
3759
|
case "blog":
|
|
5572
|
-
|
|
3760
|
+
r = new BlogBehaviour(e);
|
|
5573
3761
|
break;
|
|
5574
3762
|
case "actualites":
|
|
5575
|
-
|
|
3763
|
+
r = new ActualitesBehaviour(e);
|
|
5576
3764
|
break;
|
|
5577
3765
|
case "wiki":
|
|
5578
|
-
|
|
3766
|
+
r = new WikiBehaviour(e);
|
|
5579
3767
|
break;
|
|
5580
3768
|
case "pages":
|
|
5581
|
-
|
|
3769
|
+
r = new PagesBehaviour(e);
|
|
5582
3770
|
break;
|
|
5583
3771
|
case "poll":
|
|
5584
|
-
|
|
3772
|
+
r = new PollBehaviour(e);
|
|
5585
3773
|
break;
|
|
5586
3774
|
case "community":
|
|
5587
|
-
|
|
3775
|
+
r = new CommunityBehaviour(e);
|
|
5588
3776
|
break;
|
|
5589
3777
|
case "mindmap":
|
|
5590
|
-
|
|
3778
|
+
r = new MindmapBehaviour(e);
|
|
5591
3779
|
break;
|
|
5592
3780
|
case "forum":
|
|
5593
|
-
|
|
3781
|
+
r = new ForumBehaviour(e);
|
|
5594
3782
|
break;
|
|
5595
3783
|
case "homeworks":
|
|
5596
|
-
|
|
3784
|
+
r = new HomeworksBehaviour(e);
|
|
5597
3785
|
break;
|
|
5598
3786
|
case "scrapbook":
|
|
5599
|
-
|
|
3787
|
+
r = new ScrapbookBehaviour(e);
|
|
5600
3788
|
break;
|
|
5601
3789
|
case "collaborativewall":
|
|
5602
|
-
|
|
3790
|
+
r = new CollaborativewallBehaviour(e);
|
|
5603
3791
|
break;
|
|
5604
3792
|
case "exercizer":
|
|
5605
|
-
|
|
3793
|
+
r = new ExercizerBehaviour(e);
|
|
5606
3794
|
break;
|
|
5607
3795
|
case "formulaire":
|
|
5608
|
-
|
|
3796
|
+
r = new FormulaireBehaviour(e);
|
|
5609
3797
|
break;
|
|
5610
3798
|
case "magneto":
|
|
5611
|
-
|
|
3799
|
+
r = new MagnetoBehaviour(e);
|
|
5612
3800
|
break;
|
|
5613
3801
|
default:
|
|
5614
3802
|
throw ERROR_CODE.NOT_SUPPORTED;
|
|
5615
3803
|
}
|
|
5616
|
-
return
|
|
3804
|
+
return r.APP = t, r;
|
|
5617
3805
|
}
|
|
5618
3806
|
};
|
|
5619
3807
|
//
|
|
5620
3808
|
// STATIC REGISTRY
|
|
5621
3809
|
//
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
let SnipletsService =
|
|
3810
|
+
n(y, "registry", new ServiceRegistry()), // Expose some useful functions
|
|
3811
|
+
n(y, "findBehaviour", y.registry.findService.bind(y.registry)), n(y, "hasBehaviour", y.registry.isRegistered.bind(y.registry)), n(y, "resourceProducingApps", []);
|
|
3812
|
+
let SnipletsService = y;
|
|
5625
3813
|
const SEND_ALL = "*";
|
|
5626
3814
|
class WebBroker {
|
|
5627
3815
|
constructor(e) {
|
|
5628
|
-
|
|
3816
|
+
n(this, "subscription");
|
|
5629
3817
|
this.odeServices = e;
|
|
5630
3818
|
}
|
|
5631
3819
|
get http() {
|
|
@@ -5636,7 +3824,7 @@ class WebBroker {
|
|
|
5636
3824
|
}
|
|
5637
3825
|
dispatchEvent(e, t) {
|
|
5638
3826
|
t.findIndex(
|
|
5639
|
-
(
|
|
3827
|
+
(r) => SEND_ALL === r || e.data["event-type"] === r
|
|
5640
3828
|
) >= 0 && this.http.post("/infra/event/web/store", e.data, {
|
|
5641
3829
|
disableNotifications: !0
|
|
5642
3830
|
});
|
|
@@ -5657,10 +3845,10 @@ class WebBroker {
|
|
|
5657
3845
|
}
|
|
5658
3846
|
class DataService {
|
|
5659
3847
|
constructor(e) {
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
3848
|
+
n(this, "_webBroker");
|
|
3849
|
+
n(this, "app");
|
|
3850
|
+
n(this, "user");
|
|
3851
|
+
n(this, "profile");
|
|
5664
3852
|
this.odeServices = e;
|
|
5665
3853
|
}
|
|
5666
3854
|
get conf() {
|
|
@@ -5694,29 +3882,29 @@ class DataService {
|
|
|
5694
3882
|
addUserInfos(e) {
|
|
5695
3883
|
return this.user && (e.userId = this.user.userId, e.structure = this.user.structureNames[0]), this.profile && (e.profil = this.profile[0]), e;
|
|
5696
3884
|
}
|
|
5697
|
-
trackVideoSave(e, t, s, i, u,
|
|
5698
|
-
const
|
|
3885
|
+
trackVideoSave(e, t, s, r, i, u, a) {
|
|
3886
|
+
const c = this.addUserInfos({
|
|
5699
3887
|
"event-type": "VIDEO_SAVE",
|
|
5700
3888
|
module: "video",
|
|
5701
3889
|
video_id: e,
|
|
5702
|
-
browser:
|
|
3890
|
+
browser: u,
|
|
5703
3891
|
duration: Math.round(t),
|
|
5704
3892
|
weight: s,
|
|
5705
|
-
source:
|
|
5706
|
-
url:
|
|
3893
|
+
source: r ? "CAPTURED" : "UPLOADED",
|
|
3894
|
+
url: i
|
|
5707
3895
|
});
|
|
5708
|
-
this.app && (
|
|
3896
|
+
this.app && (c["override-module"] = this.app), a && (c.device_type = a), this.trackWebEvent(c);
|
|
5709
3897
|
}
|
|
5710
|
-
trackVideoRead(e, t, s,
|
|
5711
|
-
const
|
|
3898
|
+
trackVideoRead(e, t, s, r, i) {
|
|
3899
|
+
const u = this.addUserInfos({
|
|
5712
3900
|
"event-type": "VIDEO_READ",
|
|
5713
3901
|
module: "video",
|
|
5714
3902
|
video_id: e,
|
|
5715
|
-
browser:
|
|
3903
|
+
browser: r,
|
|
5716
3904
|
source: t ? "CAPTURED" : "UPLOADED",
|
|
5717
3905
|
url: s
|
|
5718
3906
|
});
|
|
5719
|
-
this.app && (
|
|
3907
|
+
this.app && (u["override-module"] = this.app), i && (u.device_type = i), this.trackWebEvent(u);
|
|
5720
3908
|
}
|
|
5721
3909
|
trackSpeechAndText(e) {
|
|
5722
3910
|
const t = this.addUserInfos({
|
|
@@ -5755,10 +3943,10 @@ class ReactionsService {
|
|
|
5755
3943
|
return this.http.isResponseError() ? {} : t.reactionsByResource;
|
|
5756
3944
|
}
|
|
5757
3945
|
async loadReactionDetails(e, t, s) {
|
|
5758
|
-
const
|
|
3946
|
+
const r = await this.http.get(
|
|
5759
3947
|
`/audience/reactions/${this.module}/${this.resourceType}/${e}?page=${t}&size=${s}`
|
|
5760
3948
|
);
|
|
5761
|
-
return this.http.isResponseError() ? void 0 :
|
|
3949
|
+
return this.http.isResponseError() ? void 0 : r;
|
|
5762
3950
|
}
|
|
5763
3951
|
async deleteReaction(e) {
|
|
5764
3952
|
await this.http.delete(
|
|
@@ -5822,20 +4010,20 @@ class AudienceService {
|
|
|
5822
4010
|
}
|
|
5823
4011
|
class OdeServices {
|
|
5824
4012
|
constructor() {
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
4013
|
+
n(this, "_analytics");
|
|
4014
|
+
n(this, "_cache");
|
|
4015
|
+
n(this, "_conf");
|
|
4016
|
+
n(this, "_data");
|
|
4017
|
+
n(this, "_directory");
|
|
4018
|
+
n(this, "_http");
|
|
4019
|
+
n(this, "_idiom");
|
|
4020
|
+
n(this, "_notify");
|
|
4021
|
+
n(this, "_rights");
|
|
4022
|
+
n(this, "_session");
|
|
4023
|
+
n(this, "_share");
|
|
4024
|
+
n(this, "_video");
|
|
4025
|
+
n(this, "_workspace");
|
|
4026
|
+
n(this, "_embedder");
|
|
5839
4027
|
this._analytics = new AnalyticsService(this), this._cache = new CacheService(this), this._conf = new ConfService(this), this._data = new DataService(this), this._directory = new DirectoryService(this), this._http = new HttpService(this), this._idiom = new IdiomService(this), this._notify = NotifyFrameworkFactory.instance(), this._rights = new RightService(this), this._session = new SessionService(this), this._share = new ShareService(this), this._video = new VideoService(this), this._workspace = new WorkspaceService(this), this._embedder = new EmbedderService(this);
|
|
5840
4028
|
}
|
|
5841
4029
|
initialize() {
|
|
@@ -5968,9 +4156,9 @@ class TransportFrameworkFactory {
|
|
|
5968
4156
|
return transport;
|
|
5969
4157
|
}
|
|
5970
4158
|
}
|
|
5971
|
-
const isActionAvailable = (
|
|
4159
|
+
const isActionAvailable = (o, e) => {
|
|
5972
4160
|
const t = e == null ? void 0 : e.filter(
|
|
5973
|
-
(s) => s.id ===
|
|
4161
|
+
(s) => s.id === o && s.available
|
|
5974
4162
|
);
|
|
5975
4163
|
return t && t.length > 0;
|
|
5976
4164
|
}, firstLevelWidgets = [
|
|
@@ -6037,23 +4225,23 @@ const isActionAvailable = (r, e) => {
|
|
|
6037
4225
|
class WidgetFramework {
|
|
6038
4226
|
constructor() {
|
|
6039
4227
|
//-------------------------------------
|
|
6040
|
-
|
|
6041
|
-
|
|
4228
|
+
n(this, "_initialized");
|
|
4229
|
+
n(this, "_widgets", []);
|
|
6042
4230
|
////////////////////////////////////// USER PREFERENCES
|
|
6043
|
-
|
|
4231
|
+
n(this, "_userPrefs", {});
|
|
6044
4232
|
}
|
|
6045
4233
|
initialize(e, t) {
|
|
6046
4234
|
return this._initialized || (this._initialized = new Promisified(), notify.onSessionReady().promise.then((s) => {
|
|
6047
|
-
var
|
|
6048
|
-
s && s.widgets ? (s.widgets.forEach((
|
|
6049
|
-
this._widgets.push(new Widget(
|
|
4235
|
+
var r;
|
|
4236
|
+
s && s.widgets ? (s.widgets.forEach((i) => {
|
|
4237
|
+
this._widgets.push(new Widget(i));
|
|
6050
4238
|
}), this.loadUserPrefs().then(() => {
|
|
4239
|
+
var i;
|
|
4240
|
+
(i = this._initialized) == null || i.resolve();
|
|
4241
|
+
}).catch((i) => {
|
|
6051
4242
|
var u;
|
|
6052
|
-
(u = this._initialized) == null || u.
|
|
6053
|
-
}).
|
|
6054
|
-
var c;
|
|
6055
|
-
(c = this._initialized) == null || c.reject();
|
|
6056
|
-
})) : (i = this._initialized) == null || i.reject();
|
|
4243
|
+
(u = this._initialized) == null || u.reject();
|
|
4244
|
+
})) : (r = this._initialized) == null || r.reject();
|
|
6057
4245
|
})), this._initialized.promise;
|
|
6058
4246
|
}
|
|
6059
4247
|
////////////////////////////////////// ACCESSORS
|
|
@@ -6082,21 +4270,21 @@ class WidgetFramework {
|
|
|
6082
4270
|
async applyUserPrefs(e) {
|
|
6083
4271
|
this._userPrefs = e ?? this._userPrefs;
|
|
6084
4272
|
const t = configure.Platform.theme, s = [];
|
|
6085
|
-
t.listSkins().then((
|
|
6086
|
-
var
|
|
6087
|
-
const
|
|
6088
|
-
this._widgets = this._widgets.filter((
|
|
6089
|
-
const
|
|
6090
|
-
return
|
|
6091
|
-
index: defaultWidgetOrder[
|
|
4273
|
+
t.listSkins().then((r) => {
|
|
4274
|
+
var a;
|
|
4275
|
+
const i = ((a = r.find((c) => c.child === t.skin)) == null ? void 0 : a.parent) === "panda" ? secondLevelWidgets : firstLevelWidgets;
|
|
4276
|
+
this._widgets = this._widgets.filter((c, h) => {
|
|
4277
|
+
const l = c.platformConf.name;
|
|
4278
|
+
return i.indexOf(l) !== -1 ? !1 : (this._userPrefs[l] || (this._userPrefs[l] = {
|
|
4279
|
+
index: defaultWidgetOrder[l] ?? 999,
|
|
6092
4280
|
show: !0,
|
|
6093
|
-
position:
|
|
6094
|
-
}),
|
|
4281
|
+
position: c.platformConf.position
|
|
4282
|
+
}), c.platformConf.mandatory && (this._userPrefs[l].show = !0, this._userPrefs[l].index = defaultWidgetOrder[l] ?? 999), c.platformConf.i18n && s.push(c.platformConf.i18n), c.applyUserPref(this._userPrefs[l]), !0);
|
|
6095
4283
|
});
|
|
6096
|
-
const
|
|
6097
|
-
this._widgets = this._widgets.sort((
|
|
6098
|
-
const
|
|
6099
|
-
return
|
|
4284
|
+
const u = new Idiom();
|
|
4285
|
+
this._widgets = this._widgets.sort((c, h) => {
|
|
4286
|
+
const l = u.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(), E = u.translate(`timeline.settings.${h.platformConf.name}`).toLowerCase();
|
|
4287
|
+
return l < E ? -1 : l > E ? 1 : 0;
|
|
6100
4288
|
});
|
|
6101
4289
|
});
|
|
6102
4290
|
}
|
|
@@ -6104,8 +4292,8 @@ class WidgetFramework {
|
|
|
6104
4292
|
class Widget {
|
|
6105
4293
|
//-------------------------------------
|
|
6106
4294
|
constructor(e) {
|
|
6107
|
-
|
|
6108
|
-
|
|
4295
|
+
n(this, "_schoolConf", {});
|
|
4296
|
+
n(this, "_userPref");
|
|
6109
4297
|
this._platformConf = e, this._userPref = null;
|
|
6110
4298
|
}
|
|
6111
4299
|
get platformConf() {
|