var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,b,d){a instanceof String&&(a=String(a));for(var e=a.length,c=0;c<e;c++){var f=a[c];if(b.call(d,f,c,a))return{i:c,v:f}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,d){a!=Array.prototype&&a!=Object.prototype&&(a[b]=d.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.polyfill=function(a,b,d,e){if(b){d=$jscomp.global;a=a.split(".");for(e=0;e<a.length-1;e++){var c=a[e];c in d||(d[c]={});d=d[c]}a=a[a.length-1];e=d[a];b=b(e);b!=e&&null!=b&&$jscomp.defineProperty(d,a,{configurable:!0,writable:!0,value:b})}};$jscomp.polyfill("Array.prototype.findIndex",function(a){return a?a:function(a,d){return $jscomp.findInternal(this,a,d).i}},"es6","es3");
(function(a){function b(e){if(d[e])return d[e].exports;var c=d[e]={i:e,l:!1,exports:{}};a[e].call(c.exports,c,c.exports,b);c.l=!0;return c.exports}var d={};b.m=a;b.c=d;b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{configurable:!1,enumerable:!0,get:d})};b.n=function(a){var c=a&&a.__esModule?function(){return a["default"]}:function(){return a};b.d(c,"a",c);return c};b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};b.p="";return b(b.s=0)})([function(a,b,d){Object.defineProperty(b,
"__esModule",{value:!0});var e=d(1),c=self;a=function(){this.queue=null;this.messageHandler()};a.prototype.messageHandler=function(){var a=this;c.onmessage=function(b){b=b.data;switch(b.type){case e.MSG_RECITATE_DL.UI2WK_ENQUEUE:a.updateQueue(b);b.requireStartDownload?(console.log("[RDL WORKER] updateQueue - : start download process."),a.notifyDownload()):console.log("[RDL WORKER] updateQueue - : download process is already running (or completed).");break;case e.MSG_RECITATE_DL.UI2WK_DOWNLOAD_COMPLETE:c.postMessage({type:e.MSG_RECITATE_DL.WK2UI_BUFFER_READY,
source:b.source}),a.notifyDownload()}};c.postMessage({type:e.MSG_RECITATE_DL.WK2UI_READY})};a.prototype.notifyDownload=function(){if(this.queue.length){var a=this.queue.splice(0,1)[0];c.postMessage({type:e.MSG_RECITATE_DL.WK2UI_DOWNLOAD,source:a})}else console.log("[RDL WORKER] notifyDownload - queue is empty.")};a.prototype.updateQueue=function(a){var b=a.startItem?a.allItems.findIndex(function(b){return b.source===a.startItem}):0,c=a.allItems.filter(function(c,d){return d>=b&&c.readerId===a.readerId}).map(function(a){return a.source}),
d=a.allItems.filter(function(b){return b.readerId!==a.readerId}).map(function(a){return a.source}),e=a.allItems.filter(function(c,d){return d<b&&c.readerId===a.readerId}).map(function(a){return a.source});this.queue=c.concat(e).concat(d)};b.RecitateDownloadWorker=a;new a},function(a,b,d){Object.defineProperty(b,"__esModule",{value:!0});a=b.MSG_RECITATE_DL||(b.MSG_RECITATE_DL={});a[a.UI2WK_ENQUEUE=0]="UI2WK_ENQUEUE";a[a.UI2WK_DOWNLOAD_COMPLETE=1]="UI2WK_DOWNLOAD_COMPLETE";a[a.WK2UI_READY=2]="WK2UI_READY";
a[a.WK2UI_DOWNLOAD=3]="WK2UI_DOWNLOAD";a[a.WK2UI_BUFFER_READY=4]="WK2UI_BUFFER_READY"}]);
