@fluid-topics/ft-search-context 1.1.32 → 1.1.34
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/build/ft-search-context.d.ts +1 -0
- package/build/ft-search-context.js +7 -0
- package/build/ft-search-context.light.js +3 -3
- package/build/ft-search-context.min.js +2 -2
- package/build/store/FtSearchStateManager.d.ts +2 -0
- package/build/store/FtSearchStateManager.js +4 -0
- package/package.json +5 -5
|
@@ -21,6 +21,7 @@ export declare class FtSearchContext extends FtLitElementRedux implements FtSear
|
|
|
21
21
|
searchInDocumentTitlesOnly: boolean;
|
|
22
22
|
scope?: FtSearchScope;
|
|
23
23
|
ignoreEmptyQuery: boolean;
|
|
24
|
+
openExternalDocumentInNewTab: boolean;
|
|
24
25
|
filters: FtSearchFilter[];
|
|
25
26
|
sort: FtSearchSortCriterion[];
|
|
26
27
|
private request?;
|
|
@@ -41,6 +41,7 @@ class FtSearchContext extends FtLitElementRedux {
|
|
|
41
41
|
this.pageSize = 20;
|
|
42
42
|
this.searchInDocumentTitlesOnly = false;
|
|
43
43
|
this.ignoreEmptyQuery = false;
|
|
44
|
+
this.openExternalDocumentInNewTab = false;
|
|
44
45
|
this.filters = [];
|
|
45
46
|
this.sort = [];
|
|
46
47
|
this.addStore(ftAppInfoStore);
|
|
@@ -79,6 +80,9 @@ class FtSearchContext extends FtLitElementRedux {
|
|
|
79
80
|
if (props.has("ignoreEmptyQuery") && this.ignoreEmptyQuery !== undefined) {
|
|
80
81
|
this.stateManager.setIgnoreEmptyQuery(this.ignoreEmptyQuery);
|
|
81
82
|
}
|
|
83
|
+
if (props.has("openExternalDocumentInNewTab") && this.openExternalDocumentInNewTab !== undefined) {
|
|
84
|
+
this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab);
|
|
85
|
+
}
|
|
82
86
|
}
|
|
83
87
|
connectedCallback() {
|
|
84
88
|
super.connectedCallback();
|
|
@@ -136,6 +140,9 @@ __decorate([
|
|
|
136
140
|
__decorate([
|
|
137
141
|
property({ type: Boolean })
|
|
138
142
|
], FtSearchContext.prototype, "ignoreEmptyQuery", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
property({ type: Boolean })
|
|
145
|
+
], FtSearchContext.prototype, "openExternalDocumentInNewTab", void 0);
|
|
139
146
|
__decorate([
|
|
140
147
|
jsonProperty([])
|
|
141
148
|
], FtSearchContext.prototype, "filters", void 0);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
!function(t,i,s,e){const n=s.css`
|
|
2
2
|
`,r={setRequest:(t,i)=>{t.request=i.payload},setRequestQuery:(t,i)=>{t.request.query=i.payload},setRequestContentLocale:(t,i)=>{t.request.contentLocale=i.payload},setPageSize:(t,i)=>{t.request.paging.perPage=i.payload},setPageNumber:(t,i)=>{t.request.paging.page=i.payload},setRequestSort:(t,i)=>{t.request.sort=i.payload},setRequestFilters:(t,i)=>{t.request.filters=i.payload},setRequestFacets:(t,i)=>{t.request.facets=i.payload},setRequestVirtualField:(t,i)=>{t.request.virtualField=i.payload},setRequestScope:(t,i)=>{t.request.scope=i.payload},setResults:(t,i)=>{t.results=i.payload},setFacets:(t,i)=>{t.facets=i.payload},setSpellcheck:(t,i)=>{t.spellcheck=i.payload},setLocales:(t,i)=>{t.locales=i.payload},setPaging:(t,i)=>{t.paging=i.payload},setLiveQuery:(t,i)=>{t.liveQuery=i.payload},setSuggestResults:(t,i)=>{t.suggestResults=i.payload}};var o,a,h,c,u,l,d,f,v,w,y,E,S,p,b,A,m,g;!function(t){!function(i){var s={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(s.arrayBuffer)var e=["[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&&e.indexOf(Object.prototype.toString.call(t))>-1};function r(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 o(t){return"string"!=typeof t&&(t=String(t)),t}function a(t){var i={next:function(){var i=t.shift();return{done:void 0===i,value:i}}};return s.iterable&&(i[Symbol.iterator]=function(){return i}),i}function h(t){this.map={},t instanceof h?t.forEach((function(t,i){this.append(i,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(i){this.append(i,t[i])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function u(t){return new Promise((function(i,s){t.onload=function(){i(t.result)},t.onerror=function(){s(t.error)}}))}function l(t){var i=new FileReader,s=u(i);return i.readAsArrayBuffer(t),s}function d(t){if(t.slice)return t.slice(0);var i=new Uint8Array(t.byteLength);return i.set(new Uint8Array(t)),i.buffer}function f(){return this.bodyUsed=!1,this._initBody=function(t){var i;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:s.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:s.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s.arrayBuffer&&s.blob&&((i=t)&&DataView.prototype.isPrototypeOf(i))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||n(t))?this._bodyArrayBuffer=d(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):s.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s.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(l)}),this.text=function(){var t,i,s,e=c(this);if(e)return e;if(this._bodyBlob)return t=this._bodyBlob,i=new FileReader,s=u(i),i.readAsText(t),s;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var i=new Uint8Array(t),s=new Array(i.length),e=0;e<i.length;e++)s[e]=String.fromCharCode(i[e]);return s.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s.formData&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,i){t=r(t),i=o(i);var s=this.map[t];this.map[t]=s?s+", "+i:i},h.prototype.delete=function(t){delete this.map[r(t)]},h.prototype.get=function(t){return t=r(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(r(t))},h.prototype.set=function(t,i){this.map[r(t)]=o(i)},h.prototype.forEach=function(t,i){for(var s in this.map)this.map.hasOwnProperty(s)&&t.call(i,this.map[s],s,this)},h.prototype.keys=function(){var t=[];return this.forEach((function(i,s){t.push(s)})),a(t)},h.prototype.values=function(){var t=[];return this.forEach((function(i){t.push(i)})),a(t)},h.prototype.entries=function(){var t=[];return this.forEach((function(i,s){t.push([s,i])})),a(t)},s.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,i){var s,e,n=(i=i||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,i.headers||(this.headers=new h(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=i.credentials||this.credentials||"same-origin",!i.headers&&this.headers||(this.headers=new h(i.headers)),this.method=(s=i.method||this.method||"GET",e=s.toUpperCase(),v.indexOf(e)>-1?e:s),this.mode=i.mode||this.mode||null,this.signal=i.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 y(t){var i=new FormData;return t.trim().split("&").forEach((function(t){if(t){var s=t.split("="),e=s.shift().replace(/\+/g," "),n=s.join("=").replace(/\+/g," ");i.append(decodeURIComponent(e),decodeURIComponent(n))}})),i}function E(t,i){i||(i={}),this.type="default",this.status=void 0===i.status?200:i.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in i?i.statusText:"OK",this.headers=new h(i.headers),this.url=i.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},f.call(w.prototype),f.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},E.error=function(){var t=new E(null,{status:0,statusText:""});return t.type="error",t};var S=[301,302,303,307,308];E.redirect=function(t,i){if(-1===S.indexOf(i))throw new RangeError("Invalid status code");return new E(null,{status:i,headers:{location:t}})},i.DOMException=t.DOMException;try{new i.DOMException}catch(t){i.DOMException=function(t,i){this.message=t,this.name=i;var s=Error(t);this.stack=s.stack},i.DOMException.prototype=Object.create(Error.prototype),i.DOMException.prototype.constructor=i.DOMException}function p(t,e){return new Promise((function(n,r){var o=new w(t,e);if(o.signal&&o.signal.aborted)return r(new i.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,i,s={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",i=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var s=t.split(":"),e=s.shift().trim();if(e){var n=s.join(":").trim();i.append(e,n)}})),i)};s.url="responseURL"in a?a.responseURL:s.headers.get("X-Request-URL");var e="response"in a?a.response:a.responseText;n(new E(e,s))},a.onerror=function(){r(new TypeError("Network request failed"))},a.ontimeout=function(){r(new TypeError("Network request failed"))},a.onabort=function(){r(new i.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&s.blob&&(a.responseType="blob"),o.headers.forEach((function(t,i){a.setRequestHeader(i,t)})),o.signal&&(o.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",c)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}p.polyfill=!0,t.fetch||(t.fetch=p,t.Headers=h,t.Request=w,t.Response=E),i.Headers=h,i.Request=w,i.Response=E,i.fetch=p,Object.defineProperty(i,"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"}(o||(o={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(a||(a={})),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"}(h||(h={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(c||(c={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(u||(u={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(l||(l={})),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_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(f||(f={})),function(t){t.ASC="ASC",t.DESC="DESC"}(v||(v={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(w||(w={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(y||(y={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(E||(E={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(S||(S={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(p||(p={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(b||(b={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(A||(A={})),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"}(m||(m={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(g||(g={})),m.PERSONAL_BOOK_SHARE_USER,m.PERSONAL_BOOK_USER,m.HTML_EXPORT_USER,m.PERSONAL_BOOK_USER,m.PDF_EXPORT_USER,m.PERSONAL_BOOK_USER,m.KHUB_ADMIN,m.CONTENT_PUBLISHER,m.ADMIN,m.KHUB_ADMIN,m.USERS_ADMIN,m.PORTAL_ADMIN,m.DEVELOPER,m.BETA_USER,m.DEBUG_USER;const R=s.css`
|
|
3
|
-
`,O=i.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}});class T{static build(t){const{baseUrl:i,apiIntegrationIdentifier:s}=O.getState(),e=null!=t?t:s;if(i&&e&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(i,e,!0)}static get(t){var i;return null!=t?T.build(t):null!==(i=T.API)&&void 0!==i?i:T.API=T.build()}static await(t){return new Promise((i=>{let s=T.get(t);if(s)i(s);else{const e=O.subscribe((()=>{s=T.get(t),s&&(e(),i(s))}))}}))}}var C;const
|
|
3
|
+
`,O=i.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}});class T{static build(t){const{baseUrl:i,apiIntegrationIdentifier:s}=O.getState(),e=null!=t?t:s;if(i&&e&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(i,e,!0)}static get(t){var i;return null!=t?T.build(t):null!==(i=T.API)&&void 0!==i?i:T.API=T.build()}static await(t){return new Promise((i=>{let s=T.get(t);if(s)i(s);else{const e=O.subscribe((()=>{s=T.get(t),s&&(e(),i(s))}))}}))}}var C;const I=Symbol("clearAfterUnitTest");class U{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={},this.currentUiLocale="",this[C]=()=>{this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={}},this.currentUiLocale=O.getState().uiLocale,O.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=O.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const i=t.name.toLowerCase();this.cache.setFinal(i,t),this.notify(i)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,s){var e;if(t=t.toLowerCase(),Object.keys(s).length>0){const n={...null!==(e=this.defaultMessages[t])&&void 0!==e?e:{},...s};i.deepEqual(this.defaultMessages[t],n)||(this.defaultMessages[t]=n,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,s,...e){var n,r,o;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(r=null===(n=this.cache.getNow(t))||void 0===n?void 0:n.messages)&&void 0!==r?r:{};return new i.ParametrizedLabelResolver(null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},a).resolve(s,...e)}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,i){var s;return t=t.toLowerCase(),this.listeners[t]=null!==(s=this.listeners[t])&&void 0!==s?s:new Set,this.listeners[t].add(i),()=>{var s;return null===(s=this.listeners[t])||void 0===s?void 0:s.delete(i)}}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=>i.delay(0).then((()=>t())).catch((()=>null)))))}}C=I,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new U((async(t,i)=>(await T.await()).getFluidTopicsMessageContext(t,i)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new U((async(t,i)=>(await T.await()).getCustomMessageContext(t,i))));const L=window.FluidTopicsI18nService;var D=function(t,i,s,e){for(var n,r=arguments.length,o=r<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,s,o):n(i,s))||o);return r>3&&o&&Object.defineProperty(i,s,o),o};class N extends i.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>T.get(),this.cache=new i.CacheRegistry,this.cleanSessionDebouncer=new i.Debouncer}render(){return s.html`
|
|
4
4
|
<slot></slot>
|
|
5
|
-
`}update(t){super.update(t),t.has("baseUrl")&&(O.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&O.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&O.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&O.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&O.actions.noCustom(this.noCustom),t.has("editorMode")&&O.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&O.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&O.actions.session(this.session),t.has("availableUiLocales")&&O.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>L.addContext(t))),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()))}}D.elementDefinitions={},D.styles=R,P([e.property()],D.prototype,"baseUrl",void 0),P([e.property()],D.prototype,"apiIntegrationIdentifier",void 0),P([e.property()],D.prototype,"uiLocale",void 0),P([i.jsonProperty(null)],D.prototype,"availableUiLocales",void 0),P([i.jsonProperty(null)],D.prototype,"metadataConfiguration",void 0),P([e.property({type:Boolean})],D.prototype,"editorMode",void 0),P([e.property({type:Boolean})],D.prototype,"noCustom",void 0),P([e.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],D.prototype,"noCustomComponent",void 0),P([e.property({type:Boolean})],D.prototype,"withManualResources",void 0),P([i.jsonProperty([])],D.prototype,"messageContexts",void 0),P([i.jsonProperty(void 0)],D.prototype,"session",void 0),P([e.property({type:Object})],D.prototype,"apiProvider",void 0);class N{async listMySearches(){var t;return(null===(t=O.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await T.await()).listMySearches(O.getState().session.profile.userId):[]}}const _=new i.CacheRegistry;class M{async listMyBookmarks(){return _.get("bookmarks",(async()=>(await T.await()).listMyBookmarks(O.getState().session.profile.userId)))}clearCache(){_.clear("bookmarks")}}const B=i.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const F=new class{constructor(){this.currentSession=O.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new M,O.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:s}=O.getState();i.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==s?void 0:s.profile)||(this.currentSession=s,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){B.actions.savedSearches(void 0)}clearMyBookmarks(){B.actions.bookmarks(void 0)}async reloadMySearches(){const t=new N,i=await t.listMySearches();B.actions.savedSearches(i)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const i=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;B.actions.bookmarks(i)}}};i.customElement("ft-app-context")(D);class x{static async build(){return new x(await T.await())}constructor(t){this.api=t,this.cache=new i.CacheRegistry,this.cache.registerFinal("available-locales",(()=>this.api.getAvailableSearchLocales()))}async launchSearch(t){return this.api.search(t)}async launchSuggest(t){return this.api.getSuggestions(t)}async getAvailableSearchLocales(){return this.cache.get("available-locales")}}const k=t=>t.request.virtualField===y.TITLE_ONLY&&t.request.scope===A.DOCUMENTS;class j extends Event{constructor(){super(j.eventName)}}j.eventName="search-context-clear-all-filters";class q{static build(t){return new q((t=>i.FtReduxStore.get({name:"ft-search-"+t,initialState:{request:{query:"",filters:[],facets:[],sort:[],paging:{page:1,perPage:20}},liveQuery:""},reducers:r}))(t.trim()||"context"),x.build)}constructor(t,s){this.store=t,this.serviceProvider=s,this.ignoreEmptyQuery=!1,this.searchDebouncer=new i.Debouncer(100),this.suggestDebouncer=new i.Debouncer(300)}async initService(){return this.service=await this.serviceProvider(),this.store.actions.setLocales((await this.service.getAvailableSearchLocales()).contentLocales),this.launchSearch()}async awaitService(){return i.waitFor((()=>this.service))}setQuery(t){this.store.actions.setRequestQuery(t),this.store.actions.setLiveQuery(t),this.store.actions.setPageNumber(1),this.launchSearch()}setContentLocale(t){let i=this.store.getState().locales,s=this.store.getState().request.contentLocale;if(t!=s){if(i){const e=t=>i.some((i=>i.lang==t));e(t)||(t=e(s)?s:i[0].lang)}this.store.actions.setRequestContentLocale(t),this.store.actions.setPageNumber(1),this.store.actions.setRequestFilters([]),this.launchSearch()}return t}setPageSize(t){this.store.actions.setPageSize(t),this.launchSearch()}setPageNumber(t){this.store.actions.setPageNumber(t),this.launchSearch()}setSort(t){this.store.actions.setRequestSort(t),this.store.actions.setPageNumber(1),this.launchSearch()}setFilters(t){const i=t.filter((t=>t.values.length>0));this.store.actions.setRequestFilters(i),this.store.actions.setPageNumber(1),i.forEach((t=>{this.facetIds.includes(t.key)||(this.facetIds=[...this.facetIds,t.key])})),this.launchSearch()}setSearchInDocumentTitlesOnly(t){t?(this.store.actions.setRequestVirtualField(y.TITLE_ONLY),this.store.actions.setRequestScope(A.DOCUMENTS)):(this.store.actions.setRequestVirtualField(y.EVERYWHERE),this.store.actions.setRequestScope(A.DEFAULT)),this.launchSearch()}get searchInDocumentTitlesOnly(){return k(this.store.getState())}clearAllFilters(){this.setFilters([]),this.store.eventBus.dispatchEvent(new j)}addFacet(t){this.facetIds=[...this.facetIds,t],this.launchSearch()}replaceFacet(t,i){let s=this.facetIds.filter((i=>i!=t));i&&s.push(i),this.facetIds=s,this.launchSearch()}get facetIds(){return this.store.getState().request.facets.map((t=>t.id))}set facetIds(t){let i=[...new Set(t)].map((t=>({id:t})));this.store.actions.setRequestFacets(i)}setFilter(t,i){let s=this.store.getState().request.filters,e={key:t,values:i,negative:!1},n=[...s.filter((i=>i.key!==t)),e];this.setFilters(n)}setLiveQuery(t){this.store.actions.setLiveQuery(t),this.launchSuggest()}setRequest(t){this.store.actions.setRequest(t),this.store.actions.setLiveQuery(t.query),this.store.actions.setPageNumber(1),this.launchSearch()}setScope(t){this.store.actions.setRequestScope(t),this.launchSearch()}setIgnoreEmptyQuery(t){this.ignoreEmptyQuery=t,this.launchSearch()}async launchSearch(){return await this.awaitService(),this.searchDebouncer.run((()=>this.fetchSearchData()))}async launchSuggest(){await this.awaitService(),this.suggestDebouncer.run((()=>this.fetchSuggestData()))}async fetchSearchData(){var t,s;try{null===(t=this.cancelableSearch)||void 0===t||t.cancel();let e=this.store.getState().request;if(this.store.actions.setPaging(void 0),this.ignoreEmptyQuery&&0==e.query.length)this.store.actions.setResults(void 0),this.store.actions.setFacets(void 0),this.store.actions.setSpellcheck(void 0);else{this.cancelableSearch=i.cancelable(this.service.launchSearch(e));const t=await this.cancelableSearch;if(t.paging.currentPage<=1)this.store.actions.setResults(t.results),this.store.actions.setFacets(t.facets),this.store.actions.setSpellcheck(t.spellcheck);else{let i=(null!==(s=this.store.getState().results)&&void 0!==s?s:[]).concat(t.results);this.store.actions.setResults(i)}this.store.actions.setPaging(t.paging)}}catch(t){t instanceof i.CanceledPromiseError||!this.errorHandler||this.errorHandler(t)}}async fetchSuggestData(){var t;try{const s=this.store.getState(),e=s.request,n={input:s.liveQuery,filters:e.filters,sort:e.sort,contentLocale:e.contentLocale,scope:e.scope};null===(t=this.cancelableSuggest)||void 0===t||t.cancel(),this.cancelableSuggest=i.cancelable(this.service.launchSuggest(n));let r=await this.cancelableSuggest;this.store.actions.setSuggestResults(r.suggestions)}catch(t){t instanceof i.CanceledPromiseError||!this.errorHandler||this.errorHandler(t)}}clear(){this.store.clear()}}var H=function(t,i,s,e){for(var n,r=arguments.length,o=r<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,s,o):n(i,s))||o);return r>3&&o&&Object.defineProperty(i,s,o),o};class G extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const K=Symbol("registerInterval");class V extends(function(t){var i;class s extends t{constructor(){super(...arguments),this[i]=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[K]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[K]):this.dispatchEvent(new G)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return i=K,H([e.state()],s.prototype,"stateManager",void 0),s}(i.FtLitElementRedux)){}var Q=function(t,i,s,e){for(var n,r=arguments.length,o=r<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,s,o):n(i,s))||o);return r>3&&o&&Object.defineProperty(i,s,o),o};class z extends CustomEvent{constructor(t){super("ft-search-load-error",{detail:t})}}class X extends CustomEvent{constructor(t){super("ft-search-request-change",{detail:t})}}class Y extends CustomEvent{constructor(t,i,s){super("ft-search-results-change",{detail:{request:t,paging:i,spellcheck:s}})}}class W extends i.FtLitElementRedux{get stateManager(){return null==this._stateManager&&(this._stateManager=q.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0")),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"search")),this._stateManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.filters=[],this.sort=[],this.addStore(O)}render(){return s.html`
|
|
5
|
+
`}update(t){super.update(t),t.has("baseUrl")&&(O.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&O.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&O.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&O.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&O.actions.noCustom(this.noCustom),t.has("editorMode")&&O.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&O.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&O.actions.session(this.session),t.has("availableUiLocales")&&O.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>L.addContext(t))),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()))}}N.elementDefinitions={},N.styles=R,D([e.property()],N.prototype,"baseUrl",void 0),D([e.property()],N.prototype,"apiIntegrationIdentifier",void 0),D([e.property()],N.prototype,"uiLocale",void 0),D([i.jsonProperty(null)],N.prototype,"availableUiLocales",void 0),D([i.jsonProperty(null)],N.prototype,"metadataConfiguration",void 0),D([e.property({type:Boolean})],N.prototype,"editorMode",void 0),D([e.property({type:Boolean})],N.prototype,"noCustom",void 0),D([e.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],N.prototype,"noCustomComponent",void 0),D([e.property({type:Boolean})],N.prototype,"withManualResources",void 0),D([i.jsonProperty([])],N.prototype,"messageContexts",void 0),D([i.jsonProperty(void 0)],N.prototype,"session",void 0),D([e.property({type:Object})],N.prototype,"apiProvider",void 0);class P{async listMySearches(){var t;return(null===(t=O.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await T.await()).listMySearches(O.getState().session.profile.userId):[]}}const _=new i.CacheRegistry;class B{async listMyBookmarks(){return _.get("bookmarks",(async()=>(await T.await()).listMyBookmarks(O.getState().session.profile.userId)))}clearCache(){_.clear("bookmarks")}}const M=i.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const x=new class{constructor(){this.currentSession=O.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new B,O.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:s}=O.getState();i.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==s?void 0:s.profile)||(this.currentSession=s,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){M.actions.savedSearches(void 0)}clearMyBookmarks(){M.actions.bookmarks(void 0)}async reloadMySearches(){const t=new P,i=await t.listMySearches();M.actions.savedSearches(i)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const i=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;M.actions.bookmarks(i)}}};i.customElement("ft-app-context")(N);class F{static async build(){return new F(await T.await())}constructor(t){this.api=t,this.cache=new i.CacheRegistry,this.cache.registerFinal("available-locales",(()=>this.api.getAvailableSearchLocales()))}async launchSearch(t){return this.api.search(t)}async launchSuggest(t){return this.api.getSuggestions(t)}async getAvailableSearchLocales(){return this.cache.get("available-locales")}}const k=t=>t.request.virtualField===y.TITLE_ONLY&&t.request.scope===A.DOCUMENTS;class j extends Event{constructor(){super(j.eventName)}}j.eventName="search-context-clear-all-filters";class q{static build(t){return new q((t=>i.FtReduxStore.get({name:"ft-search-"+t,initialState:{request:{query:"",filters:[],facets:[],sort:[],paging:{page:1,perPage:20}},liveQuery:""},reducers:r}))(t.trim()||"context"),F.build)}constructor(t,s){this.store=t,this.serviceProvider=s,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.searchDebouncer=new i.Debouncer(100),this.suggestDebouncer=new i.Debouncer(300)}async initService(){return this.service=await this.serviceProvider(),this.store.actions.setLocales((await this.service.getAvailableSearchLocales()).contentLocales),this.launchSearch()}async awaitService(){return i.waitFor((()=>this.service))}setQuery(t){this.store.actions.setRequestQuery(t),this.store.actions.setLiveQuery(t),this.store.actions.setPageNumber(1),this.launchSearch()}setContentLocale(t){let i=this.store.getState().locales,s=this.store.getState().request.contentLocale;if(t!=s){if(i){const e=t=>i.some((i=>i.lang==t));e(t)||(t=e(s)?s:i[0].lang)}this.store.actions.setRequestContentLocale(t),this.store.actions.setPageNumber(1),this.store.actions.setRequestFilters([]),this.launchSearch()}return t}setPageSize(t){this.store.actions.setPageSize(t),this.launchSearch()}setPageNumber(t){this.store.actions.setPageNumber(t),this.launchSearch()}setSort(t){this.store.actions.setRequestSort(t),this.store.actions.setPageNumber(1),this.launchSearch()}setFilters(t){const i=t.filter((t=>t.values.length>0));this.store.actions.setRequestFilters(i),this.store.actions.setPageNumber(1),i.forEach((t=>{this.facetIds.includes(t.key)||(this.facetIds=[...this.facetIds,t.key])})),this.launchSearch()}setSearchInDocumentTitlesOnly(t){t?(this.store.actions.setRequestVirtualField(y.TITLE_ONLY),this.store.actions.setRequestScope(A.DOCUMENTS)):(this.store.actions.setRequestVirtualField(y.EVERYWHERE),this.store.actions.setRequestScope(A.DEFAULT)),this.launchSearch()}get searchInDocumentTitlesOnly(){return k(this.store.getState())}clearAllFilters(){this.setFilters([]),this.store.eventBus.dispatchEvent(new j)}addFacet(t){this.facetIds=[...this.facetIds,t],this.launchSearch()}replaceFacet(t,i){let s=this.facetIds.filter((i=>i!=t));i&&s.push(i),this.facetIds=s,this.launchSearch()}get facetIds(){return this.store.getState().request.facets.map((t=>t.id))}set facetIds(t){let i=[...new Set(t)].map((t=>({id:t})));this.store.actions.setRequestFacets(i)}setFilter(t,i){let s=this.store.getState().request.filters,e={key:t,values:i,negative:!1},n=[...s.filter((i=>i.key!==t)),e];this.setFilters(n)}setLiveQuery(t){this.store.actions.setLiveQuery(t),this.launchSuggest()}setRequest(t){this.store.actions.setRequest(t),this.store.actions.setLiveQuery(t.query),this.store.actions.setPageNumber(1),this.launchSearch()}setScope(t){this.store.actions.setRequestScope(t),this.launchSearch()}setIgnoreEmptyQuery(t){this.ignoreEmptyQuery=t,this.launchSearch()}setOpenExternalDocumentInNewTab(t){this.openExternalDocumentInNewTab=t}async launchSearch(){return await this.awaitService(),this.searchDebouncer.run((()=>this.fetchSearchData()))}async launchSuggest(){await this.awaitService(),this.suggestDebouncer.run((()=>this.fetchSuggestData()))}async fetchSearchData(){var t,s;try{null===(t=this.cancelableSearch)||void 0===t||t.cancel();let e=this.store.getState().request;if(this.store.actions.setPaging(void 0),this.ignoreEmptyQuery&&0==e.query.length)this.store.actions.setResults(void 0),this.store.actions.setFacets(void 0),this.store.actions.setSpellcheck(void 0);else{this.cancelableSearch=i.cancelable(this.service.launchSearch(e));const t=await this.cancelableSearch;if(t.paging.currentPage<=1)this.store.actions.setResults(t.results),this.store.actions.setFacets(t.facets),this.store.actions.setSpellcheck(t.spellcheck);else{let i=(null!==(s=this.store.getState().results)&&void 0!==s?s:[]).concat(t.results);this.store.actions.setResults(i)}this.store.actions.setPaging(t.paging)}}catch(t){t instanceof i.CanceledPromiseError||!this.errorHandler||this.errorHandler(t)}}async fetchSuggestData(){var t;try{const s=this.store.getState(),e=s.request,n={input:s.liveQuery,filters:e.filters,sort:e.sort,contentLocale:e.contentLocale,scope:e.scope};null===(t=this.cancelableSuggest)||void 0===t||t.cancel(),this.cancelableSuggest=i.cancelable(this.service.launchSuggest(n));let r=await this.cancelableSuggest;this.store.actions.setSuggestResults(r.suggestions)}catch(t){t instanceof i.CanceledPromiseError||!this.errorHandler||this.errorHandler(t)}}clear(){this.store.clear()}}var H=function(t,i,s,e){for(var n,r=arguments.length,o=r<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,s,o):n(i,s))||o);return r>3&&o&&Object.defineProperty(i,s,o),o};class G extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const K=Symbol("registerInterval");class V extends(function(t){var i;class s extends t{constructor(){super(...arguments),this[i]=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[K]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[K]):this.dispatchEvent(new G)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return i=K,H([e.state()],s.prototype,"stateManager",void 0),s}(i.FtLitElementRedux)){}var Q=function(t,i,s,e){for(var n,r=arguments.length,o=r<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,s,o):n(i,s))||o);return r>3&&o&&Object.defineProperty(i,s,o),o};class z extends CustomEvent{constructor(t){super("ft-search-load-error",{detail:t})}}class X extends CustomEvent{constructor(t){super("ft-search-request-change",{detail:t})}}class Y extends CustomEvent{constructor(t,i,s){super("ft-search-results-change",{detail:{request:t,paging:i,spellcheck:s}})}}class W extends i.FtLitElementRedux{get stateManager(){return null==this._stateManager&&(this._stateManager=q.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0")),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"search")),this._stateManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.addStore(O)}render(){return s.html`
|
|
6
6
|
<slot @register-ft-search-component=${this.registerComponent}></slot>
|
|
7
|
-
`}update(t){super.update(t),t.has("query")&&void 0!==this.query&&this.stateManager.setQuery(this.query),t.has("contentLocale")&&void 0!==this.contentLocale&&this.stateManager.setContentLocale(this.contentLocale),t.has("session")&&this.session&&this.stateManager.initService(),t.has("filters")&&void 0!==this.filters&&this.stateManager.setFilters(this.filters),t.has("sort")&&void 0!==this.sort&&this.stateManager.setSort(this.sort),t.has("pageSize")&&void 0!==this.pageSize&&this.stateManager.setPageSize(this.pageSize),t.has("searchInDocumentTitlesOnly")&&void 0!==this.searchInDocumentTitlesOnly&&this.stateManager.setSearchInDocumentTitlesOnly(this.searchInDocumentTitlesOnly),t.has("scope")&&void 0!==this.scope&&this.stateManager.setScope(this.scope),t.has("ignoreEmptyQuery")&&void 0!==this.ignoreEmptyQuery&&this.stateManager.setIgnoreEmptyQuery(this.ignoreEmptyQuery)}connectedCallback(){super.connectedCallback(),this.stateManager.setQuery(this.query),this.stateManager.setContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSort(this.sort)}contentAvailableCallback(t){super.contentAvailableCallback(t),t.has("request")&&this.request&&this.dispatchEvent(new X(this.request)),t.has("paging")&&void 0!==this.paging&&this.dispatchEvent(new Y(this.request,this.paging,this.autocorrect))}registerComponent(t){t.stopPropagation();const i=t.composedPath()[0];this.register(i)}register(t){t.setSearchStateManager(this.stateManager)}handleLoadError(t){this.dispatchEvent(new z(t))}reloadSavedSearches(){
|
|
7
|
+
`}update(t){super.update(t),t.has("query")&&void 0!==this.query&&this.stateManager.setQuery(this.query),t.has("contentLocale")&&void 0!==this.contentLocale&&this.stateManager.setContentLocale(this.contentLocale),t.has("session")&&this.session&&this.stateManager.initService(),t.has("filters")&&void 0!==this.filters&&this.stateManager.setFilters(this.filters),t.has("sort")&&void 0!==this.sort&&this.stateManager.setSort(this.sort),t.has("pageSize")&&void 0!==this.pageSize&&this.stateManager.setPageSize(this.pageSize),t.has("searchInDocumentTitlesOnly")&&void 0!==this.searchInDocumentTitlesOnly&&this.stateManager.setSearchInDocumentTitlesOnly(this.searchInDocumentTitlesOnly),t.has("scope")&&void 0!==this.scope&&this.stateManager.setScope(this.scope),t.has("ignoreEmptyQuery")&&void 0!==this.ignoreEmptyQuery&&this.stateManager.setIgnoreEmptyQuery(this.ignoreEmptyQuery),t.has("openExternalDocumentInNewTab")&&void 0!==this.openExternalDocumentInNewTab&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab)}connectedCallback(){super.connectedCallback(),this.stateManager.setQuery(this.query),this.stateManager.setContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSort(this.sort)}contentAvailableCallback(t){super.contentAvailableCallback(t),t.has("request")&&this.request&&this.dispatchEvent(new X(this.request)),t.has("paging")&&void 0!==this.paging&&this.dispatchEvent(new Y(this.request,this.paging,this.autocorrect))}registerComponent(t){t.stopPropagation();const i=t.composedPath()[0];this.register(i)}register(t){t.setSearchStateManager(this.stateManager)}handleLoadError(t){this.dispatchEvent(new z(t))}reloadSavedSearches(){x.clearMySearches()}clear(){this.stateManager.clear()}}W.elementDefinitions={},W.styles=n,Q([e.property()],W.prototype,"query",void 0),Q([e.property()],W.prototype,"contentLocale",void 0),Q([e.property({type:Number})],W.prototype,"pageSize",void 0),Q([e.property({type:Boolean})],W.prototype,"searchInDocumentTitlesOnly",void 0),Q([e.property()],W.prototype,"scope",void 0),Q([e.property({type:Boolean})],W.prototype,"ignoreEmptyQuery",void 0),Q([e.property({type:Boolean})],W.prototype,"openExternalDocumentInNewTab",void 0),Q([i.jsonProperty([])],W.prototype,"filters",void 0),Q([i.jsonProperty([])],W.prototype,"sort",void 0),Q([i.redux({store:"search"})],W.prototype,"request",void 0),Q([i.redux({store:"search"})],W.prototype,"paging",void 0),Q([i.redux({store:"search",selector:t=>t.spellcheck})],W.prototype,"autocorrect",void 0),Q([i.redux({store:O.name})],W.prototype,"session",void 0),i.customElement("ft-search-context")(W),t.ClearAllFiltersEvent=j,t.FtSearchContext=W,t.FtSearchContextCssVariables={},t.FtSearchStateManager=q,t.LoadErrorEvent=z,t.SearchRequestChangeEvent=X,t.SearchResultsChangeEvent=Y,t.searchInDocumentTitlesOnlySelector=k,t.styles=n}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);
|
|
@@ -107,6 +107,6 @@ const xo=window,Eo=xo.ShadowRoot&&(void 0===xo.ShadyCSS||xo.ShadyCSS.nativeShado
|
|
|
107
107
|
`,Zr={setRequest:(t,o)=>{t.request=o.payload},setRequestQuery:(t,o)=>{t.request.query=o.payload},setRequestContentLocale:(t,o)=>{t.request.contentLocale=o.payload},setPageSize:(t,o)=>{t.request.paging.perPage=o.payload},setPageNumber:(t,o)=>{t.request.paging.page=o.payload},setRequestSort:(t,o)=>{t.request.sort=o.payload},setRequestFilters:(t,o)=>{t.request.filters=o.payload},setRequestFacets:(t,o)=>{t.request.facets=o.payload},setRequestVirtualField:(t,o)=>{t.request.virtualField=o.payload},setRequestScope:(t,o)=>{t.request.scope=o.payload},setResults:(t,o)=>{t.results=o.payload},setFacets:(t,o)=>{t.facets=o.payload},setSpellcheck:(t,o)=>{t.spellcheck=o.payload},setLocales:(t,o)=>{t.locales=o.payload},setPaging:(t,o)=>{t.paging=o.payload},setLiveQuery:(t,o)=>{t.liveQuery=o.payload},setSuggestResults:(t,o)=>{t.suggestResults=o.payload}};var Pr,Mr,Fr,Tr,Dr,_r,Br,$r,zr,Hr,Gr,qr,Vr,Yr,Jr,Xr,Qr,ti;!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]"],i=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};function n(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 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 l(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise((function(o,e){t.onload=function(){o(t.result)},t.onerror=function(){e(t.error)}}))}function h(t){var o=new FileReader,e=f(o);return o.readAsArrayBuffer(t),e}function u(t){if(t.slice)return t.slice(0);var o=new Uint8Array(t.byteLength);return o.set(new Uint8Array(t)),o.buffer}function p(){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=u(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||i(t))?this._bodyArrayBuffer=u(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=l(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?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return function(t){var o=new FileReader,e=f(o);return o.readAsText(t),e}(this._bodyBlob);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(b)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(t,o){t=n(t),o=a(o);var e=this.map[t];this.map[t]=e?e+", "+o:o},c.prototype.delete=function(t){delete this.map[n(t)]},c.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},c.prototype.set=function(t,o){this.map[n(t)]=a(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)})),s(t)},c.prototype.values=function(){var t=[];return this.forEach((function(o){t.push(o)})),s(t)},c.prototype.entries=function(){var t=[];return this.forEach((function(o,e){t.push([e,o])})),s(t)},e.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var d=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(t,o){var e,r,i=(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,i||null==t._bodyInit||(i=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(),d.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)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function b(t){var o=new FormData;return t.trim().split("&").forEach((function(t){if(t){var e=t.split("="),r=e.shift().replace(/\+/g," "),i=e.join("=").replace(/\+/g," ");o.append(decodeURIComponent(r),decodeURIComponent(i))}})),o}function g(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})},p.call(y.prototype),p.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},g.error=function(){var t=new g(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];g.redirect=function(t,o){if(-1===m.indexOf(o))throw new RangeError("Invalid status code");return new g(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 v(t,r){return new Promise((function(i,n){var a=new y(t,r);if(a.signal&&a.signal.aborted)return n(new o.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function l(){s.abort()}s.onload=function(){var t,o,e={status:s.status,statusText:s.statusText,headers:(t=s.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 i=e.join(":").trim();o.append(r,i)}})),o)};e.url="responseURL"in s?s.responseURL:e.headers.get("X-Request-URL");var r="response"in s?s.response:s.responseText;i(new g(r,e))},s.onerror=function(){n(new TypeError("Network request failed"))},s.ontimeout=function(){n(new TypeError("Network request failed"))},s.onabort=function(){n(new o.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&&e.blob&&(s.responseType="blob"),a.headers.forEach((function(t,o){s.setRequestHeader(o,t)})),a.signal&&(a.signal.addEventListener("abort",l),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",l)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}v.polyfill=!0,t.fetch||(t.fetch=v,t.Headers=c,t.Request=y,t.Response=g),o.Headers=c,o.Request=y,o.Response=g,o.fetch=v,Object.defineProperty(o,"U",{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"}(Pr||(Pr={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(Mr||(Mr={})),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"}(Fr||(Fr={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(Tr||(Tr={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(Dr||(Dr={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(_r||(_r={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(Br||(Br={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}($r||($r={})),function(t){t.ASC="ASC",t.DESC="DESC"}(zr||(zr={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(Hr||(Hr={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(Gr||(Gr={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(qr||(qr={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(Vr||(Vr={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(Yr||(Yr={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(Jr||(Jr={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(Xr||(Xr={})),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"}(Qr||(Qr={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(ti||(ti={})),Qr.PERSONAL_BOOK_SHARE_USER,Qr.PERSONAL_BOOK_USER,Qr.HTML_EXPORT_USER,Qr.PERSONAL_BOOK_USER,Qr.PDF_EXPORT_USER,Qr.PERSONAL_BOOK_USER,Qr.KHUB_ADMIN,Qr.CONTENT_PUBLISHER,Qr.ADMIN,Qr.KHUB_ADMIN,Qr.USERS_ADMIN,Qr.PORTAL_ADMIN,Qr.DEVELOPER,Qr.BETA_USER,Qr.DEBUG_USER;const oi=Ot`
|
|
108
108
|
`,ei=Kr.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}});class ri{static build(t){const{baseUrl:o,apiIntegrationIdentifier:e}=ei.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static get(t){var o;return null!=t?ri.build(t):null!==(o=ri.API)&&void 0!==o?o:ri.API=ri.build()}static await(t){return new Promise((o=>{let e=ri.get(t);if(e)o(e);else{const r=ei.subscribe((()=>{e=ri.get(t),e&&(r(),o(e))}))}}))}}var ii;const ni=Symbol("clearAfterUnitTest");class ai{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new i,this.listeners={},this.currentUiLocale="",this[ii]=()=>{this.defaultMessages={},this.cache=new i,this.listeners={}},this.currentUiLocale=ei.getState().uiLocale,ei.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=ei.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,o){var e;if(t=t.toLowerCase(),Object.keys(o).length>0){const r={...null!==(e=this.defaultMessages[t])&&void 0!==e?e:{},...o};W(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,o,...e){var r,i,n;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(i=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==i?i:{};return new Ko(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},a).resolve(o,...e)}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=>A(0).then((()=>t())).catch((()=>null)))))}}ii=ni,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new ai((async(t,o)=>(await ri.await()).getFluidTopicsMessageContext(t,o)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new ai((async(t,o)=>(await ri.await()).getCustomMessageContext(t,o))));const si=window.FluidTopicsI18nService;var ci=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class li extends Wo{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>ri.get(),this.cache=new i,this.cleanSessionDebouncer=new n}render(){return eo`
|
|
109
109
|
<slot></slot>
|
|
110
|
-
`}update(t){super.update(t),t.has("baseUrl")&&(ei.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&ei.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&ei.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&ei.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&ei.actions.noCustom(this.noCustom),t.has("editorMode")&&ei.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&ei.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&ei.actions.session(this.session),t.has("availableUiLocales")&&ei.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>si.addContext(t))),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()))}}li.elementDefinitions={},li.styles=oi,ci([I()],li.prototype,"baseUrl",void 0),ci([I()],li.prototype,"apiIntegrationIdentifier",void 0),ci([I()],li.prototype,"uiLocale",void 0),ci([K(null)],li.prototype,"availableUiLocales",void 0),ci([K(null)],li.prototype,"metadataConfiguration",void 0),ci([I({type:Boolean})],li.prototype,"editorMode",void 0),ci([I({type:Boolean})],li.prototype,"noCustom",void 0),ci([I({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],li.prototype,"noCustomComponent",void 0),ci([I({type:Boolean})],li.prototype,"withManualResources",void 0),ci([K([])],li.prototype,"messageContexts",void 0),ci([K(void 0)],li.prototype,"session",void 0),ci([I({type:Object})],li.prototype,"apiProvider",void 0);class fi{async listMySearches(){var t;return(null===(t=ei.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await ri.await()).listMySearches(ei.getState().session.profile.userId):[]}}const hi=new i;class ui{async listMyBookmarks(){return hi.get("bookmarks",(async()=>(await ri.await()).listMyBookmarks(ei.getState().session.profile.userId)))}clearCache(){hi.clear("bookmarks")}}const pi=Kr.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const di=new class{constructor(){this.currentSession=ei.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new ui,ei.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=ei.getState();W(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==o?void 0:o.profile)||(this.currentSession=o,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){pi.actions.savedSearches(void 0)}clearMyBookmarks(){pi.actions.bookmarks(void 0)}async reloadMySearches(){const t=new fi,o=await t.listMySearches();pi.actions.savedSearches(o)}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;pi.actions.bookmarks(o)}}};k("ft-app-context")(li);class yi{static async build(){return new yi(await ri.await())}constructor(t){this.api=t,this.cache=new i,this.cache.registerFinal("available-locales",(()=>this.api.getAvailableSearchLocales()))}async launchSearch(t){return this.api.search(t)}async launchSuggest(t){return this.api.getSuggestions(t)}async getAvailableSearchLocales(){return this.cache.get("available-locales")}}const bi=t=>t.request.virtualField===Gr.TITLE_ONLY&&t.request.scope===Xr.DOCUMENTS;class gi extends Event{constructor(){super(gi.eventName)}}gi.eventName="search-context-clear-all-filters";class mi{static build(t){return new mi((t=>Kr.get({name:"ft-search-"+t,initialState:{request:{query:"",filters:[],facets:[],sort:[],paging:{page:1,perPage:20}},liveQuery:""},reducers:Zr}))(t.trim()||"context"),yi.build)}constructor(t,o){this.store=t,this.serviceProvider=o,this.ignoreEmptyQuery=!1,this.searchDebouncer=new n(100),this.suggestDebouncer=new n(300)}async initService(){return this.service=await this.serviceProvider(),this.store.actions.setLocales((await this.service.getAvailableSearchLocales()).contentLocales),this.launchSearch()}async awaitService(){return async function(t,o=10,e=2e4){let r,i,n=await t();for(r=i=performance.now();null==n&&(!e||i-r<e);)await A(o),n=await t(),i=performance.now();if(null==n)throw new Error("Timeout exceeded");return n}((()=>this.service))}setQuery(t){this.store.actions.setRequestQuery(t),this.store.actions.setLiveQuery(t),this.store.actions.setPageNumber(1),this.launchSearch()}setContentLocale(t){let o=this.store.getState().locales,e=this.store.getState().request.contentLocale;if(t!=e){if(o){const r=t=>o.some((o=>o.lang==t));r(t)||(t=r(e)?e:o[0].lang)}this.store.actions.setRequestContentLocale(t),this.store.actions.setPageNumber(1),this.store.actions.setRequestFilters([]),this.launchSearch()}return t}setPageSize(t){this.store.actions.setPageSize(t),this.launchSearch()}setPageNumber(t){this.store.actions.setPageNumber(t),this.launchSearch()}setSort(t){this.store.actions.setRequestSort(t),this.store.actions.setPageNumber(1),this.launchSearch()}setFilters(t){const o=t.filter((t=>t.values.length>0));this.store.actions.setRequestFilters(o),this.store.actions.setPageNumber(1),o.forEach((t=>{this.facetIds.includes(t.key)||(this.facetIds=[...this.facetIds,t.key])})),this.launchSearch()}setSearchInDocumentTitlesOnly(t){t?(this.store.actions.setRequestVirtualField(Gr.TITLE_ONLY),this.store.actions.setRequestScope(Xr.DOCUMENTS)):(this.store.actions.setRequestVirtualField(Gr.EVERYWHERE),this.store.actions.setRequestScope(Xr.DEFAULT)),this.launchSearch()}get searchInDocumentTitlesOnly(){return bi(this.store.getState())}clearAllFilters(){this.setFilters([]),this.store.eventBus.dispatchEvent(new gi)}addFacet(t){this.facetIds=[...this.facetIds,t],this.launchSearch()}replaceFacet(t,o){let e=this.facetIds.filter((o=>o!=t));o&&e.push(o),this.facetIds=e,this.launchSearch()}get facetIds(){return this.store.getState().request.facets.map((t=>t.id))}set facetIds(t){let o=[...new Set(t)].map((t=>({id:t})));this.store.actions.setRequestFacets(o)}setFilter(t,o){let e=this.store.getState().request.filters,r={key:t,values:o,negative:!1},i=[...e.filter((o=>o.key!==t)),r];this.setFilters(i)}setLiveQuery(t){this.store.actions.setLiveQuery(t),this.launchSuggest()}setRequest(t){this.store.actions.setRequest(t),this.store.actions.setLiveQuery(t.query),this.store.actions.setPageNumber(1),this.launchSearch()}setScope(t){this.store.actions.setRequestScope(t),this.launchSearch()}setIgnoreEmptyQuery(t){this.ignoreEmptyQuery=t,this.launchSearch()}async launchSearch(){return await this.awaitService(),this.searchDebouncer.run((()=>this.fetchSearchData()))}async launchSuggest(){await this.awaitService(),this.suggestDebouncer.run((()=>this.fetchSuggestData()))}async fetchSearchData(){var t,e;try{null===(t=this.cancelableSearch)||void 0===t||t.cancel();let o=this.store.getState().request;if(this.store.actions.setPaging(void 0),this.ignoreEmptyQuery&&0==o.query.length)this.store.actions.setResults(void 0),this.store.actions.setFacets(void 0),this.store.actions.setSpellcheck(void 0);else{this.cancelableSearch=r(this.service.launchSearch(o));const t=await this.cancelableSearch;if(t.paging.currentPage<=1)this.store.actions.setResults(t.results),this.store.actions.setFacets(t.facets),this.store.actions.setSpellcheck(t.spellcheck);else{let o=(null!==(e=this.store.getState().results)&&void 0!==e?e:[]).concat(t.results);this.store.actions.setResults(o)}this.store.actions.setPaging(t.paging)}}catch(t){t instanceof o||!this.errorHandler||this.errorHandler(t)}}async fetchSuggestData(){var t;try{const o=this.store.getState(),e=o.request,i={input:o.liveQuery,filters:e.filters,sort:e.sort,contentLocale:e.contentLocale,scope:e.scope};null===(t=this.cancelableSuggest)||void 0===t||t.cancel(),this.cancelableSuggest=r(this.service.launchSuggest(i));let n=await this.cancelableSuggest;this.store.actions.setSuggestResults(n.suggestions)}catch(t){t instanceof o||!this.errorHandler||this.errorHandler(t)}}clear(){this.store.clear()}}var vi=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class Oi extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const Ni=Symbol("registerInterval");class wi 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[Ni]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[Ni]):this.dispatchEvent(new Oi)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return o=Ni,vi([L()],e.prototype,"stateManager",void 0),e}($o)){}var Si=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class xi extends CustomEvent{constructor(t){super("ft-search-load-error",{detail:t})}}class Ei extends CustomEvent{constructor(t){super("ft-search-request-change",{detail:t})}}class Ci extends CustomEvent{constructor(t,o,e){super("ft-search-results-change",{detail:{request:t,paging:o,spellcheck:e}})}}class Ri extends $o{get stateManager(){return null==this._stateManager&&(this._stateManager=mi.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0")),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"search")),this._stateManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.filters=[],this.sort=[],this.addStore(ei)}render(){return eo`
|
|
110
|
+
`}update(t){super.update(t),t.has("baseUrl")&&(ei.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&ei.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&ei.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&ei.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&ei.actions.noCustom(this.noCustom),t.has("editorMode")&&ei.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&ei.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&ei.actions.session(this.session),t.has("availableUiLocales")&&ei.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>si.addContext(t))),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()))}}li.elementDefinitions={},li.styles=oi,ci([I()],li.prototype,"baseUrl",void 0),ci([I()],li.prototype,"apiIntegrationIdentifier",void 0),ci([I()],li.prototype,"uiLocale",void 0),ci([K(null)],li.prototype,"availableUiLocales",void 0),ci([K(null)],li.prototype,"metadataConfiguration",void 0),ci([I({type:Boolean})],li.prototype,"editorMode",void 0),ci([I({type:Boolean})],li.prototype,"noCustom",void 0),ci([I({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],li.prototype,"noCustomComponent",void 0),ci([I({type:Boolean})],li.prototype,"withManualResources",void 0),ci([K([])],li.prototype,"messageContexts",void 0),ci([K(void 0)],li.prototype,"session",void 0),ci([I({type:Object})],li.prototype,"apiProvider",void 0);class fi{async listMySearches(){var t;return(null===(t=ei.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await ri.await()).listMySearches(ei.getState().session.profile.userId):[]}}const hi=new i;class ui{async listMyBookmarks(){return hi.get("bookmarks",(async()=>(await ri.await()).listMyBookmarks(ei.getState().session.profile.userId)))}clearCache(){hi.clear("bookmarks")}}const pi=Kr.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const di=new class{constructor(){this.currentSession=ei.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new ui,ei.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=ei.getState();W(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==o?void 0:o.profile)||(this.currentSession=o,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){pi.actions.savedSearches(void 0)}clearMyBookmarks(){pi.actions.bookmarks(void 0)}async reloadMySearches(){const t=new fi,o=await t.listMySearches();pi.actions.savedSearches(o)}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;pi.actions.bookmarks(o)}}};k("ft-app-context")(li);class yi{static async build(){return new yi(await ri.await())}constructor(t){this.api=t,this.cache=new i,this.cache.registerFinal("available-locales",(()=>this.api.getAvailableSearchLocales()))}async launchSearch(t){return this.api.search(t)}async launchSuggest(t){return this.api.getSuggestions(t)}async getAvailableSearchLocales(){return this.cache.get("available-locales")}}const bi=t=>t.request.virtualField===Gr.TITLE_ONLY&&t.request.scope===Xr.DOCUMENTS;class gi extends Event{constructor(){super(gi.eventName)}}gi.eventName="search-context-clear-all-filters";class mi{static build(t){return new mi((t=>Kr.get({name:"ft-search-"+t,initialState:{request:{query:"",filters:[],facets:[],sort:[],paging:{page:1,perPage:20}},liveQuery:""},reducers:Zr}))(t.trim()||"context"),yi.build)}constructor(t,o){this.store=t,this.serviceProvider=o,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.searchDebouncer=new n(100),this.suggestDebouncer=new n(300)}async initService(){return this.service=await this.serviceProvider(),this.store.actions.setLocales((await this.service.getAvailableSearchLocales()).contentLocales),this.launchSearch()}async awaitService(){return async function(t,o=10,e=2e4){let r,i,n=await t();for(r=i=performance.now();null==n&&(!e||i-r<e);)await A(o),n=await t(),i=performance.now();if(null==n)throw new Error("Timeout exceeded");return n}((()=>this.service))}setQuery(t){this.store.actions.setRequestQuery(t),this.store.actions.setLiveQuery(t),this.store.actions.setPageNumber(1),this.launchSearch()}setContentLocale(t){let o=this.store.getState().locales,e=this.store.getState().request.contentLocale;if(t!=e){if(o){const r=t=>o.some((o=>o.lang==t));r(t)||(t=r(e)?e:o[0].lang)}this.store.actions.setRequestContentLocale(t),this.store.actions.setPageNumber(1),this.store.actions.setRequestFilters([]),this.launchSearch()}return t}setPageSize(t){this.store.actions.setPageSize(t),this.launchSearch()}setPageNumber(t){this.store.actions.setPageNumber(t),this.launchSearch()}setSort(t){this.store.actions.setRequestSort(t),this.store.actions.setPageNumber(1),this.launchSearch()}setFilters(t){const o=t.filter((t=>t.values.length>0));this.store.actions.setRequestFilters(o),this.store.actions.setPageNumber(1),o.forEach((t=>{this.facetIds.includes(t.key)||(this.facetIds=[...this.facetIds,t.key])})),this.launchSearch()}setSearchInDocumentTitlesOnly(t){t?(this.store.actions.setRequestVirtualField(Gr.TITLE_ONLY),this.store.actions.setRequestScope(Xr.DOCUMENTS)):(this.store.actions.setRequestVirtualField(Gr.EVERYWHERE),this.store.actions.setRequestScope(Xr.DEFAULT)),this.launchSearch()}get searchInDocumentTitlesOnly(){return bi(this.store.getState())}clearAllFilters(){this.setFilters([]),this.store.eventBus.dispatchEvent(new gi)}addFacet(t){this.facetIds=[...this.facetIds,t],this.launchSearch()}replaceFacet(t,o){let e=this.facetIds.filter((o=>o!=t));o&&e.push(o),this.facetIds=e,this.launchSearch()}get facetIds(){return this.store.getState().request.facets.map((t=>t.id))}set facetIds(t){let o=[...new Set(t)].map((t=>({id:t})));this.store.actions.setRequestFacets(o)}setFilter(t,o){let e=this.store.getState().request.filters,r={key:t,values:o,negative:!1},i=[...e.filter((o=>o.key!==t)),r];this.setFilters(i)}setLiveQuery(t){this.store.actions.setLiveQuery(t),this.launchSuggest()}setRequest(t){this.store.actions.setRequest(t),this.store.actions.setLiveQuery(t.query),this.store.actions.setPageNumber(1),this.launchSearch()}setScope(t){this.store.actions.setRequestScope(t),this.launchSearch()}setIgnoreEmptyQuery(t){this.ignoreEmptyQuery=t,this.launchSearch()}setOpenExternalDocumentInNewTab(t){this.openExternalDocumentInNewTab=t}async launchSearch(){return await this.awaitService(),this.searchDebouncer.run((()=>this.fetchSearchData()))}async launchSuggest(){await this.awaitService(),this.suggestDebouncer.run((()=>this.fetchSuggestData()))}async fetchSearchData(){var t,e;try{null===(t=this.cancelableSearch)||void 0===t||t.cancel();let o=this.store.getState().request;if(this.store.actions.setPaging(void 0),this.ignoreEmptyQuery&&0==o.query.length)this.store.actions.setResults(void 0),this.store.actions.setFacets(void 0),this.store.actions.setSpellcheck(void 0);else{this.cancelableSearch=r(this.service.launchSearch(o));const t=await this.cancelableSearch;if(t.paging.currentPage<=1)this.store.actions.setResults(t.results),this.store.actions.setFacets(t.facets),this.store.actions.setSpellcheck(t.spellcheck);else{let o=(null!==(e=this.store.getState().results)&&void 0!==e?e:[]).concat(t.results);this.store.actions.setResults(o)}this.store.actions.setPaging(t.paging)}}catch(t){t instanceof o||!this.errorHandler||this.errorHandler(t)}}async fetchSuggestData(){var t;try{const o=this.store.getState(),e=o.request,i={input:o.liveQuery,filters:e.filters,sort:e.sort,contentLocale:e.contentLocale,scope:e.scope};null===(t=this.cancelableSuggest)||void 0===t||t.cancel(),this.cancelableSuggest=r(this.service.launchSuggest(i));let n=await this.cancelableSuggest;this.store.actions.setSuggestResults(n.suggestions)}catch(t){t instanceof o||!this.errorHandler||this.errorHandler(t)}}clear(){this.store.clear()}}var vi=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class Oi extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const Ni=Symbol("registerInterval");class wi 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[Ni]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[Ni]):this.dispatchEvent(new Oi)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return o=Ni,vi([L()],e.prototype,"stateManager",void 0),e}($o)){}var Si=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class xi extends CustomEvent{constructor(t){super("ft-search-load-error",{detail:t})}}class Ei extends CustomEvent{constructor(t){super("ft-search-request-change",{detail:t})}}class Ci extends CustomEvent{constructor(t,o,e){super("ft-search-results-change",{detail:{request:t,paging:o,spellcheck:e}})}}class Ri extends $o{get stateManager(){return null==this._stateManager&&(this._stateManager=mi.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0")),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"search")),this._stateManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.addStore(ei)}render(){return eo`
|
|
111
111
|
<slot @register-ft-search-component=${this.registerComponent}></slot>
|
|
112
|
-
`}update(t){super.update(t),t.has("query")&&void 0!==this.query&&this.stateManager.setQuery(this.query),t.has("contentLocale")&&void 0!==this.contentLocale&&this.stateManager.setContentLocale(this.contentLocale),t.has("session")&&this.session&&this.stateManager.initService(),t.has("filters")&&void 0!==this.filters&&this.stateManager.setFilters(this.filters),t.has("sort")&&void 0!==this.sort&&this.stateManager.setSort(this.sort),t.has("pageSize")&&void 0!==this.pageSize&&this.stateManager.setPageSize(this.pageSize),t.has("searchInDocumentTitlesOnly")&&void 0!==this.searchInDocumentTitlesOnly&&this.stateManager.setSearchInDocumentTitlesOnly(this.searchInDocumentTitlesOnly),t.has("scope")&&void 0!==this.scope&&this.stateManager.setScope(this.scope),t.has("ignoreEmptyQuery")&&void 0!==this.ignoreEmptyQuery&&this.stateManager.setIgnoreEmptyQuery(this.ignoreEmptyQuery)}connectedCallback(){super.connectedCallback(),this.stateManager.setQuery(this.query),this.stateManager.setContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSort(this.sort)}contentAvailableCallback(t){super.contentAvailableCallback(t),t.has("request")&&this.request&&this.dispatchEvent(new Ei(this.request)),t.has("paging")&&void 0!==this.paging&&this.dispatchEvent(new Ci(this.request,this.paging,this.autocorrect))}registerComponent(t){t.stopPropagation();const o=t.composedPath()[0];this.register(o)}register(t){t.setSearchStateManager(this.stateManager)}handleLoadError(t){this.dispatchEvent(new xi(t))}reloadSavedSearches(){di.clearMySearches()}clear(){this.stateManager.clear()}}Ri.elementDefinitions={},Ri.styles=jr,Si([I()],Ri.prototype,"query",void 0),Si([I()],Ri.prototype,"contentLocale",void 0),Si([I({type:Number})],Ri.prototype,"pageSize",void 0),Si([I({type:Boolean})],Ri.prototype,"searchInDocumentTitlesOnly",void 0),Si([I()],Ri.prototype,"scope",void 0),Si([I({type:Boolean})],Ri.prototype,"ignoreEmptyQuery",void 0),Si([K([])],Ri.prototype,"filters",void 0),Si([K([])],Ri.prototype,"sort",void 0),Si([jo({store:"search"})],Ri.prototype,"request",void 0),Si([jo({store:"search"})],Ri.prototype,"paging",void 0),Si([jo({store:"search",selector:t=>t.spellcheck})],Ri.prototype,"autocorrect",void 0),Si([jo({store:ei.name})],Ri.prototype,"session",void 0),k("ft-search-context")(Ri),t.ClearAllFiltersEvent=gi,t.FtSearchContext=Ri,t.FtSearchContextCssVariables={},t.FtSearchStateManager=mi,t.LoadErrorEvent=xi,t.SearchRequestChangeEvent=Ei,t.SearchResultsChangeEvent=Ci,t.searchInDocumentTitlesOnlySelector=bi,t.styles=jr}({});
|
|
112
|
+
`}update(t){super.update(t),t.has("query")&&void 0!==this.query&&this.stateManager.setQuery(this.query),t.has("contentLocale")&&void 0!==this.contentLocale&&this.stateManager.setContentLocale(this.contentLocale),t.has("session")&&this.session&&this.stateManager.initService(),t.has("filters")&&void 0!==this.filters&&this.stateManager.setFilters(this.filters),t.has("sort")&&void 0!==this.sort&&this.stateManager.setSort(this.sort),t.has("pageSize")&&void 0!==this.pageSize&&this.stateManager.setPageSize(this.pageSize),t.has("searchInDocumentTitlesOnly")&&void 0!==this.searchInDocumentTitlesOnly&&this.stateManager.setSearchInDocumentTitlesOnly(this.searchInDocumentTitlesOnly),t.has("scope")&&void 0!==this.scope&&this.stateManager.setScope(this.scope),t.has("ignoreEmptyQuery")&&void 0!==this.ignoreEmptyQuery&&this.stateManager.setIgnoreEmptyQuery(this.ignoreEmptyQuery),t.has("openExternalDocumentInNewTab")&&void 0!==this.openExternalDocumentInNewTab&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab)}connectedCallback(){super.connectedCallback(),this.stateManager.setQuery(this.query),this.stateManager.setContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSort(this.sort)}contentAvailableCallback(t){super.contentAvailableCallback(t),t.has("request")&&this.request&&this.dispatchEvent(new Ei(this.request)),t.has("paging")&&void 0!==this.paging&&this.dispatchEvent(new Ci(this.request,this.paging,this.autocorrect))}registerComponent(t){t.stopPropagation();const o=t.composedPath()[0];this.register(o)}register(t){t.setSearchStateManager(this.stateManager)}handleLoadError(t){this.dispatchEvent(new xi(t))}reloadSavedSearches(){di.clearMySearches()}clear(){this.stateManager.clear()}}Ri.elementDefinitions={},Ri.styles=jr,Si([I()],Ri.prototype,"query",void 0),Si([I()],Ri.prototype,"contentLocale",void 0),Si([I({type:Number})],Ri.prototype,"pageSize",void 0),Si([I({type:Boolean})],Ri.prototype,"searchInDocumentTitlesOnly",void 0),Si([I()],Ri.prototype,"scope",void 0),Si([I({type:Boolean})],Ri.prototype,"ignoreEmptyQuery",void 0),Si([I({type:Boolean})],Ri.prototype,"openExternalDocumentInNewTab",void 0),Si([K([])],Ri.prototype,"filters",void 0),Si([K([])],Ri.prototype,"sort",void 0),Si([jo({store:"search"})],Ri.prototype,"request",void 0),Si([jo({store:"search"})],Ri.prototype,"paging",void 0),Si([jo({store:"search",selector:t=>t.spellcheck})],Ri.prototype,"autocorrect",void 0),Si([jo({store:ei.name})],Ri.prototype,"session",void 0),k("ft-search-context")(Ri),t.ClearAllFiltersEvent=gi,t.FtSearchContext=Ri,t.FtSearchContextCssVariables={},t.FtSearchStateManager=mi,t.LoadErrorEvent=xi,t.SearchRequestChangeEvent=Ei,t.SearchResultsChangeEvent=Ci,t.searchInDocumentTitlesOnlySelector=bi,t.styles=jr}({});
|
|
@@ -15,6 +15,7 @@ export declare class FtSearchStateManager {
|
|
|
15
15
|
service?: FtSearchService;
|
|
16
16
|
errorHandler?: (e: Error) => void;
|
|
17
17
|
ignoreEmptyQuery: boolean;
|
|
18
|
+
openExternalDocumentInNewTab: boolean;
|
|
18
19
|
constructor(store: FtReduxStore<FtSearchPageState, FtSearchPageStateReducers>, serviceProvider: () => Promise<FtSearchService>);
|
|
19
20
|
initService(): Promise<boolean>;
|
|
20
21
|
awaitService(): Promise<FtSearchService>;
|
|
@@ -36,6 +37,7 @@ export declare class FtSearchStateManager {
|
|
|
36
37
|
setRequest(request: FtSearchRequest): void;
|
|
37
38
|
setScope(scope: FtSearchScope): void;
|
|
38
39
|
setIgnoreEmptyQuery(ignoreEmptyQuery: boolean): void;
|
|
40
|
+
setOpenExternalDocumentInNewTab(openExternalDocumentInNewTab: boolean): void;
|
|
39
41
|
private searchDebouncer;
|
|
40
42
|
launchSearch(): Promise<boolean>;
|
|
41
43
|
private suggestDebouncer;
|
|
@@ -19,6 +19,7 @@ export class FtSearchStateManager {
|
|
|
19
19
|
this.store = store;
|
|
20
20
|
this.serviceProvider = serviceProvider;
|
|
21
21
|
this.ignoreEmptyQuery = false;
|
|
22
|
+
this.openExternalDocumentInNewTab = false;
|
|
22
23
|
this.searchDebouncer = new Debouncer(100);
|
|
23
24
|
this.suggestDebouncer = new Debouncer(300);
|
|
24
25
|
}
|
|
@@ -140,6 +141,9 @@ export class FtSearchStateManager {
|
|
|
140
141
|
this.ignoreEmptyQuery = ignoreEmptyQuery;
|
|
141
142
|
this.launchSearch();
|
|
142
143
|
}
|
|
144
|
+
setOpenExternalDocumentInNewTab(openExternalDocumentInNewTab) {
|
|
145
|
+
this.openExternalDocumentInNewTab = openExternalDocumentInNewTab;
|
|
146
|
+
}
|
|
143
147
|
async launchSearch() {
|
|
144
148
|
await this.awaitService();
|
|
145
149
|
return this.searchDebouncer.run(() => this.fetchSearchData());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-search-context",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.34",
|
|
4
4
|
"description": "Context block for integrated search components",
|
|
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-app-context": "1.1.
|
|
23
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
22
|
+
"@fluid-topics/ft-app-context": "1.1.34",
|
|
23
|
+
"@fluid-topics/ft-wc-utils": "1.1.34",
|
|
24
24
|
"lit": "3.1.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@fluid-topics/public-api": "1.0.
|
|
27
|
+
"@fluid-topics/public-api": "1.0.59"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "1e947e93e937ded84f056955b14b760e9dea7058"
|
|
30
30
|
}
|