"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProgressData = void 0;
;
/**
 * @deprecated
 */
class ProgressData {
    value;
    msg;
    type;
    date;
    static resolveFrom(chunk, callbackOnFounded, checkSplit = true) {
        let progress;
        let res = [];
        if (typeof chunk !== 'string') {
            return [];
        }
        chunk = chunk.trim();
        if (checkSplit) {
            const split = chunk.split(/\r\n|\n|\r/);
            if (split.length > 1) {
                // console.log('split founded', split)
                split.forEach(s => {
                    res = res.concat(this.resolveFrom(s, callbackOnFounded, false));
                });
                return res;
            }
        }
        if (/\[\[\[.*\]\]\]/g.test(chunk)) {
            chunk = chunk.replace(/^\[\[\[/g, '').replace(/\]\]\]$/g, '');
            progress = chunk;
        }
        if (typeof progress !== 'undefined') {
            try {
                const p = JSON.parse(progress);
                const single = Object.assign(new ProgressData(), p);
                res = res.concat([single]);
                if (typeof callbackOnFounded === 'function') {
                    callbackOnFounded(single);
                }
            }
            catch (err) {
                console.log(err);
                console.error(`ProgresssBarData: fail to parse "${progress}"`);
            }
        }
        return res;
    }
    constructor(value = 0, msg = '', type = 'event', date = new Date()) {
        this.value = value;
        this.msg = msg;
        this.type = type;
        this.date = date;
    }
}
exports.ProgressData = ProgressData;
//# sourceMappingURL=models.js.map