1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[466],{1224:(e,t,i)=>{function n(e,t,i,n,s,a,r){try{var h=e[a](r),l=h.value}catch(e){return void i(e)}h.done?t(l):Promise.resolve(l).then(n,s)}function s(e){return function(){var t=this,i=arguments;return new Promise((function(s,a){var r=e.apply(t,i);function h(e){n(r,s,a,h,l,"next",e)}function l(e){n(r,s,a,h,l,"throw",e)}h(void 0)}))}}i.d(t,{YQ:()=>S,ec:()=>y,oz:()=>w}),i(6281),i(4962),i(518),i(6448),i(7593),i(76),i(5021),i(9425),i(3062),i(1810),i(6968),i(2367);var a="read-aloud-current",r="read-aloud-current-sentence",h="undefined"!=typeof window&&"Highlight"in window&&"highlights"in CSS;function l(){return document.documentElement.lang||"de"}var o="kn-read-aloud-rate";function d(e){return Number.isFinite(e)?Math.min(1.5,Math.max(.5,e)):1}var c=[],u=null,g=[[/natural/i,100],[/neural/i,90],[/online/i,80],[/katja|marlene|vicki|hedda|petra/i,60],[/samantha|aria|jenny|ava|allison|serena|libby|sonia/i,60],[/google/i,30]];function p(e){var t=0;return g.forEach((i=>{var[n,s]=i;n.test(e.name)&&(t=Math.max(t,s))})),/female|weiblich|frau/i.test(e.name)&&(t+=5),t}function v(){return(v=s((function*(e){var t=c.length?c:yield u||(u=new Promise((e=>{var t=window.speechSynthesis.getVoices();if(t.length)return c=t,void e(t);var i=()=>{c=window.speechSynthesis.getVoices(),window.speechSynthesis.removeEventListener("voiceschanged",i),e(c)};window.speechSynthesis.addEventListener("voiceschanged",i),setTimeout((()=>{c=window.speechSynthesis.getVoices(),window.speechSynthesis.removeEventListener("voiceschanged",i),e(c)}),1e3)}))),i=e.split("-")[0].toLowerCase(),n=t.filter((e=>e.lang.toLowerCase().split("-")[0]===i));return n.length?n.map(((e,t)=>({voice:e,score:p(e),index:t}))).sort(((e,t)=>t.score-e.score||e.index-t.index))[0].voice:t.find((e=>e.default))||t[0]||null}))).apply(this,arguments)}class m extends EventTarget{constructor(){super(),this.state="idle",this.segments=[],this.totalLength=0,this.currentIndex=0,this.keepAliveTimer=null,this.voice=null,this.rate=function(){try{var e=parseFloat(window.localStorage.getItem(o));return Number.isFinite(e)?d(e):1}catch(e){return 1}}(),this.speakToken=0,this.lastHighlightedElement=null,window.addEventListener("reload",(()=>this.stop())),window.addEventListener("pagehide",(()=>window.speechSynthesis.cancel()))}setState(e){this.state=e,this.dispatchEvent(new CustomEvent("statechange",{detail:{state:e}}))}emitProgress(){var e=this.segments.slice(0,this.currentIndex).reduce(((e,t)=>e+t.text.length),0),t=this.totalLength?Math.min(100,Math.round(e/this.totalLength*100)):0;this.dispatchEvent(new CustomEvent("progress",{detail:{progress:t}}))}play(){var e=this;return s((function*(){var t,i;if("paused"!==e.state){if("playing"!==e.state){var n=function(e){if(void 0===e&&(e=document.querySelector("main")),!e)return[];var t=[],i=[];return e.querySelectorAll("h1, h2, h3, h4, h5, h6, p, li, blockquote, figcaption, dt, dd").forEach((e=>{if(!function(e){return Boolean(e.closest("nav, script, style, button, form, input, select, textarea"))||Boolean(e.closest('[aria-hidden="true"]'))||Boolean(e.closest("[hidden]"))}(e)&&!function(e){if(e.hidden||"true"===e.getAttribute("aria-hidden"))return!0;var t=window.getComputedStyle(e);return"none"===t.display||"hidden"===t.visibility}(e)&&!i.some((t=>t.contains(e)))){var n,s,a,r,h=e.textContent,l=h.replace(/\s+/g," ").trim();l&&/[a-z0-9äöüÃ]/i.test(l)&&(i.push(e),(n=h,s=[],a=n.split(/(?<=[.!?])\s+/),r=0,a.forEach((e=>{if(e){var t=n.indexOf(e,r);-1!==t&&(s.push({text:e,start:t,end:t+e.length}),r=t+e.length)}})),s).forEach((i=>{var n=i.text.replace(/\s+/g," ").trim();n&&t.push({element:e,text:n,start:i.start,end:i.end})})))}})),t}(),s=document.title.split(" - ")[0].trim(),a=null!=(t=null==(i=n[0])?void 0:i.text.toLowerCase())?t:"",r=s&&a.includes(s.toLowerCase()),h=s&&!r?[{text:s,element:null}]:[];e.segments=[...h,...n],e.segments.length&&(e.totalLength=e.segments.reduce(((e,t)=>e+t.text.length),0),e.currentIndex=0,e.voice=yield function(e){return v.apply(this,arguments)}(l()),e.speakFrom(e.currentIndex))}}else e.resume()}))()}speakFrom(e){if(e>=this.segments.length)this.stop();else{var t=this.segments[e],i=new SpeechSynthesisUtterance(t.text);i.lang=l(),this.voice&&(i.voice=this.voice),i.rate=this.rate,i.pitch=1.05;var n=this.speakToken+=1;i.onend=()=>{n===this.speakToken&&"playing"===this.state&&(this.currentIndex+=1,this.emitProgress(),this.speakFrom(this.currentIndex))},this.highlightSegment(t),this.currentUtterance=i,this.setState("playing"),window.speechSynthesis.speak(i),window.speechSynthesis.resume()}}highlightSegment(e){if(e.element){if(h){var t=function(e,t,i){for(var n,s,a,r,h=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),l=h.nextNode(),o=0;l;){var d=o+l.length;if(void 0===n&&t<=d&&(n=l,s=Math.max(0,t-o)),void 0===a&&i<=d&&(a=l,r=Math.max(0,i-o)),void 0!==n&&void 0!==a)break;o=d,l=h.nextNode()}if(!n||!a)return null;var c=document.createRange();return c.setStart(n,s),c.setEnd(a,r),c}(e.element,e.start,e.end);if(t)return void CSS.highlights.set(a,new Highlight(t))}this.lastHighlightedElement&&this.lastHighlightedElement!==e.element&&this.lastHighlightedElement.classList.remove(r),e.element.classList.add(r),this.lastHighlightedElement=e.element}else this.clearHighlight()}clearHighlight(){h&&CSS.highlights.delete(a),this.lastHighlightedElement&&(this.lastHighlightedElement.classList.remove(r),this.lastHighlightedElement=null)}pause(){"playing"===this.state&&(window.speechSynthesis.pause(),this.setState("paused"),this.keepAliveTimer=window.setInterval((()=>{window.speechSynthesis.pause()}),1e4))}resume(){"paused"===this.state&&(window.clearInterval(this.keepAliveTimer),this.keepAliveTimer=null,window.speechSynthesis.resume(),this.setState("playing"),window.setTimeout((()=>{"playing"!==this.state||window.speechSynthesis.speaking||this.speakFrom(this.currentIndex)}),250))}stop(){window.clearInterval(this.keepAliveTimer),this.keepAliveTimer=null,window.speechSynthesis.cancel(),this.currentIndex=0,this.clearHighlight(),this.setState("idle")}getRate(){return this.rate}setRate(e){var t=d(e);if(t===this.rate)return t;this.rate=t;try{window.localStorage.setItem(o,String(t))}catch(e){}return this.dispatchEvent(new CustomEvent("ratechange",{detail:{rate:t}})),"playing"===this.state&&(window.speechSynthesis.cancel(),this.speakFrom(this.currentIndex)),t}}var w={MIN:.5,MAX:1.5,STEP:.25,DEFAULT:1},f=null;function y(){return f||(f=new m),f}function S(){return"speechSynthesis"in window&&void 0!==window.SpeechSynthesisUtterance}},7041:(e,t,i)=>{i.r(t),i.d(t,{default:()=>s});var n=i(1224);const s=class{constructor(e){var t;if(!(0,n.YQ)())return null==(t=e.closest(".read-aloud-trigger-item"))||t.remove(),void e.remove();this.element=e,this.engine=(0,n.ec)(),this.playButton=e.querySelector('[data-role="play"]'),this.pauseButton=e.querySelector('[data-role="pause"]'),this.stopButton=e.querySelector('[data-role="stop"]'),this.playButton.addEventListener("click",(()=>this.engine.play())),this.pauseButton.addEventListener("click",(()=>this.engine.pause())),this.stopButton.addEventListener("click",(()=>this.engine.stop())),this.engine.addEventListener("statechange",(e=>this.handleStateChange(e)))}handleStateChange(e){var{state:t}=e.detail;this.playButton.setAttribute("aria-pressed",String("playing"===t)),this.pauseButton.setAttribute("aria-pressed",String("paused"===t)),this.pauseButton.disabled="idle"===t,this.stopButton.disabled="idle"===t}}}}]); 2//# sourceMappingURL=94b1ac7b00c87ef41251.read-aloud-trigger.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.