@fluid-topics/ft-app-context 1.4.5 → 2.0.0

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { customElement } from "@fluid-topics/ft-wc-utils";
2
+ import { FtAppContext } from "./ft-app-context";
3
+ customElement("ft-app-context")(FtAppContext);
@@ -1,14 +1,5 @@
1
- "use strict";(()=>{var Un=Object.create;var Vt=Object.defineProperty;var Fn=Object.getOwnPropertyDescriptor;var jn=Object.getOwnPropertyNames;var Bn=Object.getPrototypeOf,Hn=Object.prototype.hasOwnProperty;var De=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Vn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jn(t))!Hn.call(e,i)&&i!==r&&Vt(e,i,{get:()=>t[i],enumerable:!(n=Fn(t,i))||n.enumerable});return e};var I=(e,t,r)=>(r=e!=null?Un(Bn(e)):{},Vn(t||!e||!e.__esModule?Vt(r,"default",{value:e,enumerable:!0}):r,e));var V=De((Bi,Kt)=>{Kt.exports=ftGlobals.wcUtils});var Le=De((Hi,qt)=>{qt.exports=ftGlobals.lit});var ye=De((Vi,Gt)=>{Gt.exports=ftGlobals.litDecorators});var Qt=De((J,Jt)=>{var Fe=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global,je=function(){function e(){this.fetch=!1,this.DOMException=Fe.DOMException}return e.prototype=Fe,new e}();(function(e){var t=function(r){var n=typeof e<"u"&&e||typeof self<"u"&&self||typeof global<"u"&&global||{},i={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};function s(u){return u&&DataView.prototype.isPrototypeOf(u)}if(i.arrayBuffer)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(u){return u&&a.indexOf(Object.prototype.toString.call(u))>-1};function l(u){if(typeof u!="string"&&(u=String(u)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(u)||u==="")throw new TypeError('Invalid character in header field name: "'+u+'"');return u.toLowerCase()}function c(u){return typeof u!="string"&&(u=String(u)),u}function f(u){var d={next:function(){var b=u.shift();return{done:b===void 0,value:b}}};return i.iterable&&(d[Symbol.iterator]=function(){return d}),d}function p(u){this.map={},u instanceof p?u.forEach(function(d,b){this.append(b,d)},this):Array.isArray(u)?u.forEach(function(d){if(d.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+d.length);this.append(d[0],d[1])},this):u&&Object.getOwnPropertyNames(u).forEach(function(d){this.append(d,u[d])},this)}p.prototype.append=function(u,d){u=l(u),d=c(d);var b=this.map[u];this.map[u]=b?b+", "+d:d},p.prototype.delete=function(u){delete this.map[l(u)]},p.prototype.get=function(u){return u=l(u),this.has(u)?this.map[u]:null},p.prototype.has=function(u){return this.map.hasOwnProperty(l(u))},p.prototype.set=function(u,d){this.map[l(u)]=c(d)},p.prototype.forEach=function(u,d){for(var b in this.map)this.map.hasOwnProperty(b)&&u.call(d,this.map[b],b,this)},p.prototype.keys=function(){var u=[];return this.forEach(function(d,b){u.push(b)}),f(u)},p.prototype.values=function(){var u=[];return this.forEach(function(d){u.push(d)}),f(u)},p.prototype.entries=function(){var u=[];return this.forEach(function(d,b){u.push([b,d])}),f(u)},i.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function h(u){if(!u._noBody){if(u.bodyUsed)return Promise.reject(new TypeError("Already read"));u.bodyUsed=!0}}function v(u){return new Promise(function(d,b){u.onload=function(){d(u.result)},u.onerror=function(){b(u.error)}})}function y(u){var d=new FileReader,b=v(d);return d.readAsArrayBuffer(u),b}function m(u){var d=new FileReader,b=v(d),T=/charset=([A-Za-z0-9_-]+)/.exec(u.type),R=T?T[1]:"utf-8";return d.readAsText(u,R),b}function A(u){for(var d=new Uint8Array(u),b=new Array(d.length),T=0;T<d.length;T++)b[T]=String.fromCharCode(d[T]);return b.join("")}function S(u){if(u.slice)return u.slice(0);var d=new Uint8Array(u.byteLength);return d.set(new Uint8Array(u)),d.buffer}function E(){return this.bodyUsed=!1,this._initBody=function(u){this.bodyUsed=this.bodyUsed,this._bodyInit=u,u?typeof u=="string"?this._bodyText=u:i.blob&&Blob.prototype.isPrototypeOf(u)?this._bodyBlob=u:i.formData&&FormData.prototype.isPrototypeOf(u)?this._bodyFormData=u:i.searchParams&&URLSearchParams.prototype.isPrototypeOf(u)?this._bodyText=u.toString():i.arrayBuffer&&i.blob&&s(u)?(this._bodyArrayBuffer=S(u.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(u)||o(u))?this._bodyArrayBuffer=S(u):this._bodyText=u=Object.prototype.toString.call(u):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof u=="string"?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(u)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var u=h(this);if(u)return u;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(){if(this._bodyArrayBuffer){var u=h(this);return u||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(i.blob)return this.blob().then(y);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var u=h(this);if(u)return u;if(this._bodyBlob)return m(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(A(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}var x=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function O(u){var d=u.toUpperCase();return x.indexOf(d)>-1?d:u}function L(u,d){if(!(this instanceof L))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');d=d||{};var b=d.body;if(u instanceof L){if(u.bodyUsed)throw new TypeError("Already read");this.url=u.url,this.credentials=u.credentials,d.headers||(this.headers=new p(u.headers)),this.method=u.method,this.mode=u.mode,this.signal=u.signal,!b&&u._bodyInit!=null&&(b=u._bodyInit,u.bodyUsed=!0)}else this.url=String(u);if(this.credentials=d.credentials||this.credentials||"same-origin",(d.headers||!this.headers)&&(this.headers=new p(d.headers)),this.method=O(d.method||this.method||"GET"),this.mode=d.mode||this.mode||null,this.signal=d.signal||this.signal||function(){if("AbortController"in n){var w=new AbortController;return w.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&b)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(b),(this.method==="GET"||this.method==="HEAD")&&(d.cache==="no-store"||d.cache==="no-cache")){var T=/([?&])_=[^&]*/;if(T.test(this.url))this.url=this.url.replace(T,"$1_="+new Date().getTime());else{var R=/\?/;this.url+=(R.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}L.prototype.clone=function(){return new L(this,{body:this._bodyInit})};function G(u){var d=new FormData;return u.trim().split("&").forEach(function(b){if(b){var T=b.split("="),R=T.shift().replace(/\+/g," "),w=T.join("=").replace(/\+/g," ");d.append(decodeURIComponent(R),decodeURIComponent(w))}}),d}function ie(u){var d=new p,b=u.replace(/\r?\n[\t ]+/g," ");return b.split("\r").map(function(T){return T.indexOf(`
2
- `)===0?T.substr(1,T.length):T}).forEach(function(T){var R=T.split(":"),w=R.shift().trim();if(w){var Pe=R.join(":").trim();try{d.append(w,Pe)}catch(at){console.warn("Response "+at.message)}}}),d}E.call(L.prototype);function F(u,d){if(!(this instanceof F))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(d||(d={}),this.type="default",this.status=d.status===void 0?200:d.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=d.statusText===void 0?"":""+d.statusText,this.headers=new p(d.headers),this.url=d.url||"",this._initBody(u)}E.call(F.prototype),F.prototype.clone=function(){return new F(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},F.error=function(){var u=new F(null,{status:200,statusText:""});return u.ok=!1,u.status=0,u.type="error",u};var se=[301,302,303,307,308];F.redirect=function(u,d){if(se.indexOf(d)===-1)throw new RangeError("Invalid status code");return new F(null,{status:d,headers:{location:u}})},r.DOMException=n.DOMException;try{new r.DOMException}catch{r.DOMException=function(d,b){this.message=d,this.name=b;var T=Error(d);this.stack=T.stack},r.DOMException.prototype=Object.create(Error.prototype),r.DOMException.prototype.constructor=r.DOMException}function he(u,d){return new Promise(function(b,T){var R=new L(u,d);if(R.signal&&R.signal.aborted)return T(new r.DOMException("Aborted","AbortError"));var w=new XMLHttpRequest;function Pe(){w.abort()}w.onload=function(){var k={statusText:w.statusText,headers:ie(w.getAllResponseHeaders()||"")};R.url.indexOf("file://")===0&&(w.status<200||w.status>599)?k.status=200:k.status=w.status,k.url="responseURL"in w?w.responseURL:k.headers.get("X-Request-URL");var ae="response"in w?w.response:w.responseText;setTimeout(function(){b(new F(ae,k))},0)},w.onerror=function(){setTimeout(function(){T(new TypeError("Network request failed"))},0)},w.ontimeout=function(){setTimeout(function(){T(new TypeError("Network request timed out"))},0)},w.onabort=function(){setTimeout(function(){T(new r.DOMException("Aborted","AbortError"))},0)};function at(k){try{return k===""&&n.location.href?n.location.href:k}catch{return k}}if(w.open(R.method,at(R.url),!0),R.credentials==="include"?w.withCredentials=!0:R.credentials==="omit"&&(w.withCredentials=!1),"responseType"in w&&(i.blob?w.responseType="blob":i.arrayBuffer&&(w.responseType="arraybuffer")),d&&typeof d.headers=="object"&&!(d.headers instanceof p||n.Headers&&d.headers instanceof n.Headers)){var Ht=[];Object.getOwnPropertyNames(d.headers).forEach(function(k){Ht.push(l(k)),w.setRequestHeader(k,c(d.headers[k]))}),R.headers.forEach(function(k,ae){Ht.indexOf(ae)===-1&&w.setRequestHeader(ae,k)})}else R.headers.forEach(function(k,ae){w.setRequestHeader(ae,k)});R.signal&&(R.signal.addEventListener("abort",Pe),w.onreadystatechange=function(){w.readyState===4&&R.signal.removeEventListener("abort",Pe)}),w.send(typeof R._bodyInit>"u"?null:R._bodyInit)})}return he.polyfill=!0,n.fetch||(n.fetch=he,n.Headers=p,n.Request=L,n.Response=F),r.Headers=p,r.Request=L,r.Response=F,r.fetch=he,r}({})})(je);je.fetch.ponyfill=!0;delete je.fetch.polyfill;var ve=Fe.fetch?Fe:je;J=ve.fetch;J.default=ve.fetch;J.fetch=ve.fetch;J.Headers=ve.Headers;J.Request=ve.Request;J.Response=ve.Response;Jt.exports=J});var Nn=I(V());var Fr=I(Le()),M=I(ye()),z=I(V());var zt=I(Le()),Ki={},$t=zt.css`
3
- `;var ke=I(V()),Kn="ft-app-info",oe=class e extends CustomEvent{constructor(t){super(e.eventName,{detail:t})}};oe.eventName="authentication-change";var qn={session:(e,t)=>{(0,ke.deepEqual)(e.session,t.payload)||(e.session=t.payload,setTimeout(()=>g.dispatchEvent(new oe(t.payload)),0))}},g=ke.FtReduxStore.get({name:Kn,reducers:qn,initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,apiIntegrationAppVersion:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],availableContentLocales:[],defaultLocales:void 0,searchInAllLanguagesAllowed:!1,metadataConfiguration:void 0,privacyPolicyConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1,authenticationRequired:!1}});var ot=I(V());var ue=class e{static get(t){let{baseUrl:r,apiIntegrationIdentifier:n}=g.getState(),i=t??n;if(r&&i&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(r,i,!0)}static await(t){return new Promise(r=>{let n=e.get(t);if(n)r(n);else{let i=g.subscribe(()=>{n=e.get(t),n&&(i(),r(n))})}})}};var Me=class{constructor(t){this.overrideApi=t}get api(){var t;return(t=this.overrideApi)!==null&&t!==void 0?t:ue.get()}get awaitApi(){return this.overrideApi?Promise.resolve(this.overrideApi):ue.await()}};var j=class extends Me{constructor(t=!0,r){var n;super(r),this.sortObjectFields=(s,a)=>typeof a!="object"||a==null||Array.isArray(a)?a:Object.fromEntries(Object.entries(a).sort(([o],[l])=>o.localeCompare(l)));let i=this.constructor;i.commonCache=(n=i.commonCache)!==null&&n!==void 0?n:new ot.CacheRegistry,this.cache=t?i.commonCache:new ot.CacheRegistry}clearCache(){this.cache.clearAll()}hash(t){return String(Array.from(JSON.stringify(t,this.sortObjectFields)).reduce((r,n)=>0|31*r+n.charCodeAt(0),0))}};var Ne=class extends j{async listMyBookmarks(){let t=g.getState().session;return t?.sessionAuthenticated?this.cache.get("my-bookmarks",async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId),5*60*1e3):[]}};var ut=class{addCommand(t,r=!1){g.commands.add(t,r)}consumeCommand(t){return g.commands.consume(t)}};window.FluidTopicsAppInfoStoreService=new ut;var K=I(V());var Wt,me=class extends CustomEvent{constructor(t){super("ft-i18n-context-loaded",{detail:t})}},Gn=Symbol("clearAfterUnitTest"),Ue=class extends(0,K.withEventBus)(j){constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Wt]=()=>{this.defaultMessages={},this.cache=new K.CacheRegistry,this.listeners={}},this.currentUiLocale=g.getState().uiLocale,g.subscribe(()=>this.clearWhenUiLocaleChanges())}clearWhenUiLocaleChanges(){let{uiLocale:t}=g.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){let r=t.name.toLowerCase();this.cache.setFinal(r,t),this.notify(r)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,r){var n;if(t=t.toLowerCase(),r&&Object.keys(r).length>0){let i={...(n=this.defaultMessages[t])!==null&&n!==void 0?n:{},...r};(0,K.deepEqual)(this.defaultMessages[t],i)||(this.defaultMessages[t]=i,await this.notify(t))}return this.fetchContext(t)}resolveContext(t){var r,n;return this.fetchContext(t),(n=(r=this.cache.getNow(t))===null||r===void 0?void 0:r.messages)!==null&&n!==void 0?n:{}}resolveRawMessage(t,r){let n=t.toLowerCase();return this.resolveContext(n)[r]}resolveMessage(t,r,...n){var i;let s=t.toLowerCase(),a=this.resolveContext(s);return new K.ParametrizedLabelResolver((i=this.defaultMessages[s])!==null&&i!==void 0?i:{},a).resolve(r,...n)}async fetchContext(t){let r=!this.cache.has(t),n;try{n=await this.cache.get(t,()=>this.messageContextProvider(this.currentUiLocale,t)),r&&await this.notify(t)}catch(i){!(i instanceof K.CanceledPromiseError)&&r&&console.error(i)}return n}subscribe(t,r){var n;return t=t.toLowerCase(),this.listeners[t]=(n=this.listeners[t])!==null&&n!==void 0?n:new Set,this.listeners[t].add(r),()=>{var i;return(i=this.listeners[t])===null||i===void 0?void 0:i.delete(r)}}async notifyAll(){let t=Object.keys(this.listeners);document.body.dispatchEvent(new me({loadedContexts:t})),this.dispatchEvent(new me({loadedContexts:t})),await Promise.all(t.map(r=>this.notify(r,!1)))}async notify(t,r=!0){r&&(document.body.dispatchEvent(new me({loadedContexts:[t]})),this.dispatchEvent(new me({loadedContexts:[t]}))),this.listeners[t]!=null&&await Promise.all([...this.listeners[t].values()].map(n=>(0,K.delay)(0).then(()=>n()).catch(()=>null)))}};Wt=Gn;window.FluidTopicsI18nService==null&&(window.FluidTopicsI18nService=new class extends Ue{constructor(){super(async(e,t)=>(await this.awaitApi).getFluidTopicsMessageContext(e,t))}});window.FluidTopicsCustomI18nService==null&&(window.FluidTopicsCustomI18nService=new class extends Ue{constructor(){super(async(e,t)=>(await this.awaitApi).getCustomMessageContext(e,t))}});var Yt=window.FluidTopicsI18nService,ss=window.FluidTopicsCustomI18nService;var Xt=I(V()),ct=class{highlightHtml(t,r,n){(0,Xt.highlightHtml)(t,r,n)}};window.FluidTopicsHighlightHtmlService=new ct;var $n=I(Qt(),1);var Zt;(function(e){e.black="black",e.green="green",e.blue="blue",e.purple="purple",e.red="red",e.orange="orange",e.yellow="yellow"})(Zt||(Zt={}));var er;(function(e){e.OFFICIAL="OFFICIAL",e.PERSONAL="PERSONAL",e.SHARED="SHARED"})(er||(er={}));var tr;(function(e){e.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",e.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",e.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",e.PERSONAL_BOOK="PERSONAL_BOOK",e.ATTACHMENT="ATTACHMENT",e.RESOURCE="RESOURCE",e.HTML_PACKAGE="HTML_PACKAGE"})(tr||(tr={}));var rr;(function(e){e.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",e.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",e.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",e.PERSONAL_BOOK="PERSONAL_BOOK",e.ATTACHMENT="ATTACHMENT",e.RESOURCE="RESOURCE",e.HTML_PACKAGE="HTML_PACKAGE"})(rr||(rr={}));var nr;(function(e){e.LAST_WEEK="LAST_WEEK",e.LAST_MONTH="LAST_MONTH",e.LAST_QUARTER="LAST_QUARTER",e.LAST_YEAR="LAST_YEAR"})(nr||(nr={}));var ir;(function(e){e.VALUE="VALUE",e.DATE="DATE",e.RANGE="RANGE"})(ir||(ir={}));var sr;(function(e){e.BOOKMARK__CREATE="BOOKMARK__CREATE",e.BOOKMARK__DELETE="BOOKMARK__DELETE",e.CASE_DEFLECTION__START="CASE_DEFLECTION__START",e.CASE_DEFLECTION__OPEN_TICKET="CASE_DEFLECTION__OPEN_TICKET",e.CASE_DEFLECTION__RATE="CASE_DEFLECTION__RATE",e.CHATBOT__RATE="CHATBOT__RATE",e.COLLECTION__CREATE="COLLECTION__CREATE",e.COLLECTION__UPDATE="COLLECTION__UPDATE",e.COLLECTION__DELETE="COLLECTION__DELETE",e.CUSTOM_EVENT__TRIGGER="CUSTOM_EVENT__TRIGGER",e.DOCUMENT__AI_TRANSLATE="DOCUMENT__AI_TRANSLATE",e.DOCUMENT__DISPLAY="DOCUMENT__DISPLAY",e.DOCUMENT__DOWNLOAD="DOCUMENT__DOWNLOAD",e.DOCUMENT__PRINT="DOCUMENT__PRINT",e.DOCUMENT__PROCESS="DOCUMENT__PROCESS",e.DOCUMENT__RATE="DOCUMENT__RATE",e.DOCUMENT__SEARCH="DOCUMENT__SEARCH",e.DOCUMENT__START_DISPLAY="DOCUMENT__START_DISPLAY",e.DOCUMENT__UNRATE="DOCUMENT__UNRATE",e.FEEDBACK__SEND="FEEDBACK__SEND",e.AI__COMPLETED_QUERY="AI__COMPLETED_QUERY",e.AI__RATE="AI__RATE",e.AI_CASE_DEFLECTION__START="AI_CASE_DEFLECTION__START",e.AI_CASE_DEFLECTION__OPEN_TICKET="AI_CASE_DEFLECTION__OPEN_TICKET",e.KHUB__PROCESS="KHUB__PROCESS",e.KHUB__SEARCH="KHUB__SEARCH",e.LABELS__DOWNLOAD="LABELS__DOWNLOAD",e.LINK__SHARE="LINK__SHARE",e.PAGE__DISPLAY="PAGE__DISPLAY",e.PERSONAL_BOOK__CREATE="PERSONAL_BOOK__CREATE",e.PERSONAL_BOOK__DELETE="PERSONAL_BOOK__DELETE",e.PERSONAL_BOOK__UPDATE="PERSONAL_BOOK__UPDATE",e.PERSONAL_TOPIC__CREATE="PERSONAL_TOPIC__CREATE",e.PERSONAL_TOPIC__UPDATE="PERSONAL_TOPIC__UPDATE",e.PERSONAL_TOPIC__DELETE="PERSONAL_TOPIC__DELETE",e.SAVED_SEARCH__CREATE="SAVED_SEARCH__CREATE",e.SAVED_SEARCH__DELETE="SAVED_SEARCH__DELETE",e.SAVED_SEARCH__UPDATE="SAVED_SEARCH__UPDATE",e.SEARCH_PAGE__SELECT="SEARCH_PAGE__SELECT",e.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU="SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU",e.TOPIC__AI_TRANSLATE="TOPIC__AI_TRANSLATE",e.TOPIC__DISPLAY="TOPIC__DISPLAY",e.TOPIC__RATE="TOPIC__RATE",e.TOPIC__START_DISPLAY="TOPIC__START_DISPLAY",e.TOPIC__UNRATE="TOPIC__UNRATE",e.USER__LOGIN="USER__LOGIN",e.USER__LOGOUT="USER__LOGOUT",e.HEARTBEAT="HEARTBEAT"})(sr||(sr={}));var ar;(function(e){e.THIRD_PARTY="THIRD_PARTY",e.OFF_THE_GRID="OFF_THE_GRID",e.CONTENT_PACKAGER="CONTENT_PACKAGER",e.PAGES="PAGES",e.DESIGNED_READER="DESIGNED_READER"})(ar||(ar={}));var or;(function(e){e.HOMEPAGE="HOMEPAGE",e.CUSTOM="CUSTOM",e.HEADER="HEADER",e.READER="READER",e.TOPIC_TEMPLATE="TOPIC_TEMPLATE",e.SEARCH="SEARCH",e.SEARCH_RESULT="SEARCH_RESULT",e.SEARCH_ANNOUNCEMENT="SEARCH_ANNOUNCEMENT",e.LINK_PREVIEW="LINK_PREVIEW"})(or||(or={}));var ur;(function(e){e.CLASSIC="CLASSIC",e.CUSTOM="CUSTOM",e.DESIGNER="DESIGNER"})(ur||(ur={}));var cr;(function(e){e.AND="AND",e.OR="OR",e.MONOVALUED="MONOVALUED"})(cr||(cr={}));var lr;(function(e){e.NONE="NONE",e.ALPHABET="ALPHABET",e.VERSION="VERSION"})(lr||(lr={}));var dr;(function(e){e.STARS="STARS",e.LIKE="LIKE",e.DICHOTOMOUS="DICHOTOMOUS",e.NO_RATING="NO_RATING"})(dr||(dr={}));var fr;(function(e){e.LAST_WEEK="LAST_WEEK",e.LAST_MONTH="LAST_MONTH",e.LAST_QUARTER="LAST_QUARTER",e.LAST_YEAR="LAST_YEAR",e.CUSTOM="CUSTOM"})(fr||(fr={}));var pr;(function(e){e.OPTIONAL="OPTIONAL",e.MANDATORY="MANDATORY"})(pr||(pr={}));var hr;(function(e){e.ASC="ASC",e.DESC="DESC"})(hr||(hr={}));var yr;(function(e){e.ALPHA="ALPHA",e.NATURAL="NATURAL"})(yr||(yr={}));var mr;(function(e){e.EVERYWHERE="EVERYWHERE",e.TITLE_ONLY="TITLE_ONLY",e.NONE="NONE"})(mr||(mr={}));var vr;(function(e){e.ARTICLE="ARTICLE",e.BOOK="BOOK",e.SHARED_BOOK="SHARED_BOOK",e.HTML_PACKAGE="HTML_PACKAGE"})(vr||(vr={}));var gr;(function(e){e.FLUIDTOPICS="FLUIDTOPICS",e.EXTERNAL="EXTERNAL"})(gr||(gr={}));var br;(function(e){e.MAP="MAP",e.DOCUMENT="DOCUMENT",e.TOPIC="TOPIC",e.PERSONAL_BOOK="PERSONAL_BOOK",e.SHARED_BOOK="SHARED_BOOK",e.HTML_PACKAGE="HTML_PACKAGE"})(br||(br={}));var Ar;(function(e){e.LAST_WEEK="LAST_WEEK",e.LAST_MONTH="LAST_MONTH",e.LAST_QUARTER="LAST_QUARTER",e.LAST_YEAR="LAST_YEAR"})(Ar||(Ar={}));var Sr;(function(e){e.MAP="MAP",e.DOCUMENT="DOCUMENT",e.TOPIC="TOPIC",e.HTML_PACKAGE="HTML_PACKAGE",e.HTML_PACKAGE_PAGE="HTML_PACKAGE_PAGE"})(Sr||(Sr={}));var Er;(function(e){e.DEFAULT="DEFAULT",e.DOCUMENTS="DOCUMENTS",e.ALL_TOPICS="ALL_TOPICS",e.TOPICS_AND_UNSTRUCTURED_DOCUMENTS="TOPICS_AND_UNSTRUCTURED_DOCUMENTS"})(Er||(Er={}));var wr;(function(e){e.PLAIN_TEXT="PLAIN_TEXT",e.LOCALIZED_OFFICIAL="LOCALIZED_OFFICIAL",e.LOCALIZED_CUSTOM="LOCALIZED_CUSTOM"})(wr||(wr={}));var P;(function(e){e.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",e.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",e.HTML_EXPORT_USER="HTML_EXPORT_USER",e.PDF_EXPORT_USER="PDF_EXPORT_USER",e.SAVED_SEARCH_USER="SAVED_SEARCH_USER",e.COLLECTION_USER="COLLECTION_USER",e.OFFLINE_USER="OFFLINE_USER",e.BEHAVIOR_DATA_USER="BEHAVIOR_DATA_USER",e.ANALYTICS_USER="ANALYTICS_USER",e.BETA_USER="BETA_USER",e.DEBUG_USER="DEBUG_USER",e.PRINT_USER="PRINT_USER",e.RATING_USER="RATING_USER",e.FEEDBACK_USER="FEEDBACK_USER",e.GENERATIVE_AI_USER="GENERATIVE_AI_USER",e.GENERATIVE_AI_EXPORT_USER="GENERATIVE_AI_EXPORT_USER",e.CONTENT_PUBLISHER="CONTENT_PUBLISHER",e.ANNOUNCEMENT_ADMIN="ANNOUNCEMENT_ADMIN",e.KHUB_ADMIN="KHUB_ADMIN",e.USERS_ADMIN="USERS_ADMIN",e.PORTAL_ADMIN="PORTAL_ADMIN",e.ADMIN="ADMIN"})(P||(P={}));var B;(function(e){e.SEARCHES="SEARCHES",e.BOOKMARKS="BOOKMARKS",e.BOOKS="BOOKS",e.COLLECTIONS="COLLECTIONS"})(B||(B={}));var Or;(function(e){e.UNAUTHENTICATED="UNAUTHENTICATED",e.USER_INCOMPLETE="USER_INCOMPLETE",e.MFA_REQUIRED="MFA_REQUIRED",e.AUTHENTICATED="AUTHENTICATED"})(Or||(Or={}));var Tr;(function(e){e.VALID="VALID",e.INVALID="INVALID"})(Tr||(Tr={}));var xr;(function(e){e.JSON="JSON",e.TEXT="TEXT"})(xr||(xr={}));var Cr;(function(e){e.USER="USER",e.ASSISTANT="ASSISTANT"})(Cr||(Cr={}));var _r;(function(e){e.TEXT="TEXT",e.HTML="HTML"})(_r||(_r={}));var Rr;(function(e){e.HTML="HTML",e.MARKDOWN="MARKDOWN"})(Rr||(Rr={}));var zn={[P.PERSONAL_BOOK_SHARE_USER]:[P.PERSONAL_BOOK_USER],[P.HTML_EXPORT_USER]:[P.PERSONAL_BOOK_USER],[P.PDF_EXPORT_USER]:[P.PERSONAL_BOOK_USER],[P.KHUB_ADMIN]:[P.CONTENT_PUBLISHER],[P.ADMIN]:[P.KHUB_ADMIN,P.USERS_ADMIN,P.PORTAL_ADMIN],[P.GENERATIVE_AI_EXPORT_USER]:[P.GENERATIVE_AI_USER]};function Ir(e,t){return e===t||(zn[e]??[]).some(r=>Ir(r,t))}function Pr(e,t){return e==null?!1:(Array.isArray(e)?e:Array.isArray(e.roles)?e.roles:Array.isArray(e.profile?.roles)?e.profile.roles:[]).some(n=>Ir(n,t))}var Be=class extends j{async listMySearches(){let{session:t}=g.getState();return Pr(t,P.SAVED_SEARCH_USER)?this.cache.get("my-searches",async()=>(await this.awaitApi).listMySearches(t.profile.userId),5*60*1e3):[]}};var Dr=I(V());var lt=class{isDate(t){var r,n,i,s;return(s=(i=((n=(r=g.getState().metadataConfiguration)===null||r===void 0?void 0:r.descriptors)!==null&&n!==void 0?n:[]).find(o=>o.key===t))===null||i===void 0?void 0:i.date)!==null&&s!==void 0?s:!1}format(t,r){var n,i,s;if(t==null)return"";try{return Dr.DateFormatter.format(t,(n=r?.locale)!==null&&n!==void 0?n:g.getState().uiLocale,(i=r?.longFormat)!==null&&i!==void 0?i:!1,(s=r?.withTime)!==null&&s!==void 0?s:!1)}catch(a){throw console.error(`Date ${JSON.stringify(t)} is not valid`,a),a}}};window.FluidTopicsDateService=new lt;var Lr=I(V());var Te=class{static get(t,r){var n,i;let s=g.getState(),{lang:a,region:o}=(i=(n=s.defaultLocales)===null||n===void 0?void 0:n.defaultContentLocale)!==null&&i!==void 0?i:{lang:"en",region:"US"};return new Lr.SearchPlaceConverter(s.baseUrl,t??20,s.searchInAllLanguagesAllowed,r??`${a}-${o}`)}};var kr=class extends j{async sendDocumentStartDisplayEvent(t){return this.sendEvents([this.sortEventArrays(t)],"Failed to send document.start_display event")}async sendTopicStartDisplayEvent(t){return this.sendEvents([this.sortEventArrays(t)],"Failed to send topic.start_display event")}async sendKhubSearchEvent(t){return this.sendEvents([this.sortEventArrays(t)],"Failed to send khub.search event")}async sendDocumentSearchEvent(t){return this.sendEvents([this.sortEventArrays(t)],"Failed to send document.search event")}async sendSearchPageSelectEvent(t){return this.sendEvents([this.sortEventArrays(t)],"Failed to send search_page.select event")}async sendSearchResultOpenContextMenuEvent(t){return this.sendEvents([this.sortEventArrays(t)],"Failed to send search_result.open_context_menu event")}sortEventArrays(t){let r=Object.entries(t).map(([n,i])=>Array.isArray(i)?[n,i.map(s=>typeof s=="object"&&s!=null&&!Array.isArray(s)?this.sortEventArrays(s):s).sort((s,a)=>typeof s=="object"&&s!==null&&"key"in s?s.key.localeCompare(a.key):typeof s=="string"&&typeof a=="string"?s.localeCompare(a):String(s).localeCompare(String(a)))]:typeof i=="object"&&i!==null?[n,this.sortEventArrays(i)]:[n,i]);return Object.fromEntries(r)}sendEvents(t,r){let n="anything not undefined";return this.cache.get("analytics-event-"+this.hash(t),async()=>(await this.awaitApi).sendEvents(t).then(()=>n).catch(i=>(console.info(r),console.debug(i),n)),1e3)}};var dt=class{urlToSearchRequest(t){return Te.get().parse(t)}searchRequestToUrl(t){return Te.get().serialize(t)}};window.FluidTopicsUrlService=new dt;var Q=I(V());var ce=class e extends CustomEvent{constructor(t){super(e.eventName,{detail:{currentItem:t}})}};ce.eventName="change";var ft=class{itemName(t){return`fluid-topics-history-item-${t}`}get(t){let r=sessionStorage.getItem(this.itemName(t));return r?JSON.parse(r):void 0}set(t,r){sessionStorage.setItem(this.itemName(t),JSON.stringify(r))}},Mr=new ft;var He=class e extends Q.WithEventBus{static build(){return new e(window.history,Mr,()=>window.location,!1)}constructor(t,r,n,i){var s,a;super(),this.history=t,this.historyStorage=r,this.windowLocation=n,this.states=[],this.realPushState=t.pushState,this.realReplaceState=t.replaceState,this.initialIndex=(a=(s=t.state)===null||s===void 0?void 0:s.index)!==null&&a!==void 0?a:t.length-1,this.currentIndex=this.initialIndex,this.setCurrentState(this.buildCurrentState()),this.installProxies(),this.initEventListeners(),this.initData(i)}setCurrentState(t,r=!1){let n=r&&this.currentIndex===t.index-1;this.currentState={...this.buildCurrentState(),...t},this.currentIndex=this.currentState.index,this.states[this.currentIndex]=this.currentState,n&&(this.states=this.states.slice(0,this.currentIndex+1)),this.historyStorage.set(this.currentIndex,this.currentState),(0,Q.deepEqual)(this.currentState,this.history.state)||this.realReplaceState.apply(this.history,[this.currentState,this.currentState.title,window.location.href]),setTimeout(()=>this.dispatchEvent(new ce(this.currentItem())),0)}installProxies(){let t=r=>(n,i,[s,a,o])=>{let l=r(),c={...l===this.currentIndex?this.currentState:void 0,...s,index:l,href:typeof o=="string"?o:(o??this.windowLocation()).href};n.apply(i,[c,a,o]),this.setCurrentState(c,!0)};this.history.pushState=new Proxy(this.history.pushState,{apply:t(()=>this.currentIndex+1)}),this.history.replaceState=new Proxy(this.history.replaceState,{apply:t(()=>this.currentIndex)})}initEventListeners(){window.addEventListener("popstate",t=>this.setCurrentState(t.state)),document.querySelector("title")==null&&document.head.append(document.createElement("title")),new MutationObserver(()=>this.updateCurrentState({title:document.title})).observe(document.querySelector("title"),{subtree:!0,characterData:!0,childList:!0})}initData(t){for(let r=this.history.length-1;r>=0;r--)t?this.states[r]=this.historyStorage.get(r):setTimeout(()=>this.states[r]=this.historyStorage.get(r),this.history.length-r)}updateCurrentState(t){var r;let n={...this.buildCurrentState(),...t,index:this.currentIndex,title:(r=t?.title)!==null&&r!==void 0?r:this.currentState.title};this.setCurrentState(n)}addHistoryChangeListener(t){this.addEventListener(ce.eventName,t)}removeHistoryChangeListener(t){this.removeEventListener(ce.eventName,t)}currentItem(){return(0,Q.deepCopy)(this.currentState)}back(){let t=this.previousDifferentMajorPosition();t>=0?this.history.go(t-this.currentIndex):this.currentIndex!==this.initialIndex?this.history.go(this.initialIndex-this.currentIndex):this.history.back()}backwardItem(){return(0,Q.deepCopy)(this.states[this.previousDifferentMajorPosition()])}previousDifferentMajorPosition(){let t=this.currentIndex>0?this.currentIndex-1:0;for(;t>0&&!this.isDifferentMajorState(t);)t--;return t}forward(){let t=this.nextMajorPosition();t&&t<this.states.length?this.history.go(t-this.currentIndex):this.history.forward()}forwardItem(){let t=this.nextMajorPosition();if(t)return(0,Q.deepCopy)(this.states[t])}nextMajorPosition(){let t=this.currentIndex;if(!(t>=this.states.length)){do t++;while(t<this.states.length&&!this.isDifferentMajorState(t));return this.getHigherPositionInTheSameState(t)}}getHigherPositionInTheSameState(t){var r;let n=(r=this.states[t])===null||r===void 0?void 0:r.majorStateId;if(!n)return t;let i=t,s=t+1;for(;this.states.length>s&&!this.isDifferentMajorState(s,n);)this.hasState(s)&&(i=s),s++;return i}buildCurrentState(){var t,r;return{...this.history.state,index:this.currentIndex,href:this.windowLocation().href,title:(r=(t=this.history.state)===null||t===void 0?void 0:t.title)!==null&&r!==void 0?r:document.title}}hasState(t){return this.states[t]!=null}isDifferentMajorState(t,r){var n;if(!this.hasState(t))return!1;let i=r??this.currentState.majorStateId,s=(n=this.states[t])===null||n===void 0?void 0:n.majorStateId;return s==null||s!=i}};window.FluidTopicsInternalHistoryService==null&&(window.FluidTopicsInternalHistoryService=He.build(),window.FluidTopicsHistoryService={currentItem:()=>window.FluidTopicsInternalHistoryService.currentItem(),back:()=>window.FluidTopicsInternalHistoryService.back(),forward:()=>window.FluidTopicsInternalHistoryService.forward(),backwardItem:()=>window.FluidTopicsInternalHistoryService.backwardItem(),forwardItem:()=>window.FluidTopicsInternalHistoryService.forwardItem(),addHistoryChangeListener:e=>window.FluidTopicsInternalHistoryService.addHistoryChangeListener(e),removeHistoryChangeListener:e=>window.FluidTopicsInternalHistoryService.removeHistoryChangeListener(e)});var Nr=class{constructor(){this.storeListeners=[]}store(t,r){if(this.isAuthenticated())return;let n=JSON.stringify(r);window.localStorage.setItem(t,n),window.dispatchEvent(new StorageEvent("storage",{key:t,newValue:n,storageArea:window.localStorage}))}get(t){var r,n;if(!this.isAuthenticated())return(n=JSON.parse((r=window.localStorage.getItem(t))!==null&&r!==void 0?r:"null"))!==null&&n!==void 0?n:void 0}addStoreListener(t,r){let n=i=>{i.key===t()&&!this.isAuthenticated()&&r()};this.storeListeners.push(n),window.addEventListener("storage",n)}clearStoreListeners(){this.storeListeners.forEach(t=>window.removeEventListener("storage",t)),this.storeListeners.length=0}isAuthenticated(){let t=g.getState().session;return!!t?.sessionAuthenticated}};function Ur(e,t){let{authenticationRequired:r,session:n}=g.getState();return r&&!n?.sessionAuthenticated?Promise.resolve(t):e()}var D=function(e,t,r,n){var i=arguments.length,s=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(i<3?a(s):i>3?a(t,r,s):a(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},C=class extends z.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.apiIntegrationAppVersion="ft-integration-app-version",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.navigatorOnline=!1,this.forcedOffline=!1,this.apiProvider=()=>ue.get(),this.authenticationRequired=!1,this.messageContexts=[],this.cache=new z.CacheRegistry,this.cleanSessionDebouncer=new z.Debouncer,this.reloadConfiguration=()=>{this.cache.clear("availableContentLocales"),this.updateAvailableContentLocales()}}render(){return Fr.html`
1
+ "use strict";(()=>{var pt=Object.create;var le=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var ft=Object.getOwnPropertyNames;var yt=Object.getPrototypeOf,At=Object.prototype.hasOwnProperty;var B=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var mt=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ft(t))!At.call(e,a)&&a!==s&&le(e,a,{get:()=>t[a],enumerable:!(n=ht(t,a))||n.enumerable});return e};var _=(e,t,s)=>(s=e!=null?pt(yt(e)):{},mt(t||!e||!e.__esModule?le(s,"default",{value:e,enumerable:!0}):s,e));var R=B((vt,ue)=>{ue.exports=ftGlobals.wcUtils});var W=B((Ct,ce)=>{ce.exports=ftGlobals.lit});var pe=B((bt,de)=>{de.exports=ftGlobals.litDecorators});var ge=B((x,Ee)=>{var V=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global,q=function(){function e(){this.fetch=!1,this.DOMException=V.DOMException}return e.prototype=V,new e}();(function(e){var t=function(s){var n=typeof e<"u"&&e||typeof self<"u"&&self||typeof global<"u"&&global||{},a={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};function o(r){return r&&DataView.prototype.isPrototypeOf(r)}if(a.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],y=ArrayBuffer.isView||function(r){return r&&d.indexOf(Object.prototype.toString.call(r))>-1};function S(r){if(typeof r!="string"&&(r=String(r)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(r)||r==="")throw new TypeError('Invalid character in header field name: "'+r+'"');return r.toLowerCase()}function I(r){return typeof r!="string"&&(r=String(r)),r}function Y(r){var i={next:function(){var u=r.shift();return{done:u===void 0,value:u}}};return a.iterable&&(i[Symbol.iterator]=function(){return i}),i}function A(r){this.map={},r instanceof A?r.forEach(function(i,u){this.append(u,i)},this):Array.isArray(r)?r.forEach(function(i){if(i.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+i.length);this.append(i[0],i[1])},this):r&&Object.getOwnPropertyNames(r).forEach(function(i){this.append(i,r[i])},this)}A.prototype.append=function(r,i){r=S(r),i=I(i);var u=this.map[r];this.map[r]=u?u+", "+i:i},A.prototype.delete=function(r){delete this.map[S(r)]},A.prototype.get=function(r){return r=S(r),this.has(r)?this.map[r]:null},A.prototype.has=function(r){return this.map.hasOwnProperty(S(r))},A.prototype.set=function(r,i){this.map[S(r)]=I(i)},A.prototype.forEach=function(r,i){for(var u in this.map)this.map.hasOwnProperty(u)&&r.call(i,this.map[u],u,this)},A.prototype.keys=function(){var r=[];return this.forEach(function(i,u){r.push(u)}),Y(r)},A.prototype.values=function(){var r=[];return this.forEach(function(i){r.push(i)}),Y(r)},A.prototype.entries=function(){var r=[];return this.forEach(function(i,u){r.push([u,i])}),Y(r)},a.iterable&&(A.prototype[Symbol.iterator]=A.prototype.entries);function z(r){if(!r._noBody){if(r.bodyUsed)return Promise.reject(new TypeError("Already read"));r.bodyUsed=!0}}function ne(r){return new Promise(function(i,u){r.onload=function(){i(r.result)},r.onerror=function(){u(r.error)}})}function nt(r){var i=new FileReader,u=ne(i);return i.readAsArrayBuffer(r),u}function it(r){var i=new FileReader,u=ne(i),p=/charset=([A-Za-z0-9_-]+)/.exec(r.type),f=p?p[1]:"utf-8";return i.readAsText(r,f),u}function at(r){for(var i=new Uint8Array(r),u=new Array(i.length),p=0;p<i.length;p++)u[p]=String.fromCharCode(i[p]);return u.join("")}function ie(r){if(r.slice)return r.slice(0);var i=new Uint8Array(r.byteLength);return i.set(new Uint8Array(r)),i.buffer}function ae(){return this.bodyUsed=!1,this._initBody=function(r){this.bodyUsed=this.bodyUsed,this._bodyInit=r,r?typeof r=="string"?this._bodyText=r:a.blob&&Blob.prototype.isPrototypeOf(r)?this._bodyBlob=r:a.formData&&FormData.prototype.isPrototypeOf(r)?this._bodyFormData=r:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)?this._bodyText=r.toString():a.arrayBuffer&&a.blob&&o(r)?(this._bodyArrayBuffer=ie(r.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(r)||y(r))?this._bodyArrayBuffer=ie(r):this._bodyText=r=Object.prototype.toString.call(r):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof r=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var r=z(this);if(r)return r;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(){if(this._bodyArrayBuffer){var r=z(this);return r||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(a.blob)return this.blob().then(nt);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var r=z(this);if(r)return r;if(this._bodyBlob)return it(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(at(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(ut)}),this.json=function(){return this.text().then(JSON.parse)},this}var ot=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function lt(r){var i=r.toUpperCase();return ot.indexOf(i)>-1?i:r}function O(r,i){if(!(this instanceof O))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');i=i||{};var u=i.body;if(r instanceof O){if(r.bodyUsed)throw new TypeError("Already read");this.url=r.url,this.credentials=r.credentials,i.headers||(this.headers=new A(r.headers)),this.method=r.method,this.mode=r.mode,this.signal=r.signal,!u&&r._bodyInit!=null&&(u=r._bodyInit,r.bodyUsed=!0)}else this.url=String(r);if(this.credentials=i.credentials||this.credentials||"same-origin",(i.headers||!this.headers)&&(this.headers=new A(i.headers)),this.method=lt(i.method||this.method||"GET"),this.mode=i.mode||this.mode||null,this.signal=i.signal||this.signal||function(){if("AbortController"in n){var c=new AbortController;return c.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&u)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(u),(this.method==="GET"||this.method==="HEAD")&&(i.cache==="no-store"||i.cache==="no-cache")){var p=/([?&])_=[^&]*/;if(p.test(this.url))this.url=this.url.replace(p,"$1_="+new Date().getTime());else{var f=/\?/;this.url+=(f.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}O.prototype.clone=function(){return new O(this,{body:this._bodyInit})};function ut(r){var i=new FormData;return r.trim().split("&").forEach(function(u){if(u){var p=u.split("="),f=p.shift().replace(/\+/g," "),c=p.join("=").replace(/\+/g," ");i.append(decodeURIComponent(f),decodeURIComponent(c))}}),i}function ct(r){var i=new A,u=r.replace(/\r?\n[\t ]+/g," ");return u.split("\r").map(function(p){return p.indexOf(`
2
+ `)===0?p.substr(1,p.length):p}).forEach(function(p){var f=p.split(":"),c=f.shift().trim();if(c){var H=f.join(":").trim();try{i.append(c,H)}catch(X){console.warn("Response "+X.message)}}}),i}ae.call(O.prototype);function C(r,i){if(!(this instanceof C))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(i||(i={}),this.type="default",this.status=i.status===void 0?200:i.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=i.statusText===void 0?"":""+i.statusText,this.headers=new A(i.headers),this.url=i.url||"",this._initBody(r)}ae.call(C.prototype),C.prototype.clone=function(){return new C(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new A(this.headers),url:this.url})},C.error=function(){var r=new C(null,{status:200,statusText:""});return r.ok=!1,r.status=0,r.type="error",r};var dt=[301,302,303,307,308];C.redirect=function(r,i){if(dt.indexOf(i)===-1)throw new RangeError("Invalid status code");return new C(null,{status:i,headers:{location:r}})},s.DOMException=n.DOMException;try{new s.DOMException}catch{s.DOMException=function(i,u){this.message=i,this.name=u;var p=Error(i);this.stack=p.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function Q(r,i){return new Promise(function(u,p){var f=new O(r,i);if(f.signal&&f.signal.aborted)return p(new s.DOMException("Aborted","AbortError"));var c=new XMLHttpRequest;function H(){c.abort()}c.onload=function(){var g={statusText:c.statusText,headers:ct(c.getAllResponseHeaders()||"")};f.url.indexOf("file://")===0&&(c.status<200||c.status>599)?g.status=200:g.status=c.status,g.url="responseURL"in c?c.responseURL:g.headers.get("X-Request-URL");var D="response"in c?c.response:c.responseText;setTimeout(function(){u(new C(D,g))},0)},c.onerror=function(){setTimeout(function(){p(new TypeError("Network request failed"))},0)},c.ontimeout=function(){setTimeout(function(){p(new TypeError("Network request timed out"))},0)},c.onabort=function(){setTimeout(function(){p(new s.DOMException("Aborted","AbortError"))},0)};function X(g){try{return g===""&&n.location.href?n.location.href:g}catch{return g}}if(c.open(f.method,X(f.url),!0),f.credentials==="include"?c.withCredentials=!0:f.credentials==="omit"&&(c.withCredentials=!1),"responseType"in c&&(a.blob?c.responseType="blob":a.arrayBuffer&&(c.responseType="arraybuffer")),i&&typeof i.headers=="object"&&!(i.headers instanceof A||n.Headers&&i.headers instanceof n.Headers)){var oe=[];Object.getOwnPropertyNames(i.headers).forEach(function(g){oe.push(S(g)),c.setRequestHeader(g,I(i.headers[g]))}),f.headers.forEach(function(g,D){oe.indexOf(D)===-1&&c.setRequestHeader(D,g)})}else f.headers.forEach(function(g,D){c.setRequestHeader(D,g)});f.signal&&(f.signal.addEventListener("abort",H),c.onreadystatechange=function(){c.readyState===4&&f.signal.removeEventListener("abort",H)}),c.send(typeof f._bodyInit>"u"?null:f._bodyInit)})}return Q.polyfill=!0,n.fetch||(n.fetch=Q,n.Headers=A,n.Request=O,n.Response=C),s.Headers=A,s.Request=O,s.Response=C,s.fetch=Q,s}({})})(q);q.fetch.ponyfill=!0;delete q.fetch.polyfill;var F=V.fetch?V:q;x=F.fetch;x.default=F.fetch;x.fetch=F.fetch;x.Headers=F.Headers;x.Request=F.Request;x.Response=F.Response;Ee.exports=x});var st=_(R());var rt=_(W()),T=_(pe()),b=_(R());var he=_(W());var fe=he.css`
3
+ `;var j=_(R()),Et="ft-app-info",U=class e extends CustomEvent{constructor(t){super(e.eventName,{detail:t})}};U.eventName="authentication-change";var gt={session:(e,t)=>{(0,j.deepEqual)(e.session,t.payload)||(e.session=t.payload,setTimeout(()=>l.dispatchEvent(new U(t.payload)),0))}},l=j.FtReduxStore.get({name:Et,reducers:gt,initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,apiIntegrationAppVersion:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],availableContentLocales:[],defaultLocales:void 0,searchInAllLanguagesAllowed:!1,metadataConfiguration:void 0,privacyPolicyConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1,authenticationRequired:!1}});var J=_(R());var w=class e{static get(t){let{baseUrl:s,apiIntegrationIdentifier:n}=l.getState(),a=t??n;if(s&&a&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(s,a,!0)}static await(t){return new Promise(s=>{let n=e.get(t);if(n)s(n);else{let a=l.subscribe(()=>{n=e.get(t),n&&(a(),s(n))})}})}};var K=class{constructor(t){this.overrideApi=t}get api(){var t;return(t=this.overrideApi)!==null&&t!==void 0?t:w.get()}get awaitApi(){return this.overrideApi?Promise.resolve(this.overrideApi):w.await()}};var P=class extends K{constructor(t=!0,s){var n;super(s),this.sortObjectFields=(o,d)=>typeof d!="object"||d==null||Array.isArray(d)?d:Object.fromEntries(Object.entries(d).sort(([y],[S])=>y.localeCompare(S)));let a=this.constructor;a.commonCache=(n=a.commonCache)!==null&&n!==void 0?n:new J.CacheRegistry,this.cache=t?a.commonCache:new J.CacheRegistry}clearCache(){this.cache.clearAll()}hash(t){return String(Array.from(JSON.stringify(t,this.sortObjectFields)).reduce((s,n)=>0|31*s+n.charCodeAt(0),0))}};var Z=class{addCommand(t,s=!1){l.commands.add(t,s)}consumeCommand(t){return l.commands.consume(t)}};window.FluidTopicsAppInfoStoreService=new Z;var v=_(R());var ye,N=class extends CustomEvent{constructor(t){super("ft-i18n-context-loaded",{detail:t})}},Tt=Symbol("clearAfterUnitTest"),G=class extends(0,v.withEventBus)(P){constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[ye]=()=>{this.defaultMessages={},this.cache=new v.CacheRegistry,this.listeners={}},this.currentUiLocale=l.getState().uiLocale,l.subscribe(()=>this.clearWhenUiLocaleChanges())}clearWhenUiLocaleChanges(){let{uiLocale:t}=l.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){let s=t.name.toLowerCase();this.cache.setFinal(s,t),this.notify(s)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,s){var n;if(t=t.toLowerCase(),s&&Object.keys(s).length>0){let a={...(n=this.defaultMessages[t])!==null&&n!==void 0?n:{},...s};(0,v.deepEqual)(this.defaultMessages[t],a)||(this.defaultMessages[t]=a,await this.notify(t))}return this.fetchContext(t)}resolveContext(t){var s,n;return this.fetchContext(t),(n=(s=this.cache.getNow(t))===null||s===void 0?void 0:s.messages)!==null&&n!==void 0?n:{}}resolveRawMessage(t,s){let n=t.toLowerCase();return this.resolveContext(n)[s]}resolveMessage(t,s,...n){var a;let o=t.toLowerCase(),d=this.resolveContext(o);return new v.ParametrizedLabelResolver((a=this.defaultMessages[o])!==null&&a!==void 0?a:{},d).resolve(s,...n)}async fetchContext(t){let s=!this.cache.has(t),n;try{n=await this.cache.get(t,()=>this.messageContextProvider(this.currentUiLocale,t)),s&&await this.notify(t)}catch(a){!(a instanceof v.CanceledPromiseError)&&s&&console.error(a)}return n}subscribe(t,s){var n;return t=t.toLowerCase(),this.listeners[t]=(n=this.listeners[t])!==null&&n!==void 0?n:new Set,this.listeners[t].add(s),()=>{var a;return(a=this.listeners[t])===null||a===void 0?void 0:a.delete(s)}}async notifyAll(){let t=Object.keys(this.listeners);document.body.dispatchEvent(new N({loadedContexts:t})),this.dispatchEvent(new N({loadedContexts:t})),await Promise.all(t.map(s=>this.notify(s,!1)))}async notify(t,s=!0){s&&(document.body.dispatchEvent(new N({loadedContexts:[t]})),this.dispatchEvent(new N({loadedContexts:[t]}))),this.listeners[t]!=null&&await Promise.all([...this.listeners[t].values()].map(n=>(0,v.delay)(0).then(()=>n()).catch(()=>null)))}};ye=Tt;window.FluidTopicsI18nService==null&&(window.FluidTopicsI18nService=new class extends G{constructor(){super(async(e,t)=>(await this.awaitApi).getFluidTopicsMessageContext(e,t))}});window.FluidTopicsCustomI18nService==null&&(window.FluidTopicsCustomI18nService=new class extends G{constructor(){super(async(e,t)=>(await this.awaitApi).getCustomMessageContext(e,t))}});var Ae=window.FluidTopicsI18nService,jt=window.FluidTopicsCustomI18nService;var me=_(R()),ee=class{highlightHtml(t,s,n){(0,me.highlightHtml)(t,s,n)}};window.FluidTopicsHighlightHtmlService=new ee;var St=_(ge(),1);var Te;(function(e){e.black="black",e.green="green",e.blue="blue",e.purple="purple",e.red="red",e.orange="orange",e.yellow="yellow"})(Te||(Te={}));var Se;(function(e){e.OFFICIAL="OFFICIAL",e.PERSONAL="PERSONAL",e.SHARED="SHARED"})(Se||(Se={}));var _e;(function(e){e.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",e.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",e.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",e.PERSONAL_BOOK="PERSONAL_BOOK",e.ATTACHMENT="ATTACHMENT",e.RESOURCE="RESOURCE",e.HTML_PACKAGE="HTML_PACKAGE"})(_e||(_e={}));var ve;(function(e){e.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",e.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",e.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",e.PERSONAL_BOOK="PERSONAL_BOOK",e.ATTACHMENT="ATTACHMENT",e.RESOURCE="RESOURCE",e.HTML_PACKAGE="HTML_PACKAGE"})(ve||(ve={}));var Ce;(function(e){e.LAST_WEEK="LAST_WEEK",e.LAST_MONTH="LAST_MONTH",e.LAST_QUARTER="LAST_QUARTER",e.LAST_YEAR="LAST_YEAR"})(Ce||(Ce={}));var be;(function(e){e.VALUE="VALUE",e.DATE="DATE",e.RANGE="RANGE"})(be||(be={}));var Re;(function(e){e.BOOKMARK__CREATE="BOOKMARK__CREATE",e.BOOKMARK__DELETE="BOOKMARK__DELETE",e.CASE_DEFLECTION__START="CASE_DEFLECTION__START",e.CASE_DEFLECTION__OPEN_TICKET="CASE_DEFLECTION__OPEN_TICKET",e.CASE_DEFLECTION__RATE="CASE_DEFLECTION__RATE",e.CHATBOT__RATE="CHATBOT__RATE",e.COLLECTION__CREATE="COLLECTION__CREATE",e.COLLECTION__UPDATE="COLLECTION__UPDATE",e.COLLECTION__DELETE="COLLECTION__DELETE",e.CUSTOM_EVENT__TRIGGER="CUSTOM_EVENT__TRIGGER",e.DOCUMENT__AI_TRANSLATE="DOCUMENT__AI_TRANSLATE",e.DOCUMENT__DISPLAY="DOCUMENT__DISPLAY",e.DOCUMENT__DOWNLOAD="DOCUMENT__DOWNLOAD",e.DOCUMENT__PRINT="DOCUMENT__PRINT",e.DOCUMENT__PROCESS="DOCUMENT__PROCESS",e.DOCUMENT__RATE="DOCUMENT__RATE",e.DOCUMENT__SEARCH="DOCUMENT__SEARCH",e.DOCUMENT__START_DISPLAY="DOCUMENT__START_DISPLAY",e.DOCUMENT__UNRATE="DOCUMENT__UNRATE",e.FEEDBACK__SEND="FEEDBACK__SEND",e.AI__COMPLETED_QUERY="AI__COMPLETED_QUERY",e.AI__RATE="AI__RATE",e.AI_CASE_DEFLECTION__START="AI_CASE_DEFLECTION__START",e.AI_CASE_DEFLECTION__OPEN_TICKET="AI_CASE_DEFLECTION__OPEN_TICKET",e.KHUB__PROCESS="KHUB__PROCESS",e.KHUB__SEARCH="KHUB__SEARCH",e.LABELS__DOWNLOAD="LABELS__DOWNLOAD",e.LINK__SHARE="LINK__SHARE",e.PAGE__DISPLAY="PAGE__DISPLAY",e.PERSONAL_BOOK__CREATE="PERSONAL_BOOK__CREATE",e.PERSONAL_BOOK__DELETE="PERSONAL_BOOK__DELETE",e.PERSONAL_BOOK__UPDATE="PERSONAL_BOOK__UPDATE",e.PERSONAL_TOPIC__CREATE="PERSONAL_TOPIC__CREATE",e.PERSONAL_TOPIC__UPDATE="PERSONAL_TOPIC__UPDATE",e.PERSONAL_TOPIC__DELETE="PERSONAL_TOPIC__DELETE",e.SAVED_SEARCH__CREATE="SAVED_SEARCH__CREATE",e.SAVED_SEARCH__DELETE="SAVED_SEARCH__DELETE",e.SAVED_SEARCH__UPDATE="SAVED_SEARCH__UPDATE",e.SEARCH_PAGE__SELECT="SEARCH_PAGE__SELECT",e.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU="SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU",e.TOPIC__AI_TRANSLATE="TOPIC__AI_TRANSLATE",e.TOPIC__DISPLAY="TOPIC__DISPLAY",e.TOPIC__RATE="TOPIC__RATE",e.TOPIC__START_DISPLAY="TOPIC__START_DISPLAY",e.TOPIC__UNRATE="TOPIC__UNRATE",e.USER__LOGIN="USER__LOGIN",e.USER__LOGOUT="USER__LOGOUT",e.HEARTBEAT="HEARTBEAT"})(Re||(Re={}));var Ie;(function(e){e.THIRD_PARTY="THIRD_PARTY",e.OFF_THE_GRID="OFF_THE_GRID",e.CONTENT_PACKAGER="CONTENT_PACKAGER",e.PAGES="PAGES",e.DESIGNED_READER="DESIGNED_READER"})(Ie||(Ie={}));var Oe;(function(e){e.HOMEPAGE="HOMEPAGE",e.CUSTOM="CUSTOM",e.HEADER="HEADER",e.READER="READER",e.TOPIC_TEMPLATE="TOPIC_TEMPLATE",e.SEARCH="SEARCH",e.SEARCH_RESULT="SEARCH_RESULT",e.SEARCH_ANNOUNCEMENT="SEARCH_ANNOUNCEMENT",e.LINK_PREVIEW="LINK_PREVIEW"})(Oe||(Oe={}));var xe;(function(e){e.CLASSIC="CLASSIC",e.CUSTOM="CUSTOM",e.DESIGNER="DESIGNER"})(xe||(xe={}));var Le;(function(e){e.AND="AND",e.OR="OR",e.MONOVALUED="MONOVALUED"})(Le||(Le={}));var De;(function(e){e.NONE="NONE",e.ALPHABET="ALPHABET",e.VERSION="VERSION"})(De||(De={}));var Ue;(function(e){e.STARS="STARS",e.LIKE="LIKE",e.DICHOTOMOUS="DICHOTOMOUS",e.NO_RATING="NO_RATING"})(Ue||(Ue={}));var we;(function(e){e.LAST_WEEK="LAST_WEEK",e.LAST_MONTH="LAST_MONTH",e.LAST_QUARTER="LAST_QUARTER",e.LAST_YEAR="LAST_YEAR",e.CUSTOM="CUSTOM"})(we||(we={}));var Pe;(function(e){e.OPTIONAL="OPTIONAL",e.MANDATORY="MANDATORY"})(Pe||(Pe={}));var Me;(function(e){e.ASC="ASC",e.DESC="DESC"})(Me||(Me={}));var Ne;(function(e){e.ALPHA="ALPHA",e.NATURAL="NATURAL"})(Ne||(Ne={}));var Fe;(function(e){e.EVERYWHERE="EVERYWHERE",e.TITLE_ONLY="TITLE_ONLY",e.NONE="NONE"})(Fe||(Fe={}));var ke;(function(e){e.ARTICLE="ARTICLE",e.BOOK="BOOK",e.SHARED_BOOK="SHARED_BOOK",e.HTML_PACKAGE="HTML_PACKAGE"})(ke||(ke={}));var He;(function(e){e.FLUIDTOPICS="FLUIDTOPICS",e.EXTERNAL="EXTERNAL"})(He||(He={}));var Be;(function(e){e.MAP="MAP",e.DOCUMENT="DOCUMENT",e.TOPIC="TOPIC",e.PERSONAL_BOOK="PERSONAL_BOOK",e.SHARED_BOOK="SHARED_BOOK",e.HTML_PACKAGE="HTML_PACKAGE"})(Be||(Be={}));var je;(function(e){e.LAST_WEEK="LAST_WEEK",e.LAST_MONTH="LAST_MONTH",e.LAST_QUARTER="LAST_QUARTER",e.LAST_YEAR="LAST_YEAR"})(je||(je={}));var Ke;(function(e){e.MAP="MAP",e.DOCUMENT="DOCUMENT",e.TOPIC="TOPIC",e.HTML_PACKAGE="HTML_PACKAGE",e.HTML_PACKAGE_PAGE="HTML_PACKAGE_PAGE"})(Ke||(Ke={}));var Ge;(function(e){e.DEFAULT="DEFAULT",e.DOCUMENTS="DOCUMENTS",e.ALL_TOPICS="ALL_TOPICS",e.TOPICS_AND_UNSTRUCTURED_DOCUMENTS="TOPICS_AND_UNSTRUCTURED_DOCUMENTS"})(Ge||(Ge={}));var Ve;(function(e){e.PLAIN_TEXT="PLAIN_TEXT",e.LOCALIZED_OFFICIAL="LOCALIZED_OFFICIAL",e.LOCALIZED_CUSTOM="LOCALIZED_CUSTOM"})(Ve||(Ve={}));var E;(function(e){e.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",e.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",e.HTML_EXPORT_USER="HTML_EXPORT_USER",e.PDF_EXPORT_USER="PDF_EXPORT_USER",e.SAVED_SEARCH_USER="SAVED_SEARCH_USER",e.COLLECTION_USER="COLLECTION_USER",e.OFFLINE_USER="OFFLINE_USER",e.BEHAVIOR_DATA_USER="BEHAVIOR_DATA_USER",e.ANALYTICS_USER="ANALYTICS_USER",e.BETA_USER="BETA_USER",e.DEBUG_USER="DEBUG_USER",e.PRINT_USER="PRINT_USER",e.RATING_USER="RATING_USER",e.FEEDBACK_USER="FEEDBACK_USER",e.GENERATIVE_AI_USER="GENERATIVE_AI_USER",e.GENERATIVE_AI_EXPORT_USER="GENERATIVE_AI_EXPORT_USER",e.CONTENT_PUBLISHER="CONTENT_PUBLISHER",e.ANNOUNCEMENT_ADMIN="ANNOUNCEMENT_ADMIN",e.KHUB_ADMIN="KHUB_ADMIN",e.USERS_ADMIN="USERS_ADMIN",e.PORTAL_ADMIN="PORTAL_ADMIN",e.ADMIN="ADMIN"})(E||(E={}));var qe;(function(e){e.SEARCHES="SEARCHES",e.BOOKMARKS="BOOKMARKS",e.BOOKS="BOOKS",e.COLLECTIONS="COLLECTIONS"})(qe||(qe={}));var $e;(function(e){e.UNAUTHENTICATED="UNAUTHENTICATED",e.USER_INCOMPLETE="USER_INCOMPLETE",e.MFA_REQUIRED="MFA_REQUIRED",e.AUTHENTICATED="AUTHENTICATED"})($e||($e={}));var Ye;(function(e){e.VALID="VALID",e.INVALID="INVALID"})(Ye||(Ye={}));var ze;(function(e){e.JSON="JSON",e.TEXT="TEXT"})(ze||(ze={}));var Qe;(function(e){e.USER="USER",e.ASSISTANT="ASSISTANT"})(Qe||(Qe={}));var Xe;(function(e){e.TEXT="TEXT",e.HTML="HTML"})(Xe||(Xe={}));var We;(function(e){e.HTML="HTML",e.MARKDOWN="MARKDOWN"})(We||(We={}));var Xt={[E.PERSONAL_BOOK_SHARE_USER]:[E.PERSONAL_BOOK_USER],[E.HTML_EXPORT_USER]:[E.PERSONAL_BOOK_USER],[E.PDF_EXPORT_USER]:[E.PERSONAL_BOOK_USER],[E.KHUB_ADMIN]:[E.CONTENT_PUBLISHER],[E.ADMIN]:[E.KHUB_ADMIN,E.USERS_ADMIN,E.PORTAL_ADMIN],[E.GENERATIVE_AI_EXPORT_USER]:[E.GENERATIVE_AI_USER]};var Je=_(R());var te=class{isDate(t){var s,n,a,o;return(o=(a=((n=(s=l.getState().metadataConfiguration)===null||s===void 0?void 0:s.descriptors)!==null&&n!==void 0?n:[]).find(y=>y.key===t))===null||a===void 0?void 0:a.date)!==null&&o!==void 0?o:!1}format(t,s){var n,a,o;if(t==null)return"";try{return Je.DateFormatter.format(t,(n=s?.locale)!==null&&n!==void 0?n:l.getState().uiLocale,(a=s?.longFormat)!==null&&a!==void 0?a:!1,(o=s?.withTime)!==null&&o!==void 0?o:!1)}catch(d){throw console.error(`Date ${JSON.stringify(t)} is not valid`,d),d}}};window.FluidTopicsDateService=new te;var Ze=_(R());var k=class{static get(t,s){var n,a;let o=l.getState(),{lang:d,region:y}=(a=(n=o.defaultLocales)===null||n===void 0?void 0:n.defaultContentLocale)!==null&&a!==void 0?a:{lang:"en",region:"US"};return new Ze.SearchPlaceConverter(o.baseUrl,t??20,o.searchInAllLanguagesAllowed,s??`${d}-${y}`)}};var re=class{urlToSearchRequest(t){return k.get().parse(t)}searchRequestToUrl(t){return k.get().serialize(t)}};window.FluidTopicsUrlService=new re;var L=_(R());var M=class e extends CustomEvent{constructor(t){super(e.eventName,{detail:{currentItem:t}})}};M.eventName="change";var se=class{itemName(t){return`fluid-topics-history-item-${t}`}get(t){let s=sessionStorage.getItem(this.itemName(t));return s?JSON.parse(s):void 0}set(t,s){sessionStorage.setItem(this.itemName(t),JSON.stringify(s))}},et=new se;var $=class e extends L.WithEventBus{static build(){return new e(window.history,et,()=>window.location,!1)}constructor(t,s,n,a){var o,d;super(),this.history=t,this.historyStorage=s,this.windowLocation=n,this.states=[],this.realPushState=t.pushState,this.realReplaceState=t.replaceState,this.initialIndex=(d=(o=t.state)===null||o===void 0?void 0:o.index)!==null&&d!==void 0?d:t.length-1,this.currentIndex=this.initialIndex,this.setCurrentState(this.buildCurrentState()),this.installProxies(),this.initEventListeners(),this.initData(a)}setCurrentState(t,s=!1){let n=s&&this.currentIndex===t.index-1;this.currentState={...this.buildCurrentState(),...t},this.currentIndex=this.currentState.index,this.states[this.currentIndex]=this.currentState,n&&(this.states=this.states.slice(0,this.currentIndex+1)),this.historyStorage.set(this.currentIndex,this.currentState),(0,L.deepEqual)(this.currentState,this.history.state)||this.realReplaceState.apply(this.history,[this.currentState,this.currentState.title,window.location.href]),setTimeout(()=>this.dispatchEvent(new M(this.currentItem())),0)}installProxies(){let t=s=>(n,a,[o,d,y])=>{let S=s(),I={...S===this.currentIndex?this.currentState:void 0,...o,index:S,href:typeof y=="string"?y:(y??this.windowLocation()).href};n.apply(a,[I,d,y]),this.setCurrentState(I,!0)};this.history.pushState=new Proxy(this.history.pushState,{apply:t(()=>this.currentIndex+1)}),this.history.replaceState=new Proxy(this.history.replaceState,{apply:t(()=>this.currentIndex)})}initEventListeners(){window.addEventListener("popstate",t=>this.setCurrentState(t.state)),document.querySelector("title")==null&&document.head.append(document.createElement("title")),new MutationObserver(()=>this.updateCurrentState({title:document.title})).observe(document.querySelector("title"),{subtree:!0,characterData:!0,childList:!0})}initData(t){for(let s=this.history.length-1;s>=0;s--)t?this.states[s]=this.historyStorage.get(s):setTimeout(()=>this.states[s]=this.historyStorage.get(s),this.history.length-s)}updateCurrentState(t){var s;let n={...this.buildCurrentState(),...t,index:this.currentIndex,title:(s=t?.title)!==null&&s!==void 0?s:this.currentState.title};this.setCurrentState(n)}addHistoryChangeListener(t){this.addEventListener(M.eventName,t)}removeHistoryChangeListener(t){this.removeEventListener(M.eventName,t)}currentItem(){return(0,L.deepCopy)(this.currentState)}back(){let t=this.previousDifferentMajorPosition();t>=0?this.history.go(t-this.currentIndex):this.currentIndex!==this.initialIndex?this.history.go(this.initialIndex-this.currentIndex):this.history.back()}backwardItem(){return(0,L.deepCopy)(this.states[this.previousDifferentMajorPosition()])}previousDifferentMajorPosition(){let t=this.currentIndex>0?this.currentIndex-1:0;for(;t>0&&!this.isDifferentMajorState(t);)t--;return t}forward(){let t=this.nextMajorPosition();t&&t<this.states.length?this.history.go(t-this.currentIndex):this.history.forward()}forwardItem(){let t=this.nextMajorPosition();if(t)return(0,L.deepCopy)(this.states[t])}nextMajorPosition(){let t=this.currentIndex;if(!(t>=this.states.length)){do t++;while(t<this.states.length&&!this.isDifferentMajorState(t));return this.getHigherPositionInTheSameState(t)}}getHigherPositionInTheSameState(t){var s;let n=(s=this.states[t])===null||s===void 0?void 0:s.majorStateId;if(!n)return t;let a=t,o=t+1;for(;this.states.length>o&&!this.isDifferentMajorState(o,n);)this.hasState(o)&&(a=o),o++;return a}buildCurrentState(){var t,s;return{...this.history.state,index:this.currentIndex,href:this.windowLocation().href,title:(s=(t=this.history.state)===null||t===void 0?void 0:t.title)!==null&&s!==void 0?s:document.title}}hasState(t){return this.states[t]!=null}isDifferentMajorState(t,s){var n;if(!this.hasState(t))return!1;let a=s??this.currentState.majorStateId,o=(n=this.states[t])===null||n===void 0?void 0:n.majorStateId;return o==null||o!=a}};window.FluidTopicsInternalHistoryService==null&&(window.FluidTopicsInternalHistoryService=$.build(),window.FluidTopicsHistoryService={currentItem:()=>window.FluidTopicsInternalHistoryService.currentItem(),back:()=>window.FluidTopicsInternalHistoryService.back(),forward:()=>window.FluidTopicsInternalHistoryService.forward(),backwardItem:()=>window.FluidTopicsInternalHistoryService.backwardItem(),forwardItem:()=>window.FluidTopicsInternalHistoryService.forwardItem(),addHistoryChangeListener:e=>window.FluidTopicsInternalHistoryService.addHistoryChangeListener(e),removeHistoryChangeListener:e=>window.FluidTopicsInternalHistoryService.removeHistoryChangeListener(e)});function tt(e,t){let{authenticationRequired:s,session:n}=l.getState();return s&&!n?.sessionAuthenticated?Promise.resolve(t):e()}var m=function(e,t,s,n){var a=arguments.length,o=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,s):n,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,s,n);else for(var y=e.length-1;y>=0;y--)(d=e[y])&&(o=(a<3?d(o):a>3?d(t,s,o):d(t,s))||o);return a>3&&o&&Object.defineProperty(t,s,o),o},h=class extends b.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.apiIntegrationAppVersion="ft-integration-app-version",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.navigatorOnline=!1,this.forcedOffline=!1,this.apiProvider=()=>w.get(),this.authenticationRequired=!1,this.messageContexts=[],this.cache=new b.CacheRegistry,this.cleanSessionDebouncer=new b.Debouncer,this.reloadConfiguration=()=>{this.cache.clear("availableContentLocales"),this.updateAvailableContentLocales()}}render(){return rt.html`
4
4
  <slot></slot>
5
- `}connectedCallback(){super.connectedCallback(),g.addEventListener(oe.eventName,this.reloadConfiguration)}disconnectedCallback(){g.addEventListener(oe.eventName,this.reloadConfiguration),super.disconnectedCallback()}update(t){var r,n,i,s,a,o,l;super.update(t),t.has("baseUrl")&&(g.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&g.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("apiIntegrationAppVersion")&&g.actions.apiIntegrationAppVersion(this.apiIntegrationAppVersion),t.has("uiLocale")&&g.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&g.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&g.actions.noCustom(this.noCustom),t.has("editorMode")&&g.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&g.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&g.actions.session(this.session),t.has("messageContexts")&&this.messageContexts!=null&&this.messageContexts.forEach(c=>Yt.addContext(c)),t.has("openExternalDocumentInNewTab")&&g.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("navigatorOnline")&&g.actions.navigatorOnline(this.navigatorOnline),t.has("forcedOffline")&&g.actions.forcedOffline(this.forcedOffline),t.has("localesConfiguration")&&(g.actions.defaultLocales((r=this.localesConfiguration)===null||r===void 0?void 0:r.defaultLocales),g.actions.availableUiLocales((i=(n=this.localesConfiguration)===null||n===void 0?void 0:n.availableUiLocales)!==null&&i!==void 0?i:[]),g.actions.searchInAllLanguagesAllowed((a=(s=this.localesConfiguration)===null||s===void 0?void 0:s.allLanguagesAllowed)!==null&&a!==void 0?a:!1)),t.has("authenticationRequired")&&g.actions.authenticationRequired(this.authenticationRequired),t.has("availableContentLocales")&&g.actions.availableContentLocales((l=(o=this.availableContentLocales)===null||o===void 0?void 0:o.contentLocales)!==null&&l!==void 0?l:[]),setTimeout(()=>this.updateIfNeeded())}async updateIfNeeded(){this.apiProvider()&&(this.withManualResources||(this.session==null&&this.updateSession(),this.metadataConfiguration==null&&this.updateMetadataConfiguration()),this.localesConfiguration==null&&this.updateLocalesConfiguration(),this.availableContentLocales==null&&this.updateAvailableContentLocales())}async updateSession(){this.session=await this.cache.get("session",async()=>{let t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run(()=>{this.cache.clear("session"),this.session=void 0},t.idleTimeoutInMillis),t})}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",()=>this.apiProvider().getMetadataConfiguration())}async updateLocalesConfiguration(){this.localesConfiguration=await this.cache.get("localesConfiguration",()=>this.apiProvider().getLocalesConfiguration())}async updateAvailableContentLocales(){this.availableContentLocales=await this.cache.get("availableContentLocales",()=>Ur(()=>this.apiProvider().getAvailableSearchLocales(),{contentLocales:[]}))}};C.elementDefinitions={};C.styles=$t;D([(0,M.property)()],C.prototype,"baseUrl",void 0);D([(0,M.property)()],C.prototype,"apiIntegrationIdentifier",void 0);D([(0,M.property)()],C.prototype,"apiIntegrationAppVersion",void 0);D([(0,M.property)()],C.prototype,"uiLocale",void 0);D([(0,z.jsonProperty)(null)],C.prototype,"availableUiLocales",void 0);D([(0,z.jsonProperty)(null)],C.prototype,"metadataConfiguration",void 0);D([(0,M.property)({type:Boolean})],C.prototype,"editorMode",void 0);D([(0,M.property)({type:Boolean})],C.prototype,"noCustom",void 0);D([(0,M.property)({type:Boolean})],C.prototype,"openExternalDocumentInNewTab",void 0);D([(0,M.property)({converter:{fromAttribute(e){return e==="false"?!1:e==="true"||(e??!1)}}})],C.prototype,"noCustomComponent",void 0);D([(0,M.property)({type:Boolean})],C.prototype,"withManualResources",void 0);D([(0,M.property)({type:Boolean})],C.prototype,"navigatorOnline",void 0);D([(0,M.property)({type:Boolean})],C.prototype,"forcedOffline",void 0);D([(0,M.property)({type:Object})],C.prototype,"apiProvider",void 0);D([(0,M.property)({type:Boolean})],C.prototype,"authenticationRequired",void 0);D([(0,z.jsonProperty)([])],C.prototype,"messageContexts",void 0);D([(0,z.jsonProperty)(void 0)],C.prototype,"session",void 0);D([(0,M.state)()],C.prototype,"localesConfiguration",void 0);D([(0,M.state)()],C.prototype,"availableContentLocales",void 0);var Ut=I(ye());function Wn(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;let r,n,i;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(!Ve(e[n],t[n]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(n of e.entries())if(!t.has(n[0]))return!1;for(n of e.entries())if(!Ve(n[1],t.get(n[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(n of e.entries())if(!t.has(n[0]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();let s=a=>Object.keys(a).filter(o=>a[o]!=null);if(i=s(e),r=i.length,r!==s(t).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[n]))return!1;for(n=r;n--!==0;){let a=i[n];if(!Ve(e[a],t[a]))return!1}return!0}return e!==e&&t!==t||e==null&&t==null}function Ve(e,t){try{return Wn(e,t)}catch{return!1}}function xe(e,t){return!Ve(e,t)}function jr(e){return typeof window.structuredClone=="function"?structuredClone(e):e!=null?JSON.parse(JSON.stringify(e)):e}function Ke(e,t){let r=n=>n[e]===!0;return n=>{if(r(n))return n;let i=t(n);return i[e]=!0,i}}var Br=I(ye(),1);var pt=e=>{let t=e??{};return(r,n)=>{var i;let s={hasChanged:xe,attribute:!1,...t};(0,Br.property)(s)(r,n);let a=r.constructor;a.reduxProperties=new Map(a.reduxProperties),a.reduxProperties.set(n,{selector:(i=t.selector)!==null&&i!==void 0?i:o=>o[n],store:t.store})}};var qe=class{constructor(){this.queue=[]}add(t,r=!1){r&&this.clear(t.type),this.queue.push(t)}consume(t){let r=this.queue.find(n=>n.type===t);return r&&(this.queue=this.queue.filter(n=>n!==r)),r}clear(t){typeof t=="string"?this.queue=this.queue.filter(r=>r.type!==t):this.queue=this.queue.filter(r=>!t.test(r.type))}};var le=I(ye(),1);var Hr=I(ye(),1);function Vr(e,t){let r=()=>JSON.parse(JSON.stringify(e));return(0,Hr.property)({type:Object,converter:{fromAttribute:n=>{if(n==null)return r();try{return JSON.parse(n)}catch{return r()}},toAttribute:n=>JSON.stringify(n)},hasChanged:xe,...t??{}})}var Ge=class{constructor(t=0){this.timeout=t,this.callbacks=[]}run(t,r){return this.callbacks=[t],this.debounce(r)}queue(t,r){return this.callbacks.push(t),this.debounce(r)}cancel(){this.clearTimeout(),this.resolvePromise&&this.resolvePromise(!1),this.clearPromise()}debounce(t){return this.promise==null&&(this.promise=new Promise((r,n)=>{this.resolvePromise=r,this.rejectPromise=n})),this.clearTimeout(),this._debounce=window.setTimeout(()=>this.runCallbacks(),t??this.timeout),this.promise}async runCallbacks(){var t,r;let n=[...this.callbacks];this.callbacks=[];let i=(t=this.rejectPromise)!==null&&t!==void 0?t:()=>null,s=(r=this.resolvePromise)!==null&&r!==void 0?r:()=>null;this.clearPromise();for(let a of n)try{await a()}catch(o){i(o);return}s(!0)}clearTimeout(){this._debounce!=null&&window.clearTimeout(this._debounce)}clearPromise(){this.promise=void 0,this.resolvePromise=void 0,this.rejectPromise=void 0}};var qr=I(Le(),1);var ze=globalThis,Yn=ze.ShadowRoot&&(ze.ShadyCSS===void 0||ze.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ba=Symbol();var Kr=(e,t)=>{if(Yn)e.adoptedStyleSheets=t.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(let r of t){let n=document.createElement("style"),i=ze.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=r.cssText,e.appendChild(n)}};var $e=class extends qr.LitElement{createRenderRoot(){let t=this.constructor;t.elementDefinitions&&!t.registry&&(t.registry=new CustomElementRegistry,Object.entries(t.elementDefinitions).forEach(([i,s])=>t.registry.define(i,s)));let r={...t.shadowRootOptions,customElements:t.registry},n=this.renderOptions.creationScope=this.attachShadow(r);return Kr(n,t.elementStyles),n}};function Gr(e,t,...r){var n;let i=e.querySelector(t);for(let s of r)i=(n=i?.shadowRoot)===null||n===void 0?void 0:n.querySelector(s);return i}var be=function(e,t,r,n){var i=arguments.length,s=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(i<3?a(s):i>3?a(t,r,s):a(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},Yr,zr=Symbol("constructorPrototype"),$r=Symbol("constructorName"),Xr=Symbol("exportpartsDebouncer"),Wr=Symbol("dynamicDependenciesLoaded"),ge=class e extends CustomEvent{constructor(){super(e.eventName,{bubbles:!0})}};ge.eventName="exportparts-updated";var W=class extends $e{constructor(){super(),this.useAdoptedStyleSheets=!0,this.adoptedCustomStyleSheet=new CSSStyleSheet,this[Yr]=new Ge(5),this.scheduleExportpartsUpdate=()=>{var t,r,n;(!((t=this.exportpartsPrefix)===null||t===void 0)&&t.trim()||(n=(r=this.exportpartsPrefixes)===null||r===void 0?void 0:r.length)!==null&&n!==void 0&&n)&&this[Xr].run(()=>{var i,s;!((i=this.exportpartsPrefix)===null||i===void 0)&&i.trim()?this.setExportpartsAttribute([this.exportpartsPrefix]):this.exportpartsPrefixes!=null&&((s=this.exportpartsPrefixes)===null||s===void 0?void 0:s.length)>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)})},this[$r]=this.constructor.name,this[zr]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[$r]&&Object.setPrototypeOf(this,this[zr])}connectedCallback(){var t;super.connectedCallback();try{this.shadowRoot&&!this.shadowRoot.adoptedStyleSheets.includes(this.adoptedCustomStyleSheet)&&(this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,this.adoptedCustomStyleSheet]),this.useAdoptedStyleSheets=!0}catch(n){this.useAdoptedStyleSheets=!1,console.error("Cannot use adopted stylesheets",n)}let r=this.constructor;r[Wr]||(r[Wr]=!0,this.importDynamicDependencies()),(t=this.shadowRoot)===null||t===void 0||t.addEventListener(ge.eventName,this.scheduleExportpartsUpdate)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.shadowRoot)===null||t===void 0||t.removeEventListener(ge.eventName,this.scheduleExportpartsUpdate)}importDynamicDependencies(){}updated(t){super.updated(t),this.updateComplete.then(()=>{this.contentAvailableCallback(t),this.focusElementToFocus(t),this.applyCustomStylesheet(t),this.scheduleExportpartsUpdate(),t.has("exportparts")&&this.dispatchEvent(new ge)})}contentAvailableCallback(t){}focusElementToFocus(t){if(t.has("elementToFocus")&&this.elementToFocus!=null){let{element:r,selector:n,shadowPath:i}=this.elementToFocus;if(n!=null){let s=[...i??[],n];r=Gr(this.shadowRoot,...s)}r?.focus(),window.FluidTopicsA11yHints.isKeyboardNavigation||r?.blur(),this.elementToFocus=void 0}}applyCustomStylesheet(t){var r,n,i;if(((n=(r=this.shadowRoot)===null||r===void 0?void 0:r.querySelectorAll(".ft-lit-element--custom-stylesheet"))!==null&&n!==void 0?n:[]).forEach(s=>s.remove()),this.useAdoptedStyleSheets){if(t.has("customStylesheet"))try{this.adoptedCustomStyleSheet.replaceSync((i=this.customStylesheet)!==null&&i!==void 0?i:"")}catch(s){console.error(s,this.customStylesheet),this.useAdoptedStyleSheets=!1}}else if(this.customStylesheet){let s=document.createElement("style");s.classList.add("ft-lit-element--custom-stylesheet"),s.innerHTML=this.customStylesheet,this.shadowRoot.append(s)}}setExportpartsAttribute(t){var r,n,i,s,a,o;let l=h=>h!=null&&h.trim().length>0,c=t.filter(l).map(h=>h.trim());if(c.length===0){this.exportparts=void 0;return}let f=new Set;for(let h of(n=(r=this.shadowRoot)===null||r===void 0?void 0:r.querySelectorAll("[part],[exportparts]"))!==null&&n!==void 0?n:[]){let v=(s=(i=h.getAttribute("part"))===null||i===void 0?void 0:i.split(" "))!==null&&s!==void 0?s:[],y=(o=(a=h.getAttribute("exportparts"))===null||a===void 0?void 0:a.split(",").map(A=>A.split(":")[1]))!==null&&o!==void 0?o:[],m=[...v,...y].filter(l).map(A=>A.trim());for(let A of m)f.add(A)}if(f.size===0){this.exportparts=void 0;return}let p=[...f.values()].flatMap(h=>c.map(v=>`${h}:${v}--${h}`));this.exportparts=[...this.part,...p].join(", ")}};Yr=Xr;be([(0,le.property)()],W.prototype,"exportpartsPrefix",void 0);be([Vr([])],W.prototype,"exportpartsPrefixes",void 0);be([(0,le.property)({reflect:!0})],W.prototype,"exportparts",void 0);be([(0,le.property)()],W.prototype,"customStylesheet",void 0);be([(0,le.property)()],W.prototype,"elementToFocus",void 0);be([(0,le.state)()],W.prototype,"useAdoptedStyleSheets",void 0);function We(e){var t;return(t=e?.isFtReduxStore)!==null&&t!==void 0?t:!1}var Ce=Symbol("internalReduxEventsUnsubscribers"),Z=Symbol("internalStoresUnsubscribers"),de=Symbol("internalStores"),Xn=Ke(Symbol("withRedux"),function(e){var t,r,n;class i extends e{constructor(){super(...arguments),this[t]=new Map,this[r]=new Map,this[n]=new Map}get reduxConstructor(){return this.constructor}willUpdate(a){super.willUpdate(a),[...this.reduxConstructor.reduxReactiveProperties].some(o=>a.has(o))&&this.updateFromStores()}getUnnamedStore(){if(this[de].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[de].values()][0]}getStore(a){return a==null?this.getUnnamedStore():this[de].get(a)}addStore(a,o){var l;o=(l=o??a.name)!==null&&l!==void 0?l:"default-store",this.unsubscribeFromStore(o),this[de].set(o,a),this.subscribeToStore(o,a),this.updateFromStores()}removeStore(a){let o=typeof a=="string"?a:a.name;this.unsubscribeFromStore(o),this[de].delete(o)}setupStores(){this.unsubscribeFromStores(),this[de].forEach((a,o)=>this.subscribeToStore(o,a)),this.updateFromStores()}updateFromStores(){this.reduxConstructor.reduxProperties.forEach((a,o)=>{let l=this.constructor.getPropertyOptions(o);if(!l?.attribute||!this.hasAttribute(typeof l?.attribute=="string"?l.attribute:o)){let c=this.getStore(a.store);c&&(a.store?this[Z].has(a.store):this[Z].size>0)&&(this[o]=a.selector(c.getState(),this))}})}subscribeToStore(a,o){var l;this[Z].set(a,o.subscribe(()=>this.updateFromStores())),this[Ce].set(a,[]),We(o)&&o.eventBus&&((l=this.reduxConstructor.reduxEventListeners)===null||l===void 0||l.forEach((c,f)=>{if(typeof this[f]=="function"&&(!c.store||o.name===c.store)){let p=h=>this[f](h);o.addEventListener(c.eventName,p),this[Ce].get(a).push(()=>o.removeEventListener(c.eventName,p))}})),this.onStoreAvailable(a)}unsubscribeFromStores(){this[Z].forEach((a,o)=>this.unsubscribeFromStore(o))}unsubscribeFromStore(a){var o;this[Z].has(a)&&this[Z].get(a)(),this[Z].delete(a),(o=this[Ce].get(a))===null||o===void 0||o.forEach(l=>l()),this[Ce].delete(a)}onStoreAvailable(a){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}return t=Z,r=de,n=Ce,i.reduxProperties=new Map,i.reduxReactiveProperties=new Set,i.reduxEventListeners=new Map,i}),Jr=class extends Xn(W){};function q(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(0)var i,s;throw Error("[Immer] minified error nr: "+e+(r.length?" "+r.map(function(a){return"'"+a+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function X(e){return!!e&&!!e[_]}function $(e){var t;return!!e&&(function(r){if(!r||typeof r!="object")return!1;var n=Object.getPrototypeOf(r);if(n===null)return!0;var i=Object.hasOwnProperty.call(n,"constructor")&&n.constructor;return i===Object||typeof i=="function"&&Function.toString.call(i)===ii}(e)||Array.isArray(e)||!!e[sn]||!!(!((t=e.constructor)===null||t===void 0)&&t[sn])||Et(e)||wt(e))}function fe(e,t,r){r===void 0&&(r=!1),Ee(e)===0?(r?Object.keys:Se)(e).forEach(function(n){r&&typeof n=="symbol"||t(n,e[n],e)}):e.forEach(function(n,i){return t(i,n,e)})}function Ee(e){var t=e[_];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:Et(e)?2:wt(e)?3:0}function Ae(e,t){return Ee(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Jn(e,t){return Ee(e)===2?e.get(t):e[t]}function an(e,t,r){var n=Ee(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function on(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function Et(e){return ri&&e instanceof Map}function wt(e){return ni&&e instanceof Set}function ee(e){return e.o||e.t}function Ot(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=ln(e);delete t[_];for(var r=Se(t),n=0;n<r.length;n++){var i=r[n],s=t[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(t[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function Tt(e,t){return t===void 0&&(t=!1),xt(e)||X(e)||!$(e)||(Ee(e)>1&&(e.set=e.add=e.clear=e.delete=Qn),Object.freeze(e),t&&fe(e,function(r,n){return Tt(n,!0)},!0)),e}function Qn(){q(2)}function xt(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function Y(e){var t=St[e];return t||q(18,e),t}function Zn(e,t){St[e]||(St[e]=t)}function gt(){return Re}function ht(e,t){t&&(Y("Patches"),e.u=[],e.s=[],e.v=t)}function Ye(e){bt(e),e.p.forEach(ei),e.p=null}function bt(e){e===Re&&(Re=e.l)}function Qr(e){return Re={p:[],l:Re,h:e,m:!0,_:0}}function ei(e){var t=e[_];t.i===0||t.i===1?t.j():t.g=!0}function yt(e,t){t._=t.p.length;var r=t.p[0],n=e!==void 0&&e!==r;return t.h.O||Y("ES5").S(t,e,n),n?(r[_].P&&(Ye(t),q(4)),$(e)&&(e=Xe(t,e),t.l||Je(t,e)),t.u&&Y("Patches").M(r[_].t,e,t.u,t.s)):e=Xe(t,r,[]),Ye(t),t.u&&t.v(t.u,t.s),e!==cn?e:void 0}function Xe(e,t,r){if(xt(t))return t;var n=t[_];if(!n)return fe(t,function(o,l){return Zr(e,n,t,o,l,r)},!0),t;if(n.A!==e)return t;if(!n.P)return Je(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var i=n.i===4||n.i===5?n.o=Ot(n.k):n.o,s=i,a=!1;n.i===3&&(s=new Set(i),i.clear(),a=!0),fe(s,function(o,l){return Zr(e,n,i,o,l,r,a)}),Je(e,i,!1),r&&e.u&&Y("Patches").N(n,r,e.u,e.s)}return n.o}function Zr(e,t,r,n,i,s,a){if(X(i)){var o=Xe(e,i,s&&t&&t.i!==3&&!Ae(t.R,n)?s.concat(n):void 0);if(an(r,n,o),!X(o))return;e.m=!1}else a&&r.add(i);if($(i)&&!xt(i)){if(!e.h.D&&e._<1)return;Xe(e,i),t&&t.A.l||Je(e,i)}}function Je(e,t,r){r===void 0&&(r=!1),!e.l&&e.h.D&&e.m&&Tt(t,r)}function mt(e,t){var r=e[_];return(r?ee(r):e)[t]}function en(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function te(e){e.P||(e.P=!0,e.l&&te(e.l))}function vt(e){e.o||(e.o=Ot(e.t))}function At(e,t,r){var n=Et(t)?Y("MapSet").F(t,r):wt(t)?Y("MapSet").T(t,r):e.O?function(i,s){var a=Array.isArray(i),o={i:a?1:0,A:s?s.A:gt(),P:!1,I:!1,R:{},l:s,t:i,k:null,o:null,j:null,C:!1},l=o,c=Ie;a&&(l=[o],c=_e);var f=Proxy.revocable(l,c),p=f.revoke,h=f.proxy;return o.k=h,o.j=p,h}(t,r):Y("ES5").J(t,r);return(r?r.A:gt()).p.push(n),n}function ti(e){return X(e)||q(22,e),function t(r){if(!$(r))return r;var n,i=r[_],s=Ee(r);if(i){if(!i.P&&(i.i<4||!Y("ES5").K(i)))return i.t;i.I=!0,n=tn(r,s),i.I=!1}else n=tn(r,s);return fe(n,function(a,o){i&&Jn(i.t,a)===o||an(n,a,t(o))}),s===3?new Set(n):n}(e)}function tn(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Ot(e)}function un(){function e(a,o){var l=s[a];return l?l.enumerable=o:s[a]=l={configurable:!0,enumerable:o,get:function(){var c=this[_];return Ie.get(c,a)},set:function(c){var f=this[_];Ie.set(f,a,c)}},l}function t(a){for(var o=a.length-1;o>=0;o--){var l=a[o][_];if(!l.P)switch(l.i){case 5:n(l)&&te(l);break;case 4:r(l)&&te(l)}}}function r(a){for(var o=a.t,l=a.k,c=Se(l),f=c.length-1;f>=0;f--){var p=c[f];if(p!==_){var h=o[p];if(h===void 0&&!Ae(o,p))return!0;var v=l[p],y=v&&v[_];if(y?y.t!==h:!on(v,h))return!0}}var m=!!o[_];return c.length!==Se(o).length+(m?0:1)}function n(a){var o=a.k;if(o.length!==a.t.length)return!0;var l=Object.getOwnPropertyDescriptor(o,o.length-1);if(l&&!l.get)return!0;for(var c=0;c<o.length;c++)if(!o.hasOwnProperty(c))return!0;return!1}function i(a){a.g&&q(3,JSON.stringify(ee(a)))}var s={};Zn("ES5",{J:function(a,o){var l=Array.isArray(a),c=function(p,h){if(p){for(var v=Array(h.length),y=0;y<h.length;y++)Object.defineProperty(v,""+y,e(y,!0));return v}var m=ln(h);delete m[_];for(var A=Se(m),S=0;S<A.length;S++){var E=A[S];m[E]=e(E,p||!!m[E].enumerable)}return Object.create(Object.getPrototypeOf(h),m)}(l,a),f={i:l?5:4,A:o?o.A:gt(),P:!1,I:!1,R:{},l:o,t:a,k:c,o:null,g:!1,C:!1};return Object.defineProperty(c,_,{value:f,writable:!0}),c},S:function(a,o,l){l?X(o)&&o[_].A===a&&t(a.p):(a.u&&function c(f){if(f&&typeof f=="object"){var p=f[_];if(p){var h=p.t,v=p.k,y=p.R,m=p.i;if(m===4)fe(v,function(O){O!==_&&(h[O]!==void 0||Ae(h,O)?y[O]||c(v[O]):(y[O]=!0,te(p)))}),fe(h,function(O){v[O]!==void 0||Ae(v,O)||(y[O]=!1,te(p))});else if(m===5){if(n(p)&&(te(p),y.length=!0),v.length<h.length)for(var A=v.length;A<h.length;A++)y[A]=!1;else for(var S=h.length;S<v.length;S++)y[S]=!0;for(var E=Math.min(v.length,h.length),x=0;x<E;x++)v.hasOwnProperty(x)||(y[x]=!0),y[x]===void 0&&c(v[x])}}}}(a.p[0]),t(a.p))},K:function(a){return a.i===4?r(a):n(a)}})}var rn,Re,Ct=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",ri=typeof Map<"u",ni=typeof Set<"u",nn=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",cn=Ct?Symbol.for("immer-nothing"):((rn={})["immer-nothing"]=!0,rn),sn=Ct?Symbol.for("immer-draftable"):"__$immer_draftable",_=Ct?Symbol.for("immer-state"):"__$immer_state";var ii=""+Object.prototype.constructor,Se=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,ln=Object.getOwnPropertyDescriptors||function(e){var t={};return Se(e).forEach(function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)}),t},St={},Ie={get:function(e,t){if(t===_)return e;var r=ee(e);if(!Ae(r,t))return function(i,s,a){var o,l=en(s,a);return l?"value"in l?l.value:(o=l.get)===null||o===void 0?void 0:o.call(i.k):void 0}(e,r,t);var n=r[t];return e.I||!$(n)?n:n===mt(e.t,t)?(vt(e),e.o[t]=At(e.A.h,n,e)):n},has:function(e,t){return t in ee(e)},ownKeys:function(e){return Reflect.ownKeys(ee(e))},set:function(e,t,r){var n=en(ee(e),t);if(n?.set)return n.set.call(e.k,r),!0;if(!e.P){var i=mt(ee(e),t),s=i?.[_];if(s&&s.t===r)return e.o[t]=r,e.R[t]=!1,!0;if(on(r,i)&&(r!==void 0||Ae(e.t,t)))return!0;vt(e),te(e)}return e.o[t]===r&&(r!==void 0||t in e.o)||Number.isNaN(r)&&Number.isNaN(e.o[t])||(e.o[t]=r,e.R[t]=!0),!0},deleteProperty:function(e,t){return mt(e.t,t)!==void 0||t in e.t?(e.R[t]=!1,vt(e),te(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=ee(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.i!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty:function(){q(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){q(12)}},_e={};fe(Ie,function(e,t){_e[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),_e.deleteProperty=function(e,t){return _e.set.call(this,e,t,void 0)},_e.set=function(e,t,r){return Ie.set.call(this,e[0],t,r,e[0])};var si=function(){function e(r){var n=this;this.O=nn,this.D=!0,this.produce=function(i,s,a){if(typeof i=="function"&&typeof s!="function"){var o=s;s=i;var l=n;return function(m){var A=this;m===void 0&&(m=o);for(var S=arguments.length,E=Array(S>1?S-1:0),x=1;x<S;x++)E[x-1]=arguments[x];return l.produce(m,function(O){var L;return(L=s).call.apply(L,[A,O].concat(E))})}}var c;if(typeof s!="function"&&q(6),a!==void 0&&typeof a!="function"&&q(7),$(i)){var f=Qr(n),p=At(n,i,void 0),h=!0;try{c=s(p),h=!1}finally{h?Ye(f):bt(f)}return typeof Promise<"u"&&c instanceof Promise?c.then(function(m){return ht(f,a),yt(m,f)},function(m){throw Ye(f),m}):(ht(f,a),yt(c,f))}if(!i||typeof i!="object"){if((c=s(i))===void 0&&(c=i),c===cn&&(c=void 0),n.D&&Tt(c,!0),a){var v=[],y=[];Y("Patches").M(i,c,v,y),a(v,y)}return c}q(21,i)},this.produceWithPatches=function(i,s){if(typeof i=="function")return function(c){for(var f=arguments.length,p=Array(f>1?f-1:0),h=1;h<f;h++)p[h-1]=arguments[h];return n.produceWithPatches(c,function(v){return i.apply(void 0,[v].concat(p))})};var a,o,l=n.produce(i,s,function(c,f){a=c,o=f});return typeof Promise<"u"&&l instanceof Promise?l.then(function(c){return[c,a,o]}):[l,a,o]},typeof r?.useProxies=="boolean"&&this.setUseProxies(r.useProxies),typeof r?.autoFreeze=="boolean"&&this.setAutoFreeze(r.autoFreeze)}var t=e.prototype;return t.createDraft=function(r){$(r)||q(8),X(r)&&(r=ti(r));var n=Qr(this),i=At(this,r,void 0);return i[_].C=!0,bt(n),i},t.finishDraft=function(r,n){var i=r&&r[_],s=i.A;return ht(s,n),yt(void 0,s)},t.setAutoFreeze=function(r){this.D=r},t.setUseProxies=function(r){r&&!nn&&q(20),this.O=r},t.applyPatches=function(r,n){var i;for(i=n.length-1;i>=0;i--){var s=n[i];if(s.path.length===0&&s.op==="replace"){r=s.value;break}}i>-1&&(n=n.slice(i+1));var a=Y("Patches").$;return X(r)?a(r,n):this.produce(r,function(o){return a(o,n)})},e}(),H=new si,ai=H.produce,ka=H.produceWithPatches.bind(H),Ma=H.setAutoFreeze.bind(H),Na=H.setUseProxies.bind(H),Ua=H.applyPatches.bind(H),Fa=H.createDraft.bind(H),ja=H.finishDraft.bind(H),Qe=ai;function pe(e){"@babel/helpers - typeof";return pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pe(e)}function dn(e,t){if(pe(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(pe(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fn(e){var t=dn(e,"string");return pe(t)=="symbol"?t:t+""}function pn(e,t,r){return(t=fn(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _t(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hn(Object(r),!0).forEach(function(n){pn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function U(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var yn=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Rt=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ze={INIT:"@@redux/INIT"+Rt(),REPLACE:"@@redux/REPLACE"+Rt(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Rt()}};function oi(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function It(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(U(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(U(1));return r(It)(e,t)}if(typeof e!="function")throw new Error(U(2));var i=e,s=t,a=[],o=a,l=!1;function c(){o===a&&(o=a.slice())}function f(){if(l)throw new Error(U(3));return s}function p(m){if(typeof m!="function")throw new Error(U(4));if(l)throw new Error(U(5));var A=!0;return c(),o.push(m),function(){if(A){if(l)throw new Error(U(6));A=!1,c();var E=o.indexOf(m);o.splice(E,1),a=null}}}function h(m){if(!oi(m))throw new Error(U(7));if(typeof m.type>"u")throw new Error(U(8));if(l)throw new Error(U(9));try{l=!0,s=i(s,m)}finally{l=!1}for(var A=a=o,S=0;S<A.length;S++){var E=A[S];E()}return m}function v(m){if(typeof m!="function")throw new Error(U(10));i=m,h({type:Ze.REPLACE})}function y(){var m,A=p;return m={subscribe:function(E){if(typeof E!="object"||E===null)throw new Error(U(11));function x(){E.next&&E.next(f())}x();var O=A(x);return{unsubscribe:O}}},m[yn]=function(){return this},m}return h({type:Ze.INIT}),n={dispatch:h,subscribe:p,getState:f,replaceReducer:v},n[yn]=y,n}function ui(e){Object.keys(e).forEach(function(t){var r=e[t],n=r(void 0,{type:Ze.INIT});if(typeof n>"u")throw new Error(U(12));if(typeof r(void 0,{type:Ze.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(U(13))})}function mn(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++){var i=t[n];typeof e[i]=="function"&&(r[i]=e[i])}var s=Object.keys(r),a,o;try{ui(r)}catch(l){o=l}return function(c,f){if(c===void 0&&(c={}),o)throw o;if(0)var p;for(var h=!1,v={},y=0;y<s.length;y++){var m=s[y],A=r[m],S=c[m],E=A(S,f);if(typeof E>"u"){var x=f&&f.type;throw new Error(U(14))}v[m]=E,h=h||E!==S}return h=h||s.length!==Object.keys(c).length,h?v:c}}function we(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.length===0?function(n){return n}:t.length===1?t[0]:t.reduce(function(n,i){return function(){return n(i.apply(void 0,arguments))}})}function vn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return function(){var i=n.apply(void 0,arguments),s=function(){throw new Error(U(15))},a={getState:i.getState,dispatch:function(){return s.apply(void 0,arguments)}},o=t.map(function(l){return l(a)});return s=we.apply(void 0,o)(i.dispatch),_t(_t({},i),{},{dispatch:s})}}}function gn(e){var t=function(n){var i=n.dispatch,s=n.getState;return function(a){return function(o){return typeof o=="function"?o(i,s,e):a(o)}}};return t}var bn=gn();bn.withExtraArgument=gn;var Pt=bn;var On=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),ci=function(e,t){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(c){return function(f){return l([c,f])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){r.label=c[1];break}if(c[0]===6&&r.label<s[1]){r.label=s[1],s=c;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(c);break}s[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(f){c=[6,f],i=0}finally{n=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Oe=function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e},li=Object.defineProperty,di=Object.defineProperties,fi=Object.getOwnPropertyDescriptors,An=Object.getOwnPropertySymbols,pi=Object.prototype.hasOwnProperty,hi=Object.prototype.propertyIsEnumerable,Sn=function(e,t,r){return t in e?li(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},re=function(e,t){for(var r in t||(t={}))pi.call(t,r)&&Sn(e,r,t[r]);if(An)for(var n=0,i=An(t);n<i.length;n++){var r=i[n];hi.call(t,r)&&Sn(e,r,t[r])}return e},Dt=function(e,t){return di(e,fi(t))},yi=function(e,t,r){return new Promise(function(n,i){var s=function(l){try{o(r.next(l))}catch(c){i(c)}},a=function(l){try{o(r.throw(l))}catch(c){i(c)}},o=function(l){return l.done?n(l.value):Promise.resolve(l.value).then(s,a)};o((r=r.apply(e,t)).next())})};var mi=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?we:we.apply(null,arguments)},no=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}};function vi(e){if(typeof e!="object"||e===null)return!1;var t=Object.getPrototypeOf(e);if(t===null)return!0;for(var r=t;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return t===r}var gi=function(e){On(t,e);function t(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=e.apply(this,r)||this;return Object.setPrototypeOf(i,t.prototype),i}return Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return e.prototype.concat.apply(this,r)},t.prototype.prepend=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.length===1&&Array.isArray(r[0])?new(t.bind.apply(t,Oe([void 0],r[0].concat(this)))):new(t.bind.apply(t,Oe([void 0],r.concat(this))))},t}(Array),bi=function(e){On(t,e);function t(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=e.apply(this,r)||this;return Object.setPrototypeOf(i,t.prototype),i}return Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return e.prototype.concat.apply(this,r)},t.prototype.prepend=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.length===1&&Array.isArray(r[0])?new(t.bind.apply(t,Oe([void 0],r[0].concat(this)))):new(t.bind.apply(t,Oe([void 0],r.concat(this))))},t}(Array);function Mt(e){return $(e)?Qe(e,function(){}):e}function Ai(e){return typeof e=="boolean"}function Si(){return function(t){return Ei(t)}}function Ei(e){e===void 0&&(e={});var t=e.thunk,r=t===void 0?!0:t,n=e.immutableCheck,i=n===void 0?!0:n,s=e.serializableCheck,a=s===void 0?!0:s,o=new gi;if(r&&(Ai(r)?o.push(Pt):o.push(Pt.withExtraArgument(r.extraArgument))),0){if(i)var l;if(a)var c}return o}var Lt=!0;function Tn(e){var t=Si(),r=e||{},n=r.reducer,i=n===void 0?void 0:n,s=r.middleware,a=s===void 0?t():s,o=r.devTools,l=o===void 0?!0:o,c=r.preloadedState,f=c===void 0?void 0:c,p=r.enhancers,h=p===void 0?void 0:p,v;if(typeof i=="function")v=i;else if(vi(i))v=mn(i);else throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');var y=a;if(typeof y=="function"&&(y=y(t),!Lt&&!Array.isArray(y)))throw new Error("when using a middleware builder function, an array of middleware must be returned");if(!Lt&&y.some(function(O){return typeof O!="function"}))throw new Error("each middleware provided to configureStore must be a function");var m=vn.apply(void 0,y),A=we;l&&(A=mi(re({trace:!Lt},typeof l=="object"&&l)));var S=new bi(m),E=S;Array.isArray(h)?E=Oe([m],h):typeof h=="function"&&(E=h(S));var x=A.apply(void 0,E);return It(v,f,x)}function ne(e,t){function r(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var s=t.apply(void 0,n);if(!s)throw new Error("prepareAction did not return an object");return re(re({type:e,payload:s.payload},"meta"in s&&{meta:s.meta}),"error"in s&&{error:s.error})}return{type:e,payload:n[0]}}return r.toString=function(){return""+e},r.type=e,r.match=function(n){return n.type===e},r}function xn(e){var t={},r=[],n,i={addCase:function(s,a){var o=typeof s=="string"?s:s.type;if(o in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[o]=a,i},addMatcher:function(s,a){return r.push({matcher:s,reducer:a}),i},addDefaultCase:function(s){return n=s,i}};return e(i),[t,r,n]}function wi(e){return typeof e=="function"}function Oi(e,t,r,n){r===void 0&&(r=[]);var i=typeof t=="function"?xn(t):[t,r,n],s=i[0],a=i[1],o=i[2],l;if(wi(e))l=function(){return Mt(e())};else{var c=Mt(e);l=function(){return c}}function f(p,h){p===void 0&&(p=l());var v=Oe([s[h.type]],a.filter(function(y){var m=y.matcher;return m(h)}).map(function(y){var m=y.reducer;return m}));return v.filter(function(y){return!!y}).length===0&&(v=[o]),v.reduce(function(y,m){if(m)if(X(y)){var A=y,S=m(A,h);return S===void 0?y:S}else{if($(y))return Qe(y,function(E){return m(E,h)});var S=m(y,h);if(S===void 0){if(y===null)return y;throw Error("A case reducer on a non-draftable value must not return undefined")}return S}return y},p)}return f.getInitialState=l,f}function Ti(e,t){return e+"/"+t}function Cn(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");typeof process<"u";var r=typeof e.initialState=="function"?e.initialState:Mt(e.initialState),n=e.reducers||{},i=Object.keys(n),s={},a={},o={};i.forEach(function(f){var p=n[f],h=Ti(t,f),v,y;"reducer"in p?(v=p.reducer,y=p.prepare):v=p,s[f]=v,a[h]=v,o[f]=y?ne(h,y):ne(h)});function l(){var f=typeof e.extraReducers=="function"?xn(e.extraReducers):[e.extraReducers],p=f[0],h=p===void 0?{}:p,v=f[1],y=v===void 0?[]:v,m=f[2],A=m===void 0?void 0:m,S=re(re({},h),a);return Oi(r,function(E){for(var x in S)E.addCase(x,S[x]);for(var O=0,L=y;O<L.length;O++){var G=L[O];E.addMatcher(G.matcher,G.reducer)}A&&E.addDefaultCase(A)})}var c;return{name:t,reducer:function(f,p){return c||(c=l()),c(f,p)},actions:o,caseReducers:s,getInitialState:function(){return c||(c=l()),c.getInitialState()}}}var xi="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Ci=function(e){e===void 0&&(e=21);for(var t="",r=e;r--;)t+=xi[Math.random()*64|0];return t},_i=["name","message","stack","code"],kt=function(){function e(t,r){this.payload=t,this.meta=r}return e}(),En=function(){function e(t,r){this.payload=t,this.meta=r}return e}(),Ri=function(e){if(typeof e=="object"&&e!==null){for(var t={},r=0,n=_i;r<n.length;r++){var i=n[r];typeof e[i]=="string"&&(t[i]=e[i])}return t}return{message:String(e)}},oo=function(){function e(t,r,n){var i=ne(t+"/fulfilled",function(f,p,h,v){return{payload:f,meta:Dt(re({},v||{}),{arg:h,requestId:p,requestStatus:"fulfilled"})}}),s=ne(t+"/pending",function(f,p,h){return{payload:void 0,meta:Dt(re({},h||{}),{arg:p,requestId:f,requestStatus:"pending"})}}),a=ne(t+"/rejected",function(f,p,h,v,y){return{payload:v,error:(n&&n.serializeError||Ri)(f||"Rejected"),meta:Dt(re({},y||{}),{arg:h,requestId:p,rejectedWithValue:!!v,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"})}}),o=!1,l=typeof AbortController<"u"?AbortController:function(){function f(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return f.prototype.abort=function(){},f}();function c(f){return function(p,h,v){var y=n?.idGenerator?n.idGenerator(f):Ci(),m=new l,A,S=!1;function E(O){A=O,m.abort()}var x=function(){return yi(this,null,function(){var O,L,G,ie,F,se,he;return ci(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,5]),ie=(O=n?.condition)==null?void 0:O.call(n,f,{getState:h,extra:v}),Pi(ie)?[4,ie]:[3,2];case 1:ie=u.sent(),u.label=2;case 2:if(ie===!1||m.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return S=!0,F=new Promise(function(d,b){return m.signal.addEventListener("abort",function(){return b({name:"AbortError",message:A||"Aborted"})})}),p(s(y,f,(L=n?.getPendingMeta)==null?void 0:L.call(n,{requestId:y,arg:f},{getState:h,extra:v}))),[4,Promise.race([F,Promise.resolve(r(f,{dispatch:p,getState:h,extra:v,requestId:y,signal:m.signal,abort:E,rejectWithValue:function(d,b){return new kt(d,b)},fulfillWithValue:function(d,b){return new En(d,b)}})).then(function(d){if(d instanceof kt)throw d;return d instanceof En?i(d.payload,y,f,d.meta):i(d,y,f)})])];case 3:return G=u.sent(),[3,5];case 4:return se=u.sent(),G=se instanceof kt?a(null,y,f,se.payload,se.meta):a(se,y,f),[3,5];case 5:return he=n&&!n.dispatchConditionRejection&&a.match(G)&&G.meta.condition,he||p(G),[2,G]}})})}();return Object.assign(x,{abort:E,requestId:y,arg:f,unwrap:function(){return x.then(Ii)}})}}return Object.assign(c,{pending:s,rejected:a,fulfilled:i,typePrefix:t})}return e.withTypes=function(){return e},e}();function Ii(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Pi(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var _n="listener",Rn="completed",In="cancelled",uo="task-"+In,co="task-"+Rn,lo=_n+"-"+In,fo=_n+"-"+Rn;var Nt="listenerMiddleware";var po=ne(Nt+"/add"),ho=ne(Nt+"/removeAll"),yo=ne(Nt+"/remove");var wn,mo=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:typeof global<"u"?global:globalThis):function(e){return(wn||(wn=Promise.resolve())).then(e).catch(function(t){return setTimeout(function(){throw t},0)})},Di=function(e){return function(t){setTimeout(t,e)}},vo=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Di(10);un();var Li=Ke(Symbol("withEventBus"),function(e,t){return class extends e{constructor(){super(...arguments),this.eventBus=t??document.createElement("span")}addEventListener(r,n,i){this.eventBus.addEventListener(r,n,i)}dispatchEvent(r){return this.eventBus.dispatchEvent(r)}removeEventListener(r,n,i){this.eventBus.removeEventListener(r,n,i)}}}),et=class extends Li(Object){};window.ftReduxStores||(window.ftReduxStores={});var Pn=class e extends et{static get(t){var r;let n=typeof t=="string"?t:t.name,i=typeof t=="string"?void 0:t,s=window.ftReduxStores[n];if(We(s))return s;if(i==null)return;let a=Cn({...i,reducers:(r=i.reducers)!==null&&r!==void 0?r:{}}),o=Tn({reducer:(l,c)=>{if(c.type==="CLEAR_FT_REDUX_STORE"){let f=jr(a.getInitialState());for(let p of c.keeping)f[p]=(l??f)[p];return f}else if(typeof c.type=="string"&&c.type.startsWith("DEFAULT_VALUE_SETTER__"))return{...l,...c.overwrites};return a.reducer(l,c)}});return window.ftReduxStores[i.name]=new e(a,o,i.eventBus)}constructor(t,r,n){super(),this.reduxSlice=t,this.reduxStore=r,this.isFtReduxStore=!0,this.commands=new qe;let i=s=>s!=null?JSON.parse(JSON.stringify(s)):s;this.actions=new Proxy(this.reduxSlice.actions,{get:(s,a,o)=>{let l=a,c=s[l];return c?(...f)=>{let p=c(...f.map(i));return this.reduxStore.dispatch(p),p}:f=>{this.setState({[l]:i(f)})}}}),this.eventBus=n??this.eventBus}clear(){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE",keeping:[]})}clearKeeping(...t){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE",keeping:t})}setState(t){this.reduxStore.dispatch({type:"DEFAULT_VALUE_SETTER__"+Object.keys(t).join("_"),overwrites:t})}get dispatch(){throw new Error("Don't use this method, actions are automatically dispatched when called.")}[Symbol.observable](){return this.reduxStore[Symbol.observable]()}getState(){return this.reduxStore.getState()}replaceReducer(t){throw new Error("Not implemented yet.")}subscribe(t){return this.reduxStore.subscribe(t)}get name(){return this.reduxSlice.name}get reducer(){return this.reduxSlice.reducer}get caseReducers(){return this.reduxSlice.caseReducers}getInitialState(){return this.reduxSlice.getInitialState()}};var tt=class{static format(t,r,n,i){return window.moment?window.moment(t).locale(r).format(this.getMomentDateFormat(n,i)):this.getIntlDateTime(t,r,n,i)}static getMomentDateFormat(t,r){return t?r?"lll":"ll":r?"L LT":"L"}static getIntlDateTime(t,r,n,i){let s=typeof t=="string"?new Date(t):t,a=new Intl.DateTimeFormat(r,{dateStyle:n?"medium":"short"}).format(s);if(!i)return a;let o=new Intl.DateTimeFormat(r,{timeStyle:"short"}).format(s);return`${a} ${o}`}static getTimezoneAsString(){let t=n=>String(Math.floor(n)).padStart(2,"0"),r=new Date().getTimezoneOffset();return`${r<0?"+":"-"}${t(Math.abs(r)/60)}:${t(Math.abs(r)%60)}`}};var Dn=I(V()),rt=function(e,t,r,n){var i=arguments.length,s=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(i<3?a(s):i>3?a(t,r,s):a(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},qo=(0,Dn.applyMixinOnce)(Symbol("withDateFormat"),function(e){class t extends e{constructor(...n){super(n),this.useLongDateFormat=!1,this.useDateTimeFormat=!1,this.metadataDescriptors=[],this.uiLocale="en-US",this.addStore(g)}dateFormatOptionsChanged(n){return n.has("metadataDescriptors")||n.has("useLongDateFormat")||n.has("useDateTimeFormat")||n.has("uiLocale")}getDateFormatter(n){var i,s;return((s=(i=this.metadataDescriptors.find(o=>o.key===n))===null||i===void 0?void 0:i.date)!==null&&s!==void 0?s:!1)?o=>tt.format(o,this.uiLocale,this.useLongDateFormat,this.useDateTimeFormat):void 0}}return rt([(0,Ut.property)({type:Boolean})],t.prototype,"useLongDateFormat",void 0),rt([(0,Ut.property)({type:Boolean})],t.prototype,"useDateTimeFormat",void 0),rt([pt({store:g.name,selector:r=>{var n,i;return(i=(n=r.metadataConfiguration)===null||n===void 0?void 0:n.descriptors)!==null&&i!==void 0?i:[]}})],t.prototype,"metadataDescriptors",void 0),rt([pt({store:g.name})],t.prototype,"uiLocale",void 0),t});var st=I(V());var nt=class extends j{constructor(){super(...arguments),this.CACHE_DURATION=3*60*1e3}async getUserAssetCount(t){if(this.isAuthenticated())return this.cache.get(`user-asset-count-${t}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/${t}`),this.CACHE_DURATION)}async getUserBookmarkCountByMap(t){if(this.isAuthenticated())return this.cache.get(`user-bookmark-count-by-map-${t}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/BOOKMARKS/${t}`),this.CACHE_DURATION)}isAuthenticated(){let t=g.getState().session;return!!t?.sessionAuthenticated}};var it=class extends j{constructor(){super(...arguments),this.CACHE_DURATION=3*60*1e3}async getUserAssetLabels(){return this.isAuthenticated()?this.cache.get("user-asset-labels",async()=>(await this.awaitApi).get("/internal/api/webapp/user/assets/labels"),this.CACHE_DURATION):[]}isAuthenticated(){let t=g.getState().session;return!!t?.sessionAuthenticated}};var ki="ft-user-assets",Mi={setAssetCount:(e,t)=>{let{userAssetType:r,count:n}=t.payload.assetCount;e.assetCounts.allAsset[r]=n},clearAssetCount:e=>{Object.values(B).forEach(t=>{e.assetCounts.allAsset[t]=void 0})},setBookmarkCountByMap:(e,t)=>{let r=t.payload.mapId;e.assetCounts.bookmarkByMap[r]=t.payload.count},clearBookmarkCountByMap:e=>{e.assetCounts.bookmarkByMap={}},addAsset:(e,t)=>{let{assetType:r,mapId:n,asset:i}=t.payload;jt(e,r,[...Ft(e,r),i]),Ln(e,r,1,n),kn(e,i)},editAsset:(e,t)=>{let{assetType:r,asset:n}=t.payload;jt(e,r,Ft(e,r).map(i=>i.id===n.id?n:i)),kn(e,n)},removeAsset:(e,t)=>{let{assetType:r,mapId:n,assetId:i}=t.payload;jt(e,r,Ft(e,r).filter(s=>s.id!==i)),Ln(e,r,-1,n)}},Mn={[B.SEARCHES]:"savedSearches",[B.BOOKMARKS]:"bookmarks",[B.BOOKS]:void 0,[B.COLLECTIONS]:void 0},Ft=(e,t)=>{var r;let n=Mn[t];return n?(r=e[n])!==null&&r!==void 0?r:[]:[]},jt=(e,t,r)=>{let n=Mn[t];n&&(e[n]=r)},Ln=(e,t,r,n)=>{let i=e.assetCounts.allAsset[t];if(i!==void 0&&(e.assetCounts.allAsset[t]=Math.max(0,i+r),t===B.BOOKMARKS&&n)){let s=e.assetCounts.bookmarkByMap[n];e.assetCounts.bookmarkByMap[n]=Math.max(0,s+r)}},kn=(e,t)=>{let r=e.assetLabels.map(i=>i.title),n=t.labels.filter(i=>!r.includes(i)).map(i=>({title:i}));e.assetLabels.push(...n)},N=st.FtReduxStore.get({name:ki,reducers:Mi,initialState:{savedSearches:void 0,bookmarks:void 0,assetCounts:{allAsset:Object.fromEntries(Object.values(B).map(e=>[e,void 0])),bookmarkByMap:{}},assetLabels:[]}}),Bt=class{constructor(t=new nt,r=new it){this.assetCountsService=t,this.assetLabelsService=r,this.currentSession=g.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Ne,this.savedSearchesService=new Be,g.subscribe(()=>this.reloadWhenUserSessionChanges())}reloadWhenUserSessionChanges(){var t;let{session:r}=g.getState();(0,st.deepEqual)((t=this.currentSession)===null||t===void 0?void 0:t.profile,r?.profile)||(this.currentSession=r,this.clearMySearches(),this.reloadBookmarks(),this.clearUserAssetCounts(),this.reloadAssetLabels())}clearUserAssetCounts(){this.assetCountsService.clearCache(),N.actions.clearAssetCount(),N.actions.clearBookmarkCountByMap()}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),N.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),N.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();let t=await this.savedSearchesService.listMySearches();N.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async reloadAssetLabels(){this.assetLabelsService.clearCache();let t=await this.assetLabelsService.getUserAssetLabels();N.actions.assetLabels(t)}async loadAssetCount(t){let r=await this.assetCountsService.getUserAssetCount(t);r&&N.actions.setAssetCount({assetCount:r})}async loadBookmarkByMapId(t){let r=await this.assetCountsService.getUserBookmarkCountByMap(t);r&&N.actions.setBookmarkCountByMap({count:r.count,mapId:t})}async reloadAssetCount(t){this.assetCountsService.clearCache();let r=Object.keys(N.getState().assetCounts.bookmarkByMap).length!==0;t===B.BOOKMARKS&&r&&N.actions.clearBookmarkCountByMap(),N.getState().assetCounts.allAsset[t]!==void 0&&await this.loadAssetCount(t)}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){let r=!((t=this.currentSession)===null||t===void 0)&&t.sessionAuthenticated?await this.bookmarksService.listMyBookmarks():void 0;N.actions.bookmarks(r)}}},Ni=new Bt;window.FluidTopicsUserAssetsActions==null&&(window.FluidTopicsUserAssetsActions=Ni);var ou=(e,t)=>{if(e!==void 0)return e===B.BOOKMARKS&&t?Ui(t):Fi(e)},Ui=e=>(N.getState().assetCounts.bookmarkByMap[e]===void 0&&window.FluidTopicsUserAssetsActions.loadBookmarkByMapId(e),N.getState().assetCounts.bookmarkByMap[e]),Fi=e=>(N.getState().assetCounts.allAsset[e]===void 0&&window.FluidTopicsUserAssetsActions.loadAssetCount(e),N.getState().assetCounts.allAsset[e]);(0,Nn.customElement)("ft-app-context")(C);})();
6
- /*! Bundled license information:
7
-
8
- @lit/reactive-element/css-tag.js:
9
- (**
10
- * @license
11
- * Copyright 2019 Google LLC
12
- * SPDX-License-Identifier: BSD-3-Clause
13
- *)
14
- */
5
+ `}connectedCallback(){super.connectedCallback(),l.addEventListener(U.eventName,this.reloadConfiguration)}disconnectedCallback(){l.addEventListener(U.eventName,this.reloadConfiguration),super.disconnectedCallback()}update(t){var s,n,a,o,d,y,S;super.update(t),t.has("baseUrl")&&(l.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&l.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("apiIntegrationAppVersion")&&l.actions.apiIntegrationAppVersion(this.apiIntegrationAppVersion),t.has("uiLocale")&&l.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&l.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&l.actions.noCustom(this.noCustom),t.has("editorMode")&&l.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&l.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&l.actions.session(this.session),t.has("messageContexts")&&this.messageContexts!=null&&this.messageContexts.forEach(I=>Ae.addContext(I)),t.has("openExternalDocumentInNewTab")&&l.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("navigatorOnline")&&l.actions.navigatorOnline(this.navigatorOnline),t.has("forcedOffline")&&l.actions.forcedOffline(this.forcedOffline),t.has("localesConfiguration")&&(l.actions.defaultLocales((s=this.localesConfiguration)===null||s===void 0?void 0:s.defaultLocales),l.actions.availableUiLocales((a=(n=this.localesConfiguration)===null||n===void 0?void 0:n.availableUiLocales)!==null&&a!==void 0?a:[]),l.actions.searchInAllLanguagesAllowed((d=(o=this.localesConfiguration)===null||o===void 0?void 0:o.allLanguagesAllowed)!==null&&d!==void 0?d:!1)),t.has("authenticationRequired")&&l.actions.authenticationRequired(this.authenticationRequired),t.has("availableContentLocales")&&l.actions.availableContentLocales((S=(y=this.availableContentLocales)===null||y===void 0?void 0:y.contentLocales)!==null&&S!==void 0?S:[]),setTimeout(()=>this.updateIfNeeded())}async updateIfNeeded(){this.apiProvider()&&(this.withManualResources||(this.session==null&&this.updateSession(),this.metadataConfiguration==null&&this.updateMetadataConfiguration()),this.localesConfiguration==null&&this.updateLocalesConfiguration(),this.availableContentLocales==null&&this.updateAvailableContentLocales())}async updateSession(){this.session=await this.cache.get("session",async()=>{let t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run(()=>{this.cache.clear("session"),this.session=void 0},t.idleTimeoutInMillis),t})}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",()=>this.apiProvider().getMetadataConfiguration())}async updateLocalesConfiguration(){this.localesConfiguration=await this.cache.get("localesConfiguration",()=>this.apiProvider().getLocalesConfiguration())}async updateAvailableContentLocales(){this.availableContentLocales=await this.cache.get("availableContentLocales",()=>tt(()=>this.apiProvider().getAvailableSearchLocales(),{contentLocales:[]}))}};h.elementDefinitions={};h.styles=fe;m([(0,T.property)()],h.prototype,"baseUrl",void 0);m([(0,T.property)()],h.prototype,"apiIntegrationIdentifier",void 0);m([(0,T.property)()],h.prototype,"apiIntegrationAppVersion",void 0);m([(0,T.property)()],h.prototype,"uiLocale",void 0);m([(0,b.jsonProperty)(null)],h.prototype,"availableUiLocales",void 0);m([(0,b.jsonProperty)(null)],h.prototype,"metadataConfiguration",void 0);m([(0,T.property)({type:Boolean})],h.prototype,"editorMode",void 0);m([(0,T.property)({type:Boolean})],h.prototype,"noCustom",void 0);m([(0,T.property)({type:Boolean})],h.prototype,"openExternalDocumentInNewTab",void 0);m([(0,T.property)({converter:{fromAttribute(e){return e==="false"?!1:e==="true"||(e??!1)}}})],h.prototype,"noCustomComponent",void 0);m([(0,T.property)({type:Boolean})],h.prototype,"withManualResources",void 0);m([(0,T.property)({type:Boolean})],h.prototype,"navigatorOnline",void 0);m([(0,T.property)({type:Boolean})],h.prototype,"forcedOffline",void 0);m([(0,T.property)({type:Object})],h.prototype,"apiProvider",void 0);m([(0,T.property)({type:Boolean})],h.prototype,"authenticationRequired",void 0);m([(0,b.jsonProperty)([])],h.prototype,"messageContexts",void 0);m([(0,b.jsonProperty)(void 0)],h.prototype,"session",void 0);m([(0,T.state)()],h.prototype,"localesConfiguration",void 0);m([(0,T.state)()],h.prototype,"availableContentLocales",void 0);(0,st.customElement)("ft-app-context")(h);})();