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Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/anitype@0.0.1/anitype.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","class Typer {\n\n    constructor(element, text=null) {\n\n        // enum directions\n        this.DIRECTIONS = Object.freeze({ \"FORWARD\": 1, \"BACKWARDS\": 0 })\n        \n        if(typeof(element) === \"string\"){\n            this.element = document.getElementById(element_id)\n        }else{\n            this.element = element\n        }\n\n        if(text){\n            this.element.innerText = text\n        }\n\n        this.split_text = this.element.innerText.split(\"|\")\n        this.current_element = 0\n        this.current_position = 0\n        this.direction = this.DIRECTIONS.FORWARD\n        this.move_times = 0\n        this.end_of_line = false\n        this.back_start = 0\n        this.time_val = 0\n        // blank the element out\n        this.element.innerHTML = \"&nbsp;\"\n        this.blinker = \" |\"\n    }\n\n\n\n    async run() {\n        // infinatly loop the change of text with a random wait time\n        setTimeout(() => {\n            this.update_element();\n            this.run()\n        },\n            this.wait_time())\n\n    }\n\n    random_letter() {\n        const alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n        return alphabet[Math.floor(Math.random() * alphabet.length)]\n    }\n\n    update_element() {\n        var new_text = this.get_new_text()\n\n        if (new_text == \"\" || new_text == null) {\n            this.element.innerHTML = \"&nbsp;\"\n        } else {\n            // if the start of a backwards animation first draw the wrong letter\n            if (this.back_start == 1) {\n                // draw random letter to the end\n                this.element.innerText = new_text.slice(0, new_text.length) + this.random_letter()\n                // give an extra pause for error typing\n                this.time_val = 300\n                // increment the flag to going backwards\n                this.back_start++\n            } else {\n                // reset the flag to zero to resume normal oreration.\n                this.back_start = 0\n                // reset time val\n                this.time_val = 0\n                // normal text\n                this.element.innerText = new_text\n            }\n        }\n    }\n    check_change_elements() {\n\n        // check if needs new directions\n        this.get_forward_times()\n        // reset flag\n\n        var reset = false\n        // move current position forward or backwards\n        if (this.current_position === this.split_text[this.current_element].length) {\n            this.current_position = 0\n            this.move_times = 0\n            reset = true\n        } else {\n            // move in the direction of travel by 1\n            if (this.direction === this.DIRECTIONS.FORWARD || this.current_position === 0) {\n                this.current_position++\n                //if end of line reached, increase the pause at the end\n                if (this.current_position == this.split_text[this.current_element].length) {\n                    this.end_of_line = true\n                }\n\n            } else {\n                // get the next character back\n                if (this.back_start == 0) {\n                    var next_character = this.split_text[this.current_element].slice(this.current_position - 1, this.current_position)\n                    // if going back a position == a blank space then zero the dont decrement the position and reset the move times.\n                    if (next_character == \" \" || next_character == \"\" || next_character == null) {\n                        this.move_times == 0\n                    } else {\n                        this.current_position--\n                    }\n                }\n\n            }\n            // decrement the move times\n            this.move_times--\n        }\n\n        // if position was reset it means the index will need it too\n        if (reset) {\n            // change array index if needed\n            if (this.current_element == this.split_text.length - 1) {\n                this.current_element = 0\n\n            } else {\n                this.current_element++\n            }\n        }\n    }\n\n    get_forward_times() {\n        var direction\n        // if move_times is 0 then populate them with a number or places and a direction to travel.\n        // Backwards is always less than forwards movements\n        if (this.move_times <= 0) {\n            direction = Math.floor(Math.random() * 25);   // was 25\n            if (direction >= 2 || this.current_position <= 2) {\n                this.direction = this.DIRECTIONS.FORWARD\n                this.move_times = Math.floor(Math.random() * 3);\n            } else {\n                this.direction = this.DIRECTIONS.BACKWARDS\n                this.move_times = Math.floor(Math.random() * 5) + 3;\n                this.back_start = 1\n            }\n        }\n    }\n\n    get_new_text() {\n        // check if need to switch array elements and move the cursur.\n        this.check_change_elements()\n        // get the actual text is\n        return this.split_text[this.current_element].slice(0, this.current_position)\n    }\n\n    wait_time() {\n        // used to get the time to wait between keystrokes, if the direction is backwards then it will happen faster.\n\n        if (this.DIRECTIONS.FORWARD == this.direction) {\n            // sometimes take a extra pause\n            this.time_val = 70\n            if (Math.floor(Math.random() * 8) == 0) {\n                this.time_val = Math.floor(Math.random() * 230) + 200\n            }\n        } else {\n            // less time for backspace as you generally hold it down\n            this.time_val = 40\n        }\n        // if its the end of the line pause more before continuing\n        if (this.end_of_line) {\n            this.end_of_line = false;\n            this.time_val = this.time_val + 700\n        }\n        // if error typing then add an extra pause\n        if (this.back_start) {\n            this.time_val = this.time_val + 300\n        }\n        return Math.floor(Math.random() * 100) + this.time_val;\n    }\n\n}\n\nwindow.typers = []\nvar typer \n\ndocument.querySelectorAll(\"[data-typer]\").forEach(value => {\n    let text = null\n    if(value.hasAttribute(\"data-text\")){\n        text = value.getAttribute(\"data-text\")\n    }\n    typer = new Typer(value, text)\n    typer.run()\n    typers.push(typer)\n})"]}