@fluid-topics/ft-search-results 1.1.66 → 1.1.68

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.
@@ -1,7 +1,7 @@
1
- import { TemplateResult } from "lit";
1
+ import { PropertyValues, TemplateResult } from "lit";
2
2
  import { ClusterPolicy, FtSearchResultsProperties } from "./ft-search-results.properties";
3
3
  import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registration";
4
- import type { FtSearchResultClusterEntry } from "@fluid-topics/public-api";
4
+ import type { FtPublicClusterSortCriterion, FtSearchResultClusterEntry } from "@fluid-topics/public-api";
5
5
  import "@fluid-topics/ft-search-result-context";
6
6
  import "@fluid-topics/ft-search-result-title";
7
7
  import "@fluid-topics/ft-search-result-abstract";
@@ -11,11 +11,13 @@ export declare class FtSearchResults extends FtSearchResults_base implements FtS
11
11
  clusterPolicy: ClusterPolicy;
12
12
  displayNoResultsMessage: boolean;
13
13
  renderResult: (resultOrCluster: FtSearchResultClusterEntry, index: number) => TemplateResult | string;
14
+ clusterSortCriterion: FtPublicClusterSortCriterion[];
14
15
  private request?;
15
16
  private results?;
16
17
  private selectedResultByCluster;
17
18
  constructor();
18
19
  protected render(): unknown;
20
+ protected update(props: PropertyValues): void;
19
21
  private onClusterChange;
20
22
  private buildClusters;
21
23
  private buildFullClusters;
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { html } from "lit";
8
8
  import { repeat } from "lit/directives/repeat.js";
9
9
  import { property } from "lit/decorators.js";
10
- import { redux } from "@fluid-topics/ft-wc-utils";
10
+ import { jsonProperty, redux } from "@fluid-topics/ft-wc-utils";
11
11
  import { styles } from "./ft-search-results.styles";
12
12
  import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registration";
13
13
  import "@fluid-topics/ft-search-result-context";
@@ -24,6 +24,7 @@ class FtSearchResults extends withI18n(FtSearchComponent) {
24
24
  <ft-search-result-title></ft-search-result-title>
25
25
  <ft-search-result-abstract></ft-search-result-abstract>
26
26
  `;
27
+ this.clusterSortCriterion = [];
27
28
  this.selectedResultByCluster = {};
28
29
  this.addI18nContext(resultsNumberContext);
29
30
  }
@@ -44,6 +45,13 @@ class FtSearchResults extends withI18n(FtSearchComponent) {
44
45
  `;
45
46
  });
46
47
  }
48
+ update(props) {
49
+ var _a;
50
+ super.update(props);
51
+ if (props.has("clusterSortCriterion") || props.has("stateManager") && this.clusterSortCriterion) {
52
+ (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setClusterSortCriterion(this.clusterSortCriterion);
53
+ }
54
+ }
47
55
  onClusterChange(clusterId, result) {
48
56
  this.selectedResultByCluster[clusterId] = result;
49
57
  }
@@ -85,6 +93,9 @@ __decorate([
85
93
  __decorate([
86
94
  property({ attribute: false })
87
95
  ], FtSearchResults.prototype, "renderResult", void 0);
96
+ __decorate([
97
+ jsonProperty([])
98
+ ], FtSearchResults.prototype, "clusterSortCriterion", void 0);
88
99
  __decorate([
89
100
  redux()
90
101
  ], FtSearchResults.prototype, "request", void 0);
@@ -4,9 +4,9 @@
4
4
  padding: 12px;
5
5
  }
6
6
  `;var l,c,s,p,f,h,d,g,y,u,b,m,O,x,N,S,v,w;!function(t){!function(o){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};function i(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function n(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var o={next:function(){var o=t.shift();return{done:void 0===o,value:o}}};return e.iterable&&(o[Symbol.iterator]=function(){return o}),o}function c(t){this.map={},t instanceof c?t.forEach((function(t,o){this.append(o,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(o){this.append(o,t[o])}),this)}function s(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(o,e){t.onload=function(){o(t.result)},t.onerror=function(){e(t.error)}}))}function f(t){var o=new FileReader,e=p(o);return o.readAsArrayBuffer(t),e}function h(t){if(t.slice)return t.slice(0);var o=new Uint8Array(t.byteLength);return o.set(new Uint8Array(t)),o.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(t){var o;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:e.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:e.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():e.arrayBuffer&&e.blob&&((o=t)&&DataView.prototype.isPrototypeOf(o))?(this._bodyArrayBuffer=h(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||a(t))?this._bodyArrayBuffer=h(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=s(this);if(t)return t;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?s(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(f)}),this.text=function(){var t,o,e,r=s(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,o=new FileReader,e=p(o),o.readAsText(t),e;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var o=new Uint8Array(t),e=new Array(o.length),r=0;r<o.length;r++)e[r]=String.fromCharCode(o[r]);return e.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(u)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(t,o){t=i(t),o=n(o);var e=this.map[t];this.map[t]=e?e+", "+o:o},c.prototype.delete=function(t){delete this.map[i(t)]},c.prototype.get=function(t){return t=i(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(i(t))},c.prototype.set=function(t,o){this.map[i(t)]=n(o)},c.prototype.forEach=function(t,o){for(var e in this.map)this.map.hasOwnProperty(e)&&t.call(o,this.map[e],e,this)},c.prototype.keys=function(){var t=[];return this.forEach((function(o,e){t.push(e)})),l(t)},c.prototype.values=function(){var t=[];return this.forEach((function(o){t.push(o)})),l(t)},c.prototype.entries=function(){var t=[];return this.forEach((function(o,e){t.push([e,o])})),l(t)},e.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(t,o){var e,r,a=(o=o||{}).body;if(t instanceof y){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,o.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,a||null==t._bodyInit||(a=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=o.credentials||this.credentials||"same-origin",!o.headers&&this.headers||(this.headers=new c(o.headers)),this.method=(e=o.method||this.method||"GET",r=e.toUpperCase(),g.indexOf(r)>-1?r:e),this.mode=o.mode||this.mode||null,this.signal=o.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&a)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(a)}function u(t){var o=new FormData;return t.trim().split("&").forEach((function(t){if(t){var e=t.split("="),r=e.shift().replace(/\+/g," "),a=e.join("=").replace(/\+/g," ");o.append(decodeURIComponent(r),decodeURIComponent(a))}})),o}function b(t,o){o||(o={}),this.type="default",this.status=void 0===o.status?200:o.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in o?o.statusText:"OK",this.headers=new c(o.headers),this.url=o.url||"",this._initBody(t)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},d.call(y.prototype),d.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];b.redirect=function(t,o){if(-1===m.indexOf(o))throw new RangeError("Invalid status code");return new b(null,{status:o,headers:{location:t}})},o.DOMException=t.DOMException;try{new o.DOMException}catch(t){o.DOMException=function(t,o){this.message=t,this.name=o;var e=Error(t);this.stack=e.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function O(t,r){return new Promise((function(a,i){var n=new y(t,r);if(n.signal&&n.signal.aborted)return i(new o.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function s(){l.abort()}l.onload=function(){var t,o,e={status:l.status,statusText:l.statusText,headers:(t=l.getAllResponseHeaders()||"",o=new c,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var e=t.split(":"),r=e.shift().trim();if(r){var a=e.join(":").trim();o.append(r,a)}})),o)};e.url="responseURL"in l?l.responseURL:e.headers.get("X-Request-URL");var r="response"in l?l.response:l.responseText;a(new b(r,e))},l.onerror=function(){i(new TypeError("Network request failed"))},l.ontimeout=function(){i(new TypeError("Network request failed"))},l.onabort=function(){i(new o.DOMException("Aborted","AbortError"))},l.open(n.method,n.url,!0),"include"===n.credentials?l.withCredentials=!0:"omit"===n.credentials&&(l.withCredentials=!1),"responseType"in l&&e.blob&&(l.responseType="blob"),n.headers.forEach((function(t,o){l.setRequestHeader(o,t)})),n.signal&&(n.signal.addEventListener("abort",s),l.onreadystatechange=function(){4===l.readyState&&n.signal.removeEventListener("abort",s)}),l.send(void 0===n._bodyInit?null:n._bodyInit)}))}O.polyfill=!0,t.fetch||(t.fetch=O,t.Headers=c,t.Request=y,t.Response=b),o.Headers=c,o.Request=y,o.Response=b,o.fetch=O,Object.defineProperty(o,"t",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(l||(l={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(c||(c={})),function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"}(s||(s={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(p||(p={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(f||(f={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(h||(h={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(d||(d={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(g||(g={})),function(t){t.ASC="ASC",t.DESC="DESC"}(y||(y={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(u||(u={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(b||(b={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(m||(m={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(O||(O={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(x||(x={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(N||(N={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(S||(S={})),function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.GENERATIVE_AI_USER="GENERATIVE_AI_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(v||(v={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(w||(w={})),v.PERSONAL_BOOK_SHARE_USER,v.PERSONAL_BOOK_USER,v.HTML_EXPORT_USER,v.PERSONAL_BOOK_USER,v.PDF_EXPORT_USER,v.PERSONAL_BOOK_USER,v.KHUB_ADMIN,v.CONTENT_PUBLISHER,v.ADMIN,v.KHUB_ADMIN,v.USERS_ADMIN,v.PORTAL_ADMIN,v.DEVELOPER,v.BETA_USER,v.DEBUG_USER;const C=e.css`
7
- `,E=o.FtReduxStore.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1}});class I{static get(t){const{baseUrl:o,apiIntegrationIdentifier:e}=E.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static await(t){return new Promise((o=>{let e=I.get(t);if(e)o(e);else{const r=E.subscribe((()=>{e=I.get(t),e&&(r(),o(e))}))}}))}}class U{constructor(t=!0,e){var r;this.overrideApi=e;let a=this.constructor;a.commonCache=null!==(r=a.commonCache)&&void 0!==r?r:new o.CacheRegistry,this.cache=t?a.commonCache:new o.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:I.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:I.await()}clearCache(){this.cache.clearAll()}}var R;const W=Symbol("clearAfterUnitTest");class L extends U{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[R]=()=>{this.defaultMessages={},this.cache=new o.CacheRegistry,this.listeners={}},this.currentUiLocale=E.getState().uiLocale,E.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=E.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var r;if(t=t.toLowerCase(),Object.keys(e).length>0){const a={...null!==(r=this.defaultMessages[t])&&void 0!==r?r:{},...e};o.deepEqual(this.defaultMessages[t],a)||(this.defaultMessages[t]=a,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...r){var a,i,n;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(i=null===(a=this.cache.getNow(t))||void 0===a?void 0:a.messages)&&void 0!==i?i:{};return new o.ParametrizedLabelResolver(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},l).resolve(e,...r)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>o.delay(0).then((()=>t())).catch((()=>null)))))}}R=W,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends L{constructor(){super((async(t,o)=>(await this.awaitApi).getFluidTopicsMessageContext(t,o)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends L{constructor(){super((async(t,o)=>(await this.awaitApi).getCustomMessageContext(t,o)))}});const Z=window.FluidTopicsI18nService,K=window.FluidTopicsCustomI18nService;var z=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class A extends o.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>I.get(),this.cache=new o.CacheRegistry,this.cleanSessionDebouncer=new o.Debouncer}render(){return e.html`
7
+ `,E=o.FtReduxStore.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1}});class I{static get(t){const{baseUrl:o,apiIntegrationIdentifier:e}=E.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static await(t){return new Promise((o=>{let e=I.get(t);if(e)o(e);else{const r=E.subscribe((()=>{e=I.get(t),e&&(r(),o(e))}))}}))}}class U{constructor(t=!0,e){var r;this.overrideApi=e;let a=this.constructor;a.commonCache=null!==(r=a.commonCache)&&void 0!==r?r:new o.CacheRegistry,this.cache=t?a.commonCache:new o.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:I.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:I.await()}clearCache(){this.cache.clearAll()}}var R;const W=Symbol("clearAfterUnitTest");class L extends U{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[R]=()=>{this.defaultMessages={},this.cache=new o.CacheRegistry,this.listeners={}},this.currentUiLocale=E.getState().uiLocale,E.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=E.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var r;if(t=t.toLowerCase(),Object.keys(e).length>0){const a={...null!==(r=this.defaultMessages[t])&&void 0!==r?r:{},...e};o.deepEqual(this.defaultMessages[t],a)||(this.defaultMessages[t]=a,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...r){var a,i,n;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(i=null===(a=this.cache.getNow(t))||void 0===a?void 0:a.messages)&&void 0!==i?i:{};return new o.ParametrizedLabelResolver(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},l).resolve(e,...r)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>o.delay(0).then((()=>t())).catch((()=>null)))))}}R=W,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends L{constructor(){super((async(t,o)=>(await this.awaitApi).getFluidTopicsMessageContext(t,o)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends L{constructor(){super((async(t,o)=>(await this.awaitApi).getCustomMessageContext(t,o)))}});const Z=window.FluidTopicsI18nService,K=window.FluidTopicsCustomI18nService;var z=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class A extends o.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.navigatorOnline=!1,this.forcedOffline=!1,this.apiProvider=()=>I.get(),this.messageContexts=[],this.cache=new o.CacheRegistry,this.cleanSessionDebouncer=new o.Debouncer}render(){return e.html`
8
8
  <slot></slot>
9
- `}update(t){super.update(t),t.has("baseUrl")&&(E.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&E.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&E.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&E.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&E.actions.noCustom(this.noCustom),t.has("editorMode")&&E.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&E.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&E.actions.session(this.session),t.has("availableUiLocales")&&E.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Z.addContext(t))),t.has("openExternalDocumentInNewTab")&&E.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}A.elementDefinitions={},A.styles=C,z([a.property()],A.prototype,"baseUrl",void 0),z([a.property()],A.prototype,"apiIntegrationIdentifier",void 0),z([a.property()],A.prototype,"uiLocale",void 0),z([o.jsonProperty(null)],A.prototype,"availableUiLocales",void 0),z([o.jsonProperty(null)],A.prototype,"metadataConfiguration",void 0),z([a.property({type:Boolean})],A.prototype,"editorMode",void 0),z([a.property({type:Boolean})],A.prototype,"noCustom",void 0),z([a.property({type:Boolean})],A.prototype,"openExternalDocumentInNewTab",void 0),z([a.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],A.prototype,"noCustomComponent",void 0),z([a.property({type:Boolean})],A.prototype,"withManualResources",void 0),z([o.jsonProperty([])],A.prototype,"messageContexts",void 0),z([o.jsonProperty(void 0)],A.prototype,"session",void 0),z([a.property({type:Object})],A.prototype,"apiProvider",void 0);class k extends U{async listMySearches(){let t=E.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class D extends U{async listMyBookmarks(){let t=E.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const $=o.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=E.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new D,this.savedSearchesService=new k,E.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=E.getState();o.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),$.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),$.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();$.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;$.actions.bookmarks(o)}}},o.customElement("ft-app-context")(A);class F extends Event{constructor(){super(F.eventName)}}F.eventName="search-context-clear-all-filters";var B=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class T extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const H=Symbol("registerInterval");class P extends(function(t){var o;class e extends t{constructor(){super(...arguments),this[o]=0}setSearchStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[H]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[H]):this.dispatchEvent(new T)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return o=H,B([a.state()],e.prototype,"stateManager",void 0),e}(o.FtLitElementRedux)){}const G=e.css`
9
+ `}update(t){super.update(t),t.has("baseUrl")&&(E.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&E.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&E.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&E.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&E.actions.noCustom(this.noCustom),t.has("editorMode")&&E.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&E.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&E.actions.session(this.session),t.has("availableUiLocales")&&E.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Z.addContext(t))),t.has("openExternalDocumentInNewTab")&&E.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("navigatorOnline")&&E.actions.navigatorOnline(this.navigatorOnline),t.has("forcedOffline")&&E.actions.forcedOffline(this.forcedOffline),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}A.elementDefinitions={},A.styles=C,z([a.property()],A.prototype,"baseUrl",void 0),z([a.property()],A.prototype,"apiIntegrationIdentifier",void 0),z([a.property()],A.prototype,"uiLocale",void 0),z([o.jsonProperty(null)],A.prototype,"availableUiLocales",void 0),z([o.jsonProperty(null)],A.prototype,"metadataConfiguration",void 0),z([a.property({type:Boolean})],A.prototype,"editorMode",void 0),z([a.property({type:Boolean})],A.prototype,"noCustom",void 0),z([a.property({type:Boolean})],A.prototype,"openExternalDocumentInNewTab",void 0),z([a.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],A.prototype,"noCustomComponent",void 0),z([a.property({type:Boolean})],A.prototype,"withManualResources",void 0),z([a.property({type:Boolean})],A.prototype,"navigatorOnline",void 0),z([a.property({type:Boolean})],A.prototype,"forcedOffline",void 0),z([a.property({type:Object})],A.prototype,"apiProvider",void 0),z([o.jsonProperty([])],A.prototype,"messageContexts",void 0),z([o.jsonProperty(void 0)],A.prototype,"session",void 0);class k extends U{async listMySearches(){let t=E.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class D extends U{async listMyBookmarks(){let t=E.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const $=o.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=E.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new D,this.savedSearchesService=new k,E.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=E.getState();o.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),$.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),$.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();$.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;$.actions.bookmarks(o)}}},o.customElement("ft-app-context")(A);class F extends Event{constructor(){super(F.eventName)}}F.eventName="search-context-clear-all-filters";var B=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class T extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const H=Symbol("registerInterval");class P extends(function(t){var o;class e extends t{constructor(){super(...arguments),this[o]=0}setSearchStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[H]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[H]):this.dispatchEvent(new T)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return o=H,B([a.state()],e.prototype,"stateManager",void 0),e}(o.FtLitElementRedux)){}const G=e.css`
10
10
  a {
11
11
  color: inherit;
12
12
  text-decoration: inherit;
@@ -174,11 +174,11 @@ const Dt=Symbol.for(""),$t=t=>{if(t?.r===Dt)return t?._$litStatic$},Ft=t=>({_$li
174
174
  `:this.editorMode?"Select a context and a label key.":e.nothing}update(t){var o;super.update(t),["context","key","defaultMessage"].some((o=>t.has(o)))&&this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(o=this.defaultMessage)&&void 0!==o?o:""})}}ze.elementDefinitions={},ze.styles=Ce,Ke([o.redux()],ze.prototype,"editorMode",void 0),Ke([a.property()],ze.prototype,"context",void 0),Ke([a.property()],ze.prototype,"key",void 0),Ke([o.jsonProperty([])],ze.prototype,"args",void 0),Ke([a.property()],ze.prototype,"defaultMessage",void 0);class Ae{static build(t){return new Ae(t)}static fromGwt(t){return new Ae(t)}constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,o)=>{const e=o;return t=>({context:this.name,key:e,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,o)=>(...t)=>Z.resolveMessage(this.name,o,...t)})}}o.customElement("ft-i18n")(ze);const ke=Ae.build("searchResultsNumber");var De=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class $e extends(We(P)){constructor(){super(),this.clusterPolicy="display-first-result",this.displayNoResultsMessage=!1,this.renderResult=()=>e.html`
175
175
  <ft-search-result-title></ft-search-result-title>
176
176
  <ft-search-result-abstract></ft-search-result-abstract>
177
- `,this.selectedResultByCluster={},this.addI18nContext(ke)}render(){if(this.displayNoResultsMessage&&null!=this.results&&0==this.results.length)return e.html`
177
+ `,this.clusterSortCriterion=[],this.selectedResultByCluster={},this.addI18nContext(ke)}render(){if(this.displayNoResultsMessage&&null!=this.results&&0==this.results.length)return e.html`
178
178
  <ft-typography part="no-results-message" variant="body1">${ke.messages.results(0)}</ft-typography>
179
179
  `;const t=this.buildClusters();return r.repeat(t,(t=>t.id),((t,o)=>{var r;return e.html`
180
180
  <ft-search-result-context .cluster=${t} index="${o}"
181
181
  @ft-search-result-cluster-change="${o=>this.onClusterChange(t.id,o.detail)}">
182
182
  ${this.renderResult(null!==(r=this.selectedResultByCluster[t.id])&&void 0!==r?r:t.entries[0],o)}
183
183
  </ft-search-result-context>
184
- `}))}onClusterChange(t,o){this.selectedResultByCluster[t]=o}buildClusters(){return"display-all-results"===this.clusterPolicy?this.buildAllResultsClusters():this.buildFullClusters()}buildFullClusters(){var t,o;return null!==(o=null===(t=this.results)||void 0===t?void 0:t.map((t=>({id:this.clusterId(t.entries[0]),entries:t.entries}))))&&void 0!==o?o:[]}buildAllResultsClusters(){var t,o;let e=null!==(o=null===(t=this.results)||void 0===t?void 0:t.flatMap((t=>t.entries.map((t=>({id:this.clusterId(t),entries:[t]}))))))&&void 0!==o?o:[];return this.request&&1===this.request.paging.page?e.slice(0,this.request.paging.perPage):e}clusterId(t){var o,e,r,a,i;return null!==(a=null!==(e=null===(o=t.map)||void 0===o?void 0:o.mapId)&&void 0!==e?e:null===(r=t.topic)||void 0===r?void 0:r.tocId)&&void 0!==a?a:null===(i=t.document)||void 0===i?void 0:i.documentId}}$e.styles=n,De([a.property({type:String,attribute:"cluster-policy"})],$e.prototype,"clusterPolicy",void 0),De([a.property({type:Boolean})],$e.prototype,"displayNoResultsMessage",void 0),De([a.property({attribute:!1})],$e.prototype,"renderResult",void 0),De([o.redux()],$e.prototype,"request",void 0),De([o.redux()],$e.prototype,"results",void 0),o.customElement("ft-search-results")($e),t.FtSearchResults=$e,t.FtSearchResultsCssVariables={},t.styles=n}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litRepeat,ftGlobals.litDecorators,ftGlobals.litUnsafeHTML);
184
+ `}))}update(t){var o;super.update(t),(t.has("clusterSortCriterion")||t.has("stateManager")&&this.clusterSortCriterion)&&(null===(o=this.stateManager)||void 0===o||o.setClusterSortCriterion(this.clusterSortCriterion))}onClusterChange(t,o){this.selectedResultByCluster[t]=o}buildClusters(){return"display-all-results"===this.clusterPolicy?this.buildAllResultsClusters():this.buildFullClusters()}buildFullClusters(){var t,o;return null!==(o=null===(t=this.results)||void 0===t?void 0:t.map((t=>({id:this.clusterId(t.entries[0]),entries:t.entries}))))&&void 0!==o?o:[]}buildAllResultsClusters(){var t,o;let e=null!==(o=null===(t=this.results)||void 0===t?void 0:t.flatMap((t=>t.entries.map((t=>({id:this.clusterId(t),entries:[t]}))))))&&void 0!==o?o:[];return this.request&&1===this.request.paging.page?e.slice(0,this.request.paging.perPage):e}clusterId(t){var o,e,r,a,i;return null!==(a=null!==(e=null===(o=t.map)||void 0===o?void 0:o.mapId)&&void 0!==e?e:null===(r=t.topic)||void 0===r?void 0:r.tocId)&&void 0!==a?a:null===(i=t.document)||void 0===i?void 0:i.documentId}}$e.styles=n,De([a.property({type:String,attribute:"cluster-policy"})],$e.prototype,"clusterPolicy",void 0),De([a.property({type:Boolean})],$e.prototype,"displayNoResultsMessage",void 0),De([a.property({attribute:!1})],$e.prototype,"renderResult",void 0),De([o.jsonProperty([])],$e.prototype,"clusterSortCriterion",void 0),De([o.redux()],$e.prototype,"request",void 0),De([o.redux()],$e.prototype,"results",void 0),o.customElement("ft-search-results")($e),t.FtSearchResults=$e,t.FtSearchResultsCssVariables={},t.styles=n}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litRepeat,ftGlobals.litDecorators,ftGlobals.litUnsafeHTML);
@@ -180,9 +180,9 @@ function(t){return(e,o)=>{const{slot:r,selector:n}=t??{},i="slot"+(r?`[name=${r}
180
180
  padding: 12px;
181
181
  }
182
182
  `;var as,ss,ls,cs,fs,us,hs,ds,ps,ys,gs,bs,ms,vs,Os,ws,Ss,xs;!function(t){!function(e){var o={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(o.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};function i(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function s(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return o.iterable&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise((function(e,o){t.onload=function(){e(t.result)},t.onerror=function(){o(t.error)}}))}function u(t){var e=new FileReader,o=f(e);return e.readAsArrayBuffer(t),o}function h(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:o.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o.arrayBuffer&&o.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=h(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||n(t))?this._bodyArrayBuffer=h(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):o.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o.blob&&(this.blob=function(){var t=c(this);if(t)return t;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?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(u)}),this.text=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,o=f(e);return e.readAsText(t),o}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),o=new Array(e.length),r=0;r<e.length;r++)o[r]=String.fromCharCode(e[r]);return o.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o.formData&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=i(t),e=a(e);var o=this.map[t];this.map[t]=o?o+", "+e:e},l.prototype.delete=function(t){delete this.map[i(t)]},l.prototype.get=function(t){return t=i(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(i(t))},l.prototype.set=function(t,e){this.map[i(t)]=a(e)},l.prototype.forEach=function(t,e){for(var o in this.map)this.map.hasOwnProperty(o)&&t.call(e,this.map[o],o,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,o){t.push(o)})),s(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),s(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,o){t.push([o,e])})),s(t)},o.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(t,e){var o,r,n=(e=e||{}).body;if(t instanceof y){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(o=e.method||this.method||"GET",r=o.toUpperCase(),p.indexOf(r)>-1?r:o),this.mode=e.mode||this.mode||null,this.signal=e.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 g(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var o=t.split("="),r=o.shift().replace(/\+/g," "),n=o.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(n))}})),e}function b(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},d.call(y.prototype),d.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];b.redirect=function(t,e){if(-1===m.indexOf(e))throw new RangeError("Invalid status code");return new b(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var o=Error(t);this.stack=o.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function v(t,r){return new Promise((function(n,i){var a=new y(t,r);if(a.signal&&a.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function c(){s.abort()}s.onload=function(){var t,e,o={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var o=t.split(":"),r=o.shift().trim();if(r){var n=o.join(":").trim();e.append(r,n)}})),e)};o.url="responseURL"in s?s.responseURL:o.headers.get("X-Request-URL");var r="response"in s?s.response:s.responseText;n(new b(r,o))},s.onerror=function(){i(new TypeError("Network request failed"))},s.ontimeout=function(){i(new TypeError("Network request failed"))},s.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&o.blob&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",c),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",c)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}v.polyfill=!0,t.fetch||(t.fetch=v,t.Headers=l,t.Request=y,t.Response=b),e.Headers=l,e.Request=y,e.Response=b,e.fetch=v,Object.defineProperty(e,"W",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(as||(as={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(ss||(ss={})),function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"}(ls||(ls={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(cs||(cs={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(fs||(fs={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(us||(us={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(hs||(hs={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(ds||(ds={})),function(t){t.ASC="ASC",t.DESC="DESC"}(ps||(ps={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(ys||(ys={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(gs||(gs={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(bs||(bs={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(ms||(ms={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(vs||(vs={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(Os||(Os={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(ws||(ws={})),function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.GENERATIVE_AI_USER="GENERATIVE_AI_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(Ss||(Ss={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(xs||(xs={})),Ss.PERSONAL_BOOK_SHARE_USER,Ss.PERSONAL_BOOK_USER,Ss.HTML_EXPORT_USER,Ss.PERSONAL_BOOK_USER,Ss.PDF_EXPORT_USER,Ss.PERSONAL_BOOK_USER,Ss.KHUB_ADMIN,Ss.CONTENT_PUBLISHER,Ss.ADMIN,Ss.KHUB_ADMIN,Ss.USERS_ADMIN,Ss.PORTAL_ADMIN,Ss.DEVELOPER,Ss.BETA_USER,Ss.DEBUG_USER;const Cs=ht`
183
- `,Ns=Va.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1}});class Es{static get(t){const{baseUrl:e,apiIntegrationIdentifier:o}=Ns.getState(),r=null!=t?t:o;if(e&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,r,!0)}static await(t){return new Promise((e=>{let o=Es.get(t);if(o)e(o);else{const r=Ns.subscribe((()=>{o=Es.get(t),o&&(r(),e(o))}))}}))}}class Rs{constructor(t=!0,e){var o;this.overrideApi=e;let r=this.constructor;r.commonCache=null!==(o=r.commonCache)&&void 0!==o?o:new Qe,this.cache=t?r.commonCache:new Qe}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Es.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Es.await()}clearCache(){this.cache.clearAll()}}var Is;const Us=Symbol("clearAfterUnitTest");class Ls extends Rs{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Is]=()=>{this.defaultMessages={},this.cache=new Qe,this.listeners={}},this.currentUiLocale=Ns.getState().uiLocale,Ns.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Ns.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const e=t.name.toLowerCase();this.cache.setFinal(e,t),this.notify(e)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var o;if(t=t.toLowerCase(),Object.keys(e).length>0){const r={...null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},...e};lo(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...o){var r,n,i;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(n=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==n?n:{};return new qn(null!==(i=this.defaultMessages[t])&&void 0!==i?i:{},a).resolve(e,...o)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,e){var o;return t=t.toLowerCase(),this.listeners[t]=null!==(o=this.listeners[t])&&void 0!==o?o:new Set,this.listeners[t].add(e),()=>{var o;return null===(o=this.listeners[t])||void 0===o?void 0:o.delete(e)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>io(0).then((()=>t())).catch((()=>null)))))}}Is=Us,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Ls{constructor(){super((async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Ls{constructor(){super((async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e)))}});const Ws=window.FluidTopicsI18nService,ks=window.FluidTopicsCustomI18nService;var As=function(t,e,o,r){for(var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a};class Bs extends $n{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>Es.get(),this.cache=new Qe,this.cleanSessionDebouncer=new ro}render(){return Jt`
183
+ `,Ns=Va.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1}});class Es{static get(t){const{baseUrl:e,apiIntegrationIdentifier:o}=Ns.getState(),r=null!=t?t:o;if(e&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,r,!0)}static await(t){return new Promise((e=>{let o=Es.get(t);if(o)e(o);else{const r=Ns.subscribe((()=>{o=Es.get(t),o&&(r(),e(o))}))}}))}}class Rs{constructor(t=!0,e){var o;this.overrideApi=e;let r=this.constructor;r.commonCache=null!==(o=r.commonCache)&&void 0!==o?o:new Qe,this.cache=t?r.commonCache:new Qe}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Es.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Es.await()}clearCache(){this.cache.clearAll()}}var Is;const Us=Symbol("clearAfterUnitTest");class Ls extends Rs{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Is]=()=>{this.defaultMessages={},this.cache=new Qe,this.listeners={}},this.currentUiLocale=Ns.getState().uiLocale,Ns.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Ns.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const e=t.name.toLowerCase();this.cache.setFinal(e,t),this.notify(e)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var o;if(t=t.toLowerCase(),Object.keys(e).length>0){const r={...null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},...e};lo(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...o){var r,n,i;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(n=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==n?n:{};return new qn(null!==(i=this.defaultMessages[t])&&void 0!==i?i:{},a).resolve(e,...o)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,e){var o;return t=t.toLowerCase(),this.listeners[t]=null!==(o=this.listeners[t])&&void 0!==o?o:new Set,this.listeners[t].add(e),()=>{var o;return null===(o=this.listeners[t])||void 0===o?void 0:o.delete(e)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>io(0).then((()=>t())).catch((()=>null)))))}}Is=Us,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Ls{constructor(){super((async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Ls{constructor(){super((async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e)))}});const Ws=window.FluidTopicsI18nService,ks=window.FluidTopicsCustomI18nService;var As=function(t,e,o,r){for(var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a};class Bs extends $n{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.navigatorOnline=!1,this.forcedOffline=!1,this.apiProvider=()=>Es.get(),this.messageContexts=[],this.cache=new Qe,this.cleanSessionDebouncer=new ro}render(){return Jt`
184
184
  <slot></slot>
185
- `}update(t){super.update(t),t.has("baseUrl")&&(Ns.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Ns.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Ns.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Ns.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Ns.actions.noCustom(this.noCustom),t.has("editorMode")&&Ns.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Ns.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Ns.actions.session(this.session),t.has("availableUiLocales")&&Ns.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Ws.addContext(t))),t.has("openExternalDocumentInNewTab")&&Ns.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}Bs.elementDefinitions={},Bs.styles=Cs,As([Se()],Bs.prototype,"baseUrl",void 0),As([Se()],Bs.prototype,"apiIntegrationIdentifier",void 0),As([Se()],Bs.prototype,"uiLocale",void 0),As([uo(null)],Bs.prototype,"availableUiLocales",void 0),As([uo(null)],Bs.prototype,"metadataConfiguration",void 0),As([Se({type:Boolean})],Bs.prototype,"editorMode",void 0),As([Se({type:Boolean})],Bs.prototype,"noCustom",void 0),As([Se({type:Boolean})],Bs.prototype,"openExternalDocumentInNewTab",void 0),As([Se({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Bs.prototype,"noCustomComponent",void 0),As([Se({type:Boolean})],Bs.prototype,"withManualResources",void 0),As([uo([])],Bs.prototype,"messageContexts",void 0),As([uo(void 0)],Bs.prototype,"session",void 0),As([Se({type:Object})],Bs.prototype,"apiProvider",void 0);class $s extends Rs{async listMySearches(){let t=Ns.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class _s extends Rs{async listMyBookmarks(){let t=Ns.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const Fs=Va.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=Ns.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new _s,this.savedSearchesService=new $s,Ns.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Ns.getState();lo(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),Fs.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Fs.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Fs.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Fs.actions.bookmarks(e)}}},fo("ft-app-context")(Bs);class zs extends Event{constructor(){super(zs.eventName)}}zs.eventName="search-context-clear-all-filters";var Ps=function(t,e,o,r){for(var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a};class Ms extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const Ds=Symbol("registerInterval");class js extends(function(t){var e;class o extends t{constructor(){super(...arguments),this[e]=0}setSearchStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[Ds]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[Ds]):this.dispatchEvent(new Ms)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return e=Ds,Ps([xe()],o.prototype,"stateManager",void 0),o}(ai)){}const Ks=ht`
185
+ `}update(t){super.update(t),t.has("baseUrl")&&(Ns.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Ns.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Ns.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Ns.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Ns.actions.noCustom(this.noCustom),t.has("editorMode")&&Ns.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Ns.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Ns.actions.session(this.session),t.has("availableUiLocales")&&Ns.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Ws.addContext(t))),t.has("openExternalDocumentInNewTab")&&Ns.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("navigatorOnline")&&Ns.actions.navigatorOnline(this.navigatorOnline),t.has("forcedOffline")&&Ns.actions.forcedOffline(this.forcedOffline),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}Bs.elementDefinitions={},Bs.styles=Cs,As([Se()],Bs.prototype,"baseUrl",void 0),As([Se()],Bs.prototype,"apiIntegrationIdentifier",void 0),As([Se()],Bs.prototype,"uiLocale",void 0),As([uo(null)],Bs.prototype,"availableUiLocales",void 0),As([uo(null)],Bs.prototype,"metadataConfiguration",void 0),As([Se({type:Boolean})],Bs.prototype,"editorMode",void 0),As([Se({type:Boolean})],Bs.prototype,"noCustom",void 0),As([Se({type:Boolean})],Bs.prototype,"openExternalDocumentInNewTab",void 0),As([Se({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Bs.prototype,"noCustomComponent",void 0),As([Se({type:Boolean})],Bs.prototype,"withManualResources",void 0),As([Se({type:Boolean})],Bs.prototype,"navigatorOnline",void 0),As([Se({type:Boolean})],Bs.prototype,"forcedOffline",void 0),As([Se({type:Object})],Bs.prototype,"apiProvider",void 0),As([uo([])],Bs.prototype,"messageContexts",void 0),As([uo(void 0)],Bs.prototype,"session",void 0);class $s extends Rs{async listMySearches(){let t=Ns.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class _s extends Rs{async listMyBookmarks(){let t=Ns.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const Fs=Va.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=Ns.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new _s,this.savedSearchesService=new $s,Ns.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Ns.getState();lo(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),Fs.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Fs.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Fs.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Fs.actions.bookmarks(e)}}},fo("ft-app-context")(Bs);class zs extends Event{constructor(){super(zs.eventName)}}zs.eventName="search-context-clear-all-filters";var Ps=function(t,e,o,r){for(var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a};class Ms extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const Ds=Symbol("registerInterval");class js extends(function(t){var e;class o extends t{constructor(){super(...arguments),this[e]=0}setSearchStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[Ds]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[Ds]):this.dispatchEvent(new Ms)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return e=Ds,Ps([xe()],o.prototype,"stateManager",void 0),o}(ai)){}const Ks=ht`
186
186
  a {
187
187
  color: inherit;
188
188
  text-decoration: inherit;
@@ -344,11 +344,11 @@ function(t){return(e,o)=>{const{slot:r,selector:n}=t??{},i="slot"+(r?`[name=${r}
344
344
  `:this.editorMode?"Select a context and a label key.":te}update(t){var e;super.update(t),["context","key","defaultMessage"].some((e=>t.has(e)))&&this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(e=this.defaultMessage)&&void 0!==e?e:""})}}Tc.elementDefinitions={},Tc.styles=_c,Zc([Jn()],Tc.prototype,"editorMode",void 0),Zc([Se()],Tc.prototype,"context",void 0),Zc([Se()],Tc.prototype,"key",void 0),Zc([uo([])],Tc.prototype,"args",void 0),Zc([Se()],Tc.prototype,"defaultMessage",void 0);class Hc{static build(t){return new Hc(t)}static fromGwt(t){return new Hc(t)}constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,e)=>{const o=e;return t=>({context:this.name,key:o,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,e)=>(...t)=>Ws.resolveMessage(this.name,e,...t)})}}fo("ft-i18n")(Tc);const Gc=Hc.build("searchResultsNumber");var Vc=function(t,e,o,r){for(var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a};class qc extends(Dc(js)){constructor(){super(),this.clusterPolicy="display-first-result",this.displayNoResultsMessage=!1,this.renderResult=()=>Jt`
345
345
  <ft-search-result-title></ft-search-result-title>
346
346
  <ft-search-result-abstract></ft-search-result-abstract>
347
- `,this.selectedResultByCluster={},this.addI18nContext(Gc)}render(){if(this.displayNoResultsMessage&&null!=this.results&&0==this.results.length)return Jt`
347
+ `,this.clusterSortCriterion=[],this.selectedResultByCluster={},this.addI18nContext(Gc)}render(){if(this.displayNoResultsMessage&&null!=this.results&&0==this.results.length)return Jt`
348
348
  <ft-typography part="no-results-message" variant="body1">${Gc.messages.results(0)}</ft-typography>
349
349
  `;const t=this.buildClusters();return ze(t,(t=>t.id),((t,e)=>{var o;return Jt`
350
350
  <ft-search-result-context .cluster=${t} index="${e}"
351
351
  @ft-search-result-cluster-change="${e=>this.onClusterChange(t.id,e.detail)}">
352
352
  ${this.renderResult(null!==(o=this.selectedResultByCluster[t.id])&&void 0!==o?o:t.entries[0],e)}
353
353
  </ft-search-result-context>
354
- `}))}onClusterChange(t,e){this.selectedResultByCluster[t]=e}buildClusters(){return"display-all-results"===this.clusterPolicy?this.buildAllResultsClusters():this.buildFullClusters()}buildFullClusters(){var t,e;return null!==(e=null===(t=this.results)||void 0===t?void 0:t.map((t=>({id:this.clusterId(t.entries[0]),entries:t.entries}))))&&void 0!==e?e:[]}buildAllResultsClusters(){var t,e;let o=null!==(e=null===(t=this.results)||void 0===t?void 0:t.flatMap((t=>t.entries.map((t=>({id:this.clusterId(t),entries:[t]}))))))&&void 0!==e?e:[];return this.request&&1===this.request.paging.page?o.slice(0,this.request.paging.perPage):o}clusterId(t){var e,o,r,n,i;return null!==(n=null!==(o=null===(e=t.map)||void 0===e?void 0:e.mapId)&&void 0!==o?o:null===(r=t.topic)||void 0===r?void 0:r.tocId)&&void 0!==n?n:null===(i=t.document)||void 0===i?void 0:i.documentId}}qc.styles=is,Vc([Se({type:String,attribute:"cluster-policy"})],qc.prototype,"clusterPolicy",void 0),Vc([Se({type:Boolean})],qc.prototype,"displayNoResultsMessage",void 0),Vc([Se({attribute:!1})],qc.prototype,"renderResult",void 0),Vc([Jn()],qc.prototype,"request",void 0),Vc([Jn()],qc.prototype,"results",void 0),fo("ft-search-results")(qc),t.FtSearchResults=qc,t.FtSearchResultsCssVariables={},t.styles=is}({});
354
+ `}))}update(t){var e;super.update(t),(t.has("clusterSortCriterion")||t.has("stateManager")&&this.clusterSortCriterion)&&(null===(e=this.stateManager)||void 0===e||e.setClusterSortCriterion(this.clusterSortCriterion))}onClusterChange(t,e){this.selectedResultByCluster[t]=e}buildClusters(){return"display-all-results"===this.clusterPolicy?this.buildAllResultsClusters():this.buildFullClusters()}buildFullClusters(){var t,e;return null!==(e=null===(t=this.results)||void 0===t?void 0:t.map((t=>({id:this.clusterId(t.entries[0]),entries:t.entries}))))&&void 0!==e?e:[]}buildAllResultsClusters(){var t,e;let o=null!==(e=null===(t=this.results)||void 0===t?void 0:t.flatMap((t=>t.entries.map((t=>({id:this.clusterId(t),entries:[t]}))))))&&void 0!==e?e:[];return this.request&&1===this.request.paging.page?o.slice(0,this.request.paging.perPage):o}clusterId(t){var e,o,r,n,i;return null!==(n=null!==(o=null===(e=t.map)||void 0===e?void 0:e.mapId)&&void 0!==o?o:null===(r=t.topic)||void 0===r?void 0:r.tocId)&&void 0!==n?n:null===(i=t.document)||void 0===i?void 0:i.documentId}}qc.styles=is,Vc([Se({type:String,attribute:"cluster-policy"})],qc.prototype,"clusterPolicy",void 0),Vc([Se({type:Boolean})],qc.prototype,"displayNoResultsMessage",void 0),Vc([Se({attribute:!1})],qc.prototype,"renderResult",void 0),Vc([uo([])],qc.prototype,"clusterSortCriterion",void 0),Vc([Jn()],qc.prototype,"request",void 0),Vc([Jn()],qc.prototype,"results",void 0),fo("ft-search-results")(qc),t.FtSearchResults=qc,t.FtSearchResultsCssVariables={},t.styles=is}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-search-results",
3
- "version": "1.1.66",
3
+ "version": "1.1.68",
4
4
  "description": "Search result list for integrated search component",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,12 +19,12 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-search-result-context": "1.1.66",
23
- "@fluid-topics/ft-wc-utils": "1.1.66",
22
+ "@fluid-topics/ft-search-result-context": "1.1.68",
23
+ "@fluid-topics/ft-wc-utils": "1.1.68",
24
24
  "lit": "3.1.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@fluid-topics/public-api": "1.0.65"
27
+ "@fluid-topics/public-api": "1.0.67"
28
28
  },
29
- "gitHead": "c7c2a2e66a28387fcdfdc4ba1fc9fdfc65d7b1ac"
29
+ "gitHead": "d10171ba718cee726044d0cc44820ebbb1ab7cbc"
30
30
  }