@huluvu424242/honey-slideshow
Version:
Text to Speech component wich is reading texts from DOM elements.
1,463 lines (1,401 loc) • 117 kB
JavaScript
import { r as registerInstance, h, g as getElement } from './index-a2883912.js';
import { I as IonicSafeString } from './index-dbc17a36.js';
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 = {
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.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.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;
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.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.useDeprecatedSynchronousErrorHandling) {
throw err;
}
else {
hostReportError(err);
}
}
}
__tryOrSetError(parent, fn, value) {
if (!config.useDeprecatedSynchronousErrorHandling) {
throw new Error('bad call');
}
try {
fn.call(this._context, value);
}
catch (err) {
if (config.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.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
this._subscribe(sink) :
this._trySubscribe(sink));
}
if (config.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.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 = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
};
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;
}
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
return null;
}
}
if (base && !originIndependentUrl.test(href)) {
href = resolveUrl(base, href);
}
try {
href = encodeURI(href).replace(/%25/g, '%');
} catch (e) {
return null;
}
return href;
}
const baseUrls = {};
const justDomain = /^[^:]+:\/*[^/]*$/;
const protocol = /^([^:]+:)[\s\S]*$/;
const domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
function resolveUrl(base, href) {
if (!baseUrls[' ' + base]) {
// we can ignore everything in base after the last slash of its path component,
// but we might need to add _that_
// https://tools.ietf.org/html/rfc3986#section-3
if (justDomain.test(base)) {
baseUrls[' ' + base] = base + '/';
} else {
baseUrls[' ' + base] = rtrim(base, '/', true);
}
}
base = baseUrls[' ' + base];
const relativeBase = base.indexOf(':') === -1;
if (href.substring(0, 2) === '//') {
if (relativeBase) {
return href;
}
return base.replace(protocol, '$1') + href;
} else if (href.charAt(0) === '/') {
if (relativeBase) {
return href;
}
return base.replace(domain, '$1') + href;
} else {
return base + href;
}
}
const noopTest = { exec: function noopTest() {} };
function merge(obj) {
let i = 1,
target,
key;
for (; i < arguments.length; i++) {
target = arguments[i];
for (key in target) {
if (Object.prototype.hasOwnProperty.call(target, key)) {
obj[key] = target[key];
}
}
}
return obj;
}
function splitCells(tableRow, count) {
// ensure that every cell-delimiting pipe has a space
// before it to distinguish it from an escaped pipe
const row = tableRow.replace(/\|/g, (match, offset, str) => {
let escaped = false,
curr = offset;
while (--curr >= 0 && str[curr] === '\\') escaped = !escaped;
if (escaped) {
// odd number of slashes means | is escaped
// so we leave it alone
return '|';
} else {
// add space before unescaped |
return ' |';
}
}),
cells = row.split(/ \|/);
let i = 0;
if (cells.length > count) {
cells.splice(count);
} else {
while (cells.length < count) cells.push('');
}
for (; i < cells.length; i++) {
// leading or trailing whitespace is ignored per the gfm spec
cells[i] = cells[i].trim().replace(/\\\|/g, '|');
}
return cells;
}
// Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
// /c*$/ is vulnerable to REDOS.
// invert: Remove suffix of non-c chars instead. Default falsey.
function rtrim(str, c, invert) {
const l = str.length;
if (l === 0) {
return '';
}
// Length of suffix matching the invert condition.
let suffLen = 0;
// Step left until we fail to match the invert condition.
while (suffLen < l) {
const currChar = str.charAt(l - suffLen - 1);
if (currChar === c && !invert) {
suffLen++;
} else if (currChar !== c && invert) {
suffLen++;
} else {
break;
}
}
return str.substr(0, l - suffLen);
}
function findClosingBracket(str, b) {
if (str.indexOf(b[1]) === -1) {
return -1;
}
const l = str.length;
let level = 0,
i = 0;
for (; i < l; i++) {
if (str[i] === '\\') {
i++;
} else if (str[i] === b[0]) {
level++;
} else if (str[i] === b[1]) {
level--;
if (level < 0) {
return i;
}
}
}
return -1;
}
function checkSanitizeDeprecation(opt) {
if (opt && opt.sanitize && !opt.silent) {
console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
}
}
var helpers = {
escape,
unescape,
edit,
cleanUrl,
resolveUrl,
noopTest,
merge,
splitCells,
rtrim,
findClosingBracket,
checkSanitizeDeprecation
};
const {
noopTest: noopTest$1,
edit: edit$1,
merge: merge$1
} = helpers;
/**
* Block-Level Grammar
*/
const block = {
newline: /^\n+/,
code: /^( {4}[^\n]+\n*)+/,
fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
heading: /^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
list: /^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
html: '^ {0,3}(?:' // optional indentation
+ '<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
+ '|comment[^\\n]*(\\n+|$)' // (2)
+ '|<\\?[\\s\\S]*?\\?>\\n*' // (3)
+ '|<![A-Z][\\s\\S]*?>\\n*' // (4)
+ '|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*' // (5)
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
+ ')',
def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
nptable: noopTest$1,
table: noopTest$1,
lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
// regex template, placeholders will be replaced according to different paragraph
// interruption rules of commonmark and the original markdown spec:
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,
text: /^[^\n]+/
};
block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
block.def = edit$1(block.def)
.replace('label', block._label)
.replace('title', block._title)
.getRegex();
block.bullet = /(?:[*+-]|\d{1,9}\.)/;
block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/;
block.item = edit$1(block.item, 'gm')
.replace(/bull/g, block.bullet)
.getRegex();
block.list = edit$1(block.list)
.replace(/bull/g, block.bullet)
.replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))')
.replace('def', '\\n+(?=' + block.def.source + ')')
.getRegex();
block._tag = 'address|article|aside|base|basefont|blockquote|body|caption'
+ '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'
+ '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'
+ '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
+ '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr'
+ '|track|ul';
block._comment = /<!--(?!-?>)[\s\S]*?-->/;
block.html = edit$1(block.html, 'i')
.replace('comment', block._comment)
.replace('tag', block._tag)
.replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/)
.getRegex();
block.paragraph = edit$1(block._par