@edifice.io/client 2.6.12-develop-integration-crna.20261101211105 → 2.6.12-develop-integration.20261103121816

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var P = Object.defineProperty;
2
2
  var I = (n, e, t) => e in n ? P(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var u = (n, e, t) => I(n, typeof e != "symbol" ? e + "" : e, t);
3
+ var a = (n, e, t) => I(n, typeof e != "symbol" ? e + "" : e, t);
4
4
  import axios from "axios";
5
5
  import { MimeTypeUtils } from "@edifice.io/utilities";
6
6
  import { UAParser } from "ua-parser-js";
@@ -100,8 +100,8 @@ const ERROR_CODE = {
100
100
  // TODO compléter
101
101
  }, C = class C {
102
102
  constructor(e) {
103
- u(this, "name");
104
- u(this, "listeners", /* @__PURE__ */ new Set());
103
+ a(this, "name");
104
+ a(this, "listeners", /* @__PURE__ */ new Set());
105
105
  this.name = e;
106
106
  }
107
107
  /**
@@ -139,11 +139,11 @@ const ERROR_CODE = {
139
139
  this.listeners.clear(), C.channels.delete(this.name);
140
140
  }
141
141
  };
142
- u(C, "channels", /* @__PURE__ */ new Map());
142
+ a(C, "channels", /* @__PURE__ */ new Map());
143
143
  let SimpleChannel = C;
144
144
  class Subscription {
145
145
  constructor(e, t) {
146
- u(this, "revoke");
146
+ a(this, "revoke");
147
147
  this._channel = e, this.revoke = this.setReceiver((s) => t == null ? void 0 : t(s));
148
148
  }
149
149
  setReceiver(e) {
@@ -160,7 +160,7 @@ class Subject {
160
160
  /* We maintain channels for sending messages.
161
161
  * Receiving channels are instantiated per subscription.
162
162
  */
163
- u(this, "publishChannels", /* @__PURE__ */ new Map());
163
+ a(this, "publishChannels", /* @__PURE__ */ new Map());
164
164
  }
165
165
  getChannelName(e) {
166
166
  return "Subject:" + e;
@@ -195,9 +195,9 @@ const ASYNC_DATA_NAME = {
195
195
  class Promisified {
196
196
  constructor() {
197
197
  //-------------------------------------
198
- u(this, "_resolution");
199
- u(this, "_rejection");
200
- u(this, "_promise", new Promise((e, t) => {
198
+ a(this, "_resolution");
199
+ a(this, "_rejection");
200
+ a(this, "_promise", new Promise((e, t) => {
201
201
  this._resolution = e, this._rejection = t;
202
202
  }));
203
203
  }
@@ -214,8 +214,8 @@ class Promisified {
214
214
  class NotifyFramework {
215
215
  constructor() {
216
216
  //-------------------------------------
217
- u(this, "promises", {});
218
- u(this, "subject", new Subject());
217
+ a(this, "promises", {});
218
+ a(this, "subject", new Subject());
219
219
  }
220
220
  asyncData(e) {
221
221
  return typeof this.promises[e] > "u" && (this.promises[e] = new Promisified()), this.promises[e];
@@ -246,8 +246,8 @@ const notify = new NotifyFramework(), loadedScripts$1 = {};
246
246
  class Http {
247
247
  constructor(e) {
248
248
  // Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
249
- u(this, "axios");
250
- u(this, "_latestResponse");
249
+ a(this, "axios");
250
+ a(this, "_latestResponse");
251
251
  this.axios = axios.create(e);
252
252
  }
253
253
  setCdn(e) {
@@ -327,8 +327,8 @@ class Http {
327
327
  const r = s ?? "exports", i = this.toAxiosConfig(t);
328
328
  return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((o) => this.mapAxiosResponse(o, t)).then((o) => {
329
329
  try {
330
- const a = `"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;
331
- return Function(a)();
330
+ const u = `"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;
331
+ return Function(u)();
332
332
  } catch {
333
333
  return o;
334
334
  }
@@ -344,7 +344,7 @@ class Http {
344
344
  }
345
345
  class TransportFramework {
346
346
  constructor() {
347
- u(this, "_http", new Http());
347
+ a(this, "_http", new Http());
348
348
  }
349
349
  get http() {
350
350
  return this._http;
@@ -363,11 +363,11 @@ class ConfigurationFrameworkFactory {
363
363
  const http$2 = transport.http;
364
364
  class Session {
365
365
  constructor() {
366
- u(this, "_me", null);
367
- u(this, "_currentLanguage", "");
368
- u(this, "_notLoggedIn", !0);
369
- u(this, "_description");
370
- u(this, "_profile");
366
+ a(this, "_me", null);
367
+ a(this, "_currentLanguage", "");
368
+ a(this, "_notLoggedIn", !0);
369
+ a(this, "_description");
370
+ a(this, "_profile");
371
371
  }
372
372
  get currentLanguage() {
373
373
  return this._currentLanguage;
@@ -412,7 +412,7 @@ class Session {
412
412
  hasRight(e, t) {
413
413
  if (t === "owner")
414
414
  return e.owner && e.owner.userId === this._me.userId;
415
- 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, o = t.workflow ? this.hasWorkflow(t.workflow) : !0;
415
+ const s = t.right || t, i = e.shared.filter((u) => (this._me.groupsIds || []).indexOf(u.groupId) !== -1 || u.userId === this._me.userId).find((u) => u[s] || u.manager) !== void 0, o = t.workflow ? this.hasWorkflow(t.workflow) : !0;
416
416
  return i && o;
417
417
  }
418
418
  ////////////////////////////////////////////////////////// Storage management
@@ -485,7 +485,7 @@ class Session {
485
485
  }
486
486
  class SessionFramework {
487
487
  constructor() {
488
- u(this, "session", new Session());
488
+ a(this, "session", new Session());
489
489
  }
490
490
  initialize() {
491
491
  return this.session.initialize();
@@ -509,22 +509,22 @@ class SessionFramework {
509
509
  const session = new SessionFramework();
510
510
  class Theme {
511
511
  constructor() {
512
- u(this, "_conf");
513
- u(this, "_loaded");
512
+ a(this, "_conf");
513
+ a(this, "_loaded");
514
514
  // legacy (readonly)
515
- u(this, "skinName", "");
516
- u(this, "themeName", "");
517
- u(this, "skin", "raw");
518
- u(this, "themeUrl", "/assets/themes/raw/default/");
519
- u(this, "templateOverrides", {});
520
- u(this, "portalTemplate", "/assets/themes/raw/portal.html");
521
- u(this, "basePath", "");
522
- u(this, "logoutCallback", "");
523
- u(this, "skins", []);
524
- u(this, "is1D", !1);
525
- u(this, "is2D", !1);
526
- u(this, "_onSkinReady", notify.onSkinReady());
527
- u(this, "_onOverrideReady", notify.onOverridesReady());
515
+ a(this, "skinName", "");
516
+ a(this, "themeName", "");
517
+ a(this, "skin", "raw");
518
+ a(this, "themeUrl", "/assets/themes/raw/default/");
519
+ a(this, "templateOverrides", {});
520
+ a(this, "portalTemplate", "/assets/themes/raw/portal.html");
521
+ a(this, "basePath", "");
522
+ a(this, "logoutCallback", "");
523
+ a(this, "skins", []);
524
+ a(this, "is1D", !1);
525
+ a(this, "is2D", !1);
526
+ a(this, "_onSkinReady", notify.onSkinReady());
527
+ a(this, "_onOverrideReady", notify.onOverridesReady());
528
528
  }
529
529
  initialize(e) {
530
530
  return notify.onSessionReady().promise.then(() => this.load(e));
@@ -858,9 +858,9 @@ class Idiom {
858
858
  const i = new Promisified();
859
859
  promises$1[t] = i.promise;
860
860
  const o = {};
861
- e && (o["Accept-Language"] = e), transport.http.get(t, { headers: o }).then((a) => {
862
- Object.assign(bundle$1, a), typeof s == "function" && s(), i.resolve();
863
- }).catch((a) => {
861
+ e && (o["Accept-Language"] = e), transport.http.get(t, { headers: o }).then((u) => {
862
+ Object.assign(bundle$1, u), typeof s == "function" && s(), i.resolve();
863
+ }).catch((u) => {
864
864
  typeof s == "function" && s(), i.reject();
865
865
  });
866
866
  }
@@ -896,7 +896,7 @@ class Idiom {
896
896
  class UserPreferences {
897
897
  constructor() {
898
898
  //-------------------------------------
899
- u(this, "data", {});
899
+ a(this, "data", {});
900
900
  }
901
901
  get(e) {
902
902
  return this.data[e];
@@ -923,10 +923,10 @@ class UserPreferences {
923
923
  class User {
924
924
  constructor() {
925
925
  //-------------------------------------
926
- u(this, "_me", null);
927
- u(this, "_keepOpenOnLogout", !1);
928
- u(this, "_preferences", new UserPreferences());
929
- u(this, "_bookmarkedApps", []);
926
+ a(this, "_me", null);
927
+ a(this, "_keepOpenOnLogout", !1);
928
+ a(this, "_preferences", new UserPreferences());
929
+ a(this, "_bookmarkedApps", []);
930
930
  }
931
931
  get keepOpenOnLogout() {
932
932
  return this._keepOpenOnLogout;
@@ -970,7 +970,7 @@ class User {
970
970
  });
971
971
  let r = !0;
972
972
  const i = [];
973
- s.bookmarks.forEach((o, a) => {
973
+ s.bookmarks.forEach((o, u) => {
974
974
  const c = this._me.apps.find((l) => l.name === o);
975
975
  if (c) {
976
976
  const l = Object.assign({}, c);
@@ -978,8 +978,8 @@ class User {
978
978
  } else
979
979
  i.push(o), r = !1;
980
980
  }), i.forEach((o) => {
981
- const a = s.bookmarks.indexOf(o);
982
- a !== -1 && s.bookmarks.splice(a, 1);
981
+ const u = s.bookmarks.indexOf(o);
982
+ u !== -1 && s.bookmarks.splice(u, 1);
983
983
  }), r || transport.http.putJson("/userbook/preference/apps", s);
984
984
  });
985
985
  }
@@ -1000,9 +1000,9 @@ const http$1 = transport == null ? void 0 : transport.http;
1000
1000
  class AppConf {
1001
1001
  constructor() {
1002
1002
  //-------------------------------------
1003
- u(this, "_publicConf", {});
1004
- u(this, "_currentApp");
1005
- u(this, "_appConf", {});
1003
+ a(this, "_publicConf", {});
1004
+ a(this, "_currentApp");
1005
+ a(this, "_appConf", {});
1006
1006
  }
1007
1007
  /**
1008
1008
  * Get the currently initialized App.
@@ -1040,8 +1040,8 @@ class AppConf {
1040
1040
  class Analytics {
1041
1041
  constructor() {
1042
1042
  //-------------------------------------
1043
- u(this, "_status", "void");
1044
- u(this, "_params");
1043
+ a(this, "_status", "void");
1044
+ a(this, "_params");
1045
1045
  }
1046
1046
  get status() {
1047
1047
  return this._status;
@@ -1082,9 +1082,9 @@ class Analytics {
1082
1082
  const t = await notify.onSessionReady().promise, s = session.session.description;
1083
1083
  let r;
1084
1084
  for (const l of t.structures) {
1085
- const h = e.structureMap[l];
1086
- if (h && h.collectiviteId && h.UAI) {
1087
- r = h;
1085
+ const p = e.structureMap[l];
1086
+ if (p && p.collectiviteId && p.UAI) {
1087
+ r = p;
1088
1088
  break;
1089
1089
  }
1090
1090
  }
@@ -1095,11 +1095,11 @@ class Analytics {
1095
1095
  if (!i) return;
1096
1096
  const o = i.xiti;
1097
1097
  if (!o || !o.LIBELLE_SERVICE || !r.UAI) return;
1098
- function a(l) {
1099
- let h = "";
1100
- for (let E = 0; E < l.length; E++)
1101
- h += l.charCodeAt(E);
1102
- return h;
1098
+ function u(l) {
1099
+ let p = "";
1100
+ for (let d = 0; d < l.length; d++)
1101
+ p += l.charCodeAt(d);
1102
+ return p;
1103
1103
  }
1104
1104
  const c = {
1105
1105
  Student: "ELEVE",
@@ -1118,7 +1118,7 @@ class Analytics {
1118
1118
  PROJET: r.projetId ? r.projetId : e.ID_PROJET,
1119
1119
  EXPLOITANT: e.ID_EXPLOITANT,
1120
1120
  PLATFORME: r.plateformeId ? r.plateformeId : e.ID_PLATEFORME,
1121
- ID_PERSO: a(t.userId),
1121
+ ID_PERSO: u(t.userId),
1122
1122
  PROFILE: s.profiles && s.profiles.length > 0 ? c[s.profiles[0]] ?? "" : ""
1123
1123
  };
1124
1124
  }
@@ -1146,12 +1146,12 @@ function detectDevice() {
1146
1146
  if (typeof window > "u")
1147
1147
  return { osName: "", osVersion: "", deviceType: "", deviceName: "" };
1148
1148
  const n = UAParser(), e = isPad(), t = n.device.vendor || "", s = n.device.model || "", r = t && s ? `${t} ${s}` : s || t || "Unknown";
1149
- let i = n.os.name || "Unknown", o = n.device.type || (e ? "tablet" : "desktop"), a = r;
1150
- return e && i.toLowerCase() == "macos" && (i = "iPadOS", o = "tablet", a = "iPad"), {
1149
+ let i = n.os.name || "Unknown", o = n.device.type || (e ? "tablet" : "desktop"), u = r;
1150
+ return e && i.toLowerCase() == "macos" && (i = "iPadOS", o = "tablet", u = "iPad"), {
1151
1151
  osName: i,
1152
1152
  osVersion: n.os.version || "Unknown",
1153
1153
  deviceType: o,
1154
- deviceName: a
1154
+ deviceName: u
1155
1155
  };
1156
1156
  }
1157
1157
  function readDeviceCookies() {
@@ -1177,7 +1177,7 @@ function setDeviceCookies() {
1177
1177
  class ConfigurationFramework {
1178
1178
  constructor() {
1179
1179
  //-------------------------------------
1180
- u(this, "Platform", {
1180
+ a(this, "Platform", {
1181
1181
  deploymentTag: "",
1182
1182
  cdnDomain: "",
1183
1183
  apps: new AppConf(),
@@ -1186,16 +1186,16 @@ class ConfigurationFramework {
1186
1186
  idiom: new Idiom(),
1187
1187
  listLanguages: () => transport.http.get("/languages")
1188
1188
  });
1189
- u(this, "School", {
1189
+ a(this, "School", {
1190
1190
  //apps; -> pinnedApps;
1191
1191
  });
1192
- u(this, "User", new User());
1192
+ a(this, "User", new User());
1193
1193
  setDeviceCookies();
1194
1194
  }
1195
1195
  async initialize(e, t) {
1196
1196
  if (!e) {
1197
- const r = (l) => (l < 10 ? "0" : "") + l.toFixed(0), i = /* @__PURE__ */ new Date(), o = i.getFullYear(), a = i.getMonth() + 1, c = i.getDate();
1198
- e = `${o}${r(a)}${r(c)}`;
1197
+ const r = (l) => (l < 10 ? "0" : "") + l.toFixed(0), i = /* @__PURE__ */ new Date(), o = i.getFullYear(), u = i.getMonth() + 1, c = i.getDate();
1198
+ e = `${o}${r(u)}${r(c)}`;
1199
1199
  }
1200
1200
  const s = e;
1201
1201
  this.Platform.deploymentTag = e, typeof t == "string" && t.length > 0 && (this.Platform.cdnDomain = t), transport.http.setCdn(this.Platform.cdnDomain), await Promise.all([
@@ -1233,12 +1233,12 @@ class ConfigurationFramework {
1233
1233
  // }
1234
1234
  }
1235
1235
  const configure = new ConfigurationFramework(), http = transport == null ? void 0 : transport.http;
1236
- var _;
1237
- const me = (_ = session == null ? void 0 : session.session) == null ? void 0 : _.user;
1236
+ var D;
1237
+ const me = (D = session == null ? void 0 : session.session) == null ? void 0 : D.user;
1238
1238
  class Notification {
1239
1239
  constructor(e) {
1240
- u(this, "_id");
1241
- u(this, "model");
1240
+ a(this, "_id");
1241
+ a(this, "model");
1242
1242
  e.reported = e.reporters && e.reporters.length > 0, this._id = e._id, this.model = e;
1243
1243
  }
1244
1244
  isUnread() {
@@ -1258,14 +1258,14 @@ class Notification {
1258
1258
  class TimelineApp {
1259
1259
  constructor() {
1260
1260
  //-------------------------------------
1261
- u(this, "_notifications", []);
1262
- u(this, "_notificationTypes", []);
1261
+ a(this, "_notifications", []);
1262
+ a(this, "_notificationTypes", []);
1263
1263
  // ex: ["BLOG"]
1264
- u(this, "_flashMessages", []);
1265
- u(this, "_pageNumber", 0);
1266
- u(this, "_lastPage", !1);
1267
- u(this, "_loading", !1);
1268
- u(this, "showMine", !1);
1264
+ a(this, "_flashMessages", []);
1265
+ a(this, "_pageNumber", 0);
1266
+ a(this, "_lastPage", !1);
1267
+ a(this, "_loading", !1);
1268
+ a(this, "showMine", !1);
1269
1269
  }
1270
1270
  get notifications() {
1271
1271
  return this._notifications;
@@ -1324,7 +1324,7 @@ class TimelineApp {
1324
1324
  if (r.number && r.results) {
1325
1325
  const i = r.results.filter(
1326
1326
  (o) => this._notifications.findIndex(
1327
- (a) => a._id === o._id
1327
+ (u) => u._id === o._id
1328
1328
  ) === -1
1329
1329
  ).map((o) => new Notification(o));
1330
1330
  this._notifications = this._notifications.concat(i), this._pageNumber++;
@@ -1355,7 +1355,126 @@ const ReactionTypes = [
1355
1355
  "REACTION_2",
1356
1356
  "REACTION_3",
1357
1357
  "REACTION_4"
1358
+ ], GOOGLE_DRIVE_FOLDER_MIME_TYPE = "application/vnd.google-apps.folder", GOOGLE_DRIVE_NATIVE_MIME_TYPE_PREFIX = "application/vnd.google-apps.", GOOGLE_DRIVE_EXPORTABLE_MIME_TYPES = [
1359
+ "application/vnd.google-apps.document",
1360
+ "application/vnd.google-apps.spreadsheet",
1361
+ "application/vnd.google-apps.presentation"
1358
1362
  ];
1363
+ function toGoogleDriveDocument(n) {
1364
+ const e = n.mimeType === GOOGLE_DRIVE_FOLDER_MIME_TYPE;
1365
+ return {
1366
+ id: n.id,
1367
+ name: n.name,
1368
+ ownerDisplayName: n.ownerDisplayName,
1369
+ contentType: n.mimeType,
1370
+ size: n.size,
1371
+ isFolder: e,
1372
+ canCopyToWorkspace: e || !n.mimeType.startsWith(GOOGLE_DRIVE_NATIVE_MIME_TYPE_PREFIX) || GOOGLE_DRIVE_EXPORTABLE_MIME_TYPES.includes(n.mimeType),
1373
+ lastModified: n.modifiedTime,
1374
+ shared: n.shared
1375
+ };
1376
+ }
1377
+ class GoogleDriveCopyError extends Error {
1378
+ constructor(e, t, s) {
1379
+ super(e), this.copied = t, this.failures = s, this.name = "GoogleDriveCopyError";
1380
+ }
1381
+ }
1382
+ class GoogleDriveService {
1383
+ constructor(e) {
1384
+ this.context = e;
1385
+ }
1386
+ get http() {
1387
+ return this.context.http();
1388
+ }
1389
+ /**
1390
+ * List a user's Google Drive documents and folders inside a given folder.
1391
+ *
1392
+ * Google Drive addresses its entries by opaque id, not by path: `parentId` is
1393
+ * the id of the folder to list. The query param is nonetheless named `path`,
1394
+ * as the backend kept the name it uses for Nextcloud.
1395
+ *
1396
+ * @param userId - the id of the user whose files are listed.
1397
+ * @param parentId - id of the folder to list; the Drive root when omitted.
1398
+ */
1399
+ async listDocuments(e, t) {
1400
+ return (await this.http.get(
1401
+ `/googledrive/files/user/${e}`,
1402
+ { queryParams: t ? { path: t } : void 0 }
1403
+ )).data.map(toGoogleDriveDocument);
1404
+ }
1405
+ /**
1406
+ * List the documents and folders other users shared with a user. Browse the
1407
+ * content of a shared folder with `listDocuments`, from the folder's id.
1408
+ *
1409
+ * As in the legacy workspace, only a document shared for editing can be
1410
+ * copied to the workspace: an owner can forbid readers and commenters to
1411
+ * download a file (copyRequiresWriterPermission), which fails the copy.
1412
+ *
1413
+ * @param userId - the id of the user the documents are shared with.
1414
+ */
1415
+ async listSharedDocuments(e) {
1416
+ return (await this.http.get(`/googledrive/files/user/${e}/shared`)).data.map(({ owners: s, role: r, ...i }) => {
1417
+ var u;
1418
+ const o = toGoogleDriveDocument({
1419
+ ...i,
1420
+ ownerDisplayName: (u = s == null ? void 0 : s[0]) == null ? void 0 : u.displayName
1421
+ });
1422
+ return {
1423
+ ...o,
1424
+ canCopyToWorkspace: o.canCopyToWorkspace && r === "writer"
1425
+ };
1426
+ });
1427
+ }
1428
+ /**
1429
+ * Copy Google Drive documents into the entcore workspace.
1430
+ *
1431
+ * @param userId - the id of the user whose files are copied.
1432
+ * @param ids - Drive ids of the documents to copy.
1433
+ * @param parentId - the workspace folder to copy into; user's root when omitted.
1434
+ * @param params.application - the application the documents are added from.
1435
+ * @param params.visibility - "protected" files the documents under the
1436
+ * documents added from applications, the way an upload does.
1437
+ * @throws GoogleDriveCopyError when the backend reports at least one failure.
1438
+ */
1439
+ async copyDocumentToWorkspace(e, t, s, r) {
1440
+ const i = t.map((d) => `id=${encodeURIComponent(d)}`).join("&"), u = (await this.http.put(
1441
+ `/googledrive/files/user/${e}/copy/workspace?${i}`,
1442
+ void 0,
1443
+ {
1444
+ queryParams: {
1445
+ ...s ? { parentId: s } : {},
1446
+ ...r != null && r.application ? { application: r.application } : {},
1447
+ ...(r == null ? void 0 : r.visibility) === "protected" ? { protected: !0 } : {}
1448
+ }
1449
+ }
1450
+ )).data ?? [], c = u.map((d) => d.workspace).filter((d) => !!(d != null && d._id)), l = new Set(u.map((d) => d.id)), p = [
1451
+ ...u.filter((d) => {
1452
+ var h;
1453
+ return d.status === "error" || !((h = d.workspace) != null && h._id);
1454
+ }).map(({ id: d, message: h }) => ({ id: d, message: h })),
1455
+ ...t.filter((d) => !l.has(d)).map((d) => ({ id: d, message: void 0 }))
1456
+ ];
1457
+ if (p.length > 0)
1458
+ throw new GoogleDriveCopyError(
1459
+ `Failed to copy ${p.length} of ${t.length} Google Drive document(s) to the workspace`,
1460
+ c,
1461
+ p
1462
+ );
1463
+ return c;
1464
+ }
1465
+ /**
1466
+ * Build the URL to download/preview a Google Drive document.
1467
+ * There is no dedicated thumbnail endpoint on the backend, so this is also
1468
+ * used as an image preview source for image documents.
1469
+ * @param userId - the id of the user who owns the file.
1470
+ * @param doc - the document to build the URL for.
1471
+ */
1472
+ getFileUrl(e, t) {
1473
+ return `/googledrive/files/user/${e}/file/${encodeURIComponent(
1474
+ t.id
1475
+ )}/download?isFolder=${t.isFolder}`;
1476
+ }
1477
+ }
1359
1478
  class NotifyFrameworkFactory {
1360
1479
  static instance() {
1361
1480
  return notify;
@@ -1414,7 +1533,7 @@ const m = class m {
1414
1533
  //
1415
1534
  // PROTECTED HELPERS
1416
1535
  //
1417
- u(this, "checkHttpResponse", (e) => {
1536
+ a(this, "checkHttpResponse", (e) => {
1418
1537
  if (this.http.latestResponse.status >= 300)
1419
1538
  throw this.http.latestResponse.statusText;
1420
1539
  return e;
@@ -1632,22 +1751,22 @@ const m = class m {
1632
1751
  //
1633
1752
  // STATIC REGISTRY
1634
1753
  //
1635
- u(m, "registry", new ServiceRegistry()), // Expose some useful functions
1636
- u(m, "register", m.registry.register.bind(m.registry)), u(m, "findService", m.registry.findService.bind(m.registry)), u(m, "findMainService", m.registry.findMainService.bind(m.registry)), u(m, "isRegistered", m.registry.isRegistered.bind(m.registry));
1754
+ a(m, "registry", new ServiceRegistry()), // Expose some useful functions
1755
+ a(m, "register", m.registry.register.bind(m.registry)), a(m, "findService", m.registry.findService.bind(m.registry)), a(m, "findMainService", m.registry.findMainService.bind(m.registry)), a(m, "isRegistered", m.registry.isRegistered.bind(m.registry));
1637
1756
  let ResourceService = m;
1638
1757
  const APP$3 = "collaborativeeditor", RESOURCE$3 = "collaborativeeditor";
1639
1758
  class CollaborativeEditorResourceService extends ResourceService {
1640
1759
  async create(e) {
1641
- const { name: t, description: s, thumbnail: r, folder: i } = e, o = r ? await this.getThumbnailPath(r) : "", a = await this.http.post("/collaborativeeditor", {
1760
+ const { name: t, description: s, thumbnail: r, folder: i } = e, o = r ? await this.getThumbnailPath(r) : "", u = await this.http.post("/collaborativeeditor", {
1642
1761
  name: t,
1643
1762
  description: s,
1644
1763
  thumbnail: o,
1645
1764
  folder: i
1646
1765
  });
1647
- return this.checkHttpResponse(a), a;
1766
+ return this.checkHttpResponse(u), u;
1648
1767
  }
1649
1768
  async update(e) {
1650
- const { name: t, description: s, thumbnail: r, entId: i } = e, o = await this.getThumbnailPath(r), a = await this.http.put(
1769
+ const { name: t, description: s, thumbnail: r, entId: i } = e, o = await this.getThumbnailPath(r), u = await this.http.put(
1651
1770
  `/collaborativeeditor/${i}`,
1652
1771
  {
1653
1772
  name: t,
@@ -1655,7 +1774,7 @@ class CollaborativeEditorResourceService extends ResourceService {
1655
1774
  thumbnail: o
1656
1775
  }
1657
1776
  );
1658
- return this.checkHttpResponse(a), { thumbnail: o, entId: i };
1777
+ return this.checkHttpResponse(u), { thumbnail: o, entId: i };
1659
1778
  }
1660
1779
  getResourceType() {
1661
1780
  return RESOURCE$3;
@@ -1910,9 +2029,9 @@ class AnalyticsService {
1910
2029
  let r;
1911
2030
  if (!(t != null && t.structures)) return;
1912
2031
  for (const l of t.structures) {
1913
- const h = n.structureMap[l];
1914
- if (h && h.collectiviteId && h.UAI) {
1915
- r = h;
2032
+ const p = n.structureMap[l];
2033
+ if (p && p.collectiviteId && p.UAI) {
2034
+ r = p;
1916
2035
  break;
1917
2036
  }
1918
2037
  }
@@ -1921,11 +2040,11 @@ class AnalyticsService {
1921
2040
  if (!i) return;
1922
2041
  const o = i.xiti;
1923
2042
  if (!o || !o.LIBELLE_SERVICE || !r.UAI) return;
1924
- function a(l) {
1925
- let h = "";
1926
- for (let E = 0; E < l.length; E++)
1927
- h += l.charCodeAt(E);
1928
- return h;
2043
+ function u(l) {
2044
+ let p = "";
2045
+ for (let d = 0; d < l.length; d++)
2046
+ p += l.charCodeAt(d);
2047
+ return p;
1929
2048
  }
1930
2049
  const c = {
1931
2050
  Student: "ELEVE",
@@ -1944,7 +2063,7 @@ class AnalyticsService {
1944
2063
  PROJET: r.projetId ? r.projetId : n.ID_PROJET,
1945
2064
  EXPLOITANT: n.ID_EXPLOITANT,
1946
2065
  PLATFORME: r.plateformeId ? r.plateformeId : n.ID_PLATEFORME,
1947
- ID_PERSO: a(t.userId),
2066
+ ID_PERSO: u(t.userId),
1948
2067
  PROFILE: s && s.length > 0 ? c[s[0]] ?? "" : ""
1949
2068
  };
1950
2069
  }
@@ -2179,25 +2298,25 @@ class ConfService {
2179
2298
  conf: t,
2180
2299
  publicTheme: s
2181
2300
  }) {
2182
- var E;
2183
- const r = await this.http.get("/theme"), i = (E = t == null ? void 0 : t.overriding) == null ? void 0 : E.find(
2184
- (p) => (
2301
+ var d;
2302
+ const r = await this.http.get("/theme"), i = (d = t == null ? void 0 : t.overriding) == null ? void 0 : d.find(
2303
+ (h) => (
2185
2304
  // Fix #WB2-2660:
2186
2305
  // If Public access => get the neo theme
2187
2306
  // Else get the theme from the user preference
2188
- s ? p.parent === "theme-open-ent" && p.bootstrapVersion === "ode-bootstrap-neo" : p.child === (r == null ? void 0 : r.themeName)
2307
+ s ? h.parent === "theme-open-ent" && h.bootstrapVersion === "ode-bootstrap-neo" : h.child === (r == null ? void 0 : r.themeName)
2189
2308
  )
2190
- ), o = s ? "default" : (r == null ? void 0 : r.skinName) || (i == null ? void 0 : i.skins[0]), a = (r == null ? void 0 : r.skin) || `/assets/themes/${i == null ? void 0 : i.child}/skins/${o}/`, c = i == null ? void 0 : i.skins, l = i == null ? void 0 : i.bootstrapVersion.split("-").slice(-1)[0], h = (i == null ? void 0 : i.parent) === "panda";
2309
+ ), o = s ? "default" : (r == null ? void 0 : r.skinName) || (i == null ? void 0 : i.skins[0]), u = (r == null ? void 0 : r.skin) || `/assets/themes/${i == null ? void 0 : i.child}/skins/${o}/`, c = i == null ? void 0 : i.skins, l = i == null ? void 0 : i.bootstrapVersion.split("-").slice(-1)[0], p = (i == null ? void 0 : i.parent) === "panda";
2191
2310
  return {
2192
- basePath: `${this.cdnDomain}${a}../../`,
2311
+ basePath: `${this.cdnDomain}${u}../../`,
2193
2312
  bootstrapVersion: l,
2194
- is1d: h,
2313
+ is1d: p,
2195
2314
  logoutCallback: (r == null ? void 0 : r.logoutCallback) || "",
2196
2315
  skin: i == null ? void 0 : i.child,
2197
2316
  skinName: o,
2198
2317
  skins: c,
2199
2318
  themeName: i == null ? void 0 : i.child,
2200
- themeUrl: a,
2319
+ themeUrl: u,
2201
2320
  npmTheme: (i == null ? void 0 : i.npmTheme) ?? void 0,
2202
2321
  uiOverrides: i == null ? void 0 : i.uiOverrides
2203
2322
  };
@@ -2214,7 +2333,7 @@ class ConfService {
2214
2333
  const SEND_ALL = "*";
2215
2334
  class WebBroker {
2216
2335
  constructor(e) {
2217
- u(this, "subscription");
2336
+ a(this, "subscription");
2218
2337
  this.odeServices = e;
2219
2338
  }
2220
2339
  get http() {
@@ -2246,10 +2365,10 @@ class WebBroker {
2246
2365
  }
2247
2366
  class DataService {
2248
2367
  constructor(e) {
2249
- u(this, "_webBroker");
2250
- u(this, "app");
2251
- u(this, "user");
2252
- u(this, "profile");
2368
+ a(this, "_webBroker");
2369
+ a(this, "app");
2370
+ a(this, "user");
2371
+ a(this, "profile");
2253
2372
  this.odeServices = e;
2254
2373
  }
2255
2374
  get conf() {
@@ -2283,7 +2402,7 @@ class DataService {
2283
2402
  addUserInfos(e) {
2284
2403
  return this.user && (e.userId = this.user.userId, e.structure = this.user.structureNames[0]), this.profile && (e.profil = this.profile[0]), e;
2285
2404
  }
2286
- trackVideoSave(e, t, s, r, i, o, a) {
2405
+ trackVideoSave(e, t, s, r, i, o, u) {
2287
2406
  const c = this.addUserInfos({
2288
2407
  "event-type": "VIDEO_SAVE",
2289
2408
  module: this.app || "video",
@@ -2294,7 +2413,7 @@ class DataService {
2294
2413
  source: r ? "CAPTURED" : "UPLOADED",
2295
2414
  url: i
2296
2415
  });
2297
- a && (c.device_type = a), this.trackWebEvent(c);
2416
+ u && (c.device_type = u), this.trackWebEvent(c);
2298
2417
  }
2299
2418
  trackVideoRead(e, t, s, r, i) {
2300
2419
  const o = this.addUserInfos({
@@ -2362,14 +2481,14 @@ class DirectoryService {
2362
2481
  id: s,
2363
2482
  displayName: r,
2364
2483
  notVisibleCount: o,
2365
- groups: t.map(({ name: a, id: c, nbUsers: l }) => ({
2484
+ groups: t.map(({ name: u, id: c, nbUsers: l }) => ({
2366
2485
  nbUsers: l,
2367
- displayName: a,
2486
+ displayName: u,
2368
2487
  id: c
2369
2488
  })),
2370
- users: i.map(({ displayName: a, id: c, profile: l }) => ({
2489
+ users: i.map(({ displayName: u, id: c, profile: l }) => ({
2371
2490
  profile: l,
2372
- displayName: a,
2491
+ displayName: u,
2373
2492
  // these info are missing from api
2374
2493
  firstName: "",
2375
2494
  lastName: "",
@@ -2384,9 +2503,9 @@ class DirectoryService {
2384
2503
  users: r
2385
2504
  }) {
2386
2505
  this.cache.clearCache("/directory/sharebookmark/all");
2387
- const i = r.map((p) => typeof p == "string" ? p : p.id), o = s.map((p) => typeof p == "string" ? p : p.id), a = t.map(async (p) => {
2388
- if (typeof p == "string") {
2389
- const { displayName: y, groups: d, id: g, notVisibleCount: A, users: f } = await this.getBookMarkById(p), w = f.map((D) => D.id), F = d.map((D) => D.id);
2506
+ const i = r.map((h) => typeof h == "string" ? h : h.id), o = s.map((h) => typeof h == "string" ? h : h.id), u = t.map(async (h) => {
2507
+ if (typeof h == "string") {
2508
+ const { displayName: y, groups: E, id: g, notVisibleCount: A, users: f } = await this.getBookMarkById(h), w = f.map((_) => _.id), F = E.map((_) => _.id);
2390
2509
  return {
2391
2510
  displayName: y,
2392
2511
  id: g,
@@ -2394,19 +2513,19 @@ class DirectoryService {
2394
2513
  members: [...F, ...w]
2395
2514
  };
2396
2515
  } else
2397
- return Promise.resolve(p);
2398
- }), l = (await Promise.all(a)).map((p) => p.members).reduce((p, y) => [...p, ...y], []), h = {
2516
+ return Promise.resolve(h);
2517
+ }), l = (await Promise.all(u)).map((h) => h.members).reduce((h, y) => [...h, ...y], []), p = {
2399
2518
  name: e,
2400
2519
  members: [...i, ...o, ...l]
2401
- }, { id: E } = await this.http.postJson(
2520
+ }, { id: d } = await this.http.postJson(
2402
2521
  "/directory/sharebookmark",
2403
- h
2522
+ p
2404
2523
  );
2405
2524
  return {
2406
- id: E,
2525
+ id: d,
2407
2526
  displayName: e,
2408
2527
  notVisibleCount: 0,
2409
- members: h.members
2528
+ members: p.members
2410
2529
  };
2411
2530
  }
2412
2531
  }
@@ -2445,10 +2564,10 @@ class EmbedderService {
2445
2564
  urlIsFromPattern(e, t) {
2446
2565
  const s = new RegExp("[^{}]+(?=(?:[^{}]*{[^}]*})*[^}]*$)", "g"), r = new RegExp("{[^}]*}", "g");
2447
2566
  let i = !0;
2448
- const o = t.match(s) || [], a = [];
2449
- return (t.match(r) || []).forEach((l, h) => {
2450
- l.includes("ignore") || a.push(o[h]);
2451
- }), a.forEach((l) => {
2567
+ const o = t.match(s) || [], u = [];
2568
+ return (t.match(r) || []).forEach((l, p) => {
2569
+ l.includes("ignore") || u.push(o[p]);
2570
+ }), u.forEach((l) => {
2452
2571
  if (!e.includes(l)) {
2453
2572
  i = !1;
2454
2573
  return;
@@ -2479,17 +2598,17 @@ class EmbedderService {
2479
2598
  if (this.urlIsFromPattern(t, s)) {
2480
2599
  const r = new RegExp("{[a-zA-Z0-9_.]+}", "g"), i = s.match(r) || [];
2481
2600
  let o = e.embed;
2482
- for (const a of i) {
2483
- let c = s.split(a)[0];
2601
+ for (const u of i) {
2602
+ let c = s.split(u)[0];
2484
2603
  const l = c.split("}");
2485
2604
  l.length > 1 && (c = l[l.length - 1]);
2486
- let h = t.split(c)[1];
2487
- if (!h)
2605
+ let p = t.split(c)[1];
2606
+ if (!p)
2488
2607
  continue;
2489
- const E = s.split(a)[1].split("{")[0];
2490
- E && (h = h.split(E)[0]);
2491
- const p = new RegExp("\\" + a.replace(/}/, "\\}"), "g");
2492
- o = o.replace(p, h);
2608
+ const d = s.split(u)[1].split("{")[0];
2609
+ d && (p = p.split(d)[0]);
2610
+ const h = new RegExp("\\" + u.replace(/}/, "\\}"), "g");
2611
+ o = o.replace(h, p);
2493
2612
  }
2494
2613
  return o;
2495
2614
  }
@@ -2743,9 +2862,9 @@ class IdiomService {
2743
2862
  const i = new Promisified();
2744
2863
  promises[t] = i.promise;
2745
2864
  const o = {};
2746
- e && (o["Accept-Language"] = e), this.http.get(t, { headers: o }).then((a) => {
2747
- Object.assign(bundle, a), typeof s == "function" && s(), i.resolve();
2748
- }).catch((a) => {
2865
+ e && (o["Accept-Language"] = e), this.http.get(t, { headers: o }).then((u) => {
2866
+ Object.assign(bundle, u), typeof s == "function" && s(), i.resolve();
2867
+ }).catch((u) => {
2749
2868
  typeof s == "function" && s(), i.reject();
2750
2869
  });
2751
2870
  }
@@ -2824,7 +2943,7 @@ class NextcloudService {
2824
2943
  * documents added from applications, the way an upload does.
2825
2944
  */
2826
2945
  async copyDocumentToWorkspace(e, t, s, r) {
2827
- const i = t.map((a) => `path=${encodeURIComponent(a)}`).join("&");
2946
+ const i = t.map((u) => `path=${encodeURIComponent(u)}`).join("&");
2828
2947
  return (await this.http.put(
2829
2948
  `/nextcloud/files/user/${e}/copy/workspace?${i}`,
2830
2949
  void 0,
@@ -2835,19 +2954,7 @@ class NextcloudService {
2835
2954
  ...(r == null ? void 0 : r.visibility) === "protected" ? { protected: !0 } : {}
2836
2955
  }
2837
2956
  }
2838
- )).data.filter((a) => !!(a != null && a._id));
2839
- }
2840
- /**
2841
- * Create a folder in a user's Nextcloud.
2842
- * @param userId - the id of the user who owns the Nextcloud.
2843
- * @param path - path of the folder to create, relative to the user's Nextcloud root.
2844
- */
2845
- async createFolder(e, t) {
2846
- await this.http.post(
2847
- `/nextcloud/files/user/${e}/create/folder`,
2848
- void 0,
2849
- { queryParams: { path: t } }
2850
- );
2957
+ )).data.filter((u) => !!(u != null && u._id));
2851
2958
  }
2852
2959
  /**
2853
2960
  * Check whether a user has an active Nextcloud OAuth2 connection.
@@ -2881,7 +2988,7 @@ class AbstractBehaviourService {
2881
2988
  //-----------------
2882
2989
  //--- Utilities ---
2883
2990
  //-----------------
2884
- u(this, "_cache");
2991
+ a(this, "_cache");
2885
2992
  this.context = e, this._cache = new CacheService(this.context);
2886
2993
  }
2887
2994
  getApplication() {
@@ -2915,8 +3022,8 @@ class AbstractBehaviourService {
2915
3022
  class ActualitesBehaviour extends AbstractBehaviourService {
2916
3023
  constructor() {
2917
3024
  super(...arguments);
2918
- u(this, "APP", "actualites");
2919
- u(this, "RESOURCE", "actualites");
3025
+ a(this, "APP", "actualites");
3026
+ a(this, "RESOURCE", "actualites");
2920
3027
  }
2921
3028
  async loadResources() {
2922
3029
  const [t, s] = await Promise.all([
@@ -2927,10 +3034,10 @@ class ActualitesBehaviour extends AbstractBehaviourService {
2927
3034
  /* @__PURE__ */ new Map()
2928
3035
  );
2929
3036
  return t.map((i) => {
2930
- var a;
3037
+ var u;
2931
3038
  let o;
2932
3039
  return i.threadIcon ? o = i.threadIcon + "?thumbnail=48x48" : o = "/img/icons/glyphicons_036_file.png", this.dataToResource({
2933
- title: i.title + " [" + ((a = r.get(i.threadId)) == null ? void 0 : a.title) + "]",
3040
+ title: i.title + " [" + ((u = r.get(i.threadId)) == null ? void 0 : u.title) + "]",
2934
3041
  ownerName: i.owner.displayName,
2935
3042
  owner: i.owner.id,
2936
3043
  icon: o,
@@ -2951,8 +3058,8 @@ const hexToDataUrl = (n, e = 1, t = 1) => {
2951
3058
  class AppointmentsBehaviour extends AbstractBehaviourService {
2952
3059
  constructor() {
2953
3060
  super(...arguments);
2954
- u(this, "APP", "appointments");
2955
- u(this, "RESOURCE", "appointments");
3061
+ a(this, "APP", "appointments");
3062
+ a(this, "RESOURCE", "appointments");
2956
3063
  }
2957
3064
  async loadResources() {
2958
3065
  return (await this.httpGet("/appointments/grids/linker")).map((s) => this.dataToResource({
@@ -2970,8 +3077,8 @@ class AppointmentsBehaviour extends AbstractBehaviourService {
2970
3077
  class BlogBehaviour extends AbstractBehaviourService {
2971
3078
  constructor() {
2972
3079
  super(...arguments);
2973
- u(this, "APP", "blog");
2974
- u(this, "RESOURCE", "blog");
3080
+ a(this, "APP", "blog");
3081
+ a(this, "RESOURCE", "blog");
2975
3082
  }
2976
3083
  loadResources() {
2977
3084
  return new Promise(async (t, s) => {
@@ -2979,7 +3086,7 @@ class BlogBehaviour extends AbstractBehaviourService {
2979
3086
  const r = await this.httpGet("/blog/linker"), i = [];
2980
3087
  r.forEach((o) => {
2981
3088
  o.thumbnail ? o.thumbnail = o.thumbnail + "?thumbnail=48x48" : o.thumbnail = "/img/illustrations/blog.svg";
2982
- const a = o.fetchPosts.map((c) => this.dataToResource({
3089
+ const u = o.fetchPosts.map((c) => this.dataToResource({
2983
3090
  owner: o.author.userId,
2984
3091
  ownerName: o.author.username,
2985
3092
  title: c.title + " [" + o.title + "]",
@@ -2989,7 +3096,7 @@ class BlogBehaviour extends AbstractBehaviourService {
2989
3096
  shared: !!(o.shared && o.shared.length >= 0),
2990
3097
  modified: o.modified
2991
3098
  }));
2992
- i.push(...a);
3099
+ i.push(...u);
2993
3100
  }), t(i);
2994
3101
  } catch (r) {
2995
3102
  s(r);
@@ -3000,8 +3107,8 @@ class BlogBehaviour extends AbstractBehaviourService {
3000
3107
  class CollaborativewallBehaviour extends AbstractBehaviourService {
3001
3108
  constructor() {
3002
3109
  super(...arguments);
3003
- u(this, "APP", "collaborativewall");
3004
- u(this, "RESOURCE", "collaborativewall");
3110
+ a(this, "APP", "collaborativewall");
3111
+ a(this, "RESOURCE", "collaborativewall");
3005
3112
  }
3006
3113
  async loadResources() {
3007
3114
  return (await this.httpGet(
@@ -3023,8 +3130,8 @@ class CollaborativewallBehaviour extends AbstractBehaviourService {
3023
3130
  class CommunityBehaviour extends AbstractBehaviourService {
3024
3131
  constructor() {
3025
3132
  super(...arguments);
3026
- u(this, "APP", "community");
3027
- u(this, "RESOURCE", "community");
3133
+ a(this, "APP", "community");
3134
+ a(this, "RESOURCE", "community");
3028
3135
  }
3029
3136
  async loadResources() {
3030
3137
  return (await this.httpGet(
@@ -3048,8 +3155,8 @@ class CommunityBehaviour extends AbstractBehaviourService {
3048
3155
  class ExercizerBehaviour extends AbstractBehaviourService {
3049
3156
  constructor() {
3050
3157
  super(...arguments);
3051
- u(this, "APP", "exercizer");
3052
- u(this, "RESOURCE", "exercizer");
3158
+ a(this, "APP", "exercizer");
3159
+ a(this, "RESOURCE", "exercizer");
3053
3160
  }
3054
3161
  async loadResources() {
3055
3162
  return (await this.httpGet(
@@ -3057,8 +3164,8 @@ class ExercizerBehaviour extends AbstractBehaviourService {
3057
3164
  )).map((s) => {
3058
3165
  const r = s.picture ? s.picture + "?thumbnail=48x48" : "/img/illustrations/exercizer.svg";
3059
3166
  let i, o = !1;
3060
- const a = JSON.parse(s.scheduled_at);
3061
- return a.groupList.length > 0 ? (o = !0, i = a.groupList[0].name) : a.userList.length > 0 ? (o = !0, i = a.userList[0].name) : i = "", a.groupList.length + a.userList.length > 1 && (i += "..."), this.dataToResource({
3167
+ const u = JSON.parse(s.scheduled_at);
3168
+ return u.groupList.length > 0 ? (o = !0, i = u.groupList[0].name) : u.userList.length > 0 ? (o = !0, i = u.userList[0].name) : i = "", u.groupList.length + u.userList.length > 1 && (i += "..."), this.dataToResource({
3062
3169
  title: s.title,
3063
3170
  owner: s.owner,
3064
3171
  ownerName: i,
@@ -3074,8 +3181,8 @@ class ExercizerBehaviour extends AbstractBehaviourService {
3074
3181
  class FormulaireBehaviour extends AbstractBehaviourService {
3075
3182
  constructor() {
3076
3183
  super(...arguments);
3077
- u(this, "APP", "formulaire");
3078
- u(this, "RESOURCE", "formulaire");
3184
+ a(this, "APP", "formulaire");
3185
+ a(this, "RESOURCE", "formulaire");
3079
3186
  }
3080
3187
  async loadResources() {
3081
3188
  return (await this.httpGet(
@@ -3095,8 +3202,8 @@ class FormulaireBehaviour extends AbstractBehaviourService {
3095
3202
  class ForumBehaviour extends AbstractBehaviourService {
3096
3203
  constructor() {
3097
3204
  super(...arguments);
3098
- u(this, "APP", "forum");
3099
- u(this, "RESOURCE", "forum");
3205
+ a(this, "APP", "forum");
3206
+ a(this, "RESOURCE", "forum");
3100
3207
  }
3101
3208
  async loadResources() {
3102
3209
  return (await this.httpGet("/forum/categories")).map(
@@ -3116,8 +3223,8 @@ class ForumBehaviour extends AbstractBehaviourService {
3116
3223
  class HomeworksBehaviour extends AbstractBehaviourService {
3117
3224
  constructor() {
3118
3225
  super(...arguments);
3119
- u(this, "APP", "homeworks");
3120
- u(this, "RESOURCE", "homeworks");
3226
+ a(this, "APP", "homeworks");
3227
+ a(this, "RESOURCE", "homeworks");
3121
3228
  }
3122
3229
  async loadResources() {
3123
3230
  return (await this.httpGet("/homeworks/list")).filter((t) => t.owner && t.trashed === 0).map((t) => this.dataToResource({
@@ -3135,8 +3242,8 @@ class HomeworksBehaviour extends AbstractBehaviourService {
3135
3242
  class MagnetoBehaviour extends AbstractBehaviourService {
3136
3243
  constructor() {
3137
3244
  super(...arguments);
3138
- u(this, "APP", "magneto");
3139
- u(this, "RESOURCE", "magneto");
3245
+ a(this, "APP", "magneto");
3246
+ a(this, "RESOURCE", "magneto");
3140
3247
  }
3141
3248
  async loadResources() {
3142
3249
  const { all: t } = await this.httpGet(
@@ -3157,8 +3264,8 @@ class MagnetoBehaviour extends AbstractBehaviourService {
3157
3264
  class MindmapBehaviour extends AbstractBehaviourService {
3158
3265
  constructor() {
3159
3266
  super(...arguments);
3160
- u(this, "APP", "mindmap");
3161
- u(this, "RESOURCE", "mindmap");
3267
+ a(this, "APP", "mindmap");
3268
+ a(this, "RESOURCE", "mindmap");
3162
3269
  }
3163
3270
  async loadResources() {
3164
3271
  return (await this.httpGet("/mindmap/list/all")).map(
@@ -3178,8 +3285,8 @@ class MindmapBehaviour extends AbstractBehaviourService {
3178
3285
  class PagesBehaviour extends AbstractBehaviourService {
3179
3286
  constructor() {
3180
3287
  super(...arguments);
3181
- u(this, "APP", "pages");
3182
- u(this, "RESOURCE", "pages");
3288
+ a(this, "APP", "pages");
3289
+ a(this, "RESOURCE", "pages");
3183
3290
  }
3184
3291
  async loadResources() {
3185
3292
  const t = await this.httpGet("/pages/list/all"), s = [];
@@ -3197,15 +3304,15 @@ class PagesBehaviour extends AbstractBehaviourService {
3197
3304
  shared: typeof r.shared < "u",
3198
3305
  modified: r.modified
3199
3306
  })
3200
- ), (o = r.pages) == null || o.forEach((a) => {
3307
+ ), (o = r.pages) == null || o.forEach((u) => {
3201
3308
  s.push(
3202
3309
  this.dataToResource({
3203
- title: a.title,
3310
+ title: u.title,
3204
3311
  owner: r.owner.userId,
3205
3312
  ownerName: r.owner.displayName,
3206
3313
  icon: i,
3207
- path: "/pages#/website/" + r._id + "/" + a.titleLink,
3208
- _id: r._id + "/" + a.titleLink,
3314
+ path: "/pages#/website/" + r._id + "/" + u.titleLink,
3315
+ _id: r._id + "/" + u.titleLink,
3209
3316
  shared: typeof r.shared < "u",
3210
3317
  modified: r.modified
3211
3318
  })
@@ -3217,8 +3324,8 @@ class PagesBehaviour extends AbstractBehaviourService {
3217
3324
  class PollBehaviour extends AbstractBehaviourService {
3218
3325
  constructor() {
3219
3326
  super(...arguments);
3220
- u(this, "APP", "poll");
3221
- u(this, "RESOURCE", "poll");
3327
+ a(this, "APP", "poll");
3328
+ a(this, "RESOURCE", "poll");
3222
3329
  }
3223
3330
  async loadResources() {
3224
3331
  return (await this.httpGet("/poll/list/all")).map((s) => {
@@ -3239,8 +3346,8 @@ class PollBehaviour extends AbstractBehaviourService {
3239
3346
  class ScrapbookBehaviour extends AbstractBehaviourService {
3240
3347
  constructor() {
3241
3348
  super(...arguments);
3242
- u(this, "APP", "scrapbook");
3243
- u(this, "RESOURCE", "scrapbook");
3349
+ a(this, "APP", "scrapbook");
3350
+ a(this, "RESOURCE", "scrapbook");
3244
3351
  }
3245
3352
  async loadResources() {
3246
3353
  return (await this.httpGet(
@@ -3263,8 +3370,8 @@ class ScrapbookBehaviour extends AbstractBehaviourService {
3263
3370
  class TimelinegeneratorBehaviour extends AbstractBehaviourService {
3264
3371
  constructor() {
3265
3372
  super(...arguments);
3266
- u(this, "APP", "timelinegenerator");
3267
- u(this, "RESOURCE", "timelinegenerator");
3373
+ a(this, "APP", "timelinegenerator");
3374
+ a(this, "RESOURCE", "timelinegenerator");
3268
3375
  }
3269
3376
  loadResources() {
3270
3377
  return new Promise(async (t, s) => {
@@ -3272,12 +3379,12 @@ class TimelinegeneratorBehaviour extends AbstractBehaviourService {
3272
3379
  const i = (await this.httpGet(
3273
3380
  "/timelinegenerator/timelines"
3274
3381
  )).map((o) => {
3275
- const a = o.icon || "/img/illustrations/timeline-default.png";
3382
+ const u = o.icon || "/img/illustrations/timeline-default.png";
3276
3383
  return this.dataToResource({
3277
3384
  title: o.headline,
3278
3385
  ownerName: o.owner.displayName,
3279
3386
  owner: o.owner.userId,
3280
- icon: a,
3387
+ icon: u,
3281
3388
  path: "/timelinegenerator#/view/" + o._id,
3282
3389
  _id: o._id,
3283
3390
  shared: typeof o.shared < "u",
@@ -3294,8 +3401,8 @@ class TimelinegeneratorBehaviour extends AbstractBehaviourService {
3294
3401
  class WikiBehaviour extends AbstractBehaviourService {
3295
3402
  constructor() {
3296
3403
  super(...arguments);
3297
- u(this, "APP", "wiki");
3298
- u(this, "RESOURCE", "wiki");
3404
+ a(this, "APP", "wiki");
3405
+ a(this, "RESOURCE", "wiki");
3299
3406
  }
3300
3407
  async loadResources() {
3301
3408
  return (await this.httpGet(
@@ -3318,8 +3425,8 @@ class WikiBehaviour extends AbstractBehaviourService {
3318
3425
  class WorkspaceBehaviour extends AbstractBehaviourService {
3319
3426
  constructor() {
3320
3427
  super(...arguments);
3321
- u(this, "APP", "workspace");
3322
- u(this, "RESOURCE", "workspace");
3428
+ a(this, "APP", "workspace");
3429
+ a(this, "RESOURCE", "workspace");
3323
3430
  }
3324
3431
  loadResources({ search: t, asset_id: s }) {
3325
3432
  return new Promise(async (r, i) => {
@@ -3327,12 +3434,12 @@ class WorkspaceBehaviour extends AbstractBehaviourService {
3327
3434
  let o = "/workspace/documents?filter=all&hierarchical=true";
3328
3435
  s && s.length ? o += `&search=${t}` : t && t.length && (o += `&search=${t}`);
3329
3436
  const c = (await this.httpGet(o)).filter((l) => !l.deleted).map((l) => {
3330
- const h = l.metadata["content-type"] && l.metadata["content-type"].indexOf("image") !== -1 ? `/workspace/document/${l._id}?thumbnail=120x120` : "/img/icons/unknown-large.png";
3437
+ const p = l.metadata["content-type"] && l.metadata["content-type"].indexOf("image") !== -1 ? `/workspace/document/${l._id}?thumbnail=120x120` : "/img/icons/unknown-large.png";
3331
3438
  return this.dataToResource({
3332
3439
  title: l.name,
3333
3440
  ownerName: l.ownerName,
3334
3441
  owner: l.owner,
3335
- icon: h,
3442
+ icon: p,
3336
3443
  path: `/workspace/document/${l._id}`,
3337
3444
  _id: l._id,
3338
3445
  shared: !!(l.shared && l.shared.length >= 0),
@@ -3346,7 +3453,7 @@ class WorkspaceBehaviour extends AbstractBehaviourService {
3346
3453
  });
3347
3454
  }
3348
3455
  }
3349
- const b = class b {
3456
+ const R = class R {
3350
3457
  static async initialize(e, t) {
3351
3458
  const s = e.http();
3352
3459
  if (!this.resourceProducingApps.length) {
@@ -3357,7 +3464,7 @@ const b = class b {
3357
3464
  e.session().getUser()
3358
3465
  ]);
3359
3466
  i != null && i.apps && (r != null && r.length) && (this.resourceProducingApps = r.filter(
3360
- (o) => i.apps.some((a) => a.address.includes(o))
3467
+ (o) => i.apps.some((u) => u.address.includes(o))
3361
3468
  ));
3362
3469
  } catch (r) {
3363
3470
  console.warn("Failed to load resource-producing apps:", r);
@@ -3440,9 +3547,9 @@ const b = class b {
3440
3547
  //
3441
3548
  // STATIC REGISTRY
3442
3549
  //
3443
- u(b, "registry", new ServiceRegistry()), // Expose some useful functions
3444
- u(b, "findBehaviour", b.registry.findService.bind(b.registry)), u(b, "hasBehaviour", b.registry.isRegistered.bind(b.registry)), u(b, "resourceProducingApps", []);
3445
- let SnipletsService = b;
3550
+ a(R, "registry", new ServiceRegistry()), // Expose some useful functions
3551
+ a(R, "findBehaviour", R.registry.findService.bind(R.registry)), a(R, "hasBehaviour", R.registry.isRegistered.bind(R.registry)), a(R, "resourceProducingApps", []);
3552
+ let SnipletsService = R;
3446
3553
  class RightService {
3447
3554
  constructor(e) {
3448
3555
  this.context = e;
@@ -3640,14 +3747,14 @@ class SessionService {
3640
3747
  r,
3641
3748
  i,
3642
3749
  o,
3643
- a
3750
+ u
3644
3751
  ] = await Promise.all([
3645
3752
  this.getCurrentLanguage(e),
3646
3753
  this.latestQuotaAndUsage(e),
3647
3754
  this.loadDescription(e),
3648
3755
  this.getUserProfile(),
3649
3756
  this.getBookmarks(e)
3650
- ]), { type: c, ...l } = t || {}, h = {
3757
+ ]), { type: c, ...l } = t || {}, p = {
3651
3758
  ...l,
3652
3759
  profiles: c || ["Guest"],
3653
3760
  // "type" field from /userbook/api/person becomes "profiles"
@@ -3658,9 +3765,9 @@ class SessionService {
3658
3765
  user: e,
3659
3766
  quotaAndUsage: r,
3660
3767
  currentLanguage: s,
3661
- userDescription: h,
3768
+ userDescription: p,
3662
3769
  userProfile: o,
3663
- bookmarkedApps: a
3770
+ bookmarkedApps: u
3664
3771
  };
3665
3772
  }
3666
3773
  login(e, t, s, r) {
@@ -3754,7 +3861,7 @@ class SessionService {
3754
3861
  applications: []
3755
3862
  });
3756
3863
  const i = [];
3757
- return r.bookmarks.forEach((o, a) => {
3864
+ return r.bookmarks.forEach((o, u) => {
3758
3865
  const c = ((e == null ? void 0 : e.apps) || []).find(
3759
3866
  (l) => l.name === o
3760
3867
  );
@@ -3770,11 +3877,11 @@ class SessionService {
3770
3877
  }
3771
3878
  async getPerson(e = {}) {
3772
3879
  var c;
3773
- const { options: t = {}, params: s = {} } = e, r = new URLSearchParams(s).toString(), i = `/userbook/api/person${r ? `?${r}` : ""}`, { response: o, value: a } = await this.cache.httpGet(
3880
+ const { options: t = {}, params: s = {} } = e, r = new URLSearchParams(s).toString(), i = `/userbook/api/person${r ? `?${r}` : ""}`, { response: o, value: u } = await this.cache.httpGet(
3774
3881
  i,
3775
3882
  t
3776
3883
  );
3777
- return o.status < 200 || o.status >= 300 || typeof a == "string" ? null : ((c = a == null ? void 0 : a.result) == null ? void 0 : c[0]) || null;
3884
+ return o.status < 200 || o.status >= 300 || typeof u == "string" ? null : ((c = u == null ? void 0 : u.result) == null ? void 0 : c[0]) || null;
3778
3885
  }
3779
3886
  async isAdml() {
3780
3887
  const e = await this.getUser();
@@ -3832,38 +3939,38 @@ class ShareService {
3832
3939
  t,
3833
3940
  s,
3834
3941
  r
3835
- ), a = await this.cache.httpGetJson(o), c = a.users.visibles.filter(({ username: p, firstName: y, lastName: d, login: g }) => {
3942
+ ), u = await this.cache.httpGetJson(o), c = u.users.visibles.filter(({ username: h, firstName: y, lastName: E, login: g }) => {
3836
3943
  const A = StringUtils.removeAccents(
3837
- d || ""
3944
+ E || ""
3838
3945
  ).toLowerCase(), f = StringUtils.removeAccents(
3839
3946
  y || ""
3840
3947
  ).toLowerCase(), w = StringUtils.removeAccents(
3841
- p || ""
3948
+ h || ""
3842
3949
  ).toLowerCase(), F = StringUtils.removeAccents(g || "").toLowerCase();
3843
3950
  return w.includes(i) || f.includes(i) || A.includes(i) || F.includes(i);
3844
- }).map((p) => ({
3845
- avatarUrl: this.directory.getAvatarUrl(p.id, "user"),
3846
- directoryUrl: this.directory.getDirectoryUrl(p.id, "user"),
3847
- displayName: p.username,
3848
- id: p.id,
3849
- profile: p.profile,
3951
+ }).map((h) => ({
3952
+ avatarUrl: this.directory.getAvatarUrl(h.id, "user"),
3953
+ directoryUrl: this.directory.getDirectoryUrl(h.id, "user"),
3954
+ displayName: h.username,
3955
+ id: h.id,
3956
+ profile: h.profile,
3850
3957
  type: "user"
3851
- })), l = a.groups.visibles.filter(({ name: p }) => StringUtils.removeAccents(p || "").toLowerCase().includes(i)).map((p) => ({
3852
- avatarUrl: this.directory.getAvatarUrl(p.id, "group"),
3853
- directoryUrl: this.directory.getDirectoryUrl(p.id, "group"),
3854
- displayName: p.name,
3855
- id: p.id,
3958
+ })), l = u.groups.visibles.filter(({ name: h }) => StringUtils.removeAccents(h || "").toLowerCase().includes(i)).map((h) => ({
3959
+ avatarUrl: this.directory.getAvatarUrl(h.id, "group"),
3960
+ directoryUrl: this.directory.getDirectoryUrl(h.id, "group"),
3961
+ displayName: h.name,
3962
+ id: h.id,
3856
3963
  type: "group",
3857
- structureName: p.structureName
3964
+ structureName: h.structureName
3858
3965
  }));
3859
- return [...(await this.directory.getBookMarks()).filter(({ displayName: p }) => StringUtils.removeAccents(
3860
- p || ""
3861
- ).toLowerCase().includes(i)).map((p) => ({
3966
+ return [...(await this.directory.getBookMarks()).filter(({ displayName: h }) => StringUtils.removeAccents(
3967
+ h || ""
3968
+ ).toLowerCase().includes(i)).map((h) => ({
3862
3969
  avatarUrl: "",
3863
3970
  directoryUrl: "",
3864
3971
  profile: "",
3865
- displayName: p.displayName,
3866
- id: p.id,
3972
+ displayName: h.displayName,
3973
+ id: h.id,
3867
3974
  type: "sharebookmark"
3868
3975
  })), ...c, ...l];
3869
3976
  }
@@ -3879,10 +3986,10 @@ class ShareService {
3879
3986
  return s;
3880
3987
  }
3881
3988
  getActionsAvailableFor({ id: e, type: t }, s, r) {
3882
- const o = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], a = Object.keys(r), c = [];
3883
- for (const l of a)
3989
+ const o = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], u = Object.keys(r), c = [];
3990
+ for (const l of u)
3884
3991
  r[l].filter(
3885
- (p) => o.includes(p)
3992
+ (h) => o.includes(h)
3886
3993
  ).length > 0 && c.push(l);
3887
3994
  return c;
3888
3995
  }
@@ -3894,26 +4001,26 @@ class ShareService {
3894
4001
  s == null ? void 0 : s.getResourceRights
3895
4002
  ), o = await this.cache.httpGetJson(
3896
4003
  i
3897
- ), a = await this.getShareMapping(
4004
+ ), u = await this.getShareMapping(
3898
4005
  e,
3899
4006
  s == null ? void 0 : s.getShareMapping
3900
4007
  ), c = await this.cache.httpGetJson(
3901
4008
  "/infra/public/json/sharing-rights.json"
3902
- ), l = Object.keys(o.users.checked).map((d) => o.users.visibles.find(
3903
- (A) => A.id === d
3904
- )).filter((d) => d !== void 0).map((d) => {
4009
+ ), l = Object.keys(o.users.checked).map((E) => o.users.visibles.find(
4010
+ (A) => A.id === E
4011
+ )).filter((E) => E !== void 0).map((E) => {
3905
4012
  const g = this.getActionsAvailableFor(
3906
- { id: d.id, type: "user" },
4013
+ { id: E.id, type: "user" },
3907
4014
  o,
3908
- a
4015
+ u
3909
4016
  );
3910
4017
  return {
3911
- id: d.id,
4018
+ id: E.id,
3912
4019
  type: "user",
3913
- displayName: d.username,
3914
- profile: d.profile,
3915
- avatarUrl: this.directory.getAvatarUrl(d.id, "user"),
3916
- directoryUrl: this.directory.getDirectoryUrl(d.id, "user"),
4020
+ displayName: E.username,
4021
+ profile: E.profile,
4022
+ avatarUrl: this.directory.getAvatarUrl(E.id, "user"),
4023
+ directoryUrl: this.directory.getDirectoryUrl(E.id, "user"),
3917
4024
  actions: g.map((f) => {
3918
4025
  const w = c[f];
3919
4026
  return {
@@ -3923,21 +4030,21 @@ class ShareService {
3923
4030
  };
3924
4031
  })
3925
4032
  };
3926
- }).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), h = Object.keys(o.groups.checked).map((d) => o.groups.visibles.find(
3927
- (A) => A.id === d
3928
- )).filter((d) => d !== void 0).map((d) => {
4033
+ }).sort((E, g) => (E.displayName || "").localeCompare(g.displayName)), p = Object.keys(o.groups.checked).map((E) => o.groups.visibles.find(
4034
+ (A) => A.id === E
4035
+ )).filter((E) => E !== void 0).map((E) => {
3929
4036
  const g = this.getActionsAvailableFor(
3930
- { id: d.id, type: "group" },
4037
+ { id: E.id, type: "group" },
3931
4038
  o,
3932
- a
4039
+ u
3933
4040
  );
3934
4041
  return {
3935
- id: d.id,
4042
+ id: E.id,
3936
4043
  type: "group",
3937
- displayName: d.name,
4044
+ displayName: E.name,
3938
4045
  profile: void 0,
3939
- avatarUrl: this.directory.getAvatarUrl(d.id, "group"),
3940
- directoryUrl: this.directory.getDirectoryUrl(d.id, "group"),
4046
+ avatarUrl: this.directory.getAvatarUrl(E.id, "group"),
4047
+ directoryUrl: this.directory.getDirectoryUrl(E.id, "group"),
3941
4048
  actions: g.map((f) => {
3942
4049
  const w = c[f];
3943
4050
  return {
@@ -3947,26 +4054,26 @@ class ShareService {
3947
4054
  };
3948
4055
  })
3949
4056
  };
3950
- }).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), E = [...l, ...h], p = o.groups.visibles.map(
3951
- ({ groupDisplayName: d, id: g, name: A, labels: f }) => ({
4057
+ }).sort((E, g) => (E.displayName || "").localeCompare(g.displayName)), d = [...l, ...p], h = o.groups.visibles.map(
4058
+ ({ groupDisplayName: E, id: g, name: A, labels: f }) => ({
3952
4059
  labels: f,
3953
- displayName: d || A,
4060
+ displayName: E || A,
3954
4061
  id: g
3955
4062
  })
3956
4063
  ), y = o.users.visibles.map(
3957
- ({ id: d, profile: g, username: A, firstName: f, lastName: w, login: F }) => ({
4064
+ ({ id: E, profile: g, username: A, firstName: f, lastName: w, login: F }) => ({
3958
4065
  displayName: A,
3959
4066
  firstName: f,
3960
4067
  lastName: w,
3961
4068
  login: F,
3962
4069
  profile: g,
3963
- id: d
4070
+ id: E
3964
4071
  })
3965
4072
  );
3966
4073
  return {
3967
- rights: E,
4074
+ rights: d,
3968
4075
  visibleBookmarks: r,
3969
- visibleGroups: p,
4076
+ visibleGroups: h,
3970
4077
  visibleUsers: y
3971
4078
  };
3972
4079
  }
@@ -3977,7 +4084,7 @@ class ShareService {
3977
4084
  bookmarks: {}
3978
4085
  }, i = await this.getShareMapping(e, s);
3979
4086
  for (const o of t) {
3980
- const a = o.actions.map((l) => i[l.id]).reduce((l, h) => Array.isArray(h) ? [...l, ...h] : l, []), c = [...new Set(a)];
4087
+ const u = o.actions.map((l) => i[l.id]).reduce((l, p) => Array.isArray(p) ? [...l, ...p] : l, []), c = [...new Set(u)];
3981
4088
  c.length > 0 && (o.type === "user" ? r.users[o.id] = c : o.type === "group" ? r.groups[o.id] = c : r.bookmarks[o.id] = c);
3982
4089
  }
3983
4090
  return r;
@@ -3987,40 +4094,40 @@ class ShareService {
3987
4094
  e,
3988
4095
  s,
3989
4096
  r == null ? void 0 : r.getShareMapping
3990
- ), o = (r == null ? void 0 : r.saveResourceRights) || `/${e}/share/resource/${t}`, a = this.getSearchUrl(
4097
+ ), o = (r == null ? void 0 : r.saveResourceRights) || `/${e}/share/resource/${t}`, u = this.getSearchUrl(
3991
4098
  e,
3992
4099
  t,
3993
4100
  "",
3994
4101
  r == null ? void 0 : r.getResourceRights
3995
4102
  );
3996
- return this.cache.clearCache(a), await this.http.putJson(o, i);
4103
+ return this.cache.clearCache(u), await this.http.putJson(o, i);
3997
4104
  }
3998
4105
  async getActionsForApp(e, t) {
3999
4106
  const s = await this.cache.httpGetJson(
4000
4107
  "/infra/public/json/sharing-rights.json"
4001
4108
  ), r = await this.getShareMapping(e, t);
4002
4109
  return Object.keys(s).map((o) => {
4003
- const a = s[o];
4110
+ const u = s[o];
4004
4111
  return {
4005
4112
  displayName: o,
4006
4113
  id: o,
4007
- priority: a.priority,
4008
- requires: a.requires
4114
+ priority: u.priority,
4115
+ requires: u.requires
4009
4116
  };
4010
4117
  }).filter((o) => {
4011
- var a;
4012
- return ((a = r[o.id]) == null ? void 0 : a.length) > 0;
4013
- }).sort((o, a) => o.priority - a.priority);
4118
+ var u;
4119
+ return ((u = r[o.id]) == null ? void 0 : u.length) > 0;
4120
+ }).sort((o, u) => o.priority - u.priority);
4014
4121
  }
4015
4122
  }
4016
4123
  const loadedScripts = {};
4017
4124
  class HttpService {
4018
4125
  constructor(e, t) {
4019
4126
  // Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
4020
- u(this, "axios");
4021
- u(this, "baseUrl");
4022
- u(this, "headers", {});
4023
- u(this, "_latestResponse");
4127
+ a(this, "axios");
4128
+ a(this, "baseUrl");
4129
+ a(this, "headers", {});
4130
+ a(this, "_latestResponse");
4024
4131
  this.context = e, this.axios = axios.create(t);
4025
4132
  }
4026
4133
  fixBaseUrl(e) {
@@ -4235,8 +4342,8 @@ class HttpService {
4235
4342
  const r = s ?? "exports", i = this.toAxiosConfig(t);
4236
4343
  return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((o) => this.mapAxiosResponse(o, t)).then((o) => {
4237
4344
  try {
4238
- const a = `"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;
4239
- return Function(a)();
4345
+ const u = `"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;
4346
+ return Function(u)();
4240
4347
  } catch {
4241
4348
  return o;
4242
4349
  }
@@ -4250,7 +4357,7 @@ class HttpService {
4250
4357
  });
4251
4358
  }
4252
4359
  }
4253
- const R = class R {
4360
+ const b = class b {
4254
4361
  // in minutes. Applies to recorded videos.
4255
4362
  constructor(e) {
4256
4363
  this.context = e;
@@ -4271,8 +4378,8 @@ const R = class R {
4271
4378
  APP$4.VIDEO
4272
4379
  );
4273
4380
  return {
4274
- maxWeight: (e == null ? void 0 : e["max-videosize-mbytes"]) ?? R.MAX_WEIGHT,
4275
- maxDuration: (e == null ? void 0 : e["max-videoduration-minutes"]) ?? R.MAX_DURATION,
4381
+ maxWeight: (e == null ? void 0 : e["max-videosize-mbytes"]) ?? b.MAX_WEIGHT,
4382
+ maxDuration: (e == null ? void 0 : e["max-videoduration-minutes"]) ?? b.MAX_DURATION,
4276
4383
  acceptVideoUploadExtensions: ((t = e == null ? void 0 : e["accept-videoupload-extensions"]) == null ? void 0 : t.map(
4277
4384
  (s) => s.toUpperCase()
4278
4385
  )) ?? []
@@ -4295,43 +4402,43 @@ const R = class R {
4295
4402
  throw new Error("Invalid video filename");
4296
4403
  const i = `${e.browser.name} ${e.browser.version}`, o = new FormData();
4297
4404
  o.append("device", e.device || ""), o.append("browser", i), o.append("url", e.url), o.append("app", t), o.append("file", e.file, e.filename), o.append("weight", "" + e.file.size), o.append("captation", "" + s);
4298
- let a = `/video/encode?captation=${s}`;
4299
- r && (a += `&duration=${r}`);
4405
+ let u = `/video/encode?captation=${s}`;
4406
+ r && (u += `&duration=${r}`);
4300
4407
  const c = await this.http.post(
4301
- a,
4408
+ u,
4302
4409
  o,
4303
4410
  { headers: { "Content-Type": "multipart/form-data" } }
4304
4411
  );
4305
4412
  if (c.state == "running") {
4306
- let l = 0, h = 1;
4413
+ let l = 0, p = 1;
4307
4414
  do {
4308
- const E = h + l;
4415
+ const d = p + l;
4309
4416
  await new Promise(
4310
- (y) => setTimeout(y, E * 1e3)
4311
- ), l = h, h = Math.min(8, E);
4312
- const p = await this.http.get(
4417
+ (y) => setTimeout(y, d * 1e3)
4418
+ ), l = p, p = Math.min(8, d);
4419
+ const h = await this.http.get(
4313
4420
  `/video/status/${c.processid}`
4314
4421
  );
4315
- if (p.state == "succeed")
4316
- return p.videoworkspaceid && p.videosize && this.context.data().trackVideoSave(
4317
- p.videoworkspaceid,
4422
+ if (h.state == "succeed")
4423
+ return h.videoworkspaceid && h.videosize && this.context.data().trackVideoSave(
4424
+ h.videoworkspaceid,
4318
4425
  Math.round(r),
4319
- p.videosize,
4426
+ h.videosize,
4320
4427
  s,
4321
4428
  e.url,
4322
4429
  i,
4323
4430
  e.device
4324
- ), p;
4325
- if (p.state == "error")
4431
+ ), h;
4432
+ if (h.state == "error")
4326
4433
  break;
4327
4434
  } while (!0);
4328
4435
  }
4329
4436
  throw new Error("Video cannot be uploaded.");
4330
4437
  }
4331
4438
  };
4332
- u(R, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
4333
- u(R, "MAX_DURATION", 3);
4334
- let VideoService = R;
4439
+ a(b, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
4440
+ a(b, "MAX_DURATION", 3);
4441
+ let VideoService = b;
4335
4442
  class WidgetService {
4336
4443
  constructor(e) {
4337
4444
  this.context = e;
@@ -4412,7 +4519,7 @@ const defaultMappers = {
4412
4519
  }
4413
4520
  };
4414
4521
  // FIXME add edumedia support
4415
- u(v, "roleMappers", [
4522
+ a(v, "roleMappers", [
4416
4523
  (e) => Object.keys(defaultMappers).find((s) => defaultMappers[s](e))
4417
4524
  ]);
4418
4525
  let DocumentHelper = v;
@@ -4430,29 +4537,29 @@ class WorkspaceService {
4430
4537
  size: e.size,
4431
4538
  extension: i,
4432
4539
  role: DocumentHelper.role(r, !1, i)
4433
- }, a = t.replace("." + o.extension, ""), c = o.extension ? a + "." + o.extension : a;
4434
- return { basename: a, fullname: c, metadata: o };
4540
+ }, u = t.replace("." + o.extension, ""), c = o.extension ? u + "." + o.extension : u;
4541
+ return { basename: u, fullname: c, metadata: o };
4435
4542
  }
4436
4543
  async saveFile(e, t) {
4437
4544
  const { fullname: s, metadata: r } = this.extractMetadata(e), i = new FormData();
4438
4545
  i.append("file", e, s);
4439
4546
  const o = [];
4440
4547
  ((t == null ? void 0 : t.visibility) === "public" || (t == null ? void 0 : t.visibility) === "protected") && o.push(`${t.visibility}=true`), t != null && t.application && o.push(`application=${t.application}`), r.role === "img" && o.push("quality=1"), t != null && t.parentId && o.push(`parentId=${t.parentId}`);
4441
- const a = await this.http.postFile(
4548
+ const u = await this.http.postFile(
4442
4549
  `/workspace/document?${o.join("&")}`,
4443
4550
  i
4444
4551
  );
4445
4552
  if (this.http.isResponseError())
4446
4553
  throw this.http.latestResponse.statusText;
4447
- return a;
4554
+ return u;
4448
4555
  }
4449
4556
  async updateFile(e, t, s) {
4450
4557
  const { fullname: r, metadata: i } = this.extractMetadata(t), o = new FormData();
4451
4558
  o.append("file", t, r);
4452
- const a = [];
4453
- 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}`);
4559
+ const u = [];
4560
+ i.role === "img" && u.push("quality=1"), s != null && s.alt && u.push(`alt=${s.alt}`), s != null && s.legend && u.push(`legend=${s.legend}`), s != null && s.name && u.push(`name=${s.name}`);
4454
4561
  const c = await this.http.putFile(
4455
- `/workspace/document/${e}?${a.join("&")}`,
4562
+ `/workspace/document/${e}?${u.join("&")}`,
4456
4563
  o
4457
4564
  );
4458
4565
  if (this.http.isResponseError())
@@ -4503,11 +4610,11 @@ class WorkspaceService {
4503
4610
  );
4504
4611
  if (this.http.isResponseError())
4505
4612
  throw this.http.latestResponse.statusText;
4506
- return r.forEach((o, a) => {
4613
+ return r.forEach((o, u) => {
4507
4614
  const c = e.findIndex(
4508
4615
  (l) => l._id === o._id
4509
4616
  );
4510
- 0 <= c && c < e.length && (e[c] = i[a]);
4617
+ 0 <= c && c < e.length && (e[c] = i[u]);
4511
4618
  }), e.filter((o) => !!o);
4512
4619
  }
4513
4620
  return e;
@@ -4522,12 +4629,12 @@ class WorkspaceService {
4522
4629
  if (typeof e == "string")
4523
4630
  return e.includes("data:image") || e.includes("thumbnail") ? e : `${e}${e.includes("?") ? "&" : "?"}thumbnail=${r}`;
4524
4631
  {
4525
- const a = `/workspace/${e.public ? "pub/" : ""}document/${e._id}?thumbnail=`, c = e.thumbnails;
4632
+ const u = `/workspace/${e.public ? "pub/" : ""}document/${e._id}?thumbnail=`, c = e.thumbnails;
4526
4633
  if ((o = (i = e.metadata) == null ? void 0 : i["content-type"]) != null && o.includes("video")) {
4527
4634
  const l = c && Object.keys(c).length > 0 ? Object.keys(c)[0] : null;
4528
- return l ? a + l : null;
4635
+ return l ? u + l : null;
4529
4636
  } else
4530
- return a + r;
4637
+ return u + r;
4531
4638
  }
4532
4639
  }
4533
4640
  /**
@@ -4581,23 +4688,24 @@ class WorkspaceService {
4581
4688
  }
4582
4689
  class OdeServices {
4583
4690
  constructor() {
4584
- u(this, "_analytics");
4585
- u(this, "_cache");
4586
- u(this, "_conf");
4587
- u(this, "_data");
4588
- u(this, "_directory");
4589
- u(this, "_http");
4590
- u(this, "_idiom");
4591
- u(this, "_nextcloud");
4592
- u(this, "_notify");
4593
- u(this, "_rights");
4594
- u(this, "_session");
4595
- u(this, "_share");
4596
- u(this, "_video");
4597
- u(this, "_widget");
4598
- u(this, "_workspace");
4599
- u(this, "_embedder");
4600
- 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._nextcloud = new NextcloudService(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._widget = new WidgetService(this), this._workspace = new WorkspaceService(this), this._embedder = new EmbedderService(this);
4691
+ a(this, "_analytics");
4692
+ a(this, "_cache");
4693
+ a(this, "_conf");
4694
+ a(this, "_data");
4695
+ a(this, "_directory");
4696
+ a(this, "_googledrive");
4697
+ a(this, "_http");
4698
+ a(this, "_idiom");
4699
+ a(this, "_nextcloud");
4700
+ a(this, "_notify");
4701
+ a(this, "_rights");
4702
+ a(this, "_session");
4703
+ a(this, "_share");
4704
+ a(this, "_video");
4705
+ a(this, "_widget");
4706
+ a(this, "_workspace");
4707
+ a(this, "_embedder");
4708
+ 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._googledrive = new GoogleDriveService(this), this._http = new HttpService(this), this._idiom = new IdiomService(this), this._nextcloud = new NextcloudService(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._widget = new WidgetService(this), this._workspace = new WorkspaceService(this), this._embedder = new EmbedderService(this);
4601
4709
  }
4602
4710
  initialize() {
4603
4711
  return this._data.initialize(), this;
@@ -4620,6 +4728,9 @@ class OdeServices {
4620
4728
  directory() {
4621
4729
  return this._directory;
4622
4730
  }
4731
+ googledrive() {
4732
+ return this._googledrive;
4733
+ }
4623
4734
  http() {
4624
4735
  return this._http;
4625
4736
  }
@@ -4804,10 +4915,10 @@ const isActionAvailable = (n, e) => {
4804
4915
  class WidgetFramework {
4805
4916
  constructor() {
4806
4917
  //-------------------------------------
4807
- u(this, "_initialized");
4808
- u(this, "_widgets", []);
4918
+ a(this, "_initialized");
4919
+ a(this, "_widgets", []);
4809
4920
  ////////////////////////////////////// USER PREFERENCES
4810
- u(this, "_userPrefs", {});
4921
+ a(this, "_userPrefs", {});
4811
4922
  }
4812
4923
  initialize(e, t) {
4813
4924
  return this._initialized || (this._initialized = new Promisified(), notify.onSessionReady().promise.then((s) => {
@@ -4850,20 +4961,20 @@ class WidgetFramework {
4850
4961
  this._userPrefs = e ?? this._userPrefs;
4851
4962
  const t = configure.Platform.theme, s = [];
4852
4963
  t.listSkins().then((r) => {
4853
- var a;
4854
- const i = ((a = r.find((c) => c.child === t.skin)) == null ? void 0 : a.parent) === "panda" ? secondLevelWidgets : firstLevelWidgets;
4964
+ var u;
4965
+ const i = ((u = r.find((c) => c.child === t.skin)) == null ? void 0 : u.parent) === "panda" ? secondLevelWidgets : firstLevelWidgets;
4855
4966
  this._widgets = this._widgets.filter((c, l) => {
4856
- const h = c.platformConf.name;
4857
- return i.indexOf(h) !== -1 ? !1 : (this._userPrefs[h] || (this._userPrefs[h] = {
4858
- index: defaultWidgetOrder[h] ?? 999,
4967
+ const p = c.platformConf.name;
4968
+ return i.indexOf(p) !== -1 ? !1 : (this._userPrefs[p] || (this._userPrefs[p] = {
4969
+ index: defaultWidgetOrder[p] ?? 999,
4859
4970
  show: !0,
4860
4971
  position: c.platformConf.position
4861
- }), c.platformConf.mandatory && (this._userPrefs[h].show = !0, this._userPrefs[h].index = defaultWidgetOrder[h] ?? 999), c.platformConf.i18n && s.push(c.platformConf.i18n), c.applyUserPref(this._userPrefs[h]), !0);
4972
+ }), c.platformConf.mandatory && (this._userPrefs[p].show = !0, this._userPrefs[p].index = defaultWidgetOrder[p] ?? 999), c.platformConf.i18n && s.push(c.platformConf.i18n), c.applyUserPref(this._userPrefs[p]), !0);
4862
4973
  });
4863
4974
  const o = new Idiom();
4864
4975
  this._widgets = this._widgets.sort((c, l) => {
4865
- const h = o.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(), E = o.translate(`timeline.settings.${l.platformConf.name}`).toLowerCase();
4866
- return h < E ? -1 : h > E ? 1 : 0;
4976
+ const p = o.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(), d = o.translate(`timeline.settings.${l.platformConf.name}`).toLowerCase();
4977
+ return p < d ? -1 : p > d ? 1 : 0;
4867
4978
  });
4868
4979
  });
4869
4980
  }
@@ -4871,8 +4982,8 @@ class WidgetFramework {
4871
4982
  class Widget {
4872
4983
  //-------------------------------------
4873
4984
  constructor(e) {
4874
- u(this, "_schoolConf", {});
4875
- u(this, "_userPref");
4985
+ a(this, "_schoolConf", {});
4986
+ a(this, "_userPref");
4876
4987
  this._platformConf = e, this._userPref = null;
4877
4988
  }
4878
4989
  get platformConf() {
@@ -4923,6 +5034,8 @@ export {
4923
5034
  ERROR_CODE,
4924
5035
  EVENT_NAME,
4925
5036
  FOLDER,
5037
+ GOOGLE_DRIVE_FOLDER_MIME_TYPE,
5038
+ GoogleDriveCopyError,
4926
5039
  ITimelineFactory,
4927
5040
  LAYER_NAME,
4928
5041
  NotifyFrameworkFactory,