/*!
 *
 *  # Bibi Extension: Extractor (on the fly)                     (℠)
 *
 *  * © Satoru Matsushima - https://bibi.epub.link or https://github.com/satorumurmur/bibi
 *  * Open source under the MIT License - https://github.com/satorumurmur/bibi/blob/master/LICENSE
 *
 *  * Depends on:
 *      - Bibi Zip Loader : © Lunascape - https://github.com/lunascape/bibi-zip-loader / Licensed under the MIT License - https://github.com/lunascape/bibi-zip-loader/blob/master/LICENSE
 *
 */!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=23)}({23:function(t,e,r){var n=new(r(24))({url:S.book,worker:document.currentScript.src.replace(/\.js$/,".bibi-zip-loader.worker"+(sML.UA.Trident?".alt":"")+".js")});Bibi.x({id:"Extractor_on-the-fly",description:"Utilities for Zipped Books. (Method: on-the-fly)",author:"Satoru Matsushima (@satorumurmur)",version:"1.2.0"})((function(){O.RangeLoader=n}))},24:function(t,e,r){(function(t){var r,n,o,i;function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}window,i=function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==a(t)&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){t.exports=r(2)},function(t,e,r){var n=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new j(n||[]);return i._invoke=function(t,e,r){var n=l;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===v){if("throw"===o)throw i;return L()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=O(a,r);if(u){if(u===y)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var c=f(t,e,r);if("normal"===c.type){if(n=r.done?v:h,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=v,r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l="suspendedStart",h="suspendedYield",p="executing",v="completed",y={};function d(){}function g(){}function m(){}var b={};b[i]=function(){return this};var w=Object.getPrototypeOf,k=w&&w(w(S([])));k&&k!==r&&n.call(k,i)&&(b=k);var x=m.prototype=d.prototype=Object.create(b);function E(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function T(t){var e;this._invoke=function(r,o){function i(){return new Promise((function(e,i){!function e(r,o,i,u){var c=f(t[r],t,o);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==a(l)&&n.call(l,"__await")?Promise.resolve(l.__await).then((function(t){e("next",t,i,u)}),(function(t){e("throw",t,i,u)})):Promise.resolve(l).then((function(t){s.value=t,i(s)}),(function(t){return e("throw",t,i,u)}))}u(c.arg)}(r,o,e,i)}))}return e=e?e.then(i,i):i()}}function O(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,O(t,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=f(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function S(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}return{next:L}}function L(){return{value:e,done:!0}}return g.prototype=x.constructor=m,m.constructor=g,m[c]=g.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},E(T.prototype),T.prototype[u]=function(){return this},t.AsyncIterator=T,t.async=function(e,r,n,o){var i=new T(s(e,r,n,o));return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},E(x),x[c]="Generator",x[i]=function(){return this},x.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;P(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:S(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,e,r){"use strict";var n,o;function i(){var t,e,r=new Promise((function(r,n){t=r,e=n}));return r.status=n.PENDING,r.attachPromise=function(o){o.then((function(e){r.status=n.RESOLVED,t(e)}),(function(t){r.status=n.REJECTED,e(t)}))},r.attachMessage=function(o){var i=o.error,a=o.payload;i?(r.status=n.REJECTED,e(a)):(r.status=n.RESOLVED,t(a))},r}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function u(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.r(e),r(1),function(t){t[t.PENDING=0]="PENDING",t[t.RESOLVED=1]="RESOLVED",t[t.REJECTED=2]="REJECTED"}(n||(n={})),function(t){t.INIT="INIT",t.GET_DATA="GET_DATA",t.ABORT_DATA="ABORT_DATA",t.UPDATE_STATE="UPDATE_STATE"}(o||(o={}));var c=function(){function t(e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.params=e,u(this,"resolvers",void 0),u(this,"worker",void 0),u(this,"onFallback",void 0),u(this,"onmessage",(function(t){var e=t.data,n=e.type;if(n===o.INIT)r.resolvers.init.attachMessage(e);else if(n===o.GET_DATA){var i=e.meta,a=r.resolvers.getData[i];a&&a.attachMessage(e)}else n===o.UPDATE_STATE&&r.onFallback&&r.onFallback()})),u(this,"terminate",(function(){Object.keys(r.resolvers.getData).forEach(r.abort),r.worker.terminate()}));var n=i();this.resolvers={init:n,getData:{}},this.worker=new Worker(e.worker||"lszlw.js"),this.worker.onmessage=this.onmessage,this.worker.postMessage({type:o.INIT,payload:e})}var e,r;return e=t,(r=[{key:"getState",value:function(){return this.resolvers.init}},{key:"getBuffer",value:function(t){var e=this,r=this.resolvers.getData[t];if(r)return r;var n=i();return this.resolvers.getData[t]=n,this.worker.postMessage({type:o.GET_DATA,payload:t}),n.then((function(){delete e.resolvers.getData[t]}),(function(){delete e.resolvers.getData[t]})),n}},{key:"getExistsBuffer",value:function(t){var e=this.resolvers.getData[t];if(e)return e}},{key:"getPendingCount",value:function(){return Object.keys(this.resolvers.getData).length}},{key:"abort",value:function(t){this.resolvers.getData[t]&&this.worker.postMessage({type:o.ABORT_DATA,payload:t})}}])&&a(e.prototype,r),t}();function s(){return!!document.uniqueID}function f(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function l(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){f(i,n,o,a,u,"next",t)}function u(t){f(i,n,o,a,u,"throw",t)}a(void 0)}))}}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function p(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.d(e,"default",(function(){return v}));var v=function(){function t(e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.params=e,p(this,"url",void 0),p(this,"debug",void 0),p(this,"setupWorkers",void 0),p(this,"prefetching",void 0),p(this,"prefetchAll",(function(){if(r.prefetching)return r.prefetching;var t=l(regeneratorRuntime.mark((function t(){var e,n,o,i,a,u,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.getEntryNames();case 2:e=t.sent,n=!0,o=!1,i=void 0,t.prev=6,a=e[Symbol.iterator]();case 8:if(n=(u=a.next()).done){t.next=15;break}return c=u.value,t.next=12,r.getBuffer(c);case 12:n=!0,t.next=8;break;case 15:t.next=21;break;case 17:t.prev=17,t.t0=t.catch(6),o=!0,i=t.t0;case 21:t.prev=21,t.prev=22,n||null==a.return||a.return();case 24:if(t.prev=24,!o){t.next=27;break}throw i;case 27:return t.finish(24);case 28:return t.finish(21);case 29:case"end":return t.stop()}}),t,null,[[6,17,21,29],[22,,24,28]])})))();return t.catch((function(){return r.prefetching=void 0})),r.prefetching=t})),p(this,"abort",function(){var t=l(regeneratorRuntime.mark((function t(e){var n,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.setupWorkers;case 2:for(n=t.sent,o=0;o<n.length;o++)n[o].abort(e);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),p(this,"getEntryNames",l(regeneratorRuntime.mark((function t(){var e,n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r.throwIfAbort(),t.next=3,r.setupWorkers;case 3:return e=t.sent,t.next=6,e[0].getState();case 6:return n=t.sent,t.abrupt("return",n.entryNames);case 8:case"end":return t.stop()}}),t)})))),p(this,"getBuffer",function(){var t=l(regeneratorRuntime.mark((function t(e){var n,o,i,a,u;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r.throwIfAbort(),t.next=3,r.setupWorkers;case 3:n=t.sent,o=0;case 5:if(!(o<n.length)){t.next=13;break}if(i=n[o],!(a=i.getExistsBuffer(e))){t.next=10;break}return t.abrupt("return",a);case 10:o++,t.next=5;break;case 13:return t.next=15,r.getMostFreeWorker();case 15:return u=t.sent,t.abrupt("return",u.getBuffer(e));case 17:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}());var n=new URL(e.url,window.location.href).href;this.url=n,this.throwIfAbort(),this.setupWorkers=l(regeneratorRuntime.mark((function t(){var n,o,i,a,u;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new c({url:r.url,worker:r.params.worker,noUseCache:s(),forceInMemoryCache:r.params.forceInMemoryCache,forceKeepCache:r.params.forceKeepCache}),t.next=3,n.getState();case 3:if(!t.sent.fallback){t.next=6;break}return t.abrupt("return",[n]);case 6:for(n.onFallback=function(){return r.fallback(n)},o=[n],i=e.multiply&&Math.max(e.multiply,1)||4,a=function(t){var e=new c({url:r.url,worker:r.params.worker,noUseCache:s(),forceKeepCache:!0});e.onFallback=function(){return r.fallback(e)},o.push(e)},u=1;u<i;u++)a();return t.abrupt("return",o);case 12:case"end":return t.stop()}}),t)})))()}var e,r;return e=t,(r=[{key:"getMostFreeWorker",value:function(){var t=l(regeneratorRuntime.mark((function t(){var e,r,n,o,i,a,u;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setupWorkers;case 2:for(e=t.sent,r=Number.POSITIVE_INFINITY,n=e[0],o=0,i=0;i<e.length;i++)a=e[i],u=a.getPendingCount(),r>u&&(r=u,n=a),o=Math.max(o,u);return t.abrupt("return",n);case 8:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"throwIfAbort",value:function(){}},{key:"fallback",value:function(t){this.setupWorkers=this.setupWorkers.then((function(e){return e.filter((function(e){return e!==t}))})).then((function(t){return t.forEach((function(t){return t.terminate()}))})).then((function(){return[t]}))}}])&&h(e.prototype,r),t}()}]).default},"object"==a(e)&&"object"==a(t)?t.exports=i():(n=[],void 0===(o="function"==typeof(r=i)?r.apply(e,n):r)||(t.exports=o))}).call(this,r(25)(t))},25:function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}}});