@fluid-topics/ft-reader-feedback 1.1.32 → 1.1.34

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.
@@ -1461,11 +1461,11 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1461
1461
  `,Vs=Rt`
1462
1462
  `,qs=Xr.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0}});class Ys{static build(t){const{baseUrl:e,apiIntegrationIdentifier:i}=qs.getState(),o=null!=t?t:i;if(e&&o&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,o,!0)}static get(t){var e;return null!=t?Ys.build(t):null!==(e=Ys.API)&&void 0!==e?e:Ys.API=Ys.build()}static await(t){return new Promise((e=>{let i=Ys.get(t);if(i)e(i);else{const o=qs.subscribe((()=>{i=Ys.get(t),i&&(o(),e(i))}))}}))}}var Xs;const Js=Symbol("clearAfterUnitTest");class Qs{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new o,this.listeners={},this.currentUiLocale="",this[Xs]=()=>{this.defaultMessages={},this.cache=new o,this.listeners={}},this.currentUiLocale=qs.getState().uiLocale,qs.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=qs.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const e=t.name.toLowerCase();this.cache.setFinal(e,t),this.notify(e)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var i;if(t=t.toLowerCase(),Object.keys(e).length>0){const o={...null!==(i=this.defaultMessages[t])&&void 0!==i?i:{},...e};D(this.defaultMessages[t],o)||(this.defaultMessages[t]=o,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...i){var o,r,n;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(r=null===(o=this.cache.getNow(t))||void 0===o?void 0:o.messages)&&void 0!==r?r:{};return new Xi(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},a).resolve(e,...i)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,e){var i;return t=t.toLowerCase(),this.listeners[t]=null!==(i=this.listeners[t])&&void 0!==i?i:new Set,this.listeners[t].add(e),()=>{var i;return null===(i=this.listeners[t])||void 0===i?void 0:i.delete(e)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>_(0).then((()=>t())).catch((()=>null)))))}}Xs=Js,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new Qs((async(t,e)=>(await Ys.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new Qs((async(t,e)=>(await Ys.await()).getCustomMessageContext(t,e))));const tl=window.FluidTopicsI18nService,el=window.FluidTopicsCustomI18nService;var il=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class ol extends Gi{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>Ys.get(),this.cache=new o,this.cleanSessionDebouncer=new n}render(){return de`
1463
1463
  <slot></slot>
1464
- `}update(t){super.update(t),t.has("baseUrl")&&(qs.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&qs.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&qs.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&qs.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&qs.actions.noCustom(this.noCustom),t.has("editorMode")&&qs.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&qs.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&qs.actions.session(this.session),t.has("availableUiLocales")&&qs.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>tl.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}ol.elementDefinitions={},ol.styles=Vs,il([I()],ol.prototype,"baseUrl",void 0),il([I()],ol.prototype,"apiIntegrationIdentifier",void 0),il([I()],ol.prototype,"uiLocale",void 0),il([F(null)],ol.prototype,"availableUiLocales",void 0),il([F(null)],ol.prototype,"metadataConfiguration",void 0),il([I({type:Boolean})],ol.prototype,"editorMode",void 0),il([I({type:Boolean})],ol.prototype,"noCustom",void 0),il([I({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],ol.prototype,"noCustomComponent",void 0),il([I({type:Boolean})],ol.prototype,"withManualResources",void 0),il([F([])],ol.prototype,"messageContexts",void 0),il([F(void 0)],ol.prototype,"session",void 0),il([I({type:Object})],ol.prototype,"apiProvider",void 0);class rl{async listMySearches(){var t;return(null===(t=qs.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await Ys.await()).listMySearches(qs.getState().session.profile.userId):[]}}const nl=new o;class al{async listMyBookmarks(){return nl.get("bookmarks",(async()=>(await Ys.await()).listMyBookmarks(qs.getState().session.profile.userId)))}clearCache(){nl.clear("bookmarks")}}const sl=Xr.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const ll=new class{constructor(){this.currentSession=qs.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new al,qs.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=qs.getState();D(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){sl.actions.savedSearches(void 0)}clearMyBookmarks(){sl.actions.bookmarks(void 0)}async reloadMySearches(){const t=new rl,e=await t.listMySearches();sl.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;sl.actions.bookmarks(e)}}};M("ft-app-context")(ol);var cl=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};const fl=Symbol("i18nProperties"),hl=Symbol("i18nUnsubs");function dl(t){var e;class i extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?el:tl}i18n(t,e,...i){var o;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...i);const r=null!==(o=t.args)&&void 0!==o?o:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...r)}onI18nUpdate(t){var e;null===(e=this[fl])||void 0===e||e.forEach(((e,i)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[i]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}update(t){var e;super.update(t),null===(e=this[fl])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[fl]&&new Set([...this[fl].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[hl].has(t)||this[hl].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages(t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[hl].forEach((t=>t())),this[hl].clear()}}return e=hl,cl([I({type:Boolean})],i.prototype,"useCustomMessageContexts",void 0),i}class ul extends(dl(Gi)){}class pl extends(dl(lo)){}var yl=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class gl extends pl{constructor(){super(),this.editorMode=!1,this.addStore(qs)}render(){return this.key&&this.context?de`
1464
+ `}update(t){super.update(t),t.has("baseUrl")&&(qs.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&qs.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&qs.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&qs.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&qs.actions.noCustom(this.noCustom),t.has("editorMode")&&qs.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&qs.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&qs.actions.session(this.session),t.has("availableUiLocales")&&qs.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>tl.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}ol.elementDefinitions={},ol.styles=Vs,il([I()],ol.prototype,"baseUrl",void 0),il([I()],ol.prototype,"apiIntegrationIdentifier",void 0),il([I()],ol.prototype,"uiLocale",void 0),il([F(null)],ol.prototype,"availableUiLocales",void 0),il([F(null)],ol.prototype,"metadataConfiguration",void 0),il([I({type:Boolean})],ol.prototype,"editorMode",void 0),il([I({type:Boolean})],ol.prototype,"noCustom",void 0),il([I({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],ol.prototype,"noCustomComponent",void 0),il([I({type:Boolean})],ol.prototype,"withManualResources",void 0),il([F([])],ol.prototype,"messageContexts",void 0),il([F(void 0)],ol.prototype,"session",void 0),il([I({type:Object})],ol.prototype,"apiProvider",void 0);class rl{async listMySearches(){var t;return(null===(t=qs.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await Ys.await()).listMySearches(qs.getState().session.profile.userId):[]}}const nl=new o;class al{async listMyBookmarks(){return nl.get("bookmarks",(async()=>(await Ys.await()).listMyBookmarks(qs.getState().session.profile.userId)))}clearCache(){nl.clear("bookmarks")}}const sl=Xr.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const ll=new class{constructor(){this.currentSession=qs.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new al,qs.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=qs.getState();D(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){sl.actions.savedSearches(void 0)}clearMyBookmarks(){sl.actions.bookmarks(void 0)}async reloadMySearches(){const t=new rl,e=await t.listMySearches();sl.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;sl.actions.bookmarks(e)}}};M("ft-app-context")(ol);var cl=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};const fl=Symbol("i18nAttributes"),hl=Symbol("i18nProperties"),dl=Symbol("i18nUnsubs");function ul(t){var e;class i extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?el:tl}i18n(t,e,...i){var o;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...i);const r=null!==(o=t.args)&&void 0!==o?o:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...r)}onI18nUpdate(t){var e,i;null===(e=this[fl])||void 0===e||e.forEach(((e,i)=>{var o;const r=this.getI18nAttributeValue(i);(null===(o=null==r?void 0:r.context)||void 0===o?void 0:o.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(i,r,e)})),null===(i=this[hl])||void 0===i||i.forEach(((e,i)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[i]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,e,i){this[t]={...e,message:this.i18n({context:e.context,key:e.key,...i})}}update(t){var e,i;super.update(t),null===(e=this[fl])||void 0===e||e.forEach(((e,i)=>{const o=this.getI18nAttributeValue(i);(null==o?void 0:o.context)&&o.key&&(t.has(i)||null!=e.argsProvider)&&(t.has(i)&&this.addI18nContext(o.context),this.updateI18nAttributeMessage(i,o,e))})),null===(i=this[hl])||void 0===i||i.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,e,i,o;super.connectedCallback(),new Set([...null!==(e=null===(t=this[hl])||void 0===t?void 0:t.values())&&void 0!==e?e:[],...[...null!==(o=null===(i=this[fl])||void 0===i?void 0:i.keys())&&void 0!==o?o:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[dl].has(t)||this[dl].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages("string"==typeof t?t:t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[dl].forEach((t=>t())),this[dl].clear()}}return e=dl,cl([I({type:Boolean})],i.prototype,"useCustomMessageContexts",void 0),i}class pl extends(ul(Gi)){}class yl extends(ul(lo)){}var gl=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class bl extends yl{constructor(){super(),this.editorMode=!1,this.addStore(qs)}render(){return this.key&&this.context?de`
1465
1465
  <span class="ft-i18n">
1466
1466
  ${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
1467
1467
  </span>
1468
- `:this.editorMode?"Select a context and a label key.":pe}update(t){var e;super.update(t),this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(e=this.defaultMessage)&&void 0!==e?e:""})}}gl.elementDefinitions={},gl.styles=Gs,yl([Ji()],gl.prototype,"editorMode",void 0),yl([I()],gl.prototype,"context",void 0),yl([I()],gl.prototype,"key",void 0),yl([F([])],gl.prototype,"args",void 0),yl([I()],gl.prototype,"defaultMessage",void 0);class bl{static build(t){return new bl(t)}static fromGwt(t){return new bl(t)}constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,e)=>{const i=e;return t=>({context:this.name,key:i,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,e)=>(...t)=>tl.resolveMessage(this.name,e,...t)})}}const vl=(t,e)=>(i,o)=>{var r,n;i.constructor.createProperty(o,null!=e?e:{attribute:!1,type:String});const a={...t,key:null!==(r=t.key)&&void 0!==r?r:o};i[fl]=null!==(n=i[fl])&&void 0!==n?n:new Map,i[fl].set(o,a)};M("ft-i18n")(gl);const ml=bl.build("integratedFeedbackComponent"),xl={starsRating:"{0} stars","starsRating[\\=1]":"1 star",like:"Like",dislike:"Dislike",dichotomousYes:"Yes",dichotomousNo:"No",notRated:"Not rated",ratedNow:"Rated now",ratedToday:"Rated today",ratedOn:"Rated on {0, date}",feedbackInputLabel:"How can we improve it?",feedbackfromEmail:"Your email",feedbackfromEmailInvalid:"Please enter a valid email address",okButton:"Send feedback",cancelButton:"Cancel",moreOptionsButton:"More options",feedbackSuccess:"Feedback successfully sent. Thank you!",feedbackFailure:"Failed to send feedback. Please try again later.",ratingSuccess:"Rating successfully sent. Thank you!",ratingFailure:"Failed to send rating. Please try again later.",mapFeedbackMainTitle:"Send feedback",mapRatingSectionTitle:"Rate this document",mapDichotomousRatingSectionTitle:"Did it solve your problem?",mapFeedbackSectionTitle:"Write your review",topicFeedbackMainTitle:"Send feedback",topicRatingSectionTitle:"Rate this content",topicDichotomousRatingSectionTitle:"Did this content solve your problem?",topicFeedbackSectionTitle:"Write your review"},wl={fontSize:Re.create("--ft-text-field-font-size","","SIZE","14px"),labelSize:Re.create("--ft-text-field-label-size","","SIZE","11px"),verticalSpacing:Re.create("--ft-text-field-vertical-spacing","","SIZE","4px"),horizontalSpacing:Re.create("--ft-text-field-horizontal-spacing","","SIZE","16px"),helperColor:Re.extend("--ft-text-field-helper-color","",We.colorOnSurfaceMedium),colorPrimary:Re.external(We.colorPrimary,"Design system"),colorOnSurface:Re.external(We.colorOnSurface,"Design system"),colorOnSurfaceDisabled:Re.external(We.colorOnSurfaceDisabled,"Design system"),borderRadiusS:Re.external(We.borderRadiusS,"Design system"),colorError:Re.external(We.colorError,"Design system"),prefixColor:Re.extend("--ft-text-field-prefix-color","",We.colorOnSurfaceMedium),iconColor:Re.extend("--ft-text-field-icon-color","",We.colorOnSurfaceMedium),floatingZIndex:Re.create("--ft-text-field-floating-components-z-index","","NUMBER","3"),colorSurface:Re.external(We.colorSurface,"Design system"),colorOutline:Re.external(We.colorOutline,"Design system"),elevation02:Re.external(We.elevation02,"Design system"),suggestSize:Re.create("--ft-text-field-suggest-size","","SIZE","300px")},Ol=Rt`
1468
+ `:this.editorMode?"Select a context and a label key.":pe}update(t){var e;super.update(t),["context","key","defaultMessage"].some((e=>t.has(e)))&&this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(e=this.defaultMessage)&&void 0!==e?e:""})}}bl.elementDefinitions={},bl.styles=Gs,gl([Ji()],bl.prototype,"editorMode",void 0),gl([I()],bl.prototype,"context",void 0),gl([I()],bl.prototype,"key",void 0),gl([F([])],bl.prototype,"args",void 0),gl([I()],bl.prototype,"defaultMessage",void 0);class vl{static build(t){return new vl(t)}static fromGwt(t){return new vl(t)}constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,e)=>{const i=e;return t=>({context:this.name,key:i,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,e)=>(...t)=>tl.resolveMessage(this.name,e,...t)})}}const ml=(t,e)=>(i,o)=>{var r,n;i.constructor.createProperty(o,null!=e?e:{attribute:!1,type:String});const a={...t,key:null!==(r=t.key)&&void 0!==r?r:o};i[hl]=null!==(n=i[hl])&&void 0!==n?n:new Map,i[hl].set(o,a)};M("ft-i18n")(bl);const xl=vl.build("integratedFeedbackComponent"),wl={starsRating:"{0} stars","starsRating[\\=1]":"1 star",like:"Like",dislike:"Dislike",dichotomousYes:"Yes",dichotomousNo:"No",notRated:"Not rated",ratedNow:"Rated now",ratedToday:"Rated today",ratedOn:"Rated on {0, date}",feedbackInputLabel:"How can we improve it?",feedbackfromEmail:"Your email",feedbackfromEmailInvalid:"Please enter a valid email address",okButton:"Send feedback",cancelButton:"Cancel",moreOptionsButton:"More options",feedbackSuccess:"Feedback successfully sent. Thank you!",feedbackFailure:"Failed to send feedback. Please try again later.",ratingSuccess:"Rating successfully sent. Thank you!",ratingFailure:"Failed to send rating. Please try again later.",mapFeedbackMainTitle:"Send feedback",mapRatingSectionTitle:"Rate this document",mapDichotomousRatingSectionTitle:"Did it solve your problem?",mapFeedbackSectionTitle:"Write your review",topicFeedbackMainTitle:"Send feedback",topicRatingSectionTitle:"Rate this content",topicDichotomousRatingSectionTitle:"Did this content solve your problem?",topicFeedbackSectionTitle:"Write your review"},Ol={fontSize:Re.create("--ft-text-field-font-size","","SIZE","14px"),labelSize:Re.create("--ft-text-field-label-size","","SIZE","11px"),verticalSpacing:Re.create("--ft-text-field-vertical-spacing","","SIZE","4px"),horizontalSpacing:Re.create("--ft-text-field-horizontal-spacing","","SIZE","16px"),helperColor:Re.extend("--ft-text-field-helper-color","",We.colorOnSurfaceMedium),colorPrimary:Re.external(We.colorPrimary,"Design system"),colorOnSurface:Re.external(We.colorOnSurface,"Design system"),colorOnSurfaceDisabled:Re.external(We.colorOnSurfaceDisabled,"Design system"),borderRadiusS:Re.external(We.borderRadiusS,"Design system"),colorError:Re.external(We.colorError,"Design system"),prefixColor:Re.extend("--ft-text-field-prefix-color","",We.colorOnSurfaceMedium),iconColor:Re.extend("--ft-text-field-icon-color","",We.colorOnSurfaceMedium),floatingZIndex:Re.create("--ft-text-field-floating-components-z-index","","NUMBER","3"),colorSurface:Re.external(We.colorSurface,"Design system"),colorOutline:Re.external(We.colorOutline,"Design system"),elevation02:Re.external(We.elevation02,"Design system"),suggestSize:Re.create("--ft-text-field-suggest-size","","SIZE","300px")},Sl=Rt`
1469
1469
  *:focus {
1470
1470
  outline: none;
1471
1471
  }
@@ -1478,16 +1478,16 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1478
1478
  }
1479
1479
 
1480
1480
  ft-input-label {
1481
- ${Ue(Ss.fontSize,wl.fontSize)};
1482
- ${Ue(Ss.raisedFontSize,wl.labelSize)};
1483
- ${Ue(Ss.verticalSpacing,wl.verticalSpacing)};
1484
- ${Ue(Ss.horizontalSpacing,wl.horizontalSpacing)};
1481
+ ${Ue(Ss.fontSize,Ol.fontSize)};
1482
+ ${Ue(Ss.raisedFontSize,Ol.labelSize)};
1483
+ ${Ue(Ss.verticalSpacing,Ol.verticalSpacing)};
1484
+ ${Ue(Ss.horizontalSpacing,Ol.horizontalSpacing)};
1485
1485
  }
1486
1486
 
1487
1487
  .ft-text-field--main-panel {
1488
1488
  position: relative;
1489
1489
  display: flex;
1490
- height: calc(4 * ${wl.verticalSpacing} + ${wl.labelSize} + ${wl.fontSize});
1490
+ height: calc(4 * ${Ol.verticalSpacing} + ${Ol.labelSize} + ${Ol.fontSize});
1491
1491
  }
1492
1492
 
1493
1493
  .ft-text-field--input-panel {
@@ -1496,10 +1496,10 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1496
1496
  display: flex;
1497
1497
  align-items: center;
1498
1498
  overflow: hidden;
1499
- padding: 0 ${wl.horizontalSpacing};
1499
+ padding: 0 ${Ol.horizontalSpacing};
1500
1500
 
1501
- ${Ue(Wn.fontSize,wl.fontSize)};
1502
- ${Ue(Wn.lineHeight,wl.fontSize)};
1501
+ ${Ue(Wn.fontSize,Ol.fontSize)};
1502
+ ${Ue(Wn.lineHeight,Ol.fontSize)};
1503
1503
  }
1504
1504
 
1505
1505
  .ft-text-field--input-panel ft-ripple {
@@ -1509,11 +1509,11 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1509
1509
 
1510
1510
  .ft-text-field--filled.ft-text-field--with-label .ft-text-field--input-panel {
1511
1511
  align-items: flex-end;
1512
- padding: 0 ${wl.horizontalSpacing} ${wl.verticalSpacing} ${wl.horizontalSpacing};
1512
+ padding: 0 ${Ol.horizontalSpacing} ${Ol.verticalSpacing} ${Ol.horizontalSpacing};
1513
1513
  }
1514
1514
 
1515
1515
  .ft-text-field--prefix {
1516
- color: ${wl.prefixColor};
1516
+ color: ${Ol.prefixColor};
1517
1517
  margin-right: 2px;
1518
1518
  flex-shrink: 1;
1519
1519
  overflow: hidden;
@@ -1532,15 +1532,15 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1532
1532
  flex-shrink: 1;
1533
1533
  min-width: 0; /* flex sets this to auto an prevents input from shrinking properly */
1534
1534
 
1535
- color: ${wl.colorOnSurface};
1536
- padding: calc(2 * ${wl.verticalSpacing}) 0;
1535
+ color: ${Ol.colorOnSurface};
1536
+ padding: calc(2 * ${Ol.verticalSpacing}) 0;
1537
1537
  border: none;
1538
1538
  background: none;
1539
1539
  }
1540
1540
 
1541
1541
  .ft-text-field--filled.ft-text-field--with-label .ft-text-field--input {
1542
1542
  padding-bottom: 0;
1543
- padding-top: calc(${wl.labelSize} + 2 * ${wl.verticalSpacing});
1543
+ padding-top: calc(${Ol.labelSize} + 2 * ${Ol.verticalSpacing});
1544
1544
  }
1545
1545
 
1546
1546
  .ft-text-field--input::-webkit-calendar-picker-indicator,
@@ -1549,37 +1549,37 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1549
1549
  }
1550
1550
 
1551
1551
  .ft-text-field--disabled .ft-text-field--input {
1552
- color: ${wl.colorOnSurfaceDisabled};
1552
+ color: ${Ol.colorOnSurfaceDisabled};
1553
1553
  }
1554
1554
 
1555
1555
  .ft-text-field:not(.ft-text-field--disabled):focus-within ft-input-label {
1556
- ${Ue(Ss.borderColor,wl.colorPrimary)};
1557
- ${Ue(Ss.textColor,wl.colorPrimary)};
1556
+ ${Ue(Ss.borderColor,Ol.colorPrimary)};
1557
+ ${Ue(Ss.textColor,Ol.colorPrimary)};
1558
1558
  }
1559
1559
 
1560
1560
  .ft-text-field--filled .ft-text-field--input-panel {
1561
- border-radius: ${wl.borderRadiusS} ${wl.borderRadiusS} 0 0;
1561
+ border-radius: ${Ol.borderRadiusS} ${Ol.borderRadiusS} 0 0;
1562
1562
  }
1563
1563
 
1564
1564
  .ft-text-field--outlined .ft-text-field--input-panel {
1565
- border-radius: ${wl.borderRadiusS};
1565
+ border-radius: ${Ol.borderRadiusS};
1566
1566
  }
1567
1567
 
1568
1568
  .ft-text-field--helper-text {
1569
- padding: 0 12px 0 ${wl.horizontalSpacing};
1570
- color: ${wl.helperColor};
1569
+ padding: 0 12px 0 ${Ol.horizontalSpacing};
1570
+ color: ${Ol.helperColor};
1571
1571
  }
1572
1572
 
1573
1573
  .ft-text-field--in-error .ft-text-field--input,
1574
1574
  .ft-text-field--in-error .ft-text-field--helper-text,
1575
1575
  .ft-text-field--in-error .ft-text-field--prefix {
1576
- color: ${wl.colorError};
1576
+ color: ${Ol.colorError};
1577
1577
  }
1578
1578
 
1579
1579
  .ft-text-field--icon {
1580
1580
  align-self: center;
1581
1581
  margin-left: 8px;
1582
- color: ${wl.iconColor};
1582
+ color: ${Ol.iconColor};
1583
1583
  }
1584
1584
 
1585
1585
  .ft-text-field--container {
@@ -1592,13 +1592,13 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1592
1592
  position: absolute;
1593
1593
  left: 0;
1594
1594
  right: 0;
1595
- z-index: ${wl.floatingZIndex};
1596
- background: ${wl.colorSurface};
1597
- border: 1px solid ${wl.colorOutline};
1598
- border-radius: 0 0 ${wl.borderRadiusS} ${wl.borderRadiusS};
1599
- box-shadow: ${wl.elevation02};
1595
+ z-index: ${Ol.floatingZIndex};
1596
+ background: ${Ol.colorSurface};
1597
+ border: 1px solid ${Ol.colorOutline};
1598
+ border-radius: 0 0 ${Ol.borderRadiusS} ${Ol.borderRadiusS};
1599
+ box-shadow: ${Ol.elevation02};
1600
1600
  outline: none;
1601
- max-height: ${wl.suggestSize};
1601
+ max-height: ${Ol.suggestSize};
1602
1602
  overflow-y: auto;
1603
1603
  }
1604
1604
 
@@ -1621,7 +1621,7 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1621
1621
  .ft-text-field--with-password ft-icon:hover {
1622
1622
  cursor: pointer;
1623
1623
  }
1624
- `;var Sl=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class Nl extends(Qr(Gi,"textbox")){constructor(){super(...arguments),this._value="",this.dispatchedValue="",this.outlined=!1,this.disabled=!1,this.error=!1,this.prefix=null,this.passwordHiddenIcon=os.EYE_SLASH,this.passwordRevealedIcon=os.EYE,this.filterSuggestions=!1,this.password=!1,this.focused=!1,this.hidePassword=!0,this.suggestionsOnTop=!1,this.hideSuggestions=!1,this.visibleSuggestions=[]}get value(){return this._value||""}set value(t){this.setInternalValue(t||""),this.dispatchedValue=t||""}setInternalValue(t){const e=this._value;this._value=t||"",this.setFormValue(this._value),this.requestUpdate("value",e)}focus(){var t;null===(t=this.input)||void 0===t||t.focus()}render(){const t={"ft-text-field":!0,"ft-text-field--filled":!this.outlined,"ft-text-field--outlined":this.outlined,"ft-text-field--disabled":this.disabled,"ft-text-field--has-value":!!this.value,"ft-text-field--with-label":!!this.label,"ft-text-field--in-error":this.error,"ft-text-field--with-prefix":!!this.prefix,"ft-text-field--hide-suggestions":0===this.visibleSuggestions.length||this.hideSuggestions,"ft-text-field--raised-label":this.focused||""!=this.value,"ft-text-field--with-icon":!!this.icon,"ft-text-field--with-password":this.password};return de`
1624
+ `;var Nl=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class $l extends(Qr(Gi,"textbox")){constructor(){super(...arguments),this._value="",this.dispatchedValue="",this.outlined=!1,this.disabled=!1,this.error=!1,this.prefix=null,this.passwordHiddenIcon=os.EYE_SLASH,this.passwordRevealedIcon=os.EYE,this.filterSuggestions=!1,this.password=!1,this.focused=!1,this.hidePassword=!0,this.suggestionsOnTop=!1,this.hideSuggestions=!1,this.visibleSuggestions=[]}get value(){return this._value||""}set value(t){this.setInternalValue(t||""),this.dispatchedValue=t||""}setInternalValue(t){const e=this._value;this._value=t||"",this.setFormValue(this._value),this.requestUpdate("value",e)}focus(){var t;null===(t=this.input)||void 0===t||t.focus()}render(){const t={"ft-text-field":!0,"ft-text-field--filled":!this.outlined,"ft-text-field--outlined":this.outlined,"ft-text-field--disabled":this.disabled,"ft-text-field--has-value":!!this.value,"ft-text-field--with-label":!!this.label,"ft-text-field--in-error":this.error,"ft-text-field--with-prefix":!!this.prefix,"ft-text-field--hide-suggestions":0===this.visibleSuggestions.length||this.hideSuggestions,"ft-text-field--raised-label":this.focused||""!=this.value,"ft-text-field--with-icon":!!this.icon,"ft-text-field--with-password":this.password};return de`
1625
1625
  <div class="${ja(t)}">
1626
1626
  <div class="ft-text-field--main-panel"
1627
1627
  @keydown=${this.handleKeyboardNavigation}
@@ -1673,7 +1673,7 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1673
1673
  .variant=${this.iconVariant}
1674
1674
  .value=${this.icon}
1675
1675
  @click=${()=>{var t;return null===(t=this.input)||void 0===t?void 0:t.focus()}}></ft-icon>
1676
- `:pe}update(t){super.update(t),(t.has("value")||t.has("filterSuggestions"))&&this.filterSuggestionsIfNeeded(),t.has("value")&&null!=t.get("value")&&(this.hideSuggestions=!1),t.has("dispatchedValue")&&null!=t.get("dispatchedValue")&&(this.hideSuggestions=!0)}filterSuggestionsIfNeeded(){this.filterSuggestions?(this.suggestions.forEach((t=>t.hidden=!t.getValue().toLowerCase().includes(this.value.toLowerCase()))),this.visibleSuggestions=this.suggestions.filter((t=>!t.hidden))):this.visibleSuggestions=this.suggestions}contentAvailableCallback(t){var e,i;if(super.contentAvailableCallback(t),t.has("focused")&&!this.hideSuggestions&&this.visibleSuggestions.length>0){const t=null===(e=this.input)||void 0===e?void 0:e.getBoundingClientRect(),o=null===(i=this.suggestionsContainer)||void 0===i?void 0:i.getBoundingClientRect();t&&o&&(this.suggestionsOnTop=t.bottom+o.height>window.innerHeight&&t.top-o.height>0)}}setValue(t,e=!1){this.value!==t&&(this.setInternalValue(t),this.dispatchEvent(new CustomEvent("live-change",{detail:t}))),e&&this.dispatchedValue!==t&&(this.dispatchedValue=t,this.dispatchEvent(new CustomEvent("change",{detail:t})))}handleInput(t){var e;const i=(null===(e=this.input)||void 0===e?void 0:e.value)||"";this.setValue(i,"Escape"==t.key||"Enter"==t.key)}handleClick(){this.hideSuggestions=!1}handleKeyboardNavigation(t){var e;if("ArrowDown"===t.key||"ArrowUp"===t.key){t.preventDefault(),t.stopPropagation(),this.hideSuggestions=!1;const i=this.visibleSuggestions.findIndex((t=>t.matches(":focus-within")));let o;o="ArrowDown"===t.key?i<this.visibleSuggestions.length-1?i+1:0:i>0?i-1:this.visibleSuggestions.length-1,null===(e=this.visibleSuggestions[o])||void 0===e||e.focus()}"Escape"!=t.key&&"Enter"!=t.key||(this.hideSuggestions=!0)}onSuggestionSelected(t){var e;this.setValue(t.detail,!0),null===(e=this.input)||void 0===e||e.focus(),setTimeout((()=>this.hideSuggestions=!0),0)}onFocus(){this.focused=!0,this.hideSuggestions=!1}onMainPanelBlur(){var t,e;(null===(t=this.mainPanel)||void 0===t?void 0:t.matches(":focus-within"))||(this.focused=!1,this.setValue((null===(e=this.input)||void 0===e?void 0:e.value)||"",!0))}togglePasswordVisibility(){this.hidePassword=!this.hidePassword}}Nl.elementDefinitions={"ft-input-label":Cs,"ft-ripple":Za,"ft-typography":Ma,"ft-icon":ss},Nl.styles=[sa,Ol],Sl([I()],Nl.prototype,"label",void 0),Sl([I({noAccessor:!0})],Nl.prototype,"value",null),Sl([R()],Nl.prototype,"dispatchedValue",void 0),Sl([I()],Nl.prototype,"helper",void 0),Sl([I({type:Boolean})],Nl.prototype,"outlined",void 0),Sl([I({type:Boolean})],Nl.prototype,"disabled",void 0),Sl([I({type:Boolean})],Nl.prototype,"error",void 0),Sl([I()],Nl.prototype,"prefix",void 0),Sl([I()],Nl.prototype,"icon",void 0),Sl([I()],Nl.prototype,"passwordHiddenIcon",void 0),Sl([I()],Nl.prototype,"passwordRevealedIcon",void 0),Sl([I()],Nl.prototype,"iconVariant",void 0),Sl([I({type:Boolean})],Nl.prototype,"filterSuggestions",void 0),Sl([I({type:Number})],Nl.prototype,"maxLength",void 0),Sl([I({type:Boolean})],Nl.prototype,"password",void 0),Sl([R()],Nl.prototype,"focused",void 0),Sl([R()],Nl.prototype,"hidePassword",void 0),Sl([R()],Nl.prototype,"suggestionsOnTop",void 0),Sl([R()],Nl.prototype,"hideSuggestions",void 0),Sl([R()],Nl.prototype,"visibleSuggestions",void 0),Sl([A(".ft-text-field--main-panel")],Nl.prototype,"mainPanel",void 0),Sl([A(".ft-text-field--input")],Nl.prototype,"input",void 0),Sl([A(".ft-text-field--suggestions")],Nl.prototype,"suggestionsContainer",void 0),Sl([function(t){return(e,i)=>{const{slot:o,selector:r}=t??{},n="slot"+(o?`[name=${o}]`:":not([name])");return L(0,0,{get(){const e=this.renderRoot?.querySelector(n),i=e?.assignedElements(t)??[];return void 0===r?i:i.filter((t=>t.matches(r)))}})}}({selector:"ft-text-field-suggestion"})],Nl.prototype,"suggestions",void 0);const $l=Rt`
1676
+ `:pe}update(t){super.update(t),(t.has("value")||t.has("filterSuggestions"))&&this.filterSuggestionsIfNeeded(),t.has("value")&&null!=t.get("value")&&(this.hideSuggestions=!1),t.has("dispatchedValue")&&null!=t.get("dispatchedValue")&&(this.hideSuggestions=!0)}filterSuggestionsIfNeeded(){this.filterSuggestions?(this.suggestions.forEach((t=>t.hidden=!t.getValue().toLowerCase().includes(this.value.toLowerCase()))),this.visibleSuggestions=this.suggestions.filter((t=>!t.hidden))):this.visibleSuggestions=this.suggestions}contentAvailableCallback(t){var e,i;if(super.contentAvailableCallback(t),t.has("focused")&&!this.hideSuggestions&&this.visibleSuggestions.length>0){const t=null===(e=this.input)||void 0===e?void 0:e.getBoundingClientRect(),o=null===(i=this.suggestionsContainer)||void 0===i?void 0:i.getBoundingClientRect();t&&o&&(this.suggestionsOnTop=t.bottom+o.height>window.innerHeight&&t.top-o.height>0)}}setValue(t,e=!1){this.value!==t&&(this.setInternalValue(t),this.dispatchEvent(new CustomEvent("live-change",{detail:t}))),e&&this.dispatchedValue!==t&&(this.dispatchedValue=t,this.dispatchEvent(new CustomEvent("change",{detail:t})))}handleInput(t){var e;const i=(null===(e=this.input)||void 0===e?void 0:e.value)||"";this.setValue(i,"Escape"==t.key||"Enter"==t.key)}handleClick(){this.hideSuggestions=!1}handleKeyboardNavigation(t){var e;if("ArrowDown"===t.key||"ArrowUp"===t.key){t.preventDefault(),t.stopPropagation(),this.hideSuggestions=!1;const i=this.visibleSuggestions.findIndex((t=>t.matches(":focus-within")));let o;o="ArrowDown"===t.key?i<this.visibleSuggestions.length-1?i+1:0:i>0?i-1:this.visibleSuggestions.length-1,null===(e=this.visibleSuggestions[o])||void 0===e||e.focus()}"Escape"!=t.key&&"Enter"!=t.key||(this.hideSuggestions=!0)}onSuggestionSelected(t){var e;this.setValue(t.detail,!0),null===(e=this.input)||void 0===e||e.focus(),setTimeout((()=>this.hideSuggestions=!0),0)}onFocus(){this.focused=!0,this.hideSuggestions=!1}onMainPanelBlur(){var t,e;(null===(t=this.mainPanel)||void 0===t?void 0:t.matches(":focus-within"))||(this.focused=!1,this.setValue((null===(e=this.input)||void 0===e?void 0:e.value)||"",!0))}togglePasswordVisibility(){this.hidePassword=!this.hidePassword}}$l.elementDefinitions={"ft-input-label":Cs,"ft-ripple":Za,"ft-typography":Ma,"ft-icon":ss},$l.styles=[sa,Sl],Nl([I()],$l.prototype,"label",void 0),Nl([I({noAccessor:!0})],$l.prototype,"value",null),Nl([R()],$l.prototype,"dispatchedValue",void 0),Nl([I()],$l.prototype,"helper",void 0),Nl([I({type:Boolean})],$l.prototype,"outlined",void 0),Nl([I({type:Boolean})],$l.prototype,"disabled",void 0),Nl([I({type:Boolean})],$l.prototype,"error",void 0),Nl([I()],$l.prototype,"prefix",void 0),Nl([I()],$l.prototype,"icon",void 0),Nl([I()],$l.prototype,"passwordHiddenIcon",void 0),Nl([I()],$l.prototype,"passwordRevealedIcon",void 0),Nl([I()],$l.prototype,"iconVariant",void 0),Nl([I({type:Boolean})],$l.prototype,"filterSuggestions",void 0),Nl([I({type:Number})],$l.prototype,"maxLength",void 0),Nl([I({type:Boolean})],$l.prototype,"password",void 0),Nl([R()],$l.prototype,"focused",void 0),Nl([R()],$l.prototype,"hidePassword",void 0),Nl([R()],$l.prototype,"suggestionsOnTop",void 0),Nl([R()],$l.prototype,"hideSuggestions",void 0),Nl([R()],$l.prototype,"visibleSuggestions",void 0),Nl([A(".ft-text-field--main-panel")],$l.prototype,"mainPanel",void 0),Nl([A(".ft-text-field--input")],$l.prototype,"input",void 0),Nl([A(".ft-text-field--suggestions")],$l.prototype,"suggestionsContainer",void 0),Nl([function(t){return(e,i)=>{const{slot:o,selector:r}=t??{},n="slot"+(o?`[name=${o}]`:":not([name])");return L(0,0,{get(){const e=this.renderRoot?.querySelector(n),i=e?.assignedElements(t)??[];return void 0===r?i:i.filter((t=>t.matches(r)))}})}}({selector:"ft-text-field-suggestion"})],$l.prototype,"suggestions",void 0);const Cl=Rt`
1677
1677
  .ft-text-field-suggestion {
1678
1678
  position: relative;
1679
1679
  padding: 8px 16px;
@@ -1698,7 +1698,7 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1698
1698
  slot {
1699
1699
  pointer-events: none;
1700
1700
  }
1701
- `;var Cl=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class El extends CustomEvent{constructor(t){super("suggestion-selected",{detail:t,bubbles:!0,composed:!0})}}class kl extends Gi{render(){return de`
1701
+ `;var El=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class kl extends CustomEvent{constructor(t){super("suggestion-selected",{detail:t,bubbles:!0,composed:!0})}}class Il extends Gi{render(){return de`
1702
1702
  <div class="ft-text-field-suggestion"
1703
1703
  tabindex="-1"
1704
1704
  @keydown=${this.onKeyDown}
@@ -1710,15 +1710,15 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1710
1710
  <slot></slot>
1711
1711
  </ft-typography>
1712
1712
  </div>
1713
- `}focus(t){var e;null===(e=this.container)||void 0===e||e.focus(t)}click(){var t;null===(t=this.container)||void 0===t||t.click()}confirmSuggestion(){this.dispatchEvent(new El(this.getValue()))}getValue(){return this.value||this.textContent}get textContent(){return this.assignedNodes.map((t=>t.textContent)).join("").trim()}onKeyDown(t){["Enter"," "].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),this.confirmSuggestion())}}kl.elementDefinitions={"ft-ripple":Za,"ft-typography":Ma,"ft-icon":ss},kl.styles=$l,Cl([I()],kl.prototype,"value",void 0),Cl([A(".ft-text-field-suggestion")],kl.prototype,"container",void 0),Cl([T()],kl.prototype,"assignedNodes",void 0),M("ft-text-field")(Nl),M("ft-text-field-suggestion")(kl);class Il{constructor(t){this.paginatedToc=t,this.nodeByTocId={},this.knownPrettyUrls=new Set,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,duplicatedPrettyUrls:this.duplicatedPrettyUrls,pages:this.pages,pageByTocId:this.pageByTocId}}extractPagesToc(t,e,i){return t.flatMap((t=>(t.pageConfiguration&&this.registerPage(this.buildPage(t,i)),null==t.tocId?this.extractPagesToc(t.children,e,i):[{tocId:t.tocId,title:t.title,depth:e,children:this.extractPagesToc(t.children,e+1,t.tocId)}])))}convertNodes(t,e,i){return t.flatMap((t=>{var o,r,n;if(null==t.tocId)return[...this.convertSectionNodes(null!==(o=t.pageToc)&&void 0!==o?o:[],e,t.tocId),...this.convertNodes(t.children,e,t.tocId)];let a=null===(r=t.prettyUrl)||void 0===r?void 0:r.replace(/^\//,"");const s={tocId:t.tocId,contentId:t.contentId,title:t.title,hasRating:t.hasRating,origin:t.origin,prettyUrl:a,depth:e,parentTocId:i,children:[]};this.register(s);const l=this.convertSectionNodes(null!==(n=t.pageToc)&&void 0!==n?n:[],e+1,t.tocId),c=this.convertNodes(t.children,e+1,s.tocId);return s.children=[...l,...c],[s]}))}convertSectionNodes(t,e,i){return t.flatMap((t=>{var o;let r=null===(o=t.prettyUrl)||void 0===o?void 0:o.replace(/^\//,"");const n={...t,prettyUrl:r,depth:e,parentTocId:i,children:[]};return this.register(n),n.children=this.convertSectionNodes(t.children,e+1,t.tocId),[n]}))}buildPage(t,e){var i,o,r,n,a,s;const l={number:this.pages.length+1,title:null!==(i=t.title)&&void 0!==i?i:"",rootTocId:null!==(o=t.tocId)&&void 0!==o?o:"root",toc:(null!==(r=t.pageToc)&&void 0!==r?r:[]).map((t=>this.nodeByTocId[t.tocId])),topics:[],hiddenTopics:[],breadcrumb:e?this.buildBreadcrumb(this.nodeByTocId[e]):[]},c=(t,e)=>(e?l.topics:l.hiddenTopics).push(t),f=null!==(a=null===(n=t.pageConfiguration)||void 0===n?void 0:n.parentsVisibility)&&void 0!==a?a:[];return l.breadcrumb.forEach(((t,e)=>{c(t,f[e])})),t.tocId&&c(t.tocId,t.pageConfiguration.isVisible),l.topics.push(...this.tocIds(null!==(s=t.pageToc)&&void 0!==s?s:[])),l}registerPage(t){for(let e of[...t.topics,...t.hiddenTopics])this.pageByTocId[e]||(this.pageByTocId[e]=t);this.pages.push(t)}tocIds(t){return t.flatMap((t=>[t.tocId,...this.tocIds(t.children)]))}buildBreadcrumb(t){const e=[t.tocId];for(;null==t?void 0:t.parentTocId;)e.unshift(t.parentTocId),t=this.nodeByTocId[t.parentTocId];return e}register(t){t.prettyUrl&&(this.knownPrettyUrls.has(t.prettyUrl)&&this.duplicatedPrettyUrls.add(t.prettyUrl),this.knownPrettyUrls.add(t.prettyUrl)),this.nodeByTocId[t.tocId]=t}}class Rl{convertPaginatedToc(t){return new Il(t).build()}}var Ul,Ll,Al,Tl,_l,Wl,Dl,Ml,Fl,Pl,zl,Bl,jl,Kl,Zl,Hl,Gl,Vl;!function(t){!function(e){var i={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(i.arrayBuffer)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],r=ArrayBuffer.isView||function(t){return t&&o.indexOf(Object.prototype.toString.call(t))>-1};function n(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function s(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i.iterable&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise((function(e,i){t.onload=function(){e(t.result)},t.onerror=function(){i(t.error)}}))}function h(t){var e=new FileReader,i=f(e);return e.readAsArrayBuffer(t),i}function d(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function u(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:i.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():i.arrayBuffer&&i.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||r(t))?this._bodyArrayBuffer=d(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,i=f(e);return e.readAsText(t),i}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),i=new Array(e.length),o=0;o<e.length;o++)i[o]=String.fromCharCode(e[o]);return i.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i.formData&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=n(t),e=a(e);var i=this.map[t];this.map[t]=i?i+", "+e:e},l.prototype.delete=function(t){delete this.map[n(t)]},l.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},l.prototype.set=function(t,e){this.map[n(t)]=a(e)},l.prototype.forEach=function(t,e){for(var i in this.map)this.map.hasOwnProperty(i)&&t.call(e,this.map[i],i,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,i){t.push(i)})),s(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),s(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,i){t.push([i,e])})),s(t)},i.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(t,e){var i,o,r=(e=e||{}).body;if(t instanceof y){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(i=e.method||this.method||"GET",o=i.toUpperCase(),p.indexOf(o)>-1?o:i),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function g(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var i=t.split("="),o=i.shift().replace(/\+/g," "),r=i.join("=").replace(/\+/g," ");e.append(decodeURIComponent(o),decodeURIComponent(r))}})),e}function b(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},u.call(y.prototype),u.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var v=[301,302,303,307,308];b.redirect=function(t,e){if(-1===v.indexOf(e))throw new RangeError("Invalid status code");return new b(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var i=Error(t);this.stack=i.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function m(t,o){return new Promise((function(r,n){var a=new y(t,o);if(a.signal&&a.signal.aborted)return n(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function c(){s.abort()}s.onload=function(){var t,e,i={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var i=t.split(":"),o=i.shift().trim();if(o){var r=i.join(":").trim();e.append(o,r)}})),e)};i.url="responseURL"in s?s.responseURL:i.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;r(new b(o,i))},s.onerror=function(){n(new TypeError("Network request failed"))},s.ontimeout=function(){n(new TypeError("Network request failed"))},s.onabort=function(){n(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i.blob&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",c),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",c)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}m.polyfill=!0,t.fetch||(t.fetch=m,t.Headers=l,t.Request=y,t.Response=b),e.Headers=l,e.Request=y,e.Response=b,e.fetch=m,Object.defineProperty(e,"W",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(Ul||(Ul={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(Ll||(Ll={})),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"}(Al||(Al={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(Tl||(Tl={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(_l||(_l={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(Wl||(Wl={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(Dl||(Dl={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(Ml||(Ml={})),function(t){t.ASC="ASC",t.DESC="DESC"}(Fl||(Fl={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(Pl||(Pl={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(zl||(zl={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(Bl||(Bl={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(jl||(jl={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(Kl||(Kl={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(Zl||(Zl={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(Hl||(Hl={})),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.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(Gl||(Gl={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(Vl||(Vl={}));const ql={[Gl.PERSONAL_BOOK_SHARE_USER]:[Gl.PERSONAL_BOOK_USER],[Gl.HTML_EXPORT_USER]:[Gl.PERSONAL_BOOK_USER],[Gl.PDF_EXPORT_USER]:[Gl.PERSONAL_BOOK_USER],[Gl.KHUB_ADMIN]:[Gl.CONTENT_PUBLISHER],[Gl.ADMIN]:[Gl.KHUB_ADMIN,Gl.USERS_ADMIN,Gl.PORTAL_ADMIN],[Gl.DEVELOPER]:[Gl.BETA_USER,Gl.DEBUG_USER]};function Yl(t,e){return t===e||(ql[t]??[]).some((t=>Yl(t,e)))}function Xl(t,e){if(null==t)return!1;return(Array.isArray(t)?t:Array.isArray(t.roles)?t.roles:Array.isArray(t.profile?.roles)?t.profile.roles:[]).some((t=>Yl(t,e)))}class Jl{get mapId(){return this._mapId}set mapId(t){t!==this._mapId&&this.clear(),this._mapId=t}constructor(t,e,i,o){this.converter=t,this.api=e,this.cache=i,this._mapId=o,this.initCache()}async withMapId(t){return this._mapId?t(this._mapId):void 0}initCache(){this.cache.registerFinal("configuration",(()=>this.api.getReaderConfiguration())),this.cache.register("map",(()=>this.withMapId((t=>this.fetchMap(t))))),this.cache.register("enrichedToc",(()=>this.withMapId((t=>this.fetchPages(t).then((t=>this.converter.convertPaginatedToc(t))))))),this.cache.register("ratingSummary",(()=>{var t,e;return Xl(null!==(e=null===(t=qs.getState().session)||void 0===t?void 0:t.profile.roles)&&void 0!==e?e:[],"RATING_USER")?this.withMapId((t=>this.fetchMapRating(t))):Promise.resolve()}))}clear(){this.cache.clearAll()}getMap(){return this.cache.get("map")}getConfiguration(){return this.cache.get("configuration")}getEnrichedToc(){return this.cache.get("enrichedToc")}get enrichedToc(){return this.cache.getNow("enrichedToc")}async getPaginationConfiguration(){return(await this.getEnrichedToc()).paginationConfiguration}async getToc(){return(await this.getEnrichedToc()).toc}async getPagesToc(){return(await this.getEnrichedToc()).pagesToc}async getTocNode(t){return(await this.getEnrichedToc()).nodeByTocId[t]}getTocNodeNow(t){var e;return null===(e=this.enrichedToc)||void 0===e?void 0:e.nodeByTocId[t]}async getPage(t){const e=await this.getEnrichedToc();return e.pages[t-1]||e.pages[0]}async getPageByTocId(t){const e=await this.getEnrichedToc();return e.pageByTocId[t]||e.pages[0]}getTopicInfo(t){return this.cache.get("topic-"+t.tocId,(()=>this.fetchTopicMetadata(t)))}getTopicContent(t){return this.cache.get("topic-content-"+t.tocId,(()=>this.fetchTopicHTMLContent(t)))}getAttachments(){return this.cache.get("map-attachments",(()=>this.fetchAttachments()))}getRelativesForDocument(t,e){return this.cache.get("document-relatives-"+t+"-"+e.join("-"),(()=>this.fetchRelativesForDocument(t,e)))}getRelativesForTopicInMap(t,e,i){return this.cache.get("topic-relatives-"+[t,e,...i].join("-"),(()=>this.fetchRelativesForTopicInMap(t,e,i)))}getAttachmentDownloadLink(t){return this.makeAbsolute(`${this.api.endpoints.khub.maps.mapId(this.mapId).attachments.attachmentId(t).content}?download=true`)}getLink(t,e,i){const o=this.getNavigationData(t,e,i),r=this.getReaderLinkPrefix()+(o.prettyUrl?o.prettyUrl:`${o.mapId}/${o.tocId}`),n=new URL(r,this.api.tenantBaseUrl);return null!=o.page&&n.searchParams.set("page",`${o.page}`),o.prettyUrlDuplicated&&n.searchParams.set("tocId",o.tocId),null!=o.section&&n.searchParams.set("section",o.section),n.href}getNavigationData(t,e,i){var o,r;t=t||"root";const n=this.enrichedToc,a=null==n?void 0:n.pageByTocId[t],s=null==n?void 0:n.nodeByTocId[t],l=null==s?void 0:s.prettyUrl;return{mapId:this.mapId,tocId:t,topicTitle:null!==(o=null==s?void 0:s.title)&&void 0!==o?o:"",page:e&&a&&a.number!==e?e:void 0,prettyUrl:null!=l?l.replace(/^r\//,""):void 0,prettyUrlDuplicated:null!==(r=null==n?void 0:n.duplicatedPrettyUrls.has(null!=l?l:""))&&void 0!==r&&r,section:i}}async getAccurateNavigationData(t,e,i){return await this.getEnrichedToc(),this.getNavigationData(t,e,i)}getRatingSummary(){return this.cache.get("ratingSummary")}reloadRating(){return this.cache.clear("ratingSummary"),this.getRatingSummary()}getMapRating(){return this.getRatingSummary().then((t=>null==t?void 0:t.publication))}getTopicRating(t){return this.getRatingSummary().then((e=>{var i;return e?{type:e.topics.type,rating:null===(i=e.topics)||void 0===i?void 0:i.ratings.find((e=>e.tocId===t))}:void 0}))}rateMap(t,e){return this.makeRateMapRequest(t,e).then((()=>this.clearRatingIfNecessary()))}unrateMap(){return this.makeUnrateMapRequest().then((()=>this.clearRatingIfNecessary()))}sendMapFeedback(t,e){return this.makeMapFeedbackRequest(t,e)}rateTopic(t,e,i){return this.makeRateTopicRequest(t,e,i).then((()=>this.clearRatingIfNecessary()))}unrateTopic(t){return this.makeUnrateTopicRequest(t).then((()=>this.clearRatingIfNecessary()))}async clearRatingIfNecessary(){const t=qs.getState().session;(null==t?void 0:t.sessionAuthenticated)&&this.cache.clear("ratingSummary")}sendTopicFeedback(t,e,i){return this.makeTopicFeedbackRequest(t,e,i)}fontsStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.fonts)}themeStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.theme)}buildBreadcrumb(t){let e=this.getTocNodeNow(t),i=[{tocId:e.tocId,title:e.title}],o=this.getTocNodeNow(e.parentTocId);for(;o;)i.unshift({tocId:o.tocId,title:o.title}),o=this.getTocNodeNow(o.parentTocId);return i}isFeatureAccessible(t,{session:e,ratingType:i}){if(!this.isFeatureAvailable(t))return!1;switch(t){case nn.FEEDBACK:return Xl(null!=e?e:[],Gl.FEEDBACK_USER);case nn.RATING:return Xl(null!=e?e:[],Gl.RATING_USER)&&null!=i&&i!==Dl.NO_RATING;case nn.PRINT:return Xl(null!=e?e:[],Gl.PRINT_USER);case nn.BOOKMARK:return!!(null==e?void 0:e.sessionAuthenticated);case nn.COLLECTIONS:return Xl(null!=e?e:[],Gl.COLLECTION_USER);case nn.PERSONAL_BOOKS:return Xl(null!=e?e:[],Gl.PERSONAL_BOOK_USER);default:return!1}}makeAbsolute(t){return this.api.makeAbsolute(t)}}class Ql extends Jl{static async build(t){return new Ql(new Rl,await Ys.await(),new o,t)}clear(){super.clear(),this.fingerprint=void 0}async fetchMap(t){const e=await this.api.getMap(t);return this.fingerprint=e.fingerprint,e}fetchMapRating(t){return this.api.getMapRating(t)}async fetchPages(t){return await this.getMap(),this.api.getPages(t,this.fingerprint)}fetchTopicHTMLContent(t){return this.api.getTopicHTMLContent(this.mapId,t.contentId,"DESIGNED_READER",this.fingerprint)}fetchTopicMetadata(t){return this.api.getTopic(this.mapId,t.contentId,this.fingerprint)}fetchAttachments(){return this.api.getMapAttachments(this.mapId).catch((()=>[]))}fetchRelativesForDocument(t,e){return this.api.search({query:"",paging:{page:1,perPage:-1},scope:"DOCUMENTS",filters:[{negative:!1,values:e,key:t}],sort:[],facets:[]})}fetchRelativesForTopicInMap(t,e,i){return this.api.search({query:"",paging:{page:1,perPage:1},scope:"ALL_TOPICS",filters:[{negative:!1,values:i,key:e},{negative:!1,values:[t],key:"ft:publicationId"}],sort:[],facets:[]})}makeMapFeedbackRequest(t,e){return this.api.sendMapFeedback(this.mapId,t,e)}makeRateMapRequest(t,e){return this.api.rateMap(this.mapId,t,e)}makeRateTopicRequest(t,e,i){return this.api.rateTopic(this.mapId,t,e,i)}makeTopicFeedbackRequest(t,e,i){return this.api.sendTopicFeedback(this.mapId,t,e,i)}makeUnrateMapRequest(){return this.api.unrateMap(this.mapId)}makeUnrateTopicRequest(t){return this.api.unrateTopic(this.mapId,t)}getReaderLinkPrefix(){return"r/"}isFeatureAvailable(t){return!0}}class tc{static build(t,e){return new tc((t=>Xr.get({name:"ft-reader-"+t,initialState:{mapId:void 0,visibleTopics:[],map:void 0,toc:void 0,pagesToc:void 0,paginationConfiguration:void 0,currentPage:void 0,scrollTarget:void 0,configuration:void 0,searchInDocumentQuery:void 0,relatives:void 0}}))(t.trim()||"context"),null!=e?e:Ql.build)}constructor(t,e){this.store=t,this.metadataForSwitchToRelatives=new Set,this.loadDebouncer=new n(10),this.initService(e)}async initService(t){return this.service=await t(),this.service.mapId=this.store.getState().mapId,this.reload()}async setMapId(t){t!==this.store.getState().mapId&&(this.store.actions.mapId(t),this.service&&(this.service.mapId=t),await this.reload())}setVisibleTopics(t){this.store.actions.visibleTopics(t)}async awaitService(){return W((()=>this.service))}async navigateToTopic(t,e,i){const o=await this.awaitService(),r=await(null!=i?o.getPage(i):o.getPageByTocId(null!=t?t:"root"));this.store.actions.currentPage(r),this.store.actions.scrollTarget({tocId:this.resolveValidNonRootTocId(t,r),section:e})}resolveValidNonRootTocId(t,e){var i,o,r;let n=null!==(i="root"===t?void 0:t)&&void 0!==i?i:e.rootTocId;return e.topics.includes(n)?n:null!==(r=null!==(o=e.topics[0])&&void 0!==o?o:e.hiddenTopics[0])&&void 0!==r?r:"root"}async navigateToPage(t){const e=await this.awaitService();let i=await e.getPage(t);this.store.actions.currentPage(i)}scrollDone(){this.store.actions.scrollTarget({})}async load(){var t;(null===(t=this.service)||void 0===t?void 0:t.mapId)&&null==this.store.getState().map&&await this.loadDebouncer.run((()=>this.fetchData()))}clear(){var t;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),null===(t=this.service)||void 0===t||t.clear(),this.metadataForSwitchToRelatives=new Set,this.clusteringHelper=void 0}reload(){return this.clear(),this.load()}async fetchData(){var t,i,o,r,n;try{await Promise.all([null===(t=this.service)||void 0===t?void 0:t.getConfiguration().then((t=>this.store.actions.configuration(t))),null===(i=this.service)||void 0===i?void 0:i.getMap().then((t=>this.store.actions.map(t))),null===(o=this.service)||void 0===o?void 0:o.getToc().then((t=>this.store.actions.toc(t))),null===(r=this.service)||void 0===r?void 0:r.getPagesToc().then((t=>this.store.actions.pagesToc(t))),null===(n=this.service)||void 0===n?void 0:n.getPaginationConfiguration().then((t=>this.store.actions.paginationConfiguration(t)))]).then((()=>{this.metadataForSwitchToRelatives.size>0&&this.fetchRelatives()}))}catch(t){!this.errorHandler||t instanceof e||this.errorHandler(t)}}fetchRelatives(){var t,e,i;const o=null===(t=this.store.getState().map)||void 0===t?void 0:t.metadata.filter((t=>{var e;return t.key==(null===(e=this.store.getState().configuration)||void 0===e?void 0:e.relativePivotMetadata)})).flatMap((t=>t.values));void 0!==o&&o.length>0&&(null===(e=this.service)||void 0===e||e.getRelativesForDocument(null===(i=this.store.getState().configuration)||void 0===i?void 0:i.relativePivotMetadata,o).then((t=>{const e=t.results.flatMap((t=>t.entries));this.store.actions.relatives(e),this.createClusteringHelper()})))}createClusteringHelper(){var t,e;this.store.getState().relatives&&(this.clusteringHelper=new r(this.store.getState().relatives,this.store.getState().relatives.find((t=>{var e;return(null===(e=t.map)||void 0===e?void 0:e.mapId)==this.store.getState().mapId})),this.metadataForSwitchToRelatives,null!==(e=null===(t=qs.getState().metadataConfiguration)||void 0===t?void 0:t.descriptors)&&void 0!==e?e:[]),this.store.eventBus.dispatchEvent(new CustomEvent("clustering-helper-created")))}async navigateToRelativeTopicIfFound(t){var e,i,o;const r=await W((()=>{var t;return null===(t=this.store.getState().configuration)||void 0===t?void 0:t.relativeTopicPivotMetadata})),n=this.store.getState().mapId,a=await this.awaitService(),s=await a.getRelativesForTopicInMap(n,r,[t]);if(null===(o=null===(i=null===(e=null==s?void 0:s.results)||void 0===e?void 0:e[0])||void 0===i?void 0:i.entries)||void 0===o?void 0:o[0]){const t=s.results[0].entries[0].topic.tocId;return await this.navigateToTopic(t),!0}return await this.navigateToTopic("root"),!1}setSearchInDocumentQuery(t){this.store.actions.searchInDocumentQuery(t)}registerMetadataForSwitchToRelatives(t){this.metadataForSwitchToRelatives.add(t),null==this.store.getState().relatives?this.fetchRelatives():this.createClusteringHelper()}unregisterMetadataForSwitchToRelatives(t){this.metadataForSwitchToRelatives.delete(t),this.createClusteringHelper()}}const ec=Rt`
1714
- `;class ic extends CustomEvent{constructor(t,e){super("ft-reader-map-loaded",{detail:{map:t,toc:e}})}}class oc extends CustomEvent{constructor(t,e){super("ft-reader-visible-topics-change",{detail:{visibleTopics:e}})}}class rc extends CustomEvent{constructor(t){super("ft-reader-navigation-done",{detail:t})}}class nc extends CustomEvent{constructor(t){super("ft-reader-load-error",{detail:t})}}class ac extends Event{constructor(){super("ft-reader-map-not-found")}}class sc extends Event{constructor(){super("ft-reader-map-unauthorized")}}class lc extends Event{constructor(){super("ft-reader-map-forbidden")}}class cc extends Event{constructor(){super("ft-reader-topic-relative-not-found",{bubbles:!0,composed:!0})}}var fc=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class hc extends lo{constructor(){super(),this.visibleTopics=[],this.scrollToTargetDebouncer=new n(5),this.navigationDebouncer=new n(10),this.addStore(qs)}render(){return de`
1713
+ `}focus(t){var e;null===(e=this.container)||void 0===e||e.focus(t)}click(){var t;null===(t=this.container)||void 0===t||t.click()}confirmSuggestion(){this.dispatchEvent(new kl(this.getValue()))}getValue(){return this.value||this.textContent}get textContent(){return this.assignedNodes.map((t=>t.textContent)).join("").trim()}onKeyDown(t){["Enter"," "].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),this.confirmSuggestion())}}Il.elementDefinitions={"ft-ripple":Za,"ft-typography":Ma,"ft-icon":ss},Il.styles=Cl,El([I()],Il.prototype,"value",void 0),El([A(".ft-text-field-suggestion")],Il.prototype,"container",void 0),El([T()],Il.prototype,"assignedNodes",void 0),M("ft-text-field")($l),M("ft-text-field-suggestion")(Il);class Rl{constructor(t){this.paginatedToc=t,this.nodeByTocId={},this.knownPrettyUrls=new Set,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,duplicatedPrettyUrls:this.duplicatedPrettyUrls,pages:this.pages,pageByTocId:this.pageByTocId}}extractPagesToc(t,e,i){return t.flatMap((t=>(t.pageConfiguration&&this.registerPage(this.buildPage(t,i)),null==t.tocId?this.extractPagesToc(t.children,e,i):[{tocId:t.tocId,title:t.title,depth:e,children:this.extractPagesToc(t.children,e+1,t.tocId)}])))}convertNodes(t,e,i){return t.flatMap((t=>{var o,r,n;if(null==t.tocId)return[...this.convertSectionNodes(null!==(o=t.pageToc)&&void 0!==o?o:[],e,t.tocId),...this.convertNodes(t.children,e,t.tocId)];let a=null===(r=t.prettyUrl)||void 0===r?void 0:r.replace(/^\//,"");const s={tocId:t.tocId,contentId:t.contentId,title:t.title,hasRating:t.hasRating,origin:t.origin,prettyUrl:a,depth:e,parentTocId:i,children:[]};this.register(s);const l=this.convertSectionNodes(null!==(n=t.pageToc)&&void 0!==n?n:[],e+1,t.tocId),c=this.convertNodes(t.children,e+1,s.tocId);return s.children=[...l,...c],[s]}))}convertSectionNodes(t,e,i){return t.flatMap((t=>{var o;let r=null===(o=t.prettyUrl)||void 0===o?void 0:o.replace(/^\//,"");const n={...t,prettyUrl:r,depth:e,parentTocId:i,children:[]};return this.register(n),n.children=this.convertSectionNodes(t.children,e+1,t.tocId),[n]}))}buildPage(t,e){var i,o,r,n,a,s;const l={number:this.pages.length+1,title:null!==(i=t.title)&&void 0!==i?i:"",rootTocId:null!==(o=t.tocId)&&void 0!==o?o:"root",toc:(null!==(r=t.pageToc)&&void 0!==r?r:[]).map((t=>this.nodeByTocId[t.tocId])),topics:[],hiddenTopics:[],breadcrumb:e?this.buildBreadcrumb(this.nodeByTocId[e]):[]},c=(t,e)=>(e?l.topics:l.hiddenTopics).push(t),f=null!==(a=null===(n=t.pageConfiguration)||void 0===n?void 0:n.parentsVisibility)&&void 0!==a?a:[];return l.breadcrumb.forEach(((t,e)=>{c(t,f[e])})),t.tocId&&c(t.tocId,t.pageConfiguration.isVisible),l.topics.push(...this.tocIds(null!==(s=t.pageToc)&&void 0!==s?s:[])),l}registerPage(t){for(let e of[...t.topics,...t.hiddenTopics])this.pageByTocId[e]||(this.pageByTocId[e]=t);this.pages.push(t)}tocIds(t){return t.flatMap((t=>[t.tocId,...this.tocIds(t.children)]))}buildBreadcrumb(t){const e=[t.tocId];for(;null==t?void 0:t.parentTocId;)e.unshift(t.parentTocId),t=this.nodeByTocId[t.parentTocId];return e}register(t){t.prettyUrl&&(this.knownPrettyUrls.has(t.prettyUrl)&&this.duplicatedPrettyUrls.add(t.prettyUrl),this.knownPrettyUrls.add(t.prettyUrl)),this.nodeByTocId[t.tocId]=t}}class Ul{convertPaginatedToc(t){return new Rl(t).build()}}var Ll,Al,Tl,_l,Wl,Dl,Ml,Fl,Pl,zl,Bl,jl,Kl,Zl,Hl,Gl,Vl,ql;!function(t){!function(e){var i={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(i.arrayBuffer)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],r=ArrayBuffer.isView||function(t){return t&&o.indexOf(Object.prototype.toString.call(t))>-1};function n(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function s(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i.iterable&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise((function(e,i){t.onload=function(){e(t.result)},t.onerror=function(){i(t.error)}}))}function h(t){var e=new FileReader,i=f(e);return e.readAsArrayBuffer(t),i}function d(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function u(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:i.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():i.arrayBuffer&&i.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||r(t))?this._bodyArrayBuffer=d(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,i=f(e);return e.readAsText(t),i}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),i=new Array(e.length),o=0;o<e.length;o++)i[o]=String.fromCharCode(e[o]);return i.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i.formData&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=n(t),e=a(e);var i=this.map[t];this.map[t]=i?i+", "+e:e},l.prototype.delete=function(t){delete this.map[n(t)]},l.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},l.prototype.set=function(t,e){this.map[n(t)]=a(e)},l.prototype.forEach=function(t,e){for(var i in this.map)this.map.hasOwnProperty(i)&&t.call(e,this.map[i],i,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,i){t.push(i)})),s(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),s(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,i){t.push([i,e])})),s(t)},i.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(t,e){var i,o,r=(e=e||{}).body;if(t instanceof y){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(i=e.method||this.method||"GET",o=i.toUpperCase(),p.indexOf(o)>-1?o:i),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function g(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var i=t.split("="),o=i.shift().replace(/\+/g," "),r=i.join("=").replace(/\+/g," ");e.append(decodeURIComponent(o),decodeURIComponent(r))}})),e}function b(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},u.call(y.prototype),u.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var v=[301,302,303,307,308];b.redirect=function(t,e){if(-1===v.indexOf(e))throw new RangeError("Invalid status code");return new b(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var i=Error(t);this.stack=i.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function m(t,o){return new Promise((function(r,n){var a=new y(t,o);if(a.signal&&a.signal.aborted)return n(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function c(){s.abort()}s.onload=function(){var t,e,i={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var i=t.split(":"),o=i.shift().trim();if(o){var r=i.join(":").trim();e.append(o,r)}})),e)};i.url="responseURL"in s?s.responseURL:i.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;r(new b(o,i))},s.onerror=function(){n(new TypeError("Network request failed"))},s.ontimeout=function(){n(new TypeError("Network request failed"))},s.onabort=function(){n(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i.blob&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",c),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",c)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}m.polyfill=!0,t.fetch||(t.fetch=m,t.Headers=l,t.Request=y,t.Response=b),e.Headers=l,e.Request=y,e.Response=b,e.fetch=m,Object.defineProperty(e,"W",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(Ll||(Ll={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(Al||(Al={})),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"}(Tl||(Tl={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(_l||(_l={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(Wl||(Wl={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(Dl||(Dl={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(Ml||(Ml={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(Fl||(Fl={})),function(t){t.ASC="ASC",t.DESC="DESC"}(Pl||(Pl={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(zl||(zl={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(Bl||(Bl={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(jl||(jl={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(Kl||(Kl={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(Zl||(Zl={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(Hl||(Hl={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(Gl||(Gl={})),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.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(Vl||(Vl={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(ql||(ql={}));const Yl={[Vl.PERSONAL_BOOK_SHARE_USER]:[Vl.PERSONAL_BOOK_USER],[Vl.HTML_EXPORT_USER]:[Vl.PERSONAL_BOOK_USER],[Vl.PDF_EXPORT_USER]:[Vl.PERSONAL_BOOK_USER],[Vl.KHUB_ADMIN]:[Vl.CONTENT_PUBLISHER],[Vl.ADMIN]:[Vl.KHUB_ADMIN,Vl.USERS_ADMIN,Vl.PORTAL_ADMIN],[Vl.DEVELOPER]:[Vl.BETA_USER,Vl.DEBUG_USER]};function Xl(t,e){return t===e||(Yl[t]??[]).some((t=>Xl(t,e)))}function Jl(t,e){if(null==t)return!1;return(Array.isArray(t)?t:Array.isArray(t.roles)?t.roles:Array.isArray(t.profile?.roles)?t.profile.roles:[]).some((t=>Xl(t,e)))}class Ql{get mapId(){return this._mapId}set mapId(t){t!==this._mapId&&this.clear(),this._mapId=t}constructor(t,e,i,o){this.converter=t,this.api=e,this.cache=i,this._mapId=o,this.initCache()}async withMapId(t){return this._mapId?t(this._mapId):void 0}initCache(){this.cache.registerFinal("configuration",(()=>this.api.getReaderConfiguration())),this.cache.register("map",(()=>this.withMapId((t=>this.fetchMap(t))))),this.cache.register("enrichedToc",(()=>this.withMapId((t=>this.fetchPages(t).then((t=>this.converter.convertPaginatedToc(t))))))),this.cache.register("ratingSummary",(()=>{var t,e;return Jl(null!==(e=null===(t=qs.getState().session)||void 0===t?void 0:t.profile.roles)&&void 0!==e?e:[],"RATING_USER")?this.withMapId((t=>this.fetchMapRating(t))):Promise.resolve()}))}clear(){this.cache.clearAll()}getMap(){return this.cache.get("map")}getConfiguration(){return this.cache.get("configuration")}getEnrichedToc(){return this.cache.get("enrichedToc")}get enrichedToc(){return this.cache.getNow("enrichedToc")}async getPaginationConfiguration(){return(await this.getEnrichedToc()).paginationConfiguration}async getToc(){return(await this.getEnrichedToc()).toc}async getPagesToc(){return(await this.getEnrichedToc()).pagesToc}async getTocNode(t){return(await this.getEnrichedToc()).nodeByTocId[t]}getTocNodeNow(t){var e;return null===(e=this.enrichedToc)||void 0===e?void 0:e.nodeByTocId[t]}async getPage(t){const e=await this.getEnrichedToc();return e.pages[t-1]||e.pages[0]}async getPageByTocId(t){const e=await this.getEnrichedToc();return e.pageByTocId[t]||e.pages[0]}getTopicInfo(t){return this.cache.get("topic-"+t.tocId,(()=>this.fetchTopicMetadata(t)))}getTopicContent(t){return this.cache.get("topic-content-"+t.tocId,(()=>this.fetchTopicHTMLContent(t)))}getAttachments(){return this.cache.get("map-attachments",(()=>this.fetchAttachments()))}getRelativesForDocument(t,e){return this.cache.get("document-relatives-"+t+"-"+e.join("-"),(()=>this.fetchRelativesForDocument(t,e)))}getRelativesForTopicInMap(t,e,i){return this.cache.get("topic-relatives-"+[t,e,...i].join("-"),(()=>this.fetchRelativesForTopicInMap(t,e,i)))}getAttachmentDownloadLink(t){return this.makeAbsolute(`${this.api.endpoints.khub.maps.mapId(this.mapId).attachments.attachmentId(t).content}?download=true`)}getLink(t,e,i){const o=this.getNavigationData(t,e,i),r=this.getReaderLinkPrefix()+(o.prettyUrl?o.prettyUrl:`${o.mapId}/${o.tocId}`),n=new URL(r,this.api.tenantBaseUrl);return null!=o.page&&n.searchParams.set("page",`${o.page}`),o.prettyUrlDuplicated&&n.searchParams.set("tocId",o.tocId),null!=o.section&&n.searchParams.set("section",o.section),n.href}getNavigationData(t,e,i){var o,r;t=t||"root";const n=this.enrichedToc,a=null==n?void 0:n.pageByTocId[t],s=null==n?void 0:n.nodeByTocId[t],l=null==s?void 0:s.prettyUrl;return{mapId:this.mapId,tocId:t,topicTitle:null!==(o=null==s?void 0:s.title)&&void 0!==o?o:"",page:e&&a&&a.number!==e?e:void 0,prettyUrl:null!=l?l.replace(/^r\//,""):void 0,prettyUrlDuplicated:null!==(r=null==n?void 0:n.duplicatedPrettyUrls.has(null!=l?l:""))&&void 0!==r&&r,section:i}}async getAccurateNavigationData(t,e,i){return await this.getEnrichedToc(),this.getNavigationData(t,e,i)}getRatingSummary(){return this.cache.get("ratingSummary")}reloadRating(){return this.cache.clear("ratingSummary"),this.getRatingSummary()}getMapRating(){return this.getRatingSummary().then((t=>null==t?void 0:t.publication))}getTopicRating(t){return this.getRatingSummary().then((e=>{var i;return e?{type:e.topics.type,rating:null===(i=e.topics)||void 0===i?void 0:i.ratings.find((e=>e.tocId===t))}:void 0}))}rateMap(t,e){return this.makeRateMapRequest(t,e).then((()=>this.clearRatingIfNecessary()))}unrateMap(){return this.makeUnrateMapRequest().then((()=>this.clearRatingIfNecessary()))}sendMapFeedback(t,e){return this.makeMapFeedbackRequest(t,e)}rateTopic(t,e,i){return this.makeRateTopicRequest(t,e,i).then((()=>this.clearRatingIfNecessary()))}unrateTopic(t){return this.makeUnrateTopicRequest(t).then((()=>this.clearRatingIfNecessary()))}async clearRatingIfNecessary(){const t=qs.getState().session;(null==t?void 0:t.sessionAuthenticated)&&this.cache.clear("ratingSummary")}sendTopicFeedback(t,e,i){return this.makeTopicFeedbackRequest(t,e,i)}fontsStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.fonts)}themeStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.theme)}buildBreadcrumb(t){let e=this.getTocNodeNow(t),i=[{tocId:e.tocId,title:e.title}],o=this.getTocNodeNow(e.parentTocId);for(;o;)i.unshift({tocId:o.tocId,title:o.title}),o=this.getTocNodeNow(o.parentTocId);return i}isFeatureAccessible(t,{session:e,ratingType:i}){if(!this.isFeatureAvailable(t))return!1;switch(t){case nn.FEEDBACK:return Jl(null!=e?e:[],Vl.FEEDBACK_USER);case nn.RATING:return Jl(null!=e?e:[],Vl.RATING_USER)&&null!=i&&i!==Ml.NO_RATING;case nn.PRINT:return Jl(null!=e?e:[],Vl.PRINT_USER);case nn.BOOKMARK:return!!(null==e?void 0:e.sessionAuthenticated);case nn.COLLECTIONS:return Jl(null!=e?e:[],Vl.COLLECTION_USER);case nn.PERSONAL_BOOKS:return Jl(null!=e?e:[],Vl.PERSONAL_BOOK_USER);default:return!1}}makeAbsolute(t){return this.api.makeAbsolute(t)}}class tc extends Ql{static async build(t){return new tc(new Ul,await Ys.await(),new o,t)}clear(){super.clear(),this.fingerprint=void 0}async fetchMap(t){const e=await this.api.getMap(t);return this.fingerprint=e.fingerprint,e}fetchMapRating(t){return this.api.getMapRating(t)}async fetchPages(t){return await this.getMap(),this.api.getPages(t,this.fingerprint)}fetchTopicHTMLContent(t){return this.api.getTopicHTMLContent(this.mapId,t.contentId,"DESIGNED_READER",this.fingerprint)}fetchTopicMetadata(t){return this.api.getTopic(this.mapId,t.contentId,this.fingerprint)}fetchAttachments(){return this.api.getMapAttachments(this.mapId).catch((()=>[]))}fetchRelativesForDocument(t,e){return this.api.search({query:"",paging:{page:1,perPage:-1},scope:"DOCUMENTS",filters:[{negative:!1,values:e,key:t}],sort:[],facets:[]})}fetchRelativesForTopicInMap(t,e,i){return this.api.search({query:"",paging:{page:1,perPage:1},scope:"ALL_TOPICS",filters:[{negative:!1,values:i,key:e},{negative:!1,values:[t],key:"ft:publicationId"}],sort:[],facets:[]})}makeMapFeedbackRequest(t,e){return this.api.sendMapFeedback(this.mapId,t,e)}makeRateMapRequest(t,e){return this.api.rateMap(this.mapId,t,e)}makeRateTopicRequest(t,e,i){return this.api.rateTopic(this.mapId,t,e,i)}makeTopicFeedbackRequest(t,e,i){return this.api.sendTopicFeedback(this.mapId,t,e,i)}makeUnrateMapRequest(){return this.api.unrateMap(this.mapId)}makeUnrateTopicRequest(t){return this.api.unrateTopic(this.mapId,t)}getReaderLinkPrefix(){return"r/"}isFeatureAvailable(t){return!0}}class ec{static build(t,e){return new ec((t=>Xr.get({name:"ft-reader-"+t,initialState:{mapId:void 0,visibleTopics:[],map:void 0,toc:void 0,pagesToc:void 0,paginationConfiguration:void 0,currentPage:void 0,scrollTarget:void 0,configuration:void 0,searchInDocumentQuery:void 0,relatives:void 0}}))(t.trim()||"context"),null!=e?e:tc.build)}constructor(t,e){this.store=t,this.metadataForSwitchToRelatives=new Set,this.loadDebouncer=new n(10),this.initService(e)}async initService(t){return this.service=await t(),this.service.mapId=this.store.getState().mapId,this.reload()}async setMapId(t){t!==this.store.getState().mapId&&(this.store.actions.mapId(t),this.service&&(this.service.mapId=t),await this.reload())}setVisibleTopics(t){this.store.actions.visibleTopics(t)}async awaitService(){return W((()=>this.service))}async navigateToTopic(t,e,i){const o=await this.awaitService(),r=await(null!=i?o.getPage(i):o.getPageByTocId(null!=t?t:"root"));this.store.actions.currentPage(r),this.store.actions.scrollTarget({tocId:this.resolveValidNonRootTocId(t,r),section:e})}resolveValidNonRootTocId(t,e){var i,o,r;let n=null!==(i="root"===t?void 0:t)&&void 0!==i?i:e.rootTocId;return e.topics.includes(n)?n:null!==(r=null!==(o=e.topics[0])&&void 0!==o?o:e.hiddenTopics[0])&&void 0!==r?r:"root"}async navigateToPage(t){const e=await this.awaitService();let i=await e.getPage(t);this.store.actions.currentPage(i)}scrollDone(){this.store.actions.scrollTarget({})}async load(){var t;(null===(t=this.service)||void 0===t?void 0:t.mapId)&&null==this.store.getState().map&&await this.loadDebouncer.run((()=>this.fetchData()))}clear(){var t;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),null===(t=this.service)||void 0===t||t.clear(),this.metadataForSwitchToRelatives=new Set,this.clusteringHelper=void 0}reload(){return this.clear(),this.load()}async fetchData(){var t,i,o,r,n;try{await Promise.all([null===(t=this.service)||void 0===t?void 0:t.getConfiguration().then((t=>this.store.actions.configuration(t))),null===(i=this.service)||void 0===i?void 0:i.getMap().then((t=>this.store.actions.map(t))),null===(o=this.service)||void 0===o?void 0:o.getToc().then((t=>this.store.actions.toc(t))),null===(r=this.service)||void 0===r?void 0:r.getPagesToc().then((t=>this.store.actions.pagesToc(t))),null===(n=this.service)||void 0===n?void 0:n.getPaginationConfiguration().then((t=>this.store.actions.paginationConfiguration(t)))]).then((()=>{this.metadataForSwitchToRelatives.size>0&&this.fetchRelatives()}))}catch(t){!this.errorHandler||t instanceof e||this.errorHandler(t)}}fetchRelatives(){var t,e,i;const o=null===(t=this.store.getState().map)||void 0===t?void 0:t.metadata.filter((t=>{var e;return t.key==(null===(e=this.store.getState().configuration)||void 0===e?void 0:e.relativePivotMetadata)})).flatMap((t=>t.values));void 0!==o&&o.length>0&&(null===(e=this.service)||void 0===e||e.getRelativesForDocument(null===(i=this.store.getState().configuration)||void 0===i?void 0:i.relativePivotMetadata,o).then((t=>{const e=t.results.flatMap((t=>t.entries));this.store.actions.relatives(e),this.createClusteringHelper()})))}createClusteringHelper(){var t,e;this.store.getState().relatives&&(this.clusteringHelper=new r(this.store.getState().relatives,this.store.getState().relatives.find((t=>{var e;return(null===(e=t.map)||void 0===e?void 0:e.mapId)==this.store.getState().mapId})),this.metadataForSwitchToRelatives,null!==(e=null===(t=qs.getState().metadataConfiguration)||void 0===t?void 0:t.descriptors)&&void 0!==e?e:[]),this.store.eventBus.dispatchEvent(new CustomEvent("clustering-helper-created")))}async navigateToRelativeTopicIfFound(t){var e,i,o;const r=await W((()=>{var t;return null===(t=this.store.getState().configuration)||void 0===t?void 0:t.relativeTopicPivotMetadata})),n=this.store.getState().mapId,a=await this.awaitService(),s=await a.getRelativesForTopicInMap(n,r,[t]);if(null===(o=null===(i=null===(e=null==s?void 0:s.results)||void 0===e?void 0:e[0])||void 0===i?void 0:i.entries)||void 0===o?void 0:o[0]){const t=s.results[0].entries[0].topic.tocId;return await this.navigateToTopic(t),!0}return await this.navigateToTopic("root"),!1}setSearchInDocumentQuery(t){this.store.actions.searchInDocumentQuery(t)}registerMetadataForSwitchToRelatives(t){this.metadataForSwitchToRelatives.add(t),null==this.store.getState().relatives?this.fetchRelatives():this.createClusteringHelper()}unregisterMetadataForSwitchToRelatives(t){this.metadataForSwitchToRelatives.delete(t),this.createClusteringHelper()}}const ic=Rt`
1714
+ `;class oc extends CustomEvent{constructor(t,e){super("ft-reader-map-loaded",{detail:{map:t,toc:e}})}}class rc extends CustomEvent{constructor(t,e){super("ft-reader-visible-topics-change",{detail:{visibleTopics:e}})}}class nc extends CustomEvent{constructor(t){super("ft-reader-navigation-done",{detail:t})}}class ac extends CustomEvent{constructor(t){super("ft-reader-load-error",{detail:t})}}class sc extends Event{constructor(){super("ft-reader-map-not-found")}}class lc extends Event{constructor(){super("ft-reader-map-unauthorized")}}class cc extends Event{constructor(){super("ft-reader-map-forbidden")}}class fc extends Event{constructor(){super("ft-reader-topic-relative-not-found",{bubbles:!0,composed:!0})}}var hc=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class dc extends lo{constructor(){super(),this.visibleTopics=[],this.scrollToTargetDebouncer=new n(5),this.navigationDebouncer=new n(10),this.addStore(qs)}render(){return de`
1715
1715
  ${this.importStyleIfNeeded()}
1716
1716
  <slot @register-ft-reader-component=${this.registerComponent}></slot>
1717
1717
  `}importStyleIfNeeded(){var t,e;const i=null===(t=this.stateManager.service)||void 0===t?void 0:t.themeStylesheet();return!i||window.location.href.startsWith(null!==(e=this.baseUrl)&&void 0!==e?e:"")?pe:de`
1718
1718
  <style>
1719
1719
  @import "${i}"
1720
1720
  </style>
1721
- `}get stateManager(){return null==this._stateManager&&(this._stateManager=tc.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0"),this.readerServiceProvider),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"reader")),this._stateManager}connectedCallback(){super.connectedCallback(),this.stateManager.setMapId(this.mapId),this.stateManager.awaitService().then((t=>{const e=t.fontsStylesheet();if(e&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${e}"]`)){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e),document.head.append(t)}}))}update(t){super.update(t),t.has("readerServiceProvider")&&this.readerServiceProvider&&this.stateManager.initService(this.readerServiceProvider),t.has("mapId")&&this.mapId&&(this.stateManager.setMapId(this.mapId),this.lastNotifiedNotFoundRelative=void 0),t.has("searchInDocumentQuery")&&null!=this.searchInDocumentQuery&&this.stateManager.setSearchInDocumentQuery(this.searchInDocumentQuery),["tocId","section","page","mapId","topicPivot"].some((e=>t.has(e)))&&this.mapId&&this.navigateToTarget()}contentAvailableCallback(t){var e;if(super.contentAvailableCallback(t),(t.has("map")||t.has("toc"))&&this.map&&this.toc&&this.dispatchEvent(new ic(this.map,this.toc)),t.has("scrollTarget")&&null==(null===(e=this.scrollTarget)||void 0===e?void 0:e.tocId)){const e=t.get("scrollTarget");null!=(null==e?void 0:e.tocId)&&this.scrollToTargetDebouncer.run((()=>{var t;return this.stateManager.service.getAccurateNavigationData(e.tocId,null===(t=this.currentPage)||void 0===t?void 0:t.number,e.section).then((t=>this.dispatchEvent(new rc(t))))}))}t.has("visibleTopics")&&Promise.all(this.visibleTopics.map((t=>{var e;return this.stateManager.service.getAccurateNavigationData(t,null===(e=this.currentPage)||void 0===e?void 0:e.number)}))).then((t=>{let e=t.filter((t=>null!=t&&""!==t.topicTitle)).map((t=>{var e;return{tocId:t.tocId,title:t.topicTitle,page:t.page,prettyUrl:t.prettyUrl,prettyUrlDuplicated:t.prettyUrlDuplicated,breadcrumb:null===(e=this.stateManager.service)||void 0===e?void 0:e.buildBreadcrumb(t.tocId)}}));this.dispatchEvent(new oc(this.map,e))}))}clear(){this.stateManager.clear()}async reload(){this.clear(),await this.navigateToTarget()}async navigateToTarget(){await this.stateManager.load(),await this.navigationDebouncer.run((async()=>{if(null!=this.topicPivot){await this.stateManager.navigateToRelativeTopicIfFound(this.topicPivot)||this.lastNotifiedNotFoundRelative===this.mapId+this.topicPivot?this.lastNotifiedNotFoundRelative=void 0:(this.dispatchEvent(new cc),this.lastNotifiedNotFoundRelative=this.mapId+this.topicPivot)}else null!=this.tocId?await this.stateManager.navigateToTopic(this.tocId,this.section,this.page):null!=this.page&&await this.stateManager.navigateToPage(this.page)}))}registerComponent(t){t.stopPropagation();const e=t.composedPath()[0];this.register(e)}register(t){t.setReaderStateManager(this.stateManager)}handleLoadError(t){const e=t;401===e.status?this.dispatchEvent(new sc):403===e.status?this.dispatchEvent(new lc):404===e.status?this.dispatchEvent(new ac):this.dispatchEvent(new nc(t))}reloadBookmarks(){ll.reloadBookmarks()}async reloadRating(){var t,e;await(null===(t=this.stateManager.service)||void 0===t?void 0:t.reloadRating()),null===(e=this.stateManager.store)||void 0===e||e.eventBus.dispatchEvent(new CustomEvent("rating-changed"))}}var dc;hc.styles=ec,fc([Ji({store:qs.name})],hc.prototype,"baseUrl",void 0),fc([I()],hc.prototype,"mapId",void 0),fc([I()],hc.prototype,"tocId",void 0),fc([I()],hc.prototype,"section",void 0),fc([I()],hc.prototype,"topicPivot",void 0),fc([I()],hc.prototype,"searchInDocumentQuery",void 0),fc([I({type:Number,converter:{fromAttribute:t=>+(null!=t?t:"NaN")>0?+t:dc}})],hc.prototype,"page",void 0),fc([Ji({store:"reader"})],hc.prototype,"map",void 0),fc([Ji({store:"reader"})],hc.prototype,"toc",void 0),fc([Ji({store:"reader"})],hc.prototype,"visibleTopics",void 0),fc([Ji({store:"reader"})],hc.prototype,"currentPage",void 0),fc([Ji({store:"reader"})],hc.prototype,"scrollTarget",void 0),fc([I({attribute:!1})],hc.prototype,"readerServiceProvider",void 0),M("ft-reader-context")(hc);class uc extends CustomEvent{constructor(t){super("send-feedback",{detail:t})}}class pc extends CustomEvent{constructor(t){super("ft-reader-topic-feedback",{composed:!0,bubbles:!0,detail:t})}}class yc extends CustomEvent{constructor(t){super("ft-reader-feedback",{composed:!0,bubbles:!0,detail:t})}}class gc extends CustomEvent{constructor(t){super("ft-reader-mailer-topic-feedback",{composed:!0,bubbles:!0,detail:t})}}class bc extends CustomEvent{constructor(){super("ft-reader-mailer-map-feedback",{composed:!0,bubbles:!0})}}var vc=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class mc extends(dl(cn)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.withMoreOptionsButton=!1,this.ratingAllowed=!1,this.from="",this.feedbackMessage="",this.emptyStarIcon="STAR",this.filledStarIcon="STAR_PLAIN",this.emptyLikeIcon="THUMBS_UP",this.filledLikeIcon="THUMBS_UP_PLAIN",this.emptyDislikeIcon="THUMBS_DOWN",this.filledDislikeIcon="THUMBS_DOWN_PLAIN",this.addI18nContext(ml,xl)}get canAccessFeedback(){var t;return null===(t=this.service)||void 0===t?void 0:t.isFeatureAccessible(nn.FEEDBACK,{session:this.session})}get canAccessRating(){var t,e;return null===(t=this.service)||void 0===t?void 0:t.isFeatureAccessible(nn.RATING,{session:this.session,ratingType:null===(e=this.ratingSummary)||void 0===e?void 0:e.type})}get configuredRatingType(){var t,e;return null!==(e=this.ratingAllowed?null===(t=this.ratingSummary)||void 0===t?void 0:t.type:"NO_RATING")&&void 0!==e?e:"NO_RATING"}get ratingType(){var t,e,i;return null!==(i=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.type)&&void 0!==i?i:"NO_RATING"}get ratingValue(){var t,e,i;return null!==(i=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.value)&&void 0!==i?i:-1}get ratingDate(){var t,e;const i=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.date;return"string"==typeof i?((o=i).match(/^\d{4}-\d{2}-\d{2}$/)&&(o=o.replace(/-/g,"/")),o=o.replace(" ","T").replace(/^(.+)(\+\d{2})(\d{2})$/,((t,e,i,o)=>e+i+":"+o)),new Date(o)):i;var o}render(){return this.canAccessFeedback||this.canAccessRating?de`
1721
+ `}get stateManager(){return null==this._stateManager&&(this._stateManager=ec.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0"),this.readerServiceProvider),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"reader")),this._stateManager}connectedCallback(){super.connectedCallback(),this.stateManager.setMapId(this.mapId),this.stateManager.awaitService().then((t=>{const e=t.fontsStylesheet();if(e&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${e}"]`)){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e),document.head.append(t)}}))}update(t){super.update(t),t.has("readerServiceProvider")&&this.readerServiceProvider&&this.stateManager.initService(this.readerServiceProvider),t.has("mapId")&&this.mapId&&(this.stateManager.setMapId(this.mapId),this.lastNotifiedNotFoundRelative=void 0),t.has("searchInDocumentQuery")&&null!=this.searchInDocumentQuery&&this.stateManager.setSearchInDocumentQuery(this.searchInDocumentQuery),["tocId","section","page","mapId","topicPivot"].some((e=>t.has(e)))&&this.mapId&&this.navigateToTarget()}contentAvailableCallback(t){var e;if(super.contentAvailableCallback(t),(t.has("map")||t.has("toc"))&&this.map&&this.toc&&this.dispatchEvent(new oc(this.map,this.toc)),t.has("scrollTarget")&&null==(null===(e=this.scrollTarget)||void 0===e?void 0:e.tocId)){const e=t.get("scrollTarget");null!=(null==e?void 0:e.tocId)&&this.scrollToTargetDebouncer.run((()=>{var t;return this.stateManager.service.getAccurateNavigationData(e.tocId,null===(t=this.currentPage)||void 0===t?void 0:t.number,e.section).then((t=>this.dispatchEvent(new nc(t))))}))}t.has("visibleTopics")&&Promise.all(this.visibleTopics.map((t=>{var e;return this.stateManager.service.getAccurateNavigationData(t,null===(e=this.currentPage)||void 0===e?void 0:e.number)}))).then((t=>{let e=t.filter((t=>null!=t&&""!==t.topicTitle)).map((t=>{var e;return{tocId:t.tocId,title:t.topicTitle,page:t.page,prettyUrl:t.prettyUrl,prettyUrlDuplicated:t.prettyUrlDuplicated,breadcrumb:null===(e=this.stateManager.service)||void 0===e?void 0:e.buildBreadcrumb(t.tocId)}}));this.dispatchEvent(new rc(this.map,e))}))}clear(){this.stateManager.clear()}async reload(){this.clear(),await this.navigateToTarget()}async navigateToTarget(){await this.stateManager.load(),await this.navigationDebouncer.run((async()=>{if(null!=this.topicPivot){await this.stateManager.navigateToRelativeTopicIfFound(this.topicPivot)||this.lastNotifiedNotFoundRelative===this.mapId+this.topicPivot?this.lastNotifiedNotFoundRelative=void 0:(this.dispatchEvent(new fc),this.lastNotifiedNotFoundRelative=this.mapId+this.topicPivot)}else null!=this.tocId?await this.stateManager.navigateToTopic(this.tocId,this.section,this.page):null!=this.page&&await this.stateManager.navigateToPage(this.page)}))}registerComponent(t){t.stopPropagation();const e=t.composedPath()[0];this.register(e)}register(t){t.setReaderStateManager(this.stateManager)}handleLoadError(t){const e=t;401===e.status?this.dispatchEvent(new lc):403===e.status?this.dispatchEvent(new cc):404===e.status?this.dispatchEvent(new sc):this.dispatchEvent(new ac(t))}reloadBookmarks(){ll.reloadBookmarks()}async reloadRating(){var t,e;await(null===(t=this.stateManager.service)||void 0===t?void 0:t.reloadRating()),null===(e=this.stateManager.store)||void 0===e||e.eventBus.dispatchEvent(new CustomEvent("rating-changed"))}}var uc;dc.styles=ic,hc([Ji({store:qs.name})],dc.prototype,"baseUrl",void 0),hc([I()],dc.prototype,"mapId",void 0),hc([I()],dc.prototype,"tocId",void 0),hc([I()],dc.prototype,"section",void 0),hc([I()],dc.prototype,"topicPivot",void 0),hc([I()],dc.prototype,"searchInDocumentQuery",void 0),hc([I({type:Number,converter:{fromAttribute:t=>+(null!=t?t:"NaN")>0?+t:uc}})],dc.prototype,"page",void 0),hc([Ji({store:"reader"})],dc.prototype,"map",void 0),hc([Ji({store:"reader"})],dc.prototype,"toc",void 0),hc([Ji({store:"reader"})],dc.prototype,"visibleTopics",void 0),hc([Ji({store:"reader"})],dc.prototype,"currentPage",void 0),hc([Ji({store:"reader"})],dc.prototype,"scrollTarget",void 0),hc([I({attribute:!1})],dc.prototype,"readerServiceProvider",void 0),M("ft-reader-context")(dc);class pc extends CustomEvent{constructor(t){super("send-feedback",{detail:t})}}class yc extends CustomEvent{constructor(t){super("ft-reader-topic-feedback",{composed:!0,bubbles:!0,detail:t})}}class gc extends CustomEvent{constructor(t){super("ft-reader-feedback",{composed:!0,bubbles:!0,detail:t})}}class bc extends CustomEvent{constructor(t){super("ft-reader-mailer-topic-feedback",{composed:!0,bubbles:!0,detail:{topic:t}})}}class vc extends CustomEvent{constructor(){super("ft-reader-mailer-map-feedback",{composed:!0,bubbles:!0})}}var mc=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class xc extends(ul(cn)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.withMoreOptionsButton=!1,this.ratingAllowed=!1,this.from="",this.feedbackMessage="",this.emptyStarIcon="STAR",this.filledStarIcon="STAR_PLAIN",this.emptyLikeIcon="THUMBS_UP",this.filledLikeIcon="THUMBS_UP_PLAIN",this.emptyDislikeIcon="THUMBS_DOWN",this.filledDislikeIcon="THUMBS_DOWN_PLAIN",this.addI18nContext(xl,wl)}get canAccessFeedback(){var t;return null===(t=this.service)||void 0===t?void 0:t.isFeatureAccessible(nn.FEEDBACK,{session:this.session})}get canAccessRating(){var t,e;return null===(t=this.service)||void 0===t?void 0:t.isFeatureAccessible(nn.RATING,{session:this.session,ratingType:null===(e=this.ratingSummary)||void 0===e?void 0:e.type})}get configuredRatingType(){var t,e;return null!==(e=this.ratingAllowed?null===(t=this.ratingSummary)||void 0===t?void 0:t.type:"NO_RATING")&&void 0!==e?e:"NO_RATING"}get ratingType(){var t,e,i;return null!==(i=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.type)&&void 0!==i?i:"NO_RATING"}get ratingValue(){var t,e,i;return null!==(i=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.value)&&void 0!==i?i:-1}get ratingDate(){var t,e;const i=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.date;return"string"==typeof i?((o=i).match(/^\d{4}-\d{2}-\d{2}$/)&&(o=o.replace(/-/g,"/")),o=o.replace(" ","T").replace(/^(.+)(\+\d{2})(\d{2})$/,((t,e,i,o)=>e+i+":"+o)),new Date(o)):i;var o}render(){return this.canAccessFeedback||this.canAccessRating?de`
1722
1722
  <div class="ft-reader-feedback">
1723
1723
  ${this.hideTitle?pe:de`
1724
1724
  <ft-typography variant="title" part="main-title">
@@ -1738,11 +1738,11 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1738
1738
  ${this.renderRatingDate()}
1739
1739
  </ft-typography>
1740
1740
  </div>
1741
- `:pe}renderRatingDate(){const t=this.ratingDate;if(null==t)return ml.messages.notRated();if(t.getTime()>(new Date).getTime()-6e4)return ml.messages.ratedNow();return(new Date).toLocaleDateString()===t.toLocaleDateString()?ml.messages.ratedToday():ml.messages.ratedOn(t)}renderRating(){switch(this.configuredRatingType){case"STARS":return de`
1741
+ `:pe}renderRatingDate(){const t=this.ratingDate;if(null==t)return xl.messages.notRated();if(t.getTime()>(new Date).getTime()-6e4)return xl.messages.ratedNow();return(new Date).toLocaleDateString()===t.toLocaleDateString()?xl.messages.ratedToday():xl.messages.ratedOn(t)}renderRating(){switch(this.configuredRatingType){case"STARS":return de`
1742
1742
  <div class="ft-reader-feedback--stars" part="rating rating-stars">
1743
1743
  ${Ms(new Array(5),((t,e)=>e),((t,e)=>{let i="STARS"===this.ratingType&&this.ratingValue>e;const o=e+1;return de`
1744
1744
  <ft-button round part="rating-stars-${o}"
1745
- label="${ml.messages.starsRating(o)}"
1745
+ label="${xl.messages.starsRating(o)}"
1746
1746
  tooltipPosition="top"
1747
1747
  .iconVariant=${this.iconVariant}
1748
1748
  icon="${i?this.filledStarIcon:this.emptyStarIcon}"
@@ -1759,13 +1759,13 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1759
1759
  ?selected=${e}
1760
1760
  .iconVariant=${this.iconVariant}
1761
1761
  icon="${e?this.filledLikeIcon:this.emptyLikeIcon}">
1762
- ${ml.messages.like()}
1762
+ ${xl.messages.like()}
1763
1763
  </ft-switch-option>
1764
1764
  <ft-switch-option .value=${0}
1765
1765
  ?selected=${t}
1766
1766
  .iconVariant=${this.iconVariant}
1767
1767
  icon="${t?this.filledDislikeIcon:this.emptyDislikeIcon}">
1768
- ${ml.messages.dislike()}
1768
+ ${xl.messages.dislike()}
1769
1769
  </ft-switch-option>
1770
1770
  </ft-switch>
1771
1771
  `;case"DICHOTOMOUS":const i="DICHOTOMOUS"===this.ratingType&&0===this.ratingValue,o="DICHOTOMOUS"===this.ratingType&&1===this.ratingValue;return de`
@@ -1774,11 +1774,11 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1774
1774
  part="rating rating-dichotomous">
1775
1775
  <ft-switch-option .value=${1}
1776
1776
  ?selected=${o}>
1777
- ${ml.messages.dichotomousYes()}
1777
+ ${xl.messages.dichotomousYes()}
1778
1778
  </ft-switch-option>
1779
1779
  <ft-switch-option .value=${0}
1780
1780
  ?selected=${i}>
1781
- ${ml.messages.dichotomousNo()}
1781
+ ${xl.messages.dichotomousNo()}
1782
1782
  </ft-switch-option>
1783
1783
  </ft-switch>
1784
1784
  `}return pe}rate(t){(null!=t?t:-1)!==this.ratingValue&&this.dispatchEvent(new CustomEvent("rate",{detail:t}))}renderFeedbackSection(){var t,e,i,o,r;if(this.canAccessFeedback){const n=this.feedbackMailLinkBuilder(this.feedbackMessage);let a=de`
@@ -1787,7 +1787,7 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1787
1787
  class="ft-reader-feedback--send-feedback"
1788
1788
  ?disabled=${!this.feedbackMessage||!this.validFromEmail()}
1789
1789
  part="send-feedback">
1790
- ${ml.messages.okButton()}
1790
+ ${xl.messages.okButton()}
1791
1791
  </ft-button>
1792
1792
  `;n&&(a=de`
1793
1793
  <a class="ft-reader-feedback--feedback-link" href="${n}">
@@ -1799,7 +1799,7 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1799
1799
  class="ft-reader-feedback--more-options"
1800
1800
  @click="${this.onOpenMoreDetails}"
1801
1801
  part="more-options">
1802
- ${ml.messages.moreOptionsButton()}
1802
+ ${xl.messages.moreOptionsButton()}
1803
1803
  </ft-button>
1804
1804
  `:pe;return de`
1805
1805
  <form class="ft-reader-feedback--feedback" part="feedback-container" autocomplete="on"
@@ -1810,15 +1810,15 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1810
1810
  ${null==(null===(o=null===(i=this.session)||void 0===i?void 0:i.profile)||void 0===o?void 0:o.userId)&&(null===(r=this.configuration)||void 0===r?void 0:r.mailsSentByFluidTopicsForUnauthenticatedUsers)?de`
1811
1811
  <ft-text-field outlined name="email" type="email" autocomplete="email"
1812
1812
  class="ft-reader-feedback--from-input"
1813
- label=${ml.messages.feedbackfromEmail()}
1813
+ label=${xl.messages.feedbackfromEmail()}
1814
1814
  @change=${t=>this.from=t.detail.trim()}
1815
1815
  ?error=${this.from&&!this.validFromEmail()}
1816
- helper=${this.from&&!this.validFromEmail()?ml.messages.feedbackfromEmailInvalid():""}
1816
+ helper=${this.from&&!this.validFromEmail()?xl.messages.feedbackfromEmailInvalid():""}
1817
1817
  />
1818
1818
  `:pe}
1819
1819
  <ft-text-area outlined
1820
1820
  class="ft-reader-feedback--feedback-input" part="feedback-input"
1821
- label="${ml.messages.feedbackInputLabel()}"
1821
+ label="${xl.messages.feedbackInputLabel()}"
1822
1822
  @live-change=${t=>this.feedbackMessage=t.detail.trim()}
1823
1823
  ></ft-text-area>
1824
1824
  <div part="buttons-container">
@@ -1826,7 +1826,7 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1826
1826
  ${a}
1827
1827
  </div>
1828
1828
  </form>
1829
- `}return pe}onFormSubmitEvent(t,e){t.preventDefault(),e?this.onMailerFeedbackSent():this.sendFeedback()}validFromEmail(){var t,e,i;return!(null==(null===(e=null===(t=this.session)||void 0===t?void 0:t.profile)||void 0===e?void 0:e.userId)&&(null===(i=this.configuration)||void 0===i?void 0:i.mailsSentByFluidTopicsForUnauthenticatedUsers))||/^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/.test(this.from)}sendFeedback(){var t;this.dispatchEvent(new uc({message:this.feedbackInput.value,...(null===(t=this.configuration)||void 0===t?void 0:t.mailsSentByFluidTopicsForUnauthenticatedUsers)&&{from:this.from}}))}onMailerFeedbackSent(){this.dispatchEvent(new CustomEvent("mailer-feedback"))}onOpenMoreDetails(){this.dispatchEvent(new CustomEvent("open-more-options"))}clearFeedbackInput(){setTimeout((()=>this.feedbackInput.value=""),0)}}mc.elementDefinitions={"ft-button":js,"ft-typography":Ma,"ft-switch":gs,"ft-switch-option":us,"ft-text-area":Rs,"ft-text-field":Nl},mc.styles=Ra,vc([I({type:Boolean})],mc.prototype,"editorMode",void 0),vc([I({type:Boolean})],mc.prototype,"hideTitle",void 0),vc([I({type:Boolean})],mc.prototype,"withMoreOptionsButton",void 0),vc([I({type:Boolean})],mc.prototype,"ratingAllowed",void 0),vc([I({attribute:!1})],mc.prototype,"i18nProperties",void 0),vc([I({attribute:!1})],mc.prototype,"ratingSummary",void 0),vc([I({attribute:!1})],mc.prototype,"session",void 0),vc([A(".ft-reader-feedback--feedback-input")],mc.prototype,"feedbackInput",void 0),vc([R()],mc.prototype,"from",void 0),vc([R()],mc.prototype,"feedbackMessage",void 0),vc([I()],mc.prototype,"iconVariant",void 0),vc([I()],mc.prototype,"emptyStarIcon",void 0),vc([I()],mc.prototype,"filledStarIcon",void 0),vc([I()],mc.prototype,"emptyLikeIcon",void 0),vc([I()],mc.prototype,"filledLikeIcon",void 0),vc([I()],mc.prototype,"emptyDislikeIcon",void 0),vc([I()],mc.prototype,"filledDislikeIcon",void 0),vc([Ji({store:"reader",selector:t=>{var e;return null===(e=t.configuration)||void 0===e?void 0:e.feedback}})],mc.prototype,"configuration",void 0),vc([I()],mc.prototype,"feedbackMailLinkBuilder",void 0);const xc=bl.fromGwt("server");class wc{constructor(){this.subject="",this.url="",this.subjectMetadata="",this.bodyMetadata="",this.isAuthenticated=!1}update(t,e,i,o,r){var n;this.subject=t,this.url=e,this.configuration=o,this.isAuthenticated=r,this.subjectMetadata=this.filterMetadata(i,o.subjectMetadataIds).map((t=>"["+t.values[t.values.length-1]+"]")).join(""),this.bodyMetadata=this.filterMetadata(i,null!==(n=o.bodyMetadataIds)&&void 0!==n?n:[]).map((t=>"["+t.values.join(", ")+"]")).join(" ")}filterMetadata(t,e){return e.map((e=>t.find((t=>t.key===e)))).filter((t=>null!=t&&t.values.length>0))}build(t){var e,i,o;if(0===t.length||this.isAuthenticated&&(null==this.configuration||(null===(e=this.configuration)||void 0===e?void 0:e.mailsSentByFluidTopics))||(null===(i=this.configuration)||void 0===i?void 0:i.mailsSentByFluidTopicsForUnauthenticatedUsers))return;const r=encodeURIComponent(this.subject+" "+this.subjectMetadata),n=encodeURIComponent(`\n${this.bodyMetadata}\n${this.url}\n_________________________________________________________________\n\n${t}\n\n_________________________________________________________________\n${xc.messages["mail.feedback.disclaimer"]()}`);return`mailto:${null===(o=this.configuration)||void 0===o?void 0:o.recipients.join(",")}?subject=${r}&body=${n}`}}const Oc=bl.build("inDesignerFeedbackComponent"),Sc={feedbackAndRatingDisabledInEditor:"Feedback and ratings performed here are not taken into account."};var Nc=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class $c extends(dl(cn)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.withMoreOptionsButton=!1,this.iconVariant=ns.fluid_topics,this.emptyStarIcon="STAR",this.filledStarIcon="STAR_PLAIN",this.emptyLikeIcon="THUMBS_UP",this.filledLikeIcon="THUMBS_UP_PLAIN",this.emptyDislikeIcon="THUMBS_DOWN",this.filledDislikeIcon="THUMBS_DOWN_PLAIN",this.feedbackLinkBuilder=new wc,this.i18nProperties={feedbackMainTitle:ml.properties.mapFeedbackMainTitle(),ratingSectionTitle:ml.properties.mapRatingSectionTitle(),dichotomousRatingSectionTitle:ml.properties.mapDichotomousRatingSectionTitle(),feedbackSectionTitle:ml.properties.mapFeedbackSectionTitle()},this.updateDebouncer=new n(100),this.sendRatingDebouncer=new n(500),this.addStore(qs)}render(){return de`
1829
+ `}return pe}onFormSubmitEvent(t,e){t.preventDefault(),e?this.onMailerFeedbackSent():this.sendFeedback()}validFromEmail(){var t,e,i;return!(null==(null===(e=null===(t=this.session)||void 0===t?void 0:t.profile)||void 0===e?void 0:e.userId)&&(null===(i=this.configuration)||void 0===i?void 0:i.mailsSentByFluidTopicsForUnauthenticatedUsers))||/^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/.test(this.from)}sendFeedback(){var t;this.dispatchEvent(new pc({message:this.feedbackInput.value,...(null===(t=this.configuration)||void 0===t?void 0:t.mailsSentByFluidTopicsForUnauthenticatedUsers)&&{from:this.from}}))}onMailerFeedbackSent(){this.dispatchEvent(new CustomEvent("mailer-feedback"))}onOpenMoreDetails(){this.dispatchEvent(new CustomEvent("open-more-options"))}clearFeedbackInput(){setTimeout((()=>this.feedbackInput.value=""),0)}}xc.elementDefinitions={"ft-button":js,"ft-typography":Ma,"ft-switch":gs,"ft-switch-option":us,"ft-text-area":Rs,"ft-text-field":$l},xc.styles=Ra,mc([I({type:Boolean})],xc.prototype,"editorMode",void 0),mc([I({type:Boolean})],xc.prototype,"hideTitle",void 0),mc([I({type:Boolean})],xc.prototype,"withMoreOptionsButton",void 0),mc([I({type:Boolean})],xc.prototype,"ratingAllowed",void 0),mc([I({attribute:!1})],xc.prototype,"i18nProperties",void 0),mc([I({attribute:!1})],xc.prototype,"ratingSummary",void 0),mc([I({attribute:!1})],xc.prototype,"session",void 0),mc([A(".ft-reader-feedback--feedback-input")],xc.prototype,"feedbackInput",void 0),mc([R()],xc.prototype,"from",void 0),mc([R()],xc.prototype,"feedbackMessage",void 0),mc([I()],xc.prototype,"iconVariant",void 0),mc([I()],xc.prototype,"emptyStarIcon",void 0),mc([I()],xc.prototype,"filledStarIcon",void 0),mc([I()],xc.prototype,"emptyLikeIcon",void 0),mc([I()],xc.prototype,"filledLikeIcon",void 0),mc([I()],xc.prototype,"emptyDislikeIcon",void 0),mc([I()],xc.prototype,"filledDislikeIcon",void 0),mc([Ji({store:"reader",selector:t=>{var e;return null===(e=t.configuration)||void 0===e?void 0:e.feedback}})],xc.prototype,"configuration",void 0),mc([I()],xc.prototype,"feedbackMailLinkBuilder",void 0);const wc=vl.fromGwt("server");class Oc{constructor(){this.subject="",this.url="",this.subjectMetadata="",this.bodyMetadata="",this.isAuthenticated=!1}update(t,e,i,o,r){var n;this.subject=t,this.url=e,this.configuration=o,this.isAuthenticated=r,this.subjectMetadata=this.filterMetadata(i,o.subjectMetadataIds).map((t=>"["+t.values[t.values.length-1]+"]")).join(""),this.bodyMetadata=this.filterMetadata(i,null!==(n=o.bodyMetadataIds)&&void 0!==n?n:[]).map((t=>"["+t.values.join(", ")+"]")).join(" ")}filterMetadata(t,e){return e.map((e=>t.find((t=>t.key===e)))).filter((t=>null!=t&&t.values.length>0))}shouldUseMailer(){var t,e;const i=this.isAuthenticated&&!(null===(t=this.configuration)||void 0===t?void 0:t.mailsSentByFluidTopics),o=!this.isAuthenticated&&!(null===(e=this.configuration)||void 0===e?void 0:e.mailsSentByFluidTopicsForUnauthenticatedUsers);return i||o}build(t){var e;if(null!=t&&0===t.length||!this.shouldUseMailer())return;const i=encodeURIComponent(this.subject+" "+this.subjectMetadata),o=encodeURIComponent(`\n${this.bodyMetadata}\n${this.url}\n_________________________________________________________________\n\n${null!=t?t:""}\n\n_________________________________________________________________\n${wc.messages["mail.feedback.disclaimer"]()}`);return`mailto:${null===(e=this.configuration)||void 0===e?void 0:e.recipients.join(",")}?subject=${i}&body=${o}`}}const Sc=vl.build("inDesignerFeedbackComponent"),Nc={feedbackAndRatingDisabledInEditor:"Feedback and ratings performed here are not taken into account."};var $c=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class Cc extends(ul(cn)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.withMoreOptionsButton=!1,this.iconVariant=ns.fluid_topics,this.emptyStarIcon="STAR",this.filledStarIcon="STAR_PLAIN",this.emptyLikeIcon="THUMBS_UP",this.filledLikeIcon="THUMBS_UP_PLAIN",this.emptyDislikeIcon="THUMBS_DOWN",this.filledDislikeIcon="THUMBS_DOWN_PLAIN",this.feedbackLinkBuilder=new Oc,this.i18nProperties={feedbackMainTitle:xl.properties.mapFeedbackMainTitle(),ratingSectionTitle:xl.properties.mapRatingSectionTitle(),dichotomousRatingSectionTitle:xl.properties.mapDichotomousRatingSectionTitle(),feedbackSectionTitle:xl.properties.mapFeedbackSectionTitle()},this.updateDebouncer=new n(100),this.sendRatingDebouncer=new n(500),this.addStore(qs)}render(){return de`
1830
1830
  <ft-reader-feedback
1831
1831
  ratingAllowed
1832
1832
  .i18nProperties=${this.i18nProperties}
@@ -1848,7 +1848,7 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1848
1848
  @mailer-feedback=${this.onMailerFeedbackSent}
1849
1849
  @open-more-options=${this.openMoreOptions}
1850
1850
  ></ft-reader-feedback>
1851
- `}update(t){var e,i,o,r;super.update(t),t.has("map")&&this.map&&this.updateData(),t.has("editorMode")&&this.editorMode&&this.addI18nContext(Oc,Sc),["map","configuration","user","mailSubject"].some((e=>t.has(e)))&&this.map&&this.configuration&&this.feedbackLinkBuilder.update(this.mailSubject,null!==(i=null===(e=this.service)||void 0===e?void 0:e.getLink())&&void 0!==i?i:"",this.map.metadata,this.configuration,null!=(null===(r=null===(o=this.session)||void 0===o?void 0:o.profile)||void 0===r?void 0:r.userId))}connectedCallback(){super.connectedCallback(),this.updateData()}onStoreAvailable(t){super.onStoreAvailable(t),this.updateData()}updateData(){this.updateDebouncer.run((async()=>{var t,e;this.map&&((null===(e=null===(t=this.session)||void 0===t?void 0:t.profile)||void 0===e?void 0:e.userId)||null==this.ratingSummary)&&await this.fetchRatingSummary()}))}async fetchRatingSummary(){var t;this.ratingSummary=await(null===(t=this.service)||void 0===t?void 0:t.getMapRating())}rate(t){this.ratingSummary&&(this.ratingSummary={...this.ratingSummary,rating:null==t.detail?void 0:{type:this.ratingSummary.type,value:t.detail,date:new Date}},this.sendRatingDebouncer.run((()=>this.sendRating(t.detail))))}async sendRating(t){var e,i,o;if(!this.editorMode&&this.ratingSummary){try{null==t?await(null===(e=this.service)||void 0===e?void 0:e.unrateMap()):await(null===(i=this.service)||void 0===i?void 0:i.rateMap(null===(o=this.ratingSummary)||void 0===o?void 0:o.type,t))}catch{this.dispatchEvent(new De({type:"error",message:ml.messages.ratingFailure()}))}this.updateData()}else this.editorMode&&this.dispatchEvent(new De({type:"info",message:Oc.messages.feedbackAndRatingDisabledInEditor()}))}async sendFeedback(t){var e;try{this.editorMode?this.dispatchEvent(new De({type:"info",message:Oc.messages.feedbackAndRatingDisabledInEditor()})):(await(null===(e=this.service)||void 0===e?void 0:e.sendMapFeedback(t.detail.message,t.detail.from)),this.dispatchEvent(new De({type:"info",message:ml.messages.feedbackSuccess()}))),this.readerFeedback.clearFeedbackInput()}catch{this.dispatchEvent(new De({type:"error",message:ml.messages.feedbackFailure()}))}}onMailerFeedbackSent(){this.dispatchEvent(new bc)}openMoreOptions(){var t,e,i;this.dispatchEvent(new yc({mapId:this.map.id,mapTitle:this.map.title,mapMetadata:(null===(t=this.map)||void 0===t?void 0:t.metadata)||[],ratingType:(null===(e=this.ratingSummary)||void 0===e?void 0:e.type)||Dl.NO_RATING,ratingValue:null===(i=this.ratingSummary)||void 0===i?void 0:i.rating}))}}$c.elementDefinitions={"ft-reader-feedback":mc},Nc([Ji({store:qs.name})],$c.prototype,"session",void 0),Nc([Ji({store:"reader"})],$c.prototype,"map",void 0),Nc([Ji({store:qs.name})],$c.prototype,"editorMode",void 0),Nc([Ji({store:"reader",selector:t=>{var e;return null===(e=t.configuration)||void 0===e?void 0:e.feedback}})],$c.prototype,"configuration",void 0),Nc([R()],$c.prototype,"ratingSummary",void 0),Nc([I({type:Boolean})],$c.prototype,"hideTitle",void 0),Nc([I({type:Boolean})],$c.prototype,"withMoreOptionsButton",void 0),Nc([I()],$c.prototype,"iconVariant",void 0),Nc([I()],$c.prototype,"emptyStarIcon",void 0),Nc([I()],$c.prototype,"filledStarIcon",void 0),Nc([I()],$c.prototype,"emptyLikeIcon",void 0),Nc([I()],$c.prototype,"filledLikeIcon",void 0),Nc([I()],$c.prototype,"emptyDislikeIcon",void 0),Nc([I()],$c.prototype,"filledDislikeIcon",void 0),Nc([A("ft-reader-feedback")],$c.prototype,"readerFeedback",void 0),Nc([vl(xc.properties["mail.map_feedback.subject"]((t=>{var e;return[null===(e=t.map)||void 0===e?void 0:e.title]})))],$c.prototype,"mailSubject",void 0),Nc([Qi({eventName:"rating-changed"})],$c.prototype,"fetchRatingSummary",null);var Cc=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class Ec extends Event{constructor(){super("register-ft-reader-topic-component",{bubbles:!0,composed:!0})}}const kc=Symbol("registerInterval");class Ic extends(function(t){var e;class i extends t{constructor(){super(...arguments),this.disableContextInteractions=!1,this[e]=0}connectedCallback(){super.connectedCallback(),this[kc]=window.setInterval((()=>this.tryToRegisterToTopicContext()),50)}tryToRegisterToTopicContext(){null!=this.tocNode?window.clearInterval(this[kc]):this.dispatchEvent(new Ec)}disconnectedCallback(){super.disconnectedCallback(),this.tocNode=void 0}}return e=kc,Cc([R()],i.prototype,"tocNode",void 0),Cc([R()],i.prototype,"disableContextInteractions",void 0),i}(cn)){}var Rc=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class Uc extends(dl(Ic)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.withMoreOptionsButton=!1,this.iconVariant=ns.fluid_topics,this.emptyStarIcon="STAR",this.filledStarIcon="STAR_PLAIN",this.emptyLikeIcon="THUMBS_UP",this.filledLikeIcon="THUMBS_UP_PLAIN",this.emptyDislikeIcon="THUMBS_DOWN",this.filledDislikeIcon="THUMBS_DOWN_PLAIN",this.feedbackLinkBuilder=new wc,this.i18nProperties={feedbackMainTitle:ml.properties.topicFeedbackMainTitle(),ratingSectionTitle:ml.properties.topicRatingSectionTitle(),dichotomousRatingSectionTitle:ml.properties.topicDichotomousRatingSectionTitle(),feedbackSectionTitle:ml.properties.topicFeedbackSectionTitle()},this.updateDebouncer=new n(100),this.sendRatingDebouncer=new n(500),this.addStore(qs)}render(){var t;return de`
1851
+ `}update(t){var e,i,o,r;super.update(t),t.has("map")&&this.map&&this.updateData(),t.has("editorMode")&&this.editorMode&&this.addI18nContext(Sc,Nc),["map","configuration","user","mailSubject"].some((e=>t.has(e)))&&this.map&&this.configuration&&this.feedbackLinkBuilder.update(this.mailSubject,null!==(i=null===(e=this.service)||void 0===e?void 0:e.getLink())&&void 0!==i?i:"",this.map.metadata,this.configuration,null!=(null===(r=null===(o=this.session)||void 0===o?void 0:o.profile)||void 0===r?void 0:r.userId))}connectedCallback(){super.connectedCallback(),this.updateData()}onStoreAvailable(t){super.onStoreAvailable(t),this.updateData()}updateData(){this.updateDebouncer.run((async()=>{var t,e;this.map&&((null===(e=null===(t=this.session)||void 0===t?void 0:t.profile)||void 0===e?void 0:e.userId)||null==this.ratingSummary)&&await this.fetchRatingSummary()}))}async fetchRatingSummary(){var t;this.ratingSummary=await(null===(t=this.service)||void 0===t?void 0:t.getMapRating())}rate(t){this.ratingSummary&&(this.ratingSummary={...this.ratingSummary,rating:null==t.detail?void 0:{type:this.ratingSummary.type,value:t.detail,date:new Date}},this.sendRatingDebouncer.run((()=>this.sendRating(t.detail))))}async sendRating(t){var e,i,o;if(!this.editorMode&&this.ratingSummary){try{null==t?await(null===(e=this.service)||void 0===e?void 0:e.unrateMap()):await(null===(i=this.service)||void 0===i?void 0:i.rateMap(null===(o=this.ratingSummary)||void 0===o?void 0:o.type,t))}catch{this.dispatchEvent(new De({type:"error",message:xl.messages.ratingFailure()}))}this.updateData()}else this.editorMode&&this.dispatchEvent(new De({type:"info",message:Sc.messages.feedbackAndRatingDisabledInEditor()}))}async sendFeedback(t){var e;try{this.editorMode?this.dispatchEvent(new De({type:"info",message:Sc.messages.feedbackAndRatingDisabledInEditor()})):(await(null===(e=this.service)||void 0===e?void 0:e.sendMapFeedback(t.detail.message,t.detail.from)),this.dispatchEvent(new De({type:"info",message:xl.messages.feedbackSuccess()}))),this.readerFeedback.clearFeedbackInput()}catch{this.dispatchEvent(new De({type:"error",message:xl.messages.feedbackFailure()}))}}onMailerFeedbackSent(){this.dispatchEvent(new vc)}openMoreOptions(){var t,e,i;this.dispatchEvent(new gc({mapId:this.map.id,mapTitle:this.map.title,mapMetadata:(null===(t=this.map)||void 0===t?void 0:t.metadata)||[],ratingType:(null===(e=this.ratingSummary)||void 0===e?void 0:e.type)||Ml.NO_RATING,ratingValue:null===(i=this.ratingSummary)||void 0===i?void 0:i.rating}))}}Cc.elementDefinitions={"ft-reader-feedback":xc},$c([Ji({store:qs.name})],Cc.prototype,"session",void 0),$c([Ji({store:"reader"})],Cc.prototype,"map",void 0),$c([Ji({store:qs.name})],Cc.prototype,"editorMode",void 0),$c([Ji({store:"reader",selector:t=>{var e;return null===(e=t.configuration)||void 0===e?void 0:e.feedback}})],Cc.prototype,"configuration",void 0),$c([R()],Cc.prototype,"ratingSummary",void 0),$c([I({type:Boolean})],Cc.prototype,"hideTitle",void 0),$c([I({type:Boolean})],Cc.prototype,"withMoreOptionsButton",void 0),$c([I()],Cc.prototype,"iconVariant",void 0),$c([I()],Cc.prototype,"emptyStarIcon",void 0),$c([I()],Cc.prototype,"filledStarIcon",void 0),$c([I()],Cc.prototype,"emptyLikeIcon",void 0),$c([I()],Cc.prototype,"filledLikeIcon",void 0),$c([I()],Cc.prototype,"emptyDislikeIcon",void 0),$c([I()],Cc.prototype,"filledDislikeIcon",void 0),$c([A("ft-reader-feedback")],Cc.prototype,"readerFeedback",void 0),$c([ml(wc.properties["mail.map_feedback.subject"]((t=>{var e;return[null===(e=t.map)||void 0===e?void 0:e.title]})))],Cc.prototype,"mailSubject",void 0),$c([Qi({eventName:"rating-changed"})],Cc.prototype,"fetchRatingSummary",null);var Ec=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class kc extends Event{constructor(){super("register-ft-reader-topic-component",{bubbles:!0,composed:!0})}}const Ic=Symbol("registerInterval");class Rc extends(function(t){var e;class i extends t{constructor(){super(...arguments),this.disableContextInteractions=!1,this[e]=0}connectedCallback(){super.connectedCallback(),this[Ic]=window.setInterval((()=>this.tryToRegisterToTopicContext()),50)}tryToRegisterToTopicContext(){null!=this.tocNode?window.clearInterval(this[Ic]):this.dispatchEvent(new kc)}disconnectedCallback(){super.disconnectedCallback(),this.tocNode=void 0}}return e=Ic,Ec([R()],i.prototype,"tocNode",void 0),Ec([R()],i.prototype,"disableContextInteractions",void 0),i}(cn)){}var Uc=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class Lc extends(ul(Rc)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.withMoreOptionsButton=!1,this.iconVariant=ns.fluid_topics,this.emptyStarIcon="STAR",this.filledStarIcon="STAR_PLAIN",this.emptyLikeIcon="THUMBS_UP",this.filledLikeIcon="THUMBS_UP_PLAIN",this.emptyDislikeIcon="THUMBS_DOWN",this.filledDislikeIcon="THUMBS_DOWN_PLAIN",this.feedbackLinkBuilder=new Oc,this.i18nProperties={feedbackMainTitle:xl.properties.topicFeedbackMainTitle(),ratingSectionTitle:xl.properties.topicRatingSectionTitle(),dichotomousRatingSectionTitle:xl.properties.topicDichotomousRatingSectionTitle(),feedbackSectionTitle:xl.properties.topicFeedbackSectionTitle()},this.updateDebouncer=new n(100),this.sendRatingDebouncer=new n(500),this.addStore(qs)}render(){var t;return de`
1852
1852
  <ft-reader-feedback
1853
1853
  .i18nProperties=${this.i18nProperties}
1854
1854
  ?ratingAllowed=${null===(t=this.tocNode)||void 0===t?void 0:t.hasRating}
@@ -1870,4 +1870,4 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
1870
1870
  @mailer-feedback=${this.onMailerFeedbackSent}
1871
1871
  @open-more-options=${this.openMoreOptions}
1872
1872
  ></ft-reader-feedback>
1873
- `}update(t){var e,i,o,r;super.update(t),["tocNode","user"].some((e=>t.has(e)))&&this.tocNode&&this.updateData(),t.has("editorMode")&&this.editorMode&&this.addI18nContext(Oc,Sc),["map","tocNode","configuration","user","mailSubject"].some((e=>t.has(e)))&&this.map&&this.tocNode&&this.configuration&&this.feedbackLinkBuilder.update(this.mailSubject,null!==(i=null===(e=this.service)||void 0===e?void 0:e.getLink(this.tocNode.tocId))&&void 0!==i?i:"",this.map.metadata,this.configuration,null!=(null===(r=null===(o=this.session)||void 0===o?void 0:o.profile)||void 0===r?void 0:r.userId))}connectedCallback(){super.connectedCallback(),this.updateData()}updateData(){this.updateDebouncer.run((async()=>{var t,e;this.tocNode&&((null===(e=null===(t=this.session)||void 0===t?void 0:t.profile)||void 0===e?void 0:e.userId)||null==this.ratingSummary)&&await this.fetchRatingSummary()}))}async fetchRatingSummary(){var t;this.ratingSummary=await(null===(t=this.service)||void 0===t?void 0:t.getTopicRating(this.tocNode.tocId))}rate(t){this.ratingSummary&&this.tocNode&&(this.ratingSummary={...this.ratingSummary,rating:null==t.detail?void 0:{tocId:this.tocNode.tocId,type:this.ratingSummary.type,value:t.detail,date:new Date}},this.sendRatingDebouncer.run((()=>this.sendRating(t.detail))))}async sendRating(t){var e,i,o;if(!this.editorMode&&this.ratingSummary&&this.tocNode){try{null==t?await(null===(e=this.service)||void 0===e?void 0:e.unrateTopic(this.tocNode.tocId)):await(null===(i=this.service)||void 0===i?void 0:i.rateTopic(this.tocNode.tocId,null===(o=this.ratingSummary)||void 0===o?void 0:o.type,t))}catch{this.dispatchEvent(new De({type:"error",message:ml.messages.ratingFailure()}))}this.updateData()}else this.editorMode&&this.dispatchEvent(new De({type:"info",message:Oc.messages.feedbackAndRatingDisabledInEditor()}))}async sendFeedback(t){var e;try{!this.editorMode&&this.tocNode?(await(null===(e=this.service)||void 0===e?void 0:e.sendTopicFeedback(this.tocNode.tocId,t.detail.message,t.detail.from)),this.dispatchEvent(new De({type:"info",message:ml.messages.feedbackSuccess()})),this.readerFeedback.clearFeedbackInput()):this.editorMode&&this.dispatchEvent(new De({type:"info",message:Oc.messages.feedbackAndRatingDisabledInEditor()}))}catch{this.dispatchEvent(new De({type:"error",message:ml.messages.feedbackFailure()}))}}onMailerFeedbackSent(){const t=this.tocNode;this.dispatchEvent(new gc(t))}openMoreOptions(){var t,e,i,o,r,n,a,s;this.dispatchEvent(new pc({mapId:this.map.id,mapTitle:this.map.title,tocId:this.tocNode.tocId,topicTitle:this.tocNode.title,topicUrl:null!==(e=null===(t=this.service)||void 0===t?void 0:t.getLink(this.tocNode.tocId))&&void 0!==e?e:"",mapMetadata:(null===(i=this.map)||void 0===i?void 0:i.metadata)||[],breadcrumb:(null===(r=null===(o=this.stateManager)||void 0===o?void 0:o.service)||void 0===r?void 0:r.buildBreadcrumb(this.tocNode.tocId))||[],ratingType:((null===(n=this.tocNode)||void 0===n?void 0:n.hasRating)?null===(a=this.ratingSummary)||void 0===a?void 0:a.type:Dl.NO_RATING)||Dl.NO_RATING,ratingValue:null===(s=this.ratingSummary)||void 0===s?void 0:s.rating}))}}Uc.elementDefinitions={"ft-reader-feedback":mc},Rc([Ji({store:qs.name})],Uc.prototype,"session",void 0),Rc([Ji({store:"reader"})],Uc.prototype,"map",void 0),Rc([Ji({store:qs.name})],Uc.prototype,"editorMode",void 0),Rc([Ji({store:"reader",selector:t=>{var e;return null===(e=t.configuration)||void 0===e?void 0:e.feedback}})],Uc.prototype,"configuration",void 0),Rc([R()],Uc.prototype,"ratingSummary",void 0),Rc([I({type:Boolean})],Uc.prototype,"hideTitle",void 0),Rc([I({type:Boolean})],Uc.prototype,"withMoreOptionsButton",void 0),Rc([I()],Uc.prototype,"iconVariant",void 0),Rc([I()],Uc.prototype,"emptyStarIcon",void 0),Rc([I()],Uc.prototype,"filledStarIcon",void 0),Rc([I()],Uc.prototype,"emptyLikeIcon",void 0),Rc([I()],Uc.prototype,"filledLikeIcon",void 0),Rc([I()],Uc.prototype,"emptyDislikeIcon",void 0),Rc([I()],Uc.prototype,"filledDislikeIcon",void 0),Rc([A("ft-reader-feedback")],Uc.prototype,"readerFeedback",void 0),Rc([vl(xc.properties["mail.feedback.subject"]((t=>{var e,i;return[null===(e=t.tocNode)||void 0===e?void 0:e.title,null===(i=t.map)||void 0===i?void 0:i.title]})))],Uc.prototype,"mailSubject",void 0),Rc([Qi({eventName:"rating-changed"})],Uc.prototype,"fetchRatingSummary",null),M("ft-reader-map-feedback")($c),M("ft-reader-topic-feedback")(Uc),t.FtReaderFeedbackCssVariables=Ia,t.FtReaderMapFeedback=$c,t.FtReaderTopicFeedback=Uc,t.styles=Ra}({});
1873
+ `}update(t){var e,i,o,r;super.update(t),["tocNode","user"].some((e=>t.has(e)))&&this.tocNode&&this.updateData(),t.has("editorMode")&&this.editorMode&&this.addI18nContext(Sc,Nc),["map","tocNode","configuration","user","mailSubject"].some((e=>t.has(e)))&&this.map&&this.tocNode&&this.configuration&&this.feedbackLinkBuilder.update(this.mailSubject,null!==(i=null===(e=this.service)||void 0===e?void 0:e.getLink(this.tocNode.tocId))&&void 0!==i?i:"",this.map.metadata,this.configuration,null!=(null===(r=null===(o=this.session)||void 0===o?void 0:o.profile)||void 0===r?void 0:r.userId))}connectedCallback(){super.connectedCallback(),this.updateData()}updateData(){this.updateDebouncer.run((async()=>{var t,e;this.tocNode&&((null===(e=null===(t=this.session)||void 0===t?void 0:t.profile)||void 0===e?void 0:e.userId)||null==this.ratingSummary)&&await this.fetchRatingSummary()}))}async fetchRatingSummary(){var t;this.ratingSummary=await(null===(t=this.service)||void 0===t?void 0:t.getTopicRating(this.tocNode.tocId))}rate(t){this.ratingSummary&&this.tocNode&&(this.ratingSummary={...this.ratingSummary,rating:null==t.detail?void 0:{tocId:this.tocNode.tocId,type:this.ratingSummary.type,value:t.detail,date:new Date}},this.sendRatingDebouncer.run((()=>this.sendRating(t.detail))))}async sendRating(t){var e,i,o;if(!this.editorMode&&this.ratingSummary&&this.tocNode){try{null==t?await(null===(e=this.service)||void 0===e?void 0:e.unrateTopic(this.tocNode.tocId)):await(null===(i=this.service)||void 0===i?void 0:i.rateTopic(this.tocNode.tocId,null===(o=this.ratingSummary)||void 0===o?void 0:o.type,t))}catch{this.dispatchEvent(new De({type:"error",message:xl.messages.ratingFailure()}))}this.updateData()}else this.editorMode&&this.dispatchEvent(new De({type:"info",message:Sc.messages.feedbackAndRatingDisabledInEditor()}))}async sendFeedback(t){var e;try{!this.editorMode&&this.tocNode?(await(null===(e=this.service)||void 0===e?void 0:e.sendTopicFeedback(this.tocNode.tocId,t.detail.message,t.detail.from)),this.dispatchEvent(new De({type:"info",message:xl.messages.feedbackSuccess()})),this.readerFeedback.clearFeedbackInput()):this.editorMode&&this.dispatchEvent(new De({type:"info",message:Sc.messages.feedbackAndRatingDisabledInEditor()}))}catch{this.dispatchEvent(new De({type:"error",message:xl.messages.feedbackFailure()}))}}onMailerFeedbackSent(){const t=this.tocNode;this.dispatchEvent(new bc(t))}openMoreOptions(){var t,e,i,o,r,n,a,s;this.dispatchEvent(new yc({mapId:this.map.id,mapTitle:this.map.title,tocId:this.tocNode.tocId,topicTitle:this.tocNode.title,topicUrl:null!==(e=null===(t=this.service)||void 0===t?void 0:t.getLink(this.tocNode.tocId))&&void 0!==e?e:"",mapMetadata:(null===(i=this.map)||void 0===i?void 0:i.metadata)||[],breadcrumb:(null===(r=null===(o=this.stateManager)||void 0===o?void 0:o.service)||void 0===r?void 0:r.buildBreadcrumb(this.tocNode.tocId))||[],ratingType:((null===(n=this.tocNode)||void 0===n?void 0:n.hasRating)?null===(a=this.ratingSummary)||void 0===a?void 0:a.type:Ml.NO_RATING)||Ml.NO_RATING,ratingValue:null===(s=this.ratingSummary)||void 0===s?void 0:s.rating}))}}Lc.elementDefinitions={"ft-reader-feedback":xc},Uc([Ji({store:qs.name})],Lc.prototype,"session",void 0),Uc([Ji({store:"reader"})],Lc.prototype,"map",void 0),Uc([Ji({store:qs.name})],Lc.prototype,"editorMode",void 0),Uc([Ji({store:"reader",selector:t=>{var e;return null===(e=t.configuration)||void 0===e?void 0:e.feedback}})],Lc.prototype,"configuration",void 0),Uc([R()],Lc.prototype,"ratingSummary",void 0),Uc([I({type:Boolean})],Lc.prototype,"hideTitle",void 0),Uc([I({type:Boolean})],Lc.prototype,"withMoreOptionsButton",void 0),Uc([I()],Lc.prototype,"iconVariant",void 0),Uc([I()],Lc.prototype,"emptyStarIcon",void 0),Uc([I()],Lc.prototype,"filledStarIcon",void 0),Uc([I()],Lc.prototype,"emptyLikeIcon",void 0),Uc([I()],Lc.prototype,"filledLikeIcon",void 0),Uc([I()],Lc.prototype,"emptyDislikeIcon",void 0),Uc([I()],Lc.prototype,"filledDislikeIcon",void 0),Uc([A("ft-reader-feedback")],Lc.prototype,"readerFeedback",void 0),Uc([ml(wc.properties["mail.feedback.subject"]((t=>{var e,i;return[null===(e=t.tocNode)||void 0===e?void 0:e.title,null===(i=t.map)||void 0===i?void 0:i.title]})))],Lc.prototype,"mailSubject",void 0),Uc([Qi({eventName:"rating-changed"})],Lc.prototype,"fetchRatingSummary",null),M("ft-reader-map-feedback")(Cc),M("ft-reader-topic-feedback")(Lc),t.FtReaderFeedbackCssVariables=Ia,t.FtReaderMapFeedback=Cc,t.FtReaderTopicFeedback=Lc,t.styles=Ra}({});