@fluid-topics/ft-reader-search-in-document 1.1.25 → 1.1.26

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.
@@ -1050,7 +1050,7 @@ const ze=Symbol.for(""),Ze=t=>{if(t?.r===ze)return t?._$litStatic$},Fe=t=>({_$li
1050
1050
  `,wr=o.css`
1051
1051
  `,Nr=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 Sr{static build(t){const{baseUrl:e,apiIntegrationIdentifier:o}=Nr.getState(),r=null!=t?t:o;if(e&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,r,!0)}static get(t){var e;return null!=t?Sr.build(t):null!==(e=Sr.API)&&void 0!==e?e:Sr.API=Sr.build()}static await(t){return new Promise((e=>{let o=Sr.get(t);if(o)e(o);else{const r=Nr.subscribe((()=>{o=Sr.get(t),o&&(r(),e(o))}))}}))}}var Cr;const $r=Symbol("clearAfterUnitTest");class Er{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new e.CacheRegistry,this.listeners={},this.currentUiLocale="",this[Cr]=()=>{this.defaultMessages={},this.cache=new e.CacheRegistry,this.listeners={}},this.currentUiLocale=Nr.getState().uiLocale,Nr.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Nr.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 r;if(t=t.toLowerCase(),Object.keys(o).length>0){const i={...null!==(r=this.defaultMessages[t])&&void 0!==r?r:{},...o};e.deepEqual(this.defaultMessages[t],i)||(this.defaultMessages[t]=i,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,o,...r){var i,n,a;t=t.toLowerCase(),this.fetchContext(t);const s=null!==(n=null===(i=this.cache.getNow(t))||void 0===i?void 0:i.messages)&&void 0!==n?n:{};return new e.ParametrizedLabelResolver(null!==(a=this.defaultMessages[t])&&void 0!==a?a:{},s).resolve(o,...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,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)))))}}Cr=$r,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new Er((async(t,e)=>(await Sr.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new Er((async(t,e)=>(await Sr.await()).getCustomMessageContext(t,e))));const Rr=window.FluidTopicsI18nService,Ir=window.FluidTopicsCustomI18nService;var kr=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(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 Ur 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=()=>Sr.get(),this.cache=new e.CacheRegistry,this.cleanSessionDebouncer=new e.Debouncer}render(){return o.html`
1052
1052
  <slot></slot>
1053
- `}update(t){super.update(t),t.has("baseUrl")&&Nr.actions.baseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&Nr.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Nr.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Nr.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Nr.actions.noCustom(this.noCustom),t.has("editorMode")&&Nr.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Nr.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Nr.actions.session(this.session),t.has("availableUiLocales")&&Nr.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Rr.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()))}}Ur.elementDefinitions={},Ur.styles=wr,kr([r.property()],Ur.prototype,"baseUrl",void 0),kr([r.property()],Ur.prototype,"apiIntegrationIdentifier",void 0),kr([r.property()],Ur.prototype,"uiLocale",void 0),kr([e.jsonProperty(null)],Ur.prototype,"availableUiLocales",void 0),kr([e.jsonProperty(null)],Ur.prototype,"metadataConfiguration",void 0),kr([r.property({type:Boolean})],Ur.prototype,"editorMode",void 0),kr([r.property({type:Boolean})],Ur.prototype,"noCustom",void 0),kr([r.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Ur.prototype,"noCustomComponent",void 0),kr([r.property({type:Boolean})],Ur.prototype,"withManualResources",void 0),kr([e.jsonProperty([])],Ur.prototype,"messageContexts",void 0),kr([e.jsonProperty(void 0)],Ur.prototype,"session",void 0),kr([r.property({type:Object})],Ur.prototype,"apiProvider",void 0);class Lr{async listMySearches(){var t;return(null===(t=Nr.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await Sr.await()).listMySearches(Nr.getState().session.profile.userId):[]}}const Wr=new e.CacheRegistry;class Ar{async listMyBookmarks(){return Wr.get("bookmarks",(async()=>(await Sr.await()).listMyBookmarks(Nr.getState().session.profile.userId)))}clearCache(){Wr.clear("bookmarks")}}const Kr=e.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const Br=new class{constructor(){this.currentSession=Nr.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Ar,Nr.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=Nr.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(){Kr.actions.savedSearches(void 0)}clearMyBookmarks(){Kr.actions.bookmarks(void 0)}async reloadMySearches(){const t=new Lr,e=await t.listMySearches();Kr.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;Kr.actions.bookmarks(e)}}};e.customElement("ft-app-context")(Ur);var zr=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(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 Zr=Symbol("i18nProperties"),Fr=Symbol("i18nUnsubs");function Dr(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?Ir:Rr}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;null===(e=this[Zr])||void 0===e||e.forEach(((e,o)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[o]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}update(t){var e;super.update(t),null===(e=this[Zr])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[Zr]&&new Set([...this[Zr].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[Fr].has(t)||this[Fr].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages(t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[Fr].forEach((t=>t())),this[Fr].clear()}}return e=Fr,zr([r.property({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class Tr extends(Dr(e.FtLitElement)){}class Pr extends(Dr(e.FtLitElementRedux)){}var Mr=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(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 Hr extends Pr{constructor(){super(),this.editorMode=!1,this.addStore(Nr)}render(){return this.key&&this.context?o.html`
1053
+ `}update(t){super.update(t),t.has("baseUrl")&&(Nr.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Nr.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Nr.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Nr.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Nr.actions.noCustom(this.noCustom),t.has("editorMode")&&Nr.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Nr.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Nr.actions.session(this.session),t.has("availableUiLocales")&&Nr.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Rr.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()))}}Ur.elementDefinitions={},Ur.styles=wr,kr([r.property()],Ur.prototype,"baseUrl",void 0),kr([r.property()],Ur.prototype,"apiIntegrationIdentifier",void 0),kr([r.property()],Ur.prototype,"uiLocale",void 0),kr([e.jsonProperty(null)],Ur.prototype,"availableUiLocales",void 0),kr([e.jsonProperty(null)],Ur.prototype,"metadataConfiguration",void 0),kr([r.property({type:Boolean})],Ur.prototype,"editorMode",void 0),kr([r.property({type:Boolean})],Ur.prototype,"noCustom",void 0),kr([r.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Ur.prototype,"noCustomComponent",void 0),kr([r.property({type:Boolean})],Ur.prototype,"withManualResources",void 0),kr([e.jsonProperty([])],Ur.prototype,"messageContexts",void 0),kr([e.jsonProperty(void 0)],Ur.prototype,"session",void 0),kr([r.property({type:Object})],Ur.prototype,"apiProvider",void 0);class Lr{async listMySearches(){var t;return(null===(t=Nr.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await Sr.await()).listMySearches(Nr.getState().session.profile.userId):[]}}const Wr=new e.CacheRegistry;class Ar{async listMyBookmarks(){return Wr.get("bookmarks",(async()=>(await Sr.await()).listMyBookmarks(Nr.getState().session.profile.userId)))}clearCache(){Wr.clear("bookmarks")}}const Kr=e.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const Br=new class{constructor(){this.currentSession=Nr.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Ar,Nr.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=Nr.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(){Kr.actions.savedSearches(void 0)}clearMyBookmarks(){Kr.actions.bookmarks(void 0)}async reloadMySearches(){const t=new Lr,e=await t.listMySearches();Kr.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;Kr.actions.bookmarks(e)}}};e.customElement("ft-app-context")(Ur);var zr=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(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 Zr=Symbol("i18nProperties"),Fr=Symbol("i18nUnsubs");function Dr(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?Ir:Rr}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;null===(e=this[Zr])||void 0===e||e.forEach(((e,o)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[o]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}update(t){var e;super.update(t),null===(e=this[Zr])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[Zr]&&new Set([...this[Zr].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[Fr].has(t)||this[Fr].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages(t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[Fr].forEach((t=>t())),this[Fr].clear()}}return e=Fr,zr([r.property({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class Tr extends(Dr(e.FtLitElement)){}class Pr extends(Dr(e.FtLitElementRedux)){}var Mr=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(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 Hr extends Pr{constructor(){super(),this.editorMode=!1,this.addStore(Nr)}render(){return this.key&&this.context?o.html`
1054
1054
  <span class="ft-i18n">
1055
1055
  ${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
1056
1056
  </span>
@@ -1185,7 +1185,7 @@ class ss extends _a{constructor(t){if(super(t),this.et=st,t.type!==za)throw Erro
1185
1185
  `,Ws=kt`
1186
1186
  `,js=Vi.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 Fs{static build(t){const{baseUrl:e,apiIntegrationIdentifier:o}=js.getState(),r=null!=t?t:o;if(e&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,r,!0)}static get(t){var e;return null!=t?Fs.build(t):null!==(e=Fs.API)&&void 0!==e?e:Fs.API=Fs.build()}static await(t){return new Promise((e=>{let o=Fs.get(t);if(o)e(o);else{const r=js.subscribe((()=>{o=Fs.get(t),o&&(r(),e(o))}))}}))}}var Ps;const Ms=Symbol("clearAfterUnitTest");class Bs{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new i,this.listeners={},this.currentUiLocale="",this[Ps]=()=>{this.defaultMessages={},this.cache=new i,this.listeners={}},this.currentUiLocale=js.getState().uiLocale,js.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=js.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};F(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 Xo(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=>W(0).then((()=>t())).catch((()=>null)))))}}Ps=Ms,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new Bs((async(t,e)=>(await Fs.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new Bs((async(t,e)=>(await Fs.await()).getCustomMessageContext(t,e))));const Ks=window.FluidTopicsI18nService,Ts=window.FluidTopicsCustomI18nService;var Ds=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(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 zs extends Ho{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=()=>Fs.get(),this.cache=new i,this.cleanSessionDebouncer=new n}render(){return ue`
1187
1187
  <slot></slot>
1188
- `}update(t){super.update(t),t.has("baseUrl")&&js.actions.baseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&js.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&js.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&js.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&js.actions.noCustom(this.noCustom),t.has("editorMode")&&js.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&js.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&js.actions.session(this.session),t.has("availableUiLocales")&&js.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Ks.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()))}}zs.elementDefinitions={},zs.styles=Ws,Ds([k()],zs.prototype,"baseUrl",void 0),Ds([k()],zs.prototype,"apiIntegrationIdentifier",void 0),Ds([k()],zs.prototype,"uiLocale",void 0),Ds([M(null)],zs.prototype,"availableUiLocales",void 0),Ds([M(null)],zs.prototype,"metadataConfiguration",void 0),Ds([k({type:Boolean})],zs.prototype,"editorMode",void 0),Ds([k({type:Boolean})],zs.prototype,"noCustom",void 0),Ds([k({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],zs.prototype,"noCustomComponent",void 0),Ds([k({type:Boolean})],zs.prototype,"withManualResources",void 0),Ds([M([])],zs.prototype,"messageContexts",void 0),Ds([M(void 0)],zs.prototype,"session",void 0),Ds([k({type:Object})],zs.prototype,"apiProvider",void 0);class Zs{async listMySearches(){var t;return(null===(t=js.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await Fs.await()).listMySearches(js.getState().session.profile.userId):[]}}const _s=new i;class Hs{async listMyBookmarks(){return _s.get("bookmarks",(async()=>(await Fs.await()).listMyBookmarks(js.getState().session.profile.userId)))}clearCache(){_s.clear("bookmarks")}}const Gs=Vi.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const qs=new class{constructor(){this.currentSession=js.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Hs,js.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=js.getState();F(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(){Gs.actions.savedSearches(void 0)}clearMyBookmarks(){Gs.actions.bookmarks(void 0)}async reloadMySearches(){const t=new Zs,e=await t.listMySearches();Gs.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;Gs.actions.bookmarks(e)}}};P("ft-app-context")(zs);var Vs=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(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 Ys=Symbol("i18nProperties"),Xs=Symbol("i18nUnsubs");function Qs(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?Ts:Ks}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;null===(e=this[Ys])||void 0===e||e.forEach(((e,o)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[o]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}update(t){var e;super.update(t),null===(e=this[Ys])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[Ys]&&new Set([...this[Ys].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[Xs].has(t)||this[Xs].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages(t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[Xs].forEach((t=>t())),this[Xs].clear()}}return e=Xs,Vs([k({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class Js extends(Qs(Ho)){}class tc extends(Qs(sr)){}var ec=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(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 oc extends tc{constructor(){super(),this.editorMode=!1,this.addStore(js)}render(){return this.key&&this.context?ue`
1188
+ `}update(t){super.update(t),t.has("baseUrl")&&(js.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&js.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&js.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&js.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&js.actions.noCustom(this.noCustom),t.has("editorMode")&&js.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&js.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&js.actions.session(this.session),t.has("availableUiLocales")&&js.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Ks.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()))}}zs.elementDefinitions={},zs.styles=Ws,Ds([k()],zs.prototype,"baseUrl",void 0),Ds([k()],zs.prototype,"apiIntegrationIdentifier",void 0),Ds([k()],zs.prototype,"uiLocale",void 0),Ds([M(null)],zs.prototype,"availableUiLocales",void 0),Ds([M(null)],zs.prototype,"metadataConfiguration",void 0),Ds([k({type:Boolean})],zs.prototype,"editorMode",void 0),Ds([k({type:Boolean})],zs.prototype,"noCustom",void 0),Ds([k({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],zs.prototype,"noCustomComponent",void 0),Ds([k({type:Boolean})],zs.prototype,"withManualResources",void 0),Ds([M([])],zs.prototype,"messageContexts",void 0),Ds([M(void 0)],zs.prototype,"session",void 0),Ds([k({type:Object})],zs.prototype,"apiProvider",void 0);class Zs{async listMySearches(){var t;return(null===(t=js.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await Fs.await()).listMySearches(js.getState().session.profile.userId):[]}}const _s=new i;class Hs{async listMyBookmarks(){return _s.get("bookmarks",(async()=>(await Fs.await()).listMyBookmarks(js.getState().session.profile.userId)))}clearCache(){_s.clear("bookmarks")}}const Gs=Vi.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const qs=new class{constructor(){this.currentSession=js.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Hs,js.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=js.getState();F(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(){Gs.actions.savedSearches(void 0)}clearMyBookmarks(){Gs.actions.bookmarks(void 0)}async reloadMySearches(){const t=new Zs,e=await t.listMySearches();Gs.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;Gs.actions.bookmarks(e)}}};P("ft-app-context")(zs);var Vs=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(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 Ys=Symbol("i18nProperties"),Xs=Symbol("i18nUnsubs");function Qs(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?Ts:Ks}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;null===(e=this[Ys])||void 0===e||e.forEach(((e,o)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[o]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}update(t){var e;super.update(t),null===(e=this[Ys])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[Ys]&&new Set([...this[Ys].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[Xs].has(t)||this[Xs].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages(t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[Xs].forEach((t=>t())),this[Xs].clear()}}return e=Xs,Vs([k({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class Js extends(Qs(Ho)){}class tc extends(Qs(sr)){}var ec=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(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 oc extends tc{constructor(){super(),this.editorMode=!1,this.addStore(js)}render(){return this.key&&this.context?ue`
1189
1189
  <span class="ft-i18n">
1190
1190
  ${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
1191
1191
  </span>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-search-in-document",
3
- "version": "1.1.25",
3
+ "version": "1.1.26",
4
4
  "description": "A search component to retrieve occurrences in documents",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,20 +19,20 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-button": "1.1.25",
23
- "@fluid-topics/ft-card": "1.1.25",
24
- "@fluid-topics/ft-i18n": "1.1.25",
25
- "@fluid-topics/ft-search-context": "1.1.25",
26
- "@fluid-topics/ft-search-input": "1.1.25",
27
- "@fluid-topics/ft-search-load-more-button": "1.1.25",
28
- "@fluid-topics/ft-search-result-abstract": "1.1.25",
29
- "@fluid-topics/ft-search-result-title": "1.1.25",
30
- "@fluid-topics/ft-search-results": "1.1.25",
31
- "@fluid-topics/ft-search-results-number": "1.1.25",
32
- "@fluid-topics/ft-typography": "1.1.25",
33
- "@fluid-topics/ft-wc-utils": "1.1.25",
34
- "@fluid-topics/public-api": "1.0.55",
22
+ "@fluid-topics/ft-button": "1.1.26",
23
+ "@fluid-topics/ft-card": "1.1.26",
24
+ "@fluid-topics/ft-i18n": "1.1.26",
25
+ "@fluid-topics/ft-search-context": "1.1.26",
26
+ "@fluid-topics/ft-search-input": "1.1.26",
27
+ "@fluid-topics/ft-search-load-more-button": "1.1.26",
28
+ "@fluid-topics/ft-search-result-abstract": "1.1.26",
29
+ "@fluid-topics/ft-search-result-title": "1.1.26",
30
+ "@fluid-topics/ft-search-results": "1.1.26",
31
+ "@fluid-topics/ft-search-results-number": "1.1.26",
32
+ "@fluid-topics/ft-typography": "1.1.26",
33
+ "@fluid-topics/ft-wc-utils": "1.1.26",
34
+ "@fluid-topics/public-api": "1.0.56",
35
35
  "lit": "3.1.0"
36
36
  },
37
- "gitHead": "d09eebf7a9bd09694505b987bc2645eee91b47a6"
37
+ "gitHead": "6734976f5a7f6b986917a085be0c38ca3ae562a0"
38
38
  }