@fluid-topics/public-api 1.0.45 → 1.0.47

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 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
- - Release with `npm release`
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
- .then((ftMap: FtMap) => console.log(ftMap))
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
- .then(ftMap => console.log(ftMap))
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
- .then(ftMap => console.log(ftMap))
70
+ .then(ftMap => console.log(ftMap))
71
71
  ```
72
72
 
73
73
  ### Result
@@ -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
- const roles = (0, public_1.isFtSession)(sessionOrProfileOrRoles)
19
- ? sessionOrProfileOrRoles.profile.roles
20
- : (0, public_1.isFtUserProfile)(sessionOrProfileOrRoles)
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;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FtEditorialType = exports.isFtSearchResultsPageInfo = exports.isFtSearchSortCriterionType = exports.FtSearchSortCriterionType = exports.isFtSearchSortCriterionOrder = exports.FtSearchSortCriterionOrder = exports.isFtSearchPreset = exports.isFtSearchFilter = exports.isFtPeriodFilterType = exports.FtPeriodFilterType = exports.isFtPeriodFilter = exports.isFtPeriod = exports.isFtSearchPreferencesConfiguration = exports.isFtMetadataPreferenceConfiguration = exports.isFtMapResource = exports.isFtTopicsRatingSummary = exports.isFtTopicRating = exports.isFtRatingSummary = exports.isFtRatingCreation = exports.isFtPublicationRatingSummary = exports.isFtPublicationRating = exports.isFtRatingType = exports.FtRatingType = exports.isFtMySearchRequest = exports.isFtMySearch = exports.isFtMetadata = exports.isFtUiLocale = exports.isFtMessageContext = exports.isFtSearchLocales = exports.isFtSearchLocale = exports.isFtFeedbackCreation = exports.isFtTopicContentTarget = exports.FtTopicContentTarget = exports.isFtUnstructuredDocument = exports.isFtTopicOrigin = exports.isFtTopic = exports.isFtTocNode = exports.isFtMapStyles = exports.isFtMap = exports.isFtCollectionDocument = exports.isFtBookmark = exports.isFtPersonalBookTopicLinkCreation = exports.isFtPersonalBookNodeCreation = exports.isFtPersonalBookMetadataUpdate = exports.isFtPersonalBookCreation = exports.isFtCredentials = exports.isFtTopicOriginType = exports.FtTopicOriginType = exports.isFtMyLibraryColors = exports.FtMyLibraryColors = void 0;
4
- exports.isFtUserProfile = exports.isFtSession = exports.isFtAuthenticatedSession = exports.isFtAuthenticationIdentifier = exports.isFtUserRole = exports.FtUserRole = exports.isFtSuggestResults = exports.isFtSuggestResult = exports.isFtSuggestRequest = exports.isFtTopicResource = exports.isFtSpellcheck = exports.isFtSearchSortCriterion = exports.isFtSearchFacetEntry = exports.isFtSearchFacetConf = exports.isFtSearchFacet = exports.isFtSearchResultType = exports.FtSearchResultType = exports.isFtSearchResultTopic = exports.isFtSearchResultMap = exports.isFtSearchResultUnstructuredDocument = exports.isFtSearchResultClusterEntry = exports.isFtSearchResultCluster = exports.isFtSearchRequest = exports.isFtSearchPrior = exports.isFtLabeledSearchFilter = exports.isFtSearchResults = exports.isFtCollectionDocumentType = exports.FtCollectionDocumentType = exports.isFtPageRequest = exports.isFtOpenMode = exports.FtOpenMode = exports.isFtEditorialType = void 0;
3
+ exports.isFtVirtualField = exports.FtVirtualField = exports.isFtSearchSortCriterionType = exports.FtSearchSortCriterionType = exports.isFtSearchSortCriterionOrder = exports.FtSearchSortCriterionOrder = exports.isFtSearchPreset = exports.isFtSearchFilter = exports.isFtPeriodFilterType = exports.FtPeriodFilterType = exports.isFtPeriodFilter = exports.isFtPeriod = exports.isFtSearchPreferencesConfiguration = exports.isFtMetadataPreferenceConfiguration = exports.isFtMapResource = exports.isFtTopicsRatingSummary = exports.isFtTopicRating = exports.isFtRatingSummary = exports.isFtRatingCreation = exports.isFtPublicationRatingSummary = exports.isFtPublicationRating = exports.isFtRatingType = exports.FtRatingType = exports.isFtMySearchRequest = exports.isFtMySearch = exports.isFtMetadata = exports.isFtUiLocale = exports.isFtMessageContext = exports.isFtSearchLocales = exports.isFtSearchLocale = exports.isFtFeedbackCreation = exports.isFtTopicContentTarget = exports.FtTopicContentTarget = exports.isFtUnstructuredDocument = exports.isFtTopicOrigin = exports.isFtTopic = exports.isFtTocNode = exports.isFtMapStyles = exports.isFtMap = exports.isFtCollectionDocument = exports.isFtBookmark = exports.isFtPersonalBookTopicLinkCreation = exports.isFtPersonalBookNodeCreation = exports.isFtPersonalBookMetadataUpdate = exports.isFtPersonalBookCreation = exports.isFtCredentials = exports.isFtTopicOriginType = exports.FtTopicOriginType = exports.isFtMyLibraryColors = exports.FtMyLibraryColors = void 0;
4
+ exports.isFtUserProfile = exports.isFtSession = exports.isFtAuthenticatedSession = exports.isFtAuthenticationIdentifier = exports.isFtUserRole = exports.FtUserRole = exports.isFtSuggestResults = exports.isFtSuggestResult = exports.isFtSuggestRequest = exports.isFtTopicResource = exports.isFtSpellcheck = exports.isFtSearchSortCriterion = exports.isFtSearchFacetEntry = exports.isFtSearchFacetConf = exports.isFtSearchFacet = exports.isFtSearchScope = exports.FtSearchScope = exports.isFtSearchResultType = exports.FtSearchResultType = exports.isFtSearchResultTopic = exports.isFtSearchResultMap = exports.isFtSearchResultUnstructuredDocument = exports.isFtSearchResultClusterEntry = exports.isFtSearchResultCluster = exports.isFtSearchRequest = exports.isFtSearchPrior = exports.isFtLabeledSearchFilter = exports.isFtSearchResults = exports.isFtCollectionDocumentType = exports.FtCollectionDocumentType = exports.isFtPageRequest = exports.isFtOpenMode = exports.FtOpenMode = exports.isFtEditorialType = exports.FtEditorialType = exports.isFtSearchResultsPageInfo = void 0;
5
5
  const isObject = (o) => typeof o === "object" && o != null;
6
6
  const isBoolean = (o) => typeof o === "boolean";
7
7
  const isNumber = (o) => typeof o === "number";
@@ -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
  };
@@ -264,10 +264,12 @@ const isFtMySearchRequest = (o) => {
264
264
  return isObject(o)
265
265
  && (o.periodFilter == null || (0, exports.isFtPeriodFilter)(o.periodFilter))
266
266
  && (isString(o.query))
267
+ && (o.scope == null || (0, exports.isFtSearchScope)(o.scope))
267
268
  && ((Array.isArray(o.filters)
268
269
  && o.filters.every((v) => (0, exports.isFtLabeledSearchFilter)(v))))
269
270
  && ((Array.isArray(o.sort)
270
271
  && o.sort.every((v) => (0, exports.isFtSearchSortCriterion)(v))))
272
+ && (o.virtualField == null || (0, exports.isFtVirtualField)(o.virtualField))
271
273
  && (o.contentLocale == null || isString(o.contentLocale));
272
274
  };
273
275
  exports.isFtMySearchRequest = isFtMySearchRequest;
@@ -407,6 +409,17 @@ const isFtSearchSortCriterionType = (o) => {
407
409
  return ["ALPHA", "NATURAL"].includes(o);
408
410
  };
409
411
  exports.isFtSearchSortCriterionType = isFtSearchSortCriterionType;
412
+ // From: VirtualField
413
+ var FtVirtualField;
414
+ (function (FtVirtualField) {
415
+ FtVirtualField["EVERYWHERE"] = "EVERYWHERE";
416
+ FtVirtualField["TITLE_ONLY"] = "TITLE_ONLY";
417
+ FtVirtualField["NONE"] = "NONE";
418
+ })(FtVirtualField = exports.FtVirtualField || (exports.FtVirtualField = {}));
419
+ const isFtVirtualField = (o) => {
420
+ return ["EVERYWHERE", "TITLE_ONLY", "NONE"].includes(o);
421
+ };
422
+ exports.isFtVirtualField = isFtVirtualField;
410
423
  const isFtSearchResultsPageInfo = (o) => {
411
424
  return isObject(o)
412
425
  && (isNumber(o.totalResultsCount))
@@ -420,9 +433,10 @@ var FtEditorialType;
420
433
  (function (FtEditorialType) {
421
434
  FtEditorialType["ARTICLE"] = "ARTICLE";
422
435
  FtEditorialType["BOOK"] = "BOOK";
436
+ FtEditorialType["SHARED_BOOK"] = "SHARED_BOOK";
423
437
  })(FtEditorialType = exports.FtEditorialType || (exports.FtEditorialType = {}));
424
438
  const isFtEditorialType = (o) => {
425
- return ["ARTICLE", "BOOK"].includes(o);
439
+ return ["ARTICLE", "BOOK", "SHARED_BOOK"].includes(o);
426
440
  };
427
441
  exports.isFtEditorialType = isFtEditorialType;
428
442
  // From: WsOpenMode
@@ -484,12 +498,14 @@ const isFtSearchRequest = (o) => {
484
498
  return isObject(o)
485
499
  && (o.periodFilter == null || (0, exports.isFtPeriodFilter)(o.periodFilter))
486
500
  && (isString(o.query))
501
+ && (o.scope == null || (0, exports.isFtSearchScope)(o.scope))
487
502
  && ((0, exports.isFtPageRequest)(o.paging))
488
503
  && ((Array.isArray(o.filters)
489
504
  && o.filters.every((v) => (0, exports.isFtSearchFilter)(v))))
490
505
  && ((Array.isArray(o.sort)
491
506
  && o.sort.every((v) => (0, exports.isFtSearchSortCriterion)(v))))
492
507
  && (o.uiLocale == null || isString(o.uiLocale))
508
+ && (o.virtualField == null || (0, exports.isFtVirtualField)(o.virtualField))
493
509
  && (o.contentLocale == null || isString(o.contentLocale))
494
510
  && (o.priors == null || (Array.isArray(o.priors)
495
511
  && o.priors.every((v) => (0, exports.isFtSearchPrior)(v))))
@@ -582,6 +598,16 @@ const isFtSearchResultType = (o) => {
582
598
  return ["MAP", "DOCUMENT", "TOPIC"].includes(o);
583
599
  };
584
600
  exports.isFtSearchResultType = isFtSearchResultType;
601
+ // From: WsPublicSearchScope
602
+ var FtSearchScope;
603
+ (function (FtSearchScope) {
604
+ FtSearchScope["DEFAULT"] = "DEFAULT";
605
+ FtSearchScope["DOCUMENTS"] = "DOCUMENTS";
606
+ })(FtSearchScope = exports.FtSearchScope || (exports.FtSearchScope = {}));
607
+ const isFtSearchScope = (o) => {
608
+ return ["DEFAULT", "DOCUMENTS"].includes(o);
609
+ };
610
+ exports.isFtSearchScope = isFtSearchScope;
585
611
  const isFtSearchFacet = (o) => {
586
612
  return isObject(o)
587
613
  && (isBoolean(o.hierarchical))
@@ -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>, expectedRole: FtUserRole | FtUserRoleKeys): boolean;
2
+ export declare function userHasRole(sessionOrProfileOrRoles: FtSession | FtUserProfile | Array<FtUserRole | FtUserRoleKeys> | undefined, expectedRole: FtUserRole | FtUserRoleKeys): boolean;
@@ -1,4 +1,4 @@
1
- import { FtUserRole, isFtSession, isFtUserProfile } from "../types/ft-common/public";
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
- const roles = isFtSession(sessionOrProfileOrRoles)
15
- ? sessionOrProfileOrRoles.profile.roles
16
- : isFtUserProfile(sessionOrProfileOrRoles)
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: string;
79
+ topicsApiEndpoint?: string;
80
80
  description?: string;
81
- attachmentsApiEndpoint: string;
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: string;
89
+ rightsApiEndpoint?: string;
90
90
  contentStyles: FtMapStyles;
91
91
  originUrl?: string;
92
92
  readerUrl: string;
93
- khubVersion: string;
93
+ khubVersion?: string;
94
94
  id: string;
95
95
  lang?: string;
96
96
  }
@@ -206,8 +206,10 @@ export declare const isFtMySearch: (o: any) => o is FtMySearch;
206
206
  export interface FtMySearchRequest {
207
207
  periodFilter?: FtPeriodFilter;
208
208
  query: string;
209
+ scope?: FtSearchScopeKeys | FtSearchScope;
209
210
  filters: Array<FtLabeledSearchFilter>;
210
211
  sort: Array<FtSearchSortCriterion>;
212
+ virtualField?: FtVirtualFieldKeys | FtVirtualField;
211
213
  contentLocale?: string;
212
214
  }
213
215
  export declare const isFtMySearchRequest: (o: any) => o is FtMySearchRequest;
@@ -311,6 +313,13 @@ export declare enum FtSearchSortCriterionType {
311
313
  }
312
314
  export type FtSearchSortCriterionTypeKeys = keyof typeof FtSearchSortCriterionType;
313
315
  export declare const isFtSearchSortCriterionType: (o: any) => o is FtSearchSortCriterionType;
316
+ export declare enum FtVirtualField {
317
+ EVERYWHERE = "EVERYWHERE",
318
+ TITLE_ONLY = "TITLE_ONLY",
319
+ NONE = "NONE"
320
+ }
321
+ export type FtVirtualFieldKeys = keyof typeof FtVirtualField;
322
+ export declare const isFtVirtualField: (o: any) => o is FtVirtualField;
314
323
  export interface FtSearchResultsPageInfo {
315
324
  totalResultsCount: number;
316
325
  isLastPage: boolean;
@@ -320,7 +329,8 @@ export interface FtSearchResultsPageInfo {
320
329
  export declare const isFtSearchResultsPageInfo: (o: any) => o is FtSearchResultsPageInfo;
321
330
  export declare enum FtEditorialType {
322
331
  ARTICLE = "ARTICLE",
323
- BOOK = "BOOK"
332
+ BOOK = "BOOK",
333
+ SHARED_BOOK = "SHARED_BOOK"
324
334
  }
325
335
  export type FtEditorialTypeKeys = keyof typeof FtEditorialType;
326
336
  export declare const isFtEditorialType: (o: any) => o is FtEditorialType;
@@ -367,11 +377,13 @@ export declare const isFtSearchPrior: (o: any) => o is FtSearchPrior;
367
377
  export interface FtSearchRequest {
368
378
  periodFilter?: FtPeriodFilter;
369
379
  query: string;
380
+ scope?: FtSearchScopeKeys | FtSearchScope;
370
381
  paging: FtPageRequest;
371
382
  filters: Array<FtSearchFilter>;
372
383
  sort: Array<FtSearchSortCriterion>;
373
384
  lastModified?: any;
374
385
  uiLocale?: string;
386
+ virtualField?: FtVirtualFieldKeys | FtVirtualField;
375
387
  contentLocale?: string;
376
388
  priors?: Array<FtSearchPrior>;
377
389
  facets: Array<FtSearchFacetConf>;
@@ -450,6 +462,12 @@ export declare enum FtSearchResultType {
450
462
  }
451
463
  export type FtSearchResultTypeKeys = keyof typeof FtSearchResultType;
452
464
  export declare const isFtSearchResultType: (o: any) => o is FtSearchResultType;
465
+ export declare enum FtSearchScope {
466
+ DEFAULT = "DEFAULT",
467
+ DOCUMENTS = "DOCUMENTS"
468
+ }
469
+ export type FtSearchScopeKeys = keyof typeof FtSearchScope;
470
+ export declare const isFtSearchScope: (o: any) => o is FtSearchScope;
453
471
  export interface FtSearchFacet {
454
472
  hierarchical: boolean;
455
473
  label: string;
@@ -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
  };
@@ -237,10 +237,12 @@ export const isFtMySearchRequest = (o) => {
237
237
  return isObject(o)
238
238
  && (o.periodFilter == null || isFtPeriodFilter(o.periodFilter))
239
239
  && (isString(o.query))
240
+ && (o.scope == null || isFtSearchScope(o.scope))
240
241
  && ((Array.isArray(o.filters)
241
242
  && o.filters.every((v) => isFtLabeledSearchFilter(v))))
242
243
  && ((Array.isArray(o.sort)
243
244
  && o.sort.every((v) => isFtSearchSortCriterion(v))))
245
+ && (o.virtualField == null || isFtVirtualField(o.virtualField))
244
246
  && (o.contentLocale == null || isString(o.contentLocale));
245
247
  };
246
248
  // From: RatingType
@@ -362,6 +364,16 @@ export var FtSearchSortCriterionType;
362
364
  export const isFtSearchSortCriterionType = (o) => {
363
365
  return ["ALPHA", "NATURAL"].includes(o);
364
366
  };
367
+ // From: VirtualField
368
+ export var FtVirtualField;
369
+ (function (FtVirtualField) {
370
+ FtVirtualField["EVERYWHERE"] = "EVERYWHERE";
371
+ FtVirtualField["TITLE_ONLY"] = "TITLE_ONLY";
372
+ FtVirtualField["NONE"] = "NONE";
373
+ })(FtVirtualField || (FtVirtualField = {}));
374
+ export const isFtVirtualField = (o) => {
375
+ return ["EVERYWHERE", "TITLE_ONLY", "NONE"].includes(o);
376
+ };
365
377
  export const isFtSearchResultsPageInfo = (o) => {
366
378
  return isObject(o)
367
379
  && (isNumber(o.totalResultsCount))
@@ -374,9 +386,10 @@ export var FtEditorialType;
374
386
  (function (FtEditorialType) {
375
387
  FtEditorialType["ARTICLE"] = "ARTICLE";
376
388
  FtEditorialType["BOOK"] = "BOOK";
389
+ FtEditorialType["SHARED_BOOK"] = "SHARED_BOOK";
377
390
  })(FtEditorialType || (FtEditorialType = {}));
378
391
  export const isFtEditorialType = (o) => {
379
- return ["ARTICLE", "BOOK"].includes(o);
392
+ return ["ARTICLE", "BOOK", "SHARED_BOOK"].includes(o);
380
393
  };
381
394
  // From: WsOpenMode
382
395
  export var FtOpenMode;
@@ -431,12 +444,14 @@ export const isFtSearchRequest = (o) => {
431
444
  return isObject(o)
432
445
  && (o.periodFilter == null || isFtPeriodFilter(o.periodFilter))
433
446
  && (isString(o.query))
447
+ && (o.scope == null || isFtSearchScope(o.scope))
434
448
  && (isFtPageRequest(o.paging))
435
449
  && ((Array.isArray(o.filters)
436
450
  && o.filters.every((v) => isFtSearchFilter(v))))
437
451
  && ((Array.isArray(o.sort)
438
452
  && o.sort.every((v) => isFtSearchSortCriterion(v))))
439
453
  && (o.uiLocale == null || isString(o.uiLocale))
454
+ && (o.virtualField == null || isFtVirtualField(o.virtualField))
440
455
  && (o.contentLocale == null || isString(o.contentLocale))
441
456
  && (o.priors == null || (Array.isArray(o.priors)
442
457
  && o.priors.every((v) => isFtSearchPrior(v))))
@@ -522,6 +537,15 @@ export var FtSearchResultType;
522
537
  export const isFtSearchResultType = (o) => {
523
538
  return ["MAP", "DOCUMENT", "TOPIC"].includes(o);
524
539
  };
540
+ // From: WsPublicSearchScope
541
+ export var FtSearchScope;
542
+ (function (FtSearchScope) {
543
+ FtSearchScope["DEFAULT"] = "DEFAULT";
544
+ FtSearchScope["DOCUMENTS"] = "DOCUMENTS";
545
+ })(FtSearchScope || (FtSearchScope = {}));
546
+ export const isFtSearchScope = (o) => {
547
+ return ["DEFAULT", "DOCUMENTS"].includes(o);
548
+ };
525
549
  export const isFtSearchFacet = (o) => {
526
550
  return isObject(o)
527
551
  && (isBoolean(o.hierarchical))
@@ -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 E=[301,302,303,307,308];A.redirect=function(e,t){if(-1===E.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 g(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)}))}g.polyfill=!0,e.fetch||(e.fetch=g,e.Headers=l,e.Request=f,e.Response=A),t.Headers=l,t.Request=f,t.Response=A,t.fetch=g,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)),E=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),g=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&s(e.query)&&(null==e.scope||re(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>q(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ae(e)))&&(null==e.virtualField||w(e.virtualField))&&(null==e.contentLocale||s(e.contentLocale));var b;e.FtRatingType=void 0,(b=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",b.LIKE="LIKE",b.DICHOTOMOUS="DICHOTOMOUS",b.NO_RATING="NO_RATING";const T=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),S=e=>r(e)&&s(e.date)&&T(e.type)&&n(e.value),R=e=>r(e)&&(null==e.rating||S(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 N;e.FtSearchSortCriterionType=void 0,(N=e.FtSearchSortCriterionType||(e.FtSearchSortCriterionType={})).ALPHA="ALPHA",N.NATURAL="NATURAL";const k=e=>["ALPHA","NATURAL"].includes(e);var M;e.FtVirtualField=void 0,(M=e.FtVirtualField||(e.FtVirtualField={})).EVERYWHERE="EVERYWHERE",M.TITLE_ONLY="TITLE_ONLY",M.NONE="NONE";const w=e=>["EVERYWHERE","TITLE_ONLY","NONE"].includes(e),B=e=>r(e)&&n(e.totalResultsCount)&&i(e.isLastPage)&&n(e.currentPage)&&n(e.totalClustersCount);var x;e.FtEditorialType=void 0,(x=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",x.BOOK="BOOK",x.SHARED_BOOK="SHARED_BOOK";const H=e=>["ARTICLE","BOOK","SHARED_BOOK"].includes(e);var K;e.FtOpenMode=void 0,(K=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",K.EXTERNAL="EXTERNAL";const $=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),j=e=>r(e)&&(null==e.perPage||n(e.perPage))&&n(e.page);var V;e.FtCollectionDocumentType=void 0,(V=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",V.DOCUMENT="DOCUMENT",V.TOPIC="TOPIC",V.PERSONAL_BOOK="PERSONAL_BOOK",V.SHARED_BOOK="SHARED_BOOK";const G=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),q=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.label)&&s(e.key),X=e=>r(e)&&n(e.weight)&&s(e.value)&&s(e.key),Y=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>z(e)))&&(null==e.metadataVariableAxis||s(e.metadataVariableAxis)),z=e=>r(e)&&(null==e.document||W(e.document))&&(null==e.topic||Q(e.topic))&&ee(e.type)&&(null==e.map||J(e.map)),W=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&$(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),J=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&(null==e.openMode||$(e.openMode))&&H(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),Q=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&$(e.openMode)&&s(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>le(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 Z;e.FtSearchResultType=void 0,(Z=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",Z.DOCUMENT="DOCUMENT",Z.TOPIC="TOPIC";const ee=e=>["MAP","DOCUMENT","TOPIC"].includes(e);var te;e.FtSearchScope=void 0,(te=e.FtSearchScope||(e.FtSearchScope={})).DEFAULT="DEFAULT",te.DOCUMENTS="DOCUMENTS";const re=e=>["DEFAULT","DOCUMENTS"].includes(e),ie=e=>r(e)&&i(e.hierarchical)&&s(e.label)&&i(e.multiSelectionable)&&s(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>se(e))),ne=e=>r(e)&&(null==e.maxDepth||n(e.maxDepth))&&s(e.id),se=e=>r(e)&&n(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>se(e)))&&s(e.label)&&s(e.value)&&i(e.selected),ae=e=>r(e)&&k(e.type)&&s(e.key)&&L(e.order),oe=e=>r(e)&&s(e.suggestedQuery)&&s(e.htmlSuggestedQuery),le=e=>r(e)&&s(e.filename)&&s(e.resourceUrl)&&s(e.id)&&s(e.mimeType)&&s(e.resourceContentUrl)&&s(e.viewerUrl),ue=e=>r(e)&&(null==e.filenameExtension||s(e.filenameExtension))&&(null==e.editorialType||H(e.editorialType))&&(null==e.mimeType||s(e.mimeType))&&ee(e.type)&&s(e.value);var ce;e.FtUserRole=void 0,(ce=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",ce.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",ce.HTML_EXPORT_USER="HTML_EXPORT_USER",ce.PDF_EXPORT_USER="PDF_EXPORT_USER",ce.SAVED_SEARCH_USER="SAVED_SEARCH_USER",ce.COLLECTION_USER="COLLECTION_USER",ce.OFFLINE_USER="OFFLINE_USER",ce.ANALYTICS_USER="ANALYTICS_USER",ce.BETA_USER="BETA_USER",ce.DEBUG_USER="DEBUG_USER",ce.PRINT_USER="PRINT_USER",ce.RATING_USER="RATING_USER",ce.FEEDBACK_USER="FEEDBACK_USER",ce.CONTENT_PUBLISHER="CONTENT_PUBLISHER",ce.KHUB_ADMIN="KHUB_ADMIN",ce.USERS_ADMIN="USERS_ADMIN",ce.PORTAL_ADMIN="PORTAL_ADMIN",ce.ADMIN="ADMIN",ce.DEVELOPER="DEVELOPER";const de=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),pe=e=>r(e)&&s(e.identifier)&&s(e.realm),he=e=>r(e)&&(null==e.emailAddress||s(e.emailAddress))&&(null==e.displayName||s(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>de(e)))&&(null==e.userId||s(e.userId)),ye=e=>"object"==typeof e&&null!=e,fe=e=>"boolean"==typeof e,me=e=>"number"==typeof e,Ae=e=>"string"==typeof e,Ee=e=>ye(e)&&fe(e.mailsSentByFluidTopics)&&fe(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>Ae(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>Ae(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>Ae(e))),ge=e=>ye(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>fe(e))))&&fe(e.isVisible),be=e=>ye(e)&&(null==e.prettyUrl||Ae(e.prettyUrl))&&(null==e.hasRating||fe(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||Ae(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>be(e)))&&(null==e.pageConfiguration||ge(e.pageConfiguration))&&(null==e.contentId||Ae(e.contentId))&&(null==e.title||Ae(e.title)),Te=e=>ye(e)&&fe(e.splitCurrentPageToc),Se={[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 Re(e,t){return e===t||(Se[e]??[]).some((e=>Re(e,t)))}const Fe="undefined"==typeof window?globalThis:window;function Ue(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 Oe(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Ie="undefined"==typeof window?globalThis:window;class _e extends Error{status;statusText;body;constructor(e,t,r){super(`${e} - ${t}: ${r}`),this.status=e,this.statusText=t,this.body=r}}async function ve(e){if(!e.ok)throw new _e(e.status,e.statusText,await e.text());return e}function Ce(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class Pe{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??Ie.__gwt_ft_moduleBase??Ie.fluidtopicsclient?.__moduleBase??Ie.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==Ie.location&&Ie.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 _e(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(ve).then(Ce)}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(ve).then(Ce)}fetchRawData(e){return fetch(this.makeAbsolute(e),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then(ve).then((e=>e.arrayBuffer()))}}e.FluidTopicsApi=Pe,e.HttpError=_e,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Fe.localStorage){const r=Oe(e),i=e=>{e.storageArea===Fe.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Fe.addEventListener("storage",i),{removeHandler:()=>Fe.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=Pe,e.getUnauthenticatedUserSearchPreferences=function(e){if(Fe.localStorage)return JSON.parse(Fe.localStorage.getItem(Oe(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&pe(e.authenticationIdentifier)&&he(e.profile),e.isFtAuthenticationIdentifier=pe,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)&&G(e.type),e.isFtCollectionDocumentType=G,e.isFtCredentials=e=>r(e)&&s(e.password)&&(null==e.newPassword||s(e.newPassword))&&i(e.rememberMe)&&s(e.login),e.isFtEditorialType=H,e.isFtFeedbackCreation=e=>r(e)&&(null==e.from||s(e.from))&&s(e.message),e.isFtLabeledSearchFilter=q,e.isFtMap=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&$(e.openMode)&&(null==e.topicsApiEndpoint||s(e.topicsApiEndpoint))&&(null==e.description||s(e.description))&&(null==e.attachmentsApiEndpoint||s(e.attachmentsApiEndpoint))&&H(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=>ye(e)&&Ae(e.file)&&(null==e.size||me(e.size))&&fe(e.externalLink)&&Ae(e.name)&&Ae(e.id)&&(null==e.mimeType||Ae(e.mimeType))&&(null==e.viewerUrl||Ae(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=E,e.isFtMetadataPreferenceConfiguration=O,e.isFtMyLibraryColors=o,e.isFtMySearch=e=>r(e)&&g(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=g,e.isFtOpenMode=$,e.isFtPageConfiguration=ge,e.isFtPageRequest=j,e.isFtPaginatedToc=e=>ye(e)&&Te(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>be(e))),e.isFtPaginatedTocNode=be,e.isFtPaginationConfiguration=Te,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=S,e.isFtPublicationRatingSummary=R,e.isFtRatingCreation=e=>r(e)&&T(e.type)&&n(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||U(e.topics))&&R(e.publication),e.isFtRatingType=T,e.isFtReaderConfiguration=e=>ye(e)&&Ee(e.feedback)&&me(e.loadAfterLastVisibleTopic)&&me(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=Ee,e.isFtSearchFacet=ie,e.isFtSearchFacetConf=ne,e.isFtSearchFacetEntry=se,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=X,e.isFtSearchRequest=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&s(e.query)&&(null==e.scope||re(e.scope))&&j(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ae(e)))&&(null==e.uiLocale||s(e.uiLocale))&&(null==e.virtualField||w(e.virtualField))&&(null==e.contentLocale||s(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>X(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>ne(e))),e.isFtSearchResultCluster=Y,e.isFtSearchResultClusterEntry=z,e.isFtSearchResultMap=J,e.isFtSearchResultTopic=Q,e.isFtSearchResultType=ee,e.isFtSearchResultUnstructuredDocument=W,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||oe(e.spellcheck))&&B(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>Y(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>ie(e))),e.isFtSearchResultsPageInfo=B,e.isFtSearchScope=re,e.isFtSearchSortCriterion=ae,e.isFtSearchSortCriterionOrder=L,e.isFtSearchSortCriterionType=k,e.isFtSession=e=>r(e)&&(null==e.authenticationIdentifier||pe(e.authenticationIdentifier))&&n(e.idleTimeoutInMillis)&&he(e.profile)&&i(e.sessionAuthenticated),e.isFtSpellcheck=oe,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=>ae(e)))&&(null==e.maxCount||n(e.maxCount))&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSuggestResult=ue,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>ue(e))),e.isFtTocNode=y,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(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=le,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=>E(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=he,e.isFtUserRole=de,e.isFtVirtualField=w,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Fe.localStorage){let r={...t,metadata:Ue(t.metadata??{})};const i=Oe(e),n=JSON.stringify(r);return Fe.localStorage.setItem(i,n),Fe.dispatchEvent(new StorageEvent("storage",{key:i,newValue:n,storageArea:Fe.localStorage,url:Fe.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=>Re(e,t)))}}));
@@ -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
- const roles = (0, public_1.isFtSession)(sessionOrProfileOrRoles)
19
- ? sessionOrProfileOrRoles.profile.roles
20
- : (0, public_1.isFtUserProfile)(sessionOrProfileOrRoles)
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;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FtEditorialType = exports.isFtSearchResultsPageInfo = exports.isFtSearchSortCriterionType = exports.FtSearchSortCriterionType = exports.isFtSearchSortCriterionOrder = exports.FtSearchSortCriterionOrder = exports.isFtSearchPreset = exports.isFtSearchFilter = exports.isFtPeriodFilterType = exports.FtPeriodFilterType = exports.isFtPeriodFilter = exports.isFtPeriod = exports.isFtSearchPreferencesConfiguration = exports.isFtMetadataPreferenceConfiguration = exports.isFtMapResource = exports.isFtTopicsRatingSummary = exports.isFtTopicRating = exports.isFtRatingSummary = exports.isFtRatingCreation = exports.isFtPublicationRatingSummary = exports.isFtPublicationRating = exports.isFtRatingType = exports.FtRatingType = exports.isFtMySearchRequest = exports.isFtMySearch = exports.isFtMetadata = exports.isFtUiLocale = exports.isFtMessageContext = exports.isFtSearchLocales = exports.isFtSearchLocale = exports.isFtFeedbackCreation = exports.isFtTopicContentTarget = exports.FtTopicContentTarget = exports.isFtUnstructuredDocument = exports.isFtTopicOrigin = exports.isFtTopic = exports.isFtTocNode = exports.isFtMapStyles = exports.isFtMap = exports.isFtCollectionDocument = exports.isFtBookmark = exports.isFtPersonalBookTopicLinkCreation = exports.isFtPersonalBookNodeCreation = exports.isFtPersonalBookMetadataUpdate = exports.isFtPersonalBookCreation = exports.isFtCredentials = exports.isFtTopicOriginType = exports.FtTopicOriginType = exports.isFtMyLibraryColors = exports.FtMyLibraryColors = void 0;
4
- exports.isFtUserProfile = exports.isFtSession = exports.isFtAuthenticatedSession = exports.isFtAuthenticationIdentifier = exports.isFtUserRole = exports.FtUserRole = exports.isFtSuggestResults = exports.isFtSuggestResult = exports.isFtSuggestRequest = exports.isFtTopicResource = exports.isFtSpellcheck = exports.isFtSearchSortCriterion = exports.isFtSearchFacetEntry = exports.isFtSearchFacetConf = exports.isFtSearchFacet = exports.isFtSearchResultType = exports.FtSearchResultType = exports.isFtSearchResultTopic = exports.isFtSearchResultMap = exports.isFtSearchResultUnstructuredDocument = exports.isFtSearchResultClusterEntry = exports.isFtSearchResultCluster = exports.isFtSearchRequest = exports.isFtSearchPrior = exports.isFtLabeledSearchFilter = exports.isFtSearchResults = exports.isFtCollectionDocumentType = exports.FtCollectionDocumentType = exports.isFtPageRequest = exports.isFtOpenMode = exports.FtOpenMode = exports.isFtEditorialType = void 0;
3
+ exports.isFtVirtualField = exports.FtVirtualField = exports.isFtSearchSortCriterionType = exports.FtSearchSortCriterionType = exports.isFtSearchSortCriterionOrder = exports.FtSearchSortCriterionOrder = exports.isFtSearchPreset = exports.isFtSearchFilter = exports.isFtPeriodFilterType = exports.FtPeriodFilterType = exports.isFtPeriodFilter = exports.isFtPeriod = exports.isFtSearchPreferencesConfiguration = exports.isFtMetadataPreferenceConfiguration = exports.isFtMapResource = exports.isFtTopicsRatingSummary = exports.isFtTopicRating = exports.isFtRatingSummary = exports.isFtRatingCreation = exports.isFtPublicationRatingSummary = exports.isFtPublicationRating = exports.isFtRatingType = exports.FtRatingType = exports.isFtMySearchRequest = exports.isFtMySearch = exports.isFtMetadata = exports.isFtUiLocale = exports.isFtMessageContext = exports.isFtSearchLocales = exports.isFtSearchLocale = exports.isFtFeedbackCreation = exports.isFtTopicContentTarget = exports.FtTopicContentTarget = exports.isFtUnstructuredDocument = exports.isFtTopicOrigin = exports.isFtTopic = exports.isFtTocNode = exports.isFtMapStyles = exports.isFtMap = exports.isFtCollectionDocument = exports.isFtBookmark = exports.isFtPersonalBookTopicLinkCreation = exports.isFtPersonalBookNodeCreation = exports.isFtPersonalBookMetadataUpdate = exports.isFtPersonalBookCreation = exports.isFtCredentials = exports.isFtTopicOriginType = exports.FtTopicOriginType = exports.isFtMyLibraryColors = exports.FtMyLibraryColors = void 0;
4
+ exports.isFtUserProfile = exports.isFtSession = exports.isFtAuthenticatedSession = exports.isFtAuthenticationIdentifier = exports.isFtUserRole = exports.FtUserRole = exports.isFtSuggestResults = exports.isFtSuggestResult = exports.isFtSuggestRequest = exports.isFtTopicResource = exports.isFtSpellcheck = exports.isFtSearchSortCriterion = exports.isFtSearchFacetEntry = exports.isFtSearchFacetConf = exports.isFtSearchFacet = exports.isFtSearchScope = exports.FtSearchScope = exports.isFtSearchResultType = exports.FtSearchResultType = exports.isFtSearchResultTopic = exports.isFtSearchResultMap = exports.isFtSearchResultUnstructuredDocument = exports.isFtSearchResultClusterEntry = exports.isFtSearchResultCluster = exports.isFtSearchRequest = exports.isFtSearchPrior = exports.isFtLabeledSearchFilter = exports.isFtSearchResults = exports.isFtCollectionDocumentType = exports.FtCollectionDocumentType = exports.isFtPageRequest = exports.isFtOpenMode = exports.FtOpenMode = exports.isFtEditorialType = exports.FtEditorialType = exports.isFtSearchResultsPageInfo = void 0;
5
5
  const isObject = (o) => typeof o === "object" && o != null;
6
6
  const isBoolean = (o) => typeof o === "boolean";
7
7
  const isNumber = (o) => typeof o === "number";
@@ -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
  };
@@ -264,10 +264,12 @@ const isFtMySearchRequest = (o) => {
264
264
  return isObject(o)
265
265
  && (o.periodFilter == null || (0, exports.isFtPeriodFilter)(o.periodFilter))
266
266
  && (isString(o.query))
267
+ && (o.scope == null || (0, exports.isFtSearchScope)(o.scope))
267
268
  && ((Array.isArray(o.filters)
268
269
  && o.filters.every((v) => (0, exports.isFtLabeledSearchFilter)(v))))
269
270
  && ((Array.isArray(o.sort)
270
271
  && o.sort.every((v) => (0, exports.isFtSearchSortCriterion)(v))))
272
+ && (o.virtualField == null || (0, exports.isFtVirtualField)(o.virtualField))
271
273
  && (o.contentLocale == null || isString(o.contentLocale));
272
274
  };
273
275
  exports.isFtMySearchRequest = isFtMySearchRequest;
@@ -407,6 +409,17 @@ const isFtSearchSortCriterionType = (o) => {
407
409
  return ["ALPHA", "NATURAL"].includes(o);
408
410
  };
409
411
  exports.isFtSearchSortCriterionType = isFtSearchSortCriterionType;
412
+ // From: VirtualField
413
+ var FtVirtualField;
414
+ (function (FtVirtualField) {
415
+ FtVirtualField["EVERYWHERE"] = "EVERYWHERE";
416
+ FtVirtualField["TITLE_ONLY"] = "TITLE_ONLY";
417
+ FtVirtualField["NONE"] = "NONE";
418
+ })(FtVirtualField = exports.FtVirtualField || (exports.FtVirtualField = {}));
419
+ const isFtVirtualField = (o) => {
420
+ return ["EVERYWHERE", "TITLE_ONLY", "NONE"].includes(o);
421
+ };
422
+ exports.isFtVirtualField = isFtVirtualField;
410
423
  const isFtSearchResultsPageInfo = (o) => {
411
424
  return isObject(o)
412
425
  && (isNumber(o.totalResultsCount))
@@ -420,9 +433,10 @@ var FtEditorialType;
420
433
  (function (FtEditorialType) {
421
434
  FtEditorialType["ARTICLE"] = "ARTICLE";
422
435
  FtEditorialType["BOOK"] = "BOOK";
436
+ FtEditorialType["SHARED_BOOK"] = "SHARED_BOOK";
423
437
  })(FtEditorialType = exports.FtEditorialType || (exports.FtEditorialType = {}));
424
438
  const isFtEditorialType = (o) => {
425
- return ["ARTICLE", "BOOK"].includes(o);
439
+ return ["ARTICLE", "BOOK", "SHARED_BOOK"].includes(o);
426
440
  };
427
441
  exports.isFtEditorialType = isFtEditorialType;
428
442
  // From: WsOpenMode
@@ -484,12 +498,14 @@ const isFtSearchRequest = (o) => {
484
498
  return isObject(o)
485
499
  && (o.periodFilter == null || (0, exports.isFtPeriodFilter)(o.periodFilter))
486
500
  && (isString(o.query))
501
+ && (o.scope == null || (0, exports.isFtSearchScope)(o.scope))
487
502
  && ((0, exports.isFtPageRequest)(o.paging))
488
503
  && ((Array.isArray(o.filters)
489
504
  && o.filters.every((v) => (0, exports.isFtSearchFilter)(v))))
490
505
  && ((Array.isArray(o.sort)
491
506
  && o.sort.every((v) => (0, exports.isFtSearchSortCriterion)(v))))
492
507
  && (o.uiLocale == null || isString(o.uiLocale))
508
+ && (o.virtualField == null || (0, exports.isFtVirtualField)(o.virtualField))
493
509
  && (o.contentLocale == null || isString(o.contentLocale))
494
510
  && (o.priors == null || (Array.isArray(o.priors)
495
511
  && o.priors.every((v) => (0, exports.isFtSearchPrior)(v))))
@@ -582,6 +598,16 @@ const isFtSearchResultType = (o) => {
582
598
  return ["MAP", "DOCUMENT", "TOPIC"].includes(o);
583
599
  };
584
600
  exports.isFtSearchResultType = isFtSearchResultType;
601
+ // From: WsPublicSearchScope
602
+ var FtSearchScope;
603
+ (function (FtSearchScope) {
604
+ FtSearchScope["DEFAULT"] = "DEFAULT";
605
+ FtSearchScope["DOCUMENTS"] = "DOCUMENTS";
606
+ })(FtSearchScope = exports.FtSearchScope || (exports.FtSearchScope = {}));
607
+ const isFtSearchScope = (o) => {
608
+ return ["DEFAULT", "DOCUMENTS"].includes(o);
609
+ };
610
+ exports.isFtSearchScope = isFtSearchScope;
585
611
  const isFtSearchFacet = (o) => {
586
612
  return isObject(o)
587
613
  && (isBoolean(o.hierarchical))
@@ -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 E=[301,302,303,307,308];A.redirect=function(e,t){if(-1===E.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 g(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)}))}g.polyfill=!0,e.fetch||(e.fetch=g,e.Headers=l,e.Request=f,e.Response=A),t.Headers=l,t.Request=f,t.Response=A,t.fetch=g,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)),E=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),g=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&s(e.query)&&(null==e.scope||re(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>q(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ae(e)))&&(null==e.virtualField||w(e.virtualField))&&(null==e.contentLocale||s(e.contentLocale));var b;e.FtRatingType=void 0,(b=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",b.LIKE="LIKE",b.DICHOTOMOUS="DICHOTOMOUS",b.NO_RATING="NO_RATING";const T=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),S=e=>r(e)&&s(e.date)&&T(e.type)&&n(e.value),R=e=>r(e)&&(null==e.rating||S(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 N;e.FtSearchSortCriterionType=void 0,(N=e.FtSearchSortCriterionType||(e.FtSearchSortCriterionType={})).ALPHA="ALPHA",N.NATURAL="NATURAL";const k=e=>["ALPHA","NATURAL"].includes(e);var M;e.FtVirtualField=void 0,(M=e.FtVirtualField||(e.FtVirtualField={})).EVERYWHERE="EVERYWHERE",M.TITLE_ONLY="TITLE_ONLY",M.NONE="NONE";const w=e=>["EVERYWHERE","TITLE_ONLY","NONE"].includes(e),B=e=>r(e)&&n(e.totalResultsCount)&&i(e.isLastPage)&&n(e.currentPage)&&n(e.totalClustersCount);var x;e.FtEditorialType=void 0,(x=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",x.BOOK="BOOK",x.SHARED_BOOK="SHARED_BOOK";const H=e=>["ARTICLE","BOOK","SHARED_BOOK"].includes(e);var K;e.FtOpenMode=void 0,(K=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",K.EXTERNAL="EXTERNAL";const $=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),j=e=>r(e)&&(null==e.perPage||n(e.perPage))&&n(e.page);var V;e.FtCollectionDocumentType=void 0,(V=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",V.DOCUMENT="DOCUMENT",V.TOPIC="TOPIC",V.PERSONAL_BOOK="PERSONAL_BOOK",V.SHARED_BOOK="SHARED_BOOK";const G=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),q=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.label)&&s(e.key),X=e=>r(e)&&n(e.weight)&&s(e.value)&&s(e.key),Y=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>z(e)))&&(null==e.metadataVariableAxis||s(e.metadataVariableAxis)),z=e=>r(e)&&(null==e.document||W(e.document))&&(null==e.topic||Q(e.topic))&&ee(e.type)&&(null==e.map||J(e.map)),W=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&$(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),J=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&(null==e.openMode||$(e.openMode))&&H(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),Q=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&$(e.openMode)&&s(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>le(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 Z;e.FtSearchResultType=void 0,(Z=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",Z.DOCUMENT="DOCUMENT",Z.TOPIC="TOPIC";const ee=e=>["MAP","DOCUMENT","TOPIC"].includes(e);var te;e.FtSearchScope=void 0,(te=e.FtSearchScope||(e.FtSearchScope={})).DEFAULT="DEFAULT",te.DOCUMENTS="DOCUMENTS";const re=e=>["DEFAULT","DOCUMENTS"].includes(e),ie=e=>r(e)&&i(e.hierarchical)&&s(e.label)&&i(e.multiSelectionable)&&s(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>se(e))),ne=e=>r(e)&&(null==e.maxDepth||n(e.maxDepth))&&s(e.id),se=e=>r(e)&&n(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>se(e)))&&s(e.label)&&s(e.value)&&i(e.selected),ae=e=>r(e)&&k(e.type)&&s(e.key)&&L(e.order),oe=e=>r(e)&&s(e.suggestedQuery)&&s(e.htmlSuggestedQuery),le=e=>r(e)&&s(e.filename)&&s(e.resourceUrl)&&s(e.id)&&s(e.mimeType)&&s(e.resourceContentUrl)&&s(e.viewerUrl),ue=e=>r(e)&&(null==e.filenameExtension||s(e.filenameExtension))&&(null==e.editorialType||H(e.editorialType))&&(null==e.mimeType||s(e.mimeType))&&ee(e.type)&&s(e.value);var ce;e.FtUserRole=void 0,(ce=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",ce.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",ce.HTML_EXPORT_USER="HTML_EXPORT_USER",ce.PDF_EXPORT_USER="PDF_EXPORT_USER",ce.SAVED_SEARCH_USER="SAVED_SEARCH_USER",ce.COLLECTION_USER="COLLECTION_USER",ce.OFFLINE_USER="OFFLINE_USER",ce.ANALYTICS_USER="ANALYTICS_USER",ce.BETA_USER="BETA_USER",ce.DEBUG_USER="DEBUG_USER",ce.PRINT_USER="PRINT_USER",ce.RATING_USER="RATING_USER",ce.FEEDBACK_USER="FEEDBACK_USER",ce.CONTENT_PUBLISHER="CONTENT_PUBLISHER",ce.KHUB_ADMIN="KHUB_ADMIN",ce.USERS_ADMIN="USERS_ADMIN",ce.PORTAL_ADMIN="PORTAL_ADMIN",ce.ADMIN="ADMIN",ce.DEVELOPER="DEVELOPER";const de=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),pe=e=>r(e)&&s(e.identifier)&&s(e.realm),he=e=>r(e)&&(null==e.emailAddress||s(e.emailAddress))&&(null==e.displayName||s(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>de(e)))&&(null==e.userId||s(e.userId)),ye=e=>"object"==typeof e&&null!=e,fe=e=>"boolean"==typeof e,me=e=>"number"==typeof e,Ae=e=>"string"==typeof e,Ee=e=>ye(e)&&fe(e.mailsSentByFluidTopics)&&fe(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>Ae(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>Ae(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>Ae(e))),ge=e=>ye(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>fe(e))))&&fe(e.isVisible),be=e=>ye(e)&&(null==e.prettyUrl||Ae(e.prettyUrl))&&(null==e.hasRating||fe(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||Ae(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>be(e)))&&(null==e.pageConfiguration||ge(e.pageConfiguration))&&(null==e.contentId||Ae(e.contentId))&&(null==e.title||Ae(e.title)),Te=e=>ye(e)&&fe(e.splitCurrentPageToc),Se={[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 Re(e,t){return e===t||(Se[e]??[]).some((e=>Re(e,t)))}const Fe="undefined"==typeof window?globalThis:window;function Ue(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 Oe(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Ie="undefined"==typeof window?globalThis:window;class _e extends Error{status;statusText;body;constructor(e,t,r){super(`${e} - ${t}: ${r}`),this.status=e,this.statusText=t,this.body=r}}async function ve(e){if(!e.ok)throw new _e(e.status,e.statusText,await e.text());return e}function Ce(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class Pe{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??Ie.__gwt_ft_moduleBase??Ie.fluidtopicsclient?.__moduleBase??Ie.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==Ie.location&&Ie.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 _e(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(ve).then(Ce)}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(ve).then(Ce)}fetchRawData(e){return fetch(this.makeAbsolute(e),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then(ve).then((e=>e.arrayBuffer()))}}e.FluidTopicsApi=Pe,e.HttpError=_e,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Fe.localStorage){const r=Oe(e),i=e=>{e.storageArea===Fe.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Fe.addEventListener("storage",i),{removeHandler:()=>Fe.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=Pe,e.getUnauthenticatedUserSearchPreferences=function(e){if(Fe.localStorage)return JSON.parse(Fe.localStorage.getItem(Oe(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&pe(e.authenticationIdentifier)&&he(e.profile),e.isFtAuthenticationIdentifier=pe,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)&&G(e.type),e.isFtCollectionDocumentType=G,e.isFtCredentials=e=>r(e)&&s(e.password)&&(null==e.newPassword||s(e.newPassword))&&i(e.rememberMe)&&s(e.login),e.isFtEditorialType=H,e.isFtFeedbackCreation=e=>r(e)&&(null==e.from||s(e.from))&&s(e.message),e.isFtLabeledSearchFilter=q,e.isFtMap=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&$(e.openMode)&&(null==e.topicsApiEndpoint||s(e.topicsApiEndpoint))&&(null==e.description||s(e.description))&&(null==e.attachmentsApiEndpoint||s(e.attachmentsApiEndpoint))&&H(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=>ye(e)&&Ae(e.file)&&(null==e.size||me(e.size))&&fe(e.externalLink)&&Ae(e.name)&&Ae(e.id)&&(null==e.mimeType||Ae(e.mimeType))&&(null==e.viewerUrl||Ae(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=E,e.isFtMetadataPreferenceConfiguration=O,e.isFtMyLibraryColors=o,e.isFtMySearch=e=>r(e)&&g(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=g,e.isFtOpenMode=$,e.isFtPageConfiguration=ge,e.isFtPageRequest=j,e.isFtPaginatedToc=e=>ye(e)&&Te(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>be(e))),e.isFtPaginatedTocNode=be,e.isFtPaginationConfiguration=Te,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=S,e.isFtPublicationRatingSummary=R,e.isFtRatingCreation=e=>r(e)&&T(e.type)&&n(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||U(e.topics))&&R(e.publication),e.isFtRatingType=T,e.isFtReaderConfiguration=e=>ye(e)&&Ee(e.feedback)&&me(e.loadAfterLastVisibleTopic)&&me(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=Ee,e.isFtSearchFacet=ie,e.isFtSearchFacetConf=ne,e.isFtSearchFacetEntry=se,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=X,e.isFtSearchRequest=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&s(e.query)&&(null==e.scope||re(e.scope))&&j(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ae(e)))&&(null==e.uiLocale||s(e.uiLocale))&&(null==e.virtualField||w(e.virtualField))&&(null==e.contentLocale||s(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>X(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>ne(e))),e.isFtSearchResultCluster=Y,e.isFtSearchResultClusterEntry=z,e.isFtSearchResultMap=J,e.isFtSearchResultTopic=Q,e.isFtSearchResultType=ee,e.isFtSearchResultUnstructuredDocument=W,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||oe(e.spellcheck))&&B(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>Y(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>ie(e))),e.isFtSearchResultsPageInfo=B,e.isFtSearchScope=re,e.isFtSearchSortCriterion=ae,e.isFtSearchSortCriterionOrder=L,e.isFtSearchSortCriterionType=k,e.isFtSession=e=>r(e)&&(null==e.authenticationIdentifier||pe(e.authenticationIdentifier))&&n(e.idleTimeoutInMillis)&&he(e.profile)&&i(e.sessionAuthenticated),e.isFtSpellcheck=oe,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=>ae(e)))&&(null==e.maxCount||n(e.maxCount))&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSuggestResult=ue,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>ue(e))),e.isFtTocNode=y,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(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=le,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=>E(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=he,e.isFtUserRole=de,e.isFtVirtualField=w,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Fe.localStorage){let r={...t,metadata:Ue(t.metadata??{})};const i=Oe(e),n=JSON.stringify(r);return Fe.localStorage.setItem(i,n),Fe.dispatchEvent(new StorageEvent("storage",{key:i,newValue:n,storageArea:Fe.localStorage,url:Fe.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=>Re(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>, expectedRole: FtUserRole | FtUserRoleKeys): boolean;
2
+ export declare function userHasRole(sessionOrProfileOrRoles: FtSession | FtUserProfile | Array<FtUserRole | FtUserRoleKeys> | undefined, expectedRole: FtUserRole | FtUserRoleKeys): boolean;
@@ -1,4 +1,4 @@
1
- import { FtUserRole, isFtSession, isFtUserProfile } from "../types/ft-common/public";
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
- const roles = isFtSession(sessionOrProfileOrRoles)
15
- ? sessionOrProfileOrRoles.profile.roles
16
- : isFtUserProfile(sessionOrProfileOrRoles)
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: string;
79
+ topicsApiEndpoint?: string;
80
80
  description?: string;
81
- attachmentsApiEndpoint: string;
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: string;
89
+ rightsApiEndpoint?: string;
90
90
  contentStyles: FtMapStyles;
91
91
  originUrl?: string;
92
92
  readerUrl: string;
93
- khubVersion: string;
93
+ khubVersion?: string;
94
94
  id: string;
95
95
  lang?: string;
96
96
  }
@@ -206,8 +206,10 @@ export declare const isFtMySearch: (o: any) => o is FtMySearch;
206
206
  export interface FtMySearchRequest {
207
207
  periodFilter?: FtPeriodFilter;
208
208
  query: string;
209
+ scope?: FtSearchScopeKeys | FtSearchScope;
209
210
  filters: Array<FtLabeledSearchFilter>;
210
211
  sort: Array<FtSearchSortCriterion>;
212
+ virtualField?: FtVirtualFieldKeys | FtVirtualField;
211
213
  contentLocale?: string;
212
214
  }
213
215
  export declare const isFtMySearchRequest: (o: any) => o is FtMySearchRequest;
@@ -311,6 +313,13 @@ export declare enum FtSearchSortCriterionType {
311
313
  }
312
314
  export type FtSearchSortCriterionTypeKeys = keyof typeof FtSearchSortCriterionType;
313
315
  export declare const isFtSearchSortCriterionType: (o: any) => o is FtSearchSortCriterionType;
316
+ export declare enum FtVirtualField {
317
+ EVERYWHERE = "EVERYWHERE",
318
+ TITLE_ONLY = "TITLE_ONLY",
319
+ NONE = "NONE"
320
+ }
321
+ export type FtVirtualFieldKeys = keyof typeof FtVirtualField;
322
+ export declare const isFtVirtualField: (o: any) => o is FtVirtualField;
314
323
  export interface FtSearchResultsPageInfo {
315
324
  totalResultsCount: number;
316
325
  isLastPage: boolean;
@@ -320,7 +329,8 @@ export interface FtSearchResultsPageInfo {
320
329
  export declare const isFtSearchResultsPageInfo: (o: any) => o is FtSearchResultsPageInfo;
321
330
  export declare enum FtEditorialType {
322
331
  ARTICLE = "ARTICLE",
323
- BOOK = "BOOK"
332
+ BOOK = "BOOK",
333
+ SHARED_BOOK = "SHARED_BOOK"
324
334
  }
325
335
  export type FtEditorialTypeKeys = keyof typeof FtEditorialType;
326
336
  export declare const isFtEditorialType: (o: any) => o is FtEditorialType;
@@ -367,11 +377,13 @@ export declare const isFtSearchPrior: (o: any) => o is FtSearchPrior;
367
377
  export interface FtSearchRequest {
368
378
  periodFilter?: FtPeriodFilter;
369
379
  query: string;
380
+ scope?: FtSearchScopeKeys | FtSearchScope;
370
381
  paging: FtPageRequest;
371
382
  filters: Array<FtSearchFilter>;
372
383
  sort: Array<FtSearchSortCriterion>;
373
384
  lastModified?: any;
374
385
  uiLocale?: string;
386
+ virtualField?: FtVirtualFieldKeys | FtVirtualField;
375
387
  contentLocale?: string;
376
388
  priors?: Array<FtSearchPrior>;
377
389
  facets: Array<FtSearchFacetConf>;
@@ -450,6 +462,12 @@ export declare enum FtSearchResultType {
450
462
  }
451
463
  export type FtSearchResultTypeKeys = keyof typeof FtSearchResultType;
452
464
  export declare const isFtSearchResultType: (o: any) => o is FtSearchResultType;
465
+ export declare enum FtSearchScope {
466
+ DEFAULT = "DEFAULT",
467
+ DOCUMENTS = "DOCUMENTS"
468
+ }
469
+ export type FtSearchScopeKeys = keyof typeof FtSearchScope;
470
+ export declare const isFtSearchScope: (o: any) => o is FtSearchScope;
453
471
  export interface FtSearchFacet {
454
472
  hierarchical: boolean;
455
473
  label: string;
@@ -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
  };
@@ -237,10 +237,12 @@ export const isFtMySearchRequest = (o) => {
237
237
  return isObject(o)
238
238
  && (o.periodFilter == null || isFtPeriodFilter(o.periodFilter))
239
239
  && (isString(o.query))
240
+ && (o.scope == null || isFtSearchScope(o.scope))
240
241
  && ((Array.isArray(o.filters)
241
242
  && o.filters.every((v) => isFtLabeledSearchFilter(v))))
242
243
  && ((Array.isArray(o.sort)
243
244
  && o.sort.every((v) => isFtSearchSortCriterion(v))))
245
+ && (o.virtualField == null || isFtVirtualField(o.virtualField))
244
246
  && (o.contentLocale == null || isString(o.contentLocale));
245
247
  };
246
248
  // From: RatingType
@@ -362,6 +364,16 @@ export var FtSearchSortCriterionType;
362
364
  export const isFtSearchSortCriterionType = (o) => {
363
365
  return ["ALPHA", "NATURAL"].includes(o);
364
366
  };
367
+ // From: VirtualField
368
+ export var FtVirtualField;
369
+ (function (FtVirtualField) {
370
+ FtVirtualField["EVERYWHERE"] = "EVERYWHERE";
371
+ FtVirtualField["TITLE_ONLY"] = "TITLE_ONLY";
372
+ FtVirtualField["NONE"] = "NONE";
373
+ })(FtVirtualField || (FtVirtualField = {}));
374
+ export const isFtVirtualField = (o) => {
375
+ return ["EVERYWHERE", "TITLE_ONLY", "NONE"].includes(o);
376
+ };
365
377
  export const isFtSearchResultsPageInfo = (o) => {
366
378
  return isObject(o)
367
379
  && (isNumber(o.totalResultsCount))
@@ -374,9 +386,10 @@ export var FtEditorialType;
374
386
  (function (FtEditorialType) {
375
387
  FtEditorialType["ARTICLE"] = "ARTICLE";
376
388
  FtEditorialType["BOOK"] = "BOOK";
389
+ FtEditorialType["SHARED_BOOK"] = "SHARED_BOOK";
377
390
  })(FtEditorialType || (FtEditorialType = {}));
378
391
  export const isFtEditorialType = (o) => {
379
- return ["ARTICLE", "BOOK"].includes(o);
392
+ return ["ARTICLE", "BOOK", "SHARED_BOOK"].includes(o);
380
393
  };
381
394
  // From: WsOpenMode
382
395
  export var FtOpenMode;
@@ -431,12 +444,14 @@ export const isFtSearchRequest = (o) => {
431
444
  return isObject(o)
432
445
  && (o.periodFilter == null || isFtPeriodFilter(o.periodFilter))
433
446
  && (isString(o.query))
447
+ && (o.scope == null || isFtSearchScope(o.scope))
434
448
  && (isFtPageRequest(o.paging))
435
449
  && ((Array.isArray(o.filters)
436
450
  && o.filters.every((v) => isFtSearchFilter(v))))
437
451
  && ((Array.isArray(o.sort)
438
452
  && o.sort.every((v) => isFtSearchSortCriterion(v))))
439
453
  && (o.uiLocale == null || isString(o.uiLocale))
454
+ && (o.virtualField == null || isFtVirtualField(o.virtualField))
440
455
  && (o.contentLocale == null || isString(o.contentLocale))
441
456
  && (o.priors == null || (Array.isArray(o.priors)
442
457
  && o.priors.every((v) => isFtSearchPrior(v))))
@@ -522,6 +537,15 @@ export var FtSearchResultType;
522
537
  export const isFtSearchResultType = (o) => {
523
538
  return ["MAP", "DOCUMENT", "TOPIC"].includes(o);
524
539
  };
540
+ // From: WsPublicSearchScope
541
+ export var FtSearchScope;
542
+ (function (FtSearchScope) {
543
+ FtSearchScope["DEFAULT"] = "DEFAULT";
544
+ FtSearchScope["DOCUMENTS"] = "DOCUMENTS";
545
+ })(FtSearchScope || (FtSearchScope = {}));
546
+ export const isFtSearchScope = (o) => {
547
+ return ["DEFAULT", "DOCUMENTS"].includes(o);
548
+ };
525
549
  export const isFtSearchFacet = (o) => {
526
550
  return isObject(o)
527
551
  && (isBoolean(o.hierarchical))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/public-api",
3
- "version": "1.0.45",
3
+ "version": "1.0.47",
4
4
  "description": "Fluid Topics Public API",
5
5
  "author": "Fluid Topics dev team <opensource@antidot.net>",
6
6
  "license": "LGPL-3.0-only",
package/.yarnrc DELETED
@@ -1 +0,0 @@
1
- --frozen-lockfile false