@edifice.io/client 2.0.1-develop-hotfix.1736862374617 → 2.1.0-develop-enabling.0

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 T = Object.defineProperty;
2
- var D = (n, e, t) => e in n ? T(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var a = (n, e, t) => D(n, typeof e != "symbol" ? e + "" : e, t);
2
+ var x = (n, e, t) => e in n ? T(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var a = (n, e, t) => x(n, typeof e != "symbol" ? e + "" : e, t);
4
4
  import axios from "axios";
5
5
  import { MimeTypeUtils } from "@edifice.io/utilities";
6
6
  const ReactionTypes = [
@@ -19,7 +19,7 @@ const ReactionTypes = [
19
19
  TIME_OUT: "0070",
20
20
  MALFORMED_DATA: "0080",
21
21
  NOT_LOGGED_IN: "0090"
22
- }, APP$2 = {
22
+ }, APP$1 = {
23
23
  ADMIN: "admin",
24
24
  ARCHIVE: "archive",
25
25
  AUTH: "auth",
@@ -35,7 +35,6 @@ const ReactionTypes = [
35
35
  WORKSPACE: "workspace",
36
36
  // -- a few others commonly used apps
37
37
  EXPLORER: "explorer",
38
- HOMEWORKS: "homeworks",
39
38
  VIDEO: "video",
40
39
  MINDMAP: "mindmap",
41
40
  SCRAPBOOK: "scrapbook",
@@ -364,7 +363,7 @@ const f = class f {
364
363
  a(f, "registry", new ServiceRegistry()), // Expose some useful functions
365
364
  a(f, "register", f.registry.register.bind(f.registry)), a(f, "findService", f.registry.findService.bind(f.registry)), a(f, "findMainService", f.registry.findMainService.bind(f.registry)), a(f, "isRegistered", f.registry.isRegistered.bind(f.registry));
366
365
  let ResourceService = f;
367
- const APP$1 = "scrapbook", RESOURCE$1 = "scrapbook";
366
+ const APP = "scrapbook", RESOURCE = "scrapbook";
368
367
  class ScrapbookResourceService extends ResourceService {
369
368
  create(e) {
370
369
  throw new Error("Method not implemented.");
@@ -382,10 +381,10 @@ class ScrapbookResourceService extends ResourceService {
382
381
  return this.checkHttpResponse(s), { thumbnail: t, entId: e.entId };
383
382
  }
384
383
  getResourceType() {
385
- return RESOURCE$1;
384
+ return RESOURCE;
386
385
  }
387
386
  getApplication() {
388
- return APP$1;
387
+ return APP;
389
388
  }
390
389
  getFormUrl(e) {
391
390
  return e ? `/scrapbook?folderid=${e}#/create-scrapbook/` : "/scrapbook#/create-scrapbook/";
@@ -403,57 +402,9 @@ class ScrapbookResourceService extends ResourceService {
403
402
  return `/scrapbook/exportHtml/${e}`;
404
403
  }
405
404
  }
406
- ResourceService.register(
407
- { application: RESOURCE$1, resourceType: RESOURCE$1 },
408
- (n) => new ScrapbookResourceService(n)
409
- );
410
- const APP = "homeworks", RESOURCE = "homeworks";
411
- class HomeworksResourceService extends ResourceService {
412
- async create(e) {
413
- const t = await this.getThumbnailPath(e.thumbnail), s = await this.http.post("/homeworks", {
414
- title: e.name,
415
- thumbnail: t,
416
- description: e.description,
417
- repeats: e.repeats
418
- });
419
- return this.checkHttpResponse(s), { thumbnail: t, entId: s._id };
420
- }
421
- async update(e) {
422
- const t = await this.getThumbnailPath(e.thumbnail), s = await this.http.put(
423
- `/homeworks/${e.entId}`,
424
- {
425
- title: e.name,
426
- thumbnail: t,
427
- repeats: e.repeats
428
- }
429
- );
430
- return this.checkHttpResponse(s), { thumbnail: t, entId: e.entId };
431
- }
432
- getResourceType() {
433
- return RESOURCE;
434
- }
435
- getApplication() {
436
- return APP;
437
- }
438
- getFormUrl(e) {
439
- return e ? `/homeworks?folderid=${e}#/create-homeworks/` : "/homeworks#/create-homeworks/";
440
- }
441
- getViewUrl(e) {
442
- return `/homeworks#/view-homeworks/${e}`;
443
- }
444
- getPrintUrl(e) {
445
- return `/homeworks/print#/print-homeworks/${e}`;
446
- }
447
- getEditUrl(e) {
448
- return `/homeworks#/edit-homeworks/${e}`;
449
- }
450
- getExportUrl() {
451
- throw new Error("Export not implemented.");
452
- }
453
- }
454
405
  ResourceService.register(
455
406
  { application: RESOURCE, resourceType: RESOURCE },
456
- (n) => new HomeworksResourceService(n)
407
+ (n) => new ScrapbookResourceService(n)
457
408
  );
458
409
  let ATTag;
459
410
  class AnalyticsService {
@@ -576,94 +527,6 @@ class AnalyticsService {
576
527
  };
577
528
  }
578
529
  }
579
- class ReactionsService {
580
- constructor(e, t, s) {
581
- this.context = e, this.module = t, this.resourceType = s;
582
- }
583
- get http() {
584
- return this.context.http();
585
- }
586
- async loadAvailableReactions() {
587
- try {
588
- const { "reaction-types": e } = await this.context.conf().getPublicConf("audience");
589
- return Array.isArray(e) ? e : void 0;
590
- } catch {
591
- console.error("Audience configuration not found");
592
- return;
593
- }
594
- }
595
- async loadReactionSummaries(e) {
596
- const t = await this.http.get(
597
- `/audience/reactions/${this.module}/${this.resourceType}?resourceIds=${e.join(",")}`
598
- );
599
- return this.http.isResponseError() ? {} : t.reactionsByResource;
600
- }
601
- async loadReactionDetails(e, t, s) {
602
- const r = await this.http.get(
603
- `/audience/reactions/${this.module}/${this.resourceType}/${e}?page=${t}&size=${s}`
604
- );
605
- return this.http.isResponseError() ? void 0 : r;
606
- }
607
- async deleteReaction(e) {
608
- await this.http.delete(
609
- `/audience/reactions/${this.module}/${this.resourceType}/${e}`
610
- );
611
- }
612
- async updateReaction(e, t) {
613
- await this.http.putJson(
614
- `/audience/reactions/${this.module}/${this.resourceType}`,
615
- {
616
- resourceId: e,
617
- reactionType: t
618
- }
619
- );
620
- }
621
- async createReaction(e, t) {
622
- await this.http.postJson(
623
- `/audience/reactions/${this.module}/${this.resourceType}`,
624
- {
625
- resourceId: e,
626
- reactionType: t
627
- }
628
- );
629
- }
630
- }
631
- class ViewsService {
632
- constructor(e, t, s) {
633
- this.context = e, this.module = t, this.resourceType = s;
634
- }
635
- get http() {
636
- return this.context.http();
637
- }
638
- async getCounters(e) {
639
- const t = await this.http.get(
640
- `/audience/views/count/${this.module}/${this.resourceType}?resourceIds=${e.join(",")}`
641
- );
642
- return this.http.isResponseError() ? {} : t;
643
- }
644
- async getDetails(e) {
645
- const t = await this.http.get(
646
- `/audience/views/details/${this.module}/${this.resourceType}/${e}`
647
- );
648
- return this.http.isResponseError() ? void 0 : t;
649
- }
650
- trigger(e) {
651
- return this.http.post(
652
- `/audience/views/${this.module}/${this.resourceType}/${e}`
653
- );
654
- }
655
- }
656
- class AudienceService {
657
- constructor(e, t, s) {
658
- this.context = e, this.module = t, this.resourceType = s;
659
- }
660
- get views() {
661
- return new ViewsService(this.context, this.module, this.resourceType);
662
- }
663
- get reactions() {
664
- return new ReactionsService(this.context, this.module, this.resourceType);
665
- }
666
- }
667
530
  const globalCache = {}, mutexPromise = {};
668
531
  class CacheService {
669
532
  constructor(e) {
@@ -988,388 +851,206 @@ class EmbedderService {
988
851
  return "";
989
852
  }
990
853
  }
991
- class Subscription {
992
- constructor(e, t) {
993
- a(this, "revoke");
994
- this._channel = e, this.revoke = this.setReceiver(
995
- (s) => t == null ? void 0 : t(s.data)
996
- );
854
+ const loadedScripts = {};
855
+ class HttpService {
856
+ constructor(e) {
857
+ // Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
858
+ a(this, "axios");
859
+ a(this, "baseUrl");
860
+ a(this, "headers", {});
861
+ a(this, "_latestResponse");
862
+ this.context = e, this.axios = axios;
997
863
  }
998
- setReceiver(e) {
999
- var t;
1000
- return (t = this._channel) == null || t.addEventListener("message", e), () => {
1001
- this._channel && (this._channel.removeEventListener("message", e), this._channel.close(), delete this._channel);
1002
- };
864
+ fixBaseUrl(e) {
865
+ return e.startsWith("http://") || e.startsWith("https://") ? e : this.baseUrl ? this.baseUrl.endsWith("/") || e.startsWith("/") ? `${this.baseUrl}${e}` : `${this.baseUrl}/${e}` : e;
1003
866
  }
1004
- }
1005
- class Subject {
1006
- constructor() {
1007
- /* A single BroadcastChannel cannot send AND receive messages, afaik.
1008
- * => We maintain here channels for *sending* messages.
1009
- * *Receiving* channels will be instantiated while subscribing.
1010
- */
1011
- a(this, "publishChannels", /* @__PURE__ */ new Map());
1012
- }
1013
- getChannelName(e) {
1014
- return "Subject:" + e;
1015
- }
1016
- getPublishChannel(e) {
1017
- const t = this.getChannelName(e);
1018
- let s = this.publishChannels.get(t);
1019
- return s || (s = this.newChannel(e), this.publishChannels.set(t, s)), s;
1020
- }
1021
- newChannel(e) {
1022
- const t = this.getChannelName(e), s = new BroadcastChannel(t);
1023
- return s.addEventListener("messageerror", (r) => console.log(r.data)), s;
1024
- }
1025
- publish(e, t) {
1026
- typeof e == "string" && this.getPublishChannel(e).postMessage(t);
1027
- }
1028
- subscribe(e, t) {
1029
- if (typeof e == "string") {
1030
- const s = this.newChannel(e);
1031
- return new Subscription(s, t);
1032
- } else
1033
- return new Subscription();
867
+ // ENABLING-184, Added this method to allow the use of a custom axios instance
868
+ useAxiosInstance(e) {
869
+ return this.axios = e, this;
1034
870
  }
1035
- }
1036
- const ASYNC_DATA_NAME = {
1037
- SESSION_READY: "sessionReady",
1038
- LANG_READY: "langReady",
1039
- SKIN_READY: "skinReady",
1040
- OVERRIDE_READY: "overrideReady",
1041
- APPCONF_READY: "appConfReady"
1042
- };
1043
- class Promisified {
1044
- constructor() {
1045
- //-------------------------------------
1046
- a(this, "_resolution");
1047
- a(this, "_rejection");
1048
- a(this, "_promise", new Promise((e, t) => {
1049
- this._resolution = e, this._rejection = t;
1050
- }));
871
+ // ENABLING-184, Added this method to allow the use of a custom baseUrl
872
+ useBaseUrl(e) {
873
+ return this.baseUrl = e, this.axios.defaults.baseURL = e, this;
1051
874
  }
1052
- get promise() {
1053
- return this._promise;
875
+ // ENABLING-184, Added this method to allow the use of custom headers
876
+ useHeaders(e) {
877
+ return this.headers = e, this.axios.defaults.headers.common = e, this;
1054
878
  }
1055
- resolve(e) {
1056
- this._resolution && this._resolution(e);
879
+ setCdn(e) {
880
+ e && XMLHttpRequest && !XMLHttpRequest.prototype.cdnUrl && (XMLHttpRequest.prototype.cdnUrl = e, XMLHttpRequest.prototype.baseOpen = XMLHttpRequest.prototype.open, XMLHttpRequest.prototype.open = function() {
881
+ const t = arguments[1];
882
+ return t.startsWith("/infra/public") && (arguments[1] = e + t), /^\/([^\/]*)\/public/.test(t) && (arguments[1] = e + t), t.startsWith("/assets") && (arguments[1] = e + t), t == "/conf/public" && (arguments[1] = t), t.startsWith("http") && (arguments[1] = t), this.baseOpen.apply(this, arguments);
883
+ });
1057
884
  }
1058
- reject(e) {
1059
- this._rejection && this._rejection(e);
885
+ // private toAxiosConfig(params?: IHttpParams): AxiosRequestConfig {
886
+ toAxiosConfig(e) {
887
+ if (e) {
888
+ const t = Object.assign({}, this.axios.defaults);
889
+ e.headers && (t.headers = Object.assign({}, this.axios.defaults.headers), Object.assign(t.headers, e.headers)), e.responseType && (t.responseType = e.responseType), e.queryParams && (t.params = Object.assign({}, e.queryParams));
890
+ const s = t.headers ?? {};
891
+ return t.headers = { ...s, ...this.headers }, t;
892
+ } else
893
+ return this.axios.defaults;
1060
894
  }
1061
- }
1062
- class NotifyFramework {
1063
- constructor() {
1064
- //-------------------------------------
1065
- a(this, "promises", {});
1066
- a(this, "subject", new Subject());
895
+ toCdnUrl(e) {
896
+ e = this.fixBaseUrl(e);
897
+ const t = this.context.conf().getCdnUrl() || "";
898
+ if (t.length > 0 && e !== "/conf/public") {
899
+ const s = "" + e;
900
+ (s.startsWith("/infra/public") || s.startsWith("/assets") || /^\/([^\/]*)\/public/.test(s)) && (e = t + s);
901
+ }
902
+ return e;
1067
903
  }
1068
- asyncData(e) {
1069
- return typeof this.promises[e] > "u" && (this.promises[e] = new Promisified()), this.promises[e];
904
+ mapAxiosError(e, t) {
905
+ e.response ? this._latestResponse = e.response : e.request ? this._latestResponse = {
906
+ status: 408,
907
+ statusText: ERROR_CODE.TIME_OUT
908
+ } : this._latestResponse = {
909
+ status: 500,
910
+ statusText: ERROR_CODE.UNKNOWN
911
+ };
912
+ const {
913
+ /* status, statusText, headers, */
914
+ data: s
915
+ } = this._latestResponse;
916
+ return s;
1070
917
  }
1071
- onSessionReady() {
1072
- return this.asyncData(ASYNC_DATA_NAME.SESSION_READY);
918
+ mapAxiosResponse(e, t) {
919
+ return this._latestResponse = e, e.data;
1073
920
  }
1074
- onLangReady() {
1075
- return this.asyncData(ASYNC_DATA_NAME.LANG_READY);
921
+ get latestResponse() {
922
+ return this._latestResponse;
1076
923
  }
1077
- onSkinReady() {
1078
- return this.asyncData(ASYNC_DATA_NAME.SKIN_READY);
924
+ isResponseError() {
925
+ return this.latestResponse.status < 200 || this.latestResponse.status >= 300;
1079
926
  }
1080
- onOverridesReady() {
1081
- return this.asyncData(ASYNC_DATA_NAME.OVERRIDE_READY);
927
+ async get(e, t) {
928
+ try {
929
+ const s = await this.axios.get(
930
+ this.toCdnUrl(e),
931
+ this.toAxiosConfig(t)
932
+ );
933
+ return this.mapAxiosResponse(s, t);
934
+ } catch (s) {
935
+ throw this.mapAxiosError(s, t);
936
+ }
1082
937
  }
1083
- onAppConfReady() {
1084
- return this.asyncData(ASYNC_DATA_NAME.APPCONF_READY);
938
+ async post(e, t, s) {
939
+ try {
940
+ const r = await this.axios.post(
941
+ this.fixBaseUrl(e),
942
+ t,
943
+ this.toAxiosConfig(s)
944
+ );
945
+ return this.mapAxiosResponse(r, s);
946
+ } catch (r) {
947
+ throw this.mapAxiosError(r, s);
948
+ }
1085
949
  }
1086
- promisify() {
1087
- return new Promisified();
950
+ async postFile(e, t, s) {
951
+ const r = this.toAxiosConfig(s);
952
+ r.headers && r.headers["Content-Type"] && delete r.headers["Content-Type"];
953
+ try {
954
+ const i = await this.axios.post(this.fixBaseUrl(e), t, {
955
+ ...r,
956
+ headers: {
957
+ "Content-Type": "multipart/form-data"
958
+ }
959
+ });
960
+ return this.mapAxiosResponse(i, s);
961
+ } catch (i) {
962
+ throw this.mapAxiosError(i, s);
963
+ }
1088
964
  }
1089
- events() {
1090
- return this.subject;
965
+ async postJson(e, t, s) {
966
+ const r = this.toAxiosConfig();
967
+ r.headers && (r.headers["Content-Type"] = "application/json");
968
+ try {
969
+ const i = await this.axios.post(
970
+ this.fixBaseUrl(e),
971
+ t,
972
+ this.toAxiosConfig(s)
973
+ );
974
+ return this.mapAxiosResponse(i, s);
975
+ } catch (i) {
976
+ throw this.mapAxiosError(i, s);
977
+ }
1091
978
  }
1092
- }
1093
- const notify = new NotifyFramework(), bundle = {}, promises = {}, defaultDiacriticsRemovalMap = [
1094
- {
1095
- base: "A",
1096
- letters: /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g
1097
- },
1098
- { base: "AA", letters: /[\uA732]/g },
1099
- { base: "AE", letters: /[\u00C6\u01FC\u01E2]/g },
1100
- { base: "AO", letters: /[\uA734]/g },
1101
- { base: "AU", letters: /[\uA736]/g },
1102
- { base: "AV", letters: /[\uA738\uA73A]/g },
1103
- { base: "AY", letters: /[\uA73C]/g },
1104
- {
1105
- base: "B",
1106
- letters: /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g
1107
- },
1108
- {
1109
- base: "C",
1110
- letters: /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g
1111
- },
1112
- {
1113
- base: "D",
1114
- letters: /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g
1115
- },
1116
- { base: "DZ", letters: /[\u01F1\u01C4]/g },
1117
- { base: "Dz", letters: /[\u01F2\u01C5]/g },
1118
- {
1119
- base: "E",
1120
- letters: /[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g
1121
- },
1122
- { base: "F", letters: /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g },
1123
- {
1124
- base: "G",
1125
- letters: /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g
1126
- },
1127
- {
1128
- base: "H",
1129
- letters: /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g
1130
- },
1131
- {
1132
- base: "I",
1133
- letters: /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g
1134
- },
1135
- { base: "J", letters: /[\u004A\u24BF\uFF2A\u0134\u0248]/g },
1136
- {
1137
- base: "K",
1138
- letters: /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g
1139
- },
1140
- {
1141
- base: "L",
1142
- letters: /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g
1143
- },
1144
- { base: "LJ", letters: /[\u01C7]/g },
1145
- { base: "Lj", letters: /[\u01C8]/g },
1146
- { base: "M", letters: /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g },
1147
- {
1148
- base: "N",
1149
- letters: /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g
1150
- },
1151
- { base: "NJ", letters: /[\u01CA]/g },
1152
- { base: "Nj", letters: /[\u01CB]/g },
1153
- {
1154
- base: "O",
1155
- letters: /[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g
1156
- },
1157
- { base: "OI", letters: /[\u01A2]/g },
1158
- { base: "OO", letters: /[\uA74E]/g },
1159
- { base: "OU", letters: /[\u0222]/g },
1160
- {
1161
- base: "P",
1162
- letters: /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g
1163
- },
1164
- { base: "Q", letters: /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g },
1165
- {
1166
- base: "R",
1167
- letters: /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g
1168
- },
1169
- {
1170
- base: "S",
1171
- letters: /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g
1172
- },
1173
- {
1174
- base: "T",
1175
- letters: /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g
1176
- },
1177
- { base: "TZ", letters: /[\uA728]/g },
1178
- {
1179
- base: "U",
1180
- letters: /[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g
1181
- },
1182
- { base: "V", letters: /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g },
1183
- { base: "VY", letters: /[\uA760]/g },
1184
- {
1185
- base: "W",
1186
- letters: /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g
1187
- },
1188
- { base: "X", letters: /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g },
1189
- {
1190
- base: "Y",
1191
- letters: /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g
1192
- },
1193
- {
1194
- base: "Z",
1195
- letters: /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g
1196
- },
1197
- {
1198
- base: "a",
1199
- letters: /[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g
1200
- },
1201
- { base: "aa", letters: /[\uA733]/g },
1202
- { base: "ae", letters: /[\u00E6\u01FD\u01E3]/g },
1203
- { base: "ao", letters: /[\uA735]/g },
1204
- { base: "au", letters: /[\uA737]/g },
1205
- { base: "av", letters: /[\uA739\uA73B]/g },
1206
- { base: "ay", letters: /[\uA73D]/g },
1207
- {
1208
- base: "b",
1209
- letters: /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g
1210
- },
1211
- {
1212
- base: "c",
1213
- letters: /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g
1214
- },
1215
- {
1216
- base: "d",
1217
- letters: /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g
1218
- },
1219
- { base: "dz", letters: /[\u01F3\u01C6]/g },
1220
- {
1221
- base: "e",
1222
- letters: /[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g
1223
- },
1224
- { base: "f", letters: /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g },
1225
- {
1226
- base: "g",
1227
- letters: /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g
1228
- },
1229
- {
1230
- base: "h",
1231
- letters: /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g
1232
- },
1233
- { base: "hv", letters: /[\u0195]/g },
1234
- {
1235
- base: "i",
1236
- letters: /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g
1237
- },
1238
- { base: "j", letters: /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g },
1239
- {
1240
- base: "k",
1241
- letters: /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g
1242
- },
1243
- {
1244
- base: "l",
1245
- letters: /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g
1246
- },
1247
- { base: "lj", letters: /[\u01C9]/g },
1248
- { base: "m", letters: /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g },
1249
- {
1250
- base: "n",
1251
- letters: /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g
1252
- },
1253
- { base: "nj", letters: /[\u01CC]/g },
1254
- {
1255
- base: "o",
1256
- letters: /[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g
1257
- },
1258
- { base: "oi", letters: /[\u01A3]/g },
1259
- { base: "ou", letters: /[\u0223]/g },
1260
- { base: "oo", letters: /[\uA74F]/g },
1261
- {
1262
- base: "p",
1263
- letters: /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g
1264
- },
1265
- { base: "q", letters: /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g },
1266
- {
1267
- base: "r",
1268
- letters: /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g
1269
- },
1270
- {
1271
- base: "s",
1272
- letters: /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g
1273
- },
1274
- {
1275
- base: "t",
1276
- letters: /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g
1277
- },
1278
- { base: "tz", letters: /[\uA729]/g },
1279
- {
1280
- base: "u",
1281
- letters: /[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g
1282
- },
1283
- { base: "v", letters: /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g },
1284
- { base: "vy", letters: /[\uA761]/g },
1285
- {
1286
- base: "w",
1287
- letters: /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g
1288
- },
1289
- { base: "x", letters: /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g },
1290
- {
1291
- base: "y",
1292
- letters: /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g
1293
- },
1294
- {
1295
- base: "z",
1296
- letters: /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g
1297
- }
1298
- ];
1299
- class IdiomService {
1300
- constructor(e) {
1301
- this.context = e;
979
+ async put(e, t, s) {
980
+ try {
981
+ const r = await this.axios.put(
982
+ this.fixBaseUrl(e),
983
+ t,
984
+ this.toAxiosConfig(s)
985
+ );
986
+ return this.mapAxiosResponse(r, s);
987
+ } catch (r) {
988
+ throw this.mapAxiosError(r, s);
989
+ }
1302
990
  }
1303
- get http() {
1304
- return this.context.http();
991
+ async putFile(e, t, s) {
992
+ try {
993
+ const r = this.toAxiosConfig(s);
994
+ r.headers && r.headers["Content-Type"] && delete r.headers["Content-Type"];
995
+ const i = await this.axios.put(this.fixBaseUrl(e), t, {
996
+ ...r,
997
+ headers: {
998
+ "Content-Type": "multipart/form-data"
999
+ }
1000
+ });
1001
+ return this.mapAxiosResponse(i, s);
1002
+ } catch (r) {
1003
+ throw this.mapAxiosError(r, s);
1004
+ }
1305
1005
  }
1306
- async getIdiom(e, t) {
1307
- await Promise.all([
1308
- this.addBundlePromise(e, "/i18n"),
1309
- this.addBundlePromise(e, `/${t}/i18n`)
1310
- ]);
1006
+ async putJson(e, t, s) {
1007
+ const r = this.toAxiosConfig(s);
1008
+ r.headers && (r.headers["Content-Type"] = "application/json");
1009
+ try {
1010
+ const i = await this.axios.put(this.fixBaseUrl(e), t, r);
1011
+ return this.mapAxiosResponse(i, s);
1012
+ } catch (i) {
1013
+ throw this.mapAxiosError(i, s);
1014
+ }
1311
1015
  }
1312
- translate(e, t) {
1313
- e = e ?? "";
1314
- let s = bundle[e] === void 0 ? e : bundle[e];
1315
- if (t && typeof t == "object")
1316
- for (let r in t)
1317
- typeof t[r] < "u" && (s = s.replace(
1318
- new RegExp("\\${" + r + "}", "g"),
1319
- "" + t[r]
1320
- ));
1321
- return s;
1016
+ async delete(e, t) {
1017
+ try {
1018
+ const s = await this.axios.delete(
1019
+ this.fixBaseUrl(e),
1020
+ this.toAxiosConfig(t)
1021
+ );
1022
+ return this.mapAxiosResponse(s, t);
1023
+ } catch (s) {
1024
+ throw this.mapAxiosError(s, t);
1025
+ }
1322
1026
  }
1323
- addBundlePromise(e, t) {
1324
- return this.loadBundlePromise(e, t);
1325
- }
1326
- addBundle(e, t, s) {
1327
- this.loadBundle(e, t, s);
1328
- }
1329
- loadBundlePromise(e, t) {
1330
- return this.loadBundle(e, t), promises[t];
1331
- }
1332
- loadBundle(e, t, s) {
1333
- const r = promises[t];
1334
- if (r)
1335
- s && r.then(s).catch(s);
1336
- else {
1337
- const i = new Promisified();
1338
- promises[t] = i.promise;
1339
- const o = {};
1340
- e && (o["Accept-Language"] = e), this.http.get(t, { headers: o }).then((u) => {
1341
- Object.assign(bundle, u), typeof s == "function" && s(), i.resolve();
1342
- }).catch((u) => {
1343
- typeof s == "function" && s(), i.reject();
1027
+ async deleteJson(e, t) {
1028
+ try {
1029
+ const s = await this.axios.delete(this.fixBaseUrl(e), {
1030
+ data: t
1344
1031
  });
1032
+ return this.mapAxiosResponse(s);
1033
+ } catch (s) {
1034
+ throw this.mapAxiosError(s);
1345
1035
  }
1346
1036
  }
1347
- addTranslations(e, t) {
1348
- notify.onLangReady().promise.then((s) => {
1349
- this.loadBundle(s, e + "/" + s + ".json", t);
1037
+ getScript(e, t, s) {
1038
+ const r = s ?? "exports", i = this.toAxiosConfig(t);
1039
+ return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((o) => this.mapAxiosResponse(o, t)).then((o) => {
1040
+ try {
1041
+ const u = `"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;
1042
+ return Function(u)();
1043
+ } catch {
1044
+ return o;
1045
+ }
1046
+ }).catch((o) => {
1047
+ throw this.mapAxiosError(o, t), o;
1350
1048
  });
1351
1049
  }
1352
- addAllTranslations(e) {
1353
- return e && e.length > 0 ? notify.onLangReady().promise.then(
1354
- (t) => Promise.all(
1355
- e.map(
1356
- (s) => this.loadBundlePromise(t, s + "/" + t + ".json")
1357
- )
1358
- )
1359
- ).then(() => {
1360
- }) : Promise.reject();
1361
- }
1362
- addKeys(e) {
1363
- for (var t in e)
1364
- typeof bundle[t] != "string" && (bundle[t] = e[t]);
1365
- }
1366
- removeAccents(e) {
1367
- for (var t = 0; t < defaultDiacriticsRemovalMap.length; t++)
1368
- e = e.replace(
1369
- defaultDiacriticsRemovalMap[t].letters,
1370
- defaultDiacriticsRemovalMap[t].base
1371
- );
1372
- return e;
1050
+ loadScript(e, t) {
1051
+ return loadedScripts[e] ? Promise.resolve() : this.getScript(e, t).then(() => {
1052
+ loadedScripts[e] = !0;
1053
+ });
1373
1054
  }
1374
1055
  }
1375
1056
  class AbstractBehaviourService {
@@ -1765,9 +1446,7 @@ class WikiBehaviour extends AbstractBehaviourService {
1765
1446
  a(this, "RESOURCE", "wiki");
1766
1447
  }
1767
1448
  async loadResources() {
1768
- return (await this.httpGet(
1769
- "/wiki/listallpages?visible=true"
1770
- )).map((s) => s.pages.map((r) => {
1449
+ return (await this.httpGet("/wiki/listallpages?visible=true")).map((s) => s.pages.map((r) => {
1771
1450
  let i;
1772
1451
  return typeof s.thumbnail > "u" || s.thumbnail === "" ? i = "/img/icons/glyphicons_036_file.png" : i = s.thumbnail + "?thumbnail=48x48", this.dataToResource({
1773
1452
  title: r.title + " [" + s.title + "]",
@@ -2237,6 +1916,212 @@ class SessionService {
2237
1916
  });
2238
1917
  }
2239
1918
  }
1919
+ const defaultDiacriticsRemovalMap = [
1920
+ {
1921
+ base: "A",
1922
+ letters: /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g
1923
+ },
1924
+ { base: "AA", letters: /[\uA732]/g },
1925
+ { base: "AE", letters: /[\u00C6\u01FC\u01E2]/g },
1926
+ { base: "AO", letters: /[\uA734]/g },
1927
+ { base: "AU", letters: /[\uA736]/g },
1928
+ { base: "AV", letters: /[\uA738\uA73A]/g },
1929
+ { base: "AY", letters: /[\uA73C]/g },
1930
+ {
1931
+ base: "B",
1932
+ letters: /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g
1933
+ },
1934
+ {
1935
+ base: "C",
1936
+ letters: /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g
1937
+ },
1938
+ {
1939
+ base: "D",
1940
+ letters: /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g
1941
+ },
1942
+ { base: "DZ", letters: /[\u01F1\u01C4]/g },
1943
+ { base: "Dz", letters: /[\u01F2\u01C5]/g },
1944
+ {
1945
+ base: "E",
1946
+ letters: /[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g
1947
+ },
1948
+ { base: "F", letters: /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g },
1949
+ {
1950
+ base: "G",
1951
+ letters: /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g
1952
+ },
1953
+ {
1954
+ base: "H",
1955
+ letters: /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g
1956
+ },
1957
+ {
1958
+ base: "I",
1959
+ letters: /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g
1960
+ },
1961
+ { base: "J", letters: /[\u004A\u24BF\uFF2A\u0134\u0248]/g },
1962
+ {
1963
+ base: "K",
1964
+ letters: /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g
1965
+ },
1966
+ {
1967
+ base: "L",
1968
+ letters: /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g
1969
+ },
1970
+ { base: "LJ", letters: /[\u01C7]/g },
1971
+ { base: "Lj", letters: /[\u01C8]/g },
1972
+ { base: "M", letters: /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g },
1973
+ {
1974
+ base: "N",
1975
+ letters: /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g
1976
+ },
1977
+ { base: "NJ", letters: /[\u01CA]/g },
1978
+ { base: "Nj", letters: /[\u01CB]/g },
1979
+ {
1980
+ base: "O",
1981
+ letters: /[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g
1982
+ },
1983
+ { base: "OI", letters: /[\u01A2]/g },
1984
+ { base: "OO", letters: /[\uA74E]/g },
1985
+ { base: "OU", letters: /[\u0222]/g },
1986
+ {
1987
+ base: "P",
1988
+ letters: /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g
1989
+ },
1990
+ { base: "Q", letters: /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g },
1991
+ {
1992
+ base: "R",
1993
+ letters: /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g
1994
+ },
1995
+ {
1996
+ base: "S",
1997
+ letters: /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g
1998
+ },
1999
+ {
2000
+ base: "T",
2001
+ letters: /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g
2002
+ },
2003
+ { base: "TZ", letters: /[\uA728]/g },
2004
+ {
2005
+ base: "U",
2006
+ letters: /[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g
2007
+ },
2008
+ { base: "V", letters: /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g },
2009
+ { base: "VY", letters: /[\uA760]/g },
2010
+ {
2011
+ base: "W",
2012
+ letters: /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g
2013
+ },
2014
+ { base: "X", letters: /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g },
2015
+ {
2016
+ base: "Y",
2017
+ letters: /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g
2018
+ },
2019
+ {
2020
+ base: "Z",
2021
+ letters: /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g
2022
+ },
2023
+ {
2024
+ base: "a",
2025
+ letters: /[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g
2026
+ },
2027
+ { base: "aa", letters: /[\uA733]/g },
2028
+ { base: "ae", letters: /[\u00E6\u01FD\u01E3]/g },
2029
+ { base: "ao", letters: /[\uA735]/g },
2030
+ { base: "au", letters: /[\uA737]/g },
2031
+ { base: "av", letters: /[\uA739\uA73B]/g },
2032
+ { base: "ay", letters: /[\uA73D]/g },
2033
+ {
2034
+ base: "b",
2035
+ letters: /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g
2036
+ },
2037
+ {
2038
+ base: "c",
2039
+ letters: /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g
2040
+ },
2041
+ {
2042
+ base: "d",
2043
+ letters: /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g
2044
+ },
2045
+ { base: "dz", letters: /[\u01F3\u01C6]/g },
2046
+ {
2047
+ base: "e",
2048
+ letters: /[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g
2049
+ },
2050
+ { base: "f", letters: /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g },
2051
+ {
2052
+ base: "g",
2053
+ letters: /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g
2054
+ },
2055
+ {
2056
+ base: "h",
2057
+ letters: /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g
2058
+ },
2059
+ { base: "hv", letters: /[\u0195]/g },
2060
+ {
2061
+ base: "i",
2062
+ letters: /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g
2063
+ },
2064
+ { base: "j", letters: /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g },
2065
+ {
2066
+ base: "k",
2067
+ letters: /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g
2068
+ },
2069
+ {
2070
+ base: "l",
2071
+ letters: /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g
2072
+ },
2073
+ { base: "lj", letters: /[\u01C9]/g },
2074
+ { base: "m", letters: /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g },
2075
+ {
2076
+ base: "n",
2077
+ letters: /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g
2078
+ },
2079
+ { base: "nj", letters: /[\u01CC]/g },
2080
+ {
2081
+ base: "o",
2082
+ letters: /[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g
2083
+ },
2084
+ { base: "oi", letters: /[\u01A3]/g },
2085
+ { base: "ou", letters: /[\u0223]/g },
2086
+ { base: "oo", letters: /[\uA74F]/g },
2087
+ {
2088
+ base: "p",
2089
+ letters: /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g
2090
+ },
2091
+ { base: "q", letters: /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g },
2092
+ {
2093
+ base: "r",
2094
+ letters: /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g
2095
+ },
2096
+ {
2097
+ base: "s",
2098
+ letters: /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g
2099
+ },
2100
+ {
2101
+ base: "t",
2102
+ letters: /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g
2103
+ },
2104
+ { base: "tz", letters: /[\uA729]/g },
2105
+ {
2106
+ base: "u",
2107
+ letters: /[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g
2108
+ },
2109
+ { base: "v", letters: /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g },
2110
+ { base: "vy", letters: /[\uA761]/g },
2111
+ {
2112
+ base: "w",
2113
+ letters: /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g
2114
+ },
2115
+ { base: "x", letters: /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g },
2116
+ {
2117
+ base: "y",
2118
+ letters: /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g
2119
+ },
2120
+ {
2121
+ base: "z",
2122
+ letters: /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g
2123
+ }
2124
+ ];
2240
2125
  class StringUtils {
2241
2126
  static removeAccents(e) {
2242
2127
  for (let t = 0; t < defaultDiacriticsRemovalMap.length; t++)
@@ -2293,337 +2178,138 @@ class ShareService {
2293
2178
  return [...(await this.directory.getBookMarks()).filter(({ displayName: l }) => StringUtils.removeAccents(
2294
2179
  l || ""
2295
2180
  ).toLowerCase().includes(r)).map((l) => ({
2296
- avatarUrl: "",
2297
- directoryUrl: "",
2298
- profile: "",
2299
- displayName: l.displayName,
2300
- id: l.id,
2301
- type: "sharebookmark"
2302
- })), ...o, ...u];
2303
- }
2304
- async getShareMapping(e) {
2305
- const t = await this.cache.httpGetJson(
2306
- `/${e}/rights/sharing`
2307
- );
2308
- for (const s of Object.keys(t))
2309
- if (s.includes(".")) {
2310
- const r = s.split(".")[1], i = t[s];
2311
- delete t[s], t[r] = i;
2312
- }
2313
- return t;
2314
- }
2315
- getActionsAvailableFor({ id: e, type: t }, s, r) {
2316
- const o = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], u = Object.keys(r), c = [];
2317
- for (const h of u)
2318
- r[h].filter(
2319
- (d) => o.includes(d)
2320
- ).length > 0 && c.push(h);
2321
- return c;
2322
- }
2323
- async getRightsForResource(e, t) {
2324
- const s = await this.directory.getBookMarks(), r = `/${e}/share/json/${t}?search=`, i = await this.cache.httpGetJson(r), o = await this.getShareMapping(e), u = await this.cache.httpGetJson(
2325
- "/infra/public/json/sharing-rights.json"
2326
- ), c = Object.keys(i.users.checked).map((p) => i.users.visibles.find(
2327
- (A) => A.id === p
2328
- )).filter((p) => p !== void 0).map((p) => {
2329
- const E = this.getActionsAvailableFor(
2330
- { id: p.id, type: "user" },
2331
- i,
2332
- o
2333
- );
2334
- return {
2335
- id: p.id,
2336
- type: "user",
2337
- displayName: p.username,
2338
- profile: p.profile,
2339
- avatarUrl: this.directory.getAvatarUrl(p.id, "user"),
2340
- directoryUrl: this.directory.getDirectoryUrl(p.id, "user"),
2341
- actions: E.map((m) => {
2342
- const w = u[m];
2343
- return {
2344
- displayName: m,
2345
- id: m,
2346
- priority: w.priority
2347
- };
2348
- })
2349
- };
2350
- }).sort((p, E) => (p.displayName || "").localeCompare(E.displayName)), h = Object.keys(i.groups.checked).map((p) => i.groups.visibles.find(
2351
- (A) => A.id === p
2352
- )).filter((p) => p !== void 0).map((p) => {
2353
- const E = this.getActionsAvailableFor(
2354
- { id: p.id, type: "group" },
2355
- i,
2356
- o
2357
- );
2358
- return {
2359
- id: p.id,
2360
- type: "group",
2361
- displayName: p.name,
2362
- profile: void 0,
2363
- avatarUrl: this.directory.getAvatarUrl(p.id, "group"),
2364
- directoryUrl: this.directory.getDirectoryUrl(p.id, "group"),
2365
- actions: E.map((m) => {
2366
- const w = u[m];
2367
- return {
2368
- displayName: m,
2369
- id: m,
2370
- priority: w.priority
2371
- };
2372
- })
2373
- };
2374
- }).sort((p, E) => (p.displayName || "").localeCompare(E.displayName)), l = [...c, ...h], g = i.groups.visibles.map(
2375
- ({ groupDisplayName: p, id: E, name: A }) => ({
2376
- displayName: p || A,
2377
- id: E
2378
- })
2379
- ), d = i.users.visibles.map(
2380
- ({ id: p, profile: E, username: A, firstName: m, lastName: w, login: C }) => ({
2381
- displayName: A,
2382
- firstName: m,
2383
- lastName: w,
2384
- login: C,
2385
- profile: E,
2386
- id: p
2387
- })
2388
- );
2389
- return {
2390
- rights: l,
2391
- visibleBookmarks: s,
2392
- visibleGroups: g,
2393
- visibleUsers: d
2394
- };
2395
- }
2396
- async saveRights(e, t, s) {
2397
- const r = await this.getShareMapping(e), i = {
2398
- bookmarks: {},
2399
- groups: {},
2400
- users: {}
2401
- };
2402
- for (const c of s) {
2403
- const h = c.actions.map((g) => r[g.id]).reduce((g, d) => Array.isArray(d) ? [...g, ...d] : g, []), l = [...new Set(h)];
2404
- l.length > 0 && (c.type === "user" ? i.users[c.id] = l : c.type === "group" ? i.groups[c.id] = l : i.bookmarks[c.id] = l);
2405
- }
2406
- const o = `/${e}/share/resource/${t}`;
2407
- return this.cache.clearCache(`/${e}/share/json/${t}?search=`), await this.http.putJson(o, i);
2408
- }
2409
- async getActionsForApp(e) {
2410
- const t = await this.cache.httpGetJson(
2411
- "/infra/public/json/sharing-rights.json"
2412
- ), s = await this.getShareMapping(e);
2413
- return Object.keys(t).map((i) => {
2414
- const o = t[i];
2415
- return {
2416
- displayName: i,
2417
- id: i,
2418
- priority: o.priority,
2419
- requires: o.requires
2420
- };
2421
- }).filter((i) => {
2422
- var o;
2423
- return ((o = s[i.id]) == null ? void 0 : o.length) > 0;
2424
- }).sort((i, o) => i.priority - o.priority);
2425
- }
2426
- }
2427
- const loadedScripts = {};
2428
- class HttpService {
2429
- constructor(e, t, s) {
2430
- // Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
2431
- a(this, "axios");
2432
- a(this, "baseUrl");
2433
- a(this, "headers", {});
2434
- a(this, "_latestResponse");
2435
- this.context = e, this.axios = t || axios;
2436
- }
2437
- fixBaseUrl(e) {
2438
- return e.startsWith("http://") || e.startsWith("https://") ? e : this.baseUrl ? this.baseUrl.endsWith("/") || e.startsWith("/") ? `${this.baseUrl}${e}` : `${this.baseUrl}/${e}` : e;
2439
- }
2440
- useAxiosInstance(e) {
2441
- return this.axios = e, this;
2442
- }
2443
- useBaseUrl(e) {
2444
- return this.baseUrl = e, this.axios.defaults.baseURL = e, this;
2445
- }
2446
- useHeaders(e) {
2447
- return this.headers = e, this.axios.defaults.headers.common = e, this;
2448
- }
2449
- setCdn(e) {
2450
- e && XMLHttpRequest && !XMLHttpRequest.prototype.cdnUrl && (XMLHttpRequest.prototype.cdnUrl = e, XMLHttpRequest.prototype.baseOpen = XMLHttpRequest.prototype.open, XMLHttpRequest.prototype.open = function() {
2451
- const t = arguments[1];
2452
- return t.startsWith("/infra/public") && (arguments[1] = e + t), /^\/([^\/]*)\/public/.test(t) && (arguments[1] = e + t), t.startsWith("/assets") && (arguments[1] = e + t), t == "/conf/public" && (arguments[1] = t), t.startsWith("http") && (arguments[1] = t), this.baseOpen.apply(this, arguments);
2453
- });
2454
- }
2455
- // private toAxiosConfig(params?: IHttpParams): AxiosRequestConfig {
2456
- toAxiosConfig(e) {
2457
- if (e) {
2458
- const t = Object.assign({}, this.axios.defaults);
2459
- e.headers && (t.headers = Object.assign({}, this.axios.defaults.headers), Object.assign(t.headers, e.headers)), e.responseType && (t.responseType = e.responseType), e.queryParams && (t.params = Object.assign({}, e.queryParams));
2460
- const s = t.headers ?? {};
2461
- return t.headers = { ...s, ...this.headers }, t;
2462
- } else
2463
- return this.axios.defaults;
2464
- }
2465
- toCdnUrl(e) {
2466
- e = this.fixBaseUrl(e);
2467
- const t = this.context.conf().getCdnUrl() || "";
2468
- if (t.length > 0 && e !== "/conf/public") {
2469
- const s = "" + e;
2470
- (s.startsWith("/infra/public") || s.startsWith("/assets") || /^\/([^\/]*)\/public/.test(s)) && (e = t + s);
2471
- }
2472
- return e;
2473
- }
2474
- mapAxiosError(e, t) {
2475
- e.response ? this._latestResponse = e.response : e.request ? this._latestResponse = {
2476
- status: 408,
2477
- statusText: ERROR_CODE.TIME_OUT
2478
- } : this._latestResponse = {
2479
- status: 500,
2480
- statusText: ERROR_CODE.UNKNOWN
2481
- };
2482
- const {
2483
- /* status, statusText, headers, */
2484
- data: s
2485
- } = this._latestResponse;
2486
- return s;
2487
- }
2488
- mapAxiosResponse(e, t) {
2489
- return this._latestResponse = e, e.data;
2490
- }
2491
- get latestResponse() {
2492
- return this._latestResponse;
2493
- }
2494
- isResponseError() {
2495
- return this.latestResponse.status < 200 || this.latestResponse.status >= 300;
2496
- }
2497
- async get(e, t) {
2498
- try {
2499
- const s = await this.axios.get(
2500
- this.toCdnUrl(e),
2501
- this.toAxiosConfig(t)
2502
- );
2503
- return this.mapAxiosResponse(s, t);
2504
- } catch (s) {
2505
- throw this.mapAxiosError(s, t);
2506
- }
2507
- }
2508
- async post(e, t, s) {
2509
- try {
2510
- const r = await this.axios.post(
2511
- this.fixBaseUrl(e),
2512
- t,
2513
- this.toAxiosConfig(s)
2514
- );
2515
- return this.mapAxiosResponse(r, s);
2516
- } catch (r) {
2517
- throw this.mapAxiosError(r, s);
2518
- }
2519
- }
2520
- async postFile(e, t, s) {
2521
- const r = this.toAxiosConfig(s);
2522
- r.headers && r.headers["Content-Type"] && delete r.headers["Content-Type"];
2523
- try {
2524
- const i = await this.axios.post(this.fixBaseUrl(e), t, {
2525
- ...r,
2526
- headers: {
2527
- "Content-Type": "multipart/form-data"
2528
- }
2529
- });
2530
- return this.mapAxiosResponse(i, s);
2531
- } catch (i) {
2532
- throw this.mapAxiosError(i, s);
2533
- }
2534
- }
2535
- async postJson(e, t, s) {
2536
- const r = this.toAxiosConfig();
2537
- r.headers && (r.headers["Content-Type"] = "application/json");
2538
- try {
2539
- const i = await this.axios.post(
2540
- this.fixBaseUrl(e),
2541
- t,
2542
- this.toAxiosConfig(s)
2543
- );
2544
- return this.mapAxiosResponse(i, s);
2545
- } catch (i) {
2546
- throw this.mapAxiosError(i, s);
2547
- }
2548
- }
2549
- async put(e, t, s) {
2550
- try {
2551
- const r = await this.axios.put(
2552
- this.fixBaseUrl(e),
2553
- t,
2554
- this.toAxiosConfig(s)
2555
- );
2556
- return this.mapAxiosResponse(r, s);
2557
- } catch (r) {
2558
- throw this.mapAxiosError(r, s);
2559
- }
2560
- }
2561
- async putFile(e, t, s) {
2562
- try {
2563
- const r = this.toAxiosConfig(s);
2564
- r.headers && r.headers["Content-Type"] && delete r.headers["Content-Type"];
2565
- const i = await this.axios.put(this.fixBaseUrl(e), t, {
2566
- ...r,
2567
- headers: {
2568
- "Content-Type": "multipart/form-data"
2569
- }
2570
- });
2571
- return this.mapAxiosResponse(i, s);
2572
- } catch (r) {
2573
- throw this.mapAxiosError(r, s);
2574
- }
2181
+ avatarUrl: "",
2182
+ directoryUrl: "",
2183
+ profile: "",
2184
+ displayName: l.displayName,
2185
+ id: l.id,
2186
+ type: "sharebookmark"
2187
+ })), ...o, ...u];
2575
2188
  }
2576
- async putJson(e, t, s) {
2577
- const r = this.toAxiosConfig(s);
2578
- r.headers && (r.headers["Content-Type"] = "application/json");
2579
- try {
2580
- const i = await this.axios.put(this.fixBaseUrl(e), t, r);
2581
- return this.mapAxiosResponse(i, s);
2582
- } catch (i) {
2583
- throw this.mapAxiosError(i, s);
2584
- }
2189
+ async getShareMapping(e) {
2190
+ const t = await this.cache.httpGetJson(
2191
+ `/${e}/rights/sharing`
2192
+ );
2193
+ for (const s of Object.keys(t))
2194
+ if (s.includes(".")) {
2195
+ const r = s.split(".")[1], i = t[s];
2196
+ delete t[s], t[r] = i;
2197
+ }
2198
+ return t;
2585
2199
  }
2586
- async delete(e, t) {
2587
- try {
2588
- const s = await this.axios.delete(
2589
- this.fixBaseUrl(e),
2590
- this.toAxiosConfig(t)
2200
+ getActionsAvailableFor({ id: e, type: t }, s, r) {
2201
+ const o = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], u = Object.keys(r), c = [];
2202
+ for (const h of u)
2203
+ r[h].filter(
2204
+ (d) => o.includes(d)
2205
+ ).length > 0 && c.push(h);
2206
+ return c;
2207
+ }
2208
+ async getRightsForResource(e, t) {
2209
+ const s = await this.directory.getBookMarks(), r = `/${e}/share/json/${t}?search=`, i = await this.cache.httpGetJson(r), o = await this.getShareMapping(e), u = await this.cache.httpGetJson(
2210
+ "/infra/public/json/sharing-rights.json"
2211
+ ), c = Object.keys(i.users.checked).map((p) => i.users.visibles.find(
2212
+ (A) => A.id === p
2213
+ )).filter((p) => p !== void 0).map((p) => {
2214
+ const E = this.getActionsAvailableFor(
2215
+ { id: p.id, type: "user" },
2216
+ i,
2217
+ o
2591
2218
  );
2592
- return this.mapAxiosResponse(s, t);
2593
- } catch (s) {
2594
- throw this.mapAxiosError(s, t);
2595
- }
2219
+ return {
2220
+ id: p.id,
2221
+ type: "user",
2222
+ displayName: p.username,
2223
+ profile: p.profile,
2224
+ avatarUrl: this.directory.getAvatarUrl(p.id, "user"),
2225
+ directoryUrl: this.directory.getDirectoryUrl(p.id, "user"),
2226
+ actions: E.map((m) => {
2227
+ const w = u[m];
2228
+ return {
2229
+ displayName: m,
2230
+ id: m,
2231
+ priority: w.priority
2232
+ };
2233
+ })
2234
+ };
2235
+ }).sort((p, E) => (p.displayName || "").localeCompare(E.displayName)), h = Object.keys(i.groups.checked).map((p) => i.groups.visibles.find(
2236
+ (A) => A.id === p
2237
+ )).filter((p) => p !== void 0).map((p) => {
2238
+ const E = this.getActionsAvailableFor(
2239
+ { id: p.id, type: "group" },
2240
+ i,
2241
+ o
2242
+ );
2243
+ return {
2244
+ id: p.id,
2245
+ type: "group",
2246
+ displayName: p.name,
2247
+ profile: void 0,
2248
+ avatarUrl: this.directory.getAvatarUrl(p.id, "group"),
2249
+ directoryUrl: this.directory.getDirectoryUrl(p.id, "group"),
2250
+ actions: E.map((m) => {
2251
+ const w = u[m];
2252
+ return {
2253
+ displayName: m,
2254
+ id: m,
2255
+ priority: w.priority
2256
+ };
2257
+ })
2258
+ };
2259
+ }).sort((p, E) => (p.displayName || "").localeCompare(E.displayName)), l = [...c, ...h], g = i.groups.visibles.map(
2260
+ ({ groupDisplayName: p, id: E, name: A }) => ({
2261
+ displayName: p || A,
2262
+ id: E
2263
+ })
2264
+ ), d = i.users.visibles.map(
2265
+ ({ id: p, profile: E, username: A, firstName: m, lastName: w, login: C }) => ({
2266
+ displayName: A,
2267
+ firstName: m,
2268
+ lastName: w,
2269
+ login: C,
2270
+ profile: E,
2271
+ id: p
2272
+ })
2273
+ );
2274
+ return {
2275
+ rights: l,
2276
+ visibleBookmarks: s,
2277
+ visibleGroups: g,
2278
+ visibleUsers: d
2279
+ };
2596
2280
  }
2597
- async deleteJson(e, t) {
2598
- try {
2599
- const s = await this.axios.delete(this.fixBaseUrl(e), {
2600
- data: t
2601
- });
2602
- return this.mapAxiosResponse(s);
2603
- } catch (s) {
2604
- throw this.mapAxiosError(s);
2281
+ async saveRights(e, t, s) {
2282
+ const r = await this.getShareMapping(e), i = {
2283
+ bookmarks: {},
2284
+ groups: {},
2285
+ users: {}
2286
+ };
2287
+ for (const c of s) {
2288
+ const h = c.actions.map((g) => r[g.id]).reduce((g, d) => Array.isArray(d) ? [...g, ...d] : g, []), l = [...new Set(h)];
2289
+ l.length > 0 && (c.type === "user" ? i.users[c.id] = l : c.type === "group" ? i.groups[c.id] = l : i.bookmarks[c.id] = l);
2605
2290
  }
2291
+ const o = `/${e}/share/resource/${t}`;
2292
+ return this.cache.clearCache(`/${e}/share/json/${t}?search=`), await this.http.putJson(o, i);
2606
2293
  }
2607
- getScript(e, t, s) {
2608
- const r = s ?? "exports", i = this.toAxiosConfig(t);
2609
- return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((o) => this.mapAxiosResponse(o, t)).then((o) => {
2610
- try {
2611
- const u = `"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;
2612
- return Function(u)();
2613
- } catch {
2614
- return o;
2615
- }
2616
- }).catch((o) => {
2617
- throw this.mapAxiosError(o, t), o;
2618
- });
2619
- }
2620
- loadScript(e, t) {
2621
- return loadedScripts[e] ? Promise.resolve() : this.getScript(e, t).then((s) => {
2622
- loadedScripts[e] = !0;
2623
- });
2294
+ async getActionsForApp(e) {
2295
+ const t = await this.cache.httpGetJson(
2296
+ "/infra/public/json/sharing-rights.json"
2297
+ ), s = await this.getShareMapping(e);
2298
+ return Object.keys(t).map((i) => {
2299
+ const o = t[i];
2300
+ return {
2301
+ displayName: i,
2302
+ id: i,
2303
+ priority: o.priority,
2304
+ requires: o.requires
2305
+ };
2306
+ }).filter((i) => {
2307
+ var o;
2308
+ return ((o = s[i.id]) == null ? void 0 : o.length) > 0;
2309
+ }).sort((i, o) => i.priority - o.priority);
2624
2310
  }
2625
2311
  }
2626
- const R = class R {
2312
+ const b = class b {
2627
2313
  // in minutes. Applies to recorded videos.
2628
2314
  constructor(e) {
2629
2315
  this.context = e;
@@ -2641,11 +2327,11 @@ const R = class R {
2641
2327
  async getVideoConf() {
2642
2328
  var t;
2643
2329
  const e = await this.conf.getPublicConf(
2644
- APP$2.VIDEO
2330
+ APP$1.VIDEO
2645
2331
  );
2646
2332
  return {
2647
- maxWeight: (e == null ? void 0 : e["max-videosize-mbytes"]) ?? R.MAX_WEIGHT,
2648
- maxDuration: (e == null ? void 0 : e["max-videoduration-minutes"]) ?? R.MAX_DURATION,
2333
+ maxWeight: (e == null ? void 0 : e["max-videosize-mbytes"]) ?? b.MAX_WEIGHT,
2334
+ maxDuration: (e == null ? void 0 : e["max-videoduration-minutes"]) ?? b.MAX_DURATION,
2649
2335
  acceptVideoUploadExtensions: ((t = e == null ? void 0 : e["accept-videoupload-extensions"]) == null ? void 0 : t.map(
2650
2336
  (s) => s.toUpperCase()
2651
2337
  )) ?? []
@@ -2686,7 +2372,7 @@ const R = class R {
2686
2372
  `/video/status/${c.processid}`
2687
2373
  );
2688
2374
  if (d.state == "succeed")
2689
- return d;
2375
+ return d.videoworkspaceid && d.videosize, d;
2690
2376
  if (d.state == "error")
2691
2377
  break;
2692
2378
  } while (!0);
@@ -2694,9 +2380,9 @@ const R = class R {
2694
2380
  throw new Error("Video cannot be uploaded.");
2695
2381
  }
2696
2382
  };
2697
- a(R, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
2698
- a(R, "MAX_DURATION", 3);
2699
- let VideoService = R;
2383
+ a(b, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
2384
+ a(b, "MAX_DURATION", 3);
2385
+ let VideoService = b;
2700
2386
  const defaultMappers = {
2701
2387
  csv: function({ type: n, extension: e }) {
2702
2388
  return MimeTypeUtils.INSTANCE.isCsvLike(n, e);
@@ -2731,11 +2417,11 @@ const defaultMappers = {
2731
2417
  zip: function({ type: n }) {
2732
2418
  return n.indexOf("zip") !== -1 || n.indexOf("rar") !== -1 || n.indexOf("tar") !== -1 || n.indexOf("7z") !== -1;
2733
2419
  }
2734
- }, b = class b {
2420
+ }, R = class R {
2735
2421
  /* Similar role notion as in infra-front > workspace > Model.ts */
2736
2422
  static getRole(e) {
2737
2423
  var t, s;
2738
- return b.role(
2424
+ return R.role(
2739
2425
  (t = e.metadata) == null ? void 0 : t["content-type"],
2740
2426
  !1,
2741
2427
  (s = e.metadata) == null ? void 0 : s.extension
@@ -2755,10 +2441,10 @@ const defaultMappers = {
2755
2441
  }
2756
2442
  };
2757
2443
  // FIXME add edumedia support
2758
- a(b, "roleMappers", [
2444
+ a(R, "roleMappers", [
2759
2445
  (e) => Object.keys(defaultMappers).find((s) => defaultMappers[s](e))
2760
2446
  ]);
2761
- let DocumentHelper = b;
2447
+ let DocumentHelper = R;
2762
2448
  class WorkspaceService {
2763
2449
  constructor(e) {
2764
2450
  this.context = e;
@@ -2874,6 +2560,94 @@ class WorkspaceService {
2874
2560
  }
2875
2561
  }
2876
2562
  }
2563
+ class ReactionsService {
2564
+ constructor(e, t, s) {
2565
+ this.context = e, this.module = t, this.resourceType = s;
2566
+ }
2567
+ get http() {
2568
+ return this.context.http();
2569
+ }
2570
+ async loadAvailableReactions() {
2571
+ try {
2572
+ const { "reaction-types": e } = await this.context.conf().getPublicConf("audience");
2573
+ return Array.isArray(e) ? e : void 0;
2574
+ } catch {
2575
+ console.error("Audience configuration not found");
2576
+ return;
2577
+ }
2578
+ }
2579
+ async loadReactionSummaries(e) {
2580
+ const t = await this.http.get(
2581
+ `/audience/reactions/${this.module}/${this.resourceType}?resourceIds=${e.join(",")}`
2582
+ );
2583
+ return this.http.isResponseError() ? {} : t.reactionsByResource;
2584
+ }
2585
+ async loadReactionDetails(e, t, s) {
2586
+ const r = await this.http.get(
2587
+ `/audience/reactions/${this.module}/${this.resourceType}/${e}?page=${t}&size=${s}`
2588
+ );
2589
+ return this.http.isResponseError() ? void 0 : r;
2590
+ }
2591
+ async deleteReaction(e) {
2592
+ await this.http.delete(
2593
+ `/audience/reactions/${this.module}/${this.resourceType}/${e}`
2594
+ );
2595
+ }
2596
+ async updateReaction(e, t) {
2597
+ await this.http.putJson(
2598
+ `/audience/reactions/${this.module}/${this.resourceType}`,
2599
+ {
2600
+ resourceId: e,
2601
+ reactionType: t
2602
+ }
2603
+ );
2604
+ }
2605
+ async createReaction(e, t) {
2606
+ await this.http.postJson(
2607
+ `/audience/reactions/${this.module}/${this.resourceType}`,
2608
+ {
2609
+ resourceId: e,
2610
+ reactionType: t
2611
+ }
2612
+ );
2613
+ }
2614
+ }
2615
+ class ViewsService {
2616
+ constructor(e, t, s) {
2617
+ this.context = e, this.module = t, this.resourceType = s;
2618
+ }
2619
+ get http() {
2620
+ return this.context.http();
2621
+ }
2622
+ async getCounters(e) {
2623
+ const t = await this.http.get(
2624
+ `/audience/views/count/${this.module}/${this.resourceType}?resourceIds=${e.join(",")}`
2625
+ );
2626
+ return this.http.isResponseError() ? {} : t;
2627
+ }
2628
+ async getDetails(e) {
2629
+ const t = await this.http.get(
2630
+ `/audience/views/details/${this.module}/${this.resourceType}/${e}`
2631
+ );
2632
+ return this.http.isResponseError() ? void 0 : t;
2633
+ }
2634
+ trigger(e) {
2635
+ return this.http.post(
2636
+ `/audience/views/${this.module}/${this.resourceType}/${e}`
2637
+ );
2638
+ }
2639
+ }
2640
+ class AudienceService {
2641
+ constructor(e, t, s) {
2642
+ this.context = e, this.module = t, this.resourceType = s;
2643
+ }
2644
+ get views() {
2645
+ return new ViewsService(this.context, this.module, this.resourceType);
2646
+ }
2647
+ get reactions() {
2648
+ return new ReactionsService(this.context, this.module, this.resourceType);
2649
+ }
2650
+ }
2877
2651
  class OdeServices {
2878
2652
  constructor() {
2879
2653
  a(this, "_analytics");
@@ -2882,7 +2656,7 @@ class OdeServices {
2882
2656
  // private _data: DataService;
2883
2657
  a(this, "_directory");
2884
2658
  a(this, "_http");
2885
- a(this, "_idiom");
2659
+ // private _idiom: IdiomService;
2886
2660
  // private _notify: INotifyFramework;
2887
2661
  a(this, "_rights");
2888
2662
  a(this, "_session");
@@ -2892,14 +2666,21 @@ class OdeServices {
2892
2666
  a(this, "_embedder");
2893
2667
  a(this, "baseUrl");
2894
2668
  a(this, "headers", {});
2895
- this._analytics = new AnalyticsService(this), this._cache = new CacheService(this), this._conf = new ConfService(this), this._directory = new DirectoryService(this), this._http = new HttpService(this), this._idiom = new IdiomService(this), 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);
2669
+ a(this, "axiosInstance");
2670
+ this._analytics = new AnalyticsService(this), this._cache = new CacheService(this), this._conf = new ConfService(this), this._directory = new DirectoryService(this), this._http = new HttpService(this), 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), this.axiosInstance = axios;
2896
2671
  }
2897
2672
  initialize() {
2898
2673
  return this;
2899
2674
  }
2675
+ // ENABLING-184 to allow custom axios instances to be used by the mobile framework
2676
+ withAxiosInstance(e) {
2677
+ return this.axiosInstance = e, this;
2678
+ }
2679
+ // ENABLING-184 to allow custom headers to be used by the mobile framework
2900
2680
  withHeaders(e) {
2901
2681
  return this.headers = e, this;
2902
2682
  }
2683
+ // ENABLING-184 to allow custom baseUrl to be used by the mobile framework
2903
2684
  withBaseUrl(e) {
2904
2685
  return this.baseUrl = e, this;
2905
2686
  }
@@ -2922,11 +2703,11 @@ class OdeServices {
2922
2703
  return this._directory;
2923
2704
  }
2924
2705
  http() {
2925
- return this._http.useBaseUrl(this.baseUrl).useHeaders(this.headers);
2706
+ return this._http.useAxiosInstance(this.axiosInstance).useBaseUrl(this.baseUrl).useHeaders(this.headers);
2926
2707
  }
2927
- idiom() {
2708
+ /* idiom() {
2928
2709
  return this._idiom;
2929
- }
2710
+ } */
2930
2711
  /* notify() {
2931
2712
  return this._notify;
2932
2713
  } */
@@ -3064,7 +2845,7 @@ const WIDGET_NAME = {
3064
2845
  };
3065
2846
  export {
3066
2847
  ACTION,
3067
- APP$2 as APP,
2848
+ APP$1 as APP,
3068
2849
  BOOLEAN_FILTER,
3069
2850
  DocumentHelper,
3070
2851
  ERROR_CODE,