@fluid-topics/public-api 1.0.45 → 1.0.46
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/README.md +6 -6
- package/build/cjs/roles/roles.js +10 -4
- package/build/cjs/types/ft-common/public.js +6 -5
- package/build/mjs/roles/roles.d.ts +1 -1
- package/build/mjs/roles/roles.js +10 -5
- package/build/mjs/types/ft-common/public.d.ts +6 -5
- package/build/mjs/types/ft-common/public.js +6 -5
- package/build/rollup/fluidtopics.min.js +1 -1
- package/dist/cjs/roles/roles.js +10 -4
- package/dist/cjs/types/ft-common/public.js +6 -5
- package/dist/fluidtopics.min.js +1 -1
- package/dist/mjs/roles/roles.d.ts +1 -1
- package/dist/mjs/roles/roles.js +10 -5
- package/dist/mjs/types/ft-common/public.d.ts +6 -5
- package/dist/mjs/types/ft-common/public.js +6 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,15 +21,15 @@ Using unpkg CDN
|
|
|
21
21
|
`<script src="https://unpkg.com/@fluid-topics/public-api/dist/fluidtopics.min.js"></script>`
|
|
22
22
|
|
|
23
23
|
## Publish
|
|
24
|
+
|
|
24
25
|
### Manual
|
|
25
26
|
|
|
26
27
|
- Update package.json version
|
|
27
|
-
- Build the public API
|
|
28
|
+
- Build the public API using `gw build`
|
|
28
29
|
- Login with NPM Antidot password `npm login` mail is also present on passbolt
|
|
29
|
-
-
|
|
30
|
+
- Publish with `npm publish`
|
|
30
31
|
- Do not forget to commit the package.json
|
|
31
32
|
|
|
32
|
-
|
|
33
33
|
## Examples
|
|
34
34
|
|
|
35
35
|
### Typescript
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
const api = new FluidTopicsApi("https://doc.fluidtopics.com", "my-ts-integration")
|
|
44
44
|
|
|
45
45
|
api.getMap("4R52zKZkt~kDZT3ZpoFNng")
|
|
46
|
-
|
|
46
|
+
.then((ftMap: FtMap) => console.log(ftMap))
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
### Javascript
|
|
@@ -56,7 +56,7 @@ const {FluidTopicsApi} = require("@fluid-topics/public-api")
|
|
|
56
56
|
const api = new FluidTopicsApi("https://doc.fluidtopics.com", "my-js-integration")
|
|
57
57
|
|
|
58
58
|
api.getMap("4R52zKZkt~kDZT3ZpoFNng")
|
|
59
|
-
|
|
59
|
+
.then(ftMap => console.log(ftMap))
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
UMD/Browser:
|
|
@@ -67,7 +67,7 @@ const {FluidTopicsApi} = window.fluidtopics
|
|
|
67
67
|
const api = new FluidTopicsApi("https://doc.fluidtopics.com", "my-js-integration")
|
|
68
68
|
|
|
69
69
|
api.getMap("4R52zKZkt~kDZT3ZpoFNng")
|
|
70
|
-
|
|
70
|
+
.then(ftMap => console.log(ftMap))
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
### Result
|
package/build/cjs/roles/roles.js
CHANGED
|
@@ -15,11 +15,17 @@ function roleMatches(actual, expected) {
|
|
|
15
15
|
return actual === expected || ((_a = rolesInheritance[actual]) !== null && _a !== void 0 ? _a : []).some((inherited) => roleMatches(inherited, expected));
|
|
16
16
|
}
|
|
17
17
|
function userHasRole(sessionOrProfileOrRoles, expectedRole) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
var _a;
|
|
19
|
+
if (sessionOrProfileOrRoles == null) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const roles = Array.isArray(sessionOrProfileOrRoles)
|
|
23
|
+
? sessionOrProfileOrRoles
|
|
24
|
+
: Array.isArray(sessionOrProfileOrRoles.roles)
|
|
21
25
|
? sessionOrProfileOrRoles.roles
|
|
22
|
-
: sessionOrProfileOrRoles
|
|
26
|
+
: Array.isArray((_a = sessionOrProfileOrRoles.profile) === null || _a === void 0 ? void 0 : _a.roles)
|
|
27
|
+
? sessionOrProfileOrRoles.profile.roles
|
|
28
|
+
: [];
|
|
23
29
|
return roles.some(role => roleMatches(role, expectedRole));
|
|
24
30
|
}
|
|
25
31
|
exports.userHasRole = userHasRole;
|
|
@@ -106,9 +106,9 @@ const isFtMap = (o) => {
|
|
|
106
106
|
&& ((Array.isArray(o.metadata)
|
|
107
107
|
&& o.metadata.every((v) => (0, exports.isFtMetadata)(v))))
|
|
108
108
|
&& ((0, exports.isFtOpenMode)(o.openMode))
|
|
109
|
-
&& (isString(o.topicsApiEndpoint))
|
|
109
|
+
&& (o.topicsApiEndpoint == null || isString(o.topicsApiEndpoint))
|
|
110
110
|
&& (o.description == null || isString(o.description))
|
|
111
|
-
&& (isString(o.attachmentsApiEndpoint))
|
|
111
|
+
&& (o.attachmentsApiEndpoint == null || isString(o.attachmentsApiEndpoint))
|
|
112
112
|
&& ((0, exports.isFtEditorialType)(o.editorialType))
|
|
113
113
|
&& (isString(o.baseId))
|
|
114
114
|
&& (isString(o.clusterId))
|
|
@@ -116,11 +116,11 @@ const isFtMap = (o) => {
|
|
|
116
116
|
&& (isString(o.lastPublication))
|
|
117
117
|
&& (isString(o.lastEdition))
|
|
118
118
|
&& (isString(o.originId))
|
|
119
|
-
&& (isString(o.rightsApiEndpoint))
|
|
119
|
+
&& (o.rightsApiEndpoint == null || isString(o.rightsApiEndpoint))
|
|
120
120
|
&& ((0, exports.isFtMapStyles)(o.contentStyles))
|
|
121
121
|
&& (o.originUrl == null || isString(o.originUrl))
|
|
122
122
|
&& (isString(o.readerUrl))
|
|
123
|
-
&& (isString(o.khubVersion))
|
|
123
|
+
&& (o.khubVersion == null || isString(o.khubVersion))
|
|
124
124
|
&& (isString(o.id))
|
|
125
125
|
&& (o.lang == null || isString(o.lang));
|
|
126
126
|
};
|
|
@@ -420,9 +420,10 @@ var FtEditorialType;
|
|
|
420
420
|
(function (FtEditorialType) {
|
|
421
421
|
FtEditorialType["ARTICLE"] = "ARTICLE";
|
|
422
422
|
FtEditorialType["BOOK"] = "BOOK";
|
|
423
|
+
FtEditorialType["SHARED_BOOK"] = "SHARED_BOOK";
|
|
423
424
|
})(FtEditorialType = exports.FtEditorialType || (exports.FtEditorialType = {}));
|
|
424
425
|
const isFtEditorialType = (o) => {
|
|
425
|
-
return ["ARTICLE", "BOOK"].includes(o);
|
|
426
|
+
return ["ARTICLE", "BOOK", "SHARED_BOOK"].includes(o);
|
|
426
427
|
};
|
|
427
428
|
exports.isFtEditorialType = isFtEditorialType;
|
|
428
429
|
// From: WsOpenMode
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FtSession, FtUserProfile, FtUserRole, FtUserRoleKeys } from "../types/ft-common/public";
|
|
2
|
-
export declare function userHasRole(sessionOrProfileOrRoles: FtSession | FtUserProfile | Array<FtUserRole | FtUserRoleKeys
|
|
2
|
+
export declare function userHasRole(sessionOrProfileOrRoles: FtSession | FtUserProfile | Array<FtUserRole | FtUserRoleKeys> | undefined, expectedRole: FtUserRole | FtUserRoleKeys): boolean;
|
package/build/mjs/roles/roles.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FtUserRole
|
|
1
|
+
import { FtUserRole } from "../types/ft-common/public";
|
|
2
2
|
const rolesInheritance = {
|
|
3
3
|
[FtUserRole.PERSONAL_BOOK_SHARE_USER]: [FtUserRole.PERSONAL_BOOK_USER],
|
|
4
4
|
[FtUserRole.HTML_EXPORT_USER]: [FtUserRole.PERSONAL_BOOK_USER],
|
|
@@ -11,10 +11,15 @@ function roleMatches(actual, expected) {
|
|
|
11
11
|
return actual === expected || (rolesInheritance[actual] ?? []).some((inherited) => roleMatches(inherited, expected));
|
|
12
12
|
}
|
|
13
13
|
export function userHasRole(sessionOrProfileOrRoles, expectedRole) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
if (sessionOrProfileOrRoles == null) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const roles = Array.isArray(sessionOrProfileOrRoles)
|
|
18
|
+
? sessionOrProfileOrRoles
|
|
19
|
+
: Array.isArray(sessionOrProfileOrRoles.roles)
|
|
17
20
|
? sessionOrProfileOrRoles.roles
|
|
18
|
-
: sessionOrProfileOrRoles
|
|
21
|
+
: Array.isArray(sessionOrProfileOrRoles.profile?.roles)
|
|
22
|
+
? sessionOrProfileOrRoles.profile.roles
|
|
23
|
+
: [];
|
|
19
24
|
return roles.some(role => roleMatches(role, expectedRole));
|
|
20
25
|
}
|
|
@@ -76,9 +76,9 @@ export interface FtMap {
|
|
|
76
76
|
prettyUrl?: string;
|
|
77
77
|
metadata: Array<FtMetadata>;
|
|
78
78
|
openMode: FtOpenModeKeys | FtOpenMode;
|
|
79
|
-
topicsApiEndpoint
|
|
79
|
+
topicsApiEndpoint?: string;
|
|
80
80
|
description?: string;
|
|
81
|
-
attachmentsApiEndpoint
|
|
81
|
+
attachmentsApiEndpoint?: string;
|
|
82
82
|
editorialType: FtEditorialTypeKeys | FtEditorialType;
|
|
83
83
|
baseId: string;
|
|
84
84
|
clusterId: string;
|
|
@@ -86,11 +86,11 @@ export interface FtMap {
|
|
|
86
86
|
lastPublication: string;
|
|
87
87
|
lastEdition: string;
|
|
88
88
|
originId: string;
|
|
89
|
-
rightsApiEndpoint
|
|
89
|
+
rightsApiEndpoint?: string;
|
|
90
90
|
contentStyles: FtMapStyles;
|
|
91
91
|
originUrl?: string;
|
|
92
92
|
readerUrl: string;
|
|
93
|
-
khubVersion
|
|
93
|
+
khubVersion?: string;
|
|
94
94
|
id: string;
|
|
95
95
|
lang?: string;
|
|
96
96
|
}
|
|
@@ -320,7 +320,8 @@ export interface FtSearchResultsPageInfo {
|
|
|
320
320
|
export declare const isFtSearchResultsPageInfo: (o: any) => o is FtSearchResultsPageInfo;
|
|
321
321
|
export declare enum FtEditorialType {
|
|
322
322
|
ARTICLE = "ARTICLE",
|
|
323
|
-
BOOK = "BOOK"
|
|
323
|
+
BOOK = "BOOK",
|
|
324
|
+
SHARED_BOOK = "SHARED_BOOK"
|
|
324
325
|
}
|
|
325
326
|
export type FtEditorialTypeKeys = keyof typeof FtEditorialType;
|
|
326
327
|
export declare const isFtEditorialType: (o: any) => o is FtEditorialType;
|
|
@@ -93,9 +93,9 @@ export const isFtMap = (o) => {
|
|
|
93
93
|
&& ((Array.isArray(o.metadata)
|
|
94
94
|
&& o.metadata.every((v) => isFtMetadata(v))))
|
|
95
95
|
&& (isFtOpenMode(o.openMode))
|
|
96
|
-
&& (isString(o.topicsApiEndpoint))
|
|
96
|
+
&& (o.topicsApiEndpoint == null || isString(o.topicsApiEndpoint))
|
|
97
97
|
&& (o.description == null || isString(o.description))
|
|
98
|
-
&& (isString(o.attachmentsApiEndpoint))
|
|
98
|
+
&& (o.attachmentsApiEndpoint == null || isString(o.attachmentsApiEndpoint))
|
|
99
99
|
&& (isFtEditorialType(o.editorialType))
|
|
100
100
|
&& (isString(o.baseId))
|
|
101
101
|
&& (isString(o.clusterId))
|
|
@@ -103,11 +103,11 @@ export const isFtMap = (o) => {
|
|
|
103
103
|
&& (isString(o.lastPublication))
|
|
104
104
|
&& (isString(o.lastEdition))
|
|
105
105
|
&& (isString(o.originId))
|
|
106
|
-
&& (isString(o.rightsApiEndpoint))
|
|
106
|
+
&& (o.rightsApiEndpoint == null || isString(o.rightsApiEndpoint))
|
|
107
107
|
&& (isFtMapStyles(o.contentStyles))
|
|
108
108
|
&& (o.originUrl == null || isString(o.originUrl))
|
|
109
109
|
&& (isString(o.readerUrl))
|
|
110
|
-
&& (isString(o.khubVersion))
|
|
110
|
+
&& (o.khubVersion == null || isString(o.khubVersion))
|
|
111
111
|
&& (isString(o.id))
|
|
112
112
|
&& (o.lang == null || isString(o.lang));
|
|
113
113
|
};
|
|
@@ -374,9 +374,10 @@ export var FtEditorialType;
|
|
|
374
374
|
(function (FtEditorialType) {
|
|
375
375
|
FtEditorialType["ARTICLE"] = "ARTICLE";
|
|
376
376
|
FtEditorialType["BOOK"] = "BOOK";
|
|
377
|
+
FtEditorialType["SHARED_BOOK"] = "SHARED_BOOK";
|
|
377
378
|
})(FtEditorialType || (FtEditorialType = {}));
|
|
378
379
|
export const isFtEditorialType = (o) => {
|
|
379
|
-
return ["ARTICLE", "BOOK"].includes(o);
|
|
380
|
+
return ["ARTICLE", "BOOK", "SHARED_BOOK"].includes(o);
|
|
380
381
|
};
|
|
381
382
|
// From: WsOpenMode
|
|
382
383
|
export var FtOpenMode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).fluidtopics={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){!function(t){var r={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(r.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function a(e){return"string"!=typeof e&&(e=String(e)),e}function o(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function l(e){this.map={},e instanceof l?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function u(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function c(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function d(e){var t=new FileReader,r=c(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():r.arrayBuffer&&r.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||n(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var e,t,r,i=u(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=c(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(e,t){e=s(e),t=a(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},l.prototype.delete=function(e){delete this.map[s(e)]},l.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},l.prototype.set=function(e,t){this.map[s(e)]=a(t)},l.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},l.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),o(e)},l.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),o(e)},l.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),o(e)},r.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function f(e,t){var r,i,n=(t=t||{}).body;if(e instanceof f){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new l(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new l(t.headers)),this.method=(r=t.method||this.method||"GET",i=r.toUpperCase(),y.indexOf(i)>-1?i:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function m(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}})),t}function A(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},h.call(f.prototype),h.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},A.error=function(){var e=new A(null,{status:0,statusText:""});return e.type="error",e};var g=[301,302,303,307,308];A.redirect=function(e,t){if(-1===g.indexOf(t))throw new RangeError("Invalid status code");return new A(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function b(e,i){return new Promise((function(n,s){var a=new f(e,i);if(a.signal&&a.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function u(){o.abort()}o.onload=function(){var e,t,r={status:o.status,statusText:o.statusText,headers:(e=o.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();t.append(i,n)}})),t)};r.url="responseURL"in o?o.responseURL:r.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;n(new A(i,r))},o.onerror=function(){s(new TypeError("Network request failed"))},o.ontimeout=function(){s(new TypeError("Network request failed"))},o.onabort=function(){s(new t.DOMException("Aborted","AbortError"))},o.open(a.method,a.url,!0),"include"===a.credentials?o.withCredentials=!0:"omit"===a.credentials&&(o.withCredentials=!1),"responseType"in o&&r.blob&&(o.responseType="blob"),a.headers.forEach((function(e,t){o.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",u),o.onreadystatechange=function(){4===o.readyState&&a.signal.removeEventListener("abort",u)}),o.send(void 0===a._bodyInit?null:a._bodyInit)}))}b.polyfill=!0,e.fetch||(e.fetch=b,e.Headers=l,e.Request=f,e.Response=A),t.Headers=l,t.Request=f,t.Response=A,t.fetch=b,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:t);const r=e=>"object"==typeof e&&null!=e,i=e=>"boolean"==typeof e,n=e=>"number"==typeof e,s=e=>"string"==typeof e;var a;e.FtMyLibraryColors=void 0,(a=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",a.green="green",a.blue="blue",a.purple="purple",a.red="red",a.orange="orange",a.yellow="yellow";const o=e=>["black","green","blue","purple","red","orange","yellow"].includes(e);var l;e.FtTopicOriginType=void 0,(l=e.FtTopicOriginType||(e.FtTopicOriginType={})).OFFICIAL="OFFICIAL",l.PERSONAL="PERSONAL",l.SHARED="SHARED";const u=e=>["OFFICIAL","PERSONAL","SHARED"].includes(e),c=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>Array.isArray(e)&&e.every((e=>s(e)))))&&s(e.key),d=e=>r(e)&&s(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>d(e)))&&(null==e.topicLink||p(e.topicLink))&&s(e.title)&&(null==e.htmlContent||s(e.htmlContent)),p=e=>r(e)&&s(e.tocId)&&s(e.contentId)&&s(e.mapId),h=e=>r(e)&&s(e.topicStylesheetUrl)&&s(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>s(e))),y=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&(null==e.hasRating||i(e.hasRating))&&s(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>y(e)))&&(null==e.origin||f(e.origin))&&s(e.contentId)&&s(e.title),f=e=>r(e)&&s(e.mapTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.contentId)&&s(e.mapId)&&u(e.type);var m;e.FtTopicContentTarget=void 0,(m=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",m.OFF_THE_GRID="OFF_THE_GRID",m.CONTENT_PACKAGER="CONTENT_PACKAGER",m.PAGES="PAGES",m.DESIGNED_READER="DESIGNED_READER";const A=e=>r(e)&&n(e.count)&&s(e.label)&&(null==e.lang||s(e.lang)),g=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>s(e))))))&&s(e.label)&&s(e.key),b=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&s(e.query)&&Array.isArray(e.filters)&&e.filters.every((e=>G(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>re(e)))&&(null==e.contentLocale||s(e.contentLocale));var E;e.FtRatingType=void 0,(E=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",E.LIKE="LIKE",E.DICHOTOMOUS="DICHOTOMOUS",E.NO_RATING="NO_RATING";const T=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),R=e=>r(e)&&s(e.date)&&T(e.type)&&n(e.value),S=e=>r(e)&&(null==e.rating||R(e.rating))&&T(e.type),F=e=>r(e)&&s(e.date)&&s(e.tocId)&&T(e.type)&&n(e.value),U=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>F(e)))&&T(e.type),O=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>s(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>s(e))),I=e=>r(e)&&s(e.from)&&s(e.to),_=e=>r(e)&&(null==e.period||I(e.period))&&C(e.periodType);var v;e.FtPeriodFilterType=void 0,(v=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",v.LAST_MONTH="LAST_MONTH",v.LAST_YEAR="LAST_YEAR",v.CUSTOM="CUSTOM";const C=e=>["LAST_WEEK","LAST_MONTH","LAST_YEAR","CUSTOM"].includes(e),P=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.key);var D;e.FtSearchSortCriterionOrder=void 0,(D=e.FtSearchSortCriterionOrder||(e.FtSearchSortCriterionOrder={})).ASC="ASC",D.DESC="DESC";const L=e=>["ASC","DESC"].includes(e);var k;e.FtSearchSortCriterionType=void 0,(k=e.FtSearchSortCriterionType||(e.FtSearchSortCriterionType={})).ALPHA="ALPHA",k.NATURAL="NATURAL";const N=e=>["ALPHA","NATURAL"].includes(e),M=e=>r(e)&&n(e.totalResultsCount)&&i(e.isLastPage)&&n(e.currentPage)&&n(e.totalClustersCount);var w;e.FtEditorialType=void 0,(w=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",w.BOOK="BOOK";const B=e=>["ARTICLE","BOOK"].includes(e);var x;e.FtOpenMode=void 0,(x=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",x.EXTERNAL="EXTERNAL";const H=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),$=e=>r(e)&&(null==e.perPage||n(e.perPage))&&n(e.page);var K;e.FtCollectionDocumentType=void 0,(K=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",K.DOCUMENT="DOCUMENT",K.TOPIC="TOPIC",K.PERSONAL_BOOK="PERSONAL_BOOK",K.SHARED_BOOK="SHARED_BOOK";const j=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),G=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.label)&&s(e.key),V=e=>r(e)&&n(e.weight)&&s(e.value)&&s(e.key),q=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>X(e)))&&(null==e.metadataVariableAxis||s(e.metadataVariableAxis)),X=e=>r(e)&&(null==e.document||z(e.document))&&(null==e.topic||J(e.topic))&&Q(e.type)&&(null==e.map||Y(e.map)),z=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&H(e.openMode)&&s(e.documentUrl)&&s(e.mimeType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.viewerUrl)&&s(e.contentUrl)&&s(e.filename)&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.documentId)&&s(e.lastEditionDate)&&s(e.htmlExcerpt),Y=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&(null==e.openMode||H(e.openMode))&&B(e.editorialType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.mapUrl)&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt),J=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&H(e.openMode)&&s(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>ne(e)))&&s(e.title)&&s(e.mapTitle)&&s(e.topicUrl)&&s(e.contentUrl)&&s(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt);var W;e.FtSearchResultType=void 0,(W=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",W.DOCUMENT="DOCUMENT",W.TOPIC="TOPIC";const Q=e=>["MAP","DOCUMENT","TOPIC"].includes(e),Z=e=>r(e)&&i(e.hierarchical)&&s(e.label)&&i(e.multiSelectionable)&&s(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>te(e))),ee=e=>r(e)&&(null==e.maxDepth||n(e.maxDepth))&&s(e.id),te=e=>r(e)&&n(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>te(e)))&&s(e.label)&&s(e.value)&&i(e.selected),re=e=>r(e)&&N(e.type)&&s(e.key)&&L(e.order),ie=e=>r(e)&&s(e.suggestedQuery)&&s(e.htmlSuggestedQuery),ne=e=>r(e)&&s(e.filename)&&s(e.resourceUrl)&&s(e.id)&&s(e.mimeType)&&s(e.resourceContentUrl)&&s(e.viewerUrl),se=e=>r(e)&&(null==e.filenameExtension||s(e.filenameExtension))&&(null==e.editorialType||B(e.editorialType))&&(null==e.mimeType||s(e.mimeType))&&Q(e.type)&&s(e.value);var ae;e.FtUserRole=void 0,(ae=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",ae.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",ae.HTML_EXPORT_USER="HTML_EXPORT_USER",ae.PDF_EXPORT_USER="PDF_EXPORT_USER",ae.SAVED_SEARCH_USER="SAVED_SEARCH_USER",ae.COLLECTION_USER="COLLECTION_USER",ae.OFFLINE_USER="OFFLINE_USER",ae.ANALYTICS_USER="ANALYTICS_USER",ae.BETA_USER="BETA_USER",ae.DEBUG_USER="DEBUG_USER",ae.PRINT_USER="PRINT_USER",ae.RATING_USER="RATING_USER",ae.FEEDBACK_USER="FEEDBACK_USER",ae.CONTENT_PUBLISHER="CONTENT_PUBLISHER",ae.KHUB_ADMIN="KHUB_ADMIN",ae.USERS_ADMIN="USERS_ADMIN",ae.PORTAL_ADMIN="PORTAL_ADMIN",ae.ADMIN="ADMIN",ae.DEVELOPER="DEVELOPER";const oe=e=>["PERSONAL_BOOK_USER","PERSONAL_BOOK_SHARE_USER","HTML_EXPORT_USER","PDF_EXPORT_USER","SAVED_SEARCH_USER","COLLECTION_USER","OFFLINE_USER","ANALYTICS_USER","BETA_USER","DEBUG_USER","PRINT_USER","RATING_USER","FEEDBACK_USER","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(e),le=e=>r(e)&&s(e.identifier)&&s(e.realm),ue=e=>r(e)&&(null==e.authenticationIdentifier||le(e.authenticationIdentifier))&&n(e.idleTimeoutInMillis)&&ce(e.profile)&&i(e.sessionAuthenticated),ce=e=>r(e)&&(null==e.emailAddress||s(e.emailAddress))&&(null==e.displayName||s(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>oe(e)))&&(null==e.userId||s(e.userId)),de=e=>"object"==typeof e&&null!=e,pe=e=>"boolean"==typeof e,he=e=>"number"==typeof e,ye=e=>"string"==typeof e,fe=e=>de(e)&&pe(e.mailsSentByFluidTopics)&&pe(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>ye(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>ye(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>ye(e))),me=e=>de(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>pe(e))))&&pe(e.isVisible),Ae=e=>de(e)&&(null==e.prettyUrl||ye(e.prettyUrl))&&(null==e.hasRating||pe(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||ye(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>Ae(e)))&&(null==e.pageConfiguration||me(e.pageConfiguration))&&(null==e.contentId||ye(e.contentId))&&(null==e.title||ye(e.title)),ge=e=>de(e)&&pe(e.splitCurrentPageToc),be={[e.FtUserRole.PERSONAL_BOOK_SHARE_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.HTML_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.PDF_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.KHUB_ADMIN]:[e.FtUserRole.CONTENT_PUBLISHER],[e.FtUserRole.ADMIN]:[e.FtUserRole.KHUB_ADMIN,e.FtUserRole.USERS_ADMIN,e.FtUserRole.PORTAL_ADMIN],[e.FtUserRole.DEVELOPER]:[e.FtUserRole.BETA_USER,e.FtUserRole.DEBUG_USER]};function Ee(e,t){return e===t||(be[e]??[]).some((e=>Ee(e,t)))}const Te="undefined"==typeof window?globalThis:window;function Re(e){let t={};for(let r in e){let i=e[r];("object"!=typeof i||Array.isArray(i))&&(i={prior:i});for(let e of["prior","filter"])i[e]=Array.isArray(i[e])?i[e]:[i[e]],i[e]=i[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[r]=i}return t}function Se(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Fe="undefined"==typeof window?globalThis:window;class Ue extends Error{status;statusText;body;constructor(e,t,r){super(`${e} - ${t}: ${r}`),this.status=e,this.statusText=t,this.body=r}}async function Oe(e){if(!e.ok)throw new Ue(e.status,e.statusText,await e.text());return e}function Ie(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class _e{tenantBaseUrl;ftCallingApp;authorization;searchLabel;endpoints={authentication:{login:"api/authentication/login",logout:"api/authentication/logout",currentSession:"api/authentication/current-session"},khub:{maps:{mapId:e=>({info:`api/khub/maps/${e}`,toc:`api/khub/maps/${e}/toc`,pages:`api/khub/maps/${e}/pages`,feedback:`api/khub/maps/${e}/feedback`,rating:`api/khub/maps/${e}/rating`,attachments:{list:`api/khub/maps/${e}/attachments`,attachmentId:t=>({content:`api/khub/maps/${e}/attachments/${t}/content`})},resources:{list:`api/khub/maps/${e}/resources`,resourceId:t=>({content:`api/khub/maps/${e}/resources/${t}/content`})},topics:{contentId:t=>({info:`api/khub/maps/${e}/topics/${t}`,content:`api/khub/maps/${e}/topics/${t}/content`}),tocId:t=>({feedback:`api/khub/maps/${e}/topics/${t}/feedback`,rating:`api/khub/maps/${e}/topics/${t}/rating`})}})},documents:{documentId:e=>({info:`api/khub/documents/${e}`,content:`api/khub/documents/${e}/content`,text:`api/khub/documents/${e}/content/text`,feedback:`api/khub/documents/${e}/feedback`,rating:`api/khub/documents/${e}/rating`})},suggest:"api/khub/suggest",clusteredSearch:"api/khub/clustered-search",locales:"api/khub/locales"},users:{userId:e=>({collections:{collectionId:t=>({documents:`api/users/${e}/collections/${t}/documents`})},searches:{list:`api/users/${e}/searches`},bookmarks:{list:`api/users/${e}/bookmarks`}})},stylesheets:{fonts:"api/stylesheets/fonts.css",theme:"api/stylesheets/theme.css",content:{title:"api/stylesheets/content/title.css",topic:"api/stylesheets/content/topic.css"}},configuration:{reader:"api/configuration/reader"},locales:{ui:"api/locales/ui"},messages:{locale:e=>({fluidTopics:{contextName:t=>({endpoint:`api/messages/${e}/fluid-topics/${t}`})},custom:{contextName:t=>({endpoint:`api/messages/${e}/custom/${t}`})}})}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??Fe.__gwt_ft_moduleBase??Fe.fluidtopicsclient?.__moduleBase??Fe.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==Fe.location&&Fe.location.href.startsWith(this.tenantBaseUrl)?this.ftCallingApp=t:this.ftCallingApp=`ft-public-api/${t}`}setApiKey(e){this.authorization={Authorization:"Bearer "+e}}setCredentials(e,t){var r;this.authorization={Authorization:"Basic "+(r=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(r).toString("base64"):btoa(r))}}clearAuthentication(){this.authorization=void 0}setSearchLabel(e){this.searchLabel={"FT-search-label":e}}clearSearchLabel(){this.searchLabel=void 0}login(e,t){let r={login:e,password:t,rememberMe:!0};return this.post(this.endpoints.authentication.login,r).then((r=>(this.setCredentials(e,t),r)))}logout(){return this.post(this.endpoints.authentication.logout).then((()=>this.clearAuthentication()))}getCurrentSession(){return this.get(this.endpoints.authentication.currentSession)}getReaderConfiguration(){return this.get(this.endpoints.configuration.reader)}getMap(e){return this.get(this.endpoints.khub.maps.mapId(e).info)}getTableOfContent(e){return this.get(this.endpoints.khub.maps.mapId(e).toc)}getPages(e){return this.get(this.endpoints.khub.maps.mapId(e).pages)}getTopic(e,t){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).info)}getTopicHTMLContent(e,t,r){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).content+(r?"?target="+r:""))}getMapAttachments(e){return this.get(this.endpoints.khub.maps.mapId(e).attachments.list)}getMapAttachmentContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).attachments.attachmentId(t).content)}getMapResources(e){return this.get(this.endpoints.khub.maps.mapId(e).resources.list)}getMapResourceContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).resources.resourceId(t).content)}getUnstructuredDocument(e){return this.get(this.endpoints.khub.documents.documentId(e).info)}getUnstructuredDocumentContent(e){return this.fetchRawData(this.endpoints.khub.documents.documentId(e).content)}getUnstructuredDocumentTextContent(e){return this.get(this.endpoints.khub.documents.documentId(e).text)}getCollectionDocuments(e,t){return this.get(this.endpoints.users.userId(e).collections.collectionId(t).documents)}getSuggestions(e){return this.post(this.endpoints.khub.suggest,e)}search(e){return this.post(this.endpoints.khub.clusteredSearch,e)}getAvailableSearchLocales(){return this.get(this.endpoints.khub.locales)}getAvailableUiLocales(){return this.get(this.endpoints.khub.locales)}getMapRating(e){return this.get(this.endpoints.khub.maps.mapId(e).rating)}rateMap(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).rating,{type:t,value:r})}unrateMap(e){return this.delete(this.endpoints.khub.maps.mapId(e).rating)}sendMapFeedback(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).feedback,{message:t,from:r})}rateTopic(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:r,value:i})}unrateTopic(e,t){return this.delete(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating)}sendTopicFeedback(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).feedback,{message:r,from:i})}getDocumentRating(e){return this.get(this.endpoints.khub.documents.documentId(e).rating)}rateDocument(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).rating,{type:t,value:r})}unrateDocument(e){return this.delete(this.endpoints.khub.documents.documentId(e).rating)}sendDocumentFeedback(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).feedback,{message:t,from:r})}getFluidTopicsMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).fluidTopics.contextName(t).endpoint)}getCustomMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).custom.contextName(t).endpoint)}listMySearches(e){return this.get(this.endpoints.users.userId(e).searches.list)}listMyBookmarks(e){return this.get(this.endpoints.users.userId(e).bookmarks.list)}get(e){return this.makeRequest("GET",e)}post(e,t){return this.makeRequest("POST",e,t)}put(e,t){return this.makeRequest("PUT",e,t)}delete(e){return this.makeRequest("DELETE",e)}makeAbsolute(e){return this.tenantBaseUrl+e.replace(/^\//,"")}async fetch(e,t){const r=t;return await fetch(this.makeAbsolute(e),{...r??{},headers:{...this.defaultHeaders,...r?.headers??{}}})}upload(e,t,r,i=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((n,s)=>{let a=new XMLHttpRequest;a.onload=()=>{if(a.status>=200&&a.status<300){let e="application/json"===a.getResponseHeader("Content-Type")?JSON.parse(a.responseText):a.responseText;n(e)}else s(new Ue(a.status,a.statusText,a.responseText))},a.upload.onprogress=e=>i(e),a.open(e,this.makeAbsolute(t),!0),a.send(r)})):this.fetch(t,{method:e,body:r}).then(Oe).then(Ie)}makeRequest(e,t,r){return this.fetch(t,{method:e,headers:{...null!=r?{"Content-Type":"application/json"}:{}},body:null!=r?JSON.stringify(r):void 0,credentials:null==this.authorization?"include":void 0}).then(Oe).then(Ie)}fetchRawData(e){return fetch(this.makeAbsolute(e),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then(Oe).then((e=>e.arrayBuffer()))}}e.FluidTopicsApi=_e,e.HttpError=Ue,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Te.localStorage){const r=Se(e),i=e=>{e.storageArea===Te.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Te.addEventListener("storage",i),{removeHandler:()=>Te.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=_e,e.getUnauthenticatedUserSearchPreferences=function(e){if(Te.localStorage)return JSON.parse(Te.localStorage.getItem(Se(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&le(e.authenticationIdentifier)&&ce(e.profile),e.isFtAuthenticationIdentifier=le,e.isFtBookmark=e=>r(e)&&s(e.mapTitle)&&o(e.color)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.lastUpdate)&&s(e.readerUrl)&&s(e.mapId)&&s(e.id)&&s(e.title)&&s(e.creationDate),e.isFtCollectionDocument=e=>r(e)&&i(e.deleted)&&(null==e.apiUrl||s(e.apiUrl))&&(null==e.portalUrl||s(e.portalUrl))&&s(e.id)&&s(e.title)&&j(e.type),e.isFtCollectionDocumentType=j,e.isFtCredentials=e=>r(e)&&s(e.password)&&(null==e.newPassword||s(e.newPassword))&&i(e.rememberMe)&&s(e.login),e.isFtEditorialType=B,e.isFtFeedbackCreation=e=>r(e)&&(null==e.from||s(e.from))&&s(e.message),e.isFtLabeledSearchFilter=G,e.isFtMap=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&H(e.openMode)&&s(e.topicsApiEndpoint)&&(null==e.description||s(e.description))&&s(e.attachmentsApiEndpoint)&&B(e.editorialType)&&s(e.baseId)&&s(e.clusterId)&&s(e.title)&&s(e.lastPublication)&&s(e.lastEdition)&&s(e.originId)&&s(e.rightsApiEndpoint)&&h(e.contentStyles)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.khubVersion)&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtMapAttachment=e=>de(e)&&ye(e.file)&&(null==e.size||he(e.size))&&pe(e.externalLink)&&ye(e.name)&&ye(e.id)&&(null==e.mimeType||ye(e.mimeType))&&(null==e.viewerUrl||ye(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&s(e.contentUrl)&&s(e.filename)&&s(e.id)&&s(e.mimeType),e.isFtMapStyles=h,e.isFtMessageContext=e=>r(e)&&s(e.name)&&r(e.messages)&&Object.keys(e.messages).every((e=>s(e)))&&Object.values(e.messages).every((e=>s(e)))&&s(e.locale),e.isFtMetadata=g,e.isFtMetadataPreferenceConfiguration=O,e.isFtMyLibraryColors=o,e.isFtMySearch=e=>r(e)&&b(e.searchRequest)&&o(e.color)&&i(e.alert)&&s(e.description)&&s(e.id)&&s(e.ownerId)&&s(e.title)&&s(e.creationDate),e.isFtMySearchRequest=b,e.isFtOpenMode=H,e.isFtPageConfiguration=me,e.isFtPageRequest=$,e.isFtPaginatedToc=e=>de(e)&&ge(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>Ae(e))),e.isFtPaginatedTocNode=Ae,e.isFtPaginationConfiguration=ge,e.isFtPeriod=I,e.isFtPeriodFilter=_,e.isFtPeriodFilterType=C,e.isFtPersonalBookCreation=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>c(e)))&&Array.isArray(e.nodes)&&e.nodes.every((e=>d(e)))&&s(e.description)&&s(e.title),e.isFtPersonalBookMetadataUpdate=c,e.isFtPersonalBookNodeCreation=d,e.isFtPersonalBookTopicLinkCreation=p,e.isFtPublicationRating=R,e.isFtPublicationRatingSummary=S,e.isFtRatingCreation=e=>r(e)&&T(e.type)&&n(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||U(e.topics))&&S(e.publication),e.isFtRatingType=T,e.isFtReaderConfiguration=e=>de(e)&&fe(e.feedback)&&he(e.loadAfterLastVisibleTopic)&&he(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=fe,e.isFtSearchFacet=Z,e.isFtSearchFacetConf=ee,e.isFtSearchFacetEntry=te,e.isFtSearchFilter=P,e.isFtSearchLocale=A,e.isFtSearchLocales=e=>r(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>A(e))),e.isFtSearchPreferencesConfiguration=e=>r(e)&&r(e.metadata)&&Object.keys(e.metadata).every((e=>s(e)))&&Object.values(e.metadata).every((e=>O(e))),e.isFtSearchPreset=e=>r(e)&&s(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&n(e.priority)&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSearchPrior=V,e.isFtSearchRequest=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&s(e.query)&&$(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>re(e)))&&(null==e.uiLocale||s(e.uiLocale))&&(null==e.contentLocale||s(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>V(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>ee(e))),e.isFtSearchResultCluster=q,e.isFtSearchResultClusterEntry=X,e.isFtSearchResultMap=Y,e.isFtSearchResultTopic=J,e.isFtSearchResultType=Q,e.isFtSearchResultUnstructuredDocument=z,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||ie(e.spellcheck))&&M(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>q(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>Z(e))),e.isFtSearchResultsPageInfo=M,e.isFtSearchSortCriterion=re,e.isFtSearchSortCriterionOrder=L,e.isFtSearchSortCriterionType=N,e.isFtSession=ue,e.isFtSpellcheck=ie,e.isFtSuggestRequest=e=>r(e)&&s(e.input)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>re(e)))&&(null==e.maxCount||n(e.maxCount))&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSuggestResult=se,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>se(e))),e.isFtTocNode=y,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&s(e.id)&&s(e.contentApiEndpoint)&&s(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicOrigin=f,e.isFtTopicOriginType=u,e.isFtTopicRating=F,e.isFtTopicResource=ne,e.isFtTopicsRatingSummary=U,e.isFtUiLocale=e=>r(e)&&s(e.displayName)&&s(e.languageTag)&&i(e.translated),e.isFtUnstructuredDocument=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&s(e.openMode)&&(null==e.description||s(e.description))&&s(e.mimeType)&&(null==e.baseId||s(e.baseId))&&(null==e.clusterId||s(e.clusterId))&&s(e.contentApiEndpoint)&&s(e.title)&&(null==e.lastPublication||s(e.lastPublication))&&s(e.viewerUrl)&&s(e.lastEdition)&&s(e.filename)&&(null==e.originId||s(e.originId))&&s(e.rightsApiEndpoint)&&(null==e.originUrl||s(e.originUrl))&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtUserProfile=ce,e.isFtUserRole=oe,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Te.localStorage){let r={...t,metadata:Re(t.metadata??{})};const i=Se(e),n=JSON.stringify(r);return Te.localStorage.setItem(i,n),Te.dispatchEvent(new StorageEvent("storage",{key:i,newValue:n,storageArea:Te.localStorage,url:Te.location.href})),r}console.error("Cannot set unauthenticated preferences: local storage is unavailable.")},e.userHasRole=function(e,t){return(ue(e)?e.profile.roles:ce(e)?e.roles:e).some((e=>Ee(e,t)))}}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).fluidtopics={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){!function(t){var r={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(r.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function a(e){return"string"!=typeof e&&(e=String(e)),e}function o(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function l(e){this.map={},e instanceof l?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function u(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function c(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function d(e){var t=new FileReader,r=c(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():r.arrayBuffer&&r.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||n(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var e,t,r,i=u(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=c(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(e,t){e=s(e),t=a(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},l.prototype.delete=function(e){delete this.map[s(e)]},l.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},l.prototype.set=function(e,t){this.map[s(e)]=a(t)},l.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},l.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),o(e)},l.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),o(e)},l.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),o(e)},r.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function f(e,t){var r,i,n=(t=t||{}).body;if(e instanceof f){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new l(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new l(t.headers)),this.method=(r=t.method||this.method||"GET",i=r.toUpperCase(),y.indexOf(i)>-1?i:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function m(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}})),t}function A(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},h.call(f.prototype),h.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},A.error=function(){var e=new A(null,{status:0,statusText:""});return e.type="error",e};var g=[301,302,303,307,308];A.redirect=function(e,t){if(-1===g.indexOf(t))throw new RangeError("Invalid status code");return new A(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function b(e,i){return new Promise((function(n,s){var a=new f(e,i);if(a.signal&&a.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function u(){o.abort()}o.onload=function(){var e,t,r={status:o.status,statusText:o.statusText,headers:(e=o.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();t.append(i,n)}})),t)};r.url="responseURL"in o?o.responseURL:r.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;n(new A(i,r))},o.onerror=function(){s(new TypeError("Network request failed"))},o.ontimeout=function(){s(new TypeError("Network request failed"))},o.onabort=function(){s(new t.DOMException("Aborted","AbortError"))},o.open(a.method,a.url,!0),"include"===a.credentials?o.withCredentials=!0:"omit"===a.credentials&&(o.withCredentials=!1),"responseType"in o&&r.blob&&(o.responseType="blob"),a.headers.forEach((function(e,t){o.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",u),o.onreadystatechange=function(){4===o.readyState&&a.signal.removeEventListener("abort",u)}),o.send(void 0===a._bodyInit?null:a._bodyInit)}))}b.polyfill=!0,e.fetch||(e.fetch=b,e.Headers=l,e.Request=f,e.Response=A),t.Headers=l,t.Request=f,t.Response=A,t.fetch=b,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:t);const r=e=>"object"==typeof e&&null!=e,i=e=>"boolean"==typeof e,n=e=>"number"==typeof e,s=e=>"string"==typeof e;var a;e.FtMyLibraryColors=void 0,(a=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",a.green="green",a.blue="blue",a.purple="purple",a.red="red",a.orange="orange",a.yellow="yellow";const o=e=>["black","green","blue","purple","red","orange","yellow"].includes(e);var l;e.FtTopicOriginType=void 0,(l=e.FtTopicOriginType||(e.FtTopicOriginType={})).OFFICIAL="OFFICIAL",l.PERSONAL="PERSONAL",l.SHARED="SHARED";const u=e=>["OFFICIAL","PERSONAL","SHARED"].includes(e),c=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>Array.isArray(e)&&e.every((e=>s(e)))))&&s(e.key),d=e=>r(e)&&s(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>d(e)))&&(null==e.topicLink||p(e.topicLink))&&s(e.title)&&(null==e.htmlContent||s(e.htmlContent)),p=e=>r(e)&&s(e.tocId)&&s(e.contentId)&&s(e.mapId),h=e=>r(e)&&s(e.topicStylesheetUrl)&&s(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>s(e))),y=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&(null==e.hasRating||i(e.hasRating))&&s(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>y(e)))&&(null==e.origin||f(e.origin))&&s(e.contentId)&&s(e.title),f=e=>r(e)&&s(e.mapTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.contentId)&&s(e.mapId)&&u(e.type);var m;e.FtTopicContentTarget=void 0,(m=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",m.OFF_THE_GRID="OFF_THE_GRID",m.CONTENT_PACKAGER="CONTENT_PACKAGER",m.PAGES="PAGES",m.DESIGNED_READER="DESIGNED_READER";const A=e=>r(e)&&n(e.count)&&s(e.label)&&(null==e.lang||s(e.lang)),g=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>s(e))))))&&s(e.label)&&s(e.key),b=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&s(e.query)&&Array.isArray(e.filters)&&e.filters.every((e=>G(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>re(e)))&&(null==e.contentLocale||s(e.contentLocale));var E;e.FtRatingType=void 0,(E=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",E.LIKE="LIKE",E.DICHOTOMOUS="DICHOTOMOUS",E.NO_RATING="NO_RATING";const T=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),R=e=>r(e)&&s(e.date)&&T(e.type)&&n(e.value),S=e=>r(e)&&(null==e.rating||R(e.rating))&&T(e.type),F=e=>r(e)&&s(e.date)&&s(e.tocId)&&T(e.type)&&n(e.value),U=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>F(e)))&&T(e.type),O=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>s(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>s(e))),I=e=>r(e)&&s(e.from)&&s(e.to),_=e=>r(e)&&(null==e.period||I(e.period))&&C(e.periodType);var v;e.FtPeriodFilterType=void 0,(v=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",v.LAST_MONTH="LAST_MONTH",v.LAST_YEAR="LAST_YEAR",v.CUSTOM="CUSTOM";const C=e=>["LAST_WEEK","LAST_MONTH","LAST_YEAR","CUSTOM"].includes(e),P=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.key);var D;e.FtSearchSortCriterionOrder=void 0,(D=e.FtSearchSortCriterionOrder||(e.FtSearchSortCriterionOrder={})).ASC="ASC",D.DESC="DESC";const L=e=>["ASC","DESC"].includes(e);var k;e.FtSearchSortCriterionType=void 0,(k=e.FtSearchSortCriterionType||(e.FtSearchSortCriterionType={})).ALPHA="ALPHA",k.NATURAL="NATURAL";const N=e=>["ALPHA","NATURAL"].includes(e),M=e=>r(e)&&n(e.totalResultsCount)&&i(e.isLastPage)&&n(e.currentPage)&&n(e.totalClustersCount);var w;e.FtEditorialType=void 0,(w=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",w.BOOK="BOOK",w.SHARED_BOOK="SHARED_BOOK";const B=e=>["ARTICLE","BOOK","SHARED_BOOK"].includes(e);var x;e.FtOpenMode=void 0,(x=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",x.EXTERNAL="EXTERNAL";const H=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),K=e=>r(e)&&(null==e.perPage||n(e.perPage))&&n(e.page);var $;e.FtCollectionDocumentType=void 0,($=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",$.DOCUMENT="DOCUMENT",$.TOPIC="TOPIC",$.PERSONAL_BOOK="PERSONAL_BOOK",$.SHARED_BOOK="SHARED_BOOK";const j=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),G=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.label)&&s(e.key),V=e=>r(e)&&n(e.weight)&&s(e.value)&&s(e.key),q=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>X(e)))&&(null==e.metadataVariableAxis||s(e.metadataVariableAxis)),X=e=>r(e)&&(null==e.document||z(e.document))&&(null==e.topic||J(e.topic))&&Q(e.type)&&(null==e.map||Y(e.map)),z=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&H(e.openMode)&&s(e.documentUrl)&&s(e.mimeType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.viewerUrl)&&s(e.contentUrl)&&s(e.filename)&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.documentId)&&s(e.lastEditionDate)&&s(e.htmlExcerpt),Y=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&(null==e.openMode||H(e.openMode))&&B(e.editorialType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.mapUrl)&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt),J=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&H(e.openMode)&&s(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>ne(e)))&&s(e.title)&&s(e.mapTitle)&&s(e.topicUrl)&&s(e.contentUrl)&&s(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt);var W;e.FtSearchResultType=void 0,(W=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",W.DOCUMENT="DOCUMENT",W.TOPIC="TOPIC";const Q=e=>["MAP","DOCUMENT","TOPIC"].includes(e),Z=e=>r(e)&&i(e.hierarchical)&&s(e.label)&&i(e.multiSelectionable)&&s(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>te(e))),ee=e=>r(e)&&(null==e.maxDepth||n(e.maxDepth))&&s(e.id),te=e=>r(e)&&n(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>te(e)))&&s(e.label)&&s(e.value)&&i(e.selected),re=e=>r(e)&&N(e.type)&&s(e.key)&&L(e.order),ie=e=>r(e)&&s(e.suggestedQuery)&&s(e.htmlSuggestedQuery),ne=e=>r(e)&&s(e.filename)&&s(e.resourceUrl)&&s(e.id)&&s(e.mimeType)&&s(e.resourceContentUrl)&&s(e.viewerUrl),se=e=>r(e)&&(null==e.filenameExtension||s(e.filenameExtension))&&(null==e.editorialType||B(e.editorialType))&&(null==e.mimeType||s(e.mimeType))&&Q(e.type)&&s(e.value);var ae;e.FtUserRole=void 0,(ae=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",ae.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",ae.HTML_EXPORT_USER="HTML_EXPORT_USER",ae.PDF_EXPORT_USER="PDF_EXPORT_USER",ae.SAVED_SEARCH_USER="SAVED_SEARCH_USER",ae.COLLECTION_USER="COLLECTION_USER",ae.OFFLINE_USER="OFFLINE_USER",ae.ANALYTICS_USER="ANALYTICS_USER",ae.BETA_USER="BETA_USER",ae.DEBUG_USER="DEBUG_USER",ae.PRINT_USER="PRINT_USER",ae.RATING_USER="RATING_USER",ae.FEEDBACK_USER="FEEDBACK_USER",ae.CONTENT_PUBLISHER="CONTENT_PUBLISHER",ae.KHUB_ADMIN="KHUB_ADMIN",ae.USERS_ADMIN="USERS_ADMIN",ae.PORTAL_ADMIN="PORTAL_ADMIN",ae.ADMIN="ADMIN",ae.DEVELOPER="DEVELOPER";const oe=e=>["PERSONAL_BOOK_USER","PERSONAL_BOOK_SHARE_USER","HTML_EXPORT_USER","PDF_EXPORT_USER","SAVED_SEARCH_USER","COLLECTION_USER","OFFLINE_USER","ANALYTICS_USER","BETA_USER","DEBUG_USER","PRINT_USER","RATING_USER","FEEDBACK_USER","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(e),le=e=>r(e)&&s(e.identifier)&&s(e.realm),ue=e=>r(e)&&(null==e.emailAddress||s(e.emailAddress))&&(null==e.displayName||s(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>oe(e)))&&(null==e.userId||s(e.userId)),ce=e=>"object"==typeof e&&null!=e,de=e=>"boolean"==typeof e,pe=e=>"number"==typeof e,he=e=>"string"==typeof e,ye=e=>ce(e)&&de(e.mailsSentByFluidTopics)&&de(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>he(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>he(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>he(e))),fe=e=>ce(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>de(e))))&&de(e.isVisible),me=e=>ce(e)&&(null==e.prettyUrl||he(e.prettyUrl))&&(null==e.hasRating||de(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||he(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>me(e)))&&(null==e.pageConfiguration||fe(e.pageConfiguration))&&(null==e.contentId||he(e.contentId))&&(null==e.title||he(e.title)),Ae=e=>ce(e)&&de(e.splitCurrentPageToc),ge={[e.FtUserRole.PERSONAL_BOOK_SHARE_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.HTML_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.PDF_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.KHUB_ADMIN]:[e.FtUserRole.CONTENT_PUBLISHER],[e.FtUserRole.ADMIN]:[e.FtUserRole.KHUB_ADMIN,e.FtUserRole.USERS_ADMIN,e.FtUserRole.PORTAL_ADMIN],[e.FtUserRole.DEVELOPER]:[e.FtUserRole.BETA_USER,e.FtUserRole.DEBUG_USER]};function be(e,t){return e===t||(ge[e]??[]).some((e=>be(e,t)))}const Ee="undefined"==typeof window?globalThis:window;function Te(e){let t={};for(let r in e){let i=e[r];("object"!=typeof i||Array.isArray(i))&&(i={prior:i});for(let e of["prior","filter"])i[e]=Array.isArray(i[e])?i[e]:[i[e]],i[e]=i[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[r]=i}return t}function Re(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Se="undefined"==typeof window?globalThis:window;class Fe extends Error{status;statusText;body;constructor(e,t,r){super(`${e} - ${t}: ${r}`),this.status=e,this.statusText=t,this.body=r}}async function Ue(e){if(!e.ok)throw new Fe(e.status,e.statusText,await e.text());return e}function Oe(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class Ie{tenantBaseUrl;ftCallingApp;authorization;searchLabel;endpoints={authentication:{login:"api/authentication/login",logout:"api/authentication/logout",currentSession:"api/authentication/current-session"},khub:{maps:{mapId:e=>({info:`api/khub/maps/${e}`,toc:`api/khub/maps/${e}/toc`,pages:`api/khub/maps/${e}/pages`,feedback:`api/khub/maps/${e}/feedback`,rating:`api/khub/maps/${e}/rating`,attachments:{list:`api/khub/maps/${e}/attachments`,attachmentId:t=>({content:`api/khub/maps/${e}/attachments/${t}/content`})},resources:{list:`api/khub/maps/${e}/resources`,resourceId:t=>({content:`api/khub/maps/${e}/resources/${t}/content`})},topics:{contentId:t=>({info:`api/khub/maps/${e}/topics/${t}`,content:`api/khub/maps/${e}/topics/${t}/content`}),tocId:t=>({feedback:`api/khub/maps/${e}/topics/${t}/feedback`,rating:`api/khub/maps/${e}/topics/${t}/rating`})}})},documents:{documentId:e=>({info:`api/khub/documents/${e}`,content:`api/khub/documents/${e}/content`,text:`api/khub/documents/${e}/content/text`,feedback:`api/khub/documents/${e}/feedback`,rating:`api/khub/documents/${e}/rating`})},suggest:"api/khub/suggest",clusteredSearch:"api/khub/clustered-search",locales:"api/khub/locales"},users:{userId:e=>({collections:{collectionId:t=>({documents:`api/users/${e}/collections/${t}/documents`})},searches:{list:`api/users/${e}/searches`},bookmarks:{list:`api/users/${e}/bookmarks`}})},stylesheets:{fonts:"api/stylesheets/fonts.css",theme:"api/stylesheets/theme.css",content:{title:"api/stylesheets/content/title.css",topic:"api/stylesheets/content/topic.css"}},configuration:{reader:"api/configuration/reader"},locales:{ui:"api/locales/ui"},messages:{locale:e=>({fluidTopics:{contextName:t=>({endpoint:`api/messages/${e}/fluid-topics/${t}`})},custom:{contextName:t=>({endpoint:`api/messages/${e}/custom/${t}`})}})}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??Se.__gwt_ft_moduleBase??Se.fluidtopicsclient?.__moduleBase??Se.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==Se.location&&Se.location.href.startsWith(this.tenantBaseUrl)?this.ftCallingApp=t:this.ftCallingApp=`ft-public-api/${t}`}setApiKey(e){this.authorization={Authorization:"Bearer "+e}}setCredentials(e,t){var r;this.authorization={Authorization:"Basic "+(r=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(r).toString("base64"):btoa(r))}}clearAuthentication(){this.authorization=void 0}setSearchLabel(e){this.searchLabel={"FT-search-label":e}}clearSearchLabel(){this.searchLabel=void 0}login(e,t){let r={login:e,password:t,rememberMe:!0};return this.post(this.endpoints.authentication.login,r).then((r=>(this.setCredentials(e,t),r)))}logout(){return this.post(this.endpoints.authentication.logout).then((()=>this.clearAuthentication()))}getCurrentSession(){return this.get(this.endpoints.authentication.currentSession)}getReaderConfiguration(){return this.get(this.endpoints.configuration.reader)}getMap(e){return this.get(this.endpoints.khub.maps.mapId(e).info)}getTableOfContent(e){return this.get(this.endpoints.khub.maps.mapId(e).toc)}getPages(e){return this.get(this.endpoints.khub.maps.mapId(e).pages)}getTopic(e,t){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).info)}getTopicHTMLContent(e,t,r){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).content+(r?"?target="+r:""))}getMapAttachments(e){return this.get(this.endpoints.khub.maps.mapId(e).attachments.list)}getMapAttachmentContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).attachments.attachmentId(t).content)}getMapResources(e){return this.get(this.endpoints.khub.maps.mapId(e).resources.list)}getMapResourceContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).resources.resourceId(t).content)}getUnstructuredDocument(e){return this.get(this.endpoints.khub.documents.documentId(e).info)}getUnstructuredDocumentContent(e){return this.fetchRawData(this.endpoints.khub.documents.documentId(e).content)}getUnstructuredDocumentTextContent(e){return this.get(this.endpoints.khub.documents.documentId(e).text)}getCollectionDocuments(e,t){return this.get(this.endpoints.users.userId(e).collections.collectionId(t).documents)}getSuggestions(e){return this.post(this.endpoints.khub.suggest,e)}search(e){return this.post(this.endpoints.khub.clusteredSearch,e)}getAvailableSearchLocales(){return this.get(this.endpoints.khub.locales)}getAvailableUiLocales(){return this.get(this.endpoints.khub.locales)}getMapRating(e){return this.get(this.endpoints.khub.maps.mapId(e).rating)}rateMap(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).rating,{type:t,value:r})}unrateMap(e){return this.delete(this.endpoints.khub.maps.mapId(e).rating)}sendMapFeedback(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).feedback,{message:t,from:r})}rateTopic(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:r,value:i})}unrateTopic(e,t){return this.delete(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating)}sendTopicFeedback(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).feedback,{message:r,from:i})}getDocumentRating(e){return this.get(this.endpoints.khub.documents.documentId(e).rating)}rateDocument(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).rating,{type:t,value:r})}unrateDocument(e){return this.delete(this.endpoints.khub.documents.documentId(e).rating)}sendDocumentFeedback(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).feedback,{message:t,from:r})}getFluidTopicsMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).fluidTopics.contextName(t).endpoint)}getCustomMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).custom.contextName(t).endpoint)}listMySearches(e){return this.get(this.endpoints.users.userId(e).searches.list)}listMyBookmarks(e){return this.get(this.endpoints.users.userId(e).bookmarks.list)}get(e){return this.makeRequest("GET",e)}post(e,t){return this.makeRequest("POST",e,t)}put(e,t){return this.makeRequest("PUT",e,t)}delete(e){return this.makeRequest("DELETE",e)}makeAbsolute(e){return this.tenantBaseUrl+e.replace(/^\//,"")}async fetch(e,t){const r=t;return await fetch(this.makeAbsolute(e),{...r??{},headers:{...this.defaultHeaders,...r?.headers??{}}})}upload(e,t,r,i=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((n,s)=>{let a=new XMLHttpRequest;a.onload=()=>{if(a.status>=200&&a.status<300){let e="application/json"===a.getResponseHeader("Content-Type")?JSON.parse(a.responseText):a.responseText;n(e)}else s(new Fe(a.status,a.statusText,a.responseText))},a.upload.onprogress=e=>i(e),a.open(e,this.makeAbsolute(t),!0),a.send(r)})):this.fetch(t,{method:e,body:r}).then(Ue).then(Oe)}makeRequest(e,t,r){return this.fetch(t,{method:e,headers:{...null!=r?{"Content-Type":"application/json"}:{}},body:null!=r?JSON.stringify(r):void 0,credentials:null==this.authorization?"include":void 0}).then(Ue).then(Oe)}fetchRawData(e){return fetch(this.makeAbsolute(e),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then(Ue).then((e=>e.arrayBuffer()))}}e.FluidTopicsApi=Ie,e.HttpError=Fe,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Ee.localStorage){const r=Re(e),i=e=>{e.storageArea===Ee.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Ee.addEventListener("storage",i),{removeHandler:()=>Ee.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=Ie,e.getUnauthenticatedUserSearchPreferences=function(e){if(Ee.localStorage)return JSON.parse(Ee.localStorage.getItem(Re(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&le(e.authenticationIdentifier)&&ue(e.profile),e.isFtAuthenticationIdentifier=le,e.isFtBookmark=e=>r(e)&&s(e.mapTitle)&&o(e.color)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.lastUpdate)&&s(e.readerUrl)&&s(e.mapId)&&s(e.id)&&s(e.title)&&s(e.creationDate),e.isFtCollectionDocument=e=>r(e)&&i(e.deleted)&&(null==e.apiUrl||s(e.apiUrl))&&(null==e.portalUrl||s(e.portalUrl))&&s(e.id)&&s(e.title)&&j(e.type),e.isFtCollectionDocumentType=j,e.isFtCredentials=e=>r(e)&&s(e.password)&&(null==e.newPassword||s(e.newPassword))&&i(e.rememberMe)&&s(e.login),e.isFtEditorialType=B,e.isFtFeedbackCreation=e=>r(e)&&(null==e.from||s(e.from))&&s(e.message),e.isFtLabeledSearchFilter=G,e.isFtMap=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&H(e.openMode)&&(null==e.topicsApiEndpoint||s(e.topicsApiEndpoint))&&(null==e.description||s(e.description))&&(null==e.attachmentsApiEndpoint||s(e.attachmentsApiEndpoint))&&B(e.editorialType)&&s(e.baseId)&&s(e.clusterId)&&s(e.title)&&s(e.lastPublication)&&s(e.lastEdition)&&s(e.originId)&&(null==e.rightsApiEndpoint||s(e.rightsApiEndpoint))&&h(e.contentStyles)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtMapAttachment=e=>ce(e)&&he(e.file)&&(null==e.size||pe(e.size))&&de(e.externalLink)&&he(e.name)&&he(e.id)&&(null==e.mimeType||he(e.mimeType))&&(null==e.viewerUrl||he(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&s(e.contentUrl)&&s(e.filename)&&s(e.id)&&s(e.mimeType),e.isFtMapStyles=h,e.isFtMessageContext=e=>r(e)&&s(e.name)&&r(e.messages)&&Object.keys(e.messages).every((e=>s(e)))&&Object.values(e.messages).every((e=>s(e)))&&s(e.locale),e.isFtMetadata=g,e.isFtMetadataPreferenceConfiguration=O,e.isFtMyLibraryColors=o,e.isFtMySearch=e=>r(e)&&b(e.searchRequest)&&o(e.color)&&i(e.alert)&&s(e.description)&&s(e.id)&&s(e.ownerId)&&s(e.title)&&s(e.creationDate),e.isFtMySearchRequest=b,e.isFtOpenMode=H,e.isFtPageConfiguration=fe,e.isFtPageRequest=K,e.isFtPaginatedToc=e=>ce(e)&&Ae(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>me(e))),e.isFtPaginatedTocNode=me,e.isFtPaginationConfiguration=Ae,e.isFtPeriod=I,e.isFtPeriodFilter=_,e.isFtPeriodFilterType=C,e.isFtPersonalBookCreation=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>c(e)))&&Array.isArray(e.nodes)&&e.nodes.every((e=>d(e)))&&s(e.description)&&s(e.title),e.isFtPersonalBookMetadataUpdate=c,e.isFtPersonalBookNodeCreation=d,e.isFtPersonalBookTopicLinkCreation=p,e.isFtPublicationRating=R,e.isFtPublicationRatingSummary=S,e.isFtRatingCreation=e=>r(e)&&T(e.type)&&n(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||U(e.topics))&&S(e.publication),e.isFtRatingType=T,e.isFtReaderConfiguration=e=>ce(e)&&ye(e.feedback)&&pe(e.loadAfterLastVisibleTopic)&&pe(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=ye,e.isFtSearchFacet=Z,e.isFtSearchFacetConf=ee,e.isFtSearchFacetEntry=te,e.isFtSearchFilter=P,e.isFtSearchLocale=A,e.isFtSearchLocales=e=>r(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>A(e))),e.isFtSearchPreferencesConfiguration=e=>r(e)&&r(e.metadata)&&Object.keys(e.metadata).every((e=>s(e)))&&Object.values(e.metadata).every((e=>O(e))),e.isFtSearchPreset=e=>r(e)&&s(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&n(e.priority)&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSearchPrior=V,e.isFtSearchRequest=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&s(e.query)&&K(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>re(e)))&&(null==e.uiLocale||s(e.uiLocale))&&(null==e.contentLocale||s(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>V(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>ee(e))),e.isFtSearchResultCluster=q,e.isFtSearchResultClusterEntry=X,e.isFtSearchResultMap=Y,e.isFtSearchResultTopic=J,e.isFtSearchResultType=Q,e.isFtSearchResultUnstructuredDocument=z,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||ie(e.spellcheck))&&M(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>q(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>Z(e))),e.isFtSearchResultsPageInfo=M,e.isFtSearchSortCriterion=re,e.isFtSearchSortCriterionOrder=L,e.isFtSearchSortCriterionType=N,e.isFtSession=e=>r(e)&&(null==e.authenticationIdentifier||le(e.authenticationIdentifier))&&n(e.idleTimeoutInMillis)&&ue(e.profile)&&i(e.sessionAuthenticated),e.isFtSpellcheck=ie,e.isFtSuggestRequest=e=>r(e)&&s(e.input)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>re(e)))&&(null==e.maxCount||n(e.maxCount))&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSuggestResult=se,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>se(e))),e.isFtTocNode=y,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&s(e.id)&&s(e.contentApiEndpoint)&&s(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicOrigin=f,e.isFtTopicOriginType=u,e.isFtTopicRating=F,e.isFtTopicResource=ne,e.isFtTopicsRatingSummary=U,e.isFtUiLocale=e=>r(e)&&s(e.displayName)&&s(e.languageTag)&&i(e.translated),e.isFtUnstructuredDocument=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&s(e.openMode)&&(null==e.description||s(e.description))&&s(e.mimeType)&&(null==e.baseId||s(e.baseId))&&(null==e.clusterId||s(e.clusterId))&&s(e.contentApiEndpoint)&&s(e.title)&&(null==e.lastPublication||s(e.lastPublication))&&s(e.viewerUrl)&&s(e.lastEdition)&&s(e.filename)&&(null==e.originId||s(e.originId))&&s(e.rightsApiEndpoint)&&(null==e.originUrl||s(e.originUrl))&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtUserProfile=ue,e.isFtUserRole=oe,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Ee.localStorage){let r={...t,metadata:Te(t.metadata??{})};const i=Re(e),n=JSON.stringify(r);return Ee.localStorage.setItem(i,n),Ee.dispatchEvent(new StorageEvent("storage",{key:i,newValue:n,storageArea:Ee.localStorage,url:Ee.location.href})),r}console.error("Cannot set unauthenticated preferences: local storage is unavailable.")},e.userHasRole=function(e,t){return null!=e&&(Array.isArray(e)?e:Array.isArray(e.roles)?e.roles:Array.isArray(e.profile?.roles)?e.profile.roles:[]).some((e=>be(e,t)))}}));
|
package/dist/cjs/roles/roles.js
CHANGED
|
@@ -15,11 +15,17 @@ function roleMatches(actual, expected) {
|
|
|
15
15
|
return actual === expected || ((_a = rolesInheritance[actual]) !== null && _a !== void 0 ? _a : []).some((inherited) => roleMatches(inherited, expected));
|
|
16
16
|
}
|
|
17
17
|
function userHasRole(sessionOrProfileOrRoles, expectedRole) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
var _a;
|
|
19
|
+
if (sessionOrProfileOrRoles == null) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const roles = Array.isArray(sessionOrProfileOrRoles)
|
|
23
|
+
? sessionOrProfileOrRoles
|
|
24
|
+
: Array.isArray(sessionOrProfileOrRoles.roles)
|
|
21
25
|
? sessionOrProfileOrRoles.roles
|
|
22
|
-
: sessionOrProfileOrRoles
|
|
26
|
+
: Array.isArray((_a = sessionOrProfileOrRoles.profile) === null || _a === void 0 ? void 0 : _a.roles)
|
|
27
|
+
? sessionOrProfileOrRoles.profile.roles
|
|
28
|
+
: [];
|
|
23
29
|
return roles.some(role => roleMatches(role, expectedRole));
|
|
24
30
|
}
|
|
25
31
|
exports.userHasRole = userHasRole;
|
|
@@ -106,9 +106,9 @@ const isFtMap = (o) => {
|
|
|
106
106
|
&& ((Array.isArray(o.metadata)
|
|
107
107
|
&& o.metadata.every((v) => (0, exports.isFtMetadata)(v))))
|
|
108
108
|
&& ((0, exports.isFtOpenMode)(o.openMode))
|
|
109
|
-
&& (isString(o.topicsApiEndpoint))
|
|
109
|
+
&& (o.topicsApiEndpoint == null || isString(o.topicsApiEndpoint))
|
|
110
110
|
&& (o.description == null || isString(o.description))
|
|
111
|
-
&& (isString(o.attachmentsApiEndpoint))
|
|
111
|
+
&& (o.attachmentsApiEndpoint == null || isString(o.attachmentsApiEndpoint))
|
|
112
112
|
&& ((0, exports.isFtEditorialType)(o.editorialType))
|
|
113
113
|
&& (isString(o.baseId))
|
|
114
114
|
&& (isString(o.clusterId))
|
|
@@ -116,11 +116,11 @@ const isFtMap = (o) => {
|
|
|
116
116
|
&& (isString(o.lastPublication))
|
|
117
117
|
&& (isString(o.lastEdition))
|
|
118
118
|
&& (isString(o.originId))
|
|
119
|
-
&& (isString(o.rightsApiEndpoint))
|
|
119
|
+
&& (o.rightsApiEndpoint == null || isString(o.rightsApiEndpoint))
|
|
120
120
|
&& ((0, exports.isFtMapStyles)(o.contentStyles))
|
|
121
121
|
&& (o.originUrl == null || isString(o.originUrl))
|
|
122
122
|
&& (isString(o.readerUrl))
|
|
123
|
-
&& (isString(o.khubVersion))
|
|
123
|
+
&& (o.khubVersion == null || isString(o.khubVersion))
|
|
124
124
|
&& (isString(o.id))
|
|
125
125
|
&& (o.lang == null || isString(o.lang));
|
|
126
126
|
};
|
|
@@ -420,9 +420,10 @@ var FtEditorialType;
|
|
|
420
420
|
(function (FtEditorialType) {
|
|
421
421
|
FtEditorialType["ARTICLE"] = "ARTICLE";
|
|
422
422
|
FtEditorialType["BOOK"] = "BOOK";
|
|
423
|
+
FtEditorialType["SHARED_BOOK"] = "SHARED_BOOK";
|
|
423
424
|
})(FtEditorialType = exports.FtEditorialType || (exports.FtEditorialType = {}));
|
|
424
425
|
const isFtEditorialType = (o) => {
|
|
425
|
-
return ["ARTICLE", "BOOK"].includes(o);
|
|
426
|
+
return ["ARTICLE", "BOOK", "SHARED_BOOK"].includes(o);
|
|
426
427
|
};
|
|
427
428
|
exports.isFtEditorialType = isFtEditorialType;
|
|
428
429
|
// From: WsOpenMode
|
package/dist/fluidtopics.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).fluidtopics={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){!function(t){var r={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(r.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function a(e){return"string"!=typeof e&&(e=String(e)),e}function o(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function l(e){this.map={},e instanceof l?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function u(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function c(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function d(e){var t=new FileReader,r=c(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():r.arrayBuffer&&r.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||n(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var e,t,r,i=u(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=c(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(e,t){e=s(e),t=a(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},l.prototype.delete=function(e){delete this.map[s(e)]},l.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},l.prototype.set=function(e,t){this.map[s(e)]=a(t)},l.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},l.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),o(e)},l.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),o(e)},l.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),o(e)},r.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function f(e,t){var r,i,n=(t=t||{}).body;if(e instanceof f){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new l(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new l(t.headers)),this.method=(r=t.method||this.method||"GET",i=r.toUpperCase(),y.indexOf(i)>-1?i:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function m(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}})),t}function A(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},h.call(f.prototype),h.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},A.error=function(){var e=new A(null,{status:0,statusText:""});return e.type="error",e};var g=[301,302,303,307,308];A.redirect=function(e,t){if(-1===g.indexOf(t))throw new RangeError("Invalid status code");return new A(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function b(e,i){return new Promise((function(n,s){var a=new f(e,i);if(a.signal&&a.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function u(){o.abort()}o.onload=function(){var e,t,r={status:o.status,statusText:o.statusText,headers:(e=o.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();t.append(i,n)}})),t)};r.url="responseURL"in o?o.responseURL:r.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;n(new A(i,r))},o.onerror=function(){s(new TypeError("Network request failed"))},o.ontimeout=function(){s(new TypeError("Network request failed"))},o.onabort=function(){s(new t.DOMException("Aborted","AbortError"))},o.open(a.method,a.url,!0),"include"===a.credentials?o.withCredentials=!0:"omit"===a.credentials&&(o.withCredentials=!1),"responseType"in o&&r.blob&&(o.responseType="blob"),a.headers.forEach((function(e,t){o.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",u),o.onreadystatechange=function(){4===o.readyState&&a.signal.removeEventListener("abort",u)}),o.send(void 0===a._bodyInit?null:a._bodyInit)}))}b.polyfill=!0,e.fetch||(e.fetch=b,e.Headers=l,e.Request=f,e.Response=A),t.Headers=l,t.Request=f,t.Response=A,t.fetch=b,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:t);const r=e=>"object"==typeof e&&null!=e,i=e=>"boolean"==typeof e,n=e=>"number"==typeof e,s=e=>"string"==typeof e;var a;e.FtMyLibraryColors=void 0,(a=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",a.green="green",a.blue="blue",a.purple="purple",a.red="red",a.orange="orange",a.yellow="yellow";const o=e=>["black","green","blue","purple","red","orange","yellow"].includes(e);var l;e.FtTopicOriginType=void 0,(l=e.FtTopicOriginType||(e.FtTopicOriginType={})).OFFICIAL="OFFICIAL",l.PERSONAL="PERSONAL",l.SHARED="SHARED";const u=e=>["OFFICIAL","PERSONAL","SHARED"].includes(e),c=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>Array.isArray(e)&&e.every((e=>s(e)))))&&s(e.key),d=e=>r(e)&&s(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>d(e)))&&(null==e.topicLink||p(e.topicLink))&&s(e.title)&&(null==e.htmlContent||s(e.htmlContent)),p=e=>r(e)&&s(e.tocId)&&s(e.contentId)&&s(e.mapId),h=e=>r(e)&&s(e.topicStylesheetUrl)&&s(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>s(e))),y=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&(null==e.hasRating||i(e.hasRating))&&s(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>y(e)))&&(null==e.origin||f(e.origin))&&s(e.contentId)&&s(e.title),f=e=>r(e)&&s(e.mapTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.contentId)&&s(e.mapId)&&u(e.type);var m;e.FtTopicContentTarget=void 0,(m=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",m.OFF_THE_GRID="OFF_THE_GRID",m.CONTENT_PACKAGER="CONTENT_PACKAGER",m.PAGES="PAGES",m.DESIGNED_READER="DESIGNED_READER";const A=e=>r(e)&&n(e.count)&&s(e.label)&&(null==e.lang||s(e.lang)),g=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>s(e))))))&&s(e.label)&&s(e.key),b=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&s(e.query)&&Array.isArray(e.filters)&&e.filters.every((e=>G(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>re(e)))&&(null==e.contentLocale||s(e.contentLocale));var E;e.FtRatingType=void 0,(E=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",E.LIKE="LIKE",E.DICHOTOMOUS="DICHOTOMOUS",E.NO_RATING="NO_RATING";const T=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),R=e=>r(e)&&s(e.date)&&T(e.type)&&n(e.value),S=e=>r(e)&&(null==e.rating||R(e.rating))&&T(e.type),F=e=>r(e)&&s(e.date)&&s(e.tocId)&&T(e.type)&&n(e.value),U=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>F(e)))&&T(e.type),O=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>s(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>s(e))),I=e=>r(e)&&s(e.from)&&s(e.to),_=e=>r(e)&&(null==e.period||I(e.period))&&C(e.periodType);var v;e.FtPeriodFilterType=void 0,(v=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",v.LAST_MONTH="LAST_MONTH",v.LAST_YEAR="LAST_YEAR",v.CUSTOM="CUSTOM";const C=e=>["LAST_WEEK","LAST_MONTH","LAST_YEAR","CUSTOM"].includes(e),P=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.key);var D;e.FtSearchSortCriterionOrder=void 0,(D=e.FtSearchSortCriterionOrder||(e.FtSearchSortCriterionOrder={})).ASC="ASC",D.DESC="DESC";const L=e=>["ASC","DESC"].includes(e);var k;e.FtSearchSortCriterionType=void 0,(k=e.FtSearchSortCriterionType||(e.FtSearchSortCriterionType={})).ALPHA="ALPHA",k.NATURAL="NATURAL";const N=e=>["ALPHA","NATURAL"].includes(e),M=e=>r(e)&&n(e.totalResultsCount)&&i(e.isLastPage)&&n(e.currentPage)&&n(e.totalClustersCount);var w;e.FtEditorialType=void 0,(w=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",w.BOOK="BOOK";const B=e=>["ARTICLE","BOOK"].includes(e);var x;e.FtOpenMode=void 0,(x=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",x.EXTERNAL="EXTERNAL";const H=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),$=e=>r(e)&&(null==e.perPage||n(e.perPage))&&n(e.page);var K;e.FtCollectionDocumentType=void 0,(K=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",K.DOCUMENT="DOCUMENT",K.TOPIC="TOPIC",K.PERSONAL_BOOK="PERSONAL_BOOK",K.SHARED_BOOK="SHARED_BOOK";const j=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),G=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.label)&&s(e.key),V=e=>r(e)&&n(e.weight)&&s(e.value)&&s(e.key),q=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>X(e)))&&(null==e.metadataVariableAxis||s(e.metadataVariableAxis)),X=e=>r(e)&&(null==e.document||z(e.document))&&(null==e.topic||J(e.topic))&&Q(e.type)&&(null==e.map||Y(e.map)),z=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&H(e.openMode)&&s(e.documentUrl)&&s(e.mimeType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.viewerUrl)&&s(e.contentUrl)&&s(e.filename)&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.documentId)&&s(e.lastEditionDate)&&s(e.htmlExcerpt),Y=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&(null==e.openMode||H(e.openMode))&&B(e.editorialType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.mapUrl)&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt),J=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&H(e.openMode)&&s(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>ne(e)))&&s(e.title)&&s(e.mapTitle)&&s(e.topicUrl)&&s(e.contentUrl)&&s(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt);var W;e.FtSearchResultType=void 0,(W=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",W.DOCUMENT="DOCUMENT",W.TOPIC="TOPIC";const Q=e=>["MAP","DOCUMENT","TOPIC"].includes(e),Z=e=>r(e)&&i(e.hierarchical)&&s(e.label)&&i(e.multiSelectionable)&&s(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>te(e))),ee=e=>r(e)&&(null==e.maxDepth||n(e.maxDepth))&&s(e.id),te=e=>r(e)&&n(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>te(e)))&&s(e.label)&&s(e.value)&&i(e.selected),re=e=>r(e)&&N(e.type)&&s(e.key)&&L(e.order),ie=e=>r(e)&&s(e.suggestedQuery)&&s(e.htmlSuggestedQuery),ne=e=>r(e)&&s(e.filename)&&s(e.resourceUrl)&&s(e.id)&&s(e.mimeType)&&s(e.resourceContentUrl)&&s(e.viewerUrl),se=e=>r(e)&&(null==e.filenameExtension||s(e.filenameExtension))&&(null==e.editorialType||B(e.editorialType))&&(null==e.mimeType||s(e.mimeType))&&Q(e.type)&&s(e.value);var ae;e.FtUserRole=void 0,(ae=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",ae.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",ae.HTML_EXPORT_USER="HTML_EXPORT_USER",ae.PDF_EXPORT_USER="PDF_EXPORT_USER",ae.SAVED_SEARCH_USER="SAVED_SEARCH_USER",ae.COLLECTION_USER="COLLECTION_USER",ae.OFFLINE_USER="OFFLINE_USER",ae.ANALYTICS_USER="ANALYTICS_USER",ae.BETA_USER="BETA_USER",ae.DEBUG_USER="DEBUG_USER",ae.PRINT_USER="PRINT_USER",ae.RATING_USER="RATING_USER",ae.FEEDBACK_USER="FEEDBACK_USER",ae.CONTENT_PUBLISHER="CONTENT_PUBLISHER",ae.KHUB_ADMIN="KHUB_ADMIN",ae.USERS_ADMIN="USERS_ADMIN",ae.PORTAL_ADMIN="PORTAL_ADMIN",ae.ADMIN="ADMIN",ae.DEVELOPER="DEVELOPER";const oe=e=>["PERSONAL_BOOK_USER","PERSONAL_BOOK_SHARE_USER","HTML_EXPORT_USER","PDF_EXPORT_USER","SAVED_SEARCH_USER","COLLECTION_USER","OFFLINE_USER","ANALYTICS_USER","BETA_USER","DEBUG_USER","PRINT_USER","RATING_USER","FEEDBACK_USER","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(e),le=e=>r(e)&&s(e.identifier)&&s(e.realm),ue=e=>r(e)&&(null==e.authenticationIdentifier||le(e.authenticationIdentifier))&&n(e.idleTimeoutInMillis)&&ce(e.profile)&&i(e.sessionAuthenticated),ce=e=>r(e)&&(null==e.emailAddress||s(e.emailAddress))&&(null==e.displayName||s(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>oe(e)))&&(null==e.userId||s(e.userId)),de=e=>"object"==typeof e&&null!=e,pe=e=>"boolean"==typeof e,he=e=>"number"==typeof e,ye=e=>"string"==typeof e,fe=e=>de(e)&&pe(e.mailsSentByFluidTopics)&&pe(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>ye(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>ye(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>ye(e))),me=e=>de(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>pe(e))))&&pe(e.isVisible),Ae=e=>de(e)&&(null==e.prettyUrl||ye(e.prettyUrl))&&(null==e.hasRating||pe(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||ye(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>Ae(e)))&&(null==e.pageConfiguration||me(e.pageConfiguration))&&(null==e.contentId||ye(e.contentId))&&(null==e.title||ye(e.title)),ge=e=>de(e)&&pe(e.splitCurrentPageToc),be={[e.FtUserRole.PERSONAL_BOOK_SHARE_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.HTML_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.PDF_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.KHUB_ADMIN]:[e.FtUserRole.CONTENT_PUBLISHER],[e.FtUserRole.ADMIN]:[e.FtUserRole.KHUB_ADMIN,e.FtUserRole.USERS_ADMIN,e.FtUserRole.PORTAL_ADMIN],[e.FtUserRole.DEVELOPER]:[e.FtUserRole.BETA_USER,e.FtUserRole.DEBUG_USER]};function Ee(e,t){return e===t||(be[e]??[]).some((e=>Ee(e,t)))}const Te="undefined"==typeof window?globalThis:window;function Re(e){let t={};for(let r in e){let i=e[r];("object"!=typeof i||Array.isArray(i))&&(i={prior:i});for(let e of["prior","filter"])i[e]=Array.isArray(i[e])?i[e]:[i[e]],i[e]=i[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[r]=i}return t}function Se(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Fe="undefined"==typeof window?globalThis:window;class Ue extends Error{status;statusText;body;constructor(e,t,r){super(`${e} - ${t}: ${r}`),this.status=e,this.statusText=t,this.body=r}}async function Oe(e){if(!e.ok)throw new Ue(e.status,e.statusText,await e.text());return e}function Ie(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class _e{tenantBaseUrl;ftCallingApp;authorization;searchLabel;endpoints={authentication:{login:"api/authentication/login",logout:"api/authentication/logout",currentSession:"api/authentication/current-session"},khub:{maps:{mapId:e=>({info:`api/khub/maps/${e}`,toc:`api/khub/maps/${e}/toc`,pages:`api/khub/maps/${e}/pages`,feedback:`api/khub/maps/${e}/feedback`,rating:`api/khub/maps/${e}/rating`,attachments:{list:`api/khub/maps/${e}/attachments`,attachmentId:t=>({content:`api/khub/maps/${e}/attachments/${t}/content`})},resources:{list:`api/khub/maps/${e}/resources`,resourceId:t=>({content:`api/khub/maps/${e}/resources/${t}/content`})},topics:{contentId:t=>({info:`api/khub/maps/${e}/topics/${t}`,content:`api/khub/maps/${e}/topics/${t}/content`}),tocId:t=>({feedback:`api/khub/maps/${e}/topics/${t}/feedback`,rating:`api/khub/maps/${e}/topics/${t}/rating`})}})},documents:{documentId:e=>({info:`api/khub/documents/${e}`,content:`api/khub/documents/${e}/content`,text:`api/khub/documents/${e}/content/text`,feedback:`api/khub/documents/${e}/feedback`,rating:`api/khub/documents/${e}/rating`})},suggest:"api/khub/suggest",clusteredSearch:"api/khub/clustered-search",locales:"api/khub/locales"},users:{userId:e=>({collections:{collectionId:t=>({documents:`api/users/${e}/collections/${t}/documents`})},searches:{list:`api/users/${e}/searches`},bookmarks:{list:`api/users/${e}/bookmarks`}})},stylesheets:{fonts:"api/stylesheets/fonts.css",theme:"api/stylesheets/theme.css",content:{title:"api/stylesheets/content/title.css",topic:"api/stylesheets/content/topic.css"}},configuration:{reader:"api/configuration/reader"},locales:{ui:"api/locales/ui"},messages:{locale:e=>({fluidTopics:{contextName:t=>({endpoint:`api/messages/${e}/fluid-topics/${t}`})},custom:{contextName:t=>({endpoint:`api/messages/${e}/custom/${t}`})}})}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??Fe.__gwt_ft_moduleBase??Fe.fluidtopicsclient?.__moduleBase??Fe.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==Fe.location&&Fe.location.href.startsWith(this.tenantBaseUrl)?this.ftCallingApp=t:this.ftCallingApp=`ft-public-api/${t}`}setApiKey(e){this.authorization={Authorization:"Bearer "+e}}setCredentials(e,t){var r;this.authorization={Authorization:"Basic "+(r=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(r).toString("base64"):btoa(r))}}clearAuthentication(){this.authorization=void 0}setSearchLabel(e){this.searchLabel={"FT-search-label":e}}clearSearchLabel(){this.searchLabel=void 0}login(e,t){let r={login:e,password:t,rememberMe:!0};return this.post(this.endpoints.authentication.login,r).then((r=>(this.setCredentials(e,t),r)))}logout(){return this.post(this.endpoints.authentication.logout).then((()=>this.clearAuthentication()))}getCurrentSession(){return this.get(this.endpoints.authentication.currentSession)}getReaderConfiguration(){return this.get(this.endpoints.configuration.reader)}getMap(e){return this.get(this.endpoints.khub.maps.mapId(e).info)}getTableOfContent(e){return this.get(this.endpoints.khub.maps.mapId(e).toc)}getPages(e){return this.get(this.endpoints.khub.maps.mapId(e).pages)}getTopic(e,t){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).info)}getTopicHTMLContent(e,t,r){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).content+(r?"?target="+r:""))}getMapAttachments(e){return this.get(this.endpoints.khub.maps.mapId(e).attachments.list)}getMapAttachmentContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).attachments.attachmentId(t).content)}getMapResources(e){return this.get(this.endpoints.khub.maps.mapId(e).resources.list)}getMapResourceContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).resources.resourceId(t).content)}getUnstructuredDocument(e){return this.get(this.endpoints.khub.documents.documentId(e).info)}getUnstructuredDocumentContent(e){return this.fetchRawData(this.endpoints.khub.documents.documentId(e).content)}getUnstructuredDocumentTextContent(e){return this.get(this.endpoints.khub.documents.documentId(e).text)}getCollectionDocuments(e,t){return this.get(this.endpoints.users.userId(e).collections.collectionId(t).documents)}getSuggestions(e){return this.post(this.endpoints.khub.suggest,e)}search(e){return this.post(this.endpoints.khub.clusteredSearch,e)}getAvailableSearchLocales(){return this.get(this.endpoints.khub.locales)}getAvailableUiLocales(){return this.get(this.endpoints.khub.locales)}getMapRating(e){return this.get(this.endpoints.khub.maps.mapId(e).rating)}rateMap(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).rating,{type:t,value:r})}unrateMap(e){return this.delete(this.endpoints.khub.maps.mapId(e).rating)}sendMapFeedback(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).feedback,{message:t,from:r})}rateTopic(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:r,value:i})}unrateTopic(e,t){return this.delete(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating)}sendTopicFeedback(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).feedback,{message:r,from:i})}getDocumentRating(e){return this.get(this.endpoints.khub.documents.documentId(e).rating)}rateDocument(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).rating,{type:t,value:r})}unrateDocument(e){return this.delete(this.endpoints.khub.documents.documentId(e).rating)}sendDocumentFeedback(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).feedback,{message:t,from:r})}getFluidTopicsMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).fluidTopics.contextName(t).endpoint)}getCustomMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).custom.contextName(t).endpoint)}listMySearches(e){return this.get(this.endpoints.users.userId(e).searches.list)}listMyBookmarks(e){return this.get(this.endpoints.users.userId(e).bookmarks.list)}get(e){return this.makeRequest("GET",e)}post(e,t){return this.makeRequest("POST",e,t)}put(e,t){return this.makeRequest("PUT",e,t)}delete(e){return this.makeRequest("DELETE",e)}makeAbsolute(e){return this.tenantBaseUrl+e.replace(/^\//,"")}async fetch(e,t){const r=t;return await fetch(this.makeAbsolute(e),{...r??{},headers:{...this.defaultHeaders,...r?.headers??{}}})}upload(e,t,r,i=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((n,s)=>{let a=new XMLHttpRequest;a.onload=()=>{if(a.status>=200&&a.status<300){let e="application/json"===a.getResponseHeader("Content-Type")?JSON.parse(a.responseText):a.responseText;n(e)}else s(new Ue(a.status,a.statusText,a.responseText))},a.upload.onprogress=e=>i(e),a.open(e,this.makeAbsolute(t),!0),a.send(r)})):this.fetch(t,{method:e,body:r}).then(Oe).then(Ie)}makeRequest(e,t,r){return this.fetch(t,{method:e,headers:{...null!=r?{"Content-Type":"application/json"}:{}},body:null!=r?JSON.stringify(r):void 0,credentials:null==this.authorization?"include":void 0}).then(Oe).then(Ie)}fetchRawData(e){return fetch(this.makeAbsolute(e),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then(Oe).then((e=>e.arrayBuffer()))}}e.FluidTopicsApi=_e,e.HttpError=Ue,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Te.localStorage){const r=Se(e),i=e=>{e.storageArea===Te.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Te.addEventListener("storage",i),{removeHandler:()=>Te.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=_e,e.getUnauthenticatedUserSearchPreferences=function(e){if(Te.localStorage)return JSON.parse(Te.localStorage.getItem(Se(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&le(e.authenticationIdentifier)&&ce(e.profile),e.isFtAuthenticationIdentifier=le,e.isFtBookmark=e=>r(e)&&s(e.mapTitle)&&o(e.color)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.lastUpdate)&&s(e.readerUrl)&&s(e.mapId)&&s(e.id)&&s(e.title)&&s(e.creationDate),e.isFtCollectionDocument=e=>r(e)&&i(e.deleted)&&(null==e.apiUrl||s(e.apiUrl))&&(null==e.portalUrl||s(e.portalUrl))&&s(e.id)&&s(e.title)&&j(e.type),e.isFtCollectionDocumentType=j,e.isFtCredentials=e=>r(e)&&s(e.password)&&(null==e.newPassword||s(e.newPassword))&&i(e.rememberMe)&&s(e.login),e.isFtEditorialType=B,e.isFtFeedbackCreation=e=>r(e)&&(null==e.from||s(e.from))&&s(e.message),e.isFtLabeledSearchFilter=G,e.isFtMap=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&H(e.openMode)&&s(e.topicsApiEndpoint)&&(null==e.description||s(e.description))&&s(e.attachmentsApiEndpoint)&&B(e.editorialType)&&s(e.baseId)&&s(e.clusterId)&&s(e.title)&&s(e.lastPublication)&&s(e.lastEdition)&&s(e.originId)&&s(e.rightsApiEndpoint)&&h(e.contentStyles)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.khubVersion)&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtMapAttachment=e=>de(e)&&ye(e.file)&&(null==e.size||he(e.size))&&pe(e.externalLink)&&ye(e.name)&&ye(e.id)&&(null==e.mimeType||ye(e.mimeType))&&(null==e.viewerUrl||ye(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&s(e.contentUrl)&&s(e.filename)&&s(e.id)&&s(e.mimeType),e.isFtMapStyles=h,e.isFtMessageContext=e=>r(e)&&s(e.name)&&r(e.messages)&&Object.keys(e.messages).every((e=>s(e)))&&Object.values(e.messages).every((e=>s(e)))&&s(e.locale),e.isFtMetadata=g,e.isFtMetadataPreferenceConfiguration=O,e.isFtMyLibraryColors=o,e.isFtMySearch=e=>r(e)&&b(e.searchRequest)&&o(e.color)&&i(e.alert)&&s(e.description)&&s(e.id)&&s(e.ownerId)&&s(e.title)&&s(e.creationDate),e.isFtMySearchRequest=b,e.isFtOpenMode=H,e.isFtPageConfiguration=me,e.isFtPageRequest=$,e.isFtPaginatedToc=e=>de(e)&&ge(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>Ae(e))),e.isFtPaginatedTocNode=Ae,e.isFtPaginationConfiguration=ge,e.isFtPeriod=I,e.isFtPeriodFilter=_,e.isFtPeriodFilterType=C,e.isFtPersonalBookCreation=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>c(e)))&&Array.isArray(e.nodes)&&e.nodes.every((e=>d(e)))&&s(e.description)&&s(e.title),e.isFtPersonalBookMetadataUpdate=c,e.isFtPersonalBookNodeCreation=d,e.isFtPersonalBookTopicLinkCreation=p,e.isFtPublicationRating=R,e.isFtPublicationRatingSummary=S,e.isFtRatingCreation=e=>r(e)&&T(e.type)&&n(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||U(e.topics))&&S(e.publication),e.isFtRatingType=T,e.isFtReaderConfiguration=e=>de(e)&&fe(e.feedback)&&he(e.loadAfterLastVisibleTopic)&&he(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=fe,e.isFtSearchFacet=Z,e.isFtSearchFacetConf=ee,e.isFtSearchFacetEntry=te,e.isFtSearchFilter=P,e.isFtSearchLocale=A,e.isFtSearchLocales=e=>r(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>A(e))),e.isFtSearchPreferencesConfiguration=e=>r(e)&&r(e.metadata)&&Object.keys(e.metadata).every((e=>s(e)))&&Object.values(e.metadata).every((e=>O(e))),e.isFtSearchPreset=e=>r(e)&&s(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&n(e.priority)&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSearchPrior=V,e.isFtSearchRequest=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&s(e.query)&&$(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>re(e)))&&(null==e.uiLocale||s(e.uiLocale))&&(null==e.contentLocale||s(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>V(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>ee(e))),e.isFtSearchResultCluster=q,e.isFtSearchResultClusterEntry=X,e.isFtSearchResultMap=Y,e.isFtSearchResultTopic=J,e.isFtSearchResultType=Q,e.isFtSearchResultUnstructuredDocument=z,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||ie(e.spellcheck))&&M(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>q(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>Z(e))),e.isFtSearchResultsPageInfo=M,e.isFtSearchSortCriterion=re,e.isFtSearchSortCriterionOrder=L,e.isFtSearchSortCriterionType=N,e.isFtSession=ue,e.isFtSpellcheck=ie,e.isFtSuggestRequest=e=>r(e)&&s(e.input)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>re(e)))&&(null==e.maxCount||n(e.maxCount))&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSuggestResult=se,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>se(e))),e.isFtTocNode=y,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&s(e.id)&&s(e.contentApiEndpoint)&&s(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicOrigin=f,e.isFtTopicOriginType=u,e.isFtTopicRating=F,e.isFtTopicResource=ne,e.isFtTopicsRatingSummary=U,e.isFtUiLocale=e=>r(e)&&s(e.displayName)&&s(e.languageTag)&&i(e.translated),e.isFtUnstructuredDocument=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&s(e.openMode)&&(null==e.description||s(e.description))&&s(e.mimeType)&&(null==e.baseId||s(e.baseId))&&(null==e.clusterId||s(e.clusterId))&&s(e.contentApiEndpoint)&&s(e.title)&&(null==e.lastPublication||s(e.lastPublication))&&s(e.viewerUrl)&&s(e.lastEdition)&&s(e.filename)&&(null==e.originId||s(e.originId))&&s(e.rightsApiEndpoint)&&(null==e.originUrl||s(e.originUrl))&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtUserProfile=ce,e.isFtUserRole=oe,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Te.localStorage){let r={...t,metadata:Re(t.metadata??{})};const i=Se(e),n=JSON.stringify(r);return Te.localStorage.setItem(i,n),Te.dispatchEvent(new StorageEvent("storage",{key:i,newValue:n,storageArea:Te.localStorage,url:Te.location.href})),r}console.error("Cannot set unauthenticated preferences: local storage is unavailable.")},e.userHasRole=function(e,t){return(ue(e)?e.profile.roles:ce(e)?e.roles:e).some((e=>Ee(e,t)))}}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).fluidtopics={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){!function(t){var r={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(r.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function a(e){return"string"!=typeof e&&(e=String(e)),e}function o(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function l(e){this.map={},e instanceof l?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function u(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function c(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function d(e){var t=new FileReader,r=c(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():r.arrayBuffer&&r.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||n(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var e,t,r,i=u(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=c(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(e,t){e=s(e),t=a(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},l.prototype.delete=function(e){delete this.map[s(e)]},l.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},l.prototype.set=function(e,t){this.map[s(e)]=a(t)},l.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},l.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),o(e)},l.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),o(e)},l.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),o(e)},r.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function f(e,t){var r,i,n=(t=t||{}).body;if(e instanceof f){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new l(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new l(t.headers)),this.method=(r=t.method||this.method||"GET",i=r.toUpperCase(),y.indexOf(i)>-1?i:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function m(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}})),t}function A(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},h.call(f.prototype),h.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},A.error=function(){var e=new A(null,{status:0,statusText:""});return e.type="error",e};var g=[301,302,303,307,308];A.redirect=function(e,t){if(-1===g.indexOf(t))throw new RangeError("Invalid status code");return new A(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function b(e,i){return new Promise((function(n,s){var a=new f(e,i);if(a.signal&&a.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function u(){o.abort()}o.onload=function(){var e,t,r={status:o.status,statusText:o.statusText,headers:(e=o.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();t.append(i,n)}})),t)};r.url="responseURL"in o?o.responseURL:r.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;n(new A(i,r))},o.onerror=function(){s(new TypeError("Network request failed"))},o.ontimeout=function(){s(new TypeError("Network request failed"))},o.onabort=function(){s(new t.DOMException("Aborted","AbortError"))},o.open(a.method,a.url,!0),"include"===a.credentials?o.withCredentials=!0:"omit"===a.credentials&&(o.withCredentials=!1),"responseType"in o&&r.blob&&(o.responseType="blob"),a.headers.forEach((function(e,t){o.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",u),o.onreadystatechange=function(){4===o.readyState&&a.signal.removeEventListener("abort",u)}),o.send(void 0===a._bodyInit?null:a._bodyInit)}))}b.polyfill=!0,e.fetch||(e.fetch=b,e.Headers=l,e.Request=f,e.Response=A),t.Headers=l,t.Request=f,t.Response=A,t.fetch=b,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:t);const r=e=>"object"==typeof e&&null!=e,i=e=>"boolean"==typeof e,n=e=>"number"==typeof e,s=e=>"string"==typeof e;var a;e.FtMyLibraryColors=void 0,(a=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",a.green="green",a.blue="blue",a.purple="purple",a.red="red",a.orange="orange",a.yellow="yellow";const o=e=>["black","green","blue","purple","red","orange","yellow"].includes(e);var l;e.FtTopicOriginType=void 0,(l=e.FtTopicOriginType||(e.FtTopicOriginType={})).OFFICIAL="OFFICIAL",l.PERSONAL="PERSONAL",l.SHARED="SHARED";const u=e=>["OFFICIAL","PERSONAL","SHARED"].includes(e),c=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>Array.isArray(e)&&e.every((e=>s(e)))))&&s(e.key),d=e=>r(e)&&s(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>d(e)))&&(null==e.topicLink||p(e.topicLink))&&s(e.title)&&(null==e.htmlContent||s(e.htmlContent)),p=e=>r(e)&&s(e.tocId)&&s(e.contentId)&&s(e.mapId),h=e=>r(e)&&s(e.topicStylesheetUrl)&&s(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>s(e))),y=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&(null==e.hasRating||i(e.hasRating))&&s(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>y(e)))&&(null==e.origin||f(e.origin))&&s(e.contentId)&&s(e.title),f=e=>r(e)&&s(e.mapTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.contentId)&&s(e.mapId)&&u(e.type);var m;e.FtTopicContentTarget=void 0,(m=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",m.OFF_THE_GRID="OFF_THE_GRID",m.CONTENT_PACKAGER="CONTENT_PACKAGER",m.PAGES="PAGES",m.DESIGNED_READER="DESIGNED_READER";const A=e=>r(e)&&n(e.count)&&s(e.label)&&(null==e.lang||s(e.lang)),g=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>s(e))))))&&s(e.label)&&s(e.key),b=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&s(e.query)&&Array.isArray(e.filters)&&e.filters.every((e=>G(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>re(e)))&&(null==e.contentLocale||s(e.contentLocale));var E;e.FtRatingType=void 0,(E=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",E.LIKE="LIKE",E.DICHOTOMOUS="DICHOTOMOUS",E.NO_RATING="NO_RATING";const T=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),R=e=>r(e)&&s(e.date)&&T(e.type)&&n(e.value),S=e=>r(e)&&(null==e.rating||R(e.rating))&&T(e.type),F=e=>r(e)&&s(e.date)&&s(e.tocId)&&T(e.type)&&n(e.value),U=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>F(e)))&&T(e.type),O=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>s(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>s(e))),I=e=>r(e)&&s(e.from)&&s(e.to),_=e=>r(e)&&(null==e.period||I(e.period))&&C(e.periodType);var v;e.FtPeriodFilterType=void 0,(v=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",v.LAST_MONTH="LAST_MONTH",v.LAST_YEAR="LAST_YEAR",v.CUSTOM="CUSTOM";const C=e=>["LAST_WEEK","LAST_MONTH","LAST_YEAR","CUSTOM"].includes(e),P=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.key);var D;e.FtSearchSortCriterionOrder=void 0,(D=e.FtSearchSortCriterionOrder||(e.FtSearchSortCriterionOrder={})).ASC="ASC",D.DESC="DESC";const L=e=>["ASC","DESC"].includes(e);var k;e.FtSearchSortCriterionType=void 0,(k=e.FtSearchSortCriterionType||(e.FtSearchSortCriterionType={})).ALPHA="ALPHA",k.NATURAL="NATURAL";const N=e=>["ALPHA","NATURAL"].includes(e),M=e=>r(e)&&n(e.totalResultsCount)&&i(e.isLastPage)&&n(e.currentPage)&&n(e.totalClustersCount);var w;e.FtEditorialType=void 0,(w=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",w.BOOK="BOOK",w.SHARED_BOOK="SHARED_BOOK";const B=e=>["ARTICLE","BOOK","SHARED_BOOK"].includes(e);var x;e.FtOpenMode=void 0,(x=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",x.EXTERNAL="EXTERNAL";const H=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),K=e=>r(e)&&(null==e.perPage||n(e.perPage))&&n(e.page);var $;e.FtCollectionDocumentType=void 0,($=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",$.DOCUMENT="DOCUMENT",$.TOPIC="TOPIC",$.PERSONAL_BOOK="PERSONAL_BOOK",$.SHARED_BOOK="SHARED_BOOK";const j=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),G=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.label)&&s(e.key),V=e=>r(e)&&n(e.weight)&&s(e.value)&&s(e.key),q=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>X(e)))&&(null==e.metadataVariableAxis||s(e.metadataVariableAxis)),X=e=>r(e)&&(null==e.document||z(e.document))&&(null==e.topic||J(e.topic))&&Q(e.type)&&(null==e.map||Y(e.map)),z=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&H(e.openMode)&&s(e.documentUrl)&&s(e.mimeType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.viewerUrl)&&s(e.contentUrl)&&s(e.filename)&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.documentId)&&s(e.lastEditionDate)&&s(e.htmlExcerpt),Y=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&(null==e.openMode||H(e.openMode))&&B(e.editorialType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.mapUrl)&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt),J=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&H(e.openMode)&&s(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>ne(e)))&&s(e.title)&&s(e.mapTitle)&&s(e.topicUrl)&&s(e.contentUrl)&&s(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt);var W;e.FtSearchResultType=void 0,(W=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",W.DOCUMENT="DOCUMENT",W.TOPIC="TOPIC";const Q=e=>["MAP","DOCUMENT","TOPIC"].includes(e),Z=e=>r(e)&&i(e.hierarchical)&&s(e.label)&&i(e.multiSelectionable)&&s(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>te(e))),ee=e=>r(e)&&(null==e.maxDepth||n(e.maxDepth))&&s(e.id),te=e=>r(e)&&n(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>te(e)))&&s(e.label)&&s(e.value)&&i(e.selected),re=e=>r(e)&&N(e.type)&&s(e.key)&&L(e.order),ie=e=>r(e)&&s(e.suggestedQuery)&&s(e.htmlSuggestedQuery),ne=e=>r(e)&&s(e.filename)&&s(e.resourceUrl)&&s(e.id)&&s(e.mimeType)&&s(e.resourceContentUrl)&&s(e.viewerUrl),se=e=>r(e)&&(null==e.filenameExtension||s(e.filenameExtension))&&(null==e.editorialType||B(e.editorialType))&&(null==e.mimeType||s(e.mimeType))&&Q(e.type)&&s(e.value);var ae;e.FtUserRole=void 0,(ae=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",ae.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",ae.HTML_EXPORT_USER="HTML_EXPORT_USER",ae.PDF_EXPORT_USER="PDF_EXPORT_USER",ae.SAVED_SEARCH_USER="SAVED_SEARCH_USER",ae.COLLECTION_USER="COLLECTION_USER",ae.OFFLINE_USER="OFFLINE_USER",ae.ANALYTICS_USER="ANALYTICS_USER",ae.BETA_USER="BETA_USER",ae.DEBUG_USER="DEBUG_USER",ae.PRINT_USER="PRINT_USER",ae.RATING_USER="RATING_USER",ae.FEEDBACK_USER="FEEDBACK_USER",ae.CONTENT_PUBLISHER="CONTENT_PUBLISHER",ae.KHUB_ADMIN="KHUB_ADMIN",ae.USERS_ADMIN="USERS_ADMIN",ae.PORTAL_ADMIN="PORTAL_ADMIN",ae.ADMIN="ADMIN",ae.DEVELOPER="DEVELOPER";const oe=e=>["PERSONAL_BOOK_USER","PERSONAL_BOOK_SHARE_USER","HTML_EXPORT_USER","PDF_EXPORT_USER","SAVED_SEARCH_USER","COLLECTION_USER","OFFLINE_USER","ANALYTICS_USER","BETA_USER","DEBUG_USER","PRINT_USER","RATING_USER","FEEDBACK_USER","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(e),le=e=>r(e)&&s(e.identifier)&&s(e.realm),ue=e=>r(e)&&(null==e.emailAddress||s(e.emailAddress))&&(null==e.displayName||s(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>oe(e)))&&(null==e.userId||s(e.userId)),ce=e=>"object"==typeof e&&null!=e,de=e=>"boolean"==typeof e,pe=e=>"number"==typeof e,he=e=>"string"==typeof e,ye=e=>ce(e)&&de(e.mailsSentByFluidTopics)&&de(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>he(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>he(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>he(e))),fe=e=>ce(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>de(e))))&&de(e.isVisible),me=e=>ce(e)&&(null==e.prettyUrl||he(e.prettyUrl))&&(null==e.hasRating||de(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||he(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>me(e)))&&(null==e.pageConfiguration||fe(e.pageConfiguration))&&(null==e.contentId||he(e.contentId))&&(null==e.title||he(e.title)),Ae=e=>ce(e)&&de(e.splitCurrentPageToc),ge={[e.FtUserRole.PERSONAL_BOOK_SHARE_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.HTML_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.PDF_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.KHUB_ADMIN]:[e.FtUserRole.CONTENT_PUBLISHER],[e.FtUserRole.ADMIN]:[e.FtUserRole.KHUB_ADMIN,e.FtUserRole.USERS_ADMIN,e.FtUserRole.PORTAL_ADMIN],[e.FtUserRole.DEVELOPER]:[e.FtUserRole.BETA_USER,e.FtUserRole.DEBUG_USER]};function be(e,t){return e===t||(ge[e]??[]).some((e=>be(e,t)))}const Ee="undefined"==typeof window?globalThis:window;function Te(e){let t={};for(let r in e){let i=e[r];("object"!=typeof i||Array.isArray(i))&&(i={prior:i});for(let e of["prior","filter"])i[e]=Array.isArray(i[e])?i[e]:[i[e]],i[e]=i[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[r]=i}return t}function Re(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Se="undefined"==typeof window?globalThis:window;class Fe extends Error{status;statusText;body;constructor(e,t,r){super(`${e} - ${t}: ${r}`),this.status=e,this.statusText=t,this.body=r}}async function Ue(e){if(!e.ok)throw new Fe(e.status,e.statusText,await e.text());return e}function Oe(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class Ie{tenantBaseUrl;ftCallingApp;authorization;searchLabel;endpoints={authentication:{login:"api/authentication/login",logout:"api/authentication/logout",currentSession:"api/authentication/current-session"},khub:{maps:{mapId:e=>({info:`api/khub/maps/${e}`,toc:`api/khub/maps/${e}/toc`,pages:`api/khub/maps/${e}/pages`,feedback:`api/khub/maps/${e}/feedback`,rating:`api/khub/maps/${e}/rating`,attachments:{list:`api/khub/maps/${e}/attachments`,attachmentId:t=>({content:`api/khub/maps/${e}/attachments/${t}/content`})},resources:{list:`api/khub/maps/${e}/resources`,resourceId:t=>({content:`api/khub/maps/${e}/resources/${t}/content`})},topics:{contentId:t=>({info:`api/khub/maps/${e}/topics/${t}`,content:`api/khub/maps/${e}/topics/${t}/content`}),tocId:t=>({feedback:`api/khub/maps/${e}/topics/${t}/feedback`,rating:`api/khub/maps/${e}/topics/${t}/rating`})}})},documents:{documentId:e=>({info:`api/khub/documents/${e}`,content:`api/khub/documents/${e}/content`,text:`api/khub/documents/${e}/content/text`,feedback:`api/khub/documents/${e}/feedback`,rating:`api/khub/documents/${e}/rating`})},suggest:"api/khub/suggest",clusteredSearch:"api/khub/clustered-search",locales:"api/khub/locales"},users:{userId:e=>({collections:{collectionId:t=>({documents:`api/users/${e}/collections/${t}/documents`})},searches:{list:`api/users/${e}/searches`},bookmarks:{list:`api/users/${e}/bookmarks`}})},stylesheets:{fonts:"api/stylesheets/fonts.css",theme:"api/stylesheets/theme.css",content:{title:"api/stylesheets/content/title.css",topic:"api/stylesheets/content/topic.css"}},configuration:{reader:"api/configuration/reader"},locales:{ui:"api/locales/ui"},messages:{locale:e=>({fluidTopics:{contextName:t=>({endpoint:`api/messages/${e}/fluid-topics/${t}`})},custom:{contextName:t=>({endpoint:`api/messages/${e}/custom/${t}`})}})}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??Se.__gwt_ft_moduleBase??Se.fluidtopicsclient?.__moduleBase??Se.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==Se.location&&Se.location.href.startsWith(this.tenantBaseUrl)?this.ftCallingApp=t:this.ftCallingApp=`ft-public-api/${t}`}setApiKey(e){this.authorization={Authorization:"Bearer "+e}}setCredentials(e,t){var r;this.authorization={Authorization:"Basic "+(r=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(r).toString("base64"):btoa(r))}}clearAuthentication(){this.authorization=void 0}setSearchLabel(e){this.searchLabel={"FT-search-label":e}}clearSearchLabel(){this.searchLabel=void 0}login(e,t){let r={login:e,password:t,rememberMe:!0};return this.post(this.endpoints.authentication.login,r).then((r=>(this.setCredentials(e,t),r)))}logout(){return this.post(this.endpoints.authentication.logout).then((()=>this.clearAuthentication()))}getCurrentSession(){return this.get(this.endpoints.authentication.currentSession)}getReaderConfiguration(){return this.get(this.endpoints.configuration.reader)}getMap(e){return this.get(this.endpoints.khub.maps.mapId(e).info)}getTableOfContent(e){return this.get(this.endpoints.khub.maps.mapId(e).toc)}getPages(e){return this.get(this.endpoints.khub.maps.mapId(e).pages)}getTopic(e,t){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).info)}getTopicHTMLContent(e,t,r){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).content+(r?"?target="+r:""))}getMapAttachments(e){return this.get(this.endpoints.khub.maps.mapId(e).attachments.list)}getMapAttachmentContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).attachments.attachmentId(t).content)}getMapResources(e){return this.get(this.endpoints.khub.maps.mapId(e).resources.list)}getMapResourceContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).resources.resourceId(t).content)}getUnstructuredDocument(e){return this.get(this.endpoints.khub.documents.documentId(e).info)}getUnstructuredDocumentContent(e){return this.fetchRawData(this.endpoints.khub.documents.documentId(e).content)}getUnstructuredDocumentTextContent(e){return this.get(this.endpoints.khub.documents.documentId(e).text)}getCollectionDocuments(e,t){return this.get(this.endpoints.users.userId(e).collections.collectionId(t).documents)}getSuggestions(e){return this.post(this.endpoints.khub.suggest,e)}search(e){return this.post(this.endpoints.khub.clusteredSearch,e)}getAvailableSearchLocales(){return this.get(this.endpoints.khub.locales)}getAvailableUiLocales(){return this.get(this.endpoints.khub.locales)}getMapRating(e){return this.get(this.endpoints.khub.maps.mapId(e).rating)}rateMap(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).rating,{type:t,value:r})}unrateMap(e){return this.delete(this.endpoints.khub.maps.mapId(e).rating)}sendMapFeedback(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).feedback,{message:t,from:r})}rateTopic(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:r,value:i})}unrateTopic(e,t){return this.delete(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating)}sendTopicFeedback(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).feedback,{message:r,from:i})}getDocumentRating(e){return this.get(this.endpoints.khub.documents.documentId(e).rating)}rateDocument(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).rating,{type:t,value:r})}unrateDocument(e){return this.delete(this.endpoints.khub.documents.documentId(e).rating)}sendDocumentFeedback(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).feedback,{message:t,from:r})}getFluidTopicsMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).fluidTopics.contextName(t).endpoint)}getCustomMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).custom.contextName(t).endpoint)}listMySearches(e){return this.get(this.endpoints.users.userId(e).searches.list)}listMyBookmarks(e){return this.get(this.endpoints.users.userId(e).bookmarks.list)}get(e){return this.makeRequest("GET",e)}post(e,t){return this.makeRequest("POST",e,t)}put(e,t){return this.makeRequest("PUT",e,t)}delete(e){return this.makeRequest("DELETE",e)}makeAbsolute(e){return this.tenantBaseUrl+e.replace(/^\//,"")}async fetch(e,t){const r=t;return await fetch(this.makeAbsolute(e),{...r??{},headers:{...this.defaultHeaders,...r?.headers??{}}})}upload(e,t,r,i=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((n,s)=>{let a=new XMLHttpRequest;a.onload=()=>{if(a.status>=200&&a.status<300){let e="application/json"===a.getResponseHeader("Content-Type")?JSON.parse(a.responseText):a.responseText;n(e)}else s(new Fe(a.status,a.statusText,a.responseText))},a.upload.onprogress=e=>i(e),a.open(e,this.makeAbsolute(t),!0),a.send(r)})):this.fetch(t,{method:e,body:r}).then(Ue).then(Oe)}makeRequest(e,t,r){return this.fetch(t,{method:e,headers:{...null!=r?{"Content-Type":"application/json"}:{}},body:null!=r?JSON.stringify(r):void 0,credentials:null==this.authorization?"include":void 0}).then(Ue).then(Oe)}fetchRawData(e){return fetch(this.makeAbsolute(e),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then(Ue).then((e=>e.arrayBuffer()))}}e.FluidTopicsApi=Ie,e.HttpError=Fe,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Ee.localStorage){const r=Re(e),i=e=>{e.storageArea===Ee.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Ee.addEventListener("storage",i),{removeHandler:()=>Ee.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=Ie,e.getUnauthenticatedUserSearchPreferences=function(e){if(Ee.localStorage)return JSON.parse(Ee.localStorage.getItem(Re(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&le(e.authenticationIdentifier)&&ue(e.profile),e.isFtAuthenticationIdentifier=le,e.isFtBookmark=e=>r(e)&&s(e.mapTitle)&&o(e.color)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.lastUpdate)&&s(e.readerUrl)&&s(e.mapId)&&s(e.id)&&s(e.title)&&s(e.creationDate),e.isFtCollectionDocument=e=>r(e)&&i(e.deleted)&&(null==e.apiUrl||s(e.apiUrl))&&(null==e.portalUrl||s(e.portalUrl))&&s(e.id)&&s(e.title)&&j(e.type),e.isFtCollectionDocumentType=j,e.isFtCredentials=e=>r(e)&&s(e.password)&&(null==e.newPassword||s(e.newPassword))&&i(e.rememberMe)&&s(e.login),e.isFtEditorialType=B,e.isFtFeedbackCreation=e=>r(e)&&(null==e.from||s(e.from))&&s(e.message),e.isFtLabeledSearchFilter=G,e.isFtMap=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&H(e.openMode)&&(null==e.topicsApiEndpoint||s(e.topicsApiEndpoint))&&(null==e.description||s(e.description))&&(null==e.attachmentsApiEndpoint||s(e.attachmentsApiEndpoint))&&B(e.editorialType)&&s(e.baseId)&&s(e.clusterId)&&s(e.title)&&s(e.lastPublication)&&s(e.lastEdition)&&s(e.originId)&&(null==e.rightsApiEndpoint||s(e.rightsApiEndpoint))&&h(e.contentStyles)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtMapAttachment=e=>ce(e)&&he(e.file)&&(null==e.size||pe(e.size))&&de(e.externalLink)&&he(e.name)&&he(e.id)&&(null==e.mimeType||he(e.mimeType))&&(null==e.viewerUrl||he(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&s(e.contentUrl)&&s(e.filename)&&s(e.id)&&s(e.mimeType),e.isFtMapStyles=h,e.isFtMessageContext=e=>r(e)&&s(e.name)&&r(e.messages)&&Object.keys(e.messages).every((e=>s(e)))&&Object.values(e.messages).every((e=>s(e)))&&s(e.locale),e.isFtMetadata=g,e.isFtMetadataPreferenceConfiguration=O,e.isFtMyLibraryColors=o,e.isFtMySearch=e=>r(e)&&b(e.searchRequest)&&o(e.color)&&i(e.alert)&&s(e.description)&&s(e.id)&&s(e.ownerId)&&s(e.title)&&s(e.creationDate),e.isFtMySearchRequest=b,e.isFtOpenMode=H,e.isFtPageConfiguration=fe,e.isFtPageRequest=K,e.isFtPaginatedToc=e=>ce(e)&&Ae(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>me(e))),e.isFtPaginatedTocNode=me,e.isFtPaginationConfiguration=Ae,e.isFtPeriod=I,e.isFtPeriodFilter=_,e.isFtPeriodFilterType=C,e.isFtPersonalBookCreation=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>c(e)))&&Array.isArray(e.nodes)&&e.nodes.every((e=>d(e)))&&s(e.description)&&s(e.title),e.isFtPersonalBookMetadataUpdate=c,e.isFtPersonalBookNodeCreation=d,e.isFtPersonalBookTopicLinkCreation=p,e.isFtPublicationRating=R,e.isFtPublicationRatingSummary=S,e.isFtRatingCreation=e=>r(e)&&T(e.type)&&n(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||U(e.topics))&&S(e.publication),e.isFtRatingType=T,e.isFtReaderConfiguration=e=>ce(e)&&ye(e.feedback)&&pe(e.loadAfterLastVisibleTopic)&&pe(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=ye,e.isFtSearchFacet=Z,e.isFtSearchFacetConf=ee,e.isFtSearchFacetEntry=te,e.isFtSearchFilter=P,e.isFtSearchLocale=A,e.isFtSearchLocales=e=>r(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>A(e))),e.isFtSearchPreferencesConfiguration=e=>r(e)&&r(e.metadata)&&Object.keys(e.metadata).every((e=>s(e)))&&Object.values(e.metadata).every((e=>O(e))),e.isFtSearchPreset=e=>r(e)&&s(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&n(e.priority)&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSearchPrior=V,e.isFtSearchRequest=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&s(e.query)&&K(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>re(e)))&&(null==e.uiLocale||s(e.uiLocale))&&(null==e.contentLocale||s(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>V(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>ee(e))),e.isFtSearchResultCluster=q,e.isFtSearchResultClusterEntry=X,e.isFtSearchResultMap=Y,e.isFtSearchResultTopic=J,e.isFtSearchResultType=Q,e.isFtSearchResultUnstructuredDocument=z,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||ie(e.spellcheck))&&M(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>q(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>Z(e))),e.isFtSearchResultsPageInfo=M,e.isFtSearchSortCriterion=re,e.isFtSearchSortCriterionOrder=L,e.isFtSearchSortCriterionType=N,e.isFtSession=e=>r(e)&&(null==e.authenticationIdentifier||le(e.authenticationIdentifier))&&n(e.idleTimeoutInMillis)&&ue(e.profile)&&i(e.sessionAuthenticated),e.isFtSpellcheck=ie,e.isFtSuggestRequest=e=>r(e)&&s(e.input)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>re(e)))&&(null==e.maxCount||n(e.maxCount))&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSuggestResult=se,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>se(e))),e.isFtTocNode=y,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&s(e.id)&&s(e.contentApiEndpoint)&&s(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicOrigin=f,e.isFtTopicOriginType=u,e.isFtTopicRating=F,e.isFtTopicResource=ne,e.isFtTopicsRatingSummary=U,e.isFtUiLocale=e=>r(e)&&s(e.displayName)&&s(e.languageTag)&&i(e.translated),e.isFtUnstructuredDocument=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>g(e)))&&s(e.openMode)&&(null==e.description||s(e.description))&&s(e.mimeType)&&(null==e.baseId||s(e.baseId))&&(null==e.clusterId||s(e.clusterId))&&s(e.contentApiEndpoint)&&s(e.title)&&(null==e.lastPublication||s(e.lastPublication))&&s(e.viewerUrl)&&s(e.lastEdition)&&s(e.filename)&&(null==e.originId||s(e.originId))&&s(e.rightsApiEndpoint)&&(null==e.originUrl||s(e.originUrl))&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtUserProfile=ue,e.isFtUserRole=oe,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Ee.localStorage){let r={...t,metadata:Te(t.metadata??{})};const i=Re(e),n=JSON.stringify(r);return Ee.localStorage.setItem(i,n),Ee.dispatchEvent(new StorageEvent("storage",{key:i,newValue:n,storageArea:Ee.localStorage,url:Ee.location.href})),r}console.error("Cannot set unauthenticated preferences: local storage is unavailable.")},e.userHasRole=function(e,t){return null!=e&&(Array.isArray(e)?e:Array.isArray(e.roles)?e.roles:Array.isArray(e.profile?.roles)?e.profile.roles:[]).some((e=>be(e,t)))}}));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FtSession, FtUserProfile, FtUserRole, FtUserRoleKeys } from "../types/ft-common/public";
|
|
2
|
-
export declare function userHasRole(sessionOrProfileOrRoles: FtSession | FtUserProfile | Array<FtUserRole | FtUserRoleKeys
|
|
2
|
+
export declare function userHasRole(sessionOrProfileOrRoles: FtSession | FtUserProfile | Array<FtUserRole | FtUserRoleKeys> | undefined, expectedRole: FtUserRole | FtUserRoleKeys): boolean;
|
package/dist/mjs/roles/roles.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FtUserRole
|
|
1
|
+
import { FtUserRole } from "../types/ft-common/public";
|
|
2
2
|
const rolesInheritance = {
|
|
3
3
|
[FtUserRole.PERSONAL_BOOK_SHARE_USER]: [FtUserRole.PERSONAL_BOOK_USER],
|
|
4
4
|
[FtUserRole.HTML_EXPORT_USER]: [FtUserRole.PERSONAL_BOOK_USER],
|
|
@@ -11,10 +11,15 @@ function roleMatches(actual, expected) {
|
|
|
11
11
|
return actual === expected || (rolesInheritance[actual] ?? []).some((inherited) => roleMatches(inherited, expected));
|
|
12
12
|
}
|
|
13
13
|
export function userHasRole(sessionOrProfileOrRoles, expectedRole) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
if (sessionOrProfileOrRoles == null) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const roles = Array.isArray(sessionOrProfileOrRoles)
|
|
18
|
+
? sessionOrProfileOrRoles
|
|
19
|
+
: Array.isArray(sessionOrProfileOrRoles.roles)
|
|
17
20
|
? sessionOrProfileOrRoles.roles
|
|
18
|
-
: sessionOrProfileOrRoles
|
|
21
|
+
: Array.isArray(sessionOrProfileOrRoles.profile?.roles)
|
|
22
|
+
? sessionOrProfileOrRoles.profile.roles
|
|
23
|
+
: [];
|
|
19
24
|
return roles.some(role => roleMatches(role, expectedRole));
|
|
20
25
|
}
|
|
@@ -76,9 +76,9 @@ export interface FtMap {
|
|
|
76
76
|
prettyUrl?: string;
|
|
77
77
|
metadata: Array<FtMetadata>;
|
|
78
78
|
openMode: FtOpenModeKeys | FtOpenMode;
|
|
79
|
-
topicsApiEndpoint
|
|
79
|
+
topicsApiEndpoint?: string;
|
|
80
80
|
description?: string;
|
|
81
|
-
attachmentsApiEndpoint
|
|
81
|
+
attachmentsApiEndpoint?: string;
|
|
82
82
|
editorialType: FtEditorialTypeKeys | FtEditorialType;
|
|
83
83
|
baseId: string;
|
|
84
84
|
clusterId: string;
|
|
@@ -86,11 +86,11 @@ export interface FtMap {
|
|
|
86
86
|
lastPublication: string;
|
|
87
87
|
lastEdition: string;
|
|
88
88
|
originId: string;
|
|
89
|
-
rightsApiEndpoint
|
|
89
|
+
rightsApiEndpoint?: string;
|
|
90
90
|
contentStyles: FtMapStyles;
|
|
91
91
|
originUrl?: string;
|
|
92
92
|
readerUrl: string;
|
|
93
|
-
khubVersion
|
|
93
|
+
khubVersion?: string;
|
|
94
94
|
id: string;
|
|
95
95
|
lang?: string;
|
|
96
96
|
}
|
|
@@ -320,7 +320,8 @@ export interface FtSearchResultsPageInfo {
|
|
|
320
320
|
export declare const isFtSearchResultsPageInfo: (o: any) => o is FtSearchResultsPageInfo;
|
|
321
321
|
export declare enum FtEditorialType {
|
|
322
322
|
ARTICLE = "ARTICLE",
|
|
323
|
-
BOOK = "BOOK"
|
|
323
|
+
BOOK = "BOOK",
|
|
324
|
+
SHARED_BOOK = "SHARED_BOOK"
|
|
324
325
|
}
|
|
325
326
|
export type FtEditorialTypeKeys = keyof typeof FtEditorialType;
|
|
326
327
|
export declare const isFtEditorialType: (o: any) => o is FtEditorialType;
|
|
@@ -93,9 +93,9 @@ export const isFtMap = (o) => {
|
|
|
93
93
|
&& ((Array.isArray(o.metadata)
|
|
94
94
|
&& o.metadata.every((v) => isFtMetadata(v))))
|
|
95
95
|
&& (isFtOpenMode(o.openMode))
|
|
96
|
-
&& (isString(o.topicsApiEndpoint))
|
|
96
|
+
&& (o.topicsApiEndpoint == null || isString(o.topicsApiEndpoint))
|
|
97
97
|
&& (o.description == null || isString(o.description))
|
|
98
|
-
&& (isString(o.attachmentsApiEndpoint))
|
|
98
|
+
&& (o.attachmentsApiEndpoint == null || isString(o.attachmentsApiEndpoint))
|
|
99
99
|
&& (isFtEditorialType(o.editorialType))
|
|
100
100
|
&& (isString(o.baseId))
|
|
101
101
|
&& (isString(o.clusterId))
|
|
@@ -103,11 +103,11 @@ export const isFtMap = (o) => {
|
|
|
103
103
|
&& (isString(o.lastPublication))
|
|
104
104
|
&& (isString(o.lastEdition))
|
|
105
105
|
&& (isString(o.originId))
|
|
106
|
-
&& (isString(o.rightsApiEndpoint))
|
|
106
|
+
&& (o.rightsApiEndpoint == null || isString(o.rightsApiEndpoint))
|
|
107
107
|
&& (isFtMapStyles(o.contentStyles))
|
|
108
108
|
&& (o.originUrl == null || isString(o.originUrl))
|
|
109
109
|
&& (isString(o.readerUrl))
|
|
110
|
-
&& (isString(o.khubVersion))
|
|
110
|
+
&& (o.khubVersion == null || isString(o.khubVersion))
|
|
111
111
|
&& (isString(o.id))
|
|
112
112
|
&& (o.lang == null || isString(o.lang));
|
|
113
113
|
};
|
|
@@ -374,9 +374,10 @@ export var FtEditorialType;
|
|
|
374
374
|
(function (FtEditorialType) {
|
|
375
375
|
FtEditorialType["ARTICLE"] = "ARTICLE";
|
|
376
376
|
FtEditorialType["BOOK"] = "BOOK";
|
|
377
|
+
FtEditorialType["SHARED_BOOK"] = "SHARED_BOOK";
|
|
377
378
|
})(FtEditorialType || (FtEditorialType = {}));
|
|
378
379
|
export const isFtEditorialType = (o) => {
|
|
379
|
-
return ["ARTICLE", "BOOK"].includes(o);
|
|
380
|
+
return ["ARTICLE", "BOOK", "SHARED_BOOK"].includes(o);
|
|
380
381
|
};
|
|
381
382
|
// From: WsOpenMode
|
|
382
383
|
export var FtOpenMode;
|