UNPKG

@huluvu424242/honey-slideshow

Version:

Text to Speech component wich is reading texts from DOM elements.

1,418 lines (1,376 loc) 1.21 MB
import { Context, setMode, getAssetPath, writeTask, Build, getMode, attachShadow, h, createEvent, Host, forceUpdate, readTask, proxyCustomElement } from '@stencil/core/internal/client'; const getPlatforms = (win) => setupPlatforms(win); const isPlatform = (winOrPlatform, platform) => { if (typeof winOrPlatform === 'string') { platform = winOrPlatform; winOrPlatform = undefined; } return getPlatforms(winOrPlatform).includes(platform); }; const setupPlatforms = (win = window) => { win.Ionic = win.Ionic || {}; let platforms = win.Ionic.platforms; if (platforms == null) { platforms = win.Ionic.platforms = detectPlatforms(win); platforms.forEach(p => win.document.documentElement.classList.add(`plt-${p}`)); } return platforms; }; const detectPlatforms = (win) => Object.keys(PLATFORMS_MAP).filter(p => PLATFORMS_MAP[p](win)); const isMobileWeb = (win) => isMobile(win) && !isHybrid(win); const isIpad = (win) => { // iOS 12 and below if (testUserAgent(win, /iPad/i)) { return true; } // iOS 13+ if (testUserAgent(win, /Macintosh/i) && isMobile(win)) { return true; } return false; }; const isIphone = (win) => testUserAgent(win, /iPhone/i); const isIOS = (win) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win); const isAndroid = (win) => testUserAgent(win, /android|sink/i); const isAndroidTablet = (win) => { return isAndroid(win) && !testUserAgent(win, /mobile/i); }; const isPhablet = (win) => { const width = win.innerWidth; const height = win.innerHeight; const smallest = Math.min(width, height); const largest = Math.max(width, height); return (smallest > 390 && smallest < 520) && (largest > 620 && largest < 800); }; const isTablet = (win) => { const width = win.innerWidth; const height = win.innerHeight; const smallest = Math.min(width, height); const largest = Math.max(width, height); return (isIpad(win) || isAndroidTablet(win) || ((smallest > 460 && smallest < 820) && (largest > 780 && largest < 1400))); }; const isMobile = (win) => matchMedia(win, '(any-pointer:coarse)'); const isDesktop = (win) => !isMobile(win); const isHybrid = (win) => isCordova(win) || isCapacitorNative(win); const isCordova = (win) => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']); const isCapacitorNative = (win) => { const capacitor = win['Capacitor']; return !!(capacitor && capacitor.isNative); }; const isElectron = (win) => testUserAgent(win, /electron/i); const isPWA = (win) => !!(win.matchMedia('(display-mode: standalone)').matches || win.navigator.standalone); const testUserAgent = (win, expr) => expr.test(win.navigator.userAgent); const matchMedia = (win, query) => win.matchMedia(query).matches; const PLATFORMS_MAP = { 'ipad': isIpad, 'iphone': isIphone, 'ios': isIOS, 'android': isAndroid, 'phablet': isPhablet, 'tablet': isTablet, 'cordova': isCordova, 'capacitor': isCapacitorNative, 'electron': isElectron, 'pwa': isPWA, 'mobile': isMobile, 'mobileweb': isMobileWeb, 'desktop': isDesktop, 'hybrid': isHybrid }; class Config { constructor() { this.m = new Map(); } reset(configObj) { this.m = new Map(Object.entries(configObj)); } get(key, fallback) { const value = this.m.get(key); return (value !== undefined) ? value : fallback; } getBoolean(key, fallback = false) { const val = this.m.get(key); if (val === undefined) { return fallback; } if (typeof val === 'string') { return val === 'true'; } return !!val; } getNumber(key, fallback) { const val = parseFloat(this.m.get(key)); return isNaN(val) ? (fallback !== undefined ? fallback : NaN) : val; } set(key, value) { this.m.set(key, value); } } const config = /*@__PURE__*/ new Config(); const configFromSession = (win) => { try { const configStr = win.sessionStorage.getItem(IONIC_SESSION_KEY); return configStr !== null ? JSON.parse(configStr) : {}; } catch (e) { return {}; } }; const saveConfig = (win, c) => { try { win.sessionStorage.setItem(IONIC_SESSION_KEY, JSON.stringify(c)); } catch (e) { return; } }; const configFromURL = (win) => { const configObj = {}; win.location.search.slice(1) .split('&') .map(entry => entry.split('=')) .map(([key, value]) => [decodeURIComponent(key), decodeURIComponent(value)]) .filter(([key]) => startsWith(key, IONIC_PREFIX)) .map(([key, value]) => [key.slice(IONIC_PREFIX.length), value]) .forEach(([key, value]) => { configObj[key] = value; }); return configObj; }; const startsWith = (input, search) => { return input.substr(0, search.length) === search; }; const IONIC_PREFIX = 'ionic:'; const IONIC_SESSION_KEY = 'ionic-persist-config'; let defaultMode; const appGlobalScript = () => { const doc = document; const win = window; Context.config = config; const Ionic = win.Ionic = win.Ionic || {}; // Setup platforms setupPlatforms(win); // create the Ionic.config from raw config object (if it exists) // and convert Ionic.config into a ConfigApi that has a get() fn const configObj = Object.assign(Object.assign(Object.assign(Object.assign({}, configFromSession(win)), { persistConfig: false }), Ionic.config), configFromURL(win)); config.reset(configObj); if (config.getBoolean('persistConfig')) { saveConfig(win, configObj); } // first see if the mode was set as an attribute on <html> // which could have been set by the user, or by pre-rendering // otherwise get the mode via config settings, and fallback to md Ionic.config = config; Ionic.mode = defaultMode = config.get('mode', (doc.documentElement.getAttribute('mode')) || (isPlatform(win, 'ios') ? 'ios' : 'md')); config.set('mode', defaultMode); doc.documentElement.setAttribute('mode', defaultMode); doc.documentElement.classList.add(defaultMode); if (config.getBoolean('_testing')) { config.set('animated', false); } const isIonicElement = (elm) => elm.tagName && elm.tagName.startsWith('ION-'); const isAllowedIonicModeValue = (elmMode) => ['ios', 'md'].includes(elmMode); setMode((elm) => { while (elm) { const elmMode = elm.mode || elm.getAttribute('mode'); if (elmMode) { if (isAllowedIonicModeValue(elmMode)) { return elmMode; } else if (isIonicElement(elm)) { console.warn('Invalid ionic mode: "' + elmMode + '", expected: "ios" or "md"'); } } elm = elm.parentElement; } return defaultMode; }); }; const globalScripts = appGlobalScript; const IMG_START = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' + ' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' + ' <clipPath id="p.0">\n' + ' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' + ' </clipPath>\n' + ' <g clip-path="url(#p.0)">\n' + ' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' + ' <path fill="#000000"\n' + ' d="m954.5431 670.8872l-812.8905 -308.69644l818.3474 -304.63376l-5.456909 89.36221l-561.92786 215.27156l567.38477 219.33426z"\n' + ' fill-rule="evenodd"/>\n' + ' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' + ' d="m954.5431 670.8872l-812.8905 -308.69644l818.3474 -304.63376l-5.456909 89.36221l-561.92786 215.27156l567.38477 219.33426z"\n' + ' fill-rule="evenodd"/>\n' + ' <path fill="#000000" d="m141.67947 720.0l-141.6693 0l0 -720.0l141.6693 0z" fill-rule="evenodd"/>\n' + ' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' + ' d="m141.67947 720.0l-141.6693 0l0 -720.0l141.6693 0z" fill-rule="evenodd"/>\n' + ' </g>\n' + '</svg>'; const IMG_FASTREWIND = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' + ' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' + ' <clipPath id="p.0">\n' + ' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' + ' </clipPath>\n' + ' <g clip-path="url(#p.0)">\n' + ' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' + ' <path fill="#000000"\n' + ' d="m956.60803 718.49603l-573.71375 -362.3846l577.56506 -357.61536l-3.8512573 104.90401l-396.59186 252.71136l400.4431 257.48062z"\n' + ' fill-rule="evenodd"/>\n' + ' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' + ' d="m956.60803 718.49603l-573.71375 -362.3846l577.56506 -357.61536l-3.8512573 104.90401l-396.59186 252.71136l400.4431 257.48062z"\n' + ' fill-rule="evenodd"/>\n' + ' <path fill="#000000"\n' + ' d="m574.16724 718.49603l-573.71375 -362.3846l577.56506 -357.61536l-3.8513184 104.90401l-396.59186 252.71136l400.44318 257.48062z"\n' + ' fill-rule="evenodd"/>\n' + ' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' + ' d="m574.16724 718.49603l-573.71375 -362.3846l577.56506 -357.61536l-3.8513184 104.90401l-396.59186 252.71136l400.44318 257.48062z"\n' + ' fill-rule="evenodd"/>\n' + ' </g>\n' + '</svg>'; const IMG_REWIND = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' + ' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' + ' <clipPath id="p.0">\n' + ' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' + ' </clipPath>\n' + ' <g clip-path="url(#p.0)">\n' + ' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' + ' <path fill="#000000"\n' + ' d="m951.5988 722.2808l-951.6064 -364.2935l957.99445 -359.49908l-6.3880615 105.45658l-657.81824 254.04251l664.2063 258.83694z"\n' + ' fill-rule="evenodd"/>\n' + ' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' + ' d="m951.5988 722.2808l-951.6064 -364.2935l957.99445 -359.49908l-6.3880615 105.45658l-657.81824 254.04251l664.2063 258.83694z"\n' + ' fill-rule="evenodd"/>\n' + ' </g>\n' + '</svg>'; const IMG_PLAY = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' + ' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' + ' <clipPath id="p.0">\n' + ' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' + ' </clipPath>\n' + ' <g clip-path="url(#p.0)">\n' + ' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' + ' <path fill="#000000" d="m-0.007874016 0l958.3937 360.86615l-958.3937 360.86615z" fill-rule="evenodd"/>\n' + ' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' + ' d="m-0.007874016 0l958.3937 360.86615l-958.3937 360.86615z" fill-rule="evenodd"/>\n' + ' </g>\n' + '</svg>'; const IMG_PAUSE = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' + ' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' + ' <clipPath id="p.0">\n' + ' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' + ' </clipPath>\n' + ' <g clip-path="url(#p.0)">\n' + ' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' + ' <path fill="#000000" d="m198.31253 1.2073491l192.50394 0l0 720.0l-192.50394 0z" fill-rule="evenodd"/>\n' + ' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' + ' d="m198.31253 1.2073491l192.50394 0l0 720.0l-192.50394 0z" fill-rule="evenodd"/>\n' + ' <path fill="#000000" d="m550.7434 1.2073491l192.50397 0l0 720.0l-192.50397 0z" fill-rule="evenodd"/>\n' + ' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' + ' d="m550.7434 1.2073491l192.50397 0l0 720.0l-192.50397 0z" fill-rule="evenodd"/>\n' + ' </g>\n' + '</svg>'; const IMG_FOREWARD = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' + ' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' + ' <clipPath id="p.0">\n' + ' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' + ' </clipPath>\n' + ' <g clip-path="url(#p.0)">\n' + ' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' + ' <path fill="#000000"\n' + ' d="m6.4014697 -1.503937l953.6023 362.38464l-960.0038 357.6154l6.4014697 -104.90405l659.1979 -252.71133l-665.59937 -257.48065z"\n' + ' fill-rule="evenodd"/>\n' + ' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' + ' d="m6.4014697 -1.503937l953.6023 362.38464l-960.0038 357.6154l6.4014697 -104.90405l659.1979 -252.71133l-665.59937 -257.48065z"\n' + ' fill-rule="evenodd"/>\n' + ' </g>\n' + '</svg>'; const IMG_FASTFOREWARD = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' + ' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' + ' <clipPath id="p.0">\n' + ' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' + ' </clipPath>\n' + ' <g clip-path="url(#p.0)">\n' + ' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' + ' <path fill="#000000"\n' + ' d="m3.8513029 -1.503937l573.71375 362.38464l-577.56506 357.6154l3.8513029 -104.90405l396.59186 -252.71133l-400.44315 -257.48065z"\n' + ' fill-rule="evenodd"/>\n' + ' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' + ' d="m3.8513029 -1.503937l573.71375 362.38464l-577.56506 357.6154l3.8513029 -104.90405l396.59186 -252.71133l-400.44315 -257.48065z"\n' + ' fill-rule="evenodd"/>\n' + ' <path fill="#000000"\n' + ' d="m386.29053 -1.503937l573.71375 362.38464l-577.56506 357.6154l3.8512878 -104.90405l396.59186 -252.71133l-400.44315 -257.48065z"\n' + ' fill-rule="evenodd"/>\n' + ' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' + ' d="m386.29053 -1.503937l573.71375 362.38464l-577.56506 357.6154l3.8512878 -104.90405l396.59186 -252.71133l-400.44315 -257.48065z"\n' + ' fill-rule="evenodd"/>\n' + ' </g>\n' + '</svg>'; const IMG_END = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' + ' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' + ' <clipPath id="p.0">\n' + ' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' + ' </clipPath>\n' + ' <g clip-path="url(#p.0)">\n' + ' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' + ' <path fill="#000000"\n' + ' d="m5.486655 49.11279l817.3259 308.69644l-822.81256 304.63376l5.486655 -89.36218l564.99396 -215.27158l-570.4806 -219.33423z"\n' + ' fill-rule="evenodd"/>\n' + ' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' + ' d="m5.486655 49.11279l817.3259 308.69644l-822.81256 304.63376l5.486655 -89.36218l564.99396 -215.27158l-570.4806 -219.33423z"\n' + ' fill-rule="evenodd"/>\n' + ' <path fill="#000000" d="m822.78174 0l142.45667 0l0 720.0l-142.45667 0z" fill-rule="evenodd"/>\n' + ' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' + ' d="m822.78174 0l142.45667 0l0 720.0l-142.45667 0z" fill-rule="evenodd"/>\n' + ' </g>\n' + '</svg>\n'; const IMG_STOP = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' + ' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' + ' <clipPath id="p.0">\n' + ' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' + ' </clipPath>\n' + ' <g clip-path="url(#p.0)">\n' + ' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' + ' <path fill="#000000" d="m198.312 1.2073491l544.9449 0l0 720.0l-544.9449 0z" fill-rule="evenodd"/>\n' + ' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' + ' d="m198.312 1.2073491l544.9449 0l0 720.0l-544.9449 0z" fill-rule="evenodd"/>\n' + ' </g>\n' + '</svg>'; class Logger { static logMessage(message) { console.log(message); } static debugMessage(message) { console.debug(message); } static errorMessage(message) { console.error(message); } static infoMessage(message) { console.info(message); } } class Sprachausgabe { constructor(sprachSynthese, sprachauswahl, vorleserCallbacks) { this.sprachSynthese = sprachSynthese; this.sprachauswahl = sprachauswahl; this.vorleserCallbacks = vorleserCallbacks; Logger.infoMessage("####constructor finished"); } initialisiereVorleserStimme(vorleser) { Logger.infoMessage("erzeugeVorleser started"); vorleser.pitch = this.sprachauswahl.getPitch(); vorleser.rate = this.sprachauswahl.getRate(); vorleser.volume = this.sprachauswahl.getVolume(); vorleser.voice = this.sprachauswahl.getVoice(); if (vorleser.voice && vorleser.voice.lang) { vorleser.lang = vorleser.voice.lang; } else { vorleser.lang = "de-DE"; } } erzeugeVorleser(text) { const vorleser = new SpeechSynthesisUtterance(text); if (this.vorleserCallbacks) { vorleser.onend = () => { Logger.debugMessage("Vorlesen beendet"); if (this.vorleserCallbacks.onend) { this.vorleserCallbacks.onend(); } }; vorleser.onstart = () => { Logger.debugMessage("Vorlesen gestartet"); if (this.vorleserCallbacks.onstart) { this.vorleserCallbacks.onstart(); } }; vorleser.onpause = () => { Logger.debugMessage("Pause mit Vorlesen"); if (this.vorleserCallbacks.onpause) { this.vorleserCallbacks.onpause(); } }; vorleser.onresume = () => { Logger.debugMessage("Fortsetzen des Vorlesen"); if (this.vorleserCallbacks.onresume) { this.vorleserCallbacks.onresume(); } }; vorleser.onerror = () => { Logger.errorMessage("Fehler beim Vorlesen"); if (this.vorleserCallbacks.onerror) { this.vorleserCallbacks.onerror(); } }; } this.initialisiereVorleserStimme(vorleser); return vorleser; } textVorlesen(zuLesenderText) { if (zuLesenderText) { // Auftrennung in Textblöcken nach Sprachen. // const texte: string[] = zuLesenderText.match(/(\S+[\s.]){1,20}/g); const texte = [zuLesenderText]; texte.forEach(text => { const vorleser = this.erzeugeVorleser(text); Logger.infoMessage("speaker lang used:" + vorleser.lang); if (vorleser.voice) { Logger.infoMessage("speaker voice used:" + vorleser.voice.name); Logger.infoMessage("speaker voice lang:" + vorleser.voice.lang); } else { Logger.infoMessage("no voice matched for text: " + zuLesenderText); } this.sprachSynthese.getSynthese().speak(vorleser); }); } } cancelSpeakingAndClearQueue() { this.sprachSynthese.getSynthese().cancel(); } pauseSpeakingFromQueue() { this.sprachSynthese.getSynthese().pause(); } resumeSpeakingFromQueue() { this.sprachSynthese.getSynthese().resume(); } isPaused() { return this.sprachSynthese.getSynthese().paused; } } class Sprachauswahl { constructor(sprachsynthese) { Logger.infoMessage("create Sprachauswahl"); this.sprachSynthese = sprachsynthese; this.rate = 1; this.volume = 1; this.pitch = 1; this.initDefaultStimme(); } initDefaultStimme() { const voices = this.sprachSynthese.getVoices(); if (!voices) { const voicesRetry = this.sprachSynthese.getVoices(); this.voice = voicesRetry[0]; } else { this.voice = voices[0]; } } getRate() { return this.rate; } getVolume() { return this.volume; } getPitch() { return this.pitch; } getVoice() { return this.voice; } getVoiceList() { return this.sprachSynthese.getVoices(); } setChoosenVoice(voice) { this.voice = voice; } setVolume(volume) { this.volume = volume; } setRate(rate) { this.rate = rate; } setPitch(pitch) { this.pitch = pitch; } } function isFunction(x) { return typeof x === 'function'; } let _enable_super_gross_mode_that_will_cause_bad_things = false; const config$1 = { Promise: undefined, set useDeprecatedSynchronousErrorHandling(value) { if (value) { const error = new Error(); console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack); } else if (_enable_super_gross_mode_that_will_cause_bad_things) { console.log('RxJS: Back to a better error behavior. Thank you. <3'); } _enable_super_gross_mode_that_will_cause_bad_things = value; }, get useDeprecatedSynchronousErrorHandling() { return _enable_super_gross_mode_that_will_cause_bad_things; }, }; function hostReportError(err) { setTimeout(() => { throw err; }, 0); } const empty = { closed: true, next(value) { }, error(err) { if (config$1.useDeprecatedSynchronousErrorHandling) { throw err; } else { hostReportError(err); } }, complete() { } }; const isArray = (() => Array.isArray || ((x) => x && typeof x.length === 'number'))(); function isObject(x) { return x !== null && typeof x === 'object'; } const UnsubscriptionErrorImpl = (() => { function UnsubscriptionErrorImpl(errors) { Error.call(this); this.message = errors ? `${errors.length} errors occurred during unsubscription: ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : ''; this.name = 'UnsubscriptionError'; this.errors = errors; return this; } UnsubscriptionErrorImpl.prototype = Object.create(Error.prototype); return UnsubscriptionErrorImpl; })(); const UnsubscriptionError = UnsubscriptionErrorImpl; class Subscription { constructor(unsubscribe) { this.closed = false; this._parentOrParents = null; this._subscriptions = null; if (unsubscribe) { this._unsubscribe = unsubscribe; } } unsubscribe() { let errors; if (this.closed) { return; } let { _parentOrParents, _unsubscribe, _subscriptions } = this; this.closed = true; this._parentOrParents = null; this._subscriptions = null; if (_parentOrParents instanceof Subscription) { _parentOrParents.remove(this); } else if (_parentOrParents !== null) { for (let index = 0; index < _parentOrParents.length; ++index) { const parent = _parentOrParents[index]; parent.remove(this); } } if (isFunction(_unsubscribe)) { try { _unsubscribe.call(this); } catch (e) { errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e]; } } if (isArray(_subscriptions)) { let index = -1; let len = _subscriptions.length; while (++index < len) { const sub = _subscriptions[index]; if (isObject(sub)) { try { sub.unsubscribe(); } catch (e) { errors = errors || []; if (e instanceof UnsubscriptionError) { errors = errors.concat(flattenUnsubscriptionErrors(e.errors)); } else { errors.push(e); } } } } } if (errors) { throw new UnsubscriptionError(errors); } } add(teardown) { let subscription = teardown; if (!teardown) { return Subscription.EMPTY; } switch (typeof teardown) { case 'function': subscription = new Subscription(teardown); case 'object': if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') { return subscription; } else if (this.closed) { subscription.unsubscribe(); return subscription; } else if (!(subscription instanceof Subscription)) { const tmp = subscription; subscription = new Subscription(); subscription._subscriptions = [tmp]; } break; default: { throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.'); } } let { _parentOrParents } = subscription; if (_parentOrParents === null) { subscription._parentOrParents = this; } else if (_parentOrParents instanceof Subscription) { if (_parentOrParents === this) { return subscription; } subscription._parentOrParents = [_parentOrParents, this]; } else if (_parentOrParents.indexOf(this) === -1) { _parentOrParents.push(this); } else { return subscription; } const subscriptions = this._subscriptions; if (subscriptions === null) { this._subscriptions = [subscription]; } else { subscriptions.push(subscription); } return subscription; } remove(subscription) { const subscriptions = this._subscriptions; if (subscriptions) { const subscriptionIndex = subscriptions.indexOf(subscription); if (subscriptionIndex !== -1) { subscriptions.splice(subscriptionIndex, 1); } } } } Subscription.EMPTY = (function (empty) { empty.closed = true; return empty; }(new Subscription())); function flattenUnsubscriptionErrors(errors) { return errors.reduce((errs, err) => errs.concat((err instanceof UnsubscriptionError) ? err.errors : err), []); } const rxSubscriber = (() => typeof Symbol === 'function' ? Symbol('rxSubscriber') : '@@rxSubscriber_' + Math.random())(); class Subscriber extends Subscription { constructor(destinationOrNext, error, complete) { super(); this.syncErrorValue = null; this.syncErrorThrown = false; this.syncErrorThrowable = false; this.isStopped = false; switch (arguments.length) { case 0: this.destination = empty; break; case 1: if (!destinationOrNext) { this.destination = empty; break; } if (typeof destinationOrNext === 'object') { if (destinationOrNext instanceof Subscriber) { this.syncErrorThrowable = destinationOrNext.syncErrorThrowable; this.destination = destinationOrNext; destinationOrNext.add(this); } else { this.syncErrorThrowable = true; this.destination = new SafeSubscriber(this, destinationOrNext); } break; } default: this.syncErrorThrowable = true; this.destination = new SafeSubscriber(this, destinationOrNext, error, complete); break; } } [rxSubscriber]() { return this; } static create(next, error, complete) { const subscriber = new Subscriber(next, error, complete); subscriber.syncErrorThrowable = false; return subscriber; } next(value) { if (!this.isStopped) { this._next(value); } } error(err) { if (!this.isStopped) { this.isStopped = true; this._error(err); } } complete() { if (!this.isStopped) { this.isStopped = true; this._complete(); } } unsubscribe() { if (this.closed) { return; } this.isStopped = true; super.unsubscribe(); } _next(value) { this.destination.next(value); } _error(err) { this.destination.error(err); this.unsubscribe(); } _complete() { this.destination.complete(); this.unsubscribe(); } _unsubscribeAndRecycle() { const { _parentOrParents } = this; this._parentOrParents = null; this.unsubscribe(); this.closed = false; this.isStopped = false; this._parentOrParents = _parentOrParents; return this; } } class SafeSubscriber extends Subscriber { constructor(_parentSubscriber, observerOrNext, error, complete) { super(); this._parentSubscriber = _parentSubscriber; let next; let context = this; if (isFunction(observerOrNext)) { next = observerOrNext; } else if (observerOrNext) { next = observerOrNext.next; error = observerOrNext.error; complete = observerOrNext.complete; if (observerOrNext !== empty) { context = Object.create(observerOrNext); if (isFunction(context.unsubscribe)) { this.add(context.unsubscribe.bind(context)); } context.unsubscribe = this.unsubscribe.bind(this); } } this._context = context; this._next = next; this._error = error; this._complete = complete; } next(value) { if (!this.isStopped && this._next) { const { _parentSubscriber } = this; if (!config$1.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(this._next, value); } else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) { this.unsubscribe(); } } } error(err) { if (!this.isStopped) { const { _parentSubscriber } = this; const { useDeprecatedSynchronousErrorHandling } = config$1; if (this._error) { if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(this._error, err); this.unsubscribe(); } else { this.__tryOrSetError(_parentSubscriber, this._error, err); this.unsubscribe(); } } else if (!_parentSubscriber.syncErrorThrowable) { this.unsubscribe(); if (useDeprecatedSynchronousErrorHandling) { throw err; } hostReportError(err); } else { if (useDeprecatedSynchronousErrorHandling) { _parentSubscriber.syncErrorValue = err; _parentSubscriber.syncErrorThrown = true; } else { hostReportError(err); } this.unsubscribe(); } } } complete() { if (!this.isStopped) { const { _parentSubscriber } = this; if (this._complete) { const wrappedComplete = () => this._complete.call(this._context); if (!config$1.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(wrappedComplete); this.unsubscribe(); } else { this.__tryOrSetError(_parentSubscriber, wrappedComplete); this.unsubscribe(); } } else { this.unsubscribe(); } } } __tryOrUnsub(fn, value) { try { fn.call(this._context, value); } catch (err) { this.unsubscribe(); if (config$1.useDeprecatedSynchronousErrorHandling) { throw err; } else { hostReportError(err); } } } __tryOrSetError(parent, fn, value) { if (!config$1.useDeprecatedSynchronousErrorHandling) { throw new Error('bad call'); } try { fn.call(this._context, value); } catch (err) { if (config$1.useDeprecatedSynchronousErrorHandling) { parent.syncErrorValue = err; parent.syncErrorThrown = true; return true; } else { hostReportError(err); return true; } } return false; } _unsubscribe() { const { _parentSubscriber } = this; this._context = null; this._parentSubscriber = null; _parentSubscriber.unsubscribe(); } } function canReportError(observer) { while (observer) { const { closed, destination, isStopped } = observer; if (closed || isStopped) { return false; } else if (destination && destination instanceof Subscriber) { observer = destination; } else { observer = null; } } return true; } function toSubscriber(nextOrObserver, error, complete) { if (nextOrObserver) { if (nextOrObserver instanceof Subscriber) { return nextOrObserver; } if (nextOrObserver[rxSubscriber]) { return nextOrObserver[rxSubscriber](); } } if (!nextOrObserver && !error && !complete) { return new Subscriber(empty); } return new Subscriber(nextOrObserver, error, complete); } const observable = (() => typeof Symbol === 'function' && Symbol.observable || '@@observable')(); function identity(x) { return x; } function pipeFromArray(fns) { if (fns.length === 0) { return identity; } if (fns.length === 1) { return fns[0]; } return function piped(input) { return fns.reduce((prev, fn) => fn(prev), input); }; } class Observable { constructor(subscribe) { this._isScalar = false; if (subscribe) { this._subscribe = subscribe; } } lift(operator) { const observable = new Observable(); observable.source = this; observable.operator = operator; return observable; } subscribe(observerOrNext, error, complete) { const { operator } = this; const sink = toSubscriber(observerOrNext, error, complete); if (operator) { sink.add(operator.call(sink, this.source)); } else { sink.add(this.source || (config$1.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ? this._subscribe(sink) : this._trySubscribe(sink)); } if (config$1.useDeprecatedSynchronousErrorHandling) { if (sink.syncErrorThrowable) { sink.syncErrorThrowable = false; if (sink.syncErrorThrown) { throw sink.syncErrorValue; } } } return sink; } _trySubscribe(sink) { try { return this._subscribe(sink); } catch (err) { if (config$1.useDeprecatedSynchronousErrorHandling) { sink.syncErrorThrown = true; sink.syncErrorValue = err; } if (canReportError(sink)) { sink.error(err); } else { console.warn(err); } } } forEach(next, promiseCtor) { promiseCtor = getPromiseCtor(promiseCtor); return new promiseCtor((resolve, reject) => { let subscription; subscription = this.subscribe((value) => { try { next(value); } catch (err) { reject(err); if (subscription) { subscription.unsubscribe(); } } }, reject, resolve); }); } _subscribe(subscriber) { const { source } = this; return source && source.subscribe(subscriber); } [observable]() { return this; } pipe(...operations) { if (operations.length === 0) { return this; } return pipeFromArray(operations)(this); } toPromise(promiseCtor) { promiseCtor = getPromiseCtor(promiseCtor); return new promiseCtor((resolve, reject) => { let value; this.subscribe((x) => value = x, (err) => reject(err), () => resolve(value)); }); } } Observable.create = (subscribe) => { return new Observable(subscribe); }; function getPromiseCtor(promiseCtor) { if (!promiseCtor) { promiseCtor = Promise; } if (!promiseCtor) { throw new Error('no Promise impl found'); } return promiseCtor; } const ObjectUnsubscribedErrorImpl = (() => { function ObjectUnsubscribedErrorImpl() { Error.call(this); this.message = 'object unsubscribed'; this.name = 'ObjectUnsubscribedError'; return this; } ObjectUnsubscribedErrorImpl.prototype = Object.create(Error.prototype); return ObjectUnsubscribedErrorImpl; })(); const ObjectUnsubscribedError = ObjectUnsubscribedErrorImpl; class SubjectSubscription extends Subscription { constructor(subject, subscriber) { super(); this.subject = subject; this.subscriber = subscriber; this.closed = false; } unsubscribe() { if (this.closed) { return; } this.closed = true; const subject = this.subject; const observers = subject.observers; this.subject = null; if (!observers || observers.length === 0 || subject.isStopped || subject.closed) { return; } const subscriberIndex = observers.indexOf(this.subscriber); if (subscriberIndex !== -1) { observers.splice(subscriberIndex, 1); } } } class SubjectSubscriber extends Subscriber { constructor(destination) { super(destination); this.destination = destination; } } class Subject extends Observable { constructor() { super(); this.observers = []; this.closed = false; this.isStopped = false; this.hasError = false; this.thrownError = null; } [rxSubscriber]() { return new SubjectSubscriber(this); } lift(operator) { const subject = new AnonymousSubject(this, this); subject.operator = operator; return subject; } next(value) { if (this.closed) { throw new ObjectUnsubscribedError(); } if (!this.isStopped) { const { observers } = this; const len = observers.length; const copy = observers.slice(); for (let i = 0; i < len; i++) { copy[i].next(value); } } } error(err) { if (this.closed) { throw new ObjectUnsubscribedError(); } this.hasError = true; this.thrownError = err; this.isStopped = true; const { observers } = this; const len = observers.length; const copy = observers.slice(); for (let i = 0; i < len; i++) { copy[i].error(err); } this.observers.length = 0; } complete() { if (this.closed) { throw new ObjectUnsubscribedError(); } this.isStopped = true; const { observers } = this; const len = observers.length; const copy = observers.slice(); for (let i = 0; i < len; i++) { copy[i].complete(); } this.observers.length = 0; } unsubscribe() { this.isStopped = true; this.closed = true; this.observers = null; } _trySubscribe(subscriber) { if (this.closed) { throw new ObjectUnsubscribedError(); } else { return super._trySubscribe(subscriber); } } _subscribe(subscriber) { if (this.closed) { throw new ObjectUnsubscribedError(); } else if (this.hasError) { subscriber.error(this.thrownError); return Subscription.EMPTY; } else if (this.isStopped) { subscriber.complete(); return Subscription.EMPTY; } else { this.observers.push(subscriber); return new SubjectSubscription(this, subscriber); } } asObservable() { const observable = new Observable(); observable.source = this; return observable; } } Subject.create = (destination, source) => { return new AnonymousSubject(destination, source); }; class AnonymousSubject extends Subject { constructor(destination, source) { super(); this.destination = destination; this.source = source; } next(value) { const { destination } = this; if (destination && destination.next) { destination.next(value); } } error(err) { const { destination } = this; if (destination && destination.error) { this.destination.error(err); } } complete() { const { destination } = this; if (destination && destination.complete) { this.destination.complete(); } } _subscribe(subscriber) { const { source } = this; if (source) { return this.source.subscribe(subscriber); } else { return Subscription.EMPTY; } } } class Fileloader { constructor(fileURL) { this.responseInfo = { content: null, status: null }; this.url = fileURL; } static of(fileURL) { return new Fileloader(new URL(fileURL)); } loadFile() { const responseInfo = this.responseInfo; const subject = new Subject(); const client = new XMLHttpRequest(); client.addEventListener("load", (event) => { responseInfo.content = client.responseText; console.log(event.total + " bytes gelesen.\n:" + responseInfo.content); }); client.onloadend = function () { responseInfo.status = client.status; console.log("Response Status:" + responseInfo.status); subject.next(responseInfo); }; client.open("GET", this.url.toString()); client.send(); return subject; } } function createCommonjsModule(fn, basedir, module) { return module = { path: basedir, exports: {}, require: function (path, base) { return commonjsRequire(); } }, fn(module, module.exports), module.exports; } function commonjsRequire () { throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); } var defaults = createCommonjsModule(function (module) { function getDefaults() { return { baseUrl: null, breaks: false, gfm: true, headerIds: true, headerPrefix: '', highlight: null, langPrefix: 'language-', mangle: true, pedantic: false, renderer: null, sanitize: false, sanitizer: null, silent: false, smartLists: false, smartypants: false, tokenizer: null, xhtml: false }; } function changeDefaults(newDefaults) { module.exports.defaults = newDefaults; } module.exports = { defaults: getDefaults(), getDefaults, changeDefaults }; }); var defaults$1 = createCommonjsModule(function (module) { function getDefaults() { return { baseUrl: null, breaks: false, gfm: true, headerIds: true, headerPrefix: '', highlight: null, langPrefix: 'language-', mangle: true, pedantic: false, renderer: null, sanitize: false, sanitizer: null, silent: false, smartLists: false, smartypants: false, tokenizer: null, xhtml: false }; } function changeDefaults(newDefaults) { module.exports.defaults = newDefaults; } module.exports = { defaults: getDefaults(), getDefaults, changeDefaults }; }); /** * Helpers */ const escapeTest = /[&<>"']/; const escapeReplace = /[&<>"']/g; const escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/; const escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g; const escapeReplacements = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }; const getEscapeReplacement = (ch) => escapeReplacements[ch]; function escape(html, encode) { if (encode) { if (escapeTest.test(html)) { return html.replace(escapeReplace, getEscapeReplacement); } } else { if (escapeTestNoEncode.test(html)) { return html.replace(escapeReplaceNoEncode, getEscapeReplacement); } } return html; } const unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig; function unescape(html) { // explicitly match decimal, hex, and named HTML entities return html.replace(unescapeTest, (_, n) => { n = n.toLowerCase(); if (n === 'colon') return ':'; if (n.charAt(0) === '#') { return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1)); } return ''; }); } const caret = /(^|[^\[])\^/g; function edit(regex, opt) { regex = regex.source || regex; opt = opt || ''; const obj = { replace: (name, val) => { val = val.source || val; val = val.replace(caret, '$1'); regex = regex.replace(name, val); return obj; }, getRegex: () => { return new RegExp(regex, opt); } }; return obj; } const nonWordAndColonTest = /[^\w:]/g; const originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i; function cleanUrl(sanitize, base, href) { if (sanitize) { let prot; try { prot = decodeURIComponent(unescape(href)) .replace(nonWordAndColonTest, '') .toLowerCase(); } catch (e) { return null;