@fluid-topics/ft-reader-context 1.1.3 → 1.1.4

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.
@@ -1,6 +1,7 @@
1
1
  import { PropertyValues } from "lit";
2
2
  import { FtLitElementRedux } from "@fluid-topics/ft-wc-utils";
3
3
  import { FtReaderComponentInterface } from "./registration";
4
+ import { FtReaderStateManager } from "./store/FtReaderStateManager";
4
5
  import { FtReaderPage, FtReaderScrollTarget, FtReaderTocNode } from "./store/model";
5
6
  import type { FtMap } from "@fluid-topics/public-api";
6
7
  import { FtReaderContextProperties } from "./ft-reader-context.properties";
@@ -23,7 +24,7 @@ export declare class FtReaderContext extends FtLitElementRedux implements FtRead
23
24
  protected render(): import("lit").TemplateResult<1>;
24
25
  private importStyleIfNeeded;
25
26
  private _stateManager?;
26
- private get stateManager();
27
+ get stateManager(): FtReaderStateManager;
27
28
  connectedCallback(): void;
28
29
  protected update(props: PropertyValues): void;
29
30
  private scrollToTargetDebouncer;
@@ -98,15 +98,15 @@ const No=window,So=No.ShadowRoot&&(void 0===No.ShadyCSS||No.ShadyCSS.nativeShado
98
98
  display: inline-block;
99
99
  width: 0;
100
100
  }
101
- `;class ko{constructor(t,o){this.defaultLabels=t,this.labels=o}resolve(t,...o){var e,r;t=this.resolvePluralKey(t,o);let i=null!==(r=null!==(e=this.labels[t])&&void 0!==e?e:this.defaultLabels[t])&&void 0!==r?r:"";return o.forEach(((t,o)=>i=i.replace(new RegExp(`\\{${o}([^}]*)\\}`,"g"),((o,e)=>this.formatValue(t,e))))),i}resolvePluralKey(t,o){for(let e of o)if("number"==typeof e){const o=`${String(t)}[\\=${e}]`;if(o in this.labels||o in this.defaultLabels)return o}return t}formatValue(t,o){return t instanceof Date?this.formatDate(t,o):null!=t?t:""}formatDate(t,o){const e=e=>(null==o?void 0:o.includes("date"))?t.toLocaleDateString(e):(null==o?void 0:o.includes("time"))?t.toLocaleTimeString(e):t.toLocaleString(e);try{return e(document.documentElement.lang)}catch(t){return e()}}}function Wo(t){var o;return null!==(o=null==t?void 0:t.isFtReduxStore)&&void 0!==o&&o}var To,Ko,Po;const jo=Symbol("internalReduxEventsUnsubscribers"),Mo=Symbol("internalStoresUnsubscribers"),Fo=Symbol("internalStores");class Zo extends Lo{constructor(){super(...arguments),this[To]=new Map,this[Ko]=new Map,this[Po]=[]}update(t){var o;super.update(t),(null===(o=this.reduxReactiveProperties)||void 0===o?void 0:o.some((o=>t.has(o))))&&this.updateFromStores()}getUnnamedStore(){if(this[Fo].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[Fo].values()][0]}getStore(t){return null==t?this.getUnnamedStore():this[Fo].get(t)}addStore(t,o){var e;o=null!==(e=null!=o?o:Wo(t)?t.name:void 0)&&void 0!==e?e:"default-store",this.unsubscribeFromStore(o),this.setupStore(o,t)}removeStore(t){const o="string"==typeof t?t:t.name;this.unsubscribeFromStore(o),this[Fo].delete(o)}setupStore(t,o){this[Fo].set(t,o),this.subscribeToStore(t,o),this.updateFromStores()}setupStores(){this.unsubscribeFromStores(),this[Fo].forEach(((t,o)=>this.subscribeToStore(o,t))),this.updateFromStores()}updateFromStores(){this.reduxProperties&&this.reduxProperties.forEach(((t,o)=>{const e=this.constructor.getPropertyOptions(o);if(!(null==e?void 0:e.attribute)||!this.hasAttribute("string"==typeof(null==e?void 0:e.attribute)?e.attribute:o)){const e=this.getStore(t.store);e&&(t.store?this[Mo].has(t.store):this[Mo].size>0)&&(this[o]=t.selector(e.getState(),this))}}))}subscribeToStore(t,o){var e;this[Mo].set(t,o.subscribe((()=>this.updateFromStores()))),Wo(o)&&o.eventBus&&(null===(e=this.reduxEventListeners)||void 0===e||e.forEach(((t,e)=>{if("function"==typeof this[e]&&(!t.store||o.name===t.store)){const r=t=>this[e](t);o.eventBus.addEventListener(t.eventName,r),this[jo].push((()=>o.eventBus.removeEventListener(t.eventName,r)))}}))),this.onStoreAvailable(t)}unsubscribeFromStores(){this[Mo].forEach(((t,o)=>this.unsubscribeFromStore(o))),this[jo].forEach((t=>t())),this[jo]=[]}unsubscribeFromStore(t){this[Mo].has(t)&&this[Mo].get(t)(),this[Mo].delete(t)}onStoreAvailable(t){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}function Bo(t){for(var o=arguments.length,e=Array(o>1?o-1:0),r=1;r<o;r++)e[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+t+(e.length?" "+e.map((function(t){return"'"+t+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Do(t){return!!t&&!!t[xe]}function _o(t){var o;return!!t&&(function(t){if(!t||"object"!=typeof t)return!1;var o=Object.getPrototypeOf(t);if(null===o)return!0;var e=Object.hasOwnProperty.call(o,"constructor")&&o.constructor;return e===Object||"function"==typeof e&&Function.toString.call(e)===Ie}(t)||Array.isArray(t)||!!t[Ue]||!!(null===(o=t.constructor)||void 0===o?void 0:o[Ue])||Yo(t)||Vo(t))}function $o(t,o,e){void 0===e&&(e=!1),0===zo(t)?(e?Object.keys:Le)(t).forEach((function(r){e&&"symbol"==typeof r||o(r,t[r],t)})):t.forEach((function(e,r){return o(r,e,t)}))}function zo(t){var o=t[xe];return o?o.i>3?o.i-4:o.i:Array.isArray(t)?1:Yo(t)?2:Vo(t)?3:0}function Go(t,o){return 2===zo(t)?t.has(o):Object.prototype.hasOwnProperty.call(t,o)}function Ho(t,o,e){var r=zo(t);2===r?t.set(o,e):3===r?t.add(e):t[o]=e}function qo(t,o){return t===o?0!==t||1/t==1/o:t!=t&&o!=o}function Yo(t){return Se&&t instanceof Map}function Vo(t){return Ee&&t instanceof Set}function Jo(t){return t.o||t.t}function Xo(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var o=Ae(t);delete o[xe];for(var e=Le(o),r=0;r<e.length;r++){var i=e[r],n=o[i];!1===n.writable&&(n.writable=!0,n.configurable=!0),(n.get||n.set)&&(o[i]={configurable:!0,writable:!0,enumerable:n.enumerable,value:t[i]})}return Object.create(Object.getPrototypeOf(t),o)}function Qo(t,o){return void 0===o&&(o=!1),oe(t)||Do(t)||!_o(t)||(zo(t)>1&&(t.set=t.add=t.clear=t.delete=te),Object.freeze(t),o&&$o(t,(function(t,o){return Qo(o,!0)}),!0)),t}function te(){Bo(2)}function oe(t){return null==t||"object"!=typeof t||Object.isFrozen(t)}function ee(t){var o=ke[t];return o||Bo(18,t),o}function re(){return we}function ie(t,o){o&&(ee("Patches"),t.u=[],t.s=[],t.v=o)}function ne(t){ae(t),t.p.forEach(ce),t.p=null}function ae(t){t===we&&(we=t.l)}function se(t){return we={p:[],l:we,h:t,m:!0,_:0}}function ce(t){var o=t[xe];0===o.i||1===o.i?o.j():o.g=!0}function le(t,o){o._=o.p.length;var e=o.p[0],r=void 0!==t&&t!==e;return o.h.O||ee("ES5").S(o,t,r),r?(e[xe].P&&(ne(o),Bo(4)),_o(t)&&(t=fe(o,t),o.l||ue(o,t)),o.u&&ee("Patches").M(e[xe].t,t,o.u,o.s)):t=fe(o,e,[]),ne(o),o.u&&o.v(o.u,o.s),t!==Re?t:void 0}function fe(t,o,e){if(oe(o))return o;var r=o[xe];if(!r)return $o(o,(function(i,n){return he(t,r,o,i,n,e)}),!0),o;if(r.A!==t)return o;if(!r.P)return ue(t,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=Xo(r.k):r.o,n=i,a=!1;3===r.i&&(n=new Set(i),i.clear(),a=!0),$o(n,(function(o,n){return he(t,r,i,o,n,e,a)})),ue(t,i,!1),e&&t.u&&ee("Patches").N(r,e,t.u,t.s)}return r.o}function he(t,o,e,r,i,n,a){if(Do(i)){var s=fe(t,i,n&&o&&3!==o.i&&!Go(o.R,r)?n.concat(r):void 0);if(Ho(e,r,s),!Do(s))return;t.m=!1}else a&&e.add(i);if(_o(i)&&!oe(i)){if(!t.h.D&&t._<1)return;fe(t,i),o&&o.A.l||ue(t,i)}}function ue(t,o,e){void 0===e&&(e=!1),!t.l&&t.h.D&&t.m&&Qo(o,e)}function de(t,o){var e=t[xe];return(e?Jo(e):t)[o]}function pe(t,o){if(o in t)for(var e=Object.getPrototypeOf(t);e;){var r=Object.getOwnPropertyDescriptor(e,o);if(r)return r;e=Object.getPrototypeOf(e)}}function ye(t){t.P||(t.P=!0,t.l&&ye(t.l))}function be(t){t.o||(t.o=Xo(t.t))}function ge(t,o,e){var r=Yo(o)?ee("MapSet").F(o,e):Vo(o)?ee("MapSet").T(o,e):t.O?function(t,o){var e=Array.isArray(t),r={i:e?1:0,A:o?o.A:re(),P:!1,I:!1,R:{},l:o,t,k:null,o:null,j:null,C:!1},i=r,n=We;e&&(i=[r],n=Te);var a=Proxy.revocable(i,n),s=a.revoke,c=a.proxy;return r.k=c,r.j=s,c}(o,e):ee("ES5").J(o,e);return(e?e.A:re()).p.push(r),r}function me(t){return Do(t)||Bo(22,t),function t(o){if(!_o(o))return o;var e,r=o[xe],i=zo(o);if(r){if(!r.P&&(r.i<4||!ee("ES5").K(r)))return r.t;r.I=!0,e=ve(o,i),r.I=!1}else e=ve(o,i);return $o(e,(function(o,i){r&&function(t,o){return 2===zo(t)?t.get(o):t[o]}(r.t,o)===i||Ho(e,o,t(i))})),3===i?new Set(e):e}(t)}function ve(t,o){switch(o){case 2:return new Map(t);case 3:return Array.from(t)}return Xo(t)}To=Mo,Ko=Fo,Po=jo;var Oe,we,Ne="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Se="undefined"!=typeof Map,Ee="undefined"!=typeof Set,Ce="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Re=Ne?Symbol.for("immer-nothing"):((Oe={})["immer-nothing"]=!0,Oe),Ue=Ne?Symbol.for("immer-draftable"):"__$immer_draftable",xe=Ne?Symbol.for("immer-state"):"__$immer_state",Ie=""+Object.prototype.constructor,Le="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,Ae=Object.getOwnPropertyDescriptors||function(t){var o={};return Le(t).forEach((function(e){o[e]=Object.getOwnPropertyDescriptor(t,e)})),o},ke={},We={get:function(t,o){if(o===xe)return t;var e=Jo(t);if(!Go(e,o))return function(t,o,e){var r,i=pe(o,e);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(t.k):void 0}(t,e,o);var r=e[o];return t.I||!_o(r)?r:r===de(t.t,o)?(be(t),t.o[o]=ge(t.A.h,r,t)):r},has:function(t,o){return o in Jo(t)},ownKeys:function(t){return Reflect.ownKeys(Jo(t))},set:function(t,o,e){var r=pe(Jo(t),o);if(null==r?void 0:r.set)return r.set.call(t.k,e),!0;if(!t.P){var i=de(Jo(t),o),n=null==i?void 0:i[xe];if(n&&n.t===e)return t.o[o]=e,t.R[o]=!1,!0;if(qo(e,i)&&(void 0!==e||Go(t.t,o)))return!0;be(t),ye(t)}return t.o[o]===e&&(void 0!==e||o in t.o)||Number.isNaN(e)&&Number.isNaN(t.o[o])||(t.o[o]=e,t.R[o]=!0),!0},deleteProperty:function(t,o){return void 0!==de(t.t,o)||o in t.t?(t.R[o]=!1,be(t),ye(t)):delete t.R[o],t.o&&delete t.o[o],!0},getOwnPropertyDescriptor:function(t,o){var e=Jo(t),r=Reflect.getOwnPropertyDescriptor(e,o);return r?{writable:!0,configurable:1!==t.i||"length"!==o,enumerable:r.enumerable,value:e[o]}:r},defineProperty:function(){Bo(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){Bo(12)}},Te={};$o(We,(function(t,o){Te[t]=function(){return arguments[0]=arguments[0][0],o.apply(this,arguments)}})),Te.deleteProperty=function(t,o){return Te.set.call(this,t,o,void 0)},Te.set=function(t,o,e){return We.set.call(this,t[0],o,e,t[0])};var Ke=function(){function t(t){var o=this;this.O=Ce,this.D=!0,this.produce=function(t,e,r){if("function"==typeof t&&"function"!=typeof e){var i=e;e=t;var n=o;return function(t){var o=this;void 0===t&&(t=i);for(var r=arguments.length,a=Array(r>1?r-1:0),s=1;s<r;s++)a[s-1]=arguments[s];return n.produce(t,(function(t){var r;return(r=e).call.apply(r,[o,t].concat(a))}))}}var a;if("function"!=typeof e&&Bo(6),void 0!==r&&"function"!=typeof r&&Bo(7),_o(t)){var s=se(o),c=ge(o,t,void 0),l=!0;try{a=e(c),l=!1}finally{l?ne(s):ae(s)}return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(t){return ie(s,r),le(t,s)}),(function(t){throw ne(s),t})):(ie(s,r),le(a,s))}if(!t||"object"!=typeof t){if(void 0===(a=e(t))&&(a=t),a===Re&&(a=void 0),o.D&&Qo(a,!0),r){var f=[],h=[];ee("Patches").M(t,a,f,h),r(f,h)}return a}Bo(21,t)},this.produceWithPatches=function(t,e){if("function"==typeof t)return function(e){for(var r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return o.produceWithPatches(e,(function(o){return t.apply(void 0,[o].concat(i))}))};var r,i,n=o.produce(t,e,(function(t,o){r=t,i=o}));return"undefined"!=typeof Promise&&n instanceof Promise?n.then((function(t){return[t,r,i]})):[n,r,i]},"boolean"==typeof(null==t?void 0:t.useProxies)&&this.setUseProxies(t.useProxies),"boolean"==typeof(null==t?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze)}var o=t.prototype;return o.createDraft=function(t){_o(t)||Bo(8),Do(t)&&(t=me(t));var o=se(this),e=ge(this,t,void 0);return e[xe].C=!0,ae(o),e},o.finishDraft=function(t,o){var e=(t&&t[xe]).A;return ie(e,o),le(void 0,e)},o.setAutoFreeze=function(t){this.D=t},o.setUseProxies=function(t){t&&!Ce&&Bo(20),this.O=t},o.applyPatches=function(t,o){var e;for(e=o.length-1;e>=0;e--){var r=o[e];if(0===r.path.length&&"replace"===r.op){t=r.value;break}}e>-1&&(o=o.slice(e+1));var i=ee("Patches").$;return Do(t)?i(t,o):this.produce(t,(function(t){return i(t,o)}))},t}(),Pe=new Ke,je=Pe.produce;function Me(t){return Me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Me(t)}function Fe(t){var o=function(t,o){if("object"!==Me(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,o||"default");if("object"!==Me(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===o?String:Number)(t)}(t,"string");return"symbol"===Me(o)?o:String(o)}function Ze(t,o,e){return(o=Fe(o))in t?Object.defineProperty(t,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[o]=e,t}function Be(t,o){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);o&&(r=r.filter((function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),e.push.apply(e,r)}return e}function De(t){for(var o=1;o<arguments.length;o++){var e=null!=arguments[o]?arguments[o]:{};o%2?Be(Object(e),!0).forEach((function(o){Ze(t,o,e[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Be(Object(e)).forEach((function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}))}return t}function _e(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}Pe.produceWithPatches.bind(Pe),Pe.setAutoFreeze.bind(Pe),Pe.setUseProxies.bind(Pe),Pe.applyPatches.bind(Pe),Pe.createDraft.bind(Pe),Pe.finishDraft.bind(Pe);var $e="function"==typeof Symbol&&Symbol.observable||"@@observable",ze=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ge={INIT:"@@redux/INIT"+ze(),REPLACE:"@@redux/REPLACE"+ze(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+ze()}};function He(t,o,e){var r;if("function"==typeof o&&"function"==typeof e||"function"==typeof e&&"function"==typeof arguments[3])throw new Error(_e(0));if("function"==typeof o&&void 0===e&&(e=o,o=void 0),void 0!==e){if("function"!=typeof e)throw new Error(_e(1));return e(He)(t,o)}if("function"!=typeof t)throw new Error(_e(2));var i=t,n=o,a=[],s=a,c=!1;function l(){s===a&&(s=a.slice())}function f(){if(c)throw new Error(_e(3));return n}function h(t){if("function"!=typeof t)throw new Error(_e(4));if(c)throw new Error(_e(5));var o=!0;return l(),s.push(t),function(){if(o){if(c)throw new Error(_e(6));o=!1,l();var e=s.indexOf(t);s.splice(e,1),a=null}}}function u(t){if(!function(t){if("object"!=typeof t||null===t)return!1;for(var o=t;null!==Object.getPrototypeOf(o);)o=Object.getPrototypeOf(o);return Object.getPrototypeOf(t)===o}(t))throw new Error(_e(7));if(void 0===t.type)throw new Error(_e(8));if(c)throw new Error(_e(9));try{c=!0,n=i(n,t)}finally{c=!1}for(var o=a=s,e=0;e<o.length;e++){(0,o[e])()}return t}return u({type:Ge.INIT}),(r={dispatch:u,subscribe:h,getState:f,replaceReducer:function(t){if("function"!=typeof t)throw new Error(_e(10));i=t,u({type:Ge.REPLACE})}})[$e]=function(){var t,o=h;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(_e(11));function e(){t.next&&t.next(f())}return e(),{unsubscribe:o(e)}}})[$e]=function(){return this},t},r}function qe(t){for(var o=Object.keys(t),e={},r=0;r<o.length;r++){var i=o[r];"function"==typeof t[i]&&(e[i]=t[i])}var n,a=Object.keys(e);try{!function(t){Object.keys(t).forEach((function(o){var e=t[o];if(void 0===e(void 0,{type:Ge.INIT}))throw new Error(_e(12));if(void 0===e(void 0,{type:Ge.PROBE_UNKNOWN_ACTION()}))throw new Error(_e(13))}))}(e)}catch(t){n=t}return function(t,o){if(void 0===t&&(t={}),n)throw n;for(var r=!1,i={},s=0;s<a.length;s++){var c=a[s],l=e[c],f=t[c],h=l(f,o);if(void 0===h)throw o&&o.type,new Error(_e(14));i[c]=h,r=r||h!==f}return(r=r||a.length!==Object.keys(t).length)?i:t}}function Ye(){for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return 0===o.length?function(t){return t}:1===o.length?o[0]:o.reduce((function(t,o){return function(){return t(o.apply(void 0,arguments))}}))}function Ve(){for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return function(t){return function(){var e=t.apply(void 0,arguments),r=function(){throw new Error(_e(15))},i={getState:e.getState,dispatch:function(){return r.apply(void 0,arguments)}},n=o.map((function(t){return t(i)}));return r=Ye.apply(void 0,n)(e.dispatch),De(De({},e),{},{dispatch:r})}}}function Je(t){return function(o){var e=o.dispatch,r=o.getState;return function(o){return function(i){return"function"==typeof i?i(e,r,t):o(i)}}}}var Xe=Je();Xe.withExtraArgument=Je;var Qe,tr=Xe,or=(Qe=function(t,o){return Qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&(t[e]=o[e])},Qe(t,o)},function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function e(){this.constructor=t}Qe(t,o),t.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}),er=function(t,o){var e,r,i,n,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return n={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function s(n){return function(s){return function(n){if(e)throw new TypeError("Generator is already executing.");for(;a;)try{if(e=1,r&&(i=2&n[0]?r.return:n[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,n[1])).done)return i;switch(r=0,i&&(n=[2&n[0],i.value]),n[0]){case 0:case 1:i=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,r=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==n[0]&&2!==n[0])){a=0;continue}if(3===n[0]&&(!i||n[1]>i[0]&&n[1]<i[3])){a.label=n[1];break}if(6===n[0]&&a.label<i[1]){a.label=i[1],i=n;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(n);break}i[2]&&a.ops.pop(),a.trys.pop();continue}n=o.call(t,a)}catch(t){n=[6,t],r=0}finally{e=i=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,s])}}},rr=function(t,o){for(var e=0,r=o.length,i=t.length;e<r;e++,i++)t[i]=o[e];return t},ir=Object.defineProperty,nr=Object.defineProperties,ar=Object.getOwnPropertyDescriptors,sr=Object.getOwnPropertySymbols,cr=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable,fr=function(t,o,e){return o in t?ir(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e},hr=function(t,o){for(var e in o||(o={}))cr.call(o,e)&&fr(t,e,o[e]);if(sr)for(var r=0,i=sr(o);r<i.length;r++){e=i[r];lr.call(o,e)&&fr(t,e,o[e])}return t},ur=function(t,o){return nr(t,ar(o))},dr="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Ye:Ye.apply(null,arguments)};var pr=function(t){function o(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var i=t.apply(this,e)||this;return Object.setPrototypeOf(i,o.prototype),i}return or(o,t),Object.defineProperty(o,Symbol.species,{get:function(){return o},enumerable:!1,configurable:!0}),o.prototype.concat=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];return t.prototype.concat.apply(this,o)},o.prototype.prepend=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&Array.isArray(t[0])?new(o.bind.apply(o,rr([void 0],t[0].concat(this)))):new(o.bind.apply(o,rr([void 0],t.concat(this))))},o}(Array),yr=function(t){function o(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var i=t.apply(this,e)||this;return Object.setPrototypeOf(i,o.prototype),i}return or(o,t),Object.defineProperty(o,Symbol.species,{get:function(){return o},enumerable:!1,configurable:!0}),o.prototype.concat=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];return t.prototype.concat.apply(this,o)},o.prototype.prepend=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&Array.isArray(t[0])?new(o.bind.apply(o,rr([void 0],t[0].concat(this)))):new(o.bind.apply(o,rr([void 0],t.concat(this))))},o}(Array);function br(t){return _o(t)?je(t,(function(){})):t}function gr(){return function(t){return function(t){void 0===t&&(t={});var o=t.thunk,e=void 0===o||o;t.immutableCheck,t.serializableCheck;var r=new pr;e&&(!function(t){return"boolean"==typeof t}(e)?r.push(tr.withExtraArgument(e.extraArgument)):r.push(tr));return r}(t)}}function mr(t){var o,e=gr(),r=t||{},i=r.reducer,n=void 0===i?void 0:i,a=r.middleware,s=void 0===a?e():a,c=r.devTools,l=void 0===c||c,f=r.preloadedState,h=void 0===f?void 0:f,u=r.enhancers,d=void 0===u?void 0:u;if("function"==typeof n)o=n;else{if(!function(t){if("object"!=typeof t||null===t)return!1;var o=Object.getPrototypeOf(t);if(null===o)return!0;for(var e=o;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return o===e}(n))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');o=qe(n)}var p=s;"function"==typeof p&&(p=p(e));var y=Ve.apply(void 0,p),b=Ye;l&&(b=dr(hr({trace:!1},"object"==typeof l&&l)));var g=new yr(y),m=g;return Array.isArray(d)?m=rr([y],d):"function"==typeof d&&(m=d(g)),He(o,h,b.apply(void 0,m))}function vr(t,o){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(o){var i=o.apply(void 0,e);if(!i)throw new Error("prepareAction did not return an object");return hr(hr({type:t,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:t,payload:e[0]}}return e.toString=function(){return""+t},e.type=t,e.match=function(o){return o.type===t},e}function Or(t){var o,e={},r=[],i={addCase:function(t,o){var r="string"==typeof t?t:t.type;if(r in e)throw new Error("addCase cannot be called with two reducers for the same action type");return e[r]=o,i},addMatcher:function(t,o){return r.push({matcher:t,reducer:o}),i},addDefaultCase:function(t){return o=t,i}};return t(i),[e,r,o]}function wr(t){var o=t.name;if(!o)throw new Error("`name` is a required option for createSlice");var e,r="function"==typeof t.initialState?t.initialState:br(t.initialState),i=t.reducers||{},n=Object.keys(i),a={},s={},c={};function l(){var o="function"==typeof t.extraReducers?Or(t.extraReducers):[t.extraReducers],e=o[0],i=void 0===e?{}:e,n=o[1],a=void 0===n?[]:n,c=o[2],l=void 0===c?void 0:c,f=hr(hr({},i),s);return function(t,o,e,r){void 0===e&&(e=[]);var i,n="function"==typeof o?Or(o):[o,e,r],a=n[0],s=n[1],c=n[2];if(function(t){return"function"==typeof t}(t))i=function(){return br(t())};else{var l=br(t);i=function(){return l}}function f(t,o){void 0===t&&(t=i());var e=rr([a[o.type]],s.filter((function(t){return(0,t.matcher)(o)})).map((function(t){return t.reducer})));return 0===e.filter((function(t){return!!t})).length&&(e=[c]),e.reduce((function(t,e){if(e){var r;if(Do(t))return void 0===(r=e(t,o))?t:r;if(_o(t))return je(t,(function(t){return e(t,o)}));if(void 0===(r=e(t,o))){if(null===t)return t;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return t}),t)}return f.getInitialState=i,f}(r,(function(t){for(var o in f)t.addCase(o,f[o]);for(var e=0,r=a;e<r.length;e++){var i=r[e];t.addMatcher(i.matcher,i.reducer)}l&&t.addDefaultCase(l)}))}return n.forEach((function(t){var e,r,n=i[t],l=o+"/"+t;"reducer"in n?(e=n.reducer,r=n.prepare):e=n,a[t]=e,s[l]=e,c[t]=r?vr(l,r):vr(l)})),{name:o,reducer:function(t,o){return e||(e=l()),e(t,o)},actions:c,caseReducers:a,getInitialState:function(){return e||(e=l()),e.getInitialState()}}}var Nr=["name","message","stack","code"],Sr=function(t,o){this.payload=t,this.meta=o},Er=function(t,o){this.payload=t,this.meta=o},Cr=function(t){if("object"==typeof t&&null!==t){for(var o={},e=0,r=Nr;e<r.length;e++){var i=r[e];"string"==typeof t[i]&&(o[i]=t[i])}return o}return{message:String(t)}};function Rr(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}!function(){function t(t,o,e){var r=vr(t+"/fulfilled",(function(t,o,e,r){return{payload:t,meta:ur(hr({},r||{}),{arg:e,requestId:o,requestStatus:"fulfilled"})}})),i=vr(t+"/pending",(function(t,o,e){return{payload:void 0,meta:ur(hr({},e||{}),{arg:o,requestId:t,requestStatus:"pending"})}})),n=vr(t+"/rejected",(function(t,o,r,i,n){return{payload:i,error:(e&&e.serializeError||Cr)(t||"Rejected"),meta:ur(hr({},n||{}),{arg:r,requestId:o,rejectedWithValue:!!i,requestStatus:"rejected",aborted:"AbortError"===(null==t?void 0:t.name),condition:"ConditionError"===(null==t?void 0:t.name)})}})),a="undefined"!=typeof AbortController?AbortController:function(){function t(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return t.prototype.abort=function(){},t}();return Object.assign((function(t){return function(s,c,l){var f,h=(null==e?void 0:e.idGenerator)?e.idGenerator(t):function(t){void 0===t&&(t=21);for(var o="",e=t;e--;)o+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return o}(),u=new a;function d(t){f=t,u.abort()}var p=function(){return a=this,p=null,y=function(){var a,p,y,b,g,m;return er(this,(function(v){switch(v.label){case 0:return v.trys.push([0,4,,5]),b=null==(a=null==e?void 0:e.condition)?void 0:a.call(e,t,{getState:c,extra:l}),null===(O=b)||"object"!=typeof O||"function"!=typeof O.then?[3,2]:[4,b];case 1:b=v.sent(),v.label=2;case 2:if(!1===b||u.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return g=new Promise((function(t,o){return u.signal.addEventListener("abort",(function(){return o({name:"AbortError",message:f||"Aborted"})}))})),s(i(h,t,null==(p=null==e?void 0:e.getPendingMeta)?void 0:p.call(e,{requestId:h,arg:t},{getState:c,extra:l}))),[4,Promise.race([g,Promise.resolve(o(t,{dispatch:s,getState:c,extra:l,requestId:h,signal:u.signal,abort:d,rejectWithValue:function(t,o){return new Sr(t,o)},fulfillWithValue:function(t,o){return new Er(t,o)}})).then((function(o){if(o instanceof Sr)throw o;return o instanceof Er?r(o.payload,h,t,o.meta):r(o,h,t)}))])];case 3:return y=v.sent(),[3,5];case 4:return m=v.sent(),y=m instanceof Sr?n(null,h,t,m.payload,m.meta):n(m,h,t),[3,5];case 5:return e&&!e.dispatchConditionRejection&&n.match(y)&&y.meta.condition||s(y),[2,y]}var O}))},new Promise((function(t,o){var e=function(t){try{i(y.next(t))}catch(t){o(t)}},r=function(t){try{i(y.throw(t))}catch(t){o(t)}},i=function(o){return o.done?t(o.value):Promise.resolve(o.value).then(e,r)};i((y=y.apply(a,p)).next())}));var a,p,y}();return Object.assign(p,{abort:d,requestId:h,arg:t,unwrap:function(){return p.then(Rr)}})}}),{pending:i,rejected:n,fulfilled:r,typePrefix:t})}t.withTypes=function(){return t}}();var Ur="listenerMiddleware";vr(Ur+"/add"),vr(Ur+"/removeAll"),vr(Ur+"/remove"),"function"==typeof queueMicrotask&&queueMicrotask.bind("undefined"!=typeof window?window:"undefined"!=typeof global?global:globalThis),function(){function t(t,o){var e=i[t];return e?e.enumerable=o:i[t]=e={configurable:!0,enumerable:o,get:function(){var o=this[xe];return We.get(o,t)},set:function(o){var e=this[xe];We.set(e,t,o)}},e}function o(t){for(var o=t.length-1;o>=0;o--){var i=t[o][xe];if(!i.P)switch(i.i){case 5:r(i)&&ye(i);break;case 4:e(i)&&ye(i)}}}function e(t){for(var o=t.t,e=t.k,r=Le(e),i=r.length-1;i>=0;i--){var n=r[i];if(n!==xe){var a=o[n];if(void 0===a&&!Go(o,n))return!0;var s=e[n],c=s&&s[xe];if(c?c.t!==a:!qo(s,a))return!0}}var l=!!o[xe];return r.length!==Le(o).length+(l?0:1)}function r(t){var o=t.k;if(o.length!==t.t.length)return!0;var e=Object.getOwnPropertyDescriptor(o,o.length-1);if(e&&!e.get)return!0;for(var r=0;r<o.length;r++)if(!o.hasOwnProperty(r))return!0;return!1}var i={};!function(t,o){ke[t]||(ke[t]=o)}("ES5",{J:function(o,e){var r=Array.isArray(o),i=function(o,e){if(o){for(var r=Array(e.length),i=0;i<e.length;i++)Object.defineProperty(r,""+i,t(i,!0));return r}var n=Ae(e);delete n[xe];for(var a=Le(n),s=0;s<a.length;s++){var c=a[s];n[c]=t(c,o||!!n[c].enumerable)}return Object.create(Object.getPrototypeOf(e),n)}(r,o),n={i:r?5:4,A:e?e.A:re(),P:!1,I:!1,R:{},l:e,t:o,k:i,o:null,g:!1,C:!1};return Object.defineProperty(i,xe,{value:n,writable:!0}),i},S:function(t,e,i){i?Do(e)&&e[xe].A===t&&o(t.p):(t.u&&function t(o){if(o&&"object"==typeof o){var e=o[xe];if(e){var i=e.t,n=e.k,a=e.R,s=e.i;if(4===s)$o(n,(function(o){o!==xe&&(void 0!==i[o]||Go(i,o)?a[o]||t(n[o]):(a[o]=!0,ye(e)))})),$o(i,(function(t){void 0!==n[t]||Go(n,t)||(a[t]=!1,ye(e))}));else if(5===s){if(r(e)&&(ye(e),a.length=!0),n.length<i.length)for(var c=n.length;c<i.length;c++)a[c]=!1;else for(var l=i.length;l<n.length;l++)a[l]=!0;for(var f=Math.min(n.length,i.length),h=0;h<f;h++)n.hasOwnProperty(h)||(a[h]=!0),void 0===a[h]&&t(n[h])}}}}(t.p[0]),o(t.p))},K:function(t){return 4===t.i?e(t):r(t)}})}(),window.ftReduxStores||(window.ftReduxStores={});class xr{static get(t){var o;const e="string"==typeof t?t:t.name,r="string"==typeof t?void 0:t,i=window.ftReduxStores[e];if(Wo(i))return i;if(null==r)return;const n=wr({...r,reducers:null!==(o=r.reducers)&&void 0!==o?o:{}}),a=mr({reducer:(t,o)=>{var e;switch(o.type){case"CLEAR_FT_REDUX_STORE":return n.getInitialState();case"DEFAULT_STATE_FIELDS_VALUES_SETTER":return{...t,...null!==(e=o.overwrites)&&void 0!==e?e:{}};default:return n.reducer(t,o)}}});return window.ftReduxStores[r.name]=new xr(n,a)}constructor(t,o){this.reduxSlice=t,this.reduxStore=o,this.isFtReduxStore=!0,this.eventBus=document.createElement("event-bus"),this.actions=new Proxy(this.reduxSlice.actions,{get:(t,o,e)=>{const r=o,i=t[r];return i?(...t)=>{const o=i(...t);return this.reduxStore.dispatch(o),o}:t=>{this.setState({[r]:t})}}})}clear(){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE"})}setState(t){this.reduxStore.dispatch({type:"DEFAULT_STATE_FIELDS_VALUES_SETTER",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()}}const Ir=t=>{const o=null!=t?t:{};return(t,e)=>{var r;const i={hasChanged:(t,o)=>!L(t,o),attribute:!1,...o};U(i)(t,e);const n=t;n.reduxProperties=n.reduxProperties||new Map,n.reduxProperties.set(e,{selector:null!==(r=o.selector)&&void 0!==r?r:t=>t[e],store:o.store})}};var Lr,Ar;navigator.vendor&&navigator.vendor.match(/apple/i)||(null===(Ar=null===(Lr=window.safari)||void 0===Lr?void 0:Lr.pushNotification)||void 0===Ar||Ar.toString());class kr{constructor(t){this.paginatedToc=t,this.nodeByTocId={},this.knownPrettyUrls=new Set,this.duplicatedPrettyUrls=new Set,this.pages=[],this.pageByTocId={}}build(){return{paginationConfiguration:this.paginatedToc.configuration,toc:this.convertNodes(this.paginatedToc.paginatedToc,1),pagesToc:this.extractPagesToc(this.paginatedToc.paginatedToc,1),nodeByTocId:this.nodeByTocId,duplicatedPrettyUrls:this.duplicatedPrettyUrls,pages:this.pages,pageByTocId:this.pageByTocId}}extractPagesToc(t,o,e){return t.flatMap((t=>(t.pageConfiguration&&this.registerPage(this.buildPage(t,e)),null==t.tocId?this.extractPagesToc(t.children,o,e):[{tocId:t.tocId,title:t.title,depth:o,children:this.extractPagesToc(t.children,o+1,t.tocId)}])))}convertNodes(t,o,e){return t.flatMap((t=>{var r,i,n;if(null==t.tocId)return[...this.convertSectionNodes(null!==(r=t.pageToc)&&void 0!==r?r:[],o,t.tocId),...this.convertNodes(t.children,o,t.tocId)];let a=null===(i=t.prettyUrl)||void 0===i?void 0:i.replace(/^\//,"");const s={tocId:t.tocId,contentId:t.contentId,title:t.title,hasRating:t.hasRating,origin:t.origin,prettyUrl:a,depth:o,parentTocId:e,children:[]};this.register(s);const c=this.convertSectionNodes(null!==(n=t.pageToc)&&void 0!==n?n:[],o+1,t.tocId),l=this.convertNodes(t.children,o+1,s.tocId);return s.children=[...c,...l],[s]}))}convertSectionNodes(t,o,e){return t.flatMap((t=>{var r;let i=null===(r=t.prettyUrl)||void 0===r?void 0:r.replace(/^\//,"");const n={...t,prettyUrl:i,depth:o,parentTocId:e,children:[]};return this.register(n),n.children=this.convertSectionNodes(t.children,o+1,t.tocId),[n]}))}buildPage(t,o){var e,r,i,n,a,s;const c={number:this.pages.length+1,title:null!==(e=t.title)&&void 0!==e?e:"",rootTocId:null!==(r=t.tocId)&&void 0!==r?r:"root",toc:(null!==(i=t.pageToc)&&void 0!==i?i:[]).map((t=>this.nodeByTocId[t.tocId])),topics:[],hiddenTopics:[],breadcrumb:o?this.buildBreadcrumb(this.nodeByTocId[o]):[]},l=(t,o)=>(o?c.topics:c.hiddenTopics).push(t),f=null!==(a=null===(n=t.pageConfiguration)||void 0===n?void 0:n.parentsVisibility)&&void 0!==a?a:[];return c.breadcrumb.forEach(((t,o)=>{l(t,f[o])})),t.tocId&&l(t.tocId,t.pageConfiguration.isVisible),c.topics.push(...this.tocIds(null!==(s=t.pageToc)&&void 0!==s?s:[])),c}registerPage(t){for(let o of[...t.topics,...t.hiddenTopics])this.pageByTocId[o]||(this.pageByTocId[o]=t);this.pages.push(t)}tocIds(t){return t.flatMap((t=>[t.tocId,...this.tocIds(t.children)]))}buildBreadcrumb(t){const o=[t.tocId];for(;null==t?void 0:t.parentTocId;)o.unshift(t.parentTocId),t=this.nodeByTocId[t.parentTocId];return o}register(t){t.prettyUrl&&(this.knownPrettyUrls.has(t.prettyUrl)&&this.duplicatedPrettyUrls.add(t.prettyUrl),this.knownPrettyUrls.add(t.prettyUrl)),this.nodeByTocId[t.tocId]=t}}class Wr{convertPaginatedToc(t){return new kr(t).build()}}var Tr,Kr,Pr,jr,Mr,Fr,Zr,Br,Dr,_r,$r,zr,Gr,Hr;!function(t){!function(o){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};function n(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function s(t){var o={next:function(){var o=t.shift();return{done:void 0===o,value:o}}};return e.iterable&&(o[Symbol.iterator]=function(){return o}),o}function c(t){this.map={},t instanceof c?t.forEach((function(t,o){this.append(o,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(o){this.append(o,t[o])}),this)}function l(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise((function(o,e){t.onload=function(){o(t.result)},t.onerror=function(){e(t.error)}}))}function h(t){var o=new FileReader,e=f(o);return o.readAsArrayBuffer(t),e}function u(t){if(t.slice)return t.slice(0);var o=new Uint8Array(t.byteLength);return o.set(new Uint8Array(t)),o.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(t){var o;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:e.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:e.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():e.arrayBuffer&&e.blob&&((o=t)&&DataView.prototype.isPrototypeOf(o))?(this._bodyArrayBuffer=u(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||i(t))?this._bodyArrayBuffer=u(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return function(t){var o=new FileReader,e=f(o);return o.readAsText(t),e}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var o=new Uint8Array(t),e=new Array(o.length),r=0;r<o.length;r++)e[r]=String.fromCharCode(o[r]);return e.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(t,o){t=n(t),o=a(o);var e=this.map[t];this.map[t]=e?e+", "+o:o},c.prototype.delete=function(t){delete this.map[n(t)]},c.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},c.prototype.set=function(t,o){this.map[n(t)]=a(o)},c.prototype.forEach=function(t,o){for(var e in this.map)this.map.hasOwnProperty(e)&&t.call(o,this.map[e],e,this)},c.prototype.keys=function(){var t=[];return this.forEach((function(o,e){t.push(e)})),s(t)},c.prototype.values=function(){var t=[];return this.forEach((function(o){t.push(o)})),s(t)},c.prototype.entries=function(){var t=[];return this.forEach((function(o,e){t.push([e,o])})),s(t)},e.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(t,o){var e,r,i=(o=o||{}).body;if(t instanceof y){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,o.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=o.credentials||this.credentials||"same-origin",!o.headers&&this.headers||(this.headers=new c(o.headers)),this.method=(e=o.method||this.method||"GET",r=e.toUpperCase(),p.indexOf(r)>-1?r:e),this.mode=o.mode||this.mode||null,this.signal=o.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function b(t){var o=new FormData;return t.trim().split("&").forEach((function(t){if(t){var e=t.split("="),r=e.shift().replace(/\+/g," "),i=e.join("=").replace(/\+/g," ");o.append(decodeURIComponent(r),decodeURIComponent(i))}})),o}function g(t,o){o||(o={}),this.type="default",this.status=void 0===o.status?200:o.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in o?o.statusText:"OK",this.headers=new c(o.headers),this.url=o.url||"",this._initBody(t)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},d.call(y.prototype),d.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},g.error=function(){var t=new g(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];g.redirect=function(t,o){if(-1===m.indexOf(o))throw new RangeError("Invalid status code");return new g(null,{status:o,headers:{location:t}})},o.DOMException=t.DOMException;try{new o.DOMException}catch(t){o.DOMException=function(t,o){this.message=t,this.name=o;var e=Error(t);this.stack=e.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function v(t,r){return new Promise((function(i,n){var a=new y(t,r);if(a.signal&&a.signal.aborted)return n(new o.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function l(){s.abort()}s.onload=function(){var t,o,e={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",o=new c,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var e=t.split(":"),r=e.shift().trim();if(r){var i=e.join(":").trim();o.append(r,i)}})),o)};e.url="responseURL"in s?s.responseURL:e.headers.get("X-Request-URL");var r="response"in s?s.response:s.responseText;i(new g(r,e))},s.onerror=function(){n(new TypeError("Network request failed"))},s.ontimeout=function(){n(new TypeError("Network request failed"))},s.onabort=function(){n(new o.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&e.blob&&(s.responseType="blob"),a.headers.forEach((function(t,o){s.setRequestHeader(o,t)})),a.signal&&(a.signal.addEventListener("abort",l),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",l)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}v.polyfill=!0,t.fetch||(t.fetch=v,t.Headers=c,t.Request=y,t.Response=g),o.Headers=c,o.Request=y,o.Response=g,o.fetch=v,Object.defineProperty(o,"U",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(Tr||(Tr={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(Kr||(Kr={})),function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"}(Pr||(Pr={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(jr||(jr={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(Mr||(Mr={})),function(t){t.ASC="ASC",t.DESC="DESC"}(Fr||(Fr={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(Zr||(Zr={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(Br||(Br={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(Dr||(Dr={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(_r||(_r={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}($r||($r={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(zr||(zr={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS"}(Gr||(Gr={})),function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(Hr||(Hr={}));const qr={[Hr.PERSONAL_BOOK_SHARE_USER]:[Hr.PERSONAL_BOOK_USER],[Hr.HTML_EXPORT_USER]:[Hr.PERSONAL_BOOK_USER],[Hr.PDF_EXPORT_USER]:[Hr.PERSONAL_BOOK_USER],[Hr.KHUB_ADMIN]:[Hr.CONTENT_PUBLISHER],[Hr.ADMIN]:[Hr.KHUB_ADMIN,Hr.USERS_ADMIN,Hr.PORTAL_ADMIN],[Hr.DEVELOPER]:[Hr.BETA_USER,Hr.DEBUG_USER]};function Yr(t,o){return t===o||(qr[t]??[]).some((t=>Yr(t,o)))}function Vr(t,o){if(null==t)return!1;return(Array.isArray(t)?t:Array.isArray(t.roles)?t.roles:Array.isArray(t.profile?.roles)?t.profile.roles:[]).some((t=>Yr(t,o)))}var Jr;t.FtReaderFeatures=void 0,(Jr=t.FtReaderFeatures||(t.FtReaderFeatures={})).FEEDBACK="FEEDBACK",Jr.RATING="RATING",Jr.PRINT="PRINT",Jr.BOOKMARK="BOOKMARK",Jr.COLLECTIONS="COLLECTIONS",Jr.PERSONAL_BOOKS="PERSONAL_BOOKS";const Xr=mt`
102
- `,Qr=xr.get({name:"ft-app-info",reducers:{setBaseUrl:(t,o)=>{t.baseUrl=o.payload},setApiIntegrationIdentifier:(t,o)=>{t.apiIntegrationIdentifier=o.payload},setUiLocale:(t,o)=>{t.uiLocale=o.payload},setAvailableUiLocales:(t,o)=>{t.availableUiLocales=o.payload},setEditorMode:(t,o)=>{t.editorMode=o.payload},setNoCustom:(t,o)=>{t.noCustom=o.payload},setNoCustomComponent:(t,o)=>{t.noCustomComponent=o.payload},setSession:(t,o)=>{t.session=o.payload}},initialState:{uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],editorMode:!1,noCustom:!1,noCustomComponent:!1}});class ti{static build(t){const{baseUrl:o,apiIntegrationIdentifier:e}=Qr.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static get(t){var o;return null!=t?ti.build(t):null!==(o=ti.API)&&void 0!==o?o:ti.API=ti.build()}static await(t){return new Promise((o=>{let e=ti.get(t);if(e)o(e);else{const r=Qr.subscribe((()=>{e=ti.get(t),e&&(r(),o(e))}))}}))}}var oi;const ei=Symbol("clearAfterUnitTest");class ri{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new r,this.listeners={},this.currentUiLocale="",this[oi]=()=>{this.defaultMessages={},this.cache=new r,this.listeners={}},this.currentUiLocale=Qr.getState().uiLocale,Qr.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Qr.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,o){var e;if(t=t.toLowerCase(),Object.keys(o).length>0){const r={...null!==(e=this.defaultMessages[t])&&void 0!==e?e:{},...o};L(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,o,...e){var r,i,n;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(i=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==i?i:{};return new ko(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},a).resolve(o,...e)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>I(0).then((()=>t())).catch((()=>null)))))}}oi=ei,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new ri((async(t,o)=>(await ti.await()).getFluidTopicsMessageContext(t,o)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new ri((async(t,o)=>(await ti.await()).getCustomMessageContext(t,o))));const ii=window.FluidTopicsI18nService;var ni=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class ai extends Lo{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.availableUiLocales=[],this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>ti.get(),this.cache=new r,this.cleanSessionDebouncer=new x}render(){return to`
101
+ `;class ko{constructor(t,o){this.defaultLabels=t,this.labels=o}resolve(t,...o){var e,r;t=this.resolvePluralKey(t,o);let i=null!==(r=null!==(e=this.labels[t])&&void 0!==e?e:this.defaultLabels[t])&&void 0!==r?r:"";return o.forEach(((t,o)=>i=i.replace(new RegExp(`\\{${o}([^}]*)\\}`,"g"),((o,e)=>this.formatValue(t,e))))),i}resolvePluralKey(t,o){for(let e of o)if("number"==typeof e){const o=`${String(t)}[\\=${e}]`;if(o in this.labels||o in this.defaultLabels)return o}return t}formatValue(t,o){return t instanceof Date?this.formatDate(t,o):null!=t?t:""}formatDate(t,o){const e=e=>(null==o?void 0:o.includes("date"))?t.toLocaleDateString(e):(null==o?void 0:o.includes("time"))?t.toLocaleTimeString(e):t.toLocaleString(e);try{return e(document.documentElement.lang)}catch(t){return e()}}}const Wo=t=>{const o=null!=t?t:{};return(t,e)=>{var r;const i={hasChanged:(t,o)=>!L(t,o),attribute:!1,...o};U(i)(t,e);const n=t;n.reduxProperties=n.reduxProperties||new Map,n.reduxProperties.set(e,{selector:null!==(r=o.selector)&&void 0!==r?r:t=>t[e],store:o.store})}};class To{constructor(){this.stack=[]}add(t,o=!1){o&&(this.stack=this.stack.filter((o=>o.type!==t.type))),this.stack.push(t)}consume(t){const o=this.stack.find((o=>o.type===t));return o&&(this.stack=this.stack.filter((t=>t!==o))),o}}function Ko(t){var o;return null!==(o=null==t?void 0:t.isFtReduxStore)&&void 0!==o&&o}var Po,jo,Mo;const Fo=Symbol("internalReduxEventsUnsubscribers"),Zo=Symbol("internalStoresUnsubscribers"),Bo=Symbol("internalStores");class Do extends Lo{constructor(){super(...arguments),this[Po]=new Map,this[jo]=new Map,this[Mo]=[]}update(t){var o;super.update(t),(null===(o=this.reduxReactiveProperties)||void 0===o?void 0:o.some((o=>t.has(o))))&&this.updateFromStores()}getUnnamedStore(){if(this[Bo].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[Bo].values()][0]}getStore(t){return null==t?this.getUnnamedStore():this[Bo].get(t)}addStore(t,o){var e;o=null!==(e=null!=o?o:Ko(t)?t.name:void 0)&&void 0!==e?e:"default-store",this.unsubscribeFromStore(o),this.setupStore(o,t)}removeStore(t){const o="string"==typeof t?t:t.name;this.unsubscribeFromStore(o),this[Bo].delete(o)}setupStore(t,o){this[Bo].set(t,o),this.subscribeToStore(t,o),this.updateFromStores()}setupStores(){this.unsubscribeFromStores(),this[Bo].forEach(((t,o)=>this.subscribeToStore(o,t))),this.updateFromStores()}updateFromStores(){this.reduxProperties&&this.reduxProperties.forEach(((t,o)=>{const e=this.constructor.getPropertyOptions(o);if(!(null==e?void 0:e.attribute)||!this.hasAttribute("string"==typeof(null==e?void 0:e.attribute)?e.attribute:o)){const e=this.getStore(t.store);e&&(t.store?this[Zo].has(t.store):this[Zo].size>0)&&(this[o]=t.selector(e.getState(),this))}}))}subscribeToStore(t,o){var e;this[Zo].set(t,o.subscribe((()=>this.updateFromStores()))),Ko(o)&&o.eventBus&&(null===(e=this.reduxEventListeners)||void 0===e||e.forEach(((t,e)=>{if("function"==typeof this[e]&&(!t.store||o.name===t.store)){const r=t=>this[e](t);o.eventBus.addEventListener(t.eventName,r),this[Fo].push((()=>o.eventBus.removeEventListener(t.eventName,r)))}}))),this.onStoreAvailable(t)}unsubscribeFromStores(){this[Zo].forEach(((t,o)=>this.unsubscribeFromStore(o))),this[Fo].forEach((t=>t())),this[Fo]=[]}unsubscribeFromStore(t){this[Zo].has(t)&&this[Zo].get(t)(),this[Zo].delete(t)}onStoreAvailable(t){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}function _o(t){for(var o=arguments.length,e=Array(o>1?o-1:0),r=1;r<o;r++)e[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+t+(e.length?" "+e.map((function(t){return"'"+t+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function $o(t){return!!t&&!!t[Le]}function zo(t){var o;return!!t&&(function(t){if(!t||"object"!=typeof t)return!1;var o=Object.getPrototypeOf(t);if(null===o)return!0;var e=Object.hasOwnProperty.call(o,"constructor")&&o.constructor;return e===Object||"function"==typeof e&&Function.toString.call(e)===Ae}(t)||Array.isArray(t)||!!t[Ie]||!!(null===(o=t.constructor)||void 0===o?void 0:o[Ie])||Jo(t)||Xo(t))}function Go(t,o,e){void 0===e&&(e=!1),0===Ho(t)?(e?Object.keys:ke)(t).forEach((function(r){e&&"symbol"==typeof r||o(r,t[r],t)})):t.forEach((function(e,r){return o(r,e,t)}))}function Ho(t){var o=t[Le];return o?o.i>3?o.i-4:o.i:Array.isArray(t)?1:Jo(t)?2:Xo(t)?3:0}function qo(t,o){return 2===Ho(t)?t.has(o):Object.prototype.hasOwnProperty.call(t,o)}function Yo(t,o,e){var r=Ho(t);2===r?t.set(o,e):3===r?t.add(e):t[o]=e}function Vo(t,o){return t===o?0!==t||1/t==1/o:t!=t&&o!=o}function Jo(t){return Ce&&t instanceof Map}function Xo(t){return Re&&t instanceof Set}function Qo(t){return t.o||t.t}function te(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var o=We(t);delete o[Le];for(var e=ke(o),r=0;r<e.length;r++){var i=e[r],n=o[i];!1===n.writable&&(n.writable=!0,n.configurable=!0),(n.get||n.set)&&(o[i]={configurable:!0,writable:!0,enumerable:n.enumerable,value:t[i]})}return Object.create(Object.getPrototypeOf(t),o)}function oe(t,o){return void 0===o&&(o=!1),re(t)||$o(t)||!zo(t)||(Ho(t)>1&&(t.set=t.add=t.clear=t.delete=ee),Object.freeze(t),o&&Go(t,(function(t,o){return oe(o,!0)}),!0)),t}function ee(){_o(2)}function re(t){return null==t||"object"!=typeof t||Object.isFrozen(t)}function ie(t){var o=Te[t];return o||_o(18,t),o}function ne(){return Se}function ae(t,o){o&&(ie("Patches"),t.u=[],t.s=[],t.v=o)}function se(t){ce(t),t.p.forEach(fe),t.p=null}function ce(t){t===Se&&(Se=t.l)}function le(t){return Se={p:[],l:Se,h:t,m:!0,_:0}}function fe(t){var o=t[Le];0===o.i||1===o.i?o.j():o.g=!0}function he(t,o){o._=o.p.length;var e=o.p[0],r=void 0!==t&&t!==e;return o.h.O||ie("ES5").S(o,t,r),r?(e[Le].P&&(se(o),_o(4)),zo(t)&&(t=ue(o,t),o.l||pe(o,t)),o.u&&ie("Patches").M(e[Le].t,t,o.u,o.s)):t=ue(o,e,[]),se(o),o.u&&o.v(o.u,o.s),t!==xe?t:void 0}function ue(t,o,e){if(re(o))return o;var r=o[Le];if(!r)return Go(o,(function(i,n){return de(t,r,o,i,n,e)}),!0),o;if(r.A!==t)return o;if(!r.P)return pe(t,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=te(r.k):r.o,n=i,a=!1;3===r.i&&(n=new Set(i),i.clear(),a=!0),Go(n,(function(o,n){return de(t,r,i,o,n,e,a)})),pe(t,i,!1),e&&t.u&&ie("Patches").N(r,e,t.u,t.s)}return r.o}function de(t,o,e,r,i,n,a){if($o(i)){var s=ue(t,i,n&&o&&3!==o.i&&!qo(o.R,r)?n.concat(r):void 0);if(Yo(e,r,s),!$o(s))return;t.m=!1}else a&&e.add(i);if(zo(i)&&!re(i)){if(!t.h.D&&t._<1)return;ue(t,i),o&&o.A.l||pe(t,i)}}function pe(t,o,e){void 0===e&&(e=!1),!t.l&&t.h.D&&t.m&&oe(o,e)}function ye(t,o){var e=t[Le];return(e?Qo(e):t)[o]}function be(t,o){if(o in t)for(var e=Object.getPrototypeOf(t);e;){var r=Object.getOwnPropertyDescriptor(e,o);if(r)return r;e=Object.getPrototypeOf(e)}}function ge(t){t.P||(t.P=!0,t.l&&ge(t.l))}function me(t){t.o||(t.o=te(t.t))}function ve(t,o,e){var r=Jo(o)?ie("MapSet").F(o,e):Xo(o)?ie("MapSet").T(o,e):t.O?function(t,o){var e=Array.isArray(t),r={i:e?1:0,A:o?o.A:ne(),P:!1,I:!1,R:{},l:o,t,k:null,o:null,j:null,C:!1},i=r,n=Ke;e&&(i=[r],n=Pe);var a=Proxy.revocable(i,n),s=a.revoke,c=a.proxy;return r.k=c,r.j=s,c}(o,e):ie("ES5").J(o,e);return(e?e.A:ne()).p.push(r),r}function Oe(t){return $o(t)||_o(22,t),function t(o){if(!zo(o))return o;var e,r=o[Le],i=Ho(o);if(r){if(!r.P&&(r.i<4||!ie("ES5").K(r)))return r.t;r.I=!0,e=we(o,i),r.I=!1}else e=we(o,i);return Go(e,(function(o,i){r&&function(t,o){return 2===Ho(t)?t.get(o):t[o]}(r.t,o)===i||Yo(e,o,t(i))})),3===i?new Set(e):e}(t)}function we(t,o){switch(o){case 2:return new Map(t);case 3:return Array.from(t)}return te(t)}Po=Zo,jo=Bo,Mo=Fo;var Ne,Se,Ee="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Ce="undefined"!=typeof Map,Re="undefined"!=typeof Set,Ue="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,xe=Ee?Symbol.for("immer-nothing"):((Ne={})["immer-nothing"]=!0,Ne),Ie=Ee?Symbol.for("immer-draftable"):"__$immer_draftable",Le=Ee?Symbol.for("immer-state"):"__$immer_state",Ae=""+Object.prototype.constructor,ke="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,We=Object.getOwnPropertyDescriptors||function(t){var o={};return ke(t).forEach((function(e){o[e]=Object.getOwnPropertyDescriptor(t,e)})),o},Te={},Ke={get:function(t,o){if(o===Le)return t;var e=Qo(t);if(!qo(e,o))return function(t,o,e){var r,i=be(o,e);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(t.k):void 0}(t,e,o);var r=e[o];return t.I||!zo(r)?r:r===ye(t.t,o)?(me(t),t.o[o]=ve(t.A.h,r,t)):r},has:function(t,o){return o in Qo(t)},ownKeys:function(t){return Reflect.ownKeys(Qo(t))},set:function(t,o,e){var r=be(Qo(t),o);if(null==r?void 0:r.set)return r.set.call(t.k,e),!0;if(!t.P){var i=ye(Qo(t),o),n=null==i?void 0:i[Le];if(n&&n.t===e)return t.o[o]=e,t.R[o]=!1,!0;if(Vo(e,i)&&(void 0!==e||qo(t.t,o)))return!0;me(t),ge(t)}return t.o[o]===e&&(void 0!==e||o in t.o)||Number.isNaN(e)&&Number.isNaN(t.o[o])||(t.o[o]=e,t.R[o]=!0),!0},deleteProperty:function(t,o){return void 0!==ye(t.t,o)||o in t.t?(t.R[o]=!1,me(t),ge(t)):delete t.R[o],t.o&&delete t.o[o],!0},getOwnPropertyDescriptor:function(t,o){var e=Qo(t),r=Reflect.getOwnPropertyDescriptor(e,o);return r?{writable:!0,configurable:1!==t.i||"length"!==o,enumerable:r.enumerable,value:e[o]}:r},defineProperty:function(){_o(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){_o(12)}},Pe={};Go(Ke,(function(t,o){Pe[t]=function(){return arguments[0]=arguments[0][0],o.apply(this,arguments)}})),Pe.deleteProperty=function(t,o){return Pe.set.call(this,t,o,void 0)},Pe.set=function(t,o,e){return Ke.set.call(this,t[0],o,e,t[0])};var je=function(){function t(t){var o=this;this.O=Ue,this.D=!0,this.produce=function(t,e,r){if("function"==typeof t&&"function"!=typeof e){var i=e;e=t;var n=o;return function(t){var o=this;void 0===t&&(t=i);for(var r=arguments.length,a=Array(r>1?r-1:0),s=1;s<r;s++)a[s-1]=arguments[s];return n.produce(t,(function(t){var r;return(r=e).call.apply(r,[o,t].concat(a))}))}}var a;if("function"!=typeof e&&_o(6),void 0!==r&&"function"!=typeof r&&_o(7),zo(t)){var s=le(o),c=ve(o,t,void 0),l=!0;try{a=e(c),l=!1}finally{l?se(s):ce(s)}return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(t){return ae(s,r),he(t,s)}),(function(t){throw se(s),t})):(ae(s,r),he(a,s))}if(!t||"object"!=typeof t){if(void 0===(a=e(t))&&(a=t),a===xe&&(a=void 0),o.D&&oe(a,!0),r){var f=[],h=[];ie("Patches").M(t,a,f,h),r(f,h)}return a}_o(21,t)},this.produceWithPatches=function(t,e){if("function"==typeof t)return function(e){for(var r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return o.produceWithPatches(e,(function(o){return t.apply(void 0,[o].concat(i))}))};var r,i,n=o.produce(t,e,(function(t,o){r=t,i=o}));return"undefined"!=typeof Promise&&n instanceof Promise?n.then((function(t){return[t,r,i]})):[n,r,i]},"boolean"==typeof(null==t?void 0:t.useProxies)&&this.setUseProxies(t.useProxies),"boolean"==typeof(null==t?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze)}var o=t.prototype;return o.createDraft=function(t){zo(t)||_o(8),$o(t)&&(t=Oe(t));var o=le(this),e=ve(this,t,void 0);return e[Le].C=!0,ce(o),e},o.finishDraft=function(t,o){var e=(t&&t[Le]).A;return ae(e,o),he(void 0,e)},o.setAutoFreeze=function(t){this.D=t},o.setUseProxies=function(t){t&&!Ue&&_o(20),this.O=t},o.applyPatches=function(t,o){var e;for(e=o.length-1;e>=0;e--){var r=o[e];if(0===r.path.length&&"replace"===r.op){t=r.value;break}}e>-1&&(o=o.slice(e+1));var i=ie("Patches").$;return $o(t)?i(t,o):this.produce(t,(function(t){return i(t,o)}))},t}(),Me=new je,Fe=Me.produce;function Ze(t){return Ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ze(t)}function Be(t){var o=function(t,o){if("object"!==Ze(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,o||"default");if("object"!==Ze(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===o?String:Number)(t)}(t,"string");return"symbol"===Ze(o)?o:String(o)}function De(t,o,e){return(o=Be(o))in t?Object.defineProperty(t,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[o]=e,t}function _e(t,o){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);o&&(r=r.filter((function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),e.push.apply(e,r)}return e}function $e(t){for(var o=1;o<arguments.length;o++){var e=null!=arguments[o]?arguments[o]:{};o%2?_e(Object(e),!0).forEach((function(o){De(t,o,e[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):_e(Object(e)).forEach((function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}))}return t}function ze(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}Me.produceWithPatches.bind(Me),Me.setAutoFreeze.bind(Me),Me.setUseProxies.bind(Me),Me.applyPatches.bind(Me),Me.createDraft.bind(Me),Me.finishDraft.bind(Me);var Ge="function"==typeof Symbol&&Symbol.observable||"@@observable",He=function(){return Math.random().toString(36).substring(7).split("").join(".")},qe={INIT:"@@redux/INIT"+He(),REPLACE:"@@redux/REPLACE"+He(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+He()}};function Ye(t,o,e){var r;if("function"==typeof o&&"function"==typeof e||"function"==typeof e&&"function"==typeof arguments[3])throw new Error(ze(0));if("function"==typeof o&&void 0===e&&(e=o,o=void 0),void 0!==e){if("function"!=typeof e)throw new Error(ze(1));return e(Ye)(t,o)}if("function"!=typeof t)throw new Error(ze(2));var i=t,n=o,a=[],s=a,c=!1;function l(){s===a&&(s=a.slice())}function f(){if(c)throw new Error(ze(3));return n}function h(t){if("function"!=typeof t)throw new Error(ze(4));if(c)throw new Error(ze(5));var o=!0;return l(),s.push(t),function(){if(o){if(c)throw new Error(ze(6));o=!1,l();var e=s.indexOf(t);s.splice(e,1),a=null}}}function u(t){if(!function(t){if("object"!=typeof t||null===t)return!1;for(var o=t;null!==Object.getPrototypeOf(o);)o=Object.getPrototypeOf(o);return Object.getPrototypeOf(t)===o}(t))throw new Error(ze(7));if(void 0===t.type)throw new Error(ze(8));if(c)throw new Error(ze(9));try{c=!0,n=i(n,t)}finally{c=!1}for(var o=a=s,e=0;e<o.length;e++){(0,o[e])()}return t}return u({type:qe.INIT}),(r={dispatch:u,subscribe:h,getState:f,replaceReducer:function(t){if("function"!=typeof t)throw new Error(ze(10));i=t,u({type:qe.REPLACE})}})[Ge]=function(){var t,o=h;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(ze(11));function e(){t.next&&t.next(f())}return e(),{unsubscribe:o(e)}}})[Ge]=function(){return this},t},r}function Ve(t){for(var o=Object.keys(t),e={},r=0;r<o.length;r++){var i=o[r];"function"==typeof t[i]&&(e[i]=t[i])}var n,a=Object.keys(e);try{!function(t){Object.keys(t).forEach((function(o){var e=t[o];if(void 0===e(void 0,{type:qe.INIT}))throw new Error(ze(12));if(void 0===e(void 0,{type:qe.PROBE_UNKNOWN_ACTION()}))throw new Error(ze(13))}))}(e)}catch(t){n=t}return function(t,o){if(void 0===t&&(t={}),n)throw n;for(var r=!1,i={},s=0;s<a.length;s++){var c=a[s],l=e[c],f=t[c],h=l(f,o);if(void 0===h)throw o&&o.type,new Error(ze(14));i[c]=h,r=r||h!==f}return(r=r||a.length!==Object.keys(t).length)?i:t}}function Je(){for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return 0===o.length?function(t){return t}:1===o.length?o[0]:o.reduce((function(t,o){return function(){return t(o.apply(void 0,arguments))}}))}function Xe(){for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return function(t){return function(){var e=t.apply(void 0,arguments),r=function(){throw new Error(ze(15))},i={getState:e.getState,dispatch:function(){return r.apply(void 0,arguments)}},n=o.map((function(t){return t(i)}));return r=Je.apply(void 0,n)(e.dispatch),$e($e({},e),{},{dispatch:r})}}}function Qe(t){return function(o){var e=o.dispatch,r=o.getState;return function(o){return function(i){return"function"==typeof i?i(e,r,t):o(i)}}}}var tr=Qe();tr.withExtraArgument=Qe;var or,er=tr,rr=(or=function(t,o){return or=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&(t[e]=o[e])},or(t,o)},function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function e(){this.constructor=t}or(t,o),t.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}),ir=function(t,o){var e,r,i,n,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return n={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function s(n){return function(s){return function(n){if(e)throw new TypeError("Generator is already executing.");for(;a;)try{if(e=1,r&&(i=2&n[0]?r.return:n[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,n[1])).done)return i;switch(r=0,i&&(n=[2&n[0],i.value]),n[0]){case 0:case 1:i=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,r=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==n[0]&&2!==n[0])){a=0;continue}if(3===n[0]&&(!i||n[1]>i[0]&&n[1]<i[3])){a.label=n[1];break}if(6===n[0]&&a.label<i[1]){a.label=i[1],i=n;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(n);break}i[2]&&a.ops.pop(),a.trys.pop();continue}n=o.call(t,a)}catch(t){n=[6,t],r=0}finally{e=i=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,s])}}},nr=function(t,o){for(var e=0,r=o.length,i=t.length;e<r;e++,i++)t[i]=o[e];return t},ar=Object.defineProperty,sr=Object.defineProperties,cr=Object.getOwnPropertyDescriptors,lr=Object.getOwnPropertySymbols,fr=Object.prototype.hasOwnProperty,hr=Object.prototype.propertyIsEnumerable,ur=function(t,o,e){return o in t?ar(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e},dr=function(t,o){for(var e in o||(o={}))fr.call(o,e)&&ur(t,e,o[e]);if(lr)for(var r=0,i=lr(o);r<i.length;r++){e=i[r];hr.call(o,e)&&ur(t,e,o[e])}return t},pr=function(t,o){return sr(t,cr(o))},yr="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Je:Je.apply(null,arguments)};var br=function(t){function o(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var i=t.apply(this,e)||this;return Object.setPrototypeOf(i,o.prototype),i}return rr(o,t),Object.defineProperty(o,Symbol.species,{get:function(){return o},enumerable:!1,configurable:!0}),o.prototype.concat=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];return t.prototype.concat.apply(this,o)},o.prototype.prepend=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&Array.isArray(t[0])?new(o.bind.apply(o,nr([void 0],t[0].concat(this)))):new(o.bind.apply(o,nr([void 0],t.concat(this))))},o}(Array),gr=function(t){function o(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var i=t.apply(this,e)||this;return Object.setPrototypeOf(i,o.prototype),i}return rr(o,t),Object.defineProperty(o,Symbol.species,{get:function(){return o},enumerable:!1,configurable:!0}),o.prototype.concat=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];return t.prototype.concat.apply(this,o)},o.prototype.prepend=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&Array.isArray(t[0])?new(o.bind.apply(o,nr([void 0],t[0].concat(this)))):new(o.bind.apply(o,nr([void 0],t.concat(this))))},o}(Array);function mr(t){return zo(t)?Fe(t,(function(){})):t}function vr(){return function(t){return function(t){void 0===t&&(t={});var o=t.thunk,e=void 0===o||o;t.immutableCheck,t.serializableCheck;var r=new br;e&&(!function(t){return"boolean"==typeof t}(e)?r.push(er.withExtraArgument(e.extraArgument)):r.push(er));return r}(t)}}function Or(t){var o,e=vr(),r=t||{},i=r.reducer,n=void 0===i?void 0:i,a=r.middleware,s=void 0===a?e():a,c=r.devTools,l=void 0===c||c,f=r.preloadedState,h=void 0===f?void 0:f,u=r.enhancers,d=void 0===u?void 0:u;if("function"==typeof n)o=n;else{if(!function(t){if("object"!=typeof t||null===t)return!1;var o=Object.getPrototypeOf(t);if(null===o)return!0;for(var e=o;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return o===e}(n))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');o=Ve(n)}var p=s;"function"==typeof p&&(p=p(e));var y=Xe.apply(void 0,p),b=Je;l&&(b=yr(dr({trace:!1},"object"==typeof l&&l)));var g=new gr(y),m=g;return Array.isArray(d)?m=nr([y],d):"function"==typeof d&&(m=d(g)),Ye(o,h,b.apply(void 0,m))}function wr(t,o){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(o){var i=o.apply(void 0,e);if(!i)throw new Error("prepareAction did not return an object");return dr(dr({type:t,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:t,payload:e[0]}}return e.toString=function(){return""+t},e.type=t,e.match=function(o){return o.type===t},e}function Nr(t){var o,e={},r=[],i={addCase:function(t,o){var r="string"==typeof t?t:t.type;if(r in e)throw new Error("addCase cannot be called with two reducers for the same action type");return e[r]=o,i},addMatcher:function(t,o){return r.push({matcher:t,reducer:o}),i},addDefaultCase:function(t){return o=t,i}};return t(i),[e,r,o]}function Sr(t){var o=t.name;if(!o)throw new Error("`name` is a required option for createSlice");var e,r="function"==typeof t.initialState?t.initialState:mr(t.initialState),i=t.reducers||{},n=Object.keys(i),a={},s={},c={};function l(){var o="function"==typeof t.extraReducers?Nr(t.extraReducers):[t.extraReducers],e=o[0],i=void 0===e?{}:e,n=o[1],a=void 0===n?[]:n,c=o[2],l=void 0===c?void 0:c,f=dr(dr({},i),s);return function(t,o,e,r){void 0===e&&(e=[]);var i,n="function"==typeof o?Nr(o):[o,e,r],a=n[0],s=n[1],c=n[2];if(function(t){return"function"==typeof t}(t))i=function(){return mr(t())};else{var l=mr(t);i=function(){return l}}function f(t,o){void 0===t&&(t=i());var e=nr([a[o.type]],s.filter((function(t){return(0,t.matcher)(o)})).map((function(t){return t.reducer})));return 0===e.filter((function(t){return!!t})).length&&(e=[c]),e.reduce((function(t,e){if(e){var r;if($o(t))return void 0===(r=e(t,o))?t:r;if(zo(t))return Fe(t,(function(t){return e(t,o)}));if(void 0===(r=e(t,o))){if(null===t)return t;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return t}),t)}return f.getInitialState=i,f}(r,(function(t){for(var o in f)t.addCase(o,f[o]);for(var e=0,r=a;e<r.length;e++){var i=r[e];t.addMatcher(i.matcher,i.reducer)}l&&t.addDefaultCase(l)}))}return n.forEach((function(t){var e,r,n=i[t],l=o+"/"+t;"reducer"in n?(e=n.reducer,r=n.prepare):e=n,a[t]=e,s[l]=e,c[t]=r?wr(l,r):wr(l)})),{name:o,reducer:function(t,o){return e||(e=l()),e(t,o)},actions:c,caseReducers:a,getInitialState:function(){return e||(e=l()),e.getInitialState()}}}var Er=["name","message","stack","code"],Cr=function(t,o){this.payload=t,this.meta=o},Rr=function(t,o){this.payload=t,this.meta=o},Ur=function(t){if("object"==typeof t&&null!==t){for(var o={},e=0,r=Er;e<r.length;e++){var i=r[e];"string"==typeof t[i]&&(o[i]=t[i])}return o}return{message:String(t)}};function xr(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}!function(){function t(t,o,e){var r=wr(t+"/fulfilled",(function(t,o,e,r){return{payload:t,meta:pr(dr({},r||{}),{arg:e,requestId:o,requestStatus:"fulfilled"})}})),i=wr(t+"/pending",(function(t,o,e){return{payload:void 0,meta:pr(dr({},e||{}),{arg:o,requestId:t,requestStatus:"pending"})}})),n=wr(t+"/rejected",(function(t,o,r,i,n){return{payload:i,error:(e&&e.serializeError||Ur)(t||"Rejected"),meta:pr(dr({},n||{}),{arg:r,requestId:o,rejectedWithValue:!!i,requestStatus:"rejected",aborted:"AbortError"===(null==t?void 0:t.name),condition:"ConditionError"===(null==t?void 0:t.name)})}})),a="undefined"!=typeof AbortController?AbortController:function(){function t(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return t.prototype.abort=function(){},t}();return Object.assign((function(t){return function(s,c,l){var f,h=(null==e?void 0:e.idGenerator)?e.idGenerator(t):function(t){void 0===t&&(t=21);for(var o="",e=t;e--;)o+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return o}(),u=new a;function d(t){f=t,u.abort()}var p=function(){return a=this,p=null,y=function(){var a,p,y,b,g,m;return ir(this,(function(v){switch(v.label){case 0:return v.trys.push([0,4,,5]),b=null==(a=null==e?void 0:e.condition)?void 0:a.call(e,t,{getState:c,extra:l}),null===(O=b)||"object"!=typeof O||"function"!=typeof O.then?[3,2]:[4,b];case 1:b=v.sent(),v.label=2;case 2:if(!1===b||u.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return g=new Promise((function(t,o){return u.signal.addEventListener("abort",(function(){return o({name:"AbortError",message:f||"Aborted"})}))})),s(i(h,t,null==(p=null==e?void 0:e.getPendingMeta)?void 0:p.call(e,{requestId:h,arg:t},{getState:c,extra:l}))),[4,Promise.race([g,Promise.resolve(o(t,{dispatch:s,getState:c,extra:l,requestId:h,signal:u.signal,abort:d,rejectWithValue:function(t,o){return new Cr(t,o)},fulfillWithValue:function(t,o){return new Rr(t,o)}})).then((function(o){if(o instanceof Cr)throw o;return o instanceof Rr?r(o.payload,h,t,o.meta):r(o,h,t)}))])];case 3:return y=v.sent(),[3,5];case 4:return m=v.sent(),y=m instanceof Cr?n(null,h,t,m.payload,m.meta):n(m,h,t),[3,5];case 5:return e&&!e.dispatchConditionRejection&&n.match(y)&&y.meta.condition||s(y),[2,y]}var O}))},new Promise((function(t,o){var e=function(t){try{i(y.next(t))}catch(t){o(t)}},r=function(t){try{i(y.throw(t))}catch(t){o(t)}},i=function(o){return o.done?t(o.value):Promise.resolve(o.value).then(e,r)};i((y=y.apply(a,p)).next())}));var a,p,y}();return Object.assign(p,{abort:d,requestId:h,arg:t,unwrap:function(){return p.then(xr)}})}}),{pending:i,rejected:n,fulfilled:r,typePrefix:t})}t.withTypes=function(){return t}}();var Ir,Lr,Ar="listenerMiddleware";wr(Ar+"/add"),wr(Ar+"/removeAll"),wr(Ar+"/remove"),"function"==typeof queueMicrotask&&queueMicrotask.bind("undefined"!=typeof window?window:"undefined"!=typeof global?global:globalThis),function(){function t(t,o){var e=i[t];return e?e.enumerable=o:i[t]=e={configurable:!0,enumerable:o,get:function(){var o=this[Le];return Ke.get(o,t)},set:function(o){var e=this[Le];Ke.set(e,t,o)}},e}function o(t){for(var o=t.length-1;o>=0;o--){var i=t[o][Le];if(!i.P)switch(i.i){case 5:r(i)&&ge(i);break;case 4:e(i)&&ge(i)}}}function e(t){for(var o=t.t,e=t.k,r=ke(e),i=r.length-1;i>=0;i--){var n=r[i];if(n!==Le){var a=o[n];if(void 0===a&&!qo(o,n))return!0;var s=e[n],c=s&&s[Le];if(c?c.t!==a:!Vo(s,a))return!0}}var l=!!o[Le];return r.length!==ke(o).length+(l?0:1)}function r(t){var o=t.k;if(o.length!==t.t.length)return!0;var e=Object.getOwnPropertyDescriptor(o,o.length-1);if(e&&!e.get)return!0;for(var r=0;r<o.length;r++)if(!o.hasOwnProperty(r))return!0;return!1}var i={};!function(t,o){Te[t]||(Te[t]=o)}("ES5",{J:function(o,e){var r=Array.isArray(o),i=function(o,e){if(o){for(var r=Array(e.length),i=0;i<e.length;i++)Object.defineProperty(r,""+i,t(i,!0));return r}var n=We(e);delete n[Le];for(var a=ke(n),s=0;s<a.length;s++){var c=a[s];n[c]=t(c,o||!!n[c].enumerable)}return Object.create(Object.getPrototypeOf(e),n)}(r,o),n={i:r?5:4,A:e?e.A:ne(),P:!1,I:!1,R:{},l:e,t:o,k:i,o:null,g:!1,C:!1};return Object.defineProperty(i,Le,{value:n,writable:!0}),i},S:function(t,e,i){i?$o(e)&&e[Le].A===t&&o(t.p):(t.u&&function t(o){if(o&&"object"==typeof o){var e=o[Le];if(e){var i=e.t,n=e.k,a=e.R,s=e.i;if(4===s)Go(n,(function(o){o!==Le&&(void 0!==i[o]||qo(i,o)?a[o]||t(n[o]):(a[o]=!0,ge(e)))})),Go(i,(function(t){void 0!==n[t]||qo(n,t)||(a[t]=!1,ge(e))}));else if(5===s){if(r(e)&&(ge(e),a.length=!0),n.length<i.length)for(var c=n.length;c<i.length;c++)a[c]=!1;else for(var l=i.length;l<n.length;l++)a[l]=!0;for(var f=Math.min(n.length,i.length),h=0;h<f;h++)n.hasOwnProperty(h)||(a[h]=!0),void 0===a[h]&&t(n[h])}}}}(t.p[0]),o(t.p))},K:function(t){return 4===t.i?e(t):r(t)}})}(),window.ftReduxStores||(window.ftReduxStores={});class kr{static get(t){var o;const e="string"==typeof t?t:t.name,r="string"==typeof t?void 0:t,i=window.ftReduxStores[e];if(Ko(i))return i;if(null==r)return;const n=Sr({...r,reducers:null!==(o=r.reducers)&&void 0!==o?o:{}}),a=Or({reducer:(t,o)=>{var e;switch(o.type){case"CLEAR_FT_REDUX_STORE":return n.getInitialState();case"DEFAULT_STATE_FIELDS_VALUES_SETTER":return{...t,...null!==(e=o.overwrites)&&void 0!==e?e:{}};default:return n.reducer(t,o)}}});return window.ftReduxStores[r.name]=new kr(n,a)}constructor(t,o){this.reduxSlice=t,this.reduxStore=o,this.isFtReduxStore=!0,this.eventBus=document.createElement("event-bus"),this.commands=new To,this.actions=new Proxy(this.reduxSlice.actions,{get:(t,o,e)=>{const r=o,i=t[r];return i?(...t)=>{const o=i(...t);return this.reduxStore.dispatch(o),o}:t=>{this.setState({[r]:t})}}})}clear(){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE"})}setState(t){this.reduxStore.dispatch({type:"DEFAULT_STATE_FIELDS_VALUES_SETTER",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()}}navigator.vendor&&navigator.vendor.match(/apple/i)||(null===(Lr=null===(Ir=window.safari)||void 0===Ir?void 0:Ir.pushNotification)||void 0===Lr||Lr.toString());class Wr{constructor(t){this.paginatedToc=t,this.nodeByTocId={},this.knownPrettyUrls=new Set,this.duplicatedPrettyUrls=new Set,this.pages=[],this.pageByTocId={}}build(){return{paginationConfiguration:this.paginatedToc.configuration,toc:this.convertNodes(this.paginatedToc.paginatedToc,1),pagesToc:this.extractPagesToc(this.paginatedToc.paginatedToc,1),nodeByTocId:this.nodeByTocId,duplicatedPrettyUrls:this.duplicatedPrettyUrls,pages:this.pages,pageByTocId:this.pageByTocId}}extractPagesToc(t,o,e){return t.flatMap((t=>(t.pageConfiguration&&this.registerPage(this.buildPage(t,e)),null==t.tocId?this.extractPagesToc(t.children,o,e):[{tocId:t.tocId,title:t.title,depth:o,children:this.extractPagesToc(t.children,o+1,t.tocId)}])))}convertNodes(t,o,e){return t.flatMap((t=>{var r,i,n;if(null==t.tocId)return[...this.convertSectionNodes(null!==(r=t.pageToc)&&void 0!==r?r:[],o,t.tocId),...this.convertNodes(t.children,o,t.tocId)];let a=null===(i=t.prettyUrl)||void 0===i?void 0:i.replace(/^\//,"");const s={tocId:t.tocId,contentId:t.contentId,title:t.title,hasRating:t.hasRating,origin:t.origin,prettyUrl:a,depth:o,parentTocId:e,children:[]};this.register(s);const c=this.convertSectionNodes(null!==(n=t.pageToc)&&void 0!==n?n:[],o+1,t.tocId),l=this.convertNodes(t.children,o+1,s.tocId);return s.children=[...c,...l],[s]}))}convertSectionNodes(t,o,e){return t.flatMap((t=>{var r;let i=null===(r=t.prettyUrl)||void 0===r?void 0:r.replace(/^\//,"");const n={...t,prettyUrl:i,depth:o,parentTocId:e,children:[]};return this.register(n),n.children=this.convertSectionNodes(t.children,o+1,t.tocId),[n]}))}buildPage(t,o){var e,r,i,n,a,s;const c={number:this.pages.length+1,title:null!==(e=t.title)&&void 0!==e?e:"",rootTocId:null!==(r=t.tocId)&&void 0!==r?r:"root",toc:(null!==(i=t.pageToc)&&void 0!==i?i:[]).map((t=>this.nodeByTocId[t.tocId])),topics:[],hiddenTopics:[],breadcrumb:o?this.buildBreadcrumb(this.nodeByTocId[o]):[]},l=(t,o)=>(o?c.topics:c.hiddenTopics).push(t),f=null!==(a=null===(n=t.pageConfiguration)||void 0===n?void 0:n.parentsVisibility)&&void 0!==a?a:[];return c.breadcrumb.forEach(((t,o)=>{l(t,f[o])})),t.tocId&&l(t.tocId,t.pageConfiguration.isVisible),c.topics.push(...this.tocIds(null!==(s=t.pageToc)&&void 0!==s?s:[])),c}registerPage(t){for(let o of[...t.topics,...t.hiddenTopics])this.pageByTocId[o]||(this.pageByTocId[o]=t);this.pages.push(t)}tocIds(t){return t.flatMap((t=>[t.tocId,...this.tocIds(t.children)]))}buildBreadcrumb(t){const o=[t.tocId];for(;null==t?void 0:t.parentTocId;)o.unshift(t.parentTocId),t=this.nodeByTocId[t.parentTocId];return o}register(t){t.prettyUrl&&(this.knownPrettyUrls.has(t.prettyUrl)&&this.duplicatedPrettyUrls.add(t.prettyUrl),this.knownPrettyUrls.add(t.prettyUrl)),this.nodeByTocId[t.tocId]=t}}class Tr{convertPaginatedToc(t){return new Wr(t).build()}}var Kr,Pr,jr,Mr,Fr,Zr,Br,Dr,_r,$r,zr,Gr,Hr,qr;!function(t){!function(o){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};function n(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function s(t){var o={next:function(){var o=t.shift();return{done:void 0===o,value:o}}};return e.iterable&&(o[Symbol.iterator]=function(){return o}),o}function c(t){this.map={},t instanceof c?t.forEach((function(t,o){this.append(o,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(o){this.append(o,t[o])}),this)}function l(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise((function(o,e){t.onload=function(){o(t.result)},t.onerror=function(){e(t.error)}}))}function h(t){var o=new FileReader,e=f(o);return o.readAsArrayBuffer(t),e}function u(t){if(t.slice)return t.slice(0);var o=new Uint8Array(t.byteLength);return o.set(new Uint8Array(t)),o.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(t){var o;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:e.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:e.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():e.arrayBuffer&&e.blob&&((o=t)&&DataView.prototype.isPrototypeOf(o))?(this._bodyArrayBuffer=u(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||i(t))?this._bodyArrayBuffer=u(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return function(t){var o=new FileReader,e=f(o);return o.readAsText(t),e}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var o=new Uint8Array(t),e=new Array(o.length),r=0;r<o.length;r++)e[r]=String.fromCharCode(o[r]);return e.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(t,o){t=n(t),o=a(o);var e=this.map[t];this.map[t]=e?e+", "+o:o},c.prototype.delete=function(t){delete this.map[n(t)]},c.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},c.prototype.set=function(t,o){this.map[n(t)]=a(o)},c.prototype.forEach=function(t,o){for(var e in this.map)this.map.hasOwnProperty(e)&&t.call(o,this.map[e],e,this)},c.prototype.keys=function(){var t=[];return this.forEach((function(o,e){t.push(e)})),s(t)},c.prototype.values=function(){var t=[];return this.forEach((function(o){t.push(o)})),s(t)},c.prototype.entries=function(){var t=[];return this.forEach((function(o,e){t.push([e,o])})),s(t)},e.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(t,o){var e,r,i=(o=o||{}).body;if(t instanceof y){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,o.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=o.credentials||this.credentials||"same-origin",!o.headers&&this.headers||(this.headers=new c(o.headers)),this.method=(e=o.method||this.method||"GET",r=e.toUpperCase(),p.indexOf(r)>-1?r:e),this.mode=o.mode||this.mode||null,this.signal=o.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function b(t){var o=new FormData;return t.trim().split("&").forEach((function(t){if(t){var e=t.split("="),r=e.shift().replace(/\+/g," "),i=e.join("=").replace(/\+/g," ");o.append(decodeURIComponent(r),decodeURIComponent(i))}})),o}function g(t,o){o||(o={}),this.type="default",this.status=void 0===o.status?200:o.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in o?o.statusText:"OK",this.headers=new c(o.headers),this.url=o.url||"",this._initBody(t)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},d.call(y.prototype),d.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},g.error=function(){var t=new g(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];g.redirect=function(t,o){if(-1===m.indexOf(o))throw new RangeError("Invalid status code");return new g(null,{status:o,headers:{location:t}})},o.DOMException=t.DOMException;try{new o.DOMException}catch(t){o.DOMException=function(t,o){this.message=t,this.name=o;var e=Error(t);this.stack=e.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function v(t,r){return new Promise((function(i,n){var a=new y(t,r);if(a.signal&&a.signal.aborted)return n(new o.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function l(){s.abort()}s.onload=function(){var t,o,e={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",o=new c,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var e=t.split(":"),r=e.shift().trim();if(r){var i=e.join(":").trim();o.append(r,i)}})),o)};e.url="responseURL"in s?s.responseURL:e.headers.get("X-Request-URL");var r="response"in s?s.response:s.responseText;i(new g(r,e))},s.onerror=function(){n(new TypeError("Network request failed"))},s.ontimeout=function(){n(new TypeError("Network request failed"))},s.onabort=function(){n(new o.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&e.blob&&(s.responseType="blob"),a.headers.forEach((function(t,o){s.setRequestHeader(o,t)})),a.signal&&(a.signal.addEventListener("abort",l),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",l)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}v.polyfill=!0,t.fetch||(t.fetch=v,t.Headers=c,t.Request=y,t.Response=g),o.Headers=c,o.Request=y,o.Response=g,o.fetch=v,Object.defineProperty(o,"U",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(Kr||(Kr={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(Pr||(Pr={})),function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"}(jr||(jr={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(Mr||(Mr={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(Fr||(Fr={})),function(t){t.ASC="ASC",t.DESC="DESC"}(Zr||(Zr={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(Br||(Br={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(Dr||(Dr={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(_r||(_r={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}($r||($r={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(zr||(zr={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(Gr||(Gr={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS"}(Hr||(Hr={})),function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(qr||(qr={}));const Yr={[qr.PERSONAL_BOOK_SHARE_USER]:[qr.PERSONAL_BOOK_USER],[qr.HTML_EXPORT_USER]:[qr.PERSONAL_BOOK_USER],[qr.PDF_EXPORT_USER]:[qr.PERSONAL_BOOK_USER],[qr.KHUB_ADMIN]:[qr.CONTENT_PUBLISHER],[qr.ADMIN]:[qr.KHUB_ADMIN,qr.USERS_ADMIN,qr.PORTAL_ADMIN],[qr.DEVELOPER]:[qr.BETA_USER,qr.DEBUG_USER]};function Vr(t,o){return t===o||(Yr[t]??[]).some((t=>Vr(t,o)))}function Jr(t,o){if(null==t)return!1;return(Array.isArray(t)?t:Array.isArray(t.roles)?t.roles:Array.isArray(t.profile?.roles)?t.profile.roles:[]).some((t=>Vr(t,o)))}var Xr;t.FtReaderFeatures=void 0,(Xr=t.FtReaderFeatures||(t.FtReaderFeatures={})).FEEDBACK="FEEDBACK",Xr.RATING="RATING",Xr.PRINT="PRINT",Xr.BOOKMARK="BOOKMARK",Xr.COLLECTIONS="COLLECTIONS",Xr.PERSONAL_BOOKS="PERSONAL_BOOKS";const Qr=mt`
102
+ `,ti=kr.get({name:"ft-app-info",reducers:{setBaseUrl:(t,o)=>{t.baseUrl=o.payload},setApiIntegrationIdentifier:(t,o)=>{t.apiIntegrationIdentifier=o.payload},setUiLocale:(t,o)=>{t.uiLocale=o.payload},setAvailableUiLocales:(t,o)=>{t.availableUiLocales=o.payload},setEditorMode:(t,o)=>{t.editorMode=o.payload},setNoCustom:(t,o)=>{t.noCustom=o.payload},setNoCustomComponent:(t,o)=>{t.noCustomComponent=o.payload},setSession:(t,o)=>{t.session=o.payload}},initialState:{uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],editorMode:!1,noCustom:!1,noCustomComponent:!1}});class oi{static build(t){const{baseUrl:o,apiIntegrationIdentifier:e}=ti.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static get(t){var o;return null!=t?oi.build(t):null!==(o=oi.API)&&void 0!==o?o:oi.API=oi.build()}static await(t){return new Promise((o=>{let e=oi.get(t);if(e)o(e);else{const r=ti.subscribe((()=>{e=oi.get(t),e&&(r(),o(e))}))}}))}}var ei;const ri=Symbol("clearAfterUnitTest");class ii{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new r,this.listeners={},this.currentUiLocale="",this[ei]=()=>{this.defaultMessages={},this.cache=new r,this.listeners={}},this.currentUiLocale=ti.getState().uiLocale,ti.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=ti.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,o){var e;if(t=t.toLowerCase(),Object.keys(o).length>0){const r={...null!==(e=this.defaultMessages[t])&&void 0!==e?e:{},...o};L(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,o,...e){var r,i,n;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(i=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==i?i:{};return new ko(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},a).resolve(o,...e)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>I(0).then((()=>t())).catch((()=>null)))))}}ei=ri,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new ii((async(t,o)=>(await oi.await()).getFluidTopicsMessageContext(t,o)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new ii((async(t,o)=>(await oi.await()).getCustomMessageContext(t,o))));const ni=window.FluidTopicsI18nService;var ai=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class si extends Lo{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.availableUiLocales=[],this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>oi.get(),this.cache=new r,this.cleanSessionDebouncer=new x}render(){return to`
103
103
  <slot></slot>
104
- `}update(t){super.update(t),t.has("baseUrl")&&Qr.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&Qr.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Qr.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&Qr.actions.setNoCustom(this.noCustom),t.has("editorMode")&&Qr.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&Qr.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&Qr.actions.setSession(this.session),t.has("availableUiLocales")&&Qr.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>ii.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){const t=this.apiProvider();!this.withManualResources&&t&&(null==this.session&&(this.session=await this.cache.get("session",(async()=>{const o=await t.getCurrentSession();return o.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),o.idleTimeoutInMillis),o}))),null==this.availableUiLocales&&(this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>t.getAvailableUiLocales()))))}}ai.elementDefinitions={},ai.styles=Xr,ni([U()],ai.prototype,"baseUrl",void 0),ni([U()],ai.prototype,"apiIntegrationIdentifier",void 0),ni([U()],ai.prototype,"uiLocale",void 0),ni([k([])],ai.prototype,"availableUiLocales",void 0),ni([U({type:Boolean})],ai.prototype,"editorMode",void 0),ni([U({type:Boolean})],ai.prototype,"noCustom",void 0),ni([U({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],ai.prototype,"noCustomComponent",void 0),ni([U({type:Boolean})],ai.prototype,"withManualResources",void 0),ni([k([])],ai.prototype,"messageContexts",void 0),ni([k(void 0)],ai.prototype,"session",void 0),ni([U({type:Object})],ai.prototype,"apiProvider",void 0);class si{async listMySearches(){var t;return(null===(t=Qr.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await ti.await()).listMySearches(Qr.getState().session.profile.userId):[]}}const ci=new r;class li{async listMyBookmarks(){return ci.get("bookmarks",(async()=>(await ti.await()).listMyBookmarks(Qr.getState().session.profile.userId)))}clearCache(){ci.clear("bookmarks")}}const fi=xr.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const hi=new class{constructor(){this.currentSession=Qr.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new li,Qr.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=Qr.getState();L(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==o?void 0:o.profile)||(this.currentSession=o,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){fi.actions.savedSearches(void 0)}clearMyBookmarks(){fi.actions.bookmarks(void 0)}async reloadMySearches(){const t=new si,o=await t.listMySearches();fi.actions.savedSearches(o)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;fi.actions.bookmarks(o)}}};A("ft-app-context")(ai);class ui{get mapId(){return this._mapId}set mapId(t){t!==this._mapId&&this.clear(),this._mapId=t}constructor(t,o,e,r){this.converter=t,this.api=o,this.cache=e,this._mapId=r,this.initCache()}async withMapId(t){return this._mapId?t(this._mapId):void 0}initCache(){this.cache.registerFinal("configuration",(()=>this.api.getReaderConfiguration())),this.cache.register("map",(()=>this.withMapId((t=>this.fetchMap(t))))),this.cache.register("enrichedToc",(()=>this.withMapId((t=>this.fetchPages(t).then((t=>this.converter.convertPaginatedToc(t))))))),this.cache.register("ratingSummary",(()=>{var t,o;return Vr(null!==(o=null===(t=Qr.getState().session)||void 0===t?void 0:t.profile.roles)&&void 0!==o?o:[],"RATING_USER")?this.withMapId((t=>this.fetchMapRating(t))):Promise.resolve()}))}clear(){this.cache.clearAll()}getMap(){return this.cache.get("map")}getConfiguration(){return this.cache.get("configuration")}getEnrichedToc(){return this.cache.get("enrichedToc")}get enrichedToc(){return this.cache.getNow("enrichedToc")}async getPaginationConfiguration(){return(await this.getEnrichedToc()).paginationConfiguration}async getToc(){return(await this.getEnrichedToc()).toc}async getPagesToc(){return(await this.getEnrichedToc()).pagesToc}async getTocNode(t){return(await this.getEnrichedToc()).nodeByTocId[t]}getTocNodeNow(t){var o;return null===(o=this.enrichedToc)||void 0===o?void 0:o.nodeByTocId[t]}async getPage(t){const o=await this.getEnrichedToc();return o.pages[t-1]||o.pages[0]}async getPageByTocId(t){const o=await this.getEnrichedToc();return o.pageByTocId[t]||o.pages[0]}getTopicInfo(t){return this.cache.get("topic-"+t.tocId,(()=>this.fetchTopicMetadata(t)))}getTopicContent(t){return this.cache.get("topic-content-"+t.tocId,(()=>this.fetchTopicHTMLContent(t)))}getLink(t,o,e){const r=this.getNavigationData(t,o,e),i=this.getReaderLinkPrefix()+(r.prettyUrl?r.prettyUrl:`${r.mapId}/${r.tocId}`),n=new URL(i,this.api.tenantBaseUrl);return null!=r.page&&n.searchParams.set("page",`${r.page}`),r.prettyUrlDuplicated&&n.searchParams.set("tocId",r.tocId),null!=r.section&&n.searchParams.set("section",r.section),n.href}getNavigationData(t,o,e){var r,i;t=t||"root";const n=this.enrichedToc,a=null==n?void 0:n.pageByTocId[t],s=null==n?void 0:n.nodeByTocId[t],c=null==s?void 0:s.prettyUrl;return{mapId:this.mapId,tocId:t,topicTitle:null!==(r=null==s?void 0:s.title)&&void 0!==r?r:"",page:o&&a&&a.number!==o?o:void 0,prettyUrl:null!=c?c.replace(/^r\//,""):void 0,prettyUrlDuplicated:null!==(i=null==n?void 0:n.duplicatedPrettyUrls.has(null!=c?c:""))&&void 0!==i&&i,section:e}}async getAccurateNavigationData(t,o,e){return await this.getEnrichedToc(),this.getNavigationData(t,o,e)}getRatingSummary(){return this.cache.get("ratingSummary")}getMapRating(){return this.getRatingSummary().then((t=>null==t?void 0:t.publication))}getTopicRating(t){return this.getRatingSummary().then((o=>{var e;return o?{type:o.topics.type,rating:null===(e=o.topics)||void 0===e?void 0:e.ratings.find((o=>o.tocId===t))}:void 0}))}rateMap(t,o){return this.makeRateMapRequest(t,o).then((()=>this.clearRatingIfNecessary()))}unrateMap(){return this.makeUnrateMapRequest().then((()=>this.clearRatingIfNecessary()))}sendMapFeedback(t,o){return this.makeMapFeedbackRequest(t,o)}rateTopic(t,o,e){return this.makeRateTopicRequest(t,o,e).then((()=>this.clearRatingIfNecessary()))}unrateTopic(t){return this.makeUnrateTopicRequest(t).then((()=>this.clearRatingIfNecessary()))}async clearRatingIfNecessary(){const t=Qr.getState().session;(null==t?void 0:t.sessionAuthenticated)&&this.cache.clear("ratingSummary")}sendTopicFeedback(t,o,e){return this.makeTopicFeedbackRequest(t,o,e)}fontsStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.fonts)}themeStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.theme)}buildBreadcrumb(t){let o=this.getTocNodeNow(t),e=[{tocId:o.tocId,title:o.title}],r=this.getTocNodeNow(o.parentTocId);for(;r;)e.unshift({tocId:r.tocId,title:r.title}),r=this.getTocNodeNow(r.parentTocId);return e}isFeatureAccessible(o,{session:e,ratingType:r}){if(!this.isFeatureAvailable(o))return!1;switch(o){case t.FtReaderFeatures.FEEDBACK:return Vr(null!=e?e:[],Hr.FEEDBACK_USER);case t.FtReaderFeatures.RATING:return Vr(null!=e?e:[],Hr.RATING_USER)&&null!=r&&r!==jr.NO_RATING;case t.FtReaderFeatures.PRINT:return Vr(null!=e?e:[],Hr.PRINT_USER);case t.FtReaderFeatures.BOOKMARK:return!!(null==e?void 0:e.sessionAuthenticated);case t.FtReaderFeatures.COLLECTIONS:return Vr(null!=e?e:[],Hr.COLLECTION_USER);case t.FtReaderFeatures.PERSONAL_BOOKS:return Vr(null!=e?e:[],Hr.PERSONAL_BOOK_USER);default:return!1}}}class di extends ui{static async build(t){return new di(new Wr,await ti.await(),new r,t)}clear(){super.clear(),this.fingerprint=void 0}async fetchMap(t){var o;const e=await this.api.getMap(t);return this.fingerprint=null===(o=e.lastPublication)||void 0===o?void 0:o.replace(/\D/g,""),e}fetchMapRating(t){return this.api.getMapRating(t)}async fetchPages(t){return await this.getMap(),this.api.getPages(t,this.fingerprint)}fetchTopicHTMLContent(t){return this.api.getTopicHTMLContent(this.mapId,t.contentId,"DESIGNED_READER",this.fingerprint)}fetchTopicMetadata(t){return this.api.getTopic(this.mapId,t.contentId,this.fingerprint)}makeMapFeedbackRequest(t,o){return this.api.sendMapFeedback(this.mapId,t,o)}makeRateMapRequest(t,o){return this.api.rateMap(this.mapId,t,o)}makeRateTopicRequest(t,o,e){return this.api.rateTopic(this.mapId,t,o,e)}makeTopicFeedbackRequest(t,o,e){return this.api.sendTopicFeedback(this.mapId,t,o,e)}makeUnrateMapRequest(){return this.api.unrateMap(this.mapId)}makeUnrateTopicRequest(t){return this.api.unrateTopic(this.mapId,t)}getReaderLinkPrefix(){return"r/"}isFeatureAvailable(t){return!0}}class pi{static build(t,o){return new pi((t=>xr.get({name:"ft-reader-"+t,initialState:{mapId:void 0,visibleTopics:[],map:void 0,toc:void 0,pagesToc:void 0,paginationConfiguration:void 0,currentPage:void 0,scrollTarget:void 0,configuration:void 0,searchInDocumentQuery:void 0}}))(t.trim()||"context"),null!=o?o:di.build)}constructor(t,o){this.store=t,this.reloadDebouncer=new x(10),this.initService(o)}async initService(t){return this.service=await t(),this.service.mapId=this.store.getState().mapId,this.reload()}async setMapId(t){t!==this.store.getState().mapId&&(this.store.actions.mapId(t),this.service&&(this.service.mapId=t),await this.reload())}setVisibleTopics(t){this.store.actions.visibleTopics(t)}async awaitService(){for(;null==this.service;)await I(5);return this.service}async navigateToTopic(t,o,e){const r=await this.awaitService(),i=await(null!=e?r.getPage(e):r.getPageByTocId(null!=t?t:"root"));this.store.actions.currentPage(i),this.store.actions.scrollTarget({tocId:this.resolveValidNonRootTocId(t,i),section:o})}resolveValidNonRootTocId(t,o){var e,r,i;let n=null!==(e="root"===t?void 0:t)&&void 0!==e?e:o.rootTocId;return o.topics.includes(n)?n:null!==(i=null!==(r=o.topics[0])&&void 0!==r?r:o.hiddenTopics[0])&&void 0!==i?i:"root"}async navigateToPage(t){const o=await this.awaitService();let e=await o.getPage(t);this.store.actions.currentPage(e)}scrollDone(){this.store.actions.scrollTarget({})}async reload(){var t,o;this.store.actions.configuration(void 0),this.store.actions.map(void 0),this.store.actions.toc(void 0),this.store.actions.pagesToc(void 0),this.store.actions.currentPage(void 0),this.store.actions.searchInDocumentQuery(""),null===(t=this.service)||void 0===t||t.clear(),(null===(o=this.service)||void 0===o?void 0:o.mapId)&&await this.reloadDebouncer.run((()=>this.fetchData()))}async fetchData(){var t,e,r,i,n;try{await Promise.all([null===(t=this.service)||void 0===t?void 0:t.getConfiguration().then((t=>this.store.actions.configuration(t))),null===(e=this.service)||void 0===e?void 0:e.getMap().then((t=>this.store.actions.map(t))),null===(r=this.service)||void 0===r?void 0:r.getToc().then((t=>this.store.actions.toc(t))),null===(i=this.service)||void 0===i?void 0:i.getPagesToc().then((t=>this.store.actions.pagesToc(t))),null===(n=this.service)||void 0===n?void 0:n.getPaginationConfiguration().then((t=>this.store.actions.paginationConfiguration(t)))])}catch(t){!this.errorHandler||t instanceof o||this.errorHandler(t)}}setSearchInDocumentQuery(t){this.store.actions.searchInDocumentQuery(t)}}const yi=mt`
105
- `;class bi extends CustomEvent{constructor(t,o){super("ft-reader-map-loaded",{detail:{map:t,toc:o}})}}class gi extends CustomEvent{constructor(t,o){super("ft-reader-visible-topics-change",{detail:{visibleTopics:o}})}}class mi extends CustomEvent{constructor(t){super("ft-reader-navigation-done",{detail:t})}}class vi extends CustomEvent{constructor(t){super("ft-reader-load-error",{detail:t})}}class Oi extends Event{constructor(){super("ft-reader-map-not-found")}}class wi extends Event{constructor(){super("ft-reader-map-unauthorized")}}var Ni=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class Si extends Zo{constructor(){super(),this.visibleTopics=[],this.scrollToTargetDebouncer=new x(5),this.navigationDebouncer=new x(10),this.addStore(Qr)}render(){return to`
104
+ `}update(t){super.update(t),t.has("baseUrl")&&ti.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&ti.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&ti.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&ti.actions.setNoCustom(this.noCustom),t.has("editorMode")&&ti.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&ti.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&ti.actions.setSession(this.session),t.has("availableUiLocales")&&ti.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>ni.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){const t=this.apiProvider();!this.withManualResources&&t&&(null==this.session&&(this.session=await this.cache.get("session",(async()=>{const o=await t.getCurrentSession();return o.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),o.idleTimeoutInMillis),o}))),null==this.availableUiLocales&&(this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>t.getAvailableUiLocales()))))}}si.elementDefinitions={},si.styles=Qr,ai([U()],si.prototype,"baseUrl",void 0),ai([U()],si.prototype,"apiIntegrationIdentifier",void 0),ai([U()],si.prototype,"uiLocale",void 0),ai([k([])],si.prototype,"availableUiLocales",void 0),ai([U({type:Boolean})],si.prototype,"editorMode",void 0),ai([U({type:Boolean})],si.prototype,"noCustom",void 0),ai([U({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],si.prototype,"noCustomComponent",void 0),ai([U({type:Boolean})],si.prototype,"withManualResources",void 0),ai([k([])],si.prototype,"messageContexts",void 0),ai([k(void 0)],si.prototype,"session",void 0),ai([U({type:Object})],si.prototype,"apiProvider",void 0);class ci{async listMySearches(){var t;return(null===(t=ti.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await oi.await()).listMySearches(ti.getState().session.profile.userId):[]}}const li=new r;class fi{async listMyBookmarks(){return li.get("bookmarks",(async()=>(await oi.await()).listMyBookmarks(ti.getState().session.profile.userId)))}clearCache(){li.clear("bookmarks")}}const hi=kr.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const ui=new class{constructor(){this.currentSession=ti.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new fi,ti.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=ti.getState();L(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==o?void 0:o.profile)||(this.currentSession=o,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){hi.actions.savedSearches(void 0)}clearMyBookmarks(){hi.actions.bookmarks(void 0)}async reloadMySearches(){const t=new ci,o=await t.listMySearches();hi.actions.savedSearches(o)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;hi.actions.bookmarks(o)}}};A("ft-app-context")(si);class di{get mapId(){return this._mapId}set mapId(t){t!==this._mapId&&this.clear(),this._mapId=t}constructor(t,o,e,r){this.converter=t,this.api=o,this.cache=e,this._mapId=r,this.initCache()}async withMapId(t){return this._mapId?t(this._mapId):void 0}initCache(){this.cache.registerFinal("configuration",(()=>this.api.getReaderConfiguration())),this.cache.register("map",(()=>this.withMapId((t=>this.fetchMap(t))))),this.cache.register("enrichedToc",(()=>this.withMapId((t=>this.fetchPages(t).then((t=>this.converter.convertPaginatedToc(t))))))),this.cache.register("ratingSummary",(()=>{var t,o;return Jr(null!==(o=null===(t=ti.getState().session)||void 0===t?void 0:t.profile.roles)&&void 0!==o?o:[],"RATING_USER")?this.withMapId((t=>this.fetchMapRating(t))):Promise.resolve()}))}clear(){this.cache.clearAll()}getMap(){return this.cache.get("map")}getConfiguration(){return this.cache.get("configuration")}getEnrichedToc(){return this.cache.get("enrichedToc")}get enrichedToc(){return this.cache.getNow("enrichedToc")}async getPaginationConfiguration(){return(await this.getEnrichedToc()).paginationConfiguration}async getToc(){return(await this.getEnrichedToc()).toc}async getPagesToc(){return(await this.getEnrichedToc()).pagesToc}async getTocNode(t){return(await this.getEnrichedToc()).nodeByTocId[t]}getTocNodeNow(t){var o;return null===(o=this.enrichedToc)||void 0===o?void 0:o.nodeByTocId[t]}async getPage(t){const o=await this.getEnrichedToc();return o.pages[t-1]||o.pages[0]}async getPageByTocId(t){const o=await this.getEnrichedToc();return o.pageByTocId[t]||o.pages[0]}getTopicInfo(t){return this.cache.get("topic-"+t.tocId,(()=>this.fetchTopicMetadata(t)))}getTopicContent(t){return this.cache.get("topic-content-"+t.tocId,(()=>this.fetchTopicHTMLContent(t)))}getLink(t,o,e){const r=this.getNavigationData(t,o,e),i=this.getReaderLinkPrefix()+(r.prettyUrl?r.prettyUrl:`${r.mapId}/${r.tocId}`),n=new URL(i,this.api.tenantBaseUrl);return null!=r.page&&n.searchParams.set("page",`${r.page}`),r.prettyUrlDuplicated&&n.searchParams.set("tocId",r.tocId),null!=r.section&&n.searchParams.set("section",r.section),n.href}getNavigationData(t,o,e){var r,i;t=t||"root";const n=this.enrichedToc,a=null==n?void 0:n.pageByTocId[t],s=null==n?void 0:n.nodeByTocId[t],c=null==s?void 0:s.prettyUrl;return{mapId:this.mapId,tocId:t,topicTitle:null!==(r=null==s?void 0:s.title)&&void 0!==r?r:"",page:o&&a&&a.number!==o?o:void 0,prettyUrl:null!=c?c.replace(/^r\//,""):void 0,prettyUrlDuplicated:null!==(i=null==n?void 0:n.duplicatedPrettyUrls.has(null!=c?c:""))&&void 0!==i&&i,section:e}}async getAccurateNavigationData(t,o,e){return await this.getEnrichedToc(),this.getNavigationData(t,o,e)}getRatingSummary(){return this.cache.get("ratingSummary")}getMapRating(){return this.getRatingSummary().then((t=>null==t?void 0:t.publication))}getTopicRating(t){return this.getRatingSummary().then((o=>{var e;return o?{type:o.topics.type,rating:null===(e=o.topics)||void 0===e?void 0:e.ratings.find((o=>o.tocId===t))}:void 0}))}rateMap(t,o){return this.makeRateMapRequest(t,o).then((()=>this.clearRatingIfNecessary()))}unrateMap(){return this.makeUnrateMapRequest().then((()=>this.clearRatingIfNecessary()))}sendMapFeedback(t,o){return this.makeMapFeedbackRequest(t,o)}rateTopic(t,o,e){return this.makeRateTopicRequest(t,o,e).then((()=>this.clearRatingIfNecessary()))}unrateTopic(t){return this.makeUnrateTopicRequest(t).then((()=>this.clearRatingIfNecessary()))}async clearRatingIfNecessary(){const t=ti.getState().session;(null==t?void 0:t.sessionAuthenticated)&&this.cache.clear("ratingSummary")}sendTopicFeedback(t,o,e){return this.makeTopicFeedbackRequest(t,o,e)}fontsStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.fonts)}themeStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.theme)}buildBreadcrumb(t){let o=this.getTocNodeNow(t),e=[{tocId:o.tocId,title:o.title}],r=this.getTocNodeNow(o.parentTocId);for(;r;)e.unshift({tocId:r.tocId,title:r.title}),r=this.getTocNodeNow(r.parentTocId);return e}isFeatureAccessible(o,{session:e,ratingType:r}){if(!this.isFeatureAvailable(o))return!1;switch(o){case t.FtReaderFeatures.FEEDBACK:return Jr(null!=e?e:[],qr.FEEDBACK_USER);case t.FtReaderFeatures.RATING:return Jr(null!=e?e:[],qr.RATING_USER)&&null!=r&&r!==Mr.NO_RATING;case t.FtReaderFeatures.PRINT:return Jr(null!=e?e:[],qr.PRINT_USER);case t.FtReaderFeatures.BOOKMARK:return!!(null==e?void 0:e.sessionAuthenticated);case t.FtReaderFeatures.COLLECTIONS:return Jr(null!=e?e:[],qr.COLLECTION_USER);case t.FtReaderFeatures.PERSONAL_BOOKS:return Jr(null!=e?e:[],qr.PERSONAL_BOOK_USER);default:return!1}}}class pi extends di{static async build(t){return new pi(new Tr,await oi.await(),new r,t)}clear(){super.clear(),this.fingerprint=void 0}async fetchMap(t){var o;const e=await this.api.getMap(t);return this.fingerprint=null===(o=e.lastPublication)||void 0===o?void 0:o.replace(/\D/g,""),e}fetchMapRating(t){return this.api.getMapRating(t)}async fetchPages(t){return await this.getMap(),this.api.getPages(t,this.fingerprint)}fetchTopicHTMLContent(t){return this.api.getTopicHTMLContent(this.mapId,t.contentId,"DESIGNED_READER",this.fingerprint)}fetchTopicMetadata(t){return this.api.getTopic(this.mapId,t.contentId,this.fingerprint)}makeMapFeedbackRequest(t,o){return this.api.sendMapFeedback(this.mapId,t,o)}makeRateMapRequest(t,o){return this.api.rateMap(this.mapId,t,o)}makeRateTopicRequest(t,o,e){return this.api.rateTopic(this.mapId,t,o,e)}makeTopicFeedbackRequest(t,o,e){return this.api.sendTopicFeedback(this.mapId,t,o,e)}makeUnrateMapRequest(){return this.api.unrateMap(this.mapId)}makeUnrateTopicRequest(t){return this.api.unrateTopic(this.mapId,t)}getReaderLinkPrefix(){return"r/"}isFeatureAvailable(t){return!0}}class yi{static build(t,o){return new yi((t=>kr.get({name:"ft-reader-"+t,initialState:{mapId:void 0,visibleTopics:[],map:void 0,toc:void 0,pagesToc:void 0,paginationConfiguration:void 0,currentPage:void 0,scrollTarget:void 0,configuration:void 0,searchInDocumentQuery:void 0}}))(t.trim()||"context"),null!=o?o:pi.build)}constructor(t,o){this.store=t,this.reloadDebouncer=new x(10),this.initService(o)}async initService(t){return this.service=await t(),this.service.mapId=this.store.getState().mapId,this.reload()}async setMapId(t){t!==this.store.getState().mapId&&(this.store.actions.mapId(t),this.service&&(this.service.mapId=t),await this.reload())}setVisibleTopics(t){this.store.actions.visibleTopics(t)}async awaitService(){for(;null==this.service;)await I(5);return this.service}async navigateToTopic(t,o,e){const r=await this.awaitService(),i=await(null!=e?r.getPage(e):r.getPageByTocId(null!=t?t:"root"));this.store.actions.currentPage(i),this.store.actions.scrollTarget({tocId:this.resolveValidNonRootTocId(t,i),section:o})}resolveValidNonRootTocId(t,o){var e,r,i;let n=null!==(e="root"===t?void 0:t)&&void 0!==e?e:o.rootTocId;return o.topics.includes(n)?n:null!==(i=null!==(r=o.topics[0])&&void 0!==r?r:o.hiddenTopics[0])&&void 0!==i?i:"root"}async navigateToPage(t){const o=await this.awaitService();let e=await o.getPage(t);this.store.actions.currentPage(e)}scrollDone(){this.store.actions.scrollTarget({})}async reload(){var t,o;this.store.actions.configuration(void 0),this.store.actions.map(void 0),this.store.actions.toc(void 0),this.store.actions.pagesToc(void 0),this.store.actions.currentPage(void 0),this.store.actions.searchInDocumentQuery(""),null===(t=this.service)||void 0===t||t.clear(),(null===(o=this.service)||void 0===o?void 0:o.mapId)&&await this.reloadDebouncer.run((()=>this.fetchData()))}async fetchData(){var t,e,r,i,n;try{await Promise.all([null===(t=this.service)||void 0===t?void 0:t.getConfiguration().then((t=>this.store.actions.configuration(t))),null===(e=this.service)||void 0===e?void 0:e.getMap().then((t=>this.store.actions.map(t))),null===(r=this.service)||void 0===r?void 0:r.getToc().then((t=>this.store.actions.toc(t))),null===(i=this.service)||void 0===i?void 0:i.getPagesToc().then((t=>this.store.actions.pagesToc(t))),null===(n=this.service)||void 0===n?void 0:n.getPaginationConfiguration().then((t=>this.store.actions.paginationConfiguration(t)))])}catch(t){!this.errorHandler||t instanceof o||this.errorHandler(t)}}setSearchInDocumentQuery(t){this.store.actions.searchInDocumentQuery(t)}}const bi=mt`
105
+ `;class gi extends CustomEvent{constructor(t,o){super("ft-reader-map-loaded",{detail:{map:t,toc:o}})}}class mi extends CustomEvent{constructor(t,o){super("ft-reader-visible-topics-change",{detail:{visibleTopics:o}})}}class vi extends CustomEvent{constructor(t){super("ft-reader-navigation-done",{detail:t})}}class Oi extends CustomEvent{constructor(t){super("ft-reader-load-error",{detail:t})}}class wi extends Event{constructor(){super("ft-reader-map-not-found")}}class Ni extends Event{constructor(){super("ft-reader-map-unauthorized")}}var Si=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class Ei extends Do{constructor(){super(),this.visibleTopics=[],this.scrollToTargetDebouncer=new x(5),this.navigationDebouncer=new x(10),this.addStore(ti)}render(){return to`
106
106
  ${this.importStyleIfNeeded()}
107
107
  <slot @register-ft-reader-component=${this.registerComponent}></slot>
108
108
  `}importStyleIfNeeded(){var t,o;const e=null===(t=this.stateManager.service)||void 0===t?void 0:t.themeStylesheet();return!e||window.location.href.startsWith(null!==(o=this.baseUrl)&&void 0!==o?o:"")?eo:to`
109
109
  <style>
110
110
  @import "${e}"
111
111
  </style>
112
- `}get stateManager(){return null==this._stateManager&&(this._stateManager=pi.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0"),this.readerServiceProvider),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"reader")),this._stateManager}connectedCallback(){super.connectedCallback(),this.stateManager.setMapId(this.mapId),this.stateManager.awaitService().then((t=>{const o=t.fontsStylesheet();if(o&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${o}"]`)){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",o),document.head.append(t)}}))}update(t){super.update(t),t.has("readerServiceProvider")&&this.readerServiceProvider&&this.stateManager.initService(this.readerServiceProvider),t.has("mapId")&&this.mapId&&this.stateManager.setMapId(this.mapId),t.has("searchInDocumentQuery")&&null!=this.searchInDocumentQuery&&this.stateManager.setSearchInDocumentQuery(this.searchInDocumentQuery),["tocId","section","page","mapId"].some((o=>t.has(o)))&&this.mapId&&this.navigateToTarget()}contentAvailableCallback(t){var o;if(super.contentAvailableCallback(t),(t.has("map")||t.has("toc"))&&this.map&&this.toc&&this.dispatchEvent(new bi(this.map,this.toc)),t.has("scrollTarget")&&null==(null===(o=this.scrollTarget)||void 0===o?void 0:o.tocId)){const o=t.get("scrollTarget");null!=(null==o?void 0:o.tocId)&&this.scrollToTargetDebouncer.run((()=>{var t;return this.stateManager.service.getAccurateNavigationData(o.tocId,null===(t=this.currentPage)||void 0===t?void 0:t.number,o.section).then((t=>this.dispatchEvent(new mi(t))))}))}t.has("visibleTopics")&&Promise.all(this.visibleTopics.map((t=>{var o;return this.stateManager.service.getAccurateNavigationData(t,null===(o=this.currentPage)||void 0===o?void 0:o.number)}))).then((t=>{let o=t.filter((t=>null!=t&&""!==t.topicTitle)).map((t=>{var o;return{tocId:t.tocId,title:t.topicTitle,page:t.page,prettyUrl:t.prettyUrl,prettyUrlDuplicated:t.prettyUrlDuplicated,breadcrumb:null===(o=this.stateManager.service)||void 0===o?void 0:o.buildBreadcrumb(t.tocId)}}));this.dispatchEvent(new gi(this.map,o))}))}async reload(){await this.stateManager.reload(),this.navigateToTarget()}navigateToTarget(){this.navigationDebouncer.run((()=>{null!=this.tocId?this.stateManager.navigateToTopic(this.tocId,this.section,this.page):null!=this.page&&this.stateManager.navigateToPage(this.page)}))}registerComponent(t){t.stopPropagation();const o=t.composedPath()[0];this.register(o)}register(t){t.setReaderStateManager(this.stateManager)}handleLoadError(t){const o=t;404===o.status?this.dispatchEvent(new Oi):401===o.status?this.dispatchEvent(new wi):this.dispatchEvent(new vi(t))}reloadBookmarks(){hi.reloadBookmarks()}}var Ei;Si.styles=yi,Ni([Ir({store:Qr.name})],Si.prototype,"baseUrl",void 0),Ni([U()],Si.prototype,"mapId",void 0),Ni([U()],Si.prototype,"tocId",void 0),Ni([U()],Si.prototype,"section",void 0),Ni([U()],Si.prototype,"searchInDocumentQuery",void 0),Ni([U({type:Number,converter:{fromAttribute:t=>+(null!=t?t:"NaN")>0?+t:Ei}})],Si.prototype,"page",void 0),Ni([Ir({store:"reader"})],Si.prototype,"map",void 0),Ni([Ir({store:"reader"})],Si.prototype,"toc",void 0),Ni([Ir({store:"reader"})],Si.prototype,"visibleTopics",void 0),Ni([Ir({store:"reader"})],Si.prototype,"currentPage",void 0),Ni([Ir({store:"reader"})],Si.prototype,"scrollTarget",void 0),Ni([U({attribute:!1})],Si.prototype,"readerServiceProvider",void 0),A("ft-reader-context")(Si),t.FtOfficialReaderService=di,t.FtReaderContext=Si,t.FtReaderContextCssVariables={},t.FtReaderConverter=Wr,t.FtReaderService=ui,t.LoadErrorEvent=vi,t.MapLoadedEvent=bi,t.NavigationDoneEvent=mi,t.NotFoundErrorEvent=Oi,t.UnauthorizedErrorEvent=wi,t.VisibleTopicsChangeEvent=gi,t.styles=yi}({});
112
+ `}get stateManager(){return null==this._stateManager&&(this._stateManager=yi.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0"),this.readerServiceProvider),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"reader")),this._stateManager}connectedCallback(){super.connectedCallback(),this.stateManager.setMapId(this.mapId),this.stateManager.awaitService().then((t=>{const o=t.fontsStylesheet();if(o&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${o}"]`)){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",o),document.head.append(t)}}))}update(t){super.update(t),t.has("readerServiceProvider")&&this.readerServiceProvider&&this.stateManager.initService(this.readerServiceProvider),t.has("mapId")&&this.mapId&&this.stateManager.setMapId(this.mapId),t.has("searchInDocumentQuery")&&null!=this.searchInDocumentQuery&&this.stateManager.setSearchInDocumentQuery(this.searchInDocumentQuery),["tocId","section","page","mapId"].some((o=>t.has(o)))&&this.mapId&&this.navigateToTarget()}contentAvailableCallback(t){var o;if(super.contentAvailableCallback(t),(t.has("map")||t.has("toc"))&&this.map&&this.toc&&this.dispatchEvent(new gi(this.map,this.toc)),t.has("scrollTarget")&&null==(null===(o=this.scrollTarget)||void 0===o?void 0:o.tocId)){const o=t.get("scrollTarget");null!=(null==o?void 0:o.tocId)&&this.scrollToTargetDebouncer.run((()=>{var t;return this.stateManager.service.getAccurateNavigationData(o.tocId,null===(t=this.currentPage)||void 0===t?void 0:t.number,o.section).then((t=>this.dispatchEvent(new vi(t))))}))}t.has("visibleTopics")&&Promise.all(this.visibleTopics.map((t=>{var o;return this.stateManager.service.getAccurateNavigationData(t,null===(o=this.currentPage)||void 0===o?void 0:o.number)}))).then((t=>{let o=t.filter((t=>null!=t&&""!==t.topicTitle)).map((t=>{var o;return{tocId:t.tocId,title:t.topicTitle,page:t.page,prettyUrl:t.prettyUrl,prettyUrlDuplicated:t.prettyUrlDuplicated,breadcrumb:null===(o=this.stateManager.service)||void 0===o?void 0:o.buildBreadcrumb(t.tocId)}}));this.dispatchEvent(new mi(this.map,o))}))}async reload(){await this.stateManager.reload(),this.navigateToTarget()}navigateToTarget(){this.navigationDebouncer.run((()=>{null!=this.tocId?this.stateManager.navigateToTopic(this.tocId,this.section,this.page):null!=this.page&&this.stateManager.navigateToPage(this.page)}))}registerComponent(t){t.stopPropagation();const o=t.composedPath()[0];this.register(o)}register(t){t.setReaderStateManager(this.stateManager)}handleLoadError(t){const o=t;404===o.status?this.dispatchEvent(new wi):401===o.status?this.dispatchEvent(new Ni):this.dispatchEvent(new Oi(t))}reloadBookmarks(){ui.reloadBookmarks()}}var Ci;Ei.styles=bi,Si([Wo({store:ti.name})],Ei.prototype,"baseUrl",void 0),Si([U()],Ei.prototype,"mapId",void 0),Si([U()],Ei.prototype,"tocId",void 0),Si([U()],Ei.prototype,"section",void 0),Si([U()],Ei.prototype,"searchInDocumentQuery",void 0),Si([U({type:Number,converter:{fromAttribute:t=>+(null!=t?t:"NaN")>0?+t:Ci}})],Ei.prototype,"page",void 0),Si([Wo({store:"reader"})],Ei.prototype,"map",void 0),Si([Wo({store:"reader"})],Ei.prototype,"toc",void 0),Si([Wo({store:"reader"})],Ei.prototype,"visibleTopics",void 0),Si([Wo({store:"reader"})],Ei.prototype,"currentPage",void 0),Si([Wo({store:"reader"})],Ei.prototype,"scrollTarget",void 0),Si([U({attribute:!1})],Ei.prototype,"readerServiceProvider",void 0),A("ft-reader-context")(Ei),t.FtOfficialReaderService=pi,t.FtReaderContext=Ei,t.FtReaderContextCssVariables={},t.FtReaderConverter=Tr,t.FtReaderService=di,t.LoadErrorEvent=Oi,t.MapLoadedEvent=gi,t.NavigationDoneEvent=vi,t.NotFoundErrorEvent=wi,t.UnauthorizedErrorEvent=Ni,t.VisibleTopicsChangeEvent=mi,t.styles=bi}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-context",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Context block for integrated reader components",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,13 +19,13 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-app-context": "1.1.3",
23
- "@fluid-topics/ft-wc-utils": "1.1.3",
22
+ "@fluid-topics/ft-app-context": "1.1.4",
23
+ "@fluid-topics/ft-wc-utils": "1.1.4",
24
24
  "@reduxjs/toolkit": "^1.6.2",
25
25
  "lit": "3.1.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@fluid-topics/public-api": "1.0.51"
29
29
  },
30
- "gitHead": "0d44a470e710f185c37e42ee87be4481a3bdf793"
30
+ "gitHead": "b13ddd3359734158be660854f9ffe5fc5880c430"
31
31
  }