@fluid-topics/ft-reader-topic-title 1.2.35 → 1.2.36

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,11 +1,17 @@
1
1
  import { nothing, PropertyValues } from "lit";
2
2
  import { FtReaderTopicTitleProperties } from "./ft-reader-topic-title.properties";
3
3
  import { FtReaderTopicComponent } from "@fluid-topics/ft-reader-topic-context/build/registration";
4
+ import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
4
5
  export declare class FtReaderTopicTitle extends FtReaderTopicComponent implements FtReaderTopicTitleProperties {
6
+ static elementDefinitions: ElementDefinitionsMap;
5
7
  static styles: import("lit").CSSResult[];
6
8
  private map?;
7
9
  private searchInDocumentQuery?;
10
+ private translationDestinationLanguage?;
11
+ private translationLoading?;
12
+ private translationError?;
8
13
  titleContainer?: HTMLElement;
9
14
  protected render(): typeof nothing | import("lit-html").TemplateResult;
10
15
  protected updated(props: PropertyValues): void;
16
+ private getTopicLanguage;
11
17
  }
@@ -10,23 +10,27 @@ import { FtReaderTopicComponent } from "@fluid-topics/ft-reader-topic-context/bu
10
10
  import { highlightHtml, highlightHtmlStyles, redux, waitFor } from "@fluid-topics/ft-wc-utils";
11
11
  import { html, unsafeStatic } from "lit/static-html.js";
12
12
  import { query } from "lit/decorators.js";
13
+ import { FtSkeleton } from "@fluid-topics/ft-skeleton";
13
14
  class FtReaderTopicTitle extends FtReaderTopicComponent {
14
15
  render() {
15
- var _a, _b, _c, _d, _e, _f;
16
- if (!this.map || !this.tocNode) {
16
+ var _a, _b, _c, _d, _e;
17
+ if ((!this.map || !this.tocNode) && !this.translationLoading) {
17
18
  return nothing;
18
19
  }
19
20
  const titleTag = `h${Math.min((((_a = this.tocNode) === null || _a === void 0 ? void 0 : _a.depth) || 1), 6)}`;
20
21
  const customClasses = (_c = (_b = this.map) === null || _b === void 0 ? void 0 : _b.contentStyles.customCssClasses.join(" ")) !== null && _c !== void 0 ? _c : "";
21
- const lang = (_d = this.map) === null || _d === void 0 ? void 0 : _d.lang;
22
22
  return html `
23
23
  <style>
24
- @import "${(_e = this.map) === null || _e === void 0 ? void 0 : _e.contentStyles.titleStylesheetUrl}";
24
+ @import "${(_d = this.map) === null || _d === void 0 ? void 0 : _d.contentStyles.titleStylesheetUrl}";
25
25
  </style>
26
- <section class="title" lang="${lang}">
27
- <div class="depth-${(_f = this.tocNode) === null || _f === void 0 ? void 0 : _f.depth} content-locale-${lang} ${customClasses}">
28
- <${unsafeStatic(titleTag)}>${this.tocNode.title}</${unsafeStatic(titleTag)}>
29
- </div>
26
+ <section class="title" lang="${this.getTopicLanguage()}">
27
+ ${this.translationLoading
28
+ ? html `
29
+ <ft-skeleton></ft-skeleton>`
30
+ : html `
31
+ <div class="depth-${(_e = this.tocNode) === null || _e === void 0 ? void 0 : _e.depth} content-locale-${this.getTopicLanguage()} ${customClasses}">
32
+ <${unsafeStatic(titleTag)}>${this.tocNode.title}</${unsafeStatic(titleTag)}>
33
+ </div>`}
30
34
  </section>
31
35
  `;
32
36
  }
@@ -36,7 +40,14 @@ class FtReaderTopicTitle extends FtReaderTopicComponent {
36
40
  .then(() => waitFor(() => this.titleContainer))
37
41
  .then(titleContainer => highlightHtml(titleContainer, this.disableContextInteractions ? "" : this.searchInDocumentQuery, { attributes: { part: "kwicmatch" } }));
38
42
  }
43
+ getTopicLanguage() {
44
+ var _a;
45
+ return (this.translationDestinationLanguage && !this.translationError) ? this.translationDestinationLanguage.code : (_a = this.map) === null || _a === void 0 ? void 0 : _a.lang;
46
+ }
39
47
  }
48
+ FtReaderTopicTitle.elementDefinitions = {
49
+ "ft-skeleton": FtSkeleton,
50
+ };
40
51
  FtReaderTopicTitle.styles = [
41
52
  styles,
42
53
  highlightHtmlStyles
@@ -47,6 +58,15 @@ __decorate([
47
58
  __decorate([
48
59
  redux({ selector: (s, self) => self.disableContextInteractions ? "" : s.searchInDocumentQuery })
49
60
  ], FtReaderTopicTitle.prototype, "searchInDocumentQuery", void 0);
61
+ __decorate([
62
+ redux({ selector: (s) => s.translation.destinationLanguage })
63
+ ], FtReaderTopicTitle.prototype, "translationDestinationLanguage", void 0);
64
+ __decorate([
65
+ redux({ selector: (s) => s.translation.isLoading })
66
+ ], FtReaderTopicTitle.prototype, "translationLoading", void 0);
67
+ __decorate([
68
+ redux({ selector: (s) => s.translation.isError })
69
+ ], FtReaderTopicTitle.prototype, "translationError", void 0);
50
70
  __decorate([
51
71
  query("section.title")
52
72
  ], FtReaderTopicTitle.prototype, "titleContainer", void 0);
@@ -1,19 +1,53 @@
1
- "use strict";(()=>{var Ot=Object.create;var st=Object.defineProperty;var Mt=Object.getOwnPropertyDescriptor;var Rt=Object.getOwnPropertyNames;var Et=Object.getPrototypeOf,Pt=Object.prototype.hasOwnProperty;var B=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports);var jt=(o,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Rt(t))!Pt.call(o,i)&&i!==e&&st(o,i,{get:()=>t[i],enumerable:!(s=Mt(t,i))||s.enumerable});return o};var $=(o,t,e)=>(e=o!=null?Ot(Et(o)):{},jt(t||!o||!o.__esModule?st(e,"default",{value:o,enumerable:!0}):e,o));var C=B((Zt,it)=>{it.exports=ftGlobals.wcUtils});var D=B((kt,ot)=>{ot.exports=ftGlobals.lit});var O=B((zt,lt)=>{lt.exports=ftGlobals.litDecorators});var It=$(C());var Ht=$(D());var nt=$(D()),I=$(C()),Bt={fontFamily:I.FtCssVariableFactory.external(I.designSystemVariables.titleFont,"Design system")},rt=nt.css`
1
+ "use strict";(()=>{var jt=Object.create;var rt=Object.defineProperty;var Bt=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var Ft=Object.getPrototypeOf,Ut=Object.prototype.hasOwnProperty;var U=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var Vt=(i,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Wt(t))!Ut.call(i,o)&&o!==e&&rt(i,o,{get:()=>t[o],enumerable:!(s=Bt(t,o))||s.enumerable});return i};var u=(i,t,e)=>(e=i!=null?jt(Ft(i)):{},Vt(t||!i||!i.__esModule?rt(e,"default",{value:i,enumerable:!0}):e,i));var v=U((ee,at)=>{at.exports=ftGlobals.wcUtils});var H=U((ie,lt)=>{lt.exports=ftGlobals.lit});var k=U((oe,dt)=>{dt.exports=ftGlobals.litDecorators});var Pt=u(v());var kt=u(H());var ht=u(H()),L=u(v()),Kt={fontFamily:L.FtCssVariableFactory.external(L.designSystemVariables.titleFont,"Design system")},ct=ht.css`
2
2
  .title {
3
- font-family: ${Bt.fontFamily};
3
+ font-family: ${Kt.fontFamily};
4
4
  }
5
- `;var F=$(O());var ht=$(C()),ct=$(O());var at;(function(o){o.FEEDBACK="FEEDBACK",o.RATING="RATING",o.PRINT="PRINT",o.BOOKMARK="BOOKMARK",o.COLLECTIONS="COLLECTIONS",o.PERSONAL_BOOKS="PERSONAL_BOOKS"})(at||(at={}));var Dt=function(o,t,e,s){var i=arguments.length,n=i<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,s);else for(var h=o.length-1;h>=0;h--)(r=o[h])&&(n=(i<3?r(n):i>3?r(t,e,n):r(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},U=class extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}},L=Symbol("registerInterval");function Lt(o){var t;class e extends o{constructor(){super(...arguments),this[t]=0}setReaderStateManager(i){this.clearStateManager(),this.stateManager=i,this.addStore(i.store,"reader")}clearStateManager(){this.stateManager&&(this.removeStore("reader"),this.stateManager=void 0)}get service(){var i;return(i=this.stateManager)===null||i===void 0?void 0:i.service}connectedCallback(){super.connectedCallback(),this[L]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null?window.clearInterval(this[L]):this.dispatchEvent(new U)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return t=L,Dt([(0,ct.state)()],e.prototype,"stateManager",void 0),e}var M=class extends Lt(ht.FtLitElementRedux){};var pt=function(o,t,e,s){var i=arguments.length,n=i<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,s);else for(var h=o.length-1;h>=0;h--)(r=o[h])&&(n=(i<3?r(n):i>3?r(t,e,n):r(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},K=class extends Event{constructor(){super("register-ft-reader-topic-component",{bubbles:!0,composed:!0})}},V=Symbol("registerInterval");function Ut(o){var t;class e extends o{constructor(){super(...arguments),this.disableContextInteractions=!1,this[t]=0}connectedCallback(){super.connectedCallback(),this[V]=window.setInterval(()=>this.tryToRegisterToTopicContext(),50)}tryToRegisterToTopicContext(){this.tocNode!=null?window.clearInterval(this[V]):this.dispatchEvent(new K)}disconnectedCallback(){super.disconnectedCallback(),this.tocNode=void 0}}return t=V,pt([(0,F.state)()],e.prototype,"tocNode",void 0),pt([(0,F.state)()],e.prototype,"disableContextInteractions",void 0),e}var R=class extends Ut(M){};var f=$(C());var z=globalThis,E=z.trustedTypes,dt=E?E.createPolicy("lit-html",{createHTML:o=>o}):void 0,At="$lit$",_=`lit$${Math.random().toFixed(9).slice(2)}$`,vt="?"+_,Vt=`<${vt}>`,y=document,P=()=>y.createComment(""),N=o=>o===null||typeof o!="object"&&typeof o!="function",J=Array.isArray,Ft=o=>J(o)||typeof o?.[Symbol.iterator]=="function",W=`[
6
- \f\r]`,S=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ut=/-->/g,$t=/>/g,v=RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
7
- \f\r"'\`<>=]|("|')|))|$)`,"g"),ft=/'/g,mt=/"/g,gt=/^(?:script|style|textarea|title)$/i,X=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),yt=X(1),xt=X(2),bt=X(3),T=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),_t=new WeakMap,g=y.createTreeWalker(y,129);function Ct(o,t){if(!J(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return dt!==void 0?dt.createHTML(t):t}var Kt=(o,t)=>{let e=o.length-1,s=[],i,n=t===2?"<svg>":t===3?"<math>":"",r=S;for(let h=0;h<e;h++){let l=o[h],a,p,c=-1,u=0;for(;u<l.length&&(r.lastIndex=u,p=r.exec(l),p!==null);)u=r.lastIndex,r===S?p[1]==="!--"?r=ut:p[1]!==void 0?r=$t:p[2]!==void 0?(gt.test(p[2])&&(i=RegExp("</"+p[2],"g")),r=v):p[3]!==void 0&&(r=v):r===v?p[0]===">"?(r=i??S,c=-1):p[1]===void 0?c=-2:(c=r.lastIndex-p[2].length,a=p[1],r=p[3]===void 0?v:p[3]==='"'?mt:ft):r===mt||r===ft?r=v:r===ut||r===$t?r=S:(r=v,i=void 0);let m=r===v&&o[h+1].startsWith("/>")?" ":"";n+=r===S?l+Vt:c>=0?(s.push(a),l.slice(0,c)+At+l.slice(c)+_+m):l+_+(c===-2?h:m)}return[Ct(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},H=class o{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let n=0,r=0,h=t.length-1,l=this.parts,[a,p]=Kt(t,e);if(this.el=o.createElement(a,s),g.currentNode=this.el.content,e===2||e===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(i=g.nextNode())!==null&&l.length<h;){if(i.nodeType===1){if(i.hasAttributes())for(let c of i.getAttributeNames())if(c.endsWith(At)){let u=p[r++],m=i.getAttribute(c).split(_),w=/([.?@])?(.*)/.exec(u);l.push({type:1,index:n,name:w[2],strings:m,ctor:w[1]==="."?Q:w[1]==="?"?Z:w[1]==="@"?k:b}),i.removeAttribute(c)}else c.startsWith(_)&&(l.push({type:6,index:n}),i.removeAttribute(c));if(gt.test(i.tagName)){let c=i.textContent.split(_),u=c.length-1;if(u>0){i.textContent=E?E.emptyScript:"";for(let m=0;m<u;m++)i.append(c[m],P()),g.nextNode(),l.push({type:2,index:++n});i.append(c[u],P())}}}else if(i.nodeType===8)if(i.data===vt)l.push({type:2,index:n});else{let c=-1;for(;(c=i.data.indexOf(_,c+1))!==-1;)l.push({type:7,index:n}),c+=_.length-1}n++}}static createElement(t,e){let s=y.createElement("template");return s.innerHTML=t,s}};function x(o,t,e=o,s){if(t===T)return t;let i=s!==void 0?e._$Co?.[s]:e._$Cl,n=N(t)?void 0:t._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(o),i._$AT(o,e,s)),s!==void 0?(e._$Co??=[])[s]=i:e._$Cl=i),i!==void 0&&(t=x(o,i._$AS(o,t.values),i,s)),t}var G=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??y).importNode(e,!0);g.currentNode=i;let n=g.nextNode(),r=0,h=0,l=s[0];for(;l!==void 0;){if(r===l.index){let a;l.type===2?a=new j(n,n.nextSibling,this,t):l.type===1?a=new l.ctor(n,l.name,l.strings,this,t):l.type===6&&(a=new q(n,this,t)),this._$AV.push(a),l=s[++h]}r!==l?.index&&(n=g.nextNode(),r++)}return g.currentNode=y,i}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},j=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=x(this,t,e),N(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==T&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ft(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&N(this._$AH)?this._$AA.nextSibling.data=t:this.T(y.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=H.createElement(Ct(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new G(i,this),r=n.u(this.options);n.p(e),this.T(r),this._$AH=n}}_$AC(t){let e=_t.get(t.strings);return e===void 0&&_t.set(t.strings,e=new H(t)),e}k(t){J(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,i=0;for(let n of t)i===e.length?e.push(s=new o(this.O(P()),this.O(P()),this,this.options)):s=e[i],s._$AI(n),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},b=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,n){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=d}_$AI(t,e=this,s,i){let n=this.strings,r=!1;if(n===void 0)t=x(this,t,e,0),r=!N(t)||t!==this._$AH&&t!==T,r&&(this._$AH=t);else{let h=t,l,a;for(t=n[0],l=0;l<n.length-1;l++)a=x(this,h[s+l],e,l),a===T&&(a=this._$AH[l]),r||=!N(a)||a!==this._$AH[l],a===d?t=d:t!==d&&(t+=(a??"")+n[l+1]),this._$AH[l]=a}r&&!i&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Q=class extends b{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}},Z=class extends b{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}},k=class extends b{constructor(t,e,s,i,n){super(t,e,s,i,n),this.type=5}_$AI(t,e=this){if((t=x(this,t,e,0)??d)===T)return;let s=this._$AH,i=t===d&&s!==d||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==d&&(s===d||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},q=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){x(this,t)}};var Wt=z.litHtmlPolyfillSupport;Wt?.(H,j),(z.litHtmlVersions??=[]).push("3.3.0");var Nt=Symbol.for(""),Gt=o=>{if(o?.r===Nt)return o?._$litStatic$},Y=o=>({_$litStatic$:o,r:Nt});var St=new Map,tt=o=>(t,...e)=>{let s=e.length,i,n,r=[],h=[],l,a=0,p=!1;for(;a<s;){for(l=t[a];a<s&&(n=e[a],(i=Gt(n))!==void 0);)l+=i+t[++a],p=!0;a!==s&&h.push(n),r.push(l),a++}if(a===s&&r.push(t[s]),p){let c=r.join("$$lit$$");(t=St.get(c))===void 0&&(r.raw=r,St.set(c,t=r)),e=h}return o(t,...e)},Tt=tt(yt),oe=tt(xt),ne=tt(bt);var wt=$(O()),et=function(o,t,e,s){var i=arguments.length,n=i<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,s);else for(var h=o.length-1;h>=0;h--)(r=o[h])&&(n=(i<3?r(n):i>3?r(t,e,n):r(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},A=class extends R{render(){var t,e,s,i,n,r;if(!this.map||!this.tocNode)return Ht.nothing;let h=`h${Math.min(((t=this.tocNode)===null||t===void 0?void 0:t.depth)||1,6)}`,l=(s=(e=this.map)===null||e===void 0?void 0:e.contentStyles.customCssClasses.join(" "))!==null&&s!==void 0?s:"",a=(i=this.map)===null||i===void 0?void 0:i.lang;return Tt`
5
+
6
+ ft-skeleton {
7
+ width: 150px;
8
+ }
9
+ `;var G=u(k());var ut=u(v()),mt=u(k());var pt;(function(i){i.FEEDBACK="FEEDBACK",i.RATING="RATING",i.PRINT="PRINT",i.BOOKMARK="BOOKMARK",i.COLLECTIONS="COLLECTIONS",i.PERSONAL_BOOKS="PERSONAL_BOOKS"})(pt||(pt={}));var Zt=function(i,t,e,s){var o=arguments.length,n=o<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,t,e,s);else for(var l=i.length-1;l>=0;l--)(r=i[l])&&(n=(o<3?r(n):o>3?r(t,e,n):r(t,e))||n);return o>3&&n&&Object.defineProperty(t,e,n),n},K=class extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}},V=Symbol("registerInterval");function Gt(i){var t;class e extends i{constructor(){super(...arguments),this[t]=0}setReaderStateManager(o){this.clearStateManager(),this.stateManager=o,this.addStore(o.store,"reader")}clearStateManager(){this.stateManager&&(this.removeStore("reader"),this.stateManager=void 0)}get service(){var o;return(o=this.stateManager)===null||o===void 0?void 0:o.service}connectedCallback(){super.connectedCallback(),this[V]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null?window.clearInterval(this[V]):this.dispatchEvent(new K)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return t=V,Zt([(0,mt.state)()],e.prototype,"stateManager",void 0),e}var D=class extends Gt(ut.FtLitElementRedux){};var ft=function(i,t,e,s){var o=arguments.length,n=o<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,t,e,s);else for(var l=i.length-1;l>=0;l--)(r=i[l])&&(n=(o<3?r(n):o>3?r(t,e,n):r(t,e))||n);return o>3&&n&&Object.defineProperty(t,e,n),n},Q=class extends Event{constructor(){super("register-ft-reader-topic-component",{bubbles:!0,composed:!0})}},Z=Symbol("registerInterval");function Qt(i){var t;class e extends i{constructor(){super(...arguments),this.disableContextInteractions=!1,this[t]=0}connectedCallback(){super.connectedCallback(),this[Z]=window.setInterval(()=>this.tryToRegisterToTopicContext(),50)}tryToRegisterToTopicContext(){this.tocNode!=null?window.clearInterval(this[Z]):this.dispatchEvent(new Q)}disconnectedCallback(){super.disconnectedCallback(),this.tocNode=void 0}}return t=Z,ft([(0,G.state)()],e.prototype,"tocNode",void 0),ft([(0,G.state)()],e.prototype,"disableContextInteractions",void 0),e}var P=class extends Qt(D){};var $=u(v());var et=globalThis,j=et.trustedTypes,$t=j?j.createPolicy("lit-html",{createHTML:i=>i}):void 0,xt="$lit$",y=`lit$${Math.random().toFixed(9).slice(2)}$`,bt="?"+y,zt=`<${bt}>`,S=document,B=()=>S.createComment(""),O=i=>i===null||typeof i!="object"&&typeof i!="function",it=Array.isArray,qt=i=>it(i)||typeof i?.[Symbol.iterator]=="function",z=`[
10
+ \f\r]`,I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,gt=/-->/g,_t=/>/g,b=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^
11
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),At=/'/g,vt=/"/g,Ct=/^(?:script|style|textarea|title)$/i,st=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),St=st(1),Nt=st(2),Tt=st(3),E=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),yt=new WeakMap,C=S.createTreeWalker(S,129);function wt(i,t){if(!it(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return $t!==void 0?$t.createHTML(t):t}var Yt=(i,t)=>{let e=i.length-1,s=[],o,n=t===2?"<svg>":t===3?"<math>":"",r=I;for(let l=0;l<e;l++){let a=i[l],h,d,c=-1,_=0;for(;_<a.length&&(r.lastIndex=_,d=r.exec(a),d!==null);)_=r.lastIndex,r===I?d[1]==="!--"?r=gt:d[1]!==void 0?r=_t:d[2]!==void 0?(Ct.test(d[2])&&(o=RegExp("</"+d[2],"g")),r=b):d[3]!==void 0&&(r=b):r===b?d[0]===">"?(r=o??I,c=-1):d[1]===void 0?c=-2:(c=r.lastIndex-d[2].length,h=d[1],r=d[3]===void 0?b:d[3]==='"'?vt:At):r===vt||r===At?r=b:r===gt||r===_t?r=I:(r=b,o=void 0);let A=r===b&&i[l+1].startsWith("/>")?" ":"";n+=r===I?a+zt:c>=0?(s.push(h),a.slice(0,c)+xt+a.slice(c)+y+A):a+y+(c===-2?l:A)}return[wt(i,n+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},M=class i{constructor({strings:t,_$litType$:e},s){let o;this.parts=[];let n=0,r=0,l=t.length-1,a=this.parts,[h,d]=Yt(t,e);if(this.el=i.createElement(h,s),C.currentNode=this.el.content,e===2||e===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(o=C.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let c of o.getAttributeNames())if(c.endsWith(xt)){let _=d[r++],A=o.getAttribute(c).split(y),R=/([.?@])?(.*)/.exec(_);a.push({type:1,index:n,name:R[2],strings:A,ctor:R[1]==="."?Y:R[1]==="?"?J:R[1]==="@"?X:T}),o.removeAttribute(c)}else c.startsWith(y)&&(a.push({type:6,index:n}),o.removeAttribute(c));if(Ct.test(o.tagName)){let c=o.textContent.split(y),_=c.length-1;if(_>0){o.textContent=j?j.emptyScript:"";for(let A=0;A<_;A++)o.append(c[A],B()),C.nextNode(),a.push({type:2,index:++n});o.append(c[_],B())}}}else if(o.nodeType===8)if(o.data===bt)a.push({type:2,index:n});else{let c=-1;for(;(c=o.data.indexOf(y,c+1))!==-1;)a.push({type:7,index:n}),c+=y.length-1}n++}}static createElement(t,e){let s=S.createElement("template");return s.innerHTML=t,s}};function N(i,t,e=i,s){if(t===E)return t;let o=s!==void 0?e._$Co?.[s]:e._$Cl,n=O(t)?void 0:t._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),n===void 0?o=void 0:(o=new n(i),o._$AT(i,e,s)),s!==void 0?(e._$Co??=[])[s]=o:e._$Cl=o),o!==void 0&&(t=N(i,o._$AS(i,t.values),o,s)),t}var q=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,o=(t?.creationScope??S).importNode(e,!0);C.currentNode=o;let n=C.nextNode(),r=0,l=0,a=s[0];for(;a!==void 0;){if(r===a.index){let h;a.type===2?h=new W(n,n.nextSibling,this,t):a.type===1?h=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(h=new tt(n,this,t)),this._$AV.push(h),a=s[++l]}r!==a?.index&&(n=C.nextNode(),r++)}return C.currentNode=S,o}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},W=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,o){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=N(this,t,e),O(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==E&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):qt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==p&&O(this._$AH)?this._$AA.nextSibling.data=t:this.T(S.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,o=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=M.createElement(wt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===o)this._$AH.p(e);else{let n=new q(o,this),r=n.u(this.options);n.p(e),this.T(r),this._$AH=n}}_$AC(t){let e=yt.get(t.strings);return e===void 0&&yt.set(t.strings,e=new M(t)),e}k(t){it(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,o=0;for(let n of t)o===e.length?e.push(s=new i(this.O(B()),this.O(B()),this,this.options)):s=e[o],s._$AI(n),o++;o<e.length&&(this._$AR(s&&s._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,o,n){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=p}_$AI(t,e=this,s,o){let n=this.strings,r=!1;if(n===void 0)t=N(this,t,e,0),r=!O(t)||t!==this._$AH&&t!==E,r&&(this._$AH=t);else{let l=t,a,h;for(t=n[0],a=0;a<n.length-1;a++)h=N(this,l[s+a],e,a),h===E&&(h=this._$AH[a]),r||=!O(h)||h!==this._$AH[a],h===p?t=p:t!==p&&(t+=(h??"")+n[a+1]),this._$AH[a]=h}r&&!o&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Y=class extends T{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}},J=class extends T{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}},X=class extends T{constructor(t,e,s,o,n){super(t,e,s,o,n),this.type=5}_$AI(t,e=this){if((t=N(this,t,e,0)??p)===E)return;let s=this._$AH,o=t===p&&s!==p||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==p&&(s===p||o);o&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},tt=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){N(this,t)}};var Jt=et.litHtmlPolyfillSupport;Jt?.(M,W),(et.litHtmlVersions??=[]).push("3.3.0");var It=Symbol.for(""),Xt=i=>{if(i?.r===It)return i?._$litStatic$},ot=i=>({_$litStatic$:i,r:It});var Ht=new Map,nt=i=>(t,...e)=>{let s=e.length,o,n,r=[],l=[],a,h=0,d=!1;for(;h<s;){for(a=t[h];h<s&&(n=e[h],(o=Xt(n))!==void 0);)a+=o+t[++h],d=!0;h!==s&&l.push(n),r.push(a),h++}if(h===s&&r.push(t[s]),d){let c=r.join("$$lit$$");(t=Ht.get(c))===void 0&&(r.raw=r,Ht.set(c,t=r)),e=l}return i(t,...e)},F=nt(St),pe=nt(Nt),ue=nt(Tt);var Dt=u(k());var Lt=u(v());var Mt=u(H()),Rt=u(v());var Ot=u(H()),g=u(v()),m={display:g.FtCssVariableFactory.create("--ft-skeleton--display","","DISPLAY","block"),width:g.FtCssVariableFactory.create("--ft-skeleton--width","","SIZE","100%"),height:g.FtCssVariableFactory.create("--ft-skeleton--height","","SIZE","20px"),backgroundColor:g.FtCssVariableFactory.create("--ft-skeleton--background-color","","COLOR","#f1f1f1"),glareWidth:g.FtCssVariableFactory.create("--ft-skeleton--glare-width","","SIZE","200px"),glareColor:g.FtCssVariableFactory.create("--ft-skeleton--glare-color","","COLOR","rgba(255, 255, 255, .6)"),animationDuration:g.FtCssVariableFactory.create("--ft-skeleton--animation-duration","","UNKNOWN","2s"),borderRadiusM:g.FtCssVariableFactory.external(g.designSystemVariables.borderRadiusM,"Design system")},Et=Ot.css`
12
+ :host {
13
+ width: ${m.width};
14
+ height: ${m.height};
15
+ display: ${m.display};
16
+ overflow: hidden;
17
+ border-radius: ${m.borderRadiusM};
18
+ background: linear-gradient(
19
+ 90deg,
20
+ transparent,
21
+ ${m.glareColor} calc(0.45 * ${m.glareWidth}),
22
+ ${m.glareColor} calc(0.55 * ${m.glareWidth}),
23
+ transparent ${m.glareWidth}
24
+ ), ${m.backgroundColor};
25
+ background-repeat: repeat-y;
26
+ background-size: 100vw 100vh;
27
+ background-attachment: fixed;
28
+ background-position: calc(${m.glareWidth} * -1) 0;
29
+ animation: shine ${m.animationDuration} infinite;
30
+ animation-timing-function: linear;
31
+ }
32
+
33
+ @keyframes shine {
34
+ to {
35
+ background-position: calc(100vw + ${m.glareWidth}) 0, calc(${m.glareWidth} * -1) 0;
36
+ }
37
+ }
38
+ `;var x=class extends Rt.FtLitElement{render(){return Mt.html`
39
+ `}};x.elementDefinitions={};x.styles=Et;(0,Lt.customElement)("ft-skeleton")(x);var w=function(i,t,e,s){var o=arguments.length,n=o<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,t,e,s);else for(var l=i.length-1;l>=0;l--)(r=i[l])&&(n=(o<3?r(n):o>3?r(t,e,n):r(t,e))||n);return o>3&&n&&Object.defineProperty(t,e,n),n},f=class extends P{render(){var t,e,s,o,n;if((!this.map||!this.tocNode)&&!this.translationLoading)return kt.nothing;let r=`h${Math.min(((t=this.tocNode)===null||t===void 0?void 0:t.depth)||1,6)}`,l=(s=(e=this.map)===null||e===void 0?void 0:e.contentStyles.customCssClasses.join(" "))!==null&&s!==void 0?s:"";return F`
8
40
  <style>
9
- @import "${(n=this.map)===null||n===void 0?void 0:n.contentStyles.titleStylesheetUrl}";
41
+ @import "${(o=this.map)===null||o===void 0?void 0:o.contentStyles.titleStylesheetUrl}";
10
42
  </style>
11
- <section class="title" lang="${a}">
12
- <div class="depth-${(r=this.tocNode)===null||r===void 0?void 0:r.depth} content-locale-${a} ${l}">
13
- <${Y(h)}>${this.tocNode.title}</${Y(h)}>
14
- </div>
43
+ <section class="title" lang="${this.getTopicLanguage()}">
44
+ ${this.translationLoading?F`
45
+ <ft-skeleton></ft-skeleton>`:F`
46
+ <div class="depth-${(n=this.tocNode)===null||n===void 0?void 0:n.depth} content-locale-${this.getTopicLanguage()} ${l}">
47
+ <${ot(r)}>${this.tocNode.title}</${ot(r)}>
48
+ </div>`}
15
49
  </section>
16
- `}updated(t){super.updated(t),this.updateComplete.then(()=>(0,f.waitFor)(()=>this.titleContainer)).then(e=>(0,f.highlightHtml)(e,this.disableContextInteractions?"":this.searchInDocumentQuery,{attributes:{part:"kwicmatch"}}))}};A.styles=[rt,f.highlightHtmlStyles];et([(0,f.redux)()],A.prototype,"map",void 0);et([(0,f.redux)({selector:(o,t)=>t.disableContextInteractions?"":o.searchInDocumentQuery})],A.prototype,"searchInDocumentQuery",void 0);et([(0,wt.query)("section.title")],A.prototype,"titleContainer",void 0);(0,It.customElement)("ft-reader-topic-title")(A);})();
50
+ `}updated(t){super.updated(t),this.updateComplete.then(()=>(0,$.waitFor)(()=>this.titleContainer)).then(e=>(0,$.highlightHtml)(e,this.disableContextInteractions?"":this.searchInDocumentQuery,{attributes:{part:"kwicmatch"}}))}getTopicLanguage(){var t;return this.translationDestinationLanguage&&!this.translationError?this.translationDestinationLanguage.code:(t=this.map)===null||t===void 0?void 0:t.lang}};f.elementDefinitions={"ft-skeleton":x};f.styles=[ct,$.highlightHtmlStyles];w([(0,$.redux)()],f.prototype,"map",void 0);w([(0,$.redux)({selector:(i,t)=>t.disableContextInteractions?"":i.searchInDocumentQuery})],f.prototype,"searchInDocumentQuery",void 0);w([(0,$.redux)({selector:i=>i.translation.destinationLanguage})],f.prototype,"translationDestinationLanguage",void 0);w([(0,$.redux)({selector:i=>i.translation.isLoading})],f.prototype,"translationLoading",void 0);w([(0,$.redux)({selector:i=>i.translation.isError})],f.prototype,"translationError",void 0);w([(0,Dt.query)("section.title")],f.prototype,"titleContainer",void 0);(0,Pt.customElement)("ft-reader-topic-title")(f);})();
17
51
  /*! Bundled license information:
18
52
 
19
53
  lit-html/lit-html.js: