@fluid-topics/ft-reader-attachments 1.1.66 → 1.1.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -227,9 +227,9 @@
227
227
  }
228
228
  `;var O;!function(t){t.FEEDBACK="FEEDBACK",t.RATING="RATING",t.PRINT="PRINT",t.BOOKMARK="BOOKMARK",t.COLLECTIONS="COLLECTIONS",t.PERSONAL_BOOKS="PERSONAL_BOOKS"}(O||(O={}));var N=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class v extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}}const S=Symbol("registerInterval");class w extends(function(t){var o;class e extends t{constructor(){super(...arguments),this[o]=0}setReaderStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"reader")}clearStateManager(){this.stateManager&&(this.removeStore("reader"),this.stateManager=void 0)}get service(){var t;return null===(t=this.stateManager)||void 0===t?void 0:t.service}connectedCallback(){super.connectedCallback(),this[S]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[S]):this.dispatchEvent(new v)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return o=S,N([r.state()],e.prototype,"stateManager",void 0),e}(o.FtLitElementRedux)){}const C=e.css`
229
229
  `,I=e.css`
230
- `,E=o.FtReduxStore.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1}});class U{static get(t){const{baseUrl:o,apiIntegrationIdentifier:e}=E.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static await(t){return new Promise((o=>{let e=U.get(t);if(e)o(e);else{const r=E.subscribe((()=>{e=U.get(t),e&&(r(),o(e))}))}}))}}class W{constructor(t=!0,e){var r;this.overrideApi=e;let a=this.constructor;a.commonCache=null!==(r=a.commonCache)&&void 0!==r?r:new o.CacheRegistry,this.cache=t?a.commonCache:new o.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:U.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:U.await()}clearCache(){this.cache.clearAll()}}var R;const k=Symbol("clearAfterUnitTest");class Z extends W{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[R]=()=>{this.defaultMessages={},this.cache=new o.CacheRegistry,this.listeners={}},this.currentUiLocale=E.getState().uiLocale,E.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=E.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var r;if(t=t.toLowerCase(),Object.keys(e).length>0){const a={...null!==(r=this.defaultMessages[t])&&void 0!==r?r:{},...e};o.deepEqual(this.defaultMessages[t],a)||(this.defaultMessages[t]=a,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...r){var a,i,n;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(i=null===(a=this.cache.getNow(t))||void 0===a?void 0:a.messages)&&void 0!==i?i:{};return new o.ParametrizedLabelResolver(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},l).resolve(e,...r)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>o.delay(0).then((()=>t())).catch((()=>null)))))}}R=k,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Z{constructor(){super((async(t,o)=>(await this.awaitApi).getFluidTopicsMessageContext(t,o)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Z{constructor(){super((async(t,o)=>(await this.awaitApi).getCustomMessageContext(t,o)))}});const L=window.FluidTopicsI18nService,z=window.FluidTopicsCustomI18nService;var $=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class K extends o.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>U.get(),this.cache=new o.CacheRegistry,this.cleanSessionDebouncer=new o.Debouncer}render(){return e.html`
230
+ `,E=o.FtReduxStore.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1}});class U{static get(t){const{baseUrl:o,apiIntegrationIdentifier:e}=E.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static await(t){return new Promise((o=>{let e=U.get(t);if(e)o(e);else{const r=E.subscribe((()=>{e=U.get(t),e&&(r(),o(e))}))}}))}}class W{constructor(t=!0,e){var r;this.overrideApi=e;let a=this.constructor;a.commonCache=null!==(r=a.commonCache)&&void 0!==r?r:new o.CacheRegistry,this.cache=t?a.commonCache:new o.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:U.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:U.await()}clearCache(){this.cache.clearAll()}}var R;const k=Symbol("clearAfterUnitTest");class Z extends W{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[R]=()=>{this.defaultMessages={},this.cache=new o.CacheRegistry,this.listeners={}},this.currentUiLocale=E.getState().uiLocale,E.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=E.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var r;if(t=t.toLowerCase(),Object.keys(e).length>0){const a={...null!==(r=this.defaultMessages[t])&&void 0!==r?r:{},...e};o.deepEqual(this.defaultMessages[t],a)||(this.defaultMessages[t]=a,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...r){var a,i,n;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(i=null===(a=this.cache.getNow(t))||void 0===a?void 0:a.messages)&&void 0!==i?i:{};return new o.ParametrizedLabelResolver(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},l).resolve(e,...r)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>o.delay(0).then((()=>t())).catch((()=>null)))))}}R=k,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Z{constructor(){super((async(t,o)=>(await this.awaitApi).getFluidTopicsMessageContext(t,o)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Z{constructor(){super((async(t,o)=>(await this.awaitApi).getCustomMessageContext(t,o)))}});const L=window.FluidTopicsI18nService,z=window.FluidTopicsCustomI18nService;var $=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class K extends o.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.navigatorOnline=!1,this.forcedOffline=!1,this.apiProvider=()=>U.get(),this.messageContexts=[],this.cache=new o.CacheRegistry,this.cleanSessionDebouncer=new o.Debouncer}render(){return e.html`
231
231
  <slot></slot>
232
- `}update(t){super.update(t),t.has("baseUrl")&&(E.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&E.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&E.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&E.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&E.actions.noCustom(this.noCustom),t.has("editorMode")&&E.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&E.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&E.actions.session(this.session),t.has("availableUiLocales")&&E.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>L.addContext(t))),t.has("openExternalDocumentInNewTab")&&E.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}K.elementDefinitions={},K.styles=I,$([r.property()],K.prototype,"baseUrl",void 0),$([r.property()],K.prototype,"apiIntegrationIdentifier",void 0),$([r.property()],K.prototype,"uiLocale",void 0),$([o.jsonProperty(null)],K.prototype,"availableUiLocales",void 0),$([o.jsonProperty(null)],K.prototype,"metadataConfiguration",void 0),$([r.property({type:Boolean})],K.prototype,"editorMode",void 0),$([r.property({type:Boolean})],K.prototype,"noCustom",void 0),$([r.property({type:Boolean})],K.prototype,"openExternalDocumentInNewTab",void 0),$([r.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],K.prototype,"noCustomComponent",void 0),$([r.property({type:Boolean})],K.prototype,"withManualResources",void 0),$([o.jsonProperty([])],K.prototype,"messageContexts",void 0),$([o.jsonProperty(void 0)],K.prototype,"session",void 0),$([r.property({type:Object})],K.prototype,"apiProvider",void 0);class F extends W{async listMySearches(){let t=E.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class B extends W{async listMyBookmarks(){let t=E.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const D=o.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=E.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new B,this.savedSearchesService=new F,E.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=E.getState();o.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),D.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),D.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();D.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;D.actions.bookmarks(o)}}},o.customElement("ft-app-context")(K);var A=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};const H=Symbol("i18nAttributes"),G=Symbol("i18nProperties"),M=Symbol("i18nUnsubs");function j(t){var o;class e extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[o]=new Map}get i18nService(){return this.useCustomMessageContexts?z:L}i18n(t,o,...e){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,o,...e);const a=null!==(r=t.args)&&void 0!==r?r:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...a)}onI18nUpdate(t){var o,e;null===(o=this[H])||void 0===o||o.forEach(((o,e)=>{var r;const a=this.getI18nAttributeValue(e);(null===(r=null==a?void 0:a.context)||void 0===r?void 0:r.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(e,a,o)})),null===(e=this[G])||void 0===e||e.forEach(((o,e)=>{o.context.toLowerCase()===t.toLowerCase()&&(this[e]=this.i18n(o))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,o,e){this[t]={...o,message:this.i18n({context:o.context,key:o.key,...e})}}update(t){var o,e;super.update(t),null===(o=this[H])||void 0===o||o.forEach(((o,e)=>{const r=this.getI18nAttributeValue(e);(null==r?void 0:r.context)&&r.key&&(t.has(e)||null!=o.argsProvider)&&(t.has(e)&&this.addI18nContext(r.context),this.updateI18nAttributeMessage(e,r,o))})),null===(e=this[G])||void 0===e||e.forEach(((t,o)=>{null!=t.argsProvider&&(this[o]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,o,e,r;super.connectedCallback(),new Set([...null!==(o=null===(t=this[G])||void 0===t?void 0:t.values())&&void 0!==o?o:[],...[...null!==(r=null===(e=this[H])||void 0===e?void 0:e.keys())&&void 0!==r?r:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,o){t=t.toLowerCase(),this[M].has(t)||this[M].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=o?o:{})}addI18nContext(t,o){this.addI18nMessages("string"==typeof t?t:t.name,o)}disconnectedCallback(){super.disconnectedCallback(),this[M].forEach((t=>t())),this[M].clear()}}return o=M,A([r.property({type:Boolean})],e.prototype,"useCustomMessageContexts",void 0),e}class P extends(j(o.FtLitElement)){}class T extends(j(o.FtLitElementRedux)){}var _=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class Y extends T{constructor(){super(),this.editorMode=!1,this.addStore(E)}render(){return this.key&&this.context?e.html`
232
+ `}update(t){super.update(t),t.has("baseUrl")&&(E.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&E.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&E.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&E.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&E.actions.noCustom(this.noCustom),t.has("editorMode")&&E.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&E.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&E.actions.session(this.session),t.has("availableUiLocales")&&E.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>L.addContext(t))),t.has("openExternalDocumentInNewTab")&&E.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("navigatorOnline")&&E.actions.navigatorOnline(this.navigatorOnline),t.has("forcedOffline")&&E.actions.forcedOffline(this.forcedOffline),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}K.elementDefinitions={},K.styles=I,$([r.property()],K.prototype,"baseUrl",void 0),$([r.property()],K.prototype,"apiIntegrationIdentifier",void 0),$([r.property()],K.prototype,"uiLocale",void 0),$([o.jsonProperty(null)],K.prototype,"availableUiLocales",void 0),$([o.jsonProperty(null)],K.prototype,"metadataConfiguration",void 0),$([r.property({type:Boolean})],K.prototype,"editorMode",void 0),$([r.property({type:Boolean})],K.prototype,"noCustom",void 0),$([r.property({type:Boolean})],K.prototype,"openExternalDocumentInNewTab",void 0),$([r.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],K.prototype,"noCustomComponent",void 0),$([r.property({type:Boolean})],K.prototype,"withManualResources",void 0),$([r.property({type:Boolean})],K.prototype,"navigatorOnline",void 0),$([r.property({type:Boolean})],K.prototype,"forcedOffline",void 0),$([r.property({type:Object})],K.prototype,"apiProvider",void 0),$([o.jsonProperty([])],K.prototype,"messageContexts",void 0),$([o.jsonProperty(void 0)],K.prototype,"session",void 0);class F extends W{async listMySearches(){let t=E.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class B extends W{async listMyBookmarks(){let t=E.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const D=o.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=E.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new B,this.savedSearchesService=new F,E.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=E.getState();o.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),D.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),D.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();D.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;D.actions.bookmarks(o)}}},o.customElement("ft-app-context")(K);var A=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};const H=Symbol("i18nAttributes"),G=Symbol("i18nProperties"),M=Symbol("i18nUnsubs");function j(t){var o;class e extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[o]=new Map}get i18nService(){return this.useCustomMessageContexts?z:L}i18n(t,o,...e){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,o,...e);const a=null!==(r=t.args)&&void 0!==r?r:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...a)}onI18nUpdate(t){var o,e;null===(o=this[H])||void 0===o||o.forEach(((o,e)=>{var r;const a=this.getI18nAttributeValue(e);(null===(r=null==a?void 0:a.context)||void 0===r?void 0:r.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(e,a,o)})),null===(e=this[G])||void 0===e||e.forEach(((o,e)=>{o.context.toLowerCase()===t.toLowerCase()&&(this[e]=this.i18n(o))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,o,e){this[t]={...o,message:this.i18n({context:o.context,key:o.key,...e})}}update(t){var o,e;super.update(t),null===(o=this[H])||void 0===o||o.forEach(((o,e)=>{const r=this.getI18nAttributeValue(e);(null==r?void 0:r.context)&&r.key&&(t.has(e)||null!=o.argsProvider)&&(t.has(e)&&this.addI18nContext(r.context),this.updateI18nAttributeMessage(e,r,o))})),null===(e=this[G])||void 0===e||e.forEach(((t,o)=>{null!=t.argsProvider&&(this[o]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,o,e,r;super.connectedCallback(),new Set([...null!==(o=null===(t=this[G])||void 0===t?void 0:t.values())&&void 0!==o?o:[],...[...null!==(r=null===(e=this[H])||void 0===e?void 0:e.keys())&&void 0!==r?r:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,o){t=t.toLowerCase(),this[M].has(t)||this[M].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=o?o:{})}addI18nContext(t,o){this.addI18nMessages("string"==typeof t?t:t.name,o)}disconnectedCallback(){super.disconnectedCallback(),this[M].forEach((t=>t())),this[M].clear()}}return o=M,A([r.property({type:Boolean})],e.prototype,"useCustomMessageContexts",void 0),e}class P extends(j(o.FtLitElement)){}class T extends(j(o.FtLitElementRedux)){}var _=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class Y extends T{constructor(){super(),this.editorMode=!1,this.addStore(E)}render(){return this.key&&this.context?e.html`
233
233
  <span class="ft-i18n">
234
234
  ${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
235
235
  </span>
@@ -402,9 +402,9 @@ function(t){return(e,o)=>{const{slot:r,selector:i}=t??{},n="slot"+(r?`[name=${r}
402
402
  }
403
403
  `;var Ol;!function(t){t.FEEDBACK="FEEDBACK",t.RATING="RATING",t.PRINT="PRINT",t.BOOKMARK="BOOKMARK",t.COLLECTIONS="COLLECTIONS",t.PERSONAL_BOOKS="PERSONAL_BOOKS"}(Ol||(Ol={}));var wl=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Sl extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}}const Cl=Symbol("registerInterval");class Nl extends(function(t){var e;class o extends t{constructor(){super(...arguments),this[e]=0}setReaderStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"reader")}clearStateManager(){this.stateManager&&(this.removeStore("reader"),this.stateManager=void 0)}get service(){var t;return null===(t=this.stateManager)||void 0===t?void 0:t.service}connectedCallback(){super.connectedCallback(),this[Cl]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[Cl]):this.dispatchEvent(new Sl)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return e=Cl,wl([Se()],o.prototype,"stateManager",void 0),o}(cn)){}const El=dt`
404
404
  `,Il=dt`
405
- `,Rl=Ja.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1}});class kl{static get(t){const{baseUrl:e,apiIntegrationIdentifier:o}=Rl.getState(),r=null!=t?t:o;if(e&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,r,!0)}static await(t){return new Promise((e=>{let o=kl.get(t);if(o)e(o);else{const r=Rl.subscribe((()=>{o=kl.get(t),o&&(r(),e(o))}))}}))}}class Ll{constructor(t=!0,e){var o;this.overrideApi=e;let r=this.constructor;r.commonCache=null!==(o=r.commonCache)&&void 0!==o?o:new to,this.cache=t?r.commonCache:new to}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:kl.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:kl.await()}clearCache(){this.cache.clearAll()}}var Ul;const Wl=Symbol("clearAfterUnitTest");class $l extends Ll{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Ul]=()=>{this.defaultMessages={},this.cache=new to,this.listeners={}},this.currentUiLocale=Rl.getState().uiLocale,Rl.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Rl.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const e=t.name.toLowerCase();this.cache.setFinal(e,t),this.notify(e)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var o;if(t=t.toLowerCase(),Object.keys(e).length>0){const r={...null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},...e};co(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...o){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 Ji(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=>ao(0).then((()=>t())).catch((()=>null)))))}}Ul=Wl,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends $l{constructor(){super((async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends $l{constructor(){super((async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e)))}});const Bl=window.FluidTopicsI18nService,zl=window.FluidTopicsCustomI18nService;var Fl=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Al extends Ai{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>kl.get(),this.cache=new to,this.cleanSessionDebouncer=new io}render(){return Jt`
405
+ `,Rl=Ja.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1}});class kl{static get(t){const{baseUrl:e,apiIntegrationIdentifier:o}=Rl.getState(),r=null!=t?t:o;if(e&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,r,!0)}static await(t){return new Promise((e=>{let o=kl.get(t);if(o)e(o);else{const r=Rl.subscribe((()=>{o=kl.get(t),o&&(r(),e(o))}))}}))}}class Ll{constructor(t=!0,e){var o;this.overrideApi=e;let r=this.constructor;r.commonCache=null!==(o=r.commonCache)&&void 0!==o?o:new to,this.cache=t?r.commonCache:new to}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:kl.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:kl.await()}clearCache(){this.cache.clearAll()}}var Ul;const Wl=Symbol("clearAfterUnitTest");class $l extends Ll{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Ul]=()=>{this.defaultMessages={},this.cache=new to,this.listeners={}},this.currentUiLocale=Rl.getState().uiLocale,Rl.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Rl.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const e=t.name.toLowerCase();this.cache.setFinal(e,t),this.notify(e)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var o;if(t=t.toLowerCase(),Object.keys(e).length>0){const r={...null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},...e};co(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...o){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 Ji(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=>ao(0).then((()=>t())).catch((()=>null)))))}}Ul=Wl,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends $l{constructor(){super((async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends $l{constructor(){super((async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e)))}});const Bl=window.FluidTopicsI18nService,zl=window.FluidTopicsCustomI18nService;var Fl=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Al extends Ai{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.navigatorOnline=!1,this.forcedOffline=!1,this.apiProvider=()=>kl.get(),this.messageContexts=[],this.cache=new to,this.cleanSessionDebouncer=new io}render(){return Jt`
406
406
  <slot></slot>
407
- `}update(t){super.update(t),t.has("baseUrl")&&(Rl.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Rl.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Rl.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Rl.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Rl.actions.noCustom(this.noCustom),t.has("editorMode")&&Rl.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Rl.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Rl.actions.session(this.session),t.has("availableUiLocales")&&Rl.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Bl.addContext(t))),t.has("openExternalDocumentInNewTab")&&Rl.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}Al.elementDefinitions={},Al.styles=Il,Fl([we()],Al.prototype,"baseUrl",void 0),Fl([we()],Al.prototype,"apiIntegrationIdentifier",void 0),Fl([we()],Al.prototype,"uiLocale",void 0),Fl([uo(null)],Al.prototype,"availableUiLocales",void 0),Fl([uo(null)],Al.prototype,"metadataConfiguration",void 0),Fl([we({type:Boolean})],Al.prototype,"editorMode",void 0),Fl([we({type:Boolean})],Al.prototype,"noCustom",void 0),Fl([we({type:Boolean})],Al.prototype,"openExternalDocumentInNewTab",void 0),Fl([we({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Al.prototype,"noCustomComponent",void 0),Fl([we({type:Boolean})],Al.prototype,"withManualResources",void 0),Fl([uo([])],Al.prototype,"messageContexts",void 0),Fl([uo(void 0)],Al.prototype,"session",void 0),Fl([we({type:Object})],Al.prototype,"apiProvider",void 0);class jl extends Ll{async listMySearches(){let t=Rl.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class _l extends Ll{async listMyBookmarks(){let t=Rl.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const Pl=Ja.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=Rl.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new _l,this.savedSearchesService=new jl,Rl.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Rl.getState();co(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),Pl.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Pl.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Pl.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Pl.actions.bookmarks(e)}}},ho("ft-app-context")(Al);var Ml=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const Kl=Symbol("i18nAttributes"),Zl=Symbol("i18nProperties"),Dl=Symbol("i18nUnsubs");function Hl(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?zl:Bl}i18n(t,e,...o){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...o);const i=null!==(r=t.args)&&void 0!==r?r:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...i)}onI18nUpdate(t){var e,o;null===(e=this[Kl])||void 0===e||e.forEach(((e,o)=>{var r;const i=this.getI18nAttributeValue(o);(null===(r=null==i?void 0:i.context)||void 0===r?void 0:r.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(o,i,e)})),null===(o=this[Zl])||void 0===o||o.forEach(((e,o)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[o]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,e,o){this[t]={...e,message:this.i18n({context:e.context,key:e.key,...o})}}update(t){var e,o;super.update(t),null===(e=this[Kl])||void 0===e||e.forEach(((e,o)=>{const r=this.getI18nAttributeValue(o);(null==r?void 0:r.context)&&r.key&&(t.has(o)||null!=e.argsProvider)&&(t.has(o)&&this.addI18nContext(r.context),this.updateI18nAttributeMessage(o,r,e))})),null===(o=this[Zl])||void 0===o||o.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,e,o,r;super.connectedCallback(),new Set([...null!==(e=null===(t=this[Zl])||void 0===t?void 0:t.values())&&void 0!==e?e:[],...[...null!==(r=null===(o=this[Kl])||void 0===o?void 0:o.keys())&&void 0!==r?r:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[Dl].has(t)||this[Dl].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages("string"==typeof t?t:t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[Dl].forEach((t=>t())),this[Dl].clear()}}return e=Dl,Ml([we({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class Tl extends(Hl(Ai)){}class Gl extends(Hl(cn)){}var Vl=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class ql extends Gl{constructor(){super(),this.editorMode=!1,this.addStore(Rl)}render(){return this.key&&this.context?Jt`
407
+ `}update(t){super.update(t),t.has("baseUrl")&&(Rl.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Rl.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Rl.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Rl.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Rl.actions.noCustom(this.noCustom),t.has("editorMode")&&Rl.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Rl.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Rl.actions.session(this.session),t.has("availableUiLocales")&&Rl.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Bl.addContext(t))),t.has("openExternalDocumentInNewTab")&&Rl.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("navigatorOnline")&&Rl.actions.navigatorOnline(this.navigatorOnline),t.has("forcedOffline")&&Rl.actions.forcedOffline(this.forcedOffline),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}Al.elementDefinitions={},Al.styles=Il,Fl([we()],Al.prototype,"baseUrl",void 0),Fl([we()],Al.prototype,"apiIntegrationIdentifier",void 0),Fl([we()],Al.prototype,"uiLocale",void 0),Fl([uo(null)],Al.prototype,"availableUiLocales",void 0),Fl([uo(null)],Al.prototype,"metadataConfiguration",void 0),Fl([we({type:Boolean})],Al.prototype,"editorMode",void 0),Fl([we({type:Boolean})],Al.prototype,"noCustom",void 0),Fl([we({type:Boolean})],Al.prototype,"openExternalDocumentInNewTab",void 0),Fl([we({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Al.prototype,"noCustomComponent",void 0),Fl([we({type:Boolean})],Al.prototype,"withManualResources",void 0),Fl([we({type:Boolean})],Al.prototype,"navigatorOnline",void 0),Fl([we({type:Boolean})],Al.prototype,"forcedOffline",void 0),Fl([we({type:Object})],Al.prototype,"apiProvider",void 0),Fl([uo([])],Al.prototype,"messageContexts",void 0),Fl([uo(void 0)],Al.prototype,"session",void 0);class jl extends Ll{async listMySearches(){let t=Rl.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class _l extends Ll{async listMyBookmarks(){let t=Rl.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const Pl=Ja.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=Rl.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new _l,this.savedSearchesService=new jl,Rl.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Rl.getState();co(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),Pl.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Pl.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Pl.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Pl.actions.bookmarks(e)}}},ho("ft-app-context")(Al);var Ml=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const Kl=Symbol("i18nAttributes"),Zl=Symbol("i18nProperties"),Dl=Symbol("i18nUnsubs");function Hl(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?zl:Bl}i18n(t,e,...o){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...o);const i=null!==(r=t.args)&&void 0!==r?r:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...i)}onI18nUpdate(t){var e,o;null===(e=this[Kl])||void 0===e||e.forEach(((e,o)=>{var r;const i=this.getI18nAttributeValue(o);(null===(r=null==i?void 0:i.context)||void 0===r?void 0:r.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(o,i,e)})),null===(o=this[Zl])||void 0===o||o.forEach(((e,o)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[o]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,e,o){this[t]={...e,message:this.i18n({context:e.context,key:e.key,...o})}}update(t){var e,o;super.update(t),null===(e=this[Kl])||void 0===e||e.forEach(((e,o)=>{const r=this.getI18nAttributeValue(o);(null==r?void 0:r.context)&&r.key&&(t.has(o)||null!=e.argsProvider)&&(t.has(o)&&this.addI18nContext(r.context),this.updateI18nAttributeMessage(o,r,e))})),null===(o=this[Zl])||void 0===o||o.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,e,o,r;super.connectedCallback(),new Set([...null!==(e=null===(t=this[Zl])||void 0===t?void 0:t.values())&&void 0!==e?e:[],...[...null!==(r=null===(o=this[Kl])||void 0===o?void 0:o.keys())&&void 0!==r?r:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[Dl].has(t)||this[Dl].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages("string"==typeof t?t:t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[Dl].forEach((t=>t())),this[Dl].clear()}}return e=Dl,Ml([we({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class Tl extends(Hl(Ai)){}class Gl extends(Hl(cn)){}var Vl=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class ql extends Gl{constructor(){super(),this.editorMode=!1,this.addStore(Rl)}render(){return this.key&&this.context?Jt`
408
408
  <span class="ft-i18n">
409
409
  ${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
410
410
  </span>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-attachments",
3
- "version": "1.1.66",
3
+ "version": "1.1.68",
4
4
  "description": "Reader component to list map attachments",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,15 +19,15 @@
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.66",
23
- "@fluid-topics/ft-i18n": "1.1.66",
24
- "@fluid-topics/ft-icon": "1.1.66",
25
- "@fluid-topics/ft-reader-context": "1.1.66",
26
- "@fluid-topics/ft-ripple": "1.1.66",
27
- "@fluid-topics/ft-typography": "1.1.66",
28
- "@fluid-topics/ft-wc-utils": "1.1.66",
29
- "@fluid-topics/public-api": "1.0.65",
22
+ "@fluid-topics/ft-app-context": "1.1.68",
23
+ "@fluid-topics/ft-i18n": "1.1.68",
24
+ "@fluid-topics/ft-icon": "1.1.68",
25
+ "@fluid-topics/ft-reader-context": "1.1.68",
26
+ "@fluid-topics/ft-ripple": "1.1.68",
27
+ "@fluid-topics/ft-typography": "1.1.68",
28
+ "@fluid-topics/ft-wc-utils": "1.1.68",
29
+ "@fluid-topics/public-api": "1.0.67",
30
30
  "lit": "3.1.0"
31
31
  },
32
- "gitHead": "c7c2a2e66a28387fcdfdc4ba1fc9fdfc65d7b1ac"
32
+ "gitHead": "d10171ba718cee726044d0cc44820ebbb1ab7cbc"
33
33
  }