mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-05 15:32:55 +02:00
1 line
No EOL
101 KiB
JavaScript
1 line
No EOL
101 KiB
JavaScript
(function(s,p){'object'==typeof exports&&'object'==typeof module?module.exports=p(function(){try{return require('JSZip')}catch(f){}}(),require('xmldom')):'function'==typeof define&&define.amd?define(['JSZip','xmldom'],p):'object'==typeof exports?exports.ePub=p(function(){try{return require('JSZip')}catch(f){}}(),require('xmldom')):s.ePub=p(s.JSZip,s.xmldom)})(this,function(t,s){return function(p){function u(v){if(f[v])return f[v].exports;var _=f[v]={i:v,l:!1,exports:{}};return p[v].call(_.exports,_,_.exports,u),_.l=!0,_.exports}var f={};return u.m=p,u.c=f,u.i=function(v){return v},u.d=function(v,_,C){Object.defineProperty(v,_,{configurable:!1,enumerable:!0,get:C})},u.n=function(v){var _=v&&v.__esModule?function(){return v['default']}:function(){return v};return u.d(_,'a',_),_},u.o=function(v,_){return Object.prototype.hasOwnProperty.call(v,_)},u.p='/dist/',u(u.s=48)}([function(p,u,f){'use strict';'use strict';function v(B,R){var A=-1<B.indexOf('://'),O=B;if(this.Url=void 0,this.href=B,this.protocol='',this.origin='',this.fragment='',this.search='',this.base=R,A||'string'==typeof R||(this.base=window&&window.location.href),A||this.base)try{this.Url=this.base?new URL(B,this.base):new URL(B),this.href=this.Url.href,this.protocol=this.Url.protocol,this.origin=this.Url.origin,this.fragment=this.Url.fragment,this.search=this.Url.search,O=this.Url.pathname}catch(W){this.Url=void 0}this.Path=new _(O),this.directory=this.Path.directory,this.filename=this.Path.filename,this.extension=this.Path.extension}function _(B){var R,A;R=B.indexOf('://'),-1<R&&(B=new URL(B).pathname),A=this.parse(B),this.path=B,this.directory=this.isDirectory(B)?B:A.dir+'/',this.filename=A.base,this.extension=A.ext.slice(1)}function C(){var B=new Date().getTime(),R='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(A){var O=0|(B+16*Math.random())%16;return B=Math.floor(B/16),('x'==A?O:8|7&O).toString(16)});return R}function S(B){return!isNaN(parseFloat(B))&&isFinite(B)}function k(B,R,A,O,W){var D,U=O||0,I=W||R.length,M=parseInt(U+(I-U)/2);return(A||(A=function(H,V){return H>V?1:H<V?-1:(H=V)?0:void 0}),0>=I-U)?M:(D=A(R[M],B),1==I-U?0<D?M:M+1:0===D?M:-1===D?k(B,R,A,M,I):k(B,R,A,U,M))}function E(B,R,A,O,W){var D,U=O||0,I=W||R.length,M=parseInt(U+(I-U)/2);return(A||(A=function(H,V){return H>V?1:H<V?-1:(H=V)?0:void 0}),0>=I-U)?-1:(D=A(R[M],B),1==I-U?0===D?M:-1:0===D?M:-1===D?E(B,R,A,M,I):E(B,R,A,U,M))}function T(B,R,A){for(var O=document.createTreeWalker(B,A,null,!1),W=void 0;W=O.nextNode();)R(W)}function P(B,R){if(R(B))return!0;if(B=B.firstChild)do if(P(B,R))return!0;while(B=B.nextSibling)}f(31);var z=f(8),N='undefined'!=typeof window&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame);v.prototype.path=function(){return this.Path},v.prototype.resolve=function(B){var A,R=-1<B.indexOf('://');return R?B:(A=z.resolve(this.directory,B),this.origin+A)},v.prototype.relative=function(B){return z.relative(B,this.directory)},v.prototype.toString=function(){return this.href},_.prototype.parse=function(B){return z.parse(B)},_.prototype.isAbsolute=function(B){return z.isAbsolute(B||this.path)},_.prototype.isDirectory=function(B){return'/'===B.charAt(B.length-1)},_.prototype.resolve=function(B){return z.resolve(this.directory,B)},_.prototype.relative=function(B){return z.relative(this.directory,B)},_.prototype.splitPath=function(B){return this.splitPathRe.exec(B).slice(1)},_.prototype.toString=function(){return this.path};p.exports={isElement:function(R){return!!(R&&1==R.nodeType)},uuid:C,values:function(R){for(var A=-1,O=Object.keys(R),W=O.length,U=Array(W);++A<W;)U[A]=R[O[A]];return U},resolveUrl:function(R,A){var H,O=[],W=[],U=uri(R),I=uri(A),M=U.directory,D=I.directory,F=[];return'/'===M[0]&&(M=M.substring(1)),'/'===D[D.length-1]&&(M=M.substring(0,M.length-1)),'/'===D[0]&&(D=D.substring(1)),'/'===D[D.length-1]&&(D=D.substring(0,D.length-1)),M&&(F=M.split('/')),H=D.split('/'),H.reverse().forEach(function(V){'..'===V?F.pop():V===F[F.length-1]?(F.pop(),W.unshift(V)):W.unshift(V)}),O=[U.origin],F.length&&(O=O.concat(F)),O=O.concat(W),O=O.concat(I.filename),O.join('/')},indexOfSorted:E,documentHeight:function(){return Math.max(document.documentElement.clientHeight,document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight)},isNumber:S,isFloat:function(R){return S(R)&&Math.floor(R)!==R},prefixed:function(R){var A=['Webkit','Moz','O','ms'],O=R[0].toUpperCase()+R.slice(1),W=A.length;if('undefined'==typeof document||'undefined'!=typeof document.body.style[R])return R;for(var U=0;U<W;U++)if('undefined'!=typeof document.body.style[A[U]+O])return A[U]+O;return R},defaults:function(R){for(var A=1,O=arguments.length;A<O;A++){var W=arguments[A];for(var U in W)void 0===R[U]&&(R[U]=W[U])}return R},extend:function(R){var A=[].slice.call(arguments,1);return A.forEach(function(O){O&&Object.getOwnPropertyNames(O).forEach(function(W){Object.defineProperty(R,W,Object.getOwnPropertyDescriptor(O,W))})}),R},insert:function(R,A,O){var W=k(R,A,O);return A.splice(W,0,R),W},locationOf:k,indexOfSorted:E,requestAnimationFrame:N,bounds:function(R){var A=window.getComputedStyle(R),O=0,W=0;return['width','paddingRight','paddingLeft','marginRight','marginLeft','borderRightWidth','borderLeftWidth'].forEach(function(U){O+=parseFloat(A[U])||0}),['height','paddingTop','paddingBottom','marginTop','marginBottom','borderTopWidth','borderBottomWidth'].forEach(function(U){W+=parseFloat(A[U])||0}),{height:W,width:O}},borders:function(R){var A=window.getComputedStyle(R),O=0,W=0;return['paddingRight','paddingLeft','marginRight','marginLeft','borderRightWidth','borderLeftWidth'].forEach(function(U){O+=parseFloat(A[U])||0}),['paddingTop','paddingBottom','marginTop','marginBottom','borderTopWidth','borderBottomWidth'].forEach(function(U){W+=parseFloat(A[U])||0}),{height:W,width:O}},windowBounds:function(){var R=window.innerWidth,A=window.innerHeight;return{top:0,left:0,right:R,bottom:A,width:R,height:A}},cleanStringForXpath:function(R){var A=R.match(/[^'"]+|['"]/g);return A=A.map(function(O){return'\''===O?'"\'"':'"'===O?'\'"\'':'\''+O+'\''}),'concat(\'\','+A.join(',')+')'},indexOfTextNode:function(R){var A=R.parentNode,O=A.childNodes,W,U=-1;for(var I=0;I<O.length&&(W=O[I],W.nodeType===Node.TEXT_NODE&&U++,W!=R);I++);return U},isXml:function(R){return-1<['xml','opf','ncx'].indexOf(R)},createBlob:function(R,A){var O=new Blob([R],{type:A});return O},createBlobUrl:function(R,A){var W,O=window.URL||window.webkitURL||window.mozURL,U=this.createBlob(R,A);return W=O.createObjectURL(U),W},type:function(R){return Object.prototype.toString.call(R).slice(8,-1)},parse:function(R,A,O){var W;return('undefined'==typeof DOMParser||O)&&(DOMParser=f(12).DOMParser),W=new DOMParser().parseFromString(R,A),W},qs:function(R,A){var O;if(!R)throw new Error('No Element Provided');return'undefined'==typeof R.querySelector?(O=R.getElementsByTagName(A),O.length)?O[0]:void 0:R.querySelector(A)},qsa:function(R,A){return'undefined'==typeof R.querySelector?R.getElementsByTagName(A):R.querySelectorAll(A)},qsp:function(R,A,O){var W,U;if('undefined'!=typeof R.querySelector){for(var I in A+='[',O)A+=I+'=\''+O[I]+'\'';return A+=']',R.querySelector(A)}return(W=R.getElementsByTagName(A),U=Array.prototype.slice.call(W,0).filter(function(M){for(var D in O)if(M.getAttribute(D)===O[D])return!0;return!1}),U)?U[0]:void 0},blob2base64:function(R,A){var O=new FileReader;O.readAsDataURL(R),O.onloadend=function(){A(O.result)}},createBase64Url:function(R,A){var O,W;if('string'==typeof R)return O=btoa(R),W='data:'+A+';base64,'+O,W},defer:function(){this.resolve=null,this.reject=null,this.id=C(),this.promise=new Promise(function(R,A){this.resolve=R,this.reject=A}.bind(this)),Object.freeze(this)},Url:v,Path:_,querySelectorByType:function(R,A,O){var W;if('undefined'!=typeof R.querySelector&&(W=R.querySelector(A+'[*|type="'+O+'"]')),!W||0===W.length){W=this.qsa(R,A);for(var U=0;U<W.length;U++)if(W[U].getAttributeNS('http://www.idpf.org/2007/ops','type')===O)return W[U]}else return W},sprint:function(R,A){var O=R.ownerDocument||R;'undefined'==typeof O.createTreeWalker?P(R,function(W){W&&3===W.nodeType&&A(W)},!0):T(R,A,NodeFilter.SHOW_TEXT)},children:function(R){var B=[],A=R.parentNode.childNodes;for(var O=0;O<A.length;O++){var W=A[O];1===W.nodeType&&B.push(W)}return B}}},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(0),_=1,C=3;class S{constructor(k,E,T){var P;if(this.str='',this.base={},this.spinePos=0,this.range=!1,this.path={},this.start=null,this.end=null,!(this instanceof S))return new S(k,E,T);if('string'==typeof E?this.base=this.parseComponent(E):'object'==typeof E&&E.steps&&(this.base=E),P=this.checkType(k),'string'===P)return this.str=k,v.extend(this,this.parse(k));if('range'===P)return v.extend(this,this.fromRange(k,this.base,T));if('node'===P)return v.extend(this,this.fromNode(k,this.base,T));if('EpubCFI'===P&&k.path)return k;if(!k)return this;throw new TypeError('not a valid argument for EpubCFI')}checkType(k){if(this.isCfiString(k))return'string';return'object'==typeof k&&('Range'===v.type(k)||'undefined'!=typeof k.startContainer)?'range':'object'==typeof k&&'undefined'!=typeof k.nodeType?'node':'object'==typeof k&&k instanceof S&&'EpubCFI'}parse(k){var T,P,z,E={spinePos:-1,range:!1,base:{},path:{},start:null,end:null};return'string'==typeof k?(0===k.indexOf('epubcfi(')&&')'===k[k.length-1]&&(k=k.slice(8,k.length-1)),T=this.getChapterComponent(k),!T)?{spinePos:-1}:(E.base=this.parseComponent(T),P=this.getPathComponent(k),E.path=this.parseComponent(P),z=this.getRange(k),z&&(E.range=!0,E.start=this.parseComponent(z[0]),E.end=this.parseComponent(z[1])),E.spinePos=E.base.steps[1].index,E):{spinePos:-1}}parseComponent(k){var z,E={steps:[],terminal:{offset:null,assertion:null}},T=k.split(':'),P=T[0].split('/');return 1<T.length&&(z=T[1],E.terminal=this.parseTerminal(z)),''===P[0]&&P.shift(),E.steps=P.map(function(N){return this.parseStep(N)}.bind(this)),E}parseStep(k){var E,T,P,z,N;if(z=k.match(/\[(.*)\]/),z&&z[1]&&(N=z[1]),T=parseInt(k),!isNaN(T))return 0==T%2?(E='element',P=T/2-1):(E='text',P=(T-1)/2),{type:E,index:P,id:N||null}}parseTerminal(k){var E,T,P=k.match(/\[(.*)\]/);return P&&P[1]?(E=parseInt(k.split('[')[0])||null,T=P[1]):E=parseInt(k)||null,{offset:E,assertion:T}}getChapterComponent(k){var E=k.split('!');return E[0]}getPathComponent(k){var E=k.split('!');if(E[1]){var T=E[1].split(',');return T[0]}}getRange(k){var E=k.split(',');return!(3!==E.length)&&[E[1],E[2]]}getCharecterOffsetComponent(k){var E=k.split(':');return E[1]||''}joinSteps(k){return k?k.map(function(E){var T='';return'element'===E.type&&(T+=2*(E.index+1)),'text'===E.type&&(T+=1+2*E.index),E.id&&(T+='['+E.id+']'),T}).join('/'):''}segmentString(k){var E='/';return E+=this.joinSteps(k.steps),k.terminal&&null!=k.terminal.offset&&(E+=':'+k.terminal.offset),k.terminal&&null!=k.terminal.assertion&&(E+='['+k.terminal.assertion+']'),E}toString(){var k='epubcfi(';return k+=this.segmentString(this.base),k+='!',k+=this.segmentString(this.path),this.start&&(k+=',',k+=this.segmentString(this.start)),this.end&&(k+=',',k+=this.segmentString(this.end)),k+=')',k}compare(k,E){var T,P,z,N;if('string'==typeof k&&(k=new S(k)),'string'==typeof E&&(E=new S(E)),k.spinePos>E.spinePos)return 1;if(k.spinePos<E.spinePos)return-1;k.range?(T=k.path.steps.concat(k.start.steps),z=k.start.terminal):(T=k.path.steps,z=k.path.terminal),E.range?(P=E.path.steps.concat(E.start.steps),N=E.start.terminal):(P=E.path.steps,N=E.path.terminal);for(var B=0;B<T.length;B++){if(!T[B])return-1;if(!P[B])return 1;if(T[B].index>P[B].index)return 1;if(T[B].index<P[B].index)return-1}return T.length<P.length?1:z.offset>N.offset?1:z.offset<N.offset?-1:0}step(k){var E=k.nodeType===C?'text':'element';return{id:k.id,tagName:k.tagName,type:E,index:this.position(k)}}filteredStep(k,E){var P,T=this.filter(k,E);if(T)return P=T.nodeType===C?'text':'element',{id:T.id,tagName:T.tagName,type:P,index:this.filteredPosition(T,E)}}pathTo(k,E,T){for(var N,P={steps:[],terminal:{offset:null,assertion:null}},z=k;z&&z.parentNode&&9!=z.parentNode.nodeType;)N=T?this.filteredStep(z,T):this.step(z),N&&P.steps.unshift(N),z=z.parentNode;return null!=E&&0<=E&&(P.terminal.offset=E,'text'!=P.steps[P.steps.length-1].type&&P.steps.push({type:'text',index:0})),P}equalStep(k,E){return k&&E&&k.index===E.index&&k.id===E.id&&k.type===E.type}fromRange(k,E,T){var P={range:!1,base:{},path:{},start:null,end:null},z=k.startContainer,N=k.endContainer,B=k.startOffset,R=k.endOffset,A=!1;if(T&&(A=null!=z.ownerDocument.querySelector('.'+T)),'string'==typeof E?(P.base=this.parseComponent(E),P.spinePos=P.base.steps[1].index):'object'==typeof E&&(P.base=E),k.collapsed)A&&(B=this.patchOffset(z,B,T)),P.path=this.pathTo(z,B,T);else{P.range=!0,A&&(B=this.patchOffset(z,B,T)),P.start=this.pathTo(z,B,T),A&&(R=this.patchOffset(N,R,T)),P.end=this.pathTo(N,R,T),P.path={steps:[],terminal:null};var W,O=P.start.steps.length;for(W=0;W<O&&this.equalStep(P.start.steps[W],P.end.steps[W]);W++)W===O-1?P.start.terminal===P.end.terminal&&(P.path.steps.push(P.start.steps[W]),P.range=!1):P.path.steps.push(P.start.steps[W]);P.start.steps=P.start.steps.slice(P.path.steps.length),P.end.steps=P.end.steps.slice(P.path.steps.length)}return P}fromNode(k,E,T){var P={range:!1,base:{},path:{},start:null,end:null};return T&&null!=k.ownerDocument.querySelector('.'+T),'string'==typeof E?(P.base=this.parseComponent(E),P.spinePos=P.base.steps[1].index):'object'==typeof E&&(P.base=E),P.path=this.pathTo(k,null,T),P}filter(k,E){var T,P,z,N,B,R=!1;return(k.nodeType===C?(R=!0,z=k.parentNode,T=k.parentNode.classList.contains(E)):(R=!1,T=k.classList.contains(E)),T&&R)?(N=z.previousSibling,B=z.nextSibling,N&&N.nodeType===C?P=N:B&&B.nodeType===C&&(P=B),P)?P:k:T&&!R?!1:k}patchOffset(k,E,T){if(k.nodeType!=C)return void console.error('Anchor must be a text node');var P=k,z=E;for(k.parentNode.classList.contains(T)&&(P=k.parentNode);P.previousSibling;){if(!(P.previousSibling.nodeType===_))z+=P.previousSibling.textContent.length;else if(P.previousSibling.classList.contains(T))z+=P.previousSibling.textContent.length;else break;P=P.previousSibling}return z}normalizedMap(k,E,T){var P={},z=-1,N,B=k.length,R,A;for(N=0;N<B;N++)R=k[N].nodeType,R===_&&k[N].classList.contains(T)&&(R=C),0<N&&R===C&&A===C?P[N]=z:E===R&&(z=z+1,P[N]=z),A=R;return P}position(k){var E,T;return k.nodeType===_?(E=k.parentNode.children,!E&&(E=v.children(k.parentNode)),T=Array.prototype.indexOf.call(E,k)):(E=this.textNodes(k.parentNode),T=E.indexOf(k)),T}filteredPosition(k,E){var T,P,z;return k.nodeType===_?(T=k.parentNode.children,z=this.normalizedMap(T,_,E)):(T=k.parentNode.childNodes,k.parentNode.classList.contains(E)&&(k=k.parentNode,T=k.parentNode.childNodes),z=this.normalizedMap(T,C,E)),P=Array.prototype.indexOf.call(T,k),z[P]}stepsToXpath(k){var E=['.','*'];return k.forEach(function(T){var P=T.index+1;T.id?E.push('*[position()='+P+' and @id=\''+T.id+'\']'):'text'===T.type?E.push('text()['+P+']'):E.push('*['+P+']')}),E.join('/')}stepsToQuerySelector(k){var E=['html'];return k.forEach(function(T){var P=T.index+1;T.id?E.push('#'+T.id):'text'!==T.type&&E.push('*:nth-child('+P+')')}),E.join('>')}textNodes(k,E){return Array.prototype.slice.call(k.childNodes).filter(function(T){if(T.nodeType===C)return!0;return E&&T.classList.contains(E)})}walkToNode(k,E,T){var P=E||document,z=P.documentElement,N,B=k.length,R;for(R=0;R<B;R++)N=k[R],'element'===N.type?z=z.children[N.index]:'text'===N.type&&(z=this.textNodes(z,T)[N.index]);return z}findNode(k,E,T){var z,N,P=E||document;return T||'undefined'==typeof P.evaluate?T?z=this.walkToNode(k,P,T):z=this.walkToNode(k,P):(N=this.stepsToXpath(k),z=P.evaluate(N,P,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue),z}fixMiss(k,E,T,P){var z=this.findNode(k.slice(0,-1),T,P),N=z.childNodes,B=this.normalizedMap(N,C,P),R,A,O,W=k[k.length-1].index;for(var O in B){if(!B.hasOwnProperty(O))return;if(B[O]===W)if(R=N[O],A=R.textContent.length,E>A)E=E-A;else{z=R.nodeType===_?R.childNodes[0]:R;break}}return{container:z,offset:E}}toRange(k,E){var z,N,B,R,O,W,I,T=k||document,P=T.createRange(),A=this,U=!!E&&null!=T.querySelector('.'+E);if(A.range?(z=A.start,O=A.path.steps.concat(z.steps),B=this.findNode(O,T,U?E:null),N=A.end,W=A.path.steps.concat(N.steps),R=this.findNode(W,T,U?E:null)):(z=A.path,O=A.path.steps,B=this.findNode(A.path.steps,T,U?E:null)),B)try{null==z.terminal.offset?P.setStart(B,0):P.setStart(B,z.terminal.offset)}catch(M){I=this.fixMiss(O,z.terminal.offset,T,U?E:null),P.setStart(I.container,I.offset)}else return null;if(R)try{null==N.terminal.offset?P.setEnd(R,0):P.setEnd(R,N.terminal.offset)}catch(M){I=this.fixMiss(W,A.end.terminal.offset,T,U?E:null),P.setEnd(I.container,I.offset)}return P}isCfiString(k){return'string'==typeof k&&0===k.indexOf('epubcfi(')&&')'===k[k.length-1]}generateChapterComponent(k,E,T){var P=parseInt(E),z='/'+(k+1)+'/';return z+=2*(P+1),T&&(z+='['+T+']'),z}}u.default=S,p.exports=u['default']},function(p,u,f){'use strict';'use strict';var N,B,R,A,O,W,U,v=f(32),_=f(41),C=Function.prototype.apply,S=Function.prototype.call,k=Object.create,E=Object.defineProperty,T=Object.defineProperties,P=Object.prototype.hasOwnProperty,z={configurable:!0,enumerable:!1,writable:!0};N=function(I,M){var D;return _(M),P.call(this,'__ee__')?D=this.__ee__:(D=z.value=k(null),E(this,'__ee__',z),z.value=null),D[I]?'object'==typeof D[I]?D[I].push(M):D[I]=[D[I],M]:D[I]=M,this},B=function(I,M){var D,F;return _(M),F=this,N.call(this,I,D=function(){R.call(F,I,D),C.call(M,this,arguments)}),D.__eeOnceListener__=M,this},R=function(I,M){var D,F,H,V;if(_(M),!P.call(this,'__ee__'))return this;if(D=this.__ee__,!D[I])return this;if(F=D[I],'object'==typeof F)for(V=0;H=F[V];++V)(H===M||H.__eeOnceListener__===M)&&(2===F.length?D[I]=F[V?0:1]:F.splice(V,1));else(F===M||F.__eeOnceListener__===M)&&delete D[I];return this},A=function(I){var M,D,F,H,V;if(P.call(this,'__ee__')&&(H=this.__ee__[I],H))if('object'==typeof H){for(D=arguments.length,V=Array(D-1),M=1;M<D;++M)V[M-1]=arguments[M];for(H=H.slice(),M=0;F=H[M];++M)C.call(F,this,V)}else switch(arguments.length){case 1:S.call(H,this);break;case 2:S.call(H,this,arguments[1]);break;case 3:S.call(H,this,arguments[1],arguments[2]);break;default:for(D=arguments.length,V=Array(D-1),M=1;M<D;++M)V[M-1]=arguments[M];C.call(H,this,V);}},O={on:N,once:B,off:R,emit:A},W={on:v(N),once:v(B),off:v(R),emit:v(A)},U=T({},W),p.exports=u=function(I){return null==I?k(U):T(Object(I),W)},u.methods=O},function(p,u){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0}),u.default=class{constructor(v){this.context=v||this,this.hooks=[]}register(){for(var v=0;v<arguments.length;++v)if('function'==typeof arguments[v])this.hooks.push(arguments[v]);else for(var _=0;_<arguments[v].length;++_)this.hooks.push(arguments[v][_])}trigger(){var v=arguments,_=this.context,C=[];return this.hooks.forEach(function(S){var k=S.apply(_,v);k&&'function'==typeof k.then&&C.push(k)}),Promise.all(C)}list(){return this.hooks}clear(){return this.hooks=[]}},p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(1);u.default=class{constructor(C){this.layout=C}section(C){var S=this.findRanges(C),k=this.rangeListToCfiList(C.section.cfiBase,S);return k}page(C,S,k,E){var T=C&&C.document&&C.document.body;return T?this.rangePairToCfiPair(S,{start:this.findStart(T,k,E),end:this.findEnd(T,k,E)}):void 0}walk(C,S){for(var E,T,k=document.createTreeWalker(C,NodeFilter.SHOW_TEXT,{acceptNode:function(z){return 0<z.data.trim().length?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}},!1);(E=k.nextNode())&&(T=S(E),!T););return T}findRanges(C){var S=[],k=C.contents.scrollWidth(),E=this.layout.count(k),T=this.layout.column,P=this.layout.gap,z,N;for(var B=0;B<E.pages;B++)z=(T+P)*B,N=T*(B+1)+P*B,S.push({start:this.findStart(C.document.body,z,N),end:this.findEnd(C.document.body,z,N)});return S}findStart(C,S,k){for(var T,P,E=[C],z=C;E.length;)if(T=E.shift(),P=this.walk(T,function(N){var B,R,A,O;return(N.nodeType==Node.TEXT_NODE?(O=document.createRange(),O.selectNodeContents(N),A=O.getBoundingClientRect()):A=N.getBoundingClientRect(),B=A.left,R=A.right,B>=S&&B<=k)?N:R>S?N:void(z=N,E.push(N))}),P)return this.findTextStartRange(P,S,k);return this.findTextStartRange(z,S,k)}findEnd(C,S,k){for(var T,z,E=[C],P=C;E.length;)if(T=E.shift(),z=this.walk(T,function(N){var B,R,A,O;return(N.nodeType==Node.TEXT_NODE?(O=document.createRange(),O.selectNodeContents(N),A=O.getBoundingClientRect()):A=N.getBoundingClientRect(),B=A.left,R=A.right,B>k&&P)?P:R>k?N:void(P=N,E.push(N))}),z)return this.findTextEndRange(z,S,k);return this.findTextEndRange(P,S,k)}findTextStartRange(C,S){var k=this.splitTextNodeIntoRanges(C),E,T;for(var P=0;P<k.length;P++)if(E=k[P],T=E.getBoundingClientRect(),T.left>=S)return E;return k[0]}findTextEndRange(C,S,k){var E=this.splitTextNodeIntoRanges(C),T,P,z;for(var N=0;N<E.length;N++){if(P=E[N],z=P.getBoundingClientRect(),z.left>k&&T)return T;if(z.right>k)return P;T=P}return E[E.length-1]}splitTextNodeIntoRanges(C,S){var P,k=[],E=C.textContent||'',T=E.trim(),z=C.ownerDocument,N=S||' ',B=T.indexOf(N);if(-1===B||C.nodeType!=Node.TEXT_NODE)return P=z.createRange(),P.selectNodeContents(C),[P];for(P=z.createRange(),P.setStart(C,0),P.setEnd(C,B),k.push(P),P=!1;-1!=B;)B=T.indexOf(N,B+1),0<B&&(P&&(P.setEnd(C,B),k.push(P)),P=z.createRange(),P.setStart(C,B+1));return P&&(P.setEnd(C,T.length),k.push(P)),k}rangePairToCfiPair(C,S){var k=S.start,E=S.end;k.collapse(!0),E.collapse(!0);var T=new v(k,C).toString(),P=new v(E,C).toString();return{start:T,end:P}}rangeListToCfiList(C,S){var k=[],E;for(var T=0;T<S.length;T++)E=this.rangePairToCfiPair(C,S[T]),k.push(E);return k}},p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(0);u.default=class{constructor(C){this._q=[],this.context=C,this.tick=v.requestAnimationFrame,this.running=!1,this.paused=!1}enqueue(){var C,S,k,E=[].shift.call(arguments),T=arguments;return E?('function'==typeof E?(C=new v.defer,S=C.promise,k={task:E,args:T,deferred:C,promise:S}):k={promise:E},this._q.push(k),!1!=this.paused||this.running||this.run(),k.promise):console.error('No Task Provided')}dequeue(){var C,S,k;if(this._q.length){if(C=this._q.shift(),S=C.task,S)return(k=S.apply(this.context,C.args),k&&'function'==typeof k.then)?k.then(function(){C.deferred.resolve.apply(this.context,arguments)}.bind(this),function(){C.deferred.reject.apply(this.context,arguments)}.bind(this)):(C.deferred.resolve.apply(this.context,k),C.promise);if(C.promise)return C.promise}else return C=new v.defer,C.deferred.resolve(),C.promise}dump(){for(;this._q.length;)this.dequeue()}run(){return this.running||(this.running=!0,this.defered=new v.defer),this.tick.call(window,function(){this._q.length?this.dequeue().then(function(){this.run()}.bind(this)):(this.defered.resolve(),this.running=void 0)}.bind(this)),!0==this.paused&&(this.paused=!1),this.defered.promise}flush(){return this.running?this.running:this._q.length?(this.running=this.dequeue().then(function(){return this.running=void 0,this.flush()}.bind(this)),this.running):void 0}clear(){this._q=[],this.running=!1}length(){return this._q.length}pause(){this.paused=!0}},p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(0),_=f(0).Url;u.base=function(S,k){var C,E;S&&(E=v.qs(S,'head'),C=v.qs(E,'base'),!C&&(C=S.createElement('base'),E.insertBefore(C,E.firstChild)),C.setAttribute('href',k.url))},u.canonical=function(S,k){var E,T,P=k.url;S&&(E=v.qs(S,'head'),T=v.qs(E,'link[rel=\'canonical\']'),T?T.setAttribute('href',P):(T=S.createElement('link'),T.setAttribute('rel','canonical'),T.setAttribute('href',P),E.appendChild(T)))},u.links=function(S,k){var C=S.document.querySelectorAll('a[href]'),E=function(P){var z=P.getAttribute('href');if(0!==z.indexOf('mailto:')){var N=_(z),B=this.book.resolve(z,!1);N&&N.protocol?P.setAttribute('target','_blank'):!N.fragment&&(P.onclick=function(){return k.display(B),!1})}}.bind(this);for(var T=0;T<C.length;T++)E(C[T])},u.substitute=function(S,k,E){return k.forEach(function(T,P){T&&E[P]&&(S=S.replace(new RegExp(T,'g'),E[P]))}),S}},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(0),_=f(0).Path;u.default=function(S,k,E,T){var P='undefined'!=typeof window&&window.URL,z=P?'blob':'arraybuffer',N=new v.defer,B=new XMLHttpRequest,R=XMLHttpRequest.prototype;for(var A in'overrideMimeType'in R||Object.defineProperty(R,'overrideMimeType',{value:function(){}}),E&&(B.withCredentials=!0),B.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE){var W=!1;if((''===this.responseType||'document'===this.responseType)&&(W=this.responseXML),200===this.status||W){var U;if(!this.response&&!W)return N.reject({status:this.status,message:'Empty Response',stack:new Error().stack}),N.promise;if(403===this.status)return N.reject({status:this.status,response:this.response,message:'Forbidden',stack:new Error().stack}),N.promise;U=W?this.responseXML:v.isXml(k)?v.parse(this.response,'text/xml'):'xhtml'==k?v.parse(this.response,'application/xhtml+xml'):'html'==k||'htm'==k?v.parse(this.response,'text/html'):'json'==k?JSON.parse(this.response):'blob'==k?P?this.response:new Blob([this.response]):this.response,N.resolve(U)}else N.reject({status:this.status,message:this.response,stack:new Error().stack})}},B.onerror=function(W){console.error(W),N.reject(W)},B.open('GET',S,!0),T)B.setRequestHeader(A,T[A]);return'json'==k&&B.setRequestHeader('Accept','application/json'),k||(k=new _(S).extension),'blob'==k&&(B.responseType=z),v.isXml(k)&&B.overrideMimeType('text/xml'),'xhtml'==k,'html'!=k&&'htm'!=k,'binary'==k&&(B.responseType='arraybuffer'),B.send(),N.promise},p.exports=u['default']},function(p,u,f){'use strict';(function(v){'use strict';function _(E){if('string'!=typeof E)throw new TypeError('Path must be a string. Received '+E)}function C(E,T){var P='',z=-1,N=0,B;for(var R=0;R<=E.length;++R){if(R<E.length)B=E.charCodeAt(R);else if(47===B)break;else B=47;if(47===B){if(z==R-1||1==N);else if(z!=R-1&&2==N){if(2>P.length||46!==P.charCodeAt(P.length-1)||46!==P.charCodeAt(P.length-2))if(2<P.length){for(var A=P.length-1,O=A;0<=O&&47!==P.charCodeAt(O);--O);if(O!==A){P=-1===O?'':P.slice(0,O),z=R,N=0;continue}}else if(2===P.length||1===P.length){P='',z=R,N=0;continue}T&&(0<P.length?P+='/..':P='..')}else 0<P.length?P+='/'+E.slice(z+1,R):P=E.slice(z+1,R);z=R,N=0}else 46===B&&-1!=N?++N:N=-1}return P}function S(E,T){var P=T.dir||T.root,z=T.base||(T.name||'')+(T.ext||'');return P?P===T.root?P+z:P+E+z:z}var k={resolve:function(){var z,T='',P=!1;for(var N=arguments.length-1;-1<=N&&!P;N--){var B;(0<=N?B=arguments[N]:(void 0==z&&(z=v.cwd()),B=z),_(B),0!==B.length)&&(T=B+'/'+T,P=47===B.charCodeAt(0))}return(T=C(T,!P),P)?0<T.length?'/'+T:'/':0<T.length?T:'.'},normalize:function(T){if(_(T),0===T.length)return'.';var P=47===T.charCodeAt(0),z=47===T.charCodeAt(T.length-1);return T=C(T,!P),0!==T.length||P||(T='.'),0<T.length&&z&&(T+='/'),P?'/'+T:T},isAbsolute:function(T){return _(T),0<T.length&&47===T.charCodeAt(0)},join:function(){if(0===arguments.length)return'.';var T;for(var P=0;P<arguments.length;++P){var z=arguments[P];_(z),0<z.length&&(T==void 0?T=z:T+='/'+z)}return void 0===T?'.':k.normalize(T)},relative:function(T,P){if(_(T),_(P),T===P)return'';if(T=k.resolve(T),P=k.resolve(P),T===P)return'';for(var z=1;z<T.length&&47===T.charCodeAt(z);++z);for(var N=T.length,B=N-z,R=1;R<P.length&&47===P.charCodeAt(R);++R);for(var A=P.length,O=A-R,W=B<O?B:O,U=-1,I=0;I<=W;++I){if(I===W){if(O>W){if(47===P.charCodeAt(R+I))return P.slice(R+I+1);if(0==I)return P.slice(R+I)}else B>W&&(47===T.charCodeAt(z+I)?U=I:0===I&&(U=0));break}var M=T.charCodeAt(z+I),D=P.charCodeAt(R+I);if(M!==D)break;else 47===M&&(U=I)}var F='';for(I=z+U+1;I<=N;++I)(I===N||47===T.charCodeAt(I))&&(F+=0===F.length?'..':'/..');return 0<F.length?F+P.slice(R+U):(R+=U,47===P.charCodeAt(R)&&++R,P.slice(R))},_makeLong:function(T){return T},dirname:function(T){if(_(T),0===T.length)return'.';var P=T.charCodeAt(0),z=47===P,N=-1,B=!0;for(var R=T.length-1;1<=R;--R)if(P=T.charCodeAt(R),47!==P)B=!1;else if(!B){N=R;break}return-1===N?z?'/':'.':z&&1===N?'//':T.slice(0,N)},basename:function(T,P){if(P!==void 0&&'string'!=typeof P)throw new TypeError('"ext" argument must be a string');_(T);var z=0,N=-1,B=!0,R;if(void 0!==P&&0<P.length&&P.length<=T.length){if(P.length===T.length&&P===T)return'';var A=P.length-1,O=-1;for(R=T.length-1;0<=R;--R){var W=T.charCodeAt(R);if(47!==W)-1==O&&(B=!1,O=R+1),0<=A&&(W===P.charCodeAt(A)?-1==--A&&(N=R):(A=-1,N=O));else if(!B){z=R+1;break}}return z===N?N=O:-1===N&&(N=T.length),T.slice(z,N)}for(R=T.length-1;0<=R;--R)if(47!==T.charCodeAt(R))-1==N&&(B=!1,N=R+1);else if(!B){z=R+1;break}return-1===N?'':T.slice(z,N)},extname:function(T){_(T);var P=-1,z=0,N=-1,B=!0,R=0;for(var A=T.length-1;0<=A;--A){var O=T.charCodeAt(A);if(47===O){if(!B){z=A+1;break}continue}-1==N&&(B=!1,N=A+1),46===O?-1==P?P=A:1!=R&&(R=1):-1!=P&&(R=-1)}return-1===P||-1===N||0==R||1==R&&P===N-1&&P===z+1?'':T.slice(P,N)},format:function(T){if(null===T||'object'!=typeof T)throw new TypeError('Parameter "pathObject" must be an object, not '+typeof T);return S('/',T)},parse:function(T){_(T);var P={root:'',dir:'',base:'',ext:'',name:''};if(0===T.length)return P;var B,z=T.charCodeAt(0),N=47===z;N?(P.root='/',B=1):B=0;for(var R=-1,A=0,O=-1,W=!0,U=T.length-1,I=0;U>=B;--U){if(z=T.charCodeAt(U),47===z){if(!W){A=U+1;break}continue}-1==O&&(W=!1,O=U+1),46===z?-1==R?R=U:1!=I&&(I=1):-1!=R&&(I=-1)}return-1==R||-1==O||0==I||1==I&&R==O-1&&R==A+1?-1!=O&&(0==A&&N?P.base=P.name=T.slice(1,O):P.base=P.name=T.slice(A,O)):(0==A&&N?(P.name=T.slice(1,R),P.base=T.slice(1,O)):(P.name=T.slice(A,R),P.base=T.slice(A,O)),P.ext=T.slice(R,O)),0<A?P.dir=T.slice(0,A-1):N&&(P.dir='/'),P},sep:'/',delimiter:':',posix:null};p.exports=k}).call(u,f(46))},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(2),_=f(0),C=f(1),S=f(4);class k{constructor(E,T,P){this.epubcfi=new C,this.document=E,this.documentElement=this.document.documentElement,this.content=T||this.document.body,this.window=this.document.defaultView,this.listenedEvents=['keydown','keyup','keypressed','mouseup','mousedown','click','touchend','touchstart'],this._size={width:0,height:0},this.cfiBase=P||'',this.listeners()}width(E){var T=this.content;return E&&_.isNumber(E)&&(E=E+'px'),E&&(T.style.width=E),this.window.getComputedStyle(T).width}height(E){var T=this.content;return E&&_.isNumber(E)&&(E=E+'px'),E&&(T.style.height=E),this.window.getComputedStyle(T).height}contentWidth(E){var T=this.content||this.document.body;return E&&_.isNumber(E)&&(E=E+'px'),E&&(T.style.width=E),this.window.getComputedStyle(T).width}contentHeight(E){var T=this.content||this.document.body;return E&&_.isNumber(E)&&(E=E+'px'),E&&(T.style.height=E),this.window.getComputedStyle(T).height}textWidth(){var E,T=this.document.createRange(),P=this.content||this.document.body;return T.selectNodeContents(P),E=T.getBoundingClientRect().width,E}textHeight(){var E,T=this.document.createRange(),P=this.content||this.document.body;return T.selectNodeContents(P),E=T.getBoundingClientRect().height,E}scrollWidth(){var E=this.documentElement.scrollWidth;return E}scrollHeight(){var E=this.documentElement.scrollHeight;return E}overflow(E){return E&&(this.documentElement.style.overflow=E),this.window.getComputedStyle(this.documentElement).overflow}overflowX(E){return E&&(this.documentElement.style.overflowX=E),this.window.getComputedStyle(this.documentElement).overflowX}overflowY(E){return E&&(this.documentElement.style.overflowY=E),this.window.getComputedStyle(this.documentElement).overflowY}css(E,T){var P=this.content||this.document.body;return T&&(P.style[E]=T),this.window.getComputedStyle(P)[E]}viewport(E){var T,P,z,N,B=this.document.querySelector('meta[name=\'viewport\']'),R='';return B&&B.hasAttribute('content')&&(content=B.getAttribute('content'),contents=content.split(/\s*,\s*/),contents[0]&&(T=contents[0].replace('width=','').trim()),contents[1]&&(P=contents[1].replace('height=','').trim()),contents[2]&&(z=contents[2].replace('initial-scale=','').trim()),contents[3]&&(N=contents[3].replace('user-scalable=','').trim())),E&&(R+='width='+(E.width||T),R+=', height='+(E.height||P),(E.scale||z)&&(R+=', initial-scale='+(E.scale||z)),(E.scalable||N)&&(R+=', user-scalable='+(E.scalable||N)),!B&&(B=this.document.createElement('meta'),B.setAttribute('name','viewport'),this.document.querySelector('head').appendChild(B)),B.setAttribute('content',R)),{width:parseInt(T),height:parseInt(P)}}expand(){this.emit('expand')}listeners(){this.imageLoadListeners(),this.mediaQueryListeners(),this.addEventListeners(),this.addSelectionListeners(),this.resizeListeners()}removeListeners(){this.removeEventListeners(),this.removeSelectionListeners()}resizeListeners(){var E,T;clearTimeout(this.expanding),E=this.scrollWidth(),T=this.scrollHeight(),(E!=this._size.width||T!=this._size.height)&&(this._size={width:E,height:T},this.emit('resize',this._size)),this.expanding=setTimeout(this.resizeListeners.bind(this),350)}mediaQueryListeners(){var E=this.document.styleSheets,T=function(R){R.matches&&!this._expanding&&setTimeout(this.expand.bind(this),1)}.bind(this);for(var P=0;P<E.length;P+=1){var z;try{z=E[P].cssRules}catch(R){return}if(!z)return;for(var N=0;N<z.length;N+=1)if(z[N].media){var B=this.window.matchMedia(z[N].media.mediaText);B.addListener(T)}}}observe(E){var T=this,P=new MutationObserver(function(){T._expanding&&T.expand()});return P.observe(E,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),P}imageLoadListeners(){var E=this.document.querySelectorAll('img'),T;for(var P=0;P<E.length;P++)T=E[P],'undefined'!=typeof T.naturalWidth&&0===T.naturalWidth&&(T.onload=this.expand.bind(this))}fontLoadListeners(){this.document&&this.document.fonts&&this.document.fonts.ready.then(function(){this.expand()}.bind(this))}root(){return this.document?this.document.documentElement:null}locationOf(E,T){var P,z={left:0,top:0};if(this.document)return this.epubcfi.isCfiString(E)?(range=new C(E).toRange(this.document,T),range&&(range.startContainer.nodeType===Node.ELEMENT_NODE?(P=range.startContainer.getBoundingClientRect(),z.left=P.left,z.top=P.top):(P=range.collapsed?range.getClientRects()[0]:range.getBoundingClientRect(),z.left=P.left,z.top=P.top))):'string'==typeof E&&-1<E.indexOf('#')&&(id=E.substring(E.indexOf('#')+1),el=this.document.getElementById(id),el&&(P=el.getBoundingClientRect(),z.left=P.left,z.top=P.top)),z}addStylesheet(E){return new Promise(function(T){var P,z=!1;return this.document?(P=this.document.querySelector('link[href="'+E+'"]'),P?void T(!0):void(P=this.document.createElement('link'),P.type='text/css',P.rel='stylesheet',P.href=E,P.onload=P.onreadystatechange=function(){z||this.readyState&&'complete'!=this.readyState||(z=!0,setTimeout(function(){T(!0)},1))},this.document.head.appendChild(P))):void T(!1)}.bind(this))}addStylesheetRules(E){var T,P,z='epubjs-inserted-css';if(this.document){T=this.document.getElementById('#'+z),T||(T=this.document.createElement('style'),T.id=z),this.document.head.appendChild(T),P=T.sheet;for(var N=0,B=E.length;N<B;N++){var R=1,A=E[N],O=E[N][0],W='';'[object Array]'===Object.prototype.toString.call(A[1][0])&&(A=A[1],R=0);for(var U=A.length;R<U;R++){var I=A[R];W+=I[0]+':'+I[1]+(I[2]?' !important':'')+';\n'}P.insertRule(O+'{'+W+'}',P.cssRules.length)}}}addScript(E){return new Promise(function(T){var P,z=!1;return this.document?void(P=this.document.createElement('script'),P.type='text/javascript',P.async=!0,P.src=E,P.onload=P.onreadystatechange=function(){z||this.readyState&&'complete'!=this.readyState||(z=!0,setTimeout(function(){T(!0)},1))},this.document.head.appendChild(P)):void T(!1)}.bind(this))}addClass(E){var T;this.document&&(T=this.content||this.document.body,T.classList.add(E))}removeClass(E){var T;this.document&&(T=this.content||this.document.body,T.classList.remove(E))}addEventListeners(){this.document&&this.listenedEvents.forEach(function(E){this.document.addEventListener(E,this.triggerEvent.bind(this),!1)},this)}removeEventListeners(){this.document&&this.listenedEvents.forEach(function(E){this.document.removeEventListener(E,this.triggerEvent,!1)},this)}triggerEvent(E){this.emit(E.type,E)}addSelectionListeners(){this.document&&this.document.addEventListener('selectionchange',this.onSelectionChange.bind(this),!1)}removeSelectionListeners(){this.document&&this.document.removeEventListener('selectionchange',this.onSelectionChange,!1)}onSelectionChange(){this.selectionEndTimeout&&clearTimeout(this.selectionEndTimeout),this.selectionEndTimeout=setTimeout(function(){var E=this.window.getSelection();this.triggerSelectedEvent(E)}.bind(this),500)}triggerSelectedEvent(E){var T,P;E&&0<E.rangeCount&&(T=E.getRangeAt(0),!T.collapsed&&(P=new C(T,this.cfiBase).toString(),this.emit('selected',P),this.emit('selectedRange',T)))}range(E,T){var P=new C(E);return P.toRange(this.document,T)}map(E){var T=new S(E);return T.section()}size(E,T){0<=E&&this.width(E),0<=T&&this.height(T),this.css('margin','0'),this.css('boxSizing','border-box')}columns(E,T,P,z){var N=_.prefixed('columnAxis'),B=_.prefixed('columnGap'),R=_.prefixed('columnWidth'),A=_.prefixed('columnFill');this.width(E),this.height(T),this.viewport({width:E,height:T,scale:1}),this.css('overflowY','hidden'),this.css('margin','0'),this.css('boxSizing','border-box'),this.css('maxWidth','inherit'),this.css(N,'horizontal'),this.css(A,'auto'),this.css(B,z+'px'),this.css(R,P+'px')}scaler(E,T,P){var E='scale('+E+')',z='';this.css('transformOrigin','top left'),(0<=T||0<=P)&&(z=' translate('+(T||0)+'px, '+(P||0)+'px )'),this.css('transform',E+z)}fit(E,T){var P=this.viewport(),z=E/P.width,N=T/P.height,B=z<N?z:N,R=(T-P.height*B)/2;this.width(E),this.height(T),this.overflow('hidden'),this.viewport({scale:1}),this.scaler(B,0,R),this.css('backgroundColor','transparent')}mapPage(E,T,P){var z=new S;return z.page(this,E,T,P)}destroy(){this.observer&&this.observer.disconnect(),this.removeListeners()}}v(k.prototype),u.default=k,p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(2),_=f(0);f(1);var C=f(4),S=f(5),k=f(22),E=f(23);class T{constructor(P){this.name='default',this.View=P.view,this.request=P.request,this.renditionQueue=P.queue,this.q=new S(this),this.settings=_.extend(this.settings||{},{infinite:!0,hidden:!1,width:void 0,height:void 0,axis:'vertical',ignoreClass:''}),_.extend(this.settings,P.settings||{}),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,layout:this.layout,width:0,height:0}}render(P,z){this.stage=new k({width:z.width,height:z.height,overflow:this.settings.overflow,hidden:this.settings.hidden,axis:this.settings.axis}),this.stage.attachTo(P),this.container=this.stage.getContainer(),this.views=new E(this.container),this._bounds=this.bounds(),this._stageSize=this.stage.size(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.stage.onResize(this.onResized.bind(this)),this.addEventListeners(),this.layout&&this.updateLayout()}addEventListeners(){window.addEventListener('unload',function(){this.destroy()}.bind(this))}destroy(){}onResized(){clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(function(){this.resize()}.bind(this),150)}resize(P,z){this.q.clear(),this._stageSize=this.stage.size(P,z),this._bounds=this.bounds(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.views.each(function(N){N.size(this._stageSize.width,this._stageSize.height)}.bind(this)),this.updateLayout(),this.emit('resized',{width:this.stage.width,height:this.stage.height})}createView(P){return new this.View(P,this.viewSettings)}display(P,z){var N=new _.defer,B=N.promise,R=this.views.find(P);return R&&z?(offset=R.locationOf(z),this.moveTo(offset),N.resolve(),B):(this.views.hide(),this.views.clear(),this.add(P).then(function(A){z&&(offset=A.locationOf(z),this.moveTo(offset))}.bind(this)).then(function(){var A;if('pre-paginated'===this.layout.name&&1<this.layout.divisor&&(A=P.next(),A))return this.add(A)}.bind(this)).then(function(){this.views.show(),N.resolve()}.bind(this)),B)}afterDisplayed(P){this.emit('added',P)}afterResized(P){this.emit('resize',P.section)}moveTo(P){var z=0,N=0;'vertical'===this.settings.axis?N=P.top:(z=Math.floor(P.left/this.layout.delta)*this.layout.delta,z+this.layout.delta>this.container.scrollWidth&&(z=this.container.scrollWidth-this.layout.delta)),this.scrollTo(z,N)}add(P){var z=this.createView(P);return this.views.append(z),z.onDisplayed=this.afterDisplayed.bind(this),z.onResize=this.afterResized.bind(this),z.display(this.request)}append(P){var z=this.createView(P);return this.views.append(z),z.display(this.request)}prepend(P){var z=this.createView(P);return this.views.prepend(z),z.display(this.request)}next(){var P,z;if(this.views.length&&('horizontal'===this.settings.axis?(this.scrollLeft=this.container.scrollLeft,z=this.container.scrollLeft+this.container.offsetWidth+this.layout.delta,z<this.container.scrollWidth?this.scrollBy(this.layout.delta,0):z-this.layout.columnWidth===this.container.scrollWidth?this.scrollTo(this.container.scrollWidth-this.layout.delta,0):P=this.views.last().section.next()):P=this.views.last().section.next(),P))return this.views.clear(),this.append(P).then(function(){var I;if(this.layout.name&&1<this.layout.divisor&&(I=P.next(),I))return this.append(I)}.bind(this)).then(function(){this.views.show()}.bind(this))}prev(){var P,z;if(this.views.length&&('horizontal'===this.settings.axis?(this.scrollLeft=this.container.scrollLeft,z=this.container.scrollLeft,0<z?this.scrollBy(-this.layout.delta,0):P=this.views.first().section.prev()):P=this.views.first().section.prev(),P))return this.views.clear(),this.prepend(P).then(function(){var F;if(this.layout.name&&1<this.layout.divisor&&(F=P.prev(),F))return this.prepend(F)}.bind(this)).then(function(){'horizontal'===this.settings.axis&&this.scrollTo(this.container.scrollWidth-this.layout.delta,0),this.views.show()}.bind(this))}current(){var P=this.visible();return P.length?P[P.length-1]:null}currentLocation(){return this.location='vertical'===this.settings.axis?this.scrolledLocation():this.paginatedLocation(),this.location}scrolledLocation(){var P;if(this.views.length)return P=this.views.first(),this.mapping.page(P,P.section.cfiBase)}paginatedLocation(){var P,z,N;if(this.views.length)return P=this.views.first(),z=this._bounds.left-P.position().left,N=z+this.layout.spreadWidth,this.mapping.page(P,P.section.cfiBase,z,N)}isVisible(P,z,N,B){var R=P.position(),A=B||this.bounds();if('horizontal'===this.settings.axis&&R.right>A.left-z&&R.left<A.right+N)return!0;return'vertical'===this.settings.axis&&R.bottom>A.top-z&&R.top<A.bottom+N}visible(){var P=this.bounds(),z=this.views.displayed(),N=z.length,B=[],R,A;for(var O=0;O<N;O++)A=z[O],R=this.isVisible(A,0,0,P),!0===R&&B.push(A);return B}scrollBy(P,z,N){N&&(this.ignore=!0),this.settings.height?(P&&(this.container.scrollLeft+=P),z&&(this.container.scrollTop+=z)):window.scrollBy(P,z),this.scrolled=!0,this.onScroll()}scrollTo(P,z,N){N&&(this.ignore=!0),this.settings.height?(this.container.scrollLeft=P,this.container.scrollTop=z):window.scrollTo(P,z),this.scrolled=!0,this.onScroll()}onScroll(){}bounds(){var P=this.stage.bounds();return P}applyLayout(P){this.layout=P,this.updateLayout(),this.mapping=new C(this.layout)}updateLayout(){this.stage&&(this._stageSize=this.stage.size(),'vertical'===this.settings.axis?this.layout.calculate(this._stageSize.width,this._stageSize.height):(this.layout.calculate(this._stageSize.width,this._stageSize.height,this.settings.gap),this.settings.offset=this.layout.delta,this.stage.addStyleRules('iframe',[{'margin-right':this.layout.gap+'px'}])),this.viewSettings.width=this.layout.width,this.viewSettings.height=this.layout.height,this.setLayout(this.layout))}setLayout(P){this.viewSettings.layout=P,this.views&&this.views.each(function(z){z.setLayout(P)})}updateFlow(P){var z='paginated'===P?'horizontal':'vertical';this.settings.axis=z,this.viewSettings.axis=z,this.settings.overflow='paginated'===P?'hidden':'auto'}getContents(){var P=[];return this.views.each(function(z){P.push(z.contents)}),P}}v(T.prototype),u.default=T,p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(2),_=f(0),C=f(6),S=f(3),k=f(1),E=f(5),T=f(20),P=f(4),z=f(30);f(0).Path;class N{constructor(B,R){this.settings=_.extend(this.settings||{},{width:null,height:null,ignoreClass:'',manager:'default',view:'iframe',flow:null,layout:null,spread:null,minSpreadWidth:800}),_.extend(this.settings,R),'object'==typeof this.settings.manager&&(this.manager=this.settings.manager),this.viewSettings={ignoreClass:this.settings.ignoreClass},this.book=B,this.views=null,this.hooks={},this.hooks.display=new S(this),this.hooks.serialize=new S(this),this.hooks.content=new S(this),this.hooks.layout=new S(this),this.hooks.render=new S(this),this.hooks.show=new S(this),this.hooks.content.register(C.links.bind(this)),this.hooks.content.register(this.passViewEvents.bind(this)),this.themes=new z(this),this.epubcfi=new k,this.q=new E(this),this.q.enqueue(this.book.opened),this.starting=new _.defer,this.started=this.starting.promise,this.q.enqueue(this.start)}setManager(B){this.manager=B}requireManager(B){var R;return R='string'==typeof B?'undefined'==typeof ePub?void 0:ePub.ViewManagers[B]:B,R}requireView(B){var R;return R='string'==typeof B?'undefined'==typeof ePub?void 0:ePub.Views[B]:B,R}start(){this.manager||(this.ViewManager=this.requireManager(this.settings.manager),this.View=this.requireView(this.settings.view),this.manager=new this.ViewManager({view:this.View,queue:this.q,request:this.book.load.bind(this.book),settings:this.settings})),this.settings.globalLayoutProperties=this.determineLayoutProperties(this.book.package.metadata),this.flow(this.settings.globalLayoutProperties.flow),this.layout(this.settings.globalLayoutProperties),this.manager.on('added',this.afterDisplayed.bind(this)),this.manager.on('resized',this.onResized.bind(this)),this.manager.on('scroll',this.reportLocation.bind(this)),this.on('displayed',this.reportLocation.bind(this)),this.emit('started'),this.starting.resolve()}attachTo(B){return this.q.enqueue(function(){this.manager.render(B,{width:this.settings.width,height:this.settings.height}),this.emit('attached')}.bind(this))}display(B){return this.q.enqueue(this._display,B)}_display(B){var W,U,R=this.epubcfi.isCfiString(B),A=new _.defer,O=A.promise;return(this.book.locations.length&&_.isFloat(B)&&(console.log('percentage',B),B=book.locations.cfiFromPercentage(B),console.log('cfi',B)),W=this.book.spine.get(B),!W)?(A.reject(new Error('No Section Found')),O):(!R&&'string'==typeof B&&-1<B.indexOf('#')&&(U=B.substring(B.indexOf('#')+1)),R&&(U=B),this.manager.display(W,U).then(function(){}.bind(this)))}afterDisplayed(B){this.hooks.content.trigger(B,this),this.emit('rendered',B.section),this.reportLocation()}onResized(B){this.location&&this.display(this.location.start),this.emit('resized',{width:B.width,height:B.height})}moveTo(B){this.manager.moveTo(B)}next(){return this.q.enqueue(this.manager.next.bind(this.manager)).then(this.reportLocation.bind(this))}prev(){return this.q.enqueue(this.manager.prev.bind(this.manager)).then(this.reportLocation.bind(this))}determineLayoutProperties(B){var R,A=this.settings.layout||B.layout||'reflowable',O=this.settings.spread||B.spread||'auto',W=this.settings.orientation||B.orientation||'auto',U=this.settings.flow||B.flow||'auto',I=B.viewport||'',M=this.settings.minSpreadWidth||B.minSpreadWidth||800;return 0<=this.settings.width&&0<=this.settings.height&&(I='width='+this.settings.width+', height='+this.settings.height+''),R={layout:A,spread:O,orientation:W,flow:U,viewport:I,minSpreadWidth:M},R}flow(B){var R=B;('scrolled-doc'===B||'scrolled-continuous'===B)&&(R='scrolled'),('auto'===B||'paginated'===B)&&(R='paginated'),this._layout&&this._layout.flow(R),this.manager&&this.manager.updateFlow(R)}layout(B){return B&&(this._layout=new T(B),this._layout.spread(B.spread,this.settings.minSpreadWidth),this.mapping=new P(this._layout)),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this._layout}spread(B,R){this._layout.spread(B,R),this.manager.isRendered()&&this.manager.updateLayout()}reportLocation(){return this.q.enqueue(function(){var B=this.manager.currentLocation();B&&B.then&&'function'==typeof B.then?B.then(function(R){this.location=R,this.percentage=this.book.locations.percentageFromCfi(R),null!=this.percentage&&(this.location.percentage=this.percentage),this.emit('locationChanged',this.location)}.bind(this)):B&&(this.location=B,this.percentage=this.book.locations.percentageFromCfi(B),null!=this.percentage&&(this.location.percentage=this.percentage),this.emit('locationChanged',this.location))}.bind(this))}currentLocation(){var B=this.manager.currentLocation();if(B&&B.then&&'function'==typeof B.then)B.then(function(A){var O=this.book.locations.percentageFromCfi(A);return null!=O&&(A.percentage=O),A}.bind(this));else if(B){var R=this.book.locations.percentageFromCfi(B);return null!=R&&(B.percentage=R),B}}destroy(){this.q.clear(),this.manager.destroy()}passViewEvents(B){B.contents.listenedEvents.forEach(function(R){B.on(R,this.triggerViewEvent.bind(this))}.bind(this)),B.on('selected',this.triggerSelectedEvent.bind(this))}triggerViewEvent(B){this.emit(B.type,B)}triggerSelectedEvent(B){this.emit('selected',B)}range(B,R){var A=new k(B),O=this.visible().filter(function(W){if(A.spinePos===W.index)return!0});if(O.length)return O[0].range(A,R)}adjustImages(B){return B.addStylesheetRules([['img',['max-width',B.layout.spreadWidth+'px'],['max-height',B.layout.height+'px']]]),new Promise(function(R){setTimeout(function(){R()},1)})}getContents(){return this.manager?this.manager.getContents():[]}}v(N.prototype),u.default=N,p.exports=u['default']},function(p){p.exports=s},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(2),_=f(0),C=f(0).Url,S=f(0).Path,k=f(29),E=f(21),T=f(19),P=f(25),z=f(24),N=f(27),B=f(26),R=f(11),A=f(18),O=f(7),W=f(1),U='META-INF/container.xml';class I{constructor(M,D){'undefined'==typeof D&&'object'==typeof M&&(D=M,M=void 0),this.settings=_.extend(this.settings||{},{requestMethod:void 0,requestCredentials:void 0,requestHeaders:void 0,encoding:void 0,replacements:'base64'}),_.extend(this.settings,D),this.opening=new _.defer,this.opened=this.opening.promise,this.isOpen=!1,this.loading={manifest:new _.defer,spine:new _.defer,metadata:new _.defer,cover:new _.defer,navigation:new _.defer,pageList:new _.defer,resources:new _.defer},this.loaded={manifest:this.loading.manifest.promise,spine:this.loading.spine.promise,metadata:this.loading.metadata.promise,cover:this.loading.cover.promise,navigation:this.loading.navigation.promise,pageList:this.loading.pageList.promise,resources:this.loading.resources.promise},this.ready=Promise.all([this.loaded.manifest,this.loaded.spine,this.loaded.metadata,this.loaded.cover,this.loaded.navigation,this.loaded.resources]),this.isRendered=!1,this.request=this.settings.requestMethod||O,this.spine=new k,this.locations=new E(this.spine,this.load.bind(this)),this.navigation=void 0,this.pageList=new B,this.url=void 0,this.path=void 0,this.archived=!1,M&&this.open(M).catch(F=>{var H=new Error('Cannot load book at '+M);console.error(H),this.emit('openFailed',H),console.log(F)})}open(M,D){var F,H=D||this.determineType(M);return'binary'===H?(this.archived=!0,this.url=new C('/',''),F=this.openEpub(M)):'epub'===H?(this.archived=!0,this.url=new C('/',''),F=this.request(M,'binary').then(this.openEpub.bind(this))):'opf'==H?(this.url=new C(M),F=this.openPackaging(this.url.Path.toString())):(this.url=new C(M),F=this.openContainer(U).then(this.openPackaging.bind(this))),F}openEpub(M,D){return this.unarchive(M,D||this.settings.encoding).then(()=>{return this.openContainer(U)}).then(F=>{return this.openPackaging(F)})}openContainer(M){return this.load(M).then(D=>{return this.container=new T(D),this.resolve(this.container.packagePath)})}openPackaging(M){return this.path=new S(M),this.load(M).then(D=>{return this.packaging=new P(D),this.unpack(this.packaging)})}load(M){var D;return this.archived?(D=this.resolve(M),this.archive.request(D)):(D=this.resolve(M),this.request(D,null,this.settings.requestCredentials,this.settings.requestHeaders))}resolve(M,D){var F=M,H=-1<M.indexOf('://');return H?M:(this.path&&(F=this.path.resolve(M)),!1!=D&&this.url&&(F=this.url.resolve(F)),F)}determineType(M){var D,F,H;return'string'==typeof M?(D=new C(M),F=D.path(),H=F.extension,H?'epub'===H?'epub':'opf'===H?'opf':void 0:'directory'):'binary'}unpack(M){this.package=M,this.spine.unpack(this.package,this.resolve.bind(this)),this.resources=new N(this.package.manifest,{archive:this.archive,resolver:this.resolve.bind(this),replacements:this.settings.replacements}),this.loadNavigation(this.package).then(()=>{this.toc=this.navigation.toc,this.loading.navigation.resolve(this.navigation)}),this.cover=this.resolve(this.package.coverPath),this.loading.manifest.resolve(this.package.manifest),this.loading.metadata.resolve(this.package.metadata),this.loading.spine.resolve(this.spine),this.loading.cover.resolve(this.cover),this.loading.resources.resolve(this.resources),this.loading.pageList.resolve(this.pageList),this.isOpen=!0,this.archived?this.replacements().then(()=>{this.opening.resolve(this)}):this.opening.resolve(this)}loadNavigation(M){var D=M.navPath||M.ncxPath;return D?this.load(D,'xml').then(F=>{return this.navigation=new z(F),this.pageList=new B(F),this.navigation}):void 0}section(M){return this.spine.get(M)}renderTo(M,D){return this.rendition=new R(this,D),this.rendition.attachTo(M),this.rendition}setRequestCredentials(M){this.settings.requestCredentials=M}setRequestHeaders(M){this.settings.requestHeaders=M}unarchive(M,D){return this.archive=new A,this.archive.open(M,D)}coverUrl(){var M=this.loaded.cover.then(()=>{return this.archived?this.resources.get(this.cover):this.cover});return M}replacements(){return this.spine.hooks.serialize.register((M,D)=>{D.output=this.resources.substitute(M,D.url)}),this.resources.replacements().then(()=>{return this.resources.replaceCss()})}range(M){var D=new W(M),F=this.spine.get(D.spinePos);return F.load().then(function(){var H=D.toRange(F.document);return H})}key(M){var D=M||this.package.metadata.identifier||this.url.filename;return'epubjs:'+(EPUBJS_VERSION||ePub.VERSION)+':'+D}}v(I.prototype),u.default=I,p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(0),_=f(10);u.default=class extends _{constructor(S){super(S),this.name='continuous',this.settings=v.extend(this.settings||{},{infinite:!0,overflow:'auto',axis:'vertical',offset:500,offsetDelta:250,width:void 0,height:void 0}),v.extend(this.settings,S.settings||{}),'undefined'!=S.settings.gap&&0===S.settings.gap&&(this.settings.gap=S.settings.gap),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,layout:this.layout,width:0,height:0},this.scrollTop=0,this.scrollLeft=0}display(S,k){return _.prototype.display.call(this,S,k).then(function(){return this.fill()}.bind(this))}fill(S){var k=S||new v.defer;return this.check().then(function(E){E?this.fill(k):k.resolve()}.bind(this)),k.promise}moveTo(S){var k=0,E=0,T=0,P=0;return'vertical'===this.settings.axis?(E=S.top,P=S.top+this.settings.offset):(k=Math.floor(S.left/this.layout.delta)*this.layout.delta,T=k+this.settings.offset),this.check(T,P).then(function(){this.scrollBy(k,E)}.bind(this))}resize(S,k){this.q.clear(),this._stageSize=this.stage.size(S,k),this._bounds=this.bounds(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.views.each(function(E){E.size(this._stageSize.width,this._stageSize.height)}.bind(this)),this.updateLayout(),this.emit('resized',{width:this.stage.width,height:this.stage.height})}onResized(){clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(function(){this.resize()}.bind(this),150)}afterResized(S){this.emit('resize',S.section)}removeShownListeners(S){S.onDisplayed=function(){}}append(S){var k=this.createView(S);return this.views.append(k),k}prepend(S){var k=this.createView(S);return k.on('resized',this.counter.bind(this)),this.views.prepend(k),k}counter(S){'vertical'===this.settings.axis?this.scrollBy(0,S.heightDelta,!0):this.scrollBy(S.widthDelta,0,!0)}update(S){var k=this.bounds(),E=this.views.all(),T=E.length,P=[],z='undefined'==typeof S?this.settings.offset||0:S,N,B,R=new v.defer,A=[];for(var O=0;O<T;O++)B=E[O],N=this.isVisible(B,z,z,k),!0===N?(!B.displayed&&A.push(B.display(this.request).then(function(W){W.show()})),P.push(B)):(this.q.enqueue(B.destroy.bind(B)),clearTimeout(this.trimTimeout),this.trimTimeout=setTimeout(function(){this.q.enqueue(this.trim.bind(this))}.bind(this),250));return A.length?Promise.all(A):(R.resolve(),R.promise)}check(S,k){var E,T,P,z,N=new v.defer,B=[],R='horizontal'===this.settings.axis,A=this.settings.offset||0;S&&R&&(A=S),k&&!R&&(A=k);var O=this._bounds,W=R?this.scrollLeft:this.scrollTop,U=R?O.width:O.height,I=R?this.container.scrollWidth:this.container.scrollHeight;return W+U+A>=I&&(E=this.views.last(),P=E&&E.section.next(),P&&B.push(this.append(P))),0>W-A&&(T=this.views.first(),z=T&&T.section.prev(),z&&B.push(this.prepend(z))),B.length?this.q.enqueue(function(){return this.update(A)}.bind(this)):(N.resolve(!1),N.promise)}trim(){var S=new v.defer,k=this.views.displayed(),E=k[0],T=k[k.length-1],P=this.views.indexOf(E),z=this.views.indexOf(T),N=this.views.slice(0,P),B=this.views.slice(z+1);for(var R=0;R<N.length-1;R++)this.erase(N[R],N);for(var A=1;A<B.length;A++)this.erase(B[A]);return S.resolve(),S.promise}erase(S,k){var E,T;this.settings.height?(E=this.container.scrollTop,T=this.container.scrollLeft):(E=window.scrollY,T=window.scrollX);var P=S.bounds();this.views.remove(S),k&&('vertical'===this.settings.axis?this.scrollTo(0,E-P.height,!0):this.scrollTo(T-P.width,0,!0))}addEventListeners(){window.addEventListener('unload',function(){this.ignore=!0,this.destroy()}.bind(this)),this.addScrollListeners()}addScrollListeners(){var S;this.tick=v.requestAnimationFrame,this.settings.height?(this.prevScrollTop=this.container.scrollTop,this.prevScrollLeft=this.container.scrollLeft):(this.prevScrollTop=window.scrollY,this.prevScrollLeft=window.scrollX),this.scrollDeltaVert=0,this.scrollDeltaHorz=0,this.settings.height?(S=this.container,this.scrollTop=this.container.scrollTop,this.scrollLeft=this.container.scrollLeft):(S=window,this.scrollTop=window.scrollY,this.scrollLeft=window.scrollX),S.addEventListener('scroll',this.onScroll.bind(this)),this.scrolled=!1}onScroll(){var S=void 0,k=void 0;this.settings.height?(S=this.container.scrollTop,k=this.container.scrollLeft):(S=window.scrollY,k=window.scrollX),this.scrollTop=S,this.scrollLeft=k,this.ignore?this.ignore=!1:(0===this.scrollDeltaVert&&0===this.scrollDeltaHorz||this.scrollDeltaVert>this.settings.offsetDelta||this.scrollDeltaHorz>this.settings.offsetDelta)&&(this.q.enqueue(function(){this.check()}.bind(this)),this.scrollDeltaVert=0,this.scrollDeltaHorz=0,this.emit('scroll',{top:S,left:k}),clearTimeout(this.afterScrolled),this.afterScrolled=setTimeout(function(){this.emit('scrolled',{top:this.scrollTop,left:this.scrollLeft})}.bind(this))),this.scrollDeltaVert+=Math.abs(S-this.prevScrollTop),this.scrollDeltaHorz+=Math.abs(k-this.prevScrollLeft),this.prevScrollTop=S,this.prevScrollLeft=k,clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(function(){this.scrollDeltaVert=0,this.scrollDeltaHorz=0}.bind(this),150),this.scrolled=!1}currentLocation(){return this.location='vertical'===this.settings.axis?this.scrolledLocation():this.paginatedLocation(),this.location}scrolledLocation(){var k,E,S=this.visible();return this.container.getBoundingClientRect(),1===S.length?this.mapping.page(S[0].contents,S[0].section.cfiBase):1<S.length?(k=this.mapping.page(S[0].contents,S[0].section.cfiBase),E=this.mapping.page(S[S.length-1].contents,S[S.length-1].section.cfiBase),{start:k.start,end:E.end}):void 0}paginatedLocation(){var S=this.visible(),k,E,T,P,z,N,B=this.container.getBoundingClientRect();return 1===S.length?(k=B.left-S[0].position().left,T=k+this.layout.spreadWidth,this.mapping.page(S[0].contents,S[0].section.cfiBase,k,T)):1<S.length?(k=B.left-S[0].position().left,T=k+this.layout.columnWidth,E=B.left+this.layout.spreadWidth-S[S.length-1].position().left,P=E+this.layout.columnWidth,z=this.mapping.page(S[0].contents,S[0].section.cfiBase,k,T),N=this.mapping.page(S[S.length-1].contents,S[S.length-1].section.cfiBase,E,P),{start:z.start,end:N.end}):void 0}updateLayout(){this.stage&&('vertical'===this.settings.axis?this.layout.calculate(this._stageSize.width,this._stageSize.height):(this.layout.calculate(this._stageSize.width,this._stageSize.height,this.settings.gap),this.settings.offset=this.layout.delta,this.stage.addStyleRules('iframe',[{'margin-right':this.layout.gap+'px'}])),this.viewSettings.width=this.layout.width,this.viewSettings.height=this.layout.height,this.setLayout(this.layout))}next(){'horizontal'===this.settings.axis?(this.scrollLeft=this.container.scrollLeft,this.container.scrollLeft+this.container.offsetWidth+this.layout.delta<this.container.scrollWidth?this.scrollBy(this.layout.delta,0):this.scrollTo(this.container.scrollWidth-this.layout.delta,0)):this.scrollBy(0,this.layout.height)}prev(){'horizontal'===this.settings.axis?this.scrollBy(-this.layout.delta,0):this.scrollBy(0,-this.layout.height)}updateFlow(S){var k='paginated'===S?'horizontal':'vertical';this.settings.axis=k,this.viewSettings.axis=k,this.settings.overflow='paginated'===S?'hidden':'auto',this.settings.infinite=!('vertical'!==this.settings.axis)}},p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(2),_=f(0),C=f(1),S=f(9);class k{constructor(E,T){this.settings=_.extend({ignoreClass:'',axis:'vertical',width:0,height:0,layout:void 0,globalLayoutProperties:{}},T||{}),this.id='epubjs-view-'+_.uuid(),this.section=E,this.index=E.index,this.element=this.container(this.settings.axis),this.added=!1,this.displayed=!1,this.rendered=!1,this.width=this.settings.width,this.height=this.settings.height,this.fixedWidth=0,this.fixedHeight=0,this.epubcfi=new C,this.layout=this.settings.layout}container(E){var T=document.createElement('div');return T.classList.add('epub-view'),T.style.height='0px',T.style.width='0px',T.style.overflow='hidden',T.style.display=E&&'horizontal'==E?'inline-block':'block',T}create(){return this.iframe?this.iframe:(this.element||(this.element=this.createContainer()),this.iframe=document.createElement('iframe'),this.iframe.id=this.id,this.iframe.scrolling='no',this.iframe.style.overflow='hidden',this.iframe.seamless='seamless',this.iframe.style.border='none',this.resizing=!0,this.element.style.visibility='hidden',this.iframe.style.visibility='hidden',this.iframe.style.width='0',this.iframe.style.height='0',this._width=0,this._height=0,this.element.appendChild(this.iframe),this.added=!0,this.elementBounds=_.bounds(this.element),this.supportsSrcdoc=!!('srcdoc'in this.iframe),this.iframe)}render(E,T){return this.create(),this.size(),this.sectionRender||(this.sectionRender=this.section.render(E)),this.sectionRender.then(function(P){return this.load(P)}.bind(this)).then(function(){}.bind(this)).then(function(){this.settings.layout.format(this.contents),this.expand(),this.addListeners(),!1!==T,this.emit('rendered',this.section)}.bind(this)).catch(function(P){console.error(P),this.emit('loaderror',P)}.bind(this))}size(E,T){var P=E||this.settings.width,z=T||this.settings.height;'pre-paginated'===this.layout.name?this.lock('both',P,z):'horizontal'===this.settings.axis?this.lock('height',P,z):this.lock('width',P,z)}lock(E,T,P){var z=_.borders(this.element),N;N=this.iframe?_.borders(this.iframe):{width:0,height:0},'width'==E&&_.isNumber(T)&&(this.lockedWidth=T-z.width-N.width,this.resize(this.lockedWidth,T)),'height'==E&&_.isNumber(P)&&(this.lockedHeight=P-z.height-N.height,this.resize(T,this.lockedHeight)),'both'===E&&_.isNumber(T)&&_.isNumber(P)&&(this.lockedWidth=T-z.width-N.width,this.lockedHeight=P-z.height-N.height,this.resize(this.lockedWidth,this.lockedHeight)),this.displayed&&this.iframe&&this.expand()}expand(){var E=this.lockedWidth,T=this.lockedHeight,P,z,N;!this.iframe||this._expanding||(this._expanding=!0,'horizontal'===this.settings.axis?(z=this.contents.textWidth(),z==this._textWidth?E=this._contentWidth:(E=this.contentWidth(z),P=Math.ceil(E/(this.settings.layout.columnWidth+this.settings.layout.gap)),1<this.settings.layout.divisor&&'reflowable'===this.settings.layout.name&&0<P%2&&(E+=this.settings.layout.gap+this.settings.layout.columnWidth),this._textWidth=z,this._contentWidth=E)):'vertical'===this.settings.axis&&(N=this.contents.textHeight(),N==this._textHeight?T=this._contentHeight:(T=this.contentHeight(N),this._textHeight=N,this._contentHeight=T)),(this._needsReframe||E!=this._width||T!=this._height)&&this.resize(E,T),this._expanding=!1)}contentWidth(E){var T,P;return T=this.iframe.style.width,this.iframe.style.width=(E||0)+'px',P=this.contents.scrollWidth(),this.iframe.style.width=T,P}contentHeight(E){var T,P;return T=this.iframe.style.height,this.iframe.style.height=(E||0)+'px',P=this.contents.scrollHeight(),this.iframe.style.height=T,P}resize(E,T){this.iframe&&(_.isNumber(E)&&(this.iframe.style.width=E+'px',this._width=E),_.isNumber(T)&&(this.iframe.style.height=T+'px',this._height=T),this.iframeBounds=_.bounds(this.iframe),this.reframe(this.iframeBounds.width,this.iframeBounds.height))}reframe(E,T){var P;_.isNumber(E)&&(this.element.style.width=E+'px'),_.isNumber(T)&&(this.element.style.height=T+'px'),this.prevBounds=this.elementBounds,this.elementBounds=_.bounds(this.element),P={width:this.elementBounds.width,height:this.elementBounds.height,widthDelta:this.elementBounds.width-this.prevBounds.width,heightDelta:this.elementBounds.height-this.prevBounds.height},this.onResize(this,P),this.emit('resized',P)}load(E){var T=new _.defer,P=T.promise;if(!this.iframe)return T.reject(new Error('No Iframe Available')),P;if(this.iframe.onload=function(z){this.onLoad(z,T)}.bind(this),this.supportsSrcdoc)this.iframe.srcdoc=E;else{if(this.document=this.iframe.contentDocument,!this.document)return T.reject(new Error('No Document Available')),P;this.iframe.contentDocument.open(),this.iframe.contentDocument.write(E),this.iframe.contentDocument.close()}return P}onLoad(E,T){this.window=this.iframe.contentWindow,this.document=this.iframe.contentDocument,this.contents=new S(this.document,this.document.body,this.section.cfiBase),this.rendering=!1;var P=this.document.querySelector('link[rel=\'canonical\']');P?P.setAttribute('href',this.section.url):(P=this.document.createElement('link'),P.setAttribute('rel','canonical'),P.setAttribute('href',this.section.url),this.document.querySelector('head').appendChild(P)),this.contents.on('expand',function(){this.displayed&&this.iframe&&this.expand()}),T.resolve(this.contents)}setLayout(E){this.layout=E}setAxis(E){this.settings.axis=E}resizeListenters(){clearTimeout(this.expanding),this.expanding=setTimeout(this.expand.bind(this),350)}addListeners(){}removeListeners(){}display(E){var T=new _.defer;return this.displayed?T.resolve(this):this.render(E).then(function(){this.emit('displayed',this),this.onDisplayed(this),this.displayed=!0,T.resolve(this)}.bind(this)),T.promise}show(){this.element.style.visibility='visible',this.iframe&&(this.iframe.style.visibility='visible'),this.emit('shown',this)}hide(){this.element.style.visibility='hidden',this.iframe.style.visibility='hidden',this.stopExpanding=!0,this.emit('hidden',this)}position(){return this.element.getBoundingClientRect()}locationOf(E){var T=this.iframe.getBoundingClientRect(),P=this.contents.locationOf(E,this.settings.ignoreClass);return{left:window.scrollX+T.left+P.left,top:window.scrollY+T.top+P.top}}onDisplayed(){}onResize(){}bounds(){return this.elementBounds||(this.elementBounds=_.bounds(this.element)),this.elementBounds}destroy(){this.displayed&&(this.displayed=!1,this.removeListeners(),this.stopExpanding=!0,this.element.removeChild(this.iframe),this.displayed=!1,this.iframe=null,this._textWidth=null,this._textHeight=null,this._width=null,this._height=null)}}v(k.prototype),u.default=k,p.exports=u['default']},function(p){var u=function(){return this}();try{u=u||Function('return this')()||(1,eval)('this')}catch(f){'object'==typeof window&&(u=window)}p.exports=u},function(p){'use strict';'use strict';var u={application:{ecmascript:['es','ecma'],javascript:'js',ogg:'ogx',pdf:'pdf',postscript:['ps','ai','eps','epsi','epsf','eps2','eps3'],'rdf+xml':'rdf',smil:['smi','smil'],'xhtml+xml':['xhtml','xht'],xml:['xml','xsl','xsd','opf','ncx'],zip:'zip','x-httpd-eruby':'rhtml','x-latex':'latex','x-maker':['frm','maker','frame','fm','fb','book','fbdoc'],'x-object':'o','x-shockwave-flash':['swf','swfl'],'x-silverlight':'scr','epub+zip':'epub','font-tdpfr':'pfr','inkml+xml':['ink','inkml'],json:'json','jsonml+json':'jsonml','mathml+xml':'mathml','metalink+xml':'metalink',mp4:'mp4s','omdoc+xml':'omdoc',oxps:'oxps','vnd.amazon.ebook':'azw',widget:'wgt','x-dtbook+xml':'dtb','x-dtbresource+xml':'res','x-font-bdf':'bdf','x-font-ghostscript':'gsf','x-font-linux-psf':'psf','x-font-otf':'otf','x-font-pcf':'pcf','x-font-snf':'snf','x-font-ttf':['ttf','ttc'],'x-font-type1':['pfa','pfb','pfm','afm'],'x-font-woff':'woff','x-mobipocket-ebook':['prc','mobi'],'x-mspublisher':'pub','x-nzb':'nzb','x-tgif':'obj','xaml+xml':'xaml','xml-dtd':'dtd','xproc+xml':'xpl','xslt+xml':'xslt','internet-property-stream':'acx','x-compress':'z','x-compressed':'tgz','x-gzip':'gz'},audio:{flac:'flac',midi:['mid','midi','kar','rmi'],mpeg:['mpga','mpega','mp2','mp3','m4a','mp2a','m2a','m3a'],mpegurl:'m3u',ogg:['oga','ogg','spx'],'x-aiff':['aif','aiff','aifc'],'x-ms-wma':'wma','x-wav':'wav',adpcm:'adp',mp4:'mp4a',webm:'weba','x-aac':'aac','x-caf':'caf','x-matroska':'mka','x-pn-realaudio-plugin':'rmp',xm:'xm',mid:['mid','rmi']},image:{gif:'gif',ief:'ief',jpeg:['jpeg','jpg','jpe'],pcx:'pcx',png:'png','svg+xml':['svg','svgz'],tiff:['tiff','tif'],'x-icon':'ico',bmp:'bmp',webp:'webp','x-pict':['pic','pct'],'x-tga':'tga','cis-cod':'cod'},text:{'cache-manifest':['manifest','appcache'],css:'css',csv:'csv',html:['html','htm','shtml','stm'],mathml:'mml',plain:['txt','text','brf','conf','def','list','log','in','bas'],richtext:'rtx','tab-separated-values':'tsv','x-bibtex':'bib'},video:{mpeg:['mpeg','mpg','mpe','m1v','m2v','mp2','mpa','mpv2'],mp4:['mp4','mp4v','mpg4'],quicktime:['qt','mov'],ogg:'ogv','vnd.mpegurl':['mxu','m4u'],'x-flv':'flv','x-la-asf':['lsf','lsx'],'x-mng':'mng','x-ms-asf':['asf','asx','asr'],'x-ms-wm':'wm','x-ms-wmv':'wmv','x-ms-wmx':'wmx','x-ms-wvx':'wvx','x-msvideo':'avi','x-sgi-movie':'movie','x-matroska':['mpv','mkv','mk3d','mks'],'3gpp2':'3g2',h261:'h261',h263:'h263',h264:'h264',jpeg:'jpgv',jpm:['jpm','jpgm'],mj2:['mj2','mjp2'],'vnd.ms-playready.media.pyv':'pyv','vnd.uvvu.mp4':['uvu','uvvu'],'vnd.vivo':'viv',webm:'webm','x-f4v':'f4v','x-m4v':'m4v','x-ms-vob':'vob','x-smv':'smv'}},f=function(){var v,_,C,S,k={};for(v in u)if(u.hasOwnProperty(v))for(_ in u[v])if(u[v].hasOwnProperty(_))if(C=u[v][_],'string'==typeof C)k[C]=v+'/'+_;else for(S=0;S<C.length;S++)k[C[S]]=v+'/'+_;return k}();p.exports={lookup:function(_){return _&&f[_.split('.').pop().toLowerCase()]||'text/plain'}}},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(0),_=f(7),C=f(17),S=f(0).Path;u.default=class{constructor(){this.zip=void 0,this.checkRequirements(),this.urlCache={}}checkRequirements(){try{'undefined'==typeof JSZip&&(JSZip=f(47)),this.zip=new JSZip}catch(E){console.error('JSZip lib not loaded')}}open(E,T){return this.zip.loadAsync(E,{base64:T})}openUrl(E,T){return _(E,'binary').then(function(P){return this.zip.loadAsync(P,{base64:T})}.bind(this))}request(E,T){var z,P=new v.defer,N=new S(E);return T||(T=N.extension),z='blob'==T?this.getBlob(E):this.getText(E),z?z.then(function(B){var R=this.handleResponse(B,T);P.resolve(R)}.bind(this)):P.reject({message:'File not found in the epub: '+E,stack:new Error().stack}),P.promise}handleResponse(E,T){var P;return P='json'==T?JSON.parse(E):v.isXml(T)?v.parse(E,'text/xml'):'xhtml'==T?v.parse(E,'application/xhtml+xml'):'html'==T||'htm'==T?v.parse(E,'text/html'):E,P}getBlob(E,T){var P=window.decodeURIComponent(E.substr(1)),z=this.zip.file(P);if(z)return T=T||C.lookup(z.name),z.async('uint8array').then(function(N){return new Blob([N],{type:T})})}getText(E){var T=window.decodeURIComponent(E.substr(1)),P=this.zip.file(T);if(P)return P.async('string').then(function(z){return z})}getBase64(E,T){var P=window.decodeURIComponent(E.substr(1)),z=this.zip.file(P);if(z)return T=T||C.lookup(z.name),z.async('base64').then(function(N){return'data:'+T+';base64,'+N})}createUrl(E,T){var N,B,P=new v.defer,z=window.URL||window.webkitURL||window.mozURL,R=T&&T.base64;return E in this.urlCache?(P.resolve(this.urlCache[E]),P.promise):(R?(B=this.getBase64(E),B&&B.then(function(A){this.urlCache[E]=A,P.resolve(A)}.bind(this))):(B=this.getBlob(E),B&&B.then(function(A){N=z.createObjectURL(A),this.urlCache[E]=N,P.resolve(N)}.bind(this))),B||P.reject({message:'File not found in the epub: '+E,stack:new Error().stack}),P.promise)}revokeUrl(E){var T=window.URL||window.webkitURL||window.mozURL,P=this.urlCache[E];P&&T.revokeObjectURL(P)}},p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(8),_=f(0);f(1),u.default=class{constructor(S){S&&this.parse(S)}parse(S){var k;return S?(k=_.qs(S,'rootfile'),k?void(this.packagePath=k.getAttribute('full-path'),this.directory=v.dirname(this.packagePath),this.encoding=S.xmlEncoding):void console.error('No RootFile Found')):void console.error('Container File Not Found')}},p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0}),f(0),u.default=class{constructor(_){this.name=_.layout||'reflowable',this._spread='none'!==_.spread,this._minSpreadWidth=_.minSpreadWidth||800,this._evenSpreads=_.evenSpreads||!1,this._flow='scrolled-continuous'===_.flow||'scrolled-doc'===_.flow?'scrolled':'paginated',this.width=0,this.height=0,this.spreadWidth=0,this.delta=0,this.columnWidth=0,this.gap=0,this.divisor=1}flow(_){this._flow='paginated'===_?'paginated':'scrolled'}spread(_,C){this._spread='none'!==_,0<=C&&(this._minSpreadWidth=C)}calculate(_,C,S){var k=1,E=S||0;Math.floor(_);var T=_,P=Math.floor(T/8),z,N,B;k=this._spread&&T>=this._minSpreadWidth?2:1,'reflowable'!==this.name||'paginated'!==this._flow||0<=S||(E=0==P%2?P:P-1),'pre-paginated'===this.name&&(E=0),z=1<k?(T-E)/k:T,'pre-paginated'===this.name&&1<k&&(T=z),N=z*k,B=(z+E)*k,this.width=T,this.height=C,this.spreadWidth=N,this.delta=B,this.columnWidth=z,this.gap=E,this.divisor=k}format(_){var C;return C='pre-paginated'===this.name?_.fit(this.columnWidth,this.height):'paginated'===this._flow?_.columns(this.width,this.height,this.columnWidth,this.gap):_.size(this.width,null),C}count(_){var C=Math.ceil(_/this.spreadWidth);return{spreads:C,pages:C*this.divisor}}},p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(0),_=f(5),C=f(1),S=f(2);class k{constructor(E,T){this.spine=E,this.request=T,this.q=new _(this),this.epubcfi=new C,this._locations=[],this.total=0,this.break=150,this._current=0}generate(E){return E&&(this.break=E),this.q.pause(),this.spine.each(function(T){this.q.enqueue(this.process.bind(this),T)}.bind(this)),this.q.run().then(function(){return this.total=this._locations.length-1,this._currentCfi&&(this.currentLocation=this._currentCfi),this._locations}.bind(this))}createRange(){return{startContainer:void 0,startOffset:void 0,endContainer:void 0,endOffset:void 0}}process(E){return E.load(this.request).then(function(T){var P=this.parse(T,E.cfiBase);this._locations=this._locations.concat(P)}.bind(this))}parse(E,T,P){var N,O,z=[],B=E.ownerDocument,R=v.qs(B,'body'),A=0,W=P||this.break;if(v.sprint(R,function(M){var F,D=M.length,H=0;if(0===M.textContent.trim().length)return!1;for(0==A&&(N=this.createRange(),N.startContainer=M,N.startOffset=0),F=W-A,F>D&&(A+=D,H=D);H<D;)if(H+=F,H>=D)A=D-(H-W);else{N.endContainer=M,N.endOffset=H;var V=new C(N,T).toString();z.push(V),A=0,H+=1,N=this.createRange(),N.startContainer=M,N.startOffset=H,F=W}O=M}.bind(this)),N&&N.startContainer&&O){N.endContainer=O,N.endOffset=O.length;var U=new C(N,T).toString();z.push(U),A=0}return z}locationFromCfi(E){return 0===this._locations.length?-1:v.locationOf(E.start,this._locations,this.epubcfi.compare)}percentageFromCfi(E){if(0===this._locations.length)return null;var T=this.locationFromCfi(E);return this.percentageFromLocation(T)}percentageFromLocation(E){return E&&this.total?E/this.total:0}cfiFromLocation(E){var T=-1;return'number'!=typeof E&&(E=parseInt(pg)),0<=E&&E<this._locations.length&&(T=this._locations[E]),T}cfiFromPercentage(E){var T=1<E?E/100:E,P=Math.ceil(this.total*T);return this.cfiFromLocation(P)}load(E){return this._locations=JSON.parse(E),this.total=this._locations.length-1,this._locations}save(){return JSON.stringify(this._locations)}getCurrent(){return this._current}setCurrent(E){var T;if('string'==typeof E)this._currentCfi=E;else if('number'==typeof E)this._current=E;else return;0===this._locations.length||('string'==typeof E?(T=this.locationFromCfi(E),this._current=T):T=E,this.emit('changed',{percentage:this.percentageFromLocation(T)}))}get currentLocation(){return this._current}set currentLocation(E){this.setCurrent(E)}length(){return this._locations.length}}S(k.prototype),u.default=k,p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(0);u.default=class{constructor(C){this.settings=C||{},this.id='epubjs-container-'+v.uuid(),this.container=this.create(this.settings),this.settings.hidden&&(this.wrapper=this.wrap(this.container))}create(C){var S=C.height,k=C.width,E=C.overflow||!1,T=C.axis||'vertical';C.height&&v.isNumber(C.height)&&(S=C.height+'px'),C.width&&v.isNumber(C.width)&&(k=C.width+'px');var P=document.createElement('div');return P.id=this.id,P.classList.add('epub-container'),P.style.wordSpacing='0',P.style.lineHeight='0',P.style.verticalAlign='top','horizontal'===T&&(P.style.whiteSpace='nowrap'),k&&(P.style.width=k),S&&(P.style.height=S),E&&(P.style.overflow=E),P}wrap(C){var S=document.createElement('div');return S.style.visibility='hidden',S.style.overflow='hidden',S.style.width='0',S.style.height='0',S.appendChild(C),S}getElement(C){var S;return v.isElement(C)?S=C:'string'==typeof C&&(S=document.getElementById(C)),S?S:void console.error('Not an Element')}attachTo(C){var k,S=this.getElement(C);if(S)return k=this.settings.hidden?this.wrapper:this.container,S.appendChild(k),this.element=S,S}getContainer(){return this.container}onResize(C){v.isNumber(this.settings.width)&&v.isNumber(this.settings.height)||window.addEventListener('resize',C,!1)}size(C,S){var k;return null===C&&(k=this.element.getBoundingClientRect(),k.width&&(C=k.width,this.container.style.width=k.width+'px')),null===S&&(k=k||this.element.getBoundingClientRect(),k.height&&(S=k.height,this.container.style.height=k.height+'px')),v.isNumber(C)||(k=this.container.getBoundingClientRect(),C=k.width),v.isNumber(S)||(k=k||this.container.getBoundingClientRect(),S=k.height),this.containerStyles=window.getComputedStyle(this.container),this.containerPadding={left:parseFloat(this.containerStyles['padding-left'])||0,right:parseFloat(this.containerStyles['padding-right'])||0,top:parseFloat(this.containerStyles['padding-top'])||0,bottom:parseFloat(this.containerStyles['padding-bottom'])||0},{width:C-this.containerPadding.left-this.containerPadding.right,height:S-this.containerPadding.top-this.containerPadding.bottom}}bounds(){return this.container?this.container.getBoundingClientRect():v.windowBounds()}getSheet(){var C=document.createElement('style');return C.appendChild(document.createTextNode('')),document.head.appendChild(C),C.sheet}addStyleRules(C,S){var k='#'+this.id+' ',E='';this.sheet||(this.sheet=this.getSheet()),S.forEach(function(T){for(var P in T)T.hasOwnProperty(P)&&(E+=P+':'+T[P]+';')}),this.sheet.insertRule(k+C+' {'+E+'}',0)}},p.exports=u['default']},function(p,u){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0}),u.default=class{constructor(v){this.container=v,this._views=[],this.length=0,this.hidden=!1}all(){return this._views}first(){return this._views[0]}last(){return this._views[this._views.length-1]}indexOf(v){return this._views.indexOf(v)}slice(){return this._views.slice.apply(this._views,arguments)}get(v){return this._views[v]}append(v){return this._views.push(v),this.container&&this.container.appendChild(v.element),this.length++,v}prepend(v){return this._views.unshift(v),this.container&&this.container.insertBefore(v.element,this.container.firstChild),this.length++,v}insert(v,_){return this._views.splice(_,0,v),this.container&&(_<this.container.children.length?this.container.insertBefore(v.element,this.container.children[_]):this.container.appendChild(v.element)),this.length++,v}remove(v){var _=this._views.indexOf(v);-1<_&&this._views.splice(_,1),this.destroy(v),this.length--}destroy(v){v.displayed&&v.destroy(),this.container&&this.container.removeChild(v.element),v=null}each(){return this._views.forEach.apply(this._views,arguments)}clear(){var v,_=this.length;if(this.length){for(var C=0;C<_;C++)v=this._views[C],this.destroy(v);this._views=[],this.length=0}}find(v){var _,C=this.length;for(var S=0;S<C;S++)if(_=this._views[S],_.displayed&&_.section.index==v.index)return _}displayed(){var v=[],_,C=this.length;for(var S=0;S<C;S++)_=this._views[S],_.displayed&&v.push(_);return v}show(){var v,_=this.length;for(var C=0;C<_;C++)v=this._views[C],v.displayed&&v.show();this.hidden=!1}hide(){var v,_=this.length;for(var C=0;C<_;C++)v=this._views[C],v.displayed&&v.hide();this.hidden=!0}},p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(0);u.default=class{constructor(C){this.toc=[],this.tocByHref={},this.tocById={},C&&this.parse(C)}parse(C){var S=v.qs(C,'html'),k=v.qs(C,'ncx');S?this.toc=this.parseNav(C):k&&(this.toc=this.parseNcx(C)),this.unpack(this.toc)}unpack(C){var S;for(var k=0;k<C.length;k++)S=C[k],this.tocByHref[S.href]=k,this.tocById[S.id]=k}get(C){var S;return C?(0===C.indexOf('#')?S=this.tocById[C.substring(1)]:C in this.tocByHref&&(S=this.tocByHref[C]),this.toc[S]):this.toc}parseNav(C){var S=v.querySelectorByType(C,'nav','toc'),k=S?v.qsa(S,'li'):[],E=k.length,T,P={},z=[],N,B;if(!k||0===E)return z;for(T=0;T<E;++T)N=this.navItem(k[T]),P[N.id]=N,N.parent?(B=P[N.parent],B.subitems.push(N)):z.push(N);return z}navItem(C){var z,S=C.getAttribute('id')||!1,k=v.qs(C,'a'),E=k.getAttribute('href')||'',T=k.textContent||'',P=C.parentNode;return P&&'navPoint'===P.nodeName&&(z=P.getAttribute('id')),{id:S,href:E,label:T,subitems:[],parent:z}}parseNcx(C){var S=v.qsa(C,'navPoint'),k=S.length,E,T={},P=[],z,N;if(!S||0===k)return P;for(E=0;E<k;++E)z=this.ncxItem(S[E]),T[z.id]=z,z.parent?(N=T[z.parent],N.subitems.push(z)):P.push(z);return P}ncxItem(C){var N,S=C.getAttribute('id')||!1,k=v.qs(C,'content'),E=k.getAttribute('src'),T=v.qs(C,'navLabel'),P=T.textContent?T.textContent:'',z=C.parentNode;return z&&'navPoint'===z.nodeName&&(N=z.getAttribute('id')),{id:S,href:E,label:P,subitems:[],parent:N}}forEach(C){return this.toc.forEach(C)}},p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(0),_=f(1);u.default=class{constructor(S){S&&this.parse(S)}parse(S){var k,E,T;return S?(k=v.qs(S,'metadata'),!k)?void console.error('No Metadata Found'):(E=v.qs(S,'manifest'),!E)?void console.error('No Manifest Found'):(T=v.qs(S,'spine'),!T)?void console.error('No Spine Found'):(this.manifest=this.parseManifest(E),this.navPath=this.findNavPath(E),this.ncxPath=this.findNcxPath(E,T),this.coverPath=this.findCoverPath(S),this.spineNodeIndex=Array.prototype.indexOf.call(T.parentNode.childNodes,T),this.spine=this.parseSpine(T,this.manifest),this.metadata=this.parseMetadata(k),this.metadata.direction=T.getAttribute('page-progression-direction'),{metadata:this.metadata,spine:this.spine,manifest:this.manifest,navPath:this.navPath,ncxPath:this.ncxPath,coverPath:this.coverPath,spineNodeIndex:this.spineNodeIndex}):void console.error('Package File Not Found')}parseMetadata(S){var k={};return k.title=this.getElementText(S,'title'),k.creator=this.getElementText(S,'creator'),k.description=this.getElementText(S,'description'),k.pubdate=this.getElementText(S,'date'),k.publisher=this.getElementText(S,'publisher'),k.identifier=this.getElementText(S,'identifier'),k.language=this.getElementText(S,'language'),k.rights=this.getElementText(S,'rights'),k.modified_date=this.getPropertyText(S,'dcterms:modified'),k.layout=this.getPropertyText(S,'rendition:layout'),k.orientation=this.getPropertyText(S,'rendition:orientation'),k.flow=this.getPropertyText(S,'rendition:flow'),k.viewport=this.getPropertyText(S,'rendition:viewport'),k}parseManifest(S){var k={},E=v.qsa(S,'item'),T=Array.prototype.slice.call(E);return T.forEach(function(P){var z=P.getAttribute('id'),N=P.getAttribute('href')||'',B=P.getAttribute('media-type')||'',R=P.getAttribute('properties')||'';k[z]={href:N,type:B,properties:R.length?R.split(' '):[]}}),k}parseSpine(S){var k=[],E=S.getElementsByTagName('itemref'),T=Array.prototype.slice.call(E);return new _,T.forEach(function(P,z){var N=P.getAttribute('idref'),B=P.getAttribute('properties')||'',R=B.length?B.split(' '):[],A={idref:N,linear:P.getAttribute('linear')||'',properties:R,index:z};k.push(A)}),k}findNavPath(S){var k=v.qsp(S,'item',{properties:'nav'});return!!k&&k.getAttribute('href')}findNcxPath(S,k){var T,E=v.qsp(S,'item',{'media-type':'application/x-dtbncx+xml'});return E||(T=k.getAttribute('toc'),T&&(E=S.getElementById(T))),!!E&&E.getAttribute('href')}findCoverPath(S){var k=v.qs(S,'package'),E=k.getAttribute('version');if('2.0'===E){var T=v.qsp(S,'meta',{name:'cover'});if(T){var P=T.getAttribute('content'),z=S.getElementById(P);return z?z.getAttribute('href'):''}return!1}var N=v.qsp(S,'item',{properties:'cover-image'});return N?N.getAttribute('href'):''}getElementText(S,k){var T,E=S.getElementsByTagNameNS('http://purl.org/dc/elements/1.1/',k);return E&&0!==E.length?(T=E[0],T.childNodes.length?T.childNodes[0].nodeValue:''):''}getPropertyText(S,k){var E=v.qsp(S,'meta',{property:k});return E&&E.childNodes.length?E.childNodes[0].nodeValue:''}},p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(1),_=f(0);u.default=class{constructor(S){this.pages=[],this.locations=[],this.epubcfi=new v,S&&(this.pageList=this.parse(S)),this.pageList&&this.pageList.length&&this.process(this.pageList)}parse(S){var k=_.qs(S,'html');k?this.toc=this.parseNav(S):ncx}parseNav(S){var k=_.querySelectorByType(S,'nav','page-list'),E=k?_.qsa(k,'li'):[],T=E.length,P,z=[],N;if(!E||0===T)return z;for(P=0;P<T;++P)N=this.item(E[P]),z.push(N);return z}item(S){var B,R,A,k=S.getAttribute('id')||!1,E=_.qs(S,'a'),T=E.getAttribute('href')||'',P=E.textContent||'',z=parseInt(P),N=T.indexOf('epubcfi');return-1==N?{href:T,page:z}:(B=T.split('#'),R=B[0],A=!!(1<B.length)&&B[1],{cfi:A,href:T,packageUrl:R,page:z})}process(S){S.forEach(function(k){this.pages.push(k.page),k.cfi&&this.locations.push(k.cfi)},this),this.firstPage=parseInt(this.pages[0]),this.lastPage=parseInt(this.pages[this.pages.length-1]),this.totalPages=this.lastPage-this.firstPage}addCFIs(){this.pageList.forEach(function(S){!S.cfi})}pageFromCfi(S){var k=-1;if(0===this.locations.length)return-1;var E=_.indexOfSorted(S,this.locations,this.epubcfi.compare);return-1==E?(E=EPUBJS.core.locationOf(S,this.locations,this.epubcfi.compare),k=0<=E-1?this.pages[E-1]:this.pages[0],void 0===k&&(k=-1)):k=this.pages[E],k}cfiFromPage(S){var k=-1;'number'!=typeof S&&(S=parseInt(S));var E=this.pages.indexOf(S);return-1!=E&&(k=this.locations[E]),k}pageFromPercentage(S){var k=Math.round(this.totalPages*S);return k}percentageFromPage(S){var k=(S-this.firstPage)/this.totalPages;return Math.round(1e3*k)/1e3}percentageFromCfi(S){var k=this.pageFromCfi(S),E=this.percentageFromPage(k);return E}},p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(6),_=f(0),C=f(0).Path,S=f(8);u.default=class{constructor(E,T){this.settings={replacements:T&&T.replacements||'base64',archive:T&&T.archive,resolver:T&&T.resolver},this.manifest=E,this.resources=Object.keys(E).map(function(P){return E[P]}),this.replacementUrls=[],this.split(),this.splitUrls()}split(){this.html=this.resources.filter(function(E){if('application/xhtml+xml'===E.type||'text/html'===E.type)return!0}),this.assets=this.resources.filter(function(E){if('application/xhtml+xml'!==E.type&&'text/html'!==E.type)return!0}),this.css=this.resources.filter(function(E){if('text/css'===E.type)return!0})}splitUrls(){this.urls=this.assets.map(function(E){return E.href}.bind(this)),this.cssUrls=this.css.map(function(E){return E.href})}replacements(E,T){if(E=E||this.settings.archive,T=T||this.settings.resolver,'none'===this.settings.replacements)return new Promise(function(z){z(this.urls)}.bind(this));var P=this.urls.map(function(z){var N=T(z);return E.createUrl(N,{base64:'base64'===this.settings.replacements})}.bind(this));return Promise.all(P).then(function(z){return this.replacementUrls=z,z}.bind(this))}replaceCss(E,T){var P=[];return E=E||this.settings.archive,T=T||this.settings.resolver,this.cssUrls.forEach(function(z){var N=this.createCssFile(z,E,T).then(function(B){var R=this.urls.indexOf(z);-1<R&&(this.replacementUrls[R]=B)}.bind(this));P.push(N)}.bind(this)),Promise.all(P)}createCssFile(E,T,P){var z;if(T=T||this.settings.archive,P=P||this.settings.resolver,S.isAbsolute(E))return new Promise(function(A){A(urls,replacementUrls)});var N=P(E),B=T.getText(N),R=this.urls.map(function(A){var O=P(A),W=new C(N).relative(O);return W}.bind(this));return B.then(function(A){return A=v.substitute(A,R,this.replacementUrls),z='base64'===this.settings.replacements?_.createBase64Url(A,'text/css'):_.createBlobUrl(A,'text/css'),z}.bind(this))}relativeTo(E,T){return T=T||this.settings.resolver,this.urls.map(function(P){var z=T(P),N=new C(E).relative(z);return N}.bind(this))}get(E){var T=this.urls.indexOf(E);return-1===T?void 0:this.replacementUrls.length?new Promise(function(P){P(this.replacementUrls[T])}.bind(this)):archive.createUrl(absolute,{base64:'base64'===this.settings.replacements})}substitute(E,T){var P;return P=T?this.relativeTo(T):this.urls,v.substitute(E,P,this.replacementUrls)}},p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(0),_=f(1),C=f(3),S=f(0).Url;u.default=class{constructor(E,T){this.idref=E.idref,this.linear=E.linear,this.properties=E.properties,this.index=E.index,this.href=E.href,this.url=E.url,this.next=E.next,this.prev=E.prev,this.cfiBase=E.cfiBase,T?this.hooks=T:(this.hooks={},this.hooks.serialize=new C(this),this.hooks.content=new C(this))}load(E){var T=E||this.request||f(7),P=new v.defer,z=P.promise;return this.contents?P.resolve(this.contents):T(this.url).then(function(N){return new S(this.url).directory,this.document=N,this.contents=N.documentElement,this.hooks.content.trigger(this.document,this)}.bind(this)).then(function(){P.resolve(this.contents)}.bind(this)).catch(function(N){P.reject(N)}),z}base(E){var z,T=new v.defer,P=E.createElement('base');return P.setAttribute('href',window.location.origin+'/'+this.url),E&&(z=E.querySelector('head')),z?(z.insertBefore(P,z.firstChild),T.resolve()):T.reject(new Error('No head to insert into')),T.promise}render(E){var T=new v.defer,P=T.promise;return this.output,this.load(E).then(function(z){var N;return'undefined'==typeof XMLSerializer&&(XMLSerializer=f(12).XMLSerializer),N=new XMLSerializer,this.output=N.serializeToString(z),this.output}.bind(this)).then(function(){return this.hooks.serialize.trigger(this.output,this)}.bind(this)).then(function(){T.resolve(this.output)}.bind(this)).catch(function(z){T.reject(z)}),P}find(){}reconcileLayoutSettings(E){var T={layout:E.layout,spread:E.spread,orientation:E.orientation};return this.properties.forEach(function(P){var B,R,z=P.replace('rendition:',''),N=z.indexOf('-');-1!=N&&(B=z.slice(0,N),R=z.slice(N+1),T[B]=R)}),T}cfiFromRange(E){return new _(E,this.cfiBase).toString()}cfiFromElement(E){return new _(E,this.cfiBase).toString()}},p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0}),f(0);var v=f(1),_=f(3),C=f(28),S=f(6);u.default=class{constructor(){this.spineItems=[],this.spineByHref={},this.spineById={},this.hooks={},this.hooks.serialize=new _,this.hooks.content=new _,this.hooks.content.register(S.base),this.hooks.content.register(S.canonical),this.epubcfi=new v,this.loaded=!1}unpack(E,T){this.items=E.spine,this.manifest=E.manifest,this.spineNodeIndex=E.spineNodeIndex,this.baseUrl=E.baseUrl||E.basePath||'',this.length=this.items.length,this.items.forEach(function(P,z){var N=this.manifest[P.idref],B;P.cfiBase=this.epubcfi.generateChapterComponent(this.spineNodeIndex,P.index,P.idref),N&&(P.href=N.href,P.url=T(P.href,!0),N.properties.length&&P.properties.push.apply(P.properties,N.properties)),P.prev=function(){return this.get(z-1)}.bind(this),P.next=function(){return this.get(z+1)}.bind(this),B=new C(P,this.hooks),this.append(B)}.bind(this)),this.loaded=!0}get(E){var T=0;return this.epubcfi.isCfiString(E)?(cfi=new v(E),T=cfi.spinePos):E&&('number'==typeof E||!1===isNaN(E))?T=E:E&&0===E.indexOf('#')?T=this.spineById[E.substring(1)]:E&&(E=E.split('#')[0],T=this.spineByHref[E]),this.spineItems[T]||null}append(E){var T=this.spineItems.length;return E.index=T,this.spineItems.push(E),this.spineByHref[E.href]=T,this.spineById[E.idref]=T,T}prepend(E){return this.spineItems.unshift(E),this.spineByHref[E.href]=0,this.spineById[E.idref]=0,this.spineItems.forEach(function(T,P){T.index=P}),0}remove(E){var T=this.spineItems.indexOf(E);if(-1<T)return delete this.spineByHref[E.href],delete this.spineById[E.idref],this.spineItems.splice(T,1)}each(){return this.spineItems.forEach.apply(this.spineItems,arguments)}},p.exports=u['default']},function(p,u,f){'use strict';'use strict';Object.defineProperty(u,'__esModule',{value:!0});var v=f(0).Url;u.default=class{constructor(C){this.rendition=C,this._themes={'default':{rules:[],url:'',serialized:''}},this._overrides={},this._current='default',this._injected=[],this.rendition.hooks.content.register(this.inject.bind(this)),this.rendition.hooks.content.register(this.overrides.bind(this))}register(){return 0===arguments.length?void 0:1===arguments.length&&'object'==typeof arguments[0]?this.registerThemes(arguments[0]):1===arguments.length&&'string'==typeof arguments[0]?this.default(arguments[0]):2===arguments.length&&'string'==typeof arguments[1]?this.registerUrl(arguments[0],arguments[1]):2===arguments.length&&'object'==typeof arguments[1]?this.registerRules(arguments[0],arguments[1]):void 0}default(C){return C?'string'==typeof C?this.registerUrl('default',C):'object'==typeof C?this.registerRules('default',C):void 0:void 0}registerThemes(C){for(var S in C)C.hasOwnProperty(S)&&('string'==typeof C[S]?this.registerUrl(S,C[S]):this.registerRules(S,C[S]))}registerUrl(C,S){var k=new v(S);this._themes[C]={url:k.toString()}}registerRules(C,S){this._themes[C]={rules:S}}apply(C){var S=this._current,k;this._current=C,this.update(C),k=this.rendition.getContents(),k.forEach(function(E){E.removeClass(S),E.addClass(C)}.bind(this))}update(C){var S=this.rendition.getContents();S.forEach(function(k){this.add(C,k)}.bind(this))}inject(C){var S=[],k=this._themes,E;for(var T in k)k.hasOwnProperty(T)&&(E=k[T],(E.rules||E.url&&-1===S.indexOf(E.url))&&this.add(T,C.contents));this._current&&C.contents.addClass(this._current)}add(C,S){var k=this._themes[C];k&&(k.url?S.addStylesheet(k.url):k.serialized||k.rules&&k.rules.length&&(S.addStylesheetRules(k.rules),k.injected=!0))}override(C,S){var k=this.rendition.getContents();this._overrides[C]=S,k.forEach(function(E){E.css(C,this._overrides[C])}.bind(this))}overrides(C){var S=C.contents,k=this._overrides;for(var E in k)k.hasOwnProperty(E)&&S.css(E,k[E])}fontSize(C){this.override('font-size',C)}},p.exports=u['default']},function(p,u){'use strict';'use strict';function f(z){var N=z.length;if(0<N%4)throw new Error('Invalid string. Length must be a multiple of 4');return'='===z[N-2]?2:'='===z[N-1]?1:0}function v(z){return C[63&z>>18]+C[63&z>>12]+C[63&z>>6]+C[63&z]}function _(z,N,B){var R,A=[];for(var O=N;O<B;O+=3)R=(z[O]<<16)+(z[O+1]<<8)+z[O+2],A.push(v(R));return A.join('')}u.byteLength=function(N){return 3*N.length/4-f(N)},u.toByteArray=function(N){var B,R,A,O,W,U,I=N.length;W=f(N),U=new k(3*I/4-W),A=0<W?I-4:I;var M=0;for(B=0,R=0;B<A;B+=4,R+=3)O=S[N.charCodeAt(B)]<<18|S[N.charCodeAt(B+1)]<<12|S[N.charCodeAt(B+2)]<<6|S[N.charCodeAt(B+3)],U[M++]=255&O>>16,U[M++]=255&O>>8,U[M++]=255&O;return 2===W?(O=S[N.charCodeAt(B)]<<2|S[N.charCodeAt(B+1)]>>4,U[M++]=255&O):1==W&&(O=S[N.charCodeAt(B)]<<10|S[N.charCodeAt(B+1)]<<4|S[N.charCodeAt(B+2)]>>2,U[M++]=255&O>>8,U[M++]=255&O),U},u.fromByteArray=function(N){var B,R=N.length,A=R%3,O='',W=[],U=16383;for(var I=0,M=R-A;I<M;I+=U)W.push(_(N,I,I+U>M?M:I+U));return 1==A?(B=N[R-1],O+=C[B>>2],O+=C[63&B<<4],O+='=='):2==A&&(B=(N[R-2]<<8)+N[R-1],O+=C[B>>10],O+=C[63&B>>4],O+=C[63&B<<2],O+='='),W.push(O),W.join('')};var C=[],S=[],k='undefined'==typeof Uint8Array?Array:Uint8Array,E='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';for(var T=0,P=E.length;T<P;++T)C[T]=E[T],S[E.charCodeAt(T)]=T;S['-'.charCodeAt(0)]=62,S['_'.charCodeAt(0)]=63},function(p,u,f){'use strict';'use strict';var k,v=f(33),_=f(40),C=f(36),S=f(43);k=p.exports=function(E,T){var P,z,N,B,R;return 2>arguments.length||'string'!=typeof E?(B=T,T=E,E=null):B=arguments[2],null==E?(P=N=!0,z=!1):(P=S.call(E,'c'),z=S.call(E,'e'),N=S.call(E,'w')),R={value:T,configurable:P,enumerable:z,writable:N},B?v(_(B),R):R},k.gs=function(E,T,P){var z,N,B,R;return'string'==typeof E?B=arguments[3]:(B=P,P=T,T=E,E=null),null==T?T=void 0:C(T)?null==P?P=void 0:!C(P)&&(B=P,P=void 0):(B=T,T=P=void 0),null==E?(z=!0,N=!1):(z=S.call(E,'c'),N=S.call(E,'e')),R={get:T,set:P,configurable:z,enumerable:N},B?v(_(B),R):R}},function(p,u,f){'use strict';'use strict';p.exports=f(34)()?Object.assign:f(35)},function(p){'use strict';'use strict';p.exports=function(){var f,u=Object.assign;return!('function'!=typeof u)&&(f={foo:'raz'},u(f,{bar:'dwa'},{trzy:'trzy'}),'razdwatrzy'===f.foo+f.bar+f.trzy)}},function(p,u,f){'use strict';'use strict';var v=f(37),_=f(42),C=Math.max;p.exports=function(S,k){var E,T,z,P=C(arguments.length,2);for(S=Object(_(S)),z=function(N){try{S[N]=k[N]}catch(B){E||(E=B)}},T=1;T<P;++T)k=arguments[T],v(k).forEach(z);if(E!==void 0)throw E;return S}},function(p){'use strict';'use strict';p.exports=function(u){return'function'==typeof u}},function(p,u,f){'use strict';'use strict';p.exports=f(38)()?Object.keys:f(39)},function(p){'use strict';'use strict';p.exports=function(){try{return Object.keys('primitive'),!0}catch(u){return!1}}},function(p){'use strict';'use strict';var u=Object.keys;p.exports=function(f){return u(null==f?f:Object(f))}},function(p){'use strict';'use strict';var u=Array.prototype.forEach,f=Object.create,v=function(_,C){for(var S in _)C[S]=_[S]};p.exports=function(){var _=f(null);return u.call(arguments,function(C){null==C||v(Object(C),_)}),_}},function(p){'use strict';'use strict';p.exports=function(u){if('function'!=typeof u)throw new TypeError(u+' is not a function');return u}},function(p){'use strict';'use strict';p.exports=function(u){if(null==u)throw new TypeError('Cannot use null or undefined');return u}},function(p,u,f){'use strict';'use strict';p.exports=f(44)()?String.prototype.contains:f(45)},function(p){'use strict';'use strict';var u='razdwatrzy';p.exports=function(){return!('function'!=typeof u.contains)&&!0===u.contains('dwa')&&!1===u.contains('foo')}},function(p){'use strict';'use strict';var u=String.prototype.indexOf;p.exports=function(f){return-1<u.call(this,f,arguments[1])}},function(p){function u(){throw new Error('setTimeout has not been defined')}function f(){throw new Error('clearTimeout has not been defined')}function v(O){if(P===setTimeout)return setTimeout(O,0);if((P===u||!P)&&setTimeout)return P=setTimeout,setTimeout(O,0);try{return P(O,0)}catch(W){try{return P.call(null,O,0)}catch(U){return P.call(this,O,0)}}}function _(O){if(z===clearTimeout)return clearTimeout(O);if((z===f||!z)&&clearTimeout)return z=clearTimeout,clearTimeout(O);try{return z(O)}catch(W){try{return z.call(null,O)}catch(U){return z.call(this,O)}}}function C(){B&&R&&(B=!1,R.length?N=R.concat(N):A=-1,N.length&&S())}function S(){if(!B){var O=v(C);B=!0;for(var W=N.length;W;){for(R=N,N=[];++A<W;)R&&R[A].run();A=-1,W=N.length}R=null,B=!1,_(O)}}function k(O,W){this.fun=O,this.array=W}function E(){}var T=p.exports={},P,z;(function(){try{P='function'==typeof setTimeout?setTimeout:u}catch(O){P=u}try{z='function'==typeof clearTimeout?clearTimeout:f}catch(O){z=f}})();var N=[],B=!1,R,A=-1;T.nextTick=function(O){var W=Array(arguments.length-1);if(1<arguments.length)for(var U=1;U<arguments.length;U++)W[U-1]=arguments[U];N.push(new k(O,W)),1!==N.length||B||v(S)},k.prototype.run=function(){this.fun.apply(null,this.array)},T.title='browser',T.browser=!0,T.env={},T.argv=[],T.version='',T.versions={},T.on=E,T.addListener=E,T.once=E,T.off=E,T.removeListener=E,T.removeAllListeners=E,T.emit=E,T.binding=function(){throw new Error('process.binding is not supported')},T.cwd=function(){return'/'},T.chdir=function(){throw new Error('process.chdir is not supported')},T.umask=function(){return 0}},function(p){if('undefined'==typeof t){var u=new Error('Cannot find module "JSZip"');throw u.code='MODULE_NOT_FOUND',u}p.exports=t},function(p,u,f){'use strict';(function(v){'use strict';function _(P,z){return new S.default(P,z)}Object.defineProperty(u,'__esModule',{value:!0});var C=f(13),S=function(z){return z&&z.__esModule?z:{default:z}}(C),k=f(1),E=f(11),T=f(9);_.VERSION='0.3.0','undefined'!=typeof v&&(v.EPUBJS_VERSION=_.VERSION),_.CFI=k,_.Rendition=E,_.Contents=T,_.ViewManagers={},_.Views={},_.register={manager:function(z,N){return _.ViewManagers[z]=N},view:function(z,N){return _.Views[z]=N}},_.register.view('iframe',f(15)),_.register.manager('default',f(10)),_.register.manager('continuous',f(14)),u.default=_,p.exports=u['default']}).call(u,f(16))}])}); |