@fluid-topics/ft-search-bar 1.1.35 → 1.1.37
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-bar.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export declare class FtSearchBar extends FtLitElement implements FtSearchBarProp
|
|
|
75
75
|
private get hasPriors();
|
|
76
76
|
hasLocaleSelector(): boolean;
|
|
77
77
|
focus(): void;
|
|
78
|
-
focusInput(): Promise<void>;
|
|
78
|
+
focusInput(react?: boolean): Promise<void>;
|
|
79
79
|
clear(): void;
|
|
80
80
|
protected render(): import("lit").TemplateResult<1>;
|
|
81
81
|
protected renderSearchBar(): import("lit").TemplateResult<1>;
|
package/build/ft-search-bar.js
CHANGED
|
@@ -169,9 +169,13 @@ class FtSearchBar extends FtLitElement {
|
|
|
169
169
|
var _a;
|
|
170
170
|
(_a = this.container) === null || _a === void 0 ? void 0 : _a.focus();
|
|
171
171
|
}
|
|
172
|
-
async focusInput() {
|
|
172
|
+
async focusInput(react = false) {
|
|
173
|
+
this.reactToFocus = react;
|
|
173
174
|
await waitFor(() => this.input, 50);
|
|
174
175
|
this.input.focus();
|
|
176
|
+
if (!react) {
|
|
177
|
+
this.enableFocusReactionOnAnyUserInteraction();
|
|
178
|
+
}
|
|
175
179
|
}
|
|
176
180
|
clear() {
|
|
177
181
|
this.query = "";
|
|
@@ -562,9 +566,7 @@ class FtSearchBar extends FtLitElement {
|
|
|
562
566
|
document.addEventListener("focusin", this.closeFloatingContainer);
|
|
563
567
|
document.addEventListener("click", this.closeFloatingContainer);
|
|
564
568
|
if (this.focusOnDisplay && !isTouchScreen) {
|
|
565
|
-
this.reactToFocus = false;
|
|
566
569
|
await this.focusInput();
|
|
567
|
-
this.enableFocusReactionOnAnyUserInteraction();
|
|
568
570
|
}
|
|
569
571
|
}
|
|
570
572
|
disconnectedCallback() {
|
|
@@ -2769,7 +2769,7 @@ const V=Symbol.for(""),q=t=>{if(t?.r===V)return t?._$litStatic$},Y=t=>({_$litSta
|
|
|
2769
2769
|
`;const Ur=o.css`
|
|
2770
2770
|
`,zr=e.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 Rr{static build(t){const{baseUrl:e,apiIntegrationIdentifier:o}=zr.getState(),i=null!=t?t:o;if(e&&i&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,i,!0)}static get(t){var e;return null!=t?Rr.build(t):null!==(e=Rr.API)&&void 0!==e?e:Rr.API=Rr.build()}static await(t){return new Promise((e=>{let o=Rr.get(t);if(o)e(o);else{const i=zr.subscribe((()=>{o=Rr.get(t),o&&(i(),e(o))}))}}))}}var Wr;const Br=Symbol("clearAfterUnitTest");class Zr{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new e.CacheRegistry,this.listeners={},this.currentUiLocale="",this[Wr]=()=>{this.defaultMessages={},this.cache=new e.CacheRegistry,this.listeners={}},this.currentUiLocale=zr.getState().uiLocale,zr.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=zr.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,o){var i;if(t=t.toLowerCase(),Object.keys(o).length>0){const r={...null!==(i=this.defaultMessages[t])&&void 0!==i?i:{},...o};e.deepEqual(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,o,...i){var r,a,n;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(a=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==a?a:{};return new e.ParametrizedLabelResolver(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},l).resolve(o,...i)}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=>e.delay(0).then((()=>t())).catch((()=>null)))))}}Wr=Br,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new Zr((async(t,e)=>(await Rr.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new Zr((async(t,e)=>(await Rr.await()).getCustomMessageContext(t,e))));const Kr=window.FluidTopicsI18nService;var Fr=function(t,e,o,i){for(var r,a=arguments.length,n=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,l=t.length-1;l>=0;l--)(r=t[l])&&(n=(a<3?r(n):a>3?r(e,o,n):r(e,o))||n);return a>3&&n&&Object.defineProperty(e,o,n),n};class Dr extends e.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=()=>Rr.get(),this.cache=new e.CacheRegistry,this.cleanSessionDebouncer=new e.Debouncer}render(){return o.html`
|
|
2771
2771
|
<slot></slot>
|
|
2772
|
-
`}update(t){super.update(t),t.has("baseUrl")&&(zr.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&zr.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&zr.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&zr.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&zr.actions.noCustom(this.noCustom),t.has("editorMode")&&zr.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&zr.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&zr.actions.session(this.session),t.has("availableUiLocales")&&zr.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Kr.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()))}}Dr.elementDefinitions={},Dr.styles=Ur,Fr([i.property()],Dr.prototype,"baseUrl",void 0),Fr([i.property()],Dr.prototype,"apiIntegrationIdentifier",void 0),Fr([i.property()],Dr.prototype,"uiLocale",void 0),Fr([e.jsonProperty(null)],Dr.prototype,"availableUiLocales",void 0),Fr([e.jsonProperty(null)],Dr.prototype,"metadataConfiguration",void 0),Fr([i.property({type:Boolean})],Dr.prototype,"editorMode",void 0),Fr([i.property({type:Boolean})],Dr.prototype,"noCustom",void 0),Fr([i.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Dr.prototype,"noCustomComponent",void 0),Fr([i.property({type:Boolean})],Dr.prototype,"withManualResources",void 0),Fr([e.jsonProperty([])],Dr.prototype,"messageContexts",void 0),Fr([e.jsonProperty(void 0)],Dr.prototype,"session",void 0),Fr([i.property({type:Object})],Dr.prototype,"apiProvider",void 0);class Ar{async listMySearches(){var t;return(null===(t=zr.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await Rr.await()).listMySearches(zr.getState().session.profile.userId):[]}}const Hr=new e.CacheRegistry;class Mr{async listMyBookmarks(){return Hr.get("bookmarks",(async()=>(await Rr.await()).listMyBookmarks(zr.getState().session.profile.userId)))}clearCache(){Hr.clear("bookmarks")}}const Pr=e.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=zr.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Mr,zr.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=zr.getState();e.deepEqual(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(){Pr.actions.savedSearches(void 0)}clearMyBookmarks(){Pr.actions.bookmarks(void 0)}async reloadMySearches(){const t=new Ar,e=await t.listMySearches();Pr.actions.savedSearches(e)}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;Pr.actions.bookmarks(e)}}},e.customElement("ft-app-context")(Dr);var jr=function(t,e,o,i){for(var r,a=arguments.length,n=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,l=t.length-1;l>=0;l--)(r=t[l])&&(n=(a<3?r(n):a>3?r(e,o,n):r(e,o))||n);return a>3&&n&&Object.defineProperty(e,o,n),n};null==window.fluidtopics&&console.warn("Fluid Topics public API was not found. You can find it here: https://www.npmjs.com/package/@fluid-topics/public-api");const Tr={filtersButton:"Filters",inputPlaceHolder:"Search",filterInputPlaceHolder:"Filter {0}",clearInputButton:"Clear",clearFilterButton:"Clear",displayMoreFilterValuesButton:"More",noFilterValuesAvailable:"No values available",searchButton:"Search",clearFilters:"Clear filters",contentLocaleSelector:"Lang",presetsSelector:"Quick filters",removeRecentSearch:"Remove",back:"Back"};class Gr extends CustomEvent{constructor(t){super("launch-search",{detail:t,bubbles:!0,composed:!0})}}class _r extends CustomEvent{constructor(t){super("change",{detail:t})}}const Vr=()=>{};class qr extends e.FtLitElement{isMobileMenuOpen(){return this.isMobile()&&(this.forceMobileMenuOpen||this.forceMenuOpen||this.mobileMenuOpen)}constructor(){super(),this.dense=!1,this.mode="auto",this.forceMobileMenuOpen=!1,this.forceMenuOpen=!1,this.baseUrl="",this.apiIntegrationIdentifier="ft-search-bar",this.availableContentLocales=[],this.availableContentLocalesInitialized=!1,this.labels={},this.labelResolver=new e.ParametrizedLabelResolver(Tr,{}),this.displayedFilters=[],this.presets=[],this.priors=[],this.searchRequestSerializer=t=>e.serializeRequest(this.baseUrl,t),this.focusOnDisplay=!1,this.searchFilters=[],this.sizeCategory=l.M,this.displayFacets=!1,this.mobileMenuOpen=!1,this.facets=[],this.facetsInitialized=!1,this.knownFacetLabels=new Map,this.query="",this.suggestions=[],this.recentSearches=[],this.reactToFocus=!0,this.suggestManager=new Cr(this),this.selectedFacetsManager=new Ir(this),this.desktopSearchBarManager=new Lr(this),this.mobileSearchBarManager=new Er(this,this.selectedFacetsManager,this.suggestManager),this.currentSession=zr.getState().session,this.stateChangeEventDebouncer=new e.Debouncer(10),this.updateLocalesDebouncer=new e.Debouncer(10),this.facetsLoaded=!1,this.updateFacetsDebouncer=new e.Debouncer(500),this.closeFloatingContainer=t=>{this.isMobile()||(this.displayFacets=this.displayFacets&&t.composedPath().some((t=>t===this.floatingContainer)))},this.compareFilters=(t,e)=>t.key===e.key&&t.negative==e.negative&&t.values.length===e.values.length&&t.values.every((t=>e.values.includes(t))),this.compareRequests=(t,e)=>(null==t.contentLocale||null==e.contentLocale||t.contentLocale===e.contentLocale)&&t.filters.length===e.filters.length&&t.filters.every((t=>e.filters.some((e=>this.compareFilters(t,e))))),this.enableFocusReactionCallback=()=>this.enableFocusReaction(),zr.subscribe((()=>this.reloadWhenUserSessionChanges()))}get request(){return{uiLocale:this.uiLocale,contentLocale:this.contentLocale,query:this.query,facets:this.facetsRequest,priors:this.hasPriors?this.priors:void 0,filters:this.searchFilters,paging:{perPage:0,page:1},sort:[]}}get facetsRequest(){const t=this.searchFilters.filter((t=>t.values.length>0&&!this.displayedFilters.includes(t.key))).map((t=>({id:t.key})));return[...this.displayedFilters.map((t=>({id:t}))),...t]}get suggestRequest(){return{contentLocale:this.contentLocale,input:this.query,filters:this.searchFilters,sort:[]}}isMobile(){switch(this.mode){case"mobile":return!0;case"desktop":return!1;default:return this.sizeCategory===l.S}}hasFacets(){return this.facetsRequest.length>0}get hasPresets(){return null!=this.presets&&this.presets.length>0}get hasPriors(){return null!=this.priors&&this.priors.length>0}hasLocaleSelector(){return this.availableContentLocales.length>1}focus(){var t;null===(t=this.container)||void 0===t||t.focus()}async focusInput(){await e.waitFor((()=>this.input),50),this.input.focus()}clear(){this.query="",this.searchFilters=[],this.input&&(this.input.value=""),this.mobileMenuOpen=!1,this.displayFacets=!1}render(){return o.html`
|
|
2772
|
+
`}update(t){super.update(t),t.has("baseUrl")&&(zr.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&zr.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&zr.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&zr.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&zr.actions.noCustom(this.noCustom),t.has("editorMode")&&zr.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&zr.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&zr.actions.session(this.session),t.has("availableUiLocales")&&zr.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Kr.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()))}}Dr.elementDefinitions={},Dr.styles=Ur,Fr([i.property()],Dr.prototype,"baseUrl",void 0),Fr([i.property()],Dr.prototype,"apiIntegrationIdentifier",void 0),Fr([i.property()],Dr.prototype,"uiLocale",void 0),Fr([e.jsonProperty(null)],Dr.prototype,"availableUiLocales",void 0),Fr([e.jsonProperty(null)],Dr.prototype,"metadataConfiguration",void 0),Fr([i.property({type:Boolean})],Dr.prototype,"editorMode",void 0),Fr([i.property({type:Boolean})],Dr.prototype,"noCustom",void 0),Fr([i.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Dr.prototype,"noCustomComponent",void 0),Fr([i.property({type:Boolean})],Dr.prototype,"withManualResources",void 0),Fr([e.jsonProperty([])],Dr.prototype,"messageContexts",void 0),Fr([e.jsonProperty(void 0)],Dr.prototype,"session",void 0),Fr([i.property({type:Object})],Dr.prototype,"apiProvider",void 0);class Ar{async listMySearches(){var t;return(null===(t=zr.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await Rr.await()).listMySearches(zr.getState().session.profile.userId):[]}}const Hr=new e.CacheRegistry;class Mr{async listMyBookmarks(){return Hr.get("bookmarks",(async()=>(await Rr.await()).listMyBookmarks(zr.getState().session.profile.userId)))}clearCache(){Hr.clear("bookmarks")}}const Pr=e.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=zr.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Mr,zr.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=zr.getState();e.deepEqual(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(){Pr.actions.savedSearches(void 0)}clearMyBookmarks(){Pr.actions.bookmarks(void 0)}async reloadMySearches(){const t=new Ar,e=await t.listMySearches();Pr.actions.savedSearches(e)}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;Pr.actions.bookmarks(e)}}},e.customElement("ft-app-context")(Dr);var jr=function(t,e,o,i){for(var r,a=arguments.length,n=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,l=t.length-1;l>=0;l--)(r=t[l])&&(n=(a<3?r(n):a>3?r(e,o,n):r(e,o))||n);return a>3&&n&&Object.defineProperty(e,o,n),n};null==window.fluidtopics&&console.warn("Fluid Topics public API was not found. You can find it here: https://www.npmjs.com/package/@fluid-topics/public-api");const Tr={filtersButton:"Filters",inputPlaceHolder:"Search",filterInputPlaceHolder:"Filter {0}",clearInputButton:"Clear",clearFilterButton:"Clear",displayMoreFilterValuesButton:"More",noFilterValuesAvailable:"No values available",searchButton:"Search",clearFilters:"Clear filters",contentLocaleSelector:"Lang",presetsSelector:"Quick filters",removeRecentSearch:"Remove",back:"Back"};class Gr extends CustomEvent{constructor(t){super("launch-search",{detail:t,bubbles:!0,composed:!0})}}class _r extends CustomEvent{constructor(t){super("change",{detail:t})}}const Vr=()=>{};class qr extends e.FtLitElement{isMobileMenuOpen(){return this.isMobile()&&(this.forceMobileMenuOpen||this.forceMenuOpen||this.mobileMenuOpen)}constructor(){super(),this.dense=!1,this.mode="auto",this.forceMobileMenuOpen=!1,this.forceMenuOpen=!1,this.baseUrl="",this.apiIntegrationIdentifier="ft-search-bar",this.availableContentLocales=[],this.availableContentLocalesInitialized=!1,this.labels={},this.labelResolver=new e.ParametrizedLabelResolver(Tr,{}),this.displayedFilters=[],this.presets=[],this.priors=[],this.searchRequestSerializer=t=>e.serializeRequest(this.baseUrl,t),this.focusOnDisplay=!1,this.searchFilters=[],this.sizeCategory=l.M,this.displayFacets=!1,this.mobileMenuOpen=!1,this.facets=[],this.facetsInitialized=!1,this.knownFacetLabels=new Map,this.query="",this.suggestions=[],this.recentSearches=[],this.reactToFocus=!0,this.suggestManager=new Cr(this),this.selectedFacetsManager=new Ir(this),this.desktopSearchBarManager=new Lr(this),this.mobileSearchBarManager=new Er(this,this.selectedFacetsManager,this.suggestManager),this.currentSession=zr.getState().session,this.stateChangeEventDebouncer=new e.Debouncer(10),this.updateLocalesDebouncer=new e.Debouncer(10),this.facetsLoaded=!1,this.updateFacetsDebouncer=new e.Debouncer(500),this.closeFloatingContainer=t=>{this.isMobile()||(this.displayFacets=this.displayFacets&&t.composedPath().some((t=>t===this.floatingContainer)))},this.compareFilters=(t,e)=>t.key===e.key&&t.negative==e.negative&&t.values.length===e.values.length&&t.values.every((t=>e.values.includes(t))),this.compareRequests=(t,e)=>(null==t.contentLocale||null==e.contentLocale||t.contentLocale===e.contentLocale)&&t.filters.length===e.filters.length&&t.filters.every((t=>e.filters.some((e=>this.compareFilters(t,e))))),this.enableFocusReactionCallback=()=>this.enableFocusReaction(),zr.subscribe((()=>this.reloadWhenUserSessionChanges()))}get request(){return{uiLocale:this.uiLocale,contentLocale:this.contentLocale,query:this.query,facets:this.facetsRequest,priors:this.hasPriors?this.priors:void 0,filters:this.searchFilters,paging:{perPage:0,page:1},sort:[]}}get facetsRequest(){const t=this.searchFilters.filter((t=>t.values.length>0&&!this.displayedFilters.includes(t.key))).map((t=>({id:t.key})));return[...this.displayedFilters.map((t=>({id:t}))),...t]}get suggestRequest(){return{contentLocale:this.contentLocale,input:this.query,filters:this.searchFilters,sort:[]}}isMobile(){switch(this.mode){case"mobile":return!0;case"desktop":return!1;default:return this.sizeCategory===l.S}}hasFacets(){return this.facetsRequest.length>0}get hasPresets(){return null!=this.presets&&this.presets.length>0}get hasPriors(){return null!=this.priors&&this.priors.length>0}hasLocaleSelector(){return this.availableContentLocales.length>1}focus(){var t;null===(t=this.container)||void 0===t||t.focus()}async focusInput(t=!1){this.reactToFocus=t,await e.waitFor((()=>this.input),50),this.input.focus(),t||this.enableFocusReactionOnAnyUserInteraction()}clear(){this.query="",this.searchFilters=[],this.input&&(this.input.value=""),this.mobileMenuOpen=!1,this.displayFacets=!1}render(){return o.html`
|
|
2773
2773
|
<ft-size-watcher @change=${this.updateSize}></ft-size-watcher>
|
|
2774
2774
|
${this.renderSearchBar()}
|
|
2775
2775
|
`}renderSearchBar(){return this.facetsInitialized&&this.availableContentLocalesInitialized?this.isMobile()?this.mobileSearchBarManager.render():this.desktopSearchBarManager.render():o.html`
|
|
@@ -2905,7 +2905,7 @@ const V=Symbol.for(""),q=t=>{if(t?.r===V)return t?._$litStatic$},Y=t=>({_$litSta
|
|
|
2905
2905
|
></ft-filter>
|
|
2906
2906
|
`}))}
|
|
2907
2907
|
</ft-snap-scroll>
|
|
2908
|
-
`:o.nothing}async firstUpdated(t){super.firstUpdated(t),this.initApi(),window.addEventListener("storage",(t=>{t.key===this.recentSearchesStorageKey&&this.initRecentSearches()}))}update(t){var o,i,r,a,n;if(t.has("labels")&&(this.labelResolver=new e.ParametrizedLabelResolver(Tr,this.labels)),t.has("sizeCategory")&&(this.mobileMenuOpen=!1,this.displayFacets=this.displayFacets&&!this.isMobile()),super.update(t),(t.has("availableContentLocales")||t.has("contentLocale"))&&this.availableContentLocales.length>0){const e=t=>this.availableContentLocales.some((e=>e.lang==t));e(this.contentLocale)||(this.contentLocale=t.has("contentLocale")&&e(t.get("contentLocale"))?t.get("contentLocale"):null===(o=this.availableContentLocales[0])||void 0===o?void 0:o.lang)}if(t.has("baseUrl")&&this.baseUrl&&(this.baseUrl.endsWith("/")&&(this.baseUrl=this.baseUrl.replace(/\/$/,"")),this.initRecentSearches()),t.has("presets")&&(null!==(i=this.presets)&&void 0!==i?i:[]).forEach((t=>t.filters.forEach((t=>t.values=t.values.map((t=>ce(t))))))),t.has("presets")||t.has("selectedPreset")){const t=(null!==(r=this.presets)&&void 0!==r?r:[]).find((t=>t.name===this.selectedPreset));t&&!this.compareRequests(this.request,t)&&this.setFiltersFromPreset(t)}t.has("contentLocale")&&null!=this.contentLocale&&(this.knownFacetLabels=new Map),["contentLocale","searchFilters"].some((e=>t.has(e)))&&(this.selectedPreset=null===(n=(null!==(a=this.presets)&&void 0!==a?a:[]).find((t=>this.compareRequests(t,this.request))))||void 0===n?void 0:n.name),["baseUrl","apiIntegrationIdentifier"].some((e=>t.has(e)))&&(this.api=void 0,this.initApi()),t.has("api")&&this.api&&this.initSearchData(),["uiLocale","contentLocale","searchFilters","displayedFilters"].some((e=>t.has(e)))&&this.updateFacets(),["query","uiLocale","contentLocale","searchFilters","displayedFilters","api"].some((e=>t.has(e)))&&this.suggestManager.update(),["query","uiLocale","contentLocale","searchFilters"].some((e=>t.has(e)))&&this.dispatchStateChangeEvent()}dispatchStateChangeEvent(){this.stateChangeEventDebouncer.run((()=>this.dispatchEvent(new _r(this.request))))}initSearchData(){this.availableContentLocalesInitialized=!1,this.facetsLoaded=!1,this.facetsInitialized=!1,this.updateLocalesDebouncer.run((()=>{var t;null===(t=this.api)||void 0===t||t.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[])).then((t=>{this.availableContentLocales=t,this.availableContentLocalesInitialized=!0}))})),this.updateFacetsDebouncer.run((()=>{this.retrieveFacetsFromSearch().then((()=>{this.facetsLoaded=!0,this.facetsInitialized=!0}))}),this.facetsInitialized?500:10)}updateFacets(){this.api&&(this.facetsRequest.length>0?(this.facetsLoaded=!1,this.updateFacetsDebouncer.run((async()=>{await this.retrieveFacetsFromSearch(),this.facetsLoaded=!0,this.facetsInitialized=!0}),this.facetsInitialized?500:10)):this.facets=[])}contentAvailableCallback(t){var e,o,i;if(super.contentAvailableCallback(t),t.has("displayFacets")&&this.displayFacets&&(null===(e=this.floatingContainer)||void 0===e||e.focus()),null!=this.scrollToFacet&&this.facetsLoaded){null===(o=this.scrollingFiltersContainer)||void 0===o||o.scrollIndexIntoView(this.facets.findIndex((t=>t.key===this.scrollToFacet)));const t=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector(`ft-accordion-item[data-facet-key="${this.scrollToFacet}"]`);t&&(t.active=!0),this.scrollToFacet=void 0}}initApi(){null==this.api&&(this.api=window.fluidtopics?new window.fluidtopics.FluidTopicsApi(this.baseUrl,this.apiIntegrationIdentifier,!0):void 0,setTimeout((()=>this.initApi()),10))}async retrieveFacetsFromSearch(){var t;const e=new Map;await(null===(t=this.api)||void 0===t?void 0:t.search({...this.request,query:""}).then((t=>t.facets.forEach((t=>{this.knownFacetLabels.set(t.key,t.label),e.set(t.key,t)})))).catch(Vr)),this.facets=[];for(let t of this.facetsRequest)e.has(t.id)?this.facets.push(e.get(t.id)):this.knownFacetLabels.has(t.id)&&this.facets.push({key:t.id,label:this.knownFacetLabels.get(t.id),rootNodes:[],multiSelectionable:!0,hierarchical:!1})}onFloatingContainerKeyUp(t){var e;"Escape"===t.key&&(this.displayFacets=!1,null===(e=this.filtersOpener)||void 0===e||e.focus())}setQuery(t){this.input&&(this.input.value=t),this.query=t}launchSearch(){if(this.query){let t=this.recentSearches.filter((t=>t.toLowerCase()!==this.query.toLowerCase())).filter(((t,e)=>e<20));this.recentSearches=[this.query,...t],this.saveRecentSearches()}this.dispatchEvent(new Gr(this.request)),this.mobileMenuOpen=!1,this.displayFacets=!1,this.focus()}get recentSearchesStorageKey(){return this.baseUrl+":ft:recent-search-queries"}initRecentSearches(){var t;this.recentSearches=JSON.parse(null!==(t=window.localStorage.getItem(this.recentSearchesStorageKey))&&void 0!==t?t:"[]")}saveRecentSearches(){const t=JSON.stringify(this.recentSearches);window.localStorage.setItem(this.recentSearchesStorageKey,t),window.dispatchEvent(new StorageEvent("storage",{key:this.recentSearchesStorageKey,newValue:t,storageArea:window.localStorage,url:window.location.href}))}async connectedCallback(){super.connectedCallback(),document.addEventListener("focusin",this.closeFloatingContainer),document.addEventListener("click",this.closeFloatingContainer),this.focusOnDisplay&&!e.isTouchScreen&&
|
|
2908
|
+
`:o.nothing}async firstUpdated(t){super.firstUpdated(t),this.initApi(),window.addEventListener("storage",(t=>{t.key===this.recentSearchesStorageKey&&this.initRecentSearches()}))}update(t){var o,i,r,a,n;if(t.has("labels")&&(this.labelResolver=new e.ParametrizedLabelResolver(Tr,this.labels)),t.has("sizeCategory")&&(this.mobileMenuOpen=!1,this.displayFacets=this.displayFacets&&!this.isMobile()),super.update(t),(t.has("availableContentLocales")||t.has("contentLocale"))&&this.availableContentLocales.length>0){const e=t=>this.availableContentLocales.some((e=>e.lang==t));e(this.contentLocale)||(this.contentLocale=t.has("contentLocale")&&e(t.get("contentLocale"))?t.get("contentLocale"):null===(o=this.availableContentLocales[0])||void 0===o?void 0:o.lang)}if(t.has("baseUrl")&&this.baseUrl&&(this.baseUrl.endsWith("/")&&(this.baseUrl=this.baseUrl.replace(/\/$/,"")),this.initRecentSearches()),t.has("presets")&&(null!==(i=this.presets)&&void 0!==i?i:[]).forEach((t=>t.filters.forEach((t=>t.values=t.values.map((t=>ce(t))))))),t.has("presets")||t.has("selectedPreset")){const t=(null!==(r=this.presets)&&void 0!==r?r:[]).find((t=>t.name===this.selectedPreset));t&&!this.compareRequests(this.request,t)&&this.setFiltersFromPreset(t)}t.has("contentLocale")&&null!=this.contentLocale&&(this.knownFacetLabels=new Map),["contentLocale","searchFilters"].some((e=>t.has(e)))&&(this.selectedPreset=null===(n=(null!==(a=this.presets)&&void 0!==a?a:[]).find((t=>this.compareRequests(t,this.request))))||void 0===n?void 0:n.name),["baseUrl","apiIntegrationIdentifier"].some((e=>t.has(e)))&&(this.api=void 0,this.initApi()),t.has("api")&&this.api&&this.initSearchData(),["uiLocale","contentLocale","searchFilters","displayedFilters"].some((e=>t.has(e)))&&this.updateFacets(),["query","uiLocale","contentLocale","searchFilters","displayedFilters","api"].some((e=>t.has(e)))&&this.suggestManager.update(),["query","uiLocale","contentLocale","searchFilters"].some((e=>t.has(e)))&&this.dispatchStateChangeEvent()}dispatchStateChangeEvent(){this.stateChangeEventDebouncer.run((()=>this.dispatchEvent(new _r(this.request))))}initSearchData(){this.availableContentLocalesInitialized=!1,this.facetsLoaded=!1,this.facetsInitialized=!1,this.updateLocalesDebouncer.run((()=>{var t;null===(t=this.api)||void 0===t||t.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[])).then((t=>{this.availableContentLocales=t,this.availableContentLocalesInitialized=!0}))})),this.updateFacetsDebouncer.run((()=>{this.retrieveFacetsFromSearch().then((()=>{this.facetsLoaded=!0,this.facetsInitialized=!0}))}),this.facetsInitialized?500:10)}updateFacets(){this.api&&(this.facetsRequest.length>0?(this.facetsLoaded=!1,this.updateFacetsDebouncer.run((async()=>{await this.retrieveFacetsFromSearch(),this.facetsLoaded=!0,this.facetsInitialized=!0}),this.facetsInitialized?500:10)):this.facets=[])}contentAvailableCallback(t){var e,o,i;if(super.contentAvailableCallback(t),t.has("displayFacets")&&this.displayFacets&&(null===(e=this.floatingContainer)||void 0===e||e.focus()),null!=this.scrollToFacet&&this.facetsLoaded){null===(o=this.scrollingFiltersContainer)||void 0===o||o.scrollIndexIntoView(this.facets.findIndex((t=>t.key===this.scrollToFacet)));const t=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector(`ft-accordion-item[data-facet-key="${this.scrollToFacet}"]`);t&&(t.active=!0),this.scrollToFacet=void 0}}initApi(){null==this.api&&(this.api=window.fluidtopics?new window.fluidtopics.FluidTopicsApi(this.baseUrl,this.apiIntegrationIdentifier,!0):void 0,setTimeout((()=>this.initApi()),10))}async retrieveFacetsFromSearch(){var t;const e=new Map;await(null===(t=this.api)||void 0===t?void 0:t.search({...this.request,query:""}).then((t=>t.facets.forEach((t=>{this.knownFacetLabels.set(t.key,t.label),e.set(t.key,t)})))).catch(Vr)),this.facets=[];for(let t of this.facetsRequest)e.has(t.id)?this.facets.push(e.get(t.id)):this.knownFacetLabels.has(t.id)&&this.facets.push({key:t.id,label:this.knownFacetLabels.get(t.id),rootNodes:[],multiSelectionable:!0,hierarchical:!1})}onFloatingContainerKeyUp(t){var e;"Escape"===t.key&&(this.displayFacets=!1,null===(e=this.filtersOpener)||void 0===e||e.focus())}setQuery(t){this.input&&(this.input.value=t),this.query=t}launchSearch(){if(this.query){let t=this.recentSearches.filter((t=>t.toLowerCase()!==this.query.toLowerCase())).filter(((t,e)=>e<20));this.recentSearches=[this.query,...t],this.saveRecentSearches()}this.dispatchEvent(new Gr(this.request)),this.mobileMenuOpen=!1,this.displayFacets=!1,this.focus()}get recentSearchesStorageKey(){return this.baseUrl+":ft:recent-search-queries"}initRecentSearches(){var t;this.recentSearches=JSON.parse(null!==(t=window.localStorage.getItem(this.recentSearchesStorageKey))&&void 0!==t?t:"[]")}saveRecentSearches(){const t=JSON.stringify(this.recentSearches);window.localStorage.setItem(this.recentSearchesStorageKey,t),window.dispatchEvent(new StorageEvent("storage",{key:this.recentSearchesStorageKey,newValue:t,storageArea:window.localStorage,url:window.location.href}))}async connectedCallback(){super.connectedCallback(),document.addEventListener("focusin",this.closeFloatingContainer),document.addEventListener("click",this.closeFloatingContainer),this.focusOnDisplay&&!e.isTouchScreen&&await this.focusInput()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("focusin",this.closeFloatingContainer),document.addEventListener("click",this.closeFloatingContainer)}updateSize(t){this.sizeCategory=t.detail.category}setFilter(t,o){let i=this.searchFilters.filter((e=>e.key!==t));this.facets.forEach((i=>{i.key===t&&e.flatDeep(i.rootNodes,(t=>t.childNodes)).forEach((t=>t.selected=o.includes(t.value)))})),o.length&&i.push({key:t,negative:!1,values:o}),this.searchFilters=i,this.scrollToFacet=t}setFiltersFromPreset(t){null!=t&&(null!=t.contentLocale&&(this.contentLocale=t.contentLocale),this.searchFilters=t.filters)}clearFilters(){this.facets.forEach((t=>e.flatDeep(t.rootNodes,(t=>t.childNodes)).forEach((t=>t.selected=!1)))),this.searchFilters=[];const t=this.facets[0];this.scrollToFacet=null==t?void 0:t.key}querySelector(t){return this.shadowRoot.querySelector(t)}querySelectorAll(t){return this.shadowRoot.querySelectorAll(t)}renderDesktopFloatingMenu(){return this.forceMenuOpen?o.nothing:o.html`
|
|
2909
2909
|
<div class="ft-search-bar--floating-panel"
|
|
2910
2910
|
id="ft-search-bar-floating-panel"
|
|
2911
2911
|
@keyup=${this.onFloatingContainerKeyUp}
|
|
@@ -87,7 +87,7 @@ let ke=class extends Ht{constructor(){super(...arguments),this.renderOptions={ho
|
|
|
87
87
|
* Copyright 2019 Google LLC
|
|
88
88
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
89
89
|
*/
|
|
90
|
-
const Do=window,jo=Do.ShadowRoot&&(void 0===Do.ShadyCSS||Do.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype;class Ko extends ke{createRenderRoot(){const t=this.constructor;t.elementDefinitions&&!t.registry&&(t.registry=new CustomElementRegistry,Object.entries(t.elementDefinitions).forEach((([e,o])=>t.registry.define(e,o))));const e={...t.shadowRootOptions,customElements:t.registry},o=this.renderOptions.creationScope=this.attachShadow(e);return((t,e)=>{jo?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const o=document.createElement("style"),i=Do.litNonce;void 0!==i&&o.setAttribute("nonce",i),o.textContent=e.cssText,t.appendChild(o)}))})(o,t.elementStyles),o}}var Mo,Po=function(t,e,o,i){for(var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,o,a):r(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const Zo=Symbol("constructorPrototype"),To=Symbol("constructorName"),Ho=Symbol("exportpartsDebouncer");class _o extends Ko{constructor(){super(),this[Mo]=new r(5),this[To]=this.constructor.name,this[Zo]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[To]&&Object.setPrototypeOf(this,this[Zo])}updated(t){super.updated(t),
|
|
90
|
+
const Do=window,jo=Do.ShadowRoot&&(void 0===Do.ShadyCSS||Do.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype;class Ko extends ke{createRenderRoot(){const t=this.constructor;t.elementDefinitions&&!t.registry&&(t.registry=new CustomElementRegistry,Object.entries(t.elementDefinitions).forEach((([e,o])=>t.registry.define(e,o))));const e={...t.shadowRootOptions,customElements:t.registry},o=this.renderOptions.creationScope=this.attachShadow(e);return((t,e)=>{jo?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const o=document.createElement("style"),i=Do.litNonce;void 0!==i&&o.setAttribute("nonce",i),o.textContent=e.cssText,t.appendChild(o)}))})(o,t.elementStyles),o}}var Mo,Po=function(t,e,o,i){for(var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,o,a):r(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const Zo=Symbol("constructorPrototype"),To=Symbol("constructorName"),Ho=Symbol("exportpartsDebouncer");class _o extends Ko{constructor(){super(),this[Mo]=new r(5),this[To]=this.constructor.name,this[Zo]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[To]&&Object.setPrototypeOf(this,this[Zo])}updated(t){super.updated(t),this.updateComplete.then((()=>{this.contentAvailableCallback(t),this.scheduleExportpartsUpdate()}))}contentAvailableCallback(t){var e,o;if((null!==(o=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll(".ft-lit-element--custom-stylesheet"))&&void 0!==o?o:[]).forEach((t=>t.remove())),this.customStylesheet){const t=document.createElement("style");t.classList.add("ft-lit-element--custom-stylesheet"),t.innerHTML=this.customStylesheet,this.shadowRoot.append(t)}}scheduleExportpartsUpdate(){var t,e,o;((null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())||null!==(o=null===(e=this.exportpartsPrefixes)||void 0===e?void 0:e.length)&&void 0!==o&&o)&&this[Ho].run((()=>{var t,e;(null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())?this.setExportpartsAttribute([this.exportpartsPrefix]):null!=this.exportpartsPrefixes&&(null===(e=this.exportpartsPrefixes)||void 0===e?void 0:e.length)>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)}))}setExportpartsAttribute(t){var e,o,i,r,n,a;const s=t=>null!=t&&t.trim().length>0,l=t.filter(s).map((t=>t.trim()));if(0===l.length)return void this.removeAttribute("exportparts");const c=new Set;for(let t of null!==(o=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll("[part],[exportparts]"))&&void 0!==o?o:[]){const e=null!==(r=null===(i=t.getAttribute("part"))||void 0===i?void 0:i.split(" "))&&void 0!==r?r:[],o=null!==(a=null===(n=t.getAttribute("exportparts"))||void 0===n?void 0:n.split(",").map((t=>t.split(":")[1])))&&void 0!==a?a:[];new Array(...e,...o).filter(s).map((t=>t.trim())).forEach((t=>c.add(t)))}if(0===c.size)return void this.removeAttribute("exportparts");const f=[...c.values()].flatMap((t=>l.map((e=>`${t}:${e}--${t}`))));this.setAttribute("exportparts",[...this.part,...f].join(", "))}}Mo=Ho,Po([E()],_o.prototype,"exportpartsPrefix",void 0),Po([D([])],_o.prototype,"exportpartsPrefixes",void 0),Po([E()],_o.prototype,"customStylesheet",void 0);const Vo=Ie.create("--ft-utils-highlight-html-background-color","","COLOR","#FFF26E");It`
|
|
91
91
|
.highlight-html-match {
|
|
92
92
|
background: ${Vo};
|
|
93
93
|
}
|
|
@@ -2916,7 +2916,7 @@ function(t){return(e,o)=>{const{slot:i,selector:r}=t??{},n="slot"+(i?`[name=${i}
|
|
|
2916
2916
|
`;const Jl=It`
|
|
2917
2917
|
`,Xl=Gr.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 Ql{static build(t){const{baseUrl:e,apiIntegrationIdentifier:o}=Xl.getState(),i=null!=t?t:o;if(e&&i&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,i,!0)}static get(t){var e;return null!=t?Ql.build(t):null!==(e=Ql.API)&&void 0!==e?e:Ql.API=Ql.build()}static await(t){return new Promise((e=>{let o=Ql.get(t);if(o)e(o);else{const i=Xl.subscribe((()=>{o=Ql.get(t),o&&(i(),e(o))}))}}))}}var tc;const ec=Symbol("clearAfterUnitTest");class oc{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new i,this.listeners={},this.currentUiLocale="",this[tc]=()=>{this.defaultMessages={},this.cache=new i,this.listeners={}},this.currentUiLocale=Xl.getState().uiLocale,Xl.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Xl.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 i={...null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},...e};B(this.defaultMessages[t],i)||(this.defaultMessages[t]=i,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...o){var i,r,n;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(r=null===(i=this.cache.getNow(t))||void 0===i?void 0:i.messages)&&void 0!==r?r:{};return new Jo(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},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=>z(0).then((()=>t())).catch((()=>null)))))}}tc=ec,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new oc((async(t,e)=>(await Ql.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new oc((async(t,e)=>(await Ql.await()).getCustomMessageContext(t,e))));const ic=window.FluidTopicsI18nService;var rc=function(t,e,o,i){for(var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,o,a):r(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class nc extends _o{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=()=>Ql.get(),this.cache=new i,this.cleanSessionDebouncer=new r}render(){return he`
|
|
2918
2918
|
<slot></slot>
|
|
2919
|
-
`}update(t){super.update(t),t.has("baseUrl")&&(Xl.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Xl.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Xl.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Xl.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Xl.actions.noCustom(this.noCustom),t.has("editorMode")&&Xl.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Xl.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Xl.actions.session(this.session),t.has("availableUiLocales")&&Xl.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>ic.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()))}}nc.elementDefinitions={},nc.styles=Jl,rc([E()],nc.prototype,"baseUrl",void 0),rc([E()],nc.prototype,"apiIntegrationIdentifier",void 0),rc([E()],nc.prototype,"uiLocale",void 0),rc([D(null)],nc.prototype,"availableUiLocales",void 0),rc([D(null)],nc.prototype,"metadataConfiguration",void 0),rc([E({type:Boolean})],nc.prototype,"editorMode",void 0),rc([E({type:Boolean})],nc.prototype,"noCustom",void 0),rc([E({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],nc.prototype,"noCustomComponent",void 0),rc([E({type:Boolean})],nc.prototype,"withManualResources",void 0),rc([D([])],nc.prototype,"messageContexts",void 0),rc([D(void 0)],nc.prototype,"session",void 0),rc([E({type:Object})],nc.prototype,"apiProvider",void 0);class ac{async listMySearches(){var t;return(null===(t=Xl.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await Ql.await()).listMySearches(Xl.getState().session.profile.userId):[]}}const sc=new i;class lc{async listMyBookmarks(){return sc.get("bookmarks",(async()=>(await Ql.await()).listMyBookmarks(Xl.getState().session.profile.userId)))}clearCache(){sc.clear("bookmarks")}}const cc=Gr.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=Xl.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new lc,Xl.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Xl.getState();B(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(){cc.actions.savedSearches(void 0)}clearMyBookmarks(){cc.actions.bookmarks(void 0)}async reloadMySearches(){const t=new ac,e=await t.listMySearches();cc.actions.savedSearches(e)}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;cc.actions.bookmarks(e)}}},A("ft-app-context")(nc);var fc=function(t,e,o,i){for(var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,o,a):r(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};null==window.fluidtopics&&console.warn("Fluid Topics public API was not found. You can find it here: https://www.npmjs.com/package/@fluid-topics/public-api");const hc={filtersButton:"Filters",inputPlaceHolder:"Search",filterInputPlaceHolder:"Filter {0}",clearInputButton:"Clear",clearFilterButton:"Clear",displayMoreFilterValuesButton:"More",noFilterValuesAvailable:"No values available",searchButton:"Search",clearFilters:"Clear filters",contentLocaleSelector:"Lang",presetsSelector:"Quick filters",removeRecentSearch:"Remove",back:"Back"};class pc extends CustomEvent{constructor(t){super("launch-search",{detail:t,bubbles:!0,composed:!0})}}class dc extends CustomEvent{constructor(t){super("change",{detail:t})}}const uc=()=>{};class bc extends _o{isMobileMenuOpen(){return this.isMobile()&&(this.forceMobileMenuOpen||this.forceMenuOpen||this.mobileMenuOpen)}constructor(){super(),this.dense=!1,this.mode="auto",this.forceMobileMenuOpen=!1,this.forceMenuOpen=!1,this.baseUrl="",this.apiIntegrationIdentifier="ft-search-bar",this.availableContentLocales=[],this.availableContentLocalesInitialized=!1,this.labels={},this.labelResolver=new Jo(hc,{}),this.displayedFilters=[],this.presets=[],this.priors=[],this.searchRequestSerializer=t=>function(t,e){var o;const i=new URLSearchParams({"content-lang":null!==(o=e.contentLocale)&&void 0!==o?o:"all",query:e.query});if(e.filters.length>0){const t=e.filters.map((t=>{const e=t.values.map((t=>t.replace(/_/g,"\\\\\\\\_").replace(/~/g,"\\\\~").replace(/\*/g,"\\*"))).map((t=>encodeURIComponent(function(t){return`"${t}"`}(t)))).join("_");return`${t.key}~${e}`})).join("*");i.append("filters",t)}return new URL(`${t.replace(/\/+$/,"")}/search?${i.toString()}`).href}(this.baseUrl,t),this.focusOnDisplay=!1,this.searchFilters=[],this.sizeCategory=un.M,this.displayFacets=!1,this.mobileMenuOpen=!1,this.facets=[],this.facetsInitialized=!1,this.knownFacetLabels=new Map,this.query="",this.suggestions=[],this.recentSearches=[],this.reactToFocus=!0,this.suggestManager=new Vl(this),this.selectedFacetsManager=new Gl(this),this.desktopSearchBarManager=new Yl(this),this.mobileSearchBarManager=new ql(this,this.selectedFacetsManager,this.suggestManager),this.currentSession=Xl.getState().session,this.stateChangeEventDebouncer=new r(10),this.updateLocalesDebouncer=new r(10),this.facetsLoaded=!1,this.updateFacetsDebouncer=new r(500),this.closeFloatingContainer=t=>{this.isMobile()||(this.displayFacets=this.displayFacets&&t.composedPath().some((t=>t===this.floatingContainer)))},this.compareFilters=(t,e)=>t.key===e.key&&t.negative==e.negative&&t.values.length===e.values.length&&t.values.every((t=>e.values.includes(t))),this.compareRequests=(t,e)=>(null==t.contentLocale||null==e.contentLocale||t.contentLocale===e.contentLocale)&&t.filters.length===e.filters.length&&t.filters.every((t=>e.filters.some((e=>this.compareFilters(t,e))))),this.enableFocusReactionCallback=()=>this.enableFocusReaction(),Xl.subscribe((()=>this.reloadWhenUserSessionChanges()))}get request(){return{uiLocale:this.uiLocale,contentLocale:this.contentLocale,query:this.query,facets:this.facetsRequest,priors:this.hasPriors?this.priors:void 0,filters:this.searchFilters,paging:{perPage:0,page:1},sort:[]}}get facetsRequest(){const t=this.searchFilters.filter((t=>t.values.length>0&&!this.displayedFilters.includes(t.key))).map((t=>({id:t.key})));return[...this.displayedFilters.map((t=>({id:t}))),...t]}get suggestRequest(){return{contentLocale:this.contentLocale,input:this.query,filters:this.searchFilters,sort:[]}}isMobile(){switch(this.mode){case"mobile":return!0;case"desktop":return!1;default:return this.sizeCategory===un.S}}hasFacets(){return this.facetsRequest.length>0}get hasPresets(){return null!=this.presets&&this.presets.length>0}get hasPriors(){return null!=this.priors&&this.priors.length>0}hasLocaleSelector(){return this.availableContentLocales.length>1}focus(){var t;null===(t=this.container)||void 0===t||t.focus()}async focusInput(){await async function(t,e=10,o=2e4){let i,r,n=await t();for(i=r=performance.now();null==n&&(!o||r-i<o);)await z(e),n=await t(),r=performance.now();if(null==n)throw new Error("Timeout exceeded");return n}((()=>this.input),50),this.input.focus()}clear(){this.query="",this.searchFilters=[],this.input&&(this.input.value=""),this.mobileMenuOpen=!1,this.displayFacets=!1}render(){return he`
|
|
2919
|
+
`}update(t){super.update(t),t.has("baseUrl")&&(Xl.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Xl.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Xl.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Xl.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Xl.actions.noCustom(this.noCustom),t.has("editorMode")&&Xl.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Xl.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Xl.actions.session(this.session),t.has("availableUiLocales")&&Xl.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>ic.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()))}}nc.elementDefinitions={},nc.styles=Jl,rc([E()],nc.prototype,"baseUrl",void 0),rc([E()],nc.prototype,"apiIntegrationIdentifier",void 0),rc([E()],nc.prototype,"uiLocale",void 0),rc([D(null)],nc.prototype,"availableUiLocales",void 0),rc([D(null)],nc.prototype,"metadataConfiguration",void 0),rc([E({type:Boolean})],nc.prototype,"editorMode",void 0),rc([E({type:Boolean})],nc.prototype,"noCustom",void 0),rc([E({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],nc.prototype,"noCustomComponent",void 0),rc([E({type:Boolean})],nc.prototype,"withManualResources",void 0),rc([D([])],nc.prototype,"messageContexts",void 0),rc([D(void 0)],nc.prototype,"session",void 0),rc([E({type:Object})],nc.prototype,"apiProvider",void 0);class ac{async listMySearches(){var t;return(null===(t=Xl.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await Ql.await()).listMySearches(Xl.getState().session.profile.userId):[]}}const sc=new i;class lc{async listMyBookmarks(){return sc.get("bookmarks",(async()=>(await Ql.await()).listMyBookmarks(Xl.getState().session.profile.userId)))}clearCache(){sc.clear("bookmarks")}}const cc=Gr.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=Xl.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new lc,Xl.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Xl.getState();B(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(){cc.actions.savedSearches(void 0)}clearMyBookmarks(){cc.actions.bookmarks(void 0)}async reloadMySearches(){const t=new ac,e=await t.listMySearches();cc.actions.savedSearches(e)}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;cc.actions.bookmarks(e)}}},A("ft-app-context")(nc);var fc=function(t,e,o,i){for(var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,o,a):r(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};null==window.fluidtopics&&console.warn("Fluid Topics public API was not found. You can find it here: https://www.npmjs.com/package/@fluid-topics/public-api");const hc={filtersButton:"Filters",inputPlaceHolder:"Search",filterInputPlaceHolder:"Filter {0}",clearInputButton:"Clear",clearFilterButton:"Clear",displayMoreFilterValuesButton:"More",noFilterValuesAvailable:"No values available",searchButton:"Search",clearFilters:"Clear filters",contentLocaleSelector:"Lang",presetsSelector:"Quick filters",removeRecentSearch:"Remove",back:"Back"};class pc extends CustomEvent{constructor(t){super("launch-search",{detail:t,bubbles:!0,composed:!0})}}class dc extends CustomEvent{constructor(t){super("change",{detail:t})}}const uc=()=>{};class bc extends _o{isMobileMenuOpen(){return this.isMobile()&&(this.forceMobileMenuOpen||this.forceMenuOpen||this.mobileMenuOpen)}constructor(){super(),this.dense=!1,this.mode="auto",this.forceMobileMenuOpen=!1,this.forceMenuOpen=!1,this.baseUrl="",this.apiIntegrationIdentifier="ft-search-bar",this.availableContentLocales=[],this.availableContentLocalesInitialized=!1,this.labels={},this.labelResolver=new Jo(hc,{}),this.displayedFilters=[],this.presets=[],this.priors=[],this.searchRequestSerializer=t=>function(t,e){var o;const i=new URLSearchParams({"content-lang":null!==(o=e.contentLocale)&&void 0!==o?o:"all",query:e.query});if(e.filters.length>0){const t=e.filters.map((t=>{const e=t.values.map((t=>t.replace(/_/g,"\\\\\\\\_").replace(/~/g,"\\\\~").replace(/\*/g,"\\*"))).map((t=>encodeURIComponent(function(t){return`"${t}"`}(t)))).join("_");return`${t.key}~${e}`})).join("*");i.append("filters",t)}return new URL(`${t.replace(/\/+$/,"")}/search?${i.toString()}`).href}(this.baseUrl,t),this.focusOnDisplay=!1,this.searchFilters=[],this.sizeCategory=un.M,this.displayFacets=!1,this.mobileMenuOpen=!1,this.facets=[],this.facetsInitialized=!1,this.knownFacetLabels=new Map,this.query="",this.suggestions=[],this.recentSearches=[],this.reactToFocus=!0,this.suggestManager=new Vl(this),this.selectedFacetsManager=new Gl(this),this.desktopSearchBarManager=new Yl(this),this.mobileSearchBarManager=new ql(this,this.selectedFacetsManager,this.suggestManager),this.currentSession=Xl.getState().session,this.stateChangeEventDebouncer=new r(10),this.updateLocalesDebouncer=new r(10),this.facetsLoaded=!1,this.updateFacetsDebouncer=new r(500),this.closeFloatingContainer=t=>{this.isMobile()||(this.displayFacets=this.displayFacets&&t.composedPath().some((t=>t===this.floatingContainer)))},this.compareFilters=(t,e)=>t.key===e.key&&t.negative==e.negative&&t.values.length===e.values.length&&t.values.every((t=>e.values.includes(t))),this.compareRequests=(t,e)=>(null==t.contentLocale||null==e.contentLocale||t.contentLocale===e.contentLocale)&&t.filters.length===e.filters.length&&t.filters.every((t=>e.filters.some((e=>this.compareFilters(t,e))))),this.enableFocusReactionCallback=()=>this.enableFocusReaction(),Xl.subscribe((()=>this.reloadWhenUserSessionChanges()))}get request(){return{uiLocale:this.uiLocale,contentLocale:this.contentLocale,query:this.query,facets:this.facetsRequest,priors:this.hasPriors?this.priors:void 0,filters:this.searchFilters,paging:{perPage:0,page:1},sort:[]}}get facetsRequest(){const t=this.searchFilters.filter((t=>t.values.length>0&&!this.displayedFilters.includes(t.key))).map((t=>({id:t.key})));return[...this.displayedFilters.map((t=>({id:t}))),...t]}get suggestRequest(){return{contentLocale:this.contentLocale,input:this.query,filters:this.searchFilters,sort:[]}}isMobile(){switch(this.mode){case"mobile":return!0;case"desktop":return!1;default:return this.sizeCategory===un.S}}hasFacets(){return this.facetsRequest.length>0}get hasPresets(){return null!=this.presets&&this.presets.length>0}get hasPriors(){return null!=this.priors&&this.priors.length>0}hasLocaleSelector(){return this.availableContentLocales.length>1}focus(){var t;null===(t=this.container)||void 0===t||t.focus()}async focusInput(t=!1){this.reactToFocus=t,await async function(t,e=10,o=2e4){let i,r,n=await t();for(i=r=performance.now();null==n&&(!o||r-i<o);)await z(e),n=await t(),r=performance.now();if(null==n)throw new Error("Timeout exceeded");return n}((()=>this.input),50),this.input.focus(),t||this.enableFocusReactionOnAnyUserInteraction()}clear(){this.query="",this.searchFilters=[],this.input&&(this.input.value=""),this.mobileMenuOpen=!1,this.displayFacets=!1}render(){return he`
|
|
2920
2920
|
<ft-size-watcher @change=${this.updateSize}></ft-size-watcher>
|
|
2921
2921
|
${this.renderSearchBar()}
|
|
2922
2922
|
`}renderSearchBar(){return this.facetsInitialized&&this.availableContentLocalesInitialized?this.isMobile()?this.mobileSearchBarManager.render():this.desktopSearchBarManager.render():he`
|
|
@@ -3052,7 +3052,7 @@ function(t){return(e,o)=>{const{slot:i,selector:r}=t??{},n="slot"+(i?`[name=${i}
|
|
|
3052
3052
|
></ft-filter>
|
|
3053
3053
|
`}))}
|
|
3054
3054
|
</ft-snap-scroll>
|
|
3055
|
-
`:de}async firstUpdated(t){super.firstUpdated(t),this.initApi(),window.addEventListener("storage",(t=>{t.key===this.recentSearchesStorageKey&&this.initRecentSearches()}))}update(t){var e,o,i,r,n;if(t.has("labels")&&(this.labelResolver=new Jo(hc,this.labels)),t.has("sizeCategory")&&(this.mobileMenuOpen=!1,this.displayFacets=this.displayFacets&&!this.isMobile()),super.update(t),(t.has("availableContentLocales")||t.has("contentLocale"))&&this.availableContentLocales.length>0){const o=t=>this.availableContentLocales.some((e=>e.lang==t));o(this.contentLocale)||(this.contentLocale=t.has("contentLocale")&&o(t.get("contentLocale"))?t.get("contentLocale"):null===(e=this.availableContentLocales[0])||void 0===e?void 0:e.lang)}if(t.has("baseUrl")&&this.baseUrl&&(this.baseUrl.endsWith("/")&&(this.baseUrl=this.baseUrl.replace(/\/$/,"")),this.initRecentSearches()),t.has("presets")&&(null!==(o=this.presets)&&void 0!==o?o:[]).forEach((t=>t.filters.forEach((t=>t.values=t.values.map((t=>Ea(t))))))),t.has("presets")||t.has("selectedPreset")){const t=(null!==(i=this.presets)&&void 0!==i?i:[]).find((t=>t.name===this.selectedPreset));t&&!this.compareRequests(this.request,t)&&this.setFiltersFromPreset(t)}t.has("contentLocale")&&null!=this.contentLocale&&(this.knownFacetLabels=new Map),["contentLocale","searchFilters"].some((e=>t.has(e)))&&(this.selectedPreset=null===(n=(null!==(r=this.presets)&&void 0!==r?r:[]).find((t=>this.compareRequests(t,this.request))))||void 0===n?void 0:n.name),["baseUrl","apiIntegrationIdentifier"].some((e=>t.has(e)))&&(this.api=void 0,this.initApi()),t.has("api")&&this.api&&this.initSearchData(),["uiLocale","contentLocale","searchFilters","displayedFilters"].some((e=>t.has(e)))&&this.updateFacets(),["query","uiLocale","contentLocale","searchFilters","displayedFilters","api"].some((e=>t.has(e)))&&this.suggestManager.update(),["query","uiLocale","contentLocale","searchFilters"].some((e=>t.has(e)))&&this.dispatchStateChangeEvent()}dispatchStateChangeEvent(){this.stateChangeEventDebouncer.run((()=>this.dispatchEvent(new dc(this.request))))}initSearchData(){this.availableContentLocalesInitialized=!1,this.facetsLoaded=!1,this.facetsInitialized=!1,this.updateLocalesDebouncer.run((()=>{var t;null===(t=this.api)||void 0===t||t.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[])).then((t=>{this.availableContentLocales=t,this.availableContentLocalesInitialized=!0}))})),this.updateFacetsDebouncer.run((()=>{this.retrieveFacetsFromSearch().then((()=>{this.facetsLoaded=!0,this.facetsInitialized=!0}))}),this.facetsInitialized?500:10)}updateFacets(){this.api&&(this.facetsRequest.length>0?(this.facetsLoaded=!1,this.updateFacetsDebouncer.run((async()=>{await this.retrieveFacetsFromSearch(),this.facetsLoaded=!0,this.facetsInitialized=!0}),this.facetsInitialized?500:10)):this.facets=[])}contentAvailableCallback(t){var e,o,i;if(super.contentAvailableCallback(t),t.has("displayFacets")&&this.displayFacets&&(null===(e=this.floatingContainer)||void 0===e||e.focus()),null!=this.scrollToFacet&&this.facetsLoaded){null===(o=this.scrollingFiltersContainer)||void 0===o||o.scrollIndexIntoView(this.facets.findIndex((t=>t.key===this.scrollToFacet)));const t=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector(`ft-accordion-item[data-facet-key="${this.scrollToFacet}"]`);t&&(t.active=!0),this.scrollToFacet=void 0}}initApi(){null==this.api&&(this.api=window.fluidtopics?new window.fluidtopics.FluidTopicsApi(this.baseUrl,this.apiIntegrationIdentifier,!0):void 0,setTimeout((()=>this.initApi()),10))}async retrieveFacetsFromSearch(){var t;const e=new Map;await(null===(t=this.api)||void 0===t?void 0:t.search({...this.request,query:""}).then((t=>t.facets.forEach((t=>{this.knownFacetLabels.set(t.key,t.label),e.set(t.key,t)})))).catch(uc)),this.facets=[];for(let t of this.facetsRequest)e.has(t.id)?this.facets.push(e.get(t.id)):this.knownFacetLabels.has(t.id)&&this.facets.push({key:t.id,label:this.knownFacetLabels.get(t.id),rootNodes:[],multiSelectionable:!0,hierarchical:!1})}onFloatingContainerKeyUp(t){var e;"Escape"===t.key&&(this.displayFacets=!1,null===(e=this.filtersOpener)||void 0===e||e.focus())}setQuery(t){this.input&&(this.input.value=t),this.query=t}launchSearch(){if(this.query){let t=this.recentSearches.filter((t=>t.toLowerCase()!==this.query.toLowerCase())).filter(((t,e)=>e<20));this.recentSearches=[this.query,...t],this.saveRecentSearches()}this.dispatchEvent(new pc(this.request)),this.mobileMenuOpen=!1,this.displayFacets=!1,this.focus()}get recentSearchesStorageKey(){return this.baseUrl+":ft:recent-search-queries"}initRecentSearches(){var t;this.recentSearches=JSON.parse(null!==(t=window.localStorage.getItem(this.recentSearchesStorageKey))&&void 0!==t?t:"[]")}saveRecentSearches(){const t=JSON.stringify(this.recentSearches);window.localStorage.setItem(this.recentSearchesStorageKey,t),window.dispatchEvent(new StorageEvent("storage",{key:this.recentSearchesStorageKey,newValue:t,storageArea:window.localStorage,url:window.location.href}))}async connectedCallback(){super.connectedCallback(),document.addEventListener("focusin",this.closeFloatingContainer),document.addEventListener("click",this.closeFloatingContainer),this.focusOnDisplay&&!tn&&
|
|
3055
|
+
`:de}async firstUpdated(t){super.firstUpdated(t),this.initApi(),window.addEventListener("storage",(t=>{t.key===this.recentSearchesStorageKey&&this.initRecentSearches()}))}update(t){var e,o,i,r,n;if(t.has("labels")&&(this.labelResolver=new Jo(hc,this.labels)),t.has("sizeCategory")&&(this.mobileMenuOpen=!1,this.displayFacets=this.displayFacets&&!this.isMobile()),super.update(t),(t.has("availableContentLocales")||t.has("contentLocale"))&&this.availableContentLocales.length>0){const o=t=>this.availableContentLocales.some((e=>e.lang==t));o(this.contentLocale)||(this.contentLocale=t.has("contentLocale")&&o(t.get("contentLocale"))?t.get("contentLocale"):null===(e=this.availableContentLocales[0])||void 0===e?void 0:e.lang)}if(t.has("baseUrl")&&this.baseUrl&&(this.baseUrl.endsWith("/")&&(this.baseUrl=this.baseUrl.replace(/\/$/,"")),this.initRecentSearches()),t.has("presets")&&(null!==(o=this.presets)&&void 0!==o?o:[]).forEach((t=>t.filters.forEach((t=>t.values=t.values.map((t=>Ea(t))))))),t.has("presets")||t.has("selectedPreset")){const t=(null!==(i=this.presets)&&void 0!==i?i:[]).find((t=>t.name===this.selectedPreset));t&&!this.compareRequests(this.request,t)&&this.setFiltersFromPreset(t)}t.has("contentLocale")&&null!=this.contentLocale&&(this.knownFacetLabels=new Map),["contentLocale","searchFilters"].some((e=>t.has(e)))&&(this.selectedPreset=null===(n=(null!==(r=this.presets)&&void 0!==r?r:[]).find((t=>this.compareRequests(t,this.request))))||void 0===n?void 0:n.name),["baseUrl","apiIntegrationIdentifier"].some((e=>t.has(e)))&&(this.api=void 0,this.initApi()),t.has("api")&&this.api&&this.initSearchData(),["uiLocale","contentLocale","searchFilters","displayedFilters"].some((e=>t.has(e)))&&this.updateFacets(),["query","uiLocale","contentLocale","searchFilters","displayedFilters","api"].some((e=>t.has(e)))&&this.suggestManager.update(),["query","uiLocale","contentLocale","searchFilters"].some((e=>t.has(e)))&&this.dispatchStateChangeEvent()}dispatchStateChangeEvent(){this.stateChangeEventDebouncer.run((()=>this.dispatchEvent(new dc(this.request))))}initSearchData(){this.availableContentLocalesInitialized=!1,this.facetsLoaded=!1,this.facetsInitialized=!1,this.updateLocalesDebouncer.run((()=>{var t;null===(t=this.api)||void 0===t||t.getAvailableSearchLocales().then((t=>t.contentLocales)).catch((()=>[])).then((t=>{this.availableContentLocales=t,this.availableContentLocalesInitialized=!0}))})),this.updateFacetsDebouncer.run((()=>{this.retrieveFacetsFromSearch().then((()=>{this.facetsLoaded=!0,this.facetsInitialized=!0}))}),this.facetsInitialized?500:10)}updateFacets(){this.api&&(this.facetsRequest.length>0?(this.facetsLoaded=!1,this.updateFacetsDebouncer.run((async()=>{await this.retrieveFacetsFromSearch(),this.facetsLoaded=!0,this.facetsInitialized=!0}),this.facetsInitialized?500:10)):this.facets=[])}contentAvailableCallback(t){var e,o,i;if(super.contentAvailableCallback(t),t.has("displayFacets")&&this.displayFacets&&(null===(e=this.floatingContainer)||void 0===e||e.focus()),null!=this.scrollToFacet&&this.facetsLoaded){null===(o=this.scrollingFiltersContainer)||void 0===o||o.scrollIndexIntoView(this.facets.findIndex((t=>t.key===this.scrollToFacet)));const t=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector(`ft-accordion-item[data-facet-key="${this.scrollToFacet}"]`);t&&(t.active=!0),this.scrollToFacet=void 0}}initApi(){null==this.api&&(this.api=window.fluidtopics?new window.fluidtopics.FluidTopicsApi(this.baseUrl,this.apiIntegrationIdentifier,!0):void 0,setTimeout((()=>this.initApi()),10))}async retrieveFacetsFromSearch(){var t;const e=new Map;await(null===(t=this.api)||void 0===t?void 0:t.search({...this.request,query:""}).then((t=>t.facets.forEach((t=>{this.knownFacetLabels.set(t.key,t.label),e.set(t.key,t)})))).catch(uc)),this.facets=[];for(let t of this.facetsRequest)e.has(t.id)?this.facets.push(e.get(t.id)):this.knownFacetLabels.has(t.id)&&this.facets.push({key:t.id,label:this.knownFacetLabels.get(t.id),rootNodes:[],multiSelectionable:!0,hierarchical:!1})}onFloatingContainerKeyUp(t){var e;"Escape"===t.key&&(this.displayFacets=!1,null===(e=this.filtersOpener)||void 0===e||e.focus())}setQuery(t){this.input&&(this.input.value=t),this.query=t}launchSearch(){if(this.query){let t=this.recentSearches.filter((t=>t.toLowerCase()!==this.query.toLowerCase())).filter(((t,e)=>e<20));this.recentSearches=[this.query,...t],this.saveRecentSearches()}this.dispatchEvent(new pc(this.request)),this.mobileMenuOpen=!1,this.displayFacets=!1,this.focus()}get recentSearchesStorageKey(){return this.baseUrl+":ft:recent-search-queries"}initRecentSearches(){var t;this.recentSearches=JSON.parse(null!==(t=window.localStorage.getItem(this.recentSearchesStorageKey))&&void 0!==t?t:"[]")}saveRecentSearches(){const t=JSON.stringify(this.recentSearches);window.localStorage.setItem(this.recentSearchesStorageKey,t),window.dispatchEvent(new StorageEvent("storage",{key:this.recentSearchesStorageKey,newValue:t,storageArea:window.localStorage,url:window.location.href}))}async connectedCallback(){super.connectedCallback(),document.addEventListener("focusin",this.closeFloatingContainer),document.addEventListener("click",this.closeFloatingContainer),this.focusOnDisplay&&!tn&&await this.focusInput()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("focusin",this.closeFloatingContainer),document.addEventListener("click",this.closeFloatingContainer)}updateSize(t){this.sizeCategory=t.detail.category}setFilter(t,e){let o=this.searchFilters.filter((e=>e.key!==t));this.facets.forEach((o=>{o.key===t&&F(o.rootNodes,(t=>t.childNodes)).forEach((t=>t.selected=e.includes(t.value)))})),e.length&&o.push({key:t,negative:!1,values:e}),this.searchFilters=o,this.scrollToFacet=t}setFiltersFromPreset(t){null!=t&&(null!=t.contentLocale&&(this.contentLocale=t.contentLocale),this.searchFilters=t.filters)}clearFilters(){this.facets.forEach((t=>F(t.rootNodes,(t=>t.childNodes)).forEach((t=>t.selected=!1)))),this.searchFilters=[];const t=this.facets[0];this.scrollToFacet=null==t?void 0:t.key}querySelector(t){return this.shadowRoot.querySelector(t)}querySelectorAll(t){return this.shadowRoot.querySelectorAll(t)}renderDesktopFloatingMenu(){return this.forceMenuOpen?de:he`
|
|
3056
3056
|
<div class="ft-search-bar--floating-panel"
|
|
3057
3057
|
id="ft-search-bar-floating-panel"
|
|
3058
3058
|
@keyup=${this.onFloatingContainerKeyUp}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-search-bar",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.37",
|
|
4
4
|
"description": "Search bar component using Fluid Topics public API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,23 +19,23 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-accordion": "1.1.
|
|
23
|
-
"@fluid-topics/ft-app-context": "1.1.
|
|
24
|
-
"@fluid-topics/ft-button": "1.1.
|
|
25
|
-
"@fluid-topics/ft-chip": "1.1.
|
|
26
|
-
"@fluid-topics/ft-filter": "1.1.
|
|
27
|
-
"@fluid-topics/ft-icon": "1.1.
|
|
28
|
-
"@fluid-topics/ft-select": "1.1.
|
|
29
|
-
"@fluid-topics/ft-size-watcher": "1.1.
|
|
30
|
-
"@fluid-topics/ft-skeleton": "1.1.
|
|
31
|
-
"@fluid-topics/ft-snap-scroll": "1.1.
|
|
32
|
-
"@fluid-topics/ft-tooltip": "1.1.
|
|
33
|
-
"@fluid-topics/ft-typography": "1.1.
|
|
34
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
22
|
+
"@fluid-topics/ft-accordion": "1.1.37",
|
|
23
|
+
"@fluid-topics/ft-app-context": "1.1.37",
|
|
24
|
+
"@fluid-topics/ft-button": "1.1.37",
|
|
25
|
+
"@fluid-topics/ft-chip": "1.1.37",
|
|
26
|
+
"@fluid-topics/ft-filter": "1.1.37",
|
|
27
|
+
"@fluid-topics/ft-icon": "1.1.37",
|
|
28
|
+
"@fluid-topics/ft-select": "1.1.37",
|
|
29
|
+
"@fluid-topics/ft-size-watcher": "1.1.37",
|
|
30
|
+
"@fluid-topics/ft-skeleton": "1.1.37",
|
|
31
|
+
"@fluid-topics/ft-snap-scroll": "1.1.37",
|
|
32
|
+
"@fluid-topics/ft-tooltip": "1.1.37",
|
|
33
|
+
"@fluid-topics/ft-typography": "1.1.37",
|
|
34
|
+
"@fluid-topics/ft-wc-utils": "1.1.37",
|
|
35
35
|
"lit": "3.1.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@fluid-topics/public-api": "1.0.59"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "a2f1f35da13aa0735c3765b8149fc7564593a7ed"
|
|
41
41
|
}
|