about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorfox <fox@fakecake.org>2026-03-22 08:54:29 +0300
committerfox <fox@fakecake.org>2026-03-22 08:54:29 +0300
commite509d73169fb94f3f26e35ec3ba62befd8a580e8 (patch)
treee4d161b6dc4d9bba12411937983b6889fa7d80b1
parentfbf06987e8f9d4ce505c5c957eb9266c79d210c4 (diff)
parentd631b404fb51fe7b1f756bb196a22742a5114d5e (diff)
downloadthe-epube-e509d73169fb94f3f26e35ec3ba62befd8a580e8.tar.gz
the-epube-e509d73169fb94f3f26e35ec3ba62befd8a580e8.tar.xz
Merge branch 'dev' into 'master'
Dev

See merge request git/the-epube!22
-rw-r--r--.eslintrc.js6
-rw-r--r--backend.php2
-rw-r--r--dist/app.min.js2
-rw-r--r--gulpfile.js2
-rw-r--r--index.php3
-rw-r--r--js/app.d.ts2
-rw-r--r--js/app.js735
-rw-r--r--js/localforage.d.ts123
-rw-r--r--js/reader.d.ts10
-rw-r--r--js/reader.js1011
-rw-r--r--offline.html10
-rw-r--r--package-lock.json1843
-rw-r--r--package.json2
-rw-r--r--read.html18
14 files changed, 1924 insertions, 1845 deletions
diff --git a/.eslintrc.js b/.eslintrc.js
index 553c93a..57d67c5 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -7,7 +7,7 @@ module.exports = {
     },
     "extends": "eslint:recommended",
     "parserOptions": {
-        "ecmaVersion": 2018
+        "ecmaVersion": 2022
     },
     "rules": {
         "accessor-pairs": "error",
@@ -27,7 +27,7 @@ module.exports = {
         "callback-return": "off",
         "camelcase": "off",
         "capitalized-comments": "off",
-        "class-methods-use-this": "error",
+        "class-methods-use-this": "off",
         "comma-dangle": "off",
         "comma-spacing": "off",
         "comma-style": [
@@ -110,7 +110,7 @@ module.exports = {
         "no-div-regex": "error",
         "no-duplicate-imports": "error",
         "no-else-return": "off",
-		  "no-useless-escape": "off",
+		"no-useless-escape": "off",
         "no-empty": [
             "error",
             {
diff --git a/backend.php b/backend.php
index 945f0c0..a08c345 100644
--- a/backend.php
+++ b/backend.php
@@ -28,7 +28,7 @@
 	$op = $_REQUEST["op"] ?? "";
 
 	if (!empty($_SESSION['owner'])) {
-		$csrf_ignore = [ "cover", "download", "getpagination" ];
+		$csrf_ignore = [ "cover", "download", "getpagination", "getlastread" ];
 
 		$csrf_token = $_POST['csrf_token'] ?? "";
 
diff --git a/dist/app.min.js b/dist/app.min.js
index eeb2058..61d3777 100644
--- a/dist/app.min.js
+++ b/dist/app.min.js
@@ -1 +1 @@
-"use strict";$.urlParam=function(t){try{const e=new RegExp("[?&]"+t+"=([^&#]*)").exec(window.location.href);return decodeURIComponent(e[1].replace(/\+/g," "))||0}catch(t){return 0}};const Cookie={set:function(t,e,o){const a=new Date;a.setTime(a.getTime()+1e3*o);const n="expires="+a.toUTCString();document.cookie=t+"="+encodeURIComponent(e)+"; "+n},get:function(t){t+="=";const e=document.cookie.split(";");for(let o=0;o<e.length;o++){let a=e[o];for(;" "==a.charAt(0);)a=a.substring(1);if(0==a.indexOf(t))return decodeURIComponent(a.substring(t.length,a.length))}return""},delete:function(t){document.cookie=t+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT"}},App={_dl_progress_timeout:!1,index_mode:"",cached_urls:[],version:"UNKNOWN",buildTimestamp:0,csrf_token:"",init:function(){let t=0;this.csrf_token=Cookie.get("epube_csrf_token"),console.log("setting prefilter for token",this.csrf_token),$.ajaxPrefilter((function(t,e,o){if("post"!==e.type||"post"!==t.type)return;const a=typeof e.data;"object"==a?t.data=$.param($.extend(e.data,{csrf_token:App.csrf_token})):"string"==a&&(t.data=e.data+"&csrf_token="+encodeURIComponent(App.srf_token)),console.log(">>>",t)})),"undefined"!=typeof EpubeApp&&($(".navbar").hide(),$(".epube-app-filler").show(),$(".separate-search").show(),$("body").addClass("is-epube-app"),"favorites"==$.urlParam("mode")?EpubeApp.setPage("PAGE_FAVORITES"):EpubeApp.setPage("PAGE_LIBRARY")),App.initNightMode(),"serviceWorker"in navigator?(navigator.serviceWorker.addEventListener("message",(function(e){"refresh-started"==e.data&&(console.log("cache refresh started"),t=0,$(".dl-progress").fadeIn().text("Loading, please wait...")),e.data&&0==e.data.indexOf("refreshed:")&&(++t,$(".dl-progress").fadeIn().text("Updated "+t+" files...")),"refresh-finished"==e.data&&(localforage.setItem("epube.cache-version",App.version),localforage.setItem("epube.cache-timestamp",App.buildTimestamp),window.location.reload())})),App.showCovers(),App.Offline.markBooks(),App.refreshCache()):$(".container-main").addClass("alert alert-danger").html("Service worker support missing in browser (are you using plain HTTP?).")},logout:function(){$.post("backend.php",{op:"logout"}).then(()=>{window.location.reload()})},showSummary:function(t){const e=t.getAttribute("data-book-id");return $.post("backend.php",{op:"getinfo",id:e},(function(t){const e=t.comment?t.comment:"No description available";$("#summary-modal .modal-title").html(t.title),$("#summary-modal .book-summary").html(e),$("#summary-modal").modal()})),!1},showCovers:function(){$("img[data-book-id]").each((t,e)=>{if((e=$(e)).attr("data-cover-link")){const t=$("<img>").on("load",(function(){e.css("background-image","url("+e.attr("data-cover-link")+")").fadeIn(),t.attr("src",null)})).attr("src",e.attr("data-cover-link"))}})},toggleFavorite:function(t){const e=t.getAttribute("data-book-id");return("0"==t.getAttribute("data-is-fav")||confirm("Remove favorite?"))&&$.post("backend.php",{op:"togglefav",id:e},(function(o){if(o){let a="[Error]";0==o.status?a="Add to favorites":1==o.status&&(a="Remove from favorites"),$(t).html(a).attr("data-is-fav",o.status),"favorites"==App.index_mode&&0==o.status&&$("#cell-"+e).remove()}})),!1},refreshCache:function(t){"serviceWorker"in navigator?localforage.getItem("epube.cache-version").then((function(e){console.log("local version",e,"remote version",App.version),(t||e!=App.version)&&(console.log("asking worker to refresh cache"),navigator.serviceWorker.controller?navigator.serviceWorker.controller.postMessage({msg:"refresh-cache",urls:App.cached_urls}):localforage.getItem("epube.initial-load-done").then((function(t){console.log("initial load done",t),t?$(".dl-progress").show().addClass("alert-danger").html("Could not communicate with service worker. Try reloading the page."):localforage.setItem("epube.initial-load-done",!0).then((function(){$(".dl-progress").show().addClass("alert-info").html("Page will reload to activate service worker..."),window.setTimeout((function(){window.location.reload()}),3e3)}))})))})):$(".dl-progress").show().addClass("alert-danger").html("Could not communicate with service worker. Try reloading the page.")},isOnline:function(){return"undefined"!=typeof EpubeApp&&void 0!==EpubeApp.isOnline?EpubeApp.isOnline():navigator.onLine},appCheckOffline:function(){EpubeApp.setOffline(!App.isOnline)},initNightMode:function(){if("undefined"==typeof EpubeApp){if(window.matchMedia){const t=window.matchMedia("(prefers-color-scheme: dark)");t.addEventListener("change",()=>{App.applyNightMode(t.matches)}),App.applyNightMode(t.matches)}}else App.applyNightMode(EpubeApp.isNightMode())},applyNightMode:function(t){console.log("night mode changed to",t),$("#theme_css").attr("href","lib/bootstrap/v3/css/"+(t?"theme-dark.min.css":"bootstrap-theme.min.css"))},Offline:{init:function(){"undefined"!=typeof EpubeApp&&($(".navbar").hide(),$(".epube-app-filler").show(),$("body").addClass("is-epube-app"),EpubeApp.setPage("PAGE_OFFLINE")),App.initNightMode();const t=$.urlParam("query");t&&$(".search_query").val(t),App.Offline.populateList()},get:function(t,e){console.log("offline cache: "+t),$.post("backend.php",{op:"getinfo",id:t},(function(o){if(o){const a="epube-book."+t;localforage.setItem(a,o).then((function(o){console.log(a+" got data");const n=[];n.push(fetch("backend.php?op=download&id="+o.epub_id,{credentials:"same-origin"}).then((function(t){200==t.status&&(console.log(a+" got book"),e(),localforage.setItem(a+".book",t.blob()))}))),n.push(fetch("backend.php?op=getpagination&id="+o.epub_id,{credentials:"same-origin"}).then((function(t){200==t.status&&(console.log(a+" got pagination"),t.text().then((function(t){localforage.setItem(a+".locations",JSON.parse(t))})))}))),n.push(fetch("backend.php?op=getlastread&id="+o.epub_id,{credentials:"same-origin"}).then((function(t){200==t.status&&(console.log(a+" got lastread"),t.text().then((function(t){localforage.setItem(a+".lastread",JSON.parse(t))})))}))),o.has_cover&&n.push(fetch("backend.php?op=cover&id="+t,{credentials:"same-origin"}).then((function(t){200==t.status&&(console.log(a+" got cover"),localforage.setItem(a+".cover",t.blob()))}))),Promise.all(n).then((function(){$(".dl-progress").show().html("Finished downloading <b>"+o.title+"</b>"),window.clearTimeout(App._dl_progress_timeout),App._dl_progress_timeout=window.setTimeout((function(){$(".dl-progress").fadeOut()}),5e3)}))}))}}))},getAll:function(){confirm("Download all books on this page?")&&$(".row > div").each((function(t,e){const o=$(e).attr("id").replace("cell-",""),a=$(e).find(".offline_dropitem")[0];if(o){const t="epube-book."+o;localforage.getItem(t).then((function(t){t||App.Offline.get(o,(function(){App.Offline.mark(a)}))}))}}))},markBooks:function(){const t=$(".offline_dropitem");$.each(t,(function(t,e){App.Offline.mark(e)}))},mark:function(t){const e=t.getAttribute("data-book-id"),o="epube-book."+e;localforage.getItem(o).then((function(o){o?(t.onclick=function(){return App.Offline.remove(e,(function(){App.Offline.mark(t)})),!1},t.innerHTML="Remove offline data"):(t.onclick=function(){return App.Offline.get(e,(function(){App.Offline.mark(t)})),!1},t.innerHTML="Make available offline")}))},removeFromList:function(t){const e=t.getAttribute("data-book-id");return App.Offline.remove(e,(function(){$("#cell-"+e).remove()}))},remove:function(t,e){if(confirm("Remove download?")){const o="epube-book."+t,a=[];console.log("offline remove: "+t),localforage.iterate((function(t,e){e.match(o)&&a.push(localforage.removeItem(e))})),Promise.all(a).then((function(){window.setTimeout((function(){e()}),500)}))}},search:function(){const t=$(".search_query").val();return localforage.setItem("epube.search-query",t).then((function(){App.Offline.populateList()})),!1},removeAll:function(){if(confirm("Remove all downloaded books?")){const t=[];localforage.iterate((function(e,o){o.match("epube-book")&&t.push(localforage.removeItem(o))})),Promise.all(t).then((function(){window.setTimeout((function(){App.Offline.populateList()}),500)}))}},showSummary:function(t){const e=t.getAttribute("data-book-id");return localforage.getItem("epube-book."+e).then((function(t){const e=t.comment?t.comment:"No description available";$("#summary-modal .modal-title").html(t.title),$("#summary-modal .book-summary").html(e),$("#summary-modal").modal()})),!1},populateList:function(){let t=$.urlParam("query");t&&(t=t.toLowerCase());const e=$("#books_container");e.html(""),localforage.iterate((function(o,a){a.match(/epube-book\.\d{1,}$/)&&Promise.all([localforage.getItem(a),localforage.getItem(a+".cover"),localforage.getItem(a+".lastread"),localforage.getItem(a+".book")]).then((function(o){if(o[0]&&o[3]){const a=o[0];if(t){if(!(a.series_name&&a.series_name.toLowerCase().match(t)||a.title&&a.title.toLowerCase().match(t)||a.author_sort&&a.author_sort.toLowerCase().match(t)))return}let n=!1;o&&o[1]&&(n=URL.createObjectURL(o[1]));let i=!1,r=!1;const l=o[2];l&&(i=l.page>0,r=l.total>0&&l.total-l.page<5);const s=r?"read":"",c=i?"in_progress":"",d=a.series_name?`<div><a class="series_link" href="#">${a.series_name+" ["+a.series_index+"]"}</a></div>`:"",f=$(`<div class="col-xxs-6 col-xs-4 col-sm-3 col-md-2" id="cell-${a.id}">\n\t\t\t\t\t\t\t<a class="thumbnail ${s}" href="read.html?id=${a.epub_id}&b=${a.id}">\n\t\t\t\t\t\t\t\t<img style="display : none">\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t<div class="caption">\n\t\t\t\t\t\t\t\t<div><a class="${c}" href="read.html?id=${a.epub_id}&b=${a.id}">${a.title}</a></div>\n\t\t\t\t\t\t\t\t<div><a class="author_link" href="#">${a.author_sort}</a></div>\n\t\t\t\t\t\t\t\t${d}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class="dropdown" style="white-space : nowrap">\n\t\t\t\t\t\t\t\t<a href="#" data-toggle="dropdown" role="button">More...<span class="caret"></span></a>\n\t\t\t\t\t\t\t\t<ul class="dropdown-menu">\n\t\t\t\t\t\t\t\t\t<li><a href="#" data-book-id="${a.id}" onclick="return App.Offline.showSummary(this)">Summary</a></li>\n\t\t\t\t\t\t\t\t\t<li><a href="#" data-book-id="${a.id}" onclick="App.Offline.removeFromList(this)">Remove offline data</a></li>\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>`);n?f.find("img").css("background-image","url("+n+")").fadeIn():f.fadeIn(),f.find(".series_link").attr("title",a.series_name+" ["+a.series_index+"]").attr("href","offline.html?query="+encodeURIComponent(a.series_name)),f.find(".author_link").attr("title",a.author_sort).attr("href","offline.html?query="+encodeURIComponent(a.author_sort)),e.append(f)}}))}))}}},DEFAULT_FONT_SIZE=16,DEFAULT_FONT_FAMILY="Arial",DEFAULT_LINE_HEIGHT=140,MIN_LENGTH_TO_JUSTIFY=32,LOCATION_DIVISOR=10,PAGE_RESET_PROGRESS=-1,CACHE_PREFIX="epube",CACHE_NAME="epube-v3";Promise.allSettled=Promise.allSettled||(t=>Promise.all(t.map(t=>t.then(t=>({status:"fulfilled",value:t})).catch(t=>({status:"rejected",reason:t})))));const Reader={csrf_token:"",last_stored_cfi:"",startup_finished:!1,open_last_read_when_displayed:!0,hyphenate:{},init:function(){this.csrf_token=Cookie.get("epube_csrf_token"),console.log("setting prefilter for token",this.csrf_token),$.ajaxPrefilter((function(t,e){if("post"!==e.type||"post"!==t.type)return;const o=typeof e.data;"object"==o?t.data=$.param($.extend(e.data,{csrf_token:Reader.csrf_token})):"string"==o&&(t.data=e.data+"&csrf_token="+encodeURIComponent(Reader.srf_token)),console.log(">>>",t)})),$(document).on("keyup",(function(t){Reader.hotkeyHandler(t)})),$("#left").on("mouseup",(function(){Reader.Page.prev()})),$("#right").on("mouseup",(function(){Reader.Page.next()})),Reader.Loader.init()},isTouchDevice:function(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0},onOfflineModeChanged:function(t){if(console.log("onOfflineModeChanged",t),!t&&window.book){const t=window.book;console.log("we're online, storing lastread");const e=t.rendition.currentLocation().start.cfi,o=parseInt(100*t.locations.percentageFromCfi(e));$.post("backend.php",{op:"storelastread",id:$.urlParam("id"),page:o,cfi:e,timestamp:(new Date).getTime()},(function(){})).fail((function(t){t&&401==t.status&&(window.location="index.php")}))}},initSecondStage:async function(){"undefined"!=typeof EpubeApp?EpubeApp.setPage("PAGE_READER"):($(window).on("online",(function(){Reader.onOfflineModeChanged(!1)})),$(window).on("offline",(function(){Reader.onOfflineModeChanged(!0)}))),Reader.applyTheme();if(!await localforage.getItem(Reader.cacheId())){const t=$.urlParam("b");console.log("requesting bookinfo for book",t);try{const e=await $.post("backend.php",{op:"getinfo",id:t});if(e.has_cover){const e=await fetch("backend.php?op=cover&id="+t);e.ok&&await localforage.setItem(Reader.cacheId("cover"),e.blob())}await localforage.setItem(Reader.cacheId(),e),console.log("bookinfo saved")}catch(t){return void $(".loading-message").html(`Unable to load book info.<br/><small>${t.responseText}</small>`)}}console.log("trying to load book...");let t=await localforage.getItem(Reader.cacheId("book"));if(!t){console.log("local data not found, loading from network..."),$(".loading-message").html("Downloading book…");const e=await fetch("backend.php?op=download&id="+$.urlParam("id"));if(!e.ok)return void $(".loading-message").html("Unable to download book: "+e.status);if(t=await e.blob(),!t)return void $(".loading-message").html("Unable to get book blob data.");await localforage.setItem(Reader.cacheId("book"),t),console.log("saved local data for book")}const e=new FileReader;e.onload=function(){try{Reader.openBookData(this.result)}catch(t){console.error(t),$(".loading-message").html("Unable to load book blob: "+t)}},e.onerror=t=>{console.log("filereader error",t),$(".loading-message").html("Unable to open book.<br/><small>"+t+"</small>")},e.readAsArrayBuffer(t)},openBookData:async function(t){const e=ePub();window.book=e;try{await e.open(t)}catch(t){return console.error(t),void $(".loading-message").html("Unable to open book.<br/><small>"+t.message+"</small>")}await e.ready,console.log("book is ready"),await Reader.showBookInfo(e),await Reader.loadLocations(e);const o=e.renderTo("reader",{width:"100%",height:"100%",allowScriptedContent:!1,minSpreadWidth:961});$(".location").on("click",(async function(){const t=Math.floor(o.currentLocation().start.location/10),a=Math.floor(e.locations.length()/10),n=prompt("Jump to location [1-"+a+"]",t);n&&await o.display(e.locations._locations[10*n])}));await localforage.getItem("epube.enable-hyphens")&&(Reader.hyphenate.en=createHyphenator(hyphenationPatternsEnUs,{html:!0}),Reader.hyphenate.ru=createHyphenator(hyphenationPatternsRu,{html:!0})),Reader.initRenditionHooks(e,o),Reader.initModals(),Reader.initToc(e),Reader.Page.blockLastReadUpdate(),await o.display(),console.log("startup finished"),Reader.startup_finished=!0},showBookInfo:async function(t){const e=await localforage.getItem(Reader.cacheId());let o,a;if(e)o=e.title,a=e.author_sort;else{const e=t.package.metadata;o=e.title,a=e.creator}document.title=o+" – "+a+" – The Epube",$(".title").text(o).attr("title",o+" – "+a),"undefined"!=typeof EpubeApp&&(EpubeApp.setTitle(o),EpubeApp.showActionBar(!1))},loadLocations:async function(t){let e=await localforage.getItem(Reader.cacheId("locations"));if(e&&"string"==typeof e[0]){console.log("loading local locations...");try{return void await t.locations.load(e)}catch(t){console.warn(t)}}if(App.isOnline()){console.log("downloading locations..."),$(".loading-message").html("Downloading locations…");const o=await fetch("backend.php?op=getpagination&id="+$.urlParam("id"));if(o.ok){console.log("got locations from server");try{e=await o.json()}catch(t){console.warn(t)}if(e&&"string"==typeof e[0]){console.log("saving locations locally..."),await localforage.setItem(Reader.cacheId("locations"),e);try{return void t.locations.load(e)}catch(t){console.warn(t)}}}}$(".loading-message").html("Preparing locations…");let o=0;e=await t.locations.generate(100,t=>{if(o||(o=t.length()),o>0){const e=parseInt(100*(1-t.length()/o));$(".loading-message").html(`Preparing locations (${e}%)…`)}}),$.post("backend.php",{op:"storepagination",id:$.urlParam("id"),payload:JSON.stringify(e),total:100}),await localforage.setItem(Reader.cacheId("locations"),e)},initRenditionHooks:function(t,e){console.log("initRenditionHooks"),t.spine.hooks.content.register((function(t){Reader.cleanupEmbeddedStyles(t)})),e.hooks.content.register(async o=>{o.on("linkClicked",t=>{console.log("linkClicked",t),Reader.Page.blockLastReadUpdate(),-1==t.indexOf("://")&&($(".prev_location_btn").attr("data-location-cfi",e.currentLocation().start.cfi).show(),window.setTimeout((function(){Reader.showUI(!0)}),50))}),o.on("selected",async e=>{if(App.isOnline()){const a=await t.getRange(e),n=a.endContainer.data.substring(a.startOffset,a.endOffset);console.log("selected",e,n),n.match(/^[\w­]+$/)&&Reader.lookupWord(n,()=>{"undefined"!=typeof EpubeApp&&EpubeApp.showActionBar(!1),o.window.requestAnimationFrame(()=>{o.window.getSelection().removeAllRanges()})})}});const a=window.location.href.match(/^.*\//)[0];$(o.document.head).append($("<style type='text/css'>").text(Reader.generateFontsCss(a))),$(o.document.head).append($("<style type='text/css'>").text(Reader.Loader._res_data[a+"dist/reader_iframe.min.css"]));const n=await localforage.getItem("epube.theme")||"default";$(o.document).find("body").attr("class","undefined"!=typeof EpubeApp?"is-epube-app":"").addClass("theme-"+n),console.log("contents",o),$(o.window).on("click tap",(function(t){if(0==t.button){if($(".modal").is(":visible"))return;"undefined"!=typeof EpubeApp?EpubeApp.toggleActionBar():Reader.showUI(!0)}})),$(o.window).on("wheel",(async function(t){await localforage.getItem("epube.enable-wheel")&&(t.originalEvent.deltaY>0?Reader.Page.next():t.originalEvent.deltaY<0&&Reader.Page.prev())}))}),e.on("keyup",t=>{Reader.hotkeyHandler(t)}),e.on("resized",(function(){console.log("rendition resized"),Reader.Page.blockLastReadUpdate(),Reader.open_last_read_when_displayed=!0})),e.on("rendered",(async function(o){console.log("rendition rendered section",o),$(".chapter").html($("<span>").addClass("glyphicon glyphicon-th-list")),Reader.applyTheme(),Reader.resizeSideColumns();try{const o=e.currentLocation();if(o.start){const e=t.canonical(o.start.href);let a=!1;$.each(Reader.flattenToc(t),(function(o,n){t.spine.get(n.href).canonical!=e||(a=n)})),a&&a.label&&$(".chapter").append("&nbsp;"+a.label.trim()+" | "),Reader.generateTocBar(t,Reader.flattenToc(t))}}catch(t){console.warn(t)}Reader.open_last_read_when_displayed&&(Reader.open_last_read_when_displayed=!1,await Reader.Page.openLastRead())})),e.on("displayed",(function(){console.log("rendition displayed")})),e.on("relocated",e=>Reader.Page.onRelocated(t,e))},initModals:function(){$("#settings-modal").on("shown.bs.modal",(async function(){const t=await localforage.getItem(Reader.cacheId("lastread"));t&&t.cfi&&$(".lastread_input").val(t.page+"%").attr("title","[local] "+t.cfi),navigator.onLine&&$.post("backend.php",{op:"getlastread",id:$.urlParam("id")},t=>{$(".lastread_input").val(t.page+"%").attr("title","[remote] "+t.cfi)}),$(".enable_hyphens_checkbox").attr("checked",await localforage.getItem("epube.enable-hyphens")).off("click").on("click",(function(t){localforage.setItem("epube.enable-hyphens",t.target.checked),confirm("Toggling hyphens requires page reload. Reload now?")&&window.location.reload()})),$(".enable_wheel_checkbox").attr("checked",await localforage.getItem("epube.enable-wheel")).off("click").on("click",(function(t){localforage.setItem("epube.enable-wheel",t.target.checked)})),"undefined"!=typeof EpubeApp?$(".keep_ui_checkbox").parent().parent().hide():$(".keep_ui_checkbox").attr("checked",await localforage.getItem("epube.keep-ui-visible")).off("click").on("click",(function(t){localforage.setItem("epube.keep-ui-visible",t.target.checked)}));const e=await localforage.getItem("epube.cache-timestamp"),o=await localforage.getItem("epube.cache-version");$(".last-mod-timestamp").html(`${o}\n\t\t\t\t&mdash; ${parseInt(e)?new Date(1e3*e).toLocaleString("en-GB"):"Unknown"}\n\t\t\t\t(${App.isOnline()?"<span class='text-success'>Online</span>":"<span class='text-danger'>Offline</span>"})\n\t\t\t\t`),$(".font_family").val(await localforage.getItem("epube.fontFamily")||"Arial"),$(".theme_name").val(await localforage.getItem("epube.theme")||"default");const a=$(".font_size").html("");for(let t=10;t<=32;t++){const e=$("<option>").val(t).html(t+" px");a.append(e)}a.val(await localforage.getItem("epube.fontSize")||16);const n=$(".line_height").html("");for(let t=100;t<=220;t+=10){const e=$("<option>").val(t).html(t+"%");n.append(e)}n.val(await localforage.getItem("epube.lineHeight")||140)})),$("#dict-modal").on("shown.bs.modal",(function(){$(".dict_result").scrollTop(0)})),$(".dict_search_btn").on("click",(function(){$("#dict-modal").modal("hide"),window.open("https://duckduckgo.com/?q="+$(".dict_query").val())})),$(".wiki_search_btn").on("click",(function(){$(".dict_result").html("Loading, please wait..."),$.post("backend.php",{op:"wikisearch",query:$(".dict_query").val()}).then(t=>{try{console.log("wikisearch resp",t);let e="";$.each(t.query.pages,(t,o)=>{e+=o.extract}),$(".dict_result").html(e&&"undefined"!=e?e:"No definition found for "+$(".dict_query").val()+".")}catch(t){console.error(t),$(".dict_result").text("Error while processing data: "+t)}}).fail(t=>{console.error(t),$(".dict_result").text("Error while retrieving data.")})}))},initToc:function(t){function e(e){try{const o=t.spine.get(e).cfiBase,a=t.locations._locations.find((function(t){return-1!=t.indexOf(o)}));return parseInt(window.book.locations.locationFromCfi(a)/10)}catch(t){console.warn(t)}return""}$("#toc-modal").on("shown.bs.modal",(function(){const o=t.navigation.toc,a=$(".toc_list");a.html(""),$.each(o,(function(o,n){try{const o=$("<a>").attr("href","#").html("<b class='pull-right'>"+e(n.href)+"</b>"+n.label).attr("data-href",n.href).click((function(){t.rendition.display(o.attr("data-href"))}));a.append($("<li>").append(o)),function o(a,n,i){if(3==i)return!1;if(a.subitems){const r=$("<ul class='toc_sublist list-unstyled'>");$.each(a.subitems,(function(a,n){const l=$("<a>").attr("href","#").html("<b class='pull-right'>"+e(n.href)+"</b>"+n.label).attr("data-href",n.href).click((function(){t.rendition.display(l.attr("data-href"))}));r.append($("<li>").append(l)),o(n,r,i+1)})),n.append(r)}}(n,a,0)}catch(t){console.warn(t)}})),a.children().length<=1&&(a.html(""),$.each(t.spine.items,(function(e,o){const n=$("<a>").attr("href","#").attr("title",o.url).html("Section "+(e+1)).attr("data-href",o.href).click((function(){t.rendition.display(n.attr("data-href"))}));a.append($("<li>").append(n))})))}))},cleanupEmbeddedStyles:function(t){$(t).find("p").filter((t,e)=>$(e).text().length>=32?e:null).css("text-align","justify"),$(t).find("html").attr("class",""),$(t).find("pre").css("white-space","pre-wrap"),$(t).find("a, p, span, em, i, strong, b, body, header, section, div, big, small, table, tr, td, ul, ol, li").attr("class","").css("font-family","inherit").css("font-size","inherit").css("line-height","inherit").css("color","").css("border","none ! important").css("background","").css("background-color","").attr("width","").attr("height",""),$(t).find("h1, h2, h3, h4, h5").attr("class","").css("font-family","inherit").css("color","").css("border","none ! important").css("background","").css("background-color",""),void 0!==Reader.hyphenate.en&&$(t).find("p, div").each((t,e)=>{(e=$(e)).html(Reader.hyphenate.en(e.html())),e.html(Reader.hyphenate.ru(e.html()))})},generateFontsCss:function(t){return`\n\t\t\t/** Calibri */\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Calibri';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/calibriz.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Calibri';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/calibrib.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Calibri';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/calibrii.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Calibri';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/calibri.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t/** Cambria */\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Cambria';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/cambriab.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Cambria';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/cambriaz.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Cambria';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/cambriai.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Cambria';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/cambria.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t/** Caecilia */\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: Caecilia;\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/caecilia.ttf"]});\n\t\t\t\tfont-weight : normal;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: Caecilia;\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/caeciliab.ttf"]});\n\t\t\t\tfont-weight : bold;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: Caecilia;\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/caeciliai.ttf"]});\n\t\t\t\tfont-style : italic;\n\t\t\t}\n\n\t\t\t/** Palatino */\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Palatino';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/palab.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Palatino';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/palabi.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Palatino';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/palai.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Palatino';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/pala.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t/** Consolas */\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Consolas';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/consolab.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Consolas';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/consolaz.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Consolas';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/consolai.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Consolas';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/consola.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t/** IBM Plex Mono */\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'IBM Plex Mono';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/IBMPlexMono-Bold.otf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'IBM Plex Mono';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/IBMPlexMono-BoldItalic.otf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'IBM Plex Mono';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/IBMPlexMono-TextItalic.otf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'IBM Plex Mono';\n\t\t\t\tsrc: url(${Reader.Loader._res_data[t+"lib/fonts/IBMPlexMono-Text.otf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\t\t\t`},flattenTocSubItems:function(t,e){let o=[];return 3!=e&&(t.subitems&&$.each(t.subitems,(function(t,a){a._nest=e,o.push(a),o=o.concat(Reader.flattenTocSubItems(a,e+1))})),o)},flattenToc:function(t){if(this._flattened_toc)return this._flattened_toc;{let e=[];return $.each(t.navigation.toc,(function(t,o){o._nest=0,e.push(o),e=e.concat(Reader.flattenTocSubItems(o,1))})),this._flattened_toc=e,e}},generateTocBar:function(t,e){$(".spacer").html(""),$.each(e,(function(e,o){try{const e=t.spine.get(o.href).cfiBase,a=t.locations._locations.find((function(t){return-1!=t.indexOf(e)}));if(a){const e=Math.round(100*t.locations.percentageFromCfi(a));$(".spacer").append($("<div class='toc-bar-entry'>").attr("data-nest-level",o._nest).css("left",e+"%").css("_width",3-o._nest+"px").attr("title",o.label))}}catch(t){console.warn(t)}})),$(".spacer").append($("<div class='toc-bar-entry current-position'>")),Reader.updateTocBarPosition(t,t.rendition.currentLocation())},updateTocBarPosition:function(t,e){const o=Math.round(e.start.location/t.locations.length()*100);$(".toc-bar-entry.current-position").css("left",o+"%")},applyTheme:async function(){let t=await localforage.getItem("epube.fontSize"),e=await localforage.getItem("epube.fontFamily"),o=await localforage.getItem("epube.lineHeight");t=t?t+"px":"16px",e=e||"Arial",o=o?o+"%":"140%",console.log("style",e,t,o),console.log("applying default theme styles..."),window.book&&window.book.rendition&&window.book.rendition.themes.default({html:{"font-size":t,"font-family":"'"+e+"'","line-height":o,"text-align":"justify","text-indent":"1em"}});let a=await localforage.getItem("epube.theme")||"default";console.log("called for theme",a),"default"==a&&"undefined"!=typeof EpubeApp&&EpubeApp.isNightMode()&&(a="night"),console.log("setting main UI theme",a),$("body").attr("class","undefined"!=typeof EpubeApp?"is-epube-app":"").addClass("epube-reader theme-"+a).attr("data-is-loading","false"),"undefined"!=typeof EpubeApp&&window.setTimeout((function(){let t=window.getComputedStyle(document.querySelector("body"),null).getPropertyValue("background-color").match(/rgb\((\d{1,}), (\d{1,}), (\d{1,})\)/);t&&(console.log("sending bgcolor",t),EpubeApp.setStatusBarColor(parseInt(t[1]),parseInt(t[2]),parseInt(t[3])));t=window.getComputedStyle(document.querySelector(".header .title"),null).getPropertyValue("color").match(/rgb\((\d{1,}), (\d{1,}), (\d{1,})\)/),t&&(console.log("sending accent_color",t),EpubeApp.setAccentColor(parseInt(t[1]),parseInt(t[2]),parseInt(t[3])))}),250),window.book&&window.book.rendition&&window.book.rendition.getContents().forEach(n=>{console.log(`applying styles and theme ${a} to `,n),n.css("font-size",t),n.css("font-family","'"+e+"'"),n.css("line-height",o),n.css("text-align","justify"),$(n.document).find("body").attr("class","undefined"!=typeof EpubeApp?"is-epube-app":"").addClass("theme-"+a)})},hotkeyHandler:function(t){try{if($(".modal").is(":visible"))return;39!=t.which&&32!=t.which&&34!=t.which||(t.preventDefault(),Reader.Page.next()),37!=t.which&&33!=t.which||(t.preventDefault(),Reader.Page.prev()),27==t.which&&(t.preventDefault(),Reader.showUI(!0))}catch(t){console.warn(t)}},resizeSideColumns:function(){let t=$("#reader").position().left;window.book&&window.book.rendition&&window.book.rendition.getContents().forEach(e=>{t+=parseInt(e.window.getComputedStyle(e.document.querySelector("body")).getPropertyValue("padding-left"))}),console.log(`resizing side columns to ${t} px`),$("#left, #right").width(t)},markAsRead:async function(){if(confirm("Mark book as read?")){$("#settings-modal").modal("hide");const t=100,e=window.book.locations.cfiFromPercentage(1),o=(new Date).getTime();if(App.isOnline()){const a=await $.post("backend.php",{op:"storelastread",page:t,cfi:e,id:$.urlParam("id"),timestamp:o});$(".lastread_input").val(a.page+"%")}await localforage.setItem(Reader.cacheId("lastread"),{cfi:e,page:t,total:t,timestamp:o}),await Reader.Page.openLastRead()}},close:async function(){const t=window.book.rendition.currentLocation().start.cfi,e=parseInt(100*window.book.locations.percentageFromCfi(t)),o=(new Date).getTime();await localforage.setItem(Reader.cacheId("lastread"),{cfi:t,page:e,total:100,timestamp:o}),App.isOnline()?$.post("backend.php",{op:"storelastread",id:$.urlParam("id"),page:e,cfi:t,timestamp:o},(function(){window.location=$.urlParam("rt")?"index.php?mode="+$.urlParam("rt"):"index.php"})).fail((function(){window.location="index.php"})):window.location="index.php"},cacheId:function(t){return"epube-book."+$.urlParam("b")+(t?"."+t:"")},showUI:function(t){t?$(".header,.footer").fadeIn():$(".header,.footer").fadeOut()},toggleUI:function(){$(".header").is(":visible")?$(".header,.footer").fadeOut():$(".header,.footer").fadeIn()},lookupWord:async function(t,e){t=t.replace(/­/g,""),console.log("lookupWord",t),$(".dict_result").html("Loading, please wait..."),$("#dict-modal").modal("show");try{const o=await $.post("backend.php",{op:"define",word:t});o&&($(".dict_result").html(o.result.join("<br/>")),$(".dict_query").val(t),e&&e())}catch(t){console.error(t),$(".dict_result").html(`Network error while looking up word: ${t.responseText}.`)}},search:function(){const t=$(".search_input").val(),e=$(".search_results");e.html(""),t&&(e.html("<li>Loading, please wait...</li>"),Promise.all(window.book.spine.spineItems.map(e=>e.load(window.book.load.bind(window.book)).then(e.find.bind(e,t)).finally(e.unload.bind(e)))).then(t=>Promise.resolve([].concat.apply([],t))).then((function(t){e.html(""),$.each(t,(function(t,o){const a=$("<a>").attr("href","#").html("<b class='pull-right'>"+window.book.locations.locationFromCfi(o.cfi)+"</b>"+o.excerpt).attr("data-cfi",o.cfi).attr("data-id",o.id).click((function(){window.book.rendition.display(a.attr("data-cfi"))}));e.append($("<li>").append(a))}))})))},Loader:{_res_data:[],init:async function(){"undefined"!=typeof EpubeApp&&$("body").addClass("epube-app");const t=[];let e=!1;const o=await caches.open("epube-v3");(await o.keys()).forEach(o=>{if(!o.url.match("backend.php")){console.log("[loader] loading resource",o.url);const a=fetch(o.url).then(async t=>{if(t.ok){const e=new URL(t.url);if(e.searchParams.delete("ts"),t.url.match("\\.ttf|\\.otf")){const o=await t.blob();console.log("[loader] storing blob",e.href),Reader.Loader._res_data[e.toString()]=URL.createObjectURL(o)}else{const o=await t.text();console.log("[loader] storing text",e.href),Reader.Loader._res_data[e.toString()]=o}}else console.warn("[loader] failed for resource",o.url,t),$(".loading-message").html(`Unable to load resource.<br/><small>${o.url}</small>`),e=!0});t.push(a)}}),await Promise.allSettled(t),console.log("[loader] resource load complete, failed: ",e),e?Reader.applyTheme():Reader.initSecondStage()}},Page:{_prevent_lastread_timeout:!1,_prevent_lastread:!1,next:function(){window.book.rendition.next(),"undefined"!=typeof EpubeApp?EpubeApp.showActionBar(!1):localforage.getItem("epube.keep-ui-visible").then((function(t){t||Reader.showUI(!1)}))},prev:function(){window.book.rendition.prev(),"undefined"!=typeof EpubeApp?EpubeApp.showActionBar(!1):localforage.getItem("epube.keep-ui-visible").then((function(t){t||Reader.showUI(!1)}))},openPrevious:async function(t){const e=$(t).attr("data-location-cfi");e&&await window.book.rendition.display(e),$(t).fadeOut()},blockLastReadUpdate:function(){console.log("blocking last read updates..."),Reader.Page._prevent_lastread_timeout&&window.clearTimeout(Reader.Page._prevent_lastread_timeout),Reader.Page._prevent_lastread_timeout=window.setTimeout(()=>{Reader.Page._prevent_lastread=!1,Reader.Page._prevent_lastread_timeout=!1,console.log("unblocked last read updates")},1e3),Reader.Page._prevent_lastread=!0},onRelocated:async function(t,e){if(0==t.locations.length())return;const o=e.start.cfi,a=parseInt(100*t.locations.percentageFromCfi(o));$("#cur_page").text(Math.floor(e.start.location/10)),$("#total_pages").text(Math.floor(t.locations.length()/10)),$("#page_pct").text(parseInt(100*t.locations.percentageFromCfi(o))+"%"),Reader.updateTocBarPosition(t,e);const n=e.start.displayed;if(n&&($("#chapter_cur_page").text(n.page),$("#chapter_total_pages").text(n.total),n.total>0&&$("#chapter_pct").text(parseInt(n.page/n.total*100)+"%")),Reader.startup_finished&&Reader.last_stored_cfi!=o&&!Reader.Page._prevent_lastread){const t=(new Date).getTime();console.log("storing lastread",a,o,t),await localforage.setItem(Reader.cacheId("lastread"),{cfi:o,page:a,total:100,timestamp:t}),App.isOnline()&&(console.log("updating remote lastread",o),Reader.last_stored_cfi=o,$.post("backend.php",{op:"storelastread",id:$.urlParam("id"),page:a,cfi:o,timestamp:t}))}},clearLastRead:async function(){if(confirm("Reset reading progress for this book?")){$("#settings-modal").modal("hide");const t=window.book.locations.length(),e=(new Date).getTime();App.isOnline()&&await $.post("backend.php",{op:"storelastread",page:-1,cfi:"",id:$.urlParam("id"),timestamp:e}),await localforage.setItem(Reader.cacheId("lastread"),{cfi:"",page:0,total:t,timestamp:e}),await window.book.rendition.display(window.book.locations.cfiFromPercentage(0)),$(".lastread_input").val("0%")}},resetLocations:async function(){confirm("Reset stored pagination data? This will also reset reading progress.")&&($("#settings-modal").modal("hide"),await localforage.removeItem(Reader.cacheId("lastread")),await localforage.removeItem(Reader.cacheId("locations")),await $.post("backend.php",{op:"storelastread",page:-1,cfi:"",id:$.urlParam("id"),timestamp:(new Date).getTime()}),await $.post("backend.php",{op:"deletepagination",id:$.urlParam("id")}).catch(t=>console.log(t)),window.location.reload())},openLastRead:async function(){$(".loading").show(),$(".loading-message").html("Opening last read page…"),$("#settings-modal").modal("hide");const t=window.book.rendition;if(!t)return void console.error("no rendition to work on");let e=!1;const o=await localforage.getItem(Reader.cacheId("lastread"))||{};if(console.log("got local lastread",o),App.isOnline())try{const a=await $.post("backend.php",{op:"getlastread",id:$.urlParam("id")});console.log("got remote lastread",a),a&&a.cfi&&o.cfi!=a.cfi&&a.page>=(o.page||0)&&(console.log(`using remote lastread cfi ${a.cfi}: cfi is different and remote pct ${a.page}% is further than local pct ${o.page}%`),await localforage.setItem(Reader.cacheId("lastread"),{cfi:a.cfi,page:a.page,total:a.total,timestamp:a.timestamp}),e=await Reader.Page.moveToCfiVerify(t,a.cfi))}catch(t){console.log("unable to get remote lastread, continuing..."),console.warn(t)}if(!e&&o&&o.cfi){console.log("using local lastread cfi: "+o.cfi);try{await Reader.Page.moveToCfiVerify(t,o.cfi)}catch(t){console.warn(t)}}$(".loading").fadeOut()},calculateCfiDelta:function(t,e){const o=new ePub.CFI(t),a=new ePub.CFI(e);if(console.log("calculateCfiDelta",o,a),o.path.steps.length!=a.path.steps.length)return-1;let n=0;for(let t=0;t<o.path.steps.length;t++){if(o.path.steps[t].type!=a.path.steps[t].type)return-1;if(o.path.steps[t].id!=a.path.steps[t].id)return-1;null===o.path.steps[t].id&&"element"===o.path.steps[t].type&&(n+=Math.abs(o.path.steps[t].index-a.path.steps[t].index))}return n},moveToCfiVerify:async function(t,e,o=5,a=5){for(let n=1;n<o;n++){Reader.Page.blockLastReadUpdate(),console.log(`trying to open ${e}: attempt ${n} of ${o}...`),await t.display(e);let i=!1;try{i=t.currentLocation().start.cfi}catch(t){console.warn("location not yet available, will retry:",t)}try{const t=Reader.Page.calculateCfiDelta(e,i);if(console.log(`opened cfi ${i} expected ${e}; delta: ${t}`),i==e||-1!=t&&t<=a)return console.log("cfi move verified!"),!0}catch(t){console.warn("exception while parsing cfi, will retry: ",t)}}return!1}},Settings:{onThemeChanged:async function(t){const e=$(t).val();await localforage.setItem("epube.theme",e),Reader.applyTheme()},onLineHeightChanged:async function(t){const e=$(t).val();await localforage.setItem("epube.lineHeight",e),Reader.applyTheme()},onTextSizeChanged:async function(t){const e=$(t).val();await localforage.setItem("epube.fontSize",e),Reader.applyTheme()},onFontChanged:async function(t){const e=$(t).val();await localforage.setItem("epube.fontFamily",e),Reader.applyTheme()}}};function __get_reader(){return Reader}function __get_app(){return App}
\ No newline at end of file
+"use strict";class Cookie{static set(t,e,o){const a=new Date;a.setTime(a.getTime()+1e3*o);const n="expires="+a.toUTCString();document.cookie=t+"="+encodeURIComponent(e)+"; "+n}static get(t){t+="=";const e=document.cookie.split(";");for(let o=0;o<e.length;o++){let a=e[o];for(;" "==a.charAt(0);)a=a.substring(1);if(0==a.indexOf(t))return decodeURIComponent(a.substring(t.length,a.length))}return""}static delete(t){document.cookie=t+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT"}}class AppCommon{urlParam(t){try{const e=new RegExp("[?&]"+t+"=([^&#]*)").exec(window.location.href);return decodeURIComponent(e[1].replace(/\+/g," "))||0}catch(t){return 0}}isOnline(){return"undefined"!=typeof EpubeApp&&void 0!==EpubeApp.isOnline?EpubeApp.isOnline():navigator.onLine}initNightMode(){if("undefined"==typeof EpubeApp){if(window.matchMedia){const t=window.matchMedia("(prefers-color-scheme: dark)");t.addEventListener("change",()=>{this.applyNightMode(t.matches)}),this.applyNightMode(t.matches)}}else this.applyNightMode(EpubeApp.isNightMode())}applyNightMode(t){console.log("night mode changed to",t),$("#theme_css").attr("href","lib/bootstrap/v3/css/"+(t?"theme-dark.min.css":"bootstrap-theme.min.css"))}}class AppClass extends AppCommon{_dl_progress_timeout;index_mode="";cached_urls=[];version="UNKNOWN";buildTimestamp=0;csrf_token="";init(){let t=0;this.csrf_token=Cookie.get("epube_csrf_token"),console.log("setting prefilter for token",this.csrf_token),$.ajaxPrefilter((t,e,o)=>{if("post"!==e.type||"post"!==t.type)return;const a=typeof e.data;"object"==a?t.data=$.param($.extend(e.data,{csrf_token:this.csrf_token})):"string"==a&&(t.data=e.data+"&csrf_token="+encodeURIComponent(this.csrf_token)),console.log(">>>",t)}),"undefined"!=typeof EpubeApp&&($(".navbar").hide(),$(".epube-app-filler").show(),$(".separate-search").show(),$("body").addClass("is-epube-app"),"favorites"==this.urlParam("mode")?EpubeApp.setPage("PAGE_FAVORITES"):EpubeApp.setPage("PAGE_LIBRARY")),this.initNightMode(),"serviceWorker"in navigator?(navigator.serviceWorker.addEventListener("message",e=>{"refresh-started"==e.data&&(console.log("cache refresh started"),t=0,$(".dl-progress").fadeIn().text("Loading, please wait...")),e.data&&0==e.data.indexOf("refreshed:")&&(++t,$(".dl-progress").fadeIn().text("Updated "+t+" files...")),"refresh-finished"==e.data&&(localforage.setItem("epube.cache-version",this.version),localforage.setItem("epube.cache-timestamp",this.buildTimestamp),window.location.reload())}),this.showCovers(),this.updateOfflinePrompts(),this.refreshCache()):$(".container-main").addClass("alert alert-danger").html("Service worker support missing in browser (are you using plain HTTP?).")}logout(){$.post("backend.php",{op:"logout"}).then(()=>{window.location.reload()})}async showSummary(t){const e=t.getAttribute("data-book-id");if(this.isOnline())$.post("backend.php",{op:"getinfo",id:e},(function(t){const e=t.comment?t.comment:"No description available";$("#summary-modal .modal-title").html(t.title),$("#summary-modal .book-summary").html(e),$("#summary-modal").modal()}));else{const t=await localforage.getItem("epube-book."+e),o=t.comment?t.comment:"No description available";$("#summary-modal .modal-title").html(t.title),$("#summary-modal .book-summary").html(o),$("#summary-modal").modal()}return!1}showCovers(){$("img[data-book-id]").each((t,e)=>{const o=$(e);if(o.attr("data-cover-link")){const t=$("<img>").on("load",()=>{o.css("background-image","url("+o.attr("data-cover-link")+")").fadeIn(),t.attr("src",null)}).attr("src",o.attr("data-cover-link"))}})}toggleFavorite(t){const e=t.getAttribute("data-book-id");return("0"==t.getAttribute("data-is-fav")||confirm("Remove favorite?"))&&$.post("backend.php",{op:"togglefav",id:e},o=>{if(o){let a="[Error]";0==o.status?a="Add to favorites":1==o.status&&(a="Remove from favorites"),$(t).html(a).attr("data-is-fav",o.status),"favorites"==this.index_mode&&0==o.status&&$("#cell-"+e).remove()}}),!1}async refreshCache(t){if("serviceWorker"in navigator){const e=await localforage.getItem("epube.cache-version");if(console.log("local version",e,"remote version",this.version),t||e!=this.version)if(console.log("asking worker to refresh cache"),navigator.serviceWorker.controller)navigator.serviceWorker.controller.postMessage({msg:"refresh-cache",urls:this.cached_urls});else{const t=await localforage.getItem("epube.initial-load-done");console.log("initial load done?",t),t?$(".dl-progress").show().addClass("alert-danger").html("Could not communicate with service worker. Try reloading the page."):(await localforage.setItem("epube.initial-load-done",!0),$(".dl-progress").show().addClass("alert-info").html("Page will reload to activate service worker..."),window.setTimeout((function(){window.location.reload()}),3e3))}}else $(".dl-progress").show().addClass("alert-danger").html("Could not communicate with service worker. Try reloading the page.")}appCheckOffline(){EpubeApp.setOffline(!this.isOnline)}updateOfflinePrompts(){const t=$(".offline_dropitem");$.each(t,(t,e)=>{this.updateOfflinePrompt(e)})}async updateOfflinePrompt(t){const e=t.getAttribute("data-book-id"),o="epube-book."+e;await localforage.getItem(o)?(t.onclick=()=>(this.remove(e,()=>{this.updateOfflinePrompt(t)}),!1),t.innerHTML="Remove offline data"):(t.onclick=()=>(this.get(e,()=>{this.updateOfflinePrompt(t)}),!1),t.innerHTML="Make available offline")}offlineInit(){"undefined"!=typeof EpubeApp&&($(".navbar").hide(),$(".epube-app-filler").show(),$("body").addClass("is-epube-app"),EpubeApp.setPage("PAGE_OFFLINE")),this.initNightMode();const t=this.urlParam("query");t&&$(".search_query").val(t),this.populateList()}get(t,e){console.log("offline cache: "+t),$.post("backend.php",{op:"getinfo",id:t},o=>{if(o){const a="epube-book."+t;localforage.setItem(a,o).then(o=>{console.log(a+" got data");const n=[];n.push(fetch("backend.php?op=download&id="+o.epub_id,{credentials:"same-origin"}).then((function(t){200==t.status&&(console.log(a+" got book"),localforage.setItem(a+".book",t.blob()))}))),n.push(fetch("backend.php?op=getpagination&id="+o.epub_id,{credentials:"same-origin"}).then((function(t){200==t.status&&(console.log(a+" got pagination"),t.text().then((function(t){localforage.setItem(a+".locations",JSON.parse(t))})))}))),n.push(fetch("backend.php?op=getlastread&id="+o.epub_id,{credentials:"same-origin"}).then((function(t){200==t.status&&(console.log(a+" got lastread"),t.text().then((function(t){localforage.setItem(a+".lastread",JSON.parse(t))})))}))),o.has_cover&&n.push(fetch("backend.php?op=cover&id="+t,{credentials:"same-origin"}).then((function(t){200==t.status&&(console.log(a+" got cover"),localforage.setItem(a+".cover",t.blob()))}))),Promise.all(n).then(()=>{console.log("download done, running callback",e),e(),$(".dl-progress").show().html("Finished downloading <b>"+o.title+"</b>"),window.clearTimeout(this._dl_progress_timeout),this._dl_progress_timeout=window.setTimeout((function(){$(".dl-progress").fadeOut()}),5e3)})})}})}getAll(){confirm("Download all books on this page?")&&$(".row > div").each((t,e)=>{const o=$(e).attr("id").replace("cell-",""),a=$(e).find(".offline_dropitem")[0];if(o){const t="epube-book."+o;localforage.getItem(t).then(t=>{t||this.get(o,()=>{this.updateOfflinePrompt(a)})})}})}removeFromList(t){const e=t.getAttribute("data-book-id");this.remove(e,()=>{$("#cell-"+e).remove()})}remove(t,e){if(confirm("Remove download?")){const o="epube-book."+t,a=[];console.log("offline remove: "+t),localforage.iterate((function(t,e){e.match(o)&&a.push(localforage.removeItem(e))})),Promise.all(a).then(()=>{console.log("remove done, running callback",e),window.setTimeout(()=>{e()},250)})}}async search(){const t=$(".search_query").val();return await localforage.setItem("epube.search-query",t),this.populateList(),!1}async removeAll(){if(confirm("Remove all downloaded books?")){const t=[];localforage.iterate((function(e,o){o.match("epube-book")&&t.push(localforage.removeItem(o))})),await Promise.all(t),this.populateList()}}populateList(){let t=this.urlParam("query");t&&(t=String(t).toLowerCase());const e=$("#books_container");e.html(""),localforage.iterate((function(o,a){a.match(/epube-book\.\d{1,}$/)&&Promise.all([localforage.getItem(a),localforage.getItem(a+".cover"),localforage.getItem(a+".lastread"),localforage.getItem(a+".book")]).then((function(o){if(o[0]&&o[3]){const a=o[0];if(t){if(!(a.series_name&&a.series_name.toLowerCase().match(t)||a.title&&a.title.toLowerCase().match(t)||a.author_sort&&a.author_sort.toLowerCase().match(t)))return}let n="";o&&o[1]&&(n=URL.createObjectURL(o[1]));let i=!1,s=!1;const l=o[2];l&&(i=l.page>0,s=l.total>0&&l.total-l.page<5);const r=s?"read":"",c=i?"in_progress":"",d=a.series_name?`<div><a class="series_link" href="#">${a.series_name+" ["+a.series_index+"]"}</a></div>`:"",h=$(`<div class="col-xxs-6 col-xs-4 col-sm-3 col-md-2" id="cell-${a.id}">\n\t\t\t\t\t\t<a class="thumbnail ${r}" href="read.html?id=${a.epub_id}&b=${a.id}">\n\t\t\t\t\t\t\t<img style="display : none">\n\t\t\t\t\t\t</a>\n\t\t\t\t\t\t<div class="caption">\n\t\t\t\t\t\t\t<div><a class="${c}" href="read.html?id=${a.epub_id}&b=${a.id}">${a.title}</a></div>\n\t\t\t\t\t\t\t<div><a class="author_link" href="#">${a.author_sort}</a></div>\n\t\t\t\t\t\t\t${d}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="dropdown" style="white-space : nowrap">\n\t\t\t\t\t\t\t<a href="#" data-toggle="dropdown" role="button">More...<span class="caret"></span></a>\n\t\t\t\t\t\t\t<ul class="dropdown-menu">\n\t\t\t\t\t\t\t\t<li><a href="#" data-book-id="${a.id}" onclick="return App.showSummary(this)">Summary</a></li>\n\t\t\t\t\t\t\t\t<li><a href="#" data-book-id="${a.id}" onclick="App.removeFromList(this)">Remove offline data</a></li>\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>`);n?h.find("img").css("background-image","url("+n+")").fadeIn():h.fadeIn(),h.find(".series_link").attr("title",a.series_name+" ["+a.series_index+"]").attr("href","offline.html?query="+encodeURIComponent(a.series_name)),h.find(".author_link").attr("title",a.author_sort).attr("href","offline.html?query="+encodeURIComponent(a.author_sort)),e.append(h)}}))}))}}const DEFAULT_FONT_SIZE=16,DEFAULT_FONT_FAMILY="Arial",DEFAULT_LINE_HEIGHT=140,MIN_LENGTH_TO_JUSTIFY=32,LOCATION_DIVISOR=10,PAGE_RESET_PROGRESS=-1;class ReaderClass extends AppCommon{csrf_token="";last_stored_cfi="";startup_finished=!1;open_last_read_when_displayed=!0;hyphenate={};_prevent_lastread_timeout;_prevent_lastread;book;init(){this.csrf_token=Cookie.get("epube_csrf_token"),console.log("setting prefilter for token",this.csrf_token),$.ajaxPrefilter((t,e)=>{if("post"!==e.type||"post"!==t.type)return;const o=typeof e.data;"object"==o?t.data=$.param($.extend(e.data,{csrf_token:this.csrf_token})):"string"==o&&(t.data=e.data+"&csrf_token="+encodeURIComponent(this.csrf_token)),console.log(">>>",t)}),$(document).on("keyup",t=>{this.hotkeyHandler(t)}),$("#left").on("mouseup",()=>{this.prevPage()}),$("#right").on("mouseup",()=>{this.nextPage()}),this.loader=new ReaderLoader,this.loader.init(t=>{t?this.applyTheme():this.initSecondStage()})}isTouchDevice(){return"ontouchstart"in window||navigator.maxTouchPoints>0}onOfflineModeChanged(t){if(console.log("onOfflineModeChanged",t),!t&&this.book){const t=this.book;console.log("we're online, storing lastread");const e=t.rendition.currentLocation().start.cfi,o=Math.round(100*t.locations.percentageFromCfi(e));$.post("backend.php",{op:"storelastread",id:this.urlParam("id"),page:o,cfi:e,timestamp:(new Date).getTime()},(function(){})).fail((function(t){t&&401==t.status&&(window.location.href="index.php")}))}}async initSecondStage(){"undefined"!=typeof EpubeApp?EpubeApp.setPage("PAGE_READER"):($(window).on("online",()=>{this.onOfflineModeChanged(!1)}),$(window).on("offline",()=>{this.onOfflineModeChanged(!0)})),this.applyTheme();if(!await localforage.getItem(this.cacheId())){const t=this.urlParam("b");console.log("requesting bookinfo for book",t);try{const e=await $.post("backend.php",{op:"getinfo",id:t});if(e.has_cover){const e=await fetch("backend.php?op=cover&id="+t);e.ok&&await localforage.setItem(this.cacheId("cover"),e.blob())}await localforage.setItem(this.cacheId(),e),console.log("bookinfo saved")}catch(t){return void $(".loading-message").html(`Unable to load book info.<br/><small>${t.responseText}</small>`)}}console.log("trying to load book...");let t=await localforage.getItem(this.cacheId("book"));if(!t){console.log("local data not found, loading from network..."),$(".loading-message").html("Downloading book…");const e=await fetch("backend.php?op=download&id="+this.urlParam("id"));if(!e.ok)return void $(".loading-message").html("Unable to download book: "+e.status);if(t=await e.blob(),!t)return void $(".loading-message").html("Unable to get book blob data.");await localforage.setItem(this.cacheId("book"),t),console.log("saved local data for book")}const e=new FileReader,o=this;e.onload=function(){try{o.openBookData(this.result)}catch(t){console.error(t),$(".loading-message").html("Unable to load book blob: "+t)}},e.onerror=t=>{console.log("filereader error",t),$(".loading-message").html("Unable to open book.<br/><small>"+t+"</small>")},e.readAsArrayBuffer(t)}async openBookData(t){const e=ePub();this.book=e;try{await e.open(t)}catch(t){return console.error(t),void $(".loading-message").html("Unable to open book.<br/><small>"+t.message+"</small>")}await e.ready,console.log("book is ready"),await this.showBookInfo(e),await this.loadLocations(e);const o=e.renderTo("reader",{width:"100%",height:"100%",allowScriptedContent:!1,minSpreadWidth:961});$(".location").on("click",async()=>{const t=Math.floor(o.currentLocation().start.location/10),a=Math.floor(e.locations.length()/10),n=prompt("Jump to location [1-"+a+"]",String(t));n&&await o.display(e.locations._locations[10*parseInt(n)])});await localforage.getItem("epube.enable-hyphens")&&(this.hyphenate.en=createHyphenator(hyphenationPatternsEnUs,{html:!0}),this.hyphenate.ru=createHyphenator(hyphenationPatternsRu,{html:!0})),this.initRenditionHooks(e,o),this.initModals(),this.initToc(e),this.blockLastReadUpdate(),await o.display(),console.log("startup finished"),this.startup_finished=!0}async showBookInfo(t){const e=await localforage.getItem(this.cacheId());let o,a;if(e)o=e.title,a=e.author_sort;else{const e=t.package.metadata;o=e.title,a=e.creator}document.title=o+" – "+a+" – The Epube",$(".title").text(o).attr("title",o+" – "+a),"undefined"!=typeof EpubeApp&&(EpubeApp.setTitle(o),EpubeApp.showActionBar(!1))}async loadLocations(t){let e=await localforage.getItem(this.cacheId("locations"));if(e&&"string"==typeof e[0]){console.log("loading local locations...");try{return void await t.locations.load(e)}catch(t){console.warn(t)}}if(this.isOnline()){console.log("downloading locations..."),$(".loading-message").html("Downloading locations…");const o=await fetch("backend.php?op=getpagination&id="+this.urlParam("id"));if(o.ok){console.log("got locations from server");try{e=await o.json()}catch(t){console.warn(t)}if(e&&"string"==typeof e[0]){console.log("saving locations locally..."),await localforage.setItem(this.cacheId("locations"),e);try{return void t.locations.load(e)}catch(t){console.warn(t)}}}}$(".loading-message").html("Preparing locations…");let o=0;e=await t.locations.generate(100,t=>{if(o||(o=t.length()),o>0){const e=Math.round(100*(1-t.length()/o));$(".loading-message").html(`Preparing locations (${e}%)…`)}}),$.post("backend.php",{op:"storepagination",id:this.urlParam("id"),payload:JSON.stringify(e),total:100}),await localforage.setItem(this.cacheId("locations"),e)}initRenditionHooks(t,e){console.log("initRenditionHooks"),t.spine.hooks.content.register(t=>{this.cleanupEmbeddedStyles(t)}),e.hooks.content.register(async o=>{o.on("linkClicked",t=>{console.log("linkClicked",t),this.blockLastReadUpdate(),-1==t.indexOf("://")&&($(".prev_location_btn").attr("data-location-cfi",e.currentLocation().start.cfi).show(),window.requestAnimationFrame(()=>{this.showUI(!0)}))}),o.on("selected",async e=>{if(this.isOnline()){const a=await t.getRange(e),n=a.endContainer.data.substring(a.startOffset,a.endOffset);console.log("selected",e,n),n.match(/^[\w­]+$/)&&this.lookupWord(n,()=>{"undefined"!=typeof EpubeApp&&EpubeApp.showActionBar(!1),o.window.requestAnimationFrame(()=>{o.window.getSelection().removeAllRanges()})})}});const a=window.location.href.match(/^.*\//)[0];$(o.document.head).append($("<style type='text/css'>").text(this.generateFontsCss(a))),$(o.document.head).append($("<style type='text/css'>").text(this.loader._res_data[a+"dist/reader_iframe.min.css"]));const n=await localforage.getItem("epube.theme")||"default";$(o.document).find("body").attr("class","undefined"!=typeof EpubeApp?"is-epube-app":"").addClass("theme-"+n),console.log("contents",o),$(o.window).on("click tap",t=>{if(0==t.button){if($(".modal").is(":visible"))return;"undefined"!=typeof EpubeApp?EpubeApp.toggleActionBar():this.showUI(!0)}}),$(o.window).on("wheel",async t=>{await localforage.getItem("epube.enable-wheel")&&(t.originalEvent.deltaY>0?this.nextPage():t.originalEvent.deltaY<0&&this.prevPage())})}),e.on("keyup",t=>{this.hotkeyHandler(t)}),e.on("resized",()=>{console.log("rendition resized"),this.blockLastReadUpdate(),this.open_last_read_when_displayed=!0}),e.on("rendered",async o=>{console.log("rendition rendered section",o),$(".chapter").html($("<span>").addClass("glyphicon glyphicon-th-list")),this.applyTheme(),this.resizeSideColumns();try{const o=e.currentLocation();if(o.start){const e=t.canonical(o.start.href);let a={};$.each(this.flattenToc(t),(function(o,n){t.spine.get(n.href).canonical!=e||(a=n)})),a&&a.label&&$(".chapter").append("&nbsp;"+a.label.trim()+" | "),this.generateTocBar(t,this.flattenToc(t))}}catch(t){console.warn(t)}this.open_last_read_when_displayed&&(this.open_last_read_when_displayed=!1,await this.openLastRead())}),e.on("displayed",(function(){console.log("rendition displayed")})),e.on("relocated",e=>this.onRelocated(t,e))}initModals(){$("#settings-modal").on("shown.bs.modal",async()=>{const t=await localforage.getItem(this.cacheId("lastread"));t&&t.cfi&&$(".lastread_input").val(t.page+"%").attr("title","[local] "+t.cfi),navigator.onLine&&$.post("backend.php",{op:"getlastread",id:this.urlParam("id")},t=>{$(".lastread_input").val(t.page+"%").attr("title","[remote] "+t.cfi)}),$(".enable_hyphens_checkbox").attr("checked",await localforage.getItem("epube.enable-hyphens")).off("click").on("click",(function(t){localforage.setItem("epube.enable-hyphens",t.target.checked),confirm("Toggling hyphens requires page reload. Reload now?")&&window.location.reload()})),$(".enable_wheel_checkbox").attr("checked",await localforage.getItem("epube.enable-wheel")).off("click").on("click",(function(t){localforage.setItem("epube.enable-wheel",t.target.checked)})),"undefined"!=typeof EpubeApp?$(".keep_ui_checkbox").parent().parent().hide():$(".keep_ui_checkbox").attr("checked",await localforage.getItem("epube.keep-ui-visible")).off("click").on("click",(function(t){localforage.setItem("epube.keep-ui-visible",t.target.checked)}));const e=await localforage.getItem("epube.cache-timestamp"),o=await localforage.getItem("epube.cache-version");$(".last-mod-timestamp").html(`${o}\n\t\t\t\t&mdash; ${parseInt(e)?new Date(1e3*e).toLocaleString("en-GB"):"Unknown"}\n\t\t\t\t(${this.isOnline()?"<span class='text-success'>Online</span>":"<span class='text-danger'>Offline</span>"})\n\t\t\t\t`),$(".font_family").val(await localforage.getItem("epube.fontFamily")||"Arial"),$(".theme_name").val(await localforage.getItem("epube.theme")||"default");const a=$(".font_size").html("");for(let t=10;t<=32;t++){const e=$("<option>").val(t).html(t+" px");a.append(e)}a.val(await localforage.getItem("epube.fontSize")||16);const n=$(".line_height").html("");for(let t=100;t<=220;t+=10){const e=$("<option>").val(t).html(t+"%");n.append(e)}n.val(await localforage.getItem("epube.lineHeight")||140)}),$("#dict-modal").on("shown.bs.modal",(function(){$(".dict_result").scrollTop(0)})),$(".dict_search_btn").on("click",(function(){$("#dict-modal").modal("hide"),window.open("https://duckduckgo.com/?q="+$(".dict_query").val())})),$(".wiki_search_btn").on("click",(function(){$(".dict_result").html("Loading, please wait..."),$.post("backend.php",{op:"wikisearch",query:$(".dict_query").val()}).then(t=>{try{console.log("wikisearch resp",t);let e="";$.each(t.query.pages,(t,o)=>{e+=o.extract}),$(".dict_result").html(e&&"undefined"!=e?e:"No definition found for "+$(".dict_query").val()+".")}catch(t){console.error(t),$(".dict_result").text("Error while processing data: "+t)}}).fail(t=>{console.error(t),$(".dict_result").text("Error while retrieving data.")})}))}initToc(t){const e=this;function o(o){try{const a=t.spine.get(o).cfiBase,n=t.locations._locations.find((function(t){return-1!=t.indexOf(a)}));return Math.round(e.book.locations.locationFromCfi(n)/10)}catch(t){console.warn(t)}return""}$("#toc-modal").on("shown.bs.modal",(function(){const e=t.navigation.toc,a=$(".toc_list");a.html(""),$.each(e,(function(e,n){try{const e=$("<a>").attr("href","#").html("<b class='pull-right'>"+o(n.href)+"</b>"+n.label).attr("data-href",n.href).click((function(){t.rendition.display(e.attr("data-href"))}));a.append($("<li>").append(e)),function e(a,n,i){if(3==i)return!1;if(a.subitems){const s=$("<ul class='toc_sublist list-unstyled'>");$.each(a.subitems,(function(a,n){const l=$("<a>").attr("href","#").html("<b class='pull-right'>"+o(n.href)+"</b>"+n.label).attr("data-href",n.href).click((function(){t.rendition.display(l.attr("data-href"))}));s.append($("<li>").append(l)),e(n,s,i+1)})),n.append(s)}}(n,a,0)}catch(t){console.warn(t)}})),a.children().length<=1&&(a.html(""),$.each(t.spine.items,(function(e,o){const n=$("<a>").attr("href","#").attr("title",o.url).html("Section "+(e+1)).attr("data-href",o.href).on("click",()=>{t.rendition.display(n.attr("data-href"))});a.append($("<li>").append(n))})))}))}cleanupEmbeddedStyles(t){$(t).find("p").filter((t,e)=>$(e).text().length>=32?e:null).css("text-align","justify"),$(t).find("html").attr("class",""),$(t).find("pre").css("white-space","pre-wrap"),$(t).find("a, p, span, em, i, strong, b, body, header, section, div, big, small, table, tr, td, ul, ol, li").attr("class","").css("font-family","inherit").css("font-size","inherit").css("line-height","inherit").css("color","").css("border","none ! important").css("background","").css("background-color","").attr("width","").attr("height",""),$(t).find("h1, h2, h3, h4, h5").attr("class","").css("font-family","inherit").css("color","").css("border","none ! important").css("background","").css("background-color",""),void 0!==this.hyphenate.en&&$(t).find("p, div").each((t,e)=>{const o=$(e);o.html(this.hyphenate.en(o.html())),o.html(this.hyphenate.ru(o.html()))})}generateFontsCss(t){return`\n\t\t\t/** Calibri */\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Calibri';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/calibriz.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Calibri';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/calibrib.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Calibri';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/calibrii.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Calibri';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/calibri.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t/** Cambria */\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Cambria';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/cambriab.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Cambria';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/cambriaz.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Cambria';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/cambriai.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Cambria';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/cambria.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t/** Caecilia */\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: Caecilia;\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/caecilia.ttf"]});\n\t\t\t\tfont-weight : normal;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: Caecilia;\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/caeciliab.ttf"]});\n\t\t\t\tfont-weight : bold;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: Caecilia;\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/caeciliai.ttf"]});\n\t\t\t\tfont-style : italic;\n\t\t\t}\n\n\t\t\t/** Palatino */\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Palatino';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/palab.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Palatino';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/palabi.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Palatino';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/palai.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Palatino';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/pala.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t/** Consolas */\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Consolas';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/consolab.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Consolas';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/consolaz.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Consolas';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/consolai.ttf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'Consolas';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/consola.ttf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t/** IBM Plex Mono */\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'IBM Plex Mono';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/IBMPlexMono-Bold.otf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'IBM Plex Mono';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/IBMPlexMono-BoldItalic.otf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 700;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'IBM Plex Mono';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/IBMPlexMono-TextItalic.otf"]});\n\t\t\t\tfont-style: italic;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\n\t\t\t@font-face {\n\t\t\t\tfont-family: 'IBM Plex Mono';\n\t\t\t\tsrc: url(${this.loader._res_data[t+"lib/fonts/IBMPlexMono-Text.otf"]});\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight : 400;\n\t\t\t}\n\t\t\t`}flattenTocSubItems(t,e){let o=[];return 3!=e&&(t.subitems&&$.each(t.subitems,(t,a)=>{a._nest=e,o.push(a),o=o.concat(this.flattenTocSubItems(a,e+1))}),o)}flattenToc(t){if(this._flattened_toc)return this._flattened_toc;{let e=[];return $.each(t.navigation.toc,(t,o)=>{o._nest=0,e.push(o),e=e.concat(this.flattenTocSubItems(o,1))}),this._flattened_toc=e,e}}generateTocBar(t,e){$(".spacer").html(""),$.each(e,(function(e,o){try{const e=t.spine.get(o.href).cfiBase,a=t.locations._locations.find((function(t){return-1!=t.indexOf(e)}));if(a){const e=Math.round(100*t.locations.percentageFromCfi(a));$(".spacer").append($("<div class='toc-bar-entry'>").attr("data-nest-level",o._nest).css("left",e+"%").css("_width",3-o._nest+"px").attr("title",o.label))}}catch(t){console.warn(t)}})),$(".spacer").append($("<div class='toc-bar-entry current-position'>")),this.updateTocBarPosition(t,t.rendition.currentLocation())}updateTocBarPosition(t,e){const o=Math.round(e.start.location/t.locations.length()*100);$(".toc-bar-entry.current-position").css("left",o+"%")}async applyTheme(){let t=await localforage.getItem("epube.fontSize"),e=await localforage.getItem("epube.fontFamily"),o=await localforage.getItem("epube.lineHeight");t=t?t+"px":"16px",e=e||"Arial",o=o?o+"%":"140%",console.log("style",e,t,o),console.log("applying default theme styles..."),this.book&&this.book.rendition&&this.book.rendition.themes.default({html:{"font-size":t,"font-family":"'"+e+"'","line-height":o,"text-align":"justify","text-indent":"1em"}});let a=await localforage.getItem("epube.theme")||"default";console.log("called for theme",a),"default"==a&&"undefined"!=typeof EpubeApp&&EpubeApp.isNightMode()&&(a="night"),console.log("setting main UI theme",a),$("body").attr("class","undefined"!=typeof EpubeApp?"is-epube-app":"").addClass("epube-reader theme-"+a).attr("data-is-loading","false"),"undefined"!=typeof EpubeApp&&window.setTimeout((function(){let t=window.getComputedStyle(document.querySelector("body"),null).getPropertyValue("background-color").match(/rgb\((\d{1,}), (\d{1,}), (\d{1,})\)/);t&&(console.log("sending bgcolor",t),EpubeApp.setStatusBarColor(parseInt(t[1]),parseInt(t[2]),parseInt(t[3])));t=window.getComputedStyle(document.querySelector(".header .title"),null).getPropertyValue("color").match(/rgb\((\d{1,}), (\d{1,}), (\d{1,})\)/),t&&(console.log("sending accent_color",t),EpubeApp.setAccentColor(parseInt(t[1]),parseInt(t[2]),parseInt(t[3])))}),250),this.book&&this.book.rendition&&this.book.rendition.getContents().forEach(n=>{console.log(`applying styles and theme ${a} to `,n),n.css("font-size",t),n.css("font-family","'"+e+"'"),n.css("line-height",o),n.css("text-align","justify"),$(n.document).find("body").attr("class","undefined"!=typeof EpubeApp?"is-epube-app":"").addClass("theme-"+a)})}hotkeyHandler(t){try{if($(".modal").is(":visible"))return;39!=t.which&&32!=t.which&&34!=t.which||(t.preventDefault(),this.nextPage()),37!=t.which&&33!=t.which||(t.preventDefault(),this.prevPage()),27==t.which&&(t.preventDefault(),this.showUI(!0))}catch(t){console.warn(t)}}resizeSideColumns(){let t=$("#reader").position().left;this.book&&this.book.rendition&&this.book.rendition.getContents().forEach(e=>{t+=parseInt(e.window.getComputedStyle(e.document.querySelector("body")).getPropertyValue("padding-left"))}),console.log(`resizing side columns to ${t} px`),$("#left, #right").width(t)}async markAsRead(){if(confirm("Mark book as read?")){$("#settings-modal").modal("hide");const t=100,e=this.book.locations.cfiFromPercentage(1),o=(new Date).getTime();if(this.isOnline()){const a=await $.post("backend.php",{op:"storelastread",page:t,cfi:e,id:this.urlParam("id"),timestamp:o});$(".lastread_input").val(a.page+"%")}await localforage.setItem(this.cacheId("lastread"),{cfi:e,page:t,total:t,timestamp:o}),await this.openLastRead()}}async close(){const t=this.book.rendition.currentLocation().start.cfi,e=Math.round(100*this.book.locations.percentageFromCfi(t)),o=(new Date).getTime();await localforage.setItem(this.cacheId("lastread"),{cfi:t,page:e,total:100,timestamp:o}),this.isOnline()?$.post("backend.php",{op:"storelastread",id:this.urlParam("id"),page:e,cfi:t,timestamp:o},()=>{window.location.href=this.urlParam("rt")?"index.php?mode="+this.urlParam("rt"):"index.php"}).fail(()=>{window.location.href="index.php"}):window.location.href="index.php"}cacheId(t){return"epube-book."+this.urlParam("b")+(t?"."+t:"")}showUI(t){t?$(".header,.footer").fadeIn():$(".header,.footer").fadeOut()}toggleUI(){$(".header").is(":visible")?$(".header,.footer").fadeOut():$(".header,.footer").fadeIn()}async lookupWord(t,e){t=t.replace(/­/g,""),console.log("lookupWord",t),$(".dict_result").html("Loading, please wait..."),$("#dict-modal").modal("show");try{const o=await $.post("backend.php",{op:"define",word:t});o&&($(".dict_result").html(o.result.join("<br/>")),$(".dict_query").val(t),e&&e())}catch(t){console.error(t),$(".dict_result").html(`Network error while looking up word: ${t.responseText}.`)}}search(){const t=$(".search_input").val(),e=$(".search_results");e.html(""),t&&(e.html("<li>Loading, please wait...</li>"),Promise.all(this.book.spine.spineItems.map(e=>e.load(this.book.load.bind(this.book)).then(e.find.bind(e,t)).finally(e.unload.bind(e)))).then(t=>Promise.resolve([].concat.apply([],t))).then(t=>{e.html(""),$.each(t,(t,o)=>{const a=$("<a>").attr("href","#").html("<b class='pull-right'>"+this.book.locations.locationFromCfi(o.cfi)+"</b>"+o.excerpt).attr("data-cfi",o.cfi).attr("data-id",o.id).on("click",()=>{this.book.rendition.display(a.attr("data-cfi"))});e.append($("<li>").append(a))})}))}nextPage(){this.book.rendition.next(),"undefined"!=typeof EpubeApp?EpubeApp.showActionBar(!1):localforage.getItem("epube.keep-ui-visible").then(t=>{t||this.showUI(!1)})}prevPage(){this.book.rendition.prev(),"undefined"!=typeof EpubeApp?EpubeApp.showActionBar(!1):localforage.getItem("epube.keep-ui-visible").then(t=>{t||this.showUI(!1)})}async openPrevious(t){const e=$(t).attr("data-location-cfi");e&&await this.book.rendition.display(e),$(t).fadeOut()}blockLastReadUpdate(){console.log("blocking last read updates..."),this._prevent_lastread_timeout&&window.clearTimeout(this._prevent_lastread_timeout),this._prevent_lastread_timeout=window.setTimeout(()=>{this._prevent_lastread=!1,this._prevent_lastread_timeout=!1,console.log("unblocked last read updates")},1e3),this._prevent_lastread=!0}async onRelocated(t,e){if(0==t.locations.length())return;const o=e.start.cfi,a=Math.round(100*t.locations.percentageFromCfi(o));$("#cur_page").text(Math.floor(e.start.location/10)),$("#total_pages").text(Math.floor(t.locations.length()/10)),$("#page_pct").text(Math.round(100*t.locations.percentageFromCfi(o))+"%"),this.updateTocBarPosition(t,e);const n=e.start.displayed;if(n&&($("#chapter_cur_page").text(n.page),$("#chapter_total_pages").text(n.total),n.total>0&&$("#chapter_pct").text(Math.round(n.page/n.total*100)+"%")),this.startup_finished&&this.last_stored_cfi!=o&&!this._prevent_lastread){const t=(new Date).getTime();console.log("storing lastread",a,o,t),await localforage.setItem(this.cacheId("lastread"),{cfi:o,page:a,total:100,timestamp:t}),this.isOnline()&&(console.log("updating remote lastread",o),this.last_stored_cfi=o,$.post("backend.php",{op:"storelastread",id:this.urlParam("id"),page:a,cfi:o,timestamp:t}))}}async clearLastRead(){if(confirm("Reset reading progress for this book?")){$("#settings-modal").modal("hide");const t=this.book.locations.length(),e=(new Date).getTime();this.isOnline()&&await $.post("backend.php",{op:"storelastread",page:-1,cfi:"",id:this.urlParam("id"),timestamp:e}),await localforage.setItem(this.cacheId("lastread"),{cfi:"",page:0,total:t,timestamp:e}),await this.book.rendition.display(this.book.locations.cfiFromPercentage(0)),$(".lastread_input").val("0%")}}async resetLocations(){confirm("Reset stored pagination data? This will also reset reading progress.")&&($("#settings-modal").modal("hide"),await localforage.removeItem(this.cacheId("lastread")),await localforage.removeItem(this.cacheId("locations")),await $.post("backend.php",{op:"storelastread",page:-1,cfi:"",id:this.urlParam("id"),timestamp:(new Date).getTime()}),await $.post("backend.php",{op:"deletepagination",id:this.urlParam("id")}).catch(t=>console.log(t)),window.location.reload())}async openLastRead(){$(".loading").show(),$(".loading-message").html("Opening last read page…"),$("#settings-modal").modal("hide");const t=this.book.rendition;if(!t)return void console.error("no rendition to work on");let e=!1;const o=await localforage.getItem(this.cacheId("lastread"))||{};if(console.log("got local lastread",o),this.isOnline())try{const a=await $.post("backend.php",{op:"getlastread",id:this.urlParam("id")});console.log("got remote lastread",a),a&&a.cfi&&o.cfi!=a.cfi&&a.page>=(o.page||0)&&(console.log(`using remote lastread cfi ${a.cfi}: cfi is different and remote pct ${a.page}% is further than local pct ${o.page}%`),await localforage.setItem(this.cacheId("lastread"),{cfi:a.cfi,page:a.page,total:a.total,timestamp:a.timestamp}),e=await this.moveToCfiVerify(t,a.cfi))}catch(t){console.log("unable to get remote lastread, continuing..."),console.warn(t)}if(!e&&o&&o.cfi){console.log("using local lastread cfi: "+o.cfi);try{await this.moveToCfiVerify(t,o.cfi)}catch(t){console.warn(t)}}$(".loading").fadeOut()}calculateCfiDelta(t,e){const o=new ePub.CFI(t),a=new ePub.CFI(e);if(console.log("calculateCfiDelta",o,a),o.path.steps.length!=a.path.steps.length)return-1;let n=0;for(let t=0;t<o.path.steps.length;t++){if(o.path.steps[t].type!=a.path.steps[t].type)return-1;if(o.path.steps[t].id!=a.path.steps[t].id)return-1;null===o.path.steps[t].id&&"element"===o.path.steps[t].type&&(n+=Math.abs(o.path.steps[t].index-a.path.steps[t].index))}return n}async moveToCfiVerify(t,e,o=5,a=5){for(let n=1;n<o;n++){this.blockLastReadUpdate(),console.log(`trying to open ${e}: attempt ${n} of ${o}...`),await t.display(e);let i=!1;try{i=t.currentLocation().start.cfi}catch(t){console.warn("location not yet available, will retry:",t)}try{const t=this.calculateCfiDelta(e,i);if(console.log(`opened cfi ${i} expected ${e}; delta: ${t}`),i==e||-1!=t&&t<=a)return console.log("cfi move verified!"),!0}catch(t){console.warn("exception while parsing cfi, will retry: ",t)}}return!1}async onThemeChanged(t){const e=$(t).val();await localforage.setItem("epube.theme",e),this.applyTheme()}async onLineHeightChanged(t){const e=$(t).val();await localforage.setItem("epube.lineHeight",e),this.applyTheme()}async onTextSizeChanged(t){const e=$(t).val();await localforage.setItem("epube.fontSize",e),this.applyTheme()}async onFontChanged(t){const e=$(t).val();await localforage.setItem("epube.fontFamily",e),this.applyTheme()}}class ReaderLoader{_res_data=[];CACHE_NAME="epube-v3";async init(t){"undefined"!=typeof EpubeApp&&$("body").addClass("epube-app");const e=[];let o=!1;const a=await caches.open(this.CACHE_NAME);(await a.keys()).forEach(t=>{if(!t.url.match("backend.php")){console.log("[loader] loading resource",t.url);const a=fetch(t.url).then(async e=>{if(e.ok){const t=new URL(e.url);if(t.searchParams.delete("ts"),e.url.match("\\.ttf|\\.otf")){const o=await e.blob();console.log("[loader] storing blob",t.href),this._res_data[t.toString()]=URL.createObjectURL(o)}else{const o=await e.text();console.log("[loader] storing text",t.href),this._res_data[t.toString()]=o}}else console.warn("[loader] failed for resource",t.url,e),$(".loading-message").html(`Unable to load resource.<br/><small>${t.url}</small>`),o=!0});e.push(a)}}),await Promise.allSettled(e),console.log("[loader] resource load complete, failed: ",o),t(o)}}
\ No newline at end of file
diff --git a/gulpfile.js b/gulpfile.js
index 28f6c49..ba113ad 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -36,7 +36,7 @@ gulp.task('minifyLibsJS', function(cb) {
 
 gulp.task('minifyJS', function(cb) {
 	gulp
-		.src(['js/app.js', 'js/reader.js'])
+		.src(['js/*.js'])
 		.pipe(concat('app.min.js'))
 		.pipe(uglify())
 		.on('error', swallowError)
diff --git a/index.php b/index.php
index 75e6895..01bba22 100644
--- a/index.php
+++ b/index.php
@@ -70,6 +70,8 @@
 	<script type="text/javascript">
 		'use strict';
 
+		const	App = new AppClass();
+
 		if ('serviceWorker' in navigator) {
 			navigator.serviceWorker
 				.register('worker.js')
@@ -77,6 +79,7 @@
 					console.log("service worker registered");
 
 					$(document).ready(function() {
+
 						App.cached_urls = JSON.parse('<?= json_encode($check_files_mtime) ?>');
 						App.index_mode = "<?= $mode ?>";
 						App.version = "<?= Config::get_version(true) ?>";
diff --git a/js/app.d.ts b/js/app.d.ts
new file mode 100644
index 0000000..58eddc3
--- /dev/null
+++ b/js/app.d.ts
@@ -0,0 +1,2 @@
+declare var EpubeApp: class;
+declare var localforage: LocalForage;
diff --git a/js/app.js b/js/app.js
index 7714246..a62c459 100644
--- a/js/app.js
+++ b/js/app.js
@@ -1,25 +1,18 @@
+// @ts-check
+
 'use strict';
 
 /* global localforage, EpubeApp, $ */
 
-$.urlParam = function(name){
-	try {
-		const results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
-		return decodeURIComponent(results[1].replace(/\+/g, " ")) || 0;
-	} catch (e) {
-		return 0;
-	}
-};
-
-/* exported Cookie */
-const Cookie = {
-	set: function (name, value, lifetime) {
+class Cookie {
+	static set(name, value, lifetime) {
 		const d = new Date();
 		d.setTime(d.getTime() + lifetime * 1000);
 		const expires = "expires=" + d.toUTCString();
 		document.cookie = name + "=" + encodeURIComponent(value) + "; " + expires;
-	},
-	get: function (name) {
+	}
+
+	static get(name) {
 		name = name + "=";
 		const ca = document.cookie.split(';');
 		for (let i=0; i < ca.length; i++) {
@@ -28,21 +21,71 @@ const Cookie = {
 			if (c.indexOf(name) == 0) return decodeURIComponent(c.substring(name.length, c.length));
 		}
 		return "";
-	},
-	delete: function(name) {
+	}
+
+	static delete(name) {
 		const expires = "expires=Thu, 01-Jan-1970 00:00:01 GMT";
 		document.cookie = name + "=; " + expires;
 	}
-};
-
-const App = {
-	_dl_progress_timeout: false,
-	index_mode: "",
-	cached_urls: [],
-	version: "UNKNOWN",
-	buildTimestamp: 0,
-	csrf_token: "",
-	init: function() {
+}
+
+class AppCommon {
+	urlParam(name){
+		try {
+			const results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
+			return decodeURIComponent(results[1].replace(/\+/g, " ")) || 0;
+		} catch (e) {
+			return 0;
+		}
+	}
+
+	isOnline() {
+		if (typeof EpubeApp != "undefined" && typeof EpubeApp.isOnline != "undefined")
+			return EpubeApp.isOnline();
+		else
+			return navigator.onLine;
+	}
+
+	initNightMode() {
+		if (typeof EpubeApp != "undefined") {
+			this.applyNightMode(EpubeApp.isNightMode());
+			return;
+		}
+
+		if (window.matchMedia) {
+			const mql = window.matchMedia('(prefers-color-scheme: dark)');
+
+			mql.addEventListener("change", () => {
+				this.applyNightMode(mql.matches);
+			});
+
+			this.applyNightMode(mql.matches);
+		}
+	}
+
+	applyNightMode(is_night) {
+		console.log("night mode changed to", is_night);
+
+		$("#theme_css").attr("href",
+			"lib/bootstrap/v3/css/" + (is_night ? "theme-dark.min.css" : "bootstrap-theme.min.css"));
+	}
+}
+
+/* exported AppClass */
+class AppClass extends AppCommon {
+	_dl_progress_timeout;
+
+	index_mode = "";
+
+	cached_urls = [];
+
+	version = "UNKNOWN";
+
+	buildTimestamp = 0;
+
+	csrf_token = "";
+
+	init() {
 		let refreshed_files = 0;
 
 		this.csrf_token = Cookie.get('epube_csrf_token');
@@ -50,7 +93,7 @@ const App = {
 		console.log('setting prefilter for token', this.csrf_token);
 
 		/* eslint-disable no-unused-vars */
-		$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
+		$.ajaxPrefilter((options, originalOptions, jqXHR) => {
 			if (originalOptions.type !== 'post' || options.type !== 'post') {
 				return;
 			}
@@ -58,9 +101,9 @@ const App = {
 			const datatype = typeof originalOptions.data;
 
 			if (datatype == 'object')
-				options.data = $.param($.extend(originalOptions.data, {"csrf_token": App.csrf_token}));
+				options.data = $.param($.extend(originalOptions.data, {"csrf_token": this.csrf_token}));
 			else if (datatype == 'string')
-				options.data = originalOptions.data + "&csrf_token=" + encodeURIComponent(App.srf_token);
+				options.data = originalOptions.data + "&csrf_token=" + encodeURIComponent(this.csrf_token);
 
 			console.log('>>>', options);
 		});
@@ -71,16 +114,16 @@ const App = {
 			$(".separate-search").show();
 			$("body").addClass("is-epube-app");
 
-			if ($.urlParam("mode") == "favorites")
+			if (this.urlParam("mode") == "favorites")
 				EpubeApp.setPage("PAGE_FAVORITES");
 			else
 				EpubeApp.setPage("PAGE_LIBRARY");
 		}
 
-		App.initNightMode();
+		this.initNightMode();
 
 		if ('serviceWorker' in navigator) {
-			navigator.serviceWorker.addEventListener('message', function(event) {
+			navigator.serviceWorker.addEventListener('message', (event) => {
 
 				if (event.data == 'refresh-started') {
 					console.log('cache refresh started');
@@ -100,51 +143,66 @@ const App = {
 				}
 
 				if (event.data == 'refresh-finished') {
-					localforage.setItem("epube.cache-version", App.version);
-					localforage.setItem("epube.cache-timestamp", App.buildTimestamp);
+					localforage.setItem("epube.cache-version", this.version);
+					localforage.setItem("epube.cache-timestamp", this.buildTimestamp);
 					window.location.reload()
 				}
 
 			});
 
-			App.showCovers();
-			App.Offline.markBooks();
-			App.refreshCache();
+			this.showCovers();
+			this.updateOfflinePrompts();
+			this.refreshCache();
 
 		} else {
 			$(".container-main")
 				.addClass("alert alert-danger")
 				.html("Service worker support missing in browser (are you using plain HTTP?).");
 		}
-	},
-	logout: function() {
+	}
+
+	logout() {
 		$.post("backend.php", {op: "logout"}).then(() => {
 			window.location.reload();
 		});
-	},
-	showSummary: function(elem) {
-		const id = elem.getAttribute("data-book-id");
+	}
+
+	async showSummary(elem) {
+		const bookId = elem.getAttribute("data-book-id");
+
+		if (this.isOnline()) {
 
-		$.post("backend.php", {op: 'getinfo', id: id}, function(data) {
+			$.post("backend.php", {op: 'getinfo', id: bookId}, function(data) {
 
+				const comment = data.comment ? data.comment : 'No description available';
+
+				$("#summary-modal .modal-title").html(data.title);
+				$("#summary-modal .book-summary").html(comment);
+
+				$("#summary-modal").modal();
+
+			});
+
+		} else {
+			const data = await localforage.getItem("epube-book." + bookId);
 			const comment = data.comment ? data.comment : 'No description available';
 
 			$("#summary-modal .modal-title").html(data.title);
 			$("#summary-modal .book-summary").html(comment);
 
 			$("#summary-modal").modal();
-
-		});
+		}
 
 		return false;
-	},
-	showCovers: function() {
-		$("img[data-book-id]").each((i,e) => {
-			e = $(e);
+	}
+
+	showCovers() {
+		$("img[data-book-id]").each((i, elem) => {
+			const e = $(elem);
 
 			if (e.attr('data-cover-link')) {
 				const img = $("<img>")
-					.on("load", function() {
+					.on("load", () => {
 						e.css("background-image", "url(" + e.attr('data-cover-link') + ")")
 							.fadeIn();
 
@@ -153,13 +211,14 @@ const App = {
 					.attr("src", e.attr('data-cover-link'));
 			}
 		});
-	},
-	toggleFavorite: function(elem) {
+	}
+
+	toggleFavorite(elem) {
 		const bookId = elem.getAttribute("data-book-id");
 
 		if (elem.getAttribute("data-is-fav") == "0" || confirm("Remove favorite?")) {
 
-			$.post("backend.php", {op: "togglefav", id: bookId}, function(data) {
+			$.post("backend.php", {op: "togglefav", id: bookId}, (data) => {
 				if (data) {
 					let msg = "[Error]";
 
@@ -171,7 +230,7 @@ const App = {
 
 					$(elem).html(msg).attr('data-is-fav', data.status);
 
-					if (App.index_mode == "favorites" && data.status == 0) {
+					if (this.index_mode == "favorites" && data.status == 0) {
 						$("#cell-" + bookId).remove();
 					}
 				}
@@ -179,395 +238,355 @@ const App = {
 		}
 
 		return false;
-	},
-	refreshCache: function(force) {
+	}
+
+	async refreshCache(force) {
 		if ('serviceWorker' in navigator) {
-			localforage.getItem("epube.cache-version").then(function(version) {
-				console.log('local version', version, 'remote version', App.version);
+			const version = await localforage.getItem("epube.cache-version");
 
-				if (force || version != App.version) {
-					console.log('asking worker to refresh cache');
+			console.log('local version', version, 'remote version', this.version);
 
-					if (navigator.serviceWorker.controller) {
-						navigator.serviceWorker.controller.postMessage({msg: "refresh-cache", urls: App.cached_urls});
+			if (force || version != this.version) {
+				console.log('asking worker to refresh cache');
+
+				if (navigator.serviceWorker.controller) {
+					navigator.serviceWorker.controller.postMessage({msg: "refresh-cache", urls: this.cached_urls});
+				} else {
+					const done = await localforage.getItem("epube.initial-load-done");
+
+					console.log("initial load done?", done);
+
+					if (done) {
+						$(".dl-progress")
+							.show()
+							.addClass("alert-danger")
+							.html("Could not communicate with service worker. Try reloading the page.");
 					} else {
-						localforage.getItem("epube.initial-load-done").then(function(done) {
-
-							console.log("initial load done", done);
-
-							if (done) {
-								$(".dl-progress")
-									.show()
-									.addClass("alert-danger")
-									.html("Could not communicate with service worker. Try reloading the page.");
-							} else {
-								localforage.setItem("epube.initial-load-done", true).then(function() {
-									$(".dl-progress")
-										.show()
-										.addClass("alert-info")
-										.html("Page will reload to activate service worker...");
-
-									window.setTimeout(function() {
-										window.location.reload();
-									}, 3*1000);
-
-								});
-							}
+						await localforage.setItem("epube.initial-load-done", true);
+
+						$(".dl-progress")
+							.show()
+							.addClass("alert-info")
+							.html("Page will reload to activate service worker...");
 
-						});
+						window.setTimeout(function() {
+							window.location.reload();
+						}, 3*1000);
 					}
 				}
-			});
+			}
 		} else {
 			$(".dl-progress")
 				.show()
 				.addClass("alert-danger")
 				.html("Could not communicate with service worker. Try reloading the page.");
 		}
-	},
-	isOnline: function() {
-		if (typeof EpubeApp != "undefined" && typeof EpubeApp.isOnline != "undefined")
-			return EpubeApp.isOnline();
-		else
-			return navigator.onLine;
-	},
-	appCheckOffline: function() {
-		EpubeApp.setOffline(!App.isOnline);
-	},
-	initNightMode: function() {
-		if (typeof EpubeApp != "undefined") {
-			App.applyNightMode(EpubeApp.isNightMode());
-			return;
-		}
+	}
 
-		if (window.matchMedia) {
-			const mql = window.matchMedia('(prefers-color-scheme: dark)');
+	appCheckOffline() {
+		EpubeApp.setOffline(!this.isOnline);
+	}
 
-			mql.addEventListener("change", () => {
-				App.applyNightMode(mql.matches);
-			});
+	updateOfflinePrompts() {
+		const elems = $(".offline_dropitem");
 
-			App.applyNightMode(mql.matches);
-		}
-	},
-	applyNightMode: function(is_night) {
-		console.log("night mode changed to", is_night);
+		$.each(elems, (i, elem) => {
+			this.updateOfflinePrompt(elem);
+		});
+	}
 
-		$("#theme_css").attr("href",
-			"lib/bootstrap/v3/css/" + (is_night ? "theme-dark.min.css" : "bootstrap-theme.min.css"));
-	},
-	Offline: {
-		init: function() {
-			if (typeof EpubeApp != "undefined") {
-				$(".navbar").hide();
-				$(".epube-app-filler").show();
-				$("body").addClass("is-epube-app");
-
-				EpubeApp.setPage("PAGE_OFFLINE");
-			}
+	async updateOfflinePrompt(elem) {
+		const bookId = elem.getAttribute("data-book-id");
+		const cacheId = "epube-book." + bookId;
 
-			App.initNightMode();
+		const book = await localforage.getItem(cacheId);
 
-			const query = $.urlParam("query");
+		if (book) {
+			elem.onclick = () => {
+				this.remove(bookId, () => {
+					this.updateOfflinePrompt(elem);
+				});
 
-			if (query)
-				$(".search_query").val(query);
+				return false;
+			};
 
-			App.Offline.populateList();
-		},
-		get: function(bookId, callback) {
-			console.log("offline cache: " + bookId);
+			elem.innerHTML = "Remove offline data";
 
-			$.post("backend.php", {op: "getinfo", id: bookId}, function(data) {
+		} else {
+			elem.onclick = () => {
+				this.get(bookId, () => {
+					this.updateOfflinePrompt(elem);
+				});
+				return false;
+			};
 
-				if (data) {
-					const cacheId = 'epube-book.' + bookId;
+			elem.innerHTML = "Make available offline";
+		}
+	}
 
-					localforage.setItem(cacheId, data).then(function(data) {
+	offlineInit() {
+		if (typeof EpubeApp != "undefined") {
+			$(".navbar").hide();
+			$(".epube-app-filler").show();
+			$("body").addClass("is-epube-app");
 
-						console.log(cacheId + ' got data');
+			EpubeApp.setPage("PAGE_OFFLINE");
+		}
 
-						const promises = [];
+		this.initNightMode();
 
-						promises.push(fetch('backend.php?op=download&id=' + data.epub_id, {credentials: 'same-origin'}).then(function(resp) {
-							if (resp.status == 200) {
-								console.log(cacheId + ' got book');
+		const query = this.urlParam("query");
 
-								callback();
+		if (query)
+			$(".search_query").val(query);
 
-								localforage.setItem(cacheId + '.book', resp.blob());
-							}
-						}));
+		this.populateList();
+	}
 
-						promises.push(fetch("backend.php?op=getpagination&id=" + data.epub_id, {credentials: 'same-origin'}).then(function(resp) {
-							if (resp.status == 200) {
-								console.log(cacheId + ' got pagination');
+	get(bookId, callback) {
+		console.log("offline cache: " + bookId);
 
-								resp.text().then(function(text) {
-									localforage.setItem(cacheId + '.locations', JSON.parse(text));
-								});
-							}
-						}));
+		$.post("backend.php", {op: "getinfo", id: bookId}, (data) => {
 
-						promises.push(fetch("backend.php?op=getlastread&id=" + data.epub_id, {credentials: 'same-origin'}).then(function(resp) {
-							if (resp.status == 200) {
-								console.log(cacheId + ' got lastread');
-								resp.text().then(function(text) {
-									localforage.setItem(cacheId + '.lastread', JSON.parse(text));
-								});
-							}
-						}));
+			if (data) {
+				const cacheId = 'epube-book.' + bookId;
 
-						if (data.has_cover) {
+				localforage.setItem(cacheId, data).then((data) => {
 
-							promises.push(fetch("backend.php?op=cover&id=" + bookId, {credentials: 'same-origin'}).then(function(resp) {
+					console.log(cacheId + ' got data');
 
-								if (resp.status == 200) {
-									console.log(cacheId + ' got cover');
-									localforage.setItem(cacheId + '.cover', resp.blob());
-								}
+					const promises = [];
 
-							}));
+					promises.push(fetch('backend.php?op=download&id=' + data.epub_id, {credentials: 'same-origin'}).then(function(resp) {
+						if (resp.status == 200) {
+							console.log(cacheId + ' got book');
 
+							localforage.setItem(cacheId + '.book', resp.blob());
 						}
+					}));
 
-						Promise.all(promises).then(function() {
-							$(".dl-progress")
-								.show()
-								.html("Finished downloading <b>" + data.title + "</b>");
+					promises.push(fetch("backend.php?op=getpagination&id=" + data.epub_id, {credentials: 'same-origin'}).then(function(resp) {
+						if (resp.status == 200) {
+							console.log(cacheId + ' got pagination');
 
-							window.clearTimeout(App._dl_progress_timeout);
+							resp.text().then(function(text) {
+								localforage.setItem(cacheId + '.locations', JSON.parse(text));
+							});
+						}
+					}));
+
+					promises.push(fetch("backend.php?op=getlastread&id=" + data.epub_id, {credentials: 'same-origin'}).then(function(resp) {
+						if (resp.status == 200) {
+							console.log(cacheId + ' got lastread');
+							resp.text().then(function(text) {
+								localforage.setItem(cacheId + '.lastread', JSON.parse(text));
+							});
+						}
+					}));
 
-							App._dl_progress_timeout = window.setTimeout(function() {
-								$(".dl-progress").fadeOut();
-							}, 5*1000);
-						});
-					});
-				}
-			});
-		},
-		getAll: function() {
-			if (confirm("Download all books on this page?")) {
+					if (data.has_cover) {
+						promises.push(fetch("backend.php?op=cover&id=" + bookId, {credentials: 'same-origin'}).then(function(resp) {
+							if (resp.status == 200) {
+								console.log(cacheId + ' got cover');
+								localforage.setItem(cacheId + '.cover', resp.blob());
+							}
+						}));
+					}
 
-				$(".row > div").each(function (i, row) {
-					const bookId = $(row).attr("id").replace("cell-", "");
-					const dropitem = $(row).find(".offline_dropitem")[0];
+					Promise.all(promises).then(() => {
+						console.log('download done, running callback', callback);
 
-					if (bookId) {
+						callback();
 
-						const cacheId = 'epube-book.' + bookId;
-						localforage.getItem(cacheId).then(function(book) {
+						$(".dl-progress")
+							.show()
+							.html("Finished downloading <b>" + data.title + "</b>");
 
-							if (!book) {
-								App.Offline.get(bookId, function() {
-									App.Offline.mark(dropitem);
-								});
-							}
+						window.clearTimeout(this._dl_progress_timeout);
 
-						});
+						this._dl_progress_timeout = window.setTimeout(function() {
+							$(".dl-progress").fadeOut();
+						}, 5*1000);
+					})
 
-					}
 				});
 			}
-		},
-		markBooks: function() {
-			const elems = $(".offline_dropitem");
+		});
+	}
 
-			$.each(elems, function (i, elem) {
-				App.Offline.mark(elem);
-			});
-		},
-		mark: function(elem) {
-			const bookId = elem.getAttribute("data-book-id");
-			const cacheId = "epube-book." + bookId;
-
-			localforage.getItem(cacheId).then(function(book) {
-				if (book) {
-					elem.onclick = function() {
-						App.Offline.remove(bookId, function() {
-							App.Offline.mark(elem);
-						});
-						return false;
-					};
-
-					elem.innerHTML = "Remove offline data";
+	getAll() {
+		if (confirm("Download all books on this page?")) {
 
-				} else {
-					elem.onclick = function() {
-						App.Offline.get(bookId, function() {
-							App.Offline.mark(elem);
-						});
-						return false;
-					};
-
-					elem.innerHTML = "Make available offline";
+			$(".row > div").each((i, row) => {
+				const bookId = $(row).attr("id").replace("cell-", "");
+				const dropitem = $(row).find(".offline_dropitem")[0];
+
+				if (bookId) {
+					const cacheId = 'epube-book.' + bookId;
+
+					localforage.getItem(cacheId).then((book) => {
+						if (!book) {
+							this.get(bookId, () => {
+								this.updateOfflinePrompt(dropitem);
+							});
+						}
+					});
 				}
 			});
-		},
+		}
+	}
 
-		removeFromList: function(elem) {
-			const bookId = elem.getAttribute("data-book-id");
+	removeFromList(elem) {
+		const bookId = elem.getAttribute("data-book-id");
 
-			return App.Offline.remove(bookId, function() {
-				$("#cell-" + bookId).remove();
-			});
-		},
-		remove: function(id, callback) {
-			if (confirm("Remove download?")) {
+		this.remove(bookId, () => {
+			$("#cell-" + bookId).remove();
+		});
+	}
 
-				const cacheId = "epube-book." + id;
-				const promises = [];
+	remove(id, callback) {
+		if (confirm("Remove download?")) {
 
-				console.log("offline remove: " + id);
+			const cacheId = "epube-book." + id;
+			const promises = [];
 
-				localforage.iterate(function(value, key /*, i */) {
-					if (key.match(cacheId)) {
-						promises.push(localforage.removeItem(key));
-					}
-				});
+			console.log("offline remove: " + id);
 
-				Promise.all(promises).then(function() {
-					window.setTimeout(function() {
-						callback();
-					}, 500);
-				});
-			}
-		},
-		search: function() {
-			const query = $(".search_query").val();
+			localforage.iterate(function(value, key /*, i */) {
+				if (key.match(cacheId)) {
+					promises.push(localforage.removeItem(key));
+				}
+			});
 
-			localforage.setItem("epube.search-query", query).then(function() {
-				App.Offline.populateList();
+			Promise.all(promises).then(() => {
+				console.log('remove done, running callback', callback);
+
+				// just promise.all is not enough, need to wait a bit for localforage to actually delete item (?)
+				window.setTimeout(() => {
+					callback();
+				}, 250);
 			});
+		}
+	}
 
-			return false;
-		},
-		removeAll: function() {
-			if (confirm("Remove all downloaded books?")) {
+	async search() {
+		const query = $(".search_query").val();
 
-				const promises = [];
+		await localforage.setItem("epube.search-query", query);
 
-				localforage.iterate(function(value, key/*, i*/) {
+		this.populateList();
 
-					if (key.match("epube-book")) {
-						promises.push(localforage.removeItem(key));
-					}
-				});
+		return false;
+	}
 
-				Promise.all(promises).then(function() {
-					window.setTimeout(function() {
-						App.Offline.populateList();
-					}, 500);
-				});
-			}
-		},
-		showSummary: function(elem) {
-			const bookId = elem.getAttribute("data-book-id");
+	async removeAll() {
+		if (confirm("Remove all downloaded books?")) {
 
-			localforage.getItem("epube-book." + bookId).then(function(data) {
+			const promises = [];
 
-				const comment = data.comment ? data.comment : 'No description available';
+			localforage.iterate(function(value, key/*, i*/) {
+				if (key.match("epube-book")) {
+					promises.push(localforage.removeItem(key));
+				}
+			});
 
-				$("#summary-modal .modal-title").html(data.title);
-				$("#summary-modal .book-summary").html(comment);
+			await Promise.all(promises);
 
-				$("#summary-modal").modal();
+			this.populateList();
+		}
+	}
 
-			});
+	populateList() {
+		let query = this.urlParam("query");
 
-			return false;
-		},
-		populateList: function() {
-			let query = $.urlParam("query");
+		if (query) query = String(query).toLowerCase();
 
-			if (query) query = query.toLowerCase();
+		const books = $("#books_container");
+		books.html("");
 
-			const books = $("#books_container");
-			books.html("");
+		localforage.iterate(function(value, key/*, i*/) {
+			if (key.match(/epube-book\.\d{1,}$/)) {
 
-			localforage.iterate(function(value, key/*, i*/) {
-				if (key.match(/epube-book\.\d{1,}$/)) {
+				Promise.all([
+					localforage.getItem(key),
+					localforage.getItem(key + ".cover"),
+					localforage.getItem(key + ".lastread"),
+					localforage.getItem(key + ".book")
+				]).then(function(results) {
 
-					Promise.all([
-						localforage.getItem(key),
-						localforage.getItem(key + ".cover"),
-						localforage.getItem(key + ".lastread"),
-						localforage.getItem(key + ".book")
-					]).then(function(results) {
+					if (results[0] && results[3]) {
+						const info = results[0];
 
-						if (results[0] && results[3]) {
-							const info = results[0];
+						if (query) {
+							const match =
+								(info.series_name && info.series_name.toLowerCase().match(query)) ||
+								(info.title && info.title.toLowerCase().match(query)) ||
+								(info.author_sort && info.author_sort.toLowerCase().match(query));
 
-							if (query) {
-								const match =
-									(info.series_name && info.series_name.toLowerCase().match(query)) ||
-									(info.title && info.title.toLowerCase().match(query)) ||
-									(info.author_sort && info.author_sort.toLowerCase().match(query));
+							if (!match) return;
+						}
 
-								if (!match) return;
-							}
 
+						let cover = "";
 
-							let cover = false;
+						if (results && results[1]) {
+							cover = URL.createObjectURL(results[1]);
+						}
 
-							if (results && results[1]) {
-								cover = URL.createObjectURL(results[1]);
-							}
+						let in_progress = false;
+						let is_read = false;
 
-							let in_progress = false;
-							let is_read = false;
+						const lastread = results[2];
+						if (lastread) {
+							in_progress = lastread.page > 0;
+							is_read = lastread.total > 0 && lastread.total - lastread.page < 5;
+						}
 
-							const lastread = results[2];
-							if (lastread) {
-								in_progress = lastread.page > 0;
-								is_read = lastread.total > 0 && lastread.total - lastread.page < 5;
-							}
+						const thumb_class = is_read ? "read" : "";
+						const title_class = in_progress ? "in_progress" : "";
+
+						const series_link = info.series_name ? `<div><a class="series_link" href="#">${info.series_name + " [" + info.series_index + "]"}</a></div>` : "";
+
+						const cell = $(`<div class="col-xxs-6 col-xs-4 col-sm-3 col-md-2" id="cell-${info.id}">
+						<a class="thumbnail ${thumb_class}" href="read.html?id=${info.epub_id}&b=${info.id}">
+							<img style="display : none">
+						</a>
+						<div class="caption">
+							<div><a class="${title_class}" href="read.html?id=${info.epub_id}&b=${info.id}">${info.title}</a></div>
+							<div><a class="author_link" href="#">${info.author_sort}</a></div>
+							${series_link}
+						</div>
+						<div class="dropdown" style="white-space : nowrap">
+							<a href="#" data-toggle="dropdown" role="button">More...<span class="caret"></span></a>
+							<ul class="dropdown-menu">
+								<li><a href="#" data-book-id="${info.id}" onclick="return App.showSummary(this)">Summary</a></li>
+								<li><a href="#" data-book-id="${info.id}" onclick="App.removeFromList(this)">Remove offline data</a></li>
+							</ul>
+						</div>
+					</div>`);
+
+						if (cover) {
+							cell.find("img")
+								.css("background-image", "url(" + cover + ")")
+								.fadeIn();
+						} else {
+							cell
+								.fadeIn();
+						}
 
-							const thumb_class = is_read ? "read" : "";
-							const title_class = in_progress ? "in_progress" : "";
-
-							const series_link = info.series_name ? `<div><a class="series_link" href="#">${info.series_name + " [" + info.series_index + "]"}</a></div>` : "";
-
-							const cell = $(`<div class="col-xxs-6 col-xs-4 col-sm-3 col-md-2" id="cell-${info.id}">
-							<a class="thumbnail ${thumb_class}" href="read.html?id=${info.epub_id}&b=${info.id}">
-								<img style="display : none">
-							</a>
-							<div class="caption">
-								<div><a class="${title_class}" href="read.html?id=${info.epub_id}&b=${info.id}">${info.title}</a></div>
-								<div><a class="author_link" href="#">${info.author_sort}</a></div>
-								${series_link}
-							</div>
-							<div class="dropdown" style="white-space : nowrap">
-								<a href="#" data-toggle="dropdown" role="button">More...<span class="caret"></span></a>
-								<ul class="dropdown-menu">
-									<li><a href="#" data-book-id="${info.id}" onclick="return App.Offline.showSummary(this)">Summary</a></li>
-									<li><a href="#" data-book-id="${info.id}" onclick="App.Offline.removeFromList(this)">Remove offline data</a></li>
-								</ul>
-							</div>
-						</div>`);
-
-							if (cover) {
-								cell.find("img")
-									.css("background-image", "url(" + cover + ")")
-									.fadeIn();
-							} else {
-								cell
-									.fadeIn();
-							}
+						cell.find(".series_link")
+							.attr("title", info.series_name + " [" + info.series_index  + "]")
+							.attr("href", "offline.html?query=" + encodeURIComponent(info.series_name));
 
-							cell.find(".series_link")
-								.attr("title", info.series_name + " [" + info.series_index  + "]")
-								.attr("href", "offline.html?query=" + encodeURIComponent(info.series_name));
+						cell.find(".author_link")
+							.attr("title", info.author_sort)
+							.attr("href", "offline.html?query=" + encodeURIComponent(info.author_sort));
 
-							cell.find(".author_link")
-								.attr("title", info.author_sort)
-								.attr("href", "offline.html?query=" + encodeURIComponent(info.author_sort));
+						books.append(cell);
+					}
+				});
+			}
+		});
+	}
 
-							books.append(cell);
-						}
-					});
-				}
-			});
-		}
-	},
-};
+}
diff --git a/js/localforage.d.ts b/js/localforage.d.ts
new file mode 100644
index 0000000..7fb8f58
--- /dev/null
+++ b/js/localforage.d.ts
@@ -0,0 +1,123 @@
+interface LocalForageDbInstanceOptions {
+    name?: string;
+
+    storeName?: string;
+}
+
+interface LocalForageOptions extends LocalForageDbInstanceOptions {
+    driver?: string | string[];
+
+    size?: number;
+
+    version?: number;
+
+    description?: string;
+}
+
+interface LocalForageDbMethodsCore {
+    getItem<T>(key: string, callback?: (err: any, value: T | null) => void): Promise<T | null>;
+
+    setItem<T>(key: string, value: T, callback?: (err: any, value: T) => void): Promise<T>;
+
+    removeItem(key: string, callback?: (err: any) => void): Promise<void>;
+
+    clear(callback?: (err: any) => void): Promise<void>;
+
+    length(callback?: (err: any, numberOfKeys: number) => void): Promise<number>;
+
+    key(keyIndex: number, callback?: (err: any, key: string) => void): Promise<string>;
+
+    keys(callback?: (err: any, keys: string[]) => void): Promise<string[]>;
+
+    iterate<T, U>(iteratee: (value: T, key: string, iterationNumber: number) => U,
+            callback?: (err: any, result: U) => void): Promise<U>;
+}
+
+interface LocalForageDropInstanceFn {
+    (dbInstanceOptions?: LocalForageDbInstanceOptions, callback?: (err: any) => void): Promise<void>;
+}
+
+interface LocalForageDriverMethodsOptional {
+    dropInstance?: LocalForageDropInstanceFn;
+}
+
+// duplicating LocalForageDriverMethodsOptional to preserve TS v2.0 support,
+// since Partial<> isn't supported there
+interface LocalForageDbMethodsOptional {
+    dropInstance: LocalForageDropInstanceFn;
+}
+
+interface LocalForageDriverDbMethods extends LocalForageDbMethodsCore, LocalForageDriverMethodsOptional {}
+
+interface LocalForageDriverSupportFunc {
+    (): Promise<boolean>;
+}
+
+interface LocalForageDriver extends LocalForageDriverDbMethods {
+    _driver: string;
+
+    _initStorage(options: LocalForageOptions): void;
+
+    _support?: boolean | LocalForageDriverSupportFunc;
+}
+
+interface LocalForageSerializer {
+    serialize<T>(value: T | ArrayBuffer | Blob, callback: (value: string, error: any) => void): void;
+
+    deserialize<T>(value: string): T | ArrayBuffer | Blob;
+
+    stringToBuffer(serializedString: string): ArrayBuffer;
+
+    bufferToString(buffer: ArrayBuffer): string;
+}
+
+interface LocalForageDbMethods extends LocalForageDbMethodsCore, LocalForageDbMethodsOptional {}
+
+interface LocalForage extends LocalForageDbMethods {
+    LOCALSTORAGE: string;
+    WEBSQL: string;
+    INDEXEDDB: string;
+
+    /**
+     * Set and persist localForage options. This must be called before any other calls to localForage are made, but can be called after localForage is loaded.
+     * If you set any config values with this method they will persist after driver changes, so you can call config() then setDriver()
+     * @param {LocalForageOptions} options?
+     */
+    config(options: LocalForageOptions): boolean;
+    config(options: string): any;
+    config(): LocalForageOptions;
+
+    /**
+     * Create a new instance of localForage to point to a different store.
+     * All the configuration options used by config are supported.
+     * @param {LocalForageOptions} options
+     */
+    createInstance(options: LocalForageOptions): LocalForage;
+
+    driver(): string;
+
+    /**
+     * Force usage of a particular driver or drivers, if available.
+     * @param {string} driver
+     */
+    setDriver(driver: string | string[], callback?: () => void, errorCallback?: (error: any) => void): Promise<void>;
+
+    defineDriver(driver: LocalForageDriver, callback?: () => void, errorCallback?: (error: any) => void): Promise<void>;
+
+    /**
+     * Return a particular driver
+     * @param {string} driver
+     */
+    getDriver(driver: string): Promise<LocalForageDriver>;
+
+    getSerializer(callback?: (serializer: LocalForageSerializer) => void): Promise<LocalForageSerializer>;
+
+    supports(driverName: string): boolean;
+
+    ready(callback?: (error: any) => void): Promise<void>;
+}
+
+declare module "localforage" {
+    let localforage: LocalForage;
+    export = localforage;
+}
diff --git a/js/reader.d.ts b/js/reader.d.ts
new file mode 100644
index 0000000..189b3bb
--- /dev/null
+++ b/js/reader.d.ts
@@ -0,0 +1,10 @@
+declare var EpubeApp: class;
+declare var localforage: LocalForage;
+declare var createHyphenator: function;
+
+declare var hyphenationPatternsEnUs: any;
+declare var hyphenationPatternsRu: any;
+
+declare interface Window { book: ePub }
+declare interface HTMLElement { checked: boolean }
+declare interface Event { deltaY: int, deltaX: int }
diff --git a/js/reader.js b/js/reader.js
index 129ad52..dbcc738 100644
--- a/js/reader.js
+++ b/js/reader.js
@@ -1,6 +1,8 @@
+// @ts-check
+
 'use strict';
 
-/* global localforage, EpubeApp, App, Cookie, $ */
+/* global localforage, EpubeApp, ePub, Cookie, AppCommon, $ */
 
 const DEFAULT_FONT_SIZE = 16;
 const DEFAULT_FONT_FAMILY = "Arial";
@@ -10,34 +12,30 @@ const MIN_LENGTH_TO_JUSTIFY = 32; /* characters */
 const LOCATION_DIVISOR = 10;
 const PAGE_RESET_PROGRESS = -1;
 
-const CACHE_PREFIX = 'epube';
-const CACHE_NAME = CACHE_PREFIX + '-v3';
-
-Promise.allSettled = Promise.allSettled || ((promises) => Promise.all(
-	promises.map((p) => p
-		.then((value) => ({
-			status: "fulfilled",
-			value
-		}))
-		.catch((reason) => ({
-			status: "rejected",
-			reason
-		}))
-	)
-));
-
-const Reader = {
-	csrf_token: "",
-	last_stored_cfi: "",
-	startup_finished: false,
-	open_last_read_when_displayed: true,
-	hyphenate: {},
-	init: function() {
+/* exported ReaderClass */
+class ReaderClass extends AppCommon {
+	csrf_token = "";
+
+	last_stored_cfi = "";
+
+	startup_finished = false;
+
+	open_last_read_when_displayed = true;
+
+	hyphenate = {};
+
+	_prevent_lastread_timeout;
+
+	_prevent_lastread;
+
+	book;
+
+	init() {
 		this.csrf_token = Cookie.get('epube_csrf_token');
 
 		console.log('setting prefilter for token', this.csrf_token);
 
-		$.ajaxPrefilter(function(options, originalOptions/*, jqXHR*/) {
+		$.ajaxPrefilter((options, originalOptions/*, jqXHR*/) => {
 
 			if (originalOptions.type !== 'post' || options.type !== 'post') {
 				return;
@@ -46,76 +44,84 @@ const Reader = {
 			const datatype = typeof originalOptions.data;
 
 			if (datatype == 'object')
-				options.data = $.param($.extend(originalOptions.data, {"csrf_token": Reader.csrf_token}));
+				options.data = $.param($.extend(originalOptions.data, {"csrf_token": this.csrf_token}));
 			else if (datatype == 'string')
-				options.data = originalOptions.data + "&csrf_token=" + encodeURIComponent(Reader.srf_token);
+				options.data = originalOptions.data + "&csrf_token=" + encodeURIComponent(this.csrf_token);
 
 			console.log('>>>', options);
 		});
 
-		$(document).on("keyup", function(e) {
-			Reader.hotkeyHandler(e);
+		$(document).on("keyup", (e) => {
+			this.hotkeyHandler(e);
 		});
 
-		$("#left").on("mouseup", function() {
-			Reader.Page.prev();
+		$("#left").on("mouseup", () => {
+			this.prevPage();
 		});
 
-		$("#right").on("mouseup", function() {
-			Reader.Page.next();
+		$("#right").on("mouseup", () => {
+			this.nextPage();
 		});
 
-		Reader.Loader.init();
-	},
+		this.loader = new ReaderLoader();
+
+		this.loader.init((load_failed) => {
+			if (!load_failed)
+				this.initSecondStage();
+			else
+				this.applyTheme(); // fade in, etc
+		});
+	}
+
 	// another method, maybe use this: window.matchMedia("(pointer: coarse)").matches
 	// https://stackoverflow.com/questions/4817029/whats-an-optimal-or-efficient-way-to-detect-a-touch-screen-device-using-javas
-	isTouchDevice: function() {
-		return (('ontouchstart' in window) ||
-			(navigator.maxTouchPoints > 0) ||
-			(navigator.msMaxTouchPoints > 0));
-	},
-	onOfflineModeChanged: function(offline) {
+	isTouchDevice() {
+		return ('ontouchstart' in window) || (navigator.maxTouchPoints > 0);
+	}
+
+	onOfflineModeChanged(offline) {
 		console.log('onOfflineModeChanged', offline);
 
-		if (!offline && window.book) {
-			const book = window.book;
+		if (!offline && this.book) {
+			const book = this.book;
 
 			console.log("we're online, storing lastread");
 
 			const currentCfi = book.rendition.currentLocation().start.cfi;
-			const currentPage = parseInt(book.locations.percentageFromCfi(currentCfi) * 100);
+			const currentPage = Math.round(book.locations.percentageFromCfi(currentCfi) * 100); // TODO wtf
 
-			$.post("backend.php", { op: "storelastread", id: $.urlParam("id"), page: currentPage,
+			$.post("backend.php", { op: "storelastread", id: this.urlParam("id"), page: currentPage,
 				cfi: currentCfi, timestamp: new Date().getTime() }, function() {
 					//
 				})
 				.fail(function(e) {
 					if (e && e.status == 401) {
-						window.location = "index.php";
+						window.location.href = "index.php";
 					}
 				});
 		}
-	},
-	initSecondStage: async function() {
+	}
+
+	async initSecondStage() {
 
 		if (typeof EpubeApp != "undefined") {
 			EpubeApp.setPage("PAGE_READER");
 		} else {
-			$(window).on('online', function() {
-				Reader.onOfflineModeChanged(false);
+			$(window).on('online', () => {
+				this.onOfflineModeChanged(false);
 			});
 
-			$(window).on('offline', function() {
-				Reader.onOfflineModeChanged(true);
+			$(window).on('offline', () => {
+				this.onOfflineModeChanged(true);
 			});
 		}
 
-		Reader.applyTheme();
+		this.applyTheme();
 
-		const bookinfo = await localforage.getItem(Reader.cacheId());
+		const bookinfo = await localforage.getItem(this.cacheId());
 
 		if (!bookinfo) {
-			const bookId = $.urlParam("b");
+			const bookId = this.urlParam("b");
 
 			console.log('requesting bookinfo for book', bookId)
 
@@ -126,10 +132,10 @@ const Reader = {
 					const cover = await fetch("backend.php?op=cover&id=" + bookId);
 
 					if (cover.ok)
-						await localforage.setItem(Reader.cacheId('cover'), cover.blob());
+						await localforage.setItem(this.cacheId('cover'), cover.blob());
 				}
 
-				await localforage.setItem(Reader.cacheId(), resp);
+				await localforage.setItem(this.cacheId(), resp);
 
 				console.log('bookinfo saved');
 
@@ -141,20 +147,20 @@ const Reader = {
 
 		console.log('trying to load book...');
 
-		let book_data = await localforage.getItem(Reader.cacheId("book"));
+		let book_data = await localforage.getItem(this.cacheId("book"));
 
 		if (!book_data) {
 			console.log("local data not found, loading from network...");
 
 			$(".loading-message").html("Downloading book…");
 
-			const book_resp = await fetch("backend.php?op=download&id=" + $.urlParam("id"));
+			const book_resp = await fetch("backend.php?op=download&id=" + this.urlParam("id"));
 
 			if (book_resp.ok) {
 				book_data = await book_resp.blob();
 
 				if (book_data) {
-					await localforage.setItem(Reader.cacheId('book'), book_data);
+					await localforage.setItem(this.cacheId('book'), book_data);
 					console.log('saved local data for book');
 				} else {
 					$(".loading-message").html("Unable to get book blob data.");
@@ -168,10 +174,11 @@ const Reader = {
 		}
 
 		const fileReader = new FileReader();
+		const _reader = this;
 
 		fileReader.onload = function() {
 			try {
-				Reader.openBookData(this.result);
+				_reader.openBookData(this.result);
 			} catch (e) {
 				console.error(e);
 				$(".loading-message").html("Unable to load book blob: " + e);
@@ -184,11 +191,13 @@ const Reader = {
 		};
 
 		fileReader.readAsArrayBuffer(book_data);
-	},
-	openBookData: async function(book_data) {
-		/* global ePub */
+	}
+
+	async openBookData(book_data) {
+		// @ts-ignore
 		const book = ePub();
-		window.book = book;
+
+		this.book = book;
 
 		try {
 			await book.open(book_data);
@@ -202,8 +211,8 @@ const Reader = {
 
 		console.log('book is ready');
 
-		await Reader.showBookInfo(book);
-		await Reader.loadLocations(book);
+		await this.showBookInfo(book);
+		await this.loadLocations(book);
 
 		const rendition = book.renderTo("reader", {
 			width: '100%',
@@ -212,37 +221,38 @@ const Reader = {
 			minSpreadWidth: 961
 		});
 
-		$(".location").on('click', async function() {
+		$(".location").on('click', async () => {
 			const current = Math.floor(rendition.currentLocation().start.location / LOCATION_DIVISOR);
 			const total = Math.floor(book.locations.length() / LOCATION_DIVISOR);
 
-			const page = prompt("Jump to location [1-" + total + "]", current);
+			const page = prompt("Jump to location [1-" + total + "]", String(current));
 
 			if (page)
-				await rendition.display(book.locations._locations[page * LOCATION_DIVISOR]);
+				await rendition.display(book.locations._locations[parseInt(page) * LOCATION_DIVISOR]);
 		});
 
 		const enable_hyphens = await localforage.getItem("epube.enable-hyphens");
 
 		if (enable_hyphens) {
 			/* global hyphenationPatternsEnUs, hyphenationPatternsRu, createHyphenator */
-			Reader.hyphenate.en = createHyphenator(hyphenationPatternsEnUs, { html: true });
-			Reader.hyphenate.ru = createHyphenator(hyphenationPatternsRu, { html: true });
+			this.hyphenate.en = createHyphenator(hyphenationPatternsEnUs, { html: true });
+			this.hyphenate.ru = createHyphenator(hyphenationPatternsRu, { html: true });
 		}
 
-		Reader.initRenditionHooks(book, rendition);
-		Reader.initModals();
-		Reader.initToc(book);
+		this.initRenditionHooks(book, rendition);
+		this.initModals();
+		this.initToc(book);
 
 		// open first page at startup, lastread will open when it is rendered
-		Reader.Page.blockLastReadUpdate();
+		this.blockLastReadUpdate();
 		await rendition.display();
 
 		console.log('startup finished');
-		Reader.startup_finished = true;
-	},
-	showBookInfo: async function(book) {
-		const bookinfo = await localforage.getItem(Reader.cacheId());
+		this.startup_finished = true;
+	}
+
+	async showBookInfo(book) {
+		const bookinfo = await localforage.getItem(this.cacheId());
 
 		let title;
 		let author;
@@ -267,9 +277,10 @@ const Reader = {
 			EpubeApp.setTitle(title);
 			EpubeApp.showActionBar(false);
 		}
-	},
-	loadLocations: async function(book) {
-		let locations = await localforage.getItem(Reader.cacheId("locations"));
+	}
+
+	async loadLocations(book) {
+		let locations = await localforage.getItem(this.cacheId("locations"));
 
 		// legacy format is array of objects {cfi: ..., page: ...}
 		if (locations && typeof locations[0] == "string") {
@@ -282,12 +293,12 @@ const Reader = {
 			}
 		}
 
-		if (App.isOnline()) {
+		if (this.isOnline()) {
 			console.log("downloading locations...");
 
 			$(".loading-message").html("Downloading locations…");
 
-			const resp = await fetch("backend.php?op=getpagination&id=" + $.urlParam("id"));
+			const resp = await fetch("backend.php?op=getpagination&id=" + this.urlParam("id"));
 
 			if (resp.ok) {
 				console.log("got locations from server");
@@ -302,7 +313,7 @@ const Reader = {
 				if (locations && typeof locations[0] == "string") {
 					console.log('saving locations locally...');
 
-					await localforage.setItem(Reader.cacheId("locations"), locations);
+					await localforage.setItem(this.cacheId("locations"), locations);
 
 					try {
 						book.locations.load(locations);
@@ -325,22 +336,23 @@ const Reader = {
 
 			// what if there's only one section or something and queue is already zero
 			if (generate_queue_max > 0) {
-				const queue_pct = parseInt((1 - queue.length() / generate_queue_max) * 100);
+				const queue_pct = Math.round((1 - queue.length() / generate_queue_max) * 100); // TODO un-wtf
 
 				$(".loading-message").html(`Preparing locations (${queue_pct}%)…`);
 			}
 		});
 
-		$.post("backend.php", { op: "storepagination", id: $.urlParam("id"),
+		$.post("backend.php", { op: "storepagination", id: this.urlParam("id"),
 			payload: JSON.stringify(locations), total: 100});
 
-		await localforage.setItem(Reader.cacheId("locations"), locations);
-	},
-	initRenditionHooks: function(book, rendition) {
+		await localforage.setItem(this.cacheId("locations"), locations);
+	}
+
+	initRenditionHooks(book, rendition) {
 		console.log('initRenditionHooks');
 
-		book.spine.hooks.content.register(function(doc/*, section */) {
-			Reader.cleanupEmbeddedStyles(doc);
+		book.spine.hooks.content.register((doc/*, section */) => {
+			this.cleanupEmbeddedStyles(doc);
 		});
 
 		rendition.hooks.content.register(async (contents) => {
@@ -348,28 +360,28 @@ const Reader = {
 			contents.on("linkClicked", (href) => {
 				console.log('linkClicked', href);
 
-				Reader.Page.blockLastReadUpdate();
+				this.blockLastReadUpdate();
 
 				if (href.indexOf("://") == -1) {
 					$(".prev_location_btn")
 						.attr("data-location-cfi", rendition.currentLocation().start.cfi)
 						.show();
 
-					window.setTimeout(function() {
-						Reader.showUI(true);
-					}, 50);
+					window.requestAnimationFrame(() => {
+						this.showUI(true);
+					});
 				}
 			});
 
 			contents.on("selected", async (cfiRange) => {
-				if (App.isOnline()) {
+				if (this.isOnline()) {
 					const range = await book.getRange(cfiRange);
 					const selection = range.endContainer.data.substring(range.startOffset, range.endOffset);
 
 					console.log('selected', cfiRange, selection);
 
 					if (selection.match(/^[\w­]+$/)) {
-						Reader.lookupWord(selection, () => {
+						this.lookupWord(selection, () => {
 							if (typeof EpubeApp != "undefined")
 								EpubeApp.showActionBar(false);
 
@@ -387,11 +399,11 @@ const Reader = {
 
 			$(contents.document.head)
 				.append($("<style type='text/css'>")
-					.text(Reader.generateFontsCss(base_url)));
+					.text(this.generateFontsCss(base_url)));
 
 			$(contents.document.head)
 				.append($("<style type='text/css'>")
-					.text(Reader.Loader._res_data[base_url + 'dist/reader_iframe.min.css']));
+					.text(this.loader._res_data[base_url + 'dist/reader_iframe.min.css']));
 
 			const theme = await localforage.getItem("epube.theme") || 'default';
 
@@ -401,7 +413,7 @@ const Reader = {
 
 			console.log('contents', contents);
 
-			$(contents.window).on("click tap", function(evt) {
+			$(contents.window).on("click tap", (evt) => {
 				if (evt.button == 0) {
 					if ($(".modal").is(":visible"))
 						return;
@@ -409,16 +421,16 @@ const Reader = {
 					if (typeof EpubeApp != "undefined")
 						EpubeApp.toggleActionBar();
 					else
-						Reader.showUI(true);
+						this.showUI(true);
 				}
 			});
 
-			$(contents.window).on("wheel", async function(evt) {
+			$(contents.window).on("wheel", async (evt) => {
 				if (await localforage.getItem("epube.enable-wheel")) {
 					if (evt.originalEvent.deltaY > 0) {
-						Reader.Page.next();
+						this.nextPage();
 					} else if (evt.originalEvent.deltaY < 0) {
-						Reader.Page.prev();
+						this.prevPage();
 					}
 				}
 			});
@@ -429,45 +441,46 @@ const Reader = {
 					$(window).on("swipeleft", function() {
 						console.log('swipe left');
 
-						Reader.Page.next();
+						this.nextPage();
 					});
 
 					$(window).on("swiperight", function() {
 						console.log('swipe right');
 
-						Reader.Page.prev();
+						this.prevPage();
 					});
 			} */
 
 		});
 
 		rendition.on("keyup", (e) => {
-			Reader.hotkeyHandler(e);
+			this.hotkeyHandler(e);
 		});
 
-		rendition.on('resized',  function(/*chapter*/) {
+		rendition.on('resized',  (/*chapter*/) => {
 			console.log('rendition resized');
 
-			Reader.Page.blockLastReadUpdate();
-			Reader.open_last_read_when_displayed = true;
+			this.blockLastReadUpdate();
+			this.open_last_read_when_displayed = true;
 		});
 
-		rendition.on('rendered', async function(section) {
+		rendition.on('rendered', async (section) => {
 			console.log('rendition rendered section', section);
 
+			// @ts-ignore
 			$(".chapter").html($("<span>").addClass("glyphicon glyphicon-th-list"));
 
-			Reader.applyTheme();
-			Reader.resizeSideColumns();
+			this.applyTheme();
+			this.resizeSideColumns();
 
 			try {
 				const location = rendition.currentLocation();
 
 				if (location.start) {
 					const cur_href = book.canonical(location.start.href);
-					let toc_entry = false;
+					let toc_entry = {};
 
-					$.each(Reader.flattenToc(book), function(i, r) {
+					$.each(this.flattenToc(book), function(i, r) {
 
 						if (book.spine.get(r.href).canonical == cur_href) {
 							toc_entry = r;
@@ -478,17 +491,17 @@ const Reader = {
 					if (toc_entry && toc_entry.label)
 						$(".chapter").append("&nbsp;" + toc_entry.label.trim() + " | ");
 
-					Reader.generateTocBar(book, Reader.flattenToc(book));
+					this.generateTocBar(book, this.flattenToc(book));
 				}
 
 			} catch (e) {
 				console.warn(e);
 			}
 
-			if (Reader.open_last_read_when_displayed) {
-				Reader.open_last_read_when_displayed = false;
+			if (this.open_last_read_when_displayed) {
+				this.open_last_read_when_displayed = false;
 
-				await Reader.Page.openLastRead();
+				await this.openLastRead();
 			}
 		});
 
@@ -497,12 +510,13 @@ const Reader = {
 			console.log('rendition displayed');
 		});
 
-		rendition.on('relocated', (location) => Reader.Page.onRelocated(book, location));
-	},
-	initModals: function() {
-		$('#settings-modal').on('shown.bs.modal', async function() {
+		rendition.on('relocated', (location) => this.onRelocated(book, location));
+	}
+
+	initModals() {
+		$('#settings-modal').on('shown.bs.modal', async () => {
 
-			const last_read = await localforage.getItem(Reader.cacheId("lastread"));
+			const last_read = await localforage.getItem(this.cacheId("lastread"));
 
 			if (last_read && last_read.cfi) {
 				$(".lastread_input")
@@ -511,7 +525,7 @@ const Reader = {
 			}
 
 			if (navigator.onLine)
-				$.post("backend.php", { op: "getlastread", id: $.urlParam("id") }, (data) => {
+				$.post("backend.php", { op: "getlastread", id: this.urlParam("id") }, (data) => {
 					$(".lastread_input")
 						.val(data.page + '%')
 						.attr('title', `[remote] ${data.cfi}`);
@@ -551,7 +565,7 @@ const Reader = {
 
 			$(".last-mod-timestamp").html(`${version}
 				&mdash; ${parseInt(stamp) ? new Date(stamp*1000).toLocaleString("en-GB") : "Unknown"}
-				(${App.isOnline() ? `<span class='text-success'>Online</span>` : `<span class='text-danger'>Offline</span>`})
+				(${this.isOnline() ? `<span class='text-success'>Online</span>` : `<span class='text-danger'>Offline</span>`})
 				`);
 
 			$(".font_family").val(await localforage.getItem("epube.fontFamily") || DEFAULT_FONT_FAMILY);
@@ -612,8 +626,11 @@ const Reader = {
 					$(".dict_result").text("Error while retrieving data.");
 				})
 		});
-	},
-	initToc: function(book) {
+	}
+
+	initToc(book) {
+		const _reader = this;
+
 		function toc_loc_msg(href) {
 			try {
 				const cfiBase = book.spine.get(href).cfiBase;
@@ -622,7 +639,7 @@ const Reader = {
 					return k.indexOf(cfiBase) != -1
 				});
 
-				return parseInt(window.book.locations.locationFromCfi(loc) / LOCATION_DIVISOR);
+				return Math.round(_reader.book.locations.locationFromCfi(loc) / LOCATION_DIVISOR);
 
 			} catch (e) {
 				console.warn(e);
@@ -697,9 +714,10 @@ const Reader = {
 					const a = $("<a>")
 						.attr('href', '#')
 						.attr('title', row.url)
-						.html("Section " + (i+1))
+						// @ts-ignore
+						.html(`Section ${i+1}`)
 						.attr('data-href', row.href)
-						.click(function() {
+						.on('click', () => {
 							book.rendition.display(a.attr('data-href'));
 						});
 
@@ -709,10 +727,12 @@ const Reader = {
 			}
 
 		});
-	},
+	}
+
 	/* embedded styles may conflict with our font sizes, etc */
-	cleanupEmbeddedStyles: function(doc) {
+	cleanupEmbeddedStyles(doc) {
 		$(doc).find("p")
+				// @ts-ignore
 				.filter((i, e) => (($(e).text().length >= MIN_LENGTH_TO_JUSTIFY) ? e : null))
 					.css("text-align", "justify");
 
@@ -743,43 +763,44 @@ const Reader = {
 			.css("background", "")
 			.css("background-color", "");
 
-		if (typeof Reader.hyphenate.en != "undefined") {
-			$(doc).find('p, div').each((i,p) => {
-				p = $(p);
+		if (typeof this.hyphenate.en != "undefined") {
+			$(doc).find('p, div').each((i, elem) => {
+				const p = $(elem);
 
-				p.html(Reader.hyphenate.en(p.html()));
-				p.html(Reader.hyphenate.ru(p.html()));
+				p.html(this.hyphenate.en(p.html()));
+				p.html(this.hyphenate.ru(p.html()));
 			});
 		}
-	},
-	generateFontsCss: function(base_url) {
+	}
+
+	generateFontsCss(base_url) {
 		return `
 			/** Calibri */
 
 			@font-face {
 				font-family: 'Calibri';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/calibriz.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/calibriz.ttf']});
 				font-style: italic;
 				font-weight : 700;
 			}
 
 			@font-face {
 				font-family: 'Calibri';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/calibrib.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/calibrib.ttf']});
 				font-style: normal;
 				font-weight : 700;
 			}
 
 			@font-face {
 				font-family: 'Calibri';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/calibrii.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/calibrii.ttf']});
 				font-style: italic;
 				font-weight : 400;
 			}
 
 			@font-face {
 				font-family: 'Calibri';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/calibri.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/calibri.ttf']});
 				font-style: normal;
 				font-weight : 400;
 			}
@@ -788,28 +809,28 @@ const Reader = {
 
 			@font-face {
 				font-family: 'Cambria';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/cambriab.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/cambriab.ttf']});
 				font-style: normal;
 				font-weight : 700;
 			}
 
 			@font-face {
 				font-family: 'Cambria';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/cambriaz.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/cambriaz.ttf']});
 				font-style: italic;
 				font-weight : 700;
 			}
 
 			@font-face {
 				font-family: 'Cambria';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/cambriai.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/cambriai.ttf']});
 				font-style: italic;
 				font-weight : 400;
 			}
 
 			@font-face {
 				font-family: 'Cambria';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/cambria.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/cambria.ttf']});
 				font-style: normal;
 				font-weight : 400;
 			}
@@ -818,19 +839,19 @@ const Reader = {
 
 			@font-face {
 				font-family: Caecilia;
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/caecilia.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/caecilia.ttf']});
 				font-weight : normal;
 			}
 
 			@font-face {
 				font-family: Caecilia;
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/caeciliab.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/caeciliab.ttf']});
 				font-weight : bold;
 			}
 
 			@font-face {
 				font-family: Caecilia;
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/caeciliai.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/caeciliai.ttf']});
 				font-style : italic;
 			}
 
@@ -838,28 +859,28 @@ const Reader = {
 
 			@font-face {
 				font-family: 'Palatino';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/palab.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/palab.ttf']});
 				font-style: normal;
 				font-weight : 700;
 			}
 
 			@font-face {
 				font-family: 'Palatino';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/palabi.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/palabi.ttf']});
 				font-style: italic;
 				font-weight : 700;
 			}
 
 			@font-face {
 				font-family: 'Palatino';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/palai.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/palai.ttf']});
 				font-style: italic;
 				font-weight : 400;
 			}
 
 			@font-face {
 				font-family: 'Palatino';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/pala.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/pala.ttf']});
 				font-style: normal;
 				font-weight : 400;
 			}
@@ -868,28 +889,28 @@ const Reader = {
 
 			@font-face {
 				font-family: 'Consolas';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/consolab.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/consolab.ttf']});
 				font-style: normal;
 				font-weight : 700;
 			}
 
 			@font-face {
 				font-family: 'Consolas';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/consolaz.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/consolaz.ttf']});
 				font-style: italic;
 				font-weight : 700;
 			}
 
 			@font-face {
 				font-family: 'Consolas';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/consolai.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/consolai.ttf']});
 				font-style: italic;
 				font-weight : 400;
 			}
 
 			@font-face {
 				font-family: 'Consolas';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/consola.ttf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/consola.ttf']});
 				font-style: normal;
 				font-weight : 400;
 			}
@@ -898,68 +919,71 @@ const Reader = {
 
 			@font-face {
 				font-family: 'IBM Plex Mono';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/IBMPlexMono-Bold.otf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/IBMPlexMono-Bold.otf']});
 				font-style: normal;
 				font-weight : 700;
 			}
 
 			@font-face {
 				font-family: 'IBM Plex Mono';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/IBMPlexMono-BoldItalic.otf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/IBMPlexMono-BoldItalic.otf']});
 				font-style: italic;
 				font-weight : 700;
 			}
 
 			@font-face {
 				font-family: 'IBM Plex Mono';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/IBMPlexMono-TextItalic.otf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/IBMPlexMono-TextItalic.otf']});
 				font-style: italic;
 				font-weight : 400;
 			}
 
 			@font-face {
 				font-family: 'IBM Plex Mono';
-				src: url(${Reader.Loader._res_data[base_url + 'lib/fonts/IBMPlexMono-Text.otf']});
+				src: url(${this.loader._res_data[base_url + 'lib/fonts/IBMPlexMono-Text.otf']});
 				font-style: normal;
 				font-weight : 400;
 			}
 			`;
-	},
-	flattenTocSubItems: function(entry, nest) {
+	}
+
+	flattenTocSubItems(entry, nest) {
 		let rv = [];
 
 		if (nest == 3) return false;
 
 		if (entry.subitems) {
-			$.each(entry.subitems, function (i, r) {
+			$.each(entry.subitems, (i, r) => {
 				r._nest = nest;
 
 				rv.push(r);
-				rv = rv.concat(Reader.flattenTocSubItems(r, nest+1));
+				rv = rv.concat(this.flattenTocSubItems(r, nest+1));
 			});
 		}
 
 		return rv;
-	},
-	flattenToc: function(book) {
+	}
+
+	flattenToc(book) {
 		if (this._flattened_toc) {
 			return this._flattened_toc;
 		} else {
 			let rv = [];
 
-			$.each(book.navigation.toc, function(i, r) {
+			$.each(book.navigation.toc, (i, r) => {
 				r._nest = 0;
 
 				rv.push(r);
-				rv = rv.concat(Reader.flattenTocSubItems(r, 1));
+				rv = rv.concat(this.flattenTocSubItems(r, 1));
 			});
 
 			this._flattened_toc = rv;
 
 			return rv;
 		}
-	},
-	generateTocBar: function(book, toc) {
+	}
+
+	generateTocBar(book, toc) {
 		$(".spacer")
 			.html("");
 
@@ -990,15 +1014,17 @@ const Reader = {
 
 		$(".spacer").append($("<div class='toc-bar-entry current-position'>"));
 
-		Reader.updateTocBarPosition(book, book.rendition.currentLocation())
-	},
-	updateTocBarPosition: function(book, location) {
+		this.updateTocBarPosition(book, book.rendition.currentLocation())
+	}
+
+	updateTocBarPosition(book, location) {
 		const cur_pct = Math.round(location.start.location / book.locations.length() * 100);
 
 		$(".toc-bar-entry.current-position")
 				.css('left', cur_pct + '%');
-	},
-	applyTheme: async function() {
+	}
+
+	async applyTheme() {
 		let fontSize = await localforage.getItem("epube.fontSize");
 		let fontFamily = await localforage.getItem("epube.fontFamily");
 		let lineHeight = await localforage.getItem("epube.lineHeight");
@@ -1010,8 +1036,8 @@ const Reader = {
 		console.log('style', fontFamily, fontSize, lineHeight);
 		console.log('applying default theme styles...');
 
-		if (window.book && window.book.rendition)
-			window.book.rendition.themes.default({
+		if (this.book && this.book.rendition)
+			this.book.rendition.themes.default({
 				html: {
 					'font-size': fontSize,
 					'font-family': "'" + fontFamily + "'",
@@ -1063,8 +1089,8 @@ const Reader = {
 			}, 250);
 		}
 
-		if (window.book && window.book.rendition)
-			window.book.rendition.getContents().forEach((rendition) => {
+		if (this.book && this.book.rendition)
+			this.book.rendition.getContents().forEach((rendition) => {
 				console.log(`applying styles and theme ${theme} to `, rendition);
 
 				rendition.css("font-size", fontSize);
@@ -1076,8 +1102,9 @@ const Reader = {
 					.attr("class", typeof EpubeApp != "undefined" ? "is-epube-app" : "")
 					.addClass("theme-" + theme);
 			});
-	},
-	hotkeyHandler: function(e) {
+	}
+
+	hotkeyHandler(e) {
 		try {
 			//console.log('K3:' + e.which, e);
 
@@ -1087,94 +1114,101 @@ const Reader = {
 			// right or space or pagedown
 			if (e.which == 39 || e.which == 32 || e.which == 34) {
 				e.preventDefault();
-				Reader.Page.next();
+				this.nextPage();
 			}
 
 			// left or pageup
 			if (e.which == 37 || e.which == 33) {
 				e.preventDefault();
-				Reader.Page.prev();
+				this.prevPage();
 			}
 
 			// esc
 			if (e.which == 27) {
 				e.preventDefault();
-				Reader.showUI(true);
+				this.showUI(true);
 			}
 		} catch (e) {
 			console.warn(e);
 		}
-	},
-	resizeSideColumns: function() {
+	}
+
+	resizeSideColumns() {
 		let width = $("#reader").position().left;
 
-		if (window.book && window.book.rendition)
-			window.book.rendition.getContents().forEach((rendition) => {
+		if (this.book && this.book.rendition)
+			this.book.rendition.getContents().forEach((rendition) => {
 				width += parseInt(rendition.window.getComputedStyle(rendition.document.querySelector('body')).getPropertyValue('padding-left'));
 			});
 
 		console.log(`resizing side columns to ${width} px`);
 
 		$("#left, #right").width(width);
-	},
-	markAsRead: async function() {
+	}
+
+	async markAsRead() {
 		if (confirm("Mark book as read?")) {
 			$("#settings-modal").modal('hide');
 
 			const total = 100;
-			const lastCfi = window.book.locations.cfiFromPercentage(1);
+			const lastCfi = this.book.locations.cfiFromPercentage(1);
 			const lastread_timestamp = new Date().getTime();
 
-			if (App.isOnline()) {
-				const data = await $.post("backend.php", { op: "storelastread", page: total, cfi: lastCfi, id: $.urlParam("id"), timestamp: lastread_timestamp });
+			if (this.isOnline()) {
+				const data = await $.post("backend.php", { op: "storelastread", page: total, cfi: lastCfi, id: this.urlParam("id"), timestamp: lastread_timestamp });
 				$(".lastread_input").val(data.page + '%');
 			}
 
-			await localforage.setItem(Reader.cacheId("lastread"),
+			await localforage.setItem(this.cacheId("lastread"),
 				{cfi: lastCfi, page: total, total: total, timestamp: lastread_timestamp});
 
-			await Reader.Page.openLastRead();
+			await this.openLastRead();
 		}
-	},
-	close: async function() {
-		const location = window.book.rendition.currentLocation();
+	}
+
+	async close() {
+		const location = this.book.rendition.currentLocation();
 
 		const currentCfi = location.start.cfi;
-		const currentPage = parseInt(window.book.locations.percentageFromCfi(currentCfi) * 100);
+		const currentPage = Math.round(this.book.locations.percentageFromCfi(currentCfi) * 100);
 		const totalPages = 100;
 		const lastread_timestamp = new Date().getTime();
 
-		await localforage.setItem(Reader.cacheId("lastread"),
+		await localforage.setItem(this.cacheId("lastread"),
 			{cfi: currentCfi, page: currentPage, total: totalPages, timestamp: lastread_timestamp});
 
-		if (App.isOnline()) {
-			$.post("backend.php", { op: "storelastread", id: $.urlParam("id"), page: currentPage,
-				cfi: currentCfi, timestamp: lastread_timestamp }, function() {
-				window.location = $.urlParam("rt") ? "index.php?mode=" + $.urlParam("rt") : "index.php";
+		if (this.isOnline()) {
+			$.post("backend.php", { op: "storelastread", id: this.urlParam("id"), page: currentPage,
+				cfi: currentCfi, timestamp: lastread_timestamp }, () => {
+				window.location.href = this.urlParam("rt") ? "index.php?mode=" + this.urlParam("rt") : "index.php";
 			})
-				.fail(function() {
-					window.location = "index.php";
+				.fail(() => {
+					window.location.href = "index.php";
 				});
 		} else {
-			window.location = "index.php";
+			window.location.href = "index.php";
 		}
-	},
-	cacheId: function(suffix) {
-		return "epube-book." + $.urlParam("b") + (suffix ? "." + suffix : "");
-	},
-	showUI: function(show) {
+	}
+
+	cacheId(suffix) {
+		return "epube-book." + this.urlParam("b") + (suffix ? "." + suffix : "");
+	}
+
+	showUI(show) {
 		if (show)
 			$(".header,.footer").fadeIn();
 		else
 			$(".header,.footer").fadeOut();
-	},
-	toggleUI: function() {
+	}
+
+	toggleUI() {
 		if ($(".header").is(":visible"))
 			$(".header,.footer").fadeOut();
 		else
 			$(".header,.footer").fadeIn();
-	},
-	lookupWord: async function(word, callback) {
+	}
+
+	async lookupWord(word, callback) {
 		word = word.replace(/­/g, "");
 
 		console.log('lookupWord', word);
@@ -1198,8 +1232,9 @@ const Reader = {
 
 			$(".dict_result").html(`Network error while looking up word: ${e.responseText}.`);
 		}
-	},
-	search: function() {
+	}
+
+	search() {
 		const query = $(".search_input").val();
 		const list = $(".search_results");
 
@@ -1210,359 +1245,359 @@ const Reader = {
 
 			/* eslint-disable prefer-spread */
 			Promise.all(
-				window.book.spine.spineItems.map(
-					(item) => item.load(window.book.load.bind(window.book))
+				this.book.spine.spineItems.map(
+					(item) => item.load(this.book.load.bind(this.book))
 						.then(item.find.bind(item, query))
 						.finally(item.unload.bind(item)))
 			)
 				.then((results) => Promise.resolve([].concat.apply([], results)))
-				.then(function(results) {
+				.then((results) => {
 					list.html("");
 
-					$.each(results, function (i, row) {
+					$.each(results, (i, row) => {
 						const a = $("<a>")
 							.attr('href', '#')
-							.html("<b class='pull-right'>" + window.book.locations.locationFromCfi(row.cfi) + "</b>" + row.excerpt)
+							.html("<b class='pull-right'>" + this.book.locations.locationFromCfi(row.cfi) + "</b>" + row.excerpt)
 							.attr('data-cfi', row.cfi)
 							.attr('data-id', row.id)
-							.click(function() {
-								window.book.rendition.display(a.attr('data-cfi'));
+							.on('click', () => {
+								this.book.rendition.display(a.attr('data-cfi'));
 							});
 
 						list.append($("<li>").append(a));
 					});
 				});
 		}
-	},
-	Loader: {
-		_res_data: [],
-		init: async function() {
-			if (typeof EpubeApp != "undefined") {
-				$("body").addClass("epube-app");
-			}
+	}
 
-			// we need to manually provide resources for reader iframe because service worker fetch() handler doesn't work inside iframes (chrome bug?)
+	nextPage() {
+			this.book.rendition.next();
 
-			const promises = [];
-			let load_failed = false;
+			if (typeof EpubeApp != "undefined")
+				EpubeApp.showActionBar(false);
+			else
+				localforage.getItem("epube.keep-ui-visible").then((keep) => {
+					if (!keep) this.showUI(false);
+				});
+	}
 
-			const cache = await caches.open(CACHE_NAME);
-			const cache_keys = await cache.keys();
+	prevPage() {
+		this.book.rendition.prev();
 
-			cache_keys.forEach((req) => {
-				if (!req.url.match('backend\.php')) {
-					console.log('[loader] loading resource', req.url);
-					const promise = fetch(req.url).then(async (resp) => {
-						if (resp.ok) {
-							const url = new URL(resp.url);
-							url.searchParams.delete("ts");
+		if (typeof EpubeApp != "undefined")
+			EpubeApp.showActionBar(false);
+		else
+			localforage.getItem("epube.keep-ui-visible").then((keep) => {
+				if (!keep) this.showUI(false);
+			});
+	}
 
-							if (resp.url.match('\\.ttf|\\.otf')) {
-								const blob = await resp.blob();
-								console.log('[loader] storing blob', url.href);
+	async openPrevious(elem) {
+		const cfi = $(elem).attr("data-location-cfi");
 
-								Reader.Loader._res_data[url.toString()] = URL.createObjectURL(blob);
-							} else {
-								const text = await resp.text();
-								console.log('[loader] storing text', url.href);
+		if (cfi)
+			await this.book.rendition.display(cfi);
 
-								Reader.Loader._res_data[url.toString()] = text;
-							}
-						} else {
-							console.warn('[loader] failed for resource', req.url, resp);
+		$(elem).fadeOut();
+	}
 
-							$(".loading-message").html(`Unable to load resource.<br/><small>${req.url}</small>`);
+	blockLastReadUpdate() {
+		console.log('blocking last read updates...');
 
-							load_failed = true;
-						}
-					});
+		if (this._prevent_lastread_timeout)
+			window.clearTimeout(this._prevent_lastread_timeout);
 
-					promises.push(promise);
-				}
-			});
+		this._prevent_lastread_timeout = window.setTimeout(() => {
+			this._prevent_lastread = false;
+			this._prevent_lastread_timeout = false;
+			console.log('unblocked last read updates');
+		}, 1000);
 
-			await Promise.allSettled(promises);
+		this._prevent_lastread = true;
+	}
 
-			console.log('[loader] resource load complete, failed: ', load_failed);
+	async onRelocated(book, location) {
+		// locations not generated yet
+		if (book.locations.length() == 0)
+			return;
 
-			if (!load_failed)
-				Reader.initSecondStage();
-			else
-				Reader.applyTheme(); // fade in, etc
+		const currentCfi = location.start.cfi;
+		const currentPct = Math.round(book.locations.percentageFromCfi(currentCfi) * 100);
 
-		},
-	},
-	Page: {
-		_prevent_lastread_timeout: false,
-		_prevent_lastread: false,
-		next: function() {
-			window.book.rendition.next();
+		$("#cur_page").text(Math.floor(location.start.location / LOCATION_DIVISOR));
+		$("#total_pages").text(Math.floor(book.locations.length() / LOCATION_DIVISOR));
+		$("#page_pct").text(Math.round(book.locations.percentageFromCfi(currentCfi)*100) + '%');
 
-			if (typeof EpubeApp != "undefined")
-				EpubeApp.showActionBar(false);
-			else
-				localforage.getItem("epube.keep-ui-visible").then(function(keep) {
-					if (!keep) Reader.showUI(false);
-				});
-		},
-		prev: function() {
-			window.book.rendition.prev();
+		this.updateTocBarPosition(book, location);
 
-			if (typeof EpubeApp != "undefined")
-				EpubeApp.showActionBar(false);
-			else
-				localforage.getItem("epube.keep-ui-visible").then(function(keep) {
-					if (!keep) Reader.showUI(false);
-				});
-		},
-		openPrevious: async function(elem) {
-			const cfi = $(elem).attr("data-location-cfi");
-
-			if (cfi)
-				await window.book.rendition.display(cfi);
-
-			$(elem).fadeOut();
-		},
-		blockLastReadUpdate: function() {
-			console.log('blocking last read updates...');
-
-			if (Reader.Page._prevent_lastread_timeout)
-				window.clearTimeout(Reader.Page._prevent_lastread_timeout);
-
-			Reader.Page._prevent_lastread_timeout = window.setTimeout(() => {
-				Reader.Page._prevent_lastread = false;
-				Reader.Page._prevent_lastread_timeout = false;
-				console.log('unblocked last read updates');
-			}, 1000);
-
-			Reader.Page._prevent_lastread = true;
-		},
-		onRelocated: async function (book, location) {
-			// locations not generated yet
-			if (book.locations.length() == 0)
-				return;
+		const displayed = location.start.displayed;
 
-			const currentCfi = location.start.cfi;
-			const currentPct = parseInt(book.locations.percentageFromCfi(currentCfi) * 100);
+		if (displayed) {
+			$("#chapter_cur_page").text(displayed.page);
+			$("#chapter_total_pages").text(displayed.total);
 
-			$("#cur_page").text(Math.floor(location.start.location / LOCATION_DIVISOR));
-			$("#total_pages").text(Math.floor(book.locations.length() / LOCATION_DIVISOR));
-			$("#page_pct").text(parseInt(book.locations.percentageFromCfi(currentCfi)*100) + '%');
+			if (displayed.total > 0)
+				$("#chapter_pct").text(Math.round(displayed.page / displayed.total * 100) + '%')
+		}
 
-			Reader.updateTocBarPosition(book, location);
+		if (this.startup_finished && this.last_stored_cfi != currentCfi && !this._prevent_lastread) {
+			const lastread_timestamp = new Date().getTime();
 
-			const displayed = location.start.displayed;
+			console.log("storing lastread", currentPct, currentCfi, lastread_timestamp);
 
-			if (displayed) {
-				$("#chapter_cur_page").text(displayed.page);
-				$("#chapter_total_pages").text(displayed.total);
+			await localforage.setItem(this.cacheId("lastread"),
+				{cfi: currentCfi, page: currentPct, total: 100, timestamp: lastread_timestamp});
 
-				if (displayed.total > 0)
-					$("#chapter_pct").text(parseInt(displayed.page / displayed.total * 100) + '%')
-			}
+			if (this.isOnline()) {
+				console.log("updating remote lastread", currentCfi);
+				this.last_stored_cfi = currentCfi;
 
-			if (Reader.startup_finished && Reader.last_stored_cfi != currentCfi && !Reader.Page._prevent_lastread) {
-				const lastread_timestamp = new Date().getTime();
-
-				console.log("storing lastread", currentPct, currentCfi, lastread_timestamp);
+				$.post("backend.php", { op: "storelastread", id: this.urlParam("id"), page: currentPct,
+					cfi: currentCfi, timestamp: lastread_timestamp });
+			}
+		}
+	}
 
-				await localforage.setItem(Reader.cacheId("lastread"),
-					{cfi: currentCfi, page: currentPct, total: 100, timestamp: lastread_timestamp});
+	async clearLastRead() {
+		if (confirm("Reset reading progress for this book?")) {
+			$("#settings-modal").modal('hide');
 
-				if (App.isOnline()) {
-					console.log("updating remote lastread", currentCfi);
-					Reader.last_stored_cfi = currentCfi;
+			const total = this.book.locations.length();
+			const lastread_timestamp = new Date().getTime();
 
-					$.post("backend.php", { op: "storelastread", id: $.urlParam("id"), page: currentPct,
-						cfi: currentCfi, timestamp: lastread_timestamp });
-				}
-			}
-		},
-		clearLastRead: async function() {
-			if (confirm("Reset reading progress for this book?")) {
-				$("#settings-modal").modal('hide');
+			if (this.isOnline())
+				await $.post("backend.php", { op: "storelastread", page: PAGE_RESET_PROGRESS, cfi: "", id: this.urlParam("id"), timestamp: lastread_timestamp });
 
-				const total = window.book.locations.length();
-				const lastread_timestamp = new Date().getTime();
+			await localforage.setItem(this.cacheId("lastread"),
+				{cfi: "", page: 0, total: total, timestamp: lastread_timestamp});
 
-				if (App.isOnline())
-					await $.post("backend.php", { op: "storelastread", page: PAGE_RESET_PROGRESS, cfi: "", id: $.urlParam("id"), timestamp: lastread_timestamp });
+			await this.book.rendition.display(this.book.locations.cfiFromPercentage(0));
 
-				await localforage.setItem(Reader.cacheId("lastread"),
-					{cfi: "", page: 0, total: total, timestamp: lastread_timestamp});
+			$(".lastread_input").val('0%');
+		}
+	}
 
-				await window.book.rendition.display(window.book.locations.cfiFromPercentage(0));
+	async resetLocations() {
+		if (confirm("Reset stored pagination data? This will also reset reading progress.")) {
+			$("#settings-modal").modal('hide');
 
-				$(".lastread_input").val('0%');
-			}
-		},
-		resetLocations: async function() {
-			if (confirm("Reset stored pagination data? This will also reset reading progress.")) {
-				$("#settings-modal").modal('hide');
+			await localforage.removeItem(this.cacheId("lastread"));
+			await localforage.removeItem(this.cacheId("locations"));
 
-				await localforage.removeItem(Reader.cacheId("lastread"));
-				await localforage.removeItem(Reader.cacheId("locations"));
+			await $.post("backend.php", { op: "storelastread", page: PAGE_RESET_PROGRESS, cfi: "", id: this.urlParam("id"), timestamp: new Date().getTime() })
 
-				await $.post("backend.php", { op: "storelastread", page: PAGE_RESET_PROGRESS, cfi: "", id: $.urlParam("id"), timestamp: new Date().getTime() })
+			// this might return 404 and its okay
+			await $.post("backend.php",
+				{ op: "deletepagination", id: this.urlParam("id") }).catch((e) => console.log(e))
 
-				// this might return 404 and its okay
-				await $.post("backend.php",
-					{ op: "deletepagination", id: $.urlParam("id") }).catch((e) => console.log(e))
+			window.location.reload();
+		}
+	}
 
-				window.location.reload();
-			}
-		},
-		openLastRead: async function() {
-			$(".loading").show();
-			$(".loading-message").html("Opening last read page…");
+	async openLastRead() {
+		$(".loading").show();
+		$(".loading-message").html("Opening last read page…");
 
-			$("#settings-modal").modal('hide');
+		$("#settings-modal").modal('hide');
 
-			const rendition = window.book.rendition;
+		const rendition = this.book.rendition;
 
-			if (!rendition) {
-				console.error('no rendition to work on');
-				return;
-			}
+		if (!rendition) {
+			console.error('no rendition to work on');
+			return;
+		}
 
-			let location_found = false;
+		let location_found = false;
 
-			const lr_local = await localforage.getItem(Reader.cacheId("lastread")) || {};
-			console.log('got local lastread', lr_local);
+		const lr_local = await localforage.getItem(this.cacheId("lastread")) || {};
+		console.log('got local lastread', lr_local);
 
-			if (App.isOnline()) {
-				try {
-					const lr_remote = await $.post("backend.php", { op: "getlastread", id: $.urlParam("id") });
+		if (this.isOnline()) {
+			try {
+				const lr_remote = await $.post("backend.php", { op: "getlastread", id: this.urlParam("id") });
 
-					console.log('got remote lastread', lr_remote);
+				console.log('got remote lastread', lr_remote);
 
-					if (lr_remote) {
-						if (lr_remote.cfi && lr_local.cfi != lr_remote.cfi && (lr_remote.page >= (lr_local.page || 0))) {
-							console.log(`using remote lastread cfi ${lr_remote.cfi}: cfi is different and remote pct ${lr_remote.page}% is further than local pct ${lr_local.page}%`);
+				if (lr_remote) {
+					if (lr_remote.cfi && lr_local.cfi != lr_remote.cfi && (lr_remote.page >= (lr_local.page || 0))) {
+						console.log(`using remote lastread cfi ${lr_remote.cfi}: cfi is different and remote pct ${lr_remote.page}% is further than local pct ${lr_local.page}%`);
 
-							await localforage.setItem(Reader.cacheId("lastread"),
-								{cfi: lr_remote.cfi, page: lr_remote.page, total: lr_remote.total, timestamp: lr_remote.timestamp});
+						await localforage.setItem(this.cacheId("lastread"),
+							{cfi: lr_remote.cfi, page: lr_remote.page, total: lr_remote.total, timestamp: lr_remote.timestamp});
 
-							location_found = await Reader.Page.moveToCfiVerify(rendition, lr_remote.cfi);
-						}
+						location_found = await this.moveToCfiVerify(rendition, lr_remote.cfi);
 					}
-				} catch (e) {
-					console.log('unable to get remote lastread, continuing...');
-					console.warn(e);
 				}
+			} catch (e) {
+				console.log('unable to get remote lastread, continuing...');
+				console.warn(e);
 			}
+		}
 
-			// for some reason this might not actually open *exact* CFI but it should generally be close enough after a few attempts,
-			// that's why we no longer reset to page 1 after trying local CFI
-			if (!location_found) {
-				if (lr_local && lr_local.cfi) {
-					console.log(`using local lastread cfi: ${lr_local.cfi}`);
-					try {
-						await Reader.Page.moveToCfiVerify(rendition, lr_local.cfi);
-					} catch (e) {
-						console.warn(e);
-					}
+		// for some reason this might not actually open *exact* CFI but it should generally be close enough after a few attempts,
+		// that's why we no longer reset to page 1 after trying local CFI
+		if (!location_found) {
+			if (lr_local && lr_local.cfi) {
+				console.log(`using local lastread cfi: ${lr_local.cfi}`);
+				try {
+					await this.moveToCfiVerify(rendition, lr_local.cfi);
+				} catch (e) {
+					console.warn(e);
 				}
 			}
+		}
 
-			$(".loading").fadeOut();
-		},
-		calculateCfiDelta: function(a, b) {
-			const acfi = new ePub.CFI(a);
-			const bcfi = new ePub.CFI(b);
+		$(".loading").fadeOut();
+	}
 
-			console.log('calculateCfiDelta', acfi, bcfi);
+	calculateCfiDelta(a, b) {
+		// @ts-ignore
+		const acfi = new ePub.CFI(a);
+		// @ts-ignore
+		const bcfi = new ePub.CFI(b);
 
-			if (acfi.path.steps.length != bcfi.path.steps.length)
-				return -1;
+		console.log('calculateCfiDelta', acfi, bcfi);
 
-			let delta = 0;
+		if (acfi.path.steps.length != bcfi.path.steps.length)
+			return -1;
 
-			// this is about as ad-hoc as it gets...
-			for (let i = 0; i < acfi.path.steps.length; i++) {
+		let delta = 0;
 
-				// is this possible? who knows!
-				if (acfi.path.steps[i].type != bcfi.path.steps[i].type)
-					return -1;
+		// this is about as ad-hoc as it gets...
+		for (let i = 0; i < acfi.path.steps.length; i++) {
 
-				// different "filepos" or w/e
-				if (acfi.path.steps[i].id != bcfi.path.steps[i].id)
-					return -1;
+			// is this possible? who knows!
+			if (acfi.path.steps[i].type != bcfi.path.steps[i].type)
+				return -1;
 
-				if (acfi.path.steps[i].id === null && acfi.path.steps[i].type === 'element')
-					delta += Math.abs(acfi.path.steps[i].index - bcfi.path.steps[i].index);
-			}
+			// different "filepos" or w/e
+			if (acfi.path.steps[i].id != bcfi.path.steps[i].id)
+				return -1;
 
-			return delta;
-		},
-		moveToCfiVerify: async function(rendition, cfi, attempts = 5, maxDelta = 5) {
-			for (let att = 1; att < attempts; att++) {
-				Reader.Page.blockLastReadUpdate();
+			if (acfi.path.steps[i].id === null && acfi.path.steps[i].type === 'element')
+				delta += Math.abs(acfi.path.steps[i].index - bcfi.path.steps[i].index);
+		}
 
-				console.log(`trying to open ${cfi}: attempt ${att} of ${attempts}...`);
+		return delta;
+	}
 
-				/* eslint-disable no-await-in-loop */
-				await rendition.display(cfi); // we need to be synchronous here
+	async moveToCfiVerify(rendition, cfi, attempts = 5, maxDelta = 5) {
+		for (let att = 1; att < attempts; att++) {
+			this.blockLastReadUpdate();
 
-				let moved_to = false;
+			console.log(`trying to open ${cfi}: attempt ${att} of ${attempts}...`);
 
-				try {
-					moved_to = rendition.currentLocation().start.cfi;
-				} catch (e) {
-					console.warn('location not yet available, will retry:', e);
-				}
+			/* eslint-disable no-await-in-loop */
+			await rendition.display(cfi); // we need to be synchronous here
 
-				try {
-					const delta = Reader.Page.calculateCfiDelta(cfi, moved_to);
+			let moved_to = false;
 
-					console.log(`opened cfi ${moved_to} expected ${cfi}; delta: ${delta}`);
+			try {
+				moved_to = rendition.currentLocation().start.cfi;
+			} catch (e) {
+				console.warn('location not yet available, will retry:', e);
+			}
 
-					if (moved_to == cfi || (delta != -1 && delta <= maxDelta)) {
-						console.log("cfi move verified!");
-						return true;
-					}
-				} catch (e) {
-					console.warn('exception while parsing cfi, will retry: ', e);
+			try {
+				const delta = this.calculateCfiDelta(cfi, moved_to);
+
+				console.log(`opened cfi ${moved_to} expected ${cfi}; delta: ${delta}`);
+
+				if (moved_to == cfi || (delta != -1 && delta <= maxDelta)) {
+					console.log("cfi move verified!");
+					return true;
 				}
+			} catch (e) {
+				console.warn('exception while parsing cfi, will retry: ', e);
 			}
-
-			return false;
-		},
-	},
-	Settings: {
-		onThemeChanged: async function(elem) {
-			const theme = $(elem).val();
-
-			await localforage.setItem("epube.theme", theme);
-			Reader.applyTheme();
-		},
-		onLineHeightChanged: async function(elem) {
-			const height = $(elem).val();
-
-			await localforage.setItem("epube.lineHeight", height);
-			Reader.applyTheme();
-		},
-		onTextSizeChanged: async function(elem) {
-			const size = $(elem).val();
-
-			await localforage.setItem("epube.fontSize", size);
-			Reader.applyTheme();
-		},
-		onFontChanged: async function(elem) {
-			const font = $(elem).val();
-
-			await localforage.setItem("epube.fontFamily", font);
-			Reader.applyTheme();
 		}
+
+		return false;
+	}
+
+	async onThemeChanged(elem) {
+		const theme = $(elem).val();
+
+		await localforage.setItem("epube.theme", theme);
+		this.applyTheme();
+	}
+
+	async onLineHeightChanged(elem) {
+		const height = $(elem).val();
+
+		await localforage.setItem("epube.lineHeight", height);
+		this.applyTheme();
+	}
+
+	async onTextSizeChanged(elem) {
+		const size = $(elem).val();
+
+		await localforage.setItem("epube.fontSize", size);
+		this.applyTheme();
 	}
-};
 
-/* exported __get_reader */
-function __get_reader() {
-	return Reader;
+	async onFontChanged(elem) {
+		const font = $(elem).val();
+
+		await localforage.setItem("epube.fontFamily", font);
+		this.applyTheme();
+	}
 }
 
-/* exported __get_app */
-function __get_app() {
-	return App;
+class ReaderLoader {
+	_res_data = [];
+
+	CACHE_NAME = 'epube-v3';
+
+	async init(callback) {
+		if (typeof EpubeApp != "undefined") {
+			$("body").addClass("epube-app");
+		}
+
+		// we need to manually provide resources for reader iframe because service worker fetch() handler doesn't work inside iframes (chrome bug?)
+
+		const promises = [];
+		let load_failed = false;
+
+		const cache = await caches.open(this.CACHE_NAME);
+		const cache_keys = await cache.keys();
+
+		cache_keys.forEach((req) => {
+			if (!req.url.match('backend\.php')) {
+				console.log('[loader] loading resource', req.url);
+				const promise = fetch(req.url).then(async (resp) => {
+					if (resp.ok) {
+						const url = new URL(resp.url);
+						url.searchParams.delete("ts");
+
+						if (resp.url.match('\\.ttf|\\.otf')) {
+							const blob = await resp.blob();
+							console.log('[loader] storing blob', url.href);
+
+							this._res_data[url.toString()] = URL.createObjectURL(blob);
+						} else {
+							const text = await resp.text();
+							console.log('[loader] storing text', url.href);
+
+							this._res_data[url.toString()] = text;
+						}
+					} else {
+						console.warn('[loader] failed for resource', req.url, resp);
+
+						$(".loading-message").html(`Unable to load resource.<br/><small>${req.url}</small>`);
+
+						load_failed = true;
+					}
+				});
+
+				promises.push(promise);
+			}
+		});
+
+		await Promise.allSettled(promises);
+
+		console.log('[loader] resource load complete, failed: ', load_failed);
+
+		callback(load_failed)
+	}
 }
diff --git a/offline.html b/offline.html
index 3545127..efb414c 100644
--- a/offline.html
+++ b/offline.html
@@ -15,6 +15,8 @@
 	<script type="text/javascript">
 		'use strict';
 
+		const App = new AppClass();
+
 		if ('serviceWorker' in navigator) {
 			navigator.serviceWorker
 					.register('worker.js')
@@ -22,7 +24,7 @@
 						console.log("service worker registered");
 
 						$(document).ready(function() {
-							App.Offline.init();
+							App.offlineInit();
 						});
 					});
 		} else {
@@ -65,7 +67,11 @@
 		</form>
 
 		<ul class="nav navbar-nav navbar-right">
-			<li><a href="#" onclick="App.Offline.removeAll()" title="Remove all downloads">
+			<li><a href="#" title="Refresh script cache" onclick="return App.refreshCache(true)">
+				<span class="glyphicon glyphicon-refresh"></span> <span class='hidden-sm hidden-md hidden-lg'>Refresh script cache</span></a></li>
+			</li>
+
+			<li><a href="#" onclick="App.removeAll()" title="Remove all downloads">
 				<span class="glyphicon glyphicon-remove-circle text-danger"></span> <span class='hidden-sm hidden-md hidden-lg'>Remove all downloads</span>
 			</a></li>
 		</ul>
diff --git a/package-lock.json b/package-lock.json
index 1686670..e87ae94 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14,7 +14,7 @@
         "localforage": "^1.9.0"
       },
       "devDependencies": {
-        "eslint": "^7.9.0",
+        "eslint": "^8.0.1",
         "eslint-formatter-gitlab": "^5.1.0",
         "gulp": "^4.0.2",
         "gulp-concat": "^2.6.1",
@@ -26,65 +26,143 @@
         "less": "^3.12.2"
       }
     },
-    "node_modules/@babel/code-frame": {
-      "version": "7.12.13",
-      "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz",
-      "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==",
+    "node_modules/@eslint-community/eslint-utils": {
+      "version": "4.9.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz",
+      "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
-        "@babel/highlight": "^7.12.13"
+        "eslint-visitor-keys": "^3.4.3"
+      },
+      "engines": {
+        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+      },
+      "funding": {
+        "url": "https://opencollective.com/eslint"
+      },
+      "peerDependencies": {
+        "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0"
       }
     },
-    "node_modules/@babel/helper-validator-identifier": {
-      "version": "7.12.11",
-      "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz",
-      "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==",
-      "dev": true
+    "node_modules/@eslint-community/regexpp": {
+      "version": "4.12.2",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@eslint-community/regexpp/-/regexpp-4.12.2.tgz",
+      "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==",
+      "dev": true,
+      "license": "MIT",
+      "engines": {
+        "node": "^12.0.0 || ^14.0.0 || >=16.0.0"
+      }
     },
-    "node_modules/@babel/highlight": {
-      "version": "7.12.13",
-      "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.12.13.tgz",
-      "integrity": "sha512-kocDQvIbgMKlWxXe9fof3TQ+gkIPOUSEYhJjqUjvKMez3krV7vbzYCDq39Oj11UAVK7JqPVGQPlgE85dPNlQww==",
+    "node_modules/@eslint/eslintrc": {
+      "version": "2.1.4",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@eslint/eslintrc/-/eslintrc-2.1.4.tgz",
+      "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
-        "@babel/helper-validator-identifier": "^7.12.11",
-        "chalk": "^2.0.0",
-        "js-tokens": "^4.0.0"
+        "ajv": "^6.12.4",
+        "debug": "^4.3.2",
+        "espree": "^9.6.0",
+        "globals": "^13.19.0",
+        "ignore": "^5.2.0",
+        "import-fresh": "^3.2.1",
+        "js-yaml": "^4.1.0",
+        "minimatch": "^3.1.2",
+        "strip-json-comments": "^3.1.1"
+      },
+      "engines": {
+        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+      },
+      "funding": {
+        "url": "https://opencollective.com/eslint"
+      }
+    },
+    "node_modules/@eslint/js": {
+      "version": "8.57.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@eslint/js/-/js-8.57.1.tgz",
+      "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==",
+      "dev": true,
+      "license": "MIT",
+      "engines": {
+        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
       }
     },
-    "node_modules/@babel/highlight/node_modules/chalk": {
-      "version": "2.4.2",
-      "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
-      "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+    "node_modules/@humanwhocodes/config-array": {
+      "version": "0.13.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@humanwhocodes/config-array/-/config-array-0.13.0.tgz",
+      "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==",
+      "deprecated": "Use @eslint/config-array instead",
       "dev": true,
+      "license": "Apache-2.0",
       "dependencies": {
-        "ansi-styles": "^3.2.1",
-        "escape-string-regexp": "^1.0.5",
-        "supports-color": "^5.3.0"
+        "@humanwhocodes/object-schema": "^2.0.3",
+        "debug": "^4.3.1",
+        "minimatch": "^3.0.5"
       },
       "engines": {
-        "node": ">=4"
+        "node": ">=10.10.0"
       }
     },
-    "node_modules/@eslint/eslintrc": {
-      "version": "0.3.0",
-      "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.3.0.tgz",
-      "integrity": "sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg==",
+    "node_modules/@humanwhocodes/module-importer": {
+      "version": "1.0.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
+      "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",
       "dev": true,
+      "license": "Apache-2.0",
+      "engines": {
+        "node": ">=12.22"
+      },
+      "funding": {
+        "type": "github",
+        "url": "https://github.com/sponsors/nzakas"
+      }
+    },
+    "node_modules/@humanwhocodes/object-schema": {
+      "version": "2.0.3",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz",
+      "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==",
+      "deprecated": "Use @eslint/object-schema instead",
+      "dev": true,
+      "license": "BSD-3-Clause"
+    },
+    "node_modules/@nodelib/fs.scandir": {
+      "version": "2.1.5",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
+      "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
+      "dev": true,
+      "license": "MIT",
       "dependencies": {
-        "ajv": "^6.12.4",
-        "debug": "^4.1.1",
-        "espree": "^7.3.0",
-        "globals": "^12.1.0",
-        "ignore": "^4.0.6",
-        "import-fresh": "^3.2.1",
-        "js-yaml": "^3.13.1",
-        "lodash": "^4.17.20",
-        "minimatch": "^3.0.4",
-        "strip-json-comments": "^3.1.1"
+        "@nodelib/fs.stat": "2.0.5",
+        "run-parallel": "^1.1.9"
       },
       "engines": {
-        "node": "^10.12.0 || >=12.0.0"
+        "node": ">= 8"
+      }
+    },
+    "node_modules/@nodelib/fs.stat": {
+      "version": "2.0.5",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
+      "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
+      "dev": true,
+      "license": "MIT",
+      "engines": {
+        "node": ">= 8"
+      }
+    },
+    "node_modules/@nodelib/fs.walk": {
+      "version": "1.2.8",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
+      "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
+      "dev": true,
+      "license": "MIT",
+      "dependencies": {
+        "@nodelib/fs.scandir": "2.1.5",
+        "fastq": "^1.6.0"
+      },
+      "engines": {
+        "node": ">= 8"
       }
     },
     "node_modules/@types/localforage": {
@@ -96,6 +174,13 @@
         "localforage": "*"
       }
     },
+    "node_modules/@ungap/structured-clone": {
+      "version": "1.3.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@ungap/structured-clone/-/structured-clone-1.3.0.tgz",
+      "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==",
+      "dev": true,
+      "license": "ISC"
+    },
     "node_modules/@xmldom/xmldom": {
       "version": "0.7.5",
       "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.5.tgz",
@@ -136,10 +221,11 @@
       }
     },
     "node_modules/acorn": {
-      "version": "7.4.1",
-      "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
-      "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
+      "version": "8.16.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/acorn/-/acorn-8.16.0.tgz",
+      "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
       "dev": true,
+      "license": "MIT",
       "bin": {
         "acorn": "bin/acorn"
       },
@@ -148,19 +234,21 @@
       }
     },
     "node_modules/acorn-jsx": {
-      "version": "5.3.1",
-      "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz",
-      "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==",
+      "version": "5.3.2",
+      "resolved": "https://nexus.fakecake.org/repository/npm/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
+      "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
       "dev": true,
+      "license": "MIT",
       "peerDependencies": {
         "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
       }
     },
     "node_modules/ajv": {
-      "version": "6.12.6",
-      "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
-      "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+      "version": "6.14.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/ajv/-/ajv-6.14.0.tgz",
+      "integrity": "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
         "fast-deep-equal": "^3.1.1",
         "fast-json-stable-stringify": "^2.0.0",
@@ -207,15 +295,6 @@
         "node": ">=0.4.2"
       }
     },
-    "node_modules/ansi-colors": {
-      "version": "4.1.1",
-      "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
-      "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
-      "dev": true,
-      "engines": {
-        "node": ">=6"
-      }
-    },
     "node_modules/ansi-cyan": {
       "version": "0.1.1",
       "resolved": "https://registry.npmjs.org/ansi-cyan/-/ansi-cyan-0.1.1.tgz",
@@ -254,25 +333,14 @@
     },
     "node_modules/ansi-regex": {
       "version": "5.0.1",
-      "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/ansi-regex/-/ansi-regex-5.0.1.tgz",
       "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
       "dev": true,
+      "license": "MIT",
       "engines": {
         "node": ">=8"
       }
     },
-    "node_modules/ansi-styles": {
-      "version": "3.2.1",
-      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
-      "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
-      "dev": true,
-      "dependencies": {
-        "color-convert": "^1.9.0"
-      },
-      "engines": {
-        "node": ">=4"
-      }
-    },
     "node_modules/ansi-wrap": {
       "version": "0.1.0",
       "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz",
@@ -323,13 +391,11 @@
       "dev": true
     },
     "node_modules/argparse": {
-      "version": "1.0.10",
-      "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
-      "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+      "version": "2.0.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/argparse/-/argparse-2.0.1.tgz",
+      "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
       "dev": true,
-      "dependencies": {
-        "sprintf-js": "~1.0.2"
-      }
+      "license": "Python-2.0"
     },
     "node_modules/arr-diff": {
       "version": "4.0.0",
@@ -502,15 +568,6 @@
         "node": ">=0.10.0"
       }
     },
-    "node_modules/astral-regex": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz",
-      "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==",
-      "dev": true,
-      "engines": {
-        "node": ">=8"
-      }
-    },
     "node_modules/async-done": {
       "version": "1.3.2",
       "resolved": "https://registry.npmjs.org/async-done/-/async-done-1.3.2.tgz",
@@ -807,9 +864,10 @@
     },
     "node_modules/callsites": {
       "version": "3.1.0",
-      "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/callsites/-/callsites-3.1.0.tgz",
       "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
       "dev": true,
+      "license": "MIT",
       "engines": {
         "node": ">=6"
       }
@@ -1135,21 +1193,6 @@
         "node": ">=0.10.0"
       }
     },
-    "node_modules/color-convert": {
-      "version": "1.9.3",
-      "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
-      "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
-      "dev": true,
-      "dependencies": {
-        "color-name": "1.1.3"
-      }
-    },
-    "node_modules/color-name": {
-      "version": "1.1.3",
-      "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
-      "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
-      "dev": true
-    },
     "node_modules/color-support": {
       "version": "1.1.3",
       "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
@@ -1301,12 +1344,13 @@
       }
     },
     "node_modules/debug": {
-      "version": "4.3.1",
-      "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
-      "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
+      "version": "4.4.3",
+      "resolved": "https://nexus.fakecake.org/repository/npm/debug/-/debug-4.4.3.tgz",
+      "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
-        "ms": "2.1.2"
+        "ms": "^2.1.3"
       },
       "engines": {
         "node": ">=6.0"
@@ -1336,10 +1380,11 @@
       }
     },
     "node_modules/deep-is": {
-      "version": "0.1.3",
-      "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
-      "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
-      "dev": true
+      "version": "0.1.4",
+      "resolved": "https://nexus.fakecake.org/repository/npm/deep-is/-/deep-is-0.1.4.tgz",
+      "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
+      "dev": true,
+      "license": "MIT"
     },
     "node_modules/default-compare": {
       "version": "1.0.0",
@@ -1510,12 +1555,6 @@
         "object.defaults": "^1.1.0"
       }
     },
-    "node_modules/emoji-regex": {
-      "version": "8.0.0",
-      "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
-      "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
-      "dev": true
-    },
     "node_modules/end-of-stream": {
       "version": "1.4.4",
       "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
@@ -1525,18 +1564,6 @@
         "once": "^1.4.0"
       }
     },
-    "node_modules/enquirer": {
-      "version": "2.3.6",
-      "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",
-      "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==",
-      "dev": true,
-      "dependencies": {
-        "ansi-colors": "^4.1.1"
-      },
-      "engines": {
-        "node": ">=8.6"
-      }
-    },
     "node_modules/epubjs": {
       "version": "0.3.90",
       "resolved": "https://registry.npmjs.org/epubjs/-/epubjs-0.3.90.tgz",
@@ -1626,54 +1653,57 @@
       }
     },
     "node_modules/eslint": {
-      "version": "7.19.0",
-      "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.19.0.tgz",
-      "integrity": "sha512-CGlMgJY56JZ9ZSYhJuhow61lMPPjUzWmChFya71Z/jilVos7mR/jPgaEfVGgMBY5DshbKdG8Ezb8FDCHcoMEMg==",
+      "version": "8.57.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/eslint/-/eslint-8.57.1.tgz",
+      "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==",
+      "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
-        "@babel/code-frame": "^7.0.0",
-        "@eslint/eslintrc": "^0.3.0",
-        "ajv": "^6.10.0",
+        "@eslint-community/eslint-utils": "^4.2.0",
+        "@eslint-community/regexpp": "^4.6.1",
+        "@eslint/eslintrc": "^2.1.4",
+        "@eslint/js": "8.57.1",
+        "@humanwhocodes/config-array": "^0.13.0",
+        "@humanwhocodes/module-importer": "^1.0.1",
+        "@nodelib/fs.walk": "^1.2.8",
+        "@ungap/structured-clone": "^1.2.0",
+        "ajv": "^6.12.4",
         "chalk": "^4.0.0",
         "cross-spawn": "^7.0.2",
-        "debug": "^4.0.1",
+        "debug": "^4.3.2",
         "doctrine": "^3.0.0",
-        "enquirer": "^2.3.5",
-        "eslint-scope": "^5.1.1",
-        "eslint-utils": "^2.1.0",
-        "eslint-visitor-keys": "^2.0.0",
-        "espree": "^7.3.1",
-        "esquery": "^1.2.0",
+        "escape-string-regexp": "^4.0.0",
+        "eslint-scope": "^7.2.2",
+        "eslint-visitor-keys": "^3.4.3",
+        "espree": "^9.6.1",
+        "esquery": "^1.4.2",
         "esutils": "^2.0.2",
-        "file-entry-cache": "^6.0.0",
-        "functional-red-black-tree": "^1.0.1",
-        "glob-parent": "^5.0.0",
-        "globals": "^12.1.0",
-        "ignore": "^4.0.6",
-        "import-fresh": "^3.0.0",
+        "fast-deep-equal": "^3.1.3",
+        "file-entry-cache": "^6.0.1",
+        "find-up": "^5.0.0",
+        "glob-parent": "^6.0.2",
+        "globals": "^13.19.0",
+        "graphemer": "^1.4.0",
+        "ignore": "^5.2.0",
         "imurmurhash": "^0.1.4",
         "is-glob": "^4.0.0",
-        "js-yaml": "^3.13.1",
+        "is-path-inside": "^3.0.3",
+        "js-yaml": "^4.1.0",
         "json-stable-stringify-without-jsonify": "^1.0.1",
         "levn": "^0.4.1",
-        "lodash": "^4.17.20",
-        "minimatch": "^3.0.4",
+        "lodash.merge": "^4.6.2",
+        "minimatch": "^3.1.2",
         "natural-compare": "^1.4.0",
-        "optionator": "^0.9.1",
-        "progress": "^2.0.0",
-        "regexpp": "^3.1.0",
-        "semver": "^7.2.1",
-        "strip-ansi": "^6.0.0",
-        "strip-json-comments": "^3.1.0",
-        "table": "^6.0.4",
-        "text-table": "^0.2.0",
-        "v8-compile-cache": "^2.0.3"
+        "optionator": "^0.9.3",
+        "strip-ansi": "^6.0.1",
+        "text-table": "^0.2.0"
       },
       "bin": {
         "eslint": "bin/eslint.js"
       },
       "engines": {
-        "node": "^10.12.0 || >=12.0.0"
+        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
       },
       "funding": {
         "url": "https://opencollective.com/eslint"
@@ -1697,92 +1727,99 @@
       }
     },
     "node_modules/eslint-scope": {
-      "version": "5.1.1",
-      "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
-      "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
+      "version": "7.2.2",
+      "resolved": "https://nexus.fakecake.org/repository/npm/eslint-scope/-/eslint-scope-7.2.2.tgz",
+      "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==",
       "dev": true,
+      "license": "BSD-2-Clause",
       "dependencies": {
         "esrecurse": "^4.3.0",
-        "estraverse": "^4.1.1"
-      },
-      "engines": {
-        "node": ">=8.0.0"
-      }
-    },
-    "node_modules/eslint-utils": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz",
-      "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==",
-      "dev": true,
-      "dependencies": {
-        "eslint-visitor-keys": "^1.1.0"
+        "estraverse": "^5.2.0"
       },
       "engines": {
-        "node": ">=6"
+        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
       },
       "funding": {
-        "url": "https://github.com/sponsors/mysticatea"
+        "url": "https://opencollective.com/eslint"
       }
     },
-    "node_modules/eslint-utils/node_modules/eslint-visitor-keys": {
-      "version": "1.3.0",
-      "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
-      "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
+    "node_modules/eslint-visitor-keys": {
+      "version": "3.4.3",
+      "resolved": "https://nexus.fakecake.org/repository/npm/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
+      "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
       "dev": true,
+      "license": "Apache-2.0",
       "engines": {
-        "node": ">=4"
+        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+      },
+      "funding": {
+        "url": "https://opencollective.com/eslint"
       }
     },
-    "node_modules/eslint-visitor-keys": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz",
-      "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==",
+    "node_modules/eslint/node_modules/escape-string-regexp": {
+      "version": "4.0.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+      "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
       "dev": true,
+      "license": "MIT",
       "engines": {
         "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
       }
     },
-    "node_modules/espree": {
-      "version": "7.3.1",
-      "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz",
-      "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==",
+    "node_modules/eslint/node_modules/find-up": {
+      "version": "5.0.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/find-up/-/find-up-5.0.0.tgz",
+      "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
-        "acorn": "^7.4.0",
-        "acorn-jsx": "^5.3.1",
-        "eslint-visitor-keys": "^1.3.0"
+        "locate-path": "^6.0.0",
+        "path-exists": "^4.0.0"
       },
       "engines": {
-        "node": "^10.12.0 || >=12.0.0"
+        "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
       }
     },
-    "node_modules/espree/node_modules/eslint-visitor-keys": {
-      "version": "1.3.0",
-      "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
-      "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
+    "node_modules/eslint/node_modules/path-exists": {
+      "version": "4.0.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/path-exists/-/path-exists-4.0.0.tgz",
+      "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
       "dev": true,
+      "license": "MIT",
       "engines": {
-        "node": ">=4"
+        "node": ">=8"
       }
     },
-    "node_modules/esprima": {
-      "version": "4.0.1",
-      "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
-      "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+    "node_modules/espree": {
+      "version": "9.6.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/espree/-/espree-9.6.1.tgz",
+      "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==",
       "dev": true,
-      "bin": {
-        "esparse": "bin/esparse.js",
-        "esvalidate": "bin/esvalidate.js"
+      "license": "BSD-2-Clause",
+      "dependencies": {
+        "acorn": "^8.9.0",
+        "acorn-jsx": "^5.3.2",
+        "eslint-visitor-keys": "^3.4.1"
       },
       "engines": {
-        "node": ">=4"
+        "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+      },
+      "funding": {
+        "url": "https://opencollective.com/eslint"
       }
     },
     "node_modules/esquery": {
-      "version": "1.4.0",
-      "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz",
-      "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==",
+      "version": "1.7.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/esquery/-/esquery-1.7.0.tgz",
+      "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==",
       "dev": true,
+      "license": "BSD-3-Clause",
       "dependencies": {
         "estraverse": "^5.1.0"
       },
@@ -1790,20 +1827,12 @@
         "node": ">=0.10"
       }
     },
-    "node_modules/esquery/node_modules/estraverse": {
-      "version": "5.2.0",
-      "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
-      "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
-      "dev": true,
-      "engines": {
-        "node": ">=4.0"
-      }
-    },
     "node_modules/esrecurse": {
       "version": "4.3.0",
-      "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/esrecurse/-/esrecurse-4.3.0.tgz",
       "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
       "dev": true,
+      "license": "BSD-2-Clause",
       "dependencies": {
         "estraverse": "^5.2.0"
       },
@@ -1811,20 +1840,12 @@
         "node": ">=4.0"
       }
     },
-    "node_modules/esrecurse/node_modules/estraverse": {
-      "version": "5.2.0",
-      "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
-      "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
-      "dev": true,
-      "engines": {
-        "node": ">=4.0"
-      }
-    },
     "node_modules/estraverse": {
-      "version": "4.3.0",
-      "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
-      "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
+      "version": "5.3.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/estraverse/-/estraverse-5.3.0.tgz",
+      "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
       "dev": true,
+      "license": "BSD-2-Clause",
       "engines": {
         "node": ">=4.0"
       }
@@ -2058,27 +2079,41 @@
     },
     "node_modules/fast-deep-equal": {
       "version": "3.1.3",
-      "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
       "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
-      "dev": true
+      "dev": true,
+      "license": "MIT"
     },
     "node_modules/fast-json-stable-stringify": {
       "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
       "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
-      "dev": true
+      "dev": true,
+      "license": "MIT"
     },
     "node_modules/fast-levenshtein": {
       "version": "2.0.6",
-      "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
-      "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
-      "dev": true
+      "resolved": "https://nexus.fakecake.org/repository/npm/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+      "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
+      "dev": true,
+      "license": "MIT"
+    },
+    "node_modules/fastq": {
+      "version": "1.20.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/fastq/-/fastq-1.20.1.tgz",
+      "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==",
+      "dev": true,
+      "license": "ISC",
+      "dependencies": {
+        "reusify": "^1.0.4"
+      }
     },
     "node_modules/file-entry-cache": {
-      "version": "6.0.0",
-      "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.0.tgz",
-      "integrity": "sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA==",
+      "version": "6.0.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
+      "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
         "flat-cache": "^3.0.4"
       },
@@ -2174,12 +2209,14 @@
       }
     },
     "node_modules/flat-cache": {
-      "version": "3.0.4",
-      "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
-      "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==",
+      "version": "3.2.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/flat-cache/-/flat-cache-3.2.0.tgz",
+      "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
-        "flatted": "^3.1.0",
+        "flatted": "^3.2.9",
+        "keyv": "^4.5.3",
         "rimraf": "^3.0.2"
       },
       "engines": {
@@ -2187,10 +2224,11 @@
       }
     },
     "node_modules/flatted": {
-      "version": "3.1.1",
-      "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz",
-      "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==",
-      "dev": true
+      "version": "3.4.2",
+      "resolved": "https://nexus.fakecake.org/repository/npm/flatted/-/flatted-3.4.2.tgz",
+      "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==",
+      "dev": true,
+      "license": "ISC"
     },
     "node_modules/flush-write-stream": {
       "version": "1.1.1",
@@ -2279,12 +2317,6 @@
       "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
       "dev": true
     },
-    "node_modules/functional-red-black-tree": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
-      "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
-      "dev": true
-    },
     "node_modules/get-caller-file": {
       "version": "1.0.3",
       "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
@@ -2335,15 +2367,16 @@
       }
     },
     "node_modules/glob-parent": {
-      "version": "5.1.2",
-      "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
-      "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+      "version": "6.0.2",
+      "resolved": "https://nexus.fakecake.org/repository/npm/glob-parent/-/glob-parent-6.0.2.tgz",
+      "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
       "dev": true,
+      "license": "ISC",
       "dependencies": {
-        "is-glob": "^4.0.1"
+        "is-glob": "^4.0.3"
       },
       "engines": {
-        "node": ">= 6"
+        "node": ">=10.13.0"
       }
     },
     "node_modules/glob-stream": {
@@ -2450,12 +2483,13 @@
       }
     },
     "node_modules/globals": {
-      "version": "12.4.0",
-      "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz",
-      "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==",
+      "version": "13.24.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/globals/-/globals-13.24.0.tgz",
+      "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
-        "type-fest": "^0.8.1"
+        "type-fest": "^0.20.2"
       },
       "engines": {
         "node": ">=8"
@@ -2488,6 +2522,13 @@
       "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=",
       "dev": true
     },
+    "node_modules/graphemer": {
+      "version": "1.4.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/graphemer/-/graphemer-1.4.0.tgz",
+      "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==",
+      "dev": true,
+      "license": "MIT"
+    },
     "node_modules/gulp": {
       "version": "4.0.2",
       "resolved": "https://registry.npmjs.org/gulp/-/gulp-4.0.2.tgz",
@@ -2832,15 +2873,6 @@
         "node": ">=0.10.0"
       }
     },
-    "node_modules/has-flag": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
-      "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
-      "dev": true,
-      "engines": {
-        "node": ">=4"
-      }
-    },
     "node_modules/has-gulplog": {
       "version": "0.1.0",
       "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz",
@@ -2923,10 +2955,11 @@
       "dev": true
     },
     "node_modules/ignore": {
-      "version": "4.0.6",
-      "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
-      "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",
+      "version": "5.3.2",
+      "resolved": "https://nexus.fakecake.org/repository/npm/ignore/-/ignore-5.3.2.tgz",
+      "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
       "dev": true,
+      "license": "MIT",
       "engines": {
         "node": ">= 4"
       }
@@ -2950,10 +2983,11 @@
       "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps="
     },
     "node_modules/import-fresh": {
-      "version": "3.3.0",
-      "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
-      "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==",
+      "version": "3.3.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/import-fresh/-/import-fresh-3.3.1.tgz",
+      "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
         "parent-module": "^1.0.0",
         "resolve-from": "^4.0.0"
@@ -3157,20 +3191,12 @@
         "node": ">=0.10.0"
       }
     },
-    "node_modules/is-fullwidth-code-point": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
-      "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
-      "dev": true,
-      "engines": {
-        "node": ">=8"
-      }
-    },
     "node_modules/is-glob": {
-      "version": "4.0.1",
-      "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
-      "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
+      "version": "4.0.3",
+      "resolved": "https://nexus.fakecake.org/repository/npm/is-glob/-/is-glob-4.0.3.tgz",
+      "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
         "is-extglob": "^2.1.1"
       },
@@ -3211,6 +3237,16 @@
         "node": ">=0.10.0"
       }
     },
+    "node_modules/is-path-inside": {
+      "version": "3.0.3",
+      "resolved": "https://nexus.fakecake.org/repository/npm/is-path-inside/-/is-path-inside-3.0.3.tgz",
+      "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==",
+      "dev": true,
+      "license": "MIT",
+      "engines": {
+        "node": ">=8"
+      }
+    },
     "node_modules/is-plain-object": {
       "version": "2.0.4",
       "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
@@ -3297,30 +3333,32 @@
         "node": ">=0.10.0"
       }
     },
-    "node_modules/js-tokens": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
-      "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
-      "dev": true
-    },
     "node_modules/js-yaml": {
-      "version": "3.14.1",
-      "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
-      "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
+      "version": "4.1.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/js-yaml/-/js-yaml-4.1.1.tgz",
+      "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
-        "argparse": "^1.0.7",
-        "esprima": "^4.0.0"
+        "argparse": "^2.0.1"
       },
       "bin": {
         "js-yaml": "bin/js-yaml.js"
       }
     },
+    "node_modules/json-buffer": {
+      "version": "3.0.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/json-buffer/-/json-buffer-3.0.1.tgz",
+      "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",
+      "dev": true,
+      "license": "MIT"
+    },
     "node_modules/json-schema-traverse": {
       "version": "0.4.1",
-      "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
       "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
-      "dev": true
+      "dev": true,
+      "license": "MIT"
     },
     "node_modules/json-stable-stringify-without-jsonify": {
       "version": "1.0.1",
@@ -3353,6 +3391,16 @@
       "integrity": "sha1-h/zPrv/AtozRnVX2cilD+SnqNeo=",
       "dev": true
     },
+    "node_modules/keyv": {
+      "version": "4.5.4",
+      "resolved": "https://nexus.fakecake.org/repository/npm/keyv/-/keyv-4.5.4.tgz",
+      "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",
+      "dev": true,
+      "license": "MIT",
+      "dependencies": {
+        "json-buffer": "3.0.1"
+      }
+    },
     "node_modules/kind-of": {
       "version": "6.0.3",
       "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
@@ -3457,9 +3505,10 @@
     },
     "node_modules/levn": {
       "version": "0.4.1",
-      "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/levn/-/levn-0.4.1.tgz",
       "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
         "prelude-ls": "^1.2.1",
         "type-check": "~0.4.0"
@@ -3519,6 +3568,22 @@
         "lie": "3.1.1"
       }
     },
+    "node_modules/locate-path": {
+      "version": "6.0.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/locate-path/-/locate-path-6.0.0.tgz",
+      "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
+      "dev": true,
+      "license": "MIT",
+      "dependencies": {
+        "p-locate": "^5.0.0"
+      },
+      "engines": {
+        "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
+    },
     "node_modules/lodash": {
       "version": "4.17.21",
       "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
@@ -3694,18 +3759,6 @@
         "node": ">=0.10.0"
       }
     },
-    "node_modules/lru-cache": {
-      "version": "6.0.0",
-      "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
-      "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
-      "dev": true,
-      "dependencies": {
-        "yallist": "^4.0.0"
-      },
-      "engines": {
-        "node": ">=10"
-      }
-    },
     "node_modules/make-dir": {
       "version": "2.1.0",
       "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz",
@@ -3864,10 +3917,11 @@
       }
     },
     "node_modules/minimatch": {
-      "version": "3.0.4",
-      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
-      "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+      "version": "3.1.5",
+      "resolved": "https://nexus.fakecake.org/repository/npm/minimatch/-/minimatch-3.1.5.tgz",
+      "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
       "dev": true,
+      "license": "ISC",
       "dependencies": {
         "brace-expansion": "^1.1.7"
       },
@@ -3907,10 +3961,11 @@
       }
     },
     "node_modules/ms": {
-      "version": "2.1.2",
-      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
-      "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
-      "dev": true
+      "version": "2.1.3",
+      "resolved": "https://nexus.fakecake.org/repository/npm/ms/-/ms-2.1.3.tgz",
+      "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+      "dev": true,
+      "license": "MIT"
     },
     "node_modules/multipipe": {
       "version": "0.1.2",
@@ -4183,17 +4238,18 @@
       }
     },
     "node_modules/optionator": {
-      "version": "0.9.1",
-      "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz",
-      "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==",
+      "version": "0.9.4",
+      "resolved": "https://nexus.fakecake.org/repository/npm/optionator/-/optionator-0.9.4.tgz",
+      "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
         "deep-is": "^0.1.3",
         "fast-levenshtein": "^2.0.6",
         "levn": "^0.4.1",
         "prelude-ls": "^1.2.1",
         "type-check": "^0.4.0",
-        "word-wrap": "^1.2.3"
+        "word-wrap": "^1.2.5"
       },
       "engines": {
         "node": ">= 0.8.0"
@@ -4220,6 +4276,38 @@
         "node": ">=0.10.0"
       }
     },
+    "node_modules/p-limit": {
+      "version": "3.1.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/p-limit/-/p-limit-3.1.0.tgz",
+      "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+      "dev": true,
+      "license": "MIT",
+      "dependencies": {
+        "yocto-queue": "^0.1.0"
+      },
+      "engines": {
+        "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
+    },
+    "node_modules/p-locate": {
+      "version": "5.0.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/p-locate/-/p-locate-5.0.0.tgz",
+      "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
+      "dev": true,
+      "license": "MIT",
+      "dependencies": {
+        "p-limit": "^3.0.2"
+      },
+      "engines": {
+        "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
+    },
     "node_modules/pako": {
       "version": "1.0.11",
       "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
@@ -4227,9 +4315,10 @@
     },
     "node_modules/parent-module": {
       "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/parent-module/-/parent-module-1.0.1.tgz",
       "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
         "callsites": "^3.0.0"
       },
@@ -4481,9 +4570,10 @@
     },
     "node_modules/prelude-ls": {
       "version": "1.2.1",
-      "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/prelude-ls/-/prelude-ls-1.2.1.tgz",
       "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
       "dev": true,
+      "license": "MIT",
       "engines": {
         "node": ">= 0.8.0"
       }
@@ -4502,15 +4592,6 @@
       "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
       "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
     },
-    "node_modules/progress": {
-      "version": "2.0.3",
-      "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
-      "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
-      "dev": true,
-      "engines": {
-        "node": ">=0.4.0"
-      }
-    },
     "node_modules/prr": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
@@ -4540,14 +4621,36 @@
       }
     },
     "node_modules/punycode": {
-      "version": "2.1.1",
-      "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
-      "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
+      "version": "2.3.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/punycode/-/punycode-2.3.1.tgz",
+      "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
       "dev": true,
+      "license": "MIT",
       "engines": {
         "node": ">=6"
       }
     },
+    "node_modules/queue-microtask": {
+      "version": "1.2.3",
+      "resolved": "https://nexus.fakecake.org/repository/npm/queue-microtask/-/queue-microtask-1.2.3.tgz",
+      "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
+      "dev": true,
+      "funding": [
+        {
+          "type": "github",
+          "url": "https://github.com/sponsors/feross"
+        },
+        {
+          "type": "patreon",
+          "url": "https://www.patreon.com/feross"
+        },
+        {
+          "type": "consulting",
+          "url": "https://feross.org/support"
+        }
+      ],
+      "license": "MIT"
+    },
     "node_modules/read-pkg": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
@@ -4628,18 +4731,6 @@
         "node": ">=0.10.0"
       }
     },
-    "node_modules/regexpp": {
-      "version": "3.1.0",
-      "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz",
-      "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==",
-      "dev": true,
-      "engines": {
-        "node": ">=8"
-      },
-      "funding": {
-        "url": "https://github.com/sponsors/mysticatea"
-      }
-    },
     "node_modules/remove-bom-buffer": {
       "version": "3.0.0",
       "resolved": "https://registry.npmjs.org/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz",
@@ -4723,15 +4814,6 @@
         "node": ">=0.10.0"
       }
     },
-    "node_modules/require-from-string": {
-      "version": "2.0.2",
-      "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
-      "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
-      "dev": true,
-      "engines": {
-        "node": ">=0.10.0"
-      }
-    },
     "node_modules/require-main-filename": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz",
@@ -4766,9 +4848,10 @@
     },
     "node_modules/resolve-from": {
       "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/resolve-from/-/resolve-from-4.0.0.tgz",
       "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
       "dev": true,
+      "license": "MIT",
       "engines": {
         "node": ">=4"
       }
@@ -4801,6 +4884,17 @@
         "node": ">=0.12"
       }
     },
+    "node_modules/reusify": {
+      "version": "1.1.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/reusify/-/reusify-1.1.0.tgz",
+      "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==",
+      "dev": true,
+      "license": "MIT",
+      "engines": {
+        "iojs": ">=1.0.0",
+        "node": ">=0.10.0"
+      }
+    },
     "node_modules/right-align": {
       "version": "0.1.3",
       "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz",
@@ -4815,9 +4909,11 @@
     },
     "node_modules/rimraf": {
       "version": "3.0.2",
-      "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/rimraf/-/rimraf-3.0.2.tgz",
       "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
+      "deprecated": "Rimraf versions prior to v4 are no longer supported",
       "dev": true,
+      "license": "ISC",
       "dependencies": {
         "glob": "^7.1.3"
       },
@@ -4828,6 +4924,30 @@
         "url": "https://github.com/sponsors/isaacs"
       }
     },
+    "node_modules/run-parallel": {
+      "version": "1.2.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/run-parallel/-/run-parallel-1.2.0.tgz",
+      "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
+      "dev": true,
+      "funding": [
+        {
+          "type": "github",
+          "url": "https://github.com/sponsors/feross"
+        },
+        {
+          "type": "patreon",
+          "url": "https://www.patreon.com/feross"
+        },
+        {
+          "type": "consulting",
+          "url": "https://feross.org/support"
+        }
+      ],
+      "license": "MIT",
+      "dependencies": {
+        "queue-microtask": "^1.2.2"
+      }
+    },
     "node_modules/safe-buffer": {
       "version": "5.1.2",
       "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
@@ -4842,21 +4962,6 @@
         "ret": "~0.1.10"
       }
     },
-    "node_modules/semver": {
-      "version": "7.3.4",
-      "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz",
-      "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==",
-      "dev": true,
-      "dependencies": {
-        "lru-cache": "^6.0.0"
-      },
-      "bin": {
-        "semver": "bin/semver.js"
-      },
-      "engines": {
-        "node": ">=10"
-      }
-    },
     "node_modules/semver-greatest-satisfied-range": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/semver-greatest-satisfied-range/-/semver-greatest-satisfied-range-1.1.0.tgz",
@@ -4931,56 +5036,6 @@
         "node": ">=8"
       }
     },
-    "node_modules/slice-ansi": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz",
-      "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==",
-      "dev": true,
-      "dependencies": {
-        "ansi-styles": "^4.0.0",
-        "astral-regex": "^2.0.0",
-        "is-fullwidth-code-point": "^3.0.0"
-      },
-      "engines": {
-        "node": ">=10"
-      },
-      "funding": {
-        "url": "https://github.com/chalk/slice-ansi?sponsor=1"
-      }
-    },
-    "node_modules/slice-ansi/node_modules/ansi-styles": {
-      "version": "4.3.0",
-      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
-      "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
-      "dev": true,
-      "dependencies": {
-        "color-convert": "^2.0.1"
-      },
-      "engines": {
-        "node": ">=8"
-      },
-      "funding": {
-        "url": "https://github.com/chalk/ansi-styles?sponsor=1"
-      }
-    },
-    "node_modules/slice-ansi/node_modules/color-convert": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
-      "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
-      "dev": true,
-      "dependencies": {
-        "color-name": "~1.1.4"
-      },
-      "engines": {
-        "node": ">=7.0.0"
-      }
-    },
-    "node_modules/slice-ansi/node_modules/color-name": {
-      "version": "1.1.4",
-      "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
-      "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
-      "dev": true
-    },
     "node_modules/snapdragon": {
       "version": "0.8.2",
       "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
@@ -5227,12 +5282,6 @@
         "node": ">=0.10.0"
       }
     },
-    "node_modules/sprintf-js": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
-      "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
-      "dev": true
-    },
     "node_modules/stack-trace": {
       "version": "0.0.10",
       "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
@@ -5287,27 +5336,14 @@
         "safe-buffer": "~5.1.0"
       }
     },
-    "node_modules/string-width": {
-      "version": "4.2.0",
-      "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
-      "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
-      "dev": true,
-      "dependencies": {
-        "emoji-regex": "^8.0.0",
-        "is-fullwidth-code-point": "^3.0.0",
-        "strip-ansi": "^6.0.0"
-      },
-      "engines": {
-        "node": ">=8"
-      }
-    },
     "node_modules/strip-ansi": {
-      "version": "6.0.0",
-      "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
-      "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
+      "version": "6.0.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/strip-ansi/-/strip-ansi-6.0.1.tgz",
+      "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
-        "ansi-regex": "^5.0.0"
+        "ansi-regex": "^5.0.1"
       },
       "engines": {
         "node": ">=8"
@@ -5327,9 +5363,10 @@
     },
     "node_modules/strip-json-comments": {
       "version": "3.1.1",
-      "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
       "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
       "dev": true,
+      "license": "MIT",
       "engines": {
         "node": ">=8"
       },
@@ -5337,18 +5374,6 @@
         "url": "https://github.com/sponsors/sindresorhus"
       }
     },
-    "node_modules/supports-color": {
-      "version": "5.5.0",
-      "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
-      "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
-      "dev": true,
-      "dependencies": {
-        "has-flag": "^3.0.0"
-      },
-      "engines": {
-        "node": ">=4"
-      }
-    },
     "node_modules/sver-compat": {
       "version": "1.5.0",
       "resolved": "https://registry.npmjs.org/sver-compat/-/sver-compat-1.5.0.tgz",
@@ -5359,43 +5384,6 @@
         "es6-symbol": "^3.1.1"
       }
     },
-    "node_modules/table": {
-      "version": "6.0.7",
-      "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz",
-      "integrity": "sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==",
-      "dev": true,
-      "dependencies": {
-        "ajv": "^7.0.2",
-        "lodash": "^4.17.20",
-        "slice-ansi": "^4.0.0",
-        "string-width": "^4.2.0"
-      },
-      "engines": {
-        "node": ">=10.0.0"
-      }
-    },
-    "node_modules/table/node_modules/ajv": {
-      "version": "7.1.0",
-      "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.1.0.tgz",
-      "integrity": "sha512-svS9uILze/cXbH0z2myCK2Brqprx/+JJYK5pHicT/GQiBfzzhUVAIT6MwqJg8y4xV/zoGsUeuPuwtoiKSGE15g==",
-      "dev": true,
-      "dependencies": {
-        "fast-deep-equal": "^3.1.1",
-        "json-schema-traverse": "^1.0.0",
-        "require-from-string": "^2.0.2",
-        "uri-js": "^4.2.2"
-      },
-      "funding": {
-        "type": "github",
-        "url": "https://github.com/sponsors/epoberezkin"
-      }
-    },
-    "node_modules/table/node_modules/json-schema-traverse": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
-      "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
-      "dev": true
-    },
     "node_modules/terser": {
       "version": "4.8.0",
       "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz",
@@ -5553,9 +5541,10 @@
     },
     "node_modules/type-check": {
       "version": "0.4.0",
-      "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/type-check/-/type-check-0.4.0.tgz",
       "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
         "prelude-ls": "^1.2.1"
       },
@@ -5564,12 +5553,16 @@
       }
     },
     "node_modules/type-fest": {
-      "version": "0.8.1",
-      "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
-      "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
+      "version": "0.20.2",
+      "resolved": "https://nexus.fakecake.org/repository/npm/type-fest/-/type-fest-0.20.2.tgz",
+      "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
       "dev": true,
+      "license": "(MIT OR CC0-1.0)",
       "engines": {
-        "node": ">=8"
+        "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
       }
     },
     "node_modules/typedarray": {
@@ -5766,9 +5759,10 @@
     },
     "node_modules/uri-js": {
       "version": "4.4.1",
-      "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/uri-js/-/uri-js-4.4.1.tgz",
       "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
       "dev": true,
+      "license": "BSD-2-Clause",
       "dependencies": {
         "punycode": "^2.1.0"
       }
@@ -5794,12 +5788,6 @@
       "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
       "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
     },
-    "node_modules/v8-compile-cache": {
-      "version": "2.2.0",
-      "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz",
-      "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==",
-      "dev": true
-    },
     "node_modules/v8flags": {
       "version": "3.2.0",
       "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz",
@@ -5961,10 +5949,11 @@
       }
     },
     "node_modules/word-wrap": {
-      "version": "1.2.3",
-      "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
-      "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
+      "version": "1.2.5",
+      "resolved": "https://nexus.fakecake.org/repository/npm/word-wrap/-/word-wrap-1.2.5.tgz",
+      "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==",
       "dev": true,
+      "license": "MIT",
       "engines": {
         "node": ">=0.10.0"
       }
@@ -6059,12 +6048,6 @@
       "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==",
       "dev": true
     },
-    "node_modules/yallist": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
-      "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
-      "dev": true
-    },
     "node_modules/yaml": {
       "version": "2.7.1",
       "resolved": "https://nexus.fakecake.org/repository/npm/yaml/-/yaml-2.7.1.tgz",
@@ -6155,66 +6138,109 @@
       "engines": {
         "node": ">=0.10.0"
       }
+    },
+    "node_modules/yocto-queue": {
+      "version": "0.1.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/yocto-queue/-/yocto-queue-0.1.0.tgz",
+      "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+      "dev": true,
+      "license": "MIT",
+      "engines": {
+        "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
     }
   },
   "dependencies": {
-    "@babel/code-frame": {
-      "version": "7.12.13",
-      "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz",
-      "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==",
+    "@eslint-community/eslint-utils": {
+      "version": "4.9.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz",
+      "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==",
       "dev": true,
       "requires": {
-        "@babel/highlight": "^7.12.13"
+        "eslint-visitor-keys": "^3.4.3"
       }
     },
-    "@babel/helper-validator-identifier": {
-      "version": "7.12.11",
-      "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz",
-      "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==",
+    "@eslint-community/regexpp": {
+      "version": "4.12.2",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@eslint-community/regexpp/-/regexpp-4.12.2.tgz",
+      "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==",
       "dev": true
     },
-    "@babel/highlight": {
-      "version": "7.12.13",
-      "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.12.13.tgz",
-      "integrity": "sha512-kocDQvIbgMKlWxXe9fof3TQ+gkIPOUSEYhJjqUjvKMez3krV7vbzYCDq39Oj11UAVK7JqPVGQPlgE85dPNlQww==",
-      "dev": true,
-      "requires": {
-        "@babel/helper-validator-identifier": "^7.12.11",
-        "chalk": "^2.0.0",
-        "js-tokens": "^4.0.0"
-      },
-      "dependencies": {
-        "chalk": {
-          "version": "2.4.2",
-          "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
-          "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
-          "dev": true,
-          "requires": {
-            "ansi-styles": "^3.2.1",
-            "escape-string-regexp": "^1.0.5",
-            "supports-color": "^5.3.0"
-          }
-        }
-      }
-    },
     "@eslint/eslintrc": {
-      "version": "0.3.0",
-      "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.3.0.tgz",
-      "integrity": "sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg==",
+      "version": "2.1.4",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@eslint/eslintrc/-/eslintrc-2.1.4.tgz",
+      "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==",
       "dev": true,
       "requires": {
         "ajv": "^6.12.4",
-        "debug": "^4.1.1",
-        "espree": "^7.3.0",
-        "globals": "^12.1.0",
-        "ignore": "^4.0.6",
+        "debug": "^4.3.2",
+        "espree": "^9.6.0",
+        "globals": "^13.19.0",
+        "ignore": "^5.2.0",
         "import-fresh": "^3.2.1",
-        "js-yaml": "^3.13.1",
-        "lodash": "^4.17.20",
-        "minimatch": "^3.0.4",
+        "js-yaml": "^4.1.0",
+        "minimatch": "^3.1.2",
         "strip-json-comments": "^3.1.1"
       }
     },
+    "@eslint/js": {
+      "version": "8.57.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@eslint/js/-/js-8.57.1.tgz",
+      "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==",
+      "dev": true
+    },
+    "@humanwhocodes/config-array": {
+      "version": "0.13.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@humanwhocodes/config-array/-/config-array-0.13.0.tgz",
+      "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==",
+      "dev": true,
+      "requires": {
+        "@humanwhocodes/object-schema": "^2.0.3",
+        "debug": "^4.3.1",
+        "minimatch": "^3.0.5"
+      }
+    },
+    "@humanwhocodes/module-importer": {
+      "version": "1.0.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
+      "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",
+      "dev": true
+    },
+    "@humanwhocodes/object-schema": {
+      "version": "2.0.3",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz",
+      "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==",
+      "dev": true
+    },
+    "@nodelib/fs.scandir": {
+      "version": "2.1.5",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
+      "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
+      "dev": true,
+      "requires": {
+        "@nodelib/fs.stat": "2.0.5",
+        "run-parallel": "^1.1.9"
+      }
+    },
+    "@nodelib/fs.stat": {
+      "version": "2.0.5",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
+      "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
+      "dev": true
+    },
+    "@nodelib/fs.walk": {
+      "version": "1.2.8",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
+      "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
+      "dev": true,
+      "requires": {
+        "@nodelib/fs.scandir": "2.1.5",
+        "fastq": "^1.6.0"
+      }
+    },
     "@types/localforage": {
       "version": "0.0.34",
       "resolved": "https://registry.npmjs.org/@types/localforage/-/localforage-0.0.34.tgz",
@@ -6223,6 +6249,12 @@
         "localforage": "*"
       }
     },
+    "@ungap/structured-clone": {
+      "version": "1.3.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/@ungap/structured-clone/-/structured-clone-1.3.0.tgz",
+      "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==",
+      "dev": true
+    },
     "@xmldom/xmldom": {
       "version": "0.7.5",
       "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.5.tgz",
@@ -6259,22 +6291,22 @@
       }
     },
     "acorn": {
-      "version": "7.4.1",
-      "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
-      "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
+      "version": "8.16.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/acorn/-/acorn-8.16.0.tgz",
+      "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
       "dev": true
     },
     "acorn-jsx": {
-      "version": "5.3.1",
-      "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz",
-      "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==",
+      "version": "5.3.2",
+      "resolved": "https://nexus.fakecake.org/repository/npm/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
+      "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
       "dev": true,
       "requires": {}
     },
     "ajv": {
-      "version": "6.12.6",
-      "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
-      "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+      "version": "6.14.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/ajv/-/ajv-6.14.0.tgz",
+      "integrity": "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==",
       "dev": true,
       "requires": {
         "fast-deep-equal": "^3.1.1",
@@ -6311,12 +6343,6 @@
       "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
       "dev": true
     },
-    "ansi-colors": {
-      "version": "4.1.1",
-      "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
-      "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
-      "dev": true
-    },
     "ansi-cyan": {
       "version": "0.1.1",
       "resolved": "https://registry.npmjs.org/ansi-cyan/-/ansi-cyan-0.1.1.tgz",
@@ -6346,19 +6372,10 @@
     },
     "ansi-regex": {
       "version": "5.0.1",
-      "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/ansi-regex/-/ansi-regex-5.0.1.tgz",
       "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
       "dev": true
     },
-    "ansi-styles": {
-      "version": "3.2.1",
-      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
-      "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
-      "dev": true,
-      "requires": {
-        "color-convert": "^1.9.0"
-      }
-    },
     "ansi-wrap": {
       "version": "0.1.0",
       "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz",
@@ -6402,13 +6419,10 @@
       "dev": true
     },
     "argparse": {
-      "version": "1.0.10",
-      "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
-      "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
-      "dev": true,
-      "requires": {
-        "sprintf-js": "~1.0.2"
-      }
+      "version": "2.0.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/argparse/-/argparse-2.0.1.tgz",
+      "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+      "dev": true
     },
     "arr-diff": {
       "version": "4.0.0",
@@ -6536,12 +6550,6 @@
       "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=",
       "dev": true
     },
-    "astral-regex": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz",
-      "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==",
-      "dev": true
-    },
     "async-done": {
       "version": "1.3.2",
       "resolved": "https://registry.npmjs.org/async-done/-/async-done-1.3.2.tgz",
@@ -6790,7 +6798,7 @@
     },
     "callsites": {
       "version": "3.1.0",
-      "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/callsites/-/callsites-3.1.0.tgz",
       "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
       "dev": true
     },
@@ -7052,21 +7060,6 @@
         "object-visit": "^1.0.0"
       }
     },
-    "color-convert": {
-      "version": "1.9.3",
-      "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
-      "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
-      "dev": true,
-      "requires": {
-        "color-name": "1.1.3"
-      }
-    },
-    "color-name": {
-      "version": "1.1.3",
-      "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
-      "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
-      "dev": true
-    },
     "color-support": {
       "version": "1.1.3",
       "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
@@ -7194,12 +7187,12 @@
       "dev": true
     },
     "debug": {
-      "version": "4.3.1",
-      "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
-      "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
+      "version": "4.4.3",
+      "resolved": "https://nexus.fakecake.org/repository/npm/debug/-/debug-4.4.3.tgz",
+      "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
       "dev": true,
       "requires": {
-        "ms": "2.1.2"
+        "ms": "^2.1.3"
       }
     },
     "decamelize": {
@@ -7215,9 +7208,9 @@
       "dev": true
     },
     "deep-is": {
-      "version": "0.1.3",
-      "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
-      "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
+      "version": "0.1.4",
+      "resolved": "https://nexus.fakecake.org/repository/npm/deep-is/-/deep-is-0.1.4.tgz",
+      "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
       "dev": true
     },
     "default-compare": {
@@ -7365,12 +7358,6 @@
         "object.defaults": "^1.1.0"
       }
     },
-    "emoji-regex": {
-      "version": "8.0.0",
-      "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
-      "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
-      "dev": true
-    },
     "end-of-stream": {
       "version": "1.4.4",
       "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
@@ -7380,15 +7367,6 @@
         "once": "^1.4.0"
       }
     },
-    "enquirer": {
-      "version": "2.3.6",
-      "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",
-      "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==",
-      "dev": true,
-      "requires": {
-        "ansi-colors": "^4.1.1"
-      }
-    },
     "epubjs": {
       "version": "0.3.90",
       "resolved": "https://registry.npmjs.org/epubjs/-/epubjs-0.3.90.tgz",
@@ -7472,48 +7450,73 @@
       "dev": true
     },
     "eslint": {
-      "version": "7.19.0",
-      "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.19.0.tgz",
-      "integrity": "sha512-CGlMgJY56JZ9ZSYhJuhow61lMPPjUzWmChFya71Z/jilVos7mR/jPgaEfVGgMBY5DshbKdG8Ezb8FDCHcoMEMg==",
-      "dev": true,
-      "requires": {
-        "@babel/code-frame": "^7.0.0",
-        "@eslint/eslintrc": "^0.3.0",
-        "ajv": "^6.10.0",
+      "version": "8.57.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/eslint/-/eslint-8.57.1.tgz",
+      "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==",
+      "dev": true,
+      "requires": {
+        "@eslint-community/eslint-utils": "^4.2.0",
+        "@eslint-community/regexpp": "^4.6.1",
+        "@eslint/eslintrc": "^2.1.4",
+        "@eslint/js": "8.57.1",
+        "@humanwhocodes/config-array": "^0.13.0",
+        "@humanwhocodes/module-importer": "^1.0.1",
+        "@nodelib/fs.walk": "^1.2.8",
+        "@ungap/structured-clone": "^1.2.0",
+        "ajv": "^6.12.4",
         "chalk": "^4.0.0",
         "cross-spawn": "^7.0.2",
-        "debug": "^4.0.1",
+        "debug": "^4.3.2",
         "doctrine": "^3.0.0",
-        "enquirer": "^2.3.5",
-        "eslint-scope": "^5.1.1",
-        "eslint-utils": "^2.1.0",
-        "eslint-visitor-keys": "^2.0.0",
-        "espree": "^7.3.1",
-        "esquery": "^1.2.0",
+        "escape-string-regexp": "^4.0.0",
+        "eslint-scope": "^7.2.2",
+        "eslint-visitor-keys": "^3.4.3",
+        "espree": "^9.6.1",
+        "esquery": "^1.4.2",
         "esutils": "^2.0.2",
-        "file-entry-cache": "^6.0.0",
-        "functional-red-black-tree": "^1.0.1",
-        "glob-parent": "^5.0.0",
-        "globals": "^12.1.0",
-        "ignore": "^4.0.6",
-        "import-fresh": "^3.0.0",
+        "fast-deep-equal": "^3.1.3",
+        "file-entry-cache": "^6.0.1",
+        "find-up": "^5.0.0",
+        "glob-parent": "^6.0.2",
+        "globals": "^13.19.0",
+        "graphemer": "^1.4.0",
+        "ignore": "^5.2.0",
         "imurmurhash": "^0.1.4",
         "is-glob": "^4.0.0",
-        "js-yaml": "^3.13.1",
+        "is-path-inside": "^3.0.3",
+        "js-yaml": "^4.1.0",
         "json-stable-stringify-without-jsonify": "^1.0.1",
         "levn": "^0.4.1",
-        "lodash": "^4.17.20",
-        "minimatch": "^3.0.4",
+        "lodash.merge": "^4.6.2",
+        "minimatch": "^3.1.2",
         "natural-compare": "^1.4.0",
-        "optionator": "^0.9.1",
-        "progress": "^2.0.0",
-        "regexpp": "^3.1.0",
-        "semver": "^7.2.1",
-        "strip-ansi": "^6.0.0",
-        "strip-json-comments": "^3.1.0",
-        "table": "^6.0.4",
-        "text-table": "^0.2.0",
-        "v8-compile-cache": "^2.0.3"
+        "optionator": "^0.9.3",
+        "strip-ansi": "^6.0.1",
+        "text-table": "^0.2.0"
+      },
+      "dependencies": {
+        "escape-string-regexp": {
+          "version": "4.0.0",
+          "resolved": "https://nexus.fakecake.org/repository/npm/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+          "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+          "dev": true
+        },
+        "find-up": {
+          "version": "5.0.0",
+          "resolved": "https://nexus.fakecake.org/repository/npm/find-up/-/find-up-5.0.0.tgz",
+          "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+          "dev": true,
+          "requires": {
+            "locate-path": "^6.0.0",
+            "path-exists": "^4.0.0"
+          }
+        },
+        "path-exists": {
+          "version": "4.0.0",
+          "resolved": "https://nexus.fakecake.org/repository/npm/path-exists/-/path-exists-4.0.0.tgz",
+          "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+          "dev": true
+        }
       }
     },
     "eslint-formatter-gitlab": {
@@ -7527,101 +7530,54 @@
       }
     },
     "eslint-scope": {
-      "version": "5.1.1",
-      "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
-      "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
+      "version": "7.2.2",
+      "resolved": "https://nexus.fakecake.org/repository/npm/eslint-scope/-/eslint-scope-7.2.2.tgz",
+      "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==",
       "dev": true,
       "requires": {
         "esrecurse": "^4.3.0",
-        "estraverse": "^4.1.1"
-      }
-    },
-    "eslint-utils": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz",
-      "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==",
-      "dev": true,
-      "requires": {
-        "eslint-visitor-keys": "^1.1.0"
-      },
-      "dependencies": {
-        "eslint-visitor-keys": {
-          "version": "1.3.0",
-          "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
-          "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
-          "dev": true
-        }
+        "estraverse": "^5.2.0"
       }
     },
     "eslint-visitor-keys": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz",
-      "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==",
+      "version": "3.4.3",
+      "resolved": "https://nexus.fakecake.org/repository/npm/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
+      "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
       "dev": true
     },
     "espree": {
-      "version": "7.3.1",
-      "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz",
-      "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==",
+      "version": "9.6.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/espree/-/espree-9.6.1.tgz",
+      "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==",
       "dev": true,
       "requires": {
-        "acorn": "^7.4.0",
-        "acorn-jsx": "^5.3.1",
-        "eslint-visitor-keys": "^1.3.0"
-      },
-      "dependencies": {
-        "eslint-visitor-keys": {
-          "version": "1.3.0",
-          "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
-          "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
-          "dev": true
-        }
+        "acorn": "^8.9.0",
+        "acorn-jsx": "^5.3.2",
+        "eslint-visitor-keys": "^3.4.1"
       }
     },
-    "esprima": {
-      "version": "4.0.1",
-      "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
-      "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
-      "dev": true
-    },
     "esquery": {
-      "version": "1.4.0",
-      "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz",
-      "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==",
+      "version": "1.7.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/esquery/-/esquery-1.7.0.tgz",
+      "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==",
       "dev": true,
       "requires": {
         "estraverse": "^5.1.0"
-      },
-      "dependencies": {
-        "estraverse": {
-          "version": "5.2.0",
-          "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
-          "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
-          "dev": true
-        }
       }
     },
     "esrecurse": {
       "version": "4.3.0",
-      "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/esrecurse/-/esrecurse-4.3.0.tgz",
       "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
       "dev": true,
       "requires": {
         "estraverse": "^5.2.0"
-      },
-      "dependencies": {
-        "estraverse": {
-          "version": "5.2.0",
-          "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
-          "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
-          "dev": true
-        }
       }
     },
     "estraverse": {
-      "version": "4.3.0",
-      "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
-      "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
+      "version": "5.3.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/estraverse/-/estraverse-5.3.0.tgz",
+      "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
       "dev": true
     },
     "esutils": {
@@ -7819,26 +7775,35 @@
     },
     "fast-deep-equal": {
       "version": "3.1.3",
-      "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
       "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
       "dev": true
     },
     "fast-json-stable-stringify": {
       "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
       "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
       "dev": true
     },
     "fast-levenshtein": {
       "version": "2.0.6",
-      "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
-      "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
+      "resolved": "https://nexus.fakecake.org/repository/npm/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+      "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
       "dev": true
     },
+    "fastq": {
+      "version": "1.20.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/fastq/-/fastq-1.20.1.tgz",
+      "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==",
+      "dev": true,
+      "requires": {
+        "reusify": "^1.0.4"
+      }
+    },
     "file-entry-cache": {
-      "version": "6.0.0",
-      "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.0.tgz",
-      "integrity": "sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA==",
+      "version": "6.0.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
+      "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==",
       "dev": true,
       "requires": {
         "flat-cache": "^3.0.4"
@@ -7916,19 +7881,20 @@
       "dev": true
     },
     "flat-cache": {
-      "version": "3.0.4",
-      "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
-      "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==",
+      "version": "3.2.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/flat-cache/-/flat-cache-3.2.0.tgz",
+      "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==",
       "dev": true,
       "requires": {
-        "flatted": "^3.1.0",
+        "flatted": "^3.2.9",
+        "keyv": "^4.5.3",
         "rimraf": "^3.0.2"
       }
     },
     "flatted": {
-      "version": "3.1.1",
-      "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz",
-      "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==",
+      "version": "3.4.2",
+      "resolved": "https://nexus.fakecake.org/repository/npm/flatted/-/flatted-3.4.2.tgz",
+      "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==",
       "dev": true
     },
     "flush-write-stream": {
@@ -7998,12 +7964,6 @@
       "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
       "dev": true
     },
-    "functional-red-black-tree": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
-      "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
-      "dev": true
-    },
     "get-caller-file": {
       "version": "1.0.3",
       "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
@@ -8042,12 +8002,12 @@
       }
     },
     "glob-parent": {
-      "version": "5.1.2",
-      "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
-      "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+      "version": "6.0.2",
+      "resolved": "https://nexus.fakecake.org/repository/npm/glob-parent/-/glob-parent-6.0.2.tgz",
+      "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
       "dev": true,
       "requires": {
-        "is-glob": "^4.0.1"
+        "is-glob": "^4.0.3"
       }
     },
     "glob-stream": {
@@ -8140,12 +8100,12 @@
       }
     },
     "globals": {
-      "version": "12.4.0",
-      "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz",
-      "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==",
+      "version": "13.24.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/globals/-/globals-13.24.0.tgz",
+      "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
       "dev": true,
       "requires": {
-        "type-fest": "^0.8.1"
+        "type-fest": "^0.20.2"
       }
     },
     "glogg": {
@@ -8169,6 +8129,12 @@
       "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=",
       "dev": true
     },
+    "graphemer": {
+      "version": "1.4.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/graphemer/-/graphemer-1.4.0.tgz",
+      "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==",
+      "dev": true
+    },
     "gulp": {
       "version": "4.0.2",
       "resolved": "https://registry.npmjs.org/gulp/-/gulp-4.0.2.tgz",
@@ -8447,12 +8413,6 @@
         }
       }
     },
-    "has-flag": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
-      "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
-      "dev": true
-    },
     "has-gulplog": {
       "version": "0.1.0",
       "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz",
@@ -8516,9 +8476,9 @@
       "dev": true
     },
     "ignore": {
-      "version": "4.0.6",
-      "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
-      "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",
+      "version": "5.3.2",
+      "resolved": "https://nexus.fakecake.org/repository/npm/ignore/-/ignore-5.3.2.tgz",
+      "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
       "dev": true
     },
     "image-size": {
@@ -8534,9 +8494,9 @@
       "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps="
     },
     "import-fresh": {
-      "version": "3.3.0",
-      "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
-      "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==",
+      "version": "3.3.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/import-fresh/-/import-fresh-3.3.1.tgz",
+      "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==",
       "dev": true,
       "requires": {
         "parent-module": "^1.0.0",
@@ -8699,16 +8659,10 @@
       "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
       "dev": true
     },
-    "is-fullwidth-code-point": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
-      "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
-      "dev": true
-    },
     "is-glob": {
-      "version": "4.0.1",
-      "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
-      "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
+      "version": "4.0.3",
+      "resolved": "https://nexus.fakecake.org/repository/npm/is-glob/-/is-glob-4.0.3.tgz",
+      "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
       "dev": true,
       "requires": {
         "is-extglob": "^2.1.1"
@@ -8740,6 +8694,12 @@
         }
       }
     },
+    "is-path-inside": {
+      "version": "3.0.3",
+      "resolved": "https://nexus.fakecake.org/repository/npm/is-path-inside/-/is-path-inside-3.0.3.tgz",
+      "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==",
+      "dev": true
+    },
     "is-plain-object": {
       "version": "2.0.4",
       "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
@@ -8808,25 +8768,24 @@
       "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
       "dev": true
     },
-    "js-tokens": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
-      "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
-      "dev": true
-    },
     "js-yaml": {
-      "version": "3.14.1",
-      "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
-      "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
+      "version": "4.1.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/js-yaml/-/js-yaml-4.1.1.tgz",
+      "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
       "dev": true,
       "requires": {
-        "argparse": "^1.0.7",
-        "esprima": "^4.0.0"
+        "argparse": "^2.0.1"
       }
     },
+    "json-buffer": {
+      "version": "3.0.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/json-buffer/-/json-buffer-3.0.1.tgz",
+      "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",
+      "dev": true
+    },
     "json-schema-traverse": {
       "version": "0.4.1",
-      "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
       "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
       "dev": true
     },
@@ -8863,6 +8822,15 @@
       "integrity": "sha1-h/zPrv/AtozRnVX2cilD+SnqNeo=",
       "dev": true
     },
+    "keyv": {
+      "version": "4.5.4",
+      "resolved": "https://nexus.fakecake.org/repository/npm/keyv/-/keyv-4.5.4.tgz",
+      "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",
+      "dev": true,
+      "requires": {
+        "json-buffer": "3.0.1"
+      }
+    },
     "kind-of": {
       "version": "6.0.3",
       "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
@@ -8940,7 +8908,7 @@
     },
     "levn": {
       "version": "0.4.1",
-      "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/levn/-/levn-0.4.1.tgz",
       "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
       "dev": true,
       "requires": {
@@ -8993,6 +8961,15 @@
         "lie": "3.1.1"
       }
     },
+    "locate-path": {
+      "version": "6.0.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/locate-path/-/locate-path-6.0.0.tgz",
+      "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
+      "dev": true,
+      "requires": {
+        "p-locate": "^5.0.0"
+      }
+    },
     "lodash": {
       "version": "4.17.21",
       "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
@@ -9165,15 +9142,6 @@
       "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=",
       "dev": true
     },
-    "lru-cache": {
-      "version": "6.0.0",
-      "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
-      "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
-      "dev": true,
-      "requires": {
-        "yallist": "^4.0.0"
-      }
-    },
     "make-dir": {
       "version": "2.1.0",
       "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz",
@@ -9300,9 +9268,9 @@
       "optional": true
     },
     "minimatch": {
-      "version": "3.0.4",
-      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
-      "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+      "version": "3.1.5",
+      "resolved": "https://nexus.fakecake.org/repository/npm/minimatch/-/minimatch-3.1.5.tgz",
+      "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
       "dev": true,
       "requires": {
         "brace-expansion": "^1.1.7"
@@ -9336,9 +9304,9 @@
       }
     },
     "ms": {
-      "version": "2.1.2",
-      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
-      "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+      "version": "2.1.3",
+      "resolved": "https://nexus.fakecake.org/repository/npm/ms/-/ms-2.1.3.tgz",
+      "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
       "dev": true
     },
     "multipipe": {
@@ -9562,9 +9530,9 @@
       }
     },
     "optionator": {
-      "version": "0.9.1",
-      "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz",
-      "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==",
+      "version": "0.9.4",
+      "resolved": "https://nexus.fakecake.org/repository/npm/optionator/-/optionator-0.9.4.tgz",
+      "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==",
       "dev": true,
       "requires": {
         "deep-is": "^0.1.3",
@@ -9572,7 +9540,7 @@
         "levn": "^0.4.1",
         "prelude-ls": "^1.2.1",
         "type-check": "^0.4.0",
-        "word-wrap": "^1.2.3"
+        "word-wrap": "^1.2.5"
       }
     },
     "ordered-read-streams": {
@@ -9593,6 +9561,24 @@
         "lcid": "^1.0.0"
       }
     },
+    "p-limit": {
+      "version": "3.1.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/p-limit/-/p-limit-3.1.0.tgz",
+      "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+      "dev": true,
+      "requires": {
+        "yocto-queue": "^0.1.0"
+      }
+    },
+    "p-locate": {
+      "version": "5.0.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/p-locate/-/p-locate-5.0.0.tgz",
+      "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
+      "dev": true,
+      "requires": {
+        "p-limit": "^3.0.2"
+      }
+    },
     "pako": {
       "version": "1.0.11",
       "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
@@ -9600,7 +9586,7 @@
     },
     "parent-module": {
       "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/parent-module/-/parent-module-1.0.1.tgz",
       "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
       "dev": true,
       "requires": {
@@ -9790,7 +9776,7 @@
     },
     "prelude-ls": {
       "version": "1.2.1",
-      "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/prelude-ls/-/prelude-ls-1.2.1.tgz",
       "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
       "dev": true
     },
@@ -9805,12 +9791,6 @@
       "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
       "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
     },
-    "progress": {
-      "version": "2.0.3",
-      "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
-      "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
-      "dev": true
-    },
     "prr": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
@@ -9840,9 +9820,15 @@
       }
     },
     "punycode": {
-      "version": "2.1.1",
-      "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
-      "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
+      "version": "2.3.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/punycode/-/punycode-2.3.1.tgz",
+      "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
+      "dev": true
+    },
+    "queue-microtask": {
+      "version": "1.2.3",
+      "resolved": "https://nexus.fakecake.org/repository/npm/queue-microtask/-/queue-microtask-1.2.3.tgz",
+      "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
       "dev": true
     },
     "read-pkg": {
@@ -9910,12 +9896,6 @@
         "safe-regex": "^1.1.0"
       }
     },
-    "regexpp": {
-      "version": "3.1.0",
-      "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz",
-      "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==",
-      "dev": true
-    },
     "remove-bom-buffer": {
       "version": "3.0.0",
       "resolved": "https://registry.npmjs.org/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz",
@@ -9978,12 +9958,6 @@
       "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
       "dev": true
     },
-    "require-from-string": {
-      "version": "2.0.2",
-      "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
-      "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
-      "dev": true
-    },
     "require-main-filename": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz",
@@ -10012,7 +9986,7 @@
     },
     "resolve-from": {
       "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/resolve-from/-/resolve-from-4.0.0.tgz",
       "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
       "dev": true
     },
@@ -10037,6 +10011,12 @@
       "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
       "dev": true
     },
+    "reusify": {
+      "version": "1.1.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/reusify/-/reusify-1.1.0.tgz",
+      "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==",
+      "dev": true
+    },
     "right-align": {
       "version": "0.1.3",
       "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz",
@@ -10048,13 +10028,22 @@
     },
     "rimraf": {
       "version": "3.0.2",
-      "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/rimraf/-/rimraf-3.0.2.tgz",
       "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
       "dev": true,
       "requires": {
         "glob": "^7.1.3"
       }
     },
+    "run-parallel": {
+      "version": "1.2.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/run-parallel/-/run-parallel-1.2.0.tgz",
+      "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
+      "dev": true,
+      "requires": {
+        "queue-microtask": "^1.2.2"
+      }
+    },
     "safe-buffer": {
       "version": "5.1.2",
       "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
@@ -10069,15 +10058,6 @@
         "ret": "~0.1.10"
       }
     },
-    "semver": {
-      "version": "7.3.4",
-      "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz",
-      "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==",
-      "dev": true,
-      "requires": {
-        "lru-cache": "^6.0.0"
-      }
-    },
     "semver-greatest-satisfied-range": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/semver-greatest-satisfied-range/-/semver-greatest-satisfied-range-1.1.0.tgz",
@@ -10136,43 +10116,6 @@
       "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
       "dev": true
     },
-    "slice-ansi": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz",
-      "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==",
-      "dev": true,
-      "requires": {
-        "ansi-styles": "^4.0.0",
-        "astral-regex": "^2.0.0",
-        "is-fullwidth-code-point": "^3.0.0"
-      },
-      "dependencies": {
-        "ansi-styles": {
-          "version": "4.3.0",
-          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
-          "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
-          "dev": true,
-          "requires": {
-            "color-convert": "^2.0.1"
-          }
-        },
-        "color-convert": {
-          "version": "2.0.1",
-          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
-          "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
-          "dev": true,
-          "requires": {
-            "color-name": "~1.1.4"
-          }
-        },
-        "color-name": {
-          "version": "1.1.4",
-          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
-          "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
-          "dev": true
-        }
-      }
-    },
     "snapdragon": {
       "version": "0.8.2",
       "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
@@ -10385,12 +10328,6 @@
         "extend-shallow": "^3.0.0"
       }
     },
-    "sprintf-js": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
-      "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
-      "dev": true
-    },
     "stack-trace": {
       "version": "0.0.10",
       "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
@@ -10438,24 +10375,13 @@
         "safe-buffer": "~5.1.0"
       }
     },
-    "string-width": {
-      "version": "4.2.0",
-      "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
-      "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
-      "dev": true,
-      "requires": {
-        "emoji-regex": "^8.0.0",
-        "is-fullwidth-code-point": "^3.0.0",
-        "strip-ansi": "^6.0.0"
-      }
-    },
     "strip-ansi": {
-      "version": "6.0.0",
-      "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
-      "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
+      "version": "6.0.1",
+      "resolved": "https://nexus.fakecake.org/repository/npm/strip-ansi/-/strip-ansi-6.0.1.tgz",
+      "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
       "dev": true,
       "requires": {
-        "ansi-regex": "^5.0.0"
+        "ansi-regex": "^5.0.1"
       }
     },
     "strip-bom": {
@@ -10469,19 +10395,10 @@
     },
     "strip-json-comments": {
       "version": "3.1.1",
-      "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
       "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
       "dev": true
     },
-    "supports-color": {
-      "version": "5.5.0",
-      "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
-      "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
-      "dev": true,
-      "requires": {
-        "has-flag": "^3.0.0"
-      }
-    },
     "sver-compat": {
       "version": "1.5.0",
       "resolved": "https://registry.npmjs.org/sver-compat/-/sver-compat-1.5.0.tgz",
@@ -10492,38 +10409,6 @@
         "es6-symbol": "^3.1.1"
       }
     },
-    "table": {
-      "version": "6.0.7",
-      "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz",
-      "integrity": "sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==",
-      "dev": true,
-      "requires": {
-        "ajv": "^7.0.2",
-        "lodash": "^4.17.20",
-        "slice-ansi": "^4.0.0",
-        "string-width": "^4.2.0"
-      },
-      "dependencies": {
-        "ajv": {
-          "version": "7.1.0",
-          "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.1.0.tgz",
-          "integrity": "sha512-svS9uILze/cXbH0z2myCK2Brqprx/+JJYK5pHicT/GQiBfzzhUVAIT6MwqJg8y4xV/zoGsUeuPuwtoiKSGE15g==",
-          "dev": true,
-          "requires": {
-            "fast-deep-equal": "^3.1.1",
-            "json-schema-traverse": "^1.0.0",
-            "require-from-string": "^2.0.2",
-            "uri-js": "^4.2.2"
-          }
-        },
-        "json-schema-traverse": {
-          "version": "1.0.0",
-          "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
-          "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
-          "dev": true
-        }
-      }
-    },
     "terser": {
       "version": "4.8.0",
       "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz",
@@ -10655,7 +10540,7 @@
     },
     "type-check": {
       "version": "0.4.0",
-      "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/type-check/-/type-check-0.4.0.tgz",
       "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
       "dev": true,
       "requires": {
@@ -10663,9 +10548,9 @@
       }
     },
     "type-fest": {
-      "version": "0.8.1",
-      "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
-      "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
+      "version": "0.20.2",
+      "resolved": "https://nexus.fakecake.org/repository/npm/type-fest/-/type-fest-0.20.2.tgz",
+      "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
       "dev": true
     },
     "typedarray": {
@@ -10831,7 +10716,7 @@
     },
     "uri-js": {
       "version": "4.4.1",
-      "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+      "resolved": "https://nexus.fakecake.org/repository/npm/uri-js/-/uri-js-4.4.1.tgz",
       "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
       "dev": true,
       "requires": {
@@ -10855,12 +10740,6 @@
       "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
       "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
     },
-    "v8-compile-cache": {
-      "version": "2.2.0",
-      "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz",
-      "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==",
-      "dev": true
-    },
     "v8flags": {
       "version": "3.2.0",
       "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz",
@@ -10997,9 +10876,9 @@
       "dev": true
     },
     "word-wrap": {
-      "version": "1.2.3",
-      "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
-      "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
+      "version": "1.2.5",
+      "resolved": "https://nexus.fakecake.org/repository/npm/word-wrap/-/word-wrap-1.2.5.tgz",
+      "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==",
       "dev": true
     },
     "wordwrap": {
@@ -11073,12 +10952,6 @@
       "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==",
       "dev": true
     },
-    "yallist": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
-      "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
-      "dev": true
-    },
     "yaml": {
       "version": "2.7.1",
       "resolved": "https://nexus.fakecake.org/repository/npm/yaml/-/yaml-2.7.1.tgz",
@@ -11152,6 +11025,12 @@
         "camelcase": "^3.0.0",
         "object.assign": "^4.1.0"
       }
+    },
+    "yocto-queue": {
+      "version": "0.1.0",
+      "resolved": "https://nexus.fakecake.org/repository/npm/yocto-queue/-/yocto-queue-0.1.0.tgz",
+      "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+      "dev": true
     }
   }
 }
diff --git a/package.json b/package.json
index b74609f..5e6a496 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
   "license": "GPL-3.0",
   "description": "",
   "devDependencies": {
-    "eslint": "^7.9.0",
+    "eslint": "^8.0.1",
     "eslint-formatter-gitlab": "^5.1.0",
     "gulp": "^4.0.2",
     "gulp-concat": "^2.6.1",
diff --git a/read.html b/read.html
index 7e9f58b..cc908a9 100644
--- a/read.html
+++ b/read.html
@@ -27,6 +27,8 @@
 	<script type="text/javascript">
 		'use strict';
 
+		const Reader = new ReaderClass();
+
 		if ('serviceWorker' in navigator) {
 			navigator.serviceWorker
 					.register('worker.js')
@@ -57,7 +59,7 @@
 				<div class="form-group">
 					<label class="col-sm-3 control-label">Font:</label>
 					<div class="col-sm-9">
-						<select class="font_family form-control" onchange="Reader.Settings.onFontChanged(this)">
+						<select class="font_family form-control" onchange="Reader.onFontChanged(this)">
 							<option>Arial</option>
 							<option>Caecilia</option>
 							<option>Calibri</option>
@@ -77,21 +79,21 @@
 				<div class="form-group">
 					<label class="col-sm-3 control-label">Text size:</label>
 					<div class="col-sm-9">
-						<select class="font_size form-control" onchange="Reader.Settings.onTextSizeChanged(this)"></select>
+						<select class="font_size form-control" onchange="Reader.onTextSizeChanged(this)"></select>
 					</div>
   				</div>
 
 				<div class="form-group">
 					<label class="col-sm-3 control-label">Line height:</label>
 					<div class="col-sm-9">
-						<select class="line_height form-control" onchange="Reader.Settings.onLineHeightChanged(this)"></select>
+						<select class="line_height form-control" onchange="Reader.onLineHeightChanged(this)"></select>
 					</div>
   				</div>
 
 				<div class="form-group">
 					<label class="col-sm-3 control-label">Theme:</label>
 					<div class="col-sm-9">
-						<select class="theme_name form-control" onchange="Reader.Settings.onThemeChanged(this)">
+						<select class="theme_name form-control" onchange="Reader.onThemeChanged(this)">
 							<option value="default">Default</option>
 						 	<option value="light">Light</option>
 						 	<option value="gray">Gray</option>
@@ -140,7 +142,7 @@
 						<div class="input-group">
 							<input type="numeric" disabled="disabled" class="form-control lastread_input">
 							<span class="input-group-btn">
-								<button class="btn btn-danger" type="button" onclick="Reader.Page.clearLastRead()">Reset</button>
+								<button class="btn btn-danger" type="button" onclick="Reader.clearLastRead()">Reset</button>
 							</span>
 						</div>
 					</div>
@@ -149,9 +151,9 @@
 				<div class="form-group">
 					<label class="col-sm-3 control-label"></label>
 					<div class="col-sm-9">
-						<button class="btn btn-default" type="button" onclick="Reader.Page.openLastRead()">Open last read</button>
+						<button class="btn btn-default" type="button" onclick="Reader.openLastRead()">Open last read</button>
 						<button class="btn btn-primary" type="button" onclick="Reader.markAsRead()">Mark read</button>
-						<button class="btn btn-warning" type="button" onclick="Reader.Page.resetLocations()">Reset locations</button>
+						<button class="btn btn-warning" type="button" onclick="Reader.resetLocations()">Reset locations</button>
 					</div>
 				</div>
 
@@ -241,7 +243,7 @@
 	<div class="toolbar">
 
 		<div class="prev_location_btn"
-			onclick="Reader.Page.openPrevious(this)" style="display : none">
+			onclick="Reader.openPrevious(this)" style="display : none">
 			<div class="glyphicon glyphicon-chevron-left" aria-hidden="true"></div>
 		</div>