@fluid-topics/ft-reader-metadata 2.2.19 → 2.2.21
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.
|
@@ -917,11 +917,11 @@
|
|
|
917
917
|
</ft-typography>
|
|
918
918
|
</div>
|
|
919
919
|
`}};xt.elementDefinitions={"ft-typography":re};xt.styles=Tu;var Ru=h(b());var wu={"ft-floating-menu":$,"ft-floating-menu-item":ue,"ft-floating-menu-label":xt};(0,Ru.customElements)(wu);var ri=h(b());function Vp(t){var e;return((e=(0,ri.accessResult)(t))===null||e===void 0?void 0:e.openMode)===rn.EXTERNAL}function no(t,e){return Vp(t)?(0,ri.accessResult)(t).originUrl:(0,ri.accessResultUrl)(t,e)}var Ku=h(Iu());var so=yn.build("designedReaderMapMetadata");var Mu=h(I());var Lu=Mu.css`
|
|
920
|
-
`;var ai=h(I()),at=h(W()),Y=h(b());var ae=h(b());var Pu=h(b()),jp={setTranslationDestinationLanguage:(t,e)=>{t.translation.destinationLanguage=e.payload},setTranslationSourceLanguage:(t,e)=>{t.translation.sourceLanguage=e.payload},setTranslationProfileId:(t,e)=>{t.translation.profileId=e.payload},setTranslationLoading:(t,e)=>{t.translation.isLoading=e.payload},setTranslationError:(t,e)=>{t.translation.isError=e.payload},setTopicsRating:(t,e)=>{for(let r in e.payload)t.topicsRating[r]=e.payload[r]}},Nu=t=>Pu.FtReduxStore.get({name:"ft-reader-"+t,initialState:{mapId:void 0,renderedTopics:[],visibleTopics:[],map:void 0,toc:void 0,pagesToc:void 0,filteredTocNodes:{},paginationConfiguration:void 0,currentPage:void 0,scrollTarget:void 0,configuration:void 0,searchInDocumentQuery:void 0,relatives:void 0,mapRating:void 0,topicsRating:{},translation:{sourceLanguage:void 0,destinationLanguage:void 0,profileId:void 0,isLoading:!1,isError:!1},linkPreviewDialogId:void 0,metadataFilters:[]},reducers:jp});var oo=class{constructor(e,r){this.mapId=e,this.paginatedToc=r,this.nodeByTocId={},this.nodeByUrl={},this.duplicatedPrettyUrls=new Set,this.pages=[],this.pageByTocId={}}build(){return{paginationConfiguration:this.paginatedToc.configuration,toc:this.convertNodes(this.paginatedToc.paginatedToc,1),pagesToc:this.extractPagesToc(this.paginatedToc.paginatedToc,1),nodeByTocId:this.nodeByTocId,nodeByUrl:this.nodeByUrl,duplicatedPrettyUrls:this.duplicatedPrettyUrls,pages:this.pages,pageByTocId:this.pageByTocId,translationError:this.paginatedToc.translationError,filteredTocNodes:this.paginatedToc.filteredTocNodes}}extractPagesToc(e,r,i){return e.flatMap(n=>{var s;return n.pageConfiguration&&this.registerPage(this.buildPage(n,i)),n.tocId==null?this.extractPagesToc(n.children,r,i):[{tocId:n.tocId,title:(s=n.title)!==null&&s!==void 0?s:"",contentTag:n.contentTag,contentClass:n.contentClass,untranslatedTitle:n.untranslatedTitle,depth:r,children:this.extractPagesToc(n.children,r+1,n.tocId)}]})}convertNodes(e,r,i){return e.flatMap(n=>{var s,o,a;if(n.tocId==null)return[...this.convertSectionNodes((o=n.pageToc)!==null&&o!==void 0?o:[],r,n.tocId),...this.convertNodes(n.children,r,n.tocId)];let l=(s=n.prettyUrl)===null||s===void 0?void 0:s.replace(/^\//,""),c={tocId:n.tocId,contentId:n.contentId,title:n.title,contentTag:n.contentTag,contentClass:n.contentClass,untranslatedTitle:n.untranslatedTitle,hasRating:n.hasRating,origin:n.origin,prettyUrl:l,depth:r,parentTocId:i,children:[]};this.register(c);let u=this.convertSectionNodes((a=n.pageToc)!==null&&a!==void 0?a:[],r+1,n.tocId),d=this.convertNodes(n.children,r+1,c.tocId);return c.children=[...u,...d],[c]})}convertSectionNodes(e,r,i){return e.flatMap(n=>{var s;let o=(s=n.prettyUrl)===null||s===void 0?void 0:s.replace(/^\//,""),a={...n,prettyUrl:o,depth:r,parentTocId:i,children:[]};return this.register(a),a.children=this.convertSectionNodes(n.children,r+1,n.tocId),[a]})}buildPage(e,r){var i,n,s,o,a,l,c,u;let d=(o=e.tocId)!==null&&o!==void 0?o:(n=(i=e.pageToc)===null||i===void 0?void 0:i[0])===null||n===void 0?void 0:n.tocId,p={number:this.pages.length+1,title:(a=e.title)!==null&&a!==void 0?a:"",untranslatedTitle:e.untranslatedTitle,rootTocId:d??"root",toc:((l=e.pageToc)!==null&&l!==void 0?l:[]).map(v=>this.nodeByTocId[v.tocId]),topics:[],hiddenTopics:[],rootDepth:d?this.nodeByTocId[d].depth:1,breadcrumb:r?this.buildBreadcrumb(this.nodeByTocId[r]):[]},m=(v,T)=>(T?p.topics:p.hiddenTopics).push(v),x=(c=(s=e.pageConfiguration)===null||s===void 0?void 0:s.parentsVisibility)!==null&&c!==void 0?c:[];p.breadcrumb.forEach((v,T)=>{m(v,x[T])}),e.tocId&&m(e.tocId,e.pageConfiguration.isVisible),p.topics.push(...this.tocIds((u=e.pageToc)!==null&&u!==void 0?u:[]));let A=this.resolveOverridenRootTocIdByParentForcedByPagination(p.breadcrumb,x);return p.rootTocId=A??p.rootTocId,p.rootDepth=A?this.nodeByTocId[A].depth:p.rootDepth,p}resolveOverridenRootTocIdByParentForcedByPagination(e,r){for(let i=0;i<e.length;i++)if(r[i])return e[i]}registerPage(e){for(let r of[...e.topics,...e.hiddenTopics])this.pageByTocId[r]||(this.pageByTocId[r]=e);this.pages.push(e)}tocIds(e){return e.flatMap(r=>[r.tocId,...this.tocIds(r.children)])}buildBreadcrumb(e){let r=[e.tocId];for(;e?.parentTocId;)r.unshift(e.parentTocId),e=this.nodeByTocId[e.parentTocId];return r}register(e){e.prettyUrl&&(this.nodeByUrl[e.prettyUrl]==null?this.nodeByUrl[e.prettyUrl]=e:this.duplicatedPrettyUrls.add(e.prettyUrl)),this.nodeByUrl[`${this.mapId}/${e.tocId}`]=e,this.nodeByTocId[e.tocId]=e}},In=class{convertPaginatedToc(e,r){return new oo(e,r).build()}};var Ln=h(b()),Mn=class extends ee{get metadataFilters(){return this._metadataFilters}set metadataFilters(e){this._metadataFilters=e}get mapId(){return this._mapId}set mapId(e){e!==this._mapId&&this.clear(),this._mapId=e}constructor(e,r,i,n){super(!1,r),this.converter=e,this._mapId=i,this._metadataFilters=n,this.initCache()}async withMapId(e){return this._mapId?e(this._mapId):void 0}initCache(){this.cache.register("configuration",()=>this.api.getReaderConfiguration()),this.cache.register("map",()=>this.withMapId(e=>this.fetchMap(e))),this.cache.register(this.makeCacheKey("enrichedToc",void 0,this.metadataFilters),()=>this.withMapId(e=>this.fetchPages(e,this._metadataFilters).then(r=>this.converter.convertPaginatedToc(e,r)))),this.cache.register("ratingSummary",()=>{var e,r;return Pe((r=(e=y.getState().session)===null||e===void 0?void 0:e.profile.roles)!==null&&r!==void 0?r:[],"RATING_USER")?this.withMapId(n=>this.fetchMapRating(n)):Promise.resolve()})}clear(){this.cache.clearMatching(e=>e!=="configuration")}makeCacheKey(e,r,i){return e+(r?"-destinationLanguage-"+r?.destinationLanguage:"")+(!i||i.length==0?"":"-metadataFilters-"+this.hash(i))}getMap(e){return this.cache.get(this.makeCacheKey("map",e),()=>this.fetchMap(this.mapId,e))}getMapNow(e){return this.cache.getNow(this.makeCacheKey("map",e))}getConfiguration(){return this.cache.get("configuration")}clearConfiguration(){this.cache.clear("configuration")}getEnrichedToc(e){return this.cache.get(this.makeCacheKey("enrichedToc",e,this.metadataFilters),()=>this.fetchPages(this.mapId,this.metadataFilters,e).then(r=>this.converter.convertPaginatedToc(this.mapId,r)))}getEnrichedTocNow(e){return this.cache.getNow(this.makeCacheKey("enrichedToc",e,this.metadataFilters))}async getPaginationConfiguration(){return(await this.getEnrichedToc()).paginationConfiguration}async getToc(e){return(await this.getEnrichedToc(e)).toc}async getPagesToc(e){return(await this.getEnrichedToc(e)).pagesToc}async getTranslationError(e){return(await this.getEnrichedToc(e)).translationError}async getFilteredTocNodes(e){return(await this.getEnrichedToc(e)).filteredTocNodes}async getTocNode(e,r){return(await this.getEnrichedToc(r)).nodeByTocId[e]}getTocNodeNow(e,r){var i;return(i=this.getEnrichedTocNow(r))===null||i===void 0?void 0:i.nodeByTocId[e]}getTocNodeNowByUrl(e,r){var i,n;let s=this.getMapNow(r);return s?.prettyUrl==e||`${s?.id}/root`===e?(i=this.getEnrichedTocNow(r))===null||i===void 0?void 0:i.toc[0]:(n=this.getEnrichedTocNow(r))===null||n===void 0?void 0:n.nodeByUrl[e]}async getPage(e,r){let i=await this.getEnrichedToc(r);return i.pages[e-1]||i.pages[0]}async getPageByTocId(e,r){let i=await this.getEnrichedToc(r);return i.pageByTocId[e]||i.pages[0]}getTopicInfo(e){return this.cache.get("topic-"+e.tocId,()=>this.fetchTopicMetadata(e))}getTopicContent(e){return this.cache.get("topic-content-"+e.tocId,()=>this.fetchTopicHTMLContent(e))}getTranslatedTopicContent(e,r){return this.cache.get(this.makeCacheKey("translated-topic-content-"+e.tocId,r),()=>this.fetchTranslatedTopicHTMLContent(e,r))}async getTopicMetadataValue(e,r){let i=this.getTocNodeNow(e);if(!i)return;let n=await this.getTopicInfo(i);return n?.metadata.find(s=>s.key==r)}getAttachments(){return this.cache.get("map-attachments",()=>this.fetchAttachments())}clearMapAttachments(){this.cache.clear("map-attachments")}getRelativesForDocument(e,r){return this.cache.get("document-relatives-"+e+"-"+r.join("-"),()=>this.fetchRelativesForDocument(e,r))}getRelativesForTopicInMap(e,r,i){return this.cache.get("topic-relatives-"+[e,r,...i].join("-"),()=>this.fetchRelativesForTopicInMap(e,r,i))}getAttachmentDownloadLink(e){return this.makeAbsolute(`${this.api.endpoints.khub.maps.mapId(this.mapId).attachments.attachmentId(e).content}?download=true&locationValue=reader`)}getLink(e,r,i,n){let s=this.getNavigationData(e,r,i),o=this.getReaderLinkPrefix()+(s.prettyUrl?s.prettyUrl:`${s.mapId}/${s.tocId}`),a=new URL(o,this.api.tenantBaseUrl);if(s.page!=null&&a.searchParams.set("page",`${s.page}`),s.prettyUrlDuplicated&&a.searchParams.set("tocId",s.tocId),s.section!=null&&a.searchParams.set("section",s.section),n&&s.metadataFilters){let l=Ln.SearchPlaceConverter.serializeValueFilters(s.metadataFilters);l&&a.searchParams.set(Ln.SearchPlaceQueryParams.VALUE_FILTERS,l)}return a.href}getLinkWithFilter(e,r,i){return this.getLink(e,r,i,!0)}getNavigationData(e,r,i,n){var s,o;e=e||"root";let a=this.getEnrichedTocNow(n),l=a?.pageByTocId[e],c=a?.nodeByTocId[e],u=c?.prettyUrl;return{mapId:this.mapId,tocId:e,topicTitle:(s=c?.title)!==null&&s!==void 0?s:"",untranslatedTopicTitle:c?.untranslatedTitle,page:r&&l&&l.number!==r?r:void 0,prettyUrl:u?.replace(/^r\//,""),prettyUrlDuplicated:(o=a?.duplicatedPrettyUrls.has(u??""))!==null&&o!==void 0?o:!1,section:i,metadataFilters:this.metadataFilters}}async getAccurateNavigationData(e,r,i,n){return await this.getEnrichedToc(n),this.getNavigationData(e,r,i,n)}getRatingSummary(){return this.cache.get("ratingSummary")}reloadRating(){return this.cache.clear("ratingSummary"),this.getRatingSummary()}getMapRating(){return this.getRatingSummary().then(e=>e?.publication)}getTopicRating(e){return this.getRatingSummary().then(r=>{var i;return r?{type:r.topics.type,rating:(i=r.topics)===null||i===void 0?void 0:i.ratings.find(n=>n.tocId===e)}:void 0})}rateMap(e,r){return this.makeRateMapRequest(e,r).then(()=>this.clearRatingIfNecessary())}unrateMap(){return this.makeUnrateMapRequest().then(()=>this.clearRatingIfNecessary())}sendMapFeedback(e,r){return this.makeMapFeedbackRequest(e,r)}rateTopic(e,r,i){return this.makeRateTopicRequest(e,r,i).then(()=>this.clearRatingIfNecessary())}unrateTopic(e){return this.makeUnrateTopicRequest(e).then(()=>this.clearRatingIfNecessary())}async clearRatingIfNecessary(){let e=y.getState().session;e?.sessionAuthenticated&&this.cache.clear("ratingSummary")}sendTopicFeedback(e,r,i){return this.makeTopicFeedbackRequest(e,r,i)}fontsStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.fonts)}themeStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.theme)}buildBreadcrumb(e,r){let i=this.getTocNodeNow(e,r);if(!i)return[];let n=[{tocId:i.tocId,title:i.title,untranslatedTitle:i.untranslatedTitle}],s=this.getTocNodeNow(i.parentTocId,r);for(;s;)n.unshift({tocId:s.tocId,title:s.title,untranslatedTitle:s.untranslatedTitle}),s=this.getTocNodeNow(s.parentTocId,r);return n}isFeatureAccessible(e,{session:r}){var i;if(!this.isFeatureAvailable(e))return!1;switch(e){case et.FEEDBACK:return Pe(r??[],P.FEEDBACK_USER);case et.RATING:return Pe(r??[],P.RATING_USER);case et.PRINT:return Pe(r??[],P.PRINT_USER);case et.BOOKMARK:return!!r?.sessionAuthenticated;case et.COLLECTIONS:return Pe(r??[],P.COLLECTION_USER);case et.PERSONAL_BOOKS:return Pe(r??[],P.PERSONAL_BOOK_USER)&&!(!((i=this.getMapNow())===null||i===void 0)&&i.pbkConfidential);default:return!1}}makeAbsolute(e){return this.api.makeAbsolute(e)}};var Pn=class t extends Mn{static async build(e){return new t(new In,void 0,e)}clear(){super.clear(),this.fingerprint=void 0}async fetchMap(e,r){let i=await this.api.getMap(e,r);return this.fingerprint=i.fingerprint,i}fetchMapRating(e){return this.api.getMapRating(e)}async fetchPages(e,r,i){return await this.getMap(i),r?.length?this.api.getFilteredPages(e,i,r):this.api.getPages(e,this.fingerprint,i)}fetchTopicHTMLContent(e){return this.api.getTopicHTMLContent(this.mapId,e.contentId,"DESIGNED_READER",this.fingerprint)}fetchTranslatedTopicHTMLContent(e,r){return this.api.getTranslatedTopicHTMLContent(this.mapId,e.contentId,"DESIGNED_READER",this.fingerprint,r)}fetchTopicMetadata(e){return this.api.getTopic(this.mapId,e.contentId,this.fingerprint)}fetchAttachments(){return this.api.getMapAttachments(this.mapId).catch(()=>[])}fetchRelativesForDocument(e,r){let i={query:"",paging:{page:1,perPage:-1},scope:"DOCUMENTS",metadataFilters:[{key:e,valueFilter:{negative:!1,values:r}}],sort:[],facets:[]};return this.api.search(i)}fetchRelativesForTopicInMap(e,r,i){let n={query:"",paging:{page:1,perPage:1},scope:"ALL_TOPICS",metadataFilters:[{key:r,valueFilter:{negative:!1,values:i}},{key:"ft:publicationId",valueFilter:{negative:!1,values:[e]}}],sort:[],facets:[]};return this.api.search(n)}makeMapFeedbackRequest(e,r){return this.api.sendMapFeedback(this.mapId,e,r)}makeRateMapRequest(e,r){return this.api.rateMap(this.mapId,e,r)}makeRateTopicRequest(e,r,i){return this.api.rateTopic(this.mapId,e,r,i)}makeTopicFeedbackRequest(e,r,i){return this.api.sendTopicFeedback(this.mapId,e,r,i)}makeUnrateMapRequest(){return this.api.unrateMap(this.mapId)}makeUnrateTopicRequest(e){return this.api.unrateTopic(this.mapId,e)}getReaderLinkPrefix(){return"r/"}isFeatureAvailable(e){return!0}};var zp="topicPivot";function Nn(t,e){let r=new URL(t);return e?.values.forEach(i=>{r.searchParams.append(zp,i)}),r.href}var Dn=class t{static build(e,r){return new t(Nu(e.trim()||"context"),r??Pn.build)}loaded(){return(0,ae.waitUntil)(()=>this._loaded)}constructor(e,r,i,n){this.store=e,this.clusteringHelperProvider=i,this.metadataForSwitchToRelatives=new Set,this._loaded=!1,this.loadDebouncer=new ae.Debouncer(10),this.analyticsEventsService=n??new cr,this.initService(r)}async initService(e){this.service=await e();let{mapId:r,metadataFilters:i}=this.store.getState();return this.service.mapId=r,this.service.metadataFilters=i,this.reload()}async setMapId(e){e!==this.store.getState().mapId&&(this.store.actions.mapId(e),this.service&&(this.service.mapId=e),await this.reload())}setRenderedTopics(e){this.store.actions.renderedTopics(e)}setVisibleTopics(e){this.store.actions.visibleTopics(e)}async setFilters(e){(0,ae.deepEqual)(e,this.store.getState().metadataFilters)||(this.store.actions.metadataFilters(e),this.service&&(this.service.metadataFilters=e))}async awaitService(){return(0,ae.waitFor)(()=>this.service)}async navigateToTopic(e,r,i){await this.loaded();let n=await this.resolvePage(e,i);this.store.actions.currentPage(n);let s=this.resolveValidNonRootTocId(e,n);this.store.actions.scrollTarget({tocId:s,section:r}),this.store.getState().visibleTopics[0]!==s&&this.store.actions.visibleTopics([]),e&&!r&&(this.store.commands.clear(/^focus-topic-/),this.store.commands.add({type:`focus-topic-${e}`}))}async resolvePage(e,r){var i,n;let s=await this.awaitService();if(r)return s.getPage(r,this.getTranslationSettings());if(!e)return s.getPageByTocId("root",this.getTranslationSettings());let o=this.store.getState().filteredTocNodes[e],a=((i=this.service)===null||i===void 0?void 0:i.getTocNodeNow(e))!=null;return o&&o.reason!=="ACCESS_RIGHTS_FILTER"&&!a?s.getPageByTocId((n=o.closestParent)!==null&&n!==void 0?n:"root",this.getTranslationSettings()):s.getPageByTocId(e,this.getTranslationSettings())}resolveValidNonRootTocId(e,r){var i,n,s,o,a;let l=(n=e==="root"?void 0:e)!==null&&n!==void 0?n:r.rootTocId;if(!r.topics.includes(l)){if(e!="root"&&!r.hiddenTopics.includes(l)){let c=this.store.getState().filteredTocNodes[l];if(c){this.store.dispatchEvent(new ci(c));let u=((i=this.service)===null||i===void 0?void 0:i.getTocNodeNow(c.tocId))!=null;return c.reason==="ACCESS_RIGHTS_FILTER"||u?c.tocId:(s=c.closestParent)!==null&&s!==void 0?s:"root"}this.store.dispatchEvent(new CustomEvent(Ze.requestedTopicNotFound))}return(a=(o=r.topics[0])!==null&&o!==void 0?o:r.hiddenTopics[0])!==null&&a!==void 0?a:"root"}return l}async navigateToPage(e){await this.loaded();let i=await(await this.awaitService()).getPage(e,this.getTranslationSettings());this.store.actions.currentPage(i)}scrollDone(){this.store.actions.scrollTarget({})}async load(){var e;!((e=this.service)===null||e===void 0)&&e.mapId&&this.store.getState().map==null&&await this.loadDebouncer.run(()=>this.fetchData())}clear(){var e;this._loaded=!1,this.store.actions.configuration(void 0),this.store.actions.map(void 0),this.store.actions.toc(void 0),this.store.actions.pagesToc(void 0),this.store.actions.currentPage(void 0),this.store.actions.searchInDocumentQuery(""),this.store.actions.relatives(void 0),this.store.actions.renderedTopics([]),this.store.actions.visibleTopics([]),this.store.actions.translation({sourceLanguage:void 0,destinationLanguage:void 0,profileId:void 0,isLoading:!1,isError:!1}),this.store.actions.mapRating(void 0),(e=this.service)===null||e===void 0||e.clear(),this.clusteringHelper=void 0}reload(){return this.clear(),this.load()}clearFromFilter(){this._loaded=!1,this.store.actions.toc(void 0),this.store.actions.pagesToc(void 0)}async reloadFromFilter(e,r){var i,n,s;this.clearFromFilter();let{scrollTarget:o,visibleTopics:a,currentPage:l}=this.store.getState(),c=(s=(n=(i=o?.tocId)!==null&&i!==void 0?i:a?.[0])!==null&&n!==void 0?n:l?.rootTocId)!==null&&s!==void 0?s:"root";await this.fetchDataFromFilter(),this.navigateToTopic(c,e,r)}async fetchDataFromFilter(){var e,r,i,n;let s=this.getTranslationSettings();try{await Promise.all([(e=this.service)===null||e===void 0?void 0:e.getToc(s).then(o=>this.store.actions.toc(o)),(r=this.service)===null||r===void 0?void 0:r.getPagesToc(s).then(o=>this.store.actions.pagesToc(o)),(i=this.service)===null||i===void 0?void 0:i.getFilteredTocNodes(s).then(o=>this.store.actions.filteredTocNodes(o))]),this._loaded=!0}catch(o){if(!(o instanceof ae.CanceledPromiseError))throw s&&this.setTranslationError(!0),(n=this.errorHandler)===null||n===void 0||n.call(this,o),o}}async fetchData(){var e,r,i,n,s,o,a;let l=this.getTranslationSettings();try{l&&this.setTranslationLoading(!0),await Promise.all([this.loadConfiguration(),(e=this.service)===null||e===void 0?void 0:e.getMap(l).then(c=>this.store.actions.map(c)),(r=this.service)===null||r===void 0?void 0:r.getToc(l).then(c=>this.store.actions.toc(c)),(i=this.service)===null||i===void 0?void 0:i.getPagesToc(l).then(c=>this.store.actions.pagesToc(c)),(n=this.service)===null||n===void 0?void 0:n.getPaginationConfiguration().then(c=>this.store.actions.paginationConfiguration(c)),(s=this.service)===null||s===void 0?void 0:s.getFilteredTocNodes(l).then(c=>this.store.actions.filteredTocNodes(c)),(o=this.service)===null||o===void 0?void 0:o.getTranslationError(l).then(c=>this.setTranslationError(c))]),this.metadataForSwitchToRelatives.size>0&&this.fetchRelatives(),this._loaded=!0,l&&this.setTranslationLoading(!1)}catch(c){if(!(c instanceof ae.CanceledPromiseError))throw l&&this.setTranslationError(!0),(a=this.errorHandler)===null||a===void 0||a.call(this,c),c}}loadConfiguration(){var e;return(e=this.service)===null||e===void 0?void 0:e.getConfiguration().then(r=>this.store.actions.configuration(r))}reloadConfiguration(){var e;return(e=this.service)===null||e===void 0||e.clearConfiguration(),this.loadConfiguration()}async fetchRelatives(){var e,r;let i=(e=this.store.getState().map)===null||e===void 0?void 0:e.metadata.filter(n=>{var s;return n.key==((s=this.store.getState().configuration)===null||s===void 0?void 0:s.relativePivotMetadata)}).flatMap(n=>n.values);if(i!==void 0&&i.length>0){let n=await((r=this.service)===null||r===void 0?void 0:r.getRelativesForDocument(this.store.getState().configuration.relativePivotMetadata,i)),s=n?.results.flatMap(o=>o.entries);this.store.actions.relatives(s)}this.updateClusteringHelper()}updateClusteringHelper(){this.clusteringHelper=this.createClusteringHelper(),this.clusteringHelper&&this.store.dispatchEvent(new Event(Ze.clusteringHelperCreated))}createClusteringHelper(){var e,r;if(this.clusteringHelperProvider)return this.clusteringHelperProvider();let i=this.store.getState().relatives;if(i){let n=i.find(o=>{var a;return((a=o.map)===null||a===void 0?void 0:a.mapId)==this.store.getState().mapId}),s=(r=(e=y.getState().metadataConfiguration)===null||e===void 0?void 0:e.descriptors)!==null&&r!==void 0?r:[];return new ae.ClusteringHelper(i,n,this.metadataForSwitchToRelatives,s)}}async navigateToRelativeTopicIfFound(e){var r,i,n;await this.loaded();let s=await(0,ae.waitFor)(()=>{var c;return(c=this.store.getState().configuration)===null||c===void 0?void 0:c.relativeTopicPivotMetadata}),o=this.store.getState().mapId,l=await(await this.awaitService()).getRelativesForTopicInMap(o,s,[e]);if(!((n=(i=(r=l?.results)===null||r===void 0?void 0:r[0])===null||i===void 0?void 0:i.entries)===null||n===void 0)&&n[0]){let c=l.results[0].entries[0].topic.tocId;return await this.navigateToTopic(c),!0}else return await this.navigateToTopic("root"),!1}setSearchInDocumentQuery(e){this.store.actions.searchInDocumentQuery(e)}async setTranslationDestinationLanguage(e){this.store.actions.setTranslationDestinationLanguage(e),e&&this.sendDocumentOnDemandTranslateEvent(e),await this.loadDebouncer.run(()=>this.fetchData())}async setTranslationSourceLanguage(e){this.store.actions.setTranslationSourceLanguage(e),await this.loadDebouncer.run(()=>this.fetchData())}async setTranslationProfileId(e){this.store.actions.setTranslationProfileId(e)}async setTranslationLoading(e){this.store.actions.setTranslationLoading(e)}async setTranslationError(e){this.store.actions.setTranslationError(e)}getTranslationSettings(){var e;let r=this.store.getState();return r.translation.profileId&&r.translation.destinationLanguage?{profileId:r.translation.profileId,destinationLanguage:r.translation.destinationLanguage.code,sourceLanguage:(e=r.map)===null||e===void 0?void 0:e.lang}:void 0}setLinkPreviewDialogId(e){this.store.actions.linkPreviewDialogId(e)}async fetchMapRating(){var e;this.store.actions.mapRating(await((e=this.service)===null||e===void 0?void 0:e.getMapRating()))}async fetchTopicRating(e){var r;let i=await((r=this.service)===null||r===void 0?void 0:r.getTopicRating(e));i&&this.store.actions.setTopicsRating({[e]:i})}registerMetadataForSwitchToRelatives(e){this.metadataForSwitchToRelatives.add(e),this.store.getState().relatives==null?this.fetchRelatives():this.updateClusteringHelper()}unregisterMetadataForSwitchToRelatives(e){this.metadataForSwitchToRelatives.delete(e),this.updateClusteringHelper()}async getAccurateNavigationData(e,r,i){return await this.awaitService(),this.service.getAccurateNavigationData(e,r?.number,i?.section,this.getTranslationSettings())}buildBreadcrumb(e){var r;return(r=this.service)===null||r===void 0?void 0:r.buildBreadcrumb(e,this.getTranslationSettings())}fetchTopicContent(e){var r,i;let n=this.getTranslationSettings();return n?(this.sendTopicAiTranslateEvent(n.destinationLanguage,e),(r=this.service)===null||r===void 0?void 0:r.getTranslatedTopicContent(e,n).then(s=>(s.isTranslationError&&this.setTranslationError(!0),s.content))):(i=this.service)===null||i===void 0?void 0:i.getTopicContent(e)}getTocNode(e){return this.service.getTocNode(e,this.getTranslationSettings())}getPage(e){return this.service.getPage(e,this.getTranslationSettings())}onMapAttachmentsUpdate(){var e;(e=this.service)===null||e===void 0||e.clearMapAttachments(),this.store.dispatchEvent(new Event(Ze.mapAttachmentsUpdate))}async getRelativeDocumentUrlForLocale(e){var r,i,n;this.store.getState().relatives==null&&await this.fetchRelatives();let s=ae.ClusteringHelper.findResultWithMetadataValue((n=this.store.getState().relatives)!==null&&n!==void 0?n:[],"ft:locale",e),o=(0,ae.accessResultUrl)(s);if(o){let a=this.store.getState().visibleTopics[0],l=(r=this.store.getState().configuration)===null||r===void 0?void 0:r.relativeTopicPivotMetadata;if(l&&a){let c=await((i=this.service)===null||i===void 0?void 0:i.getTopicMetadataValue(a,l));o=Nn(o,c)}}return o}sendDocumentOnDemandTranslateEvent(e){var r;let{editorMode:i,apiIntegrationIdentifier:n,apiIntegrationAppVersion:s}=y.getState(),o=this.store.getState(),a=o.map,l=o.translation.profileId;if(!(i||!a||!n||!s||!l))try{let u={...this.analyticsEventsService.convertMapToAnalyticsDocument(a),title:(r=a.untranslatedTitle)!==null&&r!==void 0?r:a.title};this.analyticsEventsService.sendDocumentOnDemandTranslateEvent({name:"DOCUMENT__ON_DEMAND_TRANSLATE",offline:!1,appName:n,appVersion:s,sourceLanguage:this.parseLanguageToAnalyticsFormat(a.lang),destinationLanguage:this.parseLanguageToAnalyticsFormat(e.code),profileId:l,document:u,translationOrigin:en.AI})}catch(c){console.warn("Failed to send on-demand document translate event:",c)}}sendTopicAiTranslateEvent(e,r){var i;let{editorMode:n,apiIntegrationIdentifier:s,apiIntegrationAppVersion:o}=y.getState(),a=this.store.getState(),l=a.map,c=a.translation.profileId;if(!(n||!l||!s||!o||!c))try{let u=this.buildBreadcrumb(r.tocId);if(!u){console.warn("Failed to build breadcrumb for topic ai translate event");return}let p={...this.analyticsEventsService.convertMapToAnalyticsDocument(l),title:(i=l.untranslatedTitle)!==null&&i!==void 0?i:l.title};this.analyticsEventsService.sendTopicAiTranslateEvent({name:"TOPIC__AI_TRANSLATE",offline:!1,appName:s,appVersion:o,sourceLanguage:this.parseLanguageToAnalyticsFormat(l.lang),destinationLanguage:this.parseLanguageToAnalyticsFormat(e),breadcrumb:u.map(m=>{var x;return{tocId:m.tocId,title:(x=m.untranslatedTitle)!==null&&x!==void 0?x:m.title}}),document:p,profileId:c})}catch(u){console.warn("Failed to send topic ai translate event:",u)}}parseLanguageToAnalyticsFormat(e){if(!e)return;let r=e.split("-");return r.length===2?{languageCode:r[0],countryCode:r[1]}:{languageCode:r[0],countryCode:""}}};var kn=class extends CustomEvent{constructor(e,r){super("ft-reader-map-loaded",{detail:{map:e,toc:r}})}},Fn=class extends CustomEvent{constructor(e,r){super("ft-reader-visible-topics-change",{detail:{visibleTopics:r}})}},Un=class extends CustomEvent{constructor(e){super("ft-reader-navigation-done",{detail:e})}},$n=class extends CustomEvent{constructor(e){super("ft-reader-load-error",{detail:e})}},Bn=class extends Event{constructor(){super("ft-reader-map-not-found")}},Hn=class extends Event{constructor(){super("ft-reader-map-unauthorized")}},Vn=class extends Event{constructor(){super("ft-reader-map-forbidden")}},jn=class extends Event{constructor(){super("ft-reader-topic-relative-not-found",{bubbles:!0,composed:!0})}};var Du=h(I());var ku=Du.css`
|
|
920
|
+
`;var ai=h(I()),at=h(W()),Y=h(b());var ae=h(b());var Pu=h(b()),jp={setTranslationDestinationLanguage:(t,e)=>{t.translation.destinationLanguage=e.payload},setTranslationSourceLanguage:(t,e)=>{t.translation.sourceLanguage=e.payload},setTranslationProfileId:(t,e)=>{t.translation.profileId=e.payload},setTranslationLoading:(t,e)=>{t.translation.isLoading=e.payload},setTranslationError:(t,e)=>{t.translation.isError=e.payload},setTopicsRating:(t,e)=>{for(let r in e.payload)t.topicsRating[r]=e.payload[r]}},Nu=t=>Pu.FtReduxStore.get({name:"ft-reader-"+t,initialState:{mapId:void 0,renderedTopics:[],visibleTopics:[],map:void 0,toc:void 0,pagesToc:void 0,filteredTocNodes:{},paginationConfiguration:void 0,currentPage:void 0,scrollTarget:void 0,configuration:void 0,searchInDocumentQuery:void 0,relatives:void 0,mapRating:void 0,topicsRating:{},translation:{sourceLanguage:void 0,destinationLanguage:void 0,profileId:void 0,isLoading:!1,isError:!1},linkPreviewDialogId:void 0,metadataFilters:[]},reducers:jp});var oo=class{constructor(e,r){this.mapId=e,this.paginatedToc=r,this.nodeByTocId={},this.nodeByUrl={},this.duplicatedPrettyUrls=new Set,this.pages=[],this.pageByTocId={}}build(){return{paginationConfiguration:this.paginatedToc.configuration,toc:this.convertNodes(this.paginatedToc.paginatedToc,1),pagesToc:this.extractPagesToc(this.paginatedToc.paginatedToc,1),nodeByTocId:this.nodeByTocId,nodeByUrl:this.nodeByUrl,duplicatedPrettyUrls:this.duplicatedPrettyUrls,pages:this.pages,pageByTocId:this.pageByTocId,translationError:this.paginatedToc.translationError,filteredTocNodes:this.paginatedToc.filteredTocNodes}}extractPagesToc(e,r,i){return e.flatMap(n=>{var s;return n.pageConfiguration&&this.registerPage(this.buildPage(n,i)),n.tocId==null?this.extractPagesToc(n.children,r,i):[{tocId:n.tocId,title:(s=n.title)!==null&&s!==void 0?s:"",contentTag:n.contentTag,contentClass:n.contentClass,untranslatedTitle:n.untranslatedTitle,depth:r,children:this.extractPagesToc(n.children,r+1,n.tocId)}]})}convertNodes(e,r,i){return e.flatMap(n=>{var s,o,a;if(n.tocId==null)return[...this.convertSectionNodes((o=n.pageToc)!==null&&o!==void 0?o:[],r,n.tocId),...this.convertNodes(n.children,r,n.tocId)];let l=(s=n.prettyUrl)===null||s===void 0?void 0:s.replace(/^\//,""),c={tocId:n.tocId,contentId:n.contentId,title:n.title,contentTag:n.contentTag,contentClass:n.contentClass,untranslatedTitle:n.untranslatedTitle,hasRating:n.hasRating,origin:n.origin,prettyUrl:l,depth:r,parentTocId:i,children:[]};this.register(c);let u=this.convertSectionNodes((a=n.pageToc)!==null&&a!==void 0?a:[],r+1,n.tocId),d=this.convertNodes(n.children,r+1,c.tocId);return c.children=[...u,...d],[c]})}convertSectionNodes(e,r,i){return e.flatMap(n=>{var s;let o=(s=n.prettyUrl)===null||s===void 0?void 0:s.replace(/^\//,""),a={...n,prettyUrl:o,depth:r,parentTocId:i,children:[]};return this.register(a),a.children=this.convertSectionNodes(n.children,r+1,n.tocId),[a]})}buildPage(e,r){var i,n,s,o,a,l,c,u;let d=(o=e.tocId)!==null&&o!==void 0?o:(n=(i=e.pageToc)===null||i===void 0?void 0:i[0])===null||n===void 0?void 0:n.tocId,p={number:this.pages.length+1,title:(a=e.title)!==null&&a!==void 0?a:"",untranslatedTitle:e.untranslatedTitle,rootTocId:d??"root",toc:((l=e.pageToc)!==null&&l!==void 0?l:[]).map(v=>this.nodeByTocId[v.tocId]),topics:[],hiddenTopics:[],rootDepth:d?this.nodeByTocId[d].depth:1,breadcrumb:r?this.buildBreadcrumb(this.nodeByTocId[r]):[]},m=(v,T)=>(T?p.topics:p.hiddenTopics).push(v),x=(c=(s=e.pageConfiguration)===null||s===void 0?void 0:s.parentsVisibility)!==null&&c!==void 0?c:[];p.breadcrumb.forEach((v,T)=>{m(v,x[T])}),e.tocId&&m(e.tocId,e.pageConfiguration.isVisible),p.topics.push(...this.tocIds((u=e.pageToc)!==null&&u!==void 0?u:[]));let A=this.resolveOverridenRootTocIdByParentForcedByPagination(p.breadcrumb,x);return p.rootTocId=A??p.rootTocId,p.rootDepth=A?this.nodeByTocId[A].depth:p.rootDepth,p}resolveOverridenRootTocIdByParentForcedByPagination(e,r){for(let i=0;i<e.length;i++)if(r[i])return e[i]}registerPage(e){for(let r of[...e.topics,...e.hiddenTopics])this.pageByTocId[r]||(this.pageByTocId[r]=e);this.pages.push(e)}tocIds(e){return e.flatMap(r=>[r.tocId,...this.tocIds(r.children)])}buildBreadcrumb(e){let r=[e.tocId];for(;e?.parentTocId;)r.unshift(e.parentTocId),e=this.nodeByTocId[e.parentTocId];return r}register(e){e.prettyUrl&&(this.nodeByUrl[e.prettyUrl]==null?this.nodeByUrl[e.prettyUrl]=e:this.duplicatedPrettyUrls.add(e.prettyUrl)),this.nodeByUrl[`${this.mapId}/${e.tocId}`]=e,this.nodeByTocId[e.tocId]=e}},In=class{convertPaginatedToc(e,r){return new oo(e,r).build()}};var Ln=h(b()),Mn=class extends ee{get metadataFilters(){return this._metadataFilters}set metadataFilters(e){this._metadataFilters=e}get mapId(){return this._mapId}set mapId(e){e!==this._mapId&&this.clear(),this._mapId=e}constructor(e,r,i,n){super(!1,r),this.converter=e,this._mapId=i,this._metadataFilters=n,this.initCache()}async withMapId(e){return this._mapId?e(this._mapId):void 0}initCache(){this.cache.register("configuration",()=>this.api.getReaderConfiguration()),this.cache.register("map",()=>this.withMapId(e=>this.fetchMap(e))),this.cache.register(this.makeCacheKey("enrichedToc",void 0,this.metadataFilters),()=>this.withMapId(e=>this.fetchPages(e,this._metadataFilters).then(r=>this.converter.convertPaginatedToc(e,r)))),this.cache.register("ratingSummary",()=>{var e,r;return Pe((r=(e=y.getState().session)===null||e===void 0?void 0:e.profile.roles)!==null&&r!==void 0?r:[],"RATING_USER")?this.withMapId(n=>this.fetchMapRating(n)):Promise.resolve()})}clear(){this.cache.clearMatching(e=>e!=="configuration")}makeCacheKey(e,r,i){return e+(r?"-destinationLanguage-"+r?.destinationLanguage:"")+(!i||i.length==0?"":"-metadataFilters-"+this.hash(i))}getMap(e){return this.cache.get(this.makeCacheKey("map",e),()=>this.fetchMap(this.mapId,e))}getMapNow(e){return this.cache.getNow(this.makeCacheKey("map",e))}getConfiguration(){return this.cache.get("configuration")}clearConfiguration(){this.cache.clear("configuration")}getEnrichedToc(e){return this.cache.get(this.makeCacheKey("enrichedToc",e,this.metadataFilters),()=>this.fetchPages(this.mapId,this.metadataFilters,e).then(r=>this.converter.convertPaginatedToc(this.mapId,r)))}getEnrichedTocNow(e){return this.cache.getNow(this.makeCacheKey("enrichedToc",e,this.metadataFilters))}async getPaginationConfiguration(){return(await this.getEnrichedToc()).paginationConfiguration}async getToc(e){return(await this.getEnrichedToc(e)).toc}async getPagesToc(e){return(await this.getEnrichedToc(e)).pagesToc}async getTranslationError(e){return(await this.getEnrichedToc(e)).translationError}async getFilteredTocNodes(e){var r;return(r=(await this.getEnrichedToc(e)).filteredTocNodes)!==null&&r!==void 0?r:{}}async getTocNode(e,r){return(await this.getEnrichedToc(r)).nodeByTocId[e]}getTocNodeNow(e,r){var i;return(i=this.getEnrichedTocNow(r))===null||i===void 0?void 0:i.nodeByTocId[e]}getTocNodeNowByUrl(e,r){var i,n;let s=this.getMapNow(r);return s?.prettyUrl==e||`${s?.id}/root`===e?(i=this.getEnrichedTocNow(r))===null||i===void 0?void 0:i.toc[0]:(n=this.getEnrichedTocNow(r))===null||n===void 0?void 0:n.nodeByUrl[e]}async getPage(e,r){let i=await this.getEnrichedToc(r);return i.pages[e-1]||i.pages[0]}async getPageByTocId(e,r){let i=await this.getEnrichedToc(r);return i.pageByTocId[e]||i.pages[0]}getTopicInfo(e){return this.cache.get("topic-"+e.tocId,()=>this.fetchTopicMetadata(e))}getTopicContent(e){return this.cache.get("topic-content-"+e.tocId,()=>this.fetchTopicHTMLContent(e))}getTranslatedTopicContent(e,r){return this.cache.get(this.makeCacheKey("translated-topic-content-"+e.tocId,r),()=>this.fetchTranslatedTopicHTMLContent(e,r))}async getTopicMetadataValue(e,r){let i=this.getTocNodeNow(e);if(!i)return;let n=await this.getTopicInfo(i);return n?.metadata.find(s=>s.key==r)}getAttachments(){return this.cache.get("map-attachments",()=>this.fetchAttachments())}clearMapAttachments(){this.cache.clear("map-attachments")}getRelativesForDocument(e,r){return this.cache.get("document-relatives-"+e+"-"+r.join("-"),()=>this.fetchRelativesForDocument(e,r))}getRelativesForTopicInMap(e,r,i){return this.cache.get("topic-relatives-"+[e,r,...i].join("-"),()=>this.fetchRelativesForTopicInMap(e,r,i))}getAttachmentDownloadLink(e){return this.makeAbsolute(`${this.api.endpoints.khub.maps.mapId(this.mapId).attachments.attachmentId(e).content}?download=true&locationValue=reader`)}getLink(e,r,i,n){let s=this.getNavigationData(e,r,i),o=this.getReaderLinkPrefix()+(s.prettyUrl?s.prettyUrl:`${s.mapId}/${s.tocId}`),a=new URL(o,this.api.tenantBaseUrl);if(s.page!=null&&a.searchParams.set("page",`${s.page}`),s.prettyUrlDuplicated&&a.searchParams.set("tocId",s.tocId),s.section!=null&&a.searchParams.set("section",s.section),n&&s.metadataFilters){let l=Ln.SearchPlaceConverter.serializeValueFilters(s.metadataFilters);l&&a.searchParams.set(Ln.SearchPlaceQueryParams.VALUE_FILTERS,l)}return a.href}getLinkWithFilter(e,r,i){return this.getLink(e,r,i,!0)}getNavigationData(e,r,i,n){var s,o;e=e||"root";let a=this.getEnrichedTocNow(n),l=a?.pageByTocId[e],c=a?.nodeByTocId[e],u=c?.prettyUrl;return{mapId:this.mapId,tocId:e,topicTitle:(s=c?.title)!==null&&s!==void 0?s:"",untranslatedTopicTitle:c?.untranslatedTitle,page:r&&l&&l.number!==r?r:void 0,prettyUrl:u?.replace(/^r\//,""),prettyUrlDuplicated:(o=a?.duplicatedPrettyUrls.has(u??""))!==null&&o!==void 0?o:!1,section:i,metadataFilters:this.metadataFilters}}async getAccurateNavigationData(e,r,i,n){return await this.getEnrichedToc(n),this.getNavigationData(e,r,i,n)}getRatingSummary(){return this.cache.get("ratingSummary")}reloadRating(){return this.cache.clear("ratingSummary"),this.getRatingSummary()}getMapRating(){return this.getRatingSummary().then(e=>e?.publication)}getTopicRating(e){return this.getRatingSummary().then(r=>{var i;return r?{type:r.topics.type,rating:(i=r.topics)===null||i===void 0?void 0:i.ratings.find(n=>n.tocId===e)}:void 0})}rateMap(e,r){return this.makeRateMapRequest(e,r).then(()=>this.clearRatingIfNecessary())}unrateMap(){return this.makeUnrateMapRequest().then(()=>this.clearRatingIfNecessary())}sendMapFeedback(e,r){return this.makeMapFeedbackRequest(e,r)}rateTopic(e,r,i){return this.makeRateTopicRequest(e,r,i).then(()=>this.clearRatingIfNecessary())}unrateTopic(e){return this.makeUnrateTopicRequest(e).then(()=>this.clearRatingIfNecessary())}async clearRatingIfNecessary(){let e=y.getState().session;e?.sessionAuthenticated&&this.cache.clear("ratingSummary")}sendTopicFeedback(e,r,i){return this.makeTopicFeedbackRequest(e,r,i)}fontsStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.fonts)}themeStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.theme)}buildBreadcrumb(e,r){let i=this.getTocNodeNow(e,r);if(!i)return[];let n=[{tocId:i.tocId,title:i.title,untranslatedTitle:i.untranslatedTitle}],s=this.getTocNodeNow(i.parentTocId,r);for(;s;)n.unshift({tocId:s.tocId,title:s.title,untranslatedTitle:s.untranslatedTitle}),s=this.getTocNodeNow(s.parentTocId,r);return n}isFeatureAccessible(e,{session:r}){var i;if(!this.isFeatureAvailable(e))return!1;switch(e){case et.FEEDBACK:return Pe(r??[],P.FEEDBACK_USER);case et.RATING:return Pe(r??[],P.RATING_USER);case et.PRINT:return Pe(r??[],P.PRINT_USER);case et.BOOKMARK:return!!r?.sessionAuthenticated;case et.COLLECTIONS:return Pe(r??[],P.COLLECTION_USER);case et.PERSONAL_BOOKS:return Pe(r??[],P.PERSONAL_BOOK_USER)&&!(!((i=this.getMapNow())===null||i===void 0)&&i.pbkConfidential);default:return!1}}makeAbsolute(e){return this.api.makeAbsolute(e)}};var Pn=class t extends Mn{static async build(e){return new t(new In,void 0,e)}clear(){super.clear(),this.fingerprint=void 0}async fetchMap(e,r){let i=await this.api.getMap(e,r);return this.fingerprint=i.fingerprint,i}fetchMapRating(e){return this.api.getMapRating(e)}async fetchPages(e,r,i){return await this.getMap(i),r?.length?this.api.getFilteredPages(e,i,r):this.api.getPages(e,this.fingerprint,i)}fetchTopicHTMLContent(e){return this.api.getTopicHTMLContent(this.mapId,e.contentId,"DESIGNED_READER",this.fingerprint)}fetchTranslatedTopicHTMLContent(e,r){return this.api.getTranslatedTopicHTMLContent(this.mapId,e.contentId,"DESIGNED_READER",this.fingerprint,r)}fetchTopicMetadata(e){return this.api.getTopic(this.mapId,e.contentId,this.fingerprint)}fetchAttachments(){return this.api.getMapAttachments(this.mapId).catch(()=>[])}fetchRelativesForDocument(e,r){let i={query:"",paging:{page:1,perPage:-1},scope:"DOCUMENTS",metadataFilters:[{key:e,valueFilter:{negative:!1,values:r}}],sort:[],facets:[]};return this.api.search(i)}fetchRelativesForTopicInMap(e,r,i){let n={query:"",paging:{page:1,perPage:1},scope:"ALL_TOPICS",metadataFilters:[{key:r,valueFilter:{negative:!1,values:i}},{key:"ft:publicationId",valueFilter:{negative:!1,values:[e]}}],sort:[],facets:[]};return this.api.search(n)}makeMapFeedbackRequest(e,r){return this.api.sendMapFeedback(this.mapId,e,r)}makeRateMapRequest(e,r){return this.api.rateMap(this.mapId,e,r)}makeRateTopicRequest(e,r,i){return this.api.rateTopic(this.mapId,e,r,i)}makeTopicFeedbackRequest(e,r,i){return this.api.sendTopicFeedback(this.mapId,e,r,i)}makeUnrateMapRequest(){return this.api.unrateMap(this.mapId)}makeUnrateTopicRequest(e){return this.api.unrateTopic(this.mapId,e)}getReaderLinkPrefix(){return"r/"}isFeatureAvailable(e){return!0}};var zp="topicPivot";function Nn(t,e){let r=new URL(t);return e?.values.forEach(i=>{r.searchParams.append(zp,i)}),r.href}var Dn=class t{static build(e,r){return new t(Nu(e.trim()||"context"),r??Pn.build)}loaded(){return(0,ae.waitUntil)(()=>this._loaded)}constructor(e,r,i,n){this.store=e,this.clusteringHelperProvider=i,this.metadataForSwitchToRelatives=new Set,this._loaded=!1,this.loadDebouncer=new ae.Debouncer(10),this.analyticsEventsService=n??new cr,this.initService(r)}async initService(e){this.service=await e();let{mapId:r,metadataFilters:i}=this.store.getState();return this.service.mapId=r,this.service.metadataFilters=i,this.reload()}async setMapId(e){e!==this.store.getState().mapId&&(this.store.actions.mapId(e),this.service&&(this.service.mapId=e),await this.reload())}setRenderedTopics(e){this.store.actions.renderedTopics(e)}setVisibleTopics(e){this.store.actions.visibleTopics(e)}async setFilters(e){(0,ae.deepEqual)(e,this.store.getState().metadataFilters)||(this.store.actions.metadataFilters(e),this.service&&(this.service.metadataFilters=e))}async awaitService(){return(0,ae.waitFor)(()=>this.service)}async navigateToTopic(e,r,i){await this.loaded();let n=await this.resolvePage(e,i);this.store.actions.currentPage(n);let s=this.resolveValidNonRootTocId(e,n);this.store.actions.scrollTarget({tocId:s,section:r}),this.store.getState().visibleTopics[0]!==s&&this.store.actions.visibleTopics([]),e&&!r&&(this.store.commands.clear(/^focus-topic-/),this.store.commands.add({type:`focus-topic-${e}`}))}async resolvePage(e,r){var i,n,s;let o=await this.awaitService();if(r)return o.getPage(r,this.getTranslationSettings());if(!e)return o.getPageByTocId("root",this.getTranslationSettings());let a=(i=this.store.getState().filteredTocNodes)===null||i===void 0?void 0:i[e],l=((n=this.service)===null||n===void 0?void 0:n.getTocNodeNow(e))!=null;return a&&a.reason!=="ACCESS_RIGHTS_FILTER"&&!l?o.getPageByTocId((s=a.closestParent)!==null&&s!==void 0?s:"root",this.getTranslationSettings()):o.getPageByTocId(e,this.getTranslationSettings())}resolveValidNonRootTocId(e,r){var i,n,s,o,a;let l=(n=e==="root"?void 0:e)!==null&&n!==void 0?n:r.rootTocId;if(!r.topics.includes(l)){if(e!="root"&&!r.hiddenTopics.includes(l)){let c=this.store.getState().filteredTocNodes[l];if(c){this.store.dispatchEvent(new ci(c));let u=((i=this.service)===null||i===void 0?void 0:i.getTocNodeNow(c.tocId))!=null;return c.reason==="ACCESS_RIGHTS_FILTER"||u?c.tocId:(s=c.closestParent)!==null&&s!==void 0?s:"root"}this.store.dispatchEvent(new CustomEvent(Ze.requestedTopicNotFound))}return(a=(o=r.topics[0])!==null&&o!==void 0?o:r.hiddenTopics[0])!==null&&a!==void 0?a:"root"}return l}async navigateToPage(e){await this.loaded();let i=await(await this.awaitService()).getPage(e,this.getTranslationSettings());this.store.actions.currentPage(i)}scrollDone(){this.store.actions.scrollTarget({})}async load(){var e;!((e=this.service)===null||e===void 0)&&e.mapId&&this.store.getState().map==null&&await this.loadDebouncer.run(()=>this.fetchData())}clear(){var e;this._loaded=!1,this.store.actions.configuration(void 0),this.store.actions.map(void 0),this.store.actions.toc(void 0),this.store.actions.pagesToc(void 0),this.store.actions.currentPage(void 0),this.store.actions.searchInDocumentQuery(""),this.store.actions.relatives(void 0),this.store.actions.renderedTopics([]),this.store.actions.visibleTopics([]),this.store.actions.translation({sourceLanguage:void 0,destinationLanguage:void 0,profileId:void 0,isLoading:!1,isError:!1}),this.store.actions.mapRating(void 0),(e=this.service)===null||e===void 0||e.clear(),this.clusteringHelper=void 0}reload(){return this.clear(),this.load()}clearFromFilter(){this._loaded=!1,this.store.actions.toc(void 0),this.store.actions.pagesToc(void 0)}async reloadFromFilter(e,r){var i,n,s;this.clearFromFilter();let{scrollTarget:o,visibleTopics:a,currentPage:l}=this.store.getState(),c=(s=(n=(i=o?.tocId)!==null&&i!==void 0?i:a?.[0])!==null&&n!==void 0?n:l?.rootTocId)!==null&&s!==void 0?s:"root";await this.fetchDataFromFilter(),this.navigateToTopic(c,e,r)}async fetchDataFromFilter(){var e,r,i,n;let s=this.getTranslationSettings();try{await Promise.all([(e=this.service)===null||e===void 0?void 0:e.getToc(s).then(o=>this.store.actions.toc(o)),(r=this.service)===null||r===void 0?void 0:r.getPagesToc(s).then(o=>this.store.actions.pagesToc(o)),(i=this.service)===null||i===void 0?void 0:i.getFilteredTocNodes(s).then(o=>this.store.actions.filteredTocNodes(o))]),this._loaded=!0}catch(o){if(!(o instanceof ae.CanceledPromiseError))throw s&&this.setTranslationError(!0),(n=this.errorHandler)===null||n===void 0||n.call(this,o),o}}async fetchData(){var e,r,i,n,s,o,a;let l=this.getTranslationSettings();try{l&&this.setTranslationLoading(!0),await Promise.all([this.loadConfiguration(),(e=this.service)===null||e===void 0?void 0:e.getMap(l).then(c=>this.store.actions.map(c)),(r=this.service)===null||r===void 0?void 0:r.getToc(l).then(c=>this.store.actions.toc(c)),(i=this.service)===null||i===void 0?void 0:i.getPagesToc(l).then(c=>this.store.actions.pagesToc(c)),(n=this.service)===null||n===void 0?void 0:n.getPaginationConfiguration().then(c=>this.store.actions.paginationConfiguration(c)),(s=this.service)===null||s===void 0?void 0:s.getFilteredTocNodes(l).then(c=>this.store.actions.filteredTocNodes(c)),(o=this.service)===null||o===void 0?void 0:o.getTranslationError(l).then(c=>this.setTranslationError(c))]),this.metadataForSwitchToRelatives.size>0&&this.fetchRelatives(),this._loaded=!0,l&&this.setTranslationLoading(!1)}catch(c){if(!(c instanceof ae.CanceledPromiseError))throw l&&this.setTranslationError(!0),(a=this.errorHandler)===null||a===void 0||a.call(this,c),c}}loadConfiguration(){var e;return(e=this.service)===null||e===void 0?void 0:e.getConfiguration().then(r=>this.store.actions.configuration(r))}reloadConfiguration(){var e;return(e=this.service)===null||e===void 0||e.clearConfiguration(),this.loadConfiguration()}async fetchRelatives(){var e,r;let i=(e=this.store.getState().map)===null||e===void 0?void 0:e.metadata.filter(n=>{var s;return n.key==((s=this.store.getState().configuration)===null||s===void 0?void 0:s.relativePivotMetadata)}).flatMap(n=>n.values);if(i!==void 0&&i.length>0){let n=await((r=this.service)===null||r===void 0?void 0:r.getRelativesForDocument(this.store.getState().configuration.relativePivotMetadata,i)),s=n?.results.flatMap(o=>o.entries);this.store.actions.relatives(s)}this.updateClusteringHelper()}updateClusteringHelper(){this.clusteringHelper=this.createClusteringHelper(),this.clusteringHelper&&this.store.dispatchEvent(new Event(Ze.clusteringHelperCreated))}createClusteringHelper(){var e,r;if(this.clusteringHelperProvider)return this.clusteringHelperProvider();let i=this.store.getState().relatives;if(i){let n=i.find(o=>{var a;return((a=o.map)===null||a===void 0?void 0:a.mapId)==this.store.getState().mapId}),s=(r=(e=y.getState().metadataConfiguration)===null||e===void 0?void 0:e.descriptors)!==null&&r!==void 0?r:[];return new ae.ClusteringHelper(i,n,this.metadataForSwitchToRelatives,s)}}async navigateToRelativeTopicIfFound(e){var r,i,n;await this.loaded();let s=await(0,ae.waitFor)(()=>{var c;return(c=this.store.getState().configuration)===null||c===void 0?void 0:c.relativeTopicPivotMetadata}),o=this.store.getState().mapId,l=await(await this.awaitService()).getRelativesForTopicInMap(o,s,[e]);if(!((n=(i=(r=l?.results)===null||r===void 0?void 0:r[0])===null||i===void 0?void 0:i.entries)===null||n===void 0)&&n[0]){let c=l.results[0].entries[0].topic.tocId;return await this.navigateToTopic(c),!0}else return await this.navigateToTopic("root"),!1}setSearchInDocumentQuery(e){this.store.actions.searchInDocumentQuery(e)}async setTranslationDestinationLanguage(e){this.store.actions.setTranslationDestinationLanguage(e),e&&this.sendDocumentOnDemandTranslateEvent(e),await this.loadDebouncer.run(()=>this.fetchData())}async setTranslationSourceLanguage(e){this.store.actions.setTranslationSourceLanguage(e),await this.loadDebouncer.run(()=>this.fetchData())}async setTranslationProfileId(e){this.store.actions.setTranslationProfileId(e)}async setTranslationLoading(e){this.store.actions.setTranslationLoading(e)}async setTranslationError(e){this.store.actions.setTranslationError(e)}getTranslationSettings(){var e;let r=this.store.getState();return r.translation.profileId&&r.translation.destinationLanguage?{profileId:r.translation.profileId,destinationLanguage:r.translation.destinationLanguage.code,sourceLanguage:(e=r.map)===null||e===void 0?void 0:e.lang}:void 0}setLinkPreviewDialogId(e){this.store.actions.linkPreviewDialogId(e)}async fetchMapRating(){var e;this.store.actions.mapRating(await((e=this.service)===null||e===void 0?void 0:e.getMapRating()))}async fetchTopicRating(e){var r;let i=await((r=this.service)===null||r===void 0?void 0:r.getTopicRating(e));i&&this.store.actions.setTopicsRating({[e]:i})}registerMetadataForSwitchToRelatives(e){this.metadataForSwitchToRelatives.add(e),this.store.getState().relatives==null?this.fetchRelatives():this.updateClusteringHelper()}unregisterMetadataForSwitchToRelatives(e){this.metadataForSwitchToRelatives.delete(e),this.updateClusteringHelper()}async getAccurateNavigationData(e,r,i){return await this.awaitService(),this.service.getAccurateNavigationData(e,r?.number,i?.section,this.getTranslationSettings())}buildBreadcrumb(e){var r;return(r=this.service)===null||r===void 0?void 0:r.buildBreadcrumb(e,this.getTranslationSettings())}fetchTopicContent(e){var r,i;let n=this.getTranslationSettings();return n?(this.sendTopicAiTranslateEvent(n.destinationLanguage,e),(r=this.service)===null||r===void 0?void 0:r.getTranslatedTopicContent(e,n).then(s=>(s.isTranslationError&&this.setTranslationError(!0),s.content))):(i=this.service)===null||i===void 0?void 0:i.getTopicContent(e)}getTocNode(e){return this.service.getTocNode(e,this.getTranslationSettings())}getPage(e){return this.service.getPage(e,this.getTranslationSettings())}onMapAttachmentsUpdate(){var e;(e=this.service)===null||e===void 0||e.clearMapAttachments(),this.store.dispatchEvent(new Event(Ze.mapAttachmentsUpdate))}async getRelativeDocumentUrlForLocale(e){var r,i,n;this.store.getState().relatives==null&&await this.fetchRelatives();let s=ae.ClusteringHelper.findResultWithMetadataValue((n=this.store.getState().relatives)!==null&&n!==void 0?n:[],"ft:locale",e),o=(0,ae.accessResultUrl)(s);if(o){let a=this.store.getState().visibleTopics[0],l=(r=this.store.getState().configuration)===null||r===void 0?void 0:r.relativeTopicPivotMetadata;if(l&&a){let c=await((i=this.service)===null||i===void 0?void 0:i.getTopicMetadataValue(a,l));o=Nn(o,c)}}return o}sendDocumentOnDemandTranslateEvent(e){var r;let{editorMode:i,apiIntegrationIdentifier:n,apiIntegrationAppVersion:s}=y.getState(),o=this.store.getState(),a=o.map,l=o.translation.profileId;if(!(i||!a||!n||!s||!l))try{let u={...this.analyticsEventsService.convertMapToAnalyticsDocument(a),title:(r=a.untranslatedTitle)!==null&&r!==void 0?r:a.title};this.analyticsEventsService.sendDocumentOnDemandTranslateEvent({name:"DOCUMENT__ON_DEMAND_TRANSLATE",offline:!1,appName:n,appVersion:s,sourceLanguage:this.parseLanguageToAnalyticsFormat(a.lang),destinationLanguage:this.parseLanguageToAnalyticsFormat(e.code),profileId:l,document:u,translationOrigin:en.AI})}catch(c){console.warn("Failed to send on-demand document translate event:",c)}}sendTopicAiTranslateEvent(e,r){var i;let{editorMode:n,apiIntegrationIdentifier:s,apiIntegrationAppVersion:o}=y.getState(),a=this.store.getState(),l=a.map,c=a.translation.profileId;if(!(n||!l||!s||!o||!c))try{let u=this.buildBreadcrumb(r.tocId);if(!u){console.warn("Failed to build breadcrumb for topic ai translate event");return}let p={...this.analyticsEventsService.convertMapToAnalyticsDocument(l),title:(i=l.untranslatedTitle)!==null&&i!==void 0?i:l.title};this.analyticsEventsService.sendTopicAiTranslateEvent({name:"TOPIC__AI_TRANSLATE",offline:!1,appName:s,appVersion:o,sourceLanguage:this.parseLanguageToAnalyticsFormat(l.lang),destinationLanguage:this.parseLanguageToAnalyticsFormat(e),breadcrumb:u.map(m=>{var x;return{tocId:m.tocId,title:(x=m.untranslatedTitle)!==null&&x!==void 0?x:m.title}}),document:p,profileId:c})}catch(u){console.warn("Failed to send topic ai translate event:",u)}}parseLanguageToAnalyticsFormat(e){if(!e)return;let r=e.split("-");return r.length===2?{languageCode:r[0],countryCode:r[1]}:{languageCode:r[0],countryCode:""}}};var kn=class extends CustomEvent{constructor(e,r){super("ft-reader-map-loaded",{detail:{map:e,toc:r}})}},Fn=class extends CustomEvent{constructor(e,r){super("ft-reader-visible-topics-change",{detail:{visibleTopics:r}})}},Un=class extends CustomEvent{constructor(e){super("ft-reader-navigation-done",{detail:e})}},$n=class extends CustomEvent{constructor(e){super("ft-reader-load-error",{detail:e})}},Bn=class extends Event{constructor(){super("ft-reader-map-not-found")}},Hn=class extends Event{constructor(){super("ft-reader-map-unauthorized")}},Vn=class extends Event{constructor(){super("ft-reader-map-forbidden")}},jn=class extends Event{constructor(){super("ft-reader-topic-relative-not-found",{bubbles:!0,composed:!0})}};var Du=h(I());var ku=Du.css`
|
|
921
921
|
`;var Hu=h(I()),Ue=h(W()),ye=h(b());var br=h(b()),oi=h(W());var ii;(function(t){t.CLUSTERED_SEARCH="CLUSTERED_SEARCH"})(ii||(ii={}));var j=h(b());var Fu=h(b()),qp={setRequest:(t,e)=>{t.request=e.payload}},Uu=t=>Fu.FtReduxStore.get({name:"ft-search-"+t,initialState:{request:{query:"",clusterSortCriterions:[],metadataFilters:[],facets:[],sort:[],sortId:void 0,paging:{page:1,perPage:20},keywordMatch:void 0},liveQuery:"",recentQueries:[],paging:void 0,facets:void 0,spellcheck:void 0,locales:[],results:void 0,announcements:void 0,suggestResults:void 0,configuration:void 0,propagatedFacets:[]},reducers:qp});var zn=class extends ee{constructor(e){super(!0,e),this.cache.registerFinal("search-configuration",async()=>(await this.awaitApi).getSearchConfiguration())}async launchSearch(e){let r={...e,metadataFilters:this.sortFilters(e.metadataFilters),facets:[...e.facets].sort((i,n)=>i.id.localeCompare(n.id))};return this.cache.get("search-"+this.hash(r),async()=>(await this.awaitApi).search(e),120*1e3)}async launchSuggest(e){let r={...e,metadataFilters:this.sortFilters(e.metadataFilters)};return this.cache.get("suggest-"+this.hash(r),async()=>(await this.awaitApi).getSuggestions(e),120*1e3)}async getAvailableSearchLocales(){return this.cache.get("available-locales",async()=>(await this.awaitApi).getAvailableSearchLocales())}async getConfiguration(){return this.cache.get("search-configuration")}sortFilters(e){return e.map(r=>r.valueFilter==null?r:{...r,valueFilter:{...r.valueFilter,values:[...r.valueFilter.values].sort((i,n)=>i.localeCompare(n))}}).sort((r,i)=>r.key.localeCompare(i.key))}};var qn=class extends CustomEvent{constructor(e){super("ft-search-load-error",{detail:e,composed:!0,bubbles:!0})}},Kn=class extends CustomEvent{constructor(e){super("ft-search-request-change",{detail:e,composed:!0,bubbles:!0})}},Wn=class extends CustomEvent{constructor(e,r,i){super("ft-search-results-change",{detail:{request:e,paging:r,spellcheck:i},composed:!0,bubbles:!0})}},ni=class t extends Event{constructor(){super(t.eventName)}};ni.eventName="search-context-clear-all-filters";var Kp=t=>t.request.virtualField===nr.TITLE_ONLY&&t.request.scope===sr.DOCUMENTS,Wp=t=>t.request.keywordMatch==tn.MANDATORY,si=class t extends j.FtStateManager{static build(e,r){return new t(Uu(e.trim()||"context"),r)}constructor(e,r){super(),this.store=e,this.ignoreEmptyQuery=!1,this.canUpdateUiLocale=!1,this.openExternalDocumentInNewTab=!1,this.applyStickyFilters=!1,this.history=new j.QueryHistoryStorage(this.store.actions.recentQueries),this.onNewNeededRequest=i=>{i==ii.CLUSTERED_SEARCH&&this.launchSearch()},this.onStorageEvent=i=>{i.key===this.taruqaConfigStorageKey&&this.loadTaruqaTemplate()},this.loadTaruqaTemplate=()=>{var i;let n;if(Pe(y.getState().session,P.DEBUG_USER)){let s=JSON.parse((i=window.localStorage.getItem(this.taruqaConfigStorageKey))!==null&&i!==void 0?i:"{}");n=s.overrideEnabled?s.template:void 0}this.updateSearchRequest({taruqaTemplateOverride:n,changedByConfiguration:!0})},this.localesDebouncer=new j.Debouncer(10),this.searchDebouncer=new j.Debouncer(100),this.launchSearch=i=>this.searchDebouncer.run(()=>this.fetchSearchData(i??this.buildSearchRequest())),this.buildSearchRequest=(i=this.store.getState())=>{var n;return{...i.request,facets:this.facetIds.map(s=>({id:s})),stickyFiltersId:this.applyStickyFilters?(n=y.getState().stickyFilters)===null||n===void 0?void 0:n.id:void 0}},this.suggestDebouncer=new j.Debouncer(1e3),this.launchSuggest=i=>this.suggestDebouncer.run(()=>this.fetchSuggestData(i??this.buildSuggestRequest())),this.buildSuggestRequest=(i=this.store.getState())=>{var n,s;return{input:i.liveQuery,metadataFilters:i.request.metadataFilters,sort:(s=i.request.sort)!==null&&s!==void 0?s:[],sortId:i.request.sortId,contentLocale:i.request.contentLocale,scope:i.request.scope,keywordMatch:i.request.keywordMatch,stickyFiltersId:this.applyStickyFilters?(n=y.getState().stickyFilters)===null||n===void 0?void 0:n.id:void 0}},this.service=r??new zn,this.service.cache.addEventListener("clear-cache",i=>{i.detail.clearedKeys.includes("available-locales")&&this.updateLocales()}),this.searchWatcher=new j.ReduxWatcher(e,this.buildSearchRequest,this.launchSearch),this.suggestWatcher=new j.ReduxWatcher(e,this.buildSuggestRequest,this.launchSuggest),this.stickyFiltersIdWatcher=new j.ReduxWatcher(y,i=>{var n;return(n=i.stickyFilters)===null||n===void 0?void 0:n.id},()=>{this.applyStickyFilters&&(this.launchSearch(),this.launchSuggest())})}async initService(){return this.updateLocales(),this.service.getConfiguration().then(e=>{this.store.actions.configuration(e),this.setSortId(this.store.getState().request.sortId)}),this.loadTaruqaTemplate(),this.launchSearch()}addListeners(){window.addEventListener("storage",this.onStorageEvent),y.addEventListener(Ce.eventName,this.loadTaruqaTemplate),this.searchWatcher.watch(),this.suggestWatcher.watch(),this.stickyFiltersIdWatcher.watch(),this.history.enable(y.getState().tenantId+"-ft-recent-queries")}removeListeners(){window.removeEventListener("storage",this.onStorageEvent),y.removeEventListener(Ce.eventName,this.loadTaruqaTemplate),this.searchWatcher.stop(),this.suggestWatcher.stop(),this.stickyFiltersIdWatcher.stop(),this.history.disable()}get taruqaConfigStorageKey(){return y.getState().tenantId+"-taruqa-experiment-conf"}updateSearchRequest(e,r=!1){let i=(0,j.deepCopy)(this.store.getState().request);delete i.changedByConfiguration,this.store.actions.setRequest({...i,paging:{perPage:i.paging.perPage,page:r?1:i.paging.page},...e})}setQuery(e){this.updateSearchRequest({query:e},!0),this.setLiveQuery(e)}setContentLocale(e){var r,i;let n=(i=this.store.getState().locales)!==null&&i!==void 0?i:[],s=this.store.getState().request.contentLocale;if(e!=s){if(n.length>0){let o=a=>n.some(l=>l.lang==a);o(e)||(e=o(s)?s:n[0].lang)}this.updateSearchRequest({contentLocale:e,metadataFilters:[]},!0),this.canUpdateUiLocale&&(!((r=qr.store.getState().localesConfiguration)===null||r===void 0)&&r.searchLanguageSetsUiLanguage)&&e&&qr.requestUiLocaleUpdate(e,e)}return e}forceContentLocale(e){this.updateSearchRequest({contentLocale:e})}setPageSize(e){let r=this.store.getState().request;this.updateSearchRequest({paging:{...r.paging,perPage:isNaN(e)?20:(0,j.minmax)(1,e,1e3)}})}setPageNumber(e){let r=this.store.getState().request;this.updateSearchRequest({paging:{...r.paging,page:isNaN(e)?1:Math.max(1,e)}})}get sortOptions(){var e,r;return(r=(e=this.store.getState().configuration)===null||e===void 0?void 0:e.sortOptions)!==null&&r!==void 0?r:[]}setSort(e){this.updateSearchRequest({sort:e},!0)}setSortId(e,r=!1){var i;let n=r?{changedByConfiguration:!0}:{};if(e==null||this.sortOptions.length==0)return this.updateSearchRequest({sortId:e,...n},!0),e;let s=(i=this.sortOptions.find(o=>o.id==e))!==null&&i!==void 0?i:this.sortOptions[0];return this.updateSearchRequest({sortId:s.id,...n},!0),s.id}setFilters(e){let r=e.filter(i=>!i.valueFilter||i.valueFilter.values.length>0);this.updateSearchRequest({metadataFilters:r},!0)}setClusterSortCriterion(e){this.updateSearchRequest({clusterSortCriterions:e})}setSearchInDocumentTitlesOnly(e){e?this.updateSearchRequest({virtualField:nr.TITLE_ONLY,scope:sr.DOCUMENTS},!0):this.updateSearchRequest({virtualField:nr.EVERYWHERE,scope:sr.DEFAULT},!0)}setKeywordMatch(e){this.updateSearchRequest({keywordMatch:e},!0)}setVirtualField(e){this.updateSearchRequest({virtualField:e},!0)}get searchInDocumentTitlesOnly(){return Kp(this.store.getState())}get keywordMatch(){return Wp(this.store.getState())}clearAllFilters(){this.setFilters([]),this.store.dispatchEvent(new ni)}addFacet(e){this.facetIds=[...this.facetIds,e]}replaceFacet(e,r){let i=this.facetIds.filter(n=>n!=e);r&&i.push(r),this.facetIds=i}get facetIds(){var e;let r=this.store.getState().request;return[...new Set([...r.facets.map(i=>i.id),...((e=r.metadataFilters)!==null&&e!==void 0?e:[]).map(i=>i.key)])]}set facetIds(e){let i=[...new Set(e)].map(n=>({id:n}));this.updateSearchRequest({facets:i})}addPropagatedFacet(e){let r=new Set(this.store.getState().propagatedFacets);r.add(e),this.store.actions.propagatedFacets([...r])}setFilter(e,r){this.setValueFilter(e,r)}setValueFilter(e,r){let i=this.store.getState().request.metadataFilters,n={key:e,valueFilter:{values:r,negative:!1}},s=[...i.filter(o=>!o.valueFilter),...i.filter(o=>o.valueFilter&&o.key!==n.key),n];this.setFilters(s)}setDateFilter(e,r){let i=this.store.getState().request.metadataFilters,n={key:e,dateFilter:{type:r}},s=[...i.filter(o=>!o.dateFilter),...i.filter(o=>o.dateFilter&&o.key!==n.key),n];this.setFilters(s)}removeDateFilter(e){let r=this.store.getState().request.metadataFilters,i=[...r.filter(n=>!n.dateFilter),...r.filter(n=>n.dateFilter&&n.key!==e)];this.setFilters(i)}setRangeFilter(e,r,i){let n=this.store.getState().request.metadataFilters,s={key:e,rangeFilter:{from:r,to:i}},o=[...n.filter(a=>!a.rangeFilter),...n.filter(a=>a.rangeFilter&&a.key!==s.key),s];this.setFilters(o)}removeRangeFilter(e){let r=this.store.getState().request.metadataFilters,i=[...r.filter(n=>!n.rangeFilter),...r.filter(n=>n.rangeFilter&&n.key!==e)];this.setFilters(i)}setLiveQuery(e){this.store.actions.liveQuery(e)}setRequest(e){this.updateSearchRequest({...e,facets:this.store.getState().request.facets},!0),this.setLiveQuery(e.query)}setScope(e){this.updateSearchRequest({scope:e})}setOtherQueryParams(e){this.updateSearchRequest({otherQueryParams:e})}setIgnoreEmptyQuery(e){this.ignoreEmptyQuery=e}setOpenExternalDocumentInNewTab(e){this.openExternalDocumentInNewTab=e}setCanUpdateUiLocale(e){this.canUpdateUiLocale=e}setApplyStickyFilters(e){this.applyStickyFilters=e,this.launchSearch(),this.launchSuggest()}addRecentQuery(e){this.history.addRecentQuery(e)}removeRecentQuery(e){this.history.removeRecentQuery(e)}updateLocales(){return this.localesDebouncer.run(async()=>this.store.actions.locales((await this.service.getAvailableSearchLocales()).contentLocales))}async fetchSearchData(e){var r,i,n,s,o;if((r=this.cancelableSearch)===null||r===void 0||r.cancel(),!!this.isRequestNeeded(ii.CLUSTERED_SEARCH))try{if(this.store.actions.paging(void 0),this.ignoreEmptyQuery&&e.query.length==0)this.store.actions.results(void 0),this.store.actions.announcements(void 0),this.store.actions.facets(void 0),this.store.actions.spellcheck(void 0);else{!((i=this.store.getState().results)===null||i===void 0)&&i.length||this.store.actions.results(void 0),this.cancelableSearch=(0,j.cancelable)(this.service.launchSearch(e));let a=await this.cancelableSearch;if(this.store.actions.announcements(a.announcements),a.paging.currentPage<=1)this.store.actions.results(a.results),this.store.actions.facets(a.facets),this.store.actions.spellcheck(a.spellcheck);else{let l=((s=this.store.getState().results)!==null&&s!==void 0?s:[]).concat(a.results);this.store.actions.results(l),this.store.commands.clear(/^focus-result-/),this.store.commands.add({type:`focus-result-${(a.paging.currentPage-1)*((o=e.paging.perPage)!==null&&o!==void 0?o:20)+1}`})}this.store.actions.paging(a.paging)}}catch(a){a instanceof j.CanceledPromiseError||(console.error(a),(n=this.errorHandler)===null||n===void 0||n.call(this,a))}}async fetchSuggestData(e){var r;try{if((r=this.cancelableSuggest)===null||r===void 0||r.cancel(),e.input.length<3){this.store.actions.suggestResults([]);return}this.cancelableSuggest=(0,j.cancelable)(this.service.launchSuggest(e));let i=await this.cancelableSuggest;this.store.actions.suggestResults(i.suggestions)}catch(i){!(i instanceof j.CanceledPromiseError)&&this.errorHandler&&this.errorHandler(i)}}clear(){this.store.clear()}clearResults(){this.store.actions.paging(void 0),this.store.actions.results(void 0),this.store.actions.announcements(void 0),this.store.actions.facets(void 0),this.store.actions.spellcheck(void 0)}};var ao=function(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s},co=class extends CustomEvent{constructor(e){super("register-ft-search-component",{bubbles:!0,composed:!0,detail:{registrationId:e}})}},$u=Symbol("registerInterval"),lo=Symbol("registerAttempts"),Gp=40,Qp=(0,br.applyMixinOnce)(Symbol("toFtSearchComponent"),function(t){class e extends t{constructor(){super(...arguments),this.neededSearchRequests=[]}willUpdate(i){var n,s,o;super.willUpdate(i),i.has("neededSearchRequests")&&((n=this.stateManager)===null||n===void 0||n.unregisterComponent(this,(o=i.get("neededSearchRequests"))!==null&&o!==void 0?o:[]),(s=this.stateManager)===null||s===void 0||s.registerComponent(this,this.neededSearchRequests))}setSearchStateManager(i){this.clearStateManager(),this.stateManager=i,this.stateManager.registerComponent(this,this.neededSearchRequests),this.addStore(i.store,"search")}clearStateManager(){this.stateManager&&(this.stateManager.unregisterComponent(this,this.neededSearchRequests),this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[lo]=0,this.tryToRegisterToContext(),this[$u]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null||this[lo]>Gp?window.clearInterval(this[$u]):(this[lo]++,this.dispatchEvent(new co(this.searchRegistrationId)))}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return ao([(0,oi.state)()],e.prototype,"stateManager",void 0),ao([(0,oi.state)({hasChanged:br.hasChanged})],e.prototype,"neededSearchRequests",void 0),ao([(0,oi.property)()],e.prototype,"searchRegistrationId",void 0),e}),Bu=class extends Qp(br.FtLitElementRedux){};var Xn=h(b());function Gn(t){return t.filter(e=>e.key==="ft:lastEdition").filter(e=>!e.valueFilter).map(e=>e.dateFilter?e.dateFilter.type:"CUSTOM").shift()}function Qn(t){var e,r;return t.dateFilter?{key:t.key,type:"DATE",dateValue:t.dateFilter.type}:t.rangeFilter?{key:t.key,type:"RANGE",from:t.rangeFilter.from,to:t.rangeFilter.to}:{key:t.key,values:(e=t.valueFilter)===null||e===void 0?void 0:e.values,negative:(r=t.valueFilter)===null||r===void 0?void 0:r.negative}}var Yn=class{constructor(e,r){this.store=e,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.enableAnalyticsEvents=!0,this.appName=void 0,this.appVersion=void 0,this.document=void 0,this.sendEvent=([i,n])=>{if(!this.canSendEvent()||!i||!n)return;let s=this.store.getState().request;this.document==null?this.sendKhubSearchEvent(s,i,n):this.sendDocumentSearchEvent(s,i,n)},this.eventsService=r??new cr,this.resultsWatcher=(0,Xn.watch)(e,i=>[i.results,i.paging],this.sendEvent)}setEnableAnalyticsEvents(e){this.enableAnalyticsEvents=e}setAppName(e){this.appName=e}setAppVersion(e){this.appVersion=e}setDocumentSearch(e){this.document=e}setDocumentSearchFromMap(e){this.setDocumentSearch(this.eventsService.convertMapToAnalyticsDocument(e))}initAppInfo(){let{apiIntegrationIdentifier:e,apiIntegrationAppVersion:r}=y.getState();this.setAppName(e??"unknown"),this.setAppVersion(r??"unknown")}canSendEvent(){if(this.appName==null||this.appVersion==null)return console.debug("ft-search-context.eventManager is not initialized. No events will be sent!"),!1;let{editorMode:e}=y.getState();return this.enableAnalyticsEvents&&!e}sendKhubSearchEvent(e,r,i){let n={offline:!1,appVersion:this.appVersion,appName:this.appName,name:Ut.KHUB__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:i.totalClustersCount},searchQuery:{terms:e.query,searchType:e.virtualField,lastUpdate:Gn(e.metadataFilters),facets:e.metadataFilters.map(s=>Qn(s))}};this.eventsService.sendKhubSearchEvent(n)}sendDocumentSearchEvent(e,r,i){if(e.metadataFilters.find(s=>{var o;return s.key==="ft:publicationId"&&((o=s.valueFilter)===null||o===void 0?void 0:o.values[0])===this.document.id})!==void 0){let s={offline:!1,appVersion:this.appVersion,appName:this.appName,name:Ut.DOCUMENT__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:i.totalClustersCount},searchQuery:{terms:e.query},document:this.document};this.eventsService.sendDocumentSearchEvent(s)}}sendResultClickedEvent(e,r){if(!this.canSendEvent())return;let i=this.store.getState().request,n;e.type==Qe.TOPIC&&(n={tocId:e.topic.tocId,title:e.topic.title});let s={offline:!1,appVersion:this.appVersion,appName:this.appName,name:Ut.SEARCH_PAGE__SELECT,searchQuery:{terms:i.query,searchType:i.virtualField,lastUpdate:Gn(i.metadataFilters),facets:i.metadataFilters.map(o=>Qn(o))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:n},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchPageSelectEvent(s)}sendResultContextMenuOpenedEvent(e,r){if(!this.canSendEvent())return;let i=this.store.getState().request,n;e.type==Qe.TOPIC&&(n={tocId:e.topic.tocId,title:e.topic.title});let s={offline:!1,appVersion:this.appVersion,appName:this.appName,name:Ut.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU,searchQuery:{terms:i.query,searchType:i.virtualField,lastUpdate:Gn(i.metadataFilters),facets:i.metadataFilters.map(o=>Qn(o))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:n},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchResultOpenContextMenuEvent(s)}convertDocument(e){switch(e.type){case Qe.MAP:return{id:e.map.mapId,title:e.map.title,type:mt.STRUCTURED_DOCUMENT,metadata:e.map.metadata};case Qe.TOPIC:return{id:e.topic.mapId,title:e.topic.mapTitle,type:mt.STRUCTURED_DOCUMENT,metadata:e.topic.metadata};case Qe.DOCUMENT:return{id:e.document.documentId,title:e.document.title,type:mt.UNSTRUCTURED_DOCUMENT,metadata:e.document.metadata,mimeType:e.document.mimeType};case Qe.HTML_PACKAGE:return{id:e.htmlPackage.packageId,title:e.htmlPackage.title,type:mt.HTML_PACKAGE,metadata:e.htmlPackage.metadata};case Qe.HTML_PACKAGE_PAGE:return{id:e.htmlPackagePage.packageId,title:e.htmlPackagePage.title,type:mt.HTML_PACKAGE,metadata:e.htmlPackagePage.metadata};default:throw new TypeError("Unknown type "+e.type)}}convertExternalLink(e){var r;return(r=(0,Xn.accessResult)(e))===null||r===void 0?void 0:r.originUrl}};var Q=function(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s},L=class extends ye.FtLitElementRedux{get stateManager(){if(this._stateManager==null){let e=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=si.build(this.id||(""+Math.round(Math.random()*999e3)).padStart(6,"0"),e),this._stateManager.errorHandler=r=>this.handleLoadError(r),this.addStore(this.stateManager.store,"search")}return this._stateManager}get eventManager(){return this._eventManager==null&&(this._eventManager=new Yn(this.stateManager.store)),this._eventManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.applyStickyFilters=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.otherQueryParams={},this._appIntegrationInfoReady=!1,this.addStore(y)}render(){return Hu.html`
|
|
922
922
|
<slot @register-ft-search-component=${this.registerComponent} @ft-search-result-click=${this.onResultClicked}
|
|
923
923
|
@ft-search-result-open-context-menu=${this.onResultContextMenuOpened}></slot>
|
|
924
|
-
`}willUpdate(e){super.willUpdate(e),e.has("_appIntegrationInfoReady")&&this._appIntegrationInfoReady&&this.eventManager.initAppInfo(),e.has("query")&&this.query!==void 0&&this.stateManager.setQuery(this.query),e.has("contentLocale")&&this.contentLocale!==void 0&&this.stateManager.forceContentLocale(this.contentLocale),e.has("filters")&&this.filters!==void 0&&this.stateManager.setFilters(this.filters),e.has("sortId")&&this.stateManager.setSortId(this.sortId),e.has("sort")&&this.sort!==void 0&&this.stateManager.setSort(this.sort),e.has("pageSize")&&this.pageSize!==void 0&&this.stateManager.setPageSize(this.pageSize),e.has("searchInDocumentTitlesOnly")&&this.searchInDocumentTitlesOnly!==void 0&&this.stateManager.setSearchInDocumentTitlesOnly(this.searchInDocumentTitlesOnly),e.has("keywordMatch")&&this.stateManager.setKeywordMatch(this.keywordMatch),e.has("scope")&&this.scope!==void 0&&this.stateManager.setScope(this.scope),e.has("virtualField")&&this.virtualField!==void 0&&this.stateManager.setVirtualField(this.virtualField),e.has("ignoreEmptyQuery")&&this.ignoreEmptyQuery!==void 0&&this.stateManager.setIgnoreEmptyQuery(this.ignoreEmptyQuery),e.has("applyStickyFilters")&&this.stateManager.setApplyStickyFilters(this.applyStickyFilters),e.has("openExternalDocumentInNewTab")&&this.openExternalDocumentInNewTab!==void 0&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("otherQueryParams")&&this.otherQueryParams!==void 0&&this.stateManager.setOtherQueryParams(this.otherQueryParams),e.has("session")&&this.session!==void 0&&e.get("session")!=null&&(this.stateManager.service.clearCache(),this.stateManager.initService())}connectedCallback(){super.connectedCallback(),this.stateManager.initService(),this.stateManager.clearResults(),this.stateManager.setQuery(this.query),this.stateManager.forceContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSort(this.sort),this.stateManager.setOtherQueryParams(this.otherQueryParams),this.stateManager.addListeners()}disconnectedCallback(){super.disconnectedCallback(),this.stateManager.removeListeners(),this.stateManager.clearResults()}contentAvailableCallback(e){super.contentAvailableCallback(e),e.has("request")&&this.request&&this.dispatchEvent(new Kn(this.request)),e.has("paging")&&this.paging!==void 0&&this.dispatchEvent(new Wn(this.request,this.paging,this.spellcheckAutocorrect))}registerComponent(e){if(e.stopPropagation(),e.detail.registrationId==this.registrationId){let
|
|
924
|
+
`}willUpdate(e){super.willUpdate(e),e.has("_appIntegrationInfoReady")&&this._appIntegrationInfoReady&&this.eventManager.initAppInfo(),e.has("query")&&this.query!==void 0&&this.stateManager.setQuery(this.query),e.has("contentLocale")&&this.contentLocale!==void 0&&this.stateManager.forceContentLocale(this.contentLocale),e.has("filters")&&this.filters!==void 0&&this.stateManager.setFilters(this.filters),e.has("sortId")&&this.stateManager.setSortId(this.sortId),e.has("sort")&&this.sort!==void 0&&this.stateManager.setSort(this.sort),e.has("pageSize")&&this.pageSize!==void 0&&this.stateManager.setPageSize(this.pageSize),e.has("searchInDocumentTitlesOnly")&&this.searchInDocumentTitlesOnly!==void 0&&this.stateManager.setSearchInDocumentTitlesOnly(this.searchInDocumentTitlesOnly),e.has("keywordMatch")&&this.stateManager.setKeywordMatch(this.keywordMatch),e.has("scope")&&this.scope!==void 0&&this.stateManager.setScope(this.scope),e.has("virtualField")&&this.virtualField!==void 0&&this.stateManager.setVirtualField(this.virtualField),e.has("ignoreEmptyQuery")&&this.ignoreEmptyQuery!==void 0&&this.stateManager.setIgnoreEmptyQuery(this.ignoreEmptyQuery),e.has("applyStickyFilters")&&this.stateManager.setApplyStickyFilters(this.applyStickyFilters),e.has("openExternalDocumentInNewTab")&&this.openExternalDocumentInNewTab!==void 0&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("otherQueryParams")&&this.otherQueryParams!==void 0&&this.stateManager.setOtherQueryParams(this.otherQueryParams),e.has("session")&&this.session!==void 0&&e.get("session")!=null&&(this.stateManager.service.clearCache(),this.stateManager.initService())}connectedCallback(){super.connectedCallback(),this.stateManager.initService(),this.stateManager.clearResults(),this.stateManager.setQuery(this.query),this.stateManager.forceContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSort(this.sort),this.stateManager.setOtherQueryParams(this.otherQueryParams),this.stateManager.addListeners()}disconnectedCallback(){super.disconnectedCallback(),this.stateManager.removeListeners(),this.stateManager.clearResults()}contentAvailableCallback(e){super.contentAvailableCallback(e),e.has("request")&&this.request&&this.dispatchEvent(new Kn(this.request)),e.has("paging")&&this.paging!==void 0&&this.dispatchEvent(new Wn(this.request,this.paging,this.spellcheckAutocorrect))}registerComponent(e){var r;if(e.stopPropagation(),((r=e.detail)===null||r===void 0?void 0:r.registrationId)==this.registrationId){let i=e.composedPath()[0];this.register(i)}}register(e){e.setSearchStateManager(this.stateManager)}handleLoadError(e){this.dispatchEvent(new qn(e))}clear(){this.stateManager.clear()}onResultClicked(e){this.eventManager.sendResultClickedEvent(e.detail.result,e.detail.rank)}onResultContextMenuOpened(e){this.eventManager.sendResultContextMenuOpenedEvent(e.detail.result,e.detail.rank)}};L.elementDefinitions={};L.styles=ku;Q([(0,ye.redux)({store:y.name})],L.prototype,"session",void 0);Q([(0,Ue.property)()],L.prototype,"query",void 0);Q([(0,Ue.property)()],L.prototype,"contentLocale",void 0);Q([(0,ye.numberProperty)()],L.prototype,"pageSize",void 0);Q([(0,Ue.property)({type:Boolean})],L.prototype,"searchInDocumentTitlesOnly",void 0);Q([(0,Ue.property)()],L.prototype,"keywordMatch",void 0);Q([(0,Ue.property)()],L.prototype,"scope",void 0);Q([(0,Ue.property)()],L.prototype,"virtualField",void 0);Q([(0,Ue.property)()],L.prototype,"registrationId",void 0);Q([(0,Ue.property)({type:Boolean})],L.prototype,"ignoreEmptyQuery",void 0);Q([(0,Ue.property)({type:Boolean})],L.prototype,"applyStickyFilters",void 0);Q([(0,ye.redux)({store:y.name})],L.prototype,"openExternalDocumentInNewTab",void 0);Q([(0,ye.jsonProperty)([])],L.prototype,"filters",void 0);Q([(0,Ue.property)()],L.prototype,"sortId",void 0);Q([(0,ye.jsonProperty)([])],L.prototype,"sort",void 0);Q([(0,ye.jsonProperty)({})],L.prototype,"otherQueryParams",void 0);Q([(0,ye.redux)({store:"search"})],L.prototype,"request",void 0);Q([(0,ye.redux)({store:"search"})],L.prototype,"paging",void 0);Q([(0,ye.redux)({store:"search",selector:t=>t.spellcheck})],L.prototype,"spellcheckAutocorrect",void 0);Q([(0,ye.redux)({store:y.name,selector:t=>t.apiIntegrationIdentifier!==void 0&&t.apiIntegrationAppVersion!==void 0})],L.prototype,"_appIntegrationInfoReady",void 0);Q([(0,Ue.property)({attribute:!1})],L.prototype,"searchServiceProvider",void 0);var ju=h(b());var Vu={"ft-search-context":L};(0,ju.customElements)(Vu);var pe=function(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s},uo=class{constructor(e){this.stateManager=e}searchInDocument(e){this.stateManager.setSearchInDocumentQuery(e??"")}},z=class extends Y.FtLitElementRedux{constructor(){super(),this.metadataFilters=[],this.visibleTopics=[],this.updateConfiguration=()=>{this.stateManager.reloadConfiguration()},this.scrollToTargetDebouncer=new Y.Debouncer(5),this.navigationDebouncer=new Y.Debouncer(10),this.mapLoadedEventDebouncer=new Y.Debouncer(50),this.addStore(y)}render(){return ai.html`
|
|
925
925
|
${this.importStyleIfNeeded()}
|
|
926
926
|
<ft-toc-filtering-search-context
|
|
927
927
|
registrationId="reader-toc-filtering"
|