1 line
No EOL
243 KiB
JavaScript
1 line
No EOL
243 KiB
JavaScript
(function(e,t){'object'==typeof exports&&'object'==typeof module?module.exports=t(require('xmldom'),function(){try{return require('jszip')}catch(t){}}()):'function'==typeof define&&define.amd?define(['xmldom','jszip'],t):'object'==typeof exports?exports.ePub=t(require('xmldom'),function(){try{return require('jszip')}catch(t){}}()):e.ePub=t(e.xmldom,e.jszip)})('undefined'==typeof self?this:self,function(e,t){var n=String.prototype,a=Math.abs,i=Math.min,o=Math.ceil,r=Math.round,s=Math.max,l=Math.floor;return function(e){function t(a){if(n[a])return n[a].exports;var i=n[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e['default']}:function(){return e};return t.d(n,'a',n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p='/dist/',t(t.s=25)}([function(e,t,n){'use strict';function a(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}function i(){var e=new Date().getTime(),t='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(t){var n=0|(e+16*Math.random())%16;return e=l(e/16),('x'==t?n:8|7&n).toString(16)});return t}function o(e){return!isNaN(parseFloat(e))&&isFinite(e)}function r(e,t,n,a,i){var o=a||0,s=i||t.length,l=parseInt(o+(s-o)/2),d;return(n||(n=function(e,t){return e>t?1:e<t?-1:e==t?0:void 0}),0>=s-o)?l:(d=n(t[l],e),1==s-o?0<=d?l:l+1:0===d?l:-1===d?r(e,t,n,l,s):r(e,t,n,o,l))}function d(e,t,n,a,i){var o=a||0,r=i||t.length,s=parseInt(o+(r-o)/2),l;return(n||(n=function(e,t){return e>t?1:e<t?-1:e==t?0:void 0}),0>=r-o)?-1:(l=n(t[s],e),1==r-o?0===l?s:-1:0===l?s:-1===l?d(e,t,n,s,r):d(e,t,n,o,s))}function u(e,t){for(var n=e.parentNode,a=n.childNodes,o=-1,r=0,i;r<a.length&&(i=a[r],i.nodeType===t&&o++,i!=e);r++);return o}function c(e,t){return new Blob([e],{type:t})}function p(e,t){return'undefined'==typeof e.querySelector?e.getElementsByTagName(t):e.querySelectorAll(t)}function g(e,t,n){for(var a=document.createTreeWalker(e,n,null,!1),i=void 0;i=a.nextNode();)t(i)}function h(e,t){if(t(e))return!0;if(e=e.firstChild,e)do{var n=h(e,t);if(n)return!0;e=e.nextSibling}while(e)}function m(e){for(var t=[e];e;e=e.parentNode)t.unshift(e);return t}Object.defineProperty(t,'__esModule',{value:!0});var f=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}();t.uuid=i,t.documentHeight=function(){return s(document.documentElement.clientHeight,document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight)},t.isElement=function(e){return!!(e&&1==e.nodeType)},t.isNumber=o,t.isFloat=function(e){var t=parseFloat(e);return!1!==o(e)&&('string'==typeof e&&-1<e.indexOf('.')||l(t)!==t)},t.prefixed=function(e){var t=['Webkit','webkit','Moz','O','ms'],n=['-webkit-','-webkit-','-moz-','-o-','-ms-'],a=e[0].toUpperCase()+e.slice(1),o=t.length;if('undefined'==typeof document||'undefined'!=typeof document.body.style[e])return e;for(var r=0;r<o;r++)if('undefined'!=typeof document.body.style[t[r]+a])return n[r]+e;return e},t.defaults=function(e){for(var t=1,n=arguments.length,a;t<n;t++)for(var i in a=arguments[t],a)void 0===e[i]&&(e[i]=a[i]);return e},t.extend=function(e){var t=[].slice.call(arguments,1);return t.forEach(function(t){t&&Object.getOwnPropertyNames(t).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}),e},t.insert=function(e,t,n){var a=r(e,t,n);return t.splice(a,0,e),a},t.locationOf=r,t.indexOfSorted=d,t.bounds=function(e){var t=window.getComputedStyle(e),n=0,a=0;return['width','paddingRight','paddingLeft','marginRight','marginLeft','borderRightWidth','borderLeftWidth'].forEach(function(e){n+=parseFloat(t[e])||0}),['height','paddingTop','paddingBottom','marginTop','marginBottom','borderTopWidth','borderBottomWidth'].forEach(function(e){a+=parseFloat(t[e])||0}),{height:a,width:n}},t.borders=function(e){var t=window.getComputedStyle(e),n=0,a=0;return['paddingRight','paddingLeft','marginRight','marginLeft','borderRightWidth','borderLeftWidth'].forEach(function(e){n+=parseFloat(t[e])||0}),['paddingTop','paddingBottom','marginTop','marginBottom','borderTopWidth','borderBottomWidth'].forEach(function(e){a+=parseFloat(t[e])||0}),{height:a,width:n}},t.nodeBounds=function(e){var t=void 0,n=e.ownerDocument;if(e.nodeType==Node.TEXT_NODE){var a=n.createRange();a.selectNodeContents(e),t=a.getBoundingClientRect()}else t=e.getBoundingClientRect();return t},t.windowBounds=function(){var e=window.innerWidth,t=window.innerHeight;return{top:0,left:0,right:e,bottom:t,width:e,height:t}},t.indexOfNode=u,t.indexOfTextNode=function(e){return u(e,b)},t.indexOfElementNode=function(e){return u(e,v)},t.isXml=function(e){return-1<['xml','opf','ncx'].indexOf(e)},t.createBlob=c,t.createBlobUrl=function(e,t){var n=c(e,t),a;return a=k.createObjectURL(n),a},t.revokeBlobUrl=function(e){return k.revokeObjectURL(e)},t.createBase64Url=function(e,t){var n,a;if('string'==typeof e)return n=btoa(encodeURIComponent(e)),a='data:'+t+';base64,'+n,a},t.type=function(e){return Object.prototype.toString.call(e).slice(8,-1)},t.parse=function(e,t,a){var i,o;return o='undefined'==typeof DOMParser||a?n(42).DOMParser:DOMParser,65279===e.charCodeAt(0)&&(e=e.slice(1)),i=new o().parseFromString(e,t),i},t.qs=function(e,t){var n;if(!e)throw new Error('No Element Provided');return'undefined'==typeof e.querySelector?(n=e.getElementsByTagName(t),n.length)?n[0]:void 0:e.querySelector(t)},t.qsa=p,t.qsp=function(e,t,n){var a,i;if('undefined'!=typeof e.querySelector){for(var o in t+='[',n)t+=o+'~=\''+n[o]+'\'';return t+=']',e.querySelector(t)}return(a=e.getElementsByTagName(t),i=Array.prototype.slice.call(a,0).filter(function(e){for(var t in n)if(e.getAttribute(t)===n[t])return!0;return!1}),i)?i[0]:void 0},t.sprint=function(e,t){var n=e.ownerDocument||e;'undefined'==typeof n.createTreeWalker?h(e,function(e){e&&3===e.nodeType&&t(e)},!0):g(e,t,NodeFilter.SHOW_TEXT)},t.treeWalker=g,t.walk=h,t.blob2base64=function(e){return new Promise(function(t){var n=new FileReader;n.readAsDataURL(e),n.onloadend=function(){t(n.result)}})},t.defer=function(){var e=this;this.resolve=null,this.reject=null,this.id=i(),this.promise=new Promise(function(t,n){e.resolve=t,e.reject=n}),Object.freeze(this)},t.querySelectorByType=function(e,t,n){var a;if('undefined'!=typeof e.querySelector&&(a=e.querySelector(t+'[*|type="'+n+'"]')),!a||0===a.length){a=p(e,t);for(var o=0;o<a.length;o++)if(a[o].getAttributeNS('http://www.idpf.org/2007/ops','type')===n||a[o].getAttribute('epub:type')===n)return a[o]}else return a},t.findChildren=function(e){for(var t=[],n=e.childNodes,a=0,i;a<n.length;a++)i=n[a],1===i.nodeType&&t.push(i);return t},t.parents=m,t.filterChildren=function(e,t,n){for(var a=[],o=e.childNodes,r=0,i;r<o.length;r++)if(i=o[r],1===i.nodeType&&i.nodeName.toLowerCase()===t){if(n)return i;a.push(i)}if(!n)return a},t.getParentByTagName=function(e,t){var n;if(null!==e&&''!==t)for(n=e.parentNode;1===n.nodeType;){if(n.tagName.toLowerCase()===t)return n;n=n.parentNode}};var y=t.requestAnimationFrame='undefined'!=typeof window&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame),v=1,b=3,k='undefined'==typeof URL?'undefined'==typeof window?void 0:window.URL||window.webkitURL||window.mozURL:URL,x=t.RangeObject=function(){function e(){a(this,e),this.collapsed=!1,this.commonAncestorContainer=void 0,this.endContainer=void 0,this.endOffset=void 0,this.startContainer=void 0,this.startOffset=void 0}return f(e,[{key:'setStart',value:function(e,t){this.startContainer=e,this.startOffset=t,this.endContainer?this.commonAncestorContainer=this._commonAncestorContainer():this.collapse(!0),this._checkCollapsed()}},{key:'setEnd',value:function(e,t){this.endContainer=e,this.endOffset=t,this.startContainer?(this.collapsed=!1,this.commonAncestorContainer=this._commonAncestorContainer()):this.collapse(!1),this._checkCollapsed()}},{key:'collapse',value:function(e){this.collapsed=!0,e?(this.endContainer=this.startContainer,this.endOffset=this.startOffset,this.commonAncestorContainer=this.startContainer.parentNode):(this.startContainer=this.endContainer,this.startOffset=this.endOffset,this.commonAncestorContainer=this.endOffset.parentNode)}},{key:'selectNode',value:function(e){var t=e.parentNode,n=Array.prototype.indexOf.call(t.childNodes,e);this.setStart(t,n),this.setEnd(t,n+1)}},{key:'selectNodeContents',value:function(e){var t=e.childNodes[e.childNodes-1],n=3===e.nodeType?e.textContent.length:parent.childNodes.length;this.setStart(e,0),this.setEnd(e,n)}},{key:'_commonAncestorContainer',value:function(e,t){var n=m(e||this.startContainer),a=m(t||this.endContainer);if(n[0]==a[0])for(var o=0;o<n.length;o++)if(n[o]!=a[o])return n[o-1]}},{key:'_checkCollapsed',value:function(){this.collapsed=this.startContainer===this.endContainer&&this.startOffset===this.endOffset}},{key:'toString',value:function(){}}]),e}()},function(e,t,n){'use strict';function a(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var o='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&'function'==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?'symbol':typeof e},i=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),r=n(0),s=1,l=3,d=function(){function e(t,n,i){a(this,e);var s;if(this.str='',this.base={},this.spinePos=0,this.range=!1,this.path={},this.start=null,this.end=null,!(this instanceof e))return new e(t,n,i);if('string'==typeof n?this.base=this.parseComponent(n):'object'===('undefined'==typeof n?'undefined':o(n))&&n.steps&&(this.base=n),s=this.checkType(t),'string'===s)return this.str=t,(0,r.extend)(this,this.parse(t));if('range'===s)return(0,r.extend)(this,this.fromRange(t,this.base,i));if('node'===s)return(0,r.extend)(this,this.fromNode(t,this.base,i));if('EpubCFI'===s&&t.path)return t;if(!t)return this;throw new TypeError('not a valid argument for EpubCFI')}return i(e,[{key:'checkType',value:function(t){return this.isCfiString(t)?'string':t&&'object'===('undefined'==typeof t?'undefined':o(t))&&('Range'===(0,r.type)(t)||'undefined'!=typeof t.startContainer)?'range':t&&'object'===('undefined'==typeof t?'undefined':o(t))&&'undefined'!=typeof t.nodeType?'node':t&&'object'===('undefined'==typeof t?'undefined':o(t))&&t instanceof e&&'EpubCFI'}},{key:'parse',value:function(e){var t={spinePos:-1,range:!1,base:{},path:{},start:null,end:null},n,a,i;return'string'==typeof e?(0===e.indexOf('epubcfi(')&&')'===e[e.length-1]&&(e=e.slice(8,e.length-1)),n=this.getChapterComponent(e),!n)?{spinePos:-1}:(t.base=this.parseComponent(n),a=this.getPathComponent(e),t.path=this.parseComponent(a),i=this.getRange(e),i&&(t.range=!0,t.start=this.parseComponent(i[0]),t.end=this.parseComponent(i[1])),t.spinePos=t.base.steps[1].index,t):{spinePos:-1}}},{key:'parseComponent',value:function(e){var t={steps:[],terminal:{offset:null,assertion:null}},n=e.split(':'),a=n[0].split('/'),i;return 1<n.length&&(i=n[1],t.terminal=this.parseTerminal(i)),''===a[0]&&a.shift(),t.steps=a.map(function(e){return this.parseStep(e)}.bind(this)),t}},{key:'parseStep',value:function(e){var t,n,a,i,o;if(i=e.match(/\[(.*)\]/),i&&i[1]&&(o=i[1]),n=parseInt(e),!isNaN(n))return 0==n%2?(t='element',a=n/2-1):(t='text',a=(n-1)/2),{type:t,index:a,id:o||null}}},{key:'parseTerminal',value:function(e){var t=e.match(/\[(.*)\]/),n,a;return t&&t[1]?(n=parseInt(e.split('[')[0]),a=t[1]):n=parseInt(e),(0,r.isNumber)(n)||(n=null),{offset:n,assertion:a}}},{key:'getChapterComponent',value:function(e){var t=e.split('!');return t[0]}},{key:'getPathComponent',value:function(e){var t=e.split('!');if(t[1]){var n=t[1].split(',');return n[0]}}},{key:'getRange',value:function(e){var t=e.split(',');return 3===t.length&&[t[1],t[2]]}},{key:'getCharecterOffsetComponent',value:function(e){var t=e.split(':');return t[1]||''}},{key:'joinSteps',value:function(e){return e?e.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('/'):''}},{key:'segmentString',value:function(e){var t='/';return t+=this.joinSteps(e.steps),e.terminal&&null!=e.terminal.offset&&(t+=':'+e.terminal.offset),e.terminal&&null!=e.terminal.assertion&&(t+='['+e.terminal.assertion+']'),t}},{key:'toString',value:function(){var e='epubcfi(';return e+=this.segmentString(this.base),e+='!',e+=this.segmentString(this.path),this.range&&this.start&&(e+=',',e+=this.segmentString(this.start)),this.range&&this.end&&(e+=',',e+=this.segmentString(this.end)),e+=')',e}},{key:'compare',value:function(t,n){var a,o,r,s,l,l;if('string'==typeof t&&(t=new e(t)),'string'==typeof n&&(n=new e(n)),t.spinePos>n.spinePos)return 1;if(t.spinePos<n.spinePos)return-1;t.range?(a=t.path.steps.concat(t.start.steps),r=t.start.terminal):(a=t.path.steps,r=t.path.terminal),n.range?(o=n.path.steps.concat(n.start.steps),s=n.start.terminal):(o=n.path.steps,s=n.path.terminal);for(var d=0;d<a.length;d++){if(!a[d])return-1;if(!o[d])return 1;if(a[d].index>o[d].index)return 1;if(a[d].index<o[d].index)return-1}return a.length<o.length?1:r.offset>s.offset?1:r.offset<s.offset?-1:0}},{key:'step',value:function(e){var t=e.nodeType===l?'text':'element';return{id:e.id,tagName:e.tagName,type:t,index:this.position(e)}}},{key:'filteredStep',value:function(e,t){var n=this.filter(e,t),a;if(n)return a=n.nodeType===l?'text':'element',{id:n.id,tagName:n.tagName,type:a,index:this.filteredPosition(n,t)}}},{key:'pathTo',value:function(e,t,n){for(var a={steps:[],terminal:{offset:null,assertion:null}},i=e,o;i&&i.parentNode&&i.parentNode.nodeType!=9;)o=n?this.filteredStep(i,n):this.step(i),o&&a.steps.unshift(o),i=i.parentNode;return null!=t&&0<=t&&(a.terminal.offset=t,'text'!=a.steps[a.steps.length-1].type&&a.steps.push({type:'text',index:0})),a}},{key:'equalStep',value:function(e,t){return e&&t&&e.index===t.index&&e.id===t.id&&e.type===t.type}},{key:'fromRange',value:function(e,t,n){var a={range:!1,base:{},path:{},start:null,end:null},r=e.startContainer,s=e.endContainer,l=e.startOffset,d=e.endOffset,u=!1;if(n&&(u=null!=r.ownerDocument.querySelector('.'+n)),'string'==typeof t?(a.base=this.parseComponent(t),a.spinePos=a.base.steps[1].index):'object'===('undefined'==typeof t?'undefined':o(t))&&(a.base=t),e.collapsed)u&&(l=this.patchOffset(r,l,n)),a.path=this.pathTo(r,l,n);else{a.range=!0,u&&(l=this.patchOffset(r,l,n)),a.start=this.pathTo(r,l,n),u&&(d=this.patchOffset(s,d,n)),a.end=this.pathTo(s,d,n),a.path={steps:[],terminal:null};var c=a.start.steps.length,p;for(p=0;p<c&&this.equalStep(a.start.steps[p],a.end.steps[p]);p++)p===c-1?a.start.terminal===a.end.terminal&&(a.path.steps.push(a.start.steps[p]),a.range=!1):a.path.steps.push(a.start.steps[p]);a.start.steps=a.start.steps.slice(a.path.steps.length),a.end.steps=a.end.steps.slice(a.path.steps.length)}return a}},{key:'fromNode',value:function(e,t,n){var a={range:!1,base:{},path:{},start:null,end:null};return'string'==typeof t?(a.base=this.parseComponent(t),a.spinePos=a.base.steps[1].index):'object'===('undefined'==typeof t?'undefined':o(t))&&(a.base=t),a.path=this.pathTo(e,null,n),a}},{key:'filter',value:function(e,t){var n=!1,a,i,o,r,s;return e.nodeType===l?(n=!0,o=e.parentNode,a=e.parentNode.classList.contains(t)):(n=!1,a=e.classList.contains(t)),a&&n?(r=o.previousSibling,s=o.nextSibling,r&&r.nodeType===l?i=r:s&&s.nodeType===l&&(i=s),i?i:e):a&&!n?!1:e}},{key:'patchOffset',value:function(e,t,n){if(e.nodeType!=l)throw new Error('Anchor must be a text node');var a=e,i=t;for(e.parentNode.classList.contains(n)&&(a=e.parentNode);a.previousSibling;){if(a.previousSibling.nodeType!==s)i+=a.previousSibling.textContent.length;else if(a.previousSibling.classList.contains(n))i+=a.previousSibling.textContent.length;else break;a=a.previousSibling}return i}},{key:'normalizedMap',value:function(e,t,n){var a={},o=-1,r=e.length,d,i,u;for(d=0;d<r;d++)i=e[d].nodeType,i===s&&e[d].classList.contains(n)&&(i=l),0<d&&i===l&&u===l?a[d]=o:t===i&&(++o,a[d]=o),u=i;return a}},{key:'position',value:function(e){var t,n;return e.nodeType===s?(t=e.parentNode.children,!t&&(t=(0,r.findChildren)(e.parentNode)),n=Array.prototype.indexOf.call(t,e)):(t=this.textNodes(e.parentNode),n=t.indexOf(e)),n}},{key:'filteredPosition',value:function(e,t){var n,a,i;return e.nodeType===s?(n=e.parentNode.children,i=this.normalizedMap(n,s,t)):(n=e.parentNode.childNodes,e.parentNode.classList.contains(t)&&(e=e.parentNode,n=e.parentNode.childNodes),i=this.normalizedMap(n,l,t)),a=Array.prototype.indexOf.call(n,e),i[a]}},{key:'stepsToXpath',value:function(e){var t=['.','*'];return e.forEach(function(e){var n=e.index+1;e.id?t.push('*[position()='+n+' and @id=\''+e.id+'\']'):'text'===e.type?t.push('text()['+n+']'):t.push('*['+n+']')}),t.join('/')}},{key:'stepsToQuerySelector',value:function(e){var t=['html'];return e.forEach(function(e){var n=e.index+1;e.id?t.push('#'+e.id):'text'===e.type||t.push('*:nth-child('+n+')')}),t.join('>')}},{key:'textNodes',value:function(e,t){return Array.prototype.slice.call(e.childNodes).filter(function(e){return e.nodeType===l||t&&e.classList.contains(t)})}},{key:'walkToNode',value:function(e,t,n){var a=t||document,o=a.documentElement,s=e.length,l,d,u;for(u=0;u<s&&(d=e[u],'element'===d.type?d.id?o=a.getElementById(d.id):(l=o.children||(0,r.findChildren)(o),o=l[d.index]):'text'===d.type&&(o=this.textNodes(o,n)[d.index]),!!o);u++);return o}},{key:'findNode',value:function(e,t,n){var a=t||document,i,o;return n||'undefined'==typeof a.evaluate?n?i=this.walkToNode(e,a,n):i=this.walkToNode(e,a):(o=this.stepsToXpath(e),i=a.evaluate(o,a,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue),i}},{key:'fixMiss',value:function(e,t,n,a){var i=this.findNode(e.slice(0,-1),n,a),o=i.childNodes,r=this.normalizedMap(o,l,a),d=e[e.length-1].index,u,c;for(var p in r){if(!r.hasOwnProperty(p))return;if(r[p]===d)if(u=o[p],c=u.textContent.length,t>c)t-=c;else{i=u.nodeType===s?u.childNodes[0]:u;break}}return{container:i,offset:t}}},{key:'toRange',value:function(e,t){var n=e||document,a=this,i=!!t&&null!=n.querySelector('.'+t),o,s,l,d,u,c,p,g;if(o='undefined'==typeof n.createRange?new r.RangeObject:n.createRange(),a.range?(s=a.start,c=a.path.steps.concat(s.steps),d=this.findNode(c,n,i?t:null),l=a.end,p=a.path.steps.concat(l.steps),u=this.findNode(p,n,i?t:null)):(s=a.path,c=a.path.steps,d=this.findNode(a.path.steps,n,i?t:null)),d)try{null==s.terminal.offset?o.setStart(d,0):o.setStart(d,s.terminal.offset)}catch(a){g=this.fixMiss(c,s.terminal.offset,n,i?t:null),o.setStart(g.container,g.offset)}else return console.log('No startContainer found for',this.toString()),null;if(u)try{null==l.terminal.offset?o.setEnd(u,0):o.setEnd(u,l.terminal.offset)}catch(r){g=this.fixMiss(p,a.end.terminal.offset,n,i?t:null),o.setEnd(g.container,g.offset)}return o}},{key:'isCfiString',value:function(e){return'string'==typeof e&&0===e.indexOf('epubcfi(')&&')'===e[e.length-1]}},{key:'generateChapterComponent',value:function(e,t,n){var a=parseInt(t),i='/'+2*(e+1)+'/';return i+=2*(a+1),n&&(i+='['+n+']'),i}},{key:'collapse',value:function(e){this.range&&(this.range=!1,e?(this.path.steps=this.path.steps.concat(this.start.steps),this.path.terminal=this.start.terminal):(this.path.steps=this.path.steps.concat(this.end.steps),this.path.terminal=this.end.terminal))}}]),e}();t.default=d,e.exports=t['default']},function(e,t){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var n=t.EPUBJS_VERSION='0.3',a=t.DOM_EVENTS=['keydown','keyup','keypressed','mouseup','mousedown','click','touchend','touchstart','touchmove'],i=t.EVENTS={BOOK:{OPEN_FAILED:'openFailed'},CONTENTS:{EXPAND:'expand',RESIZE:'resize',SELECTED:'selected',SELECTED_RANGE:'selectedRange',LINK_CLICKED:'linkClicked'},LOCATIONS:{CHANGED:'changed'},MANAGERS:{RESIZE:'resize',RESIZED:'resized',ORIENTATION_CHANGE:'orientationchange',ADDED:'added',SCROLL:'scroll',SCROLLED:'scrolled',REMOVED:'removed'},VIEWS:{AXIS:'axis',LOAD_ERROR:'loaderror',RENDERED:'rendered',RESIZED:'resized',DISPLAYED:'displayed',SHOWN:'shown',HIDDEN:'hidden',MARK_CLICKED:'markClicked'},RENDITION:{STARTED:'started',ATTACHED:'attached',DISPLAYED:'displayed',DISPLAY_ERROR:'displayerror',RENDERED:'rendered',REMOVED:'removed',RESIZED:'resized',ORIENTATION_CHANGE:'orientationchange',LOCATION_CHANGED:'locationChanged',RELOCATED:'relocated',MARK_CLICKED:'markClicked',SELECTED:'selected',LAYOUT:'layout'},LAYOUT:{UPDATED:'updated'},ANNOTATION:{ATTACH:'attach',DETACH:'detach'}}},function(e,t,n){'use strict';var a=n(27),o=n(41),r=Function.prototype.apply,s=Function.prototype.call,i=Object.create,l=Object.defineProperty,d=Object.defineProperties,u=Object.prototype.hasOwnProperty,c={configurable:!0,enumerable:!1,writable:!0},p,g,h,m,f,y,v;p=function(e,t){var n;return o(t),u.call(this,'__ee__')?n=this.__ee__:(n=c.value=i(null),l(this,'__ee__',c),c.value=null),n[e]?'object'==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},g=function(e,t){var n,a;return o(t),a=this,p.call(this,e,n=function(){h.call(a,e,n),r.call(t,this,arguments)}),n.__eeOnceListener__=t,this},h=function(e,t){var n,a,r,s;if(o(t),!u.call(this,'__ee__'))return this;if(n=this.__ee__,!n[e])return this;if(a=n[e],'object'==typeof a)for(s=0;r=a[s];++s)(r===t||r.__eeOnceListener__===t)&&(2===a.length?n[e]=a[s?0:1]:a.splice(s,1));else(a===t||a.__eeOnceListener__===t)&&delete n[e];return this},m=function(e){var t,n,a,i,o;if(u.call(this,'__ee__')&&(i=this.__ee__[e],!!i))if('object'==typeof i){for(n=arguments.length,o=Array(n-1),t=1;t<n;++t)o[t-1]=arguments[t];for(i=i.slice(),t=0;a=i[t];++t)r.call(a,this,o)}else switch(arguments.length){case 1:s.call(i,this);break;case 2:s.call(i,this,arguments[1]);break;case 3:s.call(i,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,o=Array(n-1),t=1;t<n;++t)o[t-1]=arguments[t];r.call(i,this,o);}},f={on:p,once:g,off:h,emit:m},y={on:a(p),once:a(g),off:a(h),emit:a(m)},v=d({},y),e.exports=t=function(e){return null==e?i(v):d(Object(e),y)},t.methods=f},function(e,t,n){'use strict';function a(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var i=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),o=n(7),r=function(e){return e&&e.__esModule?e:{default:e}}(o),s=function(){function e(t){a(this,e);var n,i;n=t.indexOf('://'),-1<n&&(t=new URL(t).pathname),i=this.parse(t),this.path=t,this.directory=this.isDirectory(t)?t:i.dir+'/',this.filename=i.base,this.extension=i.ext.slice(1)}return i(e,[{key:'parse',value:function(e){return r.default.parse(e)}},{key:'isAbsolute',value:function(e){return r.default.isAbsolute(e||this.path)}},{key:'isDirectory',value:function(e){return'/'===e.charAt(e.length-1)}},{key:'resolve',value:function(e){return r.default.resolve(this.directory,e)}},{key:'relative',value:function(e){var t=e&&-1<e.indexOf('://');return t?e:r.default.relative(this.directory,e)}},{key:'splitPath',value:function(e){return this.splitPathRe.exec(e).slice(1)}},{key:'toString',value:function(){return this.path}}]),e}();t.default=s,e.exports=t['default']},function(e){var t=function(){return this}();try{t=t||Function('return this')()||(1,eval)('this')}catch(n){'object'==typeof window&&(t=window)}e.exports=t},function(e,t,n){'use strict';function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var o=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),r=n(4),s=a(r),l=n(7),d=a(l),u=function(){function e(t,n){i(this,e);var a=-1<t.indexOf('://'),o=t,r;if(this.Url=void 0,this.href=t,this.protocol='',this.origin='',this.hash='',this.hash='',this.search='',this.base=n,!a&&!1!==n&&'string'!=typeof n&&window&&window.location&&(this.base=window.location.href),a||this.base)try{this.Url=this.base?new URL(t,this.base):new URL(t),this.href=this.Url.href,this.protocol=this.Url.protocol,this.origin=this.Url.origin,this.hash=this.Url.hash,this.search=this.Url.search,o=this.Url.pathname}catch(t){this.Url=void 0,this.base&&(r=new s.default(this.base),o=r.resolve(o))}this.Path=new s.default(o),this.directory=this.Path.directory,this.filename=this.Path.filename,this.extension=this.Path.extension}return o(e,[{key:'path',value:function(){return this.Path}},{key:'resolve',value:function(e){var t=-1<e.indexOf('://'),n;return t?e:(n=d.default.resolve(this.directory,e),this.origin+n)}},{key:'relative',value:function(e){return d.default.relative(e,this.directory)}},{key:'toString',value:function(){return this.href}}]),e}();t.default=u,e.exports=t['default']},function(e){'use strict';function t(e){if('string'!=typeof e)throw new TypeError('Path must be a string. Received '+e)}function n(e,t){for(var n='',a=-1,o=0,r=0,i;r<=e.length;++r){if(r<e.length)i=e.charCodeAt(r);else if(47===i)break;else i=47;if(47===i){if(a==r-1||1==o);else if(a!=r-1&&2==o){if(2>n.length||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(2<n.length){for(var s=n.length-1,l=s;0<=l&&47!==n.charCodeAt(l);--l);if(l!=s){n=-1==l?'':n.slice(0,l),a=r,o=0;continue}}else if(2===n.length||1===n.length){n='',a=r,o=0;continue}t&&(0<n.length?n+='/..':n='..')}else 0<n.length?n+='/'+e.slice(a+1,r):n=e.slice(a+1,r);a=r,o=0}else 46===i&&-1!=o?++o:o=-1}return n}function a(e,t){var n=t.dir||t.root,a=t.base||(t.name||'')+(t.ext||'');return n?n===t.root?n+a:n+e+a:a}if(!o)var o={cwd:function(){return'/'}};var r={resolve:function(){for(var e='',a=!1,r=arguments.length-1,i;-1<=r&&!a;r--){var s;(0<=r?s=arguments[r]:(void 0==i&&(i=o.cwd()),s=i),t(s),0!==s.length)&&(e=s+'/'+e,a=47===s.charCodeAt(0))}return e=n(e,!a),a?0<e.length?'/'+e:'/':0<e.length?e:'.'},normalize:function(e){if(t(e),0===e.length)return'.';var a=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return e=n(e,!a),0!==e.length||a||(e='.'),0<e.length&&i&&(e+='/'),a?'/'+e:e},isAbsolute:function(e){return t(e),0<e.length&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return'.';for(var e=0,n,a;e<arguments.length;++e)a=arguments[e],t(a),0<a.length&&(void 0==n?n=a:n+='/'+a);return void 0===n?'.':r.normalize(n)},relative:function(e,n){if(t(e),t(n),e===n)return'';if(e=r.resolve(e),n=r.resolve(n),e===n)return'';for(var a=1;a<e.length&&47===e.charCodeAt(a);++a);for(var o=e.length,s=o-a,l=1;l<n.length&&47===n.charCodeAt(l);++l);for(var d=n.length,u=d-l,c=s<u?s:u,p=-1,g=0;g<=c;++g){if(g==c){if(u>c){if(47===n.charCodeAt(l+g))return n.slice(l+g+1);if(0==g)return n.slice(l+g)}else s>c&&(47===e.charCodeAt(a+g)?p=g:0==g&&(p=0));break}var i=e.charCodeAt(a+g),h=n.charCodeAt(l+g);if(i!==h)break;else 47===i&&(p=g)}var m='';for(g=a+p+1;g<=o;++g)(g===o||47===e.charCodeAt(g))&&(m+=0===m.length?'..':'/..');return 0<m.length?m+n.slice(l+p):(l+=p,47===n.charCodeAt(l)&&++l,n.slice(l))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return'.';for(var n=e.charCodeAt(0),a=47===n,o=-1,r=!0,s=e.length-1;1<=s;--s)if(n=e.charCodeAt(s),47!==n)r=!1;else if(!r){o=s;break}return-1===o?a?'/':'.':a&&1===o?'//':e.slice(0,o)},basename:function(e,n){if(n!==void 0&&'string'!=typeof n)throw new TypeError('"ext" argument must be a string');t(e);var a=0,o=-1,r=!0,s;if(void 0!==n&&0<n.length&&n.length<=e.length){if(n.length===e.length&&n===e)return'';var i=n.length-1,l=-1;for(s=e.length-1;0<=s;--s){var d=e.charCodeAt(s);if(47!==d)-1==l&&(r=!1,l=s+1),0<=i&&(d===n.charCodeAt(i)?-1==--i&&(o=s):(i=-1,o=l));else if(!r){a=s+1;break}}return a===o?o=l:-1===o&&(o=e.length),e.slice(a,o)}for(s=e.length-1;0<=s;--s)if(47!==e.charCodeAt(s))-1==o&&(r=!1,o=s+1);else if(!r){a=s+1;break}return-1===o?'':e.slice(a,o)},extname:function(e){t(e);for(var n=-1,a=0,o=-1,r=!0,s=0,l=e.length-1,i;0<=l;--l){if(i=e.charCodeAt(l),47===i){if(!r){a=l+1;break}continue}-1==o&&(r=!1,o=l+1),46===i?-1==n?n=l:1!=s&&(s=1):-1!==n&&(s=-1)}return-1===n||-1===o||0==s||1==s&&n===o-1&&n===a+1?'':e.slice(n,o)},format:function(e){if(null===e||'object'!=typeof e)throw new TypeError('Parameter "pathObject" must be an object, not '+typeof e);return a('/',e)},parse:function(e){t(e);var n={root:'',dir:'',base:'',ext:'',name:''};if(0===e.length)return n;var a=e.charCodeAt(0),o=47===a,r;o?(n.root='/',r=1):r=0;for(var s=-1,l=0,d=-1,u=!0,c=e.length-1,i=0;c>=r;--c){if(a=e.charCodeAt(c),47===a){if(!u){l=c+1;break}continue}-1==d&&(u=!1,d=c+1),46===a?-1==s?s=c:1!=i&&(i=1):-1!=s&&(i=-1)}return-1==s||-1==d||0==i||1==i&&s==d-1&&s==l+1?-1!=d&&(0==l&&o?n.base=n.name=e.slice(1,d):n.base=n.name=e.slice(l,d)):(0==l&&o?(n.name=e.slice(1,s),n.base=e.slice(1,d)):(n.name=e.slice(l,s),n.base=e.slice(l,d)),n.ext=e.slice(s,d)),0<l?n.dir=e.slice(0,l-1):o&&(n.dir='/'),n},sep:'/',delimiter:':',posix:null};e.exports=r},function(e,t,n){'use strict';function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,'__esModule',{value:!0}),t.replaceBase=function(e,t){var n=t.url,a=-1<n.indexOf('://'),i,r;e&&(r=(0,o.qs)(e,'head'),i=(0,o.qs)(r,'base'),!i&&(i=e.createElement('base'),r.insertBefore(i,r.firstChild)),!a&&window&&window.location&&(n=window.location.origin+n),i.setAttribute('href',n))},t.replaceCanonical=function(e,t){var n=t.canonical,a,i;e&&(a=(0,o.qs)(e,'head'),i=(0,o.qs)(a,'link[rel=\'canonical\']'),i?i.setAttribute('href',n):(i=e.createElement('link'),i.setAttribute('rel','canonical'),i.setAttribute('href',n),a.appendChild(i)))},t.replaceMeta=function(e,t){var n=t.idref,a,i;e&&(a=(0,o.qs)(e,'head'),i=(0,o.qs)(a,'link[property=\'dc.identifier\']'),i?i.setAttribute('content',n):(i=e.createElement('meta'),i.setAttribute('name','dc.identifier'),i.setAttribute('content',n),a.appendChild(i)))},t.replaceLinks=function(e,t){var n=e.querySelectorAll('a[href]');if(n.length)for(var a=(0,o.qs)(e.ownerDocument,'base'),s=a?a.getAttribute('href'):void 0,l=function(e){var n=e.getAttribute('href');if(0!==n.indexOf('mailto:')){var a=-1<n.indexOf('://');if(a)e.setAttribute('target','_blank');else{var i;try{i=new r.default(n,s)}catch(e){}e.onclick=function(){return i&&i.hash?t(i.Path.path+i.hash):i?t(i.Path.path):t(n),!1}}}}.bind(this),d=0;d<n.length;d++)l(n[d])},t.substitute=function(e,t,n){return t.forEach(function(t,a){t&&n[a]&&(e=e.replace(new RegExp(t,'g'),n[a]))}),e};var o=n(0),i=n(6),r=a(i),s=n(4),l=a(s)},function(e,t,n){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var a=n(0),i=n(4),o=function(e){return e&&e.__esModule?e:{default:e}}(i);t.default=function(e,t,n,i){function r(t){u.reject(t)}function s(){if(this.readyState===XMLHttpRequest.DONE){var e=!1;if((''===this.responseType||'document'===this.responseType)&&(e=this.responseXML),200===this.status||0===this.status||e){var n;if(!this.response&&!e)return u.reject({status:this.status,message:'Empty Response',stack:new Error().stack}),u.promise;if(403===this.status)return u.reject({status:this.status,response:this.response,message:'Forbidden',stack:new Error().stack}),u.promise;n=e?this.responseXML:(0,a.isXml)(t)?(0,a.parse)(this.response,'text/xml'):'xhtml'==t?(0,a.parse)(this.response,'application/xhtml+xml'):'html'==t||'htm'==t?(0,a.parse)(this.response,'text/html'):'json'==t?JSON.parse(this.response):'blob'==t?l?this.response:new Blob([this.response]):this.response,u.resolve(n)}else u.reject({status:this.status,message:this.response,stack:new Error().stack})}}var l='undefined'!=typeof window&&window.URL,d=l?'blob':'arraybuffer',u=new a.defer,c=new XMLHttpRequest,p=XMLHttpRequest.prototype,g;for(g in'overrideMimeType'in p||Object.defineProperty(p,'overrideMimeType',{value:function(){}}),n&&(c.withCredentials=!0),c.onreadystatechange=s,c.onerror=r,c.open('GET',e,!0),i)c.setRequestHeader(g,i[g]);return'json'==t&&c.setRequestHeader('Accept','application/json'),t||(t=new o.default(e).extension),'blob'==t&&(c.responseType=d),(0,a.isXml)(t)&&c.overrideMimeType('text/xml'),'xhtml'==t,'html'!=t&&'htm'!=t,'binary'==t&&(c.responseType='arraybuffer'),c.send(),u.promise},e.exports=t['default']},function(e,t,n){'use strict';var a=n(34)();e.exports=function(e){return e!==a&&null!==e}},function(e,t){'use strict';function n(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var a=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=function(){function e(t){n(this,e),this.context=t||this,this.hooks=[]}return a(e,[{key:'register',value:function(){for(var e=0;e<arguments.length;++e)if('function'==typeof arguments[e])this.hooks.push(arguments[e]);else for(var t=0;t<arguments[e].length;++t)this.hooks.push(arguments[e][t])}},{key:'deregister',value:function(e){for(var t=void 0,n=0;n<this.hooks.length;n++)if(t=this.hooks[n],t===e){this.hooks.splice(n,1);break}}},{key:'trigger',value:function(){var e=arguments,t=this.context,n=[];return this.hooks.forEach(function(a){var i=a.apply(t,e);i&&'function'==typeof i.then&&n.push(i)}),Promise.all(n)}},{key:'list',value:function(){return this.hooks}},{key:'clear',value:function(){return this.hooks=[]}}]),e}();t.default=i,e.exports=t['default']},function(e,t,n){'use strict';function a(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0}),t.Task=void 0;var i=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),o=n(0),r=function(){function e(t){a(this,e),this._q=[],this.context=t,this.tick=o.requestAnimationFrame,this.running=!1,this.paused=!1}return i(e,[{key:'enqueue',value:function(){var e=[].shift.call(arguments),t=arguments,n,a,i;if(!e)throw new Error('No Task Provided');return'function'==typeof e?(n=new o.defer,a=n.promise,i={task:e,args:t,deferred:n,promise:a}):i={promise:e},this._q.push(i),!1!=this.paused||this.running||this.run(),i.promise}},{key:'dequeue',value:function(){var e,t,n;if(this._q.length&&!this.paused){if(e=this._q.shift(),t=e.task,t)return n=t.apply(this.context,e.args),n&&'function'==typeof n.then?n.then(function(){e.deferred.resolve.apply(this.context,arguments)}.bind(this),function(){e.deferred.reject.apply(this.context,arguments)}.bind(this)):(e.deferred.resolve.apply(this.context,n),e.promise);if(e.promise)return e.promise}else return e=new o.defer,e.deferred.resolve(),e.promise}},{key:'dump',value:function(){for(;this._q.length;)this.dequeue()}},{key:'run',value:function(){var e=this;return this.running||(this.running=!0,this.defered=new o.defer),this.tick.call(window,function(){e._q.length?e.dequeue().then(function(){this.run()}.bind(e)):(e.defered.resolve(),e.running=void 0)}),!0==this.paused&&(this.paused=!1),this.defered.promise}},{key:'flush',value:function(){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}},{key:'clear',value:function(){this._q=[]}},{key:'length',value:function(){return this._q.length}},{key:'pause',value:function(){this.paused=!0}},{key:'stop',value:function(){this._q=[],this.running=!1,this.paused=!0}}]),e}();t.default=r,t.Task=function e(t,n,i){return a(this,e),function(){var e=this,n=arguments||[];return new Promise(function(a,o){n.push(function(e,t){!e&&t?o(t):a(e)}),t.apply(i||e,n)})}}},function(e){'use strict';var t={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'}},n=function(){var e={},n,a,i,o;for(n in t)if(t.hasOwnProperty(n))for(a in t[n])if(t[n].hasOwnProperty(a))if(i=t[n][a],'string'==typeof i)e[i]=n+'/'+a;else for(o=0;o<i.length;o++)e[i[o]]=n+'/'+a;return e}();e.exports={lookup:function(e){return e&&n[e.split('.').pop().toLowerCase()]||'text/plain'}}},function(e,t,n){'use strict';function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var o=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(3),l=a(s),d=n(0),u=n(1),c=a(u),p=n(19),g=a(p),h=n(8),m=n(2),f='undefined'!=typeof navigator,y=f&&/Chrome/.test(navigator.userAgent),v=f&&!y&&/AppleWebKit/.test(navigator.userAgent),b=function(){function e(t,n,a,o){i(this,e),this.epubcfi=new c.default,this.document=t,this.documentElement=this.document.documentElement,this.content=n||this.document.body,this.window=this.document.defaultView,this._size={width:0,height:0},this.sectionIndex=o||0,this.cfiBase=a||'',this.epubReadingSystem('epub.js',m.EPUBJS_VERSION),this.listeners()}return o(e,[{key:'width',value:function(e){var t=this.content;return e&&(0,d.isNumber)(e)&&(e+='px'),e&&(t.style.width=e),this.window.getComputedStyle(t).width}},{key:'height',value:function(e){var t=this.content;return e&&(0,d.isNumber)(e)&&(e+='px'),e&&(t.style.height=e),this.window.getComputedStyle(t).height}},{key:'contentWidth',value:function(e){var t=this.content||this.document.body;return e&&(0,d.isNumber)(e)&&(e+='px'),e&&(t.style.width=e),this.window.getComputedStyle(t).width}},{key:'contentHeight',value:function(e){var t=this.content||this.document.body;return e&&(0,d.isNumber)(e)&&(e+='px'),e&&(t.style.height=e),this.window.getComputedStyle(t).height}},{key:'textWidth',value:function(){var e=void 0,t=void 0,n=this.document.createRange(),a=this.content||this.document.body,i=(0,d.borders)(a);return n.selectNodeContents(a),e=n.getBoundingClientRect(),t=e.width,i&&i.width&&(t+=i.width),r(t)}},{key:'textHeight',value:function(){var e=void 0,t=void 0,n=this.document.createRange(),a=this.content||this.document.body,i=(0,d.borders)(a);return n.selectNodeContents(a),e=n.getBoundingClientRect(),t=e.height,t&&i.height&&(t+=i.height),t&&e.top&&(t+=e.top),r(t)}},{key:'scrollWidth',value:function(){var e=this.documentElement.scrollWidth;return e}},{key:'scrollHeight',value:function(){var e=this.documentElement.scrollHeight;return e}},{key:'overflow',value:function(e){return e&&(this.documentElement.style.overflow=e),this.window.getComputedStyle(this.documentElement).overflow}},{key:'overflowX',value:function(e){return e&&(this.documentElement.style.overflowX=e),this.window.getComputedStyle(this.documentElement).overflowX}},{key:'overflowY',value:function(e){return e&&(this.documentElement.style.overflowY=e),this.window.getComputedStyle(this.documentElement).overflowY}},{key:'css',value:function(e,t,n){var a=this.content||this.document.body;return t&&a.style.setProperty(e,t,n?'important':''),this.window.getComputedStyle(a)[e]}},{key:'viewport',value:function(e){var t=this.document.querySelector('meta[name=\'viewport\']'),n={width:void 0,height:void 0,scale:void 0,minimum:void 0,maximum:void 0,scalable:void 0},a=[],i={};if(t&&t.hasAttribute('content')){var o=t.getAttribute('content'),r=o.match(/width\s*=\s*([^,]*)/),s=o.match(/height\s*=\s*([^,]*)/),l=o.match(/initial-scale\s*=\s*([^,]*)/),u=o.match(/minimum-scale\s*=\s*([^,]*)/),c=o.match(/maximum-scale\s*=\s*([^,]*)/),p=o.match(/user-scalable\s*=\s*([^,]*)/);r&&r.length&&'undefined'!=typeof r[1]&&(n.width=r[1]),s&&s.length&&'undefined'!=typeof s[1]&&(n.height=s[1]),l&&l.length&&'undefined'!=typeof l[1]&&(n.scale=l[1]),u&&u.length&&'undefined'!=typeof u[1]&&(n.minimum=u[1]),c&&c.length&&'undefined'!=typeof c[1]&&(n.maximum=c[1]),p&&p.length&&'undefined'!=typeof p[1]&&(n.scalable=p[1])}return i=(0,d.defaults)(e||{},n),e&&(i.width&&a.push('width='+i.width),i.height&&a.push('height='+i.height),i.scale&&a.push('initial-scale='+i.scale),'no'===i.scalable?(a.push('minimum-scale='+i.scale),a.push('maximum-scale='+i.scale),a.push('user-scalable='+i.scalable)):(i.scalable&&a.push('user-scalable='+i.scalable),i.minimum&&a.push('minimum-scale='+i.minimum),i.maximum&&a.push('minimum-scale='+i.maximum)),!t&&(t=this.document.createElement('meta'),t.setAttribute('name','viewport'),this.document.querySelector('head').appendChild(t)),t.setAttribute('content',a.join(', ')),this.window.scrollTo(0,0)),i}},{key:'expand',value:function(){this.emit(m.EVENTS.CONTENTS.EXPAND)}},{key:'listeners',value:function(){this.imageLoadListeners(),this.mediaQueryListeners(),this.addEventListeners(),this.addSelectionListeners(),this.resizeListeners(),this.linksHandler()}},{key:'removeListeners',value:function(){this.removeEventListeners(),this.removeSelectionListeners(),clearTimeout(this.expanding)}},{key:'resizeCheck',value:function(){var e=this.textWidth(),t=this.textHeight();(e!=this._size.width||t!=this._size.height)&&(this._size={width:e,height:t},this.onResize&&this.onResize(this._size),this.emit(m.EVENTS.CONTENTS.RESIZE,this._size))}},{key:'resizeListeners',value:function(){clearTimeout(this.expanding),requestAnimationFrame(this.resizeCheck.bind(this)),this.expanding=setTimeout(this.resizeListeners.bind(this),350)}},{key:'transitionListeners',value:function(){var e=this.content;e.style.transitionProperty='font, font-size, font-size-adjust, font-stretch, font-variation-settings, font-weight, width, height',e.style.transitionDuration='0.001ms',e.style.transitionTimingFunction='linear',e.style.transitionDelay='0',this._resizeCheck=this.resizeCheck.bind(this),this.document.addEventListener('transitionend',this._resizeCheck)}},{key:'mediaQueryListeners',value:function(){for(var e=this.document.styleSheets,t=function(e){e.matches&&!this._expanding&&setTimeout(this.expand.bind(this),1)}.bind(this),n=0;n<e.length;n+=1){var a;try{a=e[n].cssRules}catch(t){return}if(!a)return;for(var i=0;i<a.length;i+=1)if(a[i].media){var o=this.window.matchMedia(a[i].media.mediaText);o.addListener(t)}}}},{key:'resizeObservers',value:function(){var e=this;this.observer=new MutationObserver(function(){e.resizeCheck()});this.observer.observe(this.document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})}},{key:'imageLoadListeners',value:function(){for(var e=this.document.querySelectorAll('img'),t=0,n;t<e.length;t++)n=e[t],'undefined'!=typeof n.naturalWidth&&0===n.naturalWidth&&(n.onload=this.expand.bind(this))}},{key:'fontLoadListeners',value:function(){this.document&&this.document.fonts&&this.document.fonts.ready.then(function(){this.resizeCheck()}.bind(this))}},{key:'root',value:function(){return this.document?this.document.documentElement:null}},{key:'locationOf',value:function(e,t){var n={left:0,top:0},a;if(!this.document)return n;if(this.epubcfi.isCfiString(e)){var i=new c.default(e).toRange(this.document,t);if(i)if(i.startContainer.nodeType===Node.ELEMENT_NODE)a=i.startContainer.getBoundingClientRect(),n.left=a.left,n.top=a.top;else if(v){var o=i.startContainer,r=new Range;try{o.nodeType===1?a=o.getBoundingClientRect():i.startOffset+2<o.length?(r.setStart(o,i.startOffset),r.setEnd(o,i.startOffset+2),a=r.getBoundingClientRect()):0<i.startOffset-2?(r.setStart(o,i.startOffset-2),r.setEnd(o,i.startOffset),a=r.getBoundingClientRect()):a=o.parentNode.getBoundingClientRect()}catch(t){console.error(t,t.stack)}}else a=i.getBoundingClientRect()}else if('string'==typeof e&&-1<e.indexOf('#')){var s=e.substring(e.indexOf('#')+1),l=this.document.getElementById(s);if(l)if(v){var d=new Range;d.selectNode(l),a=d.getBoundingClientRect()}else a=l.getBoundingClientRect()}return a&&(n.left=a.left,n.top=a.top),n}},{key:'addStylesheet',value:function(e){return new Promise(function(t){var n=!1,a;return this.document?(a=this.document.querySelector('link[href=\''+e+'\']'),a?void t(!0):void(a=this.document.createElement('link'),a.type='text/css',a.rel='stylesheet',a.href=e,a.onload=a.onreadystatechange=function(){n||this.readyState&&'complete'!=this.readyState||(n=!0,setTimeout(function(){t(!0)},1))},this.document.head.appendChild(a))):void t(!1)}.bind(this))}},{key:'addStylesheetRules',value:function(e){var t='epubjs-inserted-css',n,a;if(this.document&&e&&0!==e.length)if(n=this.document.getElementById('#'+t),n||(n=this.document.createElement('style'),n.id=t),this.document.head.appendChild(n),a=n.sheet,'[object Array]'===Object.prototype.toString.call(e))for(var o=0,i=e.length;o<i;o++){var r=1,s=e[o],l=e[o][0],d='';'[object Array]'===Object.prototype.toString.call(s[1][0])&&(s=s[1],r=0);for(var u=s.length,c;r<u;r++)c=s[r],d+=c[0]+':'+c[1]+(c[2]?' !important':'')+';\n';a.insertRule(l+'{'+d+'}',a.cssRules.length)}else{var p=Object.keys(e);p.forEach(function(t){var n=e[t];if(Array.isArray(n))n.forEach(function(e){var n=Object.keys(e),i=n.map(function(t){return t+':'+e[t]}).join(';');a.insertRule(t+'{'+i+'}',a.cssRules.length)});else{var i=Object.keys(n),o=i.map(function(e){return e+':'+n[e]}).join(';');a.insertRule(t+'{'+o+'}',a.cssRules.length)}})}}},{key:'addScript',value:function(e){return new Promise(function(t){var n=!1,a;return this.document?void(a=this.document.createElement('script'),a.type='text/javascript',a.async=!0,a.src=e,a.onload=a.onreadystatechange=function(){n||this.readyState&&'complete'!=this.readyState||(n=!0,setTimeout(function(){t(!0)},1))},this.document.head.appendChild(a)):void t(!1)}.bind(this))}},{key:'addClass',value:function(e){var t;this.document&&(t=this.content||this.document.body,t&&t.classList.add(e))}},{key:'removeClass',value:function(e){var t;this.document&&(t=this.content||this.document.body,t&&t.classList.remove(e))}},{key:'addEventListeners',value:function(){this.document&&(this._triggerEvent=this.triggerEvent.bind(this),m.DOM_EVENTS.forEach(function(e){this.document.addEventListener(e,this._triggerEvent,{passive:!0})},this))}},{key:'removeEventListeners',value:function(){this.document&&(m.DOM_EVENTS.forEach(function(e){this.document.removeEventListener(e,this._triggerEvent,{passive:!0})},this),this._triggerEvent=void 0)}},{key:'triggerEvent',value:function(t){this.emit(t.type,t)}},{key:'addSelectionListeners',value:function(){this.document&&(this._onSelectionChange=this.onSelectionChange.bind(this),this.document.addEventListener('selectionchange',this._onSelectionChange,{passive:!0}))}},{key:'removeSelectionListeners',value:function(){this.document&&(this.document.removeEventListener('selectionchange',this._onSelectionChange,{passive:!0}),this._onSelectionChange=void 0)}},{key:'onSelectionChange',value:function(){this.selectionEndTimeout&&clearTimeout(this.selectionEndTimeout),this.selectionEndTimeout=setTimeout(function(){var e=this.window.getSelection();this.triggerSelectedEvent(e)}.bind(this),250)}},{key:'triggerSelectedEvent',value:function(e){var t,n;e&&0<e.rangeCount&&(t=e.getRangeAt(0),!t.collapsed&&(n=new c.default(t,this.cfiBase).toString(),this.emit(m.EVENTS.CONTENTS.SELECTED,n),this.emit(m.EVENTS.CONTENTS.SELECTED_RANGE,t)))}},{key:'range',value:function(e,t){var n=new c.default(e);return n.toRange(this.document,t)}},{key:'cfiFromRange',value:function(e,t){return new c.default(e,this.cfiBase,t).toString()}},{key:'cfiFromNode',value:function(e,t){return new c.default(e,this.cfiBase,t).toString()}},{key:'map',value:function(e){var t=new g.default(e);return t.section()}},{key:'size',value:function(e,t){var n={scale:1,scalable:'no'};this.layoutStyle('scrolling'),0<=e&&(this.width(e),n.width=e,this.css('padding','0 '+e/12+'px')),0<=t&&(this.height(t),n.height=t),this.css('margin','0'),this.css('box-sizing','border-box'),this.viewport(n)}},{key:'columns',value:function(e,t,n,a){var i=(0,d.prefixed)('column-axis'),o=(0,d.prefixed)('column-gap'),r=(0,d.prefixed)('column-width'),s=(0,d.prefixed)('column-fill'),l=this.writingMode(),u=0===l.indexOf('vertical')?'vertical':'horizontal';this.layoutStyle('paginated'),'rtl'===this.content.dir&&this.direction('rtl'),this.width(e),this.height(t),this.viewport({width:e,height:t,scale:1,scalable:'no'}),this.css('overflow-y','hidden'),this.css('margin','0',!0),'vertical'==u?(this.css('padding-top',a/2+'px',!0),this.css('padding-bottom',a/2+'px',!0),this.css('padding-left','20px'),this.css('padding-right','20px')):(this.css('padding-top','20px'),this.css('padding-bottom','20px'),this.css('padding-left',a/2+'px',!0),this.css('padding-right',a/2+'px',!0)),this.css('box-sizing','border-box'),this.css('max-width','inherit'),this.css(i,'horizontal'),this.css(s,'auto'),this.css(o,a+'px'),this.css(r,n+'px')}},{key:'scaler',value:function(e,t,n){var a='';this.css('transform-origin','top left'),(0<=t||0<=n)&&(a=' translate('+(t||0)+'px, '+(n||0)+'px )'),this.css('transform','scale('+e+')'+a)}},{key:'fit',value:function(e,t){var n=this.viewport(),a=parseInt(n.width),i=parseInt(n.height),o=e/a,r=t/i,s=o<r?o:r;this.layoutStyle('paginated'),this.width(a),this.height(i),this.overflow('hidden'),this.scaler(s,0,0),this.css('background-size',a*s+'px '+i*s+'px'),this.css('background-color','transparent')}},{key:'direction',value:function(e){this.documentElement&&(this.documentElement.style.direction=e)}},{key:'mapPage',value:function(e,t,n,a,i){var o=new g.default(t,i);return o.page(this,e,n,a)}},{key:'linksHandler',value:function(){var e=this;(0,h.replaceLinks)(this.content,function(t){e.emit(m.EVENTS.CONTENTS.LINK_CLICKED,t)})}},{key:'writingMode',value:function(e){var t=(0,d.prefixed)('writing-mode');return e&&this.documentElement&&(this.documentElement.style[t]=e),this.window.getComputedStyle(this.documentElement)[t]||''}},{key:'layoutStyle',value:function(e){return e&&(this._layoutStyle=e,navigator.epubReadingSystem.layoutStyle=this._layoutStyle),this._layoutStyle||'paginated'}},{key:'epubReadingSystem',value:function(e,t){return navigator.epubReadingSystem={name:e,version:t,layoutStyle:this.layoutStyle(),hasFeature:function(e){return'dom-manipulation'===e||'layout-changes'===e||'touch-events'===e||'mouse-events'===e||'keyboard-events'===e||'spine-scripting'!==e&&!1}},navigator.epubReadingSystem}},{key:'destroy',value:function(){this.observer&&this.observer.disconnect(),this.document.removeEventListener('transitionend',this._resizeCheck),this.removeListeners()}}],[{key:'listenedEvents',get:function(){return m.DOM_EVENTS}}]),e}();(0,l.default)(b.prototype),t.default=b,e.exports=t['default']},function(e,t,n){'use strict';function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var r=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(3),d=a(s),u=n(0),c=n(19),p=a(c),g=n(12),h=a(g),m=n(59),f=a(m),y=n(69),v=a(y),b=n(2),k=function(){function e(t){i(this,e),this.name='default',this.optsSettings=t.settings,this.View=t.view,this.request=t.request,this.renditionQueue=t.queue,this.q=new h.default(this),this.settings=(0,u.extend)(this.settings||{},{infinite:!0,hidden:!1,width:void 0,height:void 0,axis:void 0,flow:'scrolled',ignoreClass:'',fullsize:void 0}),(0,u.extend)(this.settings,t.settings||{}),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,flow:this.settings.flow,layout:this.layout,method:this.settings.method,width:0,height:0,forceEvenPages:!0},this.rendered=!1}return r(e,[{key:'render',value:function(e,t){var n=e.tagName;'undefined'==typeof this.settings.fullsize&&n&&('body'==n.toLowerCase()||'html'==n.toLowerCase())&&(this.settings.fullsize=!0),this.settings.fullsize&&(this.settings.overflow='visible',this.overflow=this.settings.overflow),this.settings.size=t,this.stage=new f.default({width:t.width,height:t.height,overflow:this.overflow,hidden:this.settings.hidden,axis:this.settings.axis,fullsize:this.settings.fullsize,direction:this.settings.direction}),this.stage.attachTo(e),this.container=this.stage.getContainer(),this.views=new v.default(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.stage.onOrientationChange(this.onOrientationChange.bind(this)),this.addEventListeners(),this.layout&&this.updateLayout(),this.rendered=!0}},{key:'addEventListeners',value:function(){var e;window.addEventListener('unload',function(){this.destroy()}.bind(this)),e=this.settings.fullsize?window:this.container,this._onScroll=this.onScroll.bind(this),e.addEventListener('scroll',this._onScroll)}},{key:'removeEventListeners',value:function(){var e;e=this.settings.fullsize?window:this.container,e.removeEventListener('scroll',this._onScroll),this._onScroll=void 0}},{key:'destroy',value:function(){clearTimeout(this.orientationTimeout),clearTimeout(this.resizeTimeout),clearTimeout(this.afterScrolled),this.clear(),this.removeEventListeners(),this.stage.destroy(),this.rendered=!1}},{key:'onOrientationChange',value:function(){var e=window,t=e.orientation;this.optsSettings.resizeOnOrientationChange&&this.resize(),clearTimeout(this.orientationTimeout),this.orientationTimeout=setTimeout(function(){this.orientationTimeout=void 0,this.optsSettings.resizeOnOrientationChange&&this.resize(),this.emit(b.EVENTS.MANAGERS.ORIENTATION_CHANGE,t)}.bind(this),500)}},{key:'onResized',value:function(){this.resize()}},{key:'resize',value:function(e,t){var n=this.stage.size(e,t);return this.winBounds=(0,u.windowBounds)(),this.orientationTimeout&&this.winBounds.width===this.winBounds.height?void(this._stageSize=void 0):void(this._stageSize&&this._stageSize.width===n.width&&this._stageSize.height===n.height||(this._stageSize=n,this._bounds=this.bounds(),this.clear(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.updateLayout(),this.emit(b.EVENTS.MANAGERS.RESIZED,{width:this._stageSize.width,height:this._stageSize.height})))}},{key:'createView',value:function(e){return new this.View(e,this.viewSettings)}},{key:'display',value:function(e,t){var n=new u.defer,a=n.promise;(t===e.href||(0,u.isNumber)(t))&&(t=void 0);var i=this.views.find(e);if(i&&e){var o=i.offset();if('ltr'===this.settings.direction)this.scrollTo(o.left,o.top,!0);else{var r=i.width();this.scrollTo(o.left+r,o.top,!0)}if(t){var s=i.locationOf(t);this.moveTo(s)}return n.resolve(),a}return this.clear(),this.add(e).then(function(e){if(t){var n=e.locationOf(t);this.moveTo(n)}}.bind(this),function(e){n.reject(e)}).then(function(){var t;if('pre-paginated'===this.layout.name&&1<this.layout.divisor&&0<e.index&&(t=e.next(),t))return this.add(t)}.bind(this)).then(function(){this.views.show(),n.resolve()}.bind(this)),a}},{key:'afterDisplayed',value:function(e){this.emit(b.EVENTS.MANAGERS.ADDED,e)}},{key:'afterResized',value:function(e){this.emit(b.EVENTS.MANAGERS.RESIZE,e.section)}},{key:'moveTo',value:function(e){var t=0,n=0;this.isPaginated?(t=l(e.left/this.layout.delta)*this.layout.delta,t+this.layout.delta>this.container.scrollWidth&&(t=this.container.scrollWidth-this.layout.delta)):n=e.top,this.scrollTo(t,n,!0)}},{key:'add',value:function(e){var t=this,n=this.createView(e);return this.views.append(n),n.onDisplayed=this.afterDisplayed.bind(this),n.onResize=this.afterResized.bind(this),n.on(b.EVENTS.VIEWS.AXIS,function(e){t.updateAxis(e)}),n.display(this.request)}},{key:'append',value:function(e){var t=this,n=this.createView(e);return this.views.append(n),n.onDisplayed=this.afterDisplayed.bind(this),n.onResize=this.afterResized.bind(this),n.on(b.EVENTS.VIEWS.AXIS,function(e){t.updateAxis(e)}),n.display(this.request)}},{key:'prepend',value:function(e){var t=this,n=this.createView(e);return n.on(b.EVENTS.VIEWS.RESIZED,function(e){t.counter(e)}),this.views.prepend(n),n.onDisplayed=this.afterDisplayed.bind(this),n.onResize=this.afterResized.bind(this),n.on(b.EVENTS.VIEWS.AXIS,function(e){t.updateAxis(e)}),n.display(this.request)}},{key:'counter',value:function(e){'vertical'===this.settings.axis?this.scrollBy(0,e.heightDelta,!0):this.scrollBy(e.widthDelta,0,!0)}},{key:'next',value:function(){var e=this.settings.direction,t,n;if(this.views.length){if(this.isPaginated&&'horizontal'===this.settings.axis&&(!e||'ltr'===e))this.scrollLeft=this.container.scrollLeft,n=this.container.scrollLeft+this.container.offsetWidth+this.layout.delta,n<=this.container.scrollWidth?this.scrollBy(this.layout.delta,0,!0):t=this.views.last().section.next();else if(this.isPaginated&&'horizontal'===this.settings.axis&&'rtl'===e)this.scrollLeft=this.container.scrollLeft,n=this.container.scrollLeft,0<n?this.scrollBy(this.layout.delta,0,!0):t=this.views.last().section.next();else if(this.isPaginated&&'vertical'===this.settings.axis){this.scrollTop=this.container.scrollTop;var a=this.container.scrollTop+this.container.offsetHeight;a<this.container.scrollHeight?this.scrollBy(0,this.layout.height,!0):t=this.views.last().section.next()}else t=this.views.last().section.next();return t?(this.clear(),this.append(t).then(function(){var e;if('pre-paginated'===this.layout.name&&1<this.layout.divisor&&(e=t.next(),e))return this.append(e)}.bind(this),function(e){return e}).then(function(){this.views.show()}.bind(this))):void 0}}},{key:'prev',value:function(){var e=this.settings.direction,t,n;if(this.views.length){if(this.isPaginated&&'horizontal'===this.settings.axis&&(!e||'ltr'===e))this.scrollLeft=this.container.scrollLeft,n=this.container.scrollLeft,0<n?this.scrollBy(-this.layout.delta,0,!0):t=this.views.first().section.prev();else if(this.isPaginated&&'horizontal'===this.settings.axis&&'rtl'===e)this.scrollLeft=this.container.scrollLeft,n=this.container.scrollLeft+this.container.offsetWidth+this.layout.delta,n<=this.container.scrollWidth?this.scrollBy(-this.layout.delta,0,!0):t=this.views.first().section.prev();else if(this.isPaginated&&'vertical'===this.settings.axis){this.scrollTop=this.container.scrollTop;var a=this.container.scrollTop;0<a?this.scrollBy(0,-this.layout.height,!0):t=this.views.first().section.prev()}else t=this.views.first().section.prev();return t?(this.clear(),this.prepend(t).then(function(){var e;if('pre-paginated'===this.layout.name&&1<this.layout.divisor&&(e=t.prev(),e))return this.prepend(e)}.bind(this),function(e){return e}).then(function(){this.isPaginated&&'horizontal'===this.settings.axis&&('rtl'===this.settings.direction?this.scrollTo(0,0,!0):this.scrollTo(this.container.scrollWidth-this.layout.delta,0,!0)),this.views.show()}.bind(this))):void 0}}},{key:'current',value:function(){var e=this.visible();return e.length?e[e.length-1]:null}},{key:'clear',value:function(){this.views&&(this.views.hide(),this.scrollTo(0,0,!0),this.views.clear())}},{key:'currentLocation',value:function(){return this.location='vertical'===this.settings.axis?this.scrolledLocation():this.paginatedLocation(),this.location}},{key:'scrolledLocation',value:function(){var e=this,t=this.visible(),n=this.container.getBoundingClientRect(),a=n.height<window.innerHeight?n.height:window.innerHeight,r=0,s=0;this.settings.fullsize&&(r=window.scrollY);var i=t.map(function(t){var l=t.section,d=l.index,u=l.href,c=t.position(),p=t.height(),g=r+n.top-c.top+s,h=g+a-s;h>p&&(h=p,s=h-g);var m=e.layout.count(p,a).pages,f=o(g/a),y=[],v=o(h/a);y=[];for(var b=f,i;b<=v;b++)i=b+1,y.push(i);var k=e.mapping.page(t.contents,t.section.cfiBase,g,h);return{index:d,href:u,pages:y,totalPages:m,mapping:k}});return i}},{key:'paginatedLocation',value:function(){var e=this,t=this.visible(),n=this.container.getBoundingClientRect(),a=0,o=0;this.settings.fullsize&&(a=window.scrollX);var i=t.map(function(t){var r=t.section,s=r.index,d=r.href,u=t.offset().left,c=t.position().left,p=t.width(),g=a+n.left-c+o,h=g+e.layout.width-o,m=e.mapping.page(t.contents,t.section.cfiBase,g,h),f=e.layout.count(p).pages,y=l(g/e.layout.pageWidth),v=[],b=l(h/e.layout.pageWidth);if(0>y&&(y=0,++b),'rtl'===e.settings.direction){var k=y;y=f-b,b=f-k}for(var x=y+1,i;x<=b;x++)i=x,v.push(i);return{index:s,href:d,pages:v,totalPages:f,mapping:m}});return i}},{key:'isVisible',value:function(e,t,n,a){var i=e.position(),o=a||this.bounds();return'horizontal'===this.settings.axis&&i.right>o.left-t&&i.left<o.right+n||'vertical'===this.settings.axis&&i.bottom>o.top-t&&i.top<o.bottom+n}},{key:'visible',value:function(){for(var e=this.bounds(),t=this.views.displayed(),n=t.length,a=[],o=0,i,r;o<n;o++)r=t[o],i=this.isVisible(r,0,0,e),!0===i&&a.push(r);return a}},{key:'scrollBy',value:function(e,t,n){var a='rtl'===this.settings.direction?-1:1;n&&(this.ignore=!0),this.settings.fullsize?window.scrollBy(e*a,t*a):(e&&(this.container.scrollLeft+=e*a),t&&(this.container.scrollTop+=t)),this.scrolled=!0}},{key:'scrollTo',value:function(e,t,n){n&&(this.ignore=!0),this.settings.fullsize?window.scrollTo(e,t):(this.container.scrollLeft=e,this.container.scrollTop=t),this.scrolled=!0}},{key:'onScroll',value:function(){var e=void 0,t=void 0;this.settings.fullsize?(e=window.scrollY,t=window.scrollX):(e=this.container.scrollTop,t=this.container.scrollLeft),this.scrollTop=e,this.scrollLeft=t,this.ignore?this.ignore=!1:(this.emit(b.EVENTS.MANAGERS.SCROLL,{top:e,left:t}),clearTimeout(this.afterScrolled),this.afterScrolled=setTimeout(function(){this.emit(b.EVENTS.MANAGERS.SCROLLED,{top:this.scrollTop,left:this.scrollLeft})}.bind(this),20))}},{key:'bounds',value:function(){var e;return e=this.stage.bounds(),e}},{key:'applyLayout',value:function(e){this.layout=e,this.updateLayout()}},{key:'updateLayout',value:function(){this.stage&&(this._stageSize=this.stage.size(),this.isPaginated?(this.layout.calculate(this._stageSize.width,this._stageSize.height,this.settings.gap),this.settings.offset=this.layout.delta):this.layout.calculate(this._stageSize.width,this._stageSize.height),this.viewSettings.width=this.layout.width,this.viewSettings.height=this.layout.height,this.setLayout(this.layout))}},{key:'setLayout',value:function(e){this.viewSettings.layout=e,this.mapping=new p.default(e.props,this.settings.direction,this.settings.axis),this.views&&this.views.forEach(function(t){t&&t.setLayout(e)})}},{key:'updateAxis',value:function(e,t){this.isPaginated||(e='vertical'),(t||e!==this.settings.axis)&&(this.settings.axis=e,this.stage&&this.stage.axis(e),this.viewSettings.axis=e,this.mapping&&(this.mapping=new p.default(this.layout.props,this.settings.direction,this.settings.axis)),this.layout&&('vertical'===e?this.layout.spread('none'):this.layout.spread(this.layout.settings.spread)))}},{key:'updateFlow',value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:'auto',n='paginated'===e||'auto'===e;this.isPaginated=n,'scrolled-doc'===e||'scrolled-continuous'===e||'scrolled'===e?this.updateAxis('vertical'):this.updateAxis('horizontal'),this.viewSettings.flow=e,this.overflow=this.settings.overflow?this.settings.overflow:n?'hidden':t,this.stage&&this.stage.overflow(this.overflow),this.updateLayout()}},{key:'getContents',value:function(){var e=[];return this.views?(this.views.forEach(function(t){var n=t&&t.contents;n&&e.push(n)}),e):e}},{key:'direction',value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:'ltr';this.settings.direction=e,this.stage&&this.stage.direction(e),this.viewSettings.direction=e,this.updateLayout()}},{key:'isRendered',value:function(){return this.rendered}}]),e}();(0,d.default)(k.prototype),t.default=k,e.exports=t['default']},function(e){e.exports=function(e){var t=typeof e;return null!=e&&('object'==t||'function'==t)}},function(e,t){function n(e,t){for(var n in e)t[n]=e[n]}function a(e,a){var i=e.prototype;if(Object.create){var t=Object.create(a.prototype);i.__proto__=t}if(!(i instanceof a)){function o(){}o.prototype=a.prototype,o=new o,n(i,o),e.prototype=i=o}i.constructor!=e&&('function'!=typeof e&&console.error('unknow Class:'+e),i.constructor=e)}function o(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,ae[e]),this.message=ae[e],Error.captureStackTrace&&Error.captureStackTrace(this,o);return n.code=e,t&&(this.message=this.message+': '+t),n}function r(){}function i(e,t){this._node=e,this._refresh=t,s(this)}function s(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var a=e._refresh(e._node);U(e,'length',a.length),n(a,e),e._inc=t}}function l(){}function d(e,t){for(var n=e.length;n--;)if(e[n]===t)return n}function u(e,t,n,a){if(a?t[d(t,a)]=n:t[t.length++]=n,e){n.ownerElement=e;var i=e.ownerDocument;i&&(a&&v(i,e,a),y(i,e,n))}}function c(e,t,n){var a=d(t,n);if(0<=a){for(var i=t.length-1;a<i;)t[a]=t[++a];if(t.length=i,e){var r=e.ownerDocument;r&&(v(r,e,n),n.ownerElement=null)}}else throw o(ce,new Error(e.tagName+'@'+n))}function p(e){if(this._features={},e)for(var t in e)this._features=e[t]}function g(){}function h(e){return'<'==e&&'<'||'>'==e&&'>'||'&'==e&&'&'||'"'==e&&'"'||'&#'+e.charCodeAt()+';'}function m(e,t){if(t(e))return!0;if(e=e.firstChild)do if(m(e,t))return!0;while(e=e.nextSibling)}function f(){}function y(e,t,n){e&&e._inc++;var a=n.namespaceURI;'http://www.w3.org/2000/xmlns/'==a&&(t._nsMap[n.prefix?n.localName:'']=n.value)}function v(e,t,n){e&&e._inc++;var a=n.namespaceURI;'http://www.w3.org/2000/xmlns/'==a&&delete t._nsMap[n.prefix?n.localName:'']}function b(e,t,n){if(e&&e._inc){e._inc++;var a=t.childNodes;if(n)a[a.length++]=n;else{for(var o=t.firstChild,r=0;o;)a[r++]=o,o=o.nextSibling;a.length=r}}}function k(e,t){var n=t.previousSibling,a=t.nextSibling;return n?n.nextSibling=a:e.firstChild=a,a?a.previousSibling=n:e.lastChild=n,b(e.ownerDocument,e),t}function x(e,t,n){var a=t.parentNode;if(a&&a.removeChild(t),t.nodeType===ee){var i=t.firstChild;if(null==i)return t;var o=t.lastChild}else i=o=t;var r=n?n.previousSibling:e.lastChild;i.previousSibling=r,o.nextSibling=n,r?r.nextSibling=i:e.firstChild=i,null==n?e.lastChild=o:n.previousSibling=o;do i.parentNode=e;while(i!==o&&(i=i.nextSibling));return b(e.ownerDocument||e,e),t.nodeType==ee&&(t.firstChild=t.lastChild=null),t}function E(e,t){var n=t.parentNode;if(n){var a=e.lastChild;n.removeChild(t);var a=e.lastChild}var a=e.lastChild;return t.parentNode=e,t.previousSibling=a,t.nextSibling=null,a?a.nextSibling=t:e.firstChild=t,e.lastChild=t,b(e.ownerDocument,e,t),t}function _(){this._nsMap={}}function N(){}function S(){}function w(){}function T(){}function C(){}function R(){}function I(){}function A(){}function L(){}function O(){}function D(){}function P(){}function z(e,t){var n=[],a=9==this.nodeType?this.documentElement:this,i=a.prefix,o=a.namespaceURI;if(o&&null==i){var i=a.lookupPrefix(o);if(null==i)var r=[{namespace:o,prefix:null}]}return B(this,n,e,t,r),n.join('')}function M(e,t,n){var a=e.prefix||'',o=e.namespaceURI;if(!a&&!o)return!1;if('xml'===a&&'http://www.w3.org/XML/1998/namespace'===o||'http://www.w3.org/2000/xmlns/'==o)return!1;for(var r=n.length;r--;){var i=n[r];if(i.prefix==a)return i.namespace!=o}return!0}function B(e,t,n,a,o){if(a){if(e=a(e),!e)return;if('string'==typeof e)return void t.push(e)}switch(e.nodeType){case F:o||(o=[]);var r=o.length,s=e.attributes,l=s.length,d=e.firstChild,u=e.tagName;n=V===e.namespaceURI||n,t.push('<',u);for(var c=0,i;c<l;c++)i=s.item(c),'xmlns'==i.prefix?o.push({prefix:i.localName,namespace:i.value}):'xmlns'==i.nodeName&&o.push({prefix:'',namespace:i.value});for(var c=0,i;c<l;c++){if(i=s.item(c),M(i,n,o)){var p=i.prefix||'',g=i.namespaceURI,m=p?' xmlns:'+p:' xmlns';t.push(m,'="',g,'"'),o.push({prefix:p,namespace:g})}B(i,t,n,a,o)}if(M(e,n,o)){var p=e.prefix||'',g=e.namespaceURI,m=p?' xmlns:'+p:' xmlns';t.push(m,'="',g,'"'),o.push({prefix:p,namespace:g})}if(d||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(u)){if(t.push('>'),n&&/^script$/i.test(u))for(;d;)d.data?t.push(d.data):B(d,t,n,a,o),d=d.nextSibling;else for(;d;)B(d,t,n,a,o),d=d.nextSibling;t.push('</',u,'>')}else t.push('/>');return;case J:case ee:for(var d=e.firstChild;d;)B(d,t,n,a,o),d=d.nextSibling;return;case H:return t.push(' ',e.name,'="',e.value.replace(/[<&"]/g,h),'"');case X:return t.push(e.data.replace(/[<&]/g,h));case Y:return t.push('<![CDATA[',e.data,']]>');case Q:return t.push('<!--',e.data,'-->');case $:var f=e.publicId,y=e.systemId;if(t.push('<!DOCTYPE ',e.name),f)t.push(' PUBLIC "',f),y&&'.'!=y&&t.push('" "',y),t.push('">');else if(y&&'.'!=y)t.push(' SYSTEM "',y,'">');else{var v=e.internalSubset;v&&t.push(' [',v,']'),t.push('>')}return;case Z:return t.push('<?',e.target,' ',e.data,'?>');case G:return t.push('&',e.nodeName,';');default:t.push('??',e.nodeName);}}function j(e,t,n){var a;switch(t.nodeType){case F:a=t.cloneNode(!1),a.ownerDocument=e;case ee:break;case H:n=!0;}if(a||(a=t.cloneNode(!1)),a.ownerDocument=e,a.parentNode=null,n)for(var i=t.firstChild;i;)a.appendChild(j(e,i,n)),i=i.nextSibling;return a}function q(e,t,a){var o=new t.constructor;for(var s in t){var n=t[s];'object'!=typeof n&&n!=o[s]&&(o[s]=n)}switch(t.childNodes&&(o.childNodes=new r),o.ownerDocument=e,o.nodeType){case F:var d=t.attributes,u=o.attributes=new l,c=d.length;u._ownerElement=o;for(var p=0;p<c;p++)o.setAttributeNode(q(e,d.item(p),!0));break;;case H:a=!0;}if(a)for(var i=t.firstChild;i;)o.appendChild(q(e,i,a)),i=i.nextSibling;return o}function U(e,t,n){e[t]=n}var V='http://www.w3.org/1999/xhtml',W={},F=W.ELEMENT_NODE=1,H=W.ATTRIBUTE_NODE=2,X=W.TEXT_NODE=3,Y=W.CDATA_SECTION_NODE=4,G=W.ENTITY_REFERENCE_NODE=5,K=W.ENTITY_NODE=6,Z=W.PROCESSING_INSTRUCTION_NODE=7,Q=W.COMMENT_NODE=8,J=W.DOCUMENT_NODE=9,$=W.DOCUMENT_TYPE_NODE=10,ee=W.DOCUMENT_FRAGMENT_NODE=11,te=W.NOTATION_NODE=12,ne={},ae={},ie=ne.INDEX_SIZE_ERR=(ae[1]='Index size error',1),oe=ne.DOMSTRING_SIZE_ERR=(ae[2]='DOMString size error',2),re=ne.HIERARCHY_REQUEST_ERR=(ae[3]='Hierarchy request error',3),se=ne.WRONG_DOCUMENT_ERR=(ae[4]='Wrong document',4),le=ne.INVALID_CHARACTER_ERR=(ae[5]='Invalid character',5),de=ne.NO_DATA_ALLOWED_ERR=(ae[6]='No data allowed',6),ue=ne.NO_MODIFICATION_ALLOWED_ERR=(ae[7]='No modification allowed',7),ce=ne.NOT_FOUND_ERR=(ae[8]='Not found',8),pe=ne.NOT_SUPPORTED_ERR=(ae[9]='Not supported',9),ge=ne.INUSE_ATTRIBUTE_ERR=(ae[10]='Attribute in use',10),he=ne.INVALID_STATE_ERR=(ae[11]='Invalid state',11),me=ne.SYNTAX_ERR=(ae[12]='Syntax error',12),fe=ne.INVALID_MODIFICATION_ERR=(ae[13]='Invalid modification',13),ye=ne.NAMESPACE_ERR=(ae[14]='Invalid namespace',14),ve=ne.INVALID_ACCESS_ERR=(ae[15]='Invalid access',15);o.prototype=Error.prototype,n(ne,o);r.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var n=[],a=0;a<this.length;a++)B(this[a],n,e,t);return n.join('')}},i.prototype.item=function(e){return s(this),this[e]},a(i,r);l.prototype={length:0,item:r.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var n=this[t];if(n.nodeName==e)return n}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new o(ge);var n=this.getNamedItem(e.nodeName);return u(this._ownerElement,this,e,n),n},setNamedItemNS:function(e){var t=e.ownerElement,n;if(t&&t!=this._ownerElement)throw new o(ge);return n=this.getNamedItemNS(e.namespaceURI,e.localName),u(this._ownerElement,this,e,n),n},removeNamedItem:function(e){var t=this.getNamedItem(e);return c(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var n=this.getNamedItemNS(e,t);return c(this._ownerElement,this,n),n},getNamedItemNS:function(e,t){for(var n=this.length;n--;){var a=this[n];if(a.localName==t&&a.namespaceURI==e)return a}return null}};p.prototype={hasFeature:function(e,t){var n=this._features[e.toLowerCase()];return n&&(!t||t in n)},createDocument:function(e,t,n){var a=new f;if(a.implementation=this,a.childNodes=new r,a.doctype=n,n&&a.appendChild(n),t){var i=a.createElementNS(e,t);a.appendChild(i)}return a},createDocumentType:function(e,t,n){var a=new R;return a.name=e,a.nodeName=e,a.publicId=t,a.systemId=n,a}};g.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return x(this,e,t)},replaceChild:function(e,t){this.insertBefore(e,t),t&&this.removeChild(t)},removeChild:function(e){return k(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return q(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==X&&e.nodeType==X?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return 0<this.attributes.length},lookupPrefix:function(e){for(var t=this;t;){var a=t._nsMap;if(a)for(var i in a)if(a[i]==e)return i;t=t.nodeType==H?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&e in n)return n[e];t=t.nodeType==H?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){var t=this.lookupPrefix(e);return null==t}},n(W,g),n(W,g.prototype),f.prototype={nodeName:'#document',nodeType:J,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==ee){for(var n=e.firstChild,a;n;)a=n.nextSibling,this.insertBefore(n,t),n=a;return e}return null==this.documentElement&&e.nodeType==F&&(this.documentElement=e),x(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),k(this,e)},importNode:function(e,t){return j(this,e,t)},getElementById:function(e){var t=null;return m(this.documentElement,function(n){if(n.nodeType==F&&n.getAttribute('id')==e)return t=n,!0}),t},createElement:function(e){var t=new _;t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.childNodes=new r;var n=t.attributes=new l;return n._ownerElement=t,t},createDocumentFragment:function(){var e=new O;return e.ownerDocument=this,e.childNodes=new r,e},createTextNode:function(e){var t=new w;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new T;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new C;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new D;return n.ownerDocument=this,n.tagName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new N;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new L;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new _,a=t.split(':'),i=n.attributes=new l;return n.childNodes=new r,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,2==a.length?(n.prefix=a[0],n.localName=a[1]):n.localName=t,i._ownerElement=n,n},createAttributeNS:function(e,t){var n=new N,a=t.split(':');return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,2==a.length?(n.prefix=a[0],n.localName=a[1]):n.localName=t,n}},a(f,g);_.prototype={nodeType:F,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||''},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=''+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===ee?this.insertBefore(e,null):E(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||''},setAttributeNS:function(e,t,n){var a=this.ownerDocument.createAttributeNS(e,t);a.value=a.nodeValue=''+n,this.setAttributeNode(a)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new i(this,function(t){var n=[];return m(t,function(a){a!==t&&a.nodeType==F&&('*'===e||a.tagName==e)&&n.push(a)}),n})},getElementsByTagNameNS:function(e,t){return new i(this,function(n){var a=[];return m(n,function(i){i!==n&&i.nodeType===F&&('*'===e||i.namespaceURI===e)&&('*'===t||i.localName==t)&&a.push(i)}),a})}},f.prototype.getElementsByTagName=_.prototype.getElementsByTagName,f.prototype.getElementsByTagNameNS=_.prototype.getElementsByTagNameNS,a(_,g);N.prototype.nodeType=H,a(N,g);S.prototype={data:'',substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(){throw new Error(ae[re])},deleteData:function(e,t){this.replaceData(e,t,'')},replaceData:function(e,t,n){var a=this.data.substring(0,e),i=this.data.substring(e+t);n=a+n+i,this.nodeValue=this.data=n,this.length=n.length}},a(S,g);w.prototype={nodeName:'#text',nodeType:X,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var a=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling),a}},a(w,S);T.prototype={nodeName:'#comment',nodeType:Q},a(T,S);C.prototype={nodeName:'#cdata-section',nodeType:Y},a(C,S);R.prototype.nodeType=$,a(R,g);I.prototype.nodeType=te,a(I,g);A.prototype.nodeType=K,a(A,g);L.prototype.nodeType=G,a(L,g);O.prototype.nodeName='#document-fragment',O.prototype.nodeType=ee,a(O,g),D.prototype.nodeType=Z,a(D,g),P.prototype.serializeToString=function(e,t,n){return z.call(e,t,n)},g.prototype.toString=z;try{if(Object.defineProperty){function e(t){switch(t.nodeType){case F:case ee:var n=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&n.push(e(t)),t=t.nextSibling;return n.join('');default:return t.nodeValue;}}Object.defineProperty(i.prototype,'length',{get:function(){return s(this),this.$$length}}),Object.defineProperty(g.prototype,'textContent',{get:function(){return e(this)},set:function(e){switch(this.nodeType){case F:case ee:for(;this.firstChild;)this.removeChild(this.firstChild);(e||e+'')&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e;}}}),U=function(e,t,n){e['$$'+t]=n}}}catch(t){}t.DOMImplementation=p,t.XMLSerializer=P},function(e,t,n){'use strict';function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var o='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&'function'==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?'symbol':typeof e},r=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(3),l=a(s),d=n(0),u=n(11),c=a(u),p=n(1),g=a(p),h=n(12),m=a(h),f=n(53),y=a(f),v=n(54),b=a(v),k=n(14),x=a(k),E=n(55),_=a(E),N=n(2),S=n(20),w=a(S),T=n(15),C=a(T),R=n(24),I=a(R),A=function(){function e(t,n){i(this,e),this.settings=(0,d.extend)(this.settings||{},{width:null,height:null,ignoreClass:'',manager:'default',view:'iframe',flow:null,layout:null,spread:null,minSpreadWidth:800,stylesheet:null,resizeOnOrientationChange:!0,script:null,snap:!1}),(0,d.extend)(this.settings,n),'object'===o(this.settings.manager)&&(this.manager=this.settings.manager),this.book=t,this.hooks={},this.hooks.display=new c.default(this),this.hooks.serialize=new c.default(this),this.hooks.content=new c.default(this),this.hooks.unloaded=new c.default(this),this.hooks.layout=new c.default(this),this.hooks.render=new c.default(this),this.hooks.show=new c.default(this),this.hooks.content.register(this.handleLinks.bind(this)),this.hooks.content.register(this.passEvents.bind(this)),this.hooks.content.register(this.adjustImages.bind(this)),this.book.spine.hooks.content.register(this.injectIdentifier.bind(this)),this.settings.stylesheet&&this.book.spine.hooks.content.register(this.injectStylesheet.bind(this)),this.settings.script&&this.book.spine.hooks.content.register(this.injectScript.bind(this)),this.themes=new b.default(this),this.annotations=new _.default(this),this.epubcfi=new g.default,this.q=new m.default(this),this.location=void 0,this.q.enqueue(this.book.opened),this.starting=new d.defer,this.started=this.starting.promise,this.q.enqueue(this.start)}return r(e,[{key:'setManager',value:function(e){this.manager=e}},{key:'requireManager',value:function(e){var t;return t='string'==typeof e&&'default'===e?C.default:'string'==typeof e&&'continuous'===e?I.default:e,t}},{key:'requireView',value:function(e){var t;return t='string'==typeof e&&'iframe'===e?w.default:e,t}},{key:'start',value:function(){this.settings.layout||'pre-paginated'!==this.book.package.metadata.layout&&'true'!==this.book.displayOptions.fixedLayout||(this.settings.layout='pre-paginated'),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.direction(this.book.package.metadata.direction),this.settings.globalLayoutProperties=this.determineLayoutProperties(this.book.package.metadata),this.flow(this.settings.globalLayoutProperties.flow),this.layout(this.settings.globalLayoutProperties),this.manager.on(N.EVENTS.MANAGERS.ADDED,this.afterDisplayed.bind(this)),this.manager.on(N.EVENTS.MANAGERS.REMOVED,this.afterRemoved.bind(this)),this.manager.on(N.EVENTS.MANAGERS.RESIZED,this.onResized.bind(this)),this.manager.on(N.EVENTS.MANAGERS.ORIENTATION_CHANGE,this.onOrientationChange.bind(this)),this.manager.on(N.EVENTS.MANAGERS.SCROLLED,this.reportLocation.bind(this)),this.emit(N.EVENTS.RENDITION.STARTED),this.starting.resolve()}},{key:'attachTo',value:function(e){return this.q.enqueue(function(){this.manager.render(e,{width:this.settings.width,height:this.settings.height}),this.emit(N.EVENTS.RENDITION.ATTACHED)}.bind(this))}},{key:'display',value:function(e){return this.displaying&&this.displaying.resolve(),this.q.enqueue(this._display,e)}},{key:'_display',value:function(e){var t=this;if(this.book){var n=this.epubcfi.isCfiString(e),a=new d.defer,i=a.promise,o;return(this.displaying=a,this.book.locations.length()&&(0,d.isFloat)(e)&&(e=this.book.locations.cfiFromPercentage(parseFloat(e))),o=this.book.spine.get(e),!o)?(a.reject(new Error('No Section Found')),i):(this.manager.display(o,e).then(function(){a.resolve(o),t.displaying=void 0,t.emit(N.EVENTS.RENDITION.DISPLAYED,o),t.reportLocation()},function(e){t.emit(N.EVENTS.RENDITION.DISPLAY_ERROR,e)}),i)}}},{key:'afterDisplayed',value:function(e){var t=this;e.on(N.EVENTS.VIEWS.MARK_CLICKED,function(n,a){return t.triggerMarkEvent(n,a,e.contents)}),this.hooks.render.trigger(e,this).then(function(){e.contents?t.hooks.content.trigger(e.contents,t).then(function(){t.emit(N.EVENTS.RENDITION.RENDERED,e.section,e)}):t.emit(N.EVENTS.RENDITION.RENDERED,e.section,e)})}},{key:'afterRemoved',value:function(e){var t=this;this.hooks.unloaded.trigger(e,this).then(function(){t.emit(N.EVENTS.RENDITION.REMOVED,e.section,e)})}},{key:'onResized',value:function(e){this.emit(N.EVENTS.RENDITION.RESIZED,{width:e.width,height:e.height}),this.location&&this.location.start&&this.display(this.location.start.cfi)}},{key:'onOrientationChange',value:function(e){this.emit(N.EVENTS.RENDITION.ORIENTATION_CHANGE,e)}},{key:'moveTo',value:function(e){this.manager.moveTo(e)}},{key:'resize',value:function(e,t){e&&(this.settings.width=e),t&&(this.settings.height=t),this.manager.resize(e,t)}},{key:'clear',value:function(){this.manager.clear()}},{key:'next',value:function(){return this.q.enqueue(this.manager.next.bind(this.manager)).then(this.reportLocation.bind(this))}},{key:'prev',value:function(){return this.q.enqueue(this.manager.prev.bind(this.manager)).then(this.reportLocation.bind(this))}},{key:'determineLayoutProperties',value:function(e){var t=this.settings.layout||e.layout||'reflowable',n=this.settings.spread||e.spread||'auto',a=this.settings.orientation||e.orientation||'auto',i=this.settings.flow||e.flow||'auto',o=e.viewport||'',r=this.settings.minSpreadWidth||e.minSpreadWidth||800,s=this.settings.direction||e.direction||'ltr',l;return(0===this.settings.width||0<this.settings.width)&&(0===this.settings.height||0<this.settings.height),l={layout:t,spread:n,orientation:a,flow:i,viewport:o,minSpreadWidth:r,direction:s},l}},{key:'flow',value:function(e){var t=e;('scrolled'===e||'scrolled-doc'===e||'scrolled-continuous'===e)&&(t='scrolled'),('auto'===e||'paginated'===e)&&(t='paginated'),this.settings.flow=e,this._layout&&this._layout.flow(t),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this.manager&&this.manager.updateFlow(t),this.manager&&this.manager.isRendered()&&this.location&&(this.manager.clear(),this.display(this.location.start.cfi))}},{key:'layout',value:function(e){var t=this;return e&&(this._layout=new y.default(e),this._layout.spread(e.spread,this.settings.minSpreadWidth),this._layout.on(N.EVENTS.LAYOUT.UPDATED,function(e,n){t.emit(N.EVENTS.RENDITION.LAYOUT,e,n)})),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this._layout}},{key:'spread',value:function(e,t){this.settings.spread=e,t&&(this.settings.minSpreadWidth=t),this._layout&&this._layout.spread(e,t),this.manager&&this.manager.isRendered()&&this.manager.updateLayout()}},{key:'direction',value:function(e){this.settings.direction=e||'ltr',this.manager&&this.manager.direction(this.settings.direction),this.manager&&this.manager.isRendered()&&this.location&&(this.manager.clear(),this.display(this.location.start.cfi))}},{key:'reportLocation',value:function(){return this.q.enqueue(function(){requestAnimationFrame(function(){var e=this.manager.currentLocation();if(e&&e.then&&'function'==typeof e.then)e.then(function(e){var t=this.located(e);t&&t.start&&t.end&&(this.location=t,this.emit(N.EVENTS.RENDITION.LOCATION_CHANGED,{index:this.location.start.index,href:this.location.start.href,start:this.location.start.cfi,end:this.location.end.cfi,percentage:this.location.start.percentage}),this.emit(N.EVENTS.RENDITION.RELOCATED,this.location))}.bind(this));else if(e){var t=this.located(e);if(!t||!t.start||!t.end)return;this.location=t,this.emit(N.EVENTS.RENDITION.LOCATION_CHANGED,{index:this.location.start.index,href:this.location.start.href,start:this.location.start.cfi,end:this.location.end.cfi,percentage:this.location.start.percentage}),this.emit(N.EVENTS.RENDITION.RELOCATED,this.location)}}.bind(this))}.bind(this))}},{key:'currentLocation',value:function(){var e=this.manager.currentLocation();if(e&&e.then&&'function'==typeof e.then)e.then(function(e){var t=this.located(e);return t}.bind(this));else if(e){var t=this.located(e);return t}}},{key:'located',value:function(e){if(!e.length)return{};var t=e[0],n=e[e.length-1],a={start:{index:t.index,href:t.href,cfi:t.mapping.start,displayed:{page:t.pages[0]||1,total:t.totalPages}},end:{index:n.index,href:n.href,cfi:n.mapping.end,displayed:{page:n.pages[n.pages.length-1]||1,total:n.totalPages}}},i=this.book.locations.locationFromCfi(t.mapping.start),o=this.book.locations.locationFromCfi(n.mapping.end);null!=i&&(a.start.location=i,a.start.percentage=this.book.locations.percentageFromLocation(i)),null!=o&&(a.end.location=o,a.end.percentage=this.book.locations.percentageFromLocation(o));var r=this.book.pageList.pageFromCfi(t.mapping.start),s=this.book.pageList.pageFromCfi(n.mapping.end);return-1!=r&&(a.start.page=r),-1!=s&&(a.end.page=s),n.index===this.book.spine.last().index&&a.end.displayed.page>=a.end.displayed.total&&(a.atEnd=!0),t.index===this.book.spine.first().index&&1===a.start.displayed.page&&(a.atStart=!0),a}},{key:'destroy',value:function(){this.manager&&this.manager.destroy(),this.book=void 0}},{key:'passEvents',value:function(t){var n=this;N.DOM_EVENTS.forEach(function(a){t.on(a,function(e){return n.triggerViewEvent(e,t)})}),t.on(N.EVENTS.CONTENTS.SELECTED,function(a){return n.triggerSelectedEvent(a,t)})}},{key:'triggerViewEvent',value:function(t,e){this.emit(t.type,t,e)}},{key:'triggerSelectedEvent',value:function(e,t){this.emit(N.EVENTS.RENDITION.SELECTED,e,t)}},{key:'triggerMarkEvent',value:function(e,t,n){this.emit(N.EVENTS.RENDITION.MARK_CLICKED,e,t,n)}},{key:'getRange',value:function(e,t){var n=new g.default(e),a=this.manager.visible().filter(function(e){if(n.spinePos===e.index)return!0});if(a.length)return a[0].contents.range(n,t)}},{key:'adjustImages',value:function(e){if('pre-paginated'===this._layout.name)return new Promise(function(e){e()});var t=e.window.getComputedStyle(e.content,null),n=.95*(e.content.offsetHeight-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom))),a=parseFloat(t.verticalPadding);return e.addStylesheetRules({img:{"max-width":(this._layout.columnWidth?this._layout.columnWidth-a+'px':'100%')+'!important',"max-height":n+'px!important',"object-fit":'contain',"page-break-inside":'avoid',"break-inside":'avoid',"box-sizing":'border-box'},svg:{"max-width":(this._layout.columnWidth?this._layout.columnWidth-a+'px':'100%')+'!important',"max-height":n+'px!important',"page-break-inside":'avoid',"break-inside":'avoid'}}),new Promise(function(e){setTimeout(function(){e()},1)})}},{key:'getContents',value:function(){return this.manager?this.manager.getContents():[]}},{key:'views',value:function(){var e=this.manager?this.manager.views:void 0;return e||[]}},{key:'handleLinks',value:function(e){var t=this;e&&e.on(N.EVENTS.CONTENTS.LINK_CLICKED,function(e){var n=t.book.path.relative(e);t.display(n)})}},{key:'injectStylesheet',value:function(e){var t=e.createElement('link');t.setAttribute('type','text/css'),t.setAttribute('rel','stylesheet'),t.setAttribute('href',this.settings.stylesheet),e.getElementsByTagName('head')[0].appendChild(t)}},{key:'injectScript',value:function(e){var t=e.createElement('script');t.setAttribute('type','text/javascript'),t.setAttribute('src',this.settings.script),t.textContent=' ',e.getElementsByTagName('head')[0].appendChild(t)}},{key:'injectIdentifier',value:function(e){var t=this.book.packaging.metadata.identifier,n=e.createElement('meta');n.setAttribute('name','dc.relation.ispartof'),t&&n.setAttribute('content',t),e.getElementsByTagName('head')[0].appendChild(n)}}]),e}();(0,l.default)(A.prototype),t.default=A,e.exports=t['default']},function(e,t,n){'use strict';function a(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var i=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(1),l=function(e){return e&&e.__esModule?e:{default:e}}(s),d=n(0),u=function(){function e(t,n,i,o){a(this,e),this.layout=t,this.horizontal='horizontal'===i,this.direction=n||'ltr',this._dev=o}return i(e,[{key:'section',value:function(e){var t=this.findRanges(e),n=this.rangeListToCfiList(e.section.cfiBase,t);return n}},{key:'page',value:function(e,t,n,a){var i=e&&e.document&&e.document.body,o;if(i){if(o=this.rangePairToCfiPair(t,{start:this.findStart(i,n,a),end:this.findEnd(i,n,a)}),!0===this._dev){var s=e.document,d=new l.default(o.start).toRange(s),u=new l.default(o.end).toRange(s),c=s.defaultView.getSelection(),p=s.createRange();c.removeAllRanges(),p.setStart(d.startContainer,d.startOffset),p.setEnd(u.endContainer,u.endOffset),c.addRange(p)}return o}}},{key:'walk',value:function(e,t){if(!(e&&e.nodeType===Node.TEXT_NODE)){var n={acceptNode:function(e){return 0<e.data.trim().length?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}},a=n.acceptNode;a.acceptNode=n.acceptNode;for(var i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,a,!1),o,r;(o=i.nextNode())&&(r=t(o),!r););return r}}},{key:'findRanges',value:function(e){for(var t=[],n=e.contents.scrollWidth(),a=o(n/this.layout.spreadWidth),r=a*this.layout.divisor,s=this.layout.columnWidth,l=this.layout.gap,d=0,i,u;d<r.pages;d++)i=(s+l)*d,u=s*(d+1)+l*d,t.push({start:this.findStart(e.document.body,i,u),end:this.findEnd(e.document.body,i,u)});return t}},{key:'findStart',value:function(e,t,n){for(var a=this,i=[e],o=e,r,s;i.length;)if(r=i.shift(),s=this.walk(r,function(e){var r,s,l,u,c;if(c=(0,d.nodeBounds)(e),a.horizontal&&'ltr'===a.direction){if(r=a.horizontal?c.left:c.top,s=a.horizontal?c.right:c.bottom,r>=t&&r<=n)return e;if(s>t)return e;o=e,i.push(e)}else if(a.horizontal&&'rtl'===a.direction){if(r=c.left,s=c.right,s<=n&&s>=t)return e;if(r<n)return e;o=e,i.push(e)}else{if(l=c.top,u=c.bottom,l>=t&&l<=n)return e;if(u>t)return e;o=e,i.push(e)}}),s)return this.findTextStartRange(s,t,n);return this.findTextStartRange(o,t,n)}},{key:'findEnd',value:function(e,t,n){for(var a=this,i=[e],o=e,s,l;i.length;)if(s=i.shift(),l=this.walk(s,function(e){var s,l,u,c,p;if(p=(0,d.nodeBounds)(e),a.horizontal&&'ltr'===a.direction){if(s=r(p.left),l=r(p.right),s>n&&o)return o;if(l>n)return e;o=e,i.push(e)}else if(a.horizontal&&'rtl'===a.direction){if(s=r(a.horizontal?p.left:p.top),l=r(a.horizontal?p.right:p.bottom),l<t&&o)return o;if(s<t)return e;o=e,i.push(e)}else{if(u=r(p.top),c=r(p.bottom),u>n&&o)return o;if(c>n)return e;o=e,i.push(e)}}),l)return this.findTextEndRange(l,t,n);return this.findTextEndRange(o,t,n)}},{key:'findTextStartRange',value:function(e,t,n){for(var a=this.splitTextNodeIntoRanges(e),o=0,i,r,s,l,d;o<a.length;o++)if(i=a[o],r=i.getBoundingClientRect(),this.horizontal&&'ltr'===this.direction){if(s=r.left,s>=t)return i;}else if(this.horizontal&&'rtl'===this.direction){if(d=r.right,d<=n)return i;}else if(l=r.top,l>=t)return i;return a[0]}},{key:'findTextEndRange',value:function(e,t,n){for(var a=this.splitTextNodeIntoRanges(e),o=0,i,r,s,l,d,u,c;o<a.length;o++){if(r=a[o],s=r.getBoundingClientRect(),this.horizontal&&'ltr'===this.direction){if(l=s.left,d=s.right,l>n&&i)return i;if(d>n)return r}else if(this.horizontal&&'rtl'===this.direction){if(l=s.left,d=s.right,d<t&&i)return i;if(l<t)return r}else{if(u=s.top,c=s.bottom,u>n&&i)return i;if(c>n)return r}i=r}return a[a.length-1]}},{key:'splitTextNodeIntoRanges',value:function(e,t){var n=[],a=e.textContent||'',i=a.trim(),o=e.ownerDocument,r=t||' ',s=i.indexOf(r),l;if(-1===s||e.nodeType!=Node.TEXT_NODE)return l=o.createRange(),l.selectNodeContents(e),[l];for(l=o.createRange(),l.setStart(e,0),l.setEnd(e,s),n.push(l),l=!1;-1!=s;)s=i.indexOf(r,s+1),0<s&&(l&&(l.setEnd(e,s),n.push(l)),l=o.createRange(),l.setStart(e,s+1));return l&&(l.setEnd(e,i.length),n.push(l)),n}},{key:'rangePairToCfiPair',value:function(e,t){var n=t.start,a=t.end;n.collapse(!0),a.collapse(!1);var i=new l.default(n,e).toString(),o=new l.default(a,e).toString();return{start:i,end:o}}},{key:'rangeListToCfiList',value:function(e,t){for(var n=[],a=0,i;a<t.length;a++)i=this.rangePairToCfiPair(e,t[a]),n.push(i);return n}},{key:'axis',value:function(e){return e&&(this.horizontal='horizontal'===e),this.horizontal}}]),e}();t.default=u,e.exports=t['default']},function(e,t,n){'use strict';function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var r=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(3),l=a(s),d=n(0),u=n(1),c=a(u),p=n(14),g=a(p),h=n(2),f=n(56),m=function(){function e(t,n){i(this,e),this.settings=(0,d.extend)({ignoreClass:'',axis:n.layout&&'scrolled'===n.layout.props.flow?'vertical':'horizontal',direction:void 0,width:0,height:0,layout:void 0,globalLayoutProperties:{},method:void 0},n||{}),this.id='epubjs-view-'+(0,d.uuid)(),this.section=t,this.index=t.index,this.element=this.container(this.settings.axis),this.added=!1,this.displayed=!1,this.rendered=!1,this.fixedWidth=0,this.fixedHeight=0,this.epubcfi=new c.default,this.layout=this.settings.layout,this.pane=void 0,this.highlights={},this.underlines={},this.marks={}}return r(e,[{key:'container',value:function(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.position='relative',t.style.display='block',t.style.flex=e&&'horizontal'==e?'none':'initial',t}},{key:'create',value:function(){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.iframe.setAttribute('enable-annotation','true'),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.setAttribute('ref',this.index),this.added=!0,this.elementBounds=(0,d.bounds)(this.element),this.supportsSrcdoc=!!('srcdoc'in this.iframe),this.settings.method||(this.settings.method=this.supportsSrcdoc?'srcdoc':'write'),this.iframe)}},{key:'render',value:function(e){return this.create(),this.size(),this.sectionRender||(this.sectionRender=this.section.render(e)),this.sectionRender.then(function(e){return this.load(e)}.bind(this)).then(function(){var e=this;this.layout.format(this.contents);var t=this.contents.writingMode(),n=0===t.indexOf('vertical')?'vertical':'horizontal';return this.setAxis(n),this.emit(h.EVENTS.VIEWS.AXIS,n),this.addListeners(),new Promise(function(t){e.expand(),t()})}.bind(this),function(t){return this.emit(h.EVENTS.VIEWS.LOAD_ERROR,t),new Promise(function(e,n){n(t)})}.bind(this)).then(function(){this.emit(h.EVENTS.VIEWS.RENDERED,this.section)}.bind(this))}},{key:'reset',value:function(){this.iframe&&(this.iframe.style.width='0',this.iframe.style.height='0',this._width=0,this._height=0,this._textWidth=void 0,this._contentWidth=void 0,this._textHeight=void 0,this._contentHeight=void 0),this._needsReframe=!0}},{key:'size',value:function(e,t){var n=e||this.settings.width,a=t||this.settings.height;'pre-paginated'===this.layout.name?this.lock('both',n,a):'horizontal'===this.settings.axis?this.lock('height',n,a):this.lock('width',n,a),this.settings.width=n,this.settings.height=a}},{key:'lock',value:function(e,t,n){var a=(0,d.borders)(this.element),i;i=this.iframe?(0,d.borders)(this.iframe):{width:0,height:0},'width'==e&&(0,d.isNumber)(t)&&(this.lockedWidth=t-a.width-i.width),'height'==e&&(0,d.isNumber)(n)&&(this.lockedHeight=n-a.height-i.height),'both'===e&&(0,d.isNumber)(t)&&(0,d.isNumber)(n)&&(this.lockedWidth=t-a.width-i.width,this.lockedHeight=n-a.height-i.height),this.displayed&&this.iframe&&this.expand()}},{key:'expand',value:function(){var e=this.lockedWidth,t=this.lockedHeight,n;!this.iframe||this._expanding||(this._expanding=!0,'pre-paginated'===this.layout.name?(e=this.layout.columnWidth,t=this.layout.height):'horizontal'===this.settings.axis?(e=this.contents.textWidth(),0<e%this.layout.pageWidth&&(e=o(e/this.layout.pageWidth)*this.layout.pageWidth),this.settings.forceEvenPages&&(n=e/this.layout.pageWidth,1<this.layout.divisor&&'reflowable'===this.layout.name&&0<n%2&&(e+=this.layout.pageWidth))):'vertical'===this.settings.axis&&(t=this.contents.textHeight()),(this._needsReframe||e!=this._width||t!=this._height)&&this.reframe(e,t),this._expanding=!1)}},{key:'reframe',value:function(e,t){var n=this,a;(0,d.isNumber)(e)&&(this.element.style.width=e+'px',this.iframe.style.width=e+'px',this._width=e),(0,d.isNumber)(t)&&(this.element.style.height=t+'px',this.iframe.style.height=t+'px',this._height=t);var i=this.prevBounds?e-this.prevBounds.width:e,o=this.prevBounds?t-this.prevBounds.height:t;a={width:e,height:t,widthDelta:i,heightDelta:o},this.pane&&this.pane.render(),requestAnimationFrame(function(){var e;for(var t in n.marks)n.marks.hasOwnProperty(t)&&(e=n.marks[t],n.placeMark(e.element,e.range))}),this.onResize(this,a),this.emit(h.EVENTS.VIEWS.RESIZED,a),this.prevBounds=a,this.elementBounds=(0,d.bounds)(this.element)}},{key:'load',value:function(e){var t=new d.defer,n=t.promise;if(!this.iframe)return t.reject(new Error('No Iframe Available')),n;if(this.iframe.onload=function(e){this.onLoad(e,t)}.bind(this),'blobUrl'===this.settings.method)this.blobUrl=(0,d.createBlobUrl)(e,'application/xhtml+xml'),this.iframe.src=this.blobUrl,this.element.appendChild(this.iframe);else if('srcdoc'===this.settings.method)this.iframe.srcdoc=e,this.element.appendChild(this.iframe);else{if(this.element.appendChild(this.iframe),this.document=this.iframe.contentDocument,!this.document)return t.reject(new Error('No Document Available')),n;this.iframe.contentDocument.open(),this.iframe.contentDocument.write(e),this.iframe.contentDocument.close()}return n}},{key:'onLoad',value:function(e,t){var n=this;this.window=this.iframe.contentWindow,this.document=this.iframe.contentDocument,this.contents=new g.default(this.document,this.document.body,this.section.cfiBase,this.section.index),this.rendering=!1;var a=this.document.querySelector('link[rel=\'canonical\']');a?a.setAttribute('href',this.section.canonical):(a=this.document.createElement('link'),a.setAttribute('rel','canonical'),a.setAttribute('href',this.section.canonical),this.document.querySelector('head').appendChild(a)),this.contents.on(h.EVENTS.CONTENTS.EXPAND,function(){n.displayed&&n.iframe&&(n.expand(),n.contents&&n.layout.format(n.contents))}),this.contents.on(h.EVENTS.CONTENTS.RESIZE,function(){n.displayed&&n.iframe&&(n.expand(),n.contents&&n.layout.format(n.contents))}),t.resolve(this.contents)}},{key:'setLayout',value:function(e){this.layout=e,this.contents&&(this.layout.format(this.contents),this.expand())}},{key:'setAxis',value:function(e){'scrolled'===this.layout.props.flow&&(e='vertical'),this.settings.axis=e,this.element.style.flex='horizontal'==e?'none':'initial',this.size()}},{key:'addListeners',value:function(){}},{key:'removeListeners',value:function(){}},{key:'display',value:function(e){var t=new d.defer;return this.displayed?t.resolve(this):this.render(e).then(function(){this.emit(h.EVENTS.VIEWS.DISPLAYED,this),this.onDisplayed(this),this.displayed=!0,t.resolve(this)}.bind(this),function(e){t.reject(e,this)}),t.promise}},{key:'show',value:function(){this.element.style.visibility='visible',this.iframe&&(this.iframe.style.visibility='visible',this.iframe.style.transform='translateZ(0)',this.iframe.offsetWidth,this.iframe.style.transform=null),this.emit(h.EVENTS.VIEWS.SHOWN,this)}},{key:'hide',value:function(){this.element.style.visibility='hidden',this.iframe.style.visibility='hidden',this.stopExpanding=!0,this.emit(h.EVENTS.VIEWS.HIDDEN,this)}},{key:'offset',value:function(){return{top:this.element.offsetTop,left:this.element.offsetLeft}}},{key:'width',value:function(){return this._width}},{key:'height',value:function(){return this._height}},{key:'position',value:function(){return this.element.getBoundingClientRect()}},{key:'locationOf',value:function(e){var t=this.iframe.getBoundingClientRect(),n=this.contents.locationOf(e,this.settings.ignoreClass);return{left:n.left,top:n.top}}},{key:'onDisplayed',value:function(){}},{key:'onResize',value:function(){}},{key:'bounds',value:function(e){return(e||!this.elementBounds)&&(this.elementBounds=(0,d.bounds)(this.element)),this.elementBounds}},{key:'highlight',value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2],a=this,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:'epubjs-hl',o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{};if(this.contents){var r=Object.assign({fill:'yellow',"fill-opacity":'0.3',"mix-blend-mode":'multiply'},o),s=this.contents.range(e),l=function(){a.emit(h.EVENTS.VIEWS.MARK_CLICKED,e,t)};t.epubcfi=e,this.pane||(this.pane=new f.Pane(this.iframe,this.element));var d=new f.Highlight(s,i,t,r),u=this.pane.addMark(d);return this.highlights[e]={mark:u,element:u.element,listeners:[l,n]},u.element.setAttribute('ref',i),u.element.addEventListener('click',l),u.element.addEventListener('touchstart',l),n&&(u.element.addEventListener('click',n),u.element.addEventListener('touchstart',n)),u}}},{key:'underline',value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2],a=this,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:'epubjs-ul',o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{};if(this.contents){var r=Object.assign({stroke:'black',"stroke-opacity":'0.3',"mix-blend-mode":'multiply'},o),s=this.contents.range(e),l=function(){a.emit(h.EVENTS.VIEWS.MARK_CLICKED,e,t)};t.epubcfi=e,this.pane||(this.pane=new f.Pane(this.iframe,this.element));var d=new f.Underline(s,i,t,r),u=this.pane.addMark(d);return this.underlines[e]={mark:u,element:u.element,listeners:[l,n]},u.element.setAttribute('ref',i),u.element.addEventListener('click',l),u.element.addEventListener('touchstart',l),n&&(u.element.addEventListener('click',n),u.element.addEventListener('touchstart',n)),u}}},{key:'mark',value:function(e){var t=this,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},a=arguments[2];if(this.contents){if(e in this.marks){var i=this.marks[e];return i}var o=this.contents.range(e);if(o){var r=o.commonAncestorContainer,s=1===r.nodeType?r:r.parentNode,l=function(){t.emit(h.EVENTS.VIEWS.MARK_CLICKED,e,n)};o.collapsed&&1===r.nodeType?(o=new Range,o.selectNodeContents(r)):o.collapsed&&(o=new Range,o.selectNodeContents(s));var d=this.document.createElement('a');return d.setAttribute('ref','epubjs-mk'),d.style.position='absolute',d.dataset.epubcfi=e,n&&Object.keys(n).forEach(function(e){d.dataset[e]=n[e]}),a&&(d.addEventListener('click',a),d.addEventListener('touchstart',a)),d.addEventListener('click',l),d.addEventListener('touchstart',l),this.placeMark(d,o),this.element.appendChild(d),this.marks[e]={element:d,range:o,listeners:[l,a]},s}}}},{key:'placeMark',value:function(e,t){var n,a,r;if('pre-paginated'===this.layout.name||'horizontal'!==this.settings.axis){var s=t.getBoundingClientRect();n=s.top,a=s.right}else for(var l=t.getClientRects(),d=void 0,u=0;u!=l.length;u++)d=l[u],(!r||d.left<r)&&(r=d.left,a=o(r/this.layout.props.pageWidth)*this.layout.props.pageWidth-this.layout.gap/2,n=d.top);e.style.top=n+'px',e.style.left=a+'px'}},{key:'unhighlight',value:function(e){var t;e in this.highlights&&(t=this.highlights[e],this.pane.removeMark(t.mark),t.listeners.forEach(function(e){e&&(t.element.removeEventListener('click',e),t.element.removeEventListener('touchstart',e))}),delete this.highlights[e])}},{key:'ununderline',value:function(e){var t;e in this.underlines&&(t=this.underlines[e],this.pane.removeMark(t.mark),t.listeners.forEach(function(e){e&&(t.element.removeEventListener('click',e),t.element.removeEventListener('touchstart',e))}),delete this.underlines[e])}},{key:'unmark',value:function(e){var t;e in this.marks&&(t=this.marks[e],this.element.removeChild(t.element),t.listeners.forEach(function(e){e&&(t.element.removeEventListener('click',e),t.element.removeEventListener('touchstart',e))}),delete this.marks[e])}},{key:'destroy',value:function(){for(var e in this.highlights)this.unhighlight(e);for(var t in this.underlines)this.ununderline(t);for(var n in this.marks)this.unmark(n);this.blobUrl&&(0,d.revokeBlobUrl)(this.blobUrl),this.displayed&&(this.displayed=!1,this.removeListeners(),this.contents.destroy(),this.stopExpanding=!0,this.element.removeChild(this.iframe),this.iframe=void 0,this.contents=void 0,this._textWidth=null,this._textHeight=null,this._width=null,this._height=null)}}]),e}();(0,l.default)(m.prototype),t.default=m,e.exports=t['default']},function(e,t,n){var a=n(16),o=n(61),r=n(63);e.exports=function(e,t,n){function l(t){var n=b,a=k;return b=k=void 0,m=t,E=e.apply(a,n),E}function d(e){return m=e,_=setTimeout(p,t),f?l(e):E}function u(e){var n=e-N,a=e-m,o=t-n;return y?i(o,x-a):o}function c(e){var n=e-N,a=e-m;return void 0==N||n>=t||0>n||y&&a>=x}function p(){var e=o();return c(e)?g(e):void(_=setTimeout(p,u(e)))}function g(e){return(_=void 0,v&&b)?l(e):(b=k=void 0,E)}function h(){var e=o(),n=c(e);if(b=arguments,k=this,N=e,n){if(void 0===_)return d(N);if(y)return _=setTimeout(p,t),l(N)}return void 0===_&&(_=setTimeout(p,t)),E}var m=0,f=!1,y=!1,v=!0,b,k,x,E,_,N;if('function'!=typeof e)throw new TypeError('Expected a function');return t=r(t)||0,a(n)&&(f=!!n.leading,y='maxWait'in n,x=y?s(r(n.maxWait)||0,t):x,v='trailing'in n?!!n.trailing:v),h.cancel=function(){void 0!==_&&clearTimeout(_),m=0,b=N=k=_=void 0},h.flush=function(){return void 0===_?E:g(o())},h}},function(e,t,n){var a=n(62),i='object'==typeof self&&self&&self.Object===Object&&self,o=a||i||Function('return this')();e.exports=o},function(e,t,n){var a=n(22),i=a.Symbol;e.exports=i},function(e,t,n){'use strict';function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}function r(e,t){if(!e)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return t&&('object'==typeof t||'function'==typeof t)?t:e}function s(e,t){if('function'!=typeof t&&null!==t)throw new TypeError('Super expression must either be null or a function, not '+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,'__esModule',{value:!0});var d='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&'function'==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?'symbol':typeof e},u=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),c=function e(t,n,a){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,a)}if('value'in i)return i.value;var r=i.get;return void 0===r?void 0:r.call(a)},p=n(0),g=n(15),h=i(g),m=n(70),f=i(m),y=n(2),v=n(21),b=i(v),k=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.name='continuous',n.settings=(0,p.extend)(n.settings||{},{infinite:!0,overflow:void 0,axis:void 0,flow:'scrolled',offset:500,offsetDelta:250,width:void 0,height:void 0,snap:!1,afterScrolledTimeout:10}),(0,p.extend)(n.settings,e.settings||{}),'undefined'!=e.settings.gap&&0===e.settings.gap&&(n.settings.gap=e.settings.gap),n.viewSettings={ignoreClass:n.settings.ignoreClass,axis:n.settings.axis,flow:n.settings.flow,layout:n.layout,width:0,height:0,forceEvenPages:!1},n.scrollTop=0,n.scrollLeft=0,n}return s(t,e),u(t,[{key:'display',value:function(e,t){return h.default.prototype.display.call(this,e,t).then(function(){return this.fill()}.bind(this))}},{key:'fill',value:function(e){var t=this,n=e||new p.defer;return this.q.enqueue(function(){return t.check()}).then(function(e){e?t.fill(n):n.resolve()}),n.promise}},{key:'moveTo',value:function(e){var t=0,n=0,a=0,i=0;this.isPaginated?(t=l(e.left/this.layout.delta)*this.layout.delta,a=t+this.settings.offsetDelta):(n=e.top,i=e.top+this.settings.offsetDelta),(0<t||0<n)&&this.scrollBy(t,n,!0)}},{key:'afterResized',value:function(e){this.emit(y.EVENTS.MANAGERS.RESIZE,e.section)}},{key:'removeShownListeners',value:function(e){e.onDisplayed=function(){}}},{key:'add',value:function(e){var t=this,n=this.createView(e);return this.views.append(n),n.on(y.EVENTS.VIEWS.RESIZED,function(){n.expanded=!0}),n.on(y.EVENTS.VIEWS.AXIS,function(e){t.updateAxis(e)}),n.onDisplayed=this.afterDisplayed.bind(this),n.onResize=this.afterResized.bind(this),n.display(this.request)}},{key:'append',value:function(e){var t=this,n=this.createView(e);return n.on(y.EVENTS.VIEWS.RESIZED,function(){n.expanded=!0}),n.on(y.EVENTS.VIEWS.AXIS,function(e){t.updateAxis(e)}),this.views.append(n),n.onDisplayed=this.afterDisplayed.bind(this),n}},{key:'prepend',value:function(e){var t=this,n=this.createView(e);return n.on(y.EVENTS.VIEWS.RESIZED,function(e){t.counter(e),n.expanded=!0}),n.on(y.EVENTS.VIEWS.AXIS,function(e){t.updateAxis(e)}),this.views.prepend(n),n.onDisplayed=this.afterDisplayed.bind(this),n}},{key:'counter',value:function(e){'vertical'===this.settings.axis?this.scrollBy(0,e.heightDelta,!0):this.scrollBy(e.widthDelta,0,!0)}},{key:'update',value:function(e){for(var t=this.bounds(),n=this.views.all(),a=n.length,o=[],r='undefined'==typeof e?this.settings.offset||0:e,s=new p.defer,l=[],d=0,i,u;d<a;d++)if(u=n[d],i=this.isVisible(u,r,r,t),!0===i){if(!u.displayed){var c=u.display(this.request).then(function(e){e.show()},function(){u.hide()});l.push(c)}else u.show();o.push(u)}else this.q.enqueue(u.destroy.bind(u)),clearTimeout(this.trimTimeout),this.trimTimeout=setTimeout(function(){this.q.enqueue(this.trim.bind(this))}.bind(this),250);return l.length?Promise.all(l).catch(function(e){s.reject(e)}):(s.resolve(),s.promise)}},{key:'check',value:function(e,t){var n=this,a=new p.defer,i=[],o='horizontal'===this.settings.axis,r=this.settings.offset||0;e&&o&&(r=e),t&&!o&&(r=t);var s=this._bounds,d='rtl'===this.settings.direction,u=o&&d?-1:1,c=o?this.scrollLeft:this.scrollTop*u,g=o?l(s.width):s.height,h=o?this.container.scrollWidth:this.container.scrollHeight,m=function(){var e=n.views.first(),t=e&&e.section.prev();t&&i.push(n.prepend(t))},f=function(){var e=n.views.last(),t=e&&e.section.next();t&&i.push(n.append(t))};c+g+r>=h&&(o&&d?m():f()),0>c-r&&(o&&d?f():m());var y=i.map(function(e){return e.displayed});return i.length?Promise.all(y).then(function(){if('pre-paginated'===n.layout.name&&n.layout.props.spread)return n.check()}).then(function(){return n.update(r)},function(e){return e}):(this.q.enqueue(function(){this.update()}.bind(this)),a.resolve(!1),a.promise)}},{key:'trim',value:function(){for(var e=new p.defer,t=this.views.displayed(),n=t[0],a=t[t.length-1],o=this.views.indexOf(n),r=this.views.indexOf(a),s=this.views.slice(0,o),l=this.views.slice(r+1),d=0;d<s.length-1;d++)this.erase(s[d],s);for(var i=1;i<l.length;i++)this.erase(l[i]);return e.resolve(),e.promise}},{key:'erase',value:function(e,t){var n,a;this.settings.fullsize?(n=window.scrollY,a=window.scrollX):(n=this.container.scrollTop,a=this.container.scrollLeft);var i=e.bounds();this.views.remove(e),t&&('vertical'===this.settings.axis?this.scrollTo(0,n-i.height,!0):this.scrollTo(a-l(i.width),0,!0))}},{key:'addEventListeners',value:function(){window.addEventListener('unload',function(){this.ignore=!0,this.destroy()}.bind(this)),this.addScrollListeners(),this.isPaginated&&this.settings.snap&&(this.snapper=new f.default(this,this.settings.snap&&'object'===d(this.settings.snap)&&this.settings.snap))}},{key:'addScrollListeners',value:function(){var e;this.tick=p.requestAnimationFrame,this.settings.fullsize?(this.prevScrollTop=window.scrollY,this.prevScrollLeft=window.scrollX):(this.prevScrollTop=this.container.scrollTop,this.prevScrollLeft=this.container.scrollLeft),this.scrollDeltaVert=0,this.scrollDeltaHorz=0,this.settings.fullsize?(e=window,this.scrollTop=window.scrollY,this.scrollLeft=window.scrollX):(e=this.container,this.scrollTop=this.container.scrollTop,this.scrollLeft=this.container.scrollLeft),this._onScroll=this.onScroll.bind(this),e.addEventListener('scroll',this._onScroll),this._scrolled=(0,b.default)(this.scrolled.bind(this),30),this.didScroll=!1}},{key:'removeEventListeners',value:function(){var e;e=this.settings.fullsize?window:this.container,e.removeEventListener('scroll',this._onScroll),this._onScroll=void 0}},{key:'onScroll',value:function(){var e=void 0,t=void 0,n='rtl'===this.settings.direction?-1:1;this.settings.fullsize?(e=window.scrollY*n,t=window.scrollX*n):(e=this.container.scrollTop,t=this.container.scrollLeft),this.scrollTop=e,this.scrollLeft=t,this.ignore?this.ignore=!1:this._scrolled(),this.scrollDeltaVert+=a(e-this.prevScrollTop),this.scrollDeltaHorz+=a(t-this.prevScrollLeft),this.prevScrollTop=e,this.prevScrollLeft=t,clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(function(){this.scrollDeltaVert=0,this.scrollDeltaHorz=0}.bind(this),150),clearTimeout(this.afterScrolled),this.didScroll=!1}},{key:'scrolled',value:function(){this.q.enqueue(function(){this.check()}.bind(this)),this.emit(y.EVENTS.MANAGERS.SCROLL,{top:this.scrollTop,left:this.scrollLeft}),clearTimeout(this.afterScrolled),this.afterScrolled=setTimeout(function(){this.snapper&&this.snapper.supportsTouch&&this.snapper.needsSnap()||this.emit(y.EVENTS.MANAGERS.SCROLLED,{top:this.scrollTop,left:this.scrollLeft})}.bind(this),this.settings.afterScrolledTimeout)}},{key:'next',value:function(){var e=this.settings.direction,t='pre-paginated'===this.layout.props.name&&this.layout.props.spread?2*this.layout.props.delta:this.layout.props.delta;this.views.length&&(this.isPaginated&&'horizontal'===this.settings.axis?this.scrollBy(t,0,!0):this.scrollBy(0,this.layout.height,!0),this.q.enqueue(function(){this.check()}.bind(this)))}},{key:'prev',value:function(){var e=this.settings.direction,t='pre-paginated'===this.layout.props.name&&this.layout.props.spread?2*this.layout.props.delta:this.layout.props.delta;this.views.length&&(this.isPaginated&&'horizontal'===this.settings.axis?this.scrollBy(-t,0,!0):this.scrollBy(0,-this.layout.height,!0),this.q.enqueue(function(){this.check()}.bind(this)))}},{key:'updateFlow',value:function(e){this.rendered&&this.snapper&&(this.snapper.destroy(),this.snapper=void 0),c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),'updateFlow',this).call(this,e,'scroll'),this.rendered&&this.isPaginated&&this.settings.snap&&(this.snapper=new f.default(this,this.settings.snap&&'object'===d(this.settings.snap)&&this.settings.snap))}},{key:'destroy',value:function(){c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),'destroy',this).call(this),this.snapper&&this.snapper.destroy()}}]),t}(h.default);t.default=k,e.exports=t['default']},function(e,t,n){'use strict';(function(a){function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){return new l.default(e,t)}Object.defineProperty(t,'__esModule',{value:!0});var s=n(26),l=o(s),d=n(18),u=o(d),c=n(1),p=o(c),g=n(14),h=o(g),m=n(0),f=i(m),y=n(2),v=n(76),b=i(v),k=n(20),x=o(k),E=n(15),_=o(E),N=n(24),S=o(N);r.VERSION=y.EPUBJS_VERSION,'undefined'!=typeof a&&(a.EPUBJS_VERSION=y.EPUBJS_VERSION),r.Book=l.default,r.Rendition=u.default,r.Contents=h.default,r.CFI=p.default,r.utils=f,t.default=r,e.exports=t['default']}).call(t,n(5))},function(e,t,n){'use strict';function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var o=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),r=n(3),s=a(r),l=n(0),d=n(6),u=a(d),c=n(4),p=a(c),g=n(43),h=a(g),m=n(47),f=a(m),y=n(48),v=a(y),b=n(49),k=a(b),x=n(50),E=a(x),_=n(51),N=a(_),S=n(52),w=a(S),T=n(18),C=a(T),R=n(71),I=a(R),A=n(9),L=a(A),O=n(1),D=a(O),P=n(73),z=a(P),M=n(75),B=a(M),j=n(2),q='META-INF/container.xml',U={BINARY:'binary',BASE64:'base64',EPUB:'epub',OPF:'opf',MANIFEST:'json',DIRECTORY:'directory'},V=function(){function e(t,n){var a=this;i(this,e),'undefined'==typeof n&&'string'!=typeof t&&!1==t instanceof Blob&&(n=t,t=void 0),this.settings=(0,l.extend)(this.settings||{},{requestMethod:void 0,requestCredentials:void 0,requestHeaders:void 0,encoding:void 0,replacements:void 0,canonical:void 0,openAs:void 0,store:void 0}),(0,l.extend)(this.settings,n),this.opening=new l.defer,this.opened=this.opening.promise,this.isOpen=!1,this.loading={manifest:new l.defer,spine:new l.defer,metadata:new l.defer,cover:new l.defer,navigation:new l.defer,pageList:new l.defer,resources:new l.defer,displayOptions:new l.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,displayOptions:this.loading.displayOptions.promise},this.ready=Promise.all([this.loaded.manifest,this.loaded.spine,this.loaded.metadata,this.loaded.cover,this.loaded.navigation,this.loaded.resources,this.loaded.displayOptions]),this.isRendered=!1,this.request=this.settings.requestMethod||L.default,this.spine=new h.default,this.locations=new f.default(this.spine,this.load.bind(this)),this.navigation=void 0,this.pageList=void 0,this.url=void 0,this.path=void 0,this.archived=!1,this.archive=void 0,this.storage=void 0,this.resources=void 0,this.rendition=void 0,this.container=void 0,this.packaging=void 0,this.displayOptions=void 0,this.settings.store&&this.store(this.settings.store),t&&this.open(t,this.settings.openAs).catch(function(){var e=new Error('Cannot load book at '+t);a.emit(j.EVENTS.BOOK.OPEN_FAILED,e)})}return o(e,[{key:'open',value:function(e,t){var n=t||this.determineType(e),a;return n===U.BINARY?(this.archived=!0,this.url=new u.default('/',''),a=this.openEpub(e)):n===U.BASE64?(this.archived=!0,this.url=new u.default('/',''),a=this.openEpub(e,n)):n===U.EPUB?(this.archived=!0,this.url=new u.default('/',''),a=this.request(e,'binary',this.settings.requestCredentials).then(this.openEpub.bind(this))):n==U.OPF?(this.url=new u.default(e),a=this.openPackaging(this.url.Path.toString())):n==U.MANIFEST?(this.url=new u.default(e),a=this.openManifest(this.url.Path.toString())):(this.url=new u.default(e),a=this.openContainer(q).then(this.openPackaging.bind(this))),a}},{key:'openEpub',value:function(e,t){var n=this;return this.unarchive(e,t||this.settings.encoding).then(function(){return n.openContainer(q)}).then(function(e){return n.openPackaging(e)})}},{key:'openContainer',value:function(e){var t=this;return this.load(e).then(function(e){return t.container=new v.default(e),t.resolve(t.container.packagePath)})}},{key:'openPackaging',value:function(e){var t=this;return this.path=new p.default(e),this.load(e).then(function(e){return t.packaging=new k.default(e),t.unpack(t.packaging)})}},{key:'openManifest',value:function(e){var t=this;return this.path=new p.default(e),this.load(e).then(function(e){return t.packaging=new k.default,t.packaging.load(e),t.unpack(t.packaging)})}},{key:'load',value:function(e){var t=this.resolve(e);return this.archived?this.archive.request(t):this.request(t,null,this.settings.requestCredentials,this.settings.requestHeaders)}},{key:'resolve',value:function(e,t){if(e){var n=e,a=-1<e.indexOf('://');return a?e:(this.path&&(n=this.path.resolve(e)),!1!=t&&this.url&&(n=this.url.resolve(n)),n)}}},{key:'canonical',value:function(e){var t=e;return e?(t=this.settings.canonical?this.settings.canonical(e):this.resolve(e,!0),t):''}},{key:'determineType',value:function(e){var t,n,a;return'base64'===this.settings.encoding?U.BASE64:'string'==typeof e?(t=new u.default(e),n=t.path(),a=n.extension,a?'epub'===a?U.EPUB:'opf'===a?U.OPF:'json'===a?U.MANIFEST:void 0:U.DIRECTORY):U.BINARY}},{key:'unpack',value:function(e){var t=this;this.package=e,''===this.packaging.metadata.layout?this.load(this.url.resolve('META-INF/com.apple.ibooks.display-options.xml')).then(function(e){t.displayOptions=new B.default(e),t.loading.displayOptions.resolve(t.displayOptions)}).catch(function(){t.displayOptions=new B.default,t.loading.displayOptions.resolve(t.displayOptions)}):(this.displayOptions=new B.default,this.loading.displayOptions.resolve(this.displayOptions)),this.spine.unpack(this.packaging,this.resolve.bind(this),this.canonical.bind(this)),this.resources=new N.default(this.packaging.manifest,{archive:this.archive,resolver:this.resolve.bind(this),request:this.request.bind(this),replacements:this.settings.replacements||(this.archived?'blobUrl':'base64')}),this.loadNavigation(this.packaging).then(function(){t.loading.navigation.resolve(t.navigation)}),this.packaging.coverPath&&(this.cover=this.resolve(this.packaging.coverPath)),this.loading.manifest.resolve(this.packaging.manifest),this.loading.metadata.resolve(this.packaging.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.settings.replacements&&'none'!=this.settings.replacements?this.replacements().then(function(){t.loaded.displayOptions.then(function(){t.opening.resolve(t)})}).catch(function(e){console.error(e)}):this.loaded.displayOptions.then(function(){t.opening.resolve(t)})}},{key:'loadNavigation',value:function(e){var t=this,n=e.navPath||e.ncxPath,a=e.toc;return a?new Promise(function(n){t.navigation=new E.default(a),e.pageList&&(t.pageList=new w.default(e.pageList)),n(t.navigation)}):n?this.load(n,'xml').then(function(e){return t.navigation=new E.default(e),t.pageList=new w.default(e),t.navigation}):new Promise(function(e){t.navigation=new E.default,t.pageList=new w.default,e(t.navigation)})}},{key:'section',value:function(e){return this.spine.get(e)}},{key:'renderTo',value:function(e,t){return this.rendition=new C.default(this,t),this.rendition.attachTo(e),this.rendition}},{key:'setRequestCredentials',value:function(e){this.settings.requestCredentials=e}},{key:'setRequestHeaders',value:function(e){this.settings.requestHeaders=e}},{key:'unarchive',value:function(e,t){return this.archive=new I.default,this.archive.open(e,t)}},{key:'store',value:function(e){var t=this,n=this.settings.replacements&&'none'!==this.settings.replacements,a=this.url,i=this.settings.requestMethod||L.default.bind(this);return this.storage=new z.default(e,i,this.resolve.bind(this)),this.request=this.storage.request.bind(this.storage),this.opened.then(function(){t.archived&&(t.storage.requester=t.archive.request.bind(t.archive));var e=function(e,n){n.output=t.resources.substitute(e,n.url)};t.resources.settings.replacements=n||'blobUrl',t.resources.replacements().then(function(){return t.resources.replaceCss()}),t.storage.on('offline',function(){t.url=new u.default('/',''),t.spine.hooks.serialize.register(e)}),t.storage.on('online',function(){t.url=a,t.spine.hooks.serialize.deregister(e)})}),this.storage}},{key:'coverUrl',value:function(){var e=this,t=this.loaded.cover.then(function(){return e.archived?e.resources.get(e.cover):e.cover});return t}},{key:'replacements',value:function(){var e=this;return this.spine.hooks.serialize.register(function(t,n){n.output=e.resources.substitute(t,n.url)}),this.resources.replacements().then(function(){return e.resources.replaceCss()})}},{key:'getRange',value:function(e){var t=new D.default(e),n=this.spine.get(t.spinePos),a=this.load.bind(this);return n?n.load(a).then(function(){var e=t.toRange(n.document);return e}):new Promise(function(e,t){t('CFI could not be found')})}},{key:'key',value:function(e){var t=e||this.packaging.metadata.identifier||this.url.filename;return'epubjs:'+j.EPUBJS_VERSION+':'+t}},{key:'destroy',value:function(){this.opened=void 0,this.loading=void 0,this.loaded=void 0,this.ready=void 0,this.isOpen=!1,this.isRendered=!1,this.spine&&this.spine.destroy(),this.locations&&this.locations.destroy(),this.pageList&&this.pageList.destroy(),this.archive&&this.archive.destroy(),this.resources&&this.resources.destroy(),this.container&&this.container.destroy(),this.packaging&&this.packaging.destroy(),this.rendition&&this.rendition.destroy(),this.displayOptions&&this.displayOptions.destroy(),this.spine=void 0,this.locations=void 0,this.pageList=void 0,this.archive=void 0,this.resources=void 0,this.container=void 0,this.packaging=void 0,this.rendition=void 0,this.navigation=void 0,this.url=void 0,this.path=void 0,this.archived=!1}}]),e}();(0,s.default)(V.prototype),t.default=V,e.exports=t['default']},function(e,t,n){'use strict';var a=n(28),i=n(36),o=n(37),r=n(38),s;s=e.exports=function(t,n){var o,s,l,d,u;return 2>arguments.length||'string'!=typeof t?(d=n,n=t,t=null):d=arguments[2],null==t?(o=l=!0,s=!1):(o=r.call(t,'c'),s=r.call(t,'e'),l=r.call(t,'w')),u={value:n,configurable:o,enumerable:s,writable:l},d?a(i(d),u):u},s.gs=function(t,n,s){var l,d,u,p;return'string'==typeof t?u=arguments[3]:(u=s,s=n,n=t,t=null),null==n?n=void 0:o(n)?null==s?s=void 0:!o(s)&&(u=s,s=void 0):(u=n,n=s=void 0),null==t?(l=!0,d=!1):(l=r.call(t,'c'),d=r.call(t,'e')),p={get:n,set:s,configurable:l,enumerable:d},u?a(i(u),p):p}},function(e,t,n){'use strict';e.exports=n(29)()?Object.assign:n(30)},function(e){'use strict';e.exports=function(){var e=Object.assign,t;return!('function'!=typeof e)&&(t={foo:'raz'},e(t,{bar:'dwa'},{trzy:'trzy'}),'razdwatrzy'===t.foo+t.bar+t.trzy)}},function(e,t,n){'use strict';var a=n(31),o=n(35);e.exports=function(e,t){var n=s(arguments.length,2),r,l,i;for(e=Object(o(e)),i=function(n){try{e[n]=t[n]}catch(t){r||(r=t)}},l=1;l<n;++l)t=arguments[l],a(t).forEach(i);if(r!==void 0)throw r;return e}},function(e,t,n){'use strict';e.exports=n(32)()?Object.keys:n(33)},function(e){'use strict';e.exports=function(){try{return Object.keys('primitive'),!0}catch(t){return!1}}},function(e,t,n){'use strict';var a=n(10),i=Object.keys;e.exports=function(e){return i(a(e)?Object(e):e)}},function(e){'use strict';e.exports=function(){}},function(e,t,n){'use strict';var a=n(10);e.exports=function(e){if(!a(e))throw new TypeError('Cannot use null or undefined');return e}},function(e,t,n){'use strict';var a=n(10),i=Array.prototype.forEach,o=Object.create,r=function(e,t){for(var n in e)t[n]=e[n]};e.exports=function(){var e=o(null);return i.call(arguments,function(t){a(t)&&r(Object(t),e)}),e}},function(e){'use strict';e.exports=function(e){return'function'==typeof e}},function(e,t,a){'use strict';e.exports=a(39)()?n.contains:a(40)},function(e){'use strict';var t='razdwatrzy';e.exports=function(){return!('function'!=typeof t.contains)&&!0===t.contains('dwa')&&!1===t.contains('foo')}},function(e){'use strict';var t=n.indexOf;e.exports=function(e){return-1<t.call(this,e,arguments[1])}},function(e){'use strict';e.exports=function(e){if('function'!=typeof e)throw new TypeError(e+' is not a function');return e}},function(t){t.exports=e},function(e,t,n){'use strict';function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var o=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),r=n(1),s=a(r),l=n(11),d=a(l),u=n(44),c=a(u),p=n(8),g=function(){function e(){i(this,e),this.spineItems=[],this.spineByHref={},this.spineById={},this.hooks={},this.hooks.serialize=new d.default,this.hooks.content=new d.default,this.hooks.content.register(p.replaceBase),this.hooks.content.register(p.replaceCanonical),this.hooks.content.register(p.replaceMeta),this.epubcfi=new s.default,this.loaded=!1,this.items=void 0,this.manifest=void 0,this.spineNodeIndex=void 0,this.baseUrl=void 0,this.length=void 0}return o(e,[{key:'unpack',value:function(e,t,n){var a=this;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(e,i){var o=a.manifest[e.idref],r;e.index=i,e.cfiBase=a.epubcfi.generateChapterComponent(a.spineNodeIndex,e.index,e.idref),e.href&&(e.url=t(e.href,!0),e.canonical=n(e.href)),o&&(e.href=o.href,e.url=t(e.href,!0),e.canonical=n(e.href),o.properties.length&&e.properties.push.apply(e.properties,o.properties)),'yes'===e.linear?(e.prev=function(){for(var t=e.index,n;0<t;){if(n=this.get(t-1),n&&n.linear)return n;t-=1}}.bind(a),e.next=function(){for(var t=e.index,n;t<this.spineItems.length-1;){if(n=this.get(t+1),n&&n.linear)return n;t+=1}}.bind(a)):(e.prev=function(){},e.next=function(){}),r=new c.default(e,a.hooks),a.append(r)}),this.loaded=!0}},{key:'get',value:function(e){var t=0;if('undefined'==typeof e)for(;t<this.spineItems.length;){var n=this.spineItems[t];if(n&&n.linear)break;t+=1}else if(this.epubcfi.isCfiString(e)){var a=new s.default(e);t=a.spinePos}else'number'==typeof e||!1===isNaN(e)?t=e:'string'==typeof e&&0===e.indexOf('#')?t=this.spineById[e.substring(1)]:'string'==typeof e&&(e=e.split('#')[0],t=this.spineByHref[e]||this.spineByHref[encodeURI(e)]);return this.spineItems[t]||null}},{key:'append',value:function(e){var t=this.spineItems.length;return e.index=t,this.spineItems.push(e),this.spineByHref[decodeURI(e.href)]=t,this.spineByHref[encodeURI(e.href)]=t,this.spineByHref[e.href]=t,this.spineById[e.idref]=t,t}},{key:'prepend',value:function(e){return this.spineByHref[e.href]=0,this.spineById[e.idref]=0,this.spineItems.forEach(function(e,t){e.index=t}),0}},{key:'remove',value:function(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)}},{key:'each',value:function(){return this.spineItems.forEach.apply(this.spineItems,arguments)}},{key:'first',value:function(){var e=0;do{var t=this.get(e);if(t&&t.linear)return t;e+=1}while(e<this.spineItems.length)}},{key:'last',value:function(){var e=this.spineItems.length-1;do{var t=this.get(e);if(t&&t.linear)return t;e-=1}while(0<=e)}},{key:'destroy',value:function(){this.each(function(e){return e.destroy()}),this.spineItems=void 0,this.spineByHref=void 0,this.spineById=void 0,this.hooks.serialize.clear(),this.hooks.content.clear(),this.hooks=void 0,this.epubcfi=void 0,this.loaded=!1,this.items=void 0,this.manifest=void 0,this.spineNodeIndex=void 0,this.baseUrl=void 0,this.length=void 0}}]),e}();t.default=g,e.exports=t['default']},function(e,t,n){'use strict';function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var o=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),r=n(0),s=n(1),l=a(s),d=n(11),u=a(d),c=n(8),p=function(){function e(t,n){i(this,e),this.idref=t.idref,this.linear='yes'===t.linear,this.properties=t.properties,this.index=t.index,this.href=t.href,this.url=t.url,this.canonical=t.canonical,this.next=t.next,this.prev=t.prev,this.cfiBase=t.cfiBase,n?this.hooks=n:(this.hooks={},this.hooks.serialize=new u.default(this),this.hooks.content=new u.default(this)),this.document=void 0,this.contents=void 0,this.output=void 0}return o(e,[{key:'load',value:function(e){var t=e||this.request||n(9),a=new r.defer,i=a.promise;return this.contents?a.resolve(this.contents):t(this.url).then(function(e){return this.document=e,this.contents=e.documentElement,this.hooks.content.trigger(this.document,this)}.bind(this)).then(function(){a.resolve(this.contents)}.bind(this)).catch(function(e){a.reject(e)}),i}},{key:'base',value:function(){return(0,c.replaceBase)(this.document,this)}},{key:'render',value:function(e){var t=new r.defer,a=t.promise;return this.output,this.load(e).then(function(e){var t='undefined'!=typeof navigator&&navigator.userAgent||'',a=0<=t.indexOf('Trident'),i;i='undefined'==typeof XMLSerializer||a?n(45).XMLSerializer:XMLSerializer;var o=new i;return this.output=o.serializeToString(e),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(e){t.reject(e)}),a}},{key:'find',value:function(e){var t=this,n=[],a=e.toLowerCase(),i=function(e){for(var i=e.textContent.toLowerCase(),o=t.document.createRange(),r=-1,s=150,l,d,u;-1!=d;)d=i.indexOf(a,r+1),-1!=d&&(o=t.document.createRange(),o.setStart(e,d),o.setEnd(e,d+a.length),l=t.cfiFromRange(o),e.textContent.length<s?u=e.textContent:(u=e.textContent.substring(d-s/2,d+s/2),u='...'+u+'...'),n.push({cfi:l,excerpt:u})),r=d};return(0,r.sprint)(t.document,function(e){i(e)}),n}},{key:'reconcileLayoutSettings',value:function(e){var t={layout:e.layout,spread:e.spread,orientation:e.orientation};return this.properties.forEach(function(e){var n=e.replace('rendition:',''),a=n.indexOf('-'),i,o;-1!=a&&(i=n.slice(0,a),o=n.slice(a+1),t[i]=o)}),t}},{key:'cfiFromRange',value:function(e){return new l.default(e,this.cfiBase).toString()}},{key:'cfiFromElement',value:function(e){return new l.default(e,this.cfiBase).toString()}},{key:'unload',value:function(){this.document=void 0,this.contents=void 0,this.output=void 0}},{key:'destroy',value:function(){this.unload(),this.hooks.serialize.clear(),this.hooks.content.clear(),this.hooks=void 0,this.idref=void 0,this.linear=void 0,this.properties=void 0,this.index=void 0,this.href=void 0,this.url=void 0,this.next=void 0,this.prev=void 0,this.cfiBase=void 0}}]),e}();t.default=p,e.exports=t['default']},function(e,t,n){function a(e){this.options=e||{locator:{}}}function i(e,t,n){function a(t){var a=e[t];!a&&r&&(a=2==e.length?function(n){e(t,n)}:e),i[t]=a&&function(e){a('[xmldom '+t+']\t'+e+s(n))}||function(){}}if(!e){if(t instanceof o)return t;e=t}var i={},r=e instanceof Function;return n=n||{},a('warning'),a('error'),a('fatalError'),i}function o(){this.cdata=!1}function r(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function s(e){if(e)return'\n@'+(e.systemId||'')+'#[line:'+e.lineNumber+',col:'+e.columnNumber+']'}function l(e,t,n){return'string'==typeof e?e.substr(t,n):e.length>=t+n||t?new java.lang.String(e,t,n)+'':e}function d(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}a.prototype.parseFromString=function(e,t){var n=this.options,a=new u,r=n.domBuilder||new o,s=n.errorHandler,l=n.locator,d=n.xmlns||{},c={lt:'<',gt:'>',amp:'&',quot:'"',apos:'\''};return l&&r.setDocumentLocator(l),a.errorHandler=i(s,r,l),a.domBuilder=n.domBuilder||r,/\/x?html?$/.test(t)&&(c.nbsp='\xA0',c.copy='\xA9',d['']='http://www.w3.org/1999/xhtml'),d.xml=d.xml||'http://www.w3.org/XML/1998/namespace',e?a.parse(e,d,c):a.errorHandler.error('invalid doc source'),r.doc},o.prototype={startDocument:function(){this.doc=new c().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,a){var o=this.doc,s=o.createElementNS(e,n||t),l=a.length;d(this,s),this.currentElement=s,this.locator&&r(this.locator,s);for(var u=0;u<l;u++){var e=a.getURI(u),i=a.getValue(u),n=a.getQName(u),c=o.createAttributeNS(e,n);this.locator&&r(a.getLocator(u),c),c.value=c.nodeValue=i,s.setAttributeNode(c)}},endElement:function(){var e=this.currentElement,t=e.tagName;this.currentElement=e.parentNode},startPrefixMapping:function(){},endPrefixMapping:function(){},processingInstruction:function(e,t){var n=this.doc.createProcessingInstruction(e,t);this.locator&&r(this.locator,n),d(this,n)},ignorableWhitespace:function(){},characters:function(e){if(e=l.apply(this,arguments),e){if(this.cdata)var t=this.doc.createCDATASection(e);else var t=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(t):/^\s*$/.test(e)&&this.doc.appendChild(t),this.locator&&r(this.locator,t)}},skippedEntity:function(){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e){e=l.apply(this,arguments);var t=this.doc.createComment(e);this.locator&&r(this.locator,t),d(this,t)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,n){var a=this.doc.implementation;if(a&&a.createDocumentType){var i=a.createDocumentType(e,t,n);this.locator&&r(this.locator,i),d(this,i)}},warning:function(e){console.warn('[xmldom warning]\t'+e,s(this.locator))},error:function(e){console.error('[xmldom error]\t'+e,s(this.locator))},fatalError:function(e){throw console.error('[xmldom fatalError]\t'+e,s(this.locator)),e}},'endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl'.replace(/\w+/g,function(e){o.prototype[e]=function(){return null}});var u=n(46).XMLReader,c=t.DOMImplementation=n(17).DOMImplementation;t.XMLSerializer=n(17).XMLSerializer,t.DOMParser=a},function(e,t){function n(){}function a(e,t,n,c,m){function f(e){var t=String.fromCharCode;if(65535<e){e-=65536;var n=55296+(e>>10),a=56320+(1023&e);return t(n,a)}return t(e)}function y(e){var t=e.slice(1,-1);return t in n?n[t]:'#'===t.charAt(0)?f(parseInt(t.substr(1).replace('x','0x'))):(m.error('entity not found:'+e),e)}function v(t){if(t>w){var n=e.substring(w,t).replace(/&#?\w+;/g,y);_&&b(w),c.characters(n,0,t-w),w=t}}function b(t,n){for(;t>=x&&(n=E.exec(e));)k=n.index,x=k+n[0].length,_.lineNumber++;_.columnNumber=t-k+1}for(var k=0,x=0,E=/.*(?:\r\n?|\n)|.*$/g,_=c.locator,N=[{currentNSMap:t}],S={},w=0;;){try{var T=e.indexOf('<',w);if(0>T){if(!e.substr(w).match(/^\s*$/)){var C=c.doc,R=C.createTextNode(e.substr(w));C.appendChild(R),c.currentElement=R}return}switch(T>w&&v(T),e.charAt(T+1)){case'/':var I=e.indexOf('>',T+3),A=e.substring(T+2,I),L=N.pop();0>I?(A=e.substring(T+2).replace(/[\s<].*/,''),m.error('end tag name: '+A+' is not complete:'+L.tagName),I=T+1+A.length):A.match(/\s</)&&(A=A.replace(/[\s<].*/,''),m.error('end tag name: '+A+' maybe not complete'),I=T+1+A.length);var O=L.localNSMap,D=L.tagName==A,P=D||L.tagName&&L.tagName.toLowerCase()==A.toLowerCase();if(P){if(c.endElement(L.uri,L.localName,A),O)for(var z in O)c.endPrefixMapping(z);D||m.fatalError('end tag name: '+A+' is not match the current start tagName:'+L.tagName)}else N.push(L);I++;break;case'?':_&&b(T),I=g(e,T,c);break;case'!':_&&b(T),I=p(e,T,c,m);break;default:_&&b(T);var M=new h,B=N[N.length-1].currentNSMap,I=r(e,T,M,B,y,m),j=M.length;if(!M.closed&&u(e,I,M.tagName,S)&&(M.closed=!0,!n.nbsp&&m.warning('unclosed xml attribute')),_&&j){for(var q=o(_,{}),U=0,i;U<j;U++)i=M[U],b(i.offset),i.locator=o(_,{});c.locator=q,l(M,c,B)&&N.push(M),c.locator=_}else l(M,c,B)&&N.push(M);'http://www.w3.org/1999/xhtml'!==M.uri||M.closed?I++:I=d(e,I,M.tagName,y,c);}}catch(t){m.error('element parse error: '+t),I=-1}I>w?w=I:v(s(T,w)+1)}}function o(e,n){return n.lineNumber=e.lineNumber,n.columnNumber=e.columnNumber,n}function r(e,t,n,a,i,o){for(var r=++t,l=b,s,d;;){var u=e.charAt(r);switch(u){case'=':if(l==k)s=e.slice(t,r),l=E;else if(l==x)l=E;else throw new Error('attribute equal must after attrName');break;case'\'':case'"':if(l==E||l==k){if(l==k&&(o.warning('attribute value must after "="'),s=e.slice(t,r)),t=r+1,r=e.indexOf(u,t),0<r)d=e.slice(t,r).replace(/&#?\w+;/g,i),n.add(s,d,t-1),l=N;else throw new Error('attribute value no end \''+u+'\' match');}else if(l==_)d=e.slice(t,r).replace(/&#?\w+;/g,i),n.add(s,d,t),o.warning('attribute "'+s+'" missed start quot('+u+')!!'),t=r+1,l=N;else throw new Error('attribute value must after "="');break;case'/':switch(l){case b:n.setTagName(e.slice(t,r));case N:case S:case w:l=w,n.closed=!0;case _:case k:case x:break;default:throw new Error('attribute invalid close char(\'/\')');}break;case'':return o.error('unexpected end of input'),l==b&&n.setTagName(e.slice(t,r)),r;case'>':switch(l){case b:n.setTagName(e.slice(t,r));case N:case S:case w:break;case _:case k:d=e.slice(t,r),'/'===d.slice(-1)&&(n.closed=!0,d=d.slice(0,-1));case x:l==x&&(d=s),l==_?(o.warning('attribute "'+d+'" missed quot(")!!'),n.add(s,d.replace(/&#?\w+;/g,i),t)):(('http://www.w3.org/1999/xhtml'!==a['']||!d.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+d+'" missed value!! "'+d+'" instead!!'),n.add(d,d,t));break;case E:throw new Error('attribute value missed!!');}return r;case'\x80':u=' ';default:if(' '>=u)switch(l){case b:n.setTagName(e.slice(t,r)),l=S;break;case k:s=e.slice(t,r),l=x;break;case _:var d=e.slice(t,r).replace(/&#?\w+;/g,i);o.warning('attribute "'+d+'" missed quot(")!!'),n.add(s,d,t);case N:l=S;}else switch(l){case x:n.tagName;'http://www.w3.org/1999/xhtml'===a['']&&s.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),n.add(s,s,t),t=r,l=k;break;case N:o.warning('attribute space is required"'+s+'"!!');case S:l=k,t=r;break;case E:l=_,t=r;break;case w:throw new Error('elements closed character \'/\' and \'>\' must be connected to');}}r++}}function l(e,t,n){for(var o=e.tagName,r=null,s=e.length;s--;){var i=e[s],a=i.qName,l=i.value,d=a.indexOf(':');if(0<d)var u=i.prefix=a.slice(0,d),p=a.slice(d+1),g='xmlns'===u&&p;else p=a,u=null,g='xmlns'===a&&'';i.localName=p,!1!==g&&(null==r&&(r={},c(n,n={})),n[g]=r[g]=l,i.uri='http://www.w3.org/2000/xmlns/',t.startPrefixMapping(g,l))}for(var s=e.length;s--;){i=e[s];var u=i.prefix;u&&('xml'===u&&(i.uri='http://www.w3.org/XML/1998/namespace'),'xmlns'!==u&&(i.uri=n[u||'']))}var d=o.indexOf(':');0<d?(u=e.prefix=o.slice(0,d),p=e.localName=o.slice(d+1)):(u=null,p=e.localName=o);var h=e.uri=n[u||''];if(t.startElement(h,p,o,e),!e.closed)return e.currentNSMap=n,e.localNSMap=r,!0;if(t.endElement(h,p,o),r)for(u in r)t.endPrefixMapping(u)}function d(e,t,n,a,i){if(/^(?:script|textarea)$/i.test(n)){var o=e.indexOf('</'+n+'>',t),r=e.substring(t+1,o);if(/[&<]/.test(r))return /^script$/i.test(n)?(i.characters(r,0,r.length),o):(r=r.replace(/&#?\w+;/g,a),i.characters(r,0,r.length),o)}return t+1}function u(e,t,n,a){var i=a[n];return null==i&&(i=e.lastIndexOf('</'+n+'>'),i<t&&(i=e.lastIndexOf('</'+n)),a[n]=i),i<t}function c(e,t){for(var a in e)t[a]=e[a]}function p(e,t,n,a){var i=e.charAt(t+2);switch(i){case'-':if('-'===e.charAt(t+3)){var o=e.indexOf('-->',t+4);return o>t?(n.comment(e,t+4,o-t-4),o+3):(a.error('Unclosed comment'),-1)}return-1;default:if('CDATA['==e.substr(t+3,6)){var o=e.indexOf(']]>',t+9);return n.startCDATA(),n.characters(e,t+9,o-t-9),n.endCDATA(),o+3}var r=m(e,t),s=r.length;if(1<s&&/!doctype/i.test(r[0][0])){var l=r[1][0],d=3<s&&/^public$/i.test(r[2][0])&&r[3][0],u=4<s&&r[4][0],c=r[s-1];return n.startDTD(l,d&&d.replace(/^(['"])(.*?)\1$/,'$2'),u&&u.replace(/^(['"])(.*?)\1$/,'$2')),n.endDTD(),c.index+c[0].length}}return-1}function g(e,t,n){var a=e.indexOf('?>',t);if(a){var i=e.substring(t,a).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(i){i[0].length;return n.processingInstruction(i[1],i[2]),a+2}return-1}return-1}function h(){}function i(e,t){return e.__proto__=t,e}function m(e,t){var n=[],a=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g,i;for(a.lastIndex=t,a.exec(e);i=a.exec(e);)if(n.push(i),i[1])return n}var f=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,y=new RegExp('[\\-\\.0-9'+f.source.slice(1,-1)+'\\u00B7\\u0300-\\u036F\\u203F-\\u2040]'),v=new RegExp('^'+f.source+y.source+'*(?::'+f.source+y.source+'*)?$'),b=0,k=1,x=2,E=3,_=4,N=5,S=6,w=7;n.prototype={parse:function(e,t,n){var i=this.domBuilder;i.startDocument(),c(t,t={}),a(e,t,n,i,this.errorHandler),i.endDocument()}},h.prototype={setTagName:function(e){if(!v.test(e))throw new Error('invalid tagName:'+e);this.tagName=e},add:function(e,t,n){if(!v.test(e))throw new Error('invalid attribute:'+e);this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},i({},i.prototype)instanceof i||(i=function(e,t){function n(){}for(t in n.prototype=t,n=new n,e)n[t]=e[t];return n}),t.XMLReader=n},function(e,t,n){'use strict';function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var r=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),l=n(12),d=a(l),u=n(1),c=a(u),p=n(2),g=n(3),h=a(g),m=function(){function e(t,n,a){i(this,e),this.spine=t,this.request=n,this.pause=a||100,this.q=new d.default(this),this.epubcfi=new c.default,this._locations=[],this.total=0,this.break=150,this._current=0,this.currentLocation='',this._currentCfi='',this.processingTimeout=void 0}return r(e,[{key:'generate',value:function(e){return e&&(this.break=e),this.q.pause(),this.spine.each(function(e){e.linear&&this.q.enqueue(this.process.bind(this),e)}.bind(this)),this.q.run().then(function(){return this.total=this._locations.length-1,this._currentCfi&&(this.currentLocation=this._currentCfi),this._locations}.bind(this))}},{key:'createRange',value:function(){return{startContainer:void 0,startOffset:void 0,endContainer:void 0,endOffset:void 0}}},{key:'process',value:function(e){return e.load(this.request).then(function(t){var n=new s.defer,a=this.parse(t,e.cfiBase);return this._locations=this._locations.concat(a),e.unload(),this.processingTimeout=setTimeout(function(){return n.resolve(a)},this.pause),n.promise}.bind(this))}},{key:'parse',value:function(e,t,n){var a=[],i=e.ownerDocument,o=(0,s.qs)(i,'body'),r=0,l=n||this.break,d,u;if((0,s.sprint)(o,function(e){var n=e.length,i=0,o;if(0===e.textContent.trim().length)return!1;for(0==r&&(d=this.createRange(),d.startContainer=e,d.startOffset=0),o=l-r,o>n&&(r+=n,i=n);i<n;)if(o=l-r,0===r&&(i+=1,d=this.createRange(),d.startContainer=e,d.startOffset=i),i+o>=n)r+=n-i,i=n;else{i+=o,d.endContainer=e,d.endOffset=i;var s=new c.default(d,t).toString();a.push(s),r=0}u=e}.bind(this)),d&&d.startContainer&&u){d.endContainer=u,d.endOffset=u.length;var p=new c.default(d,t).toString();a.push(p),r=0}return a}},{key:'locationFromCfi',value:function(e){var t;return(c.default.prototype.isCfiString(e)&&(e=new c.default(e)),0===this._locations.length)?-1:(t=(0,s.locationOf)(e,this._locations,this.epubcfi.compare),t>this.total?this.total:t)}},{key:'percentageFromCfi',value:function(e){if(0===this._locations.length)return null;var t=this.locationFromCfi(e);return this.percentageFromLocation(t)}},{key:'percentageFromLocation',value:function(e){return e&&this.total?e/this.total:0}},{key:'cfiFromLocation',value:function(e){var t=-1;return'number'!=typeof e&&(e=parseInt(e)),0<=e&&e<this._locations.length&&(t=this._locations[e]),t}},{key:'cfiFromPercentage',value:function(e){var t;if(1<e&&console.warn('Normalize cfiFromPercentage value to between 0 - 1'),1<=e){var n=new c.default(this._locations[this.total]);return n.collapse(),n.toString()}return t=o(this.total*e),this.cfiFromLocation(t)}},{key:'load',value:function(e){return this._locations='string'==typeof e?JSON.parse(e):e,this.total=this._locations.length-1,this._locations}},{key:'save',value:function(){return JSON.stringify(this._locations)}},{key:'getCurrent',value:function(){return this._current}},{key:'setCurrent',value:function(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(p.EVENTS.LOCATIONS.CHANGED,{percentage:this.percentageFromLocation(t)}))}},{key:'length',value:function(){return this._locations.length}},{key:'destroy',value:function(){this.spine=void 0,this.request=void 0,this.pause=void 0,this.q.stop(),this.q=void 0,this.epubcfi=void 0,this._locations=void 0,this.total=void 0,this.break=void 0,this._current=void 0,this.currentLocation=void 0,this._currentCfi=void 0,clearTimeout(this.processingTimeout)}},{key:'currentLocation',get:function(){return this._current},set:function(e){this.setCurrent(e)}}]),e}();(0,h.default)(m.prototype),t.default=m,e.exports=t['default']},function(e,t,n){'use strict';function a(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var i=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),o=n(7),r=function(e){return e&&e.__esModule?e:{default:e}}(o),s=n(0),l=function(){function e(t){a(this,e),this.packagePath='',this.directory='',this.encoding='',t&&this.parse(t)}return i(e,[{key:'parse',value:function(e){var t;if(!e)throw new Error('Container File Not Found');if(t=(0,s.qs)(e,'rootfile'),!t)throw new Error('No RootFile Found');this.packagePath=t.getAttribute('full-path'),this.directory=r.default.dirname(this.packagePath),this.encoding=e.xmlEncoding}},{key:'destroy',value:function(){this.packagePath=void 0,this.directory=void 0,this.encoding=void 0}}]),e}();t.default=l,e.exports=t['default']},function(e,t,n){'use strict';function a(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var i=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),o=n(0),r=function(){function e(t){a(this,e),this.manifest={},this.navPath='',this.ncxPath='',this.coverPath='',this.spineNodeIndex=0,this.spine=[],this.metadata={},t&&this.parse(t)}return i(e,[{key:'parse',value:function(e){var t,n,a;if(!e)throw new Error('Package File Not Found');if(t=(0,o.qs)(e,'metadata'),!t)throw new Error('No Metadata Found');if(n=(0,o.qs)(e,'manifest'),!n)throw new Error('No Manifest Found');if(a=(0,o.qs)(e,'spine'),!a)throw new Error('No Spine Found');return this.manifest=this.parseManifest(n),this.navPath=this.findNavPath(n),this.ncxPath=this.findNcxPath(n,a),this.coverPath=this.findCoverPath(e),this.spineNodeIndex=(0,o.indexOfElementNode)(a),this.spine=this.parseSpine(a,this.manifest),this.uniqueIdentifier=this.findUniqueIdentifier(e),this.metadata=this.parseMetadata(t),this.metadata.direction=a.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}}},{key:'parseMetadata',value:function(e){var t={title:this.getElementText(e,'title'),creator:this.getElementText(e,'creator'),description:this.getElementText(e,'description'),pubdate:this.getElementText(e,'date'),publisher:this.getElementText(e,'publisher'),identifier:this.getElementText(e,'identifier'),language:this.getElementText(e,'language'),rights:this.getElementText(e,'rights'),modified_date:this.getPropertyText(e,'dcterms:modified'),layout:this.getPropertyText(e,'rendition:layout'),orientation:this.getPropertyText(e,'rendition:orientation'),flow:this.getPropertyText(e,'rendition:flow'),viewport:this.getPropertyText(e,'rendition:viewport'),media_active_class:this.getPropertyText(e,'media:active-class')};return t}},{key:'parseManifest',value:function(e){var t={},n=(0,o.qsa)(e,'item'),a=Array.prototype.slice.call(n);return a.forEach(function(e){var n=e.getAttribute('id'),a=e.getAttribute('href')||'',i=e.getAttribute('media-type')||'',o=e.getAttribute('media-overlay')||'',r=e.getAttribute('properties')||'';t[n]={href:a,type:i,overlay:o,properties:r.length?r.split(' '):[]}}),t}},{key:'parseSpine',value:function(e){var t=[],n=(0,o.qsa)(e,'itemref'),a=Array.prototype.slice.call(n);return a.forEach(function(e,n){var a=e.getAttribute('idref'),i=e.getAttribute('properties')||'',o=i.length?i.split(' '):[],r={idref:a,linear:e.getAttribute('linear')||'yes',properties:o,index:n};t.push(r)}),t}},{key:'findUniqueIdentifier',value:function(e){var t=e.documentElement.getAttribute('unique-identifier');if(!t)return'';var n=e.getElementById(t);return n?'identifier'===n.localName&&'http://purl.org/dc/elements/1.1/'===n.namespaceURI?n.childNodes[0].nodeValue.trim():'':''}},{key:'findNavPath',value:function(e){var t=(0,o.qsp)(e,'item',{properties:'nav'});return!!t&&t.getAttribute('href')}},{key:'findNcxPath',value:function(e,t){var n=(0,o.qsp)(e,'item',{"media-type":'application/x-dtbncx+xml'}),a;return n||(a=t.getAttribute('toc'),a&&(n=e.querySelector('#'+a))),!!n&&n.getAttribute('href')}},{key:'findCoverPath',value:function(e){var t=(0,o.qs)(e,'package'),n=t.getAttribute('version');if('2.0'===n){var a=(0,o.qsp)(e,'meta',{name:'cover'});if(a){var i=a.getAttribute('content'),r=e.getElementById(i);return r?r.getAttribute('href'):''}return!1}var s=(0,o.qsp)(e,'item',{properties:'cover-image'});return s?s.getAttribute('href'):''}},{key:'getElementText',value:function(e,t){var n=e.getElementsByTagNameNS('http://purl.org/dc/elements/1.1/',t),a;return n&&0!==n.length?(a=n[0],a.childNodes.length?a.childNodes[0].nodeValue:''):''}},{key:'getPropertyText',value:function(e,t){var n=(0,o.qsp)(e,'meta',{property:t});return n&&n.childNodes.length?n.childNodes[0].nodeValue:''}},{key:'load',value:function(e){var t=this;this.metadata=e.metadata;var n=e.readingOrder||e.spine;return this.spine=n.map(function(e,t){return e.index=t,e.linear=e.linear||'yes',e}),e.resources.forEach(function(e,n){t.manifest[n]=e,e.rel&&'cover'===e.rel[0]&&(t.coverPath=e.href)}),this.spineNodeIndex=0,this.toc=e.toc.map(function(e){return e.label=e.title,e}),{metadata:this.metadata,spine:this.spine,manifest:this.manifest,navPath:this.navPath,ncxPath:this.ncxPath,coverPath:this.coverPath,spineNodeIndex:this.spineNodeIndex,toc:this.toc}}},{key:'destroy',value:function(){this.manifest=void 0,this.navPath=void 0,this.ncxPath=void 0,this.coverPath=void 0,this.spineNodeIndex=void 0,this.spine=void 0,this.metadata=void 0}}]),e}();t.default=r,e.exports=t['default']},function(e,t,n){'use strict';function a(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var i=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),o=n(0),r=function(){function e(t){a(this,e),this.toc=[],this.tocByHref={},this.tocById={},this.landmarks=[],this.landmarksByType={},this.length=0,t&&this.parse(t)}return i(e,[{key:'parse',value:function(e){var t=e.nodeType,n=void 0,a=void 0;t&&(n=(0,o.qs)(e,'html'),a=(0,o.qs)(e,'ncx')),t?n?(this.toc=this.parseNav(e),this.landmarks=this.parseLandmarks(e)):a&&(this.toc=this.parseNcx(e)):this.toc=this.load(e),this.length=0,this.unpack(this.toc)}},{key:'unpack',value:function(e){for(var t=0,n;t<e.length;t++)n=e[t],n.href&&(this.tocByHref[n.href]=t),n.id&&(this.tocById[n.id]=t),this.length++,n.subitems.length&&this.unpack(n.subitems)}},{key:'get',value:function(e){var t;return e?(0===e.indexOf('#')?t=this.tocById[e.substring(1)]:e in this.tocByHref&&(t=this.tocByHref[e]),this.toc[t]):this.toc}},{key:'landmark',value:function(e){var t;return e?(t=this.landmarksByType[e],this.landmarks[t]):this.landmarks}},{key:'parseNav',value:function(e){var t=(0,o.querySelectorByType)(e,'nav','toc'),n=t?(0,o.qsa)(t,'li'):[],a=n.length,r={},s=[],l,i,d;if(!n||0===a)return s;for(l=0;l<a;++l)i=this.navItem(n[l]),i&&(r[i.id]=i,i.parent?(d=r[i.parent],d.subitems.push(i)):s.push(i));return s}},{key:'navItem',value:function(e){var t=e.getAttribute('id')||void 0,n=(0,o.filterChildren)(e,'a',!0);if(n){var a=n.getAttribute('href')||'';t||(t=a);var i=n.textContent||'',r=(0,o.getParentByTagName)(e,'li'),s=void 0;if(r&&(s=r.getAttribute('id'),!s)){var l=(0,o.filterChildren)(r,'a',!0);s=l&&l.getAttribute('href')}for(;!s&&r;)if(r=(0,o.getParentByTagName)(r,'li'),r&&(s=r.getAttribute('id'),!s)){var d=(0,o.filterChildren)(r,'a',!0);s=d&&d.getAttribute('href')}return{id:t,href:a,label:i,subitems:[],parent:s}}}},{key:'parseLandmarks',value:function(e){var t=(0,o.querySelectorByType)(e,'nav','landmarks'),n=t?(0,o.qsa)(t,'li'):[],a=n.length,r=[],s,i;if(!n||0===a)return r;for(s=0;s<a;++s)i=this.landmarkItem(n[s]),i&&(r.push(i),this.landmarksByType[i.type]=s);return r}},{key:'landmarkItem',value:function(e){var t=(0,o.filterChildren)(e,'a',!0);if(t){var n=t.getAttributeNS('http://www.idpf.org/2007/ops','type')||void 0,a=t.getAttribute('href')||'',i=t.textContent||'';return{href:a,label:i,type:n}}}},{key:'parseNcx',value:function(e){var t=(0,o.qsa)(e,'navPoint'),n=t.length,a={},r=[],s,i,l;if(!t||0===n)return r;for(s=0;s<n;++s)i=this.ncxItem(t[s]),a[i.id]=i,i.parent?(l=a[i.parent],l.subitems.push(i)):r.push(i);return r}},{key:'ncxItem',value:function(e){var t=e.getAttribute('id')||!1,n=(0,o.qs)(e,'content'),a=n.getAttribute('src'),i=(0,o.qs)(e,'navLabel'),r=i.textContent?i.textContent:'',s=e.parentNode,l;return s&&('navPoint'===s.nodeName||'navPoint'===s.nodeName.split(':').slice(-1)[0])&&(l=s.getAttribute('id')),{id:t,href:a,label:r,subitems:[],parent:l}}},{key:'load',value:function(e){var t=this;return e.map(function(e){return e.label=e.title,e.subitems=e.children?t.load(e.children):[],e})}},{key:'forEach',value:function(e){return this.toc.forEach(e)}}]),e}();t.default=r,e.exports=t['default']},function(e,t,n){'use strict';function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var o=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),r=n(8),s=n(0),l=n(6),d=a(l),u=n(13),c=a(u),p=n(4),g=a(p),h=n(7),m=a(h),f=function(){function e(t,n){i(this,e),this.settings={replacements:n&&n.replacements||'base64',archive:n&&n.archive,resolver:n&&n.resolver,request:n&&n.request},this.process(t)}return o(e,[{key:'process',value:function(e){this.manifest=e,this.resources=Object.keys(e).map(function(t){return e[t]}),this.replacementUrls=[],this.html=[],this.assets=[],this.css=[],this.urls=[],this.cssUrls=[],this.split(),this.splitUrls()}},{key:'split',value:function(){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})}},{key:'splitUrls',value:function(){this.urls=this.assets.map(function(e){return e.href}.bind(this)),this.cssUrls=this.css.map(function(e){return e.href})}},{key:'createUrl',value:function(e){var t=new d.default(e),n=c.default.lookup(t.filename);return this.settings.archive?this.settings.archive.createUrl(e,{base64:'base64'===this.settings.replacements}):'base64'===this.settings.replacements?this.settings.request(e,'blob').then(function(e){return(0,s.blob2base64)(e)}).then(function(e){return(0,s.createBase64Url)(e,n)}):this.settings.request(e,'blob').then(function(e){return(0,s.createBlobUrl)(e,n)})}},{key:'replacements',value:function(){var e=this;if('none'===this.settings.replacements)return new Promise(function(e){e(this.urls)}.bind(this));var t=this.urls.map(function(t){var n=e.settings.resolver(t);return e.createUrl(n).catch(function(e){return console.error(e),null})});return Promise.all(t).then(function(t){return e.replacementUrls=t.filter(function(e){return'string'==typeof e}),t})}},{key:'replaceCss',value:function(e,t){var n=[];return e=e||this.settings.archive,t=t||this.settings.resolver,this.cssUrls.forEach(function(a){var i=this.createCssFile(a,e,t).then(function(e){var t=this.urls.indexOf(a);-1<t&&(this.replacementUrls[t]=e)}.bind(this));n.push(i)}.bind(this)),Promise.all(n)}},{key:'createCssFile',value:function(e){var t=this,n;if(m.default.isAbsolute(e))return new Promise(function(e){e()});var a=this.settings.resolver(e),i;i=this.settings.archive?this.settings.archive.getText(a):this.settings.request(a,'text');var o=this.urls.map(function(e){var n=t.settings.resolver(e),i=new g.default(a).relative(n);return i});return i?i.then(function(e){return e=(0,r.substitute)(e,o,t.replacementUrls),n='base64'===t.settings.replacements?(0,s.createBase64Url)(e,'text/css'):(0,s.createBlobUrl)(e,'text/css'),n},function(){return new Promise(function(e){e()})}):new Promise(function(e){e()})}},{key:'relativeTo',value:function(e,t){return t=t||this.settings.resolver,this.urls.map(function(n){var a=t(n),i=new g.default(e).relative(a);return i}.bind(this))}},{key:'get',value:function(e){var t=this.urls.indexOf(e);return-1===t?void 0:this.replacementUrls.length?new Promise(function(e){e(this.replacementUrls[t])}.bind(this)):this.createUrl(e)}},{key:'substitute',value:function(e,t){var n;return n=t?this.relativeTo(t):this.urls,(0,r.substitute)(e,n,this.replacementUrls)}},{key:'destroy',value:function(){this.settings=void 0,this.manifest=void 0,this.resources=void 0,this.replacementUrls=void 0,this.html=void 0,this.assets=void 0,this.css=void 0,this.urls=void 0,this.cssUrls=void 0}}]),e}();t.default=f,e.exports=t['default']},function(e,t,n){'use strict';function a(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var i=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),o=n(1),s=function(e){return e&&e.__esModule?e:{default:e}}(o),l=n(0),d=function(){function e(t){a(this,e),this.pages=[],this.locations=[],this.epubcfi=new s.default,this.firstPage=0,this.lastPage=0,this.totalPages=0,this.toc=void 0,this.ncx=void 0,t&&(this.pageList=this.parse(t)),this.pageList&&this.pageList.length&&this.process(this.pageList)}return i(e,[{key:'parse',value:function(e){var t=(0,l.qs)(e,'html'),n=(0,l.qs)(e,'ncx');return t?this.parseNav(e):void n}},{key:'parseNav',value:function(e){var t=(0,l.querySelectorByType)(e,'nav','page-list'),n=t?(0,l.qsa)(t,'li'):[],a=n.length,o=[],r,i;if(!n||0===a)return o;for(r=0;r<a;++r)i=this.item(n[r]),o.push(i);return o}},{key:'item',value:function(e){var t=(0,l.qs)(e,'a'),n=t.getAttribute('href')||'',a=t.textContent||'',i=parseInt(a),o=n.indexOf('epubcfi'),r,s,d;return-1==o?{href:n,page:i}:(r=n.split('#'),s=r[0],d=!!(1<r.length)&&r[1],{cfi:d,href:n,packageUrl:s,page:i})}},{key:'process',value:function(e){e.forEach(function(e){this.pages.push(e.page),e.cfi&&this.locations.push(e.cfi)},this),this.firstPage=parseInt(this.pages[0]),this.lastPage=parseInt(this.pages[this.pages.length-1]),this.totalPages=this.lastPage-this.firstPage}},{key:'pageFromCfi',value:function(e){var t=-1;if(0===this.locations.length)return-1;var n=(0,l.indexOfSorted)(e,this.locations,this.epubcfi.compare);return-1==n?(n=(0,l.locationOf)(e,this.locations,this.epubcfi.compare),t=0<=n-1?this.pages[n-1]:this.pages[0],void 0!==t||(t=-1)):t=this.pages[n],t}},{key:'cfiFromPage',value:function(e){var t=-1;'number'!=typeof e&&(e=parseInt(e));var n=this.pages.indexOf(e);return-1!=n&&(t=this.locations[n]),t}},{key:'pageFromPercentage',value:function(e){var t=r(this.totalPages*e);return t}},{key:'percentageFromPage',value:function(e){var t=(e-this.firstPage)/this.totalPages;return r(1e3*t)/1e3}},{key:'percentageFromCfi',value:function(e){var t=this.pageFromCfi(e),n=this.percentageFromPage(t);return n}},{key:'destroy',value:function(){this.pages=void 0,this.locations=void 0,this.epubcfi=void 0,this.pageList=void 0,this.toc=void 0,this.ncx=void 0}}]),e}();t.default=d,e.exports=t['default']},function(e,t,n){'use strict';function a(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var i=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),r=n(0),s=n(2),d=n(3),u=function(e){return e&&e.__esModule?e:{default:e}}(d),c=function(){function e(t){a(this,e),this.settings=t,this.name=t.layout||'reflowable',this._spread='none'!==t.spread,this._minSpreadWidth=t.minSpreadWidth||800,this._evenSpreads=t.evenSpreads||!1,this._flow='scrolled'===t.flow||'scrolled-continuous'===t.flow||'scrolled-doc'===t.flow?'scrolled':'paginated',this.width=0,this.height=0,this.spreadWidth=0,this.delta=0,this.columnWidth=0,this.gap=0,this.divisor=1,this.props={name:this.name,spread:this._spread,flow:this._flow,width:0,height:0,spreadWidth:0,delta:0,columnWidth:0,gap:0,divisor:1}}return i(e,[{key:'flow',value:function(e){return'undefined'!=typeof e&&(this._flow='scrolled'===e||'scrolled-continuous'===e||'scrolled-doc'===e?'scrolled':'paginated',this.update({flow:this._flow})),this._flow}},{key:'spread',value:function(e,t){return e&&(this._spread='none'!==e,this.update({spread:this._spread})),0<=t&&(this._minSpreadWidth=t),this._spread}},{key:'calculate',value:function(e,t,n){var a=1,i=n||0,o=e,r=t,s=l(o/12),d,u,c,p;a=this._spread&&o>=this._minSpreadWidth?2:1,'reflowable'!==this.name||'paginated'!==this._flow||0<=n||(i=0==s%2?s:s-1),'pre-paginated'===this.name&&(i=0),1<a?(d=o/a-i,c=d+i):(d=o,c=o),'pre-paginated'===this.name&&1<a&&(o=d),u=d*a+i,p=o,this.width=o,this.height=r,this.spreadWidth=u,this.pageWidth=c,this.delta=p,this.columnWidth=d,this.gap=i,this.divisor=a,this.update({width:o,height:r,spreadWidth:u,pageWidth:c,delta:p,columnWidth:d,gap:i,divisor:a})}},{key:'format',value:function(e){var t;return t='pre-paginated'===this.name?e.fit(this.columnWidth,this.height):'paginated'===this._flow?e.columns(this.width,this.height,this.columnWidth,this.gap):e.size(this.width,null),t}},{key:'count',value:function(e,t){var n,a;return'pre-paginated'===this.name?(n=1,a=1):'paginated'===this._flow?(t=t||this.delta,n=o(e/t),a=n*this.divisor):(t=t||this.height,n=o(e/t),a=n),{spreads:n,pages:a}}},{key:'update',value:function(e){var t=this;if(Object.keys(e).forEach(function(n){t.props[n]===e[n]&&delete e[n]}),0<Object.keys(e).length){var n=(0,r.extend)(this.props,e);this.emit(s.EVENTS.LAYOUT.UPDATED,n,e)}}}]),e}();(0,u.default)(c.prototype),t.default=c,e.exports=t['default']},function(e,t,n){'use strict';function a(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var i='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&'function'==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?'symbol':typeof e},o=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),r=n(6),s=function(e){return e&&e.__esModule?e:{default:e}}(r),l=function(){function e(t){a(this,e),this.rendition=t,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))}return o(e,[{key:'register',value:function(){return 0===arguments.length?void 0:1===arguments.length&&'object'===i(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'===i(arguments[1])?this.registerRules(arguments[0],arguments[1]):void 0}},{key:'default',value:function(e){return e?'string'==typeof e?this.registerUrl('default',e):'object'===('undefined'==typeof e?'undefined':i(e))?this.registerRules('default',e):void 0:void 0}},{key:'registerThemes',value:function(e){for(var t in e)e.hasOwnProperty(t)&&('string'==typeof e[t]?this.registerUrl(t,e[t]):this.registerRules(t,e[t]))}},{key:'registerUrl',value:function(e,t){var n=new s.default(t);this._themes[e]={url:n.toString()},this._injected[e]&&this.update(e)}},{key:'registerRules',value:function(e,t){this._themes[e]={rules:t},this._injected[e]&&this.update(e)}},{key:'select',value:function(e){var t=this._current,n;this._current=e,this.update(e),n=this.rendition.getContents(),n.forEach(function(n){n.removeClass(t),n.addClass(e)})}},{key:'update',value:function(e){var t=this,n=this.rendition.getContents();n.forEach(function(n){t.add(e,n)})}},{key:'inject',value:function(e){var t=[],n=this._themes,a;for(var i in n)n.hasOwnProperty(i)&&(i===this._current||'default'==i)&&(a=n[i],(a.rules&&0<Object.keys(a.rules).length||a.url&&-1===t.indexOf(a.url))&&this.add(i,e),this._injected.push(i));'default'!=this._current&&e.addClass(this._current)}},{key:'add',value:function(e,t){var n=this._themes[e];n&&t&&(n.url?t.addStylesheet(n.url):n.serialized||n.rules&&(t.addStylesheetRules(n.rules),n.injected=!0))}},{key:'override',value:function(e,t,n){var a=this,i=this.rendition.getContents();this._overrides[e]={value:t,priority:!0===n},i.forEach(function(t){t.css(e,a._overrides[e].value,a._overrides[e].priority)})}},{key:'overrides',value:function(e){var t=this._overrides;for(var n in t)t.hasOwnProperty(n)&&e.css(n,t[n].value,t[n].priority)}},{key:'fontSize',value:function(e){this.override('font-size',e)}},{key:'font',value:function(e){this.override('font-family',e,!0)}},{key:'destroy',value:function(){this.rendition=void 0,this._themes=void 0,this._overrides=void 0,this._current=void 0,this._injected=void 0}}]),e}();t.default=l,e.exports=t['default']},function(e,t,n){'use strict';function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var o=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),r=n(3),s=a(r),l=n(1),d=a(l),u=n(2),c=function(){function e(t){i(this,e),this.rendition=t,this.highlights=[],this.underlines=[],this.marks=[],this._annotations={},this._annotationsBySectionIndex={},this.rendition.hooks.render.register(this.inject.bind(this)),this.rendition.hooks.unloaded.register(this.clear.bind(this))}return o(e,[{key:'add',value:function(e,t,n,a,i,o){var r=encodeURI(t),s=new d.default(t),l=s.spinePos,u=new p({type:e,cfiRange:t,data:n,sectionIndex:l,cb:a,className:i,styles:o});this._annotations[r]=u,l in this._annotationsBySectionIndex?this._annotationsBySectionIndex[l].push(r):this._annotationsBySectionIndex[l]=[r];var c=this.rendition.views();return c.forEach(function(e){u.sectionIndex===e.index&&u.attach(e)}),u}},{key:'remove',value:function(e,t){var n=this,a=encodeURI(e);if(a in this._annotations){var i=this._annotations[a];if(t&&i.type!==t)return;var o=this.rendition.views();o.forEach(function(e){n._removeFromAnnotationBySectionIndex(i.sectionIndex,a),i.sectionIndex===e.index&&i.detach(e)}),delete this._annotations[a]}}},{key:'_removeFromAnnotationBySectionIndex',value:function(e,t){this._annotationsBySectionIndex[e]=this._annotationsAt(e).filter(function(e){return e!==t})}},{key:'_annotationsAt',value:function(e){return this._annotationsBySectionIndex[e]}},{key:'highlight',value:function(e,t,n,a,i){return this.add('highlight',e,t,n,a,i)}},{key:'underline',value:function(e,t,n,a,i){return this.add('underline',e,t,n,a,i)}},{key:'mark',value:function(e,t,n){return this.add('mark',e,t,n)}},{key:'each',value:function(){return this._annotations.forEach.apply(this._annotations,arguments)}},{key:'inject',value:function(e){var t=this,n=e.index;if(n in this._annotationsBySectionIndex){var a=this._annotationsBySectionIndex[n];a.forEach(function(n){var a=t._annotations[n];a.attach(e)})}}},{key:'clear',value:function(e){var t=this,n=e.index;if(n in this._annotationsBySectionIndex){var a=this._annotationsBySectionIndex[n];a.forEach(function(n){var a=t._annotations[n];a.detach(e)})}}},{key:'show',value:function(){}},{key:'hide',value:function(){}}]),e}(),p=function(){function e(t){var n=t.type,a=t.cfiRange,o=t.data,r=t.sectionIndex,s=t.cb,l=t.className,d=t.styles;i(this,e),this.type=n,this.cfiRange=a,this.data=o,this.sectionIndex=r,this.mark=void 0,this.cb=s,this.className=l,this.styles=d}return o(e,[{key:'update',value:function(e){this.data=e}},{key:'attach',value:function(e){var t=this.cfiRange,n=this.data,a=this.type,i=this.mark,o=this.cb,r=this.className,s=this.styles,l=void 0;return'highlight'===a?l=e.highlight(t,n,o,r,s):'underline'===a?l=e.underline(t,n,o,r,s):'mark'===a&&(l=e.mark(t,n,o)),this.mark=l,this.emit(u.EVENTS.ANNOTATION.ATTACH,l),l}},{key:'detach',value:function(e){var t=this.cfiRange,n=this.type,a=void 0;return e&&('highlight'===n?a=e.unhighlight(t):'underline'===n?a=e.ununderline(t):'mark'===n&&(a=e.unmark(t))),this.mark=void 0,this.emit(u.EVENTS.ANNOTATION.DETACH,a),a}},{key:'text',value:function(){}}]),e}();(0,s.default)(p.prototype),t.default=c,e.exports=t['default']},function(e,t,n){'use strict';function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!e)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return t&&('object'===('undefined'==typeof t?'undefined':u(t))||'function'==typeof t)?t:e}function o(e,t){if('function'!=typeof t&&null!==t)throw new TypeError('Super expression must either be null or a function, not '+('undefined'==typeof t?'undefined':u(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function r(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}function s(e,t){var n=t.getBoundingClientRect(),a=e.getBoundingClientRect();return{top:a.top-n.top,left:a.left-n.left,height:e.scrollHeight,width:e.scrollWidth}}function l(e,t){e.style.setProperty('top',t.top+'px','important'),e.style.setProperty('left',t.left+'px','important'),e.style.setProperty('height',t.height+'px','important'),e.style.setProperty('width',t.width+'px','important')}function d(e,t){return t.right<=e.right&&t.left>=e.left&&t.top>=e.top&&t.bottom<=e.bottom}var u='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&'function'==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?'symbol':typeof e};Object.defineProperty(t,'__esModule',{value:!0}),t.Underline=t.Highlight=t.Mark=t.Pane=void 0;var c=function e(t,n,a){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,a)}if('value'in i)return i.value;var r=i.get;return void 0===r?void 0:r.call(a)},p=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),g=n(57),h=a(g),m=n(58),f=a(m),y=t.Pane=function(){function e(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:document.body;r(this,e),this.target=t,this.element=h.default.createElement('svg'),this.marks=[],this.element.style.position='absolute',this.element.setAttribute('pointer-events','none'),f.default.proxyMouse(this.target,this.marks),this.container=n,this.container.appendChild(this.element),this.render()}return p(e,[{key:'addMark',value:function(e){var t=h.default.createElement('g');return this.element.appendChild(t),e.bind(t,this.container),this.marks.push(e),e.render(),e}},{key:'removeMark',value:function(e){var t=this.marks.indexOf(e);if(-1!==t){var n=e.unbind();this.element.removeChild(n),this.marks.splice(t,1)}}},{key:'render',value:function(){l(this.element,s(this.target,this.container));var e=!0,t=!1,n=void 0;try{for(var a=this.marks[Symbol.iterator](),i,o;!(e=(i=a.next()).done);e=!0)o=i.value,o.render()}catch(e){t=!0,n=e}finally{try{!e&&a.return&&a.return()}finally{if(t)throw n}}}}]),e}(),v=t.Mark=function(){function e(){r(this,e),this.element=null}return p(e,[{key:'bind',value:function(e,t){this.element=e,this.container=t}},{key:'unbind',value:function(){var e=this.element;return this.element=null,e}},{key:'render',value:function(){}},{key:'dispatchEvent',value:function(t){this.element&&this.element.dispatchEvent(t)}},{key:'getBoundingClientRect',value:function(){return this.element.getBoundingClientRect()}},{key:'getClientRects',value:function(){for(var e=[],t=this.element.firstChild;t;)e.push(t.getBoundingClientRect()),t=t.nextSibling;return e}},{key:'filteredRanges',value:function(){var e=Array.from(this.range.getClientRects());return e.filter(function(t){for(var n=0;n<e.length;n++){if(e[n]===t)return!0;var a=d(e[n],t);if(a)return!1}return!0})}}]),e}(),b=t.Highlight=function(e){function t(e,n,a,o){r(this,t);var s=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return s.range=e,s.className=n,s.data=a||{},s.attributes=o||{},s}return o(t,e),p(t,[{key:'bind',value:function(e,n){for(var a in c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),'bind',this).call(this,e,n),this.data)this.data.hasOwnProperty(a)&&(this.element.dataset[a]=this.data[a]);for(var a in this.attributes)this.attributes.hasOwnProperty(a)&&this.element.setAttribute(a,this.attributes[a]);this.className&&this.element.classList.add(this.className)}},{key:'render',value:function(){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(var e=this.element.ownerDocument.createDocumentFragment(),t=this.filteredRanges(),n=this.element.getBoundingClientRect(),a=this.container.getBoundingClientRect(),o=0,i=t.length;o<i;o++){var s=t[o],r=h.default.createElement('rect');r.setAttribute('x',s.left-n.left+a.left),r.setAttribute('y',s.top-n.top+a.top),r.setAttribute('height',s.height),r.setAttribute('width',s.width),e.appendChild(r)}this.element.appendChild(e)}}]),t}(v),k=t.Underline=function(e){function t(e,n,a,o){return r(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,a,o))}return o(t,e),p(t,[{key:'render',value:function(){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(var e=this.element.ownerDocument.createDocumentFragment(),t=this.filteredRanges(),n=this.element.getBoundingClientRect(),a=this.container.getBoundingClientRect(),o=0,i=t.length;o<i;o++){var s=t[o],r=h.default.createElement('rect');r.setAttribute('x',s.left-n.left+a.left),r.setAttribute('y',s.top-n.top+a.top),r.setAttribute('height',s.height),r.setAttribute('width',s.width),r.setAttribute('fill','none');var l=h.default.createElement('line');l.setAttribute('x1',s.left-n.left+a.left),l.setAttribute('x2',s.left-n.left+a.left+s.width),l.setAttribute('y1',s.top-n.top+a.top+s.height-1),l.setAttribute('y2',s.top-n.top+a.top+s.height-1),l.setAttribute('stroke-width',1),l.setAttribute('stroke','black'),l.setAttribute('stroke-linecap','square'),e.appendChild(r),e.appendChild(l)}this.element.appendChild(e)}}]),t}(b)},function(e,t){'use strict';function n(e){return document.createElementNS('http://www.w3.org/2000/svg',e)}Object.defineProperty(t,'__esModule',{value:!0}),t.createElement=n,t.default={createElement:n}},function(e,t){'use strict';function n(n,r){function t(s){for(var e=r.length-1;0<=e;e--){var i=r[e],t=s.clientX,l=s.clientY;if(s.touches&&s.touches.length&&(t=s.touches[0].clientX,l=s.touches[0].clientY),!!o(i,n,t,l)){i.dispatchEvent(a(s));break}}}if('iframe'===n.nodeName||'IFRAME'===n.nodeName)try{this.target=n.contentDocument}catch(e){this.target=n}else this.target=n;for(var e=['mouseup','mousedown','click','touchstart'],i=0,s;i<e.length;i++)s=e[i],this.target.addEventListener(s,function(n){return t(n)},!1)}function a(t){var e=Object.assign({},t,{bubbles:!1});try{return new MouseEvent(t.type,e)}catch(a){var n=document.createEvent('MouseEvents');return n.initMouseEvent(t.type,!1,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget),n}}function o(e,t,n,a){function o(e,t,n){var a=e.top-s.top,i=e.left-s.left,o=a+e.height,r=i+e.width;return a<=n&&i<=t&&o>n&&r>t}var s=t.getBoundingClientRect(),r=e.getBoundingClientRect();if(!o(r,n,a))return!1;for(var l=e.getClientRects(),d=0,i=l.length;d<i;d++)if(o(l[d],n,a))return!0;return!1}Object.defineProperty(t,'__esModule',{value:!0}),t.proxyMouse=n,t.clone=a,t.default={proxyMouse:n}},function(e,t,n){'use strict';function a(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var i=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),o=n(0),r=n(60),s=function(e){return e&&e.__esModule?e:{default:e}}(r),d=function(){function e(t){a(this,e),this.settings=t||{},this.id='epubjs-container-'+(0,o.uuid)(),this.container=this.create(this.settings),this.settings.hidden&&(this.wrapper=this.wrap(this.container))}return i(e,[{key:'create',value:function(e){var t=e.height,n=e.width,a=e.overflow||!1,i=e.axis||'vertical',r=e.direction;(0,o.extend)(this.settings,e),e.height&&(0,o.isNumber)(e.height)&&(t=e.height+'px'),e.width&&(0,o.isNumber)(e.width)&&(n=e.width+'px');var s=document.createElement('div');return s.id=this.id,s.classList.add('epub-container'),s.style.wordSpacing='0',s.style.lineHeight='0',s.style.verticalAlign='top',s.style.position='relative','horizontal'===i&&(s.style.display='flex',s.style.flexDirection='row',s.style.flexWrap='nowrap'),n&&(s.style.width=n),t&&(s.style.height=t),a&&('scroll'===a&&'vertical'===i?(s.style['overflow-y']=a,s.style['overflow-x']='hidden'):'scroll'===a&&'horizontal'===i?(s.style['overflow-y']='hidden',s.style['overflow-x']=a):s.style.overflow=a),r&&(s.dir=r,s.style.direction=r),r&&this.settings.fullsize&&(document.body.style.direction=r),s}},{key:'wrap',value:function(e){var t=document.createElement('div');return t.style.visibility='hidden',t.style.overflow='hidden',t.style.width='0',t.style.height='0',t.appendChild(e),t}},{key:'getElement',value:function(e){var t;if((0,o.isElement)(e)?t=e:'string'==typeof e&&(t=document.getElementById(e)),!t)throw new Error('Not an Element');return t}},{key:'attachTo',value:function(e){var t=this.getElement(e),n;if(t)return n=this.settings.hidden?this.wrapper:this.container,t.appendChild(n),this.element=t,t}},{key:'getContainer',value:function(){return this.container}},{key:'onResize',value:function(e){(0,o.isNumber)(this.settings.width)&&(0,o.isNumber)(this.settings.height)||(this.resizeFunc=(0,s.default)(e,50),window.addEventListener('resize',this.resizeFunc,!1))}},{key:'onOrientationChange',value:function(e){this.orientationChangeFunc=e,window.addEventListener('orientationchange',this.orientationChangeFunc,!1)}},{key:'size',value:function(e,t){var n=e||this.settings.width,a=t||this.settings.height,i;null===e?(i=this.element.getBoundingClientRect(),i.width&&(e=l(i.width),this.container.style.width=e+'px')):(0,o.isNumber)(e)?this.container.style.width=e+'px':this.container.style.width=e,null===t?(i=i||this.element.getBoundingClientRect(),i.height&&(t=i.height,this.container.style.height=t+'px')):(0,o.isNumber)(t)?this.container.style.height=t+'px':this.container.style.height=t,(0,o.isNumber)(e)||(e=this.container.clientWidth),(0,o.isNumber)(t)||(t=this.container.clientHeight),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};var r=(0,o.windowBounds)(),s=window.getComputedStyle(document.body),d={left:parseFloat(s['padding-left'])||0,right:parseFloat(s['padding-right'])||0,top:parseFloat(s['padding-top'])||0,bottom:parseFloat(s['padding-bottom'])||0};return n||(e=r.width-d.left-d.right),(!this.settings.fullsize||a)&&a||(t=r.height-d.top-d.bottom),{width:e-this.containerPadding.left-this.containerPadding.right,height:t-this.containerPadding.top-this.containerPadding.bottom}}},{key:'bounds',value:function(){var e;return'visible'!==this.container.style.overflow&&(e=this.container&&this.container.getBoundingClientRect()),e&&e.width&&e.height?e:(0,o.windowBounds)()}},{key:'getSheet',value:function(){var e=document.createElement('style');return e.appendChild(document.createTextNode('')),document.head.appendChild(e),e.sheet}},{key:'addStyleRules',value:function(e,t){var n='#'+this.id+' ',a='';this.sheet||(this.sheet=this.getSheet()),t.forEach(function(e){for(var t in e)e.hasOwnProperty(t)&&(a+=t+':'+e[t]+';')}),this.sheet.insertRule(n+e+' {'+a+'}',0)}},{key:'axis',value:function(e){'horizontal'===e?(this.container.style.display='flex',this.container.style.flexDirection='row',this.container.style.flexWrap='nowrap'):this.container.style.display='block',this.settings.axis=e}},{key:'direction',value:function(e){this.container&&(this.container.dir=e,this.container.style.direction=e),this.settings.fullsize&&(document.body.style.direction=e),this.settings.dir=e}},{key:'overflow',value:function(e){this.container&&('scroll'===e&&'vertical'===this.settings.axis?(this.container.style['overflow-y']=e,this.container.style['overflow-x']='hidden'):'scroll'===e&&'horizontal'===this.settings.axis?(this.container.style['overflow-y']='hidden',this.container.style['overflow-x']=e):this.container.style.overflow=e),this.settings.overflow=e}},{key:'destroy',value:function(){var e;this.element&&(e=this.settings.hidden?this.wrapper:this.container,this.element.contains(this.container)&&this.element.removeChild(this.container),window.removeEventListener('resize',this.resizeFunc),window.removeEventListener('orientationChange',this.orientationChangeFunc))}}]),e}();t.default=d,e.exports=t['default']},function(e,t,n){var a=n(21),i=n(16);e.exports=function(e,t,n){var o=!0,r=!0;if('function'!=typeof e)throw new TypeError('Expected a function');return i(n)&&(o='leading'in n?!!n.leading:o,r='trailing'in n?!!n.trailing:r),a(e,t,{leading:o,maxWait:t,trailing:r})}},function(e,t,n){var a=n(22);e.exports=function(){return a.Date.now()}},function(e,t,n){(function(t){var n='object'==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(t,n(5))},function(e,t,n){var a=n(16),i=n(64),o=0/0,r=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,d=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if('number'==typeof e)return e;if(i(e))return o;if(a(e)){var t='function'==typeof e.valueOf?e.valueOf():e;e=a(t)?t+'':t}if('string'!=typeof e)return 0===e?e:+e;e=e.replace(r,'');var n=l.test(e);return n||d.test(e)?u(e.slice(2),n?2:8):s.test(e)?o:+e}},function(e,t,n){var a=n(65),i=n(68);e.exports=function(e){return'symbol'==typeof e||i(e)&&a(e)=='[object Symbol]'}},function(e,t,n){var a=n(23),i=n(66),o=n(67),r=a?a.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?'[object Undefined]':'[object Null]':r&&r in Object(e)?i(e):o(e)}},function(e,t,n){var a=n(23),i=Object.prototype,o=i.hasOwnProperty,r=i.toString,s=a?a.toStringTag:void 0;e.exports=function(e){var t=o.call(e,s),n=e[s];try{e[s]=void 0}catch(t){}var a=r.call(e);return t?e[s]=n:delete e[s],a}},function(e){var t=Object.prototype,n=t.toString;e.exports=function(e){return n.call(e)}},function(e){e.exports=function(e){return null!=e&&'object'==typeof e}},function(e,t){'use strict';function n(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var a=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=function(){function e(t){n(this,e),this.container=t,this._views=[],this.length=0,this.hidden=!1}return a(e,[{key:'all',value:function(){return this._views}},{key:'first',value:function(){return this._views[0]}},{key:'last',value:function(){return this._views[this._views.length-1]}},{key:'indexOf',value:function(e){return this._views.indexOf(e)}},{key:'slice',value:function(){return this._views.slice.apply(this._views,arguments)}},{key:'get',value:function(e){return this._views[e]}},{key:'append',value:function(e){return this._views.push(e),this.container&&this.container.appendChild(e.element),this.length++,e}},{key:'prepend',value:function(e){return this._views.unshift(e),this.container&&this.container.insertBefore(e.element,this.container.firstChild),this.length++,e}},{key:'insert',value:function(e,t){return this._views.splice(t,0,e),this.container&&(t<this.container.children.length?this.container.insertBefore(e.element,this.container.children[t]):this.container.appendChild(e.element)),this.length++,e}},{key:'remove',value:function(e){var t=this._views.indexOf(e);-1<t&&this._views.splice(t,1),this.destroy(e),this.length--}},{key:'destroy',value:function(e){e.displayed&&e.destroy(),this.container&&this.container.removeChild(e.element),e=null}},{key:'forEach',value:function(){return this._views.forEach.apply(this._views,arguments)}},{key:'clear',value:function(){var e=this.length,t;if(this.length){for(var n=0;n<e;n++)t=this._views[n],this.destroy(t);this._views=[],this.length=0}}},{key:'find',value:function(e){for(var t=this.length,n=0,a;n<t;n++)if(a=this._views[n],a.displayed&&a.section.index==e.index)return a}},{key:'displayed',value:function(){for(var e=[],t=this.length,n=0,a;n<t;n++)a=this._views[n],a.displayed&&e.push(a);return e}},{key:'show',value:function(){for(var e=this.length,t=0,n;t<e;t++)n=this._views[t],n.displayed&&n.show();this.hidden=!1}},{key:'hide',value:function(){for(var e=this.length,t=0,n;t<e;t++)n=this._views[t],n.displayed&&n.hide();this.hidden=!0}}]),e}();t.default=i,e.exports=t['default']},function(e,t,n){'use strict';function o(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}var s=Math.pow,l=Math.PI;Object.defineProperty(t,'__esModule',{value:!0});var d=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),c=n(2),p=n(3),g=function(e){return e&&e.__esModule?e:{default:e}}(p),h={easeOutSine:function(e){return Math.sin(e*(l/2))},easeInOutSine:function(e){return-0.5*(Math.cos(l*e)-1)},easeInOutQuint:function(e){return 1>(e/=0.5)?0.5*s(e,5):0.5*(s(e-2,5)+2)},easeInCubic:function(e){return s(e,3)}},m=function(){function e(t,n){o(this,e),this.settings=(0,u.extend)({duration:80,minVelocity:0.2,minDistance:10,easing:h.easeInCubic},n||{}),this.supportsTouch=this.supportsTouch(),this.supportsTouch&&this.setup(t)}return d(e,[{key:'setup',value:function(e){this.manager=e,this.layout=this.manager.layout,this.fullsize=this.manager.settings.fullsize,this.fullsize?(this.element=this.manager.stage.element,this.scroller=window,this.disableScroll()):(this.element=this.manager.stage.container,this.scroller=this.element,this.element.style.WebkitOverflowScrolling='touch'),this.manager.settings.offset=this.layout.width,this.manager.settings.afterScrolledTimeout=2*this.settings.duration,this.isVertical='vertical'===this.manager.settings.axis,!this.manager.isPaginated||this.isVertical||(this.touchCanceler=!1,this.resizeCanceler=!1,this.snapping=!1,this.scrollLeft,this.scrollTop,this.startTouchX=void 0,this.startTouchY=void 0,this.startTime=void 0,this.endTouchX=void 0,this.endTouchY=void 0,this.endTime=void 0,this.addListeners())}},{key:'supportsTouch',value:function(){return'ontouchstart'in window||window.DocumentTouch&&document instanceof DocumentTouch}},{key:'disableScroll',value:function(){this.element.style.overflow='hidden'}},{key:'enableScroll',value:function(){this.element.style.overflow=''}},{key:'addListeners',value:function(){this._onResize=this.onResize.bind(this),window.addEventListener('resize',this._onResize),this._onScroll=this.onScroll.bind(this),this.scroller.addEventListener('scroll',this._onScroll),this._onTouchStart=this.onTouchStart.bind(this),this.scroller.addEventListener('touchstart',this._onTouchStart,{passive:!0}),this.on('touchstart',this._onTouchStart),this._onTouchMove=this.onTouchMove.bind(this),this.scroller.addEventListener('touchmove',this._onTouchMove,{passive:!0}),this.on('touchmove',this._onTouchMove),this._onTouchEnd=this.onTouchEnd.bind(this),this.scroller.addEventListener('touchend',this._onTouchEnd,{passive:!0}),this.on('touchend',this._onTouchEnd),this._afterDisplayed=this.afterDisplayed.bind(this),this.manager.on(c.EVENTS.MANAGERS.ADDED,this._afterDisplayed)}},{key:'removeListeners',value:function(){window.removeEventListener('resize',this._onResize),this._onResize=void 0,this.scroller.removeEventListener('scroll',this._onScroll),this._onScroll=void 0,this.scroller.removeEventListener('touchstart',this._onTouchStart,{passive:!0}),this.off('touchstart',this._onTouchStart),this._onTouchStart=void 0,this.scroller.removeEventListener('touchmove',this._onTouchMove,{passive:!0}),this.off('touchmove',this._onTouchMove),this._onTouchMove=void 0,this.scroller.removeEventListener('touchend',this._onTouchEnd,{passive:!0}),this.off('touchend',this._onTouchEnd),this._onTouchEnd=void 0,this.manager.off(c.EVENTS.MANAGERS.ADDED,this._afterDisplayed),this._afterDisplayed=void 0}},{key:'afterDisplayed',value:function(e){var t=this,n=e.contents;['touchstart','touchmove','touchend'].forEach(function(a){n.on(a,function(e){return t.triggerViewEvent(e,n)})})}},{key:'triggerViewEvent',value:function(t,e){this.emit(t.type,t,e)}},{key:'onScroll',value:function(){this.scrollLeft=this.fullsize?window.scrollX:this.scroller.scrollLeft,this.scrollTop=this.fullsize?window.scrollY:this.scroller.scrollTop}},{key:'onResize',value:function(){this.resizeCanceler=!0}},{key:'onTouchStart',value:function(t){var e=t.touches[0],n=e.screenX,a=e.screenY;this.fullsize&&this.enableScroll(),this.touchCanceler=!0,this.startTouchX||(this.startTouchX=n,this.startTouchY=a,this.startTime=this.now()),this.endTouchX=n,this.endTouchY=a,this.endTime=this.now()}},{key:'onTouchMove',value:function(t){var e=t.touches[0],n=e.screenX,i=e.screenY,o=a(i-this.endTouchY);this.touchCanceler=!0,!this.fullsize&&10>o&&(this.element.scrollLeft-=n-this.endTouchX),this.endTouchX=n,this.endTouchY=i,this.endTime=this.now()}},{key:'onTouchEnd',value:function(){this.fullsize&&this.disableScroll(),this.touchCanceler=!1;var e=this.wasSwiped();0===e?this.snap():this.snap(e),this.startTouchX=void 0,this.startTouchY=void 0,this.startTime=void 0,this.endTouchX=void 0,this.endTouchY=void 0,this.endTime=void 0}},{key:'wasSwiped',value:function(){var e=this.layout.pageWidth*this.layout.divisor,t=this.endTouchX-this.startTouchX,n=a(t),i=this.endTime-this.startTime,o=t/i,r=this.settings.minVelocity;return n<=this.settings.minDistance||n>=e?0:o>r?-1:o<-r?1:void 0}},{key:'needsSnap',value:function(){var e=this.scrollLeft,t=this.layout.pageWidth*this.layout.divisor;return 0!=e%t}},{key:'snap',value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=this.scrollLeft,n=this.layout.pageWidth*this.layout.divisor,a=r(t/n)*n;return e&&(a+=e*n),this.smoothScrollTo(a)}},{key:'smoothScrollTo',value:function(e){function t(){var l=this.now(),d=i(1,(l-o)/r),u=s(d);return this.touchCanceler||this.resizeCanceler?(this.resizeCanceler=!1,this.snapping=!1,void n.resolve()):void(1>d?(window.requestAnimationFrame(t.bind(this)),this.scrollTo(a+(e-a)*d,0)):(this.scrollTo(e,0),this.snapping=!1,n.resolve()))}var n=new u.defer,a=this.scrollLeft,o=this.now(),r=this.settings.duration,s=this.settings.easing;return this.snapping=!0,t.call(this),n.promise}},{key:'scrollTo',value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;this.fullsize?window.scroll(e,t):(this.scroller.scrollLeft=e,this.scroller.scrollTop=t)}},{key:'now',value:function(){return'now'in window.performance?performance.now():new Date().getTime()}},{key:'destroy',value:function(){this.scroller&&(this.fullsize&&this.enableScroll(),this.removeListeners(),this.scroller=void 0)}}]),e}();(0,g.default)(m.prototype),t.default=m,e.exports=t['default']},function(e,t,n){'use strict';function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var o=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),r=n(9),l=a(r),d=n(13),u=a(d),c=n(4),p=a(c),g=function(){function e(){i(this,e),this.zip=void 0,this.urlCache={},this.checkRequirements()}return o(e,[{key:'checkRequirements',value:function(){try{if('undefined'==typeof JSZip){var e=n(72);this.zip=new e}else this.zip=new JSZip}catch(t){throw new Error('JSZip lib not loaded')}}},{key:'open',value:function(e,t){return this.zip.loadAsync(e,{base64:t})}},{key:'openUrl',value:function(e,t){return(0,l.default)(e,'binary').then(function(e){return this.zip.loadAsync(e,{base64:t})}.bind(this))}},{key:'request',value:function(e,t){var n=new s.defer,a=new p.default(e),i;return t||(t=a.extension),i='blob'==t?this.getBlob(e):this.getText(e),i?i.then(function(e){var a=this.handleResponse(e,t);n.resolve(a)}.bind(this)):n.reject({message:'File not found in the epub: '+e,stack:new Error().stack}),n.promise}},{key:'handleResponse',value:function(e,t){var n;return n='json'==t?JSON.parse(e):(0,s.isXml)(t)?(0,s.parse)(e,'text/xml'):'xhtml'==t?(0,s.parse)(e,'application/xhtml+xml'):'html'==t||'htm'==t?(0,s.parse)(e,'text/html'):e,n}},{key:'getBlob',value:function(e,t){var n=window.decodeURIComponent(e.substr(1)),a=this.zip.file(n);if(a)return t=t||u.default.lookup(a.name),a.async('uint8array').then(function(e){return new Blob([e],{type:t})})}},{key:'getText',value:function(e){var t=window.decodeURIComponent(e.substr(1)),n=this.zip.file(t);if(n)return n.async('string').then(function(e){return e})}},{key:'getBase64',value:function(e,t){var n=window.decodeURIComponent(e.substr(1)),a=this.zip.file(n);if(a)return t=t||u.default.lookup(a.name),a.async('base64').then(function(e){return'data:'+t+';base64,'+e})}},{key:'createUrl',value:function(e,t){var n=new s.defer,a=window.URL||window.webkitURL||window.mozURL,i=t&&t.base64,o,r;return e in this.urlCache?(n.resolve(this.urlCache[e]),n.promise):(i?(r=this.getBase64(e),r&&r.then(function(t){this.urlCache[e]=t,n.resolve(t)}.bind(this))):(r=this.getBlob(e),r&&r.then(function(t){o=a.createObjectURL(t),this.urlCache[e]=o,n.resolve(o)}.bind(this))),r||n.reject({message:'File not found in the epub: '+e,stack:new Error().stack}),n.promise)}},{key:'revokeUrl',value:function(e){var t=window.URL||window.webkitURL||window.mozURL,n=this.urlCache[e];n&&t.revokeObjectURL(n)}},{key:'destroy',value:function(){var e=window.URL||window.webkitURL||window.mozURL;for(var t in this.urlCache)e.revokeObjectURL(t);this.zip=void 0,this.urlCache={}}}]),e}();t.default=g,e.exports=t['default']},function(n){if('undefined'==typeof t){var a=new Error('Cannot find module "jszip"');throw a.code='MODULE_NOT_FOUND',a}n.exports=t},function(e,t,n){'use strict';function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var o=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),r=n(9),l=a(r),d=n(13),u=a(d),c=n(4),p=a(c),g=n(3),h=a(g),m=function(){function e(t,n,a){i(this,e),this.urlCache={},this.storage=void 0,this.name=t,this.requester=n||l.default,this.resolver=a,this.online=!0,this.checkRequirements(),this.addListeners()}return o(e,[{key:'checkRequirements',value:function(){try{var e;e='undefined'==typeof localforage?n(74):localforage,this.storage=e.createInstance({name:this.name})}catch(t){throw new Error('localForage lib not loaded')}}},{key:'addListeners',value:function(){this._status=this.status.bind(this),window.addEventListener('online',this._status),window.addEventListener('offline',this._status)}},{key:'removeListeners',value:function(){window.removeEventListener('online',this._status),window.removeEventListener('offline',this._status),this._status=void 0}},{key:'status',value:function(){var e=navigator.onLine;this.online=e,e?this.emit('online',this):this.emit('offline',this)}},{key:'add',value:function(e,t){var n=this,a=e.resources.map(function(e){var a=e.href,i=n.resolver(a),o=window.encodeURIComponent(i);return n.storage.getItem(o).then(function(e){return!e||t?n.requester(i,'binary').then(function(e){return n.storage.setItem(o,e)}):e})});return Promise.all(a)}},{key:'put',value:function(e,t,n){var a=this,i=window.encodeURIComponent(e);return this.storage.getItem(i).then(function(o){return o?o:a.requester(e,'binary',t,n).then(function(e){return a.storage.setItem(i,e)})})}},{key:'request',value:function(e,t,n,a){var i=this;return this.online?this.requester(e,t,n,a).then(function(t){return i.put(e),t}):this.retrieve(e,t)}},{key:'retrieve',value:function(e,t){var n=this,a=new s.defer,i=new p.default(e),o;return t||(t=i.extension),o='blob'==t?this.getBlob(e):this.getText(e),o.then(function(a){var i=new s.defer,o;return a?(o=n.handleResponse(a,t),i.resolve(o)):i.reject({message:'File not found in storage: '+e,stack:new Error().stack}),i.promise})}},{key:'handleResponse',value:function(e,t){var n;return n='json'==t?JSON.parse(e):(0,s.isXml)(t)?(0,s.parse)(e,'text/xml'):'xhtml'==t?(0,s.parse)(e,'application/xhtml+xml'):'html'==t||'htm'==t?(0,s.parse)(e,'text/html'):e,n}},{key:'getBlob',value:function(e,t){var n=window.encodeURIComponent(e);return this.storage.getItem(n).then(function(n){if(n)return t=t||u.default.lookup(e),new Blob([n],{type:t})})}},{key:'getText',value:function(e,t){var n=window.encodeURIComponent(e);return t=t||u.default.lookup(e),this.storage.getItem(n).then(function(e){var n=new s.defer,a=new FileReader,i;if(e)return i=new Blob([e],{type:t}),a.addEventListener('loadend',function(){n.resolve(a.result)}),a.readAsText(i,t),n.promise})}},{key:'getBase64',value:function(e,t){var n=window.encodeURIComponent(e);return t=t||u.default.lookup(e),this.storage.getItem(n).then(function(e){var n=new s.defer,a=new FileReader,i;if(e)return i=new Blob([e],{type:t}),a.addEventListener('loadend',function(){n.resolve(a.result)}),a.readAsDataURL(i,t),n.promise})}},{key:'createUrl',value:function(e,t){var n=new s.defer,a=window.URL||window.webkitURL||window.mozURL,i=t&&t.base64,o,r;return e in this.urlCache?(n.resolve(this.urlCache[e]),n.promise):(i?(r=this.getBase64(e),r&&r.then(function(t){this.urlCache[e]=t,n.resolve(t)}.bind(this))):(r=this.getBlob(e),r&&r.then(function(t){o=a.createObjectURL(t),this.urlCache[e]=o,n.resolve(o)}.bind(this))),r||n.reject({message:'File not found in storage: '+e,stack:new Error().stack}),n.promise)}},{key:'revokeUrl',value:function(e){var t=window.URL||window.webkitURL||window.mozURL,n=this.urlCache[e];n&&t.revokeObjectURL(n)}},{key:'destroy',value:function(){var e=window.URL||window.webkitURL||window.mozURL;for(var t in this.urlCache)e.revokeObjectURL(t);this.urlCache={},this.removeListeners()}}]),e}();(0,h.default)(m.prototype),t.default=m,e.exports=t['default']},function(e,t,n){(function(t){var n,n;(function(t){e.exports=t()})(function(){return function a(d,e,t){function r(i,o){if(!e[i]){if(!d[i]){if(!o&&'function'==typeof n&&n)return n(i,!0);if(s)return s(i,!0);var c=new Error('Cannot find module \''+i+'\'');throw c.code='MODULE_NOT_FOUND',c}var p=e[i]={exports:{}};d[i][0].call(p.exports,function(t){var e=d[i][1][t];return r(e?e:t)},p,p.exports,a,d,e,t)}return e[i].exports}for(var s='function'==typeof n&&n,i=0;i<t.length;i++)r(t[i]);return r}({1:[function(e,n){(function(e){'use strict';function t(){u=!0;for(var e=d.length,t,n;e;){for(n=d,d=[],t=-1;++t<e;)n[t]();e=d.length}u=!1}var a=e.MutationObserver||e.WebKitMutationObserver,i;if(a){var o=0,r=new a(t),s=e.document.createTextNode('');r.observe(s,{characterData:!0}),i=function(){s.data=o=++o%2}}else if(!e.setImmediate&&'undefined'!=typeof e.MessageChannel){var l=new e.MessageChannel;l.port1.onmessage=t,i=function(){l.port2.postMessage(0)}}else i='document'in e&&'onreadystatechange'in e.document.createElement('script')?function(){var n=e.document.createElement('script');n.onreadystatechange=function(){t(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},e.document.documentElement.appendChild(n)}:function(){setTimeout(t,0)};var d=[],u;n.exports=function(e){1!==d.push(e)||u||i()}}).call(this,'undefined'==typeof t?'undefined'==typeof self?'undefined'==typeof window?{}:window:self:t)},{}],2:[function(e,t){'use strict';function n(){}function a(e){if('function'!=typeof e)throw new TypeError('resolver must be a function');this.state=g,this.queue=[],this.outcome=void 0,e!==n&&s(this,e)}function i(e,t,n){this.promise=e,'function'==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),'function'==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function o(t,e,n){d(function(){var a;try{a=e(n)}catch(n){return u.reject(t,n)}a===t?u.reject(t,new TypeError('Cannot resolve promise with itself')):u.resolve(t,a)})}function r(e){var t=e&&e.then;if(e&&('object'==typeof e||'function'==typeof e)&&'function'==typeof t)return function(){t.apply(e,arguments)}}function s(e,t){function n(t){i||(i=!0,u.reject(e,t))}function a(t){i||(i=!0,u.resolve(e,t))}var i=!1,o=l(function(){t(a,n)});'error'===o.status&&n(o.value)}function l(e,t){var n={};try{n.value=e(t),n.status='success'}catch(t){n.status='error',n.value=t}return n}var d=e(1),u={},c=['REJECTED'],p=['FULFILLED'],g=['PENDING'];t.exports=a,a.prototype['catch']=function(e){return this.then(null,e)},a.prototype.then=function(e,t){if('function'!=typeof e&&this.state===p||'function'!=typeof t&&this.state===c)return this;var a=new this.constructor(n);if(this.state!==g){var r=this.state===p?e:t;o(a,r,this.outcome)}else this.queue.push(new i(a,e,t));return a},i.prototype.callFulfilled=function(e){u.resolve(this.promise,e)},i.prototype.otherCallFulfilled=function(e){o(this.promise,this.onFulfilled,e)},i.prototype.callRejected=function(e){u.reject(this.promise,e)},i.prototype.otherCallRejected=function(e){o(this.promise,this.onRejected,e)},u.resolve=function(e,t){var n=l(r,t);if('error'===n.status)return u.reject(e,n.value);var a=n.value;if(a)s(e,a);else{e.state=p,e.outcome=t;for(var o=-1,i=e.queue.length;++o<i;)e.queue[o].callFulfilled(t)}return e},u.reject=function(e,t){e.state=c,e.outcome=t;for(var n=-1,a=e.queue.length;++n<a;)e.queue[n].callRejected(t);return e},a.resolve=function(e){return e instanceof this?e:u.resolve(new this(n),e)},a.reject=function(e){var t=new this(n);return u.reject(t,e)},a.all=function(e){function t(e,t){a.resolve(e).then(function(e){s[t]=e,++l!==o||r||(r=!0,u.resolve(c,s))},function(e){r||(r=!0,u.reject(c,e))})}var a=this;if('[object Array]'!==Object.prototype.toString.call(e))return this.reject(new TypeError('must be an array'));var o=e.length,r=!1;if(!o)return this.resolve([]);for(var s=Array(o),l=0,d=-1,c=new this(n);++d<o;)t(e[d],d);return c},a.race=function(e){function t(e){a.resolve(e).then(function(e){r||(r=!0,u.resolve(i,e))},function(e){r||(r=!0,u.reject(i,e))})}var a=this;if('[object Array]'!==Object.prototype.toString.call(e))return this.reject(new TypeError('must be an array'));var o=e.length,r=!1;if(!o)return this.resolve([]);for(var s=-1,i=new this(n);++s<o;)t(e[s]);return i}},{1:1}],3:[function(e){(function(t){'use strict';'function'!=typeof t.Promise&&(t.Promise=e(2))}).call(this,'undefined'==typeof t?'undefined'==typeof self?'undefined'==typeof window?{}:window:self:t)},{2:2}],4:[function(e,t){'use strict';function n(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}function a(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if('TypeError'!==i.name)throw i;for(var n='undefined'==typeof BlobBuilder?'undefined'==typeof MSBlobBuilder?'undefined'==typeof MozBlobBuilder?WebKitBlobBuilder:MozBlobBuilder:MSBlobBuilder:BlobBuilder,a=new n,o=0;o<e.length;o+=1)a.append(e[o]);return a.getBlob(t.type)}}function i(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function o(e,t,n){'function'==typeof t&&e.then(t),'function'==typeof n&&e['catch'](n)}function r(e){return'string'!=typeof e&&(console.warn(e+' used as a key, but it is not a string.'),e+=''),e}function s(){if(arguments.length&&'function'==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function l(e){for(var t=e.length,n=new ArrayBuffer(t),a=new Uint8Array(n),o=0;o<t;o++)a[o]=e.charCodeAt(o);return n}function d(e){return new B(function(t){var n=e.transaction(j,F),i=a(['']);n.objectStore(j).put(i,'key'),n.onabort=function(n){n.preventDefault(),n.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||43<=parseInt(e[1],10))}})['catch'](function(){return!1})}function u(e){return'boolean'==typeof q?B.resolve(q):d(e).then(function(e){return q=e,q})}function c(e){var t=U[e.name],n={};n.promise=new B(function(e,t){n.resolve=e,n.reject=t}),t.deferredOperations.push(n),t.dbReady=t.dbReady?t.dbReady.then(function(){return n.promise}):n.promise}function p(e){var t=U[e.name],n=t.deferredOperations.pop();if(n)return n.resolve(),n.promise}function g(e,t){var n=U[e.name],a=n.deferredOperations.pop();if(a)return a.reject(t),a.promise}function h(t,e){return new B(function(n,a){if(U[t.name]=U[t.name]||N(),t.db)if(e)c(t),t.db.close();else return n(t.db);var i=[t.name];e&&i.push(t.version);var o=M.open.apply(M,i);e&&(o.onupgradeneeded=function(n){var e=o.result;try{e.createObjectStore(t.storeName),1>=n.oldVersion&&e.createObjectStore(j)}catch(e){if('ConstraintError'===e.name)console.warn('The database "'+t.name+'" has been upgraded from version '+n.oldVersion+' to version '+n.newVersion+', but the storage "'+t.storeName+'" already exists.');else throw e}}),o.onerror=function(t){t.preventDefault(),a(o.error)},o.onsuccess=function(){n(o.result),p(t)}})}function m(e){return h(e,!1)}function f(e){return h(e,!0)}function y(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),a=e.version<e.db.version,i=e.version>e.db.version;if(a&&(e.version!==t&&console.warn('The database "'+e.name+'" can\'t be downgraded from version '+e.db.version+' to version '+e.version+'.'),e.version=e.db.version),i||n){if(n){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function v(t){return new B(function(n,e){var a=new FileReader;a.onerror=e,a.onloadend=function(a){var e=btoa(a.target.result||'');n({__local_forage_encoded_blob:!0,data:e,type:t.type})},a.readAsBinaryString(t)})}function b(e){var t=l(atob(e.data));return a([t],{type:e.type})}function k(e){return e&&e.__local_forage_encoded_blob}function x(e){var t=this,n=t._initReady().then(function(){var e=U[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return o(n,e,e),n}function E(e){c(e);for(var t=U[e.name],n=t.forages,a=0,i;a<n.length;a++)i=n[a],i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null);return e.db=null,m(e).then(function(t){return e.db=t,y(e)?f(e):t}).then(function(a){e.db=t.db=a;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=a})['catch'](function(t){throw g(e,t),t})}function _(e,t,n,a){a===void 0&&(a=1);try{var i=e.db.transaction(e.storeName,t);n(null,i)}catch(i){if(0<a&&(!e.db||'InvalidStateError'===i.name||'NotFoundError'===i.name))return B.resolve().then(function(){if(!e.db||'NotFoundError'===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),f(e)}).then(function(){return E(e).then(function(){_(e,t,n,a-1)})})['catch'](n);n(i)}}function N(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function S(e){var t=0.75*e.length,n=e.length,a=0,o,i,r,s,l;'='===e[e.length-1]&&(t--,'='===e[e.length-2]&&t--);var d=new ArrayBuffer(t),u=new Uint8Array(d);for(o=0;o<n;o+=4)i=X.indexOf(e[o]),r=X.indexOf(e[o+1]),s=X.indexOf(e[o+2]),l=X.indexOf(e[o+3]),u[a++]=i<<2|r>>4,u[a++]=(15&r)<<4|s>>2,u[a++]=(3&s)<<6|63&l;return d}function w(e){var t=new Uint8Array(e),n='',a;for(a=0;a<t.length;a+=3)n+=X[t[a]>>2],n+=X[(3&t[a])<<4|t[a+1]>>4],n+=X[(15&t[a+1])<<2|t[a+2]>>6],n+=X[63&t[a+2]];return 2==t.length%3?n=n.substring(0,n.length-1)+'=':1==t.length%3&&(n=n.substring(0,n.length-2)+'=='),n}function T(e,t,n,a){e.executeSql('CREATE TABLE IF NOT EXISTS '+t.storeName+' (id INTEGER PRIMARY KEY, key unique, value)',[],n,a)}function C(e,n,a,i,o,r){e.executeSql(a,i,o,function(e,s){s.code===s.SYNTAX_ERR?e.executeSql('SELECT name FROM sqlite_master WHERE type=\'table\' AND name = ?',[n.storeName],function(e,t){t.rows.length?r(e,s):T(e,n,function(){e.executeSql(a,i,o,r)},r)},r):r(e,s)},r)}function R(e,t,n,a){var o=this;e=r(e);var s=new B(function(i,r){o.ready().then(function(){void 0===t&&(t=null);var s=t,l=o._dbInfo;l.serializer.serialize(t,function(d,t){t?r(t):l.db.transaction(function(n){C(n,l,'INSERT OR REPLACE INTO '+l.storeName+' (key, value) VALUES (?, ?)',[e,d],function(){i(s)},function(e,t){r(t)})},function(t){if(t.code===t.QUOTA_ERR){if(0<a)return void i(R.apply(o,[e,s,n,a-1]));r(t)}})})})['catch'](r)});return i(s,n),s}function I(e){return new B(function(n,a){e.transaction(function(i){i.executeSql('SELECT name FROM sqlite_master WHERE type=\'table\' AND name <> \'__WebKitDatabaseInfoTable__\'',[],function(a,t){for(var o=[],r=0;r<t.rows.length;r++)o.push(t.rows.item(r).name);n({db:e,storeNames:o})},function(e,t){a(t)})},function(e){a(e)})})}function A(e,t){var n=e.name+'/';return e.storeName!==t.storeName&&(n+=e.storeName+'/'),n}function L(){var e='_localforage_support_test';try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(t){return!0}}function O(){return!L()||0<localStorage.length}function D(e,t){e[t]=function(){var n=arguments;return e.ready().then(function(){return e[t].apply(e,n)})}}function P(){for(var e=1,t;e<arguments.length;e++)if(t=arguments[e],t)for(var n in t)t.hasOwnProperty(n)&&(arguments[0][n]=he(t[n])?t[n].slice():t[n]);return arguments[0]}var z='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&'function'==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?'symbol':typeof e},M=function(){try{if('undefined'!=typeof indexedDB)return indexedDB;if('undefined'!=typeof webkitIndexedDB)return webkitIndexedDB;if('undefined'!=typeof mozIndexedDB)return mozIndexedDB;if('undefined'!=typeof OIndexedDB)return OIndexedDB;if('undefined'!=typeof msIndexedDB)return msIndexedDB}catch(t){}}();'undefined'==typeof Promise&&e(3);var B=Promise,j='local-forage-detect-blob-support',q=void 0,U={},V=Object.prototype.toString,W='readonly',F='readwrite',H={_driver:'asyncStorage',_initStorage:function(e){function t(){return B.resolve()}var n=this,a={db:null};if(e)for(var o in e)a[o]=e[o];var i=U[a.name];i||(i=N(),U[a.name]=i),i.forages.push(n),n._initReady||(n._initReady=n.ready,n.ready=x);for(var r=[],s=0,l;s<i.forages.length;s++)l=i.forages[s],l!==n&&r.push(l._initReady()['catch'](t));var d=i.forages.slice(0);return B.all(r).then(function(){return a.db=i.db,m(a)}).then(function(e){return a.db=e,y(a,n._defaultConfig.version)?f(a):e}).then(function(e){a.db=i.db=e,n._dbInfo=a;for(var t=0,o;t<d.length;t++)o=d[t],o!==n&&(o._dbInfo.db=a.db,o._dbInfo.version=a.version)})},_support:function(){try{if(!M)return!1;var e='undefined'!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t='function'==typeof fetch&&-1!==fetch.toString().indexOf('[native code');return(!e||t)&&'undefined'!=typeof indexedDB&&'undefined'!=typeof IDBKeyRange}catch(t){return!1}}(),iterate:function(e,t){var n=this,a=new B(function(t,a){n.ready().then(function(){_(n._dbInfo,W,function(i,o){if(i)return a(i);try{var r=o.objectStore(n._dbInfo.storeName),s=r.openCursor(),l=1;s.onsuccess=function(){var n=s.result;if(n){var a=n.value;k(a)&&(a=b(a));var i=e(a,n.key,l++);void 0===i?n['continue']():t(i)}else t()},s.onerror=function(){a(s.error)}}catch(t){a(t)}})})['catch'](a)});return i(a,t),a},getItem:function(e,t){var n=this;e=r(e);var a=new B(function(t,a){n.ready().then(function(){_(n._dbInfo,W,function(i,o){if(i)return a(i);try{var r=o.objectStore(n._dbInfo.storeName),s=r.get(e);s.onsuccess=function(){var e=s.result;void 0===e&&(e=null),k(e)&&(e=b(e)),t(e)},s.onerror=function(){a(s.error)}}catch(t){a(t)}})})['catch'](a)});return i(a,t),a},setItem:function(e,t,n){var a=this;e=r(e);var o=new B(function(n,i){var o;a.ready().then(function(){return o=a._dbInfo,'[object Blob]'===V.call(t)?u(o.db).then(function(e){return e?t:v(t)}):t}).then(function(t){_(a._dbInfo,F,function(o,r){if(o)return i(o);try{var s=r.objectStore(a._dbInfo.storeName);null===t&&(t=void 0);var l=s.put(t,e);r.oncomplete=function(){void 0===t&&(t=null),n(t)},r.onabort=r.onerror=function(){var e=l.error?l.error:l.transaction.error;i(e)}}catch(t){i(t)}})})['catch'](i)});return i(o,n),o},removeItem:function(e,t){var n=this;e=r(e);var a=new B(function(t,a){n.ready().then(function(){_(n._dbInfo,F,function(i,o){if(i)return a(i);try{var r=o.objectStore(n._dbInfo.storeName),s=r['delete'](e);o.oncomplete=function(){t()},o.onerror=function(){a(s.error)},o.onabort=function(){var e=s.error?s.error:s.transaction.error;a(e)}}catch(t){a(t)}})})['catch'](a)});return i(a,t),a},clear:function(e){var t=this,n=new B(function(e,n){t.ready().then(function(){_(t._dbInfo,F,function(a,i){if(a)return n(a);try{var o=i.objectStore(t._dbInfo.storeName),r=o.clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=r.error?r.error:r.transaction.error;n(e)}}catch(t){n(t)}})})['catch'](n)});return i(n,e),n},length:function(e){var t=this,n=new B(function(e,n){t.ready().then(function(){_(t._dbInfo,W,function(a,i){if(a)return n(a);try{var o=i.objectStore(t._dbInfo.storeName),r=o.count();r.onsuccess=function(){e(r.result)},r.onerror=function(){n(r.error)}}catch(t){n(t)}})})['catch'](n)});return i(n,e),n},key:function(e,t){var n=this,a=new B(function(t,a){return 0>e?void t(null):void n.ready().then(function(){_(n._dbInfo,W,function(i,o){if(i)return a(i);try{var r=o.objectStore(n._dbInfo.storeName),s=!1,l=r.openCursor();l.onsuccess=function(){var n=l.result;return n?void(0===e?t(n.key):s?t(n.key):(s=!0,n.advance(e))):void t(null)},l.onerror=function(){a(l.error)}}catch(t){a(t)}})})['catch'](a)});return i(a,t),a},keys:function(e){var t=this,n=new B(function(e,n){t.ready().then(function(){_(t._dbInfo,W,function(a,i){if(a)return n(a);try{var o=i.objectStore(t._dbInfo.storeName),r=o.openCursor(),s=[];r.onsuccess=function(){var t=r.result;return t?void(s.push(t.key),t['continue']()):void e(s)},r.onerror=function(){n(r.error)}}catch(t){n(t)}})})['catch'](n)});return i(n,e),n},dropInstance:function(e,t){t=s.apply(this,arguments);var n=this.config();e='function'!=typeof e&&e||{},e.name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var a=this,o;if(!e.name)o=B.reject('Invalid arguments');else{var r=e.name===n.name&&a._dbInfo.db,l=r?B.resolve(a._dbInfo.db):m(e).then(function(t){var n=U[e.name],a=n.forages;n.db=t;for(var o=0;o<a.length;o++)a[o]._dbInfo.db=t;return t});o=e.storeName?l.then(function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;c(e);var a=U[e.name],o=a.forages;t.close();for(var r=0,i;r<o.length;r++)i=o[r],i._dbInfo.db=null,i._dbInfo.version=n;var s=new B(function(t,a){var i=M.open(e.name,n);i.onerror=function(e){var t=i.result;t.close(),a(e)},i.onupgradeneeded=function(){var t=i.result;t.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}});return s.then(function(e){a.db=e;for(var t=0,n;t<o.length;t++)n=o[t],n._dbInfo.db=e,p(n._dbInfo)})['catch'](function(t){throw(g(e,t)||B.resolve())['catch'](function(){}),t})}}):l.then(function(t){c(e);var n=U[e.name],a=n.forages;t.close();for(var o=0,i;o<a.length;o++)i=a[o],i._dbInfo.db=null;var r=new B(function(t,n){var a=M.deleteDatabase(e.name);a.onerror=a.onblocked=function(e){var t=a.result;t&&t.close(),n(e)},a.onsuccess=function(){var e=a.result;e&&e.close(),t(e)}});return r.then(function(e){n.db=e;for(var t=0,i;t<a.length;t++)i=a[t],p(i._dbInfo)})['catch'](function(t){throw(g(e,t)||B.resolve())['catch'](function(){}),t})})}return i(o,t),o}},X='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',Y=/^~~local_forage_type~([^~]+)~/,G='__lfsc__:',K=G.length,Z='arbf',Q='blob',J='si08',$='ui08',ee='uic8',te='si16',ne='si32',ae='ur16',ie='ui32',oe='fl32',re='fl64',se=K+Z.length,le=Object.prototype.toString,de={serialize:function(t,n){var e='';if(t&&(e=le.call(t)),t&&('[object ArrayBuffer]'===e||t.buffer&&'[object ArrayBuffer]'===le.call(t.buffer))){var a=G,i;t instanceof ArrayBuffer?(i=t,a+=Z):(i=t.buffer,'[object Int8Array]'===e?a+=J:'[object Uint8Array]'===e?a+=$:'[object Uint8ClampedArray]'===e?a+=ee:'[object Int16Array]'===e?a+=te:'[object Uint16Array]'===e?a+=ae:'[object Int32Array]'===e?a+=ne:'[object Uint32Array]'===e?a+=ie:'[object Float32Array]'===e?a+=oe:'[object Float64Array]'===e?a+=re:n(new Error('Failed to get type for BinaryArray'))),n(a+w(i))}else if('[object Blob]'===e){var o=new FileReader;o.onload=function(){var e='~~local_forage_type~'+t.type+'~'+w(this.result);n(G+Q+e)},o.readAsArrayBuffer(t)}else try{n(JSON.stringify(t))}catch(a){console.error('Couldn\'t convert value into a JSON string: ',t),n(null,a)}},deserialize:function(e){if(e.substring(0,K)!==G)return JSON.parse(e);var t=e.substring(se),n=e.substring(K,se),i;if(n===Q&&Y.test(t)){var o=t.match(Y);i=o[1],t=t.substring(o[0].length)}var r=S(t);switch(n){case Z:return r;case Q:return a([r],{type:i});case J:return new Int8Array(r);case $:return new Uint8Array(r);case ee:return new Uint8ClampedArray(r);case te:return new Int16Array(r);case ae:return new Uint16Array(r);case ne:return new Int32Array(r);case ie:return new Uint32Array(r);case oe:return new Float32Array(r);case re:return new Float64Array(r);default:throw new Error('Unkown type: '+n);}},stringToBuffer:S,bufferToString:w},ue={_driver:'webSQLStorage',_initStorage:function(e){var t=this,n={db:null};if(e)for(var a in e)n[a]='string'==typeof e[a]?e[a]:e[a].toString();var i=new B(function(e,a){try{n.db=openDatabase(n.name,n.version+'',n.description,n.size)}catch(t){return a(t)}n.db.transaction(function(i){T(i,n,function(){t._dbInfo=n,e()},function(e,t){a(t)})},a)});return n.serializer=de,i},_support:function(){return'function'==typeof openDatabase}(),iterate:function(e,t){var n=this,a=new B(function(a,i){n.ready().then(function(){var o=n._dbInfo;o.db.transaction(function(n){C(n,o,'SELECT * FROM '+o.storeName,[],function(n,t){for(var r=t.rows,s=r.length,l=0;l<s;l++){var i=r.item(l),d=i.value;if(d&&(d=o.serializer.deserialize(d)),d=e(d,i.key,l+1),void 0!==d)return void a(d)}a()},function(e,t){i(t)})})})['catch'](i)});return i(a,t),a},getItem:function(e,t){var n=this;e=r(e);var a=new B(function(a,i){n.ready().then(function(){var o=n._dbInfo;o.db.transaction(function(n){C(n,o,'SELECT * FROM '+o.storeName+' WHERE key = ? LIMIT 1',[e],function(e,t){var n=t.rows.length?t.rows.item(0).value:null;n&&(n=o.serializer.deserialize(n)),a(n)},function(e,t){i(t)})})})['catch'](i)});return i(a,t),a},setItem:function(e,t,n){return R.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=r(e);var a=new B(function(t,a){n.ready().then(function(){var i=n._dbInfo;i.db.transaction(function(n){C(n,i,'DELETE FROM '+i.storeName+' WHERE key = ?',[e],function(){t()},function(e,t){a(t)})})})['catch'](a)});return i(a,t),a},clear:function(e){var t=this,n=new B(function(e,n){t.ready().then(function(){var a=t._dbInfo;a.db.transaction(function(i){C(i,a,'DELETE FROM '+a.storeName,[],function(){e()},function(e,t){n(t)})})})['catch'](n)});return i(n,e),n},length:function(e){var t=this,n=new B(function(e,n){t.ready().then(function(){var a=t._dbInfo;a.db.transaction(function(i){C(i,a,'SELECT COUNT(key) as c FROM '+a.storeName,[],function(n,t){var a=t.rows.item(0).c;e(a)},function(e,t){n(t)})})})['catch'](n)});return i(n,e),n},key:function(e,t){var n=this,a=new B(function(a,i){n.ready().then(function(){var o=n._dbInfo;o.db.transaction(function(n){C(n,o,'SELECT key FROM '+o.storeName+' WHERE id = ? LIMIT 1',[e+1],function(e,t){var n=t.rows.length?t.rows.item(0).key:null;a(n)},function(e,t){i(t)})})})['catch'](i)});return i(a,t),a},keys:function(e){var t=this,n=new B(function(e,n){t.ready().then(function(){var a=t._dbInfo;a.db.transaction(function(i){C(i,a,'SELECT key FROM '+a.storeName,[],function(n,t){for(var a=[],o=0;o<t.rows.length;o++)a.push(t.rows.item(o).key);e(a)},function(e,t){n(t)})})})['catch'](n)});return i(n,e),n},dropInstance:function(e,t){t=s.apply(this,arguments);var n=this.config();e='function'!=typeof e&&e||{},e.name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var a=this,o;return o=e.name?new B(function(t){var i;i=e.name===n.name?a._dbInfo.db:openDatabase(e.name,'','',0),e.storeName?t({db:i,storeNames:[e.storeName]}):t(I(i))}).then(function(e){return new B(function(t,n){e.db.transaction(function(a){function o(e){return new B(function(t,n){a.executeSql('DROP TABLE IF EXISTS '+e,[],function(){t()},function(e,t){n(t)})})}for(var r=[],s=0,i=e.storeNames.length;s<i;s++)r.push(o(e.storeNames[s]));B.all(r).then(function(){t()})['catch'](function(t){n(t)})},function(e){n(e)})})}):B.reject('Invalid arguments'),i(o,t),o}},ce={_driver:'localStorageWrapper',_initStorage:function(e){var t=this,n={};if(e)for(var a in e)n[a]=e[a];return(n.keyPrefix=A(e,t._defaultConfig),!O())?B.reject():(t._dbInfo=n,n.serializer=de,B.resolve())},_support:function(){try{return'undefined'!=typeof localStorage&&'setItem'in localStorage&&!!localStorage.setItem}catch(t){return!1}}(),iterate:function(e,t){var n=this,a=n.ready().then(function(){for(var t=n._dbInfo,a=t.keyPrefix,o=a.length,r=localStorage.length,s=1,l=0,i;l<r;l++)if(i=localStorage.key(l),0===i.indexOf(a)){var d=localStorage.getItem(i);if(d&&(d=t.serializer.deserialize(d)),d=e(d,i.substring(o),s++),void 0!==d)return d}});return i(a,t),a},getItem:function(e,t){var n=this;e=r(e);var a=n.ready().then(function(){var t=n._dbInfo,a=localStorage.getItem(t.keyPrefix+e);return a&&(a=t.serializer.deserialize(a)),a});return i(a,t),a},setItem:function(e,t,n){var a=this;e=r(e);var o=a.ready().then(function(){void 0===t&&(t=null);var n=t;return new B(function(i,o){var r=a._dbInfo;r.serializer.serialize(t,function(t,a){if(a)o(a);else try{localStorage.setItem(r.keyPrefix+e,t),i(n)}catch(t){('QuotaExceededError'===t.name||'NS_ERROR_DOM_QUOTA_REACHED'===t.name)&&o(t),o(t)}})})});return i(o,n),o},removeItem:function(e,t){var n=this;e=r(e);var a=n.ready().then(function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)});return i(a,t),a},clear:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1,a;0<=n;n--)a=localStorage.key(n),0===a.indexOf(e)&&localStorage.removeItem(a)});return i(n,e),n},length:function(e){var t=this,n=t.keys().then(function(e){return e.length});return i(n,e),n},key:function(e,t){var n=this,a=n.ready().then(function(){var t=n._dbInfo,a;try{a=localStorage.key(e)}catch(e){a=null}return a&&(a=a.substring(t.keyPrefix.length)),a});return i(a,t),a},keys:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo,n=localStorage.length,a=[],o=0,i;o<n;o++)i=localStorage.key(o),0===i.indexOf(e.keyPrefix)&&a.push(i.substring(e.keyPrefix.length));return a});return i(n,e),n},dropInstance:function(e,t){if(t=s.apply(this,arguments),e='function'!=typeof e&&e||{},!e.name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var a=this,o;return o=e.name?new B(function(t){e.storeName?t(A(e,a._defaultConfig)):t(e.name+'/')}).then(function(e){for(var t=localStorage.length-1,n;0<=t;t--)n=localStorage.key(t),0===n.indexOf(e)&&localStorage.removeItem(n)}):B.reject('Invalid arguments'),i(o,t),o}},pe=function(e,t){return e===t||'number'==typeof e&&'number'==typeof t&&isNaN(e)&&isNaN(t)},ge=function(e,t){for(var n=e.length,a=0;a<n;){if(pe(e[a],t))return!0;a++}return!1},he=Array.isArray||function(e){return'[object Array]'===Object.prototype.toString.call(e)},me={},fe={},ye={INDEXEDDB:H,WEBSQL:ue,LOCALSTORAGE:ce},ve=[ye.INDEXEDDB._driver,ye.WEBSQL._driver,ye.LOCALSTORAGE._driver],be=['dropInstance'],ke=['clear','getItem','iterate','key','keys','length','removeItem','setItem'].concat(be),xe={description:'',driver:ve.slice(),name:'localforage',size:4980736,storeName:'keyvaluepairs',version:1},Ee=function(){function e(t){for(var a in n(this,e),ye)if(ye.hasOwnProperty(a)){var i=ye[a],o=i._driver;this[a]=o,me[o]||this.defineDriver(i)}this._defaultConfig=P({},xe),this._config=P({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver)['catch'](function(){})}return e.prototype.config=function(e){if('object'===('undefined'==typeof e?'undefined':z(e))){if(this._ready)return new Error('Can\'t call config() after localforage has been used.');for(var t in e){if('storeName'==t&&(e[t]=e[t].replace(/\W/g,'_')),'version'==t&&'number'!=typeof e[t])return new Error('Database version must be a number.');this._config[t]=e[t]}return'driver'in e&&e.driver?this.setDriver(this._config.driver):!0}return'string'==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var a=new B(function(t,n){try{var a=e._driver,o=new Error('Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver');if(!e._driver)return void n(o);for(var r=ke.concat('_initStorage'),s=0,l=r.length;s<l;s++){var d=r[s],u=!ge(be,d);if((u||e[d])&&'function'!=typeof e[d])return void n(o)}var c=function(){for(var t=function(e){return function(){var t=new Error('Method '+e+' is not implemented by the current driver'),n=B.reject(t);return i(n,arguments[arguments.length-1]),n}},n=0,a=be.length,o;n<a;n++)o=be[n],e[o]||(e[o]=t(o))};c();var p=function(n){me[a]&&console.info('Redefining LocalForage driver: '+a),me[a]=e,fe[a]=n,t()};'_support'in e?e._support&&'function'==typeof e._support?e._support().then(p,n):p(!!e._support):p(!0)}catch(t){n(t)}});return o(a,t,n),a},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var a=me[e]?B.resolve(me[e]):B.reject(new Error('Driver not found.'));return o(a,t,n),a},e.prototype.getSerializer=function(e){var t=B.resolve(de);return o(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return o(n,e,e),n},e.prototype.setDriver=function(e,t,n){function a(){s._config.driver=s.driver()}function i(e){return s._extend(e),a(),s._ready=s._initStorage(s._config),s._ready}function r(e){return function(){function t(){for(;n<e.length;){var o=e[n];return n++,s._dbInfo=null,s._ready=null,s.getDriver(o).then(i)['catch'](t)}a();var r=new Error('No available storage method found.');return s._driverSet=B.reject(r),s._driverSet}var n=0;return t()}}var s=this;he(e)||(e=[e]);var l=this._getSupportedDrivers(e),d=null===this._driverSet?B.resolve():this._driverSet['catch'](function(){return B.resolve()});return this._driverSet=d.then(function(){var e=l[0];return s._dbInfo=null,s._ready=null,s.getDriver(e).then(function(e){s._driver=e._driver,a(),s._wrapLibraryMethodsWithReady(),s._initDriver=r(l)})})['catch'](function(){a();var e=new Error('No available storage method found.');return s._driverSet=B.reject(e),s._driverSet}),o(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!fe[e]},e.prototype._extend=function(e){P(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,a=e.length,i;n<a;n++)i=e[n],this.supports(i)&&t.push(i);return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=ke.length;e<t;e++)D(this,ke[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),_e=new Ee;t.exports=_e},{3:3}]},{},[4])(4)})}).call(t,n(5))},function(e,t,n){'use strict';function a(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(t,'__esModule',{value:!0});var i=function(){function e(e,t){for(var n=0,a;n<t.length;n++)a=t[n],a.enumerable=a.enumerable||!1,a.configurable=!0,'value'in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),o=n(0),r=function(){function e(t){a(this,e),this.interactive='',this.fixedLayout='',this.openToSpread='',this.orientationLock='',t&&this.parse(t)}return i(e,[{key:'parse',value:function(e){var t=this;if(!e)return this;var n=(0,o.qs)(e,'display_options');if(!n)return this;var a=(0,o.qsa)(n,'option');return a.forEach(function(e){var n='';switch(e.childNodes.length&&(n=e.childNodes[0].nodeValue),e.attributes.name.value){case'interactive':t.interactive=n;break;case'fixed-layout':t.fixedLayout=n;break;case'open-to-spread':t.openToSpread=n;break;case'orientation-lock':t.orientationLock=n;}}),this}},{key:'destroy',value:function(){this.interactive=void 0,this.fixedLayout=void 0,this.openToSpread=void 0,this.orientationLock=void 0}}]),e}();t.default=r,e.exports=t['default']},function(e,t,n){(function(e){(function(e){var t=function(){try{return!!Symbol.iterator}catch(e){return!1}}(),n=function(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t&&(n[Symbol.iterator]=function(){return n}),n},a=function(e){return encodeURIComponent(e).replace(/%20/g,'+')},o=function(e){return decodeURIComponent(e).replace(/\+/g,' ')};'URLSearchParams'in e&&'a=1'===new URLSearchParams('?a=1').toString()||function(){var o=function(e){Object.defineProperty(this,'_entries',{writable:!0,value:{}});var t=typeof e;if('undefined'==t);else if('string'==t)''!==e&&this._fromString(e);else if(e instanceof o){var n=this;e.forEach(function(e,t){n.append(t,e)})}else if(!(null!==e&&'object'==t))throw new TypeError('Unsupported input\'s type for URLSearchParams');else if('[object Array]'===Object.prototype.toString.call(e)){for(var a=0,i;a<e.length;a++)if(i=e[a],'[object Array]'===Object.prototype.toString.call(i)||2!==i.length)this.append(i[0],i[1]);else throw new TypeError('Expected [string, any] as entry at index '+a+' of URLSearchParams\'s input');}else for(var r in e)e.hasOwnProperty(r)&&this.append(r,e[r])},i=o.prototype;i.append=function(e,t){e in this._entries?this._entries[e].push(t+''):this._entries[e]=[t+'']},i.delete=function(e){delete this._entries[e]},i.get=function(e){return e in this._entries?this._entries[e][0]:null},i.getAll=function(e){return e in this._entries?this._entries[e].slice(0):[]},i.has=function(e){return e in this._entries},i.set=function(e,t){this._entries[e]=[t+'']},i.forEach=function(e,t){var n;for(var a in this._entries)if(this._entries.hasOwnProperty(a)){n=this._entries[a];for(var o=0;o<n.length;o++)e.call(t,n[o],a,this)}},i.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),n(e)},i.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),n(e)},i.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),n(e)},t&&(i[Symbol.iterator]=i.entries),i.toString=function(){var e=[];return this.forEach(function(t,n){e.push(a(n)+'='+a(t))}),e.join('&')},e.URLSearchParams=o}();var i=URLSearchParams.prototype;'function'!=typeof i.sort&&(i.sort=function(){var e=this,t=[];this.forEach(function(n,a){t.push([a,n]),e._entries||e.delete(a)}),t.sort(function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:0}),e._entries&&(e._entries={});for(var n=0;n<t.length;n++)this.append(t[n][0],t[n][1])}),'function'!=typeof i._fromString&&Object.defineProperty(i,'_fromString',{enumerable:!1,configurable:!1,writable:!1,value:function(e){if(this._entries)this._entries={};else{var t=[];this.forEach(function(e,n){t.push(n)});for(var n=0;n<t.length;n++)this.delete(t[n])}e=e.replace(/^\?/,'');for(var a=e.split('&'),n=0,i;n<a.length;n++)i=a[n].split('='),this.append(o(i[0]),1<i.length?o(i[1]):'')}})})('undefined'==typeof e?'undefined'==typeof window?'undefined'==typeof self?this:self:window:e),function(e){if(function(){try{var e=new URL('b','http://a');return e.pathname='c%20d','http://a/c%20d'===e.href&&e.searchParams}catch(t){return!1}}()||function(){var t=e.URL,n=function(t,n){'string'!=typeof t&&(t+='');var a=document,i;if(n&&(void 0===e.location||n!==e.location.href)){a=document.implementation.createHTMLDocument(''),i=a.createElement('base'),i.href=n,a.head.appendChild(i);try{if(0!==i.href.indexOf(n))throw new Error(i.href)}catch(e){throw new Error('URL unable to set base '+n+' due to '+e)}}var o=a.createElement('a');if(o.href=t,i&&(a.body.appendChild(o),o.href=o.href),':'===o.protocol||!/:/.test(o.href))throw new TypeError('Invalid URL');Object.defineProperty(this,'_anchorElement',{value:o});var r=new URLSearchParams(this.search),s=!0,l=!0,d=this;['append','delete','set'].forEach(function(e){var t=r[e];r[e]=function(){t.apply(r,arguments),s&&(l=!1,d.search=r.toString(),l=!0)}}),Object.defineProperty(this,'searchParams',{value:r,enumerable:!0});var u;Object.defineProperty(this,'_updateSearchParams',{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==u&&(u=this.search,l&&(s=!1,this.searchParams._fromString(this.search),s=!0))}})},a=n.prototype,i=function(e){Object.defineProperty(a,e,{get:function(){return this._anchorElement[e]},set:function(t){this._anchorElement[e]=t},enumerable:!0})};['hash','host','hostname','port','protocol'].forEach(function(e){i(e)}),Object.defineProperty(a,'search',{get:function(){return this._anchorElement.search},set:function(e){this._anchorElement.search=e,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(a,{toString:{get:function(){var e=this;return function(){return e.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,'')},set:function(e){this._anchorElement.href=e,this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,'/')},set:function(e){this._anchorElement.pathname=e},enumerable:!0},origin:{get:function(){var e={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],t=this._anchorElement.port!=e&&''!==this._anchorElement.port;return this._anchorElement.protocol+'//'+this._anchorElement.hostname+(t?':'+this._anchorElement.port:'')},enumerable:!0},password:{get:function(){return''},set:function(){},enumerable:!0},username:{get:function(){return''},set:function(){},enumerable:!0}}),n.createObjectURL=function(){return t.createObjectURL.apply(t,arguments)},n.revokeObjectURL=function(){return t.revokeObjectURL.apply(t,arguments)},e.URL=n}(),void 0!==e.location&&!('origin'in e.location)){var t=function(){return e.location.protocol+'//'+e.location.hostname+(e.location.port?':'+e.location.port:'')};try{Object.defineProperty(e.location,'origin',{get:t,enumerable:!0})}catch(n){setInterval(function(){e.location.origin=t()},100)}}}('undefined'==typeof e?'undefined'==typeof window?'undefined'==typeof self?this:self:window:e)}).call(t,n(5))}])}); |