@fluid-topics/ft-reader-context 2.2.36 → 2.2.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ft-reader-context.d.ts +1 -0
- package/build/ft-reader-context.js +22 -10
- package/build/ft-reader-context.light.js +10 -9
- package/build/ft-reader-context.min.js +23 -22
- package/build/store/FtReaderStateManager.d.ts +4 -0
- package/build/store/FtReaderStateManager.js +29 -2
- package/build/store/model.d.ts +1 -0
- package/build/store/redux.js +1 -0
- package/build/store/utils/FtOfficialReaderService.d.ts +2 -2
- package/build/store/utils/FtOfficialReaderService.js +5 -5
- package/build/store/utils/FtReaderService.d.ts +13 -4
- package/build/store/utils/FtReaderService.js +24 -8
- package/package.json +6 -6
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
"use strict";(()=>{var ii=Object.create;var $r=Object.defineProperty;var ai=Object.getOwnPropertyDescriptor;var oi=Object.getOwnPropertyNames;var ci=Object.getPrototypeOf,li=Object.prototype.hasOwnProperty;var ar=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}};var ui=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of oi(e))!li.call(t,s)&&s!==r&&$r(t,s,{get:()=>e[s],enumerable:!(n=ai(e,s))||n.enumerable});return t};var f=(t,e,r)=>(r=t!=null?ii(ci(t)):{},ui(e||!t||!t.__esModule?$r(r,"default",{value:t,enumerable:!0}):r,t));var T=ar((Ca,zr)=>{zr.exports=ftGlobals.wcUtils});var le=ar((wa,Gr)=>{Gr.exports=ftGlobals.lit});var se=ar((xa,Wr)=>{Wr.exports=ftGlobals.litDecorators});var ri=f(T());var Xe=f(le()),ce=f(se()),I=f(T());var fe;(function(t){t.clusteringHelperCreated="clustering-helper-created",t.mapAttachmentsUpdate="map-attachments-update",t.visibleTopicChange="visible-topic-change",t.requestedTopicNotFound="requested-topic-not-found",t.requestedTopicFiltered="requested-topic-filtered"})(fe||(fe={}));var Je=class extends CustomEvent{constructor(e){super(fe.requestedTopicFiltered,{detail:e})}},ie;(function(t){t.FEEDBACK="FEEDBACK",t.RATING="RATING",t.PRINT="PRINT",t.BOOKMARK="BOOKMARK",t.COLLECTIONS="COLLECTIONS",t.PERSONAL_BOOKS="PERSONAL_BOOKS"})(ie||(ie={}));var P=f(T());var Qr=f(T()),di={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]}},Yr=t=>Qr.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:di});var or=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,n){return e.flatMap(s=>{var i;return s.pageConfiguration&&this.registerPage(this.buildPage(s,n)),s.tocId==null?this.extractPagesToc(s.children,r,n):[{tocId:s.tocId,title:(i=s.title)!==null&&i!==void 0?i:"",contentTag:s.contentTag,contentClass:s.contentClass,untranslatedTitle:s.untranslatedTitle,depth:r,children:this.extractPagesToc(s.children,r+1,s.tocId)}]})}convertNodes(e,r,n){return e.flatMap(s=>{var i,a,o;if(s.tocId==null)return[...this.convertSectionNodes((a=s.pageToc)!==null&&a!==void 0?a:[],r,s.tocId),...this.convertNodes(s.children,r,s.tocId)];let c=(i=s.prettyUrl)===null||i===void 0?void 0:i.replace(/^\//,""),l={tocId:s.tocId,contentId:s.contentId,title:s.title,contentTag:s.contentTag,contentClass:s.contentClass,untranslatedTitle:s.untranslatedTitle,hasRating:s.hasRating,origin:s.origin,prettyUrl:c,depth:r,parentTocId:n,children:[]};this.register(l);let u=this.convertSectionNodes((o=s.pageToc)!==null&&o!==void 0?o:[],r+1,s.tocId),p=this.convertNodes(s.children,r+1,l.tocId);return l.children=[...u,...p],[l]})}convertSectionNodes(e,r,n){return e.flatMap(s=>{var i;let a=(i=s.prettyUrl)===null||i===void 0?void 0:i.replace(/^\//,""),o={...s,prettyUrl:a,depth:r,parentTocId:n,children:[]};return this.register(o),o.children=this.convertSectionNodes(s.children,r+1,s.tocId),[o]})}buildPage(e,r){var n,s,i,a,o,c,l,u;let p=(a=e.tocId)!==null&&a!==void 0?a:(s=(n=e.pageToc)===null||n===void 0?void 0:n[0])===null||s===void 0?void 0:s.tocId,h={number:this.pages.length+1,title:(o=e.title)!==null&&o!==void 0?o:"",untranslatedTitle:e.untranslatedTitle,rootTocId:p??"root",toc:((c=e.pageToc)!==null&&c!==void 0?c:[]).map(m=>this.nodeByTocId[m.tocId]),topics:[],hiddenTopics:[],rootDepth:p?this.nodeByTocId[p].depth:1,breadcrumb:r?this.buildBreadcrumb(this.nodeByTocId[r]):[]},v=(m,R)=>(R?h.topics:h.hiddenTopics).push(m),S=(l=(i=e.pageConfiguration)===null||i===void 0?void 0:i.parentsVisibility)!==null&&l!==void 0?l:[];h.breadcrumb.forEach((m,R)=>{v(m,S[R])}),e.tocId&&v(e.tocId,e.pageConfiguration.isVisible),h.topics.push(...this.tocIds((u=e.pageToc)!==null&&u!==void 0?u:[]));let _=this.resolveOverridenRootTocIdByParentForcedByPagination(h.breadcrumb,S);return h.rootTocId=_??h.rootTocId,h.rootDepth=_?this.nodeByTocId[_].depth:h.rootDepth,h}resolveOverridenRootTocIdByParentForcedByPagination(e,r){for(let n=0;n<e.length;n++)if(r[n])return e[n]}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}},Ze=class{convertPaginatedToc(e,r){return new or(e,r).build()}};var Xr;(function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"})(Xr||(Xr={}));var Jr;(function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"})(Jr||(Jr={}));var Zr;(function(t){t.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",t.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",t.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",t.PERSONAL_BOOK="PERSONAL_BOOK",t.ATTACHMENT="ATTACHMENT",t.RESOURCE="RESOURCE",t.HTML_PACKAGE="HTML_PACKAGE"})(Zr||(Zr={}));var ue;(function(t){t.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",t.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",t.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",t.PERSONAL_BOOK="PERSONAL_BOOK",t.ATTACHMENT="ATTACHMENT",t.RESOURCE="RESOURCE",t.HTML_PACKAGE="HTML_PACKAGE"})(ue||(ue={}));var en;(function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR"})(en||(en={}));var tn;(function(t){t.VALUE="VALUE",t.DATE="DATE",t.RANGE="RANGE"})(tn||(tn={}));var et;(function(t){t.OFFICIAL="OFFICIAL",t.AI="AI"})(et||(et={}));var me;(function(t){t.BOOKMARK__CREATE="BOOKMARK__CREATE",t.BOOKMARK__DELETE="BOOKMARK__DELETE",t.CASE_DEFLECTION__START="CASE_DEFLECTION__START",t.CASE_DEFLECTION__OPEN_TICKET="CASE_DEFLECTION__OPEN_TICKET",t.CASE_DEFLECTION__RATE="CASE_DEFLECTION__RATE",t.CHATBOT__RATE="CHATBOT__RATE",t.COLLECTION__CREATE="COLLECTION__CREATE",t.COLLECTION__UPDATE="COLLECTION__UPDATE",t.COLLECTION__DELETE="COLLECTION__DELETE",t.CUSTOM_EVENT__TRIGGER="CUSTOM_EVENT__TRIGGER",t.DOCUMENT__ON_DEMAND_TRANSLATE="DOCUMENT__ON_DEMAND_TRANSLATE",t.DOCUMENT__DOWNLOAD="DOCUMENT__DOWNLOAD",t.DOCUMENT__PRINT="DOCUMENT__PRINT",t.DOCUMENT__PROCESS="DOCUMENT__PROCESS",t.DOCUMENT__RATE="DOCUMENT__RATE",t.DOCUMENT__SEARCH="DOCUMENT__SEARCH",t.DOCUMENT__START_DISPLAY="DOCUMENT__START_DISPLAY",t.DOCUMENT__UNRATE="DOCUMENT__UNRATE",t.FEEDBACK__SEND="FEEDBACK__SEND",t.AI__COMPLETED_QUERY="AI__COMPLETED_QUERY",t.AI__RATE="AI__RATE",t.AI_CASE_DEFLECTION__START="AI_CASE_DEFLECTION__START",t.AI_CASE_DEFLECTION__OPEN_TICKET="AI_CASE_DEFLECTION__OPEN_TICKET",t.KHUB__PROCESS="KHUB__PROCESS",t.KHUB__SEARCH="KHUB__SEARCH",t.LABELS__DOWNLOAD="LABELS__DOWNLOAD",t.LINK__SHARE="LINK__SHARE",t.PAGE__DISPLAY="PAGE__DISPLAY",t.PERSONAL_BOOK__CREATE="PERSONAL_BOOK__CREATE",t.PERSONAL_BOOK__DELETE="PERSONAL_BOOK__DELETE",t.PERSONAL_BOOK__UPDATE="PERSONAL_BOOK__UPDATE",t.PERSONAL_TOPIC__CREATE="PERSONAL_TOPIC__CREATE",t.PERSONAL_TOPIC__UPDATE="PERSONAL_TOPIC__UPDATE",t.PERSONAL_TOPIC__DELETE="PERSONAL_TOPIC__DELETE",t.SAVED_SEARCH__CREATE="SAVED_SEARCH__CREATE",t.SAVED_SEARCH__DELETE="SAVED_SEARCH__DELETE",t.SAVED_SEARCH__UPDATE="SAVED_SEARCH__UPDATE",t.SEARCH_PAGE__SELECT="SEARCH_PAGE__SELECT",t.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU="SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU",t.TOPIC__AI_TRANSLATE="TOPIC__AI_TRANSLATE",t.TOPIC__RATE="TOPIC__RATE",t.TOPIC__START_DISPLAY="TOPIC__START_DISPLAY",t.TOPIC__UNRATE="TOPIC__UNRATE",t.USER__LOGIN="USER__LOGIN",t.USER__LOGOUT="USER__LOGOUT",t.HEARTBEAT="HEARTBEAT"})(me||(me={}));var rn;(function(t){t.STANDARD="STANDARD",t.STRUCTURAL="STRUCTURAL"})(rn||(rn={}));var nn;(function(t){t.METADATA_FILTER="METADATA_FILTER",t.ACCESS_RIGHTS_FILTER="ACCESS_RIGHTS_FILTER"})(nn||(nn={}));var sn;(function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER",t.DOC_DIFF="DOC_DIFF"})(sn||(sn={}));var an;(function(t){t.HOMEPAGE="HOMEPAGE",t.CUSTOM="CUSTOM",t.HEADER="HEADER",t.READER="READER",t.TOPIC_TEMPLATE="TOPIC_TEMPLATE",t.SEARCH="SEARCH",t.SEARCH_RESULT="SEARCH_RESULT",t.SEARCH_ANNOUNCEMENT="SEARCH_ANNOUNCEMENT",t.LINK_PREVIEW="LINK_PREVIEW",t.UD_VIEWER="UD_VIEWER",t.ASSET_VIEWER="ASSET_VIEWER"})(an||(an={}));var on;(function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"})(on||(on={}));var cn;(function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"})(cn||(cn={}));var ln;(function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"})(ln||(ln={}));var un;(function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"})(un||(un={}));var dn;(function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"})(dn||(dn={}));var tt;(function(t){t.OPTIONAL="OPTIONAL",t.MANDATORY="MANDATORY"})(tt||(tt={}));var hn;(function(t){t.ASC="ASC",t.DESC="DESC"})(hn||(hn={}));var pn;(function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"})(pn||(pn={}));var _e;(function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"})(_e||(_e={}));var fn;(function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK",t.HTML_PACKAGE="HTML_PACKAGE"})(fn||(fn={}));var mn;(function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"})(mn||(mn={}));var gn;(function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK",t.HTML_PACKAGE="HTML_PACKAGE"})(gn||(gn={}));var yn;(function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR"})(yn||(yn={}));var J;(function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.HTML_PACKAGE="HTML_PACKAGE",t.HTML_PACKAGE_PAGE="HTML_PACKAGE_PAGE"})(J||(J={}));var Ce;(function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS",t.TOPICS_AND_UNSTRUCTURED_DOCUMENTS="TOPICS_AND_UNSTRUCTURED_DOCUMENTS"})(Ce||(Ce={}));var vn;(function(t){t.PLAIN_TEXT="PLAIN_TEXT",t.LOCALIZED_OFFICIAL="LOCALIZED_OFFICIAL",t.LOCALIZED_CUSTOM="LOCALIZED_CUSTOM"})(vn||(vn={}));var A;(function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.GENERATIVE_AI_USER="GENERATIVE_AI_USER",t.GENERATIVE_AI_EXPORT_USER="GENERATIVE_AI_EXPORT_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.BEHAVIOR_DATA_USER="BEHAVIOR_DATA_USER",t.ANNOUNCEMENT_ADMIN="ANNOUNCEMENT_ADMIN",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN"})(A||(A={}));var W;(function(t){t.SEARCHES="SEARCHES",t.BOOKMARKS="BOOKMARKS",t.BOOKS="BOOKS",t.COLLECTIONS="COLLECTIONS"})(W||(W={}));var En;(function(t){t.UNAUTHENTICATED="UNAUTHENTICATED",t.USER_INCOMPLETE="USER_INCOMPLETE",t.MFA_REQUIRED="MFA_REQUIRED",t.AUTHENTICATED="AUTHENTICATED"})(En||(En={}));var Sn;(function(t){t.UNREACHABLE="UNREACHABLE",t.UNAUTHORIZED="UNAUTHORIZED",t.FORBIDDEN="FORBIDDEN",t.INCOMPATIBLE="INCOMPATIBLE",t.FAILED="FAILED",t.OK="OK"})(Sn||(Sn={}));var An;(function(t){t.VALID="VALID",t.INVALID="INVALID"})(An||(An={}));var Tn;(function(t){t.INACCURATE="INACCURATE",t.INCOMPLETE="INCOMPLETE",t.OFF_TOPIC="OFF_TOPIC",t.SEMANTIC_SEARCH="SEMANTIC_SEARCH",t.CHATBOT_INSTRUCTIONS="CHATBOT_INSTRUCTIONS",t.DOCUMENTATION="DOCUMENTATION",t.OTHER="OTHER"})(Tn||(Tn={}));var bn;(function(t){t.INACCURATE="INACCURATE",t.INCOMPLETE="INCOMPLETE",t.OFF_TOPIC="OFF_TOPIC",t.IRRELEVANT_SOURCES="IRRELEVANT_SOURCES",t.SLOW="SLOW",t.OTHER="OTHER"})(bn||(bn={}));var _n;(function(t){t.JSON="JSON",t.TEXT="TEXT"})(_n||(_n={}));var Cn;(function(t){t.JSON="JSON",t.TEXT="TEXT"})(Cn||(Cn={}));var wn;(function(t){t.TEXT="TEXT",t.HTML="HTML"})(wn||(wn={}));var xn;(function(t){t.IN_PROGRESS="IN_PROGRESS",t.ERROR="ERROR",t.DONE="DONE"})(xn||(xn={}));var Rn;(function(t){t.HTML="HTML",t.MARKDOWN="MARKDOWN"})(Rn||(Rn={}));var In;(function(t){t.SOURCES="SOURCES",t.ENRICH_AND_CLEAN="ENRICH_AND_CLEAN",t.VOCABULARIES="VOCABULARIES",t.METADATA="METADATA",t.PRETTY_URL="PRETTY_URL",t.ACCESS_RULE="ACCESS_RULE",t.DESIGNED_PAGES="DESIGNED_PAGES",t.THEME_STUDIO="THEME_STUDIO",t.PORTAL_GENERAL="PORTAL_GENERAL",t.ASSETS="ASSETS",t.CODE_LIBRARY="CODE_LIBRARY",t.THEME="THEME",t.CONTENT_STYLES="CONTENT_STYLES",t.HOMEPAGE="HOMEPAGE",t.CLASSIC_SEARCH_PAGE="CLASSIC_SEARCH_PAGE",t.CLASSIC_READER_PAGE="CLASSIC_READER_PAGE",t.PORTAL_METADATA="PORTAL_METADATA",t.LANGUAGES="LANGUAGES",t.PRINT_TEMPLATES="PRINT_TEMPLATES",t.OFFLINE="OFFLINE",t.CUSTOM_JS="CUSTOM_JS",t.CONFIDENTIALITY="CONFIDENTIALITY",t.NOTIFICATIONS="NOTIFICATIONS"})(In||(In={}));var On;(function(t){t.MAP="MAP",t.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT"})(On||(On={}));var hi={[A.PERSONAL_BOOK_SHARE_USER]:[A.PERSONAL_BOOK_USER],[A.HTML_EXPORT_USER]:[A.PERSONAL_BOOK_USER],[A.PDF_EXPORT_USER]:[A.PERSONAL_BOOK_USER],[A.KHUB_ADMIN]:[A.CONTENT_PUBLISHER],[A.ADMIN]:[A.KHUB_ADMIN,A.USERS_ADMIN,A.PORTAL_ADMIN,A.BEHAVIOR_DATA_USER],[A.GENERATIVE_AI_EXPORT_USER]:[A.GENERATIVE_AI_USER]};function kn(t,e){return t===e||(hi[t]??[]).some(r=>kn(r,e))}function Q(t,e){return t==null?!1:(Array.isArray(t)?t:Array.isArray(t.roles)?t.roles:Array.isArray(t.profile?.roles)?t.profile.roles:[]).some(n=>kn(n,e))}function Mn(t,...e){return t==null?!1:e.some(r=>Q(t,r))}var Ir=f(se());var Nn=f(se(),1);var cr=t=>e=>{window.customElements.get(t)||window.customElements.define(t,e)},pi=t=>({fromAttribute:e=>{if(e==null)return De(t);try{return JSON.parse(e)}catch{return De(t)}},toAttribute:e=>JSON.stringify(e)});function Dn(t,e){return(0,Nn.property)({type:Object,converter:pi(t),hasChanged:Pe,...e??{}})}function fi(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let r,n;if(Array.isArray(t)){if(r=t.length,r!=e.length)return!1;for(n=r;n--!==0;)if(!we(t[n],e[n]))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(n of t.entries())if(!e.has(n[0]))return!1;for(n of t.entries())if(!we(n[1],e.get(n[0])))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(n of t.entries())if(!e.has(n[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();let s=a=>Object.keys(a).filter(o=>a[o]!=null),i=s(t);if(r=i.length,r!==s(e).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[n]))return!1;for(n=r;n--!==0;){let a=i[n];if(!we(t[a],e[a]))return!1}return!0}return t!==t&&e!==e||t==null&&e==null}function we(t,e){try{return fi(t,e)}catch{return!1}}function Pe(t,e){return!we(t,e)}function De(t){return typeof window.structuredClone=="function"?structuredClone(t):t!=null?JSON.parse(JSON.stringify(t)):t}function rt(t,e){let r=n=>n[t]===!0;return n=>{if(r(n))return n;let s=e(n);return s[t]=!0,s}}var Pn=f(se(),1);var lr=t=>{let e=t??{};return(r,n)=>{var s;let i={hasChanged:Pe,attribute:!1,...e};(0,Pn.property)(i)(r,n);let a=r.constructor;a.reduxProperties=new Map(a.reduxProperties),a.reduxProperties.set(n,{selector:(s=e.selector)!==null&&s!==void 0?s:(o=>o[n]),store:e.store})}};var nt=class{constructor(){this.queue=[]}add(e,r=!1){r&&this.clear(e.type),this.queue.push(e)}consume(e){let r=this.queue.find(n=>n.type===e);return r&&(this.queue=this.queue.filter(n=>n!==r)),r}clear(e){typeof e=="string"?this.queue=this.queue.filter(r=>r.type!==e):this.queue=this.queue.filter(r=>!e.test(r.type))}};var ge=f(se(),1);var st=class{constructor(e=0){this.timeout=e,this.callbacks=[]}run(e,r){return this.callbacks=[e],this.debounce(r)}queue(e,r){return this.callbacks.push(e),this.debounce(r)}cancel(){this.clearTimeout(),this.resolvePromise&&this.resolvePromise(!1),this.clearPromise()}debounce(e){return this.promise==null&&(this.promise=new Promise((r,n)=>{this.resolvePromise=r,this.rejectPromise=n})),this.clearTimeout(),this._debounce=window.setTimeout(()=>this.runCallbacks(),e??this.timeout),this.promise}async runCallbacks(){var e,r;let n=[...this.callbacks];this.callbacks=[];let s=(e=this.rejectPromise)!==null&&e!==void 0?e:(()=>null),i=(r=this.resolvePromise)!==null&&r!==void 0?r:(()=>null);this.clearPromise();for(let a of n)try{await a()}catch(o){s(o);return}i(!0)}clearTimeout(){this._debounce!=null&&window.clearTimeout(this._debounce)}clearPromise(){this.promise=void 0,this.resolvePromise=void 0,this.rejectPromise=void 0}};var at=f(le(),1);var it=class extends at.LitElement{get scopedRegistryConstructor(){return this.constructor}createRenderRoot(){let e=this.scopedRegistryConstructor;e.elementDefinitions&&!e.registry&&(e.registry=new CustomElementRegistry,e.defineScopedElements(e.elementDefinitions));let r={...e.shadowRootOptions,customElements:e.registry},n=this.renderOptions.creationScope=this.attachShadow(r);return(0,at.adoptStyles)(n,e.elementStyles),n}static canDefineScopedElement(e){return!!this.registry&&!this.registry.get(e)}static defineScopedElements(e){Object.entries(e).forEach(([r,n])=>this.defineScopedElement(r,n))}static defineScopedElement(e,r){cr(e)(r),this.canDefineScopedElement(e)&&this.registry.define(e,r)}canDefineScopedElement(e){return this.scopedRegistryConstructor.canDefineScopedElement(e)}defineScopedElements(e){this.scopedRegistryConstructor.defineScopedElements(e)}defineScopedElement(e,r){this.scopedRegistryConstructor.defineScopedElement(e,r)}};function Ln(t,e,...r){var n;let s=t.querySelector(e);for(let i of r)s=(n=s?.shadowRoot)===null||n===void 0?void 0:n.querySelector(i);return s}var Re=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},Vn,Fn=Symbol("constructorPrototype"),Un=Symbol("constructorName"),qn=Symbol("exportpartsDebouncer"),Bn=Symbol("dynamicDependenciesLoaded"),xe=class t extends CustomEvent{constructor(){super(t.eventName,{bubbles:!0})}};xe.eventName="exportparts-updated";var Z=class extends it{constructor(){super(),this.useAdoptedStyleSheets=!0,this.adoptedCustomStyleSheet=new CSSStyleSheet,this[Vn]=new st(5),this.scheduleExportpartsUpdate=()=>{var e,r,n;(!((e=this.exportpartsPrefix)===null||e===void 0)&&e.trim()||(n=(r=this.exportpartsPrefixes)===null||r===void 0?void 0:r.length)!==null&&n!==void 0&&n)&&this[qn].run(()=>{var s,i;!((s=this.exportpartsPrefix)===null||s===void 0)&&s.trim()?this.setExportpartsAttribute([this.exportpartsPrefix]):this.exportpartsPrefixes!=null&&((i=this.exportpartsPrefixes)===null||i===void 0?void 0:i.length)>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)})},this[Un]=this.constructor.name,this[Fn]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[Un]&&Object.setPrototypeOf(this,this[Fn])}connectedCallback(){var e;super.connectedCallback();try{this.shadowRoot&&!this.shadowRoot.adoptedStyleSheets.includes(this.adoptedCustomStyleSheet)&&(this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,this.adoptedCustomStyleSheet]),this.useAdoptedStyleSheets=!0}catch(n){this.useAdoptedStyleSheets=!1,console.error("Cannot use adopted stylesheets",n)}let r=this.constructor;r[Bn]||(r[Bn]=!0,this.importDynamicDependencies()),(e=this.shadowRoot)===null||e===void 0||e.addEventListener(xe.eventName,this.scheduleExportpartsUpdate)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.shadowRoot)===null||e===void 0||e.removeEventListener(xe.eventName,this.scheduleExportpartsUpdate)}importDynamicDependencies(){}updated(e){super.updated(e),this.updateComplete.then(()=>{this.contentAvailableCallback(e),this.focusElementToFocus(e),this.applyCustomStylesheet(e),this.scheduleExportpartsUpdate(),e.has("exportparts")&&this.dispatchEvent(new xe)})}contentAvailableCallback(e){}focusElementToFocus(e){if(e.has("elementToFocus")&&this.elementToFocus!=null){let{element:r,selector:n,shadowPath:s}=this.elementToFocus;if(n!=null){let i=[...s??[],n];r=Ln(this.shadowRoot,...i)}r?.focus(),window.FluidTopicsA11yHints.isKeyboardNavigation||r?.blur(),this.elementToFocus=void 0}}applyCustomStylesheet(e){var r,n,s;if(((n=(r=this.shadowRoot)===null||r===void 0?void 0:r.querySelectorAll(".ft-lit-element--custom-stylesheet"))!==null&&n!==void 0?n:[]).forEach(i=>i.remove()),this.useAdoptedStyleSheets){if(e.has("customStylesheet"))try{this.adoptedCustomStyleSheet.replaceSync((s=this.customStylesheet)!==null&&s!==void 0?s:"")}catch(i){console.error(i,this.customStylesheet),this.useAdoptedStyleSheets=!1}}else if(this.customStylesheet){let i=document.createElement("style");i.classList.add("ft-lit-element--custom-stylesheet"),i.innerHTML=this.customStylesheet,this.shadowRoot.append(i)}}setExportpartsAttribute(e){var r,n,s,i,a,o;let c=h=>h!=null&&h.trim().length>0,l=e.filter(c).map(h=>h.trim());if(l.length===0){this.exportparts=void 0;return}let u=new Set;for(let h of(i=(r=this.shadowRoot)===null||r===void 0?void 0:r.querySelectorAll("[part],[exportparts]"))!==null&&i!==void 0?i:[]){let v=(a=(n=h.getAttribute("part"))===null||n===void 0?void 0:n.split(" "))!==null&&a!==void 0?a:[],S=(o=(s=h.getAttribute("exportparts"))===null||s===void 0?void 0:s.split(",").map(m=>m.split(":")[1]))!==null&&o!==void 0?o:[],_=[...v,...S].filter(c).map(m=>m.trim());for(let m of _)u.add(m)}if(u.size===0){this.exportparts=void 0;return}let p=[...u.values()].flatMap(h=>l.map(v=>`${h}:${v}--${h}`));this.exportparts=[...this.part,...p].join(", ")}};Vn=qn;Re([(0,ge.property)()],Z.prototype,"exportpartsPrefix",void 0);Re([Dn([])],Z.prototype,"exportpartsPrefixes",void 0);Re([(0,ge.property)({reflect:!0})],Z.prototype,"exportparts",void 0);Re([(0,ge.property)()],Z.prototype,"customStylesheet",void 0);Re([(0,ge.property)()],Z.prototype,"elementToFocus",void 0);Re([(0,ge.state)()],Z.prototype,"useAdoptedStyleSheets",void 0);function ot(t){var e;return(e=t?.isFtReduxStore)!==null&&e!==void 0?e:!1}var Le=Symbol("internalReduxEventsUnsubscribers"),de=Symbol("internalStoresUnsubscribers"),ye=Symbol("internalStores"),mi=rt(Symbol("withRedux"),function(t){var e,r,n;class s extends t{constructor(){super(...arguments),this[e]=new Map,this[r]=new Map,this[n]=new Map}get reduxConstructor(){return this.constructor}willUpdate(a){super.willUpdate(a),[...this.reduxConstructor.reduxReactiveProperties].some(o=>a.has(o))&&this.updateFromStores()}getUnnamedStore(){if(this[ye].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[ye].values()][0]}getStore(a){return a==null?this.getUnnamedStore():this[ye].get(a)}addStore(a,o){var c;o=(c=o??a.name)!==null&&c!==void 0?c:"default-store",this.unsubscribeFromStore(o),this[ye].set(o,a),this.subscribeToStore(o,a),this.updateFromStores()}removeStore(a){let o=typeof a=="string"?a:a.name;this.unsubscribeFromStore(o),this[ye].delete(o)}setupStores(){this.unsubscribeFromStores(),this[ye].forEach((a,o)=>this.subscribeToStore(o,a)),this.updateFromStores()}updateFromStores(){this.reduxConstructor.reduxProperties.forEach((a,o)=>{let c=this.constructor.getPropertyOptions(o);if(!c?.attribute||!this.hasAttribute(typeof c?.attribute=="string"?c.attribute:o)){let l=this.getStore(a.store);l&&(a.store?this[de].has(a.store):this[de].size>0)&&(this[o]=a.selector(l.getState(),this))}})}subscribeToStore(a,o){var c,l;this[de].set(a,o.subscribe(()=>this.updateFromStores())),this[Le].set(a,[]),ot(o)&&(!((c=o.deprecatedKeys)===null||c===void 0)&&c.length&&this.reduxConstructor.reduxProperties.forEach((u,p)=>{this.getStore(u.store)===o&&o.deprecatedKeys.includes(p)&&console.warn("Element",this,"is subscribed to deprecated key",p,"in store",o.name)}),o.eventBus&&((l=this.reduxConstructor.reduxEventListeners)===null||l===void 0||l.forEach((u,p)=>{if(typeof this[p]=="function"&&(!u.store||o.name===u.store)){let h=v=>this[p](v);o.addEventListener(u.eventName,h),this[Le].get(a).push(()=>o.removeEventListener(u.eventName,h))}}))),this.onStoreAvailable(a)}unsubscribeFromStores(){this[de].forEach((a,o)=>this.unsubscribeFromStore(o))}unsubscribeFromStore(a){var o;this[de].has(a)&&this[de].get(a)(),this[de].delete(a),(o=this[Le].get(a))===null||o===void 0||o.forEach(c=>c()),this[Le].delete(a)}onStoreAvailable(a){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}return e=de,r=ye,n=Le,s.reduxProperties=new Map,s.reduxReactiveProperties=new Set,s.reduxEventListeners=new Map,s}),jn=class extends mi(Z){};function D(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var gi=typeof Symbol=="function"&&Symbol.observable||"@@observable",Hn=gi,ur=()=>Math.random().toString(36).substring(7).split("").join("."),yi={INIT:`@@redux/INIT${ur()}`,REPLACE:`@@redux/REPLACE${ur()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ur()}`},ct=yi;function lt(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function dr(t,e,r){if(typeof t!="function")throw new Error(D(2));if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(D(0));if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(D(1));return r(dr)(t,e)}let n=t,s=e,i=new Map,a=i,o=0,c=!1;function l(){a===i&&(a=new Map,i.forEach((m,R)=>{a.set(R,m)}))}function u(){if(c)throw new Error(D(3));return s}function p(m){if(typeof m!="function")throw new Error(D(4));if(c)throw new Error(D(5));let R=!0;l();let H=o++;return a.set(H,m),function(){if(R){if(c)throw new Error(D(6));R=!1,l(),a.delete(H),i=null}}}function h(m){if(!lt(m))throw new Error(D(7));if(typeof m.type>"u")throw new Error(D(8));if(typeof m.type!="string")throw new Error(D(17));if(c)throw new Error(D(9));try{c=!0,s=n(s,m)}finally{c=!1}return(i=a).forEach(H=>{H()}),m}function v(m){if(typeof m!="function")throw new Error(D(10));n=m,h({type:ct.REPLACE})}function S(){let m=p;return{subscribe(R){if(typeof R!="object"||R===null)throw new Error(D(11));function H(){let y=R;y.next&&y.next(u())}return H(),{unsubscribe:m(H)}},[Hn](){return this}}}return h({type:ct.INIT}),{dispatch:h,subscribe:p,getState:u,replaceReducer:v,[Hn]:S}}function vi(t){Object.keys(t).forEach(e=>{let r=t[e];if(typeof r(void 0,{type:ct.INIT})>"u")throw new Error(D(12));if(typeof r(void 0,{type:ct.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(D(13))})}function hr(t){let e=Object.keys(t),r={};for(let a=0;a<e.length;a++){let o=e[a];typeof t[o]=="function"&&(r[o]=t[o])}let n=Object.keys(r),s,i;try{vi(r)}catch(a){i=a}return function(o={},c){if(i)throw i;let l=!1,u={};for(let p=0;p<n.length;p++){let h=n[p],v=r[h],S=o[h],_=v(S,c);if(typeof _>"u"){let m=c&&c.type;throw new Error(D(14))}u[h]=_,l=l||_!==S}return l=l||n.length!==Object.keys(o).length,l?u:o}}function Fe(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,r)=>(...n)=>e(r(...n)))}function Kn(...t){return e=>(r,n)=>{let s=e(r,n),i=()=>{throw new Error(D(15))},a={getState:s.getState,dispatch:(c,...l)=>i(c,...l)},o=t.map(c=>c(a));return i=Fe(...o)(s.dispatch),{...s,dispatch:i}}}function $n(t){return lt(t)&&"type"in t&&typeof t.type=="string"}var es=Symbol.for("immer-nothing"),zn=Symbol.for("immer-draftable"),F=Symbol.for("immer-state");function X(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var K=Object,Oe=K.getPrototypeOf,pt="constructor",Et="prototype",gr="configurable",ft="enumerable",dt="writable",Ue="value",ee=t=>!!t&&!!t[F];function $(t){return t?ts(t)||At(t)||!!t[zn]||!!t[pt]?.[zn]||Tt(t)||je(t):!1}var Ei=K[Et][pt].toString(),Gn=new WeakMap;function ts(t){if(!t||!_r(t))return!1;let e=Oe(t);if(e===null||e===K[Et])return!0;let r=K.hasOwnProperty.call(e,pt)&&e[pt];if(r===Object)return!0;if(!Ie(r))return!1;let n=Gn.get(r);return n===void 0&&(n=Function.toString.call(r),Gn.set(r,n)),n===Ei}function St(t,e,r=!0){qe(t)===0?(r?Reflect.ownKeys(t):K.keys(t)).forEach(s=>{e(s,t[s],t)}):t.forEach((n,s)=>e(s,n,t))}function qe(t){let e=t[F];return e?e.type_:At(t)?1:Tt(t)?2:je(t)?3:0}var pr=(t,e,r=qe(t))=>r===2?t.has(e):K[Et].hasOwnProperty.call(t,e),yr=(t,e,r=qe(t))=>r===2?t.get(e):t[e],mt=(t,e,r,n=qe(t))=>{n===2?t.set(e,r):n===3?t.add(r):t[e]=r};function Si(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var At=Array.isArray,Tt=t=>t instanceof Map,je=t=>t instanceof Set,_r=t=>typeof t=="object",Ie=t=>typeof t=="function",fr=t=>typeof t=="boolean";function Ai(t){let e=+t;return Number.isInteger(e)&&String(e)===t}var ae=t=>t.copy_||t.base_;var Cr=t=>t.modified_?t.copy_:t.base_;function vr(t,e){if(Tt(t))return new Map(t);if(je(t))return new Set(t);if(At(t))return Array[Et].slice.call(t);let r=ts(t);if(e===!0||e==="class_only"&&!r){let n=K.getOwnPropertyDescriptors(t);delete n[F];let s=Reflect.ownKeys(n);for(let i=0;i<s.length;i++){let a=s[i],o=n[a];o[dt]===!1&&(o[dt]=!0,o[gr]=!0),(o.get||o.set)&&(n[a]={[gr]:!0,[dt]:!0,[ft]:o[ft],[Ue]:t[a]})}return K.create(Oe(t),n)}else{let n=Oe(t);if(n!==null&&r)return{...t};let s=K.create(n);return K.assign(s,t)}}function bt(t,e=!1){return _t(t)||ee(t)||!$(t)||(qe(t)>1&&K.defineProperties(t,{set:ut,add:ut,clear:ut,delete:ut}),K.freeze(t),e&&St(t,(r,n)=>{bt(n,!0)},!1)),t}function Ti(){X(2)}var ut={[Ue]:Ti};function _t(t){return t===null||!_r(t)?!0:K.isFrozen(t)}var gt="MapSet",Er="Patches",Wn="ArrayMethods",rs={};function ve(t){let e=rs[t];return e||X(0,t),e}var Qn=t=>!!rs[t];var Be,ns=()=>Be,bi=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Qn(gt)?ve(gt):void 0,arrayMethodsPlugin_:Qn(Wn)?ve(Wn):void 0});function Yn(t,e){e&&(t.patchPlugin_=ve(Er),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Sr(t){Ar(t),t.drafts_.forEach(_i),t.drafts_=null}function Ar(t){t===Be&&(Be=t.parent_)}var Xn=t=>Be=bi(Be,t);function _i(t){let e=t[F];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function Jn(t,e){e.unfinalizedDrafts_=e.drafts_.length;let r=e.drafts_[0];if(t!==void 0&&t!==r){r[F].modified_&&(Sr(e),X(4)),$(t)&&(t=Zn(e,t));let{patchPlugin_:s}=e;s&&s.generateReplacementPatches_(r[F].base_,t,e)}else t=Zn(e,r);return Ci(e,t,!0),Sr(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==es?t:void 0}function Zn(t,e){if(_t(e))return e;let r=e[F];if(!r)return yt(e,t.handledSet_,t);if(!Ct(r,t))return e;if(!r.modified_)return r.base_;if(!r.finalized_){let{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(t);as(r,t)}return r.copy_}function Ci(t,e,r=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&bt(e,r)}function ss(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var Ct=(t,e)=>t.scope_===e,wi=[];function is(t,e,r,n){let s=ae(t),i=t.type_;if(n!==void 0&&yr(s,n,i)===e){mt(s,n,r,i);return}if(!t.draftLocations_){let o=t.draftLocations_=new Map;St(s,(c,l)=>{if(ee(l)){let u=o.get(l)||[];u.push(c),o.set(l,u)}})}let a=t.draftLocations_.get(e)??wi;for(let o of a)mt(s,o,r,i)}function xi(t,e,r){t.callbacks_.push(function(s){let i=e;if(!i||!Ct(i,s))return;s.mapSetPlugin_?.fixSetContents(i);let a=Cr(i);is(t,i.draft_??i,a,r),as(i,s)})}function as(t,e){if(t.modified_&&!t.finalized_&&(t.type_===3||t.type_===1&&t.allIndicesReassigned_||(t.assigned_?.size??0)>0)){let{patchPlugin_:n}=e;if(n){let s=n.getPath(t);s&&n.generatePatches_(t,s,e)}ss(t)}}function Ri(t,e,r){let{scope_:n}=t;if(ee(r)){let s=r[F];Ct(s,n)&&s.callbacks_.push(function(){ht(t);let a=Cr(s);is(t,r,a,e)})}else $(r)&&t.callbacks_.push(function(){let i=ae(t);t.type_===3?i.has(r)&&yt(r,n.handledSet_,n):yr(i,e,t.type_)===r&&n.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&yt(yr(t.copy_,e,t.type_),n.handledSet_,n)})}function yt(t,e,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||ee(t)||e.has(t)||!$(t)||_t(t)||(e.add(t),St(t,(n,s)=>{if(ee(s)){let i=s[F];if(Ct(i,r)){let a=Cr(i);mt(t,n,a,t.type_),ss(i)}}else $(s)&&yt(s,e,r)})),t}function Ii(t,e){let r=At(t),n={type_:r?1:0,scope_:e?e.scope_:ns(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},s=n,i=vt;r&&(s=[n],i=Ve);let{revoke:a,proxy:o}=Proxy.revocable(s,i);return n.draft_=o,n.revoke_=a,[o,n]}var vt={get(t,e){if(e===F)return t;let r=t.scope_.arrayMethodsPlugin_,n=t.type_===1&&typeof e=="string";if(n&&r?.isArrayOperationMethod(e))return r.createMethodInterceptor(t,e);let s=ae(t);if(!pr(s,e,t.type_))return ki(t,s,e);let i=s[e];if(t.finalized_||!$(i)||n&&t.operationMethod&&r?.isMutatingArrayMethod(t.operationMethod)&&Ai(e))return i;if(i===mr(t.base_,e)||Oi(t,e,i)){ht(t);let a=t.type_===1?+e:e,o=br(t.scope_,i,t,a);return t.copy_[a]=o}return i},has(t,e){return e in ae(t)},ownKeys(t){return Reflect.ownKeys(ae(t))},set(t,e,r){let n=os(ae(t),e);if(n?.set)return n.set.call(t.draft_,r),!0;if(!t.modified_){let s=mr(ae(t),e),i=s?.[F];if(i&&i.base_===r)return t.copy_[e]=r,t.assigned_.delete(e),!0;if(Si(r,s)&&(r!==void 0||pr(t.base_,e,t.type_)))return!0;ht(t),Tr(t)}return t.copy_[e]===r&&(r!==void 0||pr(t.copy_,e,t.type_))||Number.isNaN(r)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=r,t.assigned_.set(e,!0),Ri(t,e,r)),!0},deleteProperty(t,e){return ht(t),mr(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),Tr(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){let r=ae(t),n=Reflect.getOwnPropertyDescriptor(r,e);return n&&{[dt]:!0,[gr]:t.type_!==1||e!=="length",[ft]:n[ft],[Ue]:r[e]}},defineProperty(){X(11)},getPrototypeOf(t){return Oe(t.base_)},setPrototypeOf(){X(12)}},Ve={};for(let t in vt){let e=vt[t];Ve[t]=function(){let r=arguments;return r[0]=r[0][0],e.apply(this,r)}}Ve.deleteProperty=function(t,e){return Ve.set.call(this,t,e,void 0)};Ve.set=function(t,e,r){return vt.set.call(this,t[0],e,r,t[0])};function mr(t,e){let r=t[F];return(r?ae(r):t)[e]}function Oi(t,e,r){return t.type_!==1||!t.allIndicesReassigned_||!$(r)||r[F]?!1:t.baseRefs_.has(r)}function ki(t,e,r){let n=os(e,r);return n?Ue in n?n[Ue]:n.get?.call(t.draft_):void 0}function os(t,e){if(!(e in t))return;let r=Oe(t);for(;r;){let n=Object.getOwnPropertyDescriptor(r,e);if(n)return n;r=Oe(r)}}function Tr(t){t.modified_||(t.modified_=!0,t.parent_&&Tr(t.parent_))}function ht(t){t.copy_||(t.assigned_=new Map,t.copy_=vr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Mi=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,r,n)=>{if(Ie(e)&&!Ie(r)){let i=r;r=e;let a=this;return function(c=i,...l){return a.produce(c,u=>r.call(this,u,...l))}}Ie(r)||X(6),n!==void 0&&!Ie(n)&&X(7);let s;if($(e)){let i=Xn(this),a=br(i,e,void 0),o=!0;try{s=r(a),o=!1}finally{o?Sr(i):Ar(i)}return Yn(i,n),Jn(s,i)}else if(!e||!_r(e)){if(s=r(e),s===void 0&&(s=e),s===es&&(s=void 0),this.autoFreeze_&&bt(s,!0),n){let i=[],a=[];ve(Er).generateReplacementPatches_(e,s,{patches_:i,inversePatches_:a}),n(i,a)}return s}else X(1,e)},this.produceWithPatches=(e,r)=>{if(Ie(e))return(a,...o)=>this.produceWithPatches(a,c=>e(c,...o));let n,s;return[this.produce(e,r,(a,o)=>{n=a,s=o}),n,s]},fr(t?.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),fr(t?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),fr(t?.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){$(t)||X(8),ee(t)&&(t=cs(t));let e=Xn(this),r=br(e,t,void 0);return r[F].isManual_=!0,Ar(e),r}finishDraft(t,e){let r=t&&t[F];(!r||!r.isManual_)&&X(9);let{scope_:n}=r;return Yn(n,e),Jn(void 0,n)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let r;for(r=e.length-1;r>=0;r--){let s=e[r];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}r>-1&&(e=e.slice(r+1));let n=ve(Er).applyPatches_;return ee(t)?n(t,e):this.produce(t,s=>n(s,e))}};function br(t,e,r,n){let[s,i]=Tt(e)?ve(gt).proxyMap_(e,r):je(e)?ve(gt).proxySet_(e,r):Ii(e,r);return(r?.scope_??ns()).drafts_.push(s),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?xi(r,i,n):i.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:l}=c;i.modified_&&l&&l.generatePatches_(i,[],c)}),s}function cs(t){return ee(t)||X(10,t),ls(t)}function ls(t){if(!$(t)||_t(t))return t;let e=t[F],r,n=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,r=vr(t,e.scope_.immer_.useStrictShallowCopy_),n=e.scope_.immer_.shouldUseStrictIteration()}else r=vr(t,!0);let s=r;return je(r)&&(r=new Set),St(s,(i,a)=>{mt(r,i,ls(a))},n),e&&(e.finalized_=!1),r}var Ni=globalThis.Iterator,yo=typeof Ni?.from=="function";var Di=new Mi,wr=Di.produce;function us(t){return({dispatch:r,getState:n})=>s=>i=>typeof i=="function"?i(r,n,t):s(i)}var ds=us(),hs=us;var Pi=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Fe:Fe.apply(null,arguments)};typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Li=t=>t&&typeof t.match=="function";function he(t,e){function r(...n){if(e){let s=e(...n);if(!s)throw new Error(te(0));return{type:t,payload:s.payload,..."meta"in s&&{meta:s.meta},..."error"in s&&{error:s.error}}}return{type:t,payload:n[0]}}return r.toString=()=>`${t}`,r.type=t,r.match=n=>$n(n)&&n.type===t,r}var ys=class He extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,He.prototype)}static get[Symbol.species](){return He}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new He(...e[0].concat(this)):new He(...e.concat(this))}};function ps(t){return $(t)?wr(t,()=>{}):t}function wt(t,e,r){return t.has(e)?t.get(e):t.set(e,r(e)).get(e)}function Fi(t){return typeof t=="boolean"}var Ui=()=>function(e){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:s=!0,actionCreatorCheck:i=!0}=e??{},a=new ys;return r&&(Fi(r)?a.push(ds):a.push(hs(r.extraArgument))),a},Bi="RTK_autoBatch";var fs=t=>e=>{setTimeout(e,t)},Vi=(t,e)=>r=>{let n=!1,s,i,a=()=>{n||(n=!0,cancelAnimationFrame(s),clearTimeout(i),r())};s=t(a),i=setTimeout(a,e)},qi=(t={type:"raf"})=>e=>(...r)=>{let n=e(...r),s=!0,i=!1,a=!1,o=new Set,c=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?Vi(window.requestAnimationFrame,100):fs(10):t.type==="callback"?t.queueNotification:fs(t.timeout),l=()=>{a=!1,i&&(i=!1,o.forEach(u=>u()))};return Object.assign({},n,{subscribe(u){let p=()=>s&&u(),h=n.subscribe(p);return o.add(u),()=>{h(),o.delete(u)}},dispatch(u){try{return s=!u?.meta?.[Bi],i=!s,i&&(a||(a=!0,c(l))),n.dispatch(u)}finally{s=!0}}})},ji=t=>function(r){let{autoBatch:n=!0}=r??{},s=new ys(t);return n&&s.push(qi(typeof n=="object"?n:void 0)),s};function vs(t){let e=Ui(),{reducer:r=void 0,middleware:n,devTools:s=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=t||{},c;if(typeof r=="function")c=r;else if(lt(r))c=hr(r);else throw new Error(te(1));let l;typeof n=="function"?l=n(e):l=e();let u=Fe;s&&(u=Pi({trace:!1,...typeof s=="object"&&s}));let p=Kn(...l),h=ji(p),v=typeof o=="function"?o(h):h(),S=u(...v);return dr(c,a,S)}function Es(t){let e={},r=[],n,s={addCase(i,a){let o=typeof i=="string"?i:i.type;if(!o)throw new Error(te(28));if(o in e)throw new Error(te(29));return e[o]=a,s},addAsyncThunk(i,a){return a.pending&&(e[i.pending.type]=a.pending),a.rejected&&(e[i.rejected.type]=a.rejected),a.fulfilled&&(e[i.fulfilled.type]=a.fulfilled),a.settled&&r.push({matcher:i.settled,reducer:a.settled}),s},addMatcher(i,a){return r.push({matcher:i,reducer:a}),s},addDefaultCase(i){return n=i,s}};return t(s),[e,r,n]}function Hi(t){return typeof t=="function"}function Ki(t,e){let[r,n,s]=Es(e),i;if(Hi(t))i=()=>ps(t());else{let o=ps(t);i=()=>o}function a(o=i(),c){let l=[r[c.type],...n.filter(({matcher:u})=>u(c)).map(({reducer:u})=>u)];return l.filter(u=>!!u).length===0&&(l=[s]),l.reduce((u,p)=>{if(p)if(ee(u)){let h=p(u,c);return h===void 0?u:h}else{if($(u))return wr(u,h=>p(h,c));{let h=p(u,c);if(h===void 0){if(u===null)return u;throw new Error(te(9))}return h}}return u},o)}return a.getInitialState=i,a}var $i=(t,e)=>Li(t)?t.match(e):t(e);function zi(...t){return e=>t.some(r=>$i(r,e))}var Gi="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Wi=(t=21)=>{let e="",r=t;for(;r--;)e+=Gi[Math.random()*64|0];return e},Qi=["name","message","stack","code"],xr=class{payload;meta;_type;constructor(t,e){this.payload=t,this.meta=e}},ms=class{payload;meta;_type;constructor(t,e){this.payload=t,this.meta=e}},Yi=t=>{if(typeof t=="object"&&t!==null){let e={};for(let r of Qi)typeof t[r]=="string"&&(e[r]=t[r]);return e}return{message:String(t)}},gs="External signal was aborted",Xi=(()=>{function t(e,r,n){let s=he(e+"/fulfilled",(c,l,u,p)=>({payload:c,meta:{...p||{},arg:u,requestId:l,requestStatus:"fulfilled"}})),i=he(e+"/pending",(c,l,u)=>({payload:void 0,meta:{...u||{},arg:l,requestId:c,requestStatus:"pending"}})),a=he(e+"/rejected",(c,l,u,p,h)=>({payload:p,error:(n&&n.serializeError||Yi)(c||"Rejected"),meta:{...h||{},arg:u,requestId:l,rejectedWithValue:p!==void 0,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function o(c,{signal:l}={}){return(u,p,h)=>{let v=n?.idGenerator?n.idGenerator(c):Wi(),S=new AbortController,_,m;function R(g){m=g,S.abort()}l&&(l.aborted?R(gs):l.addEventListener("abort",()=>R(gs),{once:!0}));let H=(async function(){let g;try{let y=n?.condition?.(c,{getState:p,extra:h});if(Zi(y)&&(y=await y),y===!1)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};if(S.signal.aborted)throw{name:"AbortError",message:m||"Aborted"};let N=new Promise((O,L)=>{_=()=>{L({name:"AbortError",message:m||"Aborted"})},S.signal.addEventListener("abort",_,{once:!0})});u(i(v,c,n?.getPendingMeta?.({requestId:v,arg:c},{getState:p,extra:h}))),g=await Promise.race([N,Promise.resolve(r(c,{dispatch:u,getState:p,extra:h,requestId:v,signal:S.signal,abort:R,rejectWithValue:((O,L)=>new xr(O,L)),fulfillWithValue:((O,L)=>new ms(O,L))})).then(O=>{if(O instanceof xr)throw O;return O instanceof ms?s(O.payload,v,c,O.meta):s(O,v,c)})])}catch(y){g=y instanceof xr?a(null,v,c,y.payload,y.meta):a(y,v,c)}finally{_&&S.signal.removeEventListener("abort",_)}return n&&!n.dispatchConditionRejection&&a.match(g)&&g.meta.condition||u(g),g})();return Object.assign(H,{abort:R,requestId:v,arg:c,unwrap(){return H.then(Ji)}})}}return Object.assign(o,{pending:i,rejected:a,fulfilled:s,settled:zi(a,s),typePrefix:e})}return t.withTypes=()=>t,t})();function Ji(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}function Zi(t){return t!==null&&typeof t=="object"&&typeof t.then=="function"}var Ss=Symbol.for("rtk-slice-createasyncthunk"),Co={[Ss]:Xi};function ea(t,e){return`${t}/${e}`}function ta({creators:t}={}){let e=t?.asyncThunk?.[Ss];return function(n){let{name:s,reducerPath:i=s}=n;if(!s)throw new Error(te(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(na()):n.reducers)||{},o=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},l={addCase(g,y){let N=typeof g=="string"?g:g.type;if(!N)throw new Error(te(12));if(N in c.sliceCaseReducersByType)throw new Error(te(13));return c.sliceCaseReducersByType[N]=y,l},addMatcher(g,y){return c.sliceMatchers.push({matcher:g,reducer:y}),l},exposeAction(g,y){return c.actionCreators[g]=y,l},exposeCaseReducer(g,y){return c.sliceCaseReducersByName[g]=y,l}};o.forEach(g=>{let y=a[g],N={reducerName:g,type:ea(s,g),createNotation:typeof n.reducers=="function"};ia(y)?oa(N,y,l,e):sa(N,y,l)});function u(){let[g={},y=[],N=void 0]=typeof n.extraReducers=="function"?Es(n.extraReducers):[n.extraReducers],O={...g,...c.sliceCaseReducersByType};return Ki(n.initialState,L=>{for(let B in O)L.addCase(B,O[B]);for(let B of c.sliceMatchers)L.addMatcher(B.matcher,B.reducer);for(let B of y)L.addMatcher(B.matcher,B.reducer);N&&L.addDefaultCase(N)})}let p=g=>g,h=new Map,v=new WeakMap,S;function _(g,y){return S||(S=u()),S(g,y)}function m(){return S||(S=u()),S.getInitialState()}function R(g,y=!1){function N(L){let B=L[g];return typeof B>"u"&&y&&(B=wt(v,N,m)),B}function O(L=p){return wt(wt(h,y,()=>new WeakMap),L,()=>{let B={};for(let[ni,si]of Object.entries(n.selectors??{}))B[ni]=ra(si,L,()=>wt(v,L,m),y);return B})}return{reducerPath:g,getSelectors:O,get selectors(){return O(N)},selectSlice:N}}let H={name:s,reducer:_,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:m,...R(i),injectInto(g,{reducerPath:y,...N}={}){let O=y??i;return g.inject({reducerPath:O,reducer:_},N),{...H,...R(O,!0)}}};return H}}function ra(t,e,r,n){function s(i,...a){let o=e(i);return typeof o>"u"&&n&&(o=r()),t(o,...a)}return s.unwrapped=t,s}var As=ta();function na(){function t(e,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...r}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...r){return e(...r)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:r}},asyncThunk:t}}function sa({type:t,reducerName:e,createNotation:r},n,s){let i,a;if("reducer"in n){if(r&&!aa(n))throw new Error(te(17));i=n.reducer,a=n.prepare}else i=n;s.addCase(t,i).exposeCaseReducer(e,i).exposeAction(e,a?he(t,a):he(t))}function ia(t){return t._reducerDefinitionType==="asyncThunk"}function aa(t){return t._reducerDefinitionType==="reducerWithPrepare"}function oa({type:t,reducerName:e},r,n,s){if(!s)throw new Error(te(18));let{payloadCreator:i,fulfilled:a,pending:o,rejected:c,settled:l,options:u}=r,p=s(t,i,u);n.exposeAction(e,p),a&&n.addCase(p.fulfilled,a),o&&n.addCase(p.pending,o),c&&n.addCase(p.rejected,c),l&&n.addMatcher(p.settled,l),n.exposeCaseReducer(e,{fulfilled:a||xt,pending:o||xt,rejected:c||xt,settled:l||xt})}function xt(){}var Ts="listener",bs="completed",_s="cancelled",wo=`task-${_s}`,xo=`task-${bs}`,Ro=`${Ts}-${_s}`,Io=`${Ts}-${bs}`;var{assign:Cs}=Object;var Rr="listenerMiddleware";var ca=Cs(he(`${Rr}/add`),{withTypes:()=>ca}),Oo=he(`${Rr}/removeAll`),la=Cs(he(`${Rr}/remove`),{withTypes:()=>la});function te(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var ua=rt(Symbol("withEventBus"),function(t,e){return class extends t{constructor(){super(...arguments),this.eventBus=e??document.createElement("span")}addEventListener(r,n,s){this.eventBus.addEventListener(r,n,s)}dispatchEvent(r){return this.eventBus.dispatchEvent(r)}removeEventListener(r,n,s){this.eventBus.removeEventListener(r,n,s)}}}),Rt=class extends ua(Object){};window.ftReduxStores||(window.ftReduxStores={});var ws=class t extends Rt{static get(e){var r;let n=typeof e=="string"?e:e.name,s=typeof e=="string"?void 0:e,i=window.ftReduxStores[n];if(ot(i))return i;if(s==null)return;let a=As({...s,reducers:(r=s.reducers)!==null&&r!==void 0?r:{}}),o=vs({reducer:(c,l)=>{if(l.type==="CLEAR_FT_REDUX_STORE"){let u=De(a.getInitialState());for(let p of l.keeping)u[p]=(c??u)[p];return u}else if(typeof l.type=="string"&&l.type.startsWith("DEFAULT_VALUE_SETTER__"))return{...c,...l.overwrites};return a.reducer(c,l)}});return window.ftReduxStores[s.name]=new t(a,o,s.eventBus,s.deprecatedKeys)}constructor(e,r,n,s){super(),this.reduxSlice=e,this.reduxStore=r,this.deprecatedKeys=s,this.isFtReduxStore=!0,this.commands=new nt,this.injectInto=(a,o)=>this.reduxSlice.injectInto(a,o),this.selectSlice=a=>this.reduxSlice.selectSlice(a);let i=a=>a!=null?JSON.parse(JSON.stringify(a)):a;this.actions=new Proxy(this.reduxSlice.actions,{get:(a,o,c)=>{let l=o,u=a[l];return u?(...p)=>{let h=u(...p.map(i));return this.reduxStore.dispatch(h),h}:p=>{let h=l,v=this.getState()[h];we(v,p)||this.setState({[h]:i(p)})}}}),this.eventBus=n??this.eventBus}clear(){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE",keeping:[]})}clearKeeping(...e){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE",keeping:e})}setState(e){this.reduxStore.dispatch({type:"DEFAULT_VALUE_SETTER__"+Object.keys(e).join("_"),overwrites:e})}get dispatch(){throw new Error("Don't use this method, actions are automatically dispatched when called.")}[Symbol.observable](){return this.reduxStore[Symbol.observable]()}getState(){return this.reduxStore.getState()}replaceReducer(e){throw new Error("Not implemented yet.")}subscribe(e){return this.reduxStore.subscribe(e)}get name(){return this.reduxSlice.name}get reducer(){return this.reduxSlice.reducer}get caseReducers(){return this.reduxSlice.caseReducers}getInitialState(){return this.reduxSlice.getInitialState()}get selectors(){return this.reduxSlice.selectors}get reducerPath(){return this.reduxSlice.reducerPath}getSelectors(){return this.reduxSlice.getSelectors()}};var It=class{static format(e,r,n,s,i){return window.moment?window.moment(e).locale(r).format(this.getMomentDateFormat(n,s,!!i)):this.getIntlDateTime(e,r,n,s,!!i)}static getMomentDateFormat(e,r,n){return n?"LT":e?r?"lll":"ll":r?"L LT":"L"}static getIntlDateTime(e,r,n,s,i){let a=typeof e=="string"?new Date(e):e,o=new Intl.DateTimeFormat(r,{dateStyle:n?"medium":"short"}).format(a),c=new Intl.DateTimeFormat(r,{timeStyle:"short"}).format(a);return i?c:s?`${o} ${c}`:o}static getTimezoneAsString(){let e=n=>String(Math.floor(n)).padStart(2,"0"),r=new Date().getTimezoneOffset();return`${r<0?"+":"-"}${e(Math.abs(r)/60)}:${e(Math.abs(r)%60)}`}};var Ot=f(T()),da="ft-app-info",z=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:e})}};z.eventName="authentication-change";var Ke=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:e})}};Ke.eventName="ui-locale-changed";var ha={session:(t,e)=>{(0,Ot.deepEqual)(t.session,e.payload)||(t.session=e.payload,setTimeout(()=>d.dispatchEvent(new z(e.payload)),0))}},d=Ot.FtReduxStore.get({name:da,reducers:ha,initialState:{baseUrl:void 0,tenantId:void 0,apiIntegrationIdentifier:void 0,apiIntegrationAppVersion:void 0,uiLocale:document.documentElement.lang||"en-US",availableContentLocales:[],localesConfiguration:void 0,metadataConfiguration:void 0,privacyPolicyConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,noCustomCode:!1,session:void 0,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1,authenticationRequired:!1,stickyFilters:void 0}});var xs=f(T()),kt=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},ac=(0,xs.applyMixinOnce)(Symbol("withDateFormat"),function(t){class e extends t{constructor(...n){super(n),this.useLongDateFormat=!1,this.useDateTimeFormat=!1,this.metadataDescriptors=[],this.uiLocale="en-US",this.addStore(d)}dateFormatOptionsChanged(n){return n.has("metadataDescriptors")||n.has("useLongDateFormat")||n.has("useDateTimeFormat")||n.has("uiLocale")}getDateFormatter(n){var s,i;return((i=(s=this.metadataDescriptors.find(o=>o.key===n))===null||s===void 0?void 0:s.date)!==null&&i!==void 0?i:!1)?o=>It.format(o,this.uiLocale,this.useLongDateFormat,this.useDateTimeFormat):void 0}}return kt([(0,Ir.property)({type:Boolean})],e.prototype,"useLongDateFormat",void 0),kt([(0,Ir.property)({type:Boolean})],e.prototype,"useDateTimeFormat",void 0),kt([lr({store:d.name,selector:r=>{var n,s;return(s=(n=r.metadataConfiguration)===null||n===void 0?void 0:n.descriptors)!==null&&s!==void 0?s:[]}})],e.prototype,"metadataDescriptors",void 0),kt([lr({store:d.name})],e.prototype,"uiLocale",void 0),e});var Lt=f(T());var Or=f(T());var Ee=class t{static get(e){let{baseUrl:r,apiIntegrationIdentifier:n}=d.getState(),s=e??n;if(r&&s&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(r,s,!0)}static await(e){return new Promise(r=>{let n=t.get(e);if(n)r(n);else{let s=d.subscribe(()=>{n=t.get(e),n&&(s(),r(n))})}})}};var ke=class{constructor(e){this.overrideApi=e}get api(){var e;return(e=this.overrideApi)!==null&&e!==void 0?e:Ee.get()}get awaitApi(){return this.overrideApi?Promise.resolve(this.overrideApi):Ee.await()}};var k=class extends ke{constructor(e=!0,r){var n;super(r),this.sortObjectFields=(i,a)=>typeof a!="object"||a==null||Array.isArray(a)?a:Object.fromEntries(Object.entries(a).sort(([o],[c])=>o.localeCompare(c)));let s=this.constructor;s.commonCache=(n=s.commonCache)!==null&&n!==void 0?n:new Or.CacheRegistry,this.cache=e?s.commonCache:new Or.CacheRegistry}clearCache(){this.cache.clearAll()}hash(e){return String(Array.from(JSON.stringify(e,this.sortObjectFields)).reduce((r,n)=>0|31*r+n.charCodeAt(0),0))}};var Mt=class extends k{async listMySearches(){let{session:e}=d.getState();return Q(e,A.SAVED_SEARCH_USER)?this.cache.get("my-searches",async()=>(await this.awaitApi).listMySearches(e.profile.userId),300*1e3):[]}};var Nt=class extends k{async listMyBookmarks(){let e=d.getState().session;return e?.sessionAuthenticated?this.cache.get("my-bookmarks",async()=>(await this.awaitApi).listMyBookmarks(e.profile.userId),300*1e3):[]}};var Dt=class extends k{constructor(){super(...arguments),this.CACHE_DURATION=180*1e3}async getUserAssetCount(e){if(this.isAuthenticated())return this.cache.get(`user-asset-count-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/${e}`),this.CACHE_DURATION)}async getUserBookmarkCountByMap(e){if(this.isAuthenticated())return this.cache.get(`user-bookmark-count-by-map-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/BOOKMARKS/${e}`),this.CACHE_DURATION)}isAuthenticated(){let e=d.getState().session;return!!e?.sessionAuthenticated}};var Pt=class extends k{constructor(){super(...arguments),this.CACHE_DURATION=180*1e3}async getUserAssetLabels(){return this.isAuthenticated()?this.cache.get("user-asset-labels",async()=>(await this.awaitApi).get("/internal/api/webapp/user/assets/labels"),this.CACHE_DURATION):[]}isAuthenticated(){let e=d.getState().session;return!!e?.sessionAuthenticated}};var pa="ft-user-assets",fa={setAssetCount:(t,e)=>{let{userAssetType:r,count:n}=e.payload.assetCount;t.assetCounts.allAsset[r]=n},clearAssetCount:t=>{Object.values(W).forEach(e=>{t.assetCounts.allAsset[e]=void 0})},setBookmarkCountByMap:(t,e)=>{let r=e.payload.mapId;t.assetCounts.bookmarkByMap[r]=e.payload.count},clearBookmarkCountByMap:t=>{t.assetCounts.bookmarkByMap={}},addAsset:(t,e)=>{let{assetType:r,mapId:n,asset:s}=e.payload;Mr(t,r,[...kr(t,r),s]),Rs(t,r,1,n),Is(t,s)},editAsset:(t,e)=>{let{assetType:r,asset:n}=e.payload;Mr(t,r,kr(t,r).map(s=>s.id===n.id?n:s)),Is(t,n)},removeAsset:(t,e)=>{let{assetType:r,mapId:n,assetId:s}=e.payload;Mr(t,r,kr(t,r).filter(i=>i.id!==s)),Rs(t,r,-1,n)}},Os={[W.SEARCHES]:"savedSearches",[W.BOOKMARKS]:"bookmarks",[W.BOOKS]:void 0,[W.COLLECTIONS]:void 0},kr=(t,e)=>{var r;let n=Os[e];return n?(r=t[n])!==null&&r!==void 0?r:[]:[]},Mr=(t,e,r)=>{let n=Os[e];n&&(t[n]=r)},Rs=(t,e,r,n)=>{let s=t.assetCounts.allAsset[e];if(s!==void 0&&(t.assetCounts.allAsset[e]=Math.max(0,s+r),e===W.BOOKMARKS&&n)){let i=t.assetCounts.bookmarkByMap[n];t.assetCounts.bookmarkByMap[n]=Math.max(0,i+r)}},Is=(t,e)=>{let r=t.assetLabels.map(s=>s.title),n=e.labels.filter(s=>!r.includes(s)).map(s=>({title:s}));t.assetLabels.push(...n)},V=Lt.FtReduxStore.get({name:pa,reducers:fa,initialState:{savedSearches:void 0,bookmarks:void 0,assetCounts:{allAsset:Object.fromEntries(Object.values(W).map(t=>[t,void 0])),bookmarkByMap:{}},assetLabels:[]}}),Nr=class{constructor(e=new Dt,r=new Pt){this.assetCountsService=e,this.assetLabelsService=r,this.currentSession=d.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Nt,this.savedSearchesService=new Mt,d.subscribe(()=>this.reloadWhenUserSessionChanges())}reloadWhenUserSessionChanges(){var e;let{session:r}=d.getState();(0,Lt.deepEqual)((e=this.currentSession)===null||e===void 0?void 0:e.profile,r?.profile)||(this.currentSession=r,this.clearMySearches(),this.reloadBookmarks(),this.clearUserAssetCounts(),this.reloadAssetLabels())}clearUserAssetCounts(){this.assetCountsService.clearCache(),V.actions.clearAssetCount(),V.actions.clearBookmarkCountByMap()}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),V.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),V.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();let e=await this.savedSearchesService.listMySearches();V.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async reloadAssetLabels(){this.assetLabelsService.clearCache();let e=await this.assetLabelsService.getUserAssetLabels();V.actions.assetLabels(e)}async loadAssetCount(e){let r=await this.assetCountsService.getUserAssetCount(e);r&&V.getState().assetCounts.allAsset[e]!==r.count&&V.actions.setAssetCount({assetCount:r})}async loadBookmarkByMapId(e){let r=await this.assetCountsService.getUserBookmarkCountByMap(e);r&&V.getState().assetCounts.bookmarkByMap[e]!==r.count&&V.actions.setBookmarkCountByMap({count:r.count,mapId:e})}async reloadAssetCount(e){this.assetCountsService.clearCache();let r=Object.keys(V.getState().assetCounts.bookmarkByMap).length!==0;e===W.BOOKMARKS&&r&&V.actions.clearBookmarkCountByMap(),V.getState().assetCounts.allAsset[e]!==void 0&&await this.loadAssetCount(e)}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var e;if(this.bookmarksAreUsed){let r=!((e=this.currentSession)===null||e===void 0)&&e.sessionAuthenticated?await this.bookmarksService.listMyBookmarks():void 0;V.actions.bookmarks(r)}}},Dr=new Nr;window.FluidTopicsUserAssetsActions==null&&(window.FluidTopicsUserAssetsActions=Dr);var Pr=class{addCommand(e,r=!1){d.commands.add(e,r)}consumeCommand(e){return d.commands.consume(e)}};window.FluidTopicsAppInfoStoreService=new Pr;var Y=f(T());var ks,Me=class extends CustomEvent{constructor(e){super("ft-i18n-context-loaded",{detail:e})}},ma=Symbol("clearAfterUnitTest"),Ft=class extends(0,Y.withEventBus)(k){constructor(e){super(),this.messageContextProvider=e,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[ks]=()=>{this.defaultMessages={},this.cache=new Y.CacheRegistry,this.listeners={}},this.currentUiLocale=d.getState().uiLocale,d.subscribe(()=>this.clearWhenUiLocaleChanges())}clearWhenUiLocaleChanges(){let{uiLocale:e}=d.getState();this.currentUiLocale!==e&&(this.currentUiLocale=e,this.cache.clearAll(),this.notifyAll())}addContext(e){let r=e.name.toLowerCase();this.cache.setFinal(r,e),this.notify(r)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(e,r){var n;if(e=e.toLowerCase(),r&&Object.keys(r).length>0){let s={...(n=this.defaultMessages[e])!==null&&n!==void 0?n:{},...r};(0,Y.deepEqual)(this.defaultMessages[e],s)||(this.defaultMessages[e]=s,await this.notify(e))}return this.fetchContext(e)}resolveContext(e){var r,n;return this.fetchContext(e),(n=(r=this.cache.getNow(e))===null||r===void 0?void 0:r.messages)!==null&&n!==void 0?n:{}}resolveRawMessage(e,r){let n=e.toLowerCase();return this.resolveContext(n)[r]}resolveMessage(e,r,...n){var s;let i=e.toLowerCase(),a=this.resolveContext(i);return new Y.ParametrizedLabelResolver((s=this.defaultMessages[i])!==null&&s!==void 0?s:{},a).resolve(r,...n)}async fetchContext(e){let r=!this.cache.has(e),n;try{n=await this.cache.get(e,()=>this.messageContextProvider(this.currentUiLocale,e)),r&&await this.notify(e)}catch(s){!(s instanceof Y.CanceledPromiseError)&&r&&console.error(s)}return n}subscribe(e,r){var n;return e=e.toLowerCase(),this.listeners[e]=(n=this.listeners[e])!==null&&n!==void 0?n:new Set,this.listeners[e].add(r),()=>{var s;return(s=this.listeners[e])===null||s===void 0?void 0:s.delete(r)}}async notifyAll(){let e=Object.keys(this.listeners);document.body.dispatchEvent(new Me({loadedContexts:e})),this.dispatchEvent(new Me({loadedContexts:e})),await Promise.all(e.map(r=>this.notify(r,!1)))}async notify(e,r=!0){r&&(document.body.dispatchEvent(new Me({loadedContexts:[e]})),this.dispatchEvent(new Me({loadedContexts:[e]}))),this.listeners[e]!=null&&await Promise.all([...this.listeners[e].values()].map(n=>(0,Y.delay)(0).then(()=>n()).catch(()=>null)))}};ks=ma;window.FluidTopicsI18nService==null&&(window.FluidTopicsI18nService=new class extends Ft{constructor(){super(async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e))}});window.FluidTopicsCustomI18nService==null&&(window.FluidTopicsCustomI18nService=new class extends Ft{constructor(){super(async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e))}});var Ms=window.FluidTopicsI18nService,qc=window.FluidTopicsCustomI18nService;var Ns=f(T()),Lr=class{highlightHtml(e,r,n){(0,Ns.highlightHtml)(e,r,n)}};window.FluidTopicsHighlightHtmlService=new Lr;var Ds=f(T());var Fr=class{isDate(e){var r,n,s,i;return(i=(n=((s=(r=d.getState().metadataConfiguration)===null||r===void 0?void 0:r.descriptors)!==null&&s!==void 0?s:[]).find(o=>o.key===e))===null||n===void 0?void 0:n.date)!==null&&i!==void 0?i:!1}format(e,r){var n,s,i,a;if(e==null)return"";try{return Ds.DateFormatter.format(e,(n=r?.locale)!==null&&n!==void 0?n:d.getState().uiLocale,(s=r?.longFormat)!==null&&s!==void 0?s:!1,(i=r?.withTime)!==null&&i!==void 0?i:!1,(a=r?.onlyTime)!==null&&a!==void 0?a:!1)}catch(o){throw console.error(`Date ${JSON.stringify(e)} is not valid`,o),o}}};window.FluidTopicsDateService=new Fr;var Ps=f(T());var $e=class{static get(e,r,{baseUrl:n,localesConfiguration:s,availableContentLocales:i}=d.getState()){var a;if(!r||i.length>0&&!i.some(o=>o.lang===r)){let o=s?.defaultLocales.defaultContentLocale;r=o?`${o.lang}-${o.region}`:(a=i[0])===null||a===void 0?void 0:a.lang}return new Ps.SearchPlaceConverter(n,e??20,s?.allLanguagesAllowed,r,i)}};var Ne=class extends k{async sendDocumentStartDisplayEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.start_display event")}async sendTopicStartDisplayEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send topic.start_display event")}async sendKhubSearchEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send khub.search event")}async sendDocumentSearchEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.search event")}async sendSearchPageSelectEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send search_page.select event")}async sendSearchResultOpenContextMenuEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send search_result.open_context_menu event")}async sendDocumentOnDemandTranslateEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.on_demand_translate event")}async sendTopicAiTranslateEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send topic.ai_translate event")}convertMapToAnalyticsDocument(e){let r;switch(e.editorialType){case"BOOK":r="STRUCTURED_DOCUMENT";break;case"SHARED_BOOK":r="SHARED_PERSONAL_BOOK";break;case"ARTICLE":r="RESOURCE";break;case"HTML_PACKAGE":r="HTML_PACKAGE";break;default:throw new TypeError("Unknown editorial type for map : "+e.editorialType)}return{id:e.id,title:e.title,type:r,metadata:e.metadata}}sortEventArrays(e){let r=Object.entries(e).map(([n,s])=>Array.isArray(s)?[n,s.map(i=>typeof i=="object"&&i!=null&&!Array.isArray(i)?this.sortEventArrays(i):i).sort((i,a)=>typeof i=="object"&&i!==null&&"key"in i?i.key.localeCompare(a.key):typeof i=="string"&&typeof a=="string"?i.localeCompare(a):String(i).localeCompare(String(a)))]:typeof s=="object"&&s!==null?[n,this.sortEventArrays(s)]:[n,s]);return Object.fromEntries(r)}sendEvents(e,r){let n="anything not undefined";return document.dispatchEvent(new CustomEvent("ft:analytics:userevents",{detail:e})),this.cache.get("analytics-event-"+this.hash(e),async()=>(await this.awaitApi).sendEvents(e).then(()=>n).catch(s=>(console.info(r),console.debug(s),n)),1e3)}};var Ur=class{urlToSearchRequest(e){return $e.get().parse(e)}searchRequestToUrl(e){return $e.get().serialize(e)}};window.FluidTopicsUrlService=new Ur;var oe=f(T());var Se=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:{nextLocation:e}})}};Se.eventName="before-location-change";var Ae=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:{currentItem:e}})}};Ae.eventName="change";var Br=class{itemName(e){return`fluid-topics-history-item-${e}`}get(e){let r=sessionStorage.getItem(this.itemName(e));return r?JSON.parse(r):void 0}set(e,r){sessionStorage.setItem(this.itemName(e),JSON.stringify(r))}},Ls=new Br;var Ut=class t extends oe.WithEventBus{static build(){return new t(window.history,Ls,()=>window.location,!1)}constructor(e,r,n,s){var i,a;super(),this.history=e,this.historyStorage=r,this.windowLocation=n,this.states=[],this.realPushState=e.pushState,this.realReplaceState=e.replaceState,this.initialIndex=(a=(i=e.state)===null||i===void 0?void 0:i.index)!==null&&a!==void 0?a:e.length-1,this.currentIndex=this.initialIndex,this.setCurrentState(this.buildCurrentState()),this.installProxies(),this.initEventListeners(),this.initData(s)}setCurrentState(e,r=!1){let n=r&&this.currentIndex===e.index-1;this.currentState={...this.buildCurrentState(),...e},this.currentIndex=this.currentState.index,this.states[this.currentIndex]=this.currentState,n&&(this.states=this.states.slice(0,this.currentIndex+1)),this.historyStorage.set(this.currentIndex,this.currentState),(0,oe.deepEqual)(this.currentState,this.history.state)||this.realReplaceState.apply(this.history,[this.currentState,this.currentState.title,this.windowLocation().href]),setTimeout(()=>this.dispatchEvent(new Ae(this.currentItem())),0)}installProxies(){let e=r=>(n,s,[i,a,o])=>{let c=new Se(new URL(typeof o=="string"?o:(o??this.windowLocation()).href,window.location.origin));this.dispatchEvent(c);let l=r(),u={...l===this.currentIndex?this.currentState:void 0,...i,index:l,href:c.detail.nextLocation.href};n.apply(s,[u,a,u.href]),this.setCurrentState(u,!0)};this.history.pushState=new Proxy(this.history.pushState,{apply:e(()=>this.currentIndex+1)}),this.history.replaceState=new Proxy(this.history.replaceState,{apply:e(()=>this.currentIndex)})}initEventListeners(){window.addEventListener("popstate",e=>this.setCurrentState(e.state)),document.querySelector("title")==null&&document.head.append(document.createElement("title")),new MutationObserver(()=>this.updateCurrentState({title:document.title})).observe(document.querySelector("title"),{subtree:!0,characterData:!0,childList:!0})}initData(e){for(let r=this.history.length-1;r>=0;r--)e?this.states[r]=this.historyStorage.get(r):setTimeout(()=>this.states[r]=this.historyStorage.get(r),this.history.length-r)}updateCurrentState(e){var r;let n={...this.buildCurrentState(),...e,index:this.currentIndex,title:(r=e?.title)!==null&&r!==void 0?r:this.currentState.title};this.setCurrentState(n)}addBeforeLocationChangeListener(e){this.addEventListener(Se.eventName,e)}removeBeforeLocationChangeListener(e){this.removeEventListener(Se.eventName,e)}addHistoryChangeListener(e){this.addEventListener(Ae.eventName,e)}removeHistoryChangeListener(e){this.removeEventListener(Ae.eventName,e)}currentItem(){return(0,oe.deepCopy)(this.currentState)}back(){let e=this.previousDifferentMajorPosition();e>=0?this.history.go(e-this.currentIndex):this.currentIndex!==this.initialIndex?this.history.go(this.initialIndex-this.currentIndex):this.history.back()}backwardItem(){return(0,oe.deepCopy)(this.states[this.previousDifferentMajorPosition()])}backwardItemMatching(e){let r=this.states.filter(n=>!!n).filter(n=>n.index<this.currentIndex).reverse();return(0,oe.deepCopy)(r.find(n=>e(n)))}previousDifferentMajorPosition(){let e=this.currentIndex>0?this.currentIndex-1:0;for(;e>0&&!this.isDifferentMajorState(e);)e--;return e}forward(){let e=this.nextMajorPosition();e&&e<this.states.length?this.history.go(e-this.currentIndex):this.history.forward()}forwardItem(){let e=this.nextMajorPosition();if(e)return(0,oe.deepCopy)(this.states[e])}nextMajorPosition(){let e=this.currentIndex;if(!(e>=this.states.length)){do e++;while(e<this.states.length&&!this.isDifferentMajorState(e));return this.getHigherPositionInTheSameState(e)}}getHigherPositionInTheSameState(e){var r;let n=(r=this.states[e])===null||r===void 0?void 0:r.majorStateId;if(!n)return e;let s=e,i=e+1;for(;this.states.length>i&&!this.isDifferentMajorState(i,n);)this.hasState(i)&&(s=i),i++;return s}buildCurrentState(){var e,r;return{...this.history.state,index:this.currentIndex,href:this.windowLocation().href,title:(r=(e=this.history.state)===null||e===void 0?void 0:e.title)!==null&&r!==void 0?r:document.title}}hasState(e){return this.states[e]!=null}isDifferentMajorState(e,r){var n;if(!this.hasState(e))return!1;let s=r??this.currentState.majorStateId,i=(n=this.states[e])===null||n===void 0?void 0:n.majorStateId;return i==null||i!=s}};window.FluidTopicsInternalHistoryService==null&&(window.FluidTopicsInternalHistoryService=Ut.build(),window.FluidTopicsHistoryService={currentItem:()=>window.FluidTopicsInternalHistoryService.currentItem(),back:()=>window.FluidTopicsInternalHistoryService.back(),forward:()=>window.FluidTopicsInternalHistoryService.forward(),backwardItem:()=>window.FluidTopicsInternalHistoryService.backwardItem(),forwardItem:()=>window.FluidTopicsInternalHistoryService.forwardItem(),backwardItemMatching:t=>window.FluidTopicsInternalHistoryService.backwardItemMatching(t),addHistoryChangeListener:t=>window.FluidTopicsInternalHistoryService.addHistoryChangeListener(t),removeHistoryChangeListener:t=>window.FluidTopicsInternalHistoryService.removeHistoryChangeListener(t),addBeforeLocationChangeListener:t=>window.FluidTopicsInternalHistoryService.addBeforeLocationChangeListener(t),removeBeforeLocationChangeListener:t=>window.FluidTopicsInternalHistoryService.removeBeforeLocationChangeListener(t)});var Fs=f(le());var Us=Fs.css`
|
|
2
|
-
`;var
|
|
1
|
+
"use strict";(()=>{var ai=Object.create;var $r=Object.defineProperty;var oi=Object.getOwnPropertyDescriptor;var ci=Object.getOwnPropertyNames;var li=Object.getPrototypeOf,ui=Object.prototype.hasOwnProperty;var ar=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}};var di=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ci(e))!ui.call(t,s)&&s!==r&&$r(t,s,{get:()=>e[s],enumerable:!(n=oi(e,s))||n.enumerable});return t};var f=(t,e,r)=>(r=t!=null?ai(li(t)):{},di(e||!t||!t.__esModule?$r(r,"default",{value:t,enumerable:!0}):r,t));var T=ar((wa,zr)=>{zr.exports=ftGlobals.wcUtils});var le=ar((xa,Gr)=>{Gr.exports=ftGlobals.lit});var ie=ar((Ia,Wr)=>{Wr.exports=ftGlobals.litDecorators});var ni=f(T());var Je=f(le()),se=f(ie()),R=f(T());var fe;(function(t){t.clusteringHelperCreated="clustering-helper-created",t.mapAttachmentsUpdate="map-attachments-update",t.visibleTopicChange="visible-topic-change",t.requestedTopicNotFound="requested-topic-not-found",t.requestedTopicFiltered="requested-topic-filtered"})(fe||(fe={}));var Ze=class extends CustomEvent{constructor(e){super(fe.requestedTopicFiltered,{detail:e})}},ae;(function(t){t.FEEDBACK="FEEDBACK",t.RATING="RATING",t.PRINT="PRINT",t.BOOKMARK="BOOKMARK",t.COLLECTIONS="COLLECTIONS",t.PERSONAL_BOOKS="PERSONAL_BOOKS"})(ae||(ae={}));var k=f(T());var Qr=f(T()),hi={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]}},Yr=t=>Qr.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:[],applyStickyFilters:!1},reducers:hi});var or=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,n){return e.flatMap(s=>{var i;return s.pageConfiguration&&this.registerPage(this.buildPage(s,n)),s.tocId==null?this.extractPagesToc(s.children,r,n):[{tocId:s.tocId,title:(i=s.title)!==null&&i!==void 0?i:"",contentTag:s.contentTag,contentClass:s.contentClass,untranslatedTitle:s.untranslatedTitle,depth:r,children:this.extractPagesToc(s.children,r+1,s.tocId)}]})}convertNodes(e,r,n){return e.flatMap(s=>{var i,a,o;if(s.tocId==null)return[...this.convertSectionNodes((a=s.pageToc)!==null&&a!==void 0?a:[],r,s.tocId),...this.convertNodes(s.children,r,s.tocId)];let c=(i=s.prettyUrl)===null||i===void 0?void 0:i.replace(/^\//,""),l={tocId:s.tocId,contentId:s.contentId,title:s.title,contentTag:s.contentTag,contentClass:s.contentClass,untranslatedTitle:s.untranslatedTitle,hasRating:s.hasRating,origin:s.origin,prettyUrl:c,depth:r,parentTocId:n,children:[]};this.register(l);let u=this.convertSectionNodes((o=s.pageToc)!==null&&o!==void 0?o:[],r+1,s.tocId),h=this.convertNodes(s.children,r+1,l.tocId);return l.children=[...u,...h],[l]})}convertSectionNodes(e,r,n){return e.flatMap(s=>{var i;let a=(i=s.prettyUrl)===null||i===void 0?void 0:i.replace(/^\//,""),o={...s,prettyUrl:a,depth:r,parentTocId:n,children:[]};return this.register(o),o.children=this.convertSectionNodes(s.children,r+1,s.tocId),[o]})}buildPage(e,r){var n,s,i,a,o,c,l,u;let h=(a=e.tocId)!==null&&a!==void 0?a:(s=(n=e.pageToc)===null||n===void 0?void 0:n[0])===null||s===void 0?void 0:s.tocId,p={number:this.pages.length+1,title:(o=e.title)!==null&&o!==void 0?o:"",untranslatedTitle:e.untranslatedTitle,rootTocId:h??"root",toc:((c=e.pageToc)!==null&&c!==void 0?c:[]).map(m=>this.nodeByTocId[m.tocId]),topics:[],hiddenTopics:[],rootDepth:h?this.nodeByTocId[h].depth:1,breadcrumb:r?this.buildBreadcrumb(this.nodeByTocId[r]):[]},v=(m,I)=>(I?p.topics:p.hiddenTopics).push(m),S=(l=(i=e.pageConfiguration)===null||i===void 0?void 0:i.parentsVisibility)!==null&&l!==void 0?l:[];p.breadcrumb.forEach((m,I)=>{v(m,S[I])}),e.tocId&&v(e.tocId,e.pageConfiguration.isVisible),p.topics.push(...this.tocIds((u=e.pageToc)!==null&&u!==void 0?u:[]));let _=this.resolveOverridenRootTocIdByParentForcedByPagination(p.breadcrumb,S);return p.rootTocId=_??p.rootTocId,p.rootDepth=_?this.nodeByTocId[_].depth:p.rootDepth,p}resolveOverridenRootTocIdByParentForcedByPagination(e,r){for(let n=0;n<e.length;n++)if(r[n])return e[n]}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}},et=class{convertPaginatedToc(e,r){return new or(e,r).build()}};var Xr;(function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"})(Xr||(Xr={}));var Jr;(function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"})(Jr||(Jr={}));var Zr;(function(t){t.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",t.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",t.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",t.PERSONAL_BOOK="PERSONAL_BOOK",t.ATTACHMENT="ATTACHMENT",t.RESOURCE="RESOURCE",t.HTML_PACKAGE="HTML_PACKAGE"})(Zr||(Zr={}));var ue;(function(t){t.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",t.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",t.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",t.PERSONAL_BOOK="PERSONAL_BOOK",t.ATTACHMENT="ATTACHMENT",t.RESOURCE="RESOURCE",t.HTML_PACKAGE="HTML_PACKAGE"})(ue||(ue={}));var en;(function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR"})(en||(en={}));var tn;(function(t){t.VALUE="VALUE",t.DATE="DATE",t.RANGE="RANGE"})(tn||(tn={}));var tt;(function(t){t.PUBLISHED="PUBLISHED",t.AI="AI"})(tt||(tt={}));var me;(function(t){t.BOOKMARK__CREATE="BOOKMARK__CREATE",t.BOOKMARK__DELETE="BOOKMARK__DELETE",t.CASE_DEFLECTION__START="CASE_DEFLECTION__START",t.CASE_DEFLECTION__OPEN_TICKET="CASE_DEFLECTION__OPEN_TICKET",t.CASE_DEFLECTION__RATE="CASE_DEFLECTION__RATE",t.CHATBOT__RATE="CHATBOT__RATE",t.COLLECTION__CREATE="COLLECTION__CREATE",t.COLLECTION__UPDATE="COLLECTION__UPDATE",t.COLLECTION__DELETE="COLLECTION__DELETE",t.CUSTOM_EVENT__TRIGGER="CUSTOM_EVENT__TRIGGER",t.DOCUMENT__ON_DEMAND_TRANSLATE="DOCUMENT__ON_DEMAND_TRANSLATE",t.DOCUMENT__DOWNLOAD="DOCUMENT__DOWNLOAD",t.DOCUMENT__PRINT="DOCUMENT__PRINT",t.DOCUMENT__PROCESS="DOCUMENT__PROCESS",t.DOCUMENT__RATE="DOCUMENT__RATE",t.DOCUMENT__SEARCH="DOCUMENT__SEARCH",t.DOCUMENT__START_DISPLAY="DOCUMENT__START_DISPLAY",t.DOCUMENT__UNRATE="DOCUMENT__UNRATE",t.FEEDBACK__SEND="FEEDBACK__SEND",t.AI__COMPLETED_QUERY="AI__COMPLETED_QUERY",t.AI__RATE="AI__RATE",t.AI_CASE_DEFLECTION__START="AI_CASE_DEFLECTION__START",t.AI_CASE_DEFLECTION__OPEN_TICKET="AI_CASE_DEFLECTION__OPEN_TICKET",t.KHUB__PROCESS="KHUB__PROCESS",t.KHUB__SEARCH="KHUB__SEARCH",t.LABELS__DOWNLOAD="LABELS__DOWNLOAD",t.LINK__SHARE="LINK__SHARE",t.PAGE__DISPLAY="PAGE__DISPLAY",t.PERSONAL_BOOK__CREATE="PERSONAL_BOOK__CREATE",t.PERSONAL_BOOK__DELETE="PERSONAL_BOOK__DELETE",t.PERSONAL_BOOK__UPDATE="PERSONAL_BOOK__UPDATE",t.PERSONAL_TOPIC__CREATE="PERSONAL_TOPIC__CREATE",t.PERSONAL_TOPIC__UPDATE="PERSONAL_TOPIC__UPDATE",t.PERSONAL_TOPIC__DELETE="PERSONAL_TOPIC__DELETE",t.SAVED_SEARCH__CREATE="SAVED_SEARCH__CREATE",t.SAVED_SEARCH__DELETE="SAVED_SEARCH__DELETE",t.SAVED_SEARCH__UPDATE="SAVED_SEARCH__UPDATE",t.SEARCH_PAGE__SELECT="SEARCH_PAGE__SELECT",t.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU="SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU",t.TOPIC__AI_TRANSLATE="TOPIC__AI_TRANSLATE",t.TOPIC__RATE="TOPIC__RATE",t.TOPIC__START_DISPLAY="TOPIC__START_DISPLAY",t.TOPIC__UNRATE="TOPIC__UNRATE",t.USER__LOGIN="USER__LOGIN",t.USER__LOGOUT="USER__LOGOUT",t.HEARTBEAT="HEARTBEAT"})(me||(me={}));var rn;(function(t){t.STANDARD="STANDARD",t.STRUCTURAL="STRUCTURAL"})(rn||(rn={}));var nn;(function(t){t.METADATA_FILTER="METADATA_FILTER",t.ACCESS_RIGHTS_FILTER="ACCESS_RIGHTS_FILTER"})(nn||(nn={}));var sn;(function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER",t.DOC_DIFF="DOC_DIFF"})(sn||(sn={}));var an;(function(t){t.HOMEPAGE="HOMEPAGE",t.CUSTOM="CUSTOM",t.HEADER="HEADER",t.READER="READER",t.TOPIC_TEMPLATE="TOPIC_TEMPLATE",t.SEARCH="SEARCH",t.SEARCH_RESULT="SEARCH_RESULT",t.SEARCH_ANNOUNCEMENT="SEARCH_ANNOUNCEMENT",t.LINK_PREVIEW="LINK_PREVIEW",t.UD_VIEWER="UD_VIEWER",t.ASSET_VIEWER="ASSET_VIEWER"})(an||(an={}));var on;(function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"})(on||(on={}));var cn;(function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"})(cn||(cn={}));var ln;(function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"})(ln||(ln={}));var un;(function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"})(un||(un={}));var dn;(function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"})(dn||(dn={}));var rt;(function(t){t.OPTIONAL="OPTIONAL",t.MANDATORY="MANDATORY"})(rt||(rt={}));var hn;(function(t){t.ASC="ASC",t.DESC="DESC"})(hn||(hn={}));var pn;(function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"})(pn||(pn={}));var _e;(function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"})(_e||(_e={}));var fn;(function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK",t.HTML_PACKAGE="HTML_PACKAGE"})(fn||(fn={}));var mn;(function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"})(mn||(mn={}));var gn;(function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK",t.HTML_PACKAGE="HTML_PACKAGE"})(gn||(gn={}));var yn;(function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR"})(yn||(yn={}));var J;(function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.HTML_PACKAGE="HTML_PACKAGE",t.HTML_PACKAGE_PAGE="HTML_PACKAGE_PAGE"})(J||(J={}));var Ce;(function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS",t.TOPICS_AND_UNSTRUCTURED_DOCUMENTS="TOPICS_AND_UNSTRUCTURED_DOCUMENTS"})(Ce||(Ce={}));var vn;(function(t){t.PLAIN_TEXT="PLAIN_TEXT",t.LOCALIZED_OFFICIAL="LOCALIZED_OFFICIAL",t.LOCALIZED_CUSTOM="LOCALIZED_CUSTOM"})(vn||(vn={}));var A;(function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.GENERATIVE_AI_USER="GENERATIVE_AI_USER",t.GENERATIVE_AI_EXPORT_USER="GENERATIVE_AI_EXPORT_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.BEHAVIOR_DATA_USER="BEHAVIOR_DATA_USER",t.ANNOUNCEMENT_ADMIN="ANNOUNCEMENT_ADMIN",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN"})(A||(A={}));var W;(function(t){t.SEARCHES="SEARCHES",t.BOOKMARKS="BOOKMARKS",t.BOOKS="BOOKS",t.COLLECTIONS="COLLECTIONS"})(W||(W={}));var En;(function(t){t.UNAUTHENTICATED="UNAUTHENTICATED",t.USER_INCOMPLETE="USER_INCOMPLETE",t.MFA_REQUIRED="MFA_REQUIRED",t.AUTHENTICATED="AUTHENTICATED"})(En||(En={}));var Sn;(function(t){t.UNREACHABLE="UNREACHABLE",t.UNAUTHORIZED="UNAUTHORIZED",t.FORBIDDEN="FORBIDDEN",t.INCOMPATIBLE="INCOMPATIBLE",t.FAILED="FAILED",t.OK="OK"})(Sn||(Sn={}));var An;(function(t){t.VALID="VALID",t.INVALID="INVALID"})(An||(An={}));var Tn;(function(t){t.JSON="JSON",t.TEXT="TEXT"})(Tn||(Tn={}));var bn;(function(t){t.JSON="JSON",t.TEXT="TEXT"})(bn||(bn={}));var _n;(function(t){t.INACCURATE="INACCURATE",t.INCOMPLETE="INCOMPLETE",t.OFF_TOPIC="OFF_TOPIC",t.SEMANTIC_SEARCH="SEMANTIC_SEARCH",t.CHATBOT_INSTRUCTIONS="CHATBOT_INSTRUCTIONS",t.DOCUMENTATION="DOCUMENTATION",t.OTHER="OTHER"})(_n||(_n={}));var Cn;(function(t){t.INACCURATE="INACCURATE",t.INCOMPLETE="INCOMPLETE",t.OFF_TOPIC="OFF_TOPIC",t.IRRELEVANT_SOURCES="IRRELEVANT_SOURCES",t.SLOW="SLOW",t.OTHER="OTHER"})(Cn||(Cn={}));var wn;(function(t){t.CHAT="CHAT",t.COMPLETION="COMPLETION",t.RAG="RAG",t.AGENT="AGENT"})(wn||(wn={}));var xn;(function(t){t.TEXT="TEXT",t.HTML="HTML"})(xn||(xn={}));var In;(function(t){t.IN_PROGRESS="IN_PROGRESS",t.ERROR="ERROR",t.DONE="DONE"})(In||(In={}));var Rn;(function(t){t.HTML="HTML",t.MARKDOWN="MARKDOWN"})(Rn||(Rn={}));var On;(function(t){t.SOURCES="SOURCES",t.ENRICH_AND_CLEAN="ENRICH_AND_CLEAN",t.VOCABULARIES="VOCABULARIES",t.METADATA="METADATA",t.PRETTY_URL="PRETTY_URL",t.ACCESS_RULE="ACCESS_RULE",t.DESIGNED_PAGES="DESIGNED_PAGES",t.THEME_STUDIO="THEME_STUDIO",t.PORTAL_GENERAL="PORTAL_GENERAL",t.ASSETS="ASSETS",t.CODE_LIBRARY="CODE_LIBRARY",t.THEME="THEME",t.CONTENT_STYLES="CONTENT_STYLES",t.HOMEPAGE="HOMEPAGE",t.CLASSIC_SEARCH_PAGE="CLASSIC_SEARCH_PAGE",t.CLASSIC_READER_PAGE="CLASSIC_READER_PAGE",t.PORTAL_METADATA="PORTAL_METADATA",t.LANGUAGES="LANGUAGES",t.PRINT_TEMPLATES="PRINT_TEMPLATES",t.OFFLINE="OFFLINE",t.CUSTOM_JS="CUSTOM_JS",t.CONFIDENTIALITY="CONFIDENTIALITY",t.NOTIFICATIONS="NOTIFICATIONS"})(On||(On={}));var kn;(function(t){t.MAP="MAP",t.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT"})(kn||(kn={}));var pi={[A.PERSONAL_BOOK_SHARE_USER]:[A.PERSONAL_BOOK_USER],[A.HTML_EXPORT_USER]:[A.PERSONAL_BOOK_USER],[A.PDF_EXPORT_USER]:[A.PERSONAL_BOOK_USER],[A.KHUB_ADMIN]:[A.CONTENT_PUBLISHER],[A.ADMIN]:[A.KHUB_ADMIN,A.USERS_ADMIN,A.PORTAL_ADMIN,A.BEHAVIOR_DATA_USER],[A.GENERATIVE_AI_EXPORT_USER]:[A.GENERATIVE_AI_USER]};function Mn(t,e){return t===e||(pi[t]??[]).some(r=>Mn(r,e))}function Q(t,e){return t==null?!1:(Array.isArray(t)?t:Array.isArray(t.roles)?t.roles:Array.isArray(t.profile?.roles)?t.profile.roles:[]).some(n=>Mn(n,e))}function Nn(t,...e){return t==null?!1:e.some(r=>Q(t,r))}var Rr=f(ie());var Dn=f(ie(),1);var cr=t=>e=>{window.customElements.get(t)||window.customElements.define(t,e)},fi=t=>({fromAttribute:e=>{if(e==null)return De(t);try{return JSON.parse(e)}catch{return De(t)}},toAttribute:e=>JSON.stringify(e)});function Fn(t,e){return(0,Dn.property)({type:Object,converter:fi(t),hasChanged:Fe,...e??{}})}function mi(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let r,n;if(Array.isArray(t)){if(r=t.length,r!=e.length)return!1;for(n=r;n--!==0;)if(!we(t[n],e[n]))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(n of t.entries())if(!e.has(n[0]))return!1;for(n of t.entries())if(!we(n[1],e.get(n[0])))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(n of t.entries())if(!e.has(n[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();let s=a=>Object.keys(a).filter(o=>a[o]!=null),i=s(t);if(r=i.length,r!==s(e).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[n]))return!1;for(n=r;n--!==0;){let a=i[n];if(!we(t[a],e[a]))return!1}return!0}return t!==t&&e!==e||t==null&&e==null}function we(t,e){try{return mi(t,e)}catch{return!1}}function Fe(t,e){return!we(t,e)}function De(t){return typeof window.structuredClone=="function"?structuredClone(t):t!=null?JSON.parse(JSON.stringify(t)):t}function nt(t,e){let r=n=>n[t]===!0;return n=>{if(r(n))return n;let s=e(n);return s[t]=!0,s}}var Pn=f(ie(),1);var lr=t=>{let e=t??{};return(r,n)=>{var s;let i={hasChanged:Fe,attribute:!1,...e};(0,Pn.property)(i)(r,n);let a=r.constructor;a.reduxProperties=new Map(a.reduxProperties),a.reduxProperties.set(n,{selector:(s=e.selector)!==null&&s!==void 0?s:(o=>o[n]),store:e.store})}};var st=class{constructor(){this.queue=[]}add(e,r=!1){r&&this.clear(e.type),this.queue.push(e)}consume(e){let r=this.queue.find(n=>n.type===e);return r&&(this.queue=this.queue.filter(n=>n!==r)),r}clear(e){typeof e=="string"?this.queue=this.queue.filter(r=>r.type!==e):this.queue=this.queue.filter(r=>!e.test(r.type))}};var ge=f(ie(),1);var it=class{constructor(e=0){this.timeout=e,this.callbacks=[]}run(e,r){return this.callbacks=[e],this.debounce(r)}queue(e,r){return this.callbacks.push(e),this.debounce(r)}cancel(){this.clearTimeout(),this.resolvePromise&&this.resolvePromise(!1),this.clearPromise()}debounce(e){return this.promise==null&&(this.promise=new Promise((r,n)=>{this.resolvePromise=r,this.rejectPromise=n})),this.clearTimeout(),this._debounce=window.setTimeout(()=>this.runCallbacks(),e??this.timeout),this.promise}async runCallbacks(){var e,r;let n=[...this.callbacks];this.callbacks=[];let s=(e=this.rejectPromise)!==null&&e!==void 0?e:(()=>null),i=(r=this.resolvePromise)!==null&&r!==void 0?r:(()=>null);this.clearPromise();for(let a of n)try{await a()}catch(o){s(o);return}i(!0)}clearTimeout(){this._debounce!=null&&window.clearTimeout(this._debounce)}clearPromise(){this.promise=void 0,this.resolvePromise=void 0,this.rejectPromise=void 0}};var ot=f(le(),1);var at=class extends ot.LitElement{get scopedRegistryConstructor(){return this.constructor}createRenderRoot(){let e=this.scopedRegistryConstructor;e.elementDefinitions&&!e.registry&&(e.registry=new CustomElementRegistry,e.defineScopedElements(e.elementDefinitions));let r={...e.shadowRootOptions,customElements:e.registry},n=this.renderOptions.creationScope=this.attachShadow(r);return(0,ot.adoptStyles)(n,e.elementStyles),n}static canDefineScopedElement(e){return!!this.registry&&!this.registry.get(e)}static defineScopedElements(e){Object.entries(e).forEach(([r,n])=>this.defineScopedElement(r,n))}static defineScopedElement(e,r){cr(e)(r),this.canDefineScopedElement(e)&&this.registry.define(e,r)}canDefineScopedElement(e){return this.scopedRegistryConstructor.canDefineScopedElement(e)}defineScopedElements(e){this.scopedRegistryConstructor.defineScopedElements(e)}defineScopedElement(e,r){this.scopedRegistryConstructor.defineScopedElement(e,r)}};function Ln(t,e,...r){var n;let s=t.querySelector(e);for(let i of r)s=(n=s?.shadowRoot)===null||n===void 0?void 0:n.querySelector(i);return s}var Ie=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},qn,Un=Symbol("constructorPrototype"),Bn=Symbol("constructorName"),jn=Symbol("exportpartsDebouncer"),Vn=Symbol("dynamicDependenciesLoaded"),xe=class t extends CustomEvent{constructor(){super(t.eventName,{bubbles:!0})}};xe.eventName="exportparts-updated";var Z=class extends at{constructor(){super(),this.useAdoptedStyleSheets=!0,this.adoptedCustomStyleSheet=new CSSStyleSheet,this[qn]=new it(5),this.scheduleExportpartsUpdate=()=>{var e,r,n;(!((e=this.exportpartsPrefix)===null||e===void 0)&&e.trim()||(n=(r=this.exportpartsPrefixes)===null||r===void 0?void 0:r.length)!==null&&n!==void 0&&n)&&this[jn].run(()=>{var s,i;!((s=this.exportpartsPrefix)===null||s===void 0)&&s.trim()?this.setExportpartsAttribute([this.exportpartsPrefix]):this.exportpartsPrefixes!=null&&((i=this.exportpartsPrefixes)===null||i===void 0?void 0:i.length)>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)})},this[Bn]=this.constructor.name,this[Un]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[Bn]&&Object.setPrototypeOf(this,this[Un])}connectedCallback(){var e;super.connectedCallback();try{this.shadowRoot&&!this.shadowRoot.adoptedStyleSheets.includes(this.adoptedCustomStyleSheet)&&(this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,this.adoptedCustomStyleSheet]),this.useAdoptedStyleSheets=!0}catch(n){this.useAdoptedStyleSheets=!1,console.error("Cannot use adopted stylesheets",n)}let r=this.constructor;r[Vn]||(r[Vn]=!0,this.importDynamicDependencies()),(e=this.shadowRoot)===null||e===void 0||e.addEventListener(xe.eventName,this.scheduleExportpartsUpdate)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.shadowRoot)===null||e===void 0||e.removeEventListener(xe.eventName,this.scheduleExportpartsUpdate)}importDynamicDependencies(){}updated(e){super.updated(e),this.updateComplete.then(()=>{this.contentAvailableCallback(e),this.focusElementToFocus(e),this.applyCustomStylesheet(e),this.scheduleExportpartsUpdate(),e.has("exportparts")&&this.dispatchEvent(new xe)})}contentAvailableCallback(e){}focusElementToFocus(e){if(e.has("elementToFocus")&&this.elementToFocus!=null){let{element:r,selector:n,shadowPath:s}=this.elementToFocus;if(n!=null){let i=[...s??[],n];r=Ln(this.shadowRoot,...i)}r?.focus(),window.FluidTopicsA11yHints.isKeyboardNavigation||r?.blur(),this.elementToFocus=void 0}}applyCustomStylesheet(e){var r,n,s;if(((n=(r=this.shadowRoot)===null||r===void 0?void 0:r.querySelectorAll(".ft-lit-element--custom-stylesheet"))!==null&&n!==void 0?n:[]).forEach(i=>i.remove()),this.useAdoptedStyleSheets){if(e.has("customStylesheet"))try{this.adoptedCustomStyleSheet.replaceSync((s=this.customStylesheet)!==null&&s!==void 0?s:"")}catch(i){console.error(i,this.customStylesheet),this.useAdoptedStyleSheets=!1}}else if(this.customStylesheet){let i=document.createElement("style");i.classList.add("ft-lit-element--custom-stylesheet"),i.innerHTML=this.customStylesheet,this.shadowRoot.append(i)}}setExportpartsAttribute(e){var r,n,s,i,a,o;let c=p=>p!=null&&p.trim().length>0,l=e.filter(c).map(p=>p.trim());if(l.length===0){this.exportparts=void 0;return}let u=new Set;for(let p of(i=(r=this.shadowRoot)===null||r===void 0?void 0:r.querySelectorAll("[part],[exportparts]"))!==null&&i!==void 0?i:[]){let v=(a=(n=p.getAttribute("part"))===null||n===void 0?void 0:n.split(" "))!==null&&a!==void 0?a:[],S=(o=(s=p.getAttribute("exportparts"))===null||s===void 0?void 0:s.split(",").map(m=>m.split(":")[1]))!==null&&o!==void 0?o:[],_=[...v,...S].filter(c).map(m=>m.trim());for(let m of _)u.add(m)}if(u.size===0){this.exportparts=void 0;return}let h=[...u.values()].flatMap(p=>l.map(v=>`${p}:${v}--${p}`));this.exportparts=[...this.part,...h].join(", ")}};qn=jn;Ie([(0,ge.property)()],Z.prototype,"exportpartsPrefix",void 0);Ie([Fn([])],Z.prototype,"exportpartsPrefixes",void 0);Ie([(0,ge.property)({reflect:!0})],Z.prototype,"exportparts",void 0);Ie([(0,ge.property)()],Z.prototype,"customStylesheet",void 0);Ie([(0,ge.property)()],Z.prototype,"elementToFocus",void 0);Ie([(0,ge.state)()],Z.prototype,"useAdoptedStyleSheets",void 0);function ct(t){var e;return(e=t?.isFtReduxStore)!==null&&e!==void 0?e:!1}var Pe=Symbol("internalReduxEventsUnsubscribers"),de=Symbol("internalStoresUnsubscribers"),ye=Symbol("internalStores"),gi=nt(Symbol("withRedux"),function(t){var e,r,n;class s extends t{constructor(){super(...arguments),this[e]=new Map,this[r]=new Map,this[n]=new Map}get reduxConstructor(){return this.constructor}willUpdate(a){super.willUpdate(a),[...this.reduxConstructor.reduxReactiveProperties].some(o=>a.has(o))&&this.updateFromStores()}getUnnamedStore(){if(this[ye].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[ye].values()][0]}getStore(a){return a==null?this.getUnnamedStore():this[ye].get(a)}addStore(a,o){var c;o=(c=o??a.name)!==null&&c!==void 0?c:"default-store",this.unsubscribeFromStore(o),this[ye].set(o,a),this.subscribeToStore(o,a),this.updateFromStores()}removeStore(a){let o=typeof a=="string"?a:a.name;this.unsubscribeFromStore(o),this[ye].delete(o)}setupStores(){this.unsubscribeFromStores(),this[ye].forEach((a,o)=>this.subscribeToStore(o,a)),this.updateFromStores()}updateFromStores(){this.reduxConstructor.reduxProperties.forEach((a,o)=>{let c=this.constructor.getPropertyOptions(o);if(!c?.attribute||!this.hasAttribute(typeof c?.attribute=="string"?c.attribute:o)){let l=this.getStore(a.store);l&&(a.store?this[de].has(a.store):this[de].size>0)&&(this[o]=a.selector(l.getState(),this))}})}subscribeToStore(a,o){var c,l;this[de].set(a,o.subscribe(()=>this.updateFromStores())),this[Pe].set(a,[]),ct(o)&&(!((c=o.deprecatedKeys)===null||c===void 0)&&c.length&&this.reduxConstructor.reduxProperties.forEach((u,h)=>{this.getStore(u.store)===o&&o.deprecatedKeys.includes(h)&&console.warn("Element",this,"is subscribed to deprecated key",h,"in store",o.name)}),o.eventBus&&((l=this.reduxConstructor.reduxEventListeners)===null||l===void 0||l.forEach((u,h)=>{if(typeof this[h]=="function"&&(!u.store||o.name===u.store)){let p=v=>this[h](v);o.addEventListener(u.eventName,p),this[Pe].get(a).push(()=>o.removeEventListener(u.eventName,p))}}))),this.onStoreAvailable(a)}unsubscribeFromStores(){this[de].forEach((a,o)=>this.unsubscribeFromStore(o))}unsubscribeFromStore(a){var o;this[de].has(a)&&this[de].get(a)(),this[de].delete(a),(o=this[Pe].get(a))===null||o===void 0||o.forEach(c=>c()),this[Pe].delete(a)}onStoreAvailable(a){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}return e=de,r=ye,n=Pe,s.reduxProperties=new Map,s.reduxReactiveProperties=new Set,s.reduxEventListeners=new Map,s}),Hn=class extends gi(Z){};function F(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var yi=typeof Symbol=="function"&&Symbol.observable||"@@observable",Kn=yi,ur=()=>Math.random().toString(36).substring(7).split("").join("."),vi={INIT:`@@redux/INIT${ur()}`,REPLACE:`@@redux/REPLACE${ur()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ur()}`},lt=vi;function ut(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function dr(t,e,r){if(typeof t!="function")throw new Error(F(2));if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(F(0));if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(F(1));return r(dr)(t,e)}let n=t,s=e,i=new Map,a=i,o=0,c=!1;function l(){a===i&&(a=new Map,i.forEach((m,I)=>{a.set(I,m)}))}function u(){if(c)throw new Error(F(3));return s}function h(m){if(typeof m!="function")throw new Error(F(4));if(c)throw new Error(F(5));let I=!0;l();let H=o++;return a.set(H,m),function(){if(I){if(c)throw new Error(F(6));I=!1,l(),a.delete(H),i=null}}}function p(m){if(!ut(m))throw new Error(F(7));if(typeof m.type>"u")throw new Error(F(8));if(typeof m.type!="string")throw new Error(F(17));if(c)throw new Error(F(9));try{c=!0,s=n(s,m)}finally{c=!1}return(i=a).forEach(H=>{H()}),m}function v(m){if(typeof m!="function")throw new Error(F(10));n=m,p({type:lt.REPLACE})}function S(){let m=h;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(F(11));function H(){let y=I;y.next&&y.next(u())}return H(),{unsubscribe:m(H)}},[Kn](){return this}}}return p({type:lt.INIT}),{dispatch:p,subscribe:h,getState:u,replaceReducer:v,[Kn]:S}}function Ei(t){Object.keys(t).forEach(e=>{let r=t[e];if(typeof r(void 0,{type:lt.INIT})>"u")throw new Error(F(12));if(typeof r(void 0,{type:lt.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(F(13))})}function hr(t){let e=Object.keys(t),r={};for(let a=0;a<e.length;a++){let o=e[a];typeof t[o]=="function"&&(r[o]=t[o])}let n=Object.keys(r),s,i;try{Ei(r)}catch(a){i=a}return function(o={},c){if(i)throw i;let l=!1,u={};for(let h=0;h<n.length;h++){let p=n[h],v=r[p],S=o[p],_=v(S,c);if(typeof _>"u"){let m=c&&c.type;throw new Error(F(14))}u[p]=_,l=l||_!==S}return l=l||n.length!==Object.keys(o).length,l?u:o}}function Le(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,r)=>(...n)=>e(r(...n)))}function $n(...t){return e=>(r,n)=>{let s=e(r,n),i=()=>{throw new Error(F(15))},a={getState:s.getState,dispatch:(c,...l)=>i(c,...l)},o=t.map(c=>c(a));return i=Le(...o)(s.dispatch),{...s,dispatch:i}}}function zn(t){return ut(t)&&"type"in t&&typeof t.type=="string"}var ts=Symbol.for("immer-nothing"),Gn=Symbol.for("immer-draftable"),U=Symbol.for("immer-state");function X(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var K=Object,Oe=K.getPrototypeOf,ft="constructor",St="prototype",gr="configurable",mt="enumerable",ht="writable",Ue="value",ee=t=>!!t&&!!t[U];function $(t){return t?rs(t)||Tt(t)||!!t[Gn]||!!t[ft]?.[Gn]||bt(t)||je(t):!1}var Si=K[St][ft].toString(),Wn=new WeakMap;function rs(t){if(!t||!_r(t))return!1;let e=Oe(t);if(e===null||e===K[St])return!0;let r=K.hasOwnProperty.call(e,ft)&&e[ft];if(r===Object)return!0;if(!Re(r))return!1;let n=Wn.get(r);return n===void 0&&(n=Function.toString.call(r),Wn.set(r,n)),n===Si}function At(t,e,r=!0){qe(t)===0?(r?Reflect.ownKeys(t):K.keys(t)).forEach(s=>{e(s,t[s],t)}):t.forEach((n,s)=>e(s,n,t))}function qe(t){let e=t[U];return e?e.type_:Tt(t)?1:bt(t)?2:je(t)?3:0}var pr=(t,e,r=qe(t))=>r===2?t.has(e):K[St].hasOwnProperty.call(t,e),yr=(t,e,r=qe(t))=>r===2?t.get(e):t[e],gt=(t,e,r,n=qe(t))=>{n===2?t.set(e,r):n===3?t.add(r):t[e]=r};function Ai(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var Tt=Array.isArray,bt=t=>t instanceof Map,je=t=>t instanceof Set,_r=t=>typeof t=="object",Re=t=>typeof t=="function",fr=t=>typeof t=="boolean";function Ti(t){let e=+t;return Number.isInteger(e)&&String(e)===t}var oe=t=>t.copy_||t.base_;var Cr=t=>t.modified_?t.copy_:t.base_;function vr(t,e){if(bt(t))return new Map(t);if(je(t))return new Set(t);if(Tt(t))return Array[St].slice.call(t);let r=rs(t);if(e===!0||e==="class_only"&&!r){let n=K.getOwnPropertyDescriptors(t);delete n[U];let s=Reflect.ownKeys(n);for(let i=0;i<s.length;i++){let a=s[i],o=n[a];o[ht]===!1&&(o[ht]=!0,o[gr]=!0),(o.get||o.set)&&(n[a]={[gr]:!0,[ht]:!0,[mt]:o[mt],[Ue]:t[a]})}return K.create(Oe(t),n)}else{let n=Oe(t);if(n!==null&&r)return{...t};let s=K.create(n);return K.assign(s,t)}}function _t(t,e=!1){return Ct(t)||ee(t)||!$(t)||(qe(t)>1&&K.defineProperties(t,{set:dt,add:dt,clear:dt,delete:dt}),K.freeze(t),e&&At(t,(r,n)=>{_t(n,!0)},!1)),t}function bi(){X(2)}var dt={[Ue]:bi};function Ct(t){return t===null||!_r(t)?!0:K.isFrozen(t)}var yt="MapSet",Er="Patches",Qn="ArrayMethods",ns={};function ve(t){let e=ns[t];return e||X(0,t),e}var Yn=t=>!!ns[t];var Be,ss=()=>Be,_i=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Yn(yt)?ve(yt):void 0,arrayMethodsPlugin_:Yn(Qn)?ve(Qn):void 0});function Xn(t,e){e&&(t.patchPlugin_=ve(Er),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Sr(t){Ar(t),t.drafts_.forEach(Ci),t.drafts_=null}function Ar(t){t===Be&&(Be=t.parent_)}var Jn=t=>Be=_i(Be,t);function Ci(t){let e=t[U];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function Zn(t,e){e.unfinalizedDrafts_=e.drafts_.length;let r=e.drafts_[0];if(t!==void 0&&t!==r){r[U].modified_&&(Sr(e),X(4)),$(t)&&(t=es(e,t));let{patchPlugin_:s}=e;s&&s.generateReplacementPatches_(r[U].base_,t,e)}else t=es(e,r);return wi(e,t,!0),Sr(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==ts?t:void 0}function es(t,e){if(Ct(e))return e;let r=e[U];if(!r)return vt(e,t.handledSet_,t);if(!wt(r,t))return e;if(!r.modified_)return r.base_;if(!r.finalized_){let{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(t);os(r,t)}return r.copy_}function wi(t,e,r=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&_t(e,r)}function is(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var wt=(t,e)=>t.scope_===e,xi=[];function as(t,e,r,n){let s=oe(t),i=t.type_;if(n!==void 0&&yr(s,n,i)===e){gt(s,n,r,i);return}if(!t.draftLocations_){let o=t.draftLocations_=new Map;At(s,(c,l)=>{if(ee(l)){let u=o.get(l)||[];u.push(c),o.set(l,u)}})}let a=t.draftLocations_.get(e)??xi;for(let o of a)gt(s,o,r,i)}function Ii(t,e,r){t.callbacks_.push(function(s){let i=e;if(!i||!wt(i,s))return;s.mapSetPlugin_?.fixSetContents(i);let a=Cr(i);as(t,i.draft_??i,a,r),os(i,s)})}function os(t,e){if(t.modified_&&!t.finalized_&&(t.type_===3||t.type_===1&&t.allIndicesReassigned_||(t.assigned_?.size??0)>0)){let{patchPlugin_:n}=e;if(n){let s=n.getPath(t);s&&n.generatePatches_(t,s,e)}is(t)}}function Ri(t,e,r){let{scope_:n}=t;if(ee(r)){let s=r[U];wt(s,n)&&s.callbacks_.push(function(){pt(t);let a=Cr(s);as(t,r,a,e)})}else $(r)&&t.callbacks_.push(function(){let i=oe(t);t.type_===3?i.has(r)&&vt(r,n.handledSet_,n):yr(i,e,t.type_)===r&&n.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&vt(yr(t.copy_,e,t.type_),n.handledSet_,n)})}function vt(t,e,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||ee(t)||e.has(t)||!$(t)||Ct(t)||(e.add(t),At(t,(n,s)=>{if(ee(s)){let i=s[U];if(wt(i,r)){let a=Cr(i);gt(t,n,a,t.type_),is(i)}}else $(s)&&vt(s,e,r)})),t}function Oi(t,e){let r=Tt(t),n={type_:r?1:0,scope_:e?e.scope_:ss(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},s=n,i=Et;r&&(s=[n],i=Ve);let{revoke:a,proxy:o}=Proxy.revocable(s,i);return n.draft_=o,n.revoke_=a,[o,n]}var Et={get(t,e){if(e===U)return t;let r=t.scope_.arrayMethodsPlugin_,n=t.type_===1&&typeof e=="string";if(n&&r?.isArrayOperationMethod(e))return r.createMethodInterceptor(t,e);let s=oe(t);if(!pr(s,e,t.type_))return Mi(t,s,e);let i=s[e];if(t.finalized_||!$(i)||n&&t.operationMethod&&r?.isMutatingArrayMethod(t.operationMethod)&&Ti(e))return i;if(i===mr(t.base_,e)||ki(t,e,i)){pt(t);let a=t.type_===1?+e:e,o=br(t.scope_,i,t,a);return t.copy_[a]=o}return i},has(t,e){return e in oe(t)},ownKeys(t){return Reflect.ownKeys(oe(t))},set(t,e,r){let n=cs(oe(t),e);if(n?.set)return n.set.call(t.draft_,r),!0;if(!t.modified_){let s=mr(oe(t),e),i=s?.[U];if(i&&i.base_===r)return t.copy_[e]=r,t.assigned_.delete(e),!0;if(Ai(r,s)&&(r!==void 0||pr(t.base_,e,t.type_)))return!0;pt(t),Tr(t)}return t.copy_[e]===r&&(r!==void 0||pr(t.copy_,e,t.type_))||Number.isNaN(r)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=r,t.assigned_.set(e,!0),Ri(t,e,r)),!0},deleteProperty(t,e){return pt(t),mr(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),Tr(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){let r=oe(t),n=Reflect.getOwnPropertyDescriptor(r,e);return n&&{[ht]:!0,[gr]:t.type_!==1||e!=="length",[mt]:n[mt],[Ue]:r[e]}},defineProperty(){X(11)},getPrototypeOf(t){return Oe(t.base_)},setPrototypeOf(){X(12)}},Ve={};for(let t in Et){let e=Et[t];Ve[t]=function(){let r=arguments;return r[0]=r[0][0],e.apply(this,r)}}Ve.deleteProperty=function(t,e){return Ve.set.call(this,t,e,void 0)};Ve.set=function(t,e,r){return Et.set.call(this,t[0],e,r,t[0])};function mr(t,e){let r=t[U];return(r?oe(r):t)[e]}function ki(t,e,r){return t.type_!==1||!t.allIndicesReassigned_||!$(r)||r[U]?!1:t.baseRefs_.has(r)}function Mi(t,e,r){let n=cs(e,r);return n?Ue in n?n[Ue]:n.get?.call(t.draft_):void 0}function cs(t,e){if(!(e in t))return;let r=Oe(t);for(;r;){let n=Object.getOwnPropertyDescriptor(r,e);if(n)return n;r=Oe(r)}}function Tr(t){t.modified_||(t.modified_=!0,t.parent_&&Tr(t.parent_))}function pt(t){t.copy_||(t.assigned_=new Map,t.copy_=vr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Ni=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,r,n)=>{if(Re(e)&&!Re(r)){let i=r;r=e;let a=this;return function(c=i,...l){return a.produce(c,u=>r.call(this,u,...l))}}Re(r)||X(6),n!==void 0&&!Re(n)&&X(7);let s;if($(e)){let i=Jn(this),a=br(i,e,void 0),o=!0;try{s=r(a),o=!1}finally{o?Sr(i):Ar(i)}return Xn(i,n),Zn(s,i)}else if(!e||!_r(e)){if(s=r(e),s===void 0&&(s=e),s===ts&&(s=void 0),this.autoFreeze_&&_t(s,!0),n){let i=[],a=[];ve(Er).generateReplacementPatches_(e,s,{patches_:i,inversePatches_:a}),n(i,a)}return s}else X(1,e)},this.produceWithPatches=(e,r)=>{if(Re(e))return(a,...o)=>this.produceWithPatches(a,c=>e(c,...o));let n,s;return[this.produce(e,r,(a,o)=>{n=a,s=o}),n,s]},fr(t?.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),fr(t?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),fr(t?.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){$(t)||X(8),ee(t)&&(t=ls(t));let e=Jn(this),r=br(e,t,void 0);return r[U].isManual_=!0,Ar(e),r}finishDraft(t,e){let r=t&&t[U];(!r||!r.isManual_)&&X(9);let{scope_:n}=r;return Xn(n,e),Zn(void 0,n)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let r;for(r=e.length-1;r>=0;r--){let s=e[r];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}r>-1&&(e=e.slice(r+1));let n=ve(Er).applyPatches_;return ee(t)?n(t,e):this.produce(t,s=>n(s,e))}};function br(t,e,r,n){let[s,i]=bt(e)?ve(yt).proxyMap_(e,r):je(e)?ve(yt).proxySet_(e,r):Oi(e,r);return(r?.scope_??ss()).drafts_.push(s),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?Ii(r,i,n):i.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:l}=c;i.modified_&&l&&l.generatePatches_(i,[],c)}),s}function ls(t){return ee(t)||X(10,t),us(t)}function us(t){if(!$(t)||Ct(t))return t;let e=t[U],r,n=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,r=vr(t,e.scope_.immer_.useStrictShallowCopy_),n=e.scope_.immer_.shouldUseStrictIteration()}else r=vr(t,!0);let s=r;return je(r)&&(r=new Set),At(s,(i,a)=>{gt(r,i,us(a))},n),e&&(e.finalized_=!1),r}var Di=globalThis.Iterator,vo=typeof Di?.from=="function";var Fi=new Ni,wr=Fi.produce;function ds(t){return({dispatch:r,getState:n})=>s=>i=>typeof i=="function"?i(r,n,t):s(i)}var hs=ds(),ps=ds;var Pi=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Le:Le.apply(null,arguments)};typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Li=t=>t&&typeof t.match=="function";function he(t,e){function r(...n){if(e){let s=e(...n);if(!s)throw new Error(te(0));return{type:t,payload:s.payload,..."meta"in s&&{meta:s.meta},..."error"in s&&{error:s.error}}}return{type:t,payload:n[0]}}return r.toString=()=>`${t}`,r.type=t,r.match=n=>zn(n)&&n.type===t,r}var vs=class He extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,He.prototype)}static get[Symbol.species](){return He}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new He(...e[0].concat(this)):new He(...e.concat(this))}};function fs(t){return $(t)?wr(t,()=>{}):t}function xt(t,e,r){return t.has(e)?t.get(e):t.set(e,r(e)).get(e)}function Ui(t){return typeof t=="boolean"}var Bi=()=>function(e){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:s=!0,actionCreatorCheck:i=!0}=e??{},a=new vs;return r&&(Ui(r)?a.push(hs):a.push(ps(r.extraArgument))),a},Vi="RTK_autoBatch";var ms=t=>e=>{setTimeout(e,t)},qi=(t,e)=>r=>{let n=!1,s,i,a=()=>{n||(n=!0,cancelAnimationFrame(s),clearTimeout(i),r())};s=t(a),i=setTimeout(a,e)},ji=(t={type:"raf"})=>e=>(...r)=>{let n=e(...r),s=!0,i=!1,a=!1,o=new Set,c=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?qi(window.requestAnimationFrame,100):ms(10):t.type==="callback"?t.queueNotification:ms(t.timeout),l=()=>{a=!1,i&&(i=!1,o.forEach(u=>u()))};return Object.assign({},n,{subscribe(u){let h=()=>s&&u(),p=n.subscribe(h);return o.add(u),()=>{p(),o.delete(u)}},dispatch(u){try{return s=!u?.meta?.[Vi],i=!s,i&&(a||(a=!0,c(l))),n.dispatch(u)}finally{s=!0}}})},Hi=t=>function(r){let{autoBatch:n=!0}=r??{},s=new vs(t);return n&&s.push(ji(typeof n=="object"?n:void 0)),s};function Es(t){let e=Bi(),{reducer:r=void 0,middleware:n,devTools:s=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=t||{},c;if(typeof r=="function")c=r;else if(ut(r))c=hr(r);else throw new Error(te(1));let l;typeof n=="function"?l=n(e):l=e();let u=Le;s&&(u=Pi({trace:!1,...typeof s=="object"&&s}));let h=$n(...l),p=Hi(h),v=typeof o=="function"?o(p):p(),S=u(...v);return dr(c,a,S)}function Ss(t){let e={},r=[],n,s={addCase(i,a){let o=typeof i=="string"?i:i.type;if(!o)throw new Error(te(28));if(o in e)throw new Error(te(29));return e[o]=a,s},addAsyncThunk(i,a){return a.pending&&(e[i.pending.type]=a.pending),a.rejected&&(e[i.rejected.type]=a.rejected),a.fulfilled&&(e[i.fulfilled.type]=a.fulfilled),a.settled&&r.push({matcher:i.settled,reducer:a.settled}),s},addMatcher(i,a){return r.push({matcher:i,reducer:a}),s},addDefaultCase(i){return n=i,s}};return t(s),[e,r,n]}function Ki(t){return typeof t=="function"}function $i(t,e){let[r,n,s]=Ss(e),i;if(Ki(t))i=()=>fs(t());else{let o=fs(t);i=()=>o}function a(o=i(),c){let l=[r[c.type],...n.filter(({matcher:u})=>u(c)).map(({reducer:u})=>u)];return l.filter(u=>!!u).length===0&&(l=[s]),l.reduce((u,h)=>{if(h)if(ee(u)){let p=h(u,c);return p===void 0?u:p}else{if($(u))return wr(u,p=>h(p,c));{let p=h(u,c);if(p===void 0){if(u===null)return u;throw new Error(te(9))}return p}}return u},o)}return a.getInitialState=i,a}var zi=(t,e)=>Li(t)?t.match(e):t(e);function Gi(...t){return e=>t.some(r=>zi(r,e))}var Wi="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Qi=(t=21)=>{let e="",r=t;for(;r--;)e+=Wi[Math.random()*64|0];return e},Yi=["name","message","stack","code"],xr=class{payload;meta;_type;constructor(t,e){this.payload=t,this.meta=e}},gs=class{payload;meta;_type;constructor(t,e){this.payload=t,this.meta=e}},Xi=t=>{if(typeof t=="object"&&t!==null){let e={};for(let r of Yi)typeof t[r]=="string"&&(e[r]=t[r]);return e}return{message:String(t)}},ys="External signal was aborted",Ji=(()=>{function t(e,r,n){let s=he(e+"/fulfilled",(c,l,u,h)=>({payload:c,meta:{...h||{},arg:u,requestId:l,requestStatus:"fulfilled"}})),i=he(e+"/pending",(c,l,u)=>({payload:void 0,meta:{...u||{},arg:l,requestId:c,requestStatus:"pending"}})),a=he(e+"/rejected",(c,l,u,h,p)=>({payload:h,error:(n&&n.serializeError||Xi)(c||"Rejected"),meta:{...p||{},arg:u,requestId:l,rejectedWithValue:h!==void 0,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function o(c,{signal:l}={}){return(u,h,p)=>{let v=n?.idGenerator?n.idGenerator(c):Qi(),S=new AbortController,_,m;function I(g){m=g,S.abort()}l&&(l.aborted?I(ys):l.addEventListener("abort",()=>I(ys),{once:!0}));let H=(async function(){let g;try{let y=n?.condition?.(c,{getState:h,extra:p});if(ea(y)&&(y=await y),y===!1)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};if(S.signal.aborted)throw{name:"AbortError",message:m||"Aborted"};let D=new Promise((O,L)=>{_=()=>{L({name:"AbortError",message:m||"Aborted"})},S.signal.addEventListener("abort",_,{once:!0})});u(i(v,c,n?.getPendingMeta?.({requestId:v,arg:c},{getState:h,extra:p}))),g=await Promise.race([D,Promise.resolve(r(c,{dispatch:u,getState:h,extra:p,requestId:v,signal:S.signal,abort:I,rejectWithValue:((O,L)=>new xr(O,L)),fulfillWithValue:((O,L)=>new gs(O,L))})).then(O=>{if(O instanceof xr)throw O;return O instanceof gs?s(O.payload,v,c,O.meta):s(O,v,c)})])}catch(y){g=y instanceof xr?a(null,v,c,y.payload,y.meta):a(y,v,c)}finally{_&&S.signal.removeEventListener("abort",_)}return n&&!n.dispatchConditionRejection&&a.match(g)&&g.meta.condition||u(g),g})();return Object.assign(H,{abort:I,requestId:v,arg:c,unwrap(){return H.then(Zi)}})}}return Object.assign(o,{pending:i,rejected:a,fulfilled:s,settled:Gi(a,s),typePrefix:e})}return t.withTypes=()=>t,t})();function Zi(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}function ea(t){return t!==null&&typeof t=="object"&&typeof t.then=="function"}var As=Symbol.for("rtk-slice-createasyncthunk"),wo={[As]:Ji};function ta(t,e){return`${t}/${e}`}function ra({creators:t}={}){let e=t?.asyncThunk?.[As];return function(n){let{name:s,reducerPath:i=s}=n;if(!s)throw new Error(te(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(sa()):n.reducers)||{},o=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},l={addCase(g,y){let D=typeof g=="string"?g:g.type;if(!D)throw new Error(te(12));if(D in c.sliceCaseReducersByType)throw new Error(te(13));return c.sliceCaseReducersByType[D]=y,l},addMatcher(g,y){return c.sliceMatchers.push({matcher:g,reducer:y}),l},exposeAction(g,y){return c.actionCreators[g]=y,l},exposeCaseReducer(g,y){return c.sliceCaseReducersByName[g]=y,l}};o.forEach(g=>{let y=a[g],D={reducerName:g,type:ta(s,g),createNotation:typeof n.reducers=="function"};aa(y)?ca(D,y,l,e):ia(D,y,l)});function u(){let[g={},y=[],D=void 0]=typeof n.extraReducers=="function"?Ss(n.extraReducers):[n.extraReducers],O={...g,...c.sliceCaseReducersByType};return $i(n.initialState,L=>{for(let B in O)L.addCase(B,O[B]);for(let B of c.sliceMatchers)L.addMatcher(B.matcher,B.reducer);for(let B of y)L.addMatcher(B.matcher,B.reducer);D&&L.addDefaultCase(D)})}let h=g=>g,p=new Map,v=new WeakMap,S;function _(g,y){return S||(S=u()),S(g,y)}function m(){return S||(S=u()),S.getInitialState()}function I(g,y=!1){function D(L){let B=L[g];return typeof B>"u"&&y&&(B=xt(v,D,m)),B}function O(L=h){return xt(xt(p,y,()=>new WeakMap),L,()=>{let B={};for(let[si,ii]of Object.entries(n.selectors??{}))B[si]=na(ii,L,()=>xt(v,L,m),y);return B})}return{reducerPath:g,getSelectors:O,get selectors(){return O(D)},selectSlice:D}}let H={name:s,reducer:_,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:m,...I(i),injectInto(g,{reducerPath:y,...D}={}){let O=y??i;return g.inject({reducerPath:O,reducer:_},D),{...H,...I(O,!0)}}};return H}}function na(t,e,r,n){function s(i,...a){let o=e(i);return typeof o>"u"&&n&&(o=r()),t(o,...a)}return s.unwrapped=t,s}var Ts=ra();function sa(){function t(e,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...r}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...r){return e(...r)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:r}},asyncThunk:t}}function ia({type:t,reducerName:e,createNotation:r},n,s){let i,a;if("reducer"in n){if(r&&!oa(n))throw new Error(te(17));i=n.reducer,a=n.prepare}else i=n;s.addCase(t,i).exposeCaseReducer(e,i).exposeAction(e,a?he(t,a):he(t))}function aa(t){return t._reducerDefinitionType==="asyncThunk"}function oa(t){return t._reducerDefinitionType==="reducerWithPrepare"}function ca({type:t,reducerName:e},r,n,s){if(!s)throw new Error(te(18));let{payloadCreator:i,fulfilled:a,pending:o,rejected:c,settled:l,options:u}=r,h=s(t,i,u);n.exposeAction(e,h),a&&n.addCase(h.fulfilled,a),o&&n.addCase(h.pending,o),c&&n.addCase(h.rejected,c),l&&n.addMatcher(h.settled,l),n.exposeCaseReducer(e,{fulfilled:a||It,pending:o||It,rejected:c||It,settled:l||It})}function It(){}var bs="listener",_s="completed",Cs="cancelled",xo=`task-${Cs}`,Io=`task-${_s}`,Ro=`${bs}-${Cs}`,Oo=`${bs}-${_s}`;var{assign:ws}=Object;var Ir="listenerMiddleware";var la=ws(he(`${Ir}/add`),{withTypes:()=>la}),ko=he(`${Ir}/removeAll`),ua=ws(he(`${Ir}/remove`),{withTypes:()=>ua});function te(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var da=nt(Symbol("withEventBus"),function(t,e){return class extends t{constructor(){super(...arguments),this.eventBus=e??document.createElement("span")}addEventListener(r,n,s){this.eventBus.addEventListener(r,n,s)}dispatchEvent(r){return this.eventBus.dispatchEvent(r)}removeEventListener(r,n,s){this.eventBus.removeEventListener(r,n,s)}}}),Rt=class extends da(Object){};window.ftReduxStores||(window.ftReduxStores={});var xs=class t extends Rt{static get(e){var r;let n=typeof e=="string"?e:e.name,s=typeof e=="string"?void 0:e,i=window.ftReduxStores[n];if(ct(i))return i;if(s==null)return;let a=Ts({...s,reducers:(r=s.reducers)!==null&&r!==void 0?r:{}}),o=Es({reducer:(c,l)=>{if(l.type==="CLEAR_FT_REDUX_STORE"){let u=De(a.getInitialState());for(let h of l.keeping)u[h]=(c??u)[h];return u}else if(typeof l.type=="string"&&l.type.startsWith("DEFAULT_VALUE_SETTER__"))return{...c,...l.overwrites};return a.reducer(c,l)}});return window.ftReduxStores[s.name]=new t(a,o,s.eventBus,s.deprecatedKeys)}constructor(e,r,n,s){super(),this.reduxSlice=e,this.reduxStore=r,this.deprecatedKeys=s,this.isFtReduxStore=!0,this.commands=new st,this.injectInto=(a,o)=>this.reduxSlice.injectInto(a,o),this.selectSlice=a=>this.reduxSlice.selectSlice(a);let i=a=>a!=null?JSON.parse(JSON.stringify(a)):a;this.actions=new Proxy(this.reduxSlice.actions,{get:(a,o,c)=>{let l=o,u=a[l];return u?(...h)=>{let p=u(...h.map(i));return this.reduxStore.dispatch(p),p}:h=>{let p=l,v=this.getState()[p];we(v,h)||this.setState({[p]:i(h)})}}}),this.eventBus=n??this.eventBus}clear(){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE",keeping:[]})}clearKeeping(...e){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE",keeping:e})}setState(e){this.reduxStore.dispatch({type:"DEFAULT_VALUE_SETTER__"+Object.keys(e).join("_"),overwrites:e})}get dispatch(){throw new Error("Don't use this method, actions are automatically dispatched when called.")}[Symbol.observable](){return this.reduxStore[Symbol.observable]()}getState(){return this.reduxStore.getState()}replaceReducer(e){throw new Error("Not implemented yet.")}subscribe(e){return this.reduxStore.subscribe(e)}get name(){return this.reduxSlice.name}get reducer(){return this.reduxSlice.reducer}get caseReducers(){return this.reduxSlice.caseReducers}getInitialState(){return this.reduxSlice.getInitialState()}get selectors(){return this.reduxSlice.selectors}get reducerPath(){return this.reduxSlice.reducerPath}getSelectors(){return this.reduxSlice.getSelectors()}};var Ot=class{static format(e,r,n,s,i){return window.moment?window.moment(e).locale(r).format(this.getMomentDateFormat(n,s,!!i)):this.getIntlDateTime(e,r,n,s,!!i)}static getMomentDateFormat(e,r,n){return n?"LT":e?r?"lll":"ll":r?"L LT":"L"}static getIntlDateTime(e,r,n,s,i){let a=typeof e=="string"?new Date(e):e,o=new Intl.DateTimeFormat(r,{dateStyle:n?"medium":"short"}).format(a),c=new Intl.DateTimeFormat(r,{timeStyle:"short"}).format(a);return i?c:s?`${o} ${c}`:o}static getTimezoneAsString(){let e=n=>String(Math.floor(n)).padStart(2,"0"),r=new Date().getTimezoneOffset();return`${r<0?"+":"-"}${e(Math.abs(r)/60)}:${e(Math.abs(r)%60)}`}};var kt=f(T()),ha="ft-app-info",z=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:e})}};z.eventName="authentication-change";var Ke=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:e})}};Ke.eventName="ui-locale-changed";var pa={session:(t,e)=>{(0,kt.deepEqual)(t.session,e.payload)||(t.session=e.payload,setTimeout(()=>d.dispatchEvent(new z(e.payload)),0))}},d=kt.FtReduxStore.get({name:ha,reducers:pa,initialState:{baseUrl:void 0,tenantId:void 0,apiIntegrationIdentifier:void 0,apiIntegrationAppVersion:void 0,uiLocale:document.documentElement.lang||"en-US",availableContentLocales:[],localesConfiguration:void 0,metadataConfiguration:void 0,privacyPolicyConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,noCustomCode:!1,session:void 0,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1,authenticationRequired:!1,stickyFilters:void 0}});var Is=f(T()),Mt=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},oc=(0,Is.applyMixinOnce)(Symbol("withDateFormat"),function(t){class e extends t{constructor(...n){super(n),this.useLongDateFormat=!1,this.useDateTimeFormat=!1,this.metadataDescriptors=[],this.uiLocale="en-US",this.addStore(d)}dateFormatOptionsChanged(n){return n.has("metadataDescriptors")||n.has("useLongDateFormat")||n.has("useDateTimeFormat")||n.has("uiLocale")}getDateFormatter(n){var s,i;return((i=(s=this.metadataDescriptors.find(o=>o.key===n))===null||s===void 0?void 0:s.date)!==null&&i!==void 0?i:!1)?o=>Ot.format(o,this.uiLocale,this.useLongDateFormat,this.useDateTimeFormat):void 0}}return Mt([(0,Rr.property)({type:Boolean})],e.prototype,"useLongDateFormat",void 0),Mt([(0,Rr.property)({type:Boolean})],e.prototype,"useDateTimeFormat",void 0),Mt([lr({store:d.name,selector:r=>{var n,s;return(s=(n=r.metadataConfiguration)===null||n===void 0?void 0:n.descriptors)!==null&&s!==void 0?s:[]}})],e.prototype,"metadataDescriptors",void 0),Mt([lr({store:d.name})],e.prototype,"uiLocale",void 0),e});var Lt=f(T());var Or=f(T());var Ee=class t{static get(e){let{baseUrl:r,apiIntegrationIdentifier:n}=d.getState(),s=e??n;if(r&&s&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(r,s,!0)}static await(e){return new Promise(r=>{let n=t.get(e);if(n)r(n);else{let s=d.subscribe(()=>{n=t.get(e),n&&(s(),r(n))})}})}};var ke=class{constructor(e){this.overrideApi=e}get api(){var e;return(e=this.overrideApi)!==null&&e!==void 0?e:Ee.get()}get awaitApi(){return this.overrideApi?Promise.resolve(this.overrideApi):Ee.await()}};var M=class extends ke{constructor(e=!0,r){var n;super(r),this.sortObjectFields=(i,a)=>typeof a!="object"||a==null||Array.isArray(a)?a:Object.fromEntries(Object.entries(a).sort(([o],[c])=>o.localeCompare(c)));let s=this.constructor;s.commonCache=(n=s.commonCache)!==null&&n!==void 0?n:new Or.CacheRegistry,this.cache=e?s.commonCache:new Or.CacheRegistry}clearCache(){this.cache.clearAll()}hash(e){return String(Array.from(JSON.stringify(e,this.sortObjectFields)).reduce((r,n)=>0|31*r+n.charCodeAt(0),0))}};var Nt=class extends M{async listMySearches(){let{session:e}=d.getState();return Q(e,A.SAVED_SEARCH_USER)?this.cache.get("my-searches",async()=>(await this.awaitApi).listMySearches(e.profile.userId),300*1e3):[]}};var Dt=class extends M{async listMyBookmarks(){let e=d.getState().session;return e?.sessionAuthenticated?this.cache.get("my-bookmarks",async()=>(await this.awaitApi).listMyBookmarks(e.profile.userId),300*1e3):[]}};var Ft=class extends M{constructor(){super(...arguments),this.CACHE_DURATION=180*1e3}async getUserAssetCount(e){if(this.isAuthenticated())return this.cache.get(`user-asset-count-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/${e}`),this.CACHE_DURATION)}async getUserBookmarkCountByMap(e){if(this.isAuthenticated())return this.cache.get(`user-bookmark-count-by-map-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/BOOKMARKS/${e}`),this.CACHE_DURATION)}isAuthenticated(){let e=d.getState().session;return!!e?.sessionAuthenticated}};var Pt=class extends M{constructor(){super(...arguments),this.CACHE_DURATION=180*1e3}async getUserAssetLabels(){return this.isAuthenticated()?this.cache.get("user-asset-labels",async()=>(await this.awaitApi).get("/internal/api/webapp/user/assets/labels"),this.CACHE_DURATION):[]}isAuthenticated(){let e=d.getState().session;return!!e?.sessionAuthenticated}};var fa="ft-user-assets",ma={setAssetCount:(t,e)=>{let{userAssetType:r,count:n}=e.payload.assetCount;t.assetCounts.allAsset[r]=n},clearAssetCount:t=>{Object.values(W).forEach(e=>{t.assetCounts.allAsset[e]=void 0})},setBookmarkCountByMap:(t,e)=>{let r=e.payload.mapId;t.assetCounts.bookmarkByMap[r]=e.payload.count},clearBookmarkCountByMap:t=>{t.assetCounts.bookmarkByMap={}},addAsset:(t,e)=>{let{assetType:r,mapId:n,asset:s}=e.payload;Mr(t,r,[...kr(t,r),s]),Rs(t,r,1,n),Os(t,s)},editAsset:(t,e)=>{let{assetType:r,asset:n}=e.payload;Mr(t,r,kr(t,r).map(s=>s.id===n.id?n:s)),Os(t,n)},removeAsset:(t,e)=>{let{assetType:r,mapId:n,assetId:s}=e.payload;Mr(t,r,kr(t,r).filter(i=>i.id!==s)),Rs(t,r,-1,n)}},ks={[W.SEARCHES]:"savedSearches",[W.BOOKMARKS]:"bookmarks",[W.BOOKS]:void 0,[W.COLLECTIONS]:void 0},kr=(t,e)=>{var r;let n=ks[e];return n?(r=t[n])!==null&&r!==void 0?r:[]:[]},Mr=(t,e,r)=>{let n=ks[e];n&&(t[n]=r)},Rs=(t,e,r,n)=>{let s=t.assetCounts.allAsset[e];if(s!==void 0&&(t.assetCounts.allAsset[e]=Math.max(0,s+r),e===W.BOOKMARKS&&n)){let i=t.assetCounts.bookmarkByMap[n];t.assetCounts.bookmarkByMap[n]=Math.max(0,i+r)}},Os=(t,e)=>{let r=t.assetLabels.map(s=>s.title),n=e.labels.filter(s=>!r.includes(s)).map(s=>({title:s}));t.assetLabels.push(...n)},V=Lt.FtReduxStore.get({name:fa,reducers:ma,initialState:{savedSearches:void 0,bookmarks:void 0,assetCounts:{allAsset:Object.fromEntries(Object.values(W).map(t=>[t,void 0])),bookmarkByMap:{}},assetLabels:[]}}),Nr=class{constructor(e=new Ft,r=new Pt){this.assetCountsService=e,this.assetLabelsService=r,this.currentSession=d.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Dt,this.savedSearchesService=new Nt,d.subscribe(()=>this.reloadWhenUserSessionChanges())}reloadWhenUserSessionChanges(){var e;let{session:r}=d.getState();(0,Lt.deepEqual)((e=this.currentSession)===null||e===void 0?void 0:e.profile,r?.profile)||(this.currentSession=r,this.clearMySearches(),this.reloadBookmarks(),this.clearUserAssetCounts(),this.reloadAssetLabels())}clearUserAssetCounts(){this.assetCountsService.clearCache(),V.actions.clearAssetCount(),V.actions.clearBookmarkCountByMap()}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),V.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),V.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();let e=await this.savedSearchesService.listMySearches();V.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async reloadAssetLabels(){this.assetLabelsService.clearCache();let e=await this.assetLabelsService.getUserAssetLabels();V.actions.assetLabels(e)}async loadAssetCount(e){let r=await this.assetCountsService.getUserAssetCount(e);r&&V.getState().assetCounts.allAsset[e]!==r.count&&V.actions.setAssetCount({assetCount:r})}async loadBookmarkByMapId(e){let r=await this.assetCountsService.getUserBookmarkCountByMap(e);r&&V.getState().assetCounts.bookmarkByMap[e]!==r.count&&V.actions.setBookmarkCountByMap({count:r.count,mapId:e})}async reloadAssetCount(e){this.assetCountsService.clearCache();let r=Object.keys(V.getState().assetCounts.bookmarkByMap).length!==0;e===W.BOOKMARKS&&r&&V.actions.clearBookmarkCountByMap(),V.getState().assetCounts.allAsset[e]!==void 0&&await this.loadAssetCount(e)}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var e;if(this.bookmarksAreUsed){let r=!((e=this.currentSession)===null||e===void 0)&&e.sessionAuthenticated?await this.bookmarksService.listMyBookmarks():void 0;V.actions.bookmarks(r)}}},Dr=new Nr;window.FluidTopicsUserAssetsActions==null&&(window.FluidTopicsUserAssetsActions=Dr);var Fr=class{addCommand(e,r=!1){d.commands.add(e,r)}consumeCommand(e){return d.commands.consume(e)}};window.FluidTopicsAppInfoStoreService=new Fr;var Y=f(T());var Ms,Me=class extends CustomEvent{constructor(e){super("ft-i18n-context-loaded",{detail:e})}},ga=Symbol("clearAfterUnitTest"),Ut=class extends(0,Y.withEventBus)(M){constructor(e){super(),this.messageContextProvider=e,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Ms]=()=>{this.defaultMessages={},this.cache=new Y.CacheRegistry,this.listeners={}},this.currentUiLocale=d.getState().uiLocale,d.subscribe(()=>this.clearWhenUiLocaleChanges())}clearWhenUiLocaleChanges(){let{uiLocale:e}=d.getState();this.currentUiLocale!==e&&(this.currentUiLocale=e,this.cache.clearAll(),this.notifyAll())}addContext(e){let r=e.name.toLowerCase();this.cache.setFinal(r,e),this.notify(r)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(e,r){var n;if(e=e.toLowerCase(),r&&Object.keys(r).length>0){let s={...(n=this.defaultMessages[e])!==null&&n!==void 0?n:{},...r};(0,Y.deepEqual)(this.defaultMessages[e],s)||(this.defaultMessages[e]=s,await this.notify(e))}return this.fetchContext(e)}resolveContext(e){var r,n;return this.fetchContext(e),(n=(r=this.cache.getNow(e))===null||r===void 0?void 0:r.messages)!==null&&n!==void 0?n:{}}resolveRawMessage(e,r){let n=e.toLowerCase();return this.resolveContext(n)[r]}resolveMessage(e,r,...n){var s;let i=e.toLowerCase(),a=this.resolveContext(i);return new Y.ParametrizedLabelResolver((s=this.defaultMessages[i])!==null&&s!==void 0?s:{},a).resolve(r,...n)}async fetchContext(e){let r=!this.cache.has(e),n;try{n=await this.cache.get(e,()=>this.messageContextProvider(this.currentUiLocale,e)),r&&await this.notify(e)}catch(s){!(s instanceof Y.CanceledPromiseError)&&r&&console.error(s)}return n}subscribe(e,r){var n;return e=e.toLowerCase(),this.listeners[e]=(n=this.listeners[e])!==null&&n!==void 0?n:new Set,this.listeners[e].add(r),()=>{var s;return(s=this.listeners[e])===null||s===void 0?void 0:s.delete(r)}}async notifyAll(){let e=Object.keys(this.listeners);document.body.dispatchEvent(new Me({loadedContexts:e})),this.dispatchEvent(new Me({loadedContexts:e})),await Promise.all(e.map(r=>this.notify(r,!1)))}async notify(e,r=!0){r&&(document.body.dispatchEvent(new Me({loadedContexts:[e]})),this.dispatchEvent(new Me({loadedContexts:[e]}))),this.listeners[e]!=null&&await Promise.all([...this.listeners[e].values()].map(n=>(0,Y.delay)(0).then(()=>n()).catch(()=>null)))}};Ms=ga;window.FluidTopicsI18nService==null&&(window.FluidTopicsI18nService=new class extends Ut{constructor(){super(async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e))}});window.FluidTopicsCustomI18nService==null&&(window.FluidTopicsCustomI18nService=new class extends Ut{constructor(){super(async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e))}});var Ns=window.FluidTopicsI18nService,jc=window.FluidTopicsCustomI18nService;var Ds=f(T()),Pr=class{highlightHtml(e,r,n){(0,Ds.highlightHtml)(e,r,n)}};window.FluidTopicsHighlightHtmlService=new Pr;var Fs=f(T());var Lr=class{isDate(e){var r,n,s,i;return(i=(n=((s=(r=d.getState().metadataConfiguration)===null||r===void 0?void 0:r.descriptors)!==null&&s!==void 0?s:[]).find(o=>o.key===e))===null||n===void 0?void 0:n.date)!==null&&i!==void 0?i:!1}format(e,r){var n,s,i,a;if(e==null)return"";try{return Fs.DateFormatter.format(e,(n=r?.locale)!==null&&n!==void 0?n:d.getState().uiLocale,(s=r?.longFormat)!==null&&s!==void 0?s:!1,(i=r?.withTime)!==null&&i!==void 0?i:!1,(a=r?.onlyTime)!==null&&a!==void 0?a:!1)}catch(o){throw console.error(`Date ${JSON.stringify(e)} is not valid`,o),o}}};window.FluidTopicsDateService=new Lr;var Ps=f(T());var $e=class{static get(e,r,{baseUrl:n,localesConfiguration:s,availableContentLocales:i}=d.getState()){var a;if(!r||i.length>0&&!i.some(o=>o.lang===r)){let o=s?.defaultLocales.defaultContentLocale;r=o?`${o.lang}-${o.region}`:(a=i[0])===null||a===void 0?void 0:a.lang}return new Ps.SearchPlaceConverter(n,e??20,s?.allLanguagesAllowed,r,i)}};var Ne=class extends M{async sendDocumentStartDisplayEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.start_display event")}async sendTopicStartDisplayEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send topic.start_display event")}async sendKhubSearchEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send khub.search event")}async sendDocumentSearchEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.search event")}async sendSearchPageSelectEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send search_page.select event")}async sendSearchResultOpenContextMenuEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send search_result.open_context_menu event")}async sendDocumentOnDemandTranslateEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.on_demand_translate event")}async sendTopicAiTranslateEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send topic.ai_translate event")}convertMapToAnalyticsDocument(e){let r;switch(e.editorialType){case"BOOK":r="STRUCTURED_DOCUMENT";break;case"SHARED_BOOK":r="SHARED_PERSONAL_BOOK";break;case"ARTICLE":r="RESOURCE";break;case"HTML_PACKAGE":r="HTML_PACKAGE";break;default:throw new TypeError("Unknown editorial type for map : "+e.editorialType)}return{id:e.id,title:e.title,type:r,metadata:e.metadata}}sortEventArrays(e){let r=Object.entries(e).map(([n,s])=>Array.isArray(s)?[n,s.map(i=>typeof i=="object"&&i!=null&&!Array.isArray(i)?this.sortEventArrays(i):i).sort((i,a)=>typeof i=="object"&&i!==null&&"key"in i?i.key.localeCompare(a.key):typeof i=="string"&&typeof a=="string"?i.localeCompare(a):String(i).localeCompare(String(a)))]:typeof s=="object"&&s!==null?[n,this.sortEventArrays(s)]:[n,s]);return Object.fromEntries(r)}sendEvents(e,r){let n="anything not undefined";return document.dispatchEvent(new CustomEvent("ft:analytics:userevents",{detail:e})),this.cache.get("analytics-event-"+this.hash(e),async()=>(await this.awaitApi).sendEvents(e).then(()=>n).catch(s=>(console.info(r),console.debug(s),n)),1e3)}};var Ur=class{urlToSearchRequest(e){return $e.get().parse(e)}searchRequestToUrl(e){return $e.get().serialize(e)}};window.FluidTopicsUrlService=new Ur;var ce=f(T());var Se=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:{nextLocation:e}})}};Se.eventName="before-location-change";var Ae=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:{currentItem:e}})}};Ae.eventName="change";var Br=class{itemName(e){return`fluid-topics-history-item-${e}`}get(e){let r=sessionStorage.getItem(this.itemName(e));return r?JSON.parse(r):void 0}set(e,r){sessionStorage.setItem(this.itemName(e),JSON.stringify(r))}},Ls=new Br;var Bt=class t extends ce.WithEventBus{static build(){return new t(window.history,Ls,()=>window.location,!1)}constructor(e,r,n,s){var i,a;super(),this.history=e,this.historyStorage=r,this.windowLocation=n,this.states=[],this.realPushState=e.pushState,this.realReplaceState=e.replaceState,this.initialIndex=(a=(i=e.state)===null||i===void 0?void 0:i.index)!==null&&a!==void 0?a:e.length-1,this.currentIndex=this.initialIndex,this.setCurrentState(this.buildCurrentState()),this.installProxies(),this.initEventListeners(),this.initData(s)}setCurrentState(e,r=!1){let n=r&&this.currentIndex===e.index-1;this.currentState={...this.buildCurrentState(),...e},this.currentIndex=this.currentState.index,this.states[this.currentIndex]=this.currentState,n&&(this.states=this.states.slice(0,this.currentIndex+1)),this.historyStorage.set(this.currentIndex,this.currentState),(0,ce.deepEqual)(this.currentState,this.history.state)||this.realReplaceState.apply(this.history,[this.currentState,this.currentState.title,this.windowLocation().href]),setTimeout(()=>this.dispatchEvent(new Ae(this.currentItem())),0)}installProxies(){let e=r=>(n,s,[i,a,o])=>{let c=new URL(typeof o=="string"?o:(o??this.windowLocation()).href,window.location.origin!=="null"?window.location.origin:void 0),l=new Se(c);this.dispatchEvent(l);let u=r(),h={...u===this.currentIndex?this.currentState:void 0,...i,index:u,href:l.detail.nextLocation.href};n.apply(s,[h,a,h.href]),this.setCurrentState(h,!0)};this.history.pushState=new Proxy(this.history.pushState,{apply:e(()=>this.currentIndex+1)}),this.history.replaceState=new Proxy(this.history.replaceState,{apply:e(()=>this.currentIndex)})}initEventListeners(){window.addEventListener("popstate",e=>this.setCurrentState(e.state)),document.querySelector("title")==null&&document.head.append(document.createElement("title")),new MutationObserver(()=>this.updateCurrentState({title:document.title})).observe(document.querySelector("title"),{subtree:!0,characterData:!0,childList:!0})}initData(e){for(let r=this.history.length-1;r>=0;r--)e?this.states[r]=this.historyStorage.get(r):setTimeout(()=>this.states[r]=this.historyStorage.get(r),this.history.length-r)}updateCurrentState(e){var r;let n={...this.buildCurrentState(),...e,index:this.currentIndex,title:(r=e?.title)!==null&&r!==void 0?r:this.currentState.title};this.setCurrentState(n)}addBeforeLocationChangeListener(e){this.addEventListener(Se.eventName,e)}removeBeforeLocationChangeListener(e){this.removeEventListener(Se.eventName,e)}addHistoryChangeListener(e){this.addEventListener(Ae.eventName,e)}removeHistoryChangeListener(e){this.removeEventListener(Ae.eventName,e)}currentItem(){return(0,ce.deepCopy)(this.currentState)}back(){let e=this.previousDifferentMajorPosition();e>=0?this.history.go(e-this.currentIndex):this.currentIndex!==this.initialIndex?this.history.go(this.initialIndex-this.currentIndex):this.history.back()}backwardItem(){return(0,ce.deepCopy)(this.states[this.previousDifferentMajorPosition()])}backwardItemMatching(e){let r=this.states.filter(n=>!!n).filter(n=>n.index<this.currentIndex).reverse();return(0,ce.deepCopy)(r.find(n=>e(n)))}previousDifferentMajorPosition(){let e=this.currentIndex>0?this.currentIndex-1:0;for(;e>0&&!this.isDifferentMajorState(e);)e--;return e}forward(){let e=this.nextMajorPosition();e&&e<this.states.length?this.history.go(e-this.currentIndex):this.history.forward()}forwardItem(){let e=this.nextMajorPosition();if(e)return(0,ce.deepCopy)(this.states[e])}nextMajorPosition(){let e=this.currentIndex;if(!(e>=this.states.length)){do e++;while(e<this.states.length&&!this.isDifferentMajorState(e));return this.getHigherPositionInTheSameState(e)}}getHigherPositionInTheSameState(e){var r;let n=(r=this.states[e])===null||r===void 0?void 0:r.majorStateId;if(!n)return e;let s=e,i=e+1;for(;this.states.length>i&&!this.isDifferentMajorState(i,n);)this.hasState(i)&&(s=i),i++;return s}buildCurrentState(){var e,r;return{...this.history.state,index:this.currentIndex,href:this.windowLocation().href,title:(r=(e=this.history.state)===null||e===void 0?void 0:e.title)!==null&&r!==void 0?r:document.title}}hasState(e){return this.states[e]!=null}isDifferentMajorState(e,r){var n;if(!this.hasState(e))return!1;let s=r??this.currentState.majorStateId,i=(n=this.states[e])===null||n===void 0?void 0:n.majorStateId;return i==null||i!=s}};window.FluidTopicsInternalHistoryService==null&&(window.FluidTopicsInternalHistoryService=Bt.build(),window.FluidTopicsHistoryService={currentItem:()=>window.FluidTopicsInternalHistoryService.currentItem(),back:()=>window.FluidTopicsInternalHistoryService.back(),forward:()=>window.FluidTopicsInternalHistoryService.forward(),backwardItem:()=>window.FluidTopicsInternalHistoryService.backwardItem(),forwardItem:()=>window.FluidTopicsInternalHistoryService.forwardItem(),backwardItemMatching:t=>window.FluidTopicsInternalHistoryService.backwardItemMatching(t),addHistoryChangeListener:t=>window.FluidTopicsInternalHistoryService.addHistoryChangeListener(t),removeHistoryChangeListener:t=>window.FluidTopicsInternalHistoryService.removeHistoryChangeListener(t),addBeforeLocationChangeListener:t=>window.FluidTopicsInternalHistoryService.addBeforeLocationChangeListener(t),removeBeforeLocationChangeListener:t=>window.FluidTopicsInternalHistoryService.removeBeforeLocationChangeListener(t)});var Us=f(le());var Bs=Us.css`
|
|
2
|
+
`;var qs=f(le()),q=f(ie()),be=f(T());var re=f(T());function Vs(t,e){let{authenticationRequired:r,session:n}=d.getState();return r&&!n?.sessionAuthenticated?Promise.resolve(e):t()}var Vt=class extends ke{async updateUiLocale(e){return(await this.awaitApi).updateUiLocale(e)}};var Vr=class t extends re.FtStateManager{static build(e){return new t(d,e)}constructor(e,r){super(),this.store=e,this.cache=new re.CacheRegistry,this.withManualResources=!0,this.userLocaleService=new Vt,this.knownContexts=new re.AbstractRegistry,this.knownCustomComponents=new re.AbstractRegistry,this.cleanSessionDebouncer=new re.Debouncer,this.reloadConfiguration=()=>{var n;(n=this.cache)===null||n===void 0||n.clear("availableContentLocales"),this.updateAvailableContentLocales()},this.reloadDebouncer=new re.Debouncer(500),this.apiProvider=r??(()=>Ee.get())}setWithManualResources(e){this.withManualResources=e,this.updateIfNeeded()}addListeners(){this.store.addEventListener(z.eventName,this.reloadConfiguration)}removeListeners(){this.store.removeEventListener(z.eventName,this.reloadConfiguration)}async updateIfNeeded(){this.apiProvider()&&(this.withManualResources||(this.store.getState().session==null&&this.updateSession(),this.store.getState().metadataConfiguration==null&&this.updateMetadataConfiguration()),this.store.getState().localesConfiguration==null&&this.updateLocalesConfiguration(),(this.store.getState().availableContentLocales==null||this.store.getState().availableContentLocales.length==0)&&this.updateAvailableContentLocales())}async updateSession(){let e=await this.cache.get("session",async()=>{let r=await this.apiProvider().getCurrentSession();return r.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run(()=>{this.cache.clear("session"),this.setSession(void 0)},r.idleTimeoutInMillis),r});this.setSession(e)}async updateMetadataConfiguration(){this.setMetadataConfiguration(await this.cache.get("metadataConfiguration",()=>this.apiProvider().getMetadataConfiguration()))}async updateLocalesConfiguration(){this.setLocalesConfiguration(await this.cache.get("localesConfiguration",()=>this.apiProvider().getLocalesConfiguration()))}async updateAvailableContentLocales(){var e;let r=await this.cache.get("availableContentLocales",()=>Vs(()=>this.apiProvider().getAvailableSearchLocales(),{contentLocales:[]}));this.setAvailableContentLocales((e=r.contentLocales)!==null&&e!==void 0?e:[])}setStickyFilters(e){this.store.actions.stickyFilters(e)}setBaseUrl(e){this.store.actions.baseUrl(e),window.fluidTopicsBaseUrl=e}setTenantId(e){this.store.actions.tenantId(e)}setApiIntegrationIdentifier(e){this.store.actions.apiIntegrationIdentifier(e)}setApiIntegrationAppVersion(e){this.store.actions.apiIntegrationAppVersion(e)}setUiLocale(e){this.store.actions.uiLocale(e)}setLocalesConfiguration(e){this.store.actions.localesConfiguration(e),setTimeout(()=>this.updateIfNeeded())}setAvailableContentLocales(e){this.store.actions.availableContentLocales(e),setTimeout(()=>this.updateIfNeeded())}stopReloadDebouncer(){this.reloadDebouncer.cancel()}requestUiLocaleUpdate(e,r){this.userLocaleService.updateUiLocale({uiLocale:e,contentLocale:r}).then(n=>{n.uiLocaleChanged&&(this.reloadDebouncer.run(()=>window.location.reload()),this.store.dispatchEvent(new Ke(n)))}).catch(()=>{})}setMetadataConfiguration(e){this.store.actions.metadataConfiguration(e),setTimeout(()=>this.updateIfNeeded())}setNoCustom(e){this.store.actions.noCustom(e)}setEditorMode(e){this.store.actions.editorMode(e)}setNoCustomComponent(e){this.store.actions.noCustomComponent(e)}setNoCustomCode(e){this.store.actions.noCustomCode(e)}setSession(e){this.store.actions.session(e),setTimeout(()=>this.updateIfNeeded())}setOpenExternalDocumentInNewTab(e){this.store.actions.openExternalDocumentInNewTab(e)}setNavigatorOnline(e){this.store.actions.navigatorOnline(e)}setForcedOffline(e){this.store.actions.forcedOffline(e)}setAuthenticationRequired(e){this.store.actions.authenticationRequired(e)}userHasAnyRole(...e){return Nn(d.getState().session,...e)}},ne=Vr.build();var Te=class extends Event{constructor(e,r,n,s){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=r,this.callback=n,this.subscribe=s??!1}};var ze=class{constructor(){this.pendingContextRequests=new Map,this.onContextProvider=e=>{let r=this.pendingContextRequests.get(e.context);if(r===void 0)return;this.pendingContextRequests.delete(e.context);let{requests:n}=r;for(let{elementRef:s,callbackRef:i}of n){let a=s.deref(),o=i.deref();a===void 0||o===void 0||a.dispatchEvent(new Te(e.context,a,o,!0))}},this.onContextRequest=e=>{if(e.subscribe!==!0)return;let r=e.contextTarget??e.composedPath()[0],n=e.callback,s=this.pendingContextRequests.get(e.context);s===void 0&&this.pendingContextRequests.set(e.context,s={callbacks:new WeakMap,requests:[]});let i=s.callbacks.get(r);i===void 0&&s.callbacks.set(r,i=new WeakSet),i.has(n)||(i.add(n),s.requests.push({elementRef:new WeakRef(r),callbackRef:new WeakRef(n)}))}}attach(e){e.addEventListener("context-request",this.onContextRequest),e.addEventListener("context-provider",this.onContextProvider)}detach(e){e.removeEventListener("context-request",this.onContextRequest),e.removeEventListener("context-provider",this.onContextProvider)}};var N=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},b=class extends be.FtLitElementRedux{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.apiIntegrationAppVersion="ft-integration-app-version",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.noCustomCode=!1,this.withManualResources=!1,this.navigatorOnline=!1,this.forcedOffline=!1,this.authenticationRequired=!1,this.messageContexts=[],this.stateManager=ne,this.contextRoot=new ze}render(){return qs.html`
|
|
3
3
|
<slot></slot>
|
|
4
|
-
`}connectedCallback(){super.connectedCallback(),this.stateManager.addListeners(),this.contextRoot.attach(document.body)}disconnectedCallback(){super.disconnectedCallback(),this.stateManager.removeListeners(),this.contextRoot.detach(document.body)}update(e){var r;super.update(e),e.has("baseUrl")&&this.stateManager.setBaseUrl(this.baseUrl),e.has("tenantId")&&this.stateManager.setTenantId(this.tenantId),e.has("apiIntegrationIdentifier")&&this.stateManager.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),e.has("apiIntegrationAppVersion")&&this.stateManager.setApiIntegrationAppVersion(this.apiIntegrationAppVersion),e.has("uiLocale")&&this.stateManager.setUiLocale(this.uiLocale),e.has("metadataConfiguration")&&this.stateManager.setMetadataConfiguration(this.metadataConfiguration),e.has("noCustom")&&this.stateManager.setNoCustom(this.noCustom),e.has("editorMode")&&this.stateManager.setEditorMode(this.editorMode),e.has("noCustomComponent")&&this.stateManager.setNoCustomComponent(this.noCustomComponent),e.has("noCustomCode")&&this.stateManager.setNoCustomCode(this.noCustomCode),e.has("session")&&this.stateManager.setSession(this.session),e.has("messageContexts")&&this.messageContexts!=null&&this.messageContexts.forEach(n=>Ms.addContext(n)),e.has("openExternalDocumentInNewTab")&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("navigatorOnline")&&this.stateManager.setNavigatorOnline(this.navigatorOnline),e.has("forcedOffline")&&this.stateManager.setForcedOffline(this.forcedOffline),e.has("authenticationRequired")&&this.stateManager.setAuthenticationRequired(this.authenticationRequired),e.has("withManualResources")&&((r=this.stateManager)===null||r===void 0||r.setWithManualResources(this.withManualResources)),setTimeout(()=>this.stateManager.updateIfNeeded())}};b.elementDefinitions={};b.styles=Us;M([(0,q.property)()],b.prototype,"baseUrl",void 0);M([(0,q.property)()],b.prototype,"tenantId",void 0);M([(0,q.property)()],b.prototype,"apiIntegrationIdentifier",void 0);M([(0,q.property)()],b.prototype,"apiIntegrationAppVersion",void 0);M([(0,q.property)()],b.prototype,"uiLocale",void 0);M([(0,be.jsonProperty)(null)],b.prototype,"availableUiLocales",void 0);M([(0,be.jsonProperty)(null)],b.prototype,"metadataConfiguration",void 0);M([(0,q.property)({type:Boolean})],b.prototype,"editorMode",void 0);M([(0,q.property)({type:Boolean})],b.prototype,"noCustom",void 0);M([(0,q.property)({type:Boolean})],b.prototype,"openExternalDocumentInNewTab",void 0);M([(0,q.property)({converter:{fromAttribute(t){return t==="false"?!1:t==="true"||(t??!1)}}})],b.prototype,"noCustomComponent",void 0);M([(0,q.property)({converter:{fromAttribute(t){return t==="false"?!1:t==="true"||(t??!1)}}})],b.prototype,"noCustomCode",void 0);M([(0,q.property)({type:Boolean})],b.prototype,"withManualResources",void 0);M([(0,q.property)({type:Boolean})],b.prototype,"navigatorOnline",void 0);M([(0,q.property)({type:Boolean})],b.prototype,"forcedOffline",void 0);M([(0,q.property)({type:Boolean})],b.prototype,"authenticationRequired",void 0);M([(0,be.jsonProperty)([])],b.prototype,"messageContexts",void 0);M([(0,be.jsonProperty)(void 0)],b.prototype,"session",void 0);var js=f(T());var qs={"ft-app-context":b};(0,js.customElements)(qs);var qt=f(T()),Vt=class extends k{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,n,s){super(!1,r),this.converter=e,this._mapId=n,this._metadataFilters=s,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 Q((r=(e=d.getState().session)===null||e===void 0?void 0:e.profile.roles)!==null&&r!==void 0?r:[],"RATING_USER")?this.withMapId(s=>this.fetchMapRating(s)):Promise.resolve()})}clear(){this.cache.clearMatching(e=>e!=="configuration")}makeCacheKey(e,r,n){return e+(r?"-destinationLanguage-"+r?.destinationLanguage:"")+(!n||n.length==0?"":"-metadataFilters-"+this.hash(n))}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 n;return(n=this.getEnrichedTocNow(r))===null||n===void 0?void 0:n.nodeByTocId[e]}getTocNodeNowByUrl(e,r){var n,s;let i=this.getMapNow(r);return i?.prettyUrl==e||`${i?.id}/root`===e?(n=this.getEnrichedTocNow(r))===null||n===void 0?void 0:n.toc[0]:(s=this.getEnrichedTocNow(r))===null||s===void 0?void 0:s.nodeByUrl[e]}async getPage(e,r){let n=await this.getEnrichedToc(r);return n.pages[e-1]||n.pages[0]}async getPageByTocId(e,r){let n=await this.getEnrichedToc(r);return n.pageByTocId[e]||n.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 n=this.getTocNodeNow(e);if(!n)return;let s=await this.getTopicInfo(n);return s?.metadata.find(i=>i.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,n){return this.cache.get("topic-relatives-"+[e,r,...n].join("-"),()=>this.fetchRelativesForTopicInMap(e,r,n))}getAttachmentDownloadLink(e){return this.makeAbsolute(`${this.api.endpoints.khub.maps.mapId(this.mapId).attachments.attachmentId(e).content}?download=true&locationValue=reader`)}getLink(e,r,n,s){let i=this.getNavigationData(e,r,n),a=this.getReaderLinkPrefix()+(i.prettyUrl?i.prettyUrl:`${i.mapId}/${i.tocId}`),o=new URL(a,this.api.tenantBaseUrl);if(i.page!=null&&o.searchParams.set("page",`${i.page}`),i.prettyUrlDuplicated&&o.searchParams.set("tocId",i.tocId),i.section!=null&&o.searchParams.set("section",i.section),s&&i.metadataFilters){let c=qt.SearchPlaceConverter.serializeValueFilters(i.metadataFilters);c&&o.searchParams.set(qt.SearchPlaceQueryParams.VALUE_FILTERS,c)}return o.href}getLinkWithFilter(e,r,n){return this.getLink(e,r,n,!0)}getNavigationData(e,r,n,s){var i,a;e=e||"root";let o=this.getEnrichedTocNow(s),c=o?.pageByTocId[e],l=o?.nodeByTocId[e],u=l?.prettyUrl;return{mapId:this.mapId,tocId:e,topicTitle:(i=l?.title)!==null&&i!==void 0?i:"",untranslatedTopicTitle:l?.untranslatedTitle,page:r&&c&&c.number!==r?r:void 0,prettyUrl:u?.replace(/^r\//,""),prettyUrlDuplicated:(a=o?.duplicatedPrettyUrls.has(u??""))!==null&&a!==void 0?a:!1,section:n,metadataFilters:this.metadataFilters}}async getAccurateNavigationData(e,r,n,s){return await this.getEnrichedToc(s),this.getNavigationData(e,r,n,s)}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 n;return r?{type:r.topics.type,rating:(n=r.topics)===null||n===void 0?void 0:n.ratings.find(s=>s.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,n){return this.makeRateTopicRequest(e,r,n).then(()=>this.clearRatingIfNecessary())}unrateTopic(e){return this.makeUnrateTopicRequest(e).then(()=>this.clearRatingIfNecessary())}async clearRatingIfNecessary(){let e=d.getState().session;e?.sessionAuthenticated&&this.cache.clear("ratingSummary")}sendTopicFeedback(e,r,n,s){return this.makeTopicFeedbackRequest(e,r,n,s)}fontsStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.fonts)}themeStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.theme)}buildBreadcrumb(e,r){let n=this.getTocNodeNow(e,r);if(!n)return[];let s=[{tocId:n.tocId,title:n.title,untranslatedTitle:n.untranslatedTitle}],i=this.getTocNodeNow(n.parentTocId,r);for(;i;)s.unshift({tocId:i.tocId,title:i.title,untranslatedTitle:i.untranslatedTitle}),i=this.getTocNodeNow(i.parentTocId,r);return s}isFeatureAccessible(e,{session:r}){var n;if(!this.isFeatureAvailable(e))return!1;switch(e){case ie.FEEDBACK:return Q(r??[],A.FEEDBACK_USER);case ie.RATING:return Q(r??[],A.RATING_USER);case ie.PRINT:return Q(r??[],A.PRINT_USER);case ie.BOOKMARK:return!!r?.sessionAuthenticated;case ie.COLLECTIONS:return Q(r??[],A.COLLECTION_USER);case ie.PERSONAL_BOOKS:return Q(r??[],A.PERSONAL_BOOK_USER)&&!(!((n=this.getMapNow())===null||n===void 0)&&n.pbkConfidential);default:return!1}}makeAbsolute(e){return this.api.makeAbsolute(e)}};var jt=class t extends Vt{static async build(e){return new t(new Ze,void 0,e)}clear(){super.clear(),this.fingerprint=void 0}async fetchMap(e,r){let n=await this.api.getMap(e,r);return this.fingerprint=n.fingerprint,n}fetchMapRating(e){return this.api.getMapRating(e)}async fetchPages(e,r,n){return await this.getMap(n),r?.length?this.api.getFilteredPages(e,n,r):this.api.getPages(e,this.fingerprint,n)}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 n={query:"",paging:{page:1,perPage:-1},scope:"DOCUMENTS",metadataFilters:[{key:e,valueFilter:{negative:!1,values:r}}],sort:[],facets:[]};return this.api.search(n)}fetchRelativesForTopicInMap(e,r,n){let s={query:"",paging:{page:1,perPage:1},scope:"ALL_TOPICS",metadataFilters:[{key:r,valueFilter:{negative:!1,values:n}},{key:"ft:publicationId",valueFilter:{negative:!1,values:[e]}}],sort:[],facets:[]};return this.api.search(s)}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,n){return this.api.rateTopic(this.mapId,e,r,n)}makeTopicFeedbackRequest(e,r,n,s){return this.api.sendTopicFeedback(this.mapId,e,r,n,s)}makeUnrateMapRequest(){return this.api.unrateMap(this.mapId)}makeUnrateTopicRequest(e){return this.api.unrateTopic(this.mapId,e)}getReaderLinkPrefix(){return"r/"}isFeatureAvailable(e){return!0}};var va="topicPivot";function Hs(t,e){let r=new URL(t);return e?.values.forEach(n=>{r.searchParams.append(va,n)}),r.href}var Ht=class t{static build(e,r){return new t(Yr(e.trim()||"context"),r??jt.build)}loaded(){return(0,P.waitUntil)(()=>this._loaded)}constructor(e,r,n,s){this.store=e,this.clusteringHelperProvider=n,this.metadataForSwitchToRelatives=new Set,this._loaded=!1,this.loadDebouncer=new P.Debouncer(10),this.analyticsEventsService=s??new Ne,this.initService(r)}async initService(e){this.service=await e();let{mapId:r,metadataFilters:n}=this.store.getState();return this.service.mapId=r,this.service.metadataFilters=n,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,P.deepEqual)(e,this.store.getState().metadataFilters)||(this.store.actions.metadataFilters(e),this.service&&(this.service.metadataFilters=e))}async awaitService(){return(0,P.waitFor)(()=>this.service)}async navigateToTopic(e,r,n){await this.loaded();let s=await this.resolvePage(e,n);this.store.actions.currentPage(s);let i=this.resolveValidNonRootTocId(e,s);this.store.actions.scrollTarget({tocId:i,section:r}),this.store.getState().visibleTopics[0]!==i&&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 n,s,i;let a=await this.awaitService();if(r)return a.getPage(r,this.getTranslationSettings());if(!e)return a.getPageByTocId("root",this.getTranslationSettings());let o=(n=this.store.getState().filteredTocNodes)===null||n===void 0?void 0:n[e],c=((s=this.service)===null||s===void 0?void 0:s.getTocNodeNow(e))!=null;return o&&o.reason!=="ACCESS_RIGHTS_FILTER"&&!c?a.getPageByTocId((i=o.closestParent)!==null&&i!==void 0?i:"root",this.getTranslationSettings()):a.getPageByTocId(e,this.getTranslationSettings())}resolveValidNonRootTocId(e,r){var n,s,i,a,o;let c=(s=e==="root"?void 0:e)!==null&&s!==void 0?s:r.rootTocId;if(!r.topics.includes(c)){if(e!="root"&&!r.hiddenTopics.includes(c)){let l=this.store.getState().filteredTocNodes[c];if(l){this.store.dispatchEvent(new Je(l));let u=((n=this.service)===null||n===void 0?void 0:n.getTocNodeNow(l.tocId))!=null;return l.reason==="ACCESS_RIGHTS_FILTER"||u?l.tocId:(i=l.closestParent)!==null&&i!==void 0?i:"root"}this.store.dispatchEvent(new CustomEvent(fe.requestedTopicNotFound))}return(o=(a=r.topics[0])!==null&&a!==void 0?a:r.hiddenTopics[0])!==null&&o!==void 0?o:"root"}return c}async navigateToPage(e){await this.loaded();let n=await(await this.awaitService()).getPage(e,this.getTranslationSettings());this.store.actions.currentPage(n)}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 n,s,i;this.clearFromFilter();let{scrollTarget:a,visibleTopics:o,currentPage:c}=this.store.getState(),l=(i=(s=(n=a?.tocId)!==null&&n!==void 0?n:o?.[0])!==null&&s!==void 0?s:c?.rootTocId)!==null&&i!==void 0?i:"root";await this.fetchDataFromFilter(),this.navigateToTopic(l,e,r)}async fetchDataFromFilter(){var e,r,n,s;let i=this.getTranslationSettings();try{await Promise.all([(e=this.service)===null||e===void 0?void 0:e.getToc(i).then(a=>this.store.actions.toc(a)),(r=this.service)===null||r===void 0?void 0:r.getPagesToc(i).then(a=>this.store.actions.pagesToc(a)),(n=this.service)===null||n===void 0?void 0:n.getFilteredTocNodes(i).then(a=>this.store.actions.filteredTocNodes(a))]),this._loaded=!0}catch(a){if(!(a instanceof P.CanceledPromiseError))throw i&&this.setTranslationError(!0),(s=this.errorHandler)===null||s===void 0||s.call(this,a),a}}async fetchData(){var e,r,n,s,i,a,o;let c=this.getTranslationSettings();try{c&&this.setTranslationLoading(!0),await Promise.all([this.loadConfiguration(),(e=this.service)===null||e===void 0?void 0:e.getMap(c).then(l=>this.store.actions.map(l)),(r=this.service)===null||r===void 0?void 0:r.getToc(c).then(l=>this.store.actions.toc(l)),(n=this.service)===null||n===void 0?void 0:n.getPagesToc(c).then(l=>this.store.actions.pagesToc(l)),(s=this.service)===null||s===void 0?void 0:s.getPaginationConfiguration().then(l=>this.store.actions.paginationConfiguration(l)),(i=this.service)===null||i===void 0?void 0:i.getFilteredTocNodes(c).then(l=>this.store.actions.filteredTocNodes(l)),(a=this.service)===null||a===void 0?void 0:a.getTranslationError(c).then(l=>this.setTranslationError(l))]),this.metadataForSwitchToRelatives.size>0&&this.fetchRelatives(),this._loaded=!0,c&&this.setTranslationLoading(!1)}catch(l){if(!(l instanceof P.CanceledPromiseError))throw c&&this.setTranslationError(!0),(o=this.errorHandler)===null||o===void 0||o.call(this,l),l}}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 n=(e=this.store.getState().map)===null||e===void 0?void 0:e.metadata.filter(s=>{var i;return s.key==((i=this.store.getState().configuration)===null||i===void 0?void 0:i.relativePivotMetadata)}).flatMap(s=>s.values);if(n!==void 0&&n.length>0){let s=await((r=this.service)===null||r===void 0?void 0:r.getRelativesForDocument(this.store.getState().configuration.relativePivotMetadata,n)),i=s?.results.flatMap(a=>a.entries);this.store.actions.relatives(i)}this.updateClusteringHelper()}updateClusteringHelper(){this.clusteringHelper=this.createClusteringHelper(),this.clusteringHelper&&this.store.dispatchEvent(new Event(fe.clusteringHelperCreated))}createClusteringHelper(){var e,r;if(this.clusteringHelperProvider)return this.clusteringHelperProvider();let n=this.store.getState().relatives;if(n){let s=n.find(a=>{var o;return((o=a.map)===null||o===void 0?void 0:o.mapId)==this.store.getState().mapId}),i=(r=(e=d.getState().metadataConfiguration)===null||e===void 0?void 0:e.descriptors)!==null&&r!==void 0?r:[];return new P.ClusteringHelper(n,s,this.metadataForSwitchToRelatives,i)}}async navigateToRelativeTopicIfFound(e){var r,n,s;await this.loaded();let i=await(0,P.waitFor)(()=>{var l;return(l=this.store.getState().configuration)===null||l===void 0?void 0:l.relativeTopicPivotMetadata}),a=this.store.getState().mapId,c=await(await this.awaitService()).getRelativesForTopicInMap(a,i,[e]);if(!((s=(n=(r=c?.results)===null||r===void 0?void 0:r[0])===null||n===void 0?void 0:n.entries)===null||s===void 0)&&s[0]){let l=c.results[0].entries[0].topic.tocId;return await this.navigateToTopic(l),!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 n=await((r=this.service)===null||r===void 0?void 0:r.getTopicRating(e));n&&this.store.actions.setTopicsRating({[e]:n})}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,n){return await this.awaitService(),this.service.getAccurateNavigationData(e,r?.number,n?.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,n;let s=this.getTranslationSettings();return s?(this.sendTopicAiTranslateEvent(s.destinationLanguage,e),(r=this.service)===null||r===void 0?void 0:r.getTranslatedTopicContent(e,s).then(i=>(i.isTranslationError&&this.setTranslationError(!0),i.content))):(n=this.service)===null||n===void 0?void 0:n.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(fe.mapAttachmentsUpdate))}async getRelativeDocumentUrlForLocale(e){var r,n,s;this.store.getState().relatives==null&&await this.fetchRelatives();let i=P.ClusteringHelper.findResultWithMetadataValue((s=this.store.getState().relatives)!==null&&s!==void 0?s:[],"ft:locale",e),a=(0,P.accessResultUrl)(i);if(a){let o=this.store.getState().visibleTopics[0],c=(r=this.store.getState().configuration)===null||r===void 0?void 0:r.relativeTopicPivotMetadata;if(c&&o){let l=await((n=this.service)===null||n===void 0?void 0:n.getTopicMetadataValue(o,c));a=Hs(a,l)}}return a}sendDocumentOnDemandTranslateEvent(e){var r;let{editorMode:n,apiIntegrationIdentifier:s,apiIntegrationAppVersion:i}=d.getState(),a=this.store.getState(),o=a.map,c=a.translation.profileId;if(!(n||!o||!s||!i||!c))try{let u={...this.analyticsEventsService.convertMapToAnalyticsDocument(o),title:(r=o.untranslatedTitle)!==null&&r!==void 0?r:o.title};this.analyticsEventsService.sendDocumentOnDemandTranslateEvent({name:"DOCUMENT__ON_DEMAND_TRANSLATE",offline:!1,appName:s,appVersion:i,sourceLanguage:this.parseLanguageToAnalyticsFormat(o.lang),destinationLanguage:this.parseLanguageToAnalyticsFormat(e.code),profileId:c,document:u,translationOrigin:et.AI})}catch(l){console.warn("Failed to send on-demand document translate event:",l)}}sendTopicAiTranslateEvent(e,r){var n;let{editorMode:s,apiIntegrationIdentifier:i,apiIntegrationAppVersion:a}=d.getState(),o=this.store.getState(),c=o.map,l=o.translation.profileId;if(!(s||!c||!i||!a||!l))try{let u=this.buildBreadcrumb(r.tocId);if(!u){console.warn("Failed to build breadcrumb for topic ai translate event");return}let h={...this.analyticsEventsService.convertMapToAnalyticsDocument(c),title:(n=c.untranslatedTitle)!==null&&n!==void 0?n:c.title};this.analyticsEventsService.sendTopicAiTranslateEvent({name:"TOPIC__AI_TRANSLATE",offline:!1,appName:i,appVersion:a,sourceLanguage:this.parseLanguageToAnalyticsFormat(c.lang),destinationLanguage:this.parseLanguageToAnalyticsFormat(e),breadcrumb:u.map(v=>{var S;return{tocId:v.tocId,title:(S=v.untranslatedTitle)!==null&&S!==void 0?S:v.title}}),document:h,profileId:l})}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 Ks=f(le());var $s=Ks.css`
|
|
5
|
-
`;var Kt=class extends CustomEvent{constructor(e,r){super("ft-reader-map-loaded",{detail:{map:e,toc:r}})}},$t=class extends CustomEvent{constructor(e,r){super("ft-reader-visible-topics-change",{detail:{visibleTopics:r}})}},zt=class extends CustomEvent{constructor(e){super("ft-reader-navigation-done",{detail:e})}},Gt=class extends CustomEvent{constructor(e){super("ft-reader-load-error",{detail:e})}},Wt=class extends Event{constructor(){super("ft-reader-map-not-found")}},Qt=class extends Event{constructor(){super("ft-reader-map-unauthorized")}},Yt=class extends Event{constructor(){super("ft-reader-map-forbidden")}},Xt=class extends Event{constructor(){super("ft-reader-topic-relative-not-found",{bubbles:!0,composed:!0})}};var
|
|
6
|
-
`;var Js=f(le()),G=f(se()),j=f(T());var pe=f(T()),Ye=f(se());var Ge;(function(t){t.CLUSTERED_SEARCH="CLUSTERED_SEARCH"})(Ge||(Ge={}));var C=f(T());var Ws=f(T()),Ea={setRequest:(t,e)=>{t.request=e.payload}},Qs=t=>Ws.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:Ea,deprecatedKeys:["locales"]});var Jt=class extends k{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((n,s)=>n.id.localeCompare(s.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 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((n,s)=>n.localeCompare(s))}}).sort((r,n)=>r.key.localeCompare(n.key))}};var Zt=class extends CustomEvent{constructor(e){super("ft-search-load-error",{detail:e,composed:!0,bubbles:!0})}},er=class extends CustomEvent{constructor(e){super("ft-search-request-change",{detail:e,composed:!0,bubbles:!0})}},tr=class extends CustomEvent{constructor(e,r,n){super("ft-search-results-change",{detail:{request:e,paging:r,spellcheck:n},composed:!0,bubbles:!0})}},We=class t extends Event{constructor(){super(t.eventName)}};We.eventName="search-context-clear-all-filters";var Sa=t=>t.request.virtualField===_e.TITLE_ONLY&&t.request.scope===Ce.DOCUMENTS,Aa=t=>t.request.keywordMatch==tt.MANDATORY,Qe=class t extends C.FtStateManager{static build(e,r){return new t(Qs(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 C.QueryHistoryStorage(this.store.actions.recentQueries),this.onNewNeededRequest=n=>{n==Ge.CLUSTERED_SEARCH&&this.launchSearch()},this.onStorageEvent=n=>{n.key===this.taruqaConfigStorageKey&&this.loadTaruqaTemplate()},this.loadTaruqaTemplate=()=>{var n;let s;if(Q(d.getState().session,A.DEBUG_USER)){let i=JSON.parse((n=window.localStorage.getItem(this.taruqaConfigStorageKey))!==null&&n!==void 0?n:"{}");s=i.overrideEnabled?i.template:void 0}this.updateSearchRequest({taruqaTemplateOverride:s,changedByConfiguration:!0})},this.updateLocales=(n=d.getState().availableContentLocales)=>{this.store.actions.locales(n),n.length>0&&this.forceContentLocale(this.store.getState().request.contentLocale)},this.searchDebouncer=new C.Debouncer(100),this.launchSearch=n=>this.searchDebouncer.run(()=>this.fetchSearchData(n??this.buildSearchRequest())),this.buildSearchRequest=(n=this.store.getState())=>{var s;return{...n.request,facets:this.facetIds.map(i=>({id:i})),stickyFiltersId:this.applyStickyFilters?(s=d.getState().stickyFilters)===null||s===void 0?void 0:s.id:void 0}},this.suggestDebouncer=new C.Debouncer(1e3),this.launchSuggest=n=>this.suggestDebouncer.run(()=>this.fetchSuggestData(n??this.buildSuggestRequest())),this.buildSuggestRequest=(n=this.store.getState())=>{var s,i;return{input:n.liveQuery,metadataFilters:n.request.metadataFilters,sort:(i=n.request.sort)!==null&&i!==void 0?i:[],sortId:n.request.sortId,contentLocale:n.request.contentLocale,scope:n.request.scope,keywordMatch:n.request.keywordMatch,stickyFiltersId:this.applyStickyFilters?(s=d.getState().stickyFilters)===null||s===void 0?void 0:s.id:void 0}},this.service=r??new Jt,this.searchWatcher=new C.ReduxWatcher(e,this.buildSearchRequest,this.launchSearch),this.suggestWatcher=new C.ReduxWatcher(e,this.buildSuggestRequest,this.launchSuggest),this.localesWatcher=new C.ReduxWatcher(d,n=>n.availableContentLocales,this.updateLocales),this.stickyFiltersIdWatcher=new C.ReduxWatcher(d,n=>{var s;return(s=n.stickyFilters)===null||s===void 0?void 0:s.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),d.addEventListener(z.eventName,this.loadTaruqaTemplate),this.searchWatcher.watch(),this.suggestWatcher.watch(),this.localesWatcher.watch(),this.stickyFiltersIdWatcher.watch(),this.history.enable(d.getState().tenantId+"-ft-recent-queries")}removeListeners(){window.removeEventListener("storage",this.onStorageEvent),d.removeEventListener(z.eventName,this.loadTaruqaTemplate),this.searchWatcher.stop(),this.suggestWatcher.stop(),this.localesWatcher.stop(),this.stickyFiltersIdWatcher.stop(),this.history.disable()}get taruqaConfigStorageKey(){return d.getState().tenantId+"-taruqa-experiment-conf"}updateSearchRequest(e,r=!1){let n=(0,C.deepCopy)(this.store.getState().request);delete n.changedByConfiguration,this.store.actions.setRequest({...n,paging:{perPage:n.paging.perPage,page:r?1:n.paging.page},...e})}setQuery(e){this.updateSearchRequest({query:e},!0),this.setLiveQuery(e)}setContentLocale(e){var r;let n=this.store.getState().request.contentLocale;return e!==n&&(e=t.findKnownContentLocale(e,n),this.updateSearchRequest({contentLocale:e,metadataFilters:[]},!0),this.canUpdateUiLocale&&(!((r=d.getState().localesConfiguration)===null||r===void 0)&&r.searchLanguageSetsUiLanguage)&&e&&ne.requestUiLocaleUpdate(e,e)),e}static findKnownContentLocale(...e){let{availableContentLocales:r,localesConfiguration:n}=d.getState();if(r.length===0)return e[0];let s=a=>r.some(o=>o.lang==a);for(let a of e)if(s(a))return a;let i=n?.defaultLocales.defaultContentLocale;return i?`${i.lang}-${i.region}`:r[0].lang}forceContentLocale(e){this.updateSearchRequest({contentLocale:t.findKnownContentLocale(e)})}setPageSize(e){let r=this.store.getState().request;this.updateSearchRequest({paging:{...r.paging,perPage:isNaN(e)?20:(0,C.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 n;let s=r?{changedByConfiguration:!0}:{};if(e==null||this.sortOptions.length==0)return this.updateSearchRequest({sortId:e,...s},!0),e;let i=(n=this.sortOptions.find(a=>a.id==e))!==null&&n!==void 0?n:this.sortOptions[0];return this.updateSearchRequest({sortId:i.id,...s},!0),i.id}setFilters(e){let r=e.filter(n=>!n.valueFilter||n.valueFilter.values.length>0);this.updateSearchRequest({metadataFilters:r},!0)}setClusterSortCriterion(e){this.updateSearchRequest({clusterSortCriterions:e})}setSearchInDocumentTitlesOnly(e){e?this.updateSearchRequest({virtualField:_e.TITLE_ONLY,scope:Ce.DOCUMENTS},!0):this.updateSearchRequest({virtualField:_e.EVERYWHERE,scope:Ce.DEFAULT},!0)}setKeywordMatch(e){this.updateSearchRequest({keywordMatch:e},!0)}setVirtualField(e){this.updateSearchRequest({virtualField:e},!0)}get searchInDocumentTitlesOnly(){return Sa(this.store.getState())}get keywordMatch(){return Aa(this.store.getState())}clearAllFilters(){this.setFilters([]),this.store.dispatchEvent(new We)}addFacet(e){this.facetIds=[...this.facetIds,e]}replaceFacet(e,r){let n=this.facetIds.filter(s=>s!=e);r&&n.push(r),this.facetIds=n}get facetIds(){var e;let r=this.store.getState().request;return[...new Set([...r.facets.map(n=>n.id),...((e=r.metadataFilters)!==null&&e!==void 0?e:[]).map(n=>n.key)])]}set facetIds(e){let n=[...new Set(e)].map(s=>({id:s}));this.updateSearchRequest({facets:n})}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 n=this.store.getState().request.metadataFilters,s={key:e,valueFilter:{values:r,negative:!1}},i=[...n.filter(a=>!a.valueFilter),...n.filter(a=>a.valueFilter&&a.key!==s.key),s];this.setFilters(i)}setDateFilter(e,r){let n=this.store.getState().request.metadataFilters,s={key:e,dateFilter:{type:r}},i=[...n.filter(a=>!a.dateFilter),...n.filter(a=>a.dateFilter&&a.key!==s.key),s];this.setFilters(i)}removeDateFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(s=>!s.dateFilter),...r.filter(s=>s.dateFilter&&s.key!==e)];this.setFilters(n)}setRangeFilter(e,r,n){let s=this.store.getState().request.metadataFilters,i={key:e,rangeFilter:{from:r,to:n}},a=[...s.filter(o=>!o.rangeFilter),...s.filter(o=>o.rangeFilter&&o.key!==i.key),i];this.setFilters(a)}removeRangeFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(s=>!s.rangeFilter),...r.filter(s=>s.rangeFilter&&s.key!==e)];this.setFilters(n)}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)}async fetchSearchData(e){var r,n,s,i,a;if((r=this.cancelableSearch)===null||r===void 0||r.cancel(),!!this.isRequestNeeded(Ge.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{!((n=this.store.getState().results)===null||n===void 0)&&n.length||this.store.actions.results(void 0),this.cancelableSearch=(0,C.cancelable)(this.service.launchSearch(e));let o=await this.cancelableSearch;if(this.store.actions.announcements(o.announcements),o.paging.currentPage<=1)this.store.actions.results(o.results),this.store.actions.facets(o.facets),this.store.actions.spellcheck(o.spellcheck);else{let c=((i=this.store.getState().results)!==null&&i!==void 0?i:[]).concat(o.results);this.store.actions.results(c),this.store.commands.clear(/^focus-result-/),this.store.commands.add({type:`focus-result-${(o.paging.currentPage-1)*((a=e.paging.perPage)!==null&&a!==void 0?a:20)+1}`})}this.store.actions.paging(o.paging)}}catch(o){o instanceof C.CanceledPromiseError||(console.error(o),(s=this.errorHandler)===null||s===void 0||s.call(this,o))}}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,C.cancelable)(this.service.launchSuggest(e));let n=await this.cancelableSuggest;this.store.actions.suggestResults(n.suggestions)}catch(n){!(n instanceof C.CanceledPromiseError)&&this.errorHandler&&this.errorHandler(n)}}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 qr=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},Hr=class extends pe.FtContextRegistrationEvent{constructor(e){super("register-ft-search-component",e)}},Ys=Symbol("registerInterval"),jr=Symbol("registerAttempts"),Ta=40,ba=(0,pe.applyMixinOnce)(Symbol("toFtSearchComponent"),function(t){class e extends t{constructor(){super(...arguments),this.neededSearchRequests=[]}willUpdate(n){var s,i,a;super.willUpdate(n),n.has("neededSearchRequests")&&((s=this.stateManager)===null||s===void 0||s.unregisterComponent(this,(a=n.get("neededSearchRequests"))!==null&&a!==void 0?a:[]),(i=this.stateManager)===null||i===void 0||i.registerComponent(this,this.neededSearchRequests))}setSearchStateManager(n){this.clearStateManager(),this.stateManager=n,this.stateManager.registerComponent(this,this.neededSearchRequests),this.addStore(n.store,"search")}clearStateManager(){this.stateManager&&(this.stateManager.unregisterComponent(this,this.neededSearchRequests),this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[jr]=0,this.tryToRegisterToContext(),this[Ys]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null||this[jr]>Ta?window.clearInterval(this[Ys]):(this[jr]++,this.dispatchEvent(new Hr({target:this,registrationId:this.searchRegistrationId})))}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return qr([(0,Ye.state)()],e.prototype,"stateManager",void 0),qr([(0,Ye.state)({hasChanged:pe.hasChanged})],e.prototype,"neededSearchRequests",void 0),qr([(0,Ye.property)()],e.prototype,"searchRegistrationId",void 0),e}),Xs=class extends ba(pe.FtLitElementRedux){};var ir=f(T());function rr(t){return t.filter(e=>e.key==="ft:lastEdition").filter(e=>!e.valueFilter).map(e=>e.dateFilter?e.dateFilter.type:"CUSTOM").shift()}function nr(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 sr=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=([n,s])=>{if(!this.canSendEvent()||!n||!s)return;let i=this.store.getState().request;this.document==null?this.sendKhubSearchEvent(i,n,s):this.sendDocumentSearchEvent(i,n,s)},this.eventsService=r??new Ne,this.resultsWatcher=(0,ir.watch)(e,n=>[n.results,n.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}=d.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}=d.getState();return this.enableAnalyticsEvents&&!e}sendKhubSearchEvent(e,r,n){let s={offline:!1,appVersion:this.appVersion,appName:this.appName,name:me.KHUB__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:n.totalClustersCount},searchQuery:{terms:e.query,searchType:e.virtualField,lastUpdate:rr(e.metadataFilters),facets:e.metadataFilters.map(i=>nr(i))}};this.eventsService.sendKhubSearchEvent(s)}sendDocumentSearchEvent(e,r,n){if(e.metadataFilters.find(i=>{var a;return i.key==="ft:publicationId"&&((a=i.valueFilter)===null||a===void 0?void 0:a.values[0])===this.document.id})!==void 0){let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:me.DOCUMENT__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:n.totalClustersCount},searchQuery:{terms:e.query},document:this.document};this.eventsService.sendDocumentSearchEvent(i)}}sendResultClickedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,s;e.type==J.TOPIC&&(s={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:me.SEARCH_PAGE__SELECT,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:rr(n.metadataFilters),facets:n.metadataFilters.map(a=>nr(a))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:s},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchPageSelectEvent(i)}sendResultContextMenuOpenedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,s;e.type==J.TOPIC&&(s={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:me.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:rr(n.metadataFilters),facets:n.metadataFilters.map(a=>nr(a))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:s},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchResultOpenContextMenuEvent(i)}convertDocument(e){switch(e.type){case J.MAP:return{id:e.map.mapId,title:e.map.title,type:ue.STRUCTURED_DOCUMENT,metadata:e.map.metadata};case J.TOPIC:return{id:e.topic.mapId,title:e.topic.mapTitle,type:ue.STRUCTURED_DOCUMENT,metadata:e.topic.metadata};case J.DOCUMENT:return{id:e.document.documentId,title:e.document.title,type:ue.UNSTRUCTURED_DOCUMENT,metadata:e.document.metadata,mimeType:e.document.mimeType};case J.HTML_PACKAGE:return{id:e.htmlPackage.packageId,title:e.htmlPackage.title,type:ue.HTML_PACKAGE,metadata:e.htmlPackage.metadata};case J.HTML_PACKAGE_PAGE:return{id:e.htmlPackagePage.packageId,title:e.htmlPackagePage.title,type:ue.HTML_PACKAGE,metadata:e.htmlPackagePage.metadata};default:throw new TypeError("Unknown type "+e.type)}}convertExternalLink(e){var r;return(r=(0,ir.accessResult)(e))===null||r===void 0?void 0:r.originUrl}};var w=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},E=class extends j.FtLitElementRedux{get stateManager(){if(this._stateManager==null){let e=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=Qe.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 sr(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.disableAnalyticsEvents=!1,this.addStore(d)}render(){return Js.html`
|
|
4
|
+
`}connectedCallback(){super.connectedCallback(),this.stateManager.addListeners(),this.contextRoot.attach(document.body)}disconnectedCallback(){super.disconnectedCallback(),this.stateManager.removeListeners(),this.contextRoot.detach(document.body)}update(e){var r;super.update(e),e.has("baseUrl")&&this.stateManager.setBaseUrl(this.baseUrl),e.has("tenantId")&&this.stateManager.setTenantId(this.tenantId),e.has("apiIntegrationIdentifier")&&this.stateManager.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),e.has("apiIntegrationAppVersion")&&this.stateManager.setApiIntegrationAppVersion(this.apiIntegrationAppVersion),e.has("uiLocale")&&this.stateManager.setUiLocale(this.uiLocale),e.has("metadataConfiguration")&&this.stateManager.setMetadataConfiguration(this.metadataConfiguration),e.has("noCustom")&&this.stateManager.setNoCustom(this.noCustom),e.has("editorMode")&&this.stateManager.setEditorMode(this.editorMode),e.has("noCustomComponent")&&this.stateManager.setNoCustomComponent(this.noCustomComponent),e.has("noCustomCode")&&this.stateManager.setNoCustomCode(this.noCustomCode),e.has("session")&&this.stateManager.setSession(this.session),e.has("messageContexts")&&this.messageContexts!=null&&this.messageContexts.forEach(n=>Ns.addContext(n)),e.has("openExternalDocumentInNewTab")&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("navigatorOnline")&&this.stateManager.setNavigatorOnline(this.navigatorOnline),e.has("forcedOffline")&&this.stateManager.setForcedOffline(this.forcedOffline),e.has("authenticationRequired")&&this.stateManager.setAuthenticationRequired(this.authenticationRequired),e.has("withManualResources")&&((r=this.stateManager)===null||r===void 0||r.setWithManualResources(this.withManualResources)),setTimeout(()=>this.stateManager.updateIfNeeded())}};b.elementDefinitions={};b.styles=Bs;N([(0,q.property)()],b.prototype,"baseUrl",void 0);N([(0,q.property)()],b.prototype,"tenantId",void 0);N([(0,q.property)()],b.prototype,"apiIntegrationIdentifier",void 0);N([(0,q.property)()],b.prototype,"apiIntegrationAppVersion",void 0);N([(0,q.property)()],b.prototype,"uiLocale",void 0);N([(0,be.jsonProperty)(null)],b.prototype,"availableUiLocales",void 0);N([(0,be.jsonProperty)(null)],b.prototype,"metadataConfiguration",void 0);N([(0,q.property)({type:Boolean})],b.prototype,"editorMode",void 0);N([(0,q.property)({type:Boolean})],b.prototype,"noCustom",void 0);N([(0,q.property)({type:Boolean})],b.prototype,"openExternalDocumentInNewTab",void 0);N([(0,q.property)({converter:{fromAttribute(t){return t==="false"?!1:t==="true"||(t??!1)}}})],b.prototype,"noCustomComponent",void 0);N([(0,q.property)({converter:{fromAttribute(t){return t==="false"?!1:t==="true"||(t??!1)}}})],b.prototype,"noCustomCode",void 0);N([(0,q.property)({type:Boolean})],b.prototype,"withManualResources",void 0);N([(0,q.property)({type:Boolean})],b.prototype,"navigatorOnline",void 0);N([(0,q.property)({type:Boolean})],b.prototype,"forcedOffline",void 0);N([(0,q.property)({type:Boolean})],b.prototype,"authenticationRequired",void 0);N([(0,be.jsonProperty)([])],b.prototype,"messageContexts",void 0);N([(0,be.jsonProperty)(void 0)],b.prototype,"session",void 0);var Hs=f(T());var js={"ft-app-context":b};(0,Hs.customElements)(js);var Ge=f(T()),qt=class extends M{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,n,s){super(!1,r),this.converter=e,this._mapId=n,this._metadataFilters=s,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.stickyFiltersId),()=>this.withMapId(e=>this.fetchPages(e,this._metadataFilters,this.stickyFiltersId).then(r=>this.converter.convertPaginatedToc(e,r)))),this.cache.register("ratingSummary",()=>{var e,r;return Q((r=(e=d.getState().session)===null||e===void 0?void 0:e.profile.roles)!==null&&r!==void 0?r:[],"RATING_USER")?this.withMapId(s=>this.fetchMapRating(s)):Promise.resolve()})}clear(){this.cache.clearMatching(e=>e!=="configuration")}makeCacheKey(e,r,n,s){return e+(r?"-destinationLanguage-"+r?.destinationLanguage:"")+(!n||n.length==0?"":"-metadataFilters-"+this.hash(n))+(s?"-stickyFilters-"+s:"")}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.stickyFiltersId),()=>this.fetchPages(this.mapId,this.metadataFilters,this.stickyFiltersId,e).then(r=>this.converter.convertPaginatedToc(this.mapId,r)))}getEnrichedTocNow(e){return this.cache.getNow(this.makeCacheKey("enrichedToc",e,this.metadataFilters,this.stickyFiltersId))}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 n;return(n=this.getEnrichedTocNow(r))===null||n===void 0?void 0:n.nodeByTocId[e]}getTocNodeNowByUrl(e,r){var n,s;let i=this.getMapNow(r);return i?.prettyUrl==e||`${i?.id}/root`===e?(n=this.getEnrichedTocNow(r))===null||n===void 0?void 0:n.toc[0]:(s=this.getEnrichedTocNow(r))===null||s===void 0?void 0:s.nodeByUrl[e]}async getPage(e,r){let n=await this.getEnrichedToc(r);return n.pages[e-1]||n.pages[0]}async getPageByTocId(e,r){let n=await this.getEnrichedToc(r);return n.pageByTocId[e]||n.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 n=this.getTocNodeNow(e);if(!n)return;let s=await this.getTopicInfo(n);return s?.metadata.find(i=>i.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,n){return this.cache.get("topic-relatives-"+[e,r,...n].join("-"),()=>this.fetchRelativesForTopicInMap(e,r,n))}getAttachmentDownloadLink(e){return this.makeAbsolute(`${this.api.endpoints.khub.maps.mapId(this.mapId).attachments.attachmentId(e).content}?download=true&locationValue=reader`)}getLink(e,r,n,s,i){let a;typeof e=="object"?(a=e.tocId,r=e.pageNumber,n=e.section,s=e.withMetadataFilter,i=e.withStickyFilters):a=e;let o=this.getNavigationData(a,r,n),c=this.getReaderLinkPrefix()+(o.prettyUrl?o.prettyUrl:`${o.mapId}/${o.tocId}`),l=new URL(c,this.api.tenantBaseUrl);if(o.page!=null&&l.searchParams.set("page",`${o.page}`),o.prettyUrlDuplicated&&l.searchParams.set("tocId",o.tocId),o.section!=null&&l.searchParams.set("section",o.section),s&&o.metadataFilters){let u=Ge.SearchPlaceConverter.serializeValueFilters(o.metadataFilters);u&&l.searchParams.set(Ge.SearchPlaceQueryParams.VALUE_FILTERS,u)}return i&&this.stickyFiltersId&&l.searchParams.set(Ge.SearchPlaceQueryParams.STICKY_FILTER,this.stickyFiltersId),l.href}getLinkWithFilter(e,r,n){return this.getLink(e,r,n,!0)}getNavigationData(e,r,n,s){var i,a;e=e||"root";let o=this.getEnrichedTocNow(s),c=o?.pageByTocId[e],l=o?.nodeByTocId[e],u=l?.prettyUrl;return{mapId:this.mapId,tocId:e,topicTitle:(i=l?.title)!==null&&i!==void 0?i:"",untranslatedTopicTitle:l?.untranslatedTitle,page:r&&c&&c.number!==r?r:void 0,prettyUrl:u?.replace(/^r\//,""),prettyUrlDuplicated:(a=o?.duplicatedPrettyUrls.has(u??""))!==null&&a!==void 0?a:!1,section:n,metadataFilters:this.metadataFilters}}async getAccurateNavigationData(e,r,n,s){return await this.getEnrichedToc(s),this.getNavigationData(e,r,n,s)}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 n;return r?{type:r.topics.type,rating:(n=r.topics)===null||n===void 0?void 0:n.ratings.find(s=>s.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,n){return this.makeRateTopicRequest(e,r,n).then(()=>this.clearRatingIfNecessary())}unrateTopic(e){return this.makeUnrateTopicRequest(e).then(()=>this.clearRatingIfNecessary())}async clearRatingIfNecessary(){let e=d.getState().session;e?.sessionAuthenticated&&this.cache.clear("ratingSummary")}sendTopicFeedback(e,r,n,s,i){return this.makeTopicFeedbackRequest(e,r,n,s,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 n=this.getTocNodeNow(e,r);if(!n)return[];let s=[{tocId:n.tocId,title:n.title,untranslatedTitle:n.untranslatedTitle}],i=this.getTocNodeNow(n.parentTocId,r);for(;i;)s.unshift({tocId:i.tocId,title:i.title,untranslatedTitle:i.untranslatedTitle}),i=this.getTocNodeNow(i.parentTocId,r);return s}isFeatureAccessible(e,{session:r}){var n;if(!this.isFeatureAvailable(e))return!1;switch(e){case ae.FEEDBACK:return Q(r??[],A.FEEDBACK_USER);case ae.RATING:return Q(r??[],A.RATING_USER);case ae.PRINT:return Q(r??[],A.PRINT_USER);case ae.BOOKMARK:return!!r?.sessionAuthenticated;case ae.COLLECTIONS:return Q(r??[],A.COLLECTION_USER);case ae.PERSONAL_BOOKS:return Q(r??[],A.PERSONAL_BOOK_USER)&&!(!((n=this.getMapNow())===null||n===void 0)&&n.pbkConfidential);default:return!1}}makeAbsolute(e){return this.api.makeAbsolute(e)}};var jt=class t extends qt{static async build(e){return new t(new et,void 0,e)}clear(){super.clear(),this.fingerprint=void 0}async fetchMap(e,r){let n=await this.api.getMap(e,r);return this.fingerprint=n.fingerprint,n}fetchMapRating(e){return this.api.getMapRating(e)}async fetchPages(e,r,n,s){return await this.getMap(s),r?.length||n?this.api.getFilteredPages(e,s,r,n):this.api.getPages(e,this.fingerprint,s)}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 n={query:"",paging:{page:1,perPage:-1},scope:"DOCUMENTS",metadataFilters:[{key:e,valueFilter:{negative:!1,values:r}}],sort:[],facets:[]};return this.api.search(n)}fetchRelativesForTopicInMap(e,r,n){let s={query:"",paging:{page:1,perPage:1},scope:"ALL_TOPICS",metadataFilters:[{key:r,valueFilter:{negative:!1,values:n}},{key:"ft:publicationId",valueFilter:{negative:!1,values:[e]}}],sort:[],facets:[]};return this.api.search(s)}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,n){return this.api.rateTopic(this.mapId,e,r,n)}makeTopicFeedbackRequest(e,r,n,s,i){return this.api.sendTopicFeedback(this.mapId,e,r,n,s,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 Ea="topicPivot";function Ks(t,e){let r=new URL(t);return e?.values.forEach(n=>{r.searchParams.append(Ea,n)}),r.href}var Ht=class t{static build(e,r){return new t(Yr(e.trim()||"context"),r??jt.build)}loaded(){return(0,k.waitUntil)(()=>this._loaded)}constructor(e,r,n,s){this.store=e,this.clusteringHelperProvider=n,this.metadataForSwitchToRelatives=new Set,this._loaded=!1,this.loadDebouncer=new k.Debouncer(10),this.analyticsEventsService=s??new Ne,this.initService(r),this.stickyFiltersIdWatcher=new k.ReduxWatcher(d,i=>{var a;return(a=i.stickyFilters)===null||a===void 0?void 0:a.id},()=>this.reloadFromSticky())}async initService(e){var r;this.service=await e();let{mapId:n,metadataFilters:s,applyStickyFilters:i}=this.store.getState();return this.service.mapId=n,this.service.metadataFilters=s,this.service.stickyFiltersId=i?(r=d.getState().stickyFilters)===null||r===void 0?void 0:r.id:void 0,this.reload()}removeListeners(){this.stickyFiltersIdWatcher.stop()}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 setApplyStickyFilters(e){e?this.stickyFiltersIdWatcher.watch():this.stickyFiltersIdWatcher.stop(),e!=this.store.getState().applyStickyFilters&&(this.store.actions.applyStickyFilters(e),await this.reloadFromSticky())}async setFilters(e){(0,k.deepEqual)(e,this.store.getState().metadataFilters)||(this.store.actions.metadataFilters(e),this.service&&(this.service.metadataFilters=e))}async awaitService(){return(0,k.waitFor)(()=>this.service)}async navigateToTopic(e,r,n){await this.loaded();let s=await this.resolvePage(e,n);this.store.actions.currentPage(s);let i=this.resolveValidNonRootTocId(e,s);this.store.actions.scrollTarget({tocId:i,section:r}),this.store.getState().visibleTopics[0]!==i&&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 n,s,i;let a=await this.awaitService();if(r)return a.getPage(r,this.getTranslationSettings());if(!e)return a.getPageByTocId("root",this.getTranslationSettings());let o=(n=this.store.getState().filteredTocNodes)===null||n===void 0?void 0:n[e],c=((s=this.service)===null||s===void 0?void 0:s.getTocNodeNow(e))!=null;return o&&o.reason!=="ACCESS_RIGHTS_FILTER"&&!c?a.getPageByTocId((i=o.closestParent)!==null&&i!==void 0?i:"root",this.getTranslationSettings()):a.getPageByTocId(e,this.getTranslationSettings())}resolveValidNonRootTocId(e,r){var n,s,i,a,o;let c=(s=e==="root"?void 0:e)!==null&&s!==void 0?s:r.rootTocId;if(!r.topics.includes(c)){if(e!="root"&&!r.hiddenTopics.includes(c)){let l=this.store.getState().filteredTocNodes[c];if(l){this.store.dispatchEvent(new Ze(l));let u=((n=this.service)===null||n===void 0?void 0:n.getTocNodeNow(l.tocId))!=null;return l.reason==="ACCESS_RIGHTS_FILTER"||u?l.tocId:(i=l.closestParent)!==null&&i!==void 0?i:"root"}this.store.dispatchEvent(new CustomEvent(fe.requestedTopicNotFound))}return(o=(a=r.topics[0])!==null&&a!==void 0?a:r.hiddenTopics[0])!==null&&o!==void 0?o:"root"}return c}async navigateToPage(e){await this.loaded();let n=await(await this.awaitService()).getPage(e,this.getTranslationSettings());this.store.actions.currentPage(n)}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 reloadFromSticky(){var e;let{scrollTarget:r,applyStickyFilters:n,currentPage:s}=this.store.getState(),i=n?(e=d.getState().stickyFilters)===null||e===void 0?void 0:e.id:void 0;this.service&&this.service.stickyFiltersId!=i&&(this.service.stickyFiltersId=i,await this.reloadFromFilter(r?.section,s?.number))}async reloadFromFilter(e,r){var n,s,i;this.clearFromFilter();let{scrollTarget:a,visibleTopics:o,currentPage:c}=this.store.getState(),l=(i=(s=(n=a?.tocId)!==null&&n!==void 0?n:o?.[0])!==null&&s!==void 0?s:c?.rootTocId)!==null&&i!==void 0?i:"root";await this.fetchDataFromFilter(),this.navigateToTopic(l,e,r)}async fetchDataFromFilter(){var e,r,n,s;let i=this.getTranslationSettings();try{await Promise.all([(e=this.service)===null||e===void 0?void 0:e.getToc(i).then(a=>this.store.actions.toc(a)),(r=this.service)===null||r===void 0?void 0:r.getPagesToc(i).then(a=>this.store.actions.pagesToc(a)),(n=this.service)===null||n===void 0?void 0:n.getFilteredTocNodes(i).then(a=>this.store.actions.filteredTocNodes(a))]),this._loaded=!0}catch(a){if(!(a instanceof k.CanceledPromiseError))throw i&&this.setTranslationError(!0),(s=this.errorHandler)===null||s===void 0||s.call(this,a),a}}async fetchData(){var e,r,n,s,i,a,o;let c=this.getTranslationSettings();try{c&&this.setTranslationLoading(!0),await Promise.all([this.loadConfiguration(),(e=this.service)===null||e===void 0?void 0:e.getMap(c).then(l=>this.store.actions.map(l)),(r=this.service)===null||r===void 0?void 0:r.getToc(c).then(l=>this.store.actions.toc(l)),(n=this.service)===null||n===void 0?void 0:n.getPagesToc(c).then(l=>this.store.actions.pagesToc(l)),(s=this.service)===null||s===void 0?void 0:s.getPaginationConfiguration().then(l=>this.store.actions.paginationConfiguration(l)),(i=this.service)===null||i===void 0?void 0:i.getFilteredTocNodes(c).then(l=>this.store.actions.filteredTocNodes(l)),(a=this.service)===null||a===void 0?void 0:a.getTranslationError(c).then(l=>this.setTranslationError(l))]),this.metadataForSwitchToRelatives.size>0&&this.fetchRelatives(),this._loaded=!0,c&&this.setTranslationLoading(!1)}catch(l){if(!(l instanceof k.CanceledPromiseError))throw c&&this.setTranslationError(!0),(o=this.errorHandler)===null||o===void 0||o.call(this,l),l}}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 n=(e=this.store.getState().map)===null||e===void 0?void 0:e.metadata.filter(s=>{var i;return s.key==((i=this.store.getState().configuration)===null||i===void 0?void 0:i.relativePivotMetadata)}).flatMap(s=>s.values);if(n!==void 0&&n.length>0){let s=await((r=this.service)===null||r===void 0?void 0:r.getRelativesForDocument(this.store.getState().configuration.relativePivotMetadata,n)),i=s?.results.flatMap(a=>a.entries);this.store.actions.relatives(i)}this.updateClusteringHelper()}updateClusteringHelper(){this.clusteringHelper=this.createClusteringHelper(),this.clusteringHelper&&this.store.dispatchEvent(new Event(fe.clusteringHelperCreated))}createClusteringHelper(){var e,r;if(this.clusteringHelperProvider)return this.clusteringHelperProvider();let n=this.store.getState().relatives;if(n){let s=n.find(a=>{var o;return((o=a.map)===null||o===void 0?void 0:o.mapId)==this.store.getState().mapId}),i=(r=(e=d.getState().metadataConfiguration)===null||e===void 0?void 0:e.descriptors)!==null&&r!==void 0?r:[];return new k.ClusteringHelper(n,s,this.metadataForSwitchToRelatives,i)}}async navigateToRelativeTopicIfFound(e){var r,n,s;await this.loaded();let i=await(0,k.waitFor)(()=>{var l;return(l=this.store.getState().configuration)===null||l===void 0?void 0:l.relativeTopicPivotMetadata}),a=this.store.getState().mapId,c=await(await this.awaitService()).getRelativesForTopicInMap(a,i,[e]);if(!((s=(n=(r=c?.results)===null||r===void 0?void 0:r[0])===null||n===void 0?void 0:n.entries)===null||s===void 0)&&s[0]){let l=c.results[0].entries[0].topic.tocId;return await this.navigateToTopic(l),!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 n=await((r=this.service)===null||r===void 0?void 0:r.getTopicRating(e));n&&this.store.actions.setTopicsRating({[e]:n})}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,n){return await this.awaitService(),this.service.getAccurateNavigationData(e,r?.number,n?.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,n;let s=this.getTranslationSettings();return s?(this.sendTopicAiTranslateEvent(s.destinationLanguage,e),(r=this.service)===null||r===void 0?void 0:r.getTranslatedTopicContent(e,s).then(i=>(i.isTranslationError&&this.setTranslationError(!0),i.content))):(n=this.service)===null||n===void 0?void 0:n.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(fe.mapAttachmentsUpdate))}async getRelativeDocumentUrlForLocale(e){var r,n,s;this.store.getState().relatives==null&&await this.fetchRelatives();let i=k.ClusteringHelper.findResultWithMetadataValue((s=this.store.getState().relatives)!==null&&s!==void 0?s:[],"ft:locale",e),a=(0,k.accessResultUrl)(i);if(a){let o=this.store.getState().visibleTopics[0],c=(r=this.store.getState().configuration)===null||r===void 0?void 0:r.relativeTopicPivotMetadata;if(c&&o){let l=await((n=this.service)===null||n===void 0?void 0:n.getTopicMetadataValue(o,c));a=Ks(a,l)}}return a}sendDocumentOnDemandTranslateEvent(e){var r;let{editorMode:n,apiIntegrationIdentifier:s,apiIntegrationAppVersion:i}=d.getState(),a=this.store.getState(),o=a.map,c=a.translation.profileId;if(!(n||!o||!s||!i||!c))try{let u={...this.analyticsEventsService.convertMapToAnalyticsDocument(o),title:(r=o.untranslatedTitle)!==null&&r!==void 0?r:o.title};this.analyticsEventsService.sendDocumentOnDemandTranslateEvent({name:"DOCUMENT__ON_DEMAND_TRANSLATE",offline:!1,appName:s,appVersion:i,sourceLanguage:this.parseLanguageToAnalyticsFormat(o.lang),destinationLanguage:this.parseLanguageToAnalyticsFormat(e.code),profileId:c,document:u,translationOrigin:tt.AI})}catch(l){console.warn("Failed to send on-demand document translate event:",l)}}sendTopicAiTranslateEvent(e,r){var n;let{editorMode:s,apiIntegrationIdentifier:i,apiIntegrationAppVersion:a}=d.getState(),o=this.store.getState(),c=o.map,l=o.translation.profileId;if(!(s||!c||!i||!a||!l))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(c),title:(n=c.untranslatedTitle)!==null&&n!==void 0?n:c.title};this.analyticsEventsService.sendTopicAiTranslateEvent({name:"TOPIC__AI_TRANSLATE",offline:!1,appName:i,appVersion:a,sourceLanguage:this.parseLanguageToAnalyticsFormat(c.lang),destinationLanguage:this.parseLanguageToAnalyticsFormat(e),breadcrumb:u.map(v=>{var S;return{tocId:v.tocId,title:(S=v.untranslatedTitle)!==null&&S!==void 0?S:v.title}}),document:p,profileId:l})}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 $s=f(le());var zs=$s.css`
|
|
5
|
+
`;var Kt=class extends CustomEvent{constructor(e,r){super("ft-reader-map-loaded",{detail:{map:e,toc:r}})}},$t=class extends CustomEvent{constructor(e,r){super("ft-reader-visible-topics-change",{detail:{visibleTopics:r}})}},zt=class extends CustomEvent{constructor(e){super("ft-reader-navigation-done",{detail:e})}},Gt=class extends CustomEvent{constructor(e){super("ft-reader-load-error",{detail:e})}},Wt=class extends Event{constructor(){super("ft-reader-map-not-found")}},Qt=class extends Event{constructor(){super("ft-reader-map-unauthorized")}},Yt=class extends Event{constructor(){super("ft-reader-map-forbidden")}},Xt=class extends Event{constructor(){super("ft-reader-topic-relative-not-found",{bubbles:!0,composed:!0})}};var Gs=f(le());var Ws=Gs.css`
|
|
6
|
+
`;var Zs=f(le()),G=f(ie()),j=f(T());var pe=f(T()),Xe=f(ie());var We;(function(t){t.CLUSTERED_SEARCH="CLUSTERED_SEARCH"})(We||(We={}));var w=f(T());var Qs=f(T()),Sa={setRequest:(t,e)=>{t.request=e.payload}},Ys=t=>Qs.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:Sa,deprecatedKeys:["locales"]});var Jt=class extends M{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((n,s)=>n.id.localeCompare(s.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 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((n,s)=>n.localeCompare(s))}}).sort((r,n)=>r.key.localeCompare(n.key))}};var Zt=class extends CustomEvent{constructor(e){super("ft-search-load-error",{detail:e,composed:!0,bubbles:!0})}},er=class extends CustomEvent{constructor(e){super("ft-search-request-change",{detail:e,composed:!0,bubbles:!0})}},tr=class extends CustomEvent{constructor(e,r,n){super("ft-search-results-change",{detail:{request:e,paging:r,spellcheck:n},composed:!0,bubbles:!0})}},Qe=class t extends Event{constructor(){super(t.eventName)}};Qe.eventName="search-context-clear-all-filters";var Aa=t=>t.request.virtualField===_e.TITLE_ONLY&&t.request.scope===Ce.DOCUMENTS,Ta=t=>t.request.keywordMatch==rt.MANDATORY,Ye=class t extends w.FtStateManager{static build(e,r){return new t(Ys(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 w.QueryHistoryStorage(this.store.actions.recentQueries),this.onNewNeededRequest=n=>{n==We.CLUSTERED_SEARCH&&this.launchSearch()},this.onStorageEvent=n=>{n.key===this.taruqaConfigStorageKey&&this.loadTaruqaTemplate()},this.loadTaruqaTemplate=()=>{var n;let s;if(Q(d.getState().session,A.DEBUG_USER)){let i=JSON.parse((n=window.localStorage.getItem(this.taruqaConfigStorageKey))!==null&&n!==void 0?n:"{}");s=i.overrideEnabled?i.template:void 0}this.updateSearchRequest({taruqaTemplateOverride:s,changedByConfiguration:!0})},this.updateLocales=(n=d.getState().availableContentLocales)=>{this.store.actions.locales(n),n.length>0&&this.forceContentLocale(this.store.getState().request.contentLocale)},this.searchDebouncer=new w.Debouncer(100),this.launchSearch=n=>this.searchDebouncer.run(()=>this.fetchSearchData(n??this.buildSearchRequest())),this.buildSearchRequest=(n=this.store.getState())=>{var s;return{...n.request,facets:this.facetIds.map(i=>({id:i})),stickyFiltersId:this.applyStickyFilters?(s=d.getState().stickyFilters)===null||s===void 0?void 0:s.id:void 0}},this.suggestDebouncer=new w.Debouncer(1e3),this.launchSuggest=n=>this.suggestDebouncer.run(()=>this.fetchSuggestData(n??this.buildSuggestRequest())),this.buildSuggestRequest=(n=this.store.getState())=>{var s,i;return{input:n.liveQuery,metadataFilters:n.request.metadataFilters,sort:(i=n.request.sort)!==null&&i!==void 0?i:[],sortId:n.request.sortId,contentLocale:n.request.contentLocale,scope:n.request.scope,keywordMatch:n.request.keywordMatch,stickyFiltersId:this.applyStickyFilters?(s=d.getState().stickyFilters)===null||s===void 0?void 0:s.id:void 0}},this.service=r??new Jt,this.searchWatcher=new w.ReduxWatcher(e,this.buildSearchRequest,this.launchSearch),this.suggestWatcher=new w.ReduxWatcher(e,this.buildSuggestRequest,this.launchSuggest),this.localesWatcher=new w.ReduxWatcher(d,n=>n.availableContentLocales,this.updateLocales),this.stickyFiltersIdWatcher=new w.ReduxWatcher(d,n=>{var s;return(s=n.stickyFilters)===null||s===void 0?void 0:s.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),d.addEventListener(z.eventName,this.loadTaruqaTemplate),this.searchWatcher.watch(),this.suggestWatcher.watch(),this.localesWatcher.watch(),this.stickyFiltersIdWatcher.watch(),this.history.enable(d.getState().tenantId+"-ft-recent-queries")}removeListeners(){window.removeEventListener("storage",this.onStorageEvent),d.removeEventListener(z.eventName,this.loadTaruqaTemplate),this.searchWatcher.stop(),this.suggestWatcher.stop(),this.localesWatcher.stop(),this.stickyFiltersIdWatcher.stop(),this.history.disable()}get taruqaConfigStorageKey(){return d.getState().tenantId+"-taruqa-experiment-conf"}updateSearchRequest(e,r=!1){let n=(0,w.deepCopy)(this.store.getState().request);delete n.changedByConfiguration,this.store.actions.setRequest({...n,paging:{perPage:n.paging.perPage,page:r?1:n.paging.page},...e})}setQuery(e){this.updateSearchRequest({query:e},!0),this.setLiveQuery(e)}setContentLocale(e){var r;let n=this.store.getState().request.contentLocale;return e!==n&&(e=t.findKnownContentLocale(e,n),this.updateSearchRequest({contentLocale:e,metadataFilters:[]},!0),this.canUpdateUiLocale&&(!((r=d.getState().localesConfiguration)===null||r===void 0)&&r.searchLanguageSetsUiLanguage)&&e&&ne.requestUiLocaleUpdate(e,e)),e}static findKnownContentLocale(...e){let{availableContentLocales:r,localesConfiguration:n}=d.getState();if(r.length===0)return e[0];let s=a=>r.some(o=>o.lang==a);for(let a of e)if(s(a))return a;let i=n?.defaultLocales.defaultContentLocale;return i?`${i.lang}-${i.region}`:r[0].lang}forceContentLocale(e){this.updateSearchRequest({contentLocale:t.findKnownContentLocale(e)})}setPageSize(e){let r=this.store.getState().request;this.updateSearchRequest({paging:{...r.paging,perPage:isNaN(e)?20:(0,w.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 n;let s=r?{changedByConfiguration:!0}:{};if(e==null||this.sortOptions.length==0)return this.updateSearchRequest({sortId:e,...s},!0),e;let i=(n=this.sortOptions.find(a=>a.id==e))!==null&&n!==void 0?n:this.sortOptions[0];return this.updateSearchRequest({sortId:i.id,...s},!0),i.id}setFilters(e){let r=e.filter(n=>!n.valueFilter||n.valueFilter.values.length>0);this.updateSearchRequest({metadataFilters:r},!0)}setClusterSortCriterion(e){this.updateSearchRequest({clusterSortCriterions:e})}setSearchInDocumentTitlesOnly(e){e?this.updateSearchRequest({virtualField:_e.TITLE_ONLY,scope:Ce.DOCUMENTS},!0):this.updateSearchRequest({virtualField:_e.EVERYWHERE,scope:Ce.DEFAULT},!0)}setKeywordMatch(e){this.updateSearchRequest({keywordMatch:e},!0)}setVirtualField(e){this.updateSearchRequest({virtualField:e},!0)}get searchInDocumentTitlesOnly(){return Aa(this.store.getState())}get keywordMatch(){return Ta(this.store.getState())}clearAllFilters(){this.setFilters([]),this.store.dispatchEvent(new Qe)}addFacet(e){this.facetIds=[...this.facetIds,e]}replaceFacet(e,r){let n=this.facetIds.filter(s=>s!=e);r&&n.push(r),this.facetIds=n}get facetIds(){var e;let r=this.store.getState().request;return[...new Set([...r.facets.map(n=>n.id),...((e=r.metadataFilters)!==null&&e!==void 0?e:[]).map(n=>n.key)])]}set facetIds(e){let n=[...new Set(e)].map(s=>({id:s}));this.updateSearchRequest({facets:n})}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 n=this.store.getState().request.metadataFilters,s={key:e,valueFilter:{values:r,negative:!1}},i=[...n.filter(a=>!a.valueFilter),...n.filter(a=>a.valueFilter&&a.key!==s.key),s];this.setFilters(i)}setDateFilter(e,r){let n=this.store.getState().request.metadataFilters,s={key:e,dateFilter:{type:r}},i=[...n.filter(a=>!a.dateFilter),...n.filter(a=>a.dateFilter&&a.key!==s.key),s];this.setFilters(i)}removeDateFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(s=>!s.dateFilter),...r.filter(s=>s.dateFilter&&s.key!==e)];this.setFilters(n)}setRangeFilter(e,r,n){let s=this.store.getState().request.metadataFilters,i={key:e,rangeFilter:{from:r,to:n}},a=[...s.filter(o=>!o.rangeFilter),...s.filter(o=>o.rangeFilter&&o.key!==i.key),i];this.setFilters(a)}removeRangeFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(s=>!s.rangeFilter),...r.filter(s=>s.rangeFilter&&s.key!==e)];this.setFilters(n)}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)}async fetchSearchData(e){var r,n,s,i,a;if((r=this.cancelableSearch)===null||r===void 0||r.cancel(),!!this.isRequestNeeded(We.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{!((n=this.store.getState().results)===null||n===void 0)&&n.length||this.store.actions.results(void 0),this.cancelableSearch=(0,w.cancelable)(this.service.launchSearch(e));let o=await this.cancelableSearch;if(this.store.actions.announcements(o.announcements),o.paging.currentPage<=1)this.store.actions.results(o.results),this.store.actions.facets(o.facets),this.store.actions.spellcheck(o.spellcheck);else{let c=((i=this.store.getState().results)!==null&&i!==void 0?i:[]).concat(o.results);this.store.actions.results(c),this.store.commands.clear(/^focus-result-/),this.store.commands.add({type:`focus-result-${(o.paging.currentPage-1)*((a=e.paging.perPage)!==null&&a!==void 0?a:20)+1}`})}this.store.actions.paging(o.paging)}}catch(o){o instanceof w.CanceledPromiseError||(console.error(o),(s=this.errorHandler)===null||s===void 0||s.call(this,o))}}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,w.cancelable)(this.service.launchSuggest(e));let n=await this.cancelableSuggest;this.store.actions.suggestResults(n.suggestions)}catch(n){!(n instanceof w.CanceledPromiseError)&&this.errorHandler&&this.errorHandler(n)}}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 qr=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},Hr=class extends pe.FtContextRegistrationEvent{constructor(e){super("register-ft-search-component",e)}},Xs=Symbol("registerInterval"),jr=Symbol("registerAttempts"),ba=40,_a=(0,pe.applyMixinOnce)(Symbol("toFtSearchComponent"),function(t){class e extends t{constructor(){super(...arguments),this.neededSearchRequests=[]}willUpdate(n){var s,i,a;super.willUpdate(n),n.has("neededSearchRequests")&&((s=this.stateManager)===null||s===void 0||s.unregisterComponent(this,(a=n.get("neededSearchRequests"))!==null&&a!==void 0?a:[]),(i=this.stateManager)===null||i===void 0||i.registerComponent(this,this.neededSearchRequests))}setSearchStateManager(n){this.clearStateManager(),this.stateManager=n,this.stateManager.registerComponent(this,this.neededSearchRequests),this.addStore(n.store,"search")}clearStateManager(){this.stateManager&&(this.stateManager.unregisterComponent(this,this.neededSearchRequests),this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[jr]=0,this.tryToRegisterToContext(),this[Xs]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null||this[jr]>ba?window.clearInterval(this[Xs]):(this[jr]++,this.dispatchEvent(new Hr({target:this,registrationId:this.searchRegistrationId})))}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return qr([(0,Xe.state)()],e.prototype,"stateManager",void 0),qr([(0,Xe.state)({hasChanged:pe.hasChanged})],e.prototype,"neededSearchRequests",void 0),qr([(0,Xe.property)()],e.prototype,"searchRegistrationId",void 0),e}),Js=class extends _a(pe.FtLitElementRedux){};var ir=f(T());function rr(t){return t.filter(e=>e.key==="ft:lastEdition").filter(e=>!e.valueFilter).map(e=>e.dateFilter?e.dateFilter.type:"CUSTOM").shift()}function nr(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 sr=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=([n,s])=>{if(!this.canSendEvent()||!n||!s)return;let i=this.store.getState().request;this.document==null?this.sendKhubSearchEvent(i,n,s):this.sendDocumentSearchEvent(i,n,s)},this.eventsService=r??new Ne,this.resultsWatcher=(0,ir.watch)(e,n=>[n.results,n.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}=d.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}=d.getState();return this.enableAnalyticsEvents&&!e}sendKhubSearchEvent(e,r,n){let s={offline:!1,appVersion:this.appVersion,appName:this.appName,name:me.KHUB__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:n.totalClustersCount},searchQuery:{terms:e.query,searchType:e.virtualField,lastUpdate:rr(e.metadataFilters),facets:e.metadataFilters.map(i=>nr(i))}};this.eventsService.sendKhubSearchEvent(s)}sendDocumentSearchEvent(e,r,n){if(e.metadataFilters.find(i=>{var a;return i.key==="ft:publicationId"&&((a=i.valueFilter)===null||a===void 0?void 0:a.values[0])===this.document.id})!==void 0){let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:me.DOCUMENT__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:n.totalClustersCount},searchQuery:{terms:e.query},document:this.document};this.eventsService.sendDocumentSearchEvent(i)}}sendResultClickedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,s;e.type==J.TOPIC&&(s={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:me.SEARCH_PAGE__SELECT,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:rr(n.metadataFilters),facets:n.metadataFilters.map(a=>nr(a))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:s},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchPageSelectEvent(i)}sendResultContextMenuOpenedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,s;e.type==J.TOPIC&&(s={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:me.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:rr(n.metadataFilters),facets:n.metadataFilters.map(a=>nr(a))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:s},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchResultOpenContextMenuEvent(i)}convertDocument(e){switch(e.type){case J.MAP:return{id:e.map.mapId,title:e.map.title,type:ue.STRUCTURED_DOCUMENT,metadata:e.map.metadata};case J.TOPIC:return{id:e.topic.mapId,title:e.topic.mapTitle,type:ue.STRUCTURED_DOCUMENT,metadata:e.topic.metadata};case J.DOCUMENT:return{id:e.document.documentId,title:e.document.title,type:ue.UNSTRUCTURED_DOCUMENT,metadata:e.document.metadata,mimeType:e.document.mimeType};case J.HTML_PACKAGE:return{id:e.htmlPackage.packageId,title:e.htmlPackage.title,type:ue.HTML_PACKAGE,metadata:e.htmlPackage.metadata};case J.HTML_PACKAGE_PAGE:return{id:e.htmlPackagePage.packageId,title:e.htmlPackagePage.title,type:ue.HTML_PACKAGE,metadata:e.htmlPackagePage.metadata};default:throw new TypeError("Unknown type "+e.type)}}convertExternalLink(e){var r;return(r=(0,ir.accessResult)(e))===null||r===void 0?void 0:r.originUrl}};var x=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},E=class extends j.FtLitElementRedux{get stateManager(){if(this._stateManager==null){let e=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=Ye.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 sr(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.disableAnalyticsEvents=!1,this.addStore(d)}render(){return Zs.html`
|
|
7
7
|
<slot @register-ft-search-component=${this.registerComponent} @ft-search-result-click=${this.onResultClicked}
|
|
8
8
|
@ft-search-result-open-context-menu=${this.onResultContextMenuOpened}></slot>
|
|
9
|
-
`}willUpdate(e){super.willUpdate(e),e.has("_appIntegrationInfoReady")&&this._appIntegrationInfoReady&&this.eventManager.initAppInfo(),e.has("disableAnalyticsEvents")&&this.eventManager.setEnableAnalyticsEvents(!this.disableAnalyticsEvents),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(),ne.knownContexts.register(this),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(),ne.knownContexts.unregister(this),this.stateManager.removeListeners(),this.stateManager.clearResults()}contentAvailableCallback(e){super.contentAvailableCallback(e),e.has("request")&&this.request&&this.dispatchEvent(new er(this.request)),e.has("paging")&&this.paging!==void 0&&this.dispatchEvent(new tr(this.request,this.paging,this.spellcheckAutocorrect))}registerComponent(e){var r,n,s;if(e.stopPropagation(),((r=e.detail)===null||r===void 0?void 0:r.registrationId)==this.registrationId){let i=(s=(n=e.detail)===null||n===void 0?void 0:n.target)!==null&&s!==void 0?s:e.composedPath()[0];this.register(i)}}register(e){e.setSearchStateManager(this.stateManager)}handleLoadError(e){this.dispatchEvent(new Zt(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)}};E.elementDefinitions={};E.styles=
|
|
9
|
+
`}willUpdate(e){super.willUpdate(e),e.has("_appIntegrationInfoReady")&&this._appIntegrationInfoReady&&this.eventManager.initAppInfo(),e.has("disableAnalyticsEvents")&&this.eventManager.setEnableAnalyticsEvents(!this.disableAnalyticsEvents),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(),ne.knownContexts.register(this),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(),ne.knownContexts.unregister(this),this.stateManager.removeListeners(),this.stateManager.clearResults()}contentAvailableCallback(e){super.contentAvailableCallback(e),e.has("request")&&this.request&&this.dispatchEvent(new er(this.request)),e.has("paging")&&this.paging!==void 0&&this.dispatchEvent(new tr(this.request,this.paging,this.spellcheckAutocorrect))}registerComponent(e){var r,n,s;if(e.stopPropagation(),((r=e.detail)===null||r===void 0?void 0:r.registrationId)==this.registrationId){let i=(s=(n=e.detail)===null||n===void 0?void 0:n.target)!==null&&s!==void 0?s:e.composedPath()[0];this.register(i)}}register(e){e.setSearchStateManager(this.stateManager)}handleLoadError(e){this.dispatchEvent(new Zt(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)}};E.elementDefinitions={};E.styles=Ws;x([(0,j.redux)({store:d.name})],E.prototype,"session",void 0);x([(0,G.property)()],E.prototype,"query",void 0);x([(0,G.property)()],E.prototype,"contentLocale",void 0);x([(0,j.numberProperty)()],E.prototype,"pageSize",void 0);x([(0,G.property)({type:Boolean})],E.prototype,"searchInDocumentTitlesOnly",void 0);x([(0,G.property)()],E.prototype,"keywordMatch",void 0);x([(0,G.property)()],E.prototype,"scope",void 0);x([(0,G.property)()],E.prototype,"virtualField",void 0);x([(0,G.property)()],E.prototype,"registrationId",void 0);x([(0,G.property)({type:Boolean})],E.prototype,"ignoreEmptyQuery",void 0);x([(0,G.property)({type:Boolean})],E.prototype,"applyStickyFilters",void 0);x([(0,j.redux)({store:d.name})],E.prototype,"openExternalDocumentInNewTab",void 0);x([(0,j.jsonProperty)([])],E.prototype,"filters",void 0);x([(0,G.property)()],E.prototype,"sortId",void 0);x([(0,j.jsonProperty)([])],E.prototype,"sort",void 0);x([(0,j.jsonProperty)({})],E.prototype,"otherQueryParams",void 0);x([(0,j.redux)({store:"search"})],E.prototype,"request",void 0);x([(0,j.redux)({store:"search"})],E.prototype,"paging",void 0);x([(0,j.redux)({store:"search",selector:t=>t.spellcheck})],E.prototype,"spellcheckAutocorrect",void 0);x([(0,j.redux)({store:d.name,selector:t=>t.apiIntegrationIdentifier!==void 0&&t.apiIntegrationAppVersion!==void 0})],E.prototype,"_appIntegrationInfoReady",void 0);x([(0,G.property)({attribute:!1})],E.prototype,"searchServiceProvider",void 0);x([(0,G.property)({type:Boolean})],E.prototype,"disableAnalyticsEvents",void 0);var ti=f(T());var ei={"ft-search-context":E};(0,ti.customElements)(ei);var P=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},Kr=class{constructor(e){this.stateManager=e}searchInDocument(e){this.stateManager.setSearchInDocumentQuery(e??"")}},C=class extends R.FtLitElementRedux{constructor(){super(),this.applyStickyFilters=!1,this.metadataFilters=[],this.visibleTopics=[],this.updateConfiguration=()=>{this.stateManager.reloadConfiguration()},this.scrollToTargetDebouncer=new R.Debouncer(5),this.navigationDebouncer=new R.Debouncer(10),this.mapLoadedEventDebouncer=new R.Debouncer(50),this.addStore(d)}render(){return Je.html`
|
|
10
10
|
${this.importStyleIfNeeded()}
|
|
11
11
|
<ft-toc-filtering-search-context
|
|
12
12
|
disableAnalyticsEvents
|
|
13
13
|
registrationId="reader-toc-filtering"
|
|
14
|
+
?applyStickyFilters=${this.applyStickyFilters}
|
|
14
15
|
.filters=${this.filters}
|
|
15
|
-
@ft-search-request-change=${e=>{var r;e.stopPropagation()
|
|
16
|
+
@ft-search-request-change=${e=>{var r;e.stopPropagation();let n=e.detail.metadataFilters;e.target===this.tocFilteringContext&&n.length>0&&this.stateManager.setFilters((r=n.filter(s=>s.key!="ft:publicationId"))!==null&&r!==void 0?r:[])}}
|
|
16
17
|
@ft-search-results-change=${e=>e.stopPropagation()}
|
|
17
18
|
@search-context-clear-all-filters=${e=>e.stopPropagation()}
|
|
18
19
|
>
|
|
19
20
|
<slot @register-ft-reader-component=${this.registerComponent}></slot>
|
|
20
21
|
</ft-toc-filtering-search-context>
|
|
21
|
-
`}importStyleIfNeeded(){var e,r;let n=(e=this.stateManager.service)===null||e===void 0?void 0:e.themeStylesheet();return!n||window.location.href.startsWith((r=this.baseUrl)!==null&&r!==void 0?r:"")?
|
|
22
|
+
`}importStyleIfNeeded(){var e,r;let n=(e=this.stateManager.service)===null||e===void 0?void 0:e.themeStylesheet();return!n||window.location.href.startsWith((r=this.baseUrl)!==null&&r!==void 0?r:"")?Je.nothing:Je.html`
|
|
22
23
|
<style>
|
|
23
24
|
@import "${n}"
|
|
24
25
|
</style>
|
|
25
|
-
`}get stateManager(){return this._stateManager==null&&(this._stateManager=Ht.build(this.id||(0,
|
|
26
|
+
`}get stateManager(){return this._stateManager==null&&(this._stateManager=Ht.build(this.id||(0,R.randomId)(6),this.readerServiceProvider),this._stateManager.errorHandler=e=>this.handleLoadError(e),this.addStore(this.stateManager.store,"reader")),this._stateManager}get filters(){return this.mapId?[{key:"ft:publicationId",valueFilter:{negative:!1,values:[this.mapId]}},...this.metadataFilters]:[]}connectedCallback(){super.connectedCallback(),ne.knownContexts.register(this),this.stateManager.setMapId(this.mapId),this.stateManager.awaitService().then(e=>{let r=e.fontsStylesheet();if(r&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${r}"]`)){let n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("href",r),document.head.append(n)}window.FluidTopicsReaderService=new Kr(this.stateManager)}),d.addEventListener(z.eventName,this.updateConfiguration)}disconnectedCallback(){super.disconnectedCallback(),ne.knownContexts.unregister(this),d.addEventListener(z.eventName,this.updateConfiguration),this.stateManager.removeListeners()}update(e){var r;super.update(e),e.has("readerServiceProvider")&&this.readerServiceProvider&&this.stateManager.initService(this.readerServiceProvider),e.has("metadataFilters")&&this.stateManager.setFilters((r=this.metadataFilters)!==null&&r!==void 0?r:[]),e.has("applyStickyFilters")&&this.stateManager.setApplyStickyFilters(this.applyStickyFilters),e.has("mapId")&&this.mapId&&(this.stateManager.setMapId(this.mapId),this.lastNotifiedNotFoundRelative=void 0),e.has("searchInDocumentQuery")&&this.searchInDocumentQuery!=null&&this.stateManager.setSearchInDocumentQuery(this.searchInDocumentQuery);let n=this.hasUpdated&&e.has("metadataFilters");e.has("session")?this.reload():n?this.stateManager.reloadFromFilter(this.section,this.page):["tocId","section","page","mapId","topicPivot"].some(s=>e.has(s))&&this.mapId&&this.navigateToTarget()}contentAvailableCallback(e){var r,n;if(super.contentAvailableCallback(e),(e.has("map")||e.has("toc"))&&this.sendLoadedEventIfLoaded(),e.has("scrollTarget")&&((r=this.scrollTarget)===null||r===void 0?void 0:r.tocId)==null){let s=e.get("scrollTarget");s?.tocId!=null&&this.scrollToTargetDebouncer.run(()=>this.stateManager.getAccurateNavigationData(s.tocId,this.currentPage,s).then(i=>this.dispatchEvent(new zt(i))))}(e.has("visibleTopics")||e.has("scrollTarget"))&&((n=this.scrollTarget)===null||n===void 0?void 0:n.tocId)==null&&Promise.all(this.visibleTopics.map(s=>this.stateManager.getAccurateNavigationData(s,this.currentPage))).then(s=>{let i=s.filter(a=>a!=null&&a.topicTitle!=="").map(a=>({tocId:a.tocId,title:a.topicTitle,page:a.page,prettyUrl:a.prettyUrl,prettyUrlDuplicated:a.prettyUrlDuplicated,breadcrumb:this.stateManager.buildBreadcrumb(a.tocId)}));this.dispatchEvent(new $t(this.map,i))})}clear(){this.stateManager.clear()}async reload(){await this.stateManager.reload(),await this.navigateToTarget()}async navigateToTarget(){await this.stateManager.loaded(),await this.navigationDebouncer.run(async()=>{this.topicPivot!=null?!await this.stateManager.navigateToRelativeTopicIfFound(this.topicPivot)&&this.lastNotifiedNotFoundRelative!==this.mapId+this.topicPivot?(this.dispatchEvent(new Xt),this.lastNotifiedNotFoundRelative=this.mapId+this.topicPivot):this.lastNotifiedNotFoundRelative=void 0:this.tocId!=null?await this.stateManager.navigateToTopic(this.tocId,this.section,this.page):this.page!=null&&await this.stateManager.navigateToPage(this.page)})}registerComponent(e){var r,n;e.stopPropagation();let s=(n=(r=e.detail)===null||r===void 0?void 0:r.target)!==null&&n!==void 0?n:e.composedPath()[0];this.register(s)}register(e){e.setReaderStateManager(this.stateManager)}handleLoadError(e){let r=e;r.status===401?this.dispatchEvent(new Qt):r.status===403?this.dispatchEvent(new Yt):r.status===404?this.dispatchEvent(new Wt):this.dispatchEvent(new Gt(e))}reloadBookmarks(){Dr.reloadBookmarks()}async reloadRating(){var e,r;await((e=this.stateManager.service)===null||e===void 0?void 0:e.reloadRating()),(r=this.stateManager.store)===null||r===void 0||r.dispatchEvent(new CustomEvent("rating-changed"))}sendLoadedEventIfLoaded(){this.mapLoadedEventDebouncer.run(()=>{this.map&&this.toc&&this.dispatchEvent(new Kt(this.map,this.toc))})}};C.elementDefinitions={"ft-toc-filtering-search-context":E};C.styles=zs;P([(0,R.redux)({store:d.name})],C.prototype,"baseUrl",void 0);P([(0,R.redux)({store:d.name})],C.prototype,"session",void 0);P([(0,se.property)()],C.prototype,"mapId",void 0);P([(0,se.property)()],C.prototype,"tocId",void 0);P([(0,se.property)()],C.prototype,"section",void 0);P([(0,se.property)()],C.prototype,"topicPivot",void 0);P([(0,se.property)()],C.prototype,"searchInDocumentQuery",void 0);P([(0,se.property)({type:Boolean})],C.prototype,"applyStickyFilters",void 0);P([(0,R.redux)({store:"reader",converter:(0,R.jsonPropertyConverter)([]),attribute:!0})],C.prototype,"metadataFilters",void 0);P([(0,R.numberProperty)({min:1})],C.prototype,"page",void 0);P([(0,R.redux)({store:"reader"})],C.prototype,"map",void 0);P([(0,R.redux)({store:"reader"})],C.prototype,"toc",void 0);P([(0,R.redux)({store:"reader"})],C.prototype,"visibleTopics",void 0);P([(0,R.redux)({store:"reader"})],C.prototype,"currentPage",void 0);P([(0,R.redux)({store:"reader"})],C.prototype,"scrollTarget",void 0);P([(0,se.property)({attribute:!1})],C.prototype,"readerServiceProvider",void 0);P([(0,se.query)("ft-toc-filtering-search-context")],C.prototype,"tocFilteringContext",void 0);var ri={"ft-reader-context":C};(0,ni.customElements)(ri);})();
|
|
26
27
|
/*! Bundled license information:
|
|
27
28
|
|
|
28
29
|
.store/@lit-context-npm-1.1.6-2c155157c6/package/lib/context-request-event.js:
|