diff --git a/dist/epub.js b/dist/epub.js index 600d11f..5382efb 100644 --- a/dist/epub.js +++ b/dist/epub.js @@ -1034,6 +1034,9 @@ EpubCFI.prototype.toString = function() { }; EpubCFI.prototype.compare = function(cfiOne, cfiTwo) { + var stepsA, stepsB; + var terminalA, terminalB; + if(typeof cfiOne === 'string') { cfiOne = new EpubCFI(cfiOne); } @@ -1048,36 +1051,52 @@ EpubCFI.prototype.compare = function(cfiOne, cfiTwo) { return -1; } + if (cfiOne.range) { + stepsA = cfiOne.path.steps.concat(cfiOne.start.steps); + terminalA = cfiOne.start.terminal; + } else { + stepsA = cfiOne.path.steps; + terminalA = cfiOne.path.terminal; + } + + if (cfiTwo.range) { + stepsB = cfiTwo.path.steps.concat(cfiTwo.start.steps); + terminalB = cfiTwo.start.terminal; + } else { + stepsB = cfiTwo.path.steps; + terminalB = cfiTwo.path.terminal; + } // Compare Each Step in the First item - for (var i = 0; i < cfiOne.path.steps.length; i++) { - if(!cfiTwo.path.steps[i]) { + for (var i = 0; i < stepsA.length; i++) { + if(!stepsA[i]) { + return -1; + } + if(!stepsB[i]) { return 1; } - if(cfiOne.path.steps[i].index > cfiTwo.path.steps[i].index) { + if(stepsA[i].index > stepsB[i].index) { return 1; } - if(cfiOne.path.steps[i].index < cfiTwo.path.steps[i].index) { + if(stepsA[i].index < stepsB[i].index) { return -1; } // Otherwise continue checking } // All steps in First equal to Second and First is Less Specific - if(cfiOne.path.steps.length < cfiTwo.path.steps.length) { + if(stepsA.length < stepsB.length) { return 1; } // Compare the charecter offset of the text node - if(cfiOne.path.terminal.offset > cfiTwo.path.terminal.offset) { + if(terminalA.offset > terminalB.offset) { return 1; } - if(cfiOne.path.terminal.offset < cfiTwo.path.terminal.offset) { + if(terminalA.offset < terminalB.offset) { return -1; } - // TODO: compare ranges - // CFI's are equal return 0; }; @@ -1215,7 +1234,6 @@ EpubCFI.prototype.fromRange = function(range, base, ignoreClass) { } cfi.start = this.pathTo(start, startOffset, ignoreClass); - if (needsIgnoring) { endOffset = this.patchOffset(end, endOffset, ignoreClass); } @@ -1234,7 +1252,7 @@ EpubCFI.prototype.fromRange = function(range, base, ignoreClass) { for (i = 0; i < len; i++) { if (this.equalStep(cfi.start.steps[i], cfi.end.steps[i])) { - if(i == len-1) { + if(i === len-1) { // Last step is equal, check terminals if(cfi.start.terminal === cfi.end.terminal) { // CFI's are equal @@ -4270,6 +4288,15 @@ DefaultViewManager.prototype.display = function(section, target){ this.views.clear(); this.add(section) + .then(function(view){ + + // Move to correct place within the section, if needed + if(target) { + offset = view.locationOf(target); + this.moveTo(offset); + } + + }.bind(this)) .then(function(){ var next; if (this.layout.name === "pre-paginated" && @@ -4280,13 +4307,7 @@ DefaultViewManager.prototype.display = function(section, target){ } } }.bind(this)) - .then(function(view){ - - // Move to correct place within the section, if needed - if(target) { - offset = view.locationOf(target); - this.moveTo(offset); - } + .then(function(){ this.views.show(); @@ -4473,15 +4494,34 @@ DefaultViewManager.prototype.current = function(){ }; DefaultViewManager.prototype.currentLocation = function(){ + + if (this.settings.axis === "vertical") { + this.location = this.scrolledLocation(); + } else { + this.location = this.paginatedLocation(); + } + return this.location; +}; + +DefaultViewManager.prototype.scrolledLocation = function(){ + var view; + + if(this.views.length) { + view = this.views.first(); + return this.mapping.page(view, view.section.cfiBase); + } + +}; + +DefaultViewManager.prototype.paginatedLocation = function(){ var view; var start, end; if(this.views.length) { view = this.views.first(); - start = container.left - view.position().left; - end = start + this.layout.spread; - - return this.mapping.page(view, view.section.cfiBase); + start = this._bounds.left - view.position().left; + end = start + this.layout.spreadWidth; + return this.mapping.page(view, view.section.cfiBase, start, end); } }; @@ -4975,7 +5015,7 @@ Rendition.prototype.afterDisplayed = function(view){ * Report resize events and display the last seen location * @private */ -Rendition.prototype.onResized = function(){ +Rendition.prototype.onResized = function(size){ if(this.location) { this.display(this.location.start); @@ -5114,6 +5154,7 @@ Rendition.prototype.spread = function(spread, min){ /** * Report the current location + * @private */ Rendition.prototype.reportLocation = function(){ return this.q.enqueue(function(){ @@ -5121,16 +5162,50 @@ Rendition.prototype.reportLocation = function(){ if (location && location.then && typeof location.then === 'function') { location.then(function(result) { this.location = result; + + this.percentage = this.book.locations.percentageFromCfi(result); + if (this.percentage != null) { + this.location.percentage = this.percentage; + } + this.emit("locationChanged", this.location); }.bind(this)); } else if (location) { this.location = location; + this.percentage = this.book.locations.percentageFromCfi(location); + if (this.percentage != null) { + this.location.percentage = this.percentage; + } + this.emit("locationChanged", this.location); } }.bind(this)); }; +/** + * Get the Current Location CFI + * @return {EpubCFI} location (may be a promise) + */ +Rendition.prototype.currentLocation = function(){ + var location = this.manager.currentLocation(); + if (location && location.then && typeof location.then === 'function') { + location.then(function(result) { + var percentage = this.book.locations.percentageFromCfi(result); + if (percentage != null) { + result.percentage = percentage; + } + return result; + }.bind(this)); + } else if (location) { + var percentage = this.book.locations.percentageFromCfi(location); + if (percentage != null) { + location.percentage = percentage; + } + return location; + } +}; + /** * Remove and Clean Up the Rendition */ @@ -5341,7 +5416,7 @@ function Book(url, options){ /** * @property {Locations} locations */ - this.locations = new Locations(this.spine, this.load); + this.locations = new Locations(this.spine, this.load.bind(this)); /** * @property {Navigation} navigation @@ -5403,7 +5478,7 @@ Book.prototype.open = function(input, what){ .then(this.openEpub.bind(this)); } else if(type == "opf") { this.url = new Url(input); - opening = this.openPackaging(input); + opening = this.openPackaging(this.url.Path.toString()); } else { this.url = new Url(input); opening = this.openContainer(CONTAINER_PATH) @@ -5453,7 +5528,6 @@ Book.prototype.openContainer = function(url){ Book.prototype.openPackaging = function(url){ var packageUrl; this.path = new Path(url); - return this.load(url) .then(function(xml) { this.packaging = new Packaging(xml); @@ -5704,6 +5778,16 @@ Book.prototype.range = function(cfiRange) { }) }; +/** + * Generates the Book Key using the identifer in the manifest or other string provided + * @param {[string]} identifier to use instead of metadata identifier + * @return {string} key + */ +Book.prototype.key = function(identifier){ + var ident = identifier || this.package.metadata.identifier || this.url.filename; + return "epubjs:" + ePub.VERSION + ":" + ident; +}; + //-- Enable binding events to book EventEmitter(Book.prototype); @@ -8061,7 +8145,7 @@ Locations.prototype.generate = function(chars) { } return this._locations; - // console.log(this.precentage(this.book.rendition.location.start), this.precentage(this.book.rendition.location.end)); + // console.log(this.percentage(this.book.rendition.location.start), this.percentage(this.book.rendition.location.end)); }.bind(this)); }; @@ -8073,9 +8157,10 @@ Locations.prototype.process = function(section) { var range; var doc = contents.ownerDocument; + var body = core.qs(doc, 'body'); var counter = 0; - this.sprint(contents, function(node) { + this.sprint(body, function(node) { var len = node.length; var dist; var pos = 0; @@ -8148,15 +8233,17 @@ Locations.prototype.locationFromCfi = function(cfi){ if(this._locations.length === 0) { return -1; } - - return core.locationOf(cfi, this._locations, this.epubcfi.compare); + return core.locationOf(cfi.start, this._locations, this.epubcfi.compare); }; -Locations.prototype.precentageFromCfi = function(cfi) { +Locations.prototype.percentageFromCfi = function(cfi) { + if(this._locations.length === 0) { + return null; + } // Find closest cfi var loc = this.locationFromCfi(cfi); // Get percentage in total - return this.precentageFromLocation(loc); + return this.percentageFromLocation(loc); }; Locations.prototype.percentageFromLocation = function(loc) { @@ -8224,7 +8311,7 @@ Locations.prototype.setCurrent = function(curr){ } this.emit("changed", { - percentage: this.precentageFromLocation(loc) + percentage: this.percentageFromLocation(loc) }); }; diff --git a/dist/epub.js.map b/dist/epub.js.map index 77189b2..4d8cf81 100644 --- a/dist/epub.js.map +++ b/dist/epub.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap e56d9891783b1b6486a9","webpack:///./src/core.js","webpack:///./src/epubcfi.js","webpack:///./~/path-webpack/path.js","webpack:///./~/event-emitter/index.js","webpack:///./~/process/browser.js","webpack:///./src/hook.js","webpack:///./src/mapping.js","webpack:///./src/queue.js","webpack:///./src/replacements.js","webpack:///./src/request.js","webpack:///./src/contents.js","webpack:///./src/managers/default/index.js","webpack:///./src/rendition.js","webpack:///external \"xmldom\"","webpack:///./src/book.js","webpack:///./src/managers/continuous/index.js","webpack:///./src/managers/views/iframe.js","webpack:///./libs/mime/mime.js","webpack:///./~/base64-js/index.js","webpack:///./~/d/index.js","webpack:///./~/es5-ext/object/assign/index.js","webpack:///./~/es5-ext/object/assign/is-implemented.js","webpack:///./~/es5-ext/object/assign/shim.js","webpack:///./~/es5-ext/object/is-callable.js","webpack:///./~/es5-ext/object/keys/index.js","webpack:///./~/es5-ext/object/keys/is-implemented.js","webpack:///./~/es5-ext/object/keys/shim.js","webpack:///./~/es5-ext/object/normalize-options.js","webpack:///./~/es5-ext/object/valid-callable.js","webpack:///./~/es5-ext/object/valid-value.js","webpack:///./~/es5-ext/string/#/contains/index.js","webpack:///./~/es5-ext/string/#/contains/is-implemented.js","webpack:///./~/es5-ext/string/#/contains/shim.js","webpack:///./src/archive.js","webpack:///./src/container.js","webpack:///./src/layout.js","webpack:///./src/locations.js","webpack:///./src/managers/helpers/stage.js","webpack:///./src/managers/helpers/views.js","webpack:///./src/navigation.js","webpack:///./src/packaging.js","webpack:///./src/pagelist.js","webpack:///./src/resources.js","webpack:///./src/section.js","webpack:///./src/spine.js","webpack:///external \"JSZip\"","webpack:///./src/epub.js"],"names":[],"mappings":"AAAA;AACA;AACA,0EAA0E,MAAM,yBAAyB,EAAE,YAAY,EAAE;AACzH;AACA;AACA;AACA,2EAA2E,MAAM,yBAAyB,EAAE,YAAY,EAAE;AAC1H;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA,YAAI;AACJ;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;AC9DA;AACA;;AAEA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,2CAA2C,YAAY;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;;AAEA;AACA,sBAAsB;AACtB;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,qBAAqB;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iCAAiC,aAAa;;AAE9C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,8BAA8B;;AAE9B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACnoBA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,mBAAmB;;AAEnB,oBAAoB;;AAEpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;;AAGA;AACA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA,EAAE,2EAA2E;AAC7E;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA,UAAU;AACV;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,UAAU;AACV;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mCAAmC;AACnC;;AAEA;AACA;AACA;;AAEA;;AAEA,EAAE;;AAEF;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,gBAAgB,8BAA8B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,UAAU;AACV;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,SAAS;;AAErB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,EAAE;;AAEF;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,EAAE;;AAEF;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,SAAS;AACrB;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;;ACx6BA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,QAAQ;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,sCAAsC,8BAA8B;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,GAAG;;;AAGH;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,UAAU,yBAAyB;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,qBAAqB;AAC/B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAU,aAAa;AACvB;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA,WAAW;AACX;AACA,qCAAqC;AACrC;AACA;AACA,SAAS;AACT;AACA;AACA,gDAAgD;AAChD;AACA,WAAW;AACX;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2CAA2C,cAAc;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;;AAEA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,UAAU,YAAY;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;;;AAGA;;;;;;;;;ACniBA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB;;AAElB;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,aAAa,4BAA4B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,OAAO;;AAEpB;AACA,aAAa,2BAA2B;AACxC;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B;;AAE1B;AACA;AACA;AACA;;;;;;;ACnIA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;AACA,4BAA4B,UAAU;;;;;;;ACnLtC;AACA;AACA;AACA;AACA,WAAW,IAAI;AACf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6CAA6C,IAAI;AACjD;AACA;AACA,eAAe,sBAAsB;AACrC;AACA;AACA,GAAG;AACH;AACA,iBAAiB,yBAAyB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD,IAAI;AAC3D;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;;;AAGF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;;;;;;AC7DA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;;AAEA,GAAG;;AAEH;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;;AAEA,GAAG;;;AAGH;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,mBAAmB;AACnC;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,mBAAmB;AACnC;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;;AAIA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,gBAAgB,oBAAoB;AACpC;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;;;;;;ACxSA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,EAAE;AACF;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;AACA;AACA;AACA;;;;AAIA,GAAG;AACH;AACA;AACA;;AAEA,EAAE;AACF;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL,GAAG;AACH;AACA;AACA;;AAEA,EAAE;;AAEF;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,IAAI;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,YAAY,SAAS;AACrB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,EAAE;;AAEF;;AAEA;;AAEA;;;;;;;AChOA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB;;AAEvB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF,gBAAgB,kBAAkB;AAClC;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AClHA;AACA;;AAEA;AACA,uEAAuE;AACvE;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA,mCAAmC;AACnC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,6CAA6C;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,yCAAyC;AACzC;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;ACvJA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;;AAGA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH,iBAAiB,mBAAmB;AACpC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,sBAAsB;AACtB,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,EAAE;;AAEF;AACA,eAAe;;AAEf;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,mBAAmB;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB;;AAElB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA,EAAE;AACF;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA,EAAE;AACF;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA;AACA;;AAEA,4BAA4B,QAAQ;AACpC;AACA,2EAA2E;AAC3E;;AAEA;AACA,qCAAqC,gBAAgB;AACrD;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,gBAAgB,2CAA2C;;AAE3D;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,gBAAgB,aAAa;;AAE7B;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;;;;;;AC7pBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,gDAAgD;AAChD;AACA;AACA;AACA;AACA,+BAA+B,2DAA2D;AAC1F;AACA;AACA;AACA,EAAE;;AAEF,kDAAkD;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,GAAG;AACH;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;;AAGA,EAAE;;AAEF;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;;AAGA,EAAE;;AAEF;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,iBAAiB;AACjC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uCAAuC,wCAAwC;;AAE/E;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,GAAG;;AAEH;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;;;;;;;AC9hBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,IAAI;AACf,WAAW,IAAI;AACf,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,IAAI;AACf;AACA;;AAEA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oFAAoF;AACpF,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA;;AAEA;AACA,mEAAmE;AACnE,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY;AACZ;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA,YAAY,EAAE;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,IAAI;AAChB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,GAAG;AACH;AACA;AACA;;AAEA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;AACA,YAAY,MAAM;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,KAAK;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;;AAEA;AACA;;AAEA;;;;;;;AC3iBA,gD;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa;AACb,6CAA6C;AAC7C,sBAAsB,0BAA0B;AAChD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;;AAGA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA,eAAe,OAAO;AACtB;AACA;AACA;;AAEA;AACA,eAAe,MAAM;AACrB;AACA;;AAEA;AACA,eAAe,UAAU;AACzB;AACA;;AAEA;AACA,eAAe,WAAW;AAC1B;AACA;;AAEA;AACA,eAAe,SAAS;AACxB;AACA;;AAEA;AACA,eAAe,IAAI;AACnB;AACA;AACA;;AAEA;AACA,eAAe,KAAK;AACpB;AACA;AACA;;AAEA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,UAAU;AACtB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,GAAG;;;;AAIH;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;;AAEA;;;;;;;AC/dA;AACA;;AAEA;;AAEA,2CAA2C;;AAE3C;;AAEA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF,kDAAkD;;AAElD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,gBAAgB,iBAAiB;AACjC;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,2BAA2B;;AAE3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;;AAGL,OAAO;;AAEP,EAAE;AACF;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,oBAAoB;AACpC;AACA;;AAEA;AACA,gBAAgB,kBAAkB;AAClC;AACA;;AAEA;AACA;AACA;;AAEA,8DAA8D;;AAE9D;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,KAAK;;AAEL;;AAEA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;;AAEA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,sBAAsB,QAAQ;AAC9B;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,EAAE;;AAEF,sBAAsB,QAAQ;AAC9B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uCAAuC,wCAAwC;;AAE/E;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;;;;;;ACtqBA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B,EAAE,eAAe;;AAEjB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA,GAAG;;AAEH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF,mBAAmB;AACnB;;AAEA;AACA;AACA,uCAAuC;AACvC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;;;AAIA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,EAAE;;AAEF;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA,GAAG;;AAEH,EAAE;AACF;AACA;;;AAGA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;;;;;;AC9jBA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,qBAAqB,oBAAoB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,gCAAgC;;AAEhC;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;AC1KA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kCAAkC,SAAS;AAC3C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0CAA0C,UAAU;AACpD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;;;;;;ACjHA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA,SAAS;AACT;AACA;;;;;;;;AC9DA;;AAEA;AACA;AACA;;;;;;;;ACJA;;AAEA;AACA;AACA;AACA,QAAQ;AACR,cAAc,aAAa,GAAG,eAAe;AAC7C;AACA;;;;;;;;ACRA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,OAAO,sBAAsB,EAAE;AAC/B;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACrBA;;AAEA;;AAEA,iCAAiC,kCAAkC;;;;;;;;ACJnE;;AAEA;AACA;AACA;;;;;;;;ACJA;;AAEA;AACA;AACA;AACA;AACA,EAAE,YAAY,cAAc;AAC5B;;;;;;;;ACPA;;AAEA;;AAEA;AACA;AACA;;;;;;;;ACNA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;;;;;;;AChBA;;AAEA;AACA;AACA;AACA;;;;;;;;ACLA;;AAEA;AACA;AACA;AACA;;;;;;;;ACLA;;AAEA;AACA;AACA;;;;;;;;ACJA;;AAEA;;AAEA;AACA;AACA;AACA;;;;;;;;ACPA;;AAEA;;AAEA;AACA;AACA;;;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB;AACA;AACA,mCAAmC,mBAAmB;AACtD;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,oCAAoC,mBAAmB;AACvD,GAAG;AACH;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,IAAI;AAChB,YAAY,SAAS;AACrB,YAAY,IAAI;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA,6DAA6D;AAC7D;;AAEA;AACA;AACA;AACA,kCAAkC,gBAAgB;AAClD,GAAG;AACH;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA,6DAA6D;AAC7D;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB,YAAY,OAAO;AACnB;AACA;AACA,6DAA6D;AAC7D;;AAEA;AACA;AACA;AACA,iCAAiC;AACjC,GAAG;AACH;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,IAAI;;AAEJ;;AAEA,EAAE;;AAEF;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,IAAI;;AAEJ;AACA;;;AAGA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACpPA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;;;;;;ACxCA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,oBAAoB;AAC/B,WAAW,SAAS;AACpB,WAAW,UAAU;AACrB,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA,EAAE,OAAO;AACT;AACA;;AAEA,kBAAkB;AAClB;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACzJA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,YAAY,IAAI;AAChB,YAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;AAIA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,GAAG;;AAEH;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,oDAAoD;AACpD;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA,CAAC;;AAED;;AAEA;;;;;;;ACvOA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B,6BAA6B;AAC7B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA,EAAE;;AAEF,6CAA6C,cAAc;AAC3D;;;;AAIA;;;;;;;ACtOA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,gBAAgB,SAAS;AACzB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACpKA;AACA;;AAEA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,MAAM;AAClB;AACA;AACA;;AAEA,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC9LA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,EAAE;;AAEF;;AAEA;;AAEA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,mBAAmB;AAC/B,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,mBAAmB;AAC/D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,wCAAwC;AACpF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA,gDAAgD,eAAe;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,2BAA2B;AACtE;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA,iCAAiC,oBAAoB;;AAErD;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;ACzRA;AACA;;AAEA;AACA;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE,cAAc;AAChB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,gBAAgB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,YAAY,YAAY;AACxB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,IAAI;AAChB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACxPA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB,WAAW,kBAAkB;AAC7B,WAAW,UAAU;AACrB,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,SAAS;AACrB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA,uCAAuC,oDAAoD;AAC3F,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,YAAY,UAAU;AACtB,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,UAAU;AACtB,YAAY,SAAS;AACrB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAI;;AAEJ;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA,GAAG;;AAEH;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,WAAW;AACvB,YAAY,SAAS;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;AACA,IAAI,oDAAoD;AACxD;AACA;;AAEA;;;;;;;AClOA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA,6CAA6C;AAC7C;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;;AAGA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;;AAEA;;AAEA;AACA;AACA;AACA,UAAU,OAAO;AACjB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA,YAAY,MAAM;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;;;;;;;ACzLA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,yBAAyB,0BAA0B,EAAE;AACrD,yBAAyB,0BAA0B,EAAE;;AAErD;;AAEA;;;AAGA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;;;;;;;AChKA,2DAA2D,kDAAkD,6BAA6B;AAC1I,gD;;;;;;;ACDA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,mBAAmB;AAC9B,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB,yCAAyC;AACzC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA","file":"epub.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory((function webpackLoadOptionalExternalModule() { try { return require(\"JSZip\"); } catch(e) {} }()), require(\"xmldom\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"JSZip\", \"xmldom\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ePub\"] = factory((function webpackLoadOptionalExternalModule() { try { return require(\"JSZip\"); } catch(e) {} }()), require(\"xmldom\"));\n\telse\n\t\troot[\"ePub\"] = factory(root[\"JSZip\"], root[\"xmldom\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_48__, __WEBPACK_EXTERNAL_MODULE_13__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmory imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmory exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tObject.defineProperty(exports, name, {\n \t\t\tconfigurable: false,\n \t\t\tenumerable: true,\n \t\t\tget: getter\n \t\t});\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/dist/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 50);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e56d9891783b1b6486a9","var base64 = require('base64-js');\nvar path = require('path');\n\nvar requestAnimationFrame = (typeof window != 'undefined') ? (window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame) : false;\n\n/**\n * creates a uri object\n * @param\t{string} urlString\ta url string (relative or absolute)\n * @param\t{[string]} baseString optional base for the url,\n * default to window.location.href\n * @return {object} url\n */\nfunction Url(urlString, baseString) {\n\tvar absolute = (urlString.indexOf('://') > -1);\n\tvar pathname = urlString;\n\n\tthis.Url = undefined;\n\tthis.href = urlString;\n\tthis.protocol = \"\";\n\tthis.origin = \"\";\n\tthis.fragment = \"\";\n\tthis.search = \"\";\n\tthis.base = baseString;\n\n\tif (!absolute && (typeof(baseString) !== \"string\")) {\n\t\tthis.base = window && window.location.href;\n\t}\n\n\t// URL Polyfill doesn't throw an error if base is empty\n\tif (absolute || this.base) {\n\t\ttry {\n\t\t\tthis.Url = new URL(urlString, this.base);\n\t\t\tthis.href = this.Url.href;\n\n\t\t\tthis.protocol = this.Url.protocol;\n\t\t\tthis.origin = this.Url.origin;\n\t\t\tthis.fragment = this.Url.fragment;\n\t\t\tthis.search = this.Url.search;\n\n\t\t\tpathname = this.Url.pathname;\n\t\t} catch (e) {\n\t\t\t// Skip URL parsing\n\t\t\tthis.Url = undefined;\n\t\t}\n\t}\n\n\tthis.Path = new Path(pathname);\n\tthis.directory = this.Path.directory;\n\tthis.filename = this.Path.filename;\n\tthis.extension = this.Path.extension;\n\n}\n\nUrl.prototype.path = function () {\n\treturn this.Path;\n};\n\nUrl.prototype.resolve = function (what) {\n\tvar isAbsolute = (what.indexOf('://') > -1);\n\tvar fullpath;\n\n\tif (isAbsolute) {\n\t\treturn what;\n\t}\n\n\tfullpath = path.resolve(this.directory, what);\n\treturn this.origin + fullpath;\n};\n\nUrl.prototype.relative = function (what) {\n\treturn path.relative(what, this.directory);\n};\n\nUrl.prototype.toString = function () {\n\treturn this.href;\n};\n\nfunction Path(pathString) {\n\tvar protocol;\n\tvar parsed;\n\n\tprotocol = pathString.indexOf('://');\n\tif (protocol > -1) {\n\t\tpathString = new URL(pathString).pathname;\n\t}\n\n\tparsed = this.parse(pathString);\n\n\tthis.path = pathString;\n\n\tif (this.isDirectory(pathString)) {\n\t\tthis.directory = pathString;\n\t} else {\n\t\tthis.directory = parsed.dir + \"/\";\n\t}\n\n\tthis.filename = parsed.base;\n\tthis.extension = parsed.ext.slice(1);\n\n}\n\nPath.prototype.parse = function (what) {\n\treturn path.parse(what);\n};\n\nPath.prototype.isAbsolute = function (what) {\n\treturn path.isAbsolute(what || this.path);\n};\n\nPath.prototype.isDirectory = function (what) {\n\treturn (what.charAt(what.length-1) === '/');\n};\n\nPath.prototype.resolve = function (what) {\n\treturn path.resolve(this.directory, what);\n};\n\nPath.prototype.relative = function (what) {\n\treturn path.relative(this.directory, what);\n};\n\nPath.prototype.splitPath = function(filename) {\n\treturn this.splitPathRe.exec(filename).slice(1);\n};\n\nPath.prototype.toString = function () {\n\treturn this.path;\n};\n\nfunction assertPath(path) {\n\tif (typeof path !== 'string') {\n\t\tthrow new TypeError('Path must be a string. Received ', path);\n\t}\n};\n\nfunction isElement(obj) {\n\t\treturn !!(obj && obj.nodeType == 1);\n};\n\n// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript\nfunction uuid() {\n\tvar d = new Date().getTime();\n\tvar uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n\t\t\tvar r = (d + Math.random()*16)%16 | 0;\n\t\t\td = Math.floor(d/16);\n\t\t\treturn (c=='x' ? r : (r&0x7|0x8)).toString(16);\n\t});\n\treturn uuid;\n};\n\n// From Lodash\nfunction values(object) {\n\tvar index = -1,\n\t\t\tprops = Object.keys(object),\n\t\t\tlength = props.length,\n\t\t\tresult = Array(length);\n\n\twhile (++index < length) {\n\t\tresult[index] = object[props[index]];\n\t}\n\treturn result;\n};\n\nfunction resolveUrl(base, path) {\n\tvar url = [],\n\t\tsegments = [],\n\t\tbaseUri = uri(base),\n\t\tpathUri = uri(path),\n\t\tbaseDirectory = baseUri.directory,\n\t\tpathDirectory = pathUri.directory,\n\t\tdirectories = [],\n\t\t// folders = base.split(\"/\"),\n\t\tpaths;\n\n\t// if(uri.host) {\n\t//\t return path;\n\t// }\n\n\tif(baseDirectory[0] === \"/\") {\n\t\tbaseDirectory = baseDirectory.substring(1);\n\t}\n\n\tif(pathDirectory[pathDirectory.length-1] === \"/\") {\n\t\tbaseDirectory = baseDirectory.substring(0, baseDirectory.length-1);\n\t}\n\n\tif(pathDirectory[0] === \"/\") {\n\t\tpathDirectory = pathDirectory.substring(1);\n\t}\n\n\tif(pathDirectory[pathDirectory.length-1] === \"/\") {\n\t\tpathDirectory = pathDirectory.substring(0, pathDirectory.length-1);\n\t}\n\n\tif(baseDirectory) {\n\t\tdirectories = baseDirectory.split(\"/\");\n\t}\n\n\tpaths = pathDirectory.split(\"/\");\n\n\tpaths.reverse().forEach(function(part, index){\n\t\tif(part === \"..\"){\n\t\t\tdirectories.pop();\n\t\t} else if(part === directories[directories.length-1]) {\n\t\t\tdirectories.pop();\n\t\t\tsegments.unshift(part);\n\t\t} else {\n\t\t\tsegments.unshift(part);\n\t\t}\n\t});\n\n\turl = [baseUri.origin];\n\n\tif(directories.length) {\n\t\turl = url.concat(directories);\n\t}\n\n\tif(segments) {\n\t\turl = url.concat(segments);\n\t}\n\n\turl = url.concat(pathUri.filename);\n\n\treturn url.join(\"/\");\n};\n\nfunction documentHeight() {\n\treturn Math.max(\n\t\t\tdocument.documentElement.clientHeight,\n\t\t\tdocument.body.scrollHeight,\n\t\t\tdocument.documentElement.scrollHeight,\n\t\t\tdocument.body.offsetHeight,\n\t\t\tdocument.documentElement.offsetHeight\n\t);\n};\n\nfunction isNumber(n) {\n\treturn !isNaN(parseFloat(n)) && isFinite(n);\n};\n\nfunction prefixed(unprefixed) {\n\tvar vendors = [\"Webkit\", \"Moz\", \"O\", \"ms\" ],\n\t\tprefixes = ['-Webkit-', '-moz-', '-o-', '-ms-'],\n\t\tupper = unprefixed[0].toUpperCase() + unprefixed.slice(1),\n\t\tlength = vendors.length;\n\n\tif (typeof(document) === 'undefined' || typeof(document.body.style[unprefixed]) != 'undefined') {\n\t\treturn unprefixed;\n\t}\n\n\tfor ( var i=0; i < length; i++ ) {\n\t\tif (typeof(document.body.style[vendors[i] + upper]) != 'undefined') {\n\t\t\treturn vendors[i] + upper;\n\t\t}\n\t}\n\n\treturn unprefixed;\n};\n\nfunction defaults(obj) {\n\tfor (var i = 1, length = arguments.length; i < length; i++) {\n\t\tvar source = arguments[i];\n\t\tfor (var prop in source) {\n\t\t\tif (obj[prop] === void 0) obj[prop] = source[prop];\n\t\t}\n\t}\n\treturn obj;\n};\n\nfunction extend(target) {\n\t\tvar sources = [].slice.call(arguments, 1);\n\t\tsources.forEach(function (source) {\n\t\t\tif(!source) return;\n\t\t\tObject.getOwnPropertyNames(source).forEach(function(propName) {\n\t\t\t\tObject.defineProperty(target, propName, Object.getOwnPropertyDescriptor(source, propName));\n\t\t\t});\n\t\t});\n\t\treturn target;\n};\n\n// Fast quicksort insert for sorted array -- based on:\n// http://stackoverflow.com/questions/1344500/efficient-way-to-insert-a-number-into-a-sorted-array-of-numbers\nfunction insert(item, array, compareFunction) {\n\tvar location = locationOf(item, array, compareFunction);\n\tarray.splice(location, 0, item);\n\n\treturn location;\n};\n// Returns where something would fit in\nfunction locationOf(item, array, compareFunction, _start, _end) {\n\tvar start = _start || 0;\n\tvar end = _end || array.length;\n\tvar pivot = parseInt(start + (end - start) / 2);\n\tvar compared;\n\tif(!compareFunction){\n\t\tcompareFunction = function(a, b) {\n\t\t\tif(a > b) return 1;\n\t\t\tif(a < b) return -1;\n\t\t\tif(a = b) return 0;\n\t\t};\n\t}\n\tif(end-start <= 0) {\n\t\treturn pivot;\n\t}\n\n\tcompared = compareFunction(array[pivot], item);\n\tif(end-start === 1) {\n\t\treturn compared > 0 ? pivot : pivot + 1;\n\t}\n\n\tif(compared === 0) {\n\t\treturn pivot;\n\t}\n\tif(compared === -1) {\n\t\treturn locationOf(item, array, compareFunction, pivot, end);\n\t} else{\n\t\treturn locationOf(item, array, compareFunction, start, pivot);\n\t}\n};\n// Returns -1 of mpt found\nfunction indexOfSorted(item, array, compareFunction, _start, _end) {\n\tvar start = _start || 0;\n\tvar end = _end || array.length;\n\tvar pivot = parseInt(start + (end - start) / 2);\n\tvar compared;\n\tif(!compareFunction){\n\t\tcompareFunction = function(a, b) {\n\t\t\tif(a > b) return 1;\n\t\t\tif(a < b) return -1;\n\t\t\tif(a = b) return 0;\n\t\t};\n\t}\n\tif(end-start <= 0) {\n\t\treturn -1; // Not found\n\t}\n\n\tcompared = compareFunction(array[pivot], item);\n\tif(end-start === 1) {\n\t\treturn compared === 0 ? pivot : -1;\n\t}\n\tif(compared === 0) {\n\t\treturn pivot; // Found\n\t}\n\tif(compared === -1) {\n\t\treturn indexOfSorted(item, array, compareFunction, pivot, end);\n\t} else{\n\t\treturn indexOfSorted(item, array, compareFunction, start, pivot);\n\t}\n};\n\nfunction bounds(el) {\n\n\tvar style = window.getComputedStyle(el);\n\tvar widthProps = [\"width\", \"paddingRight\", \"paddingLeft\", \"marginRight\", \"marginLeft\", \"borderRightWidth\", \"borderLeftWidth\"];\n\tvar heightProps = [\"height\", \"paddingTop\", \"paddingBottom\", \"marginTop\", \"marginBottom\", \"borderTopWidth\", \"borderBottomWidth\"];\n\n\tvar width = 0;\n\tvar height = 0;\n\n\twidthProps.forEach(function(prop){\n\t\twidth += parseFloat(style[prop]) || 0;\n\t});\n\n\theightProps.forEach(function(prop){\n\t\theight += parseFloat(style[prop]) || 0;\n\t});\n\n\treturn {\n\t\theight: height,\n\t\twidth: width\n\t};\n\n};\n\nfunction borders(el) {\n\n\tvar style = window.getComputedStyle(el);\n\tvar widthProps = [\"paddingRight\", \"paddingLeft\", \"marginRight\", \"marginLeft\", \"borderRightWidth\", \"borderLeftWidth\"];\n\tvar heightProps = [\"paddingTop\", \"paddingBottom\", \"marginTop\", \"marginBottom\", \"borderTopWidth\", \"borderBottomWidth\"];\n\n\tvar width = 0;\n\tvar height = 0;\n\n\twidthProps.forEach(function(prop){\n\t\twidth += parseFloat(style[prop]) || 0;\n\t});\n\n\theightProps.forEach(function(prop){\n\t\theight += parseFloat(style[prop]) || 0;\n\t});\n\n\treturn {\n\t\theight: height,\n\t\twidth: width\n\t};\n\n};\n\nfunction windowBounds() {\n\n\tvar width = window.innerWidth;\n\tvar height = window.innerHeight;\n\n\treturn {\n\t\ttop: 0,\n\t\tleft: 0,\n\t\tright: width,\n\t\tbottom: height,\n\t\twidth: width,\n\t\theight: height\n\t};\n\n};\n\n//https://stackoverflow.com/questions/13482352/xquery-looking-for-text-with-single-quote/13483496#13483496\nfunction cleanStringForXpath(str)\t{\n\t\tvar parts = str.match(/[^'\"]+|['\"]/g);\n\t\tparts = parts.map(function(part){\n\t\t\t\tif (part === \"'\")\t{\n\t\t\t\t\t\treturn '\\\"\\'\\\"'; // output \"'\"\n\t\t\t\t}\n\n\t\t\t\tif (part === '\"') {\n\t\t\t\t\t\treturn \"\\'\\\"\\'\"; // output '\"'\n\t\t\t\t}\n\t\t\t\treturn \"\\'\" + part + \"\\'\";\n\t\t});\n\t\treturn \"concat(\\'\\',\" + parts.join(\",\") + \")\";\n};\n\nfunction indexOfTextNode(textNode){\n\tvar parent = textNode.parentNode;\n\tvar children = parent.childNodes;\n\tvar sib;\n\tvar index = -1;\n\tfor (var i = 0; i < children.length; i++) {\n\t\tsib = children[i];\n\t\tif(sib.nodeType === Node.TEXT_NODE){\n\t\t\tindex++;\n\t\t}\n\t\tif(sib == textNode) break;\n\t}\n\n\treturn index;\n};\n\nfunction isXml(ext) {\n\treturn ['xml', 'opf', 'ncx'].indexOf(ext) > -1;\n}\n\nfunction createBlob(content, mime){\n\tvar blob = new Blob([content], {type : mime });\n\n\treturn blob;\n};\n\nfunction createBlobUrl(content, mime){\n\tvar _URL = window.URL || window.webkitURL || window.mozURL;\n\tvar tempUrl;\n\tvar blob = this.createBlob(content, mime);\n\n\ttempUrl = _URL.createObjectURL(blob);\n\n\treturn tempUrl;\n};\n\nfunction createBase64Url(content, mime){\n\tvar string;\n\tvar data;\n\tvar datauri;\n\n\tif (typeof(content) !== \"string\") {\n\t\t// Only handles strings\n\t\treturn;\n\t}\n\n\tdata = btoa(content);\n\n\tdatauri = \"data:\" + mime + \";base64,\" + data;\n\n\treturn datauri;\n};\n\nfunction type(obj){\n\treturn Object.prototype.toString.call(obj).slice(8, -1);\n}\n\nfunction parse(markup, mime) {\n\tvar doc;\n\t// console.log(\"parse\", markup);\n\n\tif (typeof DOMParser === \"undefined\") {\n\t\tDOMParser = require('xmldom').DOMParser;\n\t}\n\n\n\tdoc = new DOMParser().parseFromString(markup, mime);\n\n\treturn doc;\n}\n\nfunction qs(el, sel) {\n\tvar elements;\n\n\tif (typeof el.querySelector != \"undefined\") {\n\t\treturn el.querySelector(sel);\n\t} else {\n\t\telements = el.getElementsByTagName(sel);\n\t\tif (elements.length) {\n\t\t\treturn elements[0];\n\t\t}\n\t}\n}\n\nfunction qsa(el, sel) {\n\n\tif (typeof el.querySelector != \"undefined\") {\n\t\treturn el.querySelectorAll(sel);\n\t} else {\n\t\treturn el.getElementsByTagName(sel);\n\t}\n}\n\nfunction qsp(el, sel, props) {\n\tvar q, filtered;\n\tif (typeof el.querySelector != \"undefined\") {\n\t\tsel += '[';\n\t\tfor (var prop in props) {\n\t\t\tsel += prop + \"='\" + props[prop] + \"'\";\n\t\t}\n\t\tsel += ']';\n\t\treturn el.querySelector(sel);\n\t} else {\n\t\tq = el.getElementsByTagName(sel);\n\t\tfiltered = Array.prototype.slice.call(q, 0).filter(function(el) {\n\t\t\tfor (var prop in props) {\n\t\t\t\tif(el.getAttribute(prop) === props[prop]){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\n\t\tif (filtered) {\n\t\t\treturn filtered[0];\n\t\t}\n\t}\n}\n\nfunction blob2base64(blob, cb) {\n\tvar reader = new FileReader();\n\treader.readAsDataURL(blob);\n\treader.onloadend = function() {\n\t\tcb(reader.result);\n\t}\n}\n\n// From: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred#backwards_forwards_compatible\nfunction defer() {\n\t/* A method to resolve the associated Promise with the value passed.\n\t * If the promise is already settled it does nothing.\n\t *\n\t * @param {anything} value : This value is used to resolve the promise\n\t * If the value is a Promise then the associated promise assumes the state\n\t * of Promise passed as value.\n\t */\n\tthis.resolve = null;\n\n\t/* A method to reject the assocaited Promise with the value passed.\n\t * If the promise is already settled it does nothing.\n\t *\n\t * @param {anything} reason: The reason for the rejection of the Promise.\n\t * Generally its an Error object. If however a Promise is passed, then the Promise\n\t * itself will be the reason for rejection no matter the state of the Promise.\n\t */\n\tthis.reject = null;\n\n\tthis.id = uuid();\n\n\t/* A newly created Pomise object.\n\t * Initially in pending state.\n\t */\n\tthis.promise = new Promise(function(resolve, reject) {\n\t\tthis.resolve = resolve;\n\t\tthis.reject = reject;\n\t}.bind(this));\n\tObject.freeze(this);\n}\n\n function querySelectorByType(html, element, type){\n\tvar query;\n\tif (typeof html.querySelector != \"undefined\") {\n\t\tquery = html.querySelector(element+'[*|type=\"'+type+'\"]');\n\t}\n\t// Handle IE not supporting namespaced epub:type in querySelector\n\tif(!query || query.length === 0) {\n\t\tquery = this.qsa(html, element);\n\t\tfor (var i = 0; i < query.length; i++) {\n\t\t\tif(query[i].getAttributeNS(\"http://www.idpf.org/2007/ops\", \"type\") === type) {\n\t\t\t\treturn query[i];\n\t\t\t}\n\t\t}\n\t} else {\n\t\treturn query;\n\t}\n}\n\n\n\nmodule.exports = {\n\t'isElement': isElement,\n\t'uuid': uuid,\n\t'values': values,\n\t'resolveUrl': resolveUrl,\n\t'indexOfSorted': indexOfSorted,\n\t'documentHeight': documentHeight,\n\t'isNumber': isNumber,\n\t'prefixed': prefixed,\n\t'defaults': defaults,\n\t'extend': extend,\n\t'insert': insert,\n\t'locationOf': locationOf,\n\t'indexOfSorted': indexOfSorted,\n\t'requestAnimationFrame': requestAnimationFrame,\n\t'bounds': bounds,\n\t'borders': borders,\n\t'windowBounds': windowBounds,\n\t'cleanStringForXpath': cleanStringForXpath,\n\t'indexOfTextNode': indexOfTextNode,\n\t'isXml': isXml,\n\t'createBlob': createBlob,\n\t'createBlobUrl': createBlobUrl,\n\t'type': type,\n\t'parse' : parse,\n\t'qs' : qs,\n\t'qsa' : qsa,\n\t'qsp' : qsp,\n\t'blob2base64' : blob2base64,\n\t'createBase64Url': createBase64Url,\n\t'defer': defer,\n\t'Url': Url,\n\t'Path': Path,\n\t'querySelectorByType': querySelectorByType\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/core.js\n// module id = 0\n// module chunks = 0","var core = require('./core');\n\n/**\n\tEPUB CFI spec: http://www.idpf.org/epub/linking/cfi/epub-cfi.html\n\n\tImplements:\n\t- Character Offset: epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/2/1:3)\n\t- Simple Ranges : epubcfi(/6/4[chap01ref]!/4[body01]/10[para05],/2/1:1,/3:4)\n\n\tDoes Not Implement:\n\t- Temporal Offset (~)\n\t- Spatial Offset (@)\n\t- Temporal-Spatial Offset (~ + @)\n\t- Text Location Assertion ([)\n*/\n\nfunction EpubCFI(cfiFrom, base, ignoreClass){\n\tvar type;\n\n\tthis.str = '';\n\n\tthis.base = {};\n\tthis.spinePos = 0; // For compatibility\n\n\tthis.range = false; // true || false;\n\n\tthis.path = {};\n\tthis.start = null;\n\tthis.end = null;\n\n\t// Allow instantiation without the 'new' keyword\n\tif (!(this instanceof EpubCFI)) {\n\t\treturn new EpubCFI(cfiFrom, base, ignoreClass);\n\t}\n\n\tif(typeof base === 'string') {\n\t\tthis.base = this.parseComponent(base);\n\t} else if(typeof base === 'object' && base.steps) {\n\t\tthis.base = base;\n\t}\n\n\ttype = this.checkType(cfiFrom);\n\n\n\tif(type === 'string') {\n\t\tthis.str = cfiFrom;\n\t\treturn core.extend(this, this.parse(cfiFrom));\n\t} else if (type === 'range') {\n\t\treturn core.extend(this, this.fromRange(cfiFrom, this.base, ignoreClass));\n\t} else if (type === 'node') {\n\t\treturn core.extend(this, this.fromNode(cfiFrom, this.base, ignoreClass));\n\t} else if (type === 'EpubCFI' && cfiFrom.path) {\n\t\treturn cfiFrom;\n\t} else if (!cfiFrom) {\n\t\treturn this;\n\t} else {\n\t\tthrow new TypeError('not a valid argument for EpubCFI');\n\t}\n\n};\n\nEpubCFI.prototype.checkType = function(cfi) {\n\n\tif (this.isCfiString(cfi)) {\n\t\treturn 'string';\n\t// Is a range object\n\t} else if (typeof cfi === 'object' && core.type(cfi) === \"Range\"){\n\t\treturn 'range';\n\t} else if (typeof cfi === 'object' && typeof(cfi.nodeType) != \"undefined\" ){ // || typeof cfi === 'function'\n\t\treturn 'node';\n\t} else if (typeof cfi === 'object' && cfi instanceof EpubCFI){\n\t\treturn 'EpubCFI';\n\t} else {\n\t\treturn false;\n\t}\n};\n\nEpubCFI.prototype.parse = function(cfiStr) {\n\tvar cfi = {\n\t\t\tspinePos: -1,\n\t\t\trange: false,\n\t\t\tbase: {},\n\t\t\tpath: {},\n\t\t\tstart: null,\n\t\t\tend: null\n\t\t};\n\tvar baseComponent, pathComponent, range;\n\n\tif(typeof cfiStr !== \"string\") {\n\t\treturn {spinePos: -1};\n\t}\n\n\tif(cfiStr.indexOf(\"epubcfi(\") === 0 && cfiStr[cfiStr.length-1] === \")\") {\n\t\t// Remove intial epubcfi( and ending )\n\t\tcfiStr = cfiStr.slice(8, cfiStr.length-1);\n\t}\n\n\tbaseComponent = this.getChapterComponent(cfiStr);\n\n\t// Make sure this is a valid cfi or return\n\tif(!baseComponent) {\n\t\treturn {spinePos: -1};\n\t}\n\n\tcfi.base = this.parseComponent(baseComponent);\n\n\tpathComponent = this.getPathComponent(cfiStr);\n\tcfi.path = this.parseComponent(pathComponent);\n\n\trange = this.getRange(cfiStr);\n\n\tif(range) {\n\t\tcfi.range = true;\n\t\tcfi.start = this.parseComponent(range[0]);\n\t\tcfi.end = this.parseComponent(range[1]);\n\t}\n\n\t// Get spine node position\n\t// cfi.spineSegment = cfi.base.steps[1];\n\n\t// Chapter segment is always the second step\n\tcfi.spinePos = cfi.base.steps[1].index;\n\n\treturn cfi;\n};\n\nEpubCFI.prototype.parseComponent = function(componentStr){\n\tvar component = {\n\t\tsteps: [],\n\t\tterminal: {\n\t\t\toffset: null,\n\t\t\tassertion: null\n\t\t}\n\t};\n\tvar parts = componentStr.split(':');\n\tvar steps = parts[0].split('/');\n\tvar terminal;\n\n\tif(parts.length > 1) {\n\t\tterminal = parts[1];\n\t\tcomponent.terminal = this.parseTerminal(terminal);\n\t}\n\n\tif (steps[0] === '') {\n\t\tsteps.shift(); // Ignore the first slash\n\t}\n\n\tcomponent.steps = steps.map(function(step){\n\t\treturn this.parseStep(step);\n\t}.bind(this));\n\n\treturn component;\n};\n\nEpubCFI.prototype.parseStep = function(stepStr){\n\tvar type, num, index, has_brackets, id;\n\n\thas_brackets = stepStr.match(/\\[(.*)\\]/);\n\tif(has_brackets && has_brackets[1]){\n\t\tid = has_brackets[1];\n\t}\n\n\t//-- Check if step is a text node or element\n\tnum = parseInt(stepStr);\n\n\tif(isNaN(num)) {\n\t\treturn;\n\t}\n\n\tif(num % 2 === 0) { // Even = is an element\n\t\ttype = \"element\";\n\t\tindex = num / 2 - 1;\n\t} else {\n\t\ttype = \"text\";\n\t\tindex = (num - 1 ) / 2;\n\t}\n\n\treturn {\n\t\t\"type\" : type,\n\t\t'index' : index,\n\t\t'id' : id || null\n\t};\n};\n\nEpubCFI.prototype.parseTerminal = function(termialStr){\n\tvar characterOffset, textLocationAssertion;\n\tvar assertion = termialStr.match(/\\[(.*)\\]/);\n\n\tif(assertion && assertion[1]){\n\t\tcharacterOffset = parseInt(termialStr.split('[')[0]) || null;\n\t\ttextLocationAssertion = assertion[1];\n\t} else {\n\t\tcharacterOffset = parseInt(termialStr) || null;\n\t}\n\n\treturn {\n\t\t'offset': characterOffset,\n\t\t'assertion': textLocationAssertion\n\t};\n\n};\n\nEpubCFI.prototype.getChapterComponent = function(cfiStr) {\n\n\tvar indirection = cfiStr.split(\"!\");\n\n\treturn indirection[0];\n};\n\nEpubCFI.prototype.getPathComponent = function(cfiStr) {\n\n\tvar indirection = cfiStr.split(\"!\");\n\n\tif(indirection[1]) {\n\t\tranges = indirection[1].split(',');\n\t\treturn ranges[0];\n\t}\n\n};\n\nEpubCFI.prototype.getRange = function(cfiStr) {\n\n\tvar ranges = cfiStr.split(\",\");\n\n\tif(ranges.length === 3){\n\t\treturn [\n\t\t\tranges[1],\n\t\t\tranges[2]\n\t\t];\n\t}\n\n\treturn false;\n};\n\nEpubCFI.prototype.getCharecterOffsetComponent = function(cfiStr) {\n\tvar splitStr = cfiStr.split(\":\");\n\treturn splitStr[1] || '';\n};\n\nEpubCFI.prototype.joinSteps = function(steps) {\n\tif(!steps) {\n\t\treturn \"\";\n\t}\n\n\treturn steps.map(function(part){\n\t\tvar segment = '';\n\n\t\tif(part.type === 'element') {\n\t\t\tsegment += (part.index + 1) * 2;\n\t\t}\n\n\t\tif(part.type === 'text') {\n\t\t\tsegment += 1 + (2 * part.index); // TODO: double check that this is odd\n\t\t}\n\n\t\tif(part.id) {\n\t\t\tsegment += \"[\" + part.id + \"]\";\n\t\t}\n\n\t\treturn segment;\n\n\t}).join('/');\n\n};\n\nEpubCFI.prototype.segmentString = function(segment) {\n\tvar segmentString = '/';\n\n\tsegmentString += this.joinSteps(segment.steps);\n\n\tif(segment.terminal && segment.terminal.offset != null){\n\t\tsegmentString += ':' + segment.terminal.offset;\n\t}\n\n\tif(segment.terminal && segment.terminal.assertion != null){\n\t\tsegmentString += '[' + segment.terminal.assertion + ']';\n\t}\n\n\treturn segmentString;\n};\n\nEpubCFI.prototype.toString = function() {\n\tvar cfiString = 'epubcfi(';\n\n\tcfiString += this.segmentString(this.base);\n\n\tcfiString += '!';\n\tcfiString += this.segmentString(this.path);\n\n\t// Add Range, if present\n\tif(this.start) {\n\t\tcfiString += ',';\n\t\tcfiString += this.segmentString(this.start);\n\t}\n\n\tif(this.end) {\n\t\tcfiString += ',';\n\t\tcfiString += this.segmentString(this.end);\n\t}\n\n\tcfiString += \")\";\n\n\treturn cfiString;\n};\n\nEpubCFI.prototype.compare = function(cfiOne, cfiTwo) {\n\tif(typeof cfiOne === 'string') {\n\t\tcfiOne = new EpubCFI(cfiOne);\n\t}\n\tif(typeof cfiTwo === 'string') {\n\t\tcfiTwo = new EpubCFI(cfiTwo);\n\t}\n\t// Compare Spine Positions\n\tif(cfiOne.spinePos > cfiTwo.spinePos) {\n\t\treturn 1;\n\t}\n\tif(cfiOne.spinePos < cfiTwo.spinePos) {\n\t\treturn -1;\n\t}\n\n\n\t// Compare Each Step in the First item\n\tfor (var i = 0; i < cfiOne.path.steps.length; i++) {\n\t\tif(!cfiTwo.path.steps[i]) {\n\t\t\treturn 1;\n\t\t}\n\t\tif(cfiOne.path.steps[i].index > cfiTwo.path.steps[i].index) {\n\t\t\treturn 1;\n\t\t}\n\t\tif(cfiOne.path.steps[i].index < cfiTwo.path.steps[i].index) {\n\t\t\treturn -1;\n\t\t}\n\t\t// Otherwise continue checking\n\t}\n\n\t// All steps in First equal to Second and First is Less Specific\n\tif(cfiOne.path.steps.length < cfiTwo.path.steps.length) {\n\t\treturn 1;\n\t}\n\n\t// Compare the charecter offset of the text node\n\tif(cfiOne.path.terminal.offset > cfiTwo.path.terminal.offset) {\n\t\treturn 1;\n\t}\n\tif(cfiOne.path.terminal.offset < cfiTwo.path.terminal.offset) {\n\t\treturn -1;\n\t}\n\n\t// TODO: compare ranges\n\n\t// CFI's are equal\n\treturn 0;\n};\n\nEpubCFI.prototype.step = function(node) {\n\tvar nodeType = (node.nodeType === Node.TEXT_NODE) ? 'text' : 'element';\n\n\treturn {\n\t\t'id' : node.id,\n\t\t'tagName' : node.tagName,\n\t\t'type' : nodeType,\n\t\t'index' : this.position(node)\n\t};\n};\n\nEpubCFI.prototype.filteredStep = function(node, ignoreClass) {\n\tvar filteredNode = this.filter(node, ignoreClass);\n\tvar nodeType;\n\n\t// Node filtered, so ignore\n\tif (!filteredNode) {\n\t\treturn;\n\t}\n\n\t// Otherwise add the filter node in\n\tnodeType = (filteredNode.nodeType === Node.TEXT_NODE) ? 'text' : 'element';\n\n\treturn {\n\t\t'id' : filteredNode.id,\n\t\t'tagName' : filteredNode.tagName,\n\t\t'type' : nodeType,\n\t\t'index' : this.filteredPosition(filteredNode, ignoreClass)\n\t};\n};\n\nEpubCFI.prototype.pathTo = function(node, offset, ignoreClass) {\n\tvar segment = {\n\t\tsteps: [],\n\t\tterminal: {\n\t\t\toffset: null,\n\t\t\tassertion: null\n\t\t}\n\t};\n\tvar currentNode = node;\n\tvar step;\n\n\twhile(currentNode && currentNode.parentNode &&\n\t\t\t\tcurrentNode.parentNode.nodeType != Node.DOCUMENT_NODE) {\n\n\t\tif (ignoreClass) {\n\t\t\tstep = this.filteredStep(currentNode, ignoreClass);\n\t\t} else {\n\t\t\tstep = this.step(currentNode);\n\t\t}\n\n\t\tif (step) {\n\t\t\tsegment.steps.unshift(step);\n\t\t}\n\n\t\tcurrentNode = currentNode.parentNode;\n\n\t}\n\n\tif (offset != null && offset >= 0) {\n\n\t\tsegment.terminal.offset = offset;\n\n\t\t// Make sure we are getting to a textNode if there is an offset\n\t\tif(segment.steps[segment.steps.length-1].type != \"text\") {\n\t\t\tsegment.steps.push({\n\t\t\t\t'type' : \"text\",\n\t\t\t\t'index' : 0\n\t\t\t});\n\t\t}\n\n\t}\n\n\n\treturn segment;\n}\n\nEpubCFI.prototype.equalStep = function(stepA, stepB) {\n\tif (!stepA || !stepB) {\n\t\treturn false;\n\t}\n\n\tif(stepA.index === stepB.index &&\n\t\t stepA.id === stepB.id &&\n\t\t stepA.type === stepB.type) {\n\t\treturn true;\n\t}\n\n\treturn false;\n};\nEpubCFI.prototype.fromRange = function(range, base, ignoreClass) {\n\tvar cfi = {\n\t\t\trange: false,\n\t\t\tbase: {},\n\t\t\tpath: {},\n\t\t\tstart: null,\n\t\t\tend: null\n\t\t};\n\n\tvar start = range.startContainer;\n\tvar end = range.endContainer;\n\n\tvar startOffset = range.startOffset;\n\tvar endOffset = range.endOffset;\n\n\tvar needsIgnoring = false;\n\n\tif (ignoreClass) {\n\t\t// Tell pathTo if / what to ignore\n\t\tneedsIgnoring = (start.ownerDocument.querySelector('.' + ignoreClass) != null);\n\t}\n\n\n\tif (typeof base === 'string') {\n\t\tcfi.base = this.parseComponent(base);\n\t\tcfi.spinePos = cfi.base.steps[1].index;\n\t} else if (typeof base === 'object') {\n\t\tcfi.base = base;\n\t}\n\n\tif (range.collapsed) {\n\t\tif (needsIgnoring) {\n\t\t\tstartOffset = this.patchOffset(start, startOffset, ignoreClass);\n\t\t}\n\t\tcfi.path = this.pathTo(start, startOffset, ignoreClass);\n\t} else {\n\t\tcfi.range = true;\n\n\t\tif (needsIgnoring) {\n\t\t\tstartOffset = this.patchOffset(start, startOffset, ignoreClass);\n\t\t}\n\n\t\tcfi.start = this.pathTo(start, startOffset, ignoreClass);\n\n\t\tif (needsIgnoring) {\n\t\t\tendOffset = this.patchOffset(end, endOffset, ignoreClass);\n\t\t}\n\n\t\tcfi.end = this.pathTo(end, endOffset, ignoreClass);\n\n\t\t// Create a new empty path\n\t\tcfi.path = {\n\t\t\tsteps: [],\n\t\t\tterminal: null\n\t\t};\n\n\t\t// Push steps that are shared between start and end to the common path\n\t\tvar len = cfi.start.steps.length;\n\t\tvar i;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (this.equalStep(cfi.start.steps[i], cfi.end.steps[i])) {\n\t\t\t\tif(i == len-1) {\n\t\t\t\t\t// Last step is equal, check terminals\n\t\t\t\t\tif(cfi.start.terminal === cfi.end.terminal) {\n\t\t\t\t\t\t// CFI's are equal\n\t\t\t\t\t\tcfi.path.steps.push(cfi.start.steps[i]);\n\t\t\t\t\t\t// Not a range\n\t\t\t\t\t\tcfi.range = false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tcfi.path.steps.push(cfi.start.steps[i]);\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t};\n\n\t\tcfi.start.steps = cfi.start.steps.slice(cfi.path.steps.length);\n\t\tcfi.end.steps = cfi.end.steps.slice(cfi.path.steps.length);\n\n\t\t// TODO: Add Sanity check to make sure that the end if greater than the start\n\t}\n\n\treturn cfi;\n}\n\nEpubCFI.prototype.fromNode = function(anchor, base, ignoreClass) {\n\tvar cfi = {\n\t\t\trange: false,\n\t\t\tbase: {},\n\t\t\tpath: {},\n\t\t\tstart: null,\n\t\t\tend: null\n\t\t};\n\n\tvar needsIgnoring = false;\n\n\tif (ignoreClass) {\n\t\t// Tell pathTo if / what to ignore\n\t\tneedsIgnoring = (anchor.ownerDocument.querySelector('.' + ignoreClass) != null);\n\t}\n\n\tif (typeof base === 'string') {\n\t\tcfi.base = this.parseComponent(base);\n\t\tcfi.spinePos = cfi.base.steps[1].index;\n\t} else if (typeof base === 'object') {\n\t\tcfi.base = base;\n\t}\n\n\tcfi.path = this.pathTo(anchor, null, ignoreClass);\n\n\treturn cfi;\n};\n\n\nEpubCFI.prototype.filter = function(anchor, ignoreClass) {\n\tvar needsIgnoring;\n\tvar sibling; // to join with\n\tvar parent, prevSibling, nextSibling;\n\tvar isText = false;\n\n\tif (anchor.nodeType === Node.TEXT_NODE) {\n\t\tisText = true;\n\t\tparent = anchor.parentNode;\n\t\tneedsIgnoring = anchor.parentNode.classList.contains(ignoreClass);\n\t} else {\n\t\tisText = false;\n\t\tneedsIgnoring = anchor.classList.contains(ignoreClass);\n\t}\n\n\tif (needsIgnoring && isText) {\n\t\tpreviousSibling = parent.previousSibling;\n\t\tnextSibling = parent.nextSibling;\n\n\t\t// If the sibling is a text node, join the nodes\n\t\tif (previousSibling && previousSibling.nodeType === Node.TEXT_NODE) {\n\t\t\tsibling = previousSibling;\n\t\t} else if (nextSibling && nextSibling.nodeType === Node.TEXT_NODE) {\n\t\t\tsibling = nextSibling;\n\t\t}\n\n\t\tif (sibling) {\n\t\t\treturn sibling;\n\t\t} else {\n\t\t\t// Parent will be ignored on next step\n\t\t\treturn anchor;\n\t\t}\n\n\t} else if (needsIgnoring && !isText) {\n\t\t// Otherwise just skip the element node\n\t\treturn false;\n\t} else {\n\t\t// No need to filter\n\t\treturn anchor;\n\t}\n\n};\n\nEpubCFI.prototype.patchOffset = function(anchor, offset, ignoreClass) {\n\tvar needsIgnoring;\n\tvar sibling;\n\n\tif (anchor.nodeType != Node.TEXT_NODE) {\n\t\tconsole.error(\"Anchor must be a text node\");\n\t\treturn;\n\t}\n\n\tvar curr = anchor;\n\tvar totalOffset = offset;\n\n\t// If the parent is a ignored node, get offset from it's start\n\tif (anchor.parentNode.classList.contains(ignoreClass)) {\n\t\tcurr = anchor.parentNode;\n\t}\n\n\twhile (curr.previousSibling) {\n\t\tif(curr.previousSibling.nodeType === Node.ELEMENT_NODE) {\n\t\t\t// Originally a text node, so join\n\t\t\tif(curr.previousSibling.classList.contains(ignoreClass)){\n\t\t\t\ttotalOffset += curr.previousSibling.textContent.length;\n\t\t\t} else {\n\t\t\t\tbreak; // Normal node, dont join\n\t\t\t}\n\t\t} else {\n\t\t\t// If the previous sibling is a text node, join the nodes\n\t\t\ttotalOffset += curr.previousSibling.textContent.length;\n\t\t}\n\n\t\tcurr = curr.previousSibling;\n\t}\n\n\treturn totalOffset;\n\n};\n\nEpubCFI.prototype.normalizedMap = function(children, nodeType, ignoreClass) {\n\tvar output = {};\n\tvar prevIndex = -1;\n\tvar i, len = children.length;\n\tvar currNodeType;\n\tvar prevNodeType;\n\n\tfor (i = 0; i < len; i++) {\n\n\t\tcurrNodeType = children[i].nodeType;\n\n\t\t// Check if needs ignoring\n\t\tif (currNodeType === Node.ELEMENT_NODE &&\n\t\t\t\tchildren[i].classList.contains(ignoreClass)) {\n\t\t\tcurrNodeType = Node.TEXT_NODE;\n\t\t}\n\n\t\tif (i > 0 &&\n\t\t\t\tcurrNodeType === Node.TEXT_NODE &&\n\t\t\t\tprevNodeType === Node.TEXT_NODE) {\n\t\t\t// join text nodes\n\t\t\toutput[i] = prevIndex;\n\t\t} else if (nodeType === currNodeType){\n\t\t\tprevIndex = prevIndex + 1;\n\t\t\toutput[i] = prevIndex;\n\t\t}\n\n\t\tprevNodeType = currNodeType;\n\n\t}\n\n\treturn output;\n};\n\nEpubCFI.prototype.position = function(anchor) {\n\tvar children, index, map;\n\n\tif (anchor.nodeType === Node.ELEMENT_NODE) {\n\t\tchildren = anchor.parentNode.children;\n\t\tindex = Array.prototype.indexOf.call(children, anchor);\n\t} else {\n\t\tchildren = this.textNodes(anchor.parentNode);\n\t\tindex = children.indexOf(anchor);\n\t}\n\n\treturn index;\n};\n\nEpubCFI.prototype.filteredPosition = function(anchor, ignoreClass) {\n\tvar children, index, map;\n\n\tif (anchor.nodeType === Node.ELEMENT_NODE) {\n\t\tchildren = anchor.parentNode.children;\n\t\tmap = this.normalizedMap(children, Node.ELEMENT_NODE, ignoreClass);\n\t} else {\n\t\tchildren = anchor.parentNode.childNodes;\n\t\t// Inside an ignored node\n\t\tif(anchor.parentNode.classList.contains(ignoreClass)) {\n\t\t\tanchor = anchor.parentNode;\n\t\t\tchildren = anchor.parentNode.childNodes;\n\t\t}\n\t\tmap = this.normalizedMap(children, Node.TEXT_NODE, ignoreClass);\n\t}\n\n\n\tindex = Array.prototype.indexOf.call(children, anchor);\n\n\treturn map[index];\n};\n\nEpubCFI.prototype.stepsToXpath = function(steps) {\n\tvar xpath = [\".\", \"*\"];\n\n\tsteps.forEach(function(step){\n\t\tvar position = step.index + 1;\n\n\t\tif(step.id){\n\t\t\txpath.push(\"*[position()=\" + position + \" and @id='\" + step.id + \"']\");\n\t\t} else if(step.type === \"text\") {\n\t\t\txpath.push(\"text()[\" + position + \"]\");\n\t\t} else {\n\t\t\txpath.push(\"*[\" + position + \"]\");\n\t\t}\n\t});\n\n\treturn xpath.join(\"/\");\n};\n\n\n/*\n\nTo get the last step if needed:\n\n// Get the terminal step\nlastStep = steps[steps.length-1];\n// Get the query string\nquery = this.stepsToQuery(steps);\n// Find the containing element\nstartContainerParent = doc.querySelector(query);\n// Find the text node within that element\nif(startContainerParent && lastStep.type == \"text\") {\n\tcontainer = startContainerParent.childNodes[lastStep.index];\n}\n*/\nEpubCFI.prototype.stepsToQuerySelector = function(steps) {\n\tvar query = [\"html\"];\n\n\tsteps.forEach(function(step){\n\t\tvar position = step.index + 1;\n\n\t\tif(step.id){\n\t\t\tquery.push(\"#\" + step.id);\n\t\t} else if(step.type === \"text\") {\n\t\t\t// unsupported in querySelector\n\t\t\t// query.push(\"text()[\" + position + \"]\");\n\t\t} else {\n\t\t\tquery.push(\"*:nth-child(\" + position + \")\");\n\t\t}\n\t});\n\n\treturn query.join(\">\");\n\n};\n\nEpubCFI.prototype.textNodes = function(container, ignoreClass) {\n\treturn Array.prototype.slice.call(container.childNodes).\n\t\tfilter(function (node) {\n\t\t\tif (node.nodeType === Node.TEXT_NODE) {\n\t\t\t\treturn true;\n\t\t\t} else if (ignoreClass && node.classList.contains(ignoreClass)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n};\n\nEpubCFI.prototype.walkToNode = function(steps, _doc, ignoreClass) {\n\tvar doc = _doc || document;\n\tvar container = doc.documentElement;\n\tvar step;\n\tvar len = steps.length;\n\tvar i;\n\n\tfor (i = 0; i < len; i++) {\n\t\tstep = steps[i];\n\n\t\tif(step.type === \"element\") {\n\t\t\tcontainer = container.children[step.index];\n\t\t} else if(step.type === \"text\"){\n\t\t\tcontainer = this.textNodes(container, ignoreClass)[step.index];\n\t\t}\n\n\t};\n\n\treturn container;\n};\n\nEpubCFI.prototype.findNode = function(steps, _doc, ignoreClass) {\n\tvar doc = _doc || document;\n\tvar container;\n\tvar xpath;\n\n\tif(!ignoreClass && typeof doc.evaluate != 'undefined') {\n\t\txpath = this.stepsToXpath(steps);\n\t\tcontainer = doc.evaluate(xpath, doc, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;\n\t} else if(ignoreClass) {\n\t\tcontainer = this.walkToNode(steps, doc, ignoreClass);\n\t} else {\n\t\tcontainer = this.walkToNode(steps, doc);\n\t}\n\n\treturn container;\n};\n\nEpubCFI.prototype.fixMiss = function(steps, offset, _doc, ignoreClass) {\n\tvar container = this.findNode(steps.slice(0,-1), _doc, ignoreClass);\n\tvar children = container.childNodes;\n\tvar map = this.normalizedMap(children, Node.TEXT_NODE, ignoreClass);\n\tvar i;\n\tvar child;\n\tvar len;\n\tvar childIndex;\n\tvar lastStepIndex = steps[steps.length-1].index;\n\n\tfor (var childIndex in map) {\n\t\tif (!map.hasOwnProperty(childIndex)) return;\n\n\t\tif(map[childIndex] === lastStepIndex) {\n\t\t\tchild = children[childIndex];\n\t\t\tlen = child.textContent.length;\n\t\t\tif(offset > len) {\n\t\t\t\toffset = offset - len;\n\t\t\t} else {\n\t\t\t\tif (child.nodeType === Node.ELEMENT_NODE) {\n\t\t\t\t\tcontainer = child.childNodes[0];\n\t\t\t\t} else {\n\t\t\t\t\tcontainer = child;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tcontainer: container,\n\t\toffset: offset\n\t};\n\n};\n\nEpubCFI.prototype.toRange = function(_doc, ignoreClass) {\n\tvar doc = _doc || document;\n\tvar range = doc.createRange();\n\tvar start, end, startContainer, endContainer;\n\tvar cfi = this;\n\tvar startSteps, endSteps;\n\tvar needsIgnoring = ignoreClass ? (doc.querySelector('.' + ignoreClass) != null) : false;\n\tvar missed;\n\n\tif (cfi.range) {\n\t\tstart = cfi.start;\n\t\tstartSteps = cfi.path.steps.concat(start.steps);\n\t\tstartContainer = this.findNode(startSteps, doc, needsIgnoring ? ignoreClass : null);\n\t\tend = cfi.end;\n\t\tendSteps = cfi.path.steps.concat(end.steps);\n\t\tendContainer = this.findNode(endSteps, doc, needsIgnoring ? ignoreClass : null);\n\t} else {\n\t\tstart = cfi.path;\n\t\tstartSteps = cfi.path.steps;\n\t\tstartContainer = this.findNode(cfi.path.steps, doc, needsIgnoring ? ignoreClass : null);\n\t}\n\n\tif(startContainer) {\n\t\ttry {\n\n\t\t\tif(start.terminal.offset != null) {\n\t\t\t\trange.setStart(startContainer, start.terminal.offset);\n\t\t\t} else {\n\t\t\t\trange.setStart(startContainer, 0);\n\t\t\t}\n\n\t\t} catch (e) {\n\t\t\tmissed = this.fixMiss(startSteps, start.terminal.offset, doc, needsIgnoring ? ignoreClass : null);\n\t\t\trange.setStart(missed.container, missed.offset);\n\t\t}\n\t} else {\n\t\t// No start found\n\t\treturn null;\n\t}\n\n\tif (endContainer) {\n\t\ttry {\n\n\t\t\tif(end.terminal.offset != null) {\n\t\t\t\trange.setEnd(endContainer, end.terminal.offset);\n\t\t\t} else {\n\t\t\t\trange.setEnd(endContainer, 0);\n\t\t\t}\n\n\t\t} catch (e) {\n\t\t\tmissed = this.fixMiss(endSteps, cfi.end.terminal.offset, doc, needsIgnoring ? ignoreClass : null);\n\t\t\trange.setEnd(missed.container, missed.offset);\n\t\t}\n\t}\n\n\n\t// doc.defaultView.getSelection().addRange(range);\n\treturn range;\n};\n\n// is a cfi string, should be wrapped with \"epubcfi()\"\nEpubCFI.prototype.isCfiString = function(str) {\n\tif(typeof str === 'string' &&\n\t\t\tstr.indexOf(\"epubcfi(\") === 0 &&\n\t\t\tstr[str.length-1] === \")\") {\n\t\treturn true;\n\t}\n\n\treturn false;\n};\n\nEpubCFI.prototype.generateChapterComponent = function(_spineNodeIndex, _pos, id) {\n\tvar pos = parseInt(_pos),\n\t\tspineNodeIndex = _spineNodeIndex + 1,\n\t\tcfi = '/'+spineNodeIndex+'/';\n\n\tcfi += (pos + 1) * 2;\n\n\tif(id) {\n\t\tcfi += \"[\" + id + \"]\";\n\t}\n\n\treturn cfi;\n};\n\nmodule.exports = EpubCFI;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/epubcfi.js\n// module id = 1\n// module chunks = 0","'use strict';\n\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + path);\n }\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path, allowAboveRoot) {\n var res = '';\n var lastSlash = -1;\n var dots = 0;\n var code;\n for (var i = 0; i <= path.length; ++i) {\n if (i < path.length)\n code = path.charCodeAt(i);\n else if (code === 47/*/*/)\n break;\n else\n code = 47/*/*/;\n if (code === 47/*/*/) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 ||\n res.charCodeAt(res.length - 1) !== 46/*.*/ ||\n res.charCodeAt(res.length - 2) !== 46/*.*/) {\n if (res.length > 2) {\n var start = res.length - 1;\n var j = start;\n for (; j >= 0; --j) {\n if (res.charCodeAt(j) === 47/*/*/)\n break;\n }\n if (j !== start) {\n if (j === -1)\n res = '';\n else\n res = res.slice(0, j);\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += '/..';\n else\n res = '..';\n }\n } else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46/*.*/ && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\nfunction _format(sep, pathObject) {\n var dir = pathObject.dir || pathObject.root;\n var base = pathObject.base ||\n ((pathObject.name || '') + (pathObject.ext || ''));\n if (!dir) {\n return base;\n }\n if (dir === pathObject.root) {\n return dir + base;\n }\n return dir + sep + base;\n}\n\nvar posix = {\n // path.resolve([from ...], to)\n resolve: function resolve() {\n var resolvedPath = '';\n var resolvedAbsolute = false;\n var cwd;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path;\n if (i >= 0)\n path = arguments[i];\n else {\n if (cwd === undefined)\n cwd = process.cwd();\n path = cwd;\n }\n\n assertPath(path);\n\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charCodeAt(0) === 47/*/*/;\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute) {\n if (resolvedPath.length > 0)\n return '/' + resolvedPath;\n else\n return '/';\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n } else {\n return '.';\n }\n },\n\n\n normalize: function normalize(path) {\n assertPath(path);\n\n if (path.length === 0)\n return '.';\n\n var isAbsolute = path.charCodeAt(0) === 47/*/*/;\n var trailingSeparator = path.charCodeAt(path.length - 1) === 47/*/*/;\n\n // Normalize the path\n path = normalizeStringPosix(path, !isAbsolute);\n\n if (path.length === 0 && !isAbsolute)\n path = '.';\n if (path.length > 0 && trailingSeparator)\n path += '/';\n\n if (isAbsolute)\n return '/' + path;\n return path;\n },\n\n\n isAbsolute: function isAbsolute(path) {\n assertPath(path);\n return path.length > 0 && path.charCodeAt(0) === 47/*/*/;\n },\n\n\n join: function join() {\n if (arguments.length === 0)\n return '.';\n var joined;\n for (var i = 0; i < arguments.length; ++i) {\n var arg = arguments[i];\n assertPath(arg);\n if (arg.length > 0) {\n if (joined === undefined)\n joined = arg;\n else\n joined += '/' + arg;\n }\n }\n if (joined === undefined)\n return '.';\n return posix.normalize(joined);\n },\n\n\n relative: function relative(from, to) {\n assertPath(from);\n assertPath(to);\n\n if (from === to)\n return '';\n\n from = posix.resolve(from);\n to = posix.resolve(to);\n\n if (from === to)\n return '';\n\n // Trim any leading backslashes\n var fromStart = 1;\n for (; fromStart < from.length; ++fromStart) {\n if (from.charCodeAt(fromStart) !== 47/*/*/)\n break;\n }\n var fromEnd = from.length;\n var fromLen = (fromEnd - fromStart);\n\n // Trim any leading backslashes\n var toStart = 1;\n for (; toStart < to.length; ++toStart) {\n if (to.charCodeAt(toStart) !== 47/*/*/)\n break;\n }\n var toEnd = to.length;\n var toLen = (toEnd - toStart);\n\n // Compare paths to find the longest common path from root\n var length = (fromLen < toLen ? fromLen : toLen);\n var lastCommonSep = -1;\n var i = 0;\n for (; i <= length; ++i) {\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === 47/*/*/) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n } else if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n } else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === 47/*/*/) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n } else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo'; to='/'\n lastCommonSep = 0;\n }\n }\n break;\n }\n var fromCode = from.charCodeAt(fromStart + i);\n var toCode = to.charCodeAt(toStart + i);\n if (fromCode !== toCode)\n break;\n else if (fromCode === 47/*/*/)\n lastCommonSep = i;\n }\n\n var out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === 47/*/*/) {\n if (out.length === 0)\n out += '..';\n else\n out += '/..';\n }\n }\n\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0)\n return out + to.slice(toStart + lastCommonSep);\n else {\n toStart += lastCommonSep;\n if (to.charCodeAt(toStart) === 47/*/*/)\n ++toStart;\n return to.slice(toStart);\n }\n },\n\n\n _makeLong: function _makeLong(path) {\n return path;\n },\n\n\n dirname: function dirname(path) {\n assertPath(path);\n if (path.length === 0)\n return '.';\n var code = path.charCodeAt(0);\n var hasRoot = (code === 47/*/*/);\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47/*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1)\n return hasRoot ? '/' : '.';\n if (hasRoot && end === 1)\n return '//';\n return path.slice(0, end);\n },\n\n\n basename: function basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string')\n throw new TypeError('\"ext\" argument must be a string');\n assertPath(path);\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext.length === path.length && ext === path)\n return '';\n var extIdx = ext.length - 1;\n var firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47/*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end)\n end = firstNonSlashEnd;\n else if (end === -1)\n end = path.length;\n return path.slice(start, end);\n } else {\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47/*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1)\n return '';\n return path.slice(start, end);\n }\n },\n\n\n extname: function extname(path) {\n assertPath(path);\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47/*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46/*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 ||\n end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 &&\n startDot === end - 1 &&\n startDot === startPart + 1)) {\n return '';\n }\n return path.slice(startDot, end);\n },\n\n\n format: function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError(\n 'Parameter \"pathObject\" must be an object, not ' + typeof(pathObject)\n );\n }\n return _format('/', pathObject);\n },\n\n\n parse: function parse(path) {\n assertPath(path);\n\n var ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0)\n return ret;\n var code = path.charCodeAt(0);\n var isAbsolute = (code === 47/*/*/);\n var start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n } else {\n start = 0;\n }\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n var i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i) {\n code = path.charCodeAt(i);\n if (code === 47/*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46/*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 ||\n end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 &&\n startDot === end - 1 &&\n startDot === startPart + 1)) {\n if (end !== -1) {\n if (startPart === 0 && isAbsolute)\n ret.base = ret.name = path.slice(1, end);\n else\n ret.base = ret.name = path.slice(startPart, end);\n }\n } else {\n if (startPart === 0 && isAbsolute) {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n } else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n if (startPart > 0)\n ret.dir = path.slice(0, startPart - 1);\n else if (isAbsolute)\n ret.dir = '/';\n\n return ret;\n },\n\n\n sep: '/',\n delimiter: ':',\n posix: null\n};\n\n\nmodule.exports = posix;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/path-webpack/path.js\n// module id = 2\n// module chunks = 0","'use strict';\n\nvar d = require('d')\n , callable = require('es5-ext/object/valid-callable')\n\n , apply = Function.prototype.apply, call = Function.prototype.call\n , create = Object.create, defineProperty = Object.defineProperty\n , defineProperties = Object.defineProperties\n , hasOwnProperty = Object.prototype.hasOwnProperty\n , descriptor = { configurable: true, enumerable: false, writable: true }\n\n , on, once, off, emit, methods, descriptors, base;\n\non = function (type, listener) {\n\tvar data;\n\n\tcallable(listener);\n\n\tif (!hasOwnProperty.call(this, '__ee__')) {\n\t\tdata = descriptor.value = create(null);\n\t\tdefineProperty(this, '__ee__', descriptor);\n\t\tdescriptor.value = null;\n\t} else {\n\t\tdata = this.__ee__;\n\t}\n\tif (!data[type]) data[type] = listener;\n\telse if (typeof data[type] === 'object') data[type].push(listener);\n\telse data[type] = [data[type], listener];\n\n\treturn this;\n};\n\nonce = function (type, listener) {\n\tvar once, self;\n\n\tcallable(listener);\n\tself = this;\n\ton.call(this, type, once = function () {\n\t\toff.call(self, type, once);\n\t\tapply.call(listener, this, arguments);\n\t});\n\n\tonce.__eeOnceListener__ = listener;\n\treturn this;\n};\n\noff = function (type, listener) {\n\tvar data, listeners, candidate, i;\n\n\tcallable(listener);\n\n\tif (!hasOwnProperty.call(this, '__ee__')) return this;\n\tdata = this.__ee__;\n\tif (!data[type]) return this;\n\tlisteners = data[type];\n\n\tif (typeof listeners === 'object') {\n\t\tfor (i = 0; (candidate = listeners[i]); ++i) {\n\t\t\tif ((candidate === listener) ||\n\t\t\t\t\t(candidate.__eeOnceListener__ === listener)) {\n\t\t\t\tif (listeners.length === 2) data[type] = listeners[i ? 0 : 1];\n\t\t\t\telse listeners.splice(i, 1);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif ((listeners === listener) ||\n\t\t\t\t(listeners.__eeOnceListener__ === listener)) {\n\t\t\tdelete data[type];\n\t\t}\n\t}\n\n\treturn this;\n};\n\nemit = function (type) {\n\tvar i, l, listener, listeners, args;\n\n\tif (!hasOwnProperty.call(this, '__ee__')) return;\n\tlisteners = this.__ee__[type];\n\tif (!listeners) return;\n\n\tif (typeof listeners === 'object') {\n\t\tl = arguments.length;\n\t\targs = new Array(l - 1);\n\t\tfor (i = 1; i < l; ++i) args[i - 1] = arguments[i];\n\n\t\tlisteners = listeners.slice();\n\t\tfor (i = 0; (listener = listeners[i]); ++i) {\n\t\t\tapply.call(listener, this, args);\n\t\t}\n\t} else {\n\t\tswitch (arguments.length) {\n\t\tcase 1:\n\t\t\tcall.call(listeners, this);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tcall.call(listeners, this, arguments[1]);\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tcall.call(listeners, this, arguments[1], arguments[2]);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tl = arguments.length;\n\t\t\targs = new Array(l - 1);\n\t\t\tfor (i = 1; i < l; ++i) {\n\t\t\t\targs[i - 1] = arguments[i];\n\t\t\t}\n\t\t\tapply.call(listeners, this, args);\n\t\t}\n\t}\n};\n\nmethods = {\n\ton: on,\n\tonce: once,\n\toff: off,\n\temit: emit\n};\n\ndescriptors = {\n\ton: d(on),\n\tonce: d(once),\n\toff: d(off),\n\temit: d(emit)\n};\n\nbase = defineProperties({}, descriptors);\n\nmodule.exports = exports = function (o) {\n\treturn (o == null) ? create(base) : defineProperties(Object(o), descriptors);\n};\nexports.methods = methods;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/event-emitter/index.js\n// module id = 3\n// module chunks = 0","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/process/browser.js\n// module id = 4\n// module chunks = 0 1","/**\n * Hooks allow for injecting functions that must all complete in order before finishing\n * They will execute in parallel but all must finish before continuing\n * Functions may return a promise if they are asycn.\n * @param {any} context scope of this\n * @example this.content = new EPUBJS.Hook(this);\n */\nfunction Hook(context){\n\tthis.context = context || this;\n\tthis.hooks = [];\n};\n\n/**\n * Adds a function to be run before a hook completes\n * @example this.content.register(function(){...});\n */\nHook.prototype.register = function(){\n\tfor(var i = 0; i < arguments.length; ++i) {\n\t\tif (typeof arguments[i] === \"function\") {\n\t\t\tthis.hooks.push(arguments[i]);\n\t\t} else {\n\t\t\t// unpack array\n\t\t\tfor(var j = 0; j < arguments[i].length; ++j) {\n\t\t\t\tthis.hooks.push(arguments[i][j]);\n\t\t\t}\n\t\t}\n\t}\n};\n\n/**\n * Triggers a hook to run all functions\n * @example this.content.trigger(args).then(function(){...});\n */\nHook.prototype.trigger = function(){\n\tvar args = arguments;\n\tvar context = this.context;\n\tvar promises = [];\n\n\tthis.hooks.forEach(function(task, i) {\n\t\tvar executing = task.apply(context, args);\n\n\t\tif(executing && typeof executing[\"then\"] === \"function\") {\n\t\t\t// Task is a function that returns a promise\n\t\t\tpromises.push(executing);\n\t\t}\n\t\t// Otherwise Task resolves immediately, continue\n\t});\n\n\n\treturn Promise.all(promises);\n};\n\n// Adds a function to be run before a hook completes\nHook.prototype.list = function(){\n\treturn this.hooks;\n};\n\nHook.prototype.clear = function(){\n\treturn this.hooks = [];\n};\n\nmodule.exports = Hook;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/hook.js\n// module id = 5\n// module chunks = 0","var EpubCFI = require('./epubcfi');\n\nfunction Mapping(layout){\n\tthis.layout = layout;\n};\n\nMapping.prototype.section = function(view) {\n\tvar ranges = this.findRanges(view);\n\tvar map = this.rangeListToCfiList(view.section.cfiBase, ranges);\n\n\treturn map;\n};\n\nMapping.prototype.page = function(contents, cfiBase, start, end) {\n\tvar root = contents && contents.document ? contents.document.body : false;\n\n\tif (!root) {\n\t\treturn;\n\t}\n\n\treturn this.rangePairToCfiPair(cfiBase, {\n\t\tstart: this.findStart(root, start, end),\n\t\tend: this.findEnd(root, start, end)\n\t});\n};\n\nMapping.prototype.walk = function(root, func) {\n\t//var treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT + NodeFilter.SHOW_TEXT, null, false);\n\tvar treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {\n\t\t\tacceptNode: function (node) {\n\t\t\t\t\tif ( node.data.trim().length > 0 ) {\n\t\t\t\t\t\treturn NodeFilter.FILTER_ACCEPT;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn NodeFilter.FILTER_REJECT;\n\t\t\t\t\t}\n\t\t\t}\n\t}, false);\n\tvar node;\n\tvar result;\n\twhile ((node = treeWalker.nextNode())) {\n\t\tresult = func(node);\n\t\tif(result) break;\n\t}\n\n\treturn result;\n};\n\nMapping.prototype.findRanges = function(view){\n\tvar columns = [];\n\tvar scrollWidth = view.contents.scrollWidth();\n\tvar count = this.layout.count(scrollWidth);\n\tvar column = this.layout.column;\n\tvar gap = this.layout.gap;\n\tvar start, end;\n\n\tfor (var i = 0; i < count.pages; i++) {\n\t\tstart = (column + gap) * i;\n\t\tend = (column * (i+1)) + (gap * i);\n\t\tcolumns.push({\n\t\t\tstart: this.findStart(view.document.body, start, end),\n\t\t\tend: this.findEnd(view.document.body, start, end)\n\t\t});\n\t}\n\n\treturn columns;\n};\n\nMapping.prototype.findStart = function(root, start, end){\n\tvar stack = [root];\n\tvar $el;\n\tvar found;\n\tvar $prev = root;\n\twhile (stack.length) {\n\n\t\t$el = stack.shift();\n\n\t\tfound = this.walk($el, function(node){\n\t\t\tvar left, right;\n\t\t\tvar elPos;\n\t\t\tvar elRange;\n\n\n\t\t\tif(node.nodeType == Node.TEXT_NODE){\n\t\t\t\telRange = document.createRange();\n\t\t\t\telRange.selectNodeContents(node);\n\t\t\t\telPos = elRange.getBoundingClientRect();\n\t\t\t} else {\n\t\t\t\telPos = node.getBoundingClientRect();\n\t\t\t}\n\n\t\t\tleft = elPos.left;\n\t\t\tright = elPos.right;\n\n\t\t\tif( left >= start && left <= end ) {\n\t\t\t\treturn node;\n\t\t\t} else if (right > start) {\n\t\t\t\treturn node;\n\t\t\t} else {\n\t\t\t\t$prev = node;\n\t\t\t\tstack.push(node);\n\t\t\t}\n\n\t\t});\n\n\t\tif(found) {\n\t\t\treturn this.findTextStartRange(found, start, end);\n\t\t}\n\n\t}\n\n\t// Return last element\n\treturn this.findTextStartRange($prev, start, end);\n};\n\nMapping.prototype.findEnd = function(root, start, end){\n\tvar stack = [root];\n\tvar $el;\n\tvar $prev = root;\n\tvar found;\n\n\twhile (stack.length) {\n\n\t\t$el = stack.shift();\n\n\t\tfound = this.walk($el, function(node){\n\n\t\t\tvar left, right;\n\t\t\tvar elPos;\n\t\t\tvar elRange;\n\n\n\t\t\tif(node.nodeType == Node.TEXT_NODE){\n\t\t\t\telRange = document.createRange();\n\t\t\t\telRange.selectNodeContents(node);\n\t\t\t\telPos = elRange.getBoundingClientRect();\n\t\t\t} else {\n\t\t\t\telPos = node.getBoundingClientRect();\n\t\t\t}\n\n\t\t\tleft = elPos.left;\n\t\t\tright = elPos.right;\n\n\t\t\tif(left > end && $prev) {\n\t\t\t\treturn $prev;\n\t\t\t} else if(right > end) {\n\t\t\t\treturn node;\n\t\t\t} else {\n\t\t\t\t$prev = node;\n\t\t\t\tstack.push(node);\n\t\t\t}\n\n\t\t});\n\n\n\t\tif(found){\n\t\t\treturn this.findTextEndRange(found, start, end);\n\t\t}\n\n\t}\n\n\t// end of chapter\n\treturn this.findTextEndRange($prev, start, end);\n};\n\n\nMapping.prototype.findTextStartRange = function(node, start, end){\n\tvar ranges = this.splitTextNodeIntoRanges(node);\n\tvar prev;\n\tvar range;\n\tvar pos;\n\n\tfor (var i = 0; i < ranges.length; i++) {\n\t\trange = ranges[i];\n\n\t\tpos = range.getBoundingClientRect();\n\n\t\tif( pos.left >= start ) {\n\t\t\treturn range;\n\t\t}\n\n\t\tprev = range;\n\n\t}\n\n\treturn ranges[0];\n};\n\nMapping.prototype.findTextEndRange = function(node, start, end){\n\tvar ranges = this.splitTextNodeIntoRanges(node);\n\tvar prev;\n\tvar range;\n\tvar pos;\n\n\tfor (var i = 0; i < ranges.length; i++) {\n\t\trange = ranges[i];\n\n\t\tpos = range.getBoundingClientRect();\n\n\t\tif(pos.left > end && prev) {\n\t\t\treturn prev;\n\t\t} else if(pos.right > end) {\n\t\t\treturn range;\n\t\t}\n\n\t\tprev = range;\n\n\t}\n\n\t// Ends before limit\n\treturn ranges[ranges.length-1];\n\n};\n\nMapping.prototype.splitTextNodeIntoRanges = function(node, _splitter){\n\tvar ranges = [];\n\tvar textContent = node.textContent || \"\";\n\tvar text = textContent.trim();\n\tvar range;\n\tvar rect;\n\tvar list;\n\tvar doc = node.ownerDocument;\n\tvar splitter = _splitter || \" \";\n\n\tpos = text.indexOf(splitter);\n\n\tif(pos === -1 || node.nodeType != Node.TEXT_NODE) {\n\t\trange = doc.createRange();\n\t\trange.selectNodeContents(node);\n\t\treturn [range];\n\t}\n\n\trange = doc.createRange();\n\trange.setStart(node, 0);\n\trange.setEnd(node, pos);\n\tranges.push(range);\n\trange = false;\n\n\twhile ( pos != -1 ) {\n\n\t\tpos = text.indexOf(splitter, pos + 1);\n\t\tif(pos > 0) {\n\n\t\t\tif(range) {\n\t\t\t\trange.setEnd(node, pos);\n\t\t\t\tranges.push(range);\n\t\t\t}\n\n\t\t\trange = doc.createRange();\n\t\t\trange.setStart(node, pos+1);\n\t\t}\n\t}\n\n\tif(range) {\n\t\trange.setEnd(node, text.length);\n\t\tranges.push(range);\n\t}\n\n\treturn ranges;\n};\n\n\n\nMapping.prototype.rangePairToCfiPair = function(cfiBase, rangePair){\n\n\tvar startRange = rangePair.start;\n\tvar endRange = rangePair.end;\n\n\tstartRange.collapse(true);\n\tendRange.collapse(true);\n\n\t// startCfi = section.cfiFromRange(startRange);\n\t// endCfi = section.cfiFromRange(endRange);\n\tstartCfi = new EpubCFI(startRange, cfiBase).toString();\n\tendCfi = new EpubCFI(endRange, cfiBase).toString();\n\n\treturn {\n\t\tstart: startCfi,\n\t\tend: endCfi\n\t};\n\n};\n\nMapping.prototype.rangeListToCfiList = function(cfiBase, columns){\n\tvar map = [];\n\tvar rangePair, cifPair;\n\n\tfor (var i = 0; i < columns.length; i++) {\n\t\tcifPair = this.rangePairToCfiPair(cfiBase, columns[i]);\n\n\t\tmap.push(cifPair);\n\n\t}\n\n\treturn map;\n};\n\nmodule.exports = Mapping;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/mapping.js\n// module id = 6\n// module chunks = 0","var core = require('./core');\n\n/**\n * Queue for handling tasks one at a time\n * @class\n * @param {scope} context what this will resolve to in the tasks\n */\nfunction Queue(context){\n\tthis._q = [];\n\tthis.context = context;\n\tthis.tick = core.requestAnimationFrame;\n\tthis.running = false;\n\tthis.paused = false;\n};\n\n/**\n * Add an item to the queue\n * @return {Promise}\n */\nQueue.prototype.enqueue = function() {\n\tvar deferred, promise;\n\tvar queued;\n\tvar task = [].shift.call(arguments);\n\tvar args = arguments;\n\n\t// Handle single args without context\n\t// if(args && !Array.isArray(args)) {\n\t// args = [args];\n\t// }\n\tif(!task) {\n\t\treturn console.error(\"No Task Provided\");\n\t}\n\n\tif(typeof task === \"function\"){\n\n\t\tdeferred = new core.defer();\n\t\tpromise = deferred.promise;\n\n\t\tqueued = {\n\t\t\t\"task\" : task,\n\t\t\t\"args\" : args,\n\t\t\t//\"context\" : context,\n\t\t\t\"deferred\" : deferred,\n\t\t\t\"promise\" : promise\n\t\t};\n\n\t} else {\n\t\t// Task is a promise\n\t\tqueued = {\n\t\t\t\"promise\" : task\n\t\t};\n\n\t}\n\n\tthis._q.push(queued);\n\n\t// Wait to start queue flush\n\tif (this.paused == false && !this.running) {\n\t\t// setTimeout(this.flush.bind(this), 0);\n\t\t// this.tick.call(window, this.run.bind(this));\n\t\tthis.run();\n\t}\n\n\treturn queued.promise;\n};\n\n/**\n * Run one item\n * @return {Promise}\n */\nQueue.prototype.dequeue = function(){\n\tvar inwait, task, result;\n\n\tif(this._q.length) {\n\t\tinwait = this._q.shift();\n\t\ttask = inwait.task;\n\t\tif(task){\n\t\t\t// console.log(task)\n\n\t\t\tresult = task.apply(this.context, inwait.args);\n\n\t\t\tif(result && typeof result[\"then\"] === \"function\") {\n\t\t\t\t// Task is a function that returns a promise\n\t\t\t\treturn result.then(function(){\n\t\t\t\t\tinwait.deferred.resolve.apply(this.context, arguments);\n\t\t\t\t}.bind(this));\n\t\t\t} else {\n\t\t\t\t// Task resolves immediately\n\t\t\t\tinwait.deferred.resolve.apply(this.context, result);\n\t\t\t\treturn inwait.promise;\n\t\t\t}\n\n\n\n\t\t} else if(inwait.promise) {\n\t\t\t// Task is a promise\n\t\t\treturn inwait.promise;\n\t\t}\n\n\t} else {\n\t\tinwait = new core.defer();\n\t\tinwait.deferred.resolve();\n\t\treturn inwait.promise;\n\t}\n\n};\n\n// Run All Immediately\nQueue.prototype.dump = function(){\n\twhile(this._q.length) {\n\t\tthis.dequeue();\n\t}\n};\n\n/**\n * Run all tasks sequentially, at convince\n * @return {Promise}\n */\nQueue.prototype.run = function(){\n\n\tif(!this.running){\n\t\tthis.running = true;\n\t\tthis.defered = new core.defer();\n\t}\n\n\tthis.tick.call(window, function() {\n\n\t\tif(this._q.length) {\n\n\t\t\tthis.dequeue()\n\t\t\t\t.then(function(){\n\t\t\t\t\tthis.run();\n\t\t\t\t}.bind(this));\n\n\t\t} else {\n\t\t\tthis.defered.resolve();\n\t\t\tthis.running = undefined;\n\t\t}\n\n\t}.bind(this));\n\n\t// Unpause\n\tif(this.paused == true) {\n\t\tthis.paused = false;\n\t}\n\n\treturn this.defered.promise;\n};\n\n/**\n * Flush all, as quickly as possible\n * @return {Promise}\n */\nQueue.prototype.flush = function(){\n\n\tif(this.running){\n\t\treturn this.running;\n\t}\n\n\tif(this._q.length) {\n\t\tthis.running = this.dequeue()\n\t\t\t.then(function(){\n\t\t\t\tthis.running = undefined;\n\t\t\t\treturn this.flush();\n\t\t\t}.bind(this));\n\n\t\treturn this.running;\n\t}\n\n};\n\n/**\n * Clear all items in wait\n */\nQueue.prototype.clear = function(){\n\tthis._q = [];\n\tthis.running = false;\n};\n\n/**\n * Get the number of tasks in the queue\n * @return {int} tasks\n */\nQueue.prototype.length = function(){\n\treturn this._q.length;\n};\n\n/**\n * Pause a running queue\n */\nQueue.prototype.pause = function(){\n\tthis.paused = true;\n};\n\n/**\n * Create a new task from a callback\n * @class\n * @private\n * @param {function} task\n * @param {array} args\n * @param {scope} context\n * @return {function} task\n */\nfunction Task(task, args, context){\n\n\treturn function(){\n\t\tvar toApply = arguments || [];\n\n\t\treturn new Promise(function(resolve, reject) {\n\t\t\tvar callback = function(value){\n\t\t\t\tresolve(value);\n\t\t\t};\n\t\t\t// Add the callback to the arguments list\n\t\t\ttoApply.push(callback);\n\n\t\t\t// Apply all arguments to the functions\n\t\t\ttask.apply(this, toApply);\n\n\t}.bind(this));\n\n\t};\n\n};\n\nmodule.exports = Queue;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/queue.js\n// module id = 7\n// module chunks = 0","// var URI = require('urijs');\nvar core = require('./core');\n\nfunction base(doc, section){\n\tvar base;\n\tvar head;\n\n\tif(!doc){\n\t\treturn;\n\t}\n\n\t// head = doc.querySelector(\"head\");\n\t// base = head.querySelector(\"base\");\n\thead = core.qs(doc, \"head\");\n\tbase = core.qs(head, \"base\");\n\n\tif(!base) {\n\t\tbase = doc.createElement(\"base\");\n\t\thead.insertBefore(base, head.firstChild);\n\t}\n\n\tbase.setAttribute(\"href\", section.url);\n}\n\nfunction canonical(doc, section){\n\tvar head;\n\tvar link;\n\tvar url = section.url; // window.location.origin + window.location.pathname + \"?loc=\" + encodeURIComponent(section.url);\n\n\tif(!doc){\n\t\treturn;\n\t}\n\n\thead = core.qs(doc, \"head\");\n\tlink = core.qs(head, \"link[rel='canonical']\");\n\n\tif (link) {\n\t\tlink.setAttribute(\"href\", url);\n\t} else {\n\t\tlink = doc.createElement(\"link\");\n\t\tlink.setAttribute(\"rel\", \"canonical\");\n\t\tlink.setAttribute(\"href\", url);\n\t\thead.appendChild(link);\n\t}\n}\n\nfunction links(view, renderer) {\n\n\tvar links = view.document.querySelectorAll(\"a[href]\");\n\tvar replaceLinks = function(link){\n\t\tvar href = link.getAttribute(\"href\");\n\n\t\tif(href.indexOf(\"mailto:\") === 0){\n\t\t\treturn;\n\t\t}\n\n\t\t// var linkUri = URI(href);\n\t\t// var absolute = linkUri.absoluteTo(view.section.url);\n\t\t// var relative = absolute.relativeTo(this.book.baseUrl).toString();\n\t\tvar relative = this.book.resolve(href, false);\n\t\t\n\t\tif(linkUrl && linkUrl.protocol){\n\n\t\t\tlink.setAttribute(\"target\", \"_blank\");\n\n\t\t}else{\n\t\t\t/*\n\t\t\tif(baseDirectory) {\n\t\t\t\t// We must ensure that the file:// protocol is preserved for\n\t\t\t\t// local file links, as in certain contexts (such as under\n\t\t\t\t// Titanium), file links without the file:// protocol will not\n\t\t\t\t// work\n\t\t\t\tif (baseUri.protocol === \"file\") {\n\t\t\t\t\trelative = core.resolveUrl(baseUri.base, href);\n\t\t\t\t} else {\n\t\t\t\t\trelative = core.resolveUrl(baseDirectory, href);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trelative = href;\n\t\t\t}\n\t\t\t*/\n\n\t\t\t// if(linkUri.fragment()) {\n\t\t\t\t// do nothing with fragment yet\n\t\t\t// } else {\n\t\t\t\tlink.onclick = function(){\n\t\t\t\t\trenderer.display(relative);\n\t\t\t\t\treturn false;\n\t\t\t\t};\n\t\t\t// }\n\n\t\t}\n\t}.bind(this);\n\n\tfor (var i = 0; i < links.length; i++) {\n\t\treplaceLinks(links[i]);\n\t}\n\n\n};\n\nfunction substitute(content, urls, replacements) {\n\turls.forEach(function(url, i){\n\t\tif (url && replacements[i]) {\n\t\t\tcontent = content.replace(new RegExp(url, 'g'), replacements[i]);\n\t\t}\n\t});\n\treturn content;\n}\nmodule.exports = {\n\t'base': base,\n\t'canonical' : canonical,\n\t'links': links,\n\t'substitute': substitute\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/replacements.js\n// module id = 8\n// module chunks = 0","var core = require('./core');\nvar Path = require('./core').Path;\n\nfunction request(url, type, withCredentials, headers) {\n\tvar supportsURL = (typeof window != \"undefined\") ? window.URL : false; // TODO: fallback for url if window isn't defined\n\tvar BLOB_RESPONSE = supportsURL ? \"blob\" : \"arraybuffer\";\n\tvar uri;\n\n\tvar deferred = new core.defer();\n\n\tvar xhr = new XMLHttpRequest();\n\n\t//-- Check from PDF.js:\n\t// https://github.com/mozilla/pdf.js/blob/master/web/compatibility.js\n\tvar xhrPrototype = XMLHttpRequest.prototype;\n\n\tvar header;\n\n\tif (!('overrideMimeType' in xhrPrototype)) {\n\t\t// IE10 might have response, but not overrideMimeType\n\t\tObject.defineProperty(xhrPrototype, 'overrideMimeType', {\n\t\t\tvalue: function xmlHttpRequestOverrideMimeType(mimeType) {}\n\t\t});\n\t}\n\tif(withCredentials) {\n\t\txhr.withCredentials = true;\n\t}\n\n\txhr.onreadystatechange = handler;\n\txhr.onerror = err;\n\n\txhr.open(\"GET\", url, true);\n\n\tfor(header in headers) {\n\t\txhr.setRequestHeader(header, headers[header]);\n\t}\n\n\tif(type == \"json\") {\n\t\txhr.setRequestHeader(\"Accept\", \"application/json\");\n\t}\n\n\t// If type isn't set, determine it from the file extension\n\tif(!type) {\n\t\ttype = new Path(url).extension;\n\t}\n\n\tif(type == 'blob'){\n\t\txhr.responseType = BLOB_RESPONSE;\n\t}\n\n\n\tif(core.isXml(type)) {\n\t\t// xhr.responseType = \"document\";\n\t\txhr.overrideMimeType('text/xml'); // for OPF parsing\n\t}\n\n\tif(type == 'xhtml') {\n\t\t// xhr.responseType = \"document\";\n\t}\n\n\tif(type == 'html' || type == 'htm') {\n\t\t// xhr.responseType = \"document\";\n\t }\n\n\tif(type == \"binary\") {\n\t\txhr.responseType = \"arraybuffer\";\n\t}\n\n\txhr.send();\n\n\tfunction err(e) {\n\t\tconsole.error(e);\n\t\tdeferred.reject(e);\n\t}\n\n\tfunction handler() {\n\t\tif (this.readyState === XMLHttpRequest.DONE) {\n\t\t\tvar responseXML = false;\n\n\t\t\tif(this.responseType === '' || this.responseType === \"document\") {\n\t\t\t\tresponseXML = this.responseXML;\n\t\t\t}\n\n\t\t\tif (this.status === 200 || responseXML ) { //-- Firefox is reporting 0 for blob urls\n\t\t\t\tvar r;\n\n\t\t\t\tif (!this.response && !responseXML) {\n\t\t\t\t\tdeferred.reject({\n\t\t\t\t\t\tstatus: this.status,\n\t\t\t\t\t\tmessage : \"Empty Response\",\n\t\t\t\t\t\tstack : new Error().stack\n\t\t\t\t\t});\n\t\t\t\t\treturn deferred.promise;\n\t\t\t\t}\n\n\t\t\t\tif (this.status === 403) {\n\t\t\t\t\tdeferred.reject({\n\t\t\t\t\t\tstatus: this.status,\n\t\t\t\t\t\tresponse: this.response,\n\t\t\t\t\t\tmessage : \"Forbidden\",\n\t\t\t\t\t\tstack : new Error().stack\n\t\t\t\t\t});\n\t\t\t\t\treturn deferred.promise;\n\t\t\t\t}\n\n\t\t\t\tif(responseXML){\n\t\t\t\t\tr = this.responseXML;\n\t\t\t\t} else\n\t\t\t\tif(core.isXml(type)){\n\t\t\t\t\t// xhr.overrideMimeType('text/xml'); // for OPF parsing\n\t\t\t\t\t// If this.responseXML wasn't set, try to parse using a DOMParser from text\n\t\t\t\t\tr = core.parse(this.response, \"text/xml\");\n\t\t\t\t}else\n\t\t\t\tif(type == 'xhtml'){\n\t\t\t\t\tr = core.parse(this.response, \"application/xhtml+xml\");\n\t\t\t\t}else\n\t\t\t\tif(type == 'html' || type == 'htm'){\n\t\t\t\t\tr = core.parse(this.response, \"text/html\");\n\t\t\t\t}else\n\t\t\t\tif(type == 'json'){\n\t\t\t\t\tr = JSON.parse(this.response);\n\t\t\t\t}else\n\t\t\t\tif(type == 'blob'){\n\n\t\t\t\t\tif(supportsURL) {\n\t\t\t\t\t\tr = this.response;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//-- Safari doesn't support responseType blob, so create a blob from arraybuffer\n\t\t\t\t\t\tr = new Blob([this.response]);\n\t\t\t\t\t}\n\n\t\t\t\t}else{\n\t\t\t\t\tr = this.response;\n\t\t\t\t}\n\n\t\t\t\tdeferred.resolve(r);\n\t\t\t} else {\n\n\t\t\t\tdeferred.reject({\n\t\t\t\t\tstatus: this.status,\n\t\t\t\t\tmessage : this.response,\n\t\t\t\t\tstack : new Error().stack\n\t\t\t\t});\n\n\t\t\t}\n\t\t}\n\t}\n\n\treturn deferred.promise;\n};\n\nmodule.exports = request;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/request.js\n// module id = 9\n// module chunks = 0","var EventEmitter = require('event-emitter');\nvar core = require('./core');\nvar EpubCFI = require('./epubcfi');\nvar Mapping = require('./mapping');\n\n\nfunction Contents(doc, content, cfiBase) {\n\t// Blank Cfi for Parsing\n\tthis.epubcfi = new EpubCFI();\n\n\tthis.document = doc;\n\tthis.documentElement = this.document.documentElement;\n\tthis.content = content || this.document.body;\n\tthis.window = this.document.defaultView;\n\t// Dom events to listen for\n\tthis.listenedEvents = [\"keydown\", \"keyup\", \"keypressed\", \"mouseup\", \"mousedown\", \"click\", \"touchend\", \"touchstart\"];\n\n\tthis._size = {\n\t\twidth: 0,\n\t\theight: 0\n\t}\n\n\tthis.cfiBase = cfiBase || \"\";\n\n\tthis.listeners();\n};\n\nContents.prototype.width = function(w) {\n\t// var frame = this.documentElement;\n\tvar frame = this.content;\n\n\tif (w && core.isNumber(w)) {\n\t\tw = w + \"px\";\n\t}\n\n\tif (w) {\n\t\tframe.style.width = w;\n\t\t// this.content.style.width = w;\n\t}\n\n\treturn this.window.getComputedStyle(frame)['width'];\n\n\n};\n\nContents.prototype.height = function(h) {\n\t// var frame = this.documentElement;\n\tvar frame = this.content;\n\n\tif (h && core.isNumber(h)) {\n\t\th = h + \"px\";\n\t}\n\n\tif (h) {\n\t\tframe.style.height = h;\n\t\t// this.content.style.height = h;\n\t}\n\n\treturn this.window.getComputedStyle(frame)['height'];\n\n};\n\nContents.prototype.contentWidth = function(w) {\n\n\tvar content = this.content || this.document.body;\n\n\tif (w && core.isNumber(w)) {\n\t\tw = w + \"px\";\n\t}\n\n\tif (w) {\n\t\tcontent.style.width = w;\n\t}\n\n\treturn this.window.getComputedStyle(content)['width'];\n\n\n};\n\nContents.prototype.contentHeight = function(h) {\n\n\tvar content = this.content || this.document.body;\n\n\tif (h && core.isNumber(h)) {\n\t\th = h + \"px\";\n\t}\n\n\tif (h) {\n\t\tcontent.style.height = h;\n\t}\n\n\treturn this.window.getComputedStyle(content)['height'];\n\n};\n\nContents.prototype.textWidth = function() {\n\tvar width;\n\tvar range = this.document.createRange();\n\tvar content = this.content || this.document.body;\n\n\t// Select the contents of frame\n\trange.selectNodeContents(content);\n\n\t// get the width of the text content\n\twidth = range.getBoundingClientRect().width;\n\n\treturn width;\n\n};\n\nContents.prototype.textHeight = function() {\n\tvar height;\n\tvar range = this.document.createRange();\n\tvar content = this.content || this.document.body;\n\n\trange.selectNodeContents(content);\n\n\theight = range.getBoundingClientRect().height;\n\n\treturn height;\n};\n\nContents.prototype.scrollWidth = function() {\n\tvar width = this.documentElement.scrollWidth;\n\n\treturn width;\n};\n\nContents.prototype.scrollHeight = function() {\n\tvar height = this.documentElement.scrollHeight;\n\n\treturn height;\n};\n\nContents.prototype.overflow = function(overflow) {\n\n\tif (overflow) {\n\t\tthis.documentElement.style.overflow = overflow;\n\t}\n\n\treturn this.window.getComputedStyle(this.documentElement)['overflow'];\n};\n\nContents.prototype.overflowX = function(overflow) {\n\n\tif (overflow) {\n\t\tthis.documentElement.style.overflowX = overflow;\n\t}\n\n\treturn this.window.getComputedStyle(this.documentElement)['overflowX'];\n};\n\nContents.prototype.overflowY = function(overflow) {\n\n\tif (overflow) {\n\t\tthis.documentElement.style.overflowY = overflow;\n\t}\n\n\treturn this.window.getComputedStyle(this.documentElement)['overflowY'];\n};\n\nContents.prototype.css = function(property, value) {\n\tvar content = this.content || this.document.body;\n\n\tif (value) {\n\t\tcontent.style[property] = value;\n\t}\n\n\treturn this.window.getComputedStyle(content)[property];\n};\n\nContents.prototype.viewport = function(options) {\n\tvar width, height, scale, scalable;\n\tvar $viewport = this.document.querySelector(\"meta[name='viewport']\");\n\tvar newContent = '';\n\n\t/*\n\t* check for the viewport size\n\t* \n\t*/\n\tif($viewport && $viewport.hasAttribute(\"content\")) {\n\t\tcontent = $viewport.getAttribute(\"content\");\n\t\tcontents = content.split(/\\s*,\\s*/);\n\t\tif(contents[0]){\n\t\t\twidth = contents[0].replace(\"width=\", '').trim();\n\t\t}\n\t\tif(contents[1]){\n\t\t\theight = contents[1].replace(\"height=\", '').trim();\n\t\t}\n\t\tif(contents[2]){\n\t\t\tscale = contents[2].replace(\"initial-scale=\", '').trim();\n\t\t}\n\t\tif(contents[3]){\n\t\t\tscalable = contents[3].replace(\"user-scalable=\", '').trim();\n\t\t}\n\t}\n\n\tif (options) {\n\n\t\tnewContent += \"width=\" + (options.width || width);\n\t\tnewContent += \", height=\" + (options.height || height);\n\t\tif (options.scale || scale) {\n\t\t\tnewContent += \", initial-scale=\" + (options.scale || scale);\n\t\t}\n\t\tif (options.scalable || scalable) {\n\t\t\tnewContent += \", user-scalable=\" + (options.scalable || scalable);\n\t\t}\n\n\t\tif (!$viewport) {\n\t\t\t$viewport = this.document.createElement(\"meta\");\n\t\t\t$viewport.setAttribute(\"name\", \"viewport\");\n\t\t\tthis.document.querySelector('head').appendChild($viewport);\n\t\t}\n\n\t\t$viewport.setAttribute(\"content\", newContent);\n\t}\n\n\n\treturn {\n\t\twidth: parseInt(width),\n\t\theight: parseInt(height)\n\t};\n};\n\n\n// Contents.prototype.layout = function(layoutFunc) {\n//\n// this.iframe.style.display = \"inline-block\";\n//\n// // Reset Body Styles\n// this.content.style.margin = \"0\";\n// //this.document.body.style.display = \"inline-block\";\n// //this.document.documentElement.style.width = \"auto\";\n//\n// if(layoutFunc){\n// layoutFunc(this);\n// }\n//\n// this.onLayout(this);\n//\n// };\n//\n// Contents.prototype.onLayout = function(view) {\n// // stub\n// };\n\nContents.prototype.expand = function() {\n\tthis.emit(\"expand\");\n};\n\nContents.prototype.listeners = function() {\n\n\tthis.imageLoadListeners();\n\n\tthis.mediaQueryListeners();\n\n\t// this.fontLoadListeners();\n\n\tthis.addEventListeners();\n\n\tthis.addSelectionListeners();\n\n\tthis.resizeListeners();\n\n};\n\nContents.prototype.removeListeners = function() {\n\n\tthis.removeEventListeners();\n\n\tthis.removeSelectionListeners();\n};\n\nContents.prototype.resizeListeners = function() {\n\tvar width, height;\n\t// Test size again\n\tclearTimeout(this.expanding);\n\n\twidth = this.scrollWidth();\n\theight = this.scrollHeight();\n\n\tif (width != this._size.width || height != this._size.height) {\n\n\t\tthis._size = {\n\t\t\twidth: width,\n\t\t\theight: height\n\t\t}\n\n\t\tthis.emit(\"resize\", this._size);\n\t}\n\n\tthis.expanding = setTimeout(this.resizeListeners.bind(this), 350);\n};\n\n//https://github.com/tylergaw/media-query-events/blob/master/js/mq-events.js\nContents.prototype.mediaQueryListeners = function() {\n\t\tvar sheets = this.document.styleSheets;\n\t\tvar mediaChangeHandler = function(m){\n\t\t\tif(m.matches && !this._expanding) {\n\t\t\t\tsetTimeout(this.expand.bind(this), 1);\n\t\t\t\t// this.expand();\n\t\t\t}\n\t\t}.bind(this);\n\n\t\tfor (var i = 0; i < sheets.length; i += 1) {\n\t\t\t\tvar rules;\n\t\t\t\t// Firefox errors if we access cssRules cross-domain\n\t\t\t\ttry {\n\t\t\t\t\trules = sheets[i].cssRules;\n\t\t\t\t} catch (e) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif(!rules) return; // Stylesheets changed\n\t\t\t\tfor (var j = 0; j < rules.length; j += 1) {\n\t\t\t\t\t\t//if (rules[j].constructor === CSSMediaRule) {\n\t\t\t\t\t\tif(rules[j].media){\n\t\t\t\t\t\t\t\tvar mql = this.window.matchMedia(rules[j].media.mediaText);\n\t\t\t\t\t\t\t\tmql.addListener(mediaChangeHandler);\n\t\t\t\t\t\t\t\t//mql.onchange = mediaChangeHandler;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n};\n\nContents.prototype.observe = function(target) {\n\tvar renderer = this;\n\n\t// create an observer instance\n\tvar observer = new MutationObserver(function(mutations) {\n\t\tif(renderer._expanding) {\n\t\t\trenderer.expand();\n\t\t}\n\t\t// mutations.forEach(function(mutation) {\n\t\t// console.log(mutation);\n\t\t// });\n\t});\n\n\t// configuration of the observer:\n\tvar config = { attributes: true, childList: true, characterData: true, subtree: true };\n\n\t// pass in the target node, as well as the observer options\n\tobserver.observe(target, config);\n\n\treturn observer;\n};\n\nContents.prototype.imageLoadListeners = function(target) {\n\tvar images = this.document.querySelectorAll(\"img\");\n\tvar img;\n\tfor (var i = 0; i < images.length; i++) {\n\t\timg = images[i];\n\n\t\tif (typeof img.naturalWidth !== \"undefined\" &&\n\t\t\t\timg.naturalWidth === 0) {\n\t\t\timg.onload = this.expand.bind(this);\n\t\t}\n\t}\n};\n\nContents.prototype.fontLoadListeners = function(target) {\n\tif (!this.document || !this.document.fonts) {\n\t\treturn;\n\t}\n\n\tthis.document.fonts.ready.then(function () {\n\t\tthis.expand();\n\t}.bind(this));\n\n};\n\nContents.prototype.root = function() {\n\tif(!this.document) return null;\n\treturn this.document.documentElement;\n};\n\nContents.prototype.locationOf = function(target, ignoreClass) {\n\tvar position;\n\tvar targetPos = {\"left\": 0, \"top\": 0};\n\n\tif(!this.document) return;\n\n\tif(this.epubcfi.isCfiString(target)) {\n\t\trange = new EpubCFI(target).toRange(this.document, ignoreClass);\n\n\t\tif(range) {\n\t\t\tif (range.startContainer.nodeType === Node.ELEMENT_NODE) {\n\t\t\t\tposition = range.startContainer.getBoundingClientRect();\n\t\t\t\ttargetPos.left = position.left;\n\t\t\t\ttargetPos.top = position.top;\n\t\t\t} else {\n\t\t\t\tposition = range.getBoundingClientRect();\n\t\t\t\ttargetPos.left = position.left;\n\t\t\t\ttargetPos.top = position.top;\n\t\t\t}\n\t\t}\n\n\t} else if(typeof target === \"string\" &&\n\t\ttarget.indexOf(\"#\") > -1) {\n\n\t\tid = target.substring(target.indexOf(\"#\")+1);\n\t\tel = this.document.getElementById(id);\n\n\t\tif(el) {\n\t\t\tposition = el.getBoundingClientRect();\n\t\t\ttargetPos.left = position.left;\n\t\t\ttargetPos.top = position.top;\n\t\t}\n\t}\n\n\treturn targetPos;\n};\n\nContents.prototype.addStylesheet = function(src) {\n\treturn new Promise(function(resolve, reject){\n\t\tvar $stylesheet;\n\t\tvar ready = false;\n\n\t\tif(!this.document) {\n\t\t\tresolve(false);\n\t\t\treturn;\n\t\t}\n\n\t\t$stylesheet = this.document.createElement('link');\n\t\t$stylesheet.type = 'text/css';\n\t\t$stylesheet.rel = \"stylesheet\";\n\t\t$stylesheet.href = src;\n\t\t$stylesheet.onload = $stylesheet.onreadystatechange = function() {\n\t\t\tif ( !ready && (!this.readyState || this.readyState == 'complete') ) {\n\t\t\t\tready = true;\n\t\t\t\t// Let apply\n\t\t\t\tsetTimeout(function(){\n\t\t\t\t\tresolve(true);\n\t\t\t\t}, 1);\n\t\t\t}\n\t\t};\n\n\t\tthis.document.head.appendChild($stylesheet);\n\n\t}.bind(this));\n};\n\n// https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/insertRule\nContents.prototype.addStylesheetRules = function(rules) {\n\tvar styleEl;\n\tvar styleSheet;\n\n\tif(!this.document) return;\n\n\tstyleEl = this.document.createElement('style');\n\n\t// Append style element to head\n\tthis.document.head.appendChild(styleEl);\n\n\t// Grab style sheet\n\tstyleSheet = styleEl.sheet;\n\n\tfor (var i = 0, rl = rules.length; i < rl; i++) {\n\t\tvar j = 1, rule = rules[i], selector = rules[i][0], propStr = '';\n\t\t// If the second argument of a rule is an array of arrays, correct our variables.\n\t\tif (Object.prototype.toString.call(rule[1][0]) === '[object Array]') {\n\t\t\trule = rule[1];\n\t\t\tj = 0;\n\t\t}\n\n\t\tfor (var pl = rule.length; j < pl; j++) {\n\t\t\tvar prop = rule[j];\n\t\t\tpropStr += prop[0] + ':' + prop[1] + (prop[2] ? ' !important' : '') + ';\\n';\n\t\t}\n\n\t\t// Insert CSS Rule\n\t\tstyleSheet.insertRule(selector + '{' + propStr + '}', styleSheet.cssRules.length);\n\t}\n};\n\nContents.prototype.addScript = function(src) {\n\n\treturn new Promise(function(resolve, reject){\n\t\tvar $script;\n\t\tvar ready = false;\n\n\t\tif(!this.document) {\n\t\t\tresolve(false);\n\t\t\treturn;\n\t\t}\n\n\t\t$script = this.document.createElement('script');\n\t\t$script.type = 'text/javascript';\n\t\t$script.async = true;\n\t\t$script.src = src;\n\t\t$script.onload = $script.onreadystatechange = function() {\n\t\t\tif ( !ready && (!this.readyState || this.readyState == 'complete') ) {\n\t\t\t\tready = true;\n\t\t\t\tsetTimeout(function(){\n\t\t\t\t\tresolve(true);\n\t\t\t\t}, 1);\n\t\t\t}\n\t\t};\n\n\t\tthis.document.head.appendChild($script);\n\n\t}.bind(this));\n};\n\nContents.prototype.addEventListeners = function(){\n\tif(!this.document) {\n\t\treturn;\n\t}\n\tthis.listenedEvents.forEach(function(eventName){\n\t\tthis.document.addEventListener(eventName, this.triggerEvent.bind(this), false);\n\t}, this);\n\n};\n\nContents.prototype.removeEventListeners = function(){\n\tif(!this.document) {\n\t\treturn;\n\t}\n\tthis.listenedEvents.forEach(function(eventName){\n\t\tthis.document.removeEventListener(eventName, this.triggerEvent, false);\n\t}, this);\n\n};\n\n// Pass browser events\nContents.prototype.triggerEvent = function(e){\n\tthis.emit(e.type, e);\n};\n\nContents.prototype.addSelectionListeners = function(){\n\tif(!this.document) {\n\t\treturn;\n\t}\n\tthis.document.addEventListener(\"selectionchange\", this.onSelectionChange.bind(this), false);\n};\n\nContents.prototype.removeSelectionListeners = function(){\n\tif(!this.document) {\n\t\treturn;\n\t}\n\tthis.document.removeEventListener(\"selectionchange\", this.onSelectionChange, false);\n};\n\nContents.prototype.onSelectionChange = function(e){\n\tif (this.selectionEndTimeout) {\n\t\tclearTimeout(this.selectionEndTimeout);\n\t}\n\tthis.selectionEndTimeout = setTimeout(function() {\n\t\tvar selection = this.window.getSelection();\n\t\tthis.triggerSelectedEvent(selection);\n\t}.bind(this), 500);\n};\n\nContents.prototype.triggerSelectedEvent = function(selection){\n\tvar range, cfirange;\n\n\tif (selection && selection.rangeCount > 0) {\n\t\trange = selection.getRangeAt(0);\n\t\tif(!range.collapsed) {\n\t\t\t// cfirange = this.section.cfiFromRange(range);\n\t\t\tcfirange = new EpubCFI(range, this.cfiBase).toString();\n\t\t\tthis.emit(\"selected\", cfirange);\n\t\t\tthis.emit(\"selectedRange\", range);\n\t\t}\n\t}\n};\n\nContents.prototype.range = function(_cfi, ignoreClass){\n\tvar cfi = new EpubCFI(_cfi);\n\treturn cfi.toRange(this.document, ignoreClass);\n};\n\nContents.prototype.map = function(layout){\n\tvar map = new Mapping(layout);\n\treturn map.section();\n};\n\nContents.prototype.size = function(width, height){\n\n\tif (width >= 0) {\n\t\tthis.width(width);\n\t}\n\n\tif (height >= 0) {\n\t\tthis.height(height);\n\t}\n\n\tthis.css(\"margin\", \"0\");\n\tthis.css(\"boxSizing\", \"border-box\");\n\n};\n\nContents.prototype.columns = function(width, height, columnWidth, gap){\n\tvar COLUMN_AXIS = core.prefixed('columnAxis');\n\tvar COLUMN_GAP = core.prefixed('columnGap');\n\tvar COLUMN_WIDTH = core.prefixed('columnWidth');\n\tvar COLUMN_FILL = core.prefixed('columnFill');\n\tvar textWidth;\n\n\tthis.width(width);\n\tthis.height(height);\n\n\t// Deal with Mobile trying to scale to viewport\n\tthis.viewport({ width: width, height: height, scale: 1.0 });\n\n\t// this.overflowY(\"hidden\");\n\tthis.css(\"overflowY\", \"hidden\");\n\tthis.css(\"margin\", \"0\");\n\tthis.css(\"boxSizing\", \"border-box\");\n\tthis.css(\"maxWidth\", \"inherit\");\n\n\tthis.css(COLUMN_AXIS, \"horizontal\");\n\tthis.css(COLUMN_FILL, \"auto\");\n\n\tthis.css(COLUMN_GAP, gap+\"px\");\n\tthis.css(COLUMN_WIDTH, columnWidth+\"px\");\n};\n\nContents.prototype.scale = function(scale, offsetX, offsetY){\n\tvar scale = \"scale(\" + scale + \")\";\n\tvar translate = '';\n\t// this.css(\"position\", \"absolute\"));\n\tthis.css(\"transformOrigin\", \"top left\");\n\n\tif (offsetX >= 0 || offsetY >= 0) {\n\t\ttranslate = \" translate(\" + (offsetX || 0 )+ \"px, \" + (offsetY || 0 )+ \"px )\";\n\t}\n\n\tthis.css(\"transform\", scale + translate);\n};\n\nContents.prototype.fit = function(width, height){\n\tvar viewport = this.viewport();\n\tvar widthScale = width / viewport.width;\n\tvar heightScale = height / viewport.height;\n\tvar scale = widthScale < heightScale ? widthScale : heightScale;\n\n\tvar offsetY = (height - (viewport.height * scale)) / 2;\n\n\tthis.width(width);\n\tthis.height(height);\n\tthis.overflow(\"hidden\");\n\n\t// Deal with Mobile trying to scale to viewport\n\tthis.viewport({ scale: 1.0 });\n\n\t// Scale to the correct size\n\tthis.scale(scale, 0, offsetY);\n\n\tthis.css(\"backgroundColor\", \"transparent\");\n};\n\nContents.prototype.mapPage = function(cfiBase, start, end) {\n\tvar mapping = new Mapping();\n\n\treturn mapping.page(this, cfiBase, start, end);\n};\n\nContents.prototype.destroy = function() {\n\t// Stop observing\n\tif(this.observer) {\n\t\tthis.observer.disconnect();\n\t}\n\n\tthis.removeListeners();\n\n};\n\nEventEmitter(Contents.prototype);\n\nmodule.exports = Contents;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/contents.js\n// module id = 10\n// module chunks = 0","var EventEmitter = require('event-emitter');\nvar core = require('../../core');\nvar EpubCFI = require('../../epubcfi');\nvar Mapping = require('../../mapping');\nvar Queue = require('../../queue');\nvar Stage = require('../helpers/stage');\nvar Views = require('../helpers/views');\n\nfunction DefaultViewManager(options) {\n\n\tthis.name = \"default\";\n\tthis.View = options.view;\n\tthis.request = options.request;\n\tthis.renditionQueue = options.queue;\n\tthis.q = new Queue(this);\n\n\tthis.settings = core.extend(this.settings || {}, {\n\t\tinfinite: true,\n\t\thidden: false,\n\t\twidth: undefined,\n\t\theight: undefined,\n\t\t// globalLayoutProperties : { layout: 'reflowable', spread: 'auto', orientation: 'auto'},\n\t\t// layout: null,\n\t\taxis: \"vertical\",\n\t\tignoreClass: ''\n\t});\n\n\tcore.extend(this.settings, options.settings || {});\n\n\tthis.viewSettings = {\n\t\tignoreClass: this.settings.ignoreClass,\n\t\taxis: this.settings.axis,\n\t\tlayout: this.layout,\n\t\twidth: 0,\n\t\theight: 0\n\t};\n\n}\n\nDefaultViewManager.prototype.render = function(element, size){\n\n\t// Save the stage\n\tthis.stage = new Stage({\n\t\twidth: size.width,\n\t\theight: size.height,\n\t\toverflow: this.settings.overflow,\n\t\thidden: this.settings.hidden,\n\t\taxis: this.settings.axis\n\t});\n\n\tthis.stage.attachTo(element);\n\n\t// Get this stage container div\n\tthis.container = this.stage.getContainer();\n\n\t// Views array methods\n\tthis.views = new Views(this.container);\n\n\t// Calculate Stage Size\n\tthis._bounds = this.bounds();\n\tthis._stageSize = this.stage.size();\n\n\t// Set the dimensions for views\n\tthis.viewSettings.width = this._stageSize.width;\n\tthis.viewSettings.height = this._stageSize.height;\n\n\t// Function to handle a resize event.\n\t// Will only attach if width and height are both fixed.\n\tthis.stage.onResize(this.onResized.bind(this));\n\n\t// Add Event Listeners\n\tthis.addEventListeners();\n\n\t// Add Layout method\n\t// this.applyLayoutMethod();\n\tif (this.layout) {\n\t\tthis.updateLayout();\n\t}\n};\n\nDefaultViewManager.prototype.addEventListeners = function(){\n\twindow.addEventListener('unload', function(e){\n\t\tthis.destroy();\n\t}.bind(this));\n};\n\nDefaultViewManager.prototype.destroy = function(){\n\t// this.views.each(function(view){\n\t// \tview.destroy();\n\t// });\n\n\t/*\n\n\t\tclearTimeout(this.trimTimeout);\n\t\tif(this.settings.hidden) {\n\t\t\tthis.element.removeChild(this.wrapper);\n\t\t} else {\n\t\t\tthis.element.removeChild(this.container);\n\t\t}\n\t*/\n};\n\nDefaultViewManager.prototype.onResized = function(e) {\n\tclearTimeout(this.resizeTimeout);\n\tthis.resizeTimeout = setTimeout(function(){\n\t\tthis.resize();\n\t}.bind(this), 150);\n};\n\nDefaultViewManager.prototype.resize = function(width, height){\n\n\t// Clear the queue\n\tthis.q.clear();\n\n\tthis._stageSize = this.stage.size(width, height);\n\tthis._bounds = this.bounds();\n\n\t// Update for new views\n\tthis.viewSettings.width = this._stageSize.width;\n\tthis.viewSettings.height = this._stageSize.height;\n\n\t// Update for existing views\n\tthis.views.each(function(view) {\n\t\tview.size(this._stageSize.width, this._stageSize.height);\n\t}.bind(this));\n\n\tthis.updateLayout();\n\n\tthis.emit(\"resized\", {\n\t\twidth: this.stage.width,\n\t\theight: this.stage.height\n\t});\n\n};\n\nDefaultViewManager.prototype.createView = function(section) {\n\treturn new this.View(section, this.viewSettings);\n};\n\nDefaultViewManager.prototype.display = function(section, target){\n\n\tvar displaying = new core.defer();\n\tvar displayed = displaying.promise;\n\n\t// Check to make sure the section we want isn't already shown\n\tvar visible = this.views.find(section);\n\n\t// View is already shown, just move to correct location\n\tif(visible && target) {\n\t\toffset = visible.locationOf(target);\n\t\tthis.moveTo(offset);\n\t\tdisplaying.resolve();\n\t\treturn displayed;\n\t}\n\n\t// Hide all current views\n\tthis.views.hide();\n\n\tthis.views.clear();\n\n\tthis.add(section)\n\t\t.then(function(){\n\t\t\tvar next;\n\t\t\tif (this.layout.name === \"pre-paginated\" &&\n\t\t\t\t\tthis.layout.divisor > 1) {\n\t\t\t\tnext = section.next();\n\t\t\t\tif (next) {\n\t\t\t\t\treturn this.add(next);\n\t\t\t\t}\n\t\t\t}\n\t\t}.bind(this))\n\t\t.then(function(view){\n\n\t\t\t// Move to correct place within the section, if needed\n\t\t\tif(target) {\n\t\t\t\toffset = view.locationOf(target);\n\t\t\t\tthis.moveTo(offset);\n\t\t\t}\n\n\t\t\tthis.views.show();\n\n\t\t\tdisplaying.resolve();\n\n\t\t}.bind(this))\n\t\t// .then(function(){\n\t\t// \treturn this.hooks.display.trigger(view);\n\t\t// }.bind(this))\n\t\t// .then(function(){\n\t\t// \tthis.views.show();\n\t\t// }.bind(this));\n\t\treturn displayed;\n};\n\nDefaultViewManager.prototype.afterDisplayed = function(view){\n\tthis.emit(\"added\", view);\n};\n\nDefaultViewManager.prototype.afterResized = function(view){\n\tthis.emit(\"resize\", view.section);\n};\n\n// DefaultViewManager.prototype.moveTo = function(offset){\n// \tthis.scrollTo(offset.left, offset.top);\n// };\n\nDefaultViewManager.prototype.moveTo = function(offset){\n\tvar distX = 0,\n\t\t\tdistY = 0;\n\n\tif(this.settings.axis === \"vertical\") {\n\t\tdistY = offset.top;\n\t} else {\n\t\tdistX = Math.floor(offset.left / this.layout.delta) * this.layout.delta;\n\n\t\tif (distX + this.layout.delta > this.container.scrollWidth) {\n\t\t\tdistX = this.container.scrollWidth - this.layout.delta;\n\t\t}\n\t}\n\n\tthis.scrollTo(distX, distY);\n};\n\nDefaultViewManager.prototype.add = function(section){\n\tvar view = this.createView(section);\n\n\tthis.views.append(view);\n\n\t// view.on(\"shown\", this.afterDisplayed.bind(this));\n\tview.onDisplayed = this.afterDisplayed.bind(this);\n\tview.onResize = this.afterResized.bind(this);\n\n\treturn view.display(this.request);\n\n};\n\nDefaultViewManager.prototype.append = function(section){\n\tvar view = this.createView(section);\n\tthis.views.append(view);\n\treturn view.display(this.request);\n};\n\nDefaultViewManager.prototype.prepend = function(section){\n\tvar view = this.createView(section);\n\n\tthis.views.prepend(view);\n\treturn view.display(this.request);\n};\n// DefaultViewManager.prototype.resizeView = function(view) {\n//\n// \tif(this.settings.globalLayoutProperties.layout === \"pre-paginated\") {\n// \t\tview.lock(\"both\", this.bounds.width, this.bounds.height);\n// \t} else {\n// \t\tview.lock(\"width\", this.bounds.width, this.bounds.height);\n// \t}\n//\n// };\n\nDefaultViewManager.prototype.next = function(){\n\tvar next;\n\tvar view;\n\tvar left;\n\n\tif(!this.views.length) return;\n\n\tif(this.settings.axis === \"horizontal\") {\n\n\t\tthis.scrollLeft = this.container.scrollLeft;\n\n\t\tleft = this.container.scrollLeft + this.container.offsetWidth + this.layout.delta;\n\n\t\tif(left < this.container.scrollWidth) {\n\t\t\tthis.scrollBy(this.layout.delta, 0);\n\t\t} else if (left - this.layout.columnWidth === this.container.scrollWidth) {\n\t\t\tthis.scrollTo(this.container.scrollWidth - this.layout.delta, 0);\n\t\t} else {\n\t\t\tnext = this.views.last().section.next();\n\t\t}\n\n\n\t} else {\n\n\t\tnext = this.views.last().section.next();\n\n\t}\n\n\tif(next) {\n\t\tthis.views.clear();\n\n\t\treturn this.append(next)\n\t\t\t.then(function(){\n\t\t\t\tvar right;\n\t\t\t\tif (this.layout.name && this.layout.divisor > 1) {\n\t\t\t\t\tright = next.next();\n\t\t\t\t\tif (right) {\n\t\t\t\t\t\treturn this.append(right);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}.bind(this))\n\t\t\t.then(function(){\n\t\t\t\tthis.views.show();\n\t\t\t}.bind(this));\n\t}\n\n\n};\n\nDefaultViewManager.prototype.prev = function(){\n\tvar prev;\n\tvar view;\n\tvar left;\n\n\tif(!this.views.length) return;\n\n\tif(this.settings.axis === \"horizontal\") {\n\n\t\tthis.scrollLeft = this.container.scrollLeft;\n\n\t\tleft = this.container.scrollLeft;\n\n\t\tif(left > 0) {\n\t\t\tthis.scrollBy(-this.layout.delta, 0);\n\t\t} else {\n\t\t\tprev = this.views.first().section.prev();\n\t\t}\n\n\n\t} else {\n\n\t\tprev = this.views.first().section.prev();\n\n\t}\n\n\tif(prev) {\n\t\tthis.views.clear();\n\n\t\treturn this.prepend(prev)\n\t\t\t.then(function(){\n\t\t\t\tvar left;\n\t\t\t\tif (this.layout.name && this.layout.divisor > 1) {\n\t\t\t\t\tleft = prev.prev();\n\t\t\t\t\tif (left) {\n\t\t\t\t\t\treturn this.prepend(left);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}.bind(this))\n\t\t\t.then(function(){\n\t\t\t\tif(this.settings.axis === \"horizontal\") {\n\t\t\t\t\tthis.scrollTo(this.container.scrollWidth - this.layout.delta, 0);\n\t\t\t\t}\n\t\t\t\tthis.views.show();\n\t\t\t}.bind(this));\n\t}\n};\n\nDefaultViewManager.prototype.current = function(){\n\tvar visible = this.visible();\n\tif(visible.length){\n\t\t// Current is the last visible view\n\t\treturn visible[visible.length-1];\n\t}\n\treturn null;\n};\n\nDefaultViewManager.prototype.currentLocation = function(){\n\tvar view;\n\tvar start, end;\n\n\tif(this.views.length) {\n\t\tview = this.views.first();\n\t\tstart = container.left - view.position().left;\n\t\tend = start + this.layout.spread;\n\n\t\treturn this.mapping.page(view, view.section.cfiBase);\n\t}\n\n};\n\nDefaultViewManager.prototype.isVisible = function(view, offsetPrev, offsetNext, _container){\n\tvar position = view.position();\n\tvar container = _container || this.bounds();\n\n\tif(this.settings.axis === \"horizontal\" &&\n\t\tposition.right > container.left - offsetPrev &&\n\t\tposition.left < container.right + offsetNext) {\n\n\t\treturn true;\n\n\t} else if(this.settings.axis === \"vertical\" &&\n\t\tposition.bottom > container.top - offsetPrev &&\n\t\tposition.top < container.bottom + offsetNext) {\n\n\t\treturn true;\n\t}\n\n\treturn false;\n\n};\n\nDefaultViewManager.prototype.visible = function(){\n\t// return this.views.displayed();\n\tvar container = this.bounds();\n\tvar views = this.views.displayed();\n\tvar viewsLength = views.length;\n\tvar visible = [];\n\tvar isVisible;\n\tvar view;\n\n\tfor (var i = 0; i < viewsLength; i++) {\n\t\tview = views[i];\n\t\tisVisible = this.isVisible(view, 0, 0, container);\n\n\t\tif(isVisible === true) {\n\t\t\tvisible.push(view);\n\t\t}\n\n\t}\n\treturn visible;\n};\n\nDefaultViewManager.prototype.scrollBy = function(x, y, silent){\n\tif(silent) {\n\t\tthis.ignore = true;\n\t}\n\n\tif(this.settings.height) {\n\n\t\tif(x) this.container.scrollLeft += x;\n\t\tif(y) this.container.scrollTop += y;\n\n\t} else {\n\t\twindow.scrollBy(x,y);\n\t}\n\t// console.log(\"scrollBy\", x, y);\n\tthis.scrolled = true;\n\tthis.onScroll();\n};\n\nDefaultViewManager.prototype.scrollTo = function(x, y, silent){\n\tif(silent) {\n\t\tthis.ignore = true;\n\t}\n\n\tif(this.settings.height) {\n\t\tthis.container.scrollLeft = x;\n\t\tthis.container.scrollTop = y;\n\t} else {\n\t\twindow.scrollTo(x,y);\n\t}\n\t// console.log(\"scrollTo\", x, y);\n\tthis.scrolled = true;\n\tthis.onScroll();\n\t// if(this.container.scrollLeft != x){\n\t// setTimeout(function() {\n\t// this.scrollTo(x, y, silent);\n\t// }.bind(this), 10);\n\t// return;\n\t// };\n };\n\nDefaultViewManager.prototype.onScroll = function(){\n\n};\n\nDefaultViewManager.prototype.bounds = function() {\n\tvar bounds;\n\n\tbounds = this.stage.bounds();\n\n\treturn bounds;\n};\n\nDefaultViewManager.prototype.applyLayout = function(layout) {\n\n\tthis.layout = layout;\n\tthis.updateLayout();\n\n\tthis.mapping = new Mapping(this.layout);\n\t // this.manager.layout(this.layout.format);\n};\n\nDefaultViewManager.prototype.updateLayout = function() {\n\tif (!this.stage) {\n\t\treturn;\n\t}\n\n\tthis._stageSize = this.stage.size();\n\n\tif(this.settings.axis === \"vertical\") {\n\t\tthis.layout.calculate(this._stageSize.width, this._stageSize.height);\n\t} else {\n\t\tthis.layout.calculate(\n\t\t\tthis._stageSize.width,\n\t\t\tthis._stageSize.height,\n\t\t\tthis.settings.gap\n\t\t);\n\n\t\t// Set the look ahead offset for what is visible\n\t\tthis.settings.offset = this.layout.delta;\n\n\t\tthis.stage.addStyleRules(\"iframe\", [{\"margin-right\" : this.layout.gap + \"px\"}]);\n\n\t}\n\n\t// Set the dimensions for views\n\tthis.viewSettings.width = this.layout.width;\n\tthis.viewSettings.height = this.layout.height;\n\n\tthis.setLayout(this.layout);\n\n};\n\nDefaultViewManager.prototype.setLayout = function(layout){\n\n\tthis.viewSettings.layout = layout;\n\n\tif(this.views) {\n\n\t\tthis.views.each(function(view){\n\t\t\tview.setLayout(layout);\n\t\t});\n\n\t}\n\n};\n\nDefaultViewManager.prototype.updateFlow = function(flow){\n\tvar axis = (flow === \"paginated\") ? \"horizontal\" : \"vertical\";\n\n\tthis.settings.axis = axis;\n\n\tthis.viewSettings.axis = axis;\n\n\tthis.settings.overflow = (flow === \"paginated\") ? \"hidden\" : \"auto\";\n\t// this.views.each(function(view){\n\t// \tview.setAxis(axis);\n\t// });\n\n};\n\n //-- Enable binding events to Manager\n EventEmitter(DefaultViewManager.prototype);\n\n module.exports = DefaultViewManager;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/managers/default/index.js\n// module id = 11\n// module chunks = 0","var EventEmitter = require('event-emitter');\nvar path = require('path');\nvar core = require('./core');\nvar replace = require('./replacements');\nvar Hook = require('./hook');\nvar EpubCFI = require('./epubcfi');\nvar Queue = require('./queue');\nvar Layout = require('./layout');\nvar Mapping = require('./mapping');\nvar Path = require('./core').Path;\n\n/**\n * [Rendition description]\n * @class\n * @param {Book} book\n * @param {object} options\n * @param {int} options.width\n * @param {int} options.height\n * @param {string} options.ignoreClass\n * @param {string} options.manager\n * @param {string} options.view\n * @param {string} options.layout\n * @param {string} options.spread\n * @param {int} options.minSpreadWidth overridden by spread: none (never) / both (always)\n */\nfunction Rendition(book, options) {\n\n\tthis.settings = core.extend(this.settings || {}, {\n\t\twidth: null,\n\t\theight: null,\n\t\tignoreClass: '',\n\t\tmanager: \"default\",\n\t\tview: \"iframe\",\n\t\tflow: null,\n\t\tlayout: null,\n\t\tspread: null,\n\t\tminSpreadWidth: 800\n\t});\n\n\tcore.extend(this.settings, options);\n\n\tif (typeof(this.settings.manager) === \"object\") {\n\t\tthis.manager = this.settings.manager;\n\t}\n\n\tthis.viewSettings = {\n\t\tignoreClass: this.settings.ignoreClass\n\t};\n\n\tthis.book = book;\n\n\tthis.views = null;\n\n\t/**\n\t * Adds Hook methods to the Rendition prototype\n\t * @property {Hook} hooks\n\t */\n\tthis.hooks = {};\n\tthis.hooks.display = new Hook(this);\n\tthis.hooks.serialize = new Hook(this);\n\t/**\n\t * @property {method} hooks.content\n\t * @type {Hook}\n\t */\n\tthis.hooks.content = new Hook(this);\n\tthis.hooks.layout = new Hook(this);\n\tthis.hooks.render = new Hook(this);\n\tthis.hooks.show = new Hook(this);\n\n\tthis.hooks.content.register(replace.links.bind(this));\n\tthis.hooks.content.register(this.passViewEvents.bind(this));\n\n\t// this.hooks.display.register(this.afterDisplay.bind(this));\n\n\tthis.epubcfi = new EpubCFI();\n\n\tthis.q = new Queue(this);\n\n\tthis.q.enqueue(this.book.opened);\n\n\t// Block the queue until rendering is started\n\tthis.starting = new core.defer();\n\tthis.started = this.starting.promise;\n\tthis.q.enqueue(this.start);\n};\n\n/**\n * Set the manager function\n * @param {function} manager\n */\nRendition.prototype.setManager = function(manager) {\n\tthis.manager = manager;\n};\n\n/**\n * Require the manager from passed string, or as a function\n * @param {string|function} manager [description]\n * @return {method}\n */\nRendition.prototype.requireManager = function(manager) {\n\tvar viewManager;\n\n\t// If manager is a string, try to load from register managers,\n\t// or require included managers directly\n\tif (typeof manager === \"string\") {\n\t\t// Use global or require\n\t\tviewManager = typeof ePub != \"undefined\" ? ePub.ViewManagers[manager] : undefined; //require('./managers/'+manager);\n\t} else {\n\t\t// otherwise, assume we were passed a function\n\t\tviewManager = manager\n\t}\n\n\treturn viewManager;\n};\n\n/**\n * Require the view from passed string, or as a function\n * @param {string|function} view\n * @return {view}\n */\nRendition.prototype.requireView = function(view) {\n\tvar View;\n\n\tif (typeof view == \"string\") {\n\t\tView = typeof ePub != \"undefined\" ? ePub.Views[view] : undefined; //require('./views/'+view);\n\t} else {\n\t\t// otherwise, assume we were passed a function\n\t\tView = view\n\t}\n\n\treturn View;\n};\n\n/**\n * Start the rendering\n * @return {Promise} rendering has started\n */\nRendition.prototype.start = function(){\n\n\tif(!this.manager) {\n\t\tthis.ViewManager = this.requireManager(this.settings.manager);\n\t\tthis.View = this.requireView(this.settings.view);\n\n\t\tthis.manager = new this.ViewManager({\n\t\t\tview: this.View,\n\t\t\tqueue: this.q,\n\t\t\trequest: this.book.load.bind(this.book),\n\t\t\tsettings: this.settings\n\t\t});\n\t}\n\n\t// Parse metadata to get layout props\n\tthis.settings.globalLayoutProperties = this.determineLayoutProperties(this.book.package.metadata);\n\n\tthis.flow(this.settings.globalLayoutProperties.flow);\n\n\tthis.layout(this.settings.globalLayoutProperties);\n\n\t// Listen for displayed views\n\tthis.manager.on(\"added\", this.afterDisplayed.bind(this));\n\n\t// Listen for resizing\n\tthis.manager.on(\"resized\", this.onResized.bind(this));\n\n\t// Listen for scroll changes\n\tthis.manager.on(\"scroll\", this.reportLocation.bind(this));\n\n\n\tthis.on('displayed', this.reportLocation.bind(this));\n\n\t// Trigger that rendering has started\n\tthis.emit(\"started\");\n\n\t// Start processing queue\n\tthis.starting.resolve();\n};\n\n/**\n * Call to attach the container to an element in the dom\n * Container must be attached before rendering can begin\n * @param {element} element to attach to\n * @return {Promise}\n */\nRendition.prototype.attachTo = function(element){\n\n\treturn this.q.enqueue(function () {\n\n\t\t// Start rendering\n\t\tthis.manager.render(element, {\n\t\t\t\"width\" : this.settings.width,\n\t\t\t\"height\" : this.settings.height\n\t\t});\n\n\t\t// Trigger Attached\n\t\tthis.emit(\"attached\");\n\n\t}.bind(this));\n\n};\n\n/**\n * Display a point in the book\n * The request will be added to the rendering Queue,\n * so it will wait until book is opened, rendering started\n * and all other rendering tasks have finished to be called.\n * @param {string} target Url or EpubCFI\n * @return {Promise}\n */\nRendition.prototype.display = function(target){\n\n\t// if (!this.book.spine.spineItems.length > 0) {\n\t\t// Book isn't open yet\n\t\t// return this.q.enqueue(this.display, target);\n\t// }\n\n\treturn this.q.enqueue(this._display, target);\n\n};\n\n/**\n * Tells the manager what to display immediately\n * @private\n * @param {string} target Url or EpubCFI\n * @return {Promise}\n */\nRendition.prototype._display = function(target){\n\tvar isCfiString = this.epubcfi.isCfiString(target);\n\tvar displaying = new core.defer();\n\tvar displayed = displaying.promise;\n\tvar section;\n\tvar moveTo;\n\n\tsection = this.book.spine.get(target);\n\n\tif(!section){\n\t\tdisplaying.reject(new Error(\"No Section Found\"));\n\t\treturn displayed;\n\t}\n\n\t// Trim the target fragment\n\t// removing the chapter\n\tif(!isCfiString && typeof target === \"string\" &&\n\t\ttarget.indexOf(\"#\") > -1) {\n\t\t\tmoveTo = target.substring(target.indexOf(\"#\")+1);\n\t}\n\n\tif (isCfiString) {\n\t\tmoveTo = target;\n\t}\n\n\treturn this.manager.display(section, moveTo)\n\t\t.then(function(){\n\t\t\tthis.emit(\"displayed\", section);\n\t\t}.bind(this));\n\n};\n\n/*\nRendition.prototype.render = function(view, show) {\n\n\t// view.onLayout = this.layout.format.bind(this.layout);\n\tview.create();\n\n\t// Fit to size of the container, apply padding\n\tthis.manager.resizeView(view);\n\n\t// Render Chain\n\treturn view.section.render(this.book.request)\n\t\t.then(function(contents){\n\t\t\treturn view.load(contents);\n\t\t}.bind(this))\n\t\t.then(function(doc){\n\t\t\treturn this.hooks.content.trigger(view, this);\n\t\t}.bind(this))\n\t\t.then(function(){\n\t\t\tthis.layout.format(view.contents);\n\t\t\treturn this.hooks.layout.trigger(view, this);\n\t\t}.bind(this))\n\t\t.then(function(){\n\t\t\treturn view.display();\n\t\t}.bind(this))\n\t\t.then(function(){\n\t\t\treturn this.hooks.render.trigger(view, this);\n\t\t}.bind(this))\n\t\t.then(function(){\n\t\t\tif(show !== false) {\n\t\t\t\tthis.q.enqueue(function(view){\n\t\t\t\t\tview.show();\n\t\t\t\t}, view);\n\t\t\t}\n\t\t\t// this.map = new Map(view, this.layout);\n\t\t\tthis.hooks.show.trigger(view, this);\n\t\t\tthis.trigger(\"rendered\", view.section);\n\n\t\t}.bind(this))\n\t\t.catch(function(e){\n\t\t\tthis.trigger(\"loaderror\", e);\n\t\t}.bind(this));\n\n};\n*/\n\n/**\n * Report what has been displayed\n * @private\n * @param {*} view\n */\nRendition.prototype.afterDisplayed = function(view){\n\tthis.hooks.content.trigger(view, this);\n\tthis.emit(\"rendered\", view.section);\n\tthis.reportLocation();\n};\n\n/**\n * Report resize events and display the last seen location\n * @private\n */\nRendition.prototype.onResized = function(){\n\n\tif(this.location) {\n\t\tthis.display(this.location.start);\n\t}\n\n\tthis.emit(\"resized\", {\n\t\twidth: size.width,\n\t\theight: size.height\n\t});\n\n};\n\n/**\n * Move the Rendition to a specific offset\n * Usually you would be better off calling display()\n * @param {object} offset\n */\nRendition.prototype.moveTo = function(offset){\n\tthis.manager.moveTo(offset);\n};\n\n/**\n * Go to the next \"page\" in the rendition\n * @return {Promise}\n */\nRendition.prototype.next = function(){\n\treturn this.q.enqueue(this.manager.next.bind(this.manager))\n\t\t.then(this.reportLocation.bind(this));\n};\n\n/**\n * Go to the previous \"page\" in the rendition\n * @return {Promise}\n */\nRendition.prototype.prev = function(){\n\treturn this.q.enqueue(this.manager.prev.bind(this.manager))\n\t\t.then(this.reportLocation.bind(this));\n};\n\n//-- http://www.idpf.org/epub/301/spec/epub-publications.html#meta-properties-rendering\n/**\n * Determine the Layout properties from metadata and settings\n * @private\n * @param {object} metadata\n * @return {object} properties\n */\nRendition.prototype.determineLayoutProperties = function(metadata){\n\tvar properties;\n\tvar layout = this.settings.layout || metadata.layout || \"reflowable\";\n\tvar spread = this.settings.spread || metadata.spread || \"auto\";\n\tvar orientation = this.settings.orientation || metadata.orientation || \"auto\";\n\tvar flow = this.settings.flow || metadata.flow || \"auto\";\n\tvar viewport = metadata.viewport || \"\";\n\tvar minSpreadWidth = this.settings.minSpreadWidth || metadata.minSpreadWidth || 800;\n\n\tif (this.settings.width >= 0 && this.settings.height >= 0) {\n\t\tviewport = \"width=\"+this.settings.width+\", height=\"+this.settings.height+\"\";\n\t}\n\n\tproperties = {\n\t\tlayout : layout,\n\t\tspread : spread,\n\t\torientation : orientation,\n\t\tflow : flow,\n\t\tviewport : viewport,\n\t\tminSpreadWidth : minSpreadWidth\n\t};\n\n\treturn properties;\n};\n\n// Rendition.prototype.applyLayoutProperties = function(){\n// \tvar settings = this.determineLayoutProperties(this.book.package.metadata);\n//\n// \tthis.flow(settings.flow);\n//\n// \tthis.layout(settings);\n// };\n\n/**\n * Adjust the flow of the rendition to paginated or scrolled\n * (scrolled-continuous vs scrolled-doc are handled by different view managers)\n * @param {string} flow\n */\nRendition.prototype.flow = function(flow){\n\tvar _flow;\n\tif (flow === \"scrolled-doc\" || flow === \"scrolled-continuous\") {\n\t\t_flow = \"scrolled\";\n\t}\n\n\tif (flow === \"auto\" || flow === \"paginated\") {\n\t\t_flow = \"paginated\";\n\t}\n\n\tif (this._layout) {\n\t\tthis._layout.flow(_flow);\n\t}\n\n\tif (this.manager) {\n\t\tthis.manager.updateFlow(_flow);\n\t}\n};\n\n/**\n * Adjust the layout of the rendition to reflowable or pre-paginated\n * @param {object} settings\n */\nRendition.prototype.layout = function(settings){\n\tif (settings) {\n\t\tthis._layout = new Layout(settings);\n\t\tthis._layout.spread(settings.spread, this.settings.minSpreadWidth);\n\n\t\tthis.mapping = new Mapping(this._layout);\n\t}\n\n\tif (this.manager && this._layout) {\n\t\tthis.manager.applyLayout(this._layout);\n\t}\n\n\treturn this._layout;\n};\n\n/**\n * Adjust if the rendition uses spreads\n * @param {string} spread none | auto (TODO: implement landscape, portrait, both)\n * @param {int} min min width to use spreads at\n */\nRendition.prototype.spread = function(spread, min){\n\n\tthis._layout.spread(spread, min);\n\n\tif (this.manager.isRendered()) {\n\t\tthis.manager.updateLayout();\n\t}\n};\n\n/**\n * Report the current location\n */\nRendition.prototype.reportLocation = function(){\n\treturn this.q.enqueue(function(){\n\t\tvar location = this.manager.currentLocation();\n\t\tif (location && location.then && typeof location.then === 'function') {\n\t\t\tlocation.then(function(result) {\n\t\t\t\tthis.location = result;\n\t\t\t\tthis.emit(\"locationChanged\", this.location);\n\t\t\t}.bind(this));\n\t\t} else if (location) {\n\t\t\tthis.location = location;\n\t\t\tthis.emit(\"locationChanged\", this.location);\n\t\t}\n\n\t}.bind(this));\n};\n\n/**\n * Remove and Clean Up the Rendition\n */\nRendition.prototype.destroy = function(){\n\t// Clear the queue\n\tthis.q.clear();\n\n\tthis.manager.destroy();\n};\n\n/**\n * Pass the events from a view\n * @private\n * @param {View} view\n */\nRendition.prototype.passViewEvents = function(view){\n\tview.contents.listenedEvents.forEach(function(e){\n\t\tview.on(e, this.triggerViewEvent.bind(this));\n\t}.bind(this));\n\n\tview.on(\"selected\", this.triggerSelectedEvent.bind(this));\n};\n\n/**\n * Emit events passed by a view\n * @private\n * @param {event} e\n */\nRendition.prototype.triggerViewEvent = function(e){\n\tthis.emit(e.type, e);\n};\n\n/**\n * Emit a selection event's CFI Range passed from a a view\n * @private\n * @param {EpubCFI} cfirange\n */\nRendition.prototype.triggerSelectedEvent = function(cfirange){\n\tthis.emit(\"selected\", cfirange);\n};\n\n/**\n * Get a Range from a Visible CFI\n * @param {string} cfi EpubCfi String\n * @param {string} ignoreClass\n * @return {range}\n */\nRendition.prototype.range = function(cfi, ignoreClass){\n\tvar _cfi = new EpubCFI(cfi);\n\tvar found = this.visible().filter(function (view) {\n\t\tif(_cfi.spinePos === view.index) return true;\n\t});\n\n\t// Should only every return 1 item\n\tif (found.length) {\n\t\treturn found[0].range(_cfi, ignoreClass);\n\t}\n};\n\n/**\n * Hook to adjust images to fit in columns\n * @param {View} view\n */\nRendition.prototype.adjustImages = function(view) {\n\n\tview.addStylesheetRules([\n\t\t\t[\"img\",\n\t\t\t\t[\"max-width\", (view.layout.spreadWidth) + \"px\"],\n\t\t\t\t[\"max-height\", (view.layout.height) + \"px\"]\n\t\t\t]\n\t]);\n\treturn new Promise(function(resolve, reject){\n\t\t// Wait to apply\n\t\tsetTimeout(function() {\n\t\t\tresolve();\n\t\t}, 1);\n\t});\n};\n\n//-- Enable binding events to Renderer\nEventEmitter(Rendition.prototype);\n\nmodule.exports = Rendition;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/rendition.js\n// module id = 12\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_13__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"xmldom\"\n// module id = 13\n// module chunks = 0","var EventEmitter = require('event-emitter');\nvar path = require('path');\nvar core = require('./core');\nvar Url = require('./core').Url;\nvar Path = require('./core').Path;\nvar Spine = require('./spine');\nvar Locations = require('./locations');\nvar Container = require('./container');\nvar Packaging = require('./packaging');\nvar Navigation = require('./navigation');\nvar Resources = require('./resources');\nvar PageList = require('./pagelist');\nvar Rendition = require('./rendition');\nvar Archive = require('./archive');\nvar request = require('./request');\nvar EpubCFI = require('./epubcfi');\n\n// Const\nvar CONTAINER_PATH = \"META-INF/container.xml\";\n\n/**\n * Creates a new Book\n * @class\n * @param {string} url\n * @param {object} options\n * @param {method} options.requestMethod a request function to use instead of the default\n * @param {boolean} [options.requestCredentials=undefined] send the xhr request withCredentials\n * @param {object} [options.requestHeaders=undefined] send the xhr request headers\n * @param {string} [options.encoding=binary] optional to pass 'binary' or base64' for archived Epubs\n * @param {string} [options.replacements=base64] use base64, blobUrl, or none for replacing assets in archived Epubs\n * @returns {Book}\n * @example new Book(\"/path/to/book.epub\", {})\n * @example new Book({ replacements: \"blobUrl\" })\n */\nfunction Book(url, options){\n\n\t// Allow passing just options to the Book\n\tif (typeof(options) === \"undefined\"\n\t\t&& typeof(url) === \"object\") {\n\t\toptions = url;\n\t\turl = undefined;\n\t}\n\n\tthis.settings = core.extend(this.settings || {}, {\n\t\trequestMethod: undefined,\n\t\trequestCredentials: undefined,\n\t\trequestHeaders: undefined,\n\t\tencoding: undefined,\n\t\treplacements: 'base64'\n\t});\n\n\tcore.extend(this.settings, options);\n\n\n\t// Promises\n\tthis.opening = new core.defer();\n\t/**\n\t * @property {promise} opened returns after the book is loaded\n\t */\n\tthis.opened = this.opening.promise;\n\tthis.isOpen = false;\n\n\tthis.loading = {\n\t\tmanifest: new core.defer(),\n\t\tspine: new core.defer(),\n\t\tmetadata: new core.defer(),\n\t\tcover: new core.defer(),\n\t\tnavigation: new core.defer(),\n\t\tpageList: new core.defer(),\n\t\tresources: new core.defer()\n\t};\n\n\tthis.loaded = {\n\t\tmanifest: this.loading.manifest.promise,\n\t\tspine: this.loading.spine.promise,\n\t\tmetadata: this.loading.metadata.promise,\n\t\tcover: this.loading.cover.promise,\n\t\tnavigation: this.loading.navigation.promise,\n\t\tpageList: this.loading.pageList.promise,\n\t\tresources: this.loading.resources.promise\n\t};\n\n\t// this.ready = RSVP.hash(this.loaded);\n\t/**\n\t * @property {promise} ready returns after the book is loaded and parsed\n\t * @private\n\t */\n\tthis.ready = Promise.all([this.loaded.manifest,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tthis.loaded.spine,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tthis.loaded.metadata,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tthis.loaded.cover,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tthis.loaded.navigation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tthis.loaded.resources ]);\n\n\n\t// Queue for methods used before opening\n\tthis.isRendered = false;\n\t// this._q = core.queue(this);\n\n\t/**\n\t * @property {method} request\n\t * @private\n\t */\n\tthis.request = this.settings.requestMethod || request;\n\n\t/**\n\t * @property {Spine} spine\n\t */\n\tthis.spine = new Spine();\n\n\t/**\n\t * @property {Locations} locations\n\t */\n\tthis.locations = new Locations(this.spine, this.load);\n\n\t/**\n\t * @property {Navigation} navigation\n\t */\n\tthis.navigation = undefined;\n\n\t/**\n\t * @property {PageList} pagelist\n\t */\n\tthis.pageList = new PageList();\n\n\t/**\n\t * @property {Url} url\n\t * @private\n\t */\n\tthis.url = undefined;\n\n\t/**\n\t * @property {Path} path\n\t * @private\n\t */\n\tthis.path = undefined;\n\n\t/**\n\t * @property {boolean} archived\n\t * @private\n\t */\n\tthis.archived = false;\n\n\tif(url) {\n\t\tthis.open(url).catch(function (error) {\n\t\t\tvar err = new Error(\"Cannot load book at \"+ url );\n\t\t\tconsole.error(err);\n\t\t\tthis.emit(\"openFailed\", err);\n\t\t\tconsole.log(error);\n\t\t}.bind(this));\n\t}\n};\n\n/**\n * Open a epub or url\n * @param {string} input URL, Path or ArrayBuffer\n * @param {string} [what] to force opening\n * @returns {Promise} of when the book has been loaded\n * @example book.open(\"/path/to/book.epub\")\n */\nBook.prototype.open = function(input, what){\n\tvar opening;\n\tvar type = what || this.determineType(input);\n\n\tif (type === \"binary\") {\n\t\tthis.archived = true;\n\t\tthis.url = new Url(\"/\", \"\");\n\t\topening = this.openEpub(input);\n\t} else if (type === \"epub\") {\n\t\tthis.archived = true;\n\t\tthis.url = new Url(\"/\", \"\");\n\t\topening = this.request(input, 'binary')\n\t\t\t.then(this.openEpub.bind(this));\n\t} else if(type == \"opf\") {\n\t\tthis.url = new Url(input);\n\t\topening = this.openPackaging(input);\n\t} else {\n\t\tthis.url = new Url(input);\n\t\topening = this.openContainer(CONTAINER_PATH)\n\t\t\t.then(this.openPackaging.bind(this));\n\t}\n\n\treturn opening;\n};\n\n/**\n * Open an archived epub\n * @private\n * @param {binary} data\n * @param {[string]} encoding\n * @return {Promise}\n */\nBook.prototype.openEpub = function(data, encoding){\n\treturn this.unarchive(data, encoding || this.settings.encoding)\n\t\t.then(function() {\n\t\t\treturn this.openContainer(CONTAINER_PATH);\n\t\t}.bind(this))\n\t\t.then(function(packagePath) {\n\t\t\treturn this.openPackaging(packagePath);\n\t\t}.bind(this));\n};\n\n/**\n * Open the epub container\n * @private\n * @param {string} url\n * @return {string} packagePath\n */\nBook.prototype.openContainer = function(url){\n\treturn this.load(url)\n\t\t.then(function(xml) {\n\t\t\tthis.container = new Container(xml);\n\t\t\treturn this.resolve(this.container.packagePath);\n\t\t}.bind(this));\n};\n\n/**\n * Open the Open Packaging Format Xml\n * @private\n * @param {string} url\n * @return {Promise}\n */\nBook.prototype.openPackaging = function(url){\n\tvar packageUrl;\n\tthis.path = new Path(url);\n\n\treturn this.load(url)\n\t\t.then(function(xml) {\n\t\t\tthis.packaging = new Packaging(xml);\n\t\t\treturn this.unpack(this.packaging);\n\t\t}.bind(this));\n};\n\n/**\n * Load a resource from the Book\n * @param {string} path path to the resource to load\n * @return {Promise} returns a promise with the requested resource\n */\nBook.prototype.load = function (path) {\n\tvar resolved;\n\n\tif(this.archived) {\n\t\tresolved = this.resolve(path);\n\t\treturn this.archive.request(resolved);\n\t} else {\n\t\tresolved = this.resolve(path);\n\t\treturn this.request(resolved, null, this.settings.requestCredentials, this.settings.requestHeaders);\n\t}\n};\n\n/**\n * Resolve a path to it's absolute position in the Book\n * @param {string} path\n * @param {[boolean]} absolute force resolving the full URL\n * @return {string} the resolved path string\n */\nBook.prototype.resolve = function (path, absolute) {\n\tvar resolved = path;\n\tvar isAbsolute = (path.indexOf('://') > -1);\n\n\tif (isAbsolute) {\n\t\treturn path;\n\t}\n\n\tif (this.path) {\n\t\tresolved = this.path.resolve(path);\n\t}\n\n\tif(absolute != false && this.url) {\n\t\tresolved = this.url.resolve(resolved);\n\t}\n\n\treturn resolved;\n}\n\n/**\n * Determine the type of they input passed to open\n * @private\n * @param {string} input\n * @return {string} binary | directory | epub | opf\n */\nBook.prototype.determineType = function(input) {\n\tvar url;\n\tvar path;\n\tvar extension;\n\n\tif (typeof(input) != \"string\") {\n\t\treturn \"binary\";\n\t}\n\n\turl = new Url(input);\n\tpath = url.path();\n\textension = path.extension;\n\n\tif (!extension) {\n\t\treturn \"directory\";\n\t}\n\n\tif(extension === \"epub\"){\n\t\treturn \"epub\";\n\t}\n\n\tif(extension === \"opf\"){\n\t\treturn \"opf\";\n\t}\n};\n\n\n/**\n * unpack the contents of the Books packageXml\n * @private\n * @param {document} packageXml XML Document\n */\nBook.prototype.unpack = function(opf){\n\tthis.package = opf;\n\n\tthis.spine.unpack(this.package, this.resolve.bind(this));\n\n\tthis.resources = new Resources(this.package.manifest, {\n\t\tarchive: this.archive,\n\t\tresolver: this.resolve.bind(this),\n\t\treplacements: this.settings.replacements\n\t});\n\n\tthis.loadNavigation(this.package).then(function(toc){\n\t\tthis.toc = toc;\n\t\tthis.loading.navigation.resolve(this.toc);\n\t}.bind(this));\n\n\tthis.cover = this.resolve(this.package.coverPath);\n\n\t// Resolve promises\n\tthis.loading.manifest.resolve(this.package.manifest);\n\tthis.loading.metadata.resolve(this.package.metadata);\n\tthis.loading.spine.resolve(this.spine);\n\tthis.loading.cover.resolve(this.cover);\n\tthis.loading.resources.resolve(this.resources);\n\tthis.loading.pageList.resolve(this.pageList);\n\n\n\tthis.isOpen = true;\n\n\tif(this.archived) {\n\t\tthis.replacements().then(function() {\n\t\t\tthis.opening.resolve(this);\n\t\t}.bind(this));\n\t} else {\n\t\t// Resolve book opened promise\n\t\tthis.opening.resolve(this);\n\t}\n\n};\n\n/**\n * Load Navigation and PageList from package\n * @private\n * @param {document} opf XML Document\n */\nBook.prototype.loadNavigation = function(opf){\n\tvar navPath = opf.navPath || opf.ncxPath;\n\n\tif (!navPath) {\n\t\treturn;\n\t}\n\n\treturn this.load(navPath, 'xml')\n\t\t.then(function(xml) {\n\t\t\tthis.navigation = new Navigation(xml);\n\t\t\tthis.pageList = new PageList(xml);\n\t\t}.bind(this));\n};\n\n/**\n * Alias for book.spine.get\n * @param {string} target\n */\nBook.prototype.section = function(target) {\n\treturn this.spine.get(target);\n};\n\n/**\n * Sugar to render a book\n * @param {element} element element to add the views to\n * @param {[object]} options\n * @return {Rendition}\n */\nBook.prototype.renderTo = function(element, options) {\n\t// var renderMethod = (options && options.method) ?\n\t// options.method :\n\t// \"single\";\n\n\tthis.rendition = new Rendition(this, options);\n\tthis.rendition.attachTo(element);\n\n\treturn this.rendition;\n};\n\n/**\n * Set if request should use withCredentials\n * @param {boolean} credentials\n */\nBook.prototype.setRequestCredentials = function(credentials) {\n\tthis.settings.requestCredentials = credentials;\n};\n\n/**\n * Set headers request should use\n * @param {object} headers\n */\nBook.prototype.setRequestHeaders = function(headers) {\n\tthis.settings.requestHeaders = headers;\n};\n\n/**\n * Unarchive a zipped epub\n * @private\n * @param {binary} input epub data\n * @param {[string]} encoding\n * @return {Archive}\n */\nBook.prototype.unarchive = function(input, encoding){\n\tthis.archive = new Archive();\n\treturn this.archive.open(input, encoding);\n};\n\n/**\n * Get the cover url\n * @return {string} coverUrl\n */\nBook.prototype.coverUrl = function(){\n\tvar retrieved = this.loaded.cover.\n\t\tthen(function(url) {\n\t\t\tif(this.archived) {\n\t\t\t\t// return this.archive.createUrl(this.cover);\n\t\t\t\treturn this.resources.get(this.cover);\n\t\t\t}else{\n\t\t\t\treturn this.cover;\n\t\t\t}\n\t\t}.bind(this));\n\n\n\n\treturn retrieved;\n};\n\n/**\n * load replacement urls\n * @private\n * @return {Promise} completed loading urls\n */\nBook.prototype.replacements = function(){\n\tthis.spine.hooks.serialize.register(function(output, section) {\n\t\tsection.output = this.resources.substitute(output, section.url);\n\t}.bind(this));\n\n\treturn this.resources.replacements().\n\t\tthen(function() {\n\t\t\treturn this.resources.replaceCss();\n\t\t}.bind(this));\n};\n\n/**\n * Find a DOM Range for a given CFI Range\n * @param {EpubCFI} cfiRange a epub cfi range\n * @return {Range}\n */\nBook.prototype.range = function(cfiRange) {\n\tvar cfi = new EpubCFI(cfiRange);\n\tvar item = this.spine.get(cfi.spinePos);\n\n\treturn item.load().then(function (contents) {\n\t\tvar range = cfi.toRange(item.document);\n\t\treturn range;\n\t})\n};\n\n//-- Enable binding events to book\nEventEmitter(Book.prototype);\n\nmodule.exports = Book;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/book.js\n// module id = 16\n// module chunks = 0","var core = require('../../core');\nvar DefaultViewManager = require('../default');\n\nfunction ContinuousViewManager(options) {\n\n\tDefaultViewManager.apply(this, arguments); // call super constructor.\n\n\tthis.name = \"continuous\";\n\n\tthis.settings = core.extend(this.settings || {}, {\n\t\tinfinite: true,\n\t\toverflow: \"auto\",\n\t\taxis: \"vertical\",\n\t\toffset: 500,\n\t\toffsetDelta: 250,\n\t\twidth: undefined,\n\t\theight: undefined\n\t});\n\n\tcore.extend(this.settings, options.settings || {});\n\n\t// Gap can be 0, byt defaults doesn't handle that\n\tif (options.settings.gap != \"undefined\" && options.settings.gap === 0) {\n\t\tthis.settings.gap = options.settings.gap;\n\t}\n\n\t// this.viewSettings.axis = this.settings.axis;\n\tthis.viewSettings = {\n\t\tignoreClass: this.settings.ignoreClass,\n\t\taxis: this.settings.axis,\n\t\tlayout: this.layout,\n\t\twidth: 0,\n\t\theight: 0\n\t};\n\n\tthis.scrollTop = 0;\n\tthis.scrollLeft = 0;\n};\n\n// subclass extends superclass\nContinuousViewManager.prototype = Object.create(DefaultViewManager.prototype);\nContinuousViewManager.prototype.constructor = ContinuousViewManager;\n\nContinuousViewManager.prototype.display = function(section, target){\n\treturn DefaultViewManager.prototype.display.call(this, section, target)\n\t\t.then(function () {\n\t\t\treturn this.fill();\n\t\t}.bind(this));\n};\n\nContinuousViewManager.prototype.fill = function(_full){\n\tvar full = _full || new core.defer();\n\n\tthis.check().then(function(result) {\n\t\tif (result) {\n\t\t\tthis.fill(full);\n\t\t} else {\n\t\t\tfull.resolve();\n\t\t}\n\t}.bind(this));\n\n\treturn full.promise;\n}\n\nContinuousViewManager.prototype.moveTo = function(offset){\n\t// var bounds = this.stage.bounds();\n\t// var dist = Math.floor(offset.top / bounds.height) * bounds.height;\n\tvar distX = 0,\n\t\t\tdistY = 0;\n\n\tvar offsetX = 0,\n\t\t\toffsetY = 0;\n\n\tif(this.settings.axis === \"vertical\") {\n\t\tdistY = offset.top;\n\t\toffsetY = offset.top+this.settings.offset;\n\t} else {\n\t\tdistX = Math.floor(offset.left / this.layout.delta) * this.layout.delta;\n\t\toffsetX = distX+this.settings.offset;\n\t}\n\n\treturn this.check(offsetX, offsetY)\n\t\t.then(function(){\n\t\t\tthis.scrollBy(distX, distY);\n\t\t}.bind(this));\n};\n\n/*\nContinuousViewManager.prototype.afterDisplayed = function(currView){\n\tvar next = currView.section.next();\n\tvar prev = currView.section.prev();\n\tvar index = this.views.indexOf(currView);\n\tvar prevView, nextView;\n\n\tif(index + 1 === this.views.length && next) {\n\t\tnextView = this.createView(next);\n\t\tthis.q.enqueue(this.append.bind(this), nextView);\n\t}\n\n\tif(index === 0 && prev) {\n\t\tprevView = this.createView(prev, this.viewSettings);\n\t\tthis.q.enqueue(this.prepend.bind(this), prevView);\n\t}\n\n\t// this.removeShownListeners(currView);\n\t// currView.onShown = this.afterDisplayed.bind(this);\n\tthis.emit(\"added\", currView.section);\n\n};\n*/\n\nContinuousViewManager.prototype.resize = function(width, height){\n\n\t// Clear the queue\n\tthis.q.clear();\n\n\tthis._stageSize = this.stage.size(width, height);\n\tthis._bounds = this.bounds();\n\n\t// Update for new views\n\tthis.viewSettings.width = this._stageSize.width;\n\tthis.viewSettings.height = this._stageSize.height;\n\n\t// Update for existing views\n\tthis.views.each(function(view) {\n\t\tview.size(this._stageSize.width, this._stageSize.height);\n\t}.bind(this));\n\n\tthis.updateLayout();\n\n\t// if(this.location) {\n\t// this.rendition.display(this.location.start);\n\t// }\n\n\tthis.emit(\"resized\", {\n\t\twidth: this.stage.width,\n\t\theight: this.stage.height\n\t});\n\n};\n\nContinuousViewManager.prototype.onResized = function(e) {\n\n\t// this.views.clear();\n\n\tclearTimeout(this.resizeTimeout);\n\tthis.resizeTimeout = setTimeout(function(){\n\t\tthis.resize();\n\t}.bind(this), 150);\n};\n\nContinuousViewManager.prototype.afterResized = function(view){\n\tthis.emit(\"resize\", view.section);\n};\n\n// Remove Previous Listeners if present\nContinuousViewManager.prototype.removeShownListeners = function(view){\n\n\t// view.off(\"shown\", this.afterDisplayed);\n\t// view.off(\"shown\", this.afterDisplayedAbove);\n\tview.onDisplayed = function(){};\n\n};\n\n\n// ContinuousViewManager.prototype.append = function(section){\n// \treturn this.q.enqueue(function() {\n//\n// \t\tthis._append(section);\n//\n//\n// \t}.bind(this));\n// };\n//\n// ContinuousViewManager.prototype.prepend = function(section){\n// \treturn this.q.enqueue(function() {\n//\n// \t\tthis._prepend(section);\n//\n// \t}.bind(this));\n//\n// };\n\nContinuousViewManager.prototype.append = function(section){\n\tvar view = this.createView(section);\n\tthis.views.append(view);\n\treturn view;\n};\n\nContinuousViewManager.prototype.prepend = function(section){\n\tvar view = this.createView(section);\n\n\tview.on(\"resized\", this.counter.bind(this));\n\n\tthis.views.prepend(view);\n\treturn view;\n};\n\nContinuousViewManager.prototype.counter = function(bounds){\n\n\tif(this.settings.axis === \"vertical\") {\n\t\tthis.scrollBy(0, bounds.heightDelta, true);\n\t} else {\n\t\tthis.scrollBy(bounds.widthDelta, 0, true);\n\t}\n\n};\n\nContinuousViewManager.prototype.update = function(_offset){\n\tvar container = this.bounds();\n\tvar views = this.views.all();\n\tvar viewsLength = views.length;\n\tvar visible = [];\n\tvar offset = typeof _offset != \"undefined\" ? _offset : (this.settings.offset || 0);\n\tvar isVisible;\n\tvar view;\n\n\tvar updating = new core.defer();\n\tvar promises = [];\n\n\tfor (var i = 0; i < viewsLength; i++) {\n\t\tview = views[i];\n\n\t\tisVisible = this.isVisible(view, offset, offset, container);\n\n\t\tif(isVisible === true) {\n\t\t\tif (!view.displayed) {\n\t\t\t\tpromises.push(view.display(this.request).then(function (view) {\n\t\t\t\t\tview.show();\n\t\t\t\t}));\n\t\t\t}\n\t\t\tvisible.push(view);\n\t\t} else {\n\t\t\tthis.q.enqueue(view.destroy.bind(view));\n\n\t\t\tclearTimeout(this.trimTimeout);\n\t\t\tthis.trimTimeout = setTimeout(function(){\n\t\t\t\tthis.q.enqueue(this.trim.bind(this));\n\t\t\t}.bind(this), 250);\n\t\t}\n\n\t}\n\n\tif(promises.length){\n\t\treturn Promise.all(promises);\n\t} else {\n\t\tupdating.resolve();\n\t\treturn updating.promise;\n\t}\n\n};\n\nContinuousViewManager.prototype.check = function(_offsetLeft, _offsetTop){\n\tvar last, first, next, prev;\n\n\tvar checking = new core.defer();\n\tvar newViews = [];\n\n\tvar horizontal = (this.settings.axis === \"horizontal\");\n\tvar delta = this.settings.offset || 0;\n\n\tif (_offsetLeft && horizontal) {\n\t\tdelta = _offsetLeft;\n\t}\n\n\tif (_offsetTop && !horizontal) {\n\t\tdelta = _offsetTop;\n\t}\n\n\tvar bounds = this._bounds; // bounds saved this until resize\n\n\tvar offset = horizontal ? this.scrollLeft : this.scrollTop;\n\tvar visibleLength = horizontal ? bounds.width : bounds.height;\n\tvar contentLength = horizontal ? this.container.scrollWidth : this.container.scrollHeight;\n\n\tif (offset + visibleLength + delta >= contentLength) {\n\t\tlast = this.views.last();\n\t\tnext = last && last.section.next();\n\t\tif(next) {\n\t\t\tnewViews.push(this.append(next));\n\t\t}\n\t}\n\n\tif (offset - delta < 0 ) {\n\t\tfirst = this.views.first();\n\t\tprev = first && first.section.prev();\n\t\tif(prev) {\n\t\t\tnewViews.push(this.prepend(prev));\n\t\t}\n\t}\n\n\tif(newViews.length){\n\t\t// Promise.all(promises)\n\t\t\t// .then(function() {\n\t\t\t\t// Check to see if anything new is on screen after rendering\n\t\t\t\treturn this.q.enqueue(function(){\n\t\t\t\t\treturn this.update(delta);\n\t\t\t\t}.bind(this));\n\n\n\t\t\t// }.bind(this));\n\n\t} else {\n\t\tchecking.resolve(false);\n\t\treturn checking.promise;\n\t}\n\n\n};\n\nContinuousViewManager.prototype.trim = function(){\n\tvar task = new core.defer();\n\tvar displayed = this.views.displayed();\n\tvar first = displayed[0];\n\tvar last = displayed[displayed.length-1];\n\tvar firstIndex = this.views.indexOf(first);\n\tvar lastIndex = this.views.indexOf(last);\n\tvar above = this.views.slice(0, firstIndex);\n\tvar below = this.views.slice(lastIndex+1);\n\n\t// Erase all but last above\n\tfor (var i = 0; i < above.length-1; i++) {\n\t\tthis.erase(above[i], above);\n\t}\n\n\t// Erase all except first below\n\tfor (var j = 1; j < below.length; j++) {\n\t\tthis.erase(below[j]);\n\t}\n\n\ttask.resolve();\n\treturn task.promise;\n};\n\nContinuousViewManager.prototype.erase = function(view, above){ //Trim\n\n\tvar prevTop;\n\tvar prevLeft;\n\n\tif(this.settings.height) {\n\t\tprevTop = this.container.scrollTop;\n\t\tprevLeft = this.container.scrollLeft;\n\t} else {\n\t\tprevTop = window.scrollY;\n\t\tprevLeft = window.scrollX;\n\t}\n\n\tvar bounds = view.bounds();\n\n\tthis.views.remove(view);\n\n\tif(above) {\n\n\t\tif(this.settings.axis === \"vertical\") {\n\t\t\tthis.scrollTo(0, prevTop - bounds.height, true);\n\t\t} else {\n\t\t\tthis.scrollTo(prevLeft - bounds.width, 0, true);\n\t\t}\n\t}\n\n};\n\nContinuousViewManager.prototype.addEventListeners = function(stage){\n\n\twindow.addEventListener('unload', function(e){\n\t\tthis.ignore = true;\n\t\t// this.scrollTo(0,0);\n\t\tthis.destroy();\n\t}.bind(this));\n\n\tthis.addScrollListeners();\n};\n\nContinuousViewManager.prototype.addScrollListeners = function() {\n\tvar scroller;\n\n\tthis.tick = core.requestAnimationFrame;\n\n\tif(this.settings.height) {\n\t\tthis.prevScrollTop = this.container.scrollTop;\n\t\tthis.prevScrollLeft = this.container.scrollLeft;\n\t} else {\n\t\tthis.prevScrollTop = window.scrollY;\n\t\tthis.prevScrollLeft = window.scrollX;\n\t}\n\n\tthis.scrollDeltaVert = 0;\n\tthis.scrollDeltaHorz = 0;\n\n\tif(this.settings.height) {\n\t\tscroller = this.container;\n\t\tthis.scrollTop = this.container.scrollTop;\n\t\tthis.scrollLeft = this.container.scrollLeft;\n\t} else {\n\t\tscroller = window;\n\t\tthis.scrollTop = window.scrollY;\n\t\tthis.scrollLeft = window.scrollX;\n\t}\n\n\tscroller.addEventListener(\"scroll\", this.onScroll.bind(this));\n\n\t// this.tick.call(window, this.onScroll.bind(this));\n\n\tthis.scrolled = false;\n\n};\n\nContinuousViewManager.prototype.onScroll = function(){\n\n\t// if(!this.ignore) {\n\n\t\tif(this.settings.height) {\n\t\t\tscrollTop = this.container.scrollTop;\n\t\t\tscrollLeft = this.container.scrollLeft;\n\t\t} else {\n\t\t\tscrollTop = window.scrollY;\n\t\t\tscrollLeft = window.scrollX;\n\t\t}\n\n\t\tthis.scrollTop = scrollTop;\n\t\tthis.scrollLeft = scrollLeft;\n\n\t\tif(!this.ignore) {\n\n\t\t\tif((this.scrollDeltaVert === 0 &&\n\t\t\t\t this.scrollDeltaHorz === 0) ||\n\t\t\t\t this.scrollDeltaVert > this.settings.offsetDelta ||\n\t\t\t\t this.scrollDeltaHorz > this.settings.offsetDelta) {\n\n\t\t\t\tthis.q.enqueue(function() {\n\t\t\t\t\tthis.check();\n\t\t\t\t}.bind(this));\n\t\t\t\t// this.check();\n\n\t\t\t\tthis.scrollDeltaVert = 0;\n\t\t\t\tthis.scrollDeltaHorz = 0;\n\n\t\t\t\tthis.emit(\"scroll\", {\n\t\t\t\t\ttop: scrollTop,\n\t\t\t\t\tleft: scrollLeft\n\t\t\t\t});\n\n\t\t\t\tclearTimeout(this.afterScrolled);\n\t\t\t\tthis.afterScrolled = setTimeout(function () {\n\t\t\t\t\tthis.emit(\"scrolled\", {\n\t\t\t\t\t\ttop: this.scrollTop,\n\t\t\t\t\t\tleft: this.scrollLeft\n\t\t\t\t\t});\n\t\t\t\t}.bind(this));\n\n\t\t\t}\n\n\t\t} else {\n\t\t\tthis.ignore = false;\n\t\t}\n\n\t\tthis.scrollDeltaVert += Math.abs(scrollTop-this.prevScrollTop);\n\t\tthis.scrollDeltaHorz += Math.abs(scrollLeft-this.prevScrollLeft);\n\n\t\tthis.prevScrollTop = scrollTop;\n\t\tthis.prevScrollLeft = scrollLeft;\n\n\t\tclearTimeout(this.scrollTimeout);\n\t\tthis.scrollTimeout = setTimeout(function(){\n\t\t\tthis.scrollDeltaVert = 0;\n\t\t\tthis.scrollDeltaHorz = 0;\n\t\t}.bind(this), 150);\n\n\n\t\tthis.scrolled = false;\n\t// }\n\n\t// this.tick.call(window, this.onScroll.bind(this));\n\n};\n\n\n// ContinuousViewManager.prototype.resizeView = function(view) {\n//\n// \tif(this.settings.axis === \"horizontal\") {\n// \t\tview.lock(\"height\", this.stage.width, this.stage.height);\n// \t} else {\n// \t\tview.lock(\"width\", this.stage.width, this.stage.height);\n// \t}\n//\n// };\n\nContinuousViewManager.prototype.currentLocation = function(){\n\n\tif (this.settings.axis === \"vertical\") {\n\t\tthis.location = this.scrolledLocation();\n\t} else {\n\t\tthis.location = this.paginatedLocation();\n\t}\n\n\treturn this.location;\n};\n\nContinuousViewManager.prototype.scrolledLocation = function(){\n\n\tvar visible = this.visible();\n\tvar startPage, endPage;\n\n\tvar container = this.container.getBoundingClientRect();\n\n\tif(visible.length === 1) {\n\t\treturn this.mapping.page(visible[0].contents, visible[0].section.cfiBase);\n\t}\n\n\tif(visible.length > 1) {\n\n\t\tstartPage = this.mapping.page(visible[0].contents, visible[0].section.cfiBase);\n\t\tendPage = this.mapping.page(visible[visible.length-1].contents, visible[visible.length-1].section.cfiBase);\n\n\t\treturn {\n\t\t\tstart: startPage.start,\n\t\t\tend: endPage.end\n\t\t};\n\t}\n\n};\n\nContinuousViewManager.prototype.paginatedLocation = function(){\n\tvar visible = this.visible();\n\tvar startA, startB, endA, endB;\n\tvar pageLeft, pageRight;\n\tvar container = this.container.getBoundingClientRect();\n\n\tif(visible.length === 1) {\n\t\tstartA = container.left - visible[0].position().left;\n\t\tendA = startA + this.layout.spreadWidth;\n\n\t\treturn this.mapping.page(visible[0].contents, visible[0].section.cfiBase, startA, endA);\n\t}\n\n\tif(visible.length > 1) {\n\n\t\t// Left Col\n\t\tstartA = container.left - visible[0].position().left;\n\t\tendA = startA + this.layout.columnWidth;\n\n\t\t// Right Col\n\t\tstartB = container.left + this.layout.spreadWidth - visible[visible.length-1].position().left;\n\t\tendB = startB + this.layout.columnWidth;\n\n\t\tpageLeft = this.mapping.page(visible[0].contents, visible[0].section.cfiBase, startA, endA);\n\t\tpageRight = this.mapping.page(visible[visible.length-1].contents, visible[visible.length-1].section.cfiBase, startB, endB);\n\n\t\treturn {\n\t\t\tstart: pageLeft.start,\n\t\t\tend: pageRight.end\n\t\t};\n\t}\n};\n\n/*\nContinuous.prototype.current = function(what){\n\tvar view, top;\n\tvar container = this.container.getBoundingClientRect();\n\tvar length = this.views.length - 1;\n\n\tif(this.settings.axis === \"horizontal\") {\n\n\t\tfor (var i = length; i >= 0; i--) {\n\t\t\tview = this.views[i];\n\t\t\tleft = view.position().left;\n\n\t\t\tif(left < container.right) {\n\n\t\t\t\tif(this._current == view) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tthis._current = view;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t} else {\n\n\t\tfor (var i = length; i >= 0; i--) {\n\t\t\tview = this.views[i];\n\t\t\ttop = view.bounds().top;\n\t\t\tif(top < container.bottom) {\n\n\t\t\t\tif(this._current == view) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tthis._current = view;\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn this._current;\n};\n*/\n\nContinuousViewManager.prototype.updateLayout = function() {\n\n\tif (!this.stage) {\n\t\treturn;\n\t}\n\n\tif(this.settings.axis === \"vertical\") {\n\t\tthis.layout.calculate(this._stageSize.width, this._stageSize.height);\n\t} else {\n\t\tthis.layout.calculate(\n\t\t\tthis._stageSize.width,\n\t\t\tthis._stageSize.height,\n\t\t\tthis.settings.gap\n\t\t);\n\n\t\t// Set the look ahead offset for what is visible\n\t\tthis.settings.offset = this.layout.delta;\n\n\t\tthis.stage.addStyleRules(\"iframe\", [{\"margin-right\" : this.layout.gap + \"px\"}]);\n\n\t}\n\n\t// Set the dimensions for views\n\tthis.viewSettings.width = this.layout.width;\n\tthis.viewSettings.height = this.layout.height;\n\n\tthis.setLayout(this.layout);\n\n};\n\nContinuousViewManager.prototype.next = function(){\n\n\tif(this.settings.axis === \"horizontal\") {\n\n\t\tthis.scrollLeft = this.container.scrollLeft;\n\n\t\tif(this.container.scrollLeft +\n\t\t\t this.container.offsetWidth +\n\t\t\t this.layout.delta < this.container.scrollWidth) {\n\t\t\tthis.scrollBy(this.layout.delta, 0);\n\t\t} else {\n\t\t\tthis.scrollTo(this.container.scrollWidth - this.layout.delta, 0);\n\t\t}\n\n\t} else {\n\t\tthis.scrollBy(0, this.layout.height);\n\t}\n};\n\nContinuousViewManager.prototype.prev = function(){\n\tif(this.settings.axis === \"horizontal\") {\n\t\tthis.scrollBy(-this.layout.delta, 0);\n\t} else {\n\t\tthis.scrollBy(0, -this.layout.height);\n\t}\n};\n\nContinuousViewManager.prototype.updateFlow = function(flow){\n\tvar axis = (flow === \"paginated\") ? \"horizontal\" : \"vertical\";\n\n\tthis.settings.axis = axis;\n\n\tthis.viewSettings.axis = axis;\n\n\tthis.settings.overflow = (flow === \"paginated\") ? \"hidden\" : \"auto\";\n\n\t// this.views.each(function(view){\n\t// \tview.setAxis(axis);\n\t// });\n\n\tif (this.settings.axis === \"vertical\") {\n\t\tthis.settings.infinite = true;\n\t} else {\n\t\tthis.settings.infinite = false;\n\t}\n\n};\nmodule.exports = ContinuousViewManager;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/managers/continuous/index.js\n// module id = 17\n// module chunks = 0","var EventEmitter = require('event-emitter');\nvar core = require('../../core');\nvar EpubCFI = require('../../epubcfi');\nvar Contents = require('../../contents');\n\nfunction IframeView(section, options) {\n\tthis.settings = core.extend({\n\t\tignoreClass : '',\n\t\taxis: 'vertical',\n\t\twidth: 0,\n\t\theight: 0,\n\t\tlayout: undefined,\n\t\tglobalLayoutProperties: {},\n\t}, options || {});\n\n\tthis.id = \"epubjs-view-\" + core.uuid();\n\tthis.section = section;\n\tthis.index = section.index;\n\n\tthis.element = this.container(this.settings.axis);\n\n\tthis.added = false;\n\tthis.displayed = false;\n\tthis.rendered = false;\n\n\tthis.width = this.settings.width;\n\tthis.height = this.settings.height;\n\n\tthis.fixedWidth = 0;\n\tthis.fixedHeight = 0;\n\n\t// Blank Cfi for Parsing\n\tthis.epubcfi = new EpubCFI();\n\n\tthis.layout = this.settings.layout;\n\t// Dom events to listen for\n\t// this.listenedEvents = [\"keydown\", \"keyup\", \"keypressed\", \"mouseup\", \"mousedown\", \"click\", \"touchend\", \"touchstart\"];\n};\n\nIframeView.prototype.container = function(axis) {\n\tvar element = document.createElement('div');\n\n\telement.classList.add(\"epub-view\");\n\n\t// this.element.style.minHeight = \"100px\";\n\telement.style.height = \"0px\";\n\telement.style.width = \"0px\";\n\telement.style.overflow = \"hidden\";\n\n\tif(axis && axis == \"horizontal\"){\n\t\telement.style.display = \"inline-block\";\n\t} else {\n\t\telement.style.display = \"block\";\n\t}\n\n\treturn element;\n};\n\nIframeView.prototype.create = function() {\n\n\tif(this.iframe) {\n\t\treturn this.iframe;\n\t}\n\n\tif(!this.element) {\n\t\tthis.element = this.createContainer();\n\t}\n\n\tthis.iframe = document.createElement('iframe');\n\tthis.iframe.id = this.id;\n\tthis.iframe.scrolling = \"no\"; // Might need to be removed: breaks ios width calculations\n\tthis.iframe.style.overflow = \"hidden\";\n\tthis.iframe.seamless = \"seamless\";\n\t// Back up if seamless isn't supported\n\tthis.iframe.style.border = \"none\";\n\n\tthis.resizing = true;\n\n\t// this.iframe.style.display = \"none\";\n\tthis.element.style.visibility = \"hidden\";\n\tthis.iframe.style.visibility = \"hidden\";\n\n\tthis.iframe.style.width = \"0\";\n\tthis.iframe.style.height = \"0\";\n\tthis._width = 0;\n\tthis._height = 0;\n\n\tthis.element.appendChild(this.iframe);\n\tthis.added = true;\n\n\tthis.elementBounds = core.bounds(this.element);\n\n\t// if(width || height){\n\t// this.resize(width, height);\n\t// } else if(this.width && this.height){\n\t// this.resize(this.width, this.height);\n\t// } else {\n\t// this.iframeBounds = core.bounds(this.iframe);\n\t// }\n\n\t// Firefox has trouble with baseURI and srcdoc\n\t// TODO: Disable for now in firefox\n\n\tif(!!(\"srcdoc\" in this.iframe)) {\n\t\tthis.supportsSrcdoc = true;\n\t} else {\n\t\tthis.supportsSrcdoc = false;\n\t}\n\n\treturn this.iframe;\n};\n\nIframeView.prototype.render = function(request, show) {\n\n\t// view.onLayout = this.layout.format.bind(this.layout);\n\tthis.create();\n\n\t// Fit to size of the container, apply padding\n\tthis.size();\n\n\tif(!this.sectionRender) {\n\t\tthis.sectionRender = this.section.render(request);\n\t}\n\n\t// Render Chain\n\treturn this.sectionRender\n\t\t.then(function(contents){\n\t\t\treturn this.load(contents);\n\t\t}.bind(this))\n\t\t// .then(function(doc){\n\t\t// \treturn this.hooks.content.trigger(view, this);\n\t\t// }.bind(this))\n\t\t.then(function(){\n\t\t\t// this.settings.layout.format(view.contents);\n\t\t\t// return this.hooks.layout.trigger(view, this);\n\t\t}.bind(this))\n\t\t// .then(function(){\n\t\t// \treturn this.display();\n\t\t// }.bind(this))\n\t\t// .then(function(){\n\t\t// \treturn this.hooks.render.trigger(view, this);\n\t\t// }.bind(this))\n\t\t.then(function(){\n\n\t\t\t// apply the layout function to the contents\n\t\t\tthis.settings.layout.format(this.contents);\n\n\t\t\t// Expand the iframe to the full size of the content\n\t\t\tthis.expand();\n\n\t\t\t// Listen for events that require an expansion of the iframe\n\t\t\tthis.addListeners();\n\n\t\t\tif(show !== false) {\n\t\t\t\t//this.q.enqueue(function(view){\n\t\t\t\t\t// this.show();\n\t\t\t\t//}, view);\n\t\t\t}\n\t\t\t// this.map = new Map(view, this.layout);\n\t\t\t//this.hooks.show.trigger(view, this);\n\t\t\tthis.emit(\"rendered\", this.section);\n\n\t\t}.bind(this))\n\t\t.catch(function(e){\n\t\t\tconsole.error(e);\n\t\t\tthis.emit(\"loaderror\", e);\n\t\t}.bind(this));\n\n};\n\n// Determine locks base on settings\nIframeView.prototype.size = function(_width, _height) {\n\tvar width = _width || this.settings.width;\n\tvar height = _height || this.settings.height;\n\n\tif(this.layout.name === \"pre-paginated\") {\n\t\tthis.lock(\"both\", width, height);\n\t} else if(this.settings.axis === \"horizontal\") {\n\t\tthis.lock(\"height\", width, height);\n\t} else {\n\t\tthis.lock(\"width\", width, height);\n\t}\n\n};\n\n// Lock an axis to element dimensions, taking borders into account\nIframeView.prototype.lock = function(what, width, height) {\n\tvar elBorders = core.borders(this.element);\n\tvar iframeBorders;\n\n\tif(this.iframe) {\n\t\tiframeBorders = core.borders(this.iframe);\n\t} else {\n\t\tiframeBorders = {width: 0, height: 0};\n\t}\n\n\tif(what == \"width\" && core.isNumber(width)){\n\t\tthis.lockedWidth = width - elBorders.width - iframeBorders.width;\n\t\tthis.resize(this.lockedWidth, width); // width keeps ratio correct\n\t}\n\n\tif(what == \"height\" && core.isNumber(height)){\n\t\tthis.lockedHeight = height - elBorders.height - iframeBorders.height;\n\t\tthis.resize(width, this.lockedHeight);\n\t}\n\n\tif(what === \"both\" &&\n\t\t core.isNumber(width) &&\n\t\t core.isNumber(height)){\n\n\t\tthis.lockedWidth = width - elBorders.width - iframeBorders.width;\n\t\tthis.lockedHeight = height - elBorders.height - iframeBorders.height;\n\n\t\tthis.resize(this.lockedWidth, this.lockedHeight);\n\t}\n\n\tif(this.displayed && this.iframe) {\n\n\t\t\t// this.contents.layout();\n\t\t\tthis.expand();\n\n\t}\n\n\n\n};\n\n// Resize a single axis based on content dimensions\nIframeView.prototype.expand = function(force) {\n\tvar width = this.lockedWidth;\n\tvar height = this.lockedHeight;\n\tvar columns;\n\n\tvar textWidth, textHeight;\n\n\tif(!this.iframe || this._expanding) return;\n\n\tthis._expanding = true;\n\n\t// Expand Horizontally\n\t// if(height && !width) {\n\tif(this.settings.axis === \"horizontal\") {\n\t\t// Get the width of the text\n\t\ttextWidth = this.contents.textWidth();\n\t\t// Check if the textWidth has changed\n\t\tif(textWidth != this._textWidth){\n\t\t\t// Get the contentWidth by resizing the iframe\n\t\t\t// Check with a min reset of the textWidth\n\t\t\twidth = this.contentWidth(textWidth);\n\n\t\t\tcolumns = Math.ceil(width / (this.settings.layout.columnWidth + this.settings.layout.gap));\n\n\t\t\tif ( this.settings.layout.divisor > 1 &&\n\t\t\t\t\t this.settings.layout.name === \"reflowable\" &&\n\t\t\t\t\t(columns % 2 > 0)) {\n\t\t\t\t\t// add a blank page\n\t\t\t\t\twidth += this.settings.layout.gap + this.settings.layout.columnWidth;\n\t\t\t}\n\n\t\t\t// Save the textWdith\n\t\t\tthis._textWidth = textWidth;\n\t\t\t// Save the contentWidth\n\t\t\tthis._contentWidth = width;\n\t\t} else {\n\t\t\t// Otherwise assume content height hasn't changed\n\t\t\twidth = this._contentWidth;\n\t\t}\n\t} // Expand Vertically\n\telse if(this.settings.axis === \"vertical\") {\n\t\ttextHeight = this.contents.textHeight();\n\t\tif(textHeight != this._textHeight){\n\t\t\theight = this.contentHeight(textHeight);\n\t\t\tthis._textHeight = textHeight;\n\t\t\tthis._contentHeight = height;\n\t\t} else {\n\t\t\theight = this._contentHeight;\n\t\t}\n\n\t}\n\n\t// Only Resize if dimensions have changed or\n\t// if Frame is still hidden, so needs reframing\n\tif(this._needsReframe || width != this._width || height != this._height){\n\t\tthis.resize(width, height);\n\t}\n\n\tthis._expanding = false;\n};\n\nIframeView.prototype.contentWidth = function(min) {\n\tvar prev;\n\tvar width;\n\n\t// Save previous width\n\tprev = this.iframe.style.width;\n\t// Set the iframe size to min, width will only ever be greater\n\t// Will preserve the aspect ratio\n\tthis.iframe.style.width = (min || 0) + \"px\";\n\t// Get the scroll overflow width\n\twidth = this.contents.scrollWidth();\n\t// Reset iframe size back\n\tthis.iframe.style.width = prev;\n\treturn width;\n};\n\nIframeView.prototype.contentHeight = function(min) {\n\tvar prev;\n\tvar height;\n\n\tprev = this.iframe.style.height;\n\tthis.iframe.style.height = (min || 0) + \"px\";\n\theight = this.contents.scrollHeight();\n\n\tthis.iframe.style.height = prev;\n\treturn height;\n};\n\n\nIframeView.prototype.resize = function(width, height) {\n\n\tif(!this.iframe) return;\n\n\tif(core.isNumber(width)){\n\t\tthis.iframe.style.width = width + \"px\";\n\t\tthis._width = width;\n\t}\n\n\tif(core.isNumber(height)){\n\t\tthis.iframe.style.height = height + \"px\";\n\t\tthis._height = height;\n\t}\n\n\tthis.iframeBounds = core.bounds(this.iframe);\n\n\tthis.reframe(this.iframeBounds.width, this.iframeBounds.height);\n\n};\n\nIframeView.prototype.reframe = function(width, height) {\n\tvar size;\n\n\t// if(!this.displayed) {\n\t// this._needsReframe = true;\n\t// return;\n\t// }\n\tif(core.isNumber(width)){\n\t\tthis.element.style.width = width + \"px\";\n\t}\n\n\tif(core.isNumber(height)){\n\t\tthis.element.style.height = height + \"px\";\n\t}\n\n\tthis.prevBounds = this.elementBounds;\n\n\tthis.elementBounds = core.bounds(this.element);\n\n\tsize = {\n\t\twidth: this.elementBounds.width,\n\t\theight: this.elementBounds.height,\n\t\twidthDelta: this.elementBounds.width - this.prevBounds.width,\n\t\theightDelta: this.elementBounds.height - this.prevBounds.height,\n\t};\n\n\tthis.onResize(this, size);\n\n\tthis.emit(\"resized\", size);\n\n};\n\n\nIframeView.prototype.load = function(contents) {\n\tvar loading = new core.defer();\n\tvar loaded = loading.promise;\n\n\tif(!this.iframe) {\n\t\tloading.reject(new Error(\"No Iframe Available\"));\n\t\treturn loaded;\n\t}\n\n\tthis.iframe.onload = function(event) {\n\n\t\tthis.onLoad(event, loading);\n\n\t}.bind(this);\n\n\tif(this.supportsSrcdoc){\n\t\tthis.iframe.srcdoc = contents;\n\t} else {\n\n\t\tthis.document = this.iframe.contentDocument;\n\n\t\tif(!this.document) {\n\t\t\tloading.reject(new Error(\"No Document Available\"));\n\t\t\treturn loaded;\n\t\t}\n\n\t\tthis.iframe.contentDocument.open();\n\t\tthis.iframe.contentDocument.write(contents);\n\t\tthis.iframe.contentDocument.close();\n\n\t}\n\n\treturn loaded;\n};\n\nIframeView.prototype.onLoad = function(event, promise) {\n\n\t\tthis.window = this.iframe.contentWindow;\n\t\tthis.document = this.iframe.contentDocument;\n\n\t\tthis.contents = new Contents(this.document, this.document.body, this.section.cfiBase);\n\n\t\tthis.rendering = false;\n\n\t\tvar link = this.document.querySelector(\"link[rel='canonical']\");\n\t\tif (link) {\n\t\t\tlink.setAttribute(\"href\", this.section.url);\n\t\t} else {\n\t\t\tlink = this.document.createElement(\"link\");\n\t\t\tlink.setAttribute(\"rel\", \"canonical\");\n\t\t\tlink.setAttribute(\"href\", this.section.url);\n\t\t\tthis.document.querySelector(\"head\").appendChild(link);\n\t\t}\n\n\t\tthis.contents.on(\"expand\", function () {\n\t\t\tif(this.displayed && this.iframe) {\n\t\t\t\t\tthis.expand();\n\t\t\t}\n\t\t});\n\n\t\tpromise.resolve(this.contents);\n};\n\n\n\n// IframeView.prototype.layout = function(layoutFunc) {\n//\n// this.iframe.style.display = \"inline-block\";\n//\n// // Reset Body Styles\n// // this.document.body.style.margin = \"0\";\n// //this.document.body.style.display = \"inline-block\";\n// //this.document.documentElement.style.width = \"auto\";\n//\n// if(layoutFunc){\n// this.layoutFunc = layoutFunc;\n// }\n//\n// this.contents.layout(this.layoutFunc);\n//\n// };\n//\n// IframeView.prototype.onLayout = function(view) {\n// // stub\n// };\n\nIframeView.prototype.setLayout = function(layout) {\n\tthis.layout = layout;\n};\n\nIframeView.prototype.setAxis = function(axis) {\n\tthis.settings.axis = axis;\n};\n\nIframeView.prototype.resizeListenters = function() {\n\t// Test size again\n\tclearTimeout(this.expanding);\n\tthis.expanding = setTimeout(this.expand.bind(this), 350);\n};\n\nIframeView.prototype.addListeners = function() {\n\t//TODO: Add content listeners for expanding\n};\n\nIframeView.prototype.removeListeners = function(layoutFunc) {\n\t//TODO: remove content listeners for expanding\n};\n\nIframeView.prototype.display = function(request) {\n\tvar displayed = new core.defer();\n\n\tif (!this.displayed) {\n\n\t\tthis.render(request).then(function () {\n\n\t\t\tthis.emit(\"displayed\", this);\n\t\t\tthis.onDisplayed(this);\n\n\t\t\tthis.displayed = true;\n\t\t\tdisplayed.resolve(this);\n\n\t\t}.bind(this));\n\n\t} else {\n\t\tdisplayed.resolve(this);\n\t}\n\n\n\treturn displayed.promise;\n};\n\nIframeView.prototype.show = function() {\n\n\tthis.element.style.visibility = \"visible\";\n\n\tif(this.iframe){\n\t\tthis.iframe.style.visibility = \"visible\";\n\t}\n\n\tthis.emit(\"shown\", this);\n};\n\nIframeView.prototype.hide = function() {\n\t// this.iframe.style.display = \"none\";\n\tthis.element.style.visibility = \"hidden\";\n\tthis.iframe.style.visibility = \"hidden\";\n\n\tthis.stopExpanding = true;\n\tthis.emit(\"hidden\", this);\n};\n\nIframeView.prototype.position = function() {\n\treturn this.element.getBoundingClientRect();\n};\n\nIframeView.prototype.locationOf = function(target) {\n\tvar parentPos = this.iframe.getBoundingClientRect();\n\tvar targetPos = this.contents.locationOf(target, this.settings.ignoreClass);\n\n\treturn {\n\t\t\"left\": window.scrollX + parentPos.left + targetPos.left,\n\t\t\"top\": window.scrollY + parentPos.top + targetPos.top\n\t};\n};\n\nIframeView.prototype.onDisplayed = function(view) {\n\t// Stub, override with a custom functions\n};\n\nIframeView.prototype.onResize = function(view, e) {\n\t// Stub, override with a custom functions\n};\n\nIframeView.prototype.bounds = function() {\n\tif(!this.elementBounds) {\n\t\tthis.elementBounds = core.bounds(this.element);\n\t}\n\treturn this.elementBounds;\n};\n\nIframeView.prototype.destroy = function() {\n\n\tif(this.displayed){\n\t\tthis.displayed = false;\n\n\t\tthis.removeListeners();\n\n\t\tthis.stopExpanding = true;\n\t\tthis.element.removeChild(this.iframe);\n\t\tthis.displayed = false;\n\t\tthis.iframe = null;\n\n\t\tthis._textWidth = null;\n\t\tthis._textHeight = null;\n\t\tthis._width = null;\n\t\tthis._height = null;\n\t}\n\t// this.element.style.height = \"0px\";\n\t// this.element.style.width = \"0px\";\n};\n\nEventEmitter(IframeView.prototype);\n\nmodule.exports = IframeView;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/managers/views/iframe.js\n// module id = 18\n// module chunks = 0","/*\n From Zip.js, by Gildas Lormeau\nedited down\n */\n\nvar table = {\n\t\"application\" : {\n\t\t\"ecmascript\" : [ \"es\", \"ecma\" ],\n\t\t\"javascript\" : \"js\",\n\t\t\"ogg\" : \"ogx\",\n\t\t\"pdf\" : \"pdf\",\n\t\t\"postscript\" : [ \"ps\", \"ai\", \"eps\", \"epsi\", \"epsf\", \"eps2\", \"eps3\" ],\n\t\t\"rdf+xml\" : \"rdf\",\n\t\t\"smil\" : [ \"smi\", \"smil\" ],\n\t\t\"xhtml+xml\" : [ \"xhtml\", \"xht\" ],\n\t\t\"xml\" : [ \"xml\", \"xsl\", \"xsd\", \"opf\", \"ncx\" ],\n\t\t\"zip\" : \"zip\",\n\t\t\"x-httpd-eruby\" : \"rhtml\",\n\t\t\"x-latex\" : \"latex\",\n\t\t\"x-maker\" : [ \"frm\", \"maker\", \"frame\", \"fm\", \"fb\", \"book\", \"fbdoc\" ],\n\t\t\"x-object\" : \"o\",\n\t\t\"x-shockwave-flash\" : [ \"swf\", \"swfl\" ],\n\t\t\"x-silverlight\" : \"scr\",\n\t\t\"epub+zip\" : \"epub\",\n\t\t\"font-tdpfr\" : \"pfr\",\n\t\t\"inkml+xml\" : [ \"ink\", \"inkml\" ],\n\t\t\"json\" : \"json\",\n\t\t\"jsonml+json\" : \"jsonml\",\n\t\t\"mathml+xml\" : \"mathml\",\n\t\t\"metalink+xml\" : \"metalink\",\n\t\t\"mp4\" : \"mp4s\",\n\t\t// \"oebps-package+xml\" : \"opf\",\n\t\t\"omdoc+xml\" : \"omdoc\",\n\t\t\"oxps\" : \"oxps\",\n\t\t\"vnd.amazon.ebook\" : \"azw\",\n\t\t\"widget\" : \"wgt\",\n\t\t// \"x-dtbncx+xml\" : \"ncx\",\n\t\t\"x-dtbook+xml\" : \"dtb\",\n\t\t\"x-dtbresource+xml\" : \"res\",\n\t\t\"x-font-bdf\" : \"bdf\",\n\t\t\"x-font-ghostscript\" : \"gsf\",\n\t\t\"x-font-linux-psf\" : \"psf\",\n\t\t\"x-font-otf\" : \"otf\",\n\t\t\"x-font-pcf\" : \"pcf\",\n\t\t\"x-font-snf\" : \"snf\",\n\t\t\"x-font-ttf\" : [ \"ttf\", \"ttc\" ],\n\t\t\"x-font-type1\" : [ \"pfa\", \"pfb\", \"pfm\", \"afm\" ],\n\t\t\"x-font-woff\" : \"woff\",\n\t\t\"x-mobipocket-ebook\" : [ \"prc\", \"mobi\" ],\n\t\t\"x-mspublisher\" : \"pub\",\n\t\t\"x-nzb\" : \"nzb\",\n\t\t\"x-tgif\" : \"obj\",\n\t\t\"xaml+xml\" : \"xaml\",\n\t\t\"xml-dtd\" : \"dtd\",\n\t\t\"xproc+xml\" : \"xpl\",\n\t\t\"xslt+xml\" : \"xslt\",\n\t\t\"internet-property-stream\" : \"acx\",\n\t\t\"x-compress\" : \"z\",\n\t\t\"x-compressed\" : \"tgz\",\n\t\t\"x-gzip\" : \"gz\",\n\t},\n\t\"audio\" : {\n\t\t\"flac\" : \"flac\",\n\t\t\"midi\" : [ \"mid\", \"midi\", \"kar\", \"rmi\" ],\n\t\t\"mpeg\" : [ \"mpga\", \"mpega\", \"mp2\", \"mp3\", \"m4a\", \"mp2a\", \"m2a\", \"m3a\" ],\n\t\t\"mpegurl\" : \"m3u\",\n\t\t\"ogg\" : [ \"oga\", \"ogg\", \"spx\" ],\n\t\t\"x-aiff\" : [ \"aif\", \"aiff\", \"aifc\" ],\n\t\t\"x-ms-wma\" : \"wma\",\n\t\t\"x-wav\" : \"wav\",\n\t\t\"adpcm\" : \"adp\",\n\t\t\"mp4\" : \"mp4a\",\n\t\t\"webm\" : \"weba\",\n\t\t\"x-aac\" : \"aac\",\n\t\t\"x-caf\" : \"caf\",\n\t\t\"x-matroska\" : \"mka\",\n\t\t\"x-pn-realaudio-plugin\" : \"rmp\",\n\t\t\"xm\" : \"xm\",\n\t\t\"mid\" : [ \"mid\", \"rmi\" ]\n\t},\n\t\"image\" : {\n\t\t\"gif\" : \"gif\",\n\t\t\"ief\" : \"ief\",\n\t\t\"jpeg\" : [ \"jpeg\", \"jpg\", \"jpe\" ],\n\t\t\"pcx\" : \"pcx\",\n\t\t\"png\" : \"png\",\n\t\t\"svg+xml\" : [ \"svg\", \"svgz\" ],\n\t\t\"tiff\" : [ \"tiff\", \"tif\" ],\n\t\t\"x-icon\" : \"ico\",\n\t\t\"bmp\" : \"bmp\",\n\t\t\"webp\" : \"webp\",\n\t\t\"x-pict\" : [ \"pic\", \"pct\" ],\n\t\t\"x-tga\" : \"tga\",\n\t\t\"cis-cod\" : \"cod\"\n\t},\n\t\"text\" : {\n\t\t\"cache-manifest\" : [ \"manifest\", \"appcache\" ],\n\t\t\"css\" : \"css\",\n\t\t\"csv\" : \"csv\",\n\t\t\"html\" : [ \"html\", \"htm\", \"shtml\", \"stm\" ],\n\t\t\"mathml\" : \"mml\",\n\t\t\"plain\" : [ \"txt\", \"text\", \"brf\", \"conf\", \"def\", \"list\", \"log\", \"in\", \"bas\" ],\n\t\t\"richtext\" : \"rtx\",\n\t\t\"tab-separated-values\" : \"tsv\",\n\t\t\"x-bibtex\" : \"bib\"\n\t},\n\t\"video\" : {\n\t\t\"mpeg\" : [ \"mpeg\", \"mpg\", \"mpe\", \"m1v\", \"m2v\", \"mp2\", \"mpa\", \"mpv2\" ],\n\t\t\"mp4\" : [ \"mp4\", \"mp4v\", \"mpg4\" ],\n\t\t\"quicktime\" : [ \"qt\", \"mov\" ],\n\t\t\"ogg\" : \"ogv\",\n\t\t\"vnd.mpegurl\" : [ \"mxu\", \"m4u\" ],\n\t\t\"x-flv\" : \"flv\",\n\t\t\"x-la-asf\" : [ \"lsf\", \"lsx\" ],\n\t\t\"x-mng\" : \"mng\",\n\t\t\"x-ms-asf\" : [ \"asf\", \"asx\", \"asr\" ],\n\t\t\"x-ms-wm\" : \"wm\",\n\t\t\"x-ms-wmv\" : \"wmv\",\n\t\t\"x-ms-wmx\" : \"wmx\",\n\t\t\"x-ms-wvx\" : \"wvx\",\n\t\t\"x-msvideo\" : \"avi\",\n\t\t\"x-sgi-movie\" : \"movie\",\n\t\t\"x-matroska\" : [ \"mpv\", \"mkv\", \"mk3d\", \"mks\" ],\n\t\t\"3gpp2\" : \"3g2\",\n\t\t\"h261\" : \"h261\",\n\t\t\"h263\" : \"h263\",\n\t\t\"h264\" : \"h264\",\n\t\t\"jpeg\" : \"jpgv\",\n\t\t\"jpm\" : [ \"jpm\", \"jpgm\" ],\n\t\t\"mj2\" : [ \"mj2\", \"mjp2\" ],\n\t\t\"vnd.ms-playready.media.pyv\" : \"pyv\",\n\t\t\"vnd.uvvu.mp4\" : [ \"uvu\", \"uvvu\" ],\n\t\t\"vnd.vivo\" : \"viv\",\n\t\t\"webm\" : \"webm\",\n\t\t\"x-f4v\" : \"f4v\",\n\t\t\"x-m4v\" : \"m4v\",\n\t\t\"x-ms-vob\" : \"vob\",\n\t\t\"x-smv\" : \"smv\"\n\t}\n};\n\nvar mimeTypes = (function() {\n\tvar type, subtype, val, index, mimeTypes = {};\n\tfor (type in table) {\n\t\tif (table.hasOwnProperty(type)) {\n\t\t\tfor (subtype in table[type]) {\n\t\t\t\tif (table[type].hasOwnProperty(subtype)) {\n\t\t\t\t\tval = table[type][subtype];\n\t\t\t\t\tif (typeof val == \"string\") {\n\t\t\t\t\t\tmimeTypes[val] = type + \"/\" + subtype;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfor (index = 0; index < val.length; index++) {\n\t\t\t\t\t\t\tmimeTypes[val[index]] = type + \"/\" + subtype;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn mimeTypes;\n})();\n\nvar defaultValue = \"text/plain\";//\"application/octet-stream\";\n\nfunction lookup(filename) {\n\treturn filename && mimeTypes[filename.split(\".\").pop().toLowerCase()] || defaultValue;\n};\n\nmodule.exports = {\n\t'lookup': lookup\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./libs/mime/mime.js\n// module id = 19\n// module chunks = 0","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction placeHoldersCount (b64) {\n var len = b64.length\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // the number of equal signs (place holders)\n // if there are two placeholders, than the two characters before it\n // represent one byte\n // if there is only one, then the three characters before it represent 2 bytes\n // this is just a cheap hack to not do indexOf twice\n return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0\n}\n\nfunction byteLength (b64) {\n // base64 is 4/3 + up to two characters of the original data\n return b64.length * 3 / 4 - placeHoldersCount(b64)\n}\n\nfunction toByteArray (b64) {\n var i, j, l, tmp, placeHolders, arr\n var len = b64.length\n placeHolders = placeHoldersCount(b64)\n\n arr = new Arr(len * 3 / 4 - placeHolders)\n\n // if there are placeholders, only get up to the last complete 4 chars\n l = placeHolders > 0 ? len - 4 : len\n\n var L = 0\n\n for (i = 0, j = 0; i < l; i += 4, j += 3) {\n tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]\n arr[L++] = (tmp >> 16) & 0xFF\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n if (placeHolders === 2) {\n tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[L++] = tmp & 0xFF\n } else if (placeHolders === 1) {\n tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var output = ''\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n output += lookup[tmp >> 2]\n output += lookup[(tmp << 4) & 0x3F]\n output += '=='\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + (uint8[len - 1])\n output += lookup[tmp >> 10]\n output += lookup[(tmp >> 4) & 0x3F]\n output += lookup[(tmp << 2) & 0x3F]\n output += '='\n }\n\n parts.push(output)\n\n return parts.join('')\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/base64-js/index.js\n// module id = 20\n// module chunks = 0","'use strict';\n\nvar assign = require('es5-ext/object/assign')\n , normalizeOpts = require('es5-ext/object/normalize-options')\n , isCallable = require('es5-ext/object/is-callable')\n , contains = require('es5-ext/string/#/contains')\n\n , d;\n\nd = module.exports = function (dscr, value/*, options*/) {\n\tvar c, e, w, options, desc;\n\tif ((arguments.length < 2) || (typeof dscr !== 'string')) {\n\t\toptions = value;\n\t\tvalue = dscr;\n\t\tdscr = null;\n\t} else {\n\t\toptions = arguments[2];\n\t}\n\tif (dscr == null) {\n\t\tc = w = true;\n\t\te = false;\n\t} else {\n\t\tc = contains.call(dscr, 'c');\n\t\te = contains.call(dscr, 'e');\n\t\tw = contains.call(dscr, 'w');\n\t}\n\n\tdesc = { value: value, configurable: c, enumerable: e, writable: w };\n\treturn !options ? desc : assign(normalizeOpts(options), desc);\n};\n\nd.gs = function (dscr, get, set/*, options*/) {\n\tvar c, e, options, desc;\n\tif (typeof dscr !== 'string') {\n\t\toptions = set;\n\t\tset = get;\n\t\tget = dscr;\n\t\tdscr = null;\n\t} else {\n\t\toptions = arguments[3];\n\t}\n\tif (get == null) {\n\t\tget = undefined;\n\t} else if (!isCallable(get)) {\n\t\toptions = get;\n\t\tget = set = undefined;\n\t} else if (set == null) {\n\t\tset = undefined;\n\t} else if (!isCallable(set)) {\n\t\toptions = set;\n\t\tset = undefined;\n\t}\n\tif (dscr == null) {\n\t\tc = true;\n\t\te = false;\n\t} else {\n\t\tc = contains.call(dscr, 'c');\n\t\te = contains.call(dscr, 'e');\n\t}\n\n\tdesc = { get: get, set: set, configurable: c, enumerable: e };\n\treturn !options ? desc : assign(normalizeOpts(options), desc);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/d/index.js\n// module id = 21\n// module chunks = 0","'use strict';\n\nmodule.exports = require('./is-implemented')()\n\t? Object.assign\n\t: require('./shim');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/assign/index.js\n// module id = 22\n// module chunks = 0","'use strict';\n\nmodule.exports = function () {\n\tvar assign = Object.assign, obj;\n\tif (typeof assign !== 'function') return false;\n\tobj = { foo: 'raz' };\n\tassign(obj, { bar: 'dwa' }, { trzy: 'trzy' });\n\treturn (obj.foo + obj.bar + obj.trzy) === 'razdwatrzy';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/assign/is-implemented.js\n// module id = 23\n// module chunks = 0","'use strict';\n\nvar keys = require('../keys')\n , value = require('../valid-value')\n\n , max = Math.max;\n\nmodule.exports = function (dest, src/*, …srcn*/) {\n\tvar error, i, l = max(arguments.length, 2), assign;\n\tdest = Object(value(dest));\n\tassign = function (key) {\n\t\ttry { dest[key] = src[key]; } catch (e) {\n\t\t\tif (!error) error = e;\n\t\t}\n\t};\n\tfor (i = 1; i < l; ++i) {\n\t\tsrc = arguments[i];\n\t\tkeys(src).forEach(assign);\n\t}\n\tif (error !== undefined) throw error;\n\treturn dest;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/assign/shim.js\n// module id = 24\n// module chunks = 0","// Deprecated\n\n'use strict';\n\nmodule.exports = function (obj) { return typeof obj === 'function'; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/is-callable.js\n// module id = 25\n// module chunks = 0","'use strict';\n\nmodule.exports = require('./is-implemented')()\n\t? Object.keys\n\t: require('./shim');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/keys/index.js\n// module id = 26\n// module chunks = 0","'use strict';\n\nmodule.exports = function () {\n\ttry {\n\t\tObject.keys('primitive');\n\t\treturn true;\n\t} catch (e) { return false; }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/keys/is-implemented.js\n// module id = 27\n// module chunks = 0","'use strict';\n\nvar keys = Object.keys;\n\nmodule.exports = function (object) {\n\treturn keys(object == null ? object : Object(object));\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/keys/shim.js\n// module id = 28\n// module chunks = 0","'use strict';\n\nvar forEach = Array.prototype.forEach, create = Object.create;\n\nvar process = function (src, obj) {\n\tvar key;\n\tfor (key in src) obj[key] = src[key];\n};\n\nmodule.exports = function (options/*, …options*/) {\n\tvar result = create(null);\n\tforEach.call(arguments, function (options) {\n\t\tif (options == null) return;\n\t\tprocess(Object(options), result);\n\t});\n\treturn result;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/normalize-options.js\n// module id = 29\n// module chunks = 0","'use strict';\n\nmodule.exports = function (fn) {\n\tif (typeof fn !== 'function') throw new TypeError(fn + \" is not a function\");\n\treturn fn;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/valid-callable.js\n// module id = 30\n// module chunks = 0","'use strict';\n\nmodule.exports = function (value) {\n\tif (value == null) throw new TypeError(\"Cannot use null or undefined\");\n\treturn value;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/valid-value.js\n// module id = 31\n// module chunks = 0","'use strict';\n\nmodule.exports = require('./is-implemented')()\n\t? String.prototype.contains\n\t: require('./shim');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/string/#/contains/index.js\n// module id = 32\n// module chunks = 0","'use strict';\n\nvar str = 'razdwatrzy';\n\nmodule.exports = function () {\n\tif (typeof str.contains !== 'function') return false;\n\treturn ((str.contains('dwa') === true) && (str.contains('foo') === false));\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/string/#/contains/is-implemented.js\n// module id = 33\n// module chunks = 0","'use strict';\n\nvar indexOf = String.prototype.indexOf;\n\nmodule.exports = function (searchString/*, position*/) {\n\treturn indexOf.call(this, searchString, arguments[1]) > -1;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/string/#/contains/shim.js\n// module id = 34\n// module chunks = 0","var core = require('./core');\nvar request = require('./request');\nvar mime = require('../libs/mime/mime');\nvar Path = require('./core').Path;\n\n/**\n * Handles Unzipping a requesting files from an Epub Archive\n * @class\n */\nfunction Archive() {\n\tthis.zip = undefined;\n\tthis.checkRequirements();\n\tthis.urlCache = {};\n}\n\n/**\n * Checks to see if JSZip exists in global namspace,\n * Requires JSZip if it isn't there\n * @private\n */\nArchive.prototype.checkRequirements = function(){\n\ttry {\n\t\tif (typeof JSZip === 'undefined') {\n\t\t\tJSZip = require('jszip');\n\t\t}\n\t\tthis.zip = new JSZip();\n\t} catch (e) {\n\t\tconsole.error(\"JSZip lib not loaded\");\n\t}\n};\n\n/**\n * Open an archive\n * @param {binary} input\n * @param {boolean} isBase64 tells JSZip if the input data is base64 encoded\n * @return {Promise} zipfile\n */\nArchive.prototype.open = function(input, isBase64){\n\treturn this.zip.loadAsync(input, {\"base64\": isBase64});\n};\n\n/**\n * Load and Open an archive\n * @param {string} zipUrl\n * @param {boolean} isBase64 tells JSZip if the input data is base64 encoded\n * @return {Promise} zipfile\n */\nArchive.prototype.openUrl = function(zipUrl, isBase64){\n\treturn request(zipUrl, \"binary\")\n\t\t.then(function(data){\n\t\t\treturn this.zip.loadAsync(data, {\"base64\": isBase64});\n\t\t}.bind(this));\n};\n\n/**\n * Request\n * @param {string} url a url to request from the archive\n * @param {[string]} type specify the type of the returned result\n * @return {Promise}\n */\nArchive.prototype.request = function(url, type){\n\tvar deferred = new core.defer();\n\tvar response;\n\tvar r;\n\tvar path = new Path(url);\n\n\t// If type isn't set, determine it from the file extension\n\tif(!type) {\n\t\ttype = path.extension;\n\t}\n\n\tif(type == 'blob'){\n\t\tresponse = this.getBlob(url);\n\t} else {\n\t\tresponse = this.getText(url);\n\t}\n\n\tif (response) {\n\t\tresponse.then(function (r) {\n\t\t\tresult = this.handleResponse(r, type);\n\t\t\tdeferred.resolve(result);\n\t\t}.bind(this));\n\t} else {\n\t\tdeferred.reject({\n\t\t\tmessage : \"File not found in the epub: \" + url,\n\t\t\tstack : new Error().stack\n\t\t});\n\t}\n\treturn deferred.promise;\n};\n\n/**\n * Handle the response from request\n * @private\n * @param {any} response\n * @param {[string]} type\n * @return {any} the parsed result\n */\nArchive.prototype.handleResponse = function(response, type){\n\tvar r;\n\n\tif(type == \"json\") {\n\t\tr = JSON.parse(response);\n\t}\n\telse\n\tif(core.isXml(type)) {\n\t\tr = core.parse(response, \"text/xml\");\n\t}\n\telse\n\tif(type == 'xhtml') {\n\t\tr = core.parse(response, \"application/xhtml+xml\");\n\t}\n\telse\n\tif(type == 'html' || type == 'htm') {\n\t\tr = core.parse(response, \"text/html\");\n\t } else {\n\t\t r = response;\n\t }\n\n\treturn r;\n};\n\n/**\n * Get a Blob from Archive by Url\n * @param {string} url\n * @param {[string]} mimeType\n * @return {Blob}\n */\nArchive.prototype.getBlob = function(url, mimeType){\n\tvar decodededUrl = window.decodeURIComponent(url.substr(1)); // Remove first slash\n\tvar entry = this.zip.file(decodededUrl);\n\n\tif(entry) {\n\t\tmimeType = mimeType || mime.lookup(entry.name);\n\t\treturn entry.async(\"uint8array\").then(function(uint8array) {\n\t\t\treturn new Blob([uint8array], {type : mimeType});\n\t\t});\n\t}\n};\n\n/**\n * Get Text from Archive by Url\n * @param {string} url\n * @param {[string]} encoding\n * @return {string}\n */\nArchive.prototype.getText = function(url, encoding){\n\tvar decodededUrl = window.decodeURIComponent(url.substr(1)); // Remove first slash\n\tvar entry = this.zip.file(decodededUrl);\n\n\tif(entry) {\n\t\treturn entry.async(\"string\").then(function(text) {\n\t\t\treturn text;\n\t\t});\n\t}\n};\n\n/**\n * Get a base64 encoded result from Archive by Url\n * @param {string} url\n * @param {[string]} mimeType\n * @return {string} base64 encoded\n */\nArchive.prototype.getBase64 = function(url, mimeType){\n\tvar decodededUrl = window.decodeURIComponent(url.substr(1)); // Remove first slash\n\tvar entry = this.zip.file(decodededUrl);\n\n\tif(entry) {\n\t\tmimeType = mimeType || mime.lookup(entry.name);\n\t\treturn entry.async(\"base64\").then(function(data) {\n\t\t\treturn \"data:\" + mimeType + \";base64,\" + data;\n\t\t});\n\t}\n};\n\n/**\n * Create a Url from an unarchived item\n * @param {string} url\n * @param {[object]} options.base64 use base64 encoding or blob url\n * @return {Promise} url promise with Url string\n */\nArchive.prototype.createUrl = function(url, options){\n\tvar deferred = new core.defer();\n\tvar _URL = window.URL || window.webkitURL || window.mozURL;\n\tvar tempUrl;\n\tvar blob;\n\tvar response;\n\tvar useBase64 = options && options.base64;\n\n\tif(url in this.urlCache) {\n\t\tdeferred.resolve(this.urlCache[url]);\n\t\treturn deferred.promise;\n\t}\n\n\tif (useBase64) {\n\t\tresponse = this.getBase64(url);\n\n\t\tif (response) {\n\t\t\tresponse.then(function(tempUrl) {\n\n\t\t\t\tthis.urlCache[url] = tempUrl;\n\t\t\t\tdeferred.resolve(tempUrl);\n\n\t\t\t}.bind(this));\n\n\t\t}\n\n\t} else {\n\n\t\tresponse = this.getBlob(url);\n\n\t\tif (response) {\n\t\t\tresponse.then(function(blob) {\n\n\t\t\t\ttempUrl = _URL.createObjectURL(blob);\n\t\t\t\tthis.urlCache[url] = tempUrl;\n\t\t\t\tdeferred.resolve(tempUrl);\n\n\t\t\t}.bind(this));\n\n\t\t}\n\t}\n\n\n\tif (!response) {\n\t\tdeferred.reject({\n\t\t\tmessage : \"File not found in the epub: \" + url,\n\t\t\tstack : new Error().stack\n\t\t});\n\t}\n\n\treturn deferred.promise;\n};\n\n/**\n * Revoke Temp Url for a achive item\n * @param {string} url url of the item in the archive\n */\nArchive.prototype.revokeUrl = function(url){\n\tvar _URL = window.URL || window.webkitURL || window.mozURL;\n\tvar fromCache = this.urlCache[url];\n\tif(fromCache) _URL.revokeObjectURL(fromCache);\n};\n\nmodule.exports = Archive;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/archive.js\n// module id = 36\n// module chunks = 0","var path = require('path');\nvar core = require('./core');\nvar EpubCFI = require('./epubcfi');\n\n/**\n * Handles Parsing and Accessing an Epub Container\n * @class\n * @param {[document]} containerDocument xml document\n */\nfunction Container(containerDocument) {\n\tif (containerDocument) {\n\t\tthis.parse(containerDocument);\n\t}\n};\n\n/**\n * Parse the Container XML\n * @param {document} containerDocument\n */\nContainer.prototype.parse = function(containerDocument){\n\t\t//-- \n\t\tvar rootfile, fullpath, folder, encoding;\n\n\t\tif(!containerDocument) {\n\t\t\tconsole.error(\"Container File Not Found\");\n\t\t\treturn;\n\t\t}\n\n\t\trootfile = core.qs(containerDocument, \"rootfile\");\n\n\t\tif(!rootfile) {\n\t\t\tconsole.error(\"No RootFile Found\");\n\t\t\treturn;\n\t\t}\n\n\t\tthis.packagePath = rootfile.getAttribute('full-path');\n\t\tthis.directory = path.dirname(this.packagePath);\n\t\tthis.encoding = containerDocument.xmlEncoding;\n};\n\nmodule.exports = Container;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/container.js\n// module id = 37\n// module chunks = 0","var core = require('./core');\n\n/**\n * Figures out the CSS to apply for a layout\n * @class\n * @param {object} settings\n * @param {[string=reflowable]} settings.layout\n * @param {[string]} settings.spread\n * @param {[int=800]} settings.minSpreadWidth\n * @param {[boolean=false]} settings.evenSpreads\n */\nfunction Layout(settings){\n\tthis.name = settings.layout || \"reflowable\";\n\tthis._spread = (settings.spread === \"none\") ? false : true;\n\tthis._minSpreadWidth = settings.minSpreadWidth || 800;\n\tthis._evenSpreads = settings.evenSpreads || false;\n\n\tif (settings.flow === \"scrolled-continuous\" ||\n\t\t\tsettings.flow === \"scrolled-doc\") {\n\t\tthis._flow = \"scrolled\";\n\t} else {\n\t\tthis._flow = \"paginated\";\n\t}\n\n\n\tthis.width = 0;\n\tthis.height = 0;\n\tthis.spreadWidth = 0;\n\tthis.delta = 0;\n\n\tthis.columnWidth = 0;\n\tthis.gap = 0;\n\tthis.divisor = 1;\n};\n\n/**\n * Switch the flow between paginated and scrolled\n * @param {string} flow paginated | scrolled\n */\nLayout.prototype.flow = function(flow) {\n\tthis._flow = (flow === \"paginated\") ? \"paginated\" : \"scrolled\";\n}\n\n/**\n * Switch between using spreads or not, and set the\n * width at which they switch to single.\n * @param {string} spread true | false\n * @param {boolean} min integer in pixels\n */\nLayout.prototype.spread = function(spread, min) {\n\n\tthis._spread = (spread === \"none\") ? false : true;\n\n\tif (min >= 0) {\n\t\tthis._minSpreadWidth = min;\n\t}\n}\n\n/**\n * Calculate the dimensions of the pagination\n * @param {number} _width [description]\n * @param {number} _height [description]\n * @param {number} _gap [description]\n */\nLayout.prototype.calculate = function(_width, _height, _gap){\n\n\tvar divisor = 1;\n\tvar gap = _gap || 0;\n\n\t//-- Check the width and create even width columns\n\tvar fullWidth = Math.floor(_width);\n\tvar width = _width;\n\n\tvar section = Math.floor(width / 8);\n\n\tvar colWidth;\n\tvar spreadWidth;\n\tvar delta;\n\n\tif (this._spread && width >= this._minSpreadWidth) {\n\t\tdivisor = 2;\n\t} else {\n\t\tdivisor = 1;\n\t}\n\n\tif (this.name === \"reflowable\" && this._flow === \"paginated\" && !(_gap >= 0)) {\n\t\tgap = ((section % 2 === 0) ? section : section - 1);\n\t}\n\n\tif (this.name === \"pre-paginated\" ) {\n\t\tgap = 0;\n\t}\n\n\t//-- Double Page\n\tif(divisor > 1) {\n\t\tcolWidth = Math.floor((width - gap) / divisor);\n\t} else {\n\t\tcolWidth = width;\n\t}\n\n\tif (this.name === \"pre-paginated\" && divisor > 1) {\n\t\twidth = colWidth;\n\t}\n\n\tspreadWidth = colWidth * divisor;\n\n\tdelta = (colWidth + gap) * divisor;\n\n\tthis.width = width;\n\tthis.height = _height;\n\tthis.spreadWidth = spreadWidth;\n\tthis.delta = delta;\n\n\tthis.columnWidth = colWidth;\n\tthis.gap = gap;\n\tthis.divisor = divisor;\n};\n\n/**\n * Apply Css to a Document\n * @param {Contents} contents\n * @return {[Promise]}\n */\nLayout.prototype.format = function(contents){\n\tvar formating;\n\n\tif (this.name === \"pre-paginated\") {\n\t\tformating = contents.fit(this.columnWidth, this.height);\n\t} else if (this._flow === \"paginated\") {\n\t\tformating = contents.columns(this.width, this.height, this.columnWidth, this.gap);\n\t} else { // scrolled\n\t\tformating = contents.size(this.width, null);\n\t}\n\n\treturn formating; // might be a promise in some View Managers\n};\n\n/**\n * Count number of pages\n * @param {number} totalWidth\n * @return {number} spreads\n * @return {number} pages\n */\nLayout.prototype.count = function(totalWidth) {\n\t// var totalWidth = contents.scrollWidth();\n\tvar spreads = Math.ceil( totalWidth / this.spreadWidth);\n\n\treturn {\n\t\tspreads : spreads,\n\t\tpages : spreads * this.divisor\n\t};\n};\n\nmodule.exports = Layout;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/layout.js\n// module id = 38\n// module chunks = 0","var core = require('./core');\nvar Queue = require('./queue');\nvar EpubCFI = require('./epubcfi');\nvar EventEmitter = require('event-emitter');\n\n/**\n * Find Locations for a Book\n * @param {Spine} spine\n * @param {request} request\n */\nfunction Locations(spine, request) {\n\tthis.spine = spine;\n\tthis.request = request;\n\n\tthis.q = new Queue(this);\n\tthis.epubcfi = new EpubCFI();\n\n\tthis._locations = [];\n\tthis.total = 0;\n\n\tthis.break = 150;\n\n\tthis._current = 0;\n\n};\n\n/**\n * Load all of sections in the book to generate locations\n * @param {int} chars how many chars to split on\n * @return {object} locations\n */\nLocations.prototype.generate = function(chars) {\n\n\tif (chars) {\n\t\tthis.break = chars;\n\t}\n\n\tthis.q.pause();\n\n\tthis.spine.each(function(section) {\n\n\t\tthis.q.enqueue(this.process, section);\n\n\t}.bind(this));\n\n\treturn this.q.run().then(function() {\n\t\tthis.total = this._locations.length-1;\n\n\t\tif (this._currentCfi) {\n\t\t\tthis.currentLocation = this._currentCfi;\n\t\t}\n\n\t\treturn this._locations;\n\t\t// console.log(this.precentage(this.book.rendition.location.start), this.precentage(this.book.rendition.location.end));\n\t}.bind(this));\n\n};\n\nLocations.prototype.process = function(section) {\n\n\treturn section.load(this.request)\n\t\t.then(function(contents) {\n\n\t\t\tvar range;\n\t\t\tvar doc = contents.ownerDocument;\n\t\t\tvar counter = 0;\n\n\t\t\tthis.sprint(contents, function(node) {\n\t\t\t\tvar len = node.length;\n\t\t\t\tvar dist;\n\t\t\t\tvar pos = 0;\n\n\t\t\t\t// Start range\n\t\t\t\tif (counter == 0) {\n\t\t\t\t\trange = doc.createRange();\n\t\t\t\t\trange.setStart(node, 0);\n\t\t\t\t}\n\n\t\t\t\tdist = this.break - counter;\n\n\t\t\t\t// Node is smaller than a break\n\t\t\t\tif(dist > len){\n\t\t\t\t\tcounter += len;\n\t\t\t\t\tpos = len;\n\t\t\t\t}\n\n\t\t\t\twhile (pos < len) {\n\t\t\t\t\tcounter = this.break;\n\t\t\t\t\tpos += this.break;\n\n\t\t\t\t\t// Gone over\n\t\t\t\t\tif(pos >= len){\n\t\t\t\t\t\t// Continue counter for next node\n\t\t\t\t\t\tcounter = len - (pos - this.break);\n\n\t\t\t\t\t// At End\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// End the previous range\n\t\t\t\t\t\trange.setEnd(node, pos);\n\t\t\t\t\t\tcfi = section.cfiFromRange(range);\n\t\t\t\t\t\tthis._locations.push(cfi);\n\t\t\t\t\t\tcounter = 0;\n\n\t\t\t\t\t\t// Start new range\n\t\t\t\t\t\tpos += 1;\n\t\t\t\t\t\trange = doc.createRange();\n\t\t\t\t\t\trange.setStart(node, pos);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\n\t\t\t}.bind(this));\n\n\t\t\t// Close remaining\n\t\t\tif (range) {\n\t\t\t\trange.setEnd(prev, prev.length);\n\t\t\t\tcfi = section.cfiFromRange(range);\n\t\t\t\tthis._locations.push(cfi)\n\t\t\t\tcounter = 0;\n\t\t\t}\n\n\t\t}.bind(this));\n\n};\n\nLocations.prototype.sprint = function(root, func) {\n\tvar treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, null, false);\n\n\twhile ((node = treeWalker.nextNode())) {\n\t\tfunc(node);\n\t}\n\n};\n\nLocations.prototype.locationFromCfi = function(cfi){\n\t// Check if the location has not been set yet\n\tif(this._locations.length === 0) {\n\t\treturn -1;\n\t}\n\n\treturn core.locationOf(cfi, this._locations, this.epubcfi.compare);\n};\n\nLocations.prototype.precentageFromCfi = function(cfi) {\n\t// Find closest cfi\n\tvar loc = this.locationFromCfi(cfi);\n\t// Get percentage in total\n\treturn this.precentageFromLocation(loc);\n};\n\nLocations.prototype.percentageFromLocation = function(loc) {\n\tif (!loc || !this.total) {\n\t\treturn 0;\n\t}\n\treturn (loc / this.total);\n};\n\nLocations.prototype.cfiFromLocation = function(loc){\n\tvar cfi = -1;\n\t// check that pg is an int\n\tif(typeof loc != \"number\"){\n\t\tloc = parseInt(pg);\n\t}\n\n\tif(loc >= 0 && loc < this._locations.length) {\n\t\tcfi = this._locations[loc];\n\t}\n\n\treturn cfi;\n};\n\nLocations.prototype.cfiFromPercentage = function(value){\n\tvar percentage = (value > 1) ? value / 100 : value; // Normalize value to 0-1\n\tvar loc = Math.ceil(this.total * percentage);\n\n\treturn this.cfiFromLocation(loc);\n};\n\nLocations.prototype.load = function(locations){\n\tthis._locations = JSON.parse(locations);\n\tthis.total = this._locations.length-1;\n\treturn this._locations;\n};\n\nLocations.prototype.save = function(json){\n\treturn JSON.stringify(this._locations);\n};\n\nLocations.prototype.getCurrent = function(json){\n\treturn this._current;\n};\n\nLocations.prototype.setCurrent = function(curr){\n\tvar loc;\n\n\tif(typeof curr == \"string\"){\n\t\tthis._currentCfi = curr;\n\t} else if (typeof curr == \"number\") {\n\t\tthis._current = curr;\n\t} else {\n\t\treturn;\n\t}\n\n\tif(this._locations.length === 0) {\n\t\treturn;\n\t}\n\n\tif(typeof curr == \"string\"){\n\t\tloc = this.locationFromCfi(curr);\n\t\tthis._current = loc;\n\t} else {\n\t\tloc = curr;\n\t}\n\n\tthis.emit(\"changed\", {\n\t\tpercentage: this.precentageFromLocation(loc)\n\t});\n};\n\nObject.defineProperty(Locations.prototype, 'currentLocation', {\n\tget: function () {\n\t\treturn this._current;\n\t},\n\tset: function (curr) {\n\t\tthis.setCurrent(curr);\n\t}\n});\n\nEventEmitter(Locations.prototype);\n\nmodule.exports = Locations;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/locations.js\n// module id = 39\n// module chunks = 0","var core = require('../../core');\n\nfunction Stage(_options) {\n\tthis.settings = _options || {};\n\tthis.id = \"epubjs-container-\" + core.uuid();\n\n\tthis.container = this.create(this.settings);\n\n\tif(this.settings.hidden) {\n\t\tthis.wrapper = this.wrap(this.container);\n\t}\n\n}\n\n/*\n* Creates an element to render to.\n* Resizes to passed width and height or to the elements size\n*/\nStage.prototype.create = function(options){\n\tvar height = options.height;// !== false ? options.height : \"100%\";\n\tvar width = options.width;// !== false ? options.width : \"100%\";\n\tvar overflow = options.overflow || false;\n\tvar axis = options.axis || \"vertical\";\n\n\tif(options.height && core.isNumber(options.height)) {\n\t\theight = options.height + \"px\";\n\t}\n\n\tif(options.width && core.isNumber(options.width)) {\n\t\twidth = options.width + \"px\";\n\t}\n\n\t// Create new container element\n\tcontainer = document.createElement(\"div\");\n\n\tcontainer.id = this.id;\n\tcontainer.classList.add(\"epub-container\");\n\n\t// Style Element\n\t// container.style.fontSize = \"0\";\n\tcontainer.style.wordSpacing = \"0\";\n\tcontainer.style.lineHeight = \"0\";\n\tcontainer.style.verticalAlign = \"top\";\n\n\tif(axis === \"horizontal\") {\n\t\tcontainer.style.whiteSpace = \"nowrap\";\n\t}\n\n\tif(width){\n\t\tcontainer.style.width = width;\n\t}\n\n\tif(height){\n\t\tcontainer.style.height = height;\n\t}\n\n\tif (overflow) {\n\t\tcontainer.style.overflow = overflow;\n\t}\n\n\treturn container;\n};\n\nStage.wrap = function(container) {\n\tvar wrapper = document.createElement(\"div\");\n\n\twrapper.style.visibility = \"hidden\";\n\twrapper.style.overflow = \"hidden\";\n\twrapper.style.width = \"0\";\n\twrapper.style.height = \"0\";\n\n\twrapper.appendChild(container);\n\treturn wrapper;\n};\n\n\nStage.prototype.getElement = function(_element){\n\tvar element;\n\n\tif(core.isElement(_element)) {\n\t\telement = _element;\n\t} else if (typeof _element === \"string\") {\n\t\telement = document.getElementById(_element);\n\t}\n\n\tif(!element){\n\t\tconsole.error(\"Not an Element\");\n\t\treturn;\n\t}\n\n\treturn element;\n};\n\nStage.prototype.attachTo = function(what){\n\n\tvar element = this.getElement(what);\n\tvar base;\n\n\tif(!element){\n\t\treturn;\n\t}\n\n\tif(this.settings.hidden) {\n\t\tbase = this.wrapper;\n\t} else {\n\t\tbase = this.container;\n\t}\n\n\telement.appendChild(base);\n\n\tthis.element = element;\n\n\treturn element;\n\n};\n\nStage.prototype.getContainer = function() {\n\treturn this.container;\n};\n\nStage.prototype.onResize = function(func){\n\t// Only listen to window for resize event if width and height are not fixed.\n\t// This applies if it is set to a percent or auto.\n\tif(!core.isNumber(this.settings.width) ||\n\t\t !core.isNumber(this.settings.height) ) {\n\t\twindow.addEventListener(\"resize\", func, false);\n\t}\n\n};\n\nStage.prototype.size = function(width, height){\n\tvar bounds;\n\t// var width = _width || this.settings.width;\n\t// var height = _height || this.settings.height;\n\n\t// If width or height are set to false, inherit them from containing element\n\tif(width === null) {\n\t\tbounds = this.element.getBoundingClientRect();\n\n\t\tif(bounds.width) {\n\t\t\twidth = bounds.width;\n\t\t\tthis.container.style.width = bounds.width + \"px\";\n\t\t}\n\t}\n\n\tif(height === null) {\n\t\tbounds = bounds || this.element.getBoundingClientRect();\n\n\t\tif(bounds.height) {\n\t\t\theight = bounds.height;\n\t\t\tthis.container.style.height = bounds.height + \"px\";\n\t\t}\n\n\t}\n\n\tif(!core.isNumber(width)) {\n\t\tbounds = this.container.getBoundingClientRect();\n\t\twidth = bounds.width;\n\t\t//height = bounds.height;\n\t}\n\n\tif(!core.isNumber(height)) {\n\t\tbounds = bounds || this.container.getBoundingClientRect();\n\t\t//width = bounds.width;\n\t\theight = bounds.height;\n\t}\n\n\n\tthis.containerStyles = window.getComputedStyle(this.container);\n\n\tthis.containerPadding = {\n\t\tleft: parseFloat(this.containerStyles[\"padding-left\"]) || 0,\n\t\tright: parseFloat(this.containerStyles[\"padding-right\"]) || 0,\n\t\ttop: parseFloat(this.containerStyles[\"padding-top\"]) || 0,\n\t\tbottom: parseFloat(this.containerStyles[\"padding-bottom\"]) || 0\n\t};\n\n\treturn {\n\t\twidth: width -\n\t\t\t\t\t\tthis.containerPadding.left -\n\t\t\t\t\t\tthis.containerPadding.right,\n\t\theight: height -\n\t\t\t\t\t\tthis.containerPadding.top -\n\t\t\t\t\t\tthis.containerPadding.bottom\n\t};\n\n};\n\nStage.prototype.bounds = function(){\n\n\tif(!this.container) {\n\t\treturn core.windowBounds();\n\t} else {\n\t\treturn this.container.getBoundingClientRect();\n\t}\n\n}\n\nStage.prototype.getSheet = function(){\n\tvar style = document.createElement(\"style\");\n\n\t// WebKit hack --> https://davidwalsh.name/add-rules-stylesheets\n\tstyle.appendChild(document.createTextNode(\"\"));\n\n\tdocument.head.appendChild(style);\n\n\treturn style.sheet;\n}\n\nStage.prototype.addStyleRules = function(selector, rulesArray){\n\tvar scope = \"#\" + this.id + \" \";\n\tvar rules = \"\";\n\n\tif(!this.sheet){\n\t\tthis.sheet = this.getSheet();\n\t}\n\n\trulesArray.forEach(function(set) {\n\t\tfor (var prop in set) {\n\t\t\tif(set.hasOwnProperty(prop)) {\n\t\t\t\trules += prop + \":\" + set[prop] + \";\";\n\t\t\t}\n\t\t}\n\t})\n\n\tthis.sheet.insertRule(scope + selector + \" {\" + rules + \"}\", 0);\n}\n\n\n\nmodule.exports = Stage;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/managers/helpers/stage.js\n// module id = 40\n// module chunks = 0","function Views(container) {\n\tthis.container = container;\n\tthis._views = [];\n\tthis.length = 0;\n\tthis.hidden = false;\n};\n\nViews.prototype.all = function() {\n\treturn this._views;\n};\n\nViews.prototype.first = function() {\n\treturn this._views[0];\n};\n\nViews.prototype.last = function() {\n\treturn this._views[this._views.length-1];\n};\n\nViews.prototype.indexOf = function(view) {\n\treturn this._views.indexOf(view);\n};\n\nViews.prototype.slice = function() {\n\treturn this._views.slice.apply(this._views, arguments);\n};\n\nViews.prototype.get = function(i) {\n\treturn this._views[i];\n};\n\nViews.prototype.append = function(view){\n\tthis._views.push(view);\n\tif(this.container){\n\t\tthis.container.appendChild(view.element);\n\t}\n\tthis.length++;\n\treturn view;\n};\n\nViews.prototype.prepend = function(view){\n\tthis._views.unshift(view);\n\tif(this.container){\n\t\tthis.container.insertBefore(view.element, this.container.firstChild);\n\t}\n\tthis.length++;\n\treturn view;\n};\n\nViews.prototype.insert = function(view, index) {\n\tthis._views.splice(index, 0, view);\n\n\tif(this.container){\n\t\tif(index < this.container.children.length){\n\t\t\tthis.container.insertBefore(view.element, this.container.children[index]);\n\t\t} else {\n\t\t\tthis.container.appendChild(view.element);\n\t\t}\n\t}\n\n\tthis.length++;\n\treturn view;\n};\n\nViews.prototype.remove = function(view) {\n\tvar index = this._views.indexOf(view);\n\n\tif(index > -1) {\n\t\tthis._views.splice(index, 1);\n\t}\n\n\n\tthis.destroy(view);\n\n\tthis.length--;\n};\n\nViews.prototype.destroy = function(view) {\n\tif(view.displayed){\n\t\tview.destroy();\n\t}\n\n\tif(this.container){\n\t\t this.container.removeChild(view.element);\n\t}\n\tview = null;\n};\n\n// Iterators\n\nViews.prototype.each = function() {\n\treturn this._views.forEach.apply(this._views, arguments);\n};\n\nViews.prototype.clear = function(){\n\t// Remove all views\n\tvar view;\n\tvar len = this.length;\n\n\tif(!this.length) return;\n\n\tfor (var i = 0; i < len; i++) {\n\t\tview = this._views[i];\n\t\tthis.destroy(view);\n\t}\n\n\tthis._views = [];\n\tthis.length = 0;\n};\n\nViews.prototype.find = function(section){\n\n\tvar view;\n\tvar len = this.length;\n\n\tfor (var i = 0; i < len; i++) {\n\t\tview = this._views[i];\n\t\tif(view.displayed && view.section.index == section.index) {\n\t\t\treturn view;\n\t\t}\n\t}\n\n};\n\nViews.prototype.displayed = function(){\n\tvar displayed = [];\n\tvar view;\n\tvar len = this.length;\n\n\tfor (var i = 0; i < len; i++) {\n\t\tview = this._views[i];\n\t\tif(view.displayed){\n\t\t\tdisplayed.push(view);\n\t\t}\n\t}\n\treturn displayed;\n};\n\nViews.prototype.show = function(){\n\tvar view;\n\tvar len = this.length;\n\n\tfor (var i = 0; i < len; i++) {\n\t\tview = this._views[i];\n\t\tif(view.displayed){\n\t\t\tview.show();\n\t\t}\n\t}\n\tthis.hidden = false;\n};\n\nViews.prototype.hide = function(){\n\tvar view;\n\tvar len = this.length;\n\n\tfor (var i = 0; i < len; i++) {\n\t\tview = this._views[i];\n\t\tif(view.displayed){\n\t\t\tview.hide();\n\t\t}\n\t}\n\tthis.hidden = true;\n};\n\nmodule.exports = Views;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/managers/helpers/views.js\n// module id = 41\n// module chunks = 0","var core = require('./core');\nvar path = require('path');\n\n/**\n * Navigation Parser\n * @param {document} xml navigation html / xhtml / ncx\n */\nfunction Navigation(xml){\n\tthis.toc = [];\n\tthis.tocByHref = {};\n\tthis.tocById = {};\n\n\tif (xml) {\n\t\tthis.parse(xml);\n\t}\n};\n\n/**\n * Parse out the navigation items\n * @param {document} xml navigation html / xhtml / ncx\n */\nNavigation.prototype.parse = function(xml) {\n\tvar html = core.qs(xml, \"html\");\n\tvar ncx = core.qs(xml, \"ncx\");\n\n\tif(html) {\n\t\tthis.toc = this.parseNav(xml);\n\t} else if(ncx){\n\t\tthis.toc = this.parseNcx(xml);\n\t}\n\n\tthis.unpack(this.toc);\n};\n\n/**\n * Unpack navigation items\n * @private\n * @param {array} toc\n */\nNavigation.prototype.unpack = function(toc) {\n\tvar item;\n\n\tfor (var i = 0; i < toc.length; i++) {\n\t\titem = toc[i];\n\t\tthis.tocByHref[item.href] = i;\n\t\tthis.tocById[item.id] = i;\n\t}\n\n};\n\n/**\n * Get an item from the navigation\n * @param {string} target\n * @return {object} navItems\n */\nNavigation.prototype.get = function(target) {\n\tvar index;\n\n\tif(!target) {\n\t\treturn this.toc;\n\t}\n\n\tif(target.indexOf(\"#\") === 0) {\n\t\tindex = this.tocById[target.substring(1)];\n\t} else if(target in this.tocByHref){\n\t\tindex = this.tocByHref[target];\n\t}\n\n\treturn this.toc[index];\n};\n\n/**\n * Parse from a Epub > 3.0 Nav\n * @private\n * @param {document} navHtml\n * @return {array} navigation list\n */\nNavigation.prototype.parseNav = function(navHtml){\n\tvar navElement = core.querySelectorByType(navHtml, \"nav\", \"toc\");\n\tvar navItems = navElement ? core.qsa(navElement, \"li\") : [];\n\tvar length = navItems.length;\n\tvar i;\n\tvar toc = {};\n\tvar list = [];\n\tvar item, parent;\n\n\tif(!navItems || length === 0) return list;\n\n\tfor (i = 0; i < length; ++i) {\n\t\titem = this.navItem(navItems[i]);\n\t\ttoc[item.id] = item;\n\t\tif(!item.parent) {\n\t\t\tlist.push(item);\n\t\t} else {\n\t\t\tparent = toc[item.parent];\n\t\t\tparent.subitems.push(item);\n\t\t}\n\t}\n\n\treturn list;\n};\n\n/**\n * Create a navItem\n * @private\n * @param {element} item\n * @return {object} navItem\n */\nNavigation.prototype.navItem = function(item){\n\tvar id = item.getAttribute('id') || false,\n\t\t\tcontent = core.qs(item, \"a\"),\n\t\t\tsrc = content.getAttribute('href') || '',\n\t\t\ttext = content.textContent || \"\",\n\t\t\tsubitems = [],\n\t\t\tparentNode = item.parentNode,\n\t\t\tparent;\n\n\tif(parentNode && parentNode.nodeName === \"navPoint\") {\n\t\tparent = parentNode.getAttribute('id');\n\t}\n\n\treturn {\n\t\t\"id\": id,\n\t\t\"href\": src,\n\t\t\"label\": text,\n\t\t\"subitems\" : subitems,\n\t\t\"parent\" : parent\n\t};\n};\n\n/**\n * Parse from a Epub > 3.0 NC\n * @private\n * @param {document} navHtml\n * @return {array} navigation list\n */\nNavigation.prototype.parseNcx = function(tocXml){\n\tvar navPoints = core.qsa(tocXml, \"navPoint\");\n\tvar length = navPoints.length;\n\tvar i;\n\tvar toc = {};\n\tvar list = [];\n\tvar item, parent;\n\n\tif(!navPoints || length === 0) return list;\n\n\tfor (i = 0; i < length; ++i) {\n\t\titem = this.ncxItem(navPoints[i]);\n\t\ttoc[item.id] = item;\n\t\tif(!item.parent) {\n\t\t\tlist.push(item);\n\t\t} else {\n\t\t\tparent = toc[item.parent];\n\t\t\tparent.subitems.push(item);\n\t\t}\n\t}\n\n\treturn list;\n};\n\n/**\n * Create a ncxItem\n * @private\n * @param {element} item\n * @return {object} ncxItem\n */\nNavigation.prototype.ncxItem = function(item){\n\tvar id = item.getAttribute('id') || false,\n\t\t\tcontent = core.qs(item, \"content\"),\n\t\t\tsrc = content.getAttribute('src'),\n\t\t\tnavLabel = core.qs(item, \"navLabel\"),\n\t\t\ttext = navLabel.textContent ? navLabel.textContent : \"\",\n\t\t\tsubitems = [],\n\t\t\tparentNode = item.parentNode,\n\t\t\tparent;\n\n\tif(parentNode && parentNode.nodeName === \"navPoint\") {\n\t\tparent = parentNode.getAttribute('id');\n\t}\n\n\n\treturn {\n\t\t\"id\": id,\n\t\t\"href\": src,\n\t\t\"label\": text,\n\t\t\"subitems\" : subitems,\n\t\t\"parent\" : parent\n\t};\n};\n\nmodule.exports = Navigation;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/navigation.js\n// module id = 42\n// module chunks = 0","var path = require('path');\nvar core = require('./core');\nvar EpubCFI = require('./epubcfi');\n\n/**\n * Open Packaging Format Parser\n * @class\n * @param {document} packageDocument OPF XML\n */\nfunction Packaging(packageDocument) {\n\tif (packageDocument) {\n\t\tthis.parse(packageDocument);\n\t}\n};\n\n/**\n * Parse OPF XML\n * @param {document} packageDocument OPF XML\n * @return {object} parsed package parts\n */\nPackaging.prototype.parse = function(packageDocument){\n\tvar metadataNode, manifestNode, spineNode;\n\n\tif(!packageDocument) {\n\t\tconsole.error(\"Package File Not Found\");\n\t\treturn;\n\t}\n\n\tmetadataNode = core.qs(packageDocument, \"metadata\");\n\tif(!metadataNode) {\n\t\tconsole.error(\"No Metadata Found\");\n\t\treturn;\n\t}\n\n\tmanifestNode = core.qs(packageDocument, \"manifest\");\n\tif(!manifestNode) {\n\t\tconsole.error(\"No Manifest Found\");\n\t\treturn;\n\t}\n\n\tspineNode = core.qs(packageDocument, \"spine\");\n\tif(!spineNode) {\n\t\tconsole.error(\"No Spine Found\");\n\t\treturn;\n\t}\n\n\tthis.manifest = this.parseManifest(manifestNode);\n\tthis.navPath = this.findNavPath(manifestNode);\n\tthis.ncxPath = this.findNcxPath(manifestNode, spineNode);\n\tthis.coverPath = this.findCoverPath(packageDocument);\n\n\tthis.spineNodeIndex = Array.prototype.indexOf.call(spineNode.parentNode.childNodes, spineNode);\n\n\tthis.spine = this.parseSpine(spineNode, this.manifest);\n\n\tthis.metadata = this.parseMetadata(metadataNode);\n\n\tthis.metadata.direction = spineNode.getAttribute(\"page-progression-direction\");\n\n\n\treturn {\n\t\t'metadata' : this.metadata,\n\t\t'spine' : this.spine,\n\t\t'manifest' : this.manifest,\n\t\t'navPath' : this.navPath,\n\t\t'ncxPath' : this.ncxPath,\n\t\t'coverPath': this.coverPath,\n\t\t'spineNodeIndex' : this.spineNodeIndex\n\t};\n};\n\n/**\n * Parse Metadata\n * @private\n * @param {document} xml\n * @return {object} metadata\n */\nPackaging.prototype.parseMetadata = function(xml){\n\tvar metadata = {};\n\n\tmetadata.title = this.getElementText(xml, 'title');\n\tmetadata.creator = this.getElementText(xml, 'creator');\n\tmetadata.description = this.getElementText(xml, 'description');\n\n\tmetadata.pubdate = this.getElementText(xml, 'date');\n\n\tmetadata.publisher = this.getElementText(xml, 'publisher');\n\n\tmetadata.identifier = this.getElementText(xml, \"identifier\");\n\tmetadata.language = this.getElementText(xml, \"language\");\n\tmetadata.rights = this.getElementText(xml, \"rights\");\n\n\tmetadata.modified_date = this.getPropertyText(xml, 'dcterms:modified');\n\n\tmetadata.layout = this.getPropertyText(xml, \"rendition:layout\");\n\tmetadata.orientation = this.getPropertyText(xml, 'rendition:orientation');\n\tmetadata.flow = this.getPropertyText(xml, 'rendition:flow');\n\tmetadata.viewport = this.getPropertyText(xml, 'rendition:viewport');\n\t// metadata.page_prog_dir = packageXml.querySelector(\"spine\").getAttribute(\"page-progression-direction\");\n\n\treturn metadata;\n};\n\n/**\n * Parse Manifest\n * @private\n * @param {document} manifestXml\n * @return {object} manifest\n */\nPackaging.prototype.parseManifest = function(manifestXml){\n\tvar manifest = {};\n\n\t//-- Turn items into an array\n\t// var selected = manifestXml.querySelectorAll(\"item\");\n\tvar selected = core.qsa(manifestXml, \"item\");\n\tvar items = Array.prototype.slice.call(selected);\n\n\t//-- Create an object with the id as key\n\titems.forEach(function(item){\n\t\tvar id = item.getAttribute('id'),\n\t\t\t\thref = item.getAttribute('href') || '',\n\t\t\t\ttype = item.getAttribute('media-type') || '',\n\t\t\t\tproperties = item.getAttribute('properties') || '';\n\n\t\tmanifest[id] = {\n\t\t\t'href' : href,\n\t\t\t// 'url' : href,\n\t\t\t'type' : type,\n\t\t\t'properties' : properties.length ? properties.split(' ') : []\n\t\t};\n\n\t});\n\n\treturn manifest;\n\n};\n\n/**\n * Parse Spine\n * @param {document} spineXml\n * @param {Packaging.manifest} manifest\n * @return {object} spine\n */\nPackaging.prototype.parseSpine = function(spineXml, manifest){\n\tvar spine = [];\n\n\tvar selected = spineXml.getElementsByTagName(\"itemref\"),\n\t\t\titems = Array.prototype.slice.call(selected);\n\n\tvar epubcfi = new EpubCFI();\n\n\t//-- Add to array to mantain ordering and cross reference with manifest\n\titems.forEach(function(item, index){\n\t\tvar idref = item.getAttribute('idref');\n\t\t// var cfiBase = epubcfi.generateChapterComponent(spineNodeIndex, index, Id);\n\t\tvar props = item.getAttribute('properties') || '';\n\t\tvar propArray = props.length ? props.split(' ') : [];\n\t\t// var manifestProps = manifest[Id].properties;\n\t\t// var manifestPropArray = manifestProps.length ? manifestProps.split(' ') : [];\n\n\t\tvar itemref = {\n\t\t\t'idref' : idref,\n\t\t\t'linear' : item.getAttribute('linear') || '',\n\t\t\t'properties' : propArray,\n\t\t\t// 'href' : manifest[Id].href,\n\t\t\t// 'url' : manifest[Id].url,\n\t\t\t'index' : index\n\t\t\t// 'cfiBase' : cfiBase\n\t\t};\n\t\tspine.push(itemref);\n\t});\n\n\treturn spine;\n};\n\n/**\n * Find TOC NAV\n * @private\n */\nPackaging.prototype.findNavPath = function(manifestNode){\n\t// Find item with property 'nav'\n\t// Should catch nav irregardless of order\n\t// var node = manifestNode.querySelector(\"item[properties$='nav'], item[properties^='nav '], item[properties*=' nav ']\");\n\tvar node = core.qsp(manifestNode, \"item\", {\"properties\":\"nav\"});\n\treturn node ? node.getAttribute('href') : false;\n};\n\n/**\n * Find TOC NCX\n * media-type=\"application/x-dtbncx+xml\" href=\"toc.ncx\"\n * @private\n */\nPackaging.prototype.findNcxPath = function(manifestNode, spineNode){\n\t// var node = manifestNode.querySelector(\"item[media-type='application/x-dtbncx+xml']\");\n\tvar node = core.qsp(manifestNode, \"item\", {\"media-type\":\"application/x-dtbncx+xml\"});\n\tvar tocId;\n\n\t// If we can't find the toc by media-type then try to look for id of the item in the spine attributes as\n\t// according to http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.4.1.2,\n\t// \"The item that describes the NCX must be referenced by the spine toc attribute.\"\n\tif (!node) {\n\t\ttocId = spineNode.getAttribute(\"toc\");\n\t\tif(tocId) {\n\t\t\t// node = manifestNode.querySelector(\"item[id='\" + tocId + \"']\");\n\t\t\tnode = manifestNode.getElementById(tocId);\n\t\t}\n\t}\n\n\treturn node ? node.getAttribute('href') : false;\n};\n\n/**\n * Find the Cover Path\n * \n * Fallback for Epub 2.0\n * @param {document} packageXml\n * @return {string} href\n */\nPackaging.prototype.findCoverPath = function(packageXml){\n\tvar pkg = core.qs(packageXml, \"package\");\n\tvar epubVersion = pkg.getAttribute('version');\n\n\tif (epubVersion === '2.0') {\n\t\tvar metaCover = core.qsp(packageXml, 'meta', {'name':'cover'});\n\t\tif (metaCover) {\n\t\t\tvar coverId = metaCover.getAttribute('content');\n\t\t\t// var cover = packageXml.querySelector(\"item[id='\" + coverId + \"']\");\n\t\t\tvar cover = packageXml.getElementById(coverId);\n\t\t\treturn cover ? cover.getAttribute('href') : false;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}\n\telse {\n\t\t// var node = packageXml.querySelector(\"item[properties='cover-image']\");\n\t\tvar node = core.qsp(packageXml, 'item', {'properties':'cover-image'});\n\t\treturn node ? node.getAttribute('href') : false;\n\t}\n};\n\n/**\n * Get text of a namespaced element\n * @private\n * @param {document} xml\n * @param {string} tag\n * @return {string} text\n */\nPackaging.prototype.getElementText = function(xml, tag){\n\tvar found = xml.getElementsByTagNameNS(\"http://purl.org/dc/elements/1.1/\", tag),\n\t\tel;\n\n\tif(!found || found.length === 0) return '';\n\n\tel = found[0];\n\n\tif(el.childNodes.length){\n\t\treturn el.childNodes[0].nodeValue;\n\t}\n\n\treturn '';\n\n};\n\n/**\n * Get text by property\n * @private\n * @param {document} xml\n * @param {string} property\n * @return {string} text\n */\nPackaging.prototype.getPropertyText = function(xml, property){\n\tvar el = core.qsp(xml, \"meta\", {\"property\":property});\n\n\tif(el && el.childNodes.length){\n\t\treturn el.childNodes[0].nodeValue;\n\t}\n\n\treturn '';\n};\n\nmodule.exports = Packaging;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/packaging.js\n// module id = 43\n// module chunks = 0","var EpubCFI = require('./epubcfi');\nvar core = require('./core');\n\n/**\n * Page List Parser\n * @param {[document]} xml\n */\nfunction PageList(xml) {\n\tthis.pages = [];\n\tthis.locations = [];\n\tthis.epubcfi = new EpubCFI();\n\n\tif (xml) {\n\t\tthis.pageList = this.parse(xml);\n\t}\n\n\tif(this.pageList && this.pageList.length) {\n\t\tthis.process(this.pageList);\n\t}\n};\n\n/**\n * Parse PageList Xml\n * @param {document} xml\n */\nPageList.prototype.parse = function(xml) {\n\tvar html = core.qs(xml, \"html\");\n\t// var ncx = core.qs(xml, \"ncx\");\n\n\tif(html) {\n\t\tthis.toc = this.parseNav(xml);\n\t} else if(ncx){ // Not supported\n\t\t// this.toc = this.parseNcx(xml);\n\t\treturn;\n\t}\n\n};\n\n/**\n * Parse a Nav PageList\n * @private\n * @param {document} navHtml\n * @return {PageList.item[]} list\n */\nPageList.prototype.parseNav = function(navHtml){\n\tvar navElement = core.querySelectorByType(navHtml, \"nav\", \"page-list\");\n\tvar navItems = navElement ? core.qsa(navElement, \"li\") : [];\n\tvar length = navItems.length;\n\tvar i;\n\tvar toc = {};\n\tvar list = [];\n\tvar item;\n\n\tif(!navItems || length === 0) return list;\n\n\tfor (i = 0; i < length; ++i) {\n\t\titem = this.item(navItems[i]);\n\t\tlist.push(item);\n\t}\n\n\treturn list;\n};\n\n/**\n * Page List Item\n * @private\n * @param {object} item\n * @return {object} pageListItem\n */\nPageList.prototype.item = function(item){\n\tvar id = item.getAttribute('id') || false,\n\t\tcontent = core.qs(item, \"a\"),\n\t\thref = content.getAttribute('href') || '',\n\t\ttext = content.textContent || \"\",\n\t\tpage = parseInt(text),\n\t\tisCfi = href.indexOf(\"epubcfi\"),\n\t\tsplit,\n\t\tpackageUrl,\n\t\tcfi;\n\n\tif(isCfi != -1) {\n\t\tsplit = href.split(\"#\");\n\t\tpackageUrl = split[0];\n\t\tcfi = split.length > 1 ? split[1] : false;\n\t\treturn {\n\t\t\t\"cfi\" : cfi,\n\t\t\t\"href\" : href,\n\t\t\t\"packageUrl\" : packageUrl,\n\t\t\t\"page\" : page\n\t\t};\n\t} else {\n\t\treturn {\n\t\t\t\"href\" : href,\n\t\t\t\"page\" : page\n\t\t};\n\t}\n};\n\n/**\n * Process pageList items\n * @private\n * @param {array} pageList\n */\nPageList.prototype.process = function(pageList){\n\tpageList.forEach(function(item){\n\t\tthis.pages.push(item.page);\n\t\tif (item.cfi) {\n\t\t\tthis.locations.push(item.cfi);\n\t\t}\n\t}, this);\n\tthis.firstPage = parseInt(this.pages[0]);\n\tthis.lastPage = parseInt(this.pages[this.pages.length-1]);\n\tthis.totalPages = this.lastPage - this.firstPage;\n};\n\n\n/**\n * Replace HREFs with CFI\n * TODO: implement getting CFI from Href\n */\nPageList.prototype.addCFIs = function() {\n\tthis.pageList.forEach(function(pg){\n\t\tif(!pg.cfi) {\n\t\t\t// epubcfi.generateCfiFromHref(pg.href, book).then(function(cfi){\n\t\t\t// \tpg.cfi = cfi;\n\t\t\t// \tpg.packageUrl = book.settings.packageUrl;\n\t\t\t// });\n\t\t}\n\t});\n}\n\n/*\nEPUBJS.EpubCFI.prototype.generateCfiFromHref = function(href, book) {\n var uri = EPUBJS.core.uri(href);\n var path = uri.path;\n var fragment = uri.fragment;\n var spinePos = book.spineIndexByURL[path];\n var loaded;\n var deferred = new RSVP.defer();\n var epubcfi = new EPUBJS.EpubCFI();\n var spineItem;\n\n if(typeof spinePos !== \"undefined\"){\n spineItem = book.spine[spinePos];\n loaded = book.loadXml(spineItem.url);\n loaded.then(function(doc){\n var element = doc.getElementById(fragment);\n var cfi;\n cfi = epubcfi.generateCfiFromElement(element, spineItem.cfiBase);\n deferred.resolve(cfi);\n });\n }\n\n return deferred.promise;\n};\n*/\n\n/**\n * Get a PageList result from a EpubCFI\n * @param {string} cfi EpubCFI String\n * @return {string} page\n */\nPageList.prototype.pageFromCfi = function(cfi){\n\tvar pg = -1;\n\n\t// Check if the pageList has not been set yet\n\tif(this.locations.length === 0) {\n\t\treturn -1;\n\t}\n\n\t// TODO: check if CFI is valid?\n\n\t// check if the cfi is in the location list\n\t// var index = this.locations.indexOf(cfi);\n\tvar index = core.indexOfSorted(cfi, this.locations, this.epubcfi.compare);\n\tif(index != -1) {\n\t\tpg = this.pages[index];\n\t} else {\n\t\t// Otherwise add it to the list of locations\n\t\t// Insert it in the correct position in the locations page\n\t\t//index = EPUBJS.core.insert(cfi, this.locations, this.epubcfi.compare);\n\t\tindex = EPUBJS.core.locationOf(cfi, this.locations, this.epubcfi.compare);\n\t\t// Get the page at the location just before the new one, or return the first\n\t\tpg = index-1 >= 0 ? this.pages[index-1] : this.pages[0];\n\t\tif(pg !== undefined) {\n\t\t\t// Add the new page in so that the locations and page array match up\n\t\t\t//this.pages.splice(index, 0, pg);\n\t\t} else {\n\t\t\tpg = -1;\n\t\t}\n\n\t}\n\treturn pg;\n};\n\n/**\n * Get an EpubCFI from a Page List Item\n * @param {string} pg\n * @return {string} cfi\n */\nPageList.prototype.cfiFromPage = function(pg){\n\tvar cfi = -1;\n\t// check that pg is an int\n\tif(typeof pg != \"number\"){\n\t\tpg = parseInt(pg);\n\t}\n\n\t// check if the cfi is in the page list\n\t// Pages could be unsorted.\n\tvar index = this.pages.indexOf(pg);\n\tif(index != -1) {\n\t\tcfi = this.locations[index];\n\t}\n\t// TODO: handle pages not in the list\n\treturn cfi;\n};\n\n/**\n * Get a Page from Book percentage\n * @param {number} percent\n * @return {string} page\n */\nPageList.prototype.pageFromPercentage = function(percent){\n\tvar pg = Math.round(this.totalPages * percent);\n\treturn pg;\n};\n\n/**\n * Returns a value between 0 - 1 corresponding to the location of a page\n * @param {int} pg the page\n * @return {number} percentage\n */\nPageList.prototype.percentageFromPage = function(pg){\n\tvar percentage = (pg - this.firstPage) / this.totalPages;\n\treturn Math.round(percentage * 1000) / 1000;\n};\n\n/**\n * Returns a value between 0 - 1 corresponding to the location of a cfi\n * @param {string} cfi EpubCFI String\n * @return {number} percentage\n */\nPageList.prototype.percentageFromCfi = function(cfi){\n\tvar pg = this.pageFromCfi(cfi);\n\tvar percentage = this.percentageFromPage(pg);\n\treturn percentage;\n};\n\nmodule.exports = PageList;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/pagelist.js\n// module id = 44\n// module chunks = 0","var replace = require('./replacements');\nvar core = require('./core');\nvar Path = require('./core').Path;\nvar path = require('path');\n\n/**\n * Handle Package Resources\n * @class\n * @param {Manifest} manifest\n * @param {[object]} options\n * @param {[string='base64']} options.replacements\n * @param {[Archive]} options.archive\n * @param {[method]} options.resolver\n */\nfunction Resources(manifest, options) {\n\tthis.settings = {\n\t\treplacements: (options && options.replacements) || 'base64',\n\t\tarchive: (options && options.archive),\n\t\tresolver: (options && options.resolver)\n\t};\n\tthis.manifest = manifest;\n\tthis.resources = Object.keys(manifest).\n\t\tmap(function (key){\n\t\t\treturn manifest[key];\n\t\t});\n\n\tthis.replacementUrls = [];\n\n\tthis.split();\n\tthis.splitUrls();\n}\n\n/**\n * Split resources by type\n * @private\n */\nResources.prototype.split = function(){\n\n\t// HTML\n\tthis.html = this.resources.\n\t\tfilter(function (item){\n\t\t\tif (item.type === \"application/xhtml+xml\" ||\n\t\t\t\t\titem.type === \"text/html\") {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n\n\t// Exclude HTML\n\tthis.assets = this.resources.\n\t\tfilter(function (item){\n\t\t\tif (item.type !== \"application/xhtml+xml\" &&\n\t\t\t\t\titem.type !== \"text/html\") {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n\n\t// Only CSS\n\tthis.css = this.resources.\n\t\tfilter(function (item){\n\t\t\tif (item.type === \"text/css\") {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n};\n\n/**\n * Convert split resources into Urls\n * @private\n */\nResources.prototype.splitUrls = function(){\n\n\t// All Assets Urls\n\tthis.urls = this.assets.\n\t\tmap(function(item) {\n\t\t\treturn item.href;\n\t\t}.bind(this));\n\n\t// Css Urls\n\tthis.cssUrls = this.css.map(function(item) {\n\t\treturn item.href;\n\t});\n\n};\n\n/**\n * Create blob urls for all the assets\n * @param {Archive} archive\n * @param {resolver} resolver Url resolver\n * @return {Promise} returns replacement urls\n */\nResources.prototype.replacements = function(archive, resolver){\n\tarchive = archive || this.settings.archive;\n\tresolver = resolver || this.settings.resolver;\n\n\tif (this.settings.replacements === \"none\") {\n\t\treturn new Promise(function(resolve, reject) {\n\t\t\tresolve(this.urls);\n\t\t}.bind(this));\n\t}\n\n\tvar replacements = this.urls.\n\t\tmap(function(url) {\n\t\t\tvar absolute = resolver(url);\n\n\t\t\treturn archive.createUrl(absolute, {\"base64\": (this.settings.replacements === \"base64\")});\n\t\t}.bind(this))\n\n\treturn Promise.all(replacements)\n\t\t.then(function(replacementUrls) {\n\t\t\tthis.replacementUrls = replacementUrls;\n\t\t\treturn replacementUrls;\n\t\t}.bind(this));\n};\n\n/**\n * Replace URLs in CSS resources\n * @private\n * @param {[Archive]} archive\n * @param {[method]} resolver\n * @return {Promise}\n */\nResources.prototype.replaceCss = function(archive, resolver){\n\tvar replaced = [];\n\tarchive = archive || this.settings.archive;\n\tresolver = resolver || this.settings.resolver;\n\tthis.cssUrls.forEach(function(href) {\n\t\tvar replacement = this.createCssFile(href, archive, resolver)\n\t\t\t.then(function (replacementUrl) {\n\t\t\t\t// switch the url in the replacementUrls\n\t\t\t\tvar indexInUrls = this.urls.indexOf(href);\n\t\t\t\tif (indexInUrls > -1) {\n\t\t\t\t\tthis.replacementUrls[indexInUrls] = replacementUrl;\n\t\t\t\t}\n\t\t\t}.bind(this));\n\n\t\treplaced.push(replacement);\n\t}.bind(this));\n\treturn Promise.all(replaced);\n};\n\n/**\n * Create a new CSS file with the replaced URLs\n * @private\n * @param {string} href the original css file\n * @param {[Archive]} archive\n * @param {[method]} resolver\n * @return {Promise} returns a BlobUrl to the new CSS file or a data url\n */\nResources.prototype.createCssFile = function(href, archive, resolver){\n\t\tvar newUrl;\n\t\tvar indexInUrls;\n\t\tarchive = archive || this.settings.archive;\n\t\tresolver = resolver || this.settings.resolver;\n\n\t\tif (path.isAbsolute(href)) {\n\t\t\treturn new Promise(function(resolve, reject){\n\t\t\t\tresolve(urls, replacementUrls);\n\t\t\t});\n\t\t}\n\n\t\tvar absolute = resolver(href);\n\n\t\t// Get the text of the css file from the archive\n\t\tvar textResponse = archive.getText(absolute);\n\t\t// Get asset links relative to css file\n\t\tvar relUrls = this.urls.map(function(assetHref) {\n\t\t\t\tvar resolved = resolver(assetHref);\n\t\t\t\tvar relative = new Path(absolute).relative(resolved);\n\n\t\t\t\treturn relative;\n\t\t\t}.bind(this));\n\n\t\treturn textResponse.then(function (text) {\n\t\t\t// Replacements in the css text\n\t\t\ttext = replace.substitute(text, relUrls, this.replacementUrls);\n\n\t\t\t// Get the new url\n\t\t\tif (this.settings.replacements === \"base64\") {\n\t\t\t\tnewUrl = core.createBase64Url(text, 'text/css');\n\t\t\t} else {\n\t\t\t\tnewUrl = core.createBlobUrl(text, 'text/css');\n\t\t\t}\n\n\t\t\treturn newUrl;\n\t\t}.bind(this));\n\n};\n\n/**\n * Resolve all resources URLs relative to an absolute URL\n * @param {string} absolute to be resolved to\n * @param {[resolver]} resolver\n * @return {string[]} array with relative Urls\n */\nResources.prototype.relativeTo = function(absolute, resolver){\n\tresolver = resolver || this.settings.resolver;\n\n\t// Get Urls relative to current sections\n\treturn this.urls.\n\t\tmap(function(href) {\n\t\t\tvar resolved = resolver(href);\n\t\t\tvar relative = new Path(absolute).relative(resolved);\n\t\t\treturn relative;\n\t\t}.bind(this));\n};\n\n/**\n * Get a URL for a resource\n * @param {string} path\n * @return {string} url\n */\nResources.prototype.get = function(path) {\n\tvar indexInUrls = this.urls.indexOf(path);\n\tif (indexInUrls === -1) {\n\t\treturn;\n\t}\n\tif (this.replacementUrls.length) {\n\t\treturn new Promise(function(resolve, reject) {\n\t\t\tresolve(this.replacementUrls[indexInUrls]);\n\t\t}.bind(this));\n\t} else {\n\t\treturn archive.createUrl(absolute,\n\t\t\t{\"base64\": (this.settings.replacements === \"base64\")})\n\t}\n}\n\nmodule.exports = Resources;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/resources.js\n// module id = 45\n// module chunks = 0","var core = require('./core');\nvar EpubCFI = require('./epubcfi');\nvar Hook = require('./hook');\nvar Url = require('./core').Url;\n\n/**\n * Represents a Section of the Book\n * In most books this is equivelent to a Chapter\n * @param {object} item The spine item representing the section\n * @param {object} hooks hooks for serialize and content\n */\nfunction Section(item, hooks){\n\t\tthis.idref = item.idref;\n\t\tthis.linear = item.linear;\n\t\tthis.properties = item.properties;\n\t\tthis.index = item.index;\n\t\tthis.href = item.href;\n\t\tthis.url = item.url;\n\t\tthis.next = item.next;\n\t\tthis.prev = item.prev;\n\n\t\tthis.cfiBase = item.cfiBase;\n\n\t\tif (hooks) {\n\t\t\tthis.hooks = hooks;\n\t\t} else {\n\t\t\tthis.hooks = {};\n\t\t\tthis.hooks.serialize = new Hook(this);\n\t\t\tthis.hooks.content = new Hook(this);\n\t\t}\n\n};\n\n/**\n * Load the section from its url\n * @param {method} _request a request method to use for loading\n * @return {document} a promise with the xml document\n */\nSection.prototype.load = function(_request){\n\tvar request = _request || this.request || require('./request');\n\tvar loading = new core.defer();\n\tvar loaded = loading.promise;\n\n\tif(this.contents) {\n\t\tloading.resolve(this.contents);\n\t} else {\n\t\trequest(this.url)\n\t\t\t.then(function(xml){\n\t\t\t\tvar base;\n\t\t\t\tvar directory = new Url(this.url).directory;\n\n\t\t\t\tthis.document = xml;\n\t\t\t\tthis.contents = xml.documentElement;\n\n\t\t\t\treturn this.hooks.content.trigger(this.document, this);\n\t\t\t}.bind(this))\n\t\t\t.then(function(){\n\t\t\t\tloading.resolve(this.contents);\n\t\t\t}.bind(this))\n\t\t\t.catch(function(error){\n\t\t\t\tloading.reject(error);\n\t\t\t});\n\t}\n\n\treturn loaded;\n};\n\n/**\n * Adds a base tag for resolving urls in the section\n * @private\n * @param {document} _document\n */\nSection.prototype.base = function(_document){\n\t\tvar task = new core.defer();\n\t\tvar base = _document.createElement(\"base\"); // TODO: check if exists\n\t\tvar head;\n\n\t\tbase.setAttribute(\"href\", window.location.origin + \"/\" +this.url);\n\n\t\tif(_document) {\n\t\t\thead = _document.querySelector(\"head\");\n\t\t}\n\t\tif(head) {\n\t\t\thead.insertBefore(base, head.firstChild);\n\t\t\ttask.resolve();\n\t\t} else {\n\t\t\ttask.reject(new Error(\"No head to insert into\"));\n\t\t}\n\n\n\t\treturn task.promise;\n};\n\n/**\n * Render the contents of a section\n * @param {method} _request a request method to use for loading\n * @return {string} output a serialized XML Document\n */\nSection.prototype.render = function(_request){\n\tvar rendering = new core.defer();\n\tvar rendered = rendering.promise;\n\tthis.output; // TODO: better way to return this from hooks?\n\n\tthis.load(_request).\n\t\tthen(function(contents){\n\t\t\tvar serializer;\n\n\t\t\tif (typeof XMLSerializer === \"undefined\") {\n\t\t\t\tXMLSerializer = require('xmldom').XMLSerializer;\n\t\t\t}\n\t\t\tserializer = new XMLSerializer();\n\t\t\tthis.output = serializer.serializeToString(contents);\n\t\t\treturn this.output;\n\t\t}.bind(this)).\n\t\tthen(function(){\n\t\t\treturn this.hooks.serialize.trigger(this.output, this);\n\t\t}.bind(this)).\n\t\tthen(function(){\n\t\t\trendering.resolve(this.output);\n\t\t}.bind(this))\n\t\t.catch(function(error){\n\t\t\trendering.reject(error);\n\t\t});\n\n\treturn rendered;\n};\n\n/**\n * Find a string in a section\n * TODO: need reimplementation from v0.2\n * @param {string} query [description]\n * @return {[type]} [description]\n */\nSection.prototype.find = function(query){\n\n};\n\n/**\n* Reconciles the current chapters layout properies with\n* the global layout properities.\n* @param {object} global The globa layout settings object, chapter properties string\n* @return {object} layoutProperties Object with layout properties\n*/\nSection.prototype.reconcileLayoutSettings = function(global){\n\t//-- Get the global defaults\n\tvar settings = {\n\t\tlayout : global.layout,\n\t\tspread : global.spread,\n\t\torientation : global.orientation\n\t};\n\n\t//-- Get the chapter's display type\n\tthis.properties.forEach(function(prop){\n\t\tvar rendition = prop.replace(\"rendition:\", '');\n\t\tvar split = rendition.indexOf(\"-\");\n\t\tvar property, value;\n\n\t\tif(split != -1){\n\t\t\tproperty = rendition.slice(0, split);\n\t\t\tvalue = rendition.slice(split+1);\n\n\t\t\tsettings[property] = value;\n\t\t}\n\t});\n return settings;\n};\n\n/**\n * Get a CFI from a Range in the Section\n * @param {range} _range\n * @return {string} cfi an EpubCFI string\n */\nSection.prototype.cfiFromRange = function(_range) {\n\treturn new EpubCFI(_range, this.cfiBase).toString();\n};\n\n/**\n * Get a CFI from an Element in the Section\n * @param {element} el\n * @return {string} cfi an EpubCFI string\n */\nSection.prototype.cfiFromElement = function(el) {\n\treturn new EpubCFI(el, this.cfiBase).toString();\n};\n\nmodule.exports = Section;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/section.js\n// module id = 46\n// module chunks = 0","var core = require('./core');\nvar EpubCFI = require('./epubcfi');\nvar Hook = require('./hook');\nvar Section = require('./section');\nvar replacements = require('./replacements');\n\n/**\n * A collection of Spine Items\n */\nfunction Spine(){\n\tthis.spineItems = [];\n\tthis.spineByHref = {};\n\tthis.spineById = {};\n\n\tthis.hooks = {};\n\tthis.hooks.serialize = new Hook();\n\tthis.hooks.content = new Hook();\n\n\t// Register replacements\n\tthis.hooks.content.register(replacements.base);\n\tthis.hooks.content.register(replacements.canonical);\n\n\tthis.epubcfi = new EpubCFI();\n\n\tthis.loaded = false;\n};\n\n/**\n * Unpack items from a opf into spine items\n * @param {Package} _package\n * @param {method} resolver URL resolver\n */\nSpine.prototype.unpack = function(_package, resolver) {\n\n\tthis.items = _package.spine;\n\tthis.manifest = _package.manifest;\n\tthis.spineNodeIndex = _package.spineNodeIndex;\n\tthis.baseUrl = _package.baseUrl || _package.basePath || '';\n\tthis.length = this.items.length;\n\n\tthis.items.forEach(function(item, index){\n\t\tvar href, url;\n\t\tvar manifestItem = this.manifest[item.idref];\n\t\tvar spineItem;\n\n\t\titem.cfiBase = this.epubcfi.generateChapterComponent(this.spineNodeIndex, item.index, item.idref);\n\n\t\tif(manifestItem) {\n\t\t\titem.href = manifestItem.href;\n\t\t\titem.url = resolver(item.href, true);\n\n\t\t\tif(manifestItem.properties.length){\n\t\t\t\titem.properties.push.apply(item.properties, manifestItem.properties);\n\t\t\t}\n\t\t}\n\n\t\titem.prev = function(){ return this.get(index-1); }.bind(this);\n\t\titem.next = function(){ return this.get(index+1); }.bind(this);\n\n\t\tspineItem = new Section(item, this.hooks);\n\n\t\tthis.append(spineItem);\n\n\n\t}.bind(this));\n\n\tthis.loaded = true;\n};\n\n/**\n * Get an item from the spine\n * @param {[string|int]} target\n * @return {Section} section\n * @example spine.get();\n * @example spine.get(1);\n * @example spine.get(\"chap1.html\");\n * @example spine.get(\"#id1234\");\n */\nSpine.prototype.get = function(target) {\n\tvar index = 0;\n\n\tif(this.epubcfi.isCfiString(target)) {\n\t\tcfi = new EpubCFI(target);\n\t\tindex = cfi.spinePos;\n\t} else if(target && (typeof target === \"number\" || isNaN(target) === false)){\n\t\tindex = target;\n\t} else if(target && target.indexOf(\"#\") === 0) {\n\t\tindex = this.spineById[target.substring(1)];\n\t} else if(target) {\n\t\t// Remove fragments\n\t\ttarget = target.split(\"#\")[0];\n\t\tindex = this.spineByHref[target];\n\t}\n\n\treturn this.spineItems[index] || null;\n};\n\n/**\n * Append a Section to the Spine\n * @private\n * @param {Section} section\n */\nSpine.prototype.append = function(section) {\n\tvar index = this.spineItems.length;\n\tsection.index = index;\n\n\tthis.spineItems.push(section);\n\n\tthis.spineByHref[section.href] = index;\n\tthis.spineById[section.idref] = index;\n\n\treturn index;\n};\n\n/**\n * Prepend a Section to the Spine\n * @private\n * @param {Section} section\n */\nSpine.prototype.prepend = function(section) {\n\tvar index = this.spineItems.unshift(section);\n\tthis.spineByHref[section.href] = 0;\n\tthis.spineById[section.idref] = 0;\n\n\t// Re-index\n\tthis.spineItems.forEach(function(item, index){\n\t\titem.index = index;\n\t});\n\n\treturn 0;\n};\n\n// Spine.prototype.insert = function(section, index) {\n//\n// };\n\n/**\n * Remove a Section from the Spine\n * @private\n * @param {Section} section\n */\nSpine.prototype.remove = function(section) {\n\tvar index = this.spineItems.indexOf(section);\n\n\tif(index > -1) {\n\t\tdelete this.spineByHref[section.href];\n\t\tdelete this.spineById[section.idref];\n\n\t\treturn this.spineItems.splice(index, 1);\n\t}\n};\n\n/**\n * Loop over the Sections in the Spine\n * @return {method} forEach\n */\nSpine.prototype.each = function() {\n\treturn this.spineItems.forEach.apply(this.spineItems, arguments);\n};\n\nmodule.exports = Spine;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/spine.js\n// module id = 47\n// module chunks = 0","if(typeof __WEBPACK_EXTERNAL_MODULE_48__ === 'undefined') {var e = new Error(\"Cannot find module \\\"JSZip\\\"\"); e.code = 'MODULE_NOT_FOUND'; throw e;}\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_48__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"JSZip\"\n// module id = 48\n// module chunks = 0","var Book = require('./book');\nvar EpubCFI = require('./epubcfi');\nvar Rendition = require('./rendition');\nvar Contents = require('./contents');\n\n/**\n * Creates a new Book\n * @param {string|ArrayBuffer} url URL, Path or ArrayBuffer\n * @param {object} options to pass to the book\n * @returns {Book} a new Book object\n * @example ePub(\"/path/to/book.epub\", {})\n */\nfunction ePub(url, options) {\n\treturn new Book(url, options);\n};\n\nePub.VERSION = \"0.3.0\";\n\nePub.CFI = EpubCFI;\nePub.Rendition = Rendition;\nePub.Contents = Contents;\n\nePub.ViewManagers = {};\nePub.Views = {};\n/**\n * register plugins\n */\nePub.register = {\n\t/**\n\t * register a new view manager\n\t */\n\tmanager : function(name, manager){\n\t\treturn ePub.ViewManagers[name] = manager;\n\t},\n\t/**\n\t * register a new view\n\t */\n\tview : function(name, view){\n\t\treturn ePub.Views[name] = view;\n\t}\n};\n\n// Default Views\nePub.register.view(\"iframe\", require('./managers/views/iframe'));\n\n// Default View Managers\nePub.register.manager(\"default\", require('./managers/default'));\nePub.register.manager(\"continuous\", require('./managers/continuous'));\n\nmodule.exports = ePub;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/epub.js\n// module id = 50\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 34da14c1966138acf4e6","webpack:///./src/core.js","webpack:///./src/epubcfi.js","webpack:///./~/path-webpack/path.js","webpack:///./~/event-emitter/index.js","webpack:///./~/process/browser.js","webpack:///./src/hook.js","webpack:///./src/mapping.js","webpack:///./src/queue.js","webpack:///./src/replacements.js","webpack:///./src/request.js","webpack:///./src/contents.js","webpack:///./src/managers/default/index.js","webpack:///./src/rendition.js","webpack:///external \"xmldom\"","webpack:///./src/book.js","webpack:///./src/managers/continuous/index.js","webpack:///./src/managers/views/iframe.js","webpack:///./libs/mime/mime.js","webpack:///./~/base64-js/index.js","webpack:///./~/d/index.js","webpack:///./~/es5-ext/object/assign/index.js","webpack:///./~/es5-ext/object/assign/is-implemented.js","webpack:///./~/es5-ext/object/assign/shim.js","webpack:///./~/es5-ext/object/is-callable.js","webpack:///./~/es5-ext/object/keys/index.js","webpack:///./~/es5-ext/object/keys/is-implemented.js","webpack:///./~/es5-ext/object/keys/shim.js","webpack:///./~/es5-ext/object/normalize-options.js","webpack:///./~/es5-ext/object/valid-callable.js","webpack:///./~/es5-ext/object/valid-value.js","webpack:///./~/es5-ext/string/#/contains/index.js","webpack:///./~/es5-ext/string/#/contains/is-implemented.js","webpack:///./~/es5-ext/string/#/contains/shim.js","webpack:///./src/archive.js","webpack:///./src/container.js","webpack:///./src/layout.js","webpack:///./src/locations.js","webpack:///./src/managers/helpers/stage.js","webpack:///./src/managers/helpers/views.js","webpack:///./src/navigation.js","webpack:///./src/packaging.js","webpack:///./src/pagelist.js","webpack:///./src/resources.js","webpack:///./src/section.js","webpack:///./src/spine.js","webpack:///external \"JSZip\"","webpack:///./src/epub.js"],"names":[],"mappings":"AAAA;AACA;AACA,0EAA0E,MAAM,yBAAyB,EAAE,YAAY,EAAE;AACzH;AACA;AACA;AACA,2EAA2E,MAAM,yBAAyB,EAAE,YAAY,EAAE;AAC1H;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA,YAAI;AACJ;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;AC9DA;AACA;;AAEA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,2CAA2C,YAAY;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;;AAEA;AACA,sBAAsB;AACtB;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,qBAAqB;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iCAAiC,aAAa;;AAE9C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,8BAA8B;;AAE9B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACnoBA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,mBAAmB;;AAEnB,oBAAoB;;AAEpB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;;AAGA;AACA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA,EAAE,2EAA2E;AAC7E;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA,UAAU;AACV;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,UAAU;AACV;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mCAAmC;AACnC;;AAEA;AACA;AACA;;AAEA;;AAEA,EAAE;;AAEF;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA,gBAAgB,mBAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,UAAU;AACV;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,SAAS;;AAErB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,EAAE;;AAEF;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,EAAE;;AAEF;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,SAAS;AACrB;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;;AC17BA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,QAAQ;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,sCAAsC,8BAA8B;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,GAAG;;;AAGH;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,UAAU,yBAAyB;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,qBAAqB;AAC/B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAU,aAAa;AACvB;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA,WAAW;AACX;AACA,qCAAqC;AACrC;AACA;AACA,SAAS;AACT;AACA;AACA,gDAAgD;AAChD;AACA,WAAW;AACX;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2CAA2C,cAAc;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;;AAEA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,UAAU,YAAY;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;;;AAGA;;;;;;;;;ACniBA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB;;AAElB;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,aAAa,4BAA4B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,OAAO;;AAEpB;AACA,aAAa,2BAA2B;AACxC;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B;;AAE1B;AACA;AACA;AACA;;;;;;;ACnIA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;AACA,4BAA4B,UAAU;;;;;;;ACnLtC;AACA;AACA;AACA;AACA,WAAW,IAAI;AACf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6CAA6C,IAAI;AACjD;AACA;AACA,eAAe,sBAAsB;AACrC;AACA;AACA,GAAG;AACH;AACA,iBAAiB,yBAAyB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD,IAAI;AAC3D;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;;;AAGF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;;;;;;AC7DA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;;AAEA,GAAG;;AAEH;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;;AAEA,GAAG;;;AAGH;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,mBAAmB;AACnC;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,mBAAmB;AACnC;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;;AAIA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,gBAAgB,oBAAoB;AACpC;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;;;;;;ACxSA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,EAAE;AACF;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;AACA;AACA;AACA;;;;AAIA,GAAG;AACH;AACA;AACA;;AAEA,EAAE;AACF;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL,GAAG;AACH;AACA;AACA;;AAEA,EAAE;;AAEF;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,IAAI;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,YAAY,SAAS;AACrB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,EAAE;;AAEF;;AAEA;;AAEA;;;;;;;AChOA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB;;AAEvB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;;AAEF,gBAAgB,kBAAkB;AAClC;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AClHA;AACA;;AAEA;AACA,uEAAuE;AACvE;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA,mCAAmC;AACnC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,6CAA6C;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,yCAAyC;AACzC;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;ACvJA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;;AAGA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH,iBAAiB,mBAAmB;AACpC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,sBAAsB;AACtB,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,EAAE;;AAEF;AACA,eAAe;;AAEf;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,mBAAmB;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB;;AAElB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA,EAAE;AACF;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA,EAAE;AACF;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA;AACA;;AAEA,4BAA4B,QAAQ;AACpC;AACA,2EAA2E;AAC3E;;AAEA;AACA,qCAAqC,gBAAgB;AACrD;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,gBAAgB,2CAA2C;;AAE3D;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,gBAAgB,aAAa;;AAE7B;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;;;;;;AC7pBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,gDAAgD;AAChD;AACA;AACA;AACA;AACA,+BAA+B,2DAA2D;AAC1F;AACA;AACA;AACA,EAAE;;AAEF,kDAAkD;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;;AAEA;;AAEA,GAAG;AACH;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;;AAGA,EAAE;;AAEF;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;;AAGA,EAAE;;AAEF;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,iBAAiB;AACjC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uCAAuC,wCAAwC;;AAE/E;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,GAAG;;AAEH;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;;;;;;;ACpjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,IAAI;AACf,WAAW,IAAI;AACf,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,IAAI;AACf;AACA;;AAEA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oFAAoF;AACpF,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA;;AAEA;AACA,mEAAmE;AACnE,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY;AACZ;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA,YAAY,EAAE;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,IAAI;AAChB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,IAAI;AACJ,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,EAAE;AACF;;AAEA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;AACA,YAAY,MAAM;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,KAAK;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;;AAEA;AACA;;AAEA;;;;;;;AC9kBA,gD;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa;AACb,6CAA6C;AAC7C,sBAAsB,0BAA0B;AAChD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;;AAGA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA,eAAe,OAAO;AACtB;AACA;AACA;;AAEA;AACA,eAAe,MAAM;AACrB;AACA;;AAEA;AACA,eAAe,UAAU;AACzB;AACA;;AAEA;AACA,eAAe,WAAW;AAC1B;AACA;;AAEA;AACA,eAAe,SAAS;AACxB;AACA;;AAEA;AACA,eAAe,IAAI;AACnB;AACA;AACA;;AAEA;AACA,eAAe,KAAK;AACpB;AACA;AACA;;AAEA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,UAAU;AACtB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,GAAG;;;;AAIH;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;ACxeA;AACA;;AAEA;;AAEA,2CAA2C;;AAE3C;;AAEA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF,kDAAkD;;AAElD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,gBAAgB,iBAAiB;AACjC;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,2BAA2B;;AAE3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;;AAGL,OAAO;;AAEP,EAAE;AACF;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,oBAAoB;AACpC;AACA;;AAEA;AACA,gBAAgB,kBAAkB;AAClC;AACA;;AAEA;AACA;AACA;;AAEA,8DAA8D;;AAE9D;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,KAAK;;AAEL;;AAEA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;;AAEA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,sBAAsB,QAAQ;AAC9B;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,EAAE;;AAEF,sBAAsB,QAAQ;AAC9B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uCAAuC,wCAAwC;;AAE/E;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;;;;;;ACtqBA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B,EAAE,eAAe;;AAEjB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA,GAAG;;AAEH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF,mBAAmB;AACnB;;AAEA;AACA;AACA,uCAAuC;AACvC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;;;AAIA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,EAAE;;AAEF;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA,GAAG;;AAEH,EAAE;AACF;AACA;;;AAGA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;;;;;;AC9jBA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,qBAAqB,oBAAoB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,gCAAgC;;AAEhC;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;AC1KA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kCAAkC,SAAS;AAC3C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0CAA0C,UAAU;AACpD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;;;;;;ACjHA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA,SAAS;AACT;AACA;;;;;;;;AC9DA;;AAEA;AACA;AACA;;;;;;;;ACJA;;AAEA;AACA;AACA;AACA,QAAQ;AACR,cAAc,aAAa,GAAG,eAAe;AAC7C;AACA;;;;;;;;ACRA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,OAAO,sBAAsB,EAAE;AAC/B;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACrBA;;AAEA;;AAEA,iCAAiC,kCAAkC;;;;;;;;ACJnE;;AAEA;AACA;AACA;;;;;;;;ACJA;;AAEA;AACA;AACA;AACA;AACA,EAAE,YAAY,cAAc;AAC5B;;;;;;;;ACPA;;AAEA;;AAEA;AACA;AACA;;;;;;;;ACNA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;;;;;;;AChBA;;AAEA;AACA;AACA;AACA;;;;;;;;ACLA;;AAEA;AACA;AACA;AACA;;;;;;;;ACLA;;AAEA;AACA;AACA;;;;;;;;ACJA;;AAEA;;AAEA;AACA;AACA;AACA;;;;;;;;ACPA;;AAEA;;AAEA;AACA;AACA;;;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB;AACA;AACA,mCAAmC,mBAAmB;AACtD;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,oCAAoC,mBAAmB;AACvD,GAAG;AACH;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,IAAI;AAChB,YAAY,SAAS;AACrB,YAAY,IAAI;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA,6DAA6D;AAC7D;;AAEA;AACA;AACA;AACA,kCAAkC,gBAAgB;AAClD,GAAG;AACH;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA,6DAA6D;AAC7D;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB,YAAY,OAAO;AACnB;AACA;AACA,6DAA6D;AAC7D;;AAEA;AACA;AACA;AACA,iCAAiC;AACjC,GAAG;AACH;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,IAAI;;AAEJ;;AAEA,EAAE;;AAEF;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,IAAI;;AAEJ;AACA;;;AAGA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACpPA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;;;;;;ACxCA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,oBAAoB;AAC/B,WAAW,SAAS;AACpB,WAAW,UAAU;AACrB,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA,EAAE,OAAO;AACT;AACA;;AAEA,kBAAkB;AAClB;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACzJA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,YAAY,IAAI;AAChB,YAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;AAIA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,GAAG;;AAEH;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,oDAAoD;AACpD;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA,CAAC;;AAED;;AAEA;;;;;;;AC1OA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B,6BAA6B;AAC7B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA,EAAE;;AAEF,6CAA6C,cAAc;AAC3D;;;;AAIA;;;;;;;ACtOA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,gBAAgB,SAAS;AACzB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACpKA;AACA;;AAEA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,MAAM;AAClB;AACA;AACA;;AAEA,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC9LA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,EAAE;;AAEF;;AAEA;;AAEA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,mBAAmB;AAC/B,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,mBAAmB;AAC/D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,wCAAwC;AACpF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA,gDAAgD,eAAe;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,2BAA2B;AACtE;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA,iCAAiC,oBAAoB;;AAErD;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;ACzRA;AACA;;AAEA;AACA;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE,cAAc;AAChB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB,YAAY,gBAAgB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,YAAY,YAAY;AACxB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,IAAI;AAChB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACxPA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB,WAAW,kBAAkB;AAC7B,WAAW,UAAU;AACrB,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,SAAS;AACrB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA,uCAAuC,oDAAoD;AAC3F,GAAG;;AAEH;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,YAAY,UAAU;AACtB,YAAY,SAAS;AACrB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,UAAU;AACtB,YAAY,SAAS;AACrB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAI;;AAEJ;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA,GAAG;;AAEH;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,WAAW;AACvB,YAAY,SAAS;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;AACA,IAAI,oDAAoD;AACxD;AACA;;AAEA;;;;;;;AClOA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA,6CAA6C;AAC7C;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;;AAGA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;;AAEA;;AAEA;AACA;AACA;AACA,UAAU,OAAO;AACjB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA,YAAY,MAAM;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;;;;;;;ACzLA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,yBAAyB,0BAA0B,EAAE;AACrD,yBAAyB,0BAA0B,EAAE;;AAErD;;AAEA;;;AAGA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;;;;;;;AChKA,2DAA2D,kDAAkD,6BAA6B;AAC1I,gD;;;;;;;ACDA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,mBAAmB;AAC9B,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB,yCAAyC;AACzC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA","file":"epub.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory((function webpackLoadOptionalExternalModule() { try { return require(\"JSZip\"); } catch(e) {} }()), require(\"xmldom\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"JSZip\", \"xmldom\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ePub\"] = factory((function webpackLoadOptionalExternalModule() { try { return require(\"JSZip\"); } catch(e) {} }()), require(\"xmldom\"));\n\telse\n\t\troot[\"ePub\"] = factory(root[\"JSZip\"], root[\"xmldom\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_48__, __WEBPACK_EXTERNAL_MODULE_13__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmory imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmory exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tObject.defineProperty(exports, name, {\n \t\t\tconfigurable: false,\n \t\t\tenumerable: true,\n \t\t\tget: getter\n \t\t});\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/dist/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 50);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 34da14c1966138acf4e6","var base64 = require('base64-js');\nvar path = require('path');\n\nvar requestAnimationFrame = (typeof window != 'undefined') ? (window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame) : false;\n\n/**\n * creates a uri object\n * @param\t{string} urlString\ta url string (relative or absolute)\n * @param\t{[string]} baseString optional base for the url,\n * default to window.location.href\n * @return {object} url\n */\nfunction Url(urlString, baseString) {\n\tvar absolute = (urlString.indexOf('://') > -1);\n\tvar pathname = urlString;\n\n\tthis.Url = undefined;\n\tthis.href = urlString;\n\tthis.protocol = \"\";\n\tthis.origin = \"\";\n\tthis.fragment = \"\";\n\tthis.search = \"\";\n\tthis.base = baseString;\n\n\tif (!absolute && (typeof(baseString) !== \"string\")) {\n\t\tthis.base = window && window.location.href;\n\t}\n\n\t// URL Polyfill doesn't throw an error if base is empty\n\tif (absolute || this.base) {\n\t\ttry {\n\t\t\tthis.Url = new URL(urlString, this.base);\n\t\t\tthis.href = this.Url.href;\n\n\t\t\tthis.protocol = this.Url.protocol;\n\t\t\tthis.origin = this.Url.origin;\n\t\t\tthis.fragment = this.Url.fragment;\n\t\t\tthis.search = this.Url.search;\n\n\t\t\tpathname = this.Url.pathname;\n\t\t} catch (e) {\n\t\t\t// Skip URL parsing\n\t\t\tthis.Url = undefined;\n\t\t}\n\t}\n\n\tthis.Path = new Path(pathname);\n\tthis.directory = this.Path.directory;\n\tthis.filename = this.Path.filename;\n\tthis.extension = this.Path.extension;\n\n}\n\nUrl.prototype.path = function () {\n\treturn this.Path;\n};\n\nUrl.prototype.resolve = function (what) {\n\tvar isAbsolute = (what.indexOf('://') > -1);\n\tvar fullpath;\n\n\tif (isAbsolute) {\n\t\treturn what;\n\t}\n\n\tfullpath = path.resolve(this.directory, what);\n\treturn this.origin + fullpath;\n};\n\nUrl.prototype.relative = function (what) {\n\treturn path.relative(what, this.directory);\n};\n\nUrl.prototype.toString = function () {\n\treturn this.href;\n};\n\nfunction Path(pathString) {\n\tvar protocol;\n\tvar parsed;\n\n\tprotocol = pathString.indexOf('://');\n\tif (protocol > -1) {\n\t\tpathString = new URL(pathString).pathname;\n\t}\n\n\tparsed = this.parse(pathString);\n\n\tthis.path = pathString;\n\n\tif (this.isDirectory(pathString)) {\n\t\tthis.directory = pathString;\n\t} else {\n\t\tthis.directory = parsed.dir + \"/\";\n\t}\n\n\tthis.filename = parsed.base;\n\tthis.extension = parsed.ext.slice(1);\n\n}\n\nPath.prototype.parse = function (what) {\n\treturn path.parse(what);\n};\n\nPath.prototype.isAbsolute = function (what) {\n\treturn path.isAbsolute(what || this.path);\n};\n\nPath.prototype.isDirectory = function (what) {\n\treturn (what.charAt(what.length-1) === '/');\n};\n\nPath.prototype.resolve = function (what) {\n\treturn path.resolve(this.directory, what);\n};\n\nPath.prototype.relative = function (what) {\n\treturn path.relative(this.directory, what);\n};\n\nPath.prototype.splitPath = function(filename) {\n\treturn this.splitPathRe.exec(filename).slice(1);\n};\n\nPath.prototype.toString = function () {\n\treturn this.path;\n};\n\nfunction assertPath(path) {\n\tif (typeof path !== 'string') {\n\t\tthrow new TypeError('Path must be a string. Received ', path);\n\t}\n};\n\nfunction isElement(obj) {\n\t\treturn !!(obj && obj.nodeType == 1);\n};\n\n// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript\nfunction uuid() {\n\tvar d = new Date().getTime();\n\tvar uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n\t\t\tvar r = (d + Math.random()*16)%16 | 0;\n\t\t\td = Math.floor(d/16);\n\t\t\treturn (c=='x' ? r : (r&0x7|0x8)).toString(16);\n\t});\n\treturn uuid;\n};\n\n// From Lodash\nfunction values(object) {\n\tvar index = -1,\n\t\t\tprops = Object.keys(object),\n\t\t\tlength = props.length,\n\t\t\tresult = Array(length);\n\n\twhile (++index < length) {\n\t\tresult[index] = object[props[index]];\n\t}\n\treturn result;\n};\n\nfunction resolveUrl(base, path) {\n\tvar url = [],\n\t\tsegments = [],\n\t\tbaseUri = uri(base),\n\t\tpathUri = uri(path),\n\t\tbaseDirectory = baseUri.directory,\n\t\tpathDirectory = pathUri.directory,\n\t\tdirectories = [],\n\t\t// folders = base.split(\"/\"),\n\t\tpaths;\n\n\t// if(uri.host) {\n\t//\t return path;\n\t// }\n\n\tif(baseDirectory[0] === \"/\") {\n\t\tbaseDirectory = baseDirectory.substring(1);\n\t}\n\n\tif(pathDirectory[pathDirectory.length-1] === \"/\") {\n\t\tbaseDirectory = baseDirectory.substring(0, baseDirectory.length-1);\n\t}\n\n\tif(pathDirectory[0] === \"/\") {\n\t\tpathDirectory = pathDirectory.substring(1);\n\t}\n\n\tif(pathDirectory[pathDirectory.length-1] === \"/\") {\n\t\tpathDirectory = pathDirectory.substring(0, pathDirectory.length-1);\n\t}\n\n\tif(baseDirectory) {\n\t\tdirectories = baseDirectory.split(\"/\");\n\t}\n\n\tpaths = pathDirectory.split(\"/\");\n\n\tpaths.reverse().forEach(function(part, index){\n\t\tif(part === \"..\"){\n\t\t\tdirectories.pop();\n\t\t} else if(part === directories[directories.length-1]) {\n\t\t\tdirectories.pop();\n\t\t\tsegments.unshift(part);\n\t\t} else {\n\t\t\tsegments.unshift(part);\n\t\t}\n\t});\n\n\turl = [baseUri.origin];\n\n\tif(directories.length) {\n\t\turl = url.concat(directories);\n\t}\n\n\tif(segments) {\n\t\turl = url.concat(segments);\n\t}\n\n\turl = url.concat(pathUri.filename);\n\n\treturn url.join(\"/\");\n};\n\nfunction documentHeight() {\n\treturn Math.max(\n\t\t\tdocument.documentElement.clientHeight,\n\t\t\tdocument.body.scrollHeight,\n\t\t\tdocument.documentElement.scrollHeight,\n\t\t\tdocument.body.offsetHeight,\n\t\t\tdocument.documentElement.offsetHeight\n\t);\n};\n\nfunction isNumber(n) {\n\treturn !isNaN(parseFloat(n)) && isFinite(n);\n};\n\nfunction prefixed(unprefixed) {\n\tvar vendors = [\"Webkit\", \"Moz\", \"O\", \"ms\" ],\n\t\tprefixes = ['-Webkit-', '-moz-', '-o-', '-ms-'],\n\t\tupper = unprefixed[0].toUpperCase() + unprefixed.slice(1),\n\t\tlength = vendors.length;\n\n\tif (typeof(document) === 'undefined' || typeof(document.body.style[unprefixed]) != 'undefined') {\n\t\treturn unprefixed;\n\t}\n\n\tfor ( var i=0; i < length; i++ ) {\n\t\tif (typeof(document.body.style[vendors[i] + upper]) != 'undefined') {\n\t\t\treturn vendors[i] + upper;\n\t\t}\n\t}\n\n\treturn unprefixed;\n};\n\nfunction defaults(obj) {\n\tfor (var i = 1, length = arguments.length; i < length; i++) {\n\t\tvar source = arguments[i];\n\t\tfor (var prop in source) {\n\t\t\tif (obj[prop] === void 0) obj[prop] = source[prop];\n\t\t}\n\t}\n\treturn obj;\n};\n\nfunction extend(target) {\n\t\tvar sources = [].slice.call(arguments, 1);\n\t\tsources.forEach(function (source) {\n\t\t\tif(!source) return;\n\t\t\tObject.getOwnPropertyNames(source).forEach(function(propName) {\n\t\t\t\tObject.defineProperty(target, propName, Object.getOwnPropertyDescriptor(source, propName));\n\t\t\t});\n\t\t});\n\t\treturn target;\n};\n\n// Fast quicksort insert for sorted array -- based on:\n// http://stackoverflow.com/questions/1344500/efficient-way-to-insert-a-number-into-a-sorted-array-of-numbers\nfunction insert(item, array, compareFunction) {\n\tvar location = locationOf(item, array, compareFunction);\n\tarray.splice(location, 0, item);\n\n\treturn location;\n};\n// Returns where something would fit in\nfunction locationOf(item, array, compareFunction, _start, _end) {\n\tvar start = _start || 0;\n\tvar end = _end || array.length;\n\tvar pivot = parseInt(start + (end - start) / 2);\n\tvar compared;\n\tif(!compareFunction){\n\t\tcompareFunction = function(a, b) {\n\t\t\tif(a > b) return 1;\n\t\t\tif(a < b) return -1;\n\t\t\tif(a = b) return 0;\n\t\t};\n\t}\n\tif(end-start <= 0) {\n\t\treturn pivot;\n\t}\n\n\tcompared = compareFunction(array[pivot], item);\n\tif(end-start === 1) {\n\t\treturn compared > 0 ? pivot : pivot + 1;\n\t}\n\n\tif(compared === 0) {\n\t\treturn pivot;\n\t}\n\tif(compared === -1) {\n\t\treturn locationOf(item, array, compareFunction, pivot, end);\n\t} else{\n\t\treturn locationOf(item, array, compareFunction, start, pivot);\n\t}\n};\n// Returns -1 of mpt found\nfunction indexOfSorted(item, array, compareFunction, _start, _end) {\n\tvar start = _start || 0;\n\tvar end = _end || array.length;\n\tvar pivot = parseInt(start + (end - start) / 2);\n\tvar compared;\n\tif(!compareFunction){\n\t\tcompareFunction = function(a, b) {\n\t\t\tif(a > b) return 1;\n\t\t\tif(a < b) return -1;\n\t\t\tif(a = b) return 0;\n\t\t};\n\t}\n\tif(end-start <= 0) {\n\t\treturn -1; // Not found\n\t}\n\n\tcompared = compareFunction(array[pivot], item);\n\tif(end-start === 1) {\n\t\treturn compared === 0 ? pivot : -1;\n\t}\n\tif(compared === 0) {\n\t\treturn pivot; // Found\n\t}\n\tif(compared === -1) {\n\t\treturn indexOfSorted(item, array, compareFunction, pivot, end);\n\t} else{\n\t\treturn indexOfSorted(item, array, compareFunction, start, pivot);\n\t}\n};\n\nfunction bounds(el) {\n\n\tvar style = window.getComputedStyle(el);\n\tvar widthProps = [\"width\", \"paddingRight\", \"paddingLeft\", \"marginRight\", \"marginLeft\", \"borderRightWidth\", \"borderLeftWidth\"];\n\tvar heightProps = [\"height\", \"paddingTop\", \"paddingBottom\", \"marginTop\", \"marginBottom\", \"borderTopWidth\", \"borderBottomWidth\"];\n\n\tvar width = 0;\n\tvar height = 0;\n\n\twidthProps.forEach(function(prop){\n\t\twidth += parseFloat(style[prop]) || 0;\n\t});\n\n\theightProps.forEach(function(prop){\n\t\theight += parseFloat(style[prop]) || 0;\n\t});\n\n\treturn {\n\t\theight: height,\n\t\twidth: width\n\t};\n\n};\n\nfunction borders(el) {\n\n\tvar style = window.getComputedStyle(el);\n\tvar widthProps = [\"paddingRight\", \"paddingLeft\", \"marginRight\", \"marginLeft\", \"borderRightWidth\", \"borderLeftWidth\"];\n\tvar heightProps = [\"paddingTop\", \"paddingBottom\", \"marginTop\", \"marginBottom\", \"borderTopWidth\", \"borderBottomWidth\"];\n\n\tvar width = 0;\n\tvar height = 0;\n\n\twidthProps.forEach(function(prop){\n\t\twidth += parseFloat(style[prop]) || 0;\n\t});\n\n\theightProps.forEach(function(prop){\n\t\theight += parseFloat(style[prop]) || 0;\n\t});\n\n\treturn {\n\t\theight: height,\n\t\twidth: width\n\t};\n\n};\n\nfunction windowBounds() {\n\n\tvar width = window.innerWidth;\n\tvar height = window.innerHeight;\n\n\treturn {\n\t\ttop: 0,\n\t\tleft: 0,\n\t\tright: width,\n\t\tbottom: height,\n\t\twidth: width,\n\t\theight: height\n\t};\n\n};\n\n//https://stackoverflow.com/questions/13482352/xquery-looking-for-text-with-single-quote/13483496#13483496\nfunction cleanStringForXpath(str)\t{\n\t\tvar parts = str.match(/[^'\"]+|['\"]/g);\n\t\tparts = parts.map(function(part){\n\t\t\t\tif (part === \"'\")\t{\n\t\t\t\t\t\treturn '\\\"\\'\\\"'; // output \"'\"\n\t\t\t\t}\n\n\t\t\t\tif (part === '\"') {\n\t\t\t\t\t\treturn \"\\'\\\"\\'\"; // output '\"'\n\t\t\t\t}\n\t\t\t\treturn \"\\'\" + part + \"\\'\";\n\t\t});\n\t\treturn \"concat(\\'\\',\" + parts.join(\",\") + \")\";\n};\n\nfunction indexOfTextNode(textNode){\n\tvar parent = textNode.parentNode;\n\tvar children = parent.childNodes;\n\tvar sib;\n\tvar index = -1;\n\tfor (var i = 0; i < children.length; i++) {\n\t\tsib = children[i];\n\t\tif(sib.nodeType === Node.TEXT_NODE){\n\t\t\tindex++;\n\t\t}\n\t\tif(sib == textNode) break;\n\t}\n\n\treturn index;\n};\n\nfunction isXml(ext) {\n\treturn ['xml', 'opf', 'ncx'].indexOf(ext) > -1;\n}\n\nfunction createBlob(content, mime){\n\tvar blob = new Blob([content], {type : mime });\n\n\treturn blob;\n};\n\nfunction createBlobUrl(content, mime){\n\tvar _URL = window.URL || window.webkitURL || window.mozURL;\n\tvar tempUrl;\n\tvar blob = this.createBlob(content, mime);\n\n\ttempUrl = _URL.createObjectURL(blob);\n\n\treturn tempUrl;\n};\n\nfunction createBase64Url(content, mime){\n\tvar string;\n\tvar data;\n\tvar datauri;\n\n\tif (typeof(content) !== \"string\") {\n\t\t// Only handles strings\n\t\treturn;\n\t}\n\n\tdata = btoa(content);\n\n\tdatauri = \"data:\" + mime + \";base64,\" + data;\n\n\treturn datauri;\n};\n\nfunction type(obj){\n\treturn Object.prototype.toString.call(obj).slice(8, -1);\n}\n\nfunction parse(markup, mime) {\n\tvar doc;\n\t// console.log(\"parse\", markup);\n\n\tif (typeof DOMParser === \"undefined\") {\n\t\tDOMParser = require('xmldom').DOMParser;\n\t}\n\n\n\tdoc = new DOMParser().parseFromString(markup, mime);\n\n\treturn doc;\n}\n\nfunction qs(el, sel) {\n\tvar elements;\n\n\tif (typeof el.querySelector != \"undefined\") {\n\t\treturn el.querySelector(sel);\n\t} else {\n\t\telements = el.getElementsByTagName(sel);\n\t\tif (elements.length) {\n\t\t\treturn elements[0];\n\t\t}\n\t}\n}\n\nfunction qsa(el, sel) {\n\n\tif (typeof el.querySelector != \"undefined\") {\n\t\treturn el.querySelectorAll(sel);\n\t} else {\n\t\treturn el.getElementsByTagName(sel);\n\t}\n}\n\nfunction qsp(el, sel, props) {\n\tvar q, filtered;\n\tif (typeof el.querySelector != \"undefined\") {\n\t\tsel += '[';\n\t\tfor (var prop in props) {\n\t\t\tsel += prop + \"='\" + props[prop] + \"'\";\n\t\t}\n\t\tsel += ']';\n\t\treturn el.querySelector(sel);\n\t} else {\n\t\tq = el.getElementsByTagName(sel);\n\t\tfiltered = Array.prototype.slice.call(q, 0).filter(function(el) {\n\t\t\tfor (var prop in props) {\n\t\t\t\tif(el.getAttribute(prop) === props[prop]){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\n\t\tif (filtered) {\n\t\t\treturn filtered[0];\n\t\t}\n\t}\n}\n\nfunction blob2base64(blob, cb) {\n\tvar reader = new FileReader();\n\treader.readAsDataURL(blob);\n\treader.onloadend = function() {\n\t\tcb(reader.result);\n\t}\n}\n\n// From: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred#backwards_forwards_compatible\nfunction defer() {\n\t/* A method to resolve the associated Promise with the value passed.\n\t * If the promise is already settled it does nothing.\n\t *\n\t * @param {anything} value : This value is used to resolve the promise\n\t * If the value is a Promise then the associated promise assumes the state\n\t * of Promise passed as value.\n\t */\n\tthis.resolve = null;\n\n\t/* A method to reject the assocaited Promise with the value passed.\n\t * If the promise is already settled it does nothing.\n\t *\n\t * @param {anything} reason: The reason for the rejection of the Promise.\n\t * Generally its an Error object. If however a Promise is passed, then the Promise\n\t * itself will be the reason for rejection no matter the state of the Promise.\n\t */\n\tthis.reject = null;\n\n\tthis.id = uuid();\n\n\t/* A newly created Pomise object.\n\t * Initially in pending state.\n\t */\n\tthis.promise = new Promise(function(resolve, reject) {\n\t\tthis.resolve = resolve;\n\t\tthis.reject = reject;\n\t}.bind(this));\n\tObject.freeze(this);\n}\n\n function querySelectorByType(html, element, type){\n\tvar query;\n\tif (typeof html.querySelector != \"undefined\") {\n\t\tquery = html.querySelector(element+'[*|type=\"'+type+'\"]');\n\t}\n\t// Handle IE not supporting namespaced epub:type in querySelector\n\tif(!query || query.length === 0) {\n\t\tquery = this.qsa(html, element);\n\t\tfor (var i = 0; i < query.length; i++) {\n\t\t\tif(query[i].getAttributeNS(\"http://www.idpf.org/2007/ops\", \"type\") === type) {\n\t\t\t\treturn query[i];\n\t\t\t}\n\t\t}\n\t} else {\n\t\treturn query;\n\t}\n}\n\n\n\nmodule.exports = {\n\t'isElement': isElement,\n\t'uuid': uuid,\n\t'values': values,\n\t'resolveUrl': resolveUrl,\n\t'indexOfSorted': indexOfSorted,\n\t'documentHeight': documentHeight,\n\t'isNumber': isNumber,\n\t'prefixed': prefixed,\n\t'defaults': defaults,\n\t'extend': extend,\n\t'insert': insert,\n\t'locationOf': locationOf,\n\t'indexOfSorted': indexOfSorted,\n\t'requestAnimationFrame': requestAnimationFrame,\n\t'bounds': bounds,\n\t'borders': borders,\n\t'windowBounds': windowBounds,\n\t'cleanStringForXpath': cleanStringForXpath,\n\t'indexOfTextNode': indexOfTextNode,\n\t'isXml': isXml,\n\t'createBlob': createBlob,\n\t'createBlobUrl': createBlobUrl,\n\t'type': type,\n\t'parse' : parse,\n\t'qs' : qs,\n\t'qsa' : qsa,\n\t'qsp' : qsp,\n\t'blob2base64' : blob2base64,\n\t'createBase64Url': createBase64Url,\n\t'defer': defer,\n\t'Url': Url,\n\t'Path': Path,\n\t'querySelectorByType': querySelectorByType\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/core.js\n// module id = 0\n// module chunks = 0","var core = require('./core');\n\n/**\n\tEPUB CFI spec: http://www.idpf.org/epub/linking/cfi/epub-cfi.html\n\n\tImplements:\n\t- Character Offset: epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/2/1:3)\n\t- Simple Ranges : epubcfi(/6/4[chap01ref]!/4[body01]/10[para05],/2/1:1,/3:4)\n\n\tDoes Not Implement:\n\t- Temporal Offset (~)\n\t- Spatial Offset (@)\n\t- Temporal-Spatial Offset (~ + @)\n\t- Text Location Assertion ([)\n*/\n\nfunction EpubCFI(cfiFrom, base, ignoreClass){\n\tvar type;\n\n\tthis.str = '';\n\n\tthis.base = {};\n\tthis.spinePos = 0; // For compatibility\n\n\tthis.range = false; // true || false;\n\n\tthis.path = {};\n\tthis.start = null;\n\tthis.end = null;\n\n\t// Allow instantiation without the 'new' keyword\n\tif (!(this instanceof EpubCFI)) {\n\t\treturn new EpubCFI(cfiFrom, base, ignoreClass);\n\t}\n\n\tif(typeof base === 'string') {\n\t\tthis.base = this.parseComponent(base);\n\t} else if(typeof base === 'object' && base.steps) {\n\t\tthis.base = base;\n\t}\n\n\ttype = this.checkType(cfiFrom);\n\n\n\tif(type === 'string') {\n\t\tthis.str = cfiFrom;\n\t\treturn core.extend(this, this.parse(cfiFrom));\n\t} else if (type === 'range') {\n\t\treturn core.extend(this, this.fromRange(cfiFrom, this.base, ignoreClass));\n\t} else if (type === 'node') {\n\t\treturn core.extend(this, this.fromNode(cfiFrom, this.base, ignoreClass));\n\t} else if (type === 'EpubCFI' && cfiFrom.path) {\n\t\treturn cfiFrom;\n\t} else if (!cfiFrom) {\n\t\treturn this;\n\t} else {\n\t\tthrow new TypeError('not a valid argument for EpubCFI');\n\t}\n\n};\n\nEpubCFI.prototype.checkType = function(cfi) {\n\n\tif (this.isCfiString(cfi)) {\n\t\treturn 'string';\n\t// Is a range object\n\t} else if (typeof cfi === 'object' && core.type(cfi) === \"Range\"){\n\t\treturn 'range';\n\t} else if (typeof cfi === 'object' && typeof(cfi.nodeType) != \"undefined\" ){ // || typeof cfi === 'function'\n\t\treturn 'node';\n\t} else if (typeof cfi === 'object' && cfi instanceof EpubCFI){\n\t\treturn 'EpubCFI';\n\t} else {\n\t\treturn false;\n\t}\n};\n\nEpubCFI.prototype.parse = function(cfiStr) {\n\tvar cfi = {\n\t\t\tspinePos: -1,\n\t\t\trange: false,\n\t\t\tbase: {},\n\t\t\tpath: {},\n\t\t\tstart: null,\n\t\t\tend: null\n\t\t};\n\tvar baseComponent, pathComponent, range;\n\n\tif(typeof cfiStr !== \"string\") {\n\t\treturn {spinePos: -1};\n\t}\n\n\tif(cfiStr.indexOf(\"epubcfi(\") === 0 && cfiStr[cfiStr.length-1] === \")\") {\n\t\t// Remove intial epubcfi( and ending )\n\t\tcfiStr = cfiStr.slice(8, cfiStr.length-1);\n\t}\n\n\tbaseComponent = this.getChapterComponent(cfiStr);\n\n\t// Make sure this is a valid cfi or return\n\tif(!baseComponent) {\n\t\treturn {spinePos: -1};\n\t}\n\n\tcfi.base = this.parseComponent(baseComponent);\n\n\tpathComponent = this.getPathComponent(cfiStr);\n\tcfi.path = this.parseComponent(pathComponent);\n\n\trange = this.getRange(cfiStr);\n\n\tif(range) {\n\t\tcfi.range = true;\n\t\tcfi.start = this.parseComponent(range[0]);\n\t\tcfi.end = this.parseComponent(range[1]);\n\t}\n\n\t// Get spine node position\n\t// cfi.spineSegment = cfi.base.steps[1];\n\n\t// Chapter segment is always the second step\n\tcfi.spinePos = cfi.base.steps[1].index;\n\n\treturn cfi;\n};\n\nEpubCFI.prototype.parseComponent = function(componentStr){\n\tvar component = {\n\t\tsteps: [],\n\t\tterminal: {\n\t\t\toffset: null,\n\t\t\tassertion: null\n\t\t}\n\t};\n\tvar parts = componentStr.split(':');\n\tvar steps = parts[0].split('/');\n\tvar terminal;\n\n\tif(parts.length > 1) {\n\t\tterminal = parts[1];\n\t\tcomponent.terminal = this.parseTerminal(terminal);\n\t}\n\n\tif (steps[0] === '') {\n\t\tsteps.shift(); // Ignore the first slash\n\t}\n\n\tcomponent.steps = steps.map(function(step){\n\t\treturn this.parseStep(step);\n\t}.bind(this));\n\n\treturn component;\n};\n\nEpubCFI.prototype.parseStep = function(stepStr){\n\tvar type, num, index, has_brackets, id;\n\n\thas_brackets = stepStr.match(/\\[(.*)\\]/);\n\tif(has_brackets && has_brackets[1]){\n\t\tid = has_brackets[1];\n\t}\n\n\t//-- Check if step is a text node or element\n\tnum = parseInt(stepStr);\n\n\tif(isNaN(num)) {\n\t\treturn;\n\t}\n\n\tif(num % 2 === 0) { // Even = is an element\n\t\ttype = \"element\";\n\t\tindex = num / 2 - 1;\n\t} else {\n\t\ttype = \"text\";\n\t\tindex = (num - 1 ) / 2;\n\t}\n\n\treturn {\n\t\t\"type\" : type,\n\t\t'index' : index,\n\t\t'id' : id || null\n\t};\n};\n\nEpubCFI.prototype.parseTerminal = function(termialStr){\n\tvar characterOffset, textLocationAssertion;\n\tvar assertion = termialStr.match(/\\[(.*)\\]/);\n\n\tif(assertion && assertion[1]){\n\t\tcharacterOffset = parseInt(termialStr.split('[')[0]) || null;\n\t\ttextLocationAssertion = assertion[1];\n\t} else {\n\t\tcharacterOffset = parseInt(termialStr) || null;\n\t}\n\n\treturn {\n\t\t'offset': characterOffset,\n\t\t'assertion': textLocationAssertion\n\t};\n\n};\n\nEpubCFI.prototype.getChapterComponent = function(cfiStr) {\n\n\tvar indirection = cfiStr.split(\"!\");\n\n\treturn indirection[0];\n};\n\nEpubCFI.prototype.getPathComponent = function(cfiStr) {\n\n\tvar indirection = cfiStr.split(\"!\");\n\n\tif(indirection[1]) {\n\t\tranges = indirection[1].split(',');\n\t\treturn ranges[0];\n\t}\n\n};\n\nEpubCFI.prototype.getRange = function(cfiStr) {\n\n\tvar ranges = cfiStr.split(\",\");\n\n\tif(ranges.length === 3){\n\t\treturn [\n\t\t\tranges[1],\n\t\t\tranges[2]\n\t\t];\n\t}\n\n\treturn false;\n};\n\nEpubCFI.prototype.getCharecterOffsetComponent = function(cfiStr) {\n\tvar splitStr = cfiStr.split(\":\");\n\treturn splitStr[1] || '';\n};\n\nEpubCFI.prototype.joinSteps = function(steps) {\n\tif(!steps) {\n\t\treturn \"\";\n\t}\n\n\treturn steps.map(function(part){\n\t\tvar segment = '';\n\n\t\tif(part.type === 'element') {\n\t\t\tsegment += (part.index + 1) * 2;\n\t\t}\n\n\t\tif(part.type === 'text') {\n\t\t\tsegment += 1 + (2 * part.index); // TODO: double check that this is odd\n\t\t}\n\n\t\tif(part.id) {\n\t\t\tsegment += \"[\" + part.id + \"]\";\n\t\t}\n\n\t\treturn segment;\n\n\t}).join('/');\n\n};\n\nEpubCFI.prototype.segmentString = function(segment) {\n\tvar segmentString = '/';\n\n\tsegmentString += this.joinSteps(segment.steps);\n\n\tif(segment.terminal && segment.terminal.offset != null){\n\t\tsegmentString += ':' + segment.terminal.offset;\n\t}\n\n\tif(segment.terminal && segment.terminal.assertion != null){\n\t\tsegmentString += '[' + segment.terminal.assertion + ']';\n\t}\n\n\treturn segmentString;\n};\n\nEpubCFI.prototype.toString = function() {\n\tvar cfiString = 'epubcfi(';\n\n\tcfiString += this.segmentString(this.base);\n\n\tcfiString += '!';\n\tcfiString += this.segmentString(this.path);\n\n\t// Add Range, if present\n\tif(this.start) {\n\t\tcfiString += ',';\n\t\tcfiString += this.segmentString(this.start);\n\t}\n\n\tif(this.end) {\n\t\tcfiString += ',';\n\t\tcfiString += this.segmentString(this.end);\n\t}\n\n\tcfiString += \")\";\n\n\treturn cfiString;\n};\n\nEpubCFI.prototype.compare = function(cfiOne, cfiTwo) {\n\tvar stepsA, stepsB;\n\tvar terminalA, terminalB;\n\n\tif(typeof cfiOne === 'string') {\n\t\tcfiOne = new EpubCFI(cfiOne);\n\t}\n\tif(typeof cfiTwo === 'string') {\n\t\tcfiTwo = new EpubCFI(cfiTwo);\n\t}\n\t// Compare Spine Positions\n\tif(cfiOne.spinePos > cfiTwo.spinePos) {\n\t\treturn 1;\n\t}\n\tif(cfiOne.spinePos < cfiTwo.spinePos) {\n\t\treturn -1;\n\t}\n\n\tif (cfiOne.range) {\n\t\tstepsA = cfiOne.path.steps.concat(cfiOne.start.steps);\n\t\tterminalA = cfiOne.start.terminal;\n\t} else {\n\t\tstepsA = cfiOne.path.steps;\n\t\tterminalA = cfiOne.path.terminal;\n\t}\n\n\tif (cfiTwo.range) {\n\t\tstepsB = cfiTwo.path.steps.concat(cfiTwo.start.steps);\n\t\tterminalB = cfiTwo.start.terminal;\n\t} else {\n\t\tstepsB = cfiTwo.path.steps;\n\t\tterminalB = cfiTwo.path.terminal;\n\t}\n\n\t// Compare Each Step in the First item\n\tfor (var i = 0; i < stepsA.length; i++) {\n\t\tif(!stepsA[i]) {\n\t\t\treturn -1;\n\t\t}\n\t\tif(!stepsB[i]) {\n\t\t\treturn 1;\n\t\t}\n\t\tif(stepsA[i].index > stepsB[i].index) {\n\t\t\treturn 1;\n\t\t}\n\t\tif(stepsA[i].index < stepsB[i].index) {\n\t\t\treturn -1;\n\t\t}\n\t\t// Otherwise continue checking\n\t}\n\n\t// All steps in First equal to Second and First is Less Specific\n\tif(stepsA.length < stepsB.length) {\n\t\treturn 1;\n\t}\n\n\t// Compare the charecter offset of the text node\n\tif(terminalA.offset > terminalB.offset) {\n\t\treturn 1;\n\t}\n\tif(terminalA.offset < terminalB.offset) {\n\t\treturn -1;\n\t}\n\n\t// CFI's are equal\n\treturn 0;\n};\n\nEpubCFI.prototype.step = function(node) {\n\tvar nodeType = (node.nodeType === Node.TEXT_NODE) ? 'text' : 'element';\n\n\treturn {\n\t\t'id' : node.id,\n\t\t'tagName' : node.tagName,\n\t\t'type' : nodeType,\n\t\t'index' : this.position(node)\n\t};\n};\n\nEpubCFI.prototype.filteredStep = function(node, ignoreClass) {\n\tvar filteredNode = this.filter(node, ignoreClass);\n\tvar nodeType;\n\n\t// Node filtered, so ignore\n\tif (!filteredNode) {\n\t\treturn;\n\t}\n\n\t// Otherwise add the filter node in\n\tnodeType = (filteredNode.nodeType === Node.TEXT_NODE) ? 'text' : 'element';\n\n\treturn {\n\t\t'id' : filteredNode.id,\n\t\t'tagName' : filteredNode.tagName,\n\t\t'type' : nodeType,\n\t\t'index' : this.filteredPosition(filteredNode, ignoreClass)\n\t};\n};\n\nEpubCFI.prototype.pathTo = function(node, offset, ignoreClass) {\n\tvar segment = {\n\t\tsteps: [],\n\t\tterminal: {\n\t\t\toffset: null,\n\t\t\tassertion: null\n\t\t}\n\t};\n\tvar currentNode = node;\n\tvar step;\n\n\twhile(currentNode && currentNode.parentNode &&\n\t\t\t\tcurrentNode.parentNode.nodeType != Node.DOCUMENT_NODE) {\n\n\t\tif (ignoreClass) {\n\t\t\tstep = this.filteredStep(currentNode, ignoreClass);\n\t\t} else {\n\t\t\tstep = this.step(currentNode);\n\t\t}\n\n\t\tif (step) {\n\t\t\tsegment.steps.unshift(step);\n\t\t}\n\n\t\tcurrentNode = currentNode.parentNode;\n\n\t}\n\n\tif (offset != null && offset >= 0) {\n\n\t\tsegment.terminal.offset = offset;\n\n\t\t// Make sure we are getting to a textNode if there is an offset\n\t\tif(segment.steps[segment.steps.length-1].type != \"text\") {\n\t\t\tsegment.steps.push({\n\t\t\t\t'type' : \"text\",\n\t\t\t\t'index' : 0\n\t\t\t});\n\t\t}\n\n\t}\n\n\n\treturn segment;\n}\n\nEpubCFI.prototype.equalStep = function(stepA, stepB) {\n\tif (!stepA || !stepB) {\n\t\treturn false;\n\t}\n\n\tif(stepA.index === stepB.index &&\n\t\t stepA.id === stepB.id &&\n\t\t stepA.type === stepB.type) {\n\t\treturn true;\n\t}\n\n\treturn false;\n};\nEpubCFI.prototype.fromRange = function(range, base, ignoreClass) {\n\tvar cfi = {\n\t\t\trange: false,\n\t\t\tbase: {},\n\t\t\tpath: {},\n\t\t\tstart: null,\n\t\t\tend: null\n\t\t};\n\n\tvar start = range.startContainer;\n\tvar end = range.endContainer;\n\n\tvar startOffset = range.startOffset;\n\tvar endOffset = range.endOffset;\n\n\tvar needsIgnoring = false;\n\n\tif (ignoreClass) {\n\t\t// Tell pathTo if / what to ignore\n\t\tneedsIgnoring = (start.ownerDocument.querySelector('.' + ignoreClass) != null);\n\t}\n\n\n\tif (typeof base === 'string') {\n\t\tcfi.base = this.parseComponent(base);\n\t\tcfi.spinePos = cfi.base.steps[1].index;\n\t} else if (typeof base === 'object') {\n\t\tcfi.base = base;\n\t}\n\n\tif (range.collapsed) {\n\t\tif (needsIgnoring) {\n\t\t\tstartOffset = this.patchOffset(start, startOffset, ignoreClass);\n\t\t}\n\t\tcfi.path = this.pathTo(start, startOffset, ignoreClass);\n\t} else {\n\t\tcfi.range = true;\n\n\t\tif (needsIgnoring) {\n\t\t\tstartOffset = this.patchOffset(start, startOffset, ignoreClass);\n\t\t}\n\n\t\tcfi.start = this.pathTo(start, startOffset, ignoreClass);\n\t\tif (needsIgnoring) {\n\t\t\tendOffset = this.patchOffset(end, endOffset, ignoreClass);\n\t\t}\n\n\t\tcfi.end = this.pathTo(end, endOffset, ignoreClass);\n\n\t\t// Create a new empty path\n\t\tcfi.path = {\n\t\t\tsteps: [],\n\t\t\tterminal: null\n\t\t};\n\n\t\t// Push steps that are shared between start and end to the common path\n\t\tvar len = cfi.start.steps.length;\n\t\tvar i;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (this.equalStep(cfi.start.steps[i], cfi.end.steps[i])) {\n\t\t\t\tif(i === len-1) {\n\t\t\t\t\t// Last step is equal, check terminals\n\t\t\t\t\tif(cfi.start.terminal === cfi.end.terminal) {\n\t\t\t\t\t\t// CFI's are equal\n\t\t\t\t\t\tcfi.path.steps.push(cfi.start.steps[i]);\n\t\t\t\t\t\t// Not a range\n\t\t\t\t\t\tcfi.range = false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tcfi.path.steps.push(cfi.start.steps[i]);\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t};\n\n\t\tcfi.start.steps = cfi.start.steps.slice(cfi.path.steps.length);\n\t\tcfi.end.steps = cfi.end.steps.slice(cfi.path.steps.length);\n\n\t\t// TODO: Add Sanity check to make sure that the end if greater than the start\n\t}\n\n\treturn cfi;\n}\n\nEpubCFI.prototype.fromNode = function(anchor, base, ignoreClass) {\n\tvar cfi = {\n\t\t\trange: false,\n\t\t\tbase: {},\n\t\t\tpath: {},\n\t\t\tstart: null,\n\t\t\tend: null\n\t\t};\n\n\tvar needsIgnoring = false;\n\n\tif (ignoreClass) {\n\t\t// Tell pathTo if / what to ignore\n\t\tneedsIgnoring = (anchor.ownerDocument.querySelector('.' + ignoreClass) != null);\n\t}\n\n\tif (typeof base === 'string') {\n\t\tcfi.base = this.parseComponent(base);\n\t\tcfi.spinePos = cfi.base.steps[1].index;\n\t} else if (typeof base === 'object') {\n\t\tcfi.base = base;\n\t}\n\n\tcfi.path = this.pathTo(anchor, null, ignoreClass);\n\n\treturn cfi;\n};\n\n\nEpubCFI.prototype.filter = function(anchor, ignoreClass) {\n\tvar needsIgnoring;\n\tvar sibling; // to join with\n\tvar parent, prevSibling, nextSibling;\n\tvar isText = false;\n\n\tif (anchor.nodeType === Node.TEXT_NODE) {\n\t\tisText = true;\n\t\tparent = anchor.parentNode;\n\t\tneedsIgnoring = anchor.parentNode.classList.contains(ignoreClass);\n\t} else {\n\t\tisText = false;\n\t\tneedsIgnoring = anchor.classList.contains(ignoreClass);\n\t}\n\n\tif (needsIgnoring && isText) {\n\t\tpreviousSibling = parent.previousSibling;\n\t\tnextSibling = parent.nextSibling;\n\n\t\t// If the sibling is a text node, join the nodes\n\t\tif (previousSibling && previousSibling.nodeType === Node.TEXT_NODE) {\n\t\t\tsibling = previousSibling;\n\t\t} else if (nextSibling && nextSibling.nodeType === Node.TEXT_NODE) {\n\t\t\tsibling = nextSibling;\n\t\t}\n\n\t\tif (sibling) {\n\t\t\treturn sibling;\n\t\t} else {\n\t\t\t// Parent will be ignored on next step\n\t\t\treturn anchor;\n\t\t}\n\n\t} else if (needsIgnoring && !isText) {\n\t\t// Otherwise just skip the element node\n\t\treturn false;\n\t} else {\n\t\t// No need to filter\n\t\treturn anchor;\n\t}\n\n};\n\nEpubCFI.prototype.patchOffset = function(anchor, offset, ignoreClass) {\n\tvar needsIgnoring;\n\tvar sibling;\n\n\tif (anchor.nodeType != Node.TEXT_NODE) {\n\t\tconsole.error(\"Anchor must be a text node\");\n\t\treturn;\n\t}\n\n\tvar curr = anchor;\n\tvar totalOffset = offset;\n\n\t// If the parent is a ignored node, get offset from it's start\n\tif (anchor.parentNode.classList.contains(ignoreClass)) {\n\t\tcurr = anchor.parentNode;\n\t}\n\n\twhile (curr.previousSibling) {\n\t\tif(curr.previousSibling.nodeType === Node.ELEMENT_NODE) {\n\t\t\t// Originally a text node, so join\n\t\t\tif(curr.previousSibling.classList.contains(ignoreClass)){\n\t\t\t\ttotalOffset += curr.previousSibling.textContent.length;\n\t\t\t} else {\n\t\t\t\tbreak; // Normal node, dont join\n\t\t\t}\n\t\t} else {\n\t\t\t// If the previous sibling is a text node, join the nodes\n\t\t\ttotalOffset += curr.previousSibling.textContent.length;\n\t\t}\n\n\t\tcurr = curr.previousSibling;\n\t}\n\n\treturn totalOffset;\n\n};\n\nEpubCFI.prototype.normalizedMap = function(children, nodeType, ignoreClass) {\n\tvar output = {};\n\tvar prevIndex = -1;\n\tvar i, len = children.length;\n\tvar currNodeType;\n\tvar prevNodeType;\n\n\tfor (i = 0; i < len; i++) {\n\n\t\tcurrNodeType = children[i].nodeType;\n\n\t\t// Check if needs ignoring\n\t\tif (currNodeType === Node.ELEMENT_NODE &&\n\t\t\t\tchildren[i].classList.contains(ignoreClass)) {\n\t\t\tcurrNodeType = Node.TEXT_NODE;\n\t\t}\n\n\t\tif (i > 0 &&\n\t\t\t\tcurrNodeType === Node.TEXT_NODE &&\n\t\t\t\tprevNodeType === Node.TEXT_NODE) {\n\t\t\t// join text nodes\n\t\t\toutput[i] = prevIndex;\n\t\t} else if (nodeType === currNodeType){\n\t\t\tprevIndex = prevIndex + 1;\n\t\t\toutput[i] = prevIndex;\n\t\t}\n\n\t\tprevNodeType = currNodeType;\n\n\t}\n\n\treturn output;\n};\n\nEpubCFI.prototype.position = function(anchor) {\n\tvar children, index, map;\n\n\tif (anchor.nodeType === Node.ELEMENT_NODE) {\n\t\tchildren = anchor.parentNode.children;\n\t\tindex = Array.prototype.indexOf.call(children, anchor);\n\t} else {\n\t\tchildren = this.textNodes(anchor.parentNode);\n\t\tindex = children.indexOf(anchor);\n\t}\n\n\treturn index;\n};\n\nEpubCFI.prototype.filteredPosition = function(anchor, ignoreClass) {\n\tvar children, index, map;\n\n\tif (anchor.nodeType === Node.ELEMENT_NODE) {\n\t\tchildren = anchor.parentNode.children;\n\t\tmap = this.normalizedMap(children, Node.ELEMENT_NODE, ignoreClass);\n\t} else {\n\t\tchildren = anchor.parentNode.childNodes;\n\t\t// Inside an ignored node\n\t\tif(anchor.parentNode.classList.contains(ignoreClass)) {\n\t\t\tanchor = anchor.parentNode;\n\t\t\tchildren = anchor.parentNode.childNodes;\n\t\t}\n\t\tmap = this.normalizedMap(children, Node.TEXT_NODE, ignoreClass);\n\t}\n\n\n\tindex = Array.prototype.indexOf.call(children, anchor);\n\n\treturn map[index];\n};\n\nEpubCFI.prototype.stepsToXpath = function(steps) {\n\tvar xpath = [\".\", \"*\"];\n\n\tsteps.forEach(function(step){\n\t\tvar position = step.index + 1;\n\n\t\tif(step.id){\n\t\t\txpath.push(\"*[position()=\" + position + \" and @id='\" + step.id + \"']\");\n\t\t} else if(step.type === \"text\") {\n\t\t\txpath.push(\"text()[\" + position + \"]\");\n\t\t} else {\n\t\t\txpath.push(\"*[\" + position + \"]\");\n\t\t}\n\t});\n\n\treturn xpath.join(\"/\");\n};\n\n\n/*\n\nTo get the last step if needed:\n\n// Get the terminal step\nlastStep = steps[steps.length-1];\n// Get the query string\nquery = this.stepsToQuery(steps);\n// Find the containing element\nstartContainerParent = doc.querySelector(query);\n// Find the text node within that element\nif(startContainerParent && lastStep.type == \"text\") {\n\tcontainer = startContainerParent.childNodes[lastStep.index];\n}\n*/\nEpubCFI.prototype.stepsToQuerySelector = function(steps) {\n\tvar query = [\"html\"];\n\n\tsteps.forEach(function(step){\n\t\tvar position = step.index + 1;\n\n\t\tif(step.id){\n\t\t\tquery.push(\"#\" + step.id);\n\t\t} else if(step.type === \"text\") {\n\t\t\t// unsupported in querySelector\n\t\t\t// query.push(\"text()[\" + position + \"]\");\n\t\t} else {\n\t\t\tquery.push(\"*:nth-child(\" + position + \")\");\n\t\t}\n\t});\n\n\treturn query.join(\">\");\n\n};\n\nEpubCFI.prototype.textNodes = function(container, ignoreClass) {\n\treturn Array.prototype.slice.call(container.childNodes).\n\t\tfilter(function (node) {\n\t\t\tif (node.nodeType === Node.TEXT_NODE) {\n\t\t\t\treturn true;\n\t\t\t} else if (ignoreClass && node.classList.contains(ignoreClass)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n};\n\nEpubCFI.prototype.walkToNode = function(steps, _doc, ignoreClass) {\n\tvar doc = _doc || document;\n\tvar container = doc.documentElement;\n\tvar step;\n\tvar len = steps.length;\n\tvar i;\n\n\tfor (i = 0; i < len; i++) {\n\t\tstep = steps[i];\n\n\t\tif(step.type === \"element\") {\n\t\t\tcontainer = container.children[step.index];\n\t\t} else if(step.type === \"text\"){\n\t\t\tcontainer = this.textNodes(container, ignoreClass)[step.index];\n\t\t}\n\n\t};\n\n\treturn container;\n};\n\nEpubCFI.prototype.findNode = function(steps, _doc, ignoreClass) {\n\tvar doc = _doc || document;\n\tvar container;\n\tvar xpath;\n\n\tif(!ignoreClass && typeof doc.evaluate != 'undefined') {\n\t\txpath = this.stepsToXpath(steps);\n\t\tcontainer = doc.evaluate(xpath, doc, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;\n\t} else if(ignoreClass) {\n\t\tcontainer = this.walkToNode(steps, doc, ignoreClass);\n\t} else {\n\t\tcontainer = this.walkToNode(steps, doc);\n\t}\n\n\treturn container;\n};\n\nEpubCFI.prototype.fixMiss = function(steps, offset, _doc, ignoreClass) {\n\tvar container = this.findNode(steps.slice(0,-1), _doc, ignoreClass);\n\tvar children = container.childNodes;\n\tvar map = this.normalizedMap(children, Node.TEXT_NODE, ignoreClass);\n\tvar i;\n\tvar child;\n\tvar len;\n\tvar childIndex;\n\tvar lastStepIndex = steps[steps.length-1].index;\n\n\tfor (var childIndex in map) {\n\t\tif (!map.hasOwnProperty(childIndex)) return;\n\n\t\tif(map[childIndex] === lastStepIndex) {\n\t\t\tchild = children[childIndex];\n\t\t\tlen = child.textContent.length;\n\t\t\tif(offset > len) {\n\t\t\t\toffset = offset - len;\n\t\t\t} else {\n\t\t\t\tif (child.nodeType === Node.ELEMENT_NODE) {\n\t\t\t\t\tcontainer = child.childNodes[0];\n\t\t\t\t} else {\n\t\t\t\t\tcontainer = child;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tcontainer: container,\n\t\toffset: offset\n\t};\n\n};\n\nEpubCFI.prototype.toRange = function(_doc, ignoreClass) {\n\tvar doc = _doc || document;\n\tvar range = doc.createRange();\n\tvar start, end, startContainer, endContainer;\n\tvar cfi = this;\n\tvar startSteps, endSteps;\n\tvar needsIgnoring = ignoreClass ? (doc.querySelector('.' + ignoreClass) != null) : false;\n\tvar missed;\n\n\tif (cfi.range) {\n\t\tstart = cfi.start;\n\t\tstartSteps = cfi.path.steps.concat(start.steps);\n\t\tstartContainer = this.findNode(startSteps, doc, needsIgnoring ? ignoreClass : null);\n\t\tend = cfi.end;\n\t\tendSteps = cfi.path.steps.concat(end.steps);\n\t\tendContainer = this.findNode(endSteps, doc, needsIgnoring ? ignoreClass : null);\n\t} else {\n\t\tstart = cfi.path;\n\t\tstartSteps = cfi.path.steps;\n\t\tstartContainer = this.findNode(cfi.path.steps, doc, needsIgnoring ? ignoreClass : null);\n\t}\n\n\tif(startContainer) {\n\t\ttry {\n\n\t\t\tif(start.terminal.offset != null) {\n\t\t\t\trange.setStart(startContainer, start.terminal.offset);\n\t\t\t} else {\n\t\t\t\trange.setStart(startContainer, 0);\n\t\t\t}\n\n\t\t} catch (e) {\n\t\t\tmissed = this.fixMiss(startSteps, start.terminal.offset, doc, needsIgnoring ? ignoreClass : null);\n\t\t\trange.setStart(missed.container, missed.offset);\n\t\t}\n\t} else {\n\t\t// No start found\n\t\treturn null;\n\t}\n\n\tif (endContainer) {\n\t\ttry {\n\n\t\t\tif(end.terminal.offset != null) {\n\t\t\t\trange.setEnd(endContainer, end.terminal.offset);\n\t\t\t} else {\n\t\t\t\trange.setEnd(endContainer, 0);\n\t\t\t}\n\n\t\t} catch (e) {\n\t\t\tmissed = this.fixMiss(endSteps, cfi.end.terminal.offset, doc, needsIgnoring ? ignoreClass : null);\n\t\t\trange.setEnd(missed.container, missed.offset);\n\t\t}\n\t}\n\n\n\t// doc.defaultView.getSelection().addRange(range);\n\treturn range;\n};\n\n// is a cfi string, should be wrapped with \"epubcfi()\"\nEpubCFI.prototype.isCfiString = function(str) {\n\tif(typeof str === 'string' &&\n\t\t\tstr.indexOf(\"epubcfi(\") === 0 &&\n\t\t\tstr[str.length-1] === \")\") {\n\t\treturn true;\n\t}\n\n\treturn false;\n};\n\nEpubCFI.prototype.generateChapterComponent = function(_spineNodeIndex, _pos, id) {\n\tvar pos = parseInt(_pos),\n\t\tspineNodeIndex = _spineNodeIndex + 1,\n\t\tcfi = '/'+spineNodeIndex+'/';\n\n\tcfi += (pos + 1) * 2;\n\n\tif(id) {\n\t\tcfi += \"[\" + id + \"]\";\n\t}\n\n\treturn cfi;\n};\n\nmodule.exports = EpubCFI;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/epubcfi.js\n// module id = 1\n// module chunks = 0","'use strict';\n\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + path);\n }\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path, allowAboveRoot) {\n var res = '';\n var lastSlash = -1;\n var dots = 0;\n var code;\n for (var i = 0; i <= path.length; ++i) {\n if (i < path.length)\n code = path.charCodeAt(i);\n else if (code === 47/*/*/)\n break;\n else\n code = 47/*/*/;\n if (code === 47/*/*/) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 ||\n res.charCodeAt(res.length - 1) !== 46/*.*/ ||\n res.charCodeAt(res.length - 2) !== 46/*.*/) {\n if (res.length > 2) {\n var start = res.length - 1;\n var j = start;\n for (; j >= 0; --j) {\n if (res.charCodeAt(j) === 47/*/*/)\n break;\n }\n if (j !== start) {\n if (j === -1)\n res = '';\n else\n res = res.slice(0, j);\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += '/..';\n else\n res = '..';\n }\n } else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46/*.*/ && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\nfunction _format(sep, pathObject) {\n var dir = pathObject.dir || pathObject.root;\n var base = pathObject.base ||\n ((pathObject.name || '') + (pathObject.ext || ''));\n if (!dir) {\n return base;\n }\n if (dir === pathObject.root) {\n return dir + base;\n }\n return dir + sep + base;\n}\n\nvar posix = {\n // path.resolve([from ...], to)\n resolve: function resolve() {\n var resolvedPath = '';\n var resolvedAbsolute = false;\n var cwd;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path;\n if (i >= 0)\n path = arguments[i];\n else {\n if (cwd === undefined)\n cwd = process.cwd();\n path = cwd;\n }\n\n assertPath(path);\n\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charCodeAt(0) === 47/*/*/;\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute) {\n if (resolvedPath.length > 0)\n return '/' + resolvedPath;\n else\n return '/';\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n } else {\n return '.';\n }\n },\n\n\n normalize: function normalize(path) {\n assertPath(path);\n\n if (path.length === 0)\n return '.';\n\n var isAbsolute = path.charCodeAt(0) === 47/*/*/;\n var trailingSeparator = path.charCodeAt(path.length - 1) === 47/*/*/;\n\n // Normalize the path\n path = normalizeStringPosix(path, !isAbsolute);\n\n if (path.length === 0 && !isAbsolute)\n path = '.';\n if (path.length > 0 && trailingSeparator)\n path += '/';\n\n if (isAbsolute)\n return '/' + path;\n return path;\n },\n\n\n isAbsolute: function isAbsolute(path) {\n assertPath(path);\n return path.length > 0 && path.charCodeAt(0) === 47/*/*/;\n },\n\n\n join: function join() {\n if (arguments.length === 0)\n return '.';\n var joined;\n for (var i = 0; i < arguments.length; ++i) {\n var arg = arguments[i];\n assertPath(arg);\n if (arg.length > 0) {\n if (joined === undefined)\n joined = arg;\n else\n joined += '/' + arg;\n }\n }\n if (joined === undefined)\n return '.';\n return posix.normalize(joined);\n },\n\n\n relative: function relative(from, to) {\n assertPath(from);\n assertPath(to);\n\n if (from === to)\n return '';\n\n from = posix.resolve(from);\n to = posix.resolve(to);\n\n if (from === to)\n return '';\n\n // Trim any leading backslashes\n var fromStart = 1;\n for (; fromStart < from.length; ++fromStart) {\n if (from.charCodeAt(fromStart) !== 47/*/*/)\n break;\n }\n var fromEnd = from.length;\n var fromLen = (fromEnd - fromStart);\n\n // Trim any leading backslashes\n var toStart = 1;\n for (; toStart < to.length; ++toStart) {\n if (to.charCodeAt(toStart) !== 47/*/*/)\n break;\n }\n var toEnd = to.length;\n var toLen = (toEnd - toStart);\n\n // Compare paths to find the longest common path from root\n var length = (fromLen < toLen ? fromLen : toLen);\n var lastCommonSep = -1;\n var i = 0;\n for (; i <= length; ++i) {\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === 47/*/*/) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n } else if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n } else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === 47/*/*/) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n } else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo'; to='/'\n lastCommonSep = 0;\n }\n }\n break;\n }\n var fromCode = from.charCodeAt(fromStart + i);\n var toCode = to.charCodeAt(toStart + i);\n if (fromCode !== toCode)\n break;\n else if (fromCode === 47/*/*/)\n lastCommonSep = i;\n }\n\n var out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === 47/*/*/) {\n if (out.length === 0)\n out += '..';\n else\n out += '/..';\n }\n }\n\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0)\n return out + to.slice(toStart + lastCommonSep);\n else {\n toStart += lastCommonSep;\n if (to.charCodeAt(toStart) === 47/*/*/)\n ++toStart;\n return to.slice(toStart);\n }\n },\n\n\n _makeLong: function _makeLong(path) {\n return path;\n },\n\n\n dirname: function dirname(path) {\n assertPath(path);\n if (path.length === 0)\n return '.';\n var code = path.charCodeAt(0);\n var hasRoot = (code === 47/*/*/);\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47/*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1)\n return hasRoot ? '/' : '.';\n if (hasRoot && end === 1)\n return '//';\n return path.slice(0, end);\n },\n\n\n basename: function basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string')\n throw new TypeError('\"ext\" argument must be a string');\n assertPath(path);\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext.length === path.length && ext === path)\n return '';\n var extIdx = ext.length - 1;\n var firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47/*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end)\n end = firstNonSlashEnd;\n else if (end === -1)\n end = path.length;\n return path.slice(start, end);\n } else {\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47/*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1)\n return '';\n return path.slice(start, end);\n }\n },\n\n\n extname: function extname(path) {\n assertPath(path);\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47/*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46/*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 ||\n end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 &&\n startDot === end - 1 &&\n startDot === startPart + 1)) {\n return '';\n }\n return path.slice(startDot, end);\n },\n\n\n format: function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError(\n 'Parameter \"pathObject\" must be an object, not ' + typeof(pathObject)\n );\n }\n return _format('/', pathObject);\n },\n\n\n parse: function parse(path) {\n assertPath(path);\n\n var ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0)\n return ret;\n var code = path.charCodeAt(0);\n var isAbsolute = (code === 47/*/*/);\n var start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n } else {\n start = 0;\n }\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n var i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i) {\n code = path.charCodeAt(i);\n if (code === 47/*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46/*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 ||\n end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 &&\n startDot === end - 1 &&\n startDot === startPart + 1)) {\n if (end !== -1) {\n if (startPart === 0 && isAbsolute)\n ret.base = ret.name = path.slice(1, end);\n else\n ret.base = ret.name = path.slice(startPart, end);\n }\n } else {\n if (startPart === 0 && isAbsolute) {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n } else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n if (startPart > 0)\n ret.dir = path.slice(0, startPart - 1);\n else if (isAbsolute)\n ret.dir = '/';\n\n return ret;\n },\n\n\n sep: '/',\n delimiter: ':',\n posix: null\n};\n\n\nmodule.exports = posix;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/path-webpack/path.js\n// module id = 2\n// module chunks = 0","'use strict';\n\nvar d = require('d')\n , callable = require('es5-ext/object/valid-callable')\n\n , apply = Function.prototype.apply, call = Function.prototype.call\n , create = Object.create, defineProperty = Object.defineProperty\n , defineProperties = Object.defineProperties\n , hasOwnProperty = Object.prototype.hasOwnProperty\n , descriptor = { configurable: true, enumerable: false, writable: true }\n\n , on, once, off, emit, methods, descriptors, base;\n\non = function (type, listener) {\n\tvar data;\n\n\tcallable(listener);\n\n\tif (!hasOwnProperty.call(this, '__ee__')) {\n\t\tdata = descriptor.value = create(null);\n\t\tdefineProperty(this, '__ee__', descriptor);\n\t\tdescriptor.value = null;\n\t} else {\n\t\tdata = this.__ee__;\n\t}\n\tif (!data[type]) data[type] = listener;\n\telse if (typeof data[type] === 'object') data[type].push(listener);\n\telse data[type] = [data[type], listener];\n\n\treturn this;\n};\n\nonce = function (type, listener) {\n\tvar once, self;\n\n\tcallable(listener);\n\tself = this;\n\ton.call(this, type, once = function () {\n\t\toff.call(self, type, once);\n\t\tapply.call(listener, this, arguments);\n\t});\n\n\tonce.__eeOnceListener__ = listener;\n\treturn this;\n};\n\noff = function (type, listener) {\n\tvar data, listeners, candidate, i;\n\n\tcallable(listener);\n\n\tif (!hasOwnProperty.call(this, '__ee__')) return this;\n\tdata = this.__ee__;\n\tif (!data[type]) return this;\n\tlisteners = data[type];\n\n\tif (typeof listeners === 'object') {\n\t\tfor (i = 0; (candidate = listeners[i]); ++i) {\n\t\t\tif ((candidate === listener) ||\n\t\t\t\t\t(candidate.__eeOnceListener__ === listener)) {\n\t\t\t\tif (listeners.length === 2) data[type] = listeners[i ? 0 : 1];\n\t\t\t\telse listeners.splice(i, 1);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif ((listeners === listener) ||\n\t\t\t\t(listeners.__eeOnceListener__ === listener)) {\n\t\t\tdelete data[type];\n\t\t}\n\t}\n\n\treturn this;\n};\n\nemit = function (type) {\n\tvar i, l, listener, listeners, args;\n\n\tif (!hasOwnProperty.call(this, '__ee__')) return;\n\tlisteners = this.__ee__[type];\n\tif (!listeners) return;\n\n\tif (typeof listeners === 'object') {\n\t\tl = arguments.length;\n\t\targs = new Array(l - 1);\n\t\tfor (i = 1; i < l; ++i) args[i - 1] = arguments[i];\n\n\t\tlisteners = listeners.slice();\n\t\tfor (i = 0; (listener = listeners[i]); ++i) {\n\t\t\tapply.call(listener, this, args);\n\t\t}\n\t} else {\n\t\tswitch (arguments.length) {\n\t\tcase 1:\n\t\t\tcall.call(listeners, this);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tcall.call(listeners, this, arguments[1]);\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tcall.call(listeners, this, arguments[1], arguments[2]);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tl = arguments.length;\n\t\t\targs = new Array(l - 1);\n\t\t\tfor (i = 1; i < l; ++i) {\n\t\t\t\targs[i - 1] = arguments[i];\n\t\t\t}\n\t\t\tapply.call(listeners, this, args);\n\t\t}\n\t}\n};\n\nmethods = {\n\ton: on,\n\tonce: once,\n\toff: off,\n\temit: emit\n};\n\ndescriptors = {\n\ton: d(on),\n\tonce: d(once),\n\toff: d(off),\n\temit: d(emit)\n};\n\nbase = defineProperties({}, descriptors);\n\nmodule.exports = exports = function (o) {\n\treturn (o == null) ? create(base) : defineProperties(Object(o), descriptors);\n};\nexports.methods = methods;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/event-emitter/index.js\n// module id = 3\n// module chunks = 0","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/process/browser.js\n// module id = 4\n// module chunks = 0 1","/**\n * Hooks allow for injecting functions that must all complete in order before finishing\n * They will execute in parallel but all must finish before continuing\n * Functions may return a promise if they are asycn.\n * @param {any} context scope of this\n * @example this.content = new EPUBJS.Hook(this);\n */\nfunction Hook(context){\n\tthis.context = context || this;\n\tthis.hooks = [];\n};\n\n/**\n * Adds a function to be run before a hook completes\n * @example this.content.register(function(){...});\n */\nHook.prototype.register = function(){\n\tfor(var i = 0; i < arguments.length; ++i) {\n\t\tif (typeof arguments[i] === \"function\") {\n\t\t\tthis.hooks.push(arguments[i]);\n\t\t} else {\n\t\t\t// unpack array\n\t\t\tfor(var j = 0; j < arguments[i].length; ++j) {\n\t\t\t\tthis.hooks.push(arguments[i][j]);\n\t\t\t}\n\t\t}\n\t}\n};\n\n/**\n * Triggers a hook to run all functions\n * @example this.content.trigger(args).then(function(){...});\n */\nHook.prototype.trigger = function(){\n\tvar args = arguments;\n\tvar context = this.context;\n\tvar promises = [];\n\n\tthis.hooks.forEach(function(task, i) {\n\t\tvar executing = task.apply(context, args);\n\n\t\tif(executing && typeof executing[\"then\"] === \"function\") {\n\t\t\t// Task is a function that returns a promise\n\t\t\tpromises.push(executing);\n\t\t}\n\t\t// Otherwise Task resolves immediately, continue\n\t});\n\n\n\treturn Promise.all(promises);\n};\n\n// Adds a function to be run before a hook completes\nHook.prototype.list = function(){\n\treturn this.hooks;\n};\n\nHook.prototype.clear = function(){\n\treturn this.hooks = [];\n};\n\nmodule.exports = Hook;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/hook.js\n// module id = 5\n// module chunks = 0","var EpubCFI = require('./epubcfi');\n\nfunction Mapping(layout){\n\tthis.layout = layout;\n};\n\nMapping.prototype.section = function(view) {\n\tvar ranges = this.findRanges(view);\n\tvar map = this.rangeListToCfiList(view.section.cfiBase, ranges);\n\n\treturn map;\n};\n\nMapping.prototype.page = function(contents, cfiBase, start, end) {\n\tvar root = contents && contents.document ? contents.document.body : false;\n\n\tif (!root) {\n\t\treturn;\n\t}\n\n\treturn this.rangePairToCfiPair(cfiBase, {\n\t\tstart: this.findStart(root, start, end),\n\t\tend: this.findEnd(root, start, end)\n\t});\n};\n\nMapping.prototype.walk = function(root, func) {\n\t//var treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT + NodeFilter.SHOW_TEXT, null, false);\n\tvar treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {\n\t\t\tacceptNode: function (node) {\n\t\t\t\t\tif ( node.data.trim().length > 0 ) {\n\t\t\t\t\t\treturn NodeFilter.FILTER_ACCEPT;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn NodeFilter.FILTER_REJECT;\n\t\t\t\t\t}\n\t\t\t}\n\t}, false);\n\tvar node;\n\tvar result;\n\twhile ((node = treeWalker.nextNode())) {\n\t\tresult = func(node);\n\t\tif(result) break;\n\t}\n\n\treturn result;\n};\n\nMapping.prototype.findRanges = function(view){\n\tvar columns = [];\n\tvar scrollWidth = view.contents.scrollWidth();\n\tvar count = this.layout.count(scrollWidth);\n\tvar column = this.layout.column;\n\tvar gap = this.layout.gap;\n\tvar start, end;\n\n\tfor (var i = 0; i < count.pages; i++) {\n\t\tstart = (column + gap) * i;\n\t\tend = (column * (i+1)) + (gap * i);\n\t\tcolumns.push({\n\t\t\tstart: this.findStart(view.document.body, start, end),\n\t\t\tend: this.findEnd(view.document.body, start, end)\n\t\t});\n\t}\n\n\treturn columns;\n};\n\nMapping.prototype.findStart = function(root, start, end){\n\tvar stack = [root];\n\tvar $el;\n\tvar found;\n\tvar $prev = root;\n\twhile (stack.length) {\n\n\t\t$el = stack.shift();\n\n\t\tfound = this.walk($el, function(node){\n\t\t\tvar left, right;\n\t\t\tvar elPos;\n\t\t\tvar elRange;\n\n\n\t\t\tif(node.nodeType == Node.TEXT_NODE){\n\t\t\t\telRange = document.createRange();\n\t\t\t\telRange.selectNodeContents(node);\n\t\t\t\telPos = elRange.getBoundingClientRect();\n\t\t\t} else {\n\t\t\t\telPos = node.getBoundingClientRect();\n\t\t\t}\n\n\t\t\tleft = elPos.left;\n\t\t\tright = elPos.right;\n\n\t\t\tif( left >= start && left <= end ) {\n\t\t\t\treturn node;\n\t\t\t} else if (right > start) {\n\t\t\t\treturn node;\n\t\t\t} else {\n\t\t\t\t$prev = node;\n\t\t\t\tstack.push(node);\n\t\t\t}\n\n\t\t});\n\n\t\tif(found) {\n\t\t\treturn this.findTextStartRange(found, start, end);\n\t\t}\n\n\t}\n\n\t// Return last element\n\treturn this.findTextStartRange($prev, start, end);\n};\n\nMapping.prototype.findEnd = function(root, start, end){\n\tvar stack = [root];\n\tvar $el;\n\tvar $prev = root;\n\tvar found;\n\n\twhile (stack.length) {\n\n\t\t$el = stack.shift();\n\n\t\tfound = this.walk($el, function(node){\n\n\t\t\tvar left, right;\n\t\t\tvar elPos;\n\t\t\tvar elRange;\n\n\n\t\t\tif(node.nodeType == Node.TEXT_NODE){\n\t\t\t\telRange = document.createRange();\n\t\t\t\telRange.selectNodeContents(node);\n\t\t\t\telPos = elRange.getBoundingClientRect();\n\t\t\t} else {\n\t\t\t\telPos = node.getBoundingClientRect();\n\t\t\t}\n\n\t\t\tleft = elPos.left;\n\t\t\tright = elPos.right;\n\n\t\t\tif(left > end && $prev) {\n\t\t\t\treturn $prev;\n\t\t\t} else if(right > end) {\n\t\t\t\treturn node;\n\t\t\t} else {\n\t\t\t\t$prev = node;\n\t\t\t\tstack.push(node);\n\t\t\t}\n\n\t\t});\n\n\n\t\tif(found){\n\t\t\treturn this.findTextEndRange(found, start, end);\n\t\t}\n\n\t}\n\n\t// end of chapter\n\treturn this.findTextEndRange($prev, start, end);\n};\n\n\nMapping.prototype.findTextStartRange = function(node, start, end){\n\tvar ranges = this.splitTextNodeIntoRanges(node);\n\tvar prev;\n\tvar range;\n\tvar pos;\n\n\tfor (var i = 0; i < ranges.length; i++) {\n\t\trange = ranges[i];\n\n\t\tpos = range.getBoundingClientRect();\n\n\t\tif( pos.left >= start ) {\n\t\t\treturn range;\n\t\t}\n\n\t\tprev = range;\n\n\t}\n\n\treturn ranges[0];\n};\n\nMapping.prototype.findTextEndRange = function(node, start, end){\n\tvar ranges = this.splitTextNodeIntoRanges(node);\n\tvar prev;\n\tvar range;\n\tvar pos;\n\n\tfor (var i = 0; i < ranges.length; i++) {\n\t\trange = ranges[i];\n\n\t\tpos = range.getBoundingClientRect();\n\n\t\tif(pos.left > end && prev) {\n\t\t\treturn prev;\n\t\t} else if(pos.right > end) {\n\t\t\treturn range;\n\t\t}\n\n\t\tprev = range;\n\n\t}\n\n\t// Ends before limit\n\treturn ranges[ranges.length-1];\n\n};\n\nMapping.prototype.splitTextNodeIntoRanges = function(node, _splitter){\n\tvar ranges = [];\n\tvar textContent = node.textContent || \"\";\n\tvar text = textContent.trim();\n\tvar range;\n\tvar rect;\n\tvar list;\n\tvar doc = node.ownerDocument;\n\tvar splitter = _splitter || \" \";\n\n\tpos = text.indexOf(splitter);\n\n\tif(pos === -1 || node.nodeType != Node.TEXT_NODE) {\n\t\trange = doc.createRange();\n\t\trange.selectNodeContents(node);\n\t\treturn [range];\n\t}\n\n\trange = doc.createRange();\n\trange.setStart(node, 0);\n\trange.setEnd(node, pos);\n\tranges.push(range);\n\trange = false;\n\n\twhile ( pos != -1 ) {\n\n\t\tpos = text.indexOf(splitter, pos + 1);\n\t\tif(pos > 0) {\n\n\t\t\tif(range) {\n\t\t\t\trange.setEnd(node, pos);\n\t\t\t\tranges.push(range);\n\t\t\t}\n\n\t\t\trange = doc.createRange();\n\t\t\trange.setStart(node, pos+1);\n\t\t}\n\t}\n\n\tif(range) {\n\t\trange.setEnd(node, text.length);\n\t\tranges.push(range);\n\t}\n\n\treturn ranges;\n};\n\n\n\nMapping.prototype.rangePairToCfiPair = function(cfiBase, rangePair){\n\n\tvar startRange = rangePair.start;\n\tvar endRange = rangePair.end;\n\n\tstartRange.collapse(true);\n\tendRange.collapse(true);\n\n\t// startCfi = section.cfiFromRange(startRange);\n\t// endCfi = section.cfiFromRange(endRange);\n\tstartCfi = new EpubCFI(startRange, cfiBase).toString();\n\tendCfi = new EpubCFI(endRange, cfiBase).toString();\n\n\treturn {\n\t\tstart: startCfi,\n\t\tend: endCfi\n\t};\n\n};\n\nMapping.prototype.rangeListToCfiList = function(cfiBase, columns){\n\tvar map = [];\n\tvar rangePair, cifPair;\n\n\tfor (var i = 0; i < columns.length; i++) {\n\t\tcifPair = this.rangePairToCfiPair(cfiBase, columns[i]);\n\n\t\tmap.push(cifPair);\n\n\t}\n\n\treturn map;\n};\n\nmodule.exports = Mapping;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/mapping.js\n// module id = 6\n// module chunks = 0","var core = require('./core');\n\n/**\n * Queue for handling tasks one at a time\n * @class\n * @param {scope} context what this will resolve to in the tasks\n */\nfunction Queue(context){\n\tthis._q = [];\n\tthis.context = context;\n\tthis.tick = core.requestAnimationFrame;\n\tthis.running = false;\n\tthis.paused = false;\n};\n\n/**\n * Add an item to the queue\n * @return {Promise}\n */\nQueue.prototype.enqueue = function() {\n\tvar deferred, promise;\n\tvar queued;\n\tvar task = [].shift.call(arguments);\n\tvar args = arguments;\n\n\t// Handle single args without context\n\t// if(args && !Array.isArray(args)) {\n\t// args = [args];\n\t// }\n\tif(!task) {\n\t\treturn console.error(\"No Task Provided\");\n\t}\n\n\tif(typeof task === \"function\"){\n\n\t\tdeferred = new core.defer();\n\t\tpromise = deferred.promise;\n\n\t\tqueued = {\n\t\t\t\"task\" : task,\n\t\t\t\"args\" : args,\n\t\t\t//\"context\" : context,\n\t\t\t\"deferred\" : deferred,\n\t\t\t\"promise\" : promise\n\t\t};\n\n\t} else {\n\t\t// Task is a promise\n\t\tqueued = {\n\t\t\t\"promise\" : task\n\t\t};\n\n\t}\n\n\tthis._q.push(queued);\n\n\t// Wait to start queue flush\n\tif (this.paused == false && !this.running) {\n\t\t// setTimeout(this.flush.bind(this), 0);\n\t\t// this.tick.call(window, this.run.bind(this));\n\t\tthis.run();\n\t}\n\n\treturn queued.promise;\n};\n\n/**\n * Run one item\n * @return {Promise}\n */\nQueue.prototype.dequeue = function(){\n\tvar inwait, task, result;\n\n\tif(this._q.length) {\n\t\tinwait = this._q.shift();\n\t\ttask = inwait.task;\n\t\tif(task){\n\t\t\t// console.log(task)\n\n\t\t\tresult = task.apply(this.context, inwait.args);\n\n\t\t\tif(result && typeof result[\"then\"] === \"function\") {\n\t\t\t\t// Task is a function that returns a promise\n\t\t\t\treturn result.then(function(){\n\t\t\t\t\tinwait.deferred.resolve.apply(this.context, arguments);\n\t\t\t\t}.bind(this));\n\t\t\t} else {\n\t\t\t\t// Task resolves immediately\n\t\t\t\tinwait.deferred.resolve.apply(this.context, result);\n\t\t\t\treturn inwait.promise;\n\t\t\t}\n\n\n\n\t\t} else if(inwait.promise) {\n\t\t\t// Task is a promise\n\t\t\treturn inwait.promise;\n\t\t}\n\n\t} else {\n\t\tinwait = new core.defer();\n\t\tinwait.deferred.resolve();\n\t\treturn inwait.promise;\n\t}\n\n};\n\n// Run All Immediately\nQueue.prototype.dump = function(){\n\twhile(this._q.length) {\n\t\tthis.dequeue();\n\t}\n};\n\n/**\n * Run all tasks sequentially, at convince\n * @return {Promise}\n */\nQueue.prototype.run = function(){\n\n\tif(!this.running){\n\t\tthis.running = true;\n\t\tthis.defered = new core.defer();\n\t}\n\n\tthis.tick.call(window, function() {\n\n\t\tif(this._q.length) {\n\n\t\t\tthis.dequeue()\n\t\t\t\t.then(function(){\n\t\t\t\t\tthis.run();\n\t\t\t\t}.bind(this));\n\n\t\t} else {\n\t\t\tthis.defered.resolve();\n\t\t\tthis.running = undefined;\n\t\t}\n\n\t}.bind(this));\n\n\t// Unpause\n\tif(this.paused == true) {\n\t\tthis.paused = false;\n\t}\n\n\treturn this.defered.promise;\n};\n\n/**\n * Flush all, as quickly as possible\n * @return {Promise}\n */\nQueue.prototype.flush = function(){\n\n\tif(this.running){\n\t\treturn this.running;\n\t}\n\n\tif(this._q.length) {\n\t\tthis.running = this.dequeue()\n\t\t\t.then(function(){\n\t\t\t\tthis.running = undefined;\n\t\t\t\treturn this.flush();\n\t\t\t}.bind(this));\n\n\t\treturn this.running;\n\t}\n\n};\n\n/**\n * Clear all items in wait\n */\nQueue.prototype.clear = function(){\n\tthis._q = [];\n\tthis.running = false;\n};\n\n/**\n * Get the number of tasks in the queue\n * @return {int} tasks\n */\nQueue.prototype.length = function(){\n\treturn this._q.length;\n};\n\n/**\n * Pause a running queue\n */\nQueue.prototype.pause = function(){\n\tthis.paused = true;\n};\n\n/**\n * Create a new task from a callback\n * @class\n * @private\n * @param {function} task\n * @param {array} args\n * @param {scope} context\n * @return {function} task\n */\nfunction Task(task, args, context){\n\n\treturn function(){\n\t\tvar toApply = arguments || [];\n\n\t\treturn new Promise(function(resolve, reject) {\n\t\t\tvar callback = function(value){\n\t\t\t\tresolve(value);\n\t\t\t};\n\t\t\t// Add the callback to the arguments list\n\t\t\ttoApply.push(callback);\n\n\t\t\t// Apply all arguments to the functions\n\t\t\ttask.apply(this, toApply);\n\n\t}.bind(this));\n\n\t};\n\n};\n\nmodule.exports = Queue;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/queue.js\n// module id = 7\n// module chunks = 0","// var URI = require('urijs');\nvar core = require('./core');\n\nfunction base(doc, section){\n\tvar base;\n\tvar head;\n\n\tif(!doc){\n\t\treturn;\n\t}\n\n\t// head = doc.querySelector(\"head\");\n\t// base = head.querySelector(\"base\");\n\thead = core.qs(doc, \"head\");\n\tbase = core.qs(head, \"base\");\n\n\tif(!base) {\n\t\tbase = doc.createElement(\"base\");\n\t\thead.insertBefore(base, head.firstChild);\n\t}\n\n\tbase.setAttribute(\"href\", section.url);\n}\n\nfunction canonical(doc, section){\n\tvar head;\n\tvar link;\n\tvar url = section.url; // window.location.origin + window.location.pathname + \"?loc=\" + encodeURIComponent(section.url);\n\n\tif(!doc){\n\t\treturn;\n\t}\n\n\thead = core.qs(doc, \"head\");\n\tlink = core.qs(head, \"link[rel='canonical']\");\n\n\tif (link) {\n\t\tlink.setAttribute(\"href\", url);\n\t} else {\n\t\tlink = doc.createElement(\"link\");\n\t\tlink.setAttribute(\"rel\", \"canonical\");\n\t\tlink.setAttribute(\"href\", url);\n\t\thead.appendChild(link);\n\t}\n}\n\nfunction links(view, renderer) {\n\n\tvar links = view.document.querySelectorAll(\"a[href]\");\n\tvar replaceLinks = function(link){\n\t\tvar href = link.getAttribute(\"href\");\n\n\t\tif(href.indexOf(\"mailto:\") === 0){\n\t\t\treturn;\n\t\t}\n\n\t\t// var linkUri = URI(href);\n\t\t// var absolute = linkUri.absoluteTo(view.section.url);\n\t\t// var relative = absolute.relativeTo(this.book.baseUrl).toString();\n\t\tvar relative = this.book.resolve(href, false);\n\t\t\n\t\tif(linkUrl && linkUrl.protocol){\n\n\t\t\tlink.setAttribute(\"target\", \"_blank\");\n\n\t\t}else{\n\t\t\t/*\n\t\t\tif(baseDirectory) {\n\t\t\t\t// We must ensure that the file:// protocol is preserved for\n\t\t\t\t// local file links, as in certain contexts (such as under\n\t\t\t\t// Titanium), file links without the file:// protocol will not\n\t\t\t\t// work\n\t\t\t\tif (baseUri.protocol === \"file\") {\n\t\t\t\t\trelative = core.resolveUrl(baseUri.base, href);\n\t\t\t\t} else {\n\t\t\t\t\trelative = core.resolveUrl(baseDirectory, href);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trelative = href;\n\t\t\t}\n\t\t\t*/\n\n\t\t\t// if(linkUri.fragment()) {\n\t\t\t\t// do nothing with fragment yet\n\t\t\t// } else {\n\t\t\t\tlink.onclick = function(){\n\t\t\t\t\trenderer.display(relative);\n\t\t\t\t\treturn false;\n\t\t\t\t};\n\t\t\t// }\n\n\t\t}\n\t}.bind(this);\n\n\tfor (var i = 0; i < links.length; i++) {\n\t\treplaceLinks(links[i]);\n\t}\n\n\n};\n\nfunction substitute(content, urls, replacements) {\n\turls.forEach(function(url, i){\n\t\tif (url && replacements[i]) {\n\t\t\tcontent = content.replace(new RegExp(url, 'g'), replacements[i]);\n\t\t}\n\t});\n\treturn content;\n}\nmodule.exports = {\n\t'base': base,\n\t'canonical' : canonical,\n\t'links': links,\n\t'substitute': substitute\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/replacements.js\n// module id = 8\n// module chunks = 0","var core = require('./core');\nvar Path = require('./core').Path;\n\nfunction request(url, type, withCredentials, headers) {\n\tvar supportsURL = (typeof window != \"undefined\") ? window.URL : false; // TODO: fallback for url if window isn't defined\n\tvar BLOB_RESPONSE = supportsURL ? \"blob\" : \"arraybuffer\";\n\tvar uri;\n\n\tvar deferred = new core.defer();\n\n\tvar xhr = new XMLHttpRequest();\n\n\t//-- Check from PDF.js:\n\t// https://github.com/mozilla/pdf.js/blob/master/web/compatibility.js\n\tvar xhrPrototype = XMLHttpRequest.prototype;\n\n\tvar header;\n\n\tif (!('overrideMimeType' in xhrPrototype)) {\n\t\t// IE10 might have response, but not overrideMimeType\n\t\tObject.defineProperty(xhrPrototype, 'overrideMimeType', {\n\t\t\tvalue: function xmlHttpRequestOverrideMimeType(mimeType) {}\n\t\t});\n\t}\n\tif(withCredentials) {\n\t\txhr.withCredentials = true;\n\t}\n\n\txhr.onreadystatechange = handler;\n\txhr.onerror = err;\n\n\txhr.open(\"GET\", url, true);\n\n\tfor(header in headers) {\n\t\txhr.setRequestHeader(header, headers[header]);\n\t}\n\n\tif(type == \"json\") {\n\t\txhr.setRequestHeader(\"Accept\", \"application/json\");\n\t}\n\n\t// If type isn't set, determine it from the file extension\n\tif(!type) {\n\t\ttype = new Path(url).extension;\n\t}\n\n\tif(type == 'blob'){\n\t\txhr.responseType = BLOB_RESPONSE;\n\t}\n\n\n\tif(core.isXml(type)) {\n\t\t// xhr.responseType = \"document\";\n\t\txhr.overrideMimeType('text/xml'); // for OPF parsing\n\t}\n\n\tif(type == 'xhtml') {\n\t\t// xhr.responseType = \"document\";\n\t}\n\n\tif(type == 'html' || type == 'htm') {\n\t\t// xhr.responseType = \"document\";\n\t }\n\n\tif(type == \"binary\") {\n\t\txhr.responseType = \"arraybuffer\";\n\t}\n\n\txhr.send();\n\n\tfunction err(e) {\n\t\tconsole.error(e);\n\t\tdeferred.reject(e);\n\t}\n\n\tfunction handler() {\n\t\tif (this.readyState === XMLHttpRequest.DONE) {\n\t\t\tvar responseXML = false;\n\n\t\t\tif(this.responseType === '' || this.responseType === \"document\") {\n\t\t\t\tresponseXML = this.responseXML;\n\t\t\t}\n\n\t\t\tif (this.status === 200 || responseXML ) { //-- Firefox is reporting 0 for blob urls\n\t\t\t\tvar r;\n\n\t\t\t\tif (!this.response && !responseXML) {\n\t\t\t\t\tdeferred.reject({\n\t\t\t\t\t\tstatus: this.status,\n\t\t\t\t\t\tmessage : \"Empty Response\",\n\t\t\t\t\t\tstack : new Error().stack\n\t\t\t\t\t});\n\t\t\t\t\treturn deferred.promise;\n\t\t\t\t}\n\n\t\t\t\tif (this.status === 403) {\n\t\t\t\t\tdeferred.reject({\n\t\t\t\t\t\tstatus: this.status,\n\t\t\t\t\t\tresponse: this.response,\n\t\t\t\t\t\tmessage : \"Forbidden\",\n\t\t\t\t\t\tstack : new Error().stack\n\t\t\t\t\t});\n\t\t\t\t\treturn deferred.promise;\n\t\t\t\t}\n\n\t\t\t\tif(responseXML){\n\t\t\t\t\tr = this.responseXML;\n\t\t\t\t} else\n\t\t\t\tif(core.isXml(type)){\n\t\t\t\t\t// xhr.overrideMimeType('text/xml'); // for OPF parsing\n\t\t\t\t\t// If this.responseXML wasn't set, try to parse using a DOMParser from text\n\t\t\t\t\tr = core.parse(this.response, \"text/xml\");\n\t\t\t\t}else\n\t\t\t\tif(type == 'xhtml'){\n\t\t\t\t\tr = core.parse(this.response, \"application/xhtml+xml\");\n\t\t\t\t}else\n\t\t\t\tif(type == 'html' || type == 'htm'){\n\t\t\t\t\tr = core.parse(this.response, \"text/html\");\n\t\t\t\t}else\n\t\t\t\tif(type == 'json'){\n\t\t\t\t\tr = JSON.parse(this.response);\n\t\t\t\t}else\n\t\t\t\tif(type == 'blob'){\n\n\t\t\t\t\tif(supportsURL) {\n\t\t\t\t\t\tr = this.response;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//-- Safari doesn't support responseType blob, so create a blob from arraybuffer\n\t\t\t\t\t\tr = new Blob([this.response]);\n\t\t\t\t\t}\n\n\t\t\t\t}else{\n\t\t\t\t\tr = this.response;\n\t\t\t\t}\n\n\t\t\t\tdeferred.resolve(r);\n\t\t\t} else {\n\n\t\t\t\tdeferred.reject({\n\t\t\t\t\tstatus: this.status,\n\t\t\t\t\tmessage : this.response,\n\t\t\t\t\tstack : new Error().stack\n\t\t\t\t});\n\n\t\t\t}\n\t\t}\n\t}\n\n\treturn deferred.promise;\n};\n\nmodule.exports = request;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/request.js\n// module id = 9\n// module chunks = 0","var EventEmitter = require('event-emitter');\nvar core = require('./core');\nvar EpubCFI = require('./epubcfi');\nvar Mapping = require('./mapping');\n\n\nfunction Contents(doc, content, cfiBase) {\n\t// Blank Cfi for Parsing\n\tthis.epubcfi = new EpubCFI();\n\n\tthis.document = doc;\n\tthis.documentElement = this.document.documentElement;\n\tthis.content = content || this.document.body;\n\tthis.window = this.document.defaultView;\n\t// Dom events to listen for\n\tthis.listenedEvents = [\"keydown\", \"keyup\", \"keypressed\", \"mouseup\", \"mousedown\", \"click\", \"touchend\", \"touchstart\"];\n\n\tthis._size = {\n\t\twidth: 0,\n\t\theight: 0\n\t}\n\n\tthis.cfiBase = cfiBase || \"\";\n\n\tthis.listeners();\n};\n\nContents.prototype.width = function(w) {\n\t// var frame = this.documentElement;\n\tvar frame = this.content;\n\n\tif (w && core.isNumber(w)) {\n\t\tw = w + \"px\";\n\t}\n\n\tif (w) {\n\t\tframe.style.width = w;\n\t\t// this.content.style.width = w;\n\t}\n\n\treturn this.window.getComputedStyle(frame)['width'];\n\n\n};\n\nContents.prototype.height = function(h) {\n\t// var frame = this.documentElement;\n\tvar frame = this.content;\n\n\tif (h && core.isNumber(h)) {\n\t\th = h + \"px\";\n\t}\n\n\tif (h) {\n\t\tframe.style.height = h;\n\t\t// this.content.style.height = h;\n\t}\n\n\treturn this.window.getComputedStyle(frame)['height'];\n\n};\n\nContents.prototype.contentWidth = function(w) {\n\n\tvar content = this.content || this.document.body;\n\n\tif (w && core.isNumber(w)) {\n\t\tw = w + \"px\";\n\t}\n\n\tif (w) {\n\t\tcontent.style.width = w;\n\t}\n\n\treturn this.window.getComputedStyle(content)['width'];\n\n\n};\n\nContents.prototype.contentHeight = function(h) {\n\n\tvar content = this.content || this.document.body;\n\n\tif (h && core.isNumber(h)) {\n\t\th = h + \"px\";\n\t}\n\n\tif (h) {\n\t\tcontent.style.height = h;\n\t}\n\n\treturn this.window.getComputedStyle(content)['height'];\n\n};\n\nContents.prototype.textWidth = function() {\n\tvar width;\n\tvar range = this.document.createRange();\n\tvar content = this.content || this.document.body;\n\n\t// Select the contents of frame\n\trange.selectNodeContents(content);\n\n\t// get the width of the text content\n\twidth = range.getBoundingClientRect().width;\n\n\treturn width;\n\n};\n\nContents.prototype.textHeight = function() {\n\tvar height;\n\tvar range = this.document.createRange();\n\tvar content = this.content || this.document.body;\n\n\trange.selectNodeContents(content);\n\n\theight = range.getBoundingClientRect().height;\n\n\treturn height;\n};\n\nContents.prototype.scrollWidth = function() {\n\tvar width = this.documentElement.scrollWidth;\n\n\treturn width;\n};\n\nContents.prototype.scrollHeight = function() {\n\tvar height = this.documentElement.scrollHeight;\n\n\treturn height;\n};\n\nContents.prototype.overflow = function(overflow) {\n\n\tif (overflow) {\n\t\tthis.documentElement.style.overflow = overflow;\n\t}\n\n\treturn this.window.getComputedStyle(this.documentElement)['overflow'];\n};\n\nContents.prototype.overflowX = function(overflow) {\n\n\tif (overflow) {\n\t\tthis.documentElement.style.overflowX = overflow;\n\t}\n\n\treturn this.window.getComputedStyle(this.documentElement)['overflowX'];\n};\n\nContents.prototype.overflowY = function(overflow) {\n\n\tif (overflow) {\n\t\tthis.documentElement.style.overflowY = overflow;\n\t}\n\n\treturn this.window.getComputedStyle(this.documentElement)['overflowY'];\n};\n\nContents.prototype.css = function(property, value) {\n\tvar content = this.content || this.document.body;\n\n\tif (value) {\n\t\tcontent.style[property] = value;\n\t}\n\n\treturn this.window.getComputedStyle(content)[property];\n};\n\nContents.prototype.viewport = function(options) {\n\tvar width, height, scale, scalable;\n\tvar $viewport = this.document.querySelector(\"meta[name='viewport']\");\n\tvar newContent = '';\n\n\t/*\n\t* check for the viewport size\n\t* \n\t*/\n\tif($viewport && $viewport.hasAttribute(\"content\")) {\n\t\tcontent = $viewport.getAttribute(\"content\");\n\t\tcontents = content.split(/\\s*,\\s*/);\n\t\tif(contents[0]){\n\t\t\twidth = contents[0].replace(\"width=\", '').trim();\n\t\t}\n\t\tif(contents[1]){\n\t\t\theight = contents[1].replace(\"height=\", '').trim();\n\t\t}\n\t\tif(contents[2]){\n\t\t\tscale = contents[2].replace(\"initial-scale=\", '').trim();\n\t\t}\n\t\tif(contents[3]){\n\t\t\tscalable = contents[3].replace(\"user-scalable=\", '').trim();\n\t\t}\n\t}\n\n\tif (options) {\n\n\t\tnewContent += \"width=\" + (options.width || width);\n\t\tnewContent += \", height=\" + (options.height || height);\n\t\tif (options.scale || scale) {\n\t\t\tnewContent += \", initial-scale=\" + (options.scale || scale);\n\t\t}\n\t\tif (options.scalable || scalable) {\n\t\t\tnewContent += \", user-scalable=\" + (options.scalable || scalable);\n\t\t}\n\n\t\tif (!$viewport) {\n\t\t\t$viewport = this.document.createElement(\"meta\");\n\t\t\t$viewport.setAttribute(\"name\", \"viewport\");\n\t\t\tthis.document.querySelector('head').appendChild($viewport);\n\t\t}\n\n\t\t$viewport.setAttribute(\"content\", newContent);\n\t}\n\n\n\treturn {\n\t\twidth: parseInt(width),\n\t\theight: parseInt(height)\n\t};\n};\n\n\n// Contents.prototype.layout = function(layoutFunc) {\n//\n// this.iframe.style.display = \"inline-block\";\n//\n// // Reset Body Styles\n// this.content.style.margin = \"0\";\n// //this.document.body.style.display = \"inline-block\";\n// //this.document.documentElement.style.width = \"auto\";\n//\n// if(layoutFunc){\n// layoutFunc(this);\n// }\n//\n// this.onLayout(this);\n//\n// };\n//\n// Contents.prototype.onLayout = function(view) {\n// // stub\n// };\n\nContents.prototype.expand = function() {\n\tthis.emit(\"expand\");\n};\n\nContents.prototype.listeners = function() {\n\n\tthis.imageLoadListeners();\n\n\tthis.mediaQueryListeners();\n\n\t// this.fontLoadListeners();\n\n\tthis.addEventListeners();\n\n\tthis.addSelectionListeners();\n\n\tthis.resizeListeners();\n\n};\n\nContents.prototype.removeListeners = function() {\n\n\tthis.removeEventListeners();\n\n\tthis.removeSelectionListeners();\n};\n\nContents.prototype.resizeListeners = function() {\n\tvar width, height;\n\t// Test size again\n\tclearTimeout(this.expanding);\n\n\twidth = this.scrollWidth();\n\theight = this.scrollHeight();\n\n\tif (width != this._size.width || height != this._size.height) {\n\n\t\tthis._size = {\n\t\t\twidth: width,\n\t\t\theight: height\n\t\t}\n\n\t\tthis.emit(\"resize\", this._size);\n\t}\n\n\tthis.expanding = setTimeout(this.resizeListeners.bind(this), 350);\n};\n\n//https://github.com/tylergaw/media-query-events/blob/master/js/mq-events.js\nContents.prototype.mediaQueryListeners = function() {\n\t\tvar sheets = this.document.styleSheets;\n\t\tvar mediaChangeHandler = function(m){\n\t\t\tif(m.matches && !this._expanding) {\n\t\t\t\tsetTimeout(this.expand.bind(this), 1);\n\t\t\t\t// this.expand();\n\t\t\t}\n\t\t}.bind(this);\n\n\t\tfor (var i = 0; i < sheets.length; i += 1) {\n\t\t\t\tvar rules;\n\t\t\t\t// Firefox errors if we access cssRules cross-domain\n\t\t\t\ttry {\n\t\t\t\t\trules = sheets[i].cssRules;\n\t\t\t\t} catch (e) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif(!rules) return; // Stylesheets changed\n\t\t\t\tfor (var j = 0; j < rules.length; j += 1) {\n\t\t\t\t\t\t//if (rules[j].constructor === CSSMediaRule) {\n\t\t\t\t\t\tif(rules[j].media){\n\t\t\t\t\t\t\t\tvar mql = this.window.matchMedia(rules[j].media.mediaText);\n\t\t\t\t\t\t\t\tmql.addListener(mediaChangeHandler);\n\t\t\t\t\t\t\t\t//mql.onchange = mediaChangeHandler;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n};\n\nContents.prototype.observe = function(target) {\n\tvar renderer = this;\n\n\t// create an observer instance\n\tvar observer = new MutationObserver(function(mutations) {\n\t\tif(renderer._expanding) {\n\t\t\trenderer.expand();\n\t\t}\n\t\t// mutations.forEach(function(mutation) {\n\t\t// console.log(mutation);\n\t\t// });\n\t});\n\n\t// configuration of the observer:\n\tvar config = { attributes: true, childList: true, characterData: true, subtree: true };\n\n\t// pass in the target node, as well as the observer options\n\tobserver.observe(target, config);\n\n\treturn observer;\n};\n\nContents.prototype.imageLoadListeners = function(target) {\n\tvar images = this.document.querySelectorAll(\"img\");\n\tvar img;\n\tfor (var i = 0; i < images.length; i++) {\n\t\timg = images[i];\n\n\t\tif (typeof img.naturalWidth !== \"undefined\" &&\n\t\t\t\timg.naturalWidth === 0) {\n\t\t\timg.onload = this.expand.bind(this);\n\t\t}\n\t}\n};\n\nContents.prototype.fontLoadListeners = function(target) {\n\tif (!this.document || !this.document.fonts) {\n\t\treturn;\n\t}\n\n\tthis.document.fonts.ready.then(function () {\n\t\tthis.expand();\n\t}.bind(this));\n\n};\n\nContents.prototype.root = function() {\n\tif(!this.document) return null;\n\treturn this.document.documentElement;\n};\n\nContents.prototype.locationOf = function(target, ignoreClass) {\n\tvar position;\n\tvar targetPos = {\"left\": 0, \"top\": 0};\n\n\tif(!this.document) return;\n\n\tif(this.epubcfi.isCfiString(target)) {\n\t\trange = new EpubCFI(target).toRange(this.document, ignoreClass);\n\n\t\tif(range) {\n\t\t\tif (range.startContainer.nodeType === Node.ELEMENT_NODE) {\n\t\t\t\tposition = range.startContainer.getBoundingClientRect();\n\t\t\t\ttargetPos.left = position.left;\n\t\t\t\ttargetPos.top = position.top;\n\t\t\t} else {\n\t\t\t\tposition = range.getBoundingClientRect();\n\t\t\t\ttargetPos.left = position.left;\n\t\t\t\ttargetPos.top = position.top;\n\t\t\t}\n\t\t}\n\n\t} else if(typeof target === \"string\" &&\n\t\ttarget.indexOf(\"#\") > -1) {\n\n\t\tid = target.substring(target.indexOf(\"#\")+1);\n\t\tel = this.document.getElementById(id);\n\n\t\tif(el) {\n\t\t\tposition = el.getBoundingClientRect();\n\t\t\ttargetPos.left = position.left;\n\t\t\ttargetPos.top = position.top;\n\t\t}\n\t}\n\n\treturn targetPos;\n};\n\nContents.prototype.addStylesheet = function(src) {\n\treturn new Promise(function(resolve, reject){\n\t\tvar $stylesheet;\n\t\tvar ready = false;\n\n\t\tif(!this.document) {\n\t\t\tresolve(false);\n\t\t\treturn;\n\t\t}\n\n\t\t$stylesheet = this.document.createElement('link');\n\t\t$stylesheet.type = 'text/css';\n\t\t$stylesheet.rel = \"stylesheet\";\n\t\t$stylesheet.href = src;\n\t\t$stylesheet.onload = $stylesheet.onreadystatechange = function() {\n\t\t\tif ( !ready && (!this.readyState || this.readyState == 'complete') ) {\n\t\t\t\tready = true;\n\t\t\t\t// Let apply\n\t\t\t\tsetTimeout(function(){\n\t\t\t\t\tresolve(true);\n\t\t\t\t}, 1);\n\t\t\t}\n\t\t};\n\n\t\tthis.document.head.appendChild($stylesheet);\n\n\t}.bind(this));\n};\n\n// https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/insertRule\nContents.prototype.addStylesheetRules = function(rules) {\n\tvar styleEl;\n\tvar styleSheet;\n\n\tif(!this.document) return;\n\n\tstyleEl = this.document.createElement('style');\n\n\t// Append style element to head\n\tthis.document.head.appendChild(styleEl);\n\n\t// Grab style sheet\n\tstyleSheet = styleEl.sheet;\n\n\tfor (var i = 0, rl = rules.length; i < rl; i++) {\n\t\tvar j = 1, rule = rules[i], selector = rules[i][0], propStr = '';\n\t\t// If the second argument of a rule is an array of arrays, correct our variables.\n\t\tif (Object.prototype.toString.call(rule[1][0]) === '[object Array]') {\n\t\t\trule = rule[1];\n\t\t\tj = 0;\n\t\t}\n\n\t\tfor (var pl = rule.length; j < pl; j++) {\n\t\t\tvar prop = rule[j];\n\t\t\tpropStr += prop[0] + ':' + prop[1] + (prop[2] ? ' !important' : '') + ';\\n';\n\t\t}\n\n\t\t// Insert CSS Rule\n\t\tstyleSheet.insertRule(selector + '{' + propStr + '}', styleSheet.cssRules.length);\n\t}\n};\n\nContents.prototype.addScript = function(src) {\n\n\treturn new Promise(function(resolve, reject){\n\t\tvar $script;\n\t\tvar ready = false;\n\n\t\tif(!this.document) {\n\t\t\tresolve(false);\n\t\t\treturn;\n\t\t}\n\n\t\t$script = this.document.createElement('script');\n\t\t$script.type = 'text/javascript';\n\t\t$script.async = true;\n\t\t$script.src = src;\n\t\t$script.onload = $script.onreadystatechange = function() {\n\t\t\tif ( !ready && (!this.readyState || this.readyState == 'complete') ) {\n\t\t\t\tready = true;\n\t\t\t\tsetTimeout(function(){\n\t\t\t\t\tresolve(true);\n\t\t\t\t}, 1);\n\t\t\t}\n\t\t};\n\n\t\tthis.document.head.appendChild($script);\n\n\t}.bind(this));\n};\n\nContents.prototype.addEventListeners = function(){\n\tif(!this.document) {\n\t\treturn;\n\t}\n\tthis.listenedEvents.forEach(function(eventName){\n\t\tthis.document.addEventListener(eventName, this.triggerEvent.bind(this), false);\n\t}, this);\n\n};\n\nContents.prototype.removeEventListeners = function(){\n\tif(!this.document) {\n\t\treturn;\n\t}\n\tthis.listenedEvents.forEach(function(eventName){\n\t\tthis.document.removeEventListener(eventName, this.triggerEvent, false);\n\t}, this);\n\n};\n\n// Pass browser events\nContents.prototype.triggerEvent = function(e){\n\tthis.emit(e.type, e);\n};\n\nContents.prototype.addSelectionListeners = function(){\n\tif(!this.document) {\n\t\treturn;\n\t}\n\tthis.document.addEventListener(\"selectionchange\", this.onSelectionChange.bind(this), false);\n};\n\nContents.prototype.removeSelectionListeners = function(){\n\tif(!this.document) {\n\t\treturn;\n\t}\n\tthis.document.removeEventListener(\"selectionchange\", this.onSelectionChange, false);\n};\n\nContents.prototype.onSelectionChange = function(e){\n\tif (this.selectionEndTimeout) {\n\t\tclearTimeout(this.selectionEndTimeout);\n\t}\n\tthis.selectionEndTimeout = setTimeout(function() {\n\t\tvar selection = this.window.getSelection();\n\t\tthis.triggerSelectedEvent(selection);\n\t}.bind(this), 500);\n};\n\nContents.prototype.triggerSelectedEvent = function(selection){\n\tvar range, cfirange;\n\n\tif (selection && selection.rangeCount > 0) {\n\t\trange = selection.getRangeAt(0);\n\t\tif(!range.collapsed) {\n\t\t\t// cfirange = this.section.cfiFromRange(range);\n\t\t\tcfirange = new EpubCFI(range, this.cfiBase).toString();\n\t\t\tthis.emit(\"selected\", cfirange);\n\t\t\tthis.emit(\"selectedRange\", range);\n\t\t}\n\t}\n};\n\nContents.prototype.range = function(_cfi, ignoreClass){\n\tvar cfi = new EpubCFI(_cfi);\n\treturn cfi.toRange(this.document, ignoreClass);\n};\n\nContents.prototype.map = function(layout){\n\tvar map = new Mapping(layout);\n\treturn map.section();\n};\n\nContents.prototype.size = function(width, height){\n\n\tif (width >= 0) {\n\t\tthis.width(width);\n\t}\n\n\tif (height >= 0) {\n\t\tthis.height(height);\n\t}\n\n\tthis.css(\"margin\", \"0\");\n\tthis.css(\"boxSizing\", \"border-box\");\n\n};\n\nContents.prototype.columns = function(width, height, columnWidth, gap){\n\tvar COLUMN_AXIS = core.prefixed('columnAxis');\n\tvar COLUMN_GAP = core.prefixed('columnGap');\n\tvar COLUMN_WIDTH = core.prefixed('columnWidth');\n\tvar COLUMN_FILL = core.prefixed('columnFill');\n\tvar textWidth;\n\n\tthis.width(width);\n\tthis.height(height);\n\n\t// Deal with Mobile trying to scale to viewport\n\tthis.viewport({ width: width, height: height, scale: 1.0 });\n\n\t// this.overflowY(\"hidden\");\n\tthis.css(\"overflowY\", \"hidden\");\n\tthis.css(\"margin\", \"0\");\n\tthis.css(\"boxSizing\", \"border-box\");\n\tthis.css(\"maxWidth\", \"inherit\");\n\n\tthis.css(COLUMN_AXIS, \"horizontal\");\n\tthis.css(COLUMN_FILL, \"auto\");\n\n\tthis.css(COLUMN_GAP, gap+\"px\");\n\tthis.css(COLUMN_WIDTH, columnWidth+\"px\");\n};\n\nContents.prototype.scale = function(scale, offsetX, offsetY){\n\tvar scale = \"scale(\" + scale + \")\";\n\tvar translate = '';\n\t// this.css(\"position\", \"absolute\"));\n\tthis.css(\"transformOrigin\", \"top left\");\n\n\tif (offsetX >= 0 || offsetY >= 0) {\n\t\ttranslate = \" translate(\" + (offsetX || 0 )+ \"px, \" + (offsetY || 0 )+ \"px )\";\n\t}\n\n\tthis.css(\"transform\", scale + translate);\n};\n\nContents.prototype.fit = function(width, height){\n\tvar viewport = this.viewport();\n\tvar widthScale = width / viewport.width;\n\tvar heightScale = height / viewport.height;\n\tvar scale = widthScale < heightScale ? widthScale : heightScale;\n\n\tvar offsetY = (height - (viewport.height * scale)) / 2;\n\n\tthis.width(width);\n\tthis.height(height);\n\tthis.overflow(\"hidden\");\n\n\t// Deal with Mobile trying to scale to viewport\n\tthis.viewport({ scale: 1.0 });\n\n\t// Scale to the correct size\n\tthis.scale(scale, 0, offsetY);\n\n\tthis.css(\"backgroundColor\", \"transparent\");\n};\n\nContents.prototype.mapPage = function(cfiBase, start, end) {\n\tvar mapping = new Mapping();\n\n\treturn mapping.page(this, cfiBase, start, end);\n};\n\nContents.prototype.destroy = function() {\n\t// Stop observing\n\tif(this.observer) {\n\t\tthis.observer.disconnect();\n\t}\n\n\tthis.removeListeners();\n\n};\n\nEventEmitter(Contents.prototype);\n\nmodule.exports = Contents;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/contents.js\n// module id = 10\n// module chunks = 0","var EventEmitter = require('event-emitter');\nvar core = require('../../core');\nvar EpubCFI = require('../../epubcfi');\nvar Mapping = require('../../mapping');\nvar Queue = require('../../queue');\nvar Stage = require('../helpers/stage');\nvar Views = require('../helpers/views');\n\nfunction DefaultViewManager(options) {\n\n\tthis.name = \"default\";\n\tthis.View = options.view;\n\tthis.request = options.request;\n\tthis.renditionQueue = options.queue;\n\tthis.q = new Queue(this);\n\n\tthis.settings = core.extend(this.settings || {}, {\n\t\tinfinite: true,\n\t\thidden: false,\n\t\twidth: undefined,\n\t\theight: undefined,\n\t\t// globalLayoutProperties : { layout: 'reflowable', spread: 'auto', orientation: 'auto'},\n\t\t// layout: null,\n\t\taxis: \"vertical\",\n\t\tignoreClass: ''\n\t});\n\n\tcore.extend(this.settings, options.settings || {});\n\n\tthis.viewSettings = {\n\t\tignoreClass: this.settings.ignoreClass,\n\t\taxis: this.settings.axis,\n\t\tlayout: this.layout,\n\t\twidth: 0,\n\t\theight: 0\n\t};\n\n}\n\nDefaultViewManager.prototype.render = function(element, size){\n\n\t// Save the stage\n\tthis.stage = new Stage({\n\t\twidth: size.width,\n\t\theight: size.height,\n\t\toverflow: this.settings.overflow,\n\t\thidden: this.settings.hidden,\n\t\taxis: this.settings.axis\n\t});\n\n\tthis.stage.attachTo(element);\n\n\t// Get this stage container div\n\tthis.container = this.stage.getContainer();\n\n\t// Views array methods\n\tthis.views = new Views(this.container);\n\n\t// Calculate Stage Size\n\tthis._bounds = this.bounds();\n\tthis._stageSize = this.stage.size();\n\n\t// Set the dimensions for views\n\tthis.viewSettings.width = this._stageSize.width;\n\tthis.viewSettings.height = this._stageSize.height;\n\n\t// Function to handle a resize event.\n\t// Will only attach if width and height are both fixed.\n\tthis.stage.onResize(this.onResized.bind(this));\n\n\t// Add Event Listeners\n\tthis.addEventListeners();\n\n\t// Add Layout method\n\t// this.applyLayoutMethod();\n\tif (this.layout) {\n\t\tthis.updateLayout();\n\t}\n};\n\nDefaultViewManager.prototype.addEventListeners = function(){\n\twindow.addEventListener('unload', function(e){\n\t\tthis.destroy();\n\t}.bind(this));\n};\n\nDefaultViewManager.prototype.destroy = function(){\n\t// this.views.each(function(view){\n\t// \tview.destroy();\n\t// });\n\n\t/*\n\n\t\tclearTimeout(this.trimTimeout);\n\t\tif(this.settings.hidden) {\n\t\t\tthis.element.removeChild(this.wrapper);\n\t\t} else {\n\t\t\tthis.element.removeChild(this.container);\n\t\t}\n\t*/\n};\n\nDefaultViewManager.prototype.onResized = function(e) {\n\tclearTimeout(this.resizeTimeout);\n\tthis.resizeTimeout = setTimeout(function(){\n\t\tthis.resize();\n\t}.bind(this), 150);\n};\n\nDefaultViewManager.prototype.resize = function(width, height){\n\n\t// Clear the queue\n\tthis.q.clear();\n\n\tthis._stageSize = this.stage.size(width, height);\n\tthis._bounds = this.bounds();\n\n\t// Update for new views\n\tthis.viewSettings.width = this._stageSize.width;\n\tthis.viewSettings.height = this._stageSize.height;\n\n\t// Update for existing views\n\tthis.views.each(function(view) {\n\t\tview.size(this._stageSize.width, this._stageSize.height);\n\t}.bind(this));\n\n\tthis.updateLayout();\n\n\tthis.emit(\"resized\", {\n\t\twidth: this.stage.width,\n\t\theight: this.stage.height\n\t});\n\n};\n\nDefaultViewManager.prototype.createView = function(section) {\n\treturn new this.View(section, this.viewSettings);\n};\n\nDefaultViewManager.prototype.display = function(section, target){\n\n\tvar displaying = new core.defer();\n\tvar displayed = displaying.promise;\n\n\t// Check to make sure the section we want isn't already shown\n\tvar visible = this.views.find(section);\n\n\t// View is already shown, just move to correct location\n\tif(visible && target) {\n\t\toffset = visible.locationOf(target);\n\t\tthis.moveTo(offset);\n\t\tdisplaying.resolve();\n\t\treturn displayed;\n\t}\n\n\t// Hide all current views\n\tthis.views.hide();\n\n\tthis.views.clear();\n\n\tthis.add(section)\n\t\t.then(function(view){\n\n\t\t\t// Move to correct place within the section, if needed\n\t\t\tif(target) {\n\t\t\t\toffset = view.locationOf(target);\n\t\t\t\tthis.moveTo(offset);\n\t\t\t}\n\n\t\t}.bind(this))\n\t\t.then(function(){\n\t\t\tvar next;\n\t\t\tif (this.layout.name === \"pre-paginated\" &&\n\t\t\t\t\tthis.layout.divisor > 1) {\n\t\t\t\tnext = section.next();\n\t\t\t\tif (next) {\n\t\t\t\t\treturn this.add(next);\n\t\t\t\t}\n\t\t\t}\n\t\t}.bind(this))\n\t\t.then(function(){\n\n\t\t\tthis.views.show();\n\n\t\t\tdisplaying.resolve();\n\n\t\t}.bind(this))\n\t\t// .then(function(){\n\t\t// \treturn this.hooks.display.trigger(view);\n\t\t// }.bind(this))\n\t\t// .then(function(){\n\t\t// \tthis.views.show();\n\t\t// }.bind(this));\n\t\treturn displayed;\n};\n\nDefaultViewManager.prototype.afterDisplayed = function(view){\n\tthis.emit(\"added\", view);\n};\n\nDefaultViewManager.prototype.afterResized = function(view){\n\tthis.emit(\"resize\", view.section);\n};\n\n// DefaultViewManager.prototype.moveTo = function(offset){\n// \tthis.scrollTo(offset.left, offset.top);\n// };\n\nDefaultViewManager.prototype.moveTo = function(offset){\n\tvar distX = 0,\n\t\t\tdistY = 0;\n\n\tif(this.settings.axis === \"vertical\") {\n\t\tdistY = offset.top;\n\t} else {\n\t\tdistX = Math.floor(offset.left / this.layout.delta) * this.layout.delta;\n\n\t\tif (distX + this.layout.delta > this.container.scrollWidth) {\n\t\t\tdistX = this.container.scrollWidth - this.layout.delta;\n\t\t}\n\t}\n\n\tthis.scrollTo(distX, distY);\n};\n\nDefaultViewManager.prototype.add = function(section){\n\tvar view = this.createView(section);\n\n\tthis.views.append(view);\n\n\t// view.on(\"shown\", this.afterDisplayed.bind(this));\n\tview.onDisplayed = this.afterDisplayed.bind(this);\n\tview.onResize = this.afterResized.bind(this);\n\n\treturn view.display(this.request);\n\n};\n\nDefaultViewManager.prototype.append = function(section){\n\tvar view = this.createView(section);\n\tthis.views.append(view);\n\treturn view.display(this.request);\n};\n\nDefaultViewManager.prototype.prepend = function(section){\n\tvar view = this.createView(section);\n\n\tthis.views.prepend(view);\n\treturn view.display(this.request);\n};\n// DefaultViewManager.prototype.resizeView = function(view) {\n//\n// \tif(this.settings.globalLayoutProperties.layout === \"pre-paginated\") {\n// \t\tview.lock(\"both\", this.bounds.width, this.bounds.height);\n// \t} else {\n// \t\tview.lock(\"width\", this.bounds.width, this.bounds.height);\n// \t}\n//\n// };\n\nDefaultViewManager.prototype.next = function(){\n\tvar next;\n\tvar view;\n\tvar left;\n\n\tif(!this.views.length) return;\n\n\tif(this.settings.axis === \"horizontal\") {\n\n\t\tthis.scrollLeft = this.container.scrollLeft;\n\n\t\tleft = this.container.scrollLeft + this.container.offsetWidth + this.layout.delta;\n\n\t\tif(left < this.container.scrollWidth) {\n\t\t\tthis.scrollBy(this.layout.delta, 0);\n\t\t} else if (left - this.layout.columnWidth === this.container.scrollWidth) {\n\t\t\tthis.scrollTo(this.container.scrollWidth - this.layout.delta, 0);\n\t\t} else {\n\t\t\tnext = this.views.last().section.next();\n\t\t}\n\n\n\t} else {\n\n\t\tnext = this.views.last().section.next();\n\n\t}\n\n\tif(next) {\n\t\tthis.views.clear();\n\n\t\treturn this.append(next)\n\t\t\t.then(function(){\n\t\t\t\tvar right;\n\t\t\t\tif (this.layout.name && this.layout.divisor > 1) {\n\t\t\t\t\tright = next.next();\n\t\t\t\t\tif (right) {\n\t\t\t\t\t\treturn this.append(right);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}.bind(this))\n\t\t\t.then(function(){\n\t\t\t\tthis.views.show();\n\t\t\t}.bind(this));\n\t}\n\n\n};\n\nDefaultViewManager.prototype.prev = function(){\n\tvar prev;\n\tvar view;\n\tvar left;\n\n\tif(!this.views.length) return;\n\n\tif(this.settings.axis === \"horizontal\") {\n\n\t\tthis.scrollLeft = this.container.scrollLeft;\n\n\t\tleft = this.container.scrollLeft;\n\n\t\tif(left > 0) {\n\t\t\tthis.scrollBy(-this.layout.delta, 0);\n\t\t} else {\n\t\t\tprev = this.views.first().section.prev();\n\t\t}\n\n\n\t} else {\n\n\t\tprev = this.views.first().section.prev();\n\n\t}\n\n\tif(prev) {\n\t\tthis.views.clear();\n\n\t\treturn this.prepend(prev)\n\t\t\t.then(function(){\n\t\t\t\tvar left;\n\t\t\t\tif (this.layout.name && this.layout.divisor > 1) {\n\t\t\t\t\tleft = prev.prev();\n\t\t\t\t\tif (left) {\n\t\t\t\t\t\treturn this.prepend(left);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}.bind(this))\n\t\t\t.then(function(){\n\t\t\t\tif(this.settings.axis === \"horizontal\") {\n\t\t\t\t\tthis.scrollTo(this.container.scrollWidth - this.layout.delta, 0);\n\t\t\t\t}\n\t\t\t\tthis.views.show();\n\t\t\t}.bind(this));\n\t}\n};\n\nDefaultViewManager.prototype.current = function(){\n\tvar visible = this.visible();\n\tif(visible.length){\n\t\t// Current is the last visible view\n\t\treturn visible[visible.length-1];\n\t}\n\treturn null;\n};\n\nDefaultViewManager.prototype.currentLocation = function(){\n\n\tif (this.settings.axis === \"vertical\") {\n\t\tthis.location = this.scrolledLocation();\n\t} else {\n\t\tthis.location = this.paginatedLocation();\n\t}\n\treturn this.location;\n};\n\nDefaultViewManager.prototype.scrolledLocation = function(){\n\tvar view;\n\n\tif(this.views.length) {\n\t\tview = this.views.first();\n\t\treturn this.mapping.page(view, view.section.cfiBase);\n\t}\n\n};\n\nDefaultViewManager.prototype.paginatedLocation = function(){\n\tvar view;\n\tvar start, end;\n\n\tif(this.views.length) {\n\t\tview = this.views.first();\n\t\tstart = this._bounds.left - view.position().left;\n\t\tend = start + this.layout.spreadWidth;\n\t\treturn this.mapping.page(view, view.section.cfiBase, start, end);\n\t}\n\n};\n\nDefaultViewManager.prototype.isVisible = function(view, offsetPrev, offsetNext, _container){\n\tvar position = view.position();\n\tvar container = _container || this.bounds();\n\n\tif(this.settings.axis === \"horizontal\" &&\n\t\tposition.right > container.left - offsetPrev &&\n\t\tposition.left < container.right + offsetNext) {\n\n\t\treturn true;\n\n\t} else if(this.settings.axis === \"vertical\" &&\n\t\tposition.bottom > container.top - offsetPrev &&\n\t\tposition.top < container.bottom + offsetNext) {\n\n\t\treturn true;\n\t}\n\n\treturn false;\n\n};\n\nDefaultViewManager.prototype.visible = function(){\n\t// return this.views.displayed();\n\tvar container = this.bounds();\n\tvar views = this.views.displayed();\n\tvar viewsLength = views.length;\n\tvar visible = [];\n\tvar isVisible;\n\tvar view;\n\n\tfor (var i = 0; i < viewsLength; i++) {\n\t\tview = views[i];\n\t\tisVisible = this.isVisible(view, 0, 0, container);\n\n\t\tif(isVisible === true) {\n\t\t\tvisible.push(view);\n\t\t}\n\n\t}\n\treturn visible;\n};\n\nDefaultViewManager.prototype.scrollBy = function(x, y, silent){\n\tif(silent) {\n\t\tthis.ignore = true;\n\t}\n\n\tif(this.settings.height) {\n\n\t\tif(x) this.container.scrollLeft += x;\n\t\tif(y) this.container.scrollTop += y;\n\n\t} else {\n\t\twindow.scrollBy(x,y);\n\t}\n\t// console.log(\"scrollBy\", x, y);\n\tthis.scrolled = true;\n\tthis.onScroll();\n};\n\nDefaultViewManager.prototype.scrollTo = function(x, y, silent){\n\tif(silent) {\n\t\tthis.ignore = true;\n\t}\n\n\tif(this.settings.height) {\n\t\tthis.container.scrollLeft = x;\n\t\tthis.container.scrollTop = y;\n\t} else {\n\t\twindow.scrollTo(x,y);\n\t}\n\t// console.log(\"scrollTo\", x, y);\n\tthis.scrolled = true;\n\tthis.onScroll();\n\t// if(this.container.scrollLeft != x){\n\t// setTimeout(function() {\n\t// this.scrollTo(x, y, silent);\n\t// }.bind(this), 10);\n\t// return;\n\t// };\n };\n\nDefaultViewManager.prototype.onScroll = function(){\n\n};\n\nDefaultViewManager.prototype.bounds = function() {\n\tvar bounds;\n\n\tbounds = this.stage.bounds();\n\n\treturn bounds;\n};\n\nDefaultViewManager.prototype.applyLayout = function(layout) {\n\n\tthis.layout = layout;\n\tthis.updateLayout();\n\n\tthis.mapping = new Mapping(this.layout);\n\t // this.manager.layout(this.layout.format);\n};\n\nDefaultViewManager.prototype.updateLayout = function() {\n\tif (!this.stage) {\n\t\treturn;\n\t}\n\n\tthis._stageSize = this.stage.size();\n\n\tif(this.settings.axis === \"vertical\") {\n\t\tthis.layout.calculate(this._stageSize.width, this._stageSize.height);\n\t} else {\n\t\tthis.layout.calculate(\n\t\t\tthis._stageSize.width,\n\t\t\tthis._stageSize.height,\n\t\t\tthis.settings.gap\n\t\t);\n\n\t\t// Set the look ahead offset for what is visible\n\t\tthis.settings.offset = this.layout.delta;\n\n\t\tthis.stage.addStyleRules(\"iframe\", [{\"margin-right\" : this.layout.gap + \"px\"}]);\n\n\t}\n\n\t// Set the dimensions for views\n\tthis.viewSettings.width = this.layout.width;\n\tthis.viewSettings.height = this.layout.height;\n\n\tthis.setLayout(this.layout);\n\n};\n\nDefaultViewManager.prototype.setLayout = function(layout){\n\n\tthis.viewSettings.layout = layout;\n\n\tif(this.views) {\n\n\t\tthis.views.each(function(view){\n\t\t\tview.setLayout(layout);\n\t\t});\n\n\t}\n\n};\n\nDefaultViewManager.prototype.updateFlow = function(flow){\n\tvar axis = (flow === \"paginated\") ? \"horizontal\" : \"vertical\";\n\n\tthis.settings.axis = axis;\n\n\tthis.viewSettings.axis = axis;\n\n\tthis.settings.overflow = (flow === \"paginated\") ? \"hidden\" : \"auto\";\n\t// this.views.each(function(view){\n\t// \tview.setAxis(axis);\n\t// });\n\n};\n\n //-- Enable binding events to Manager\n EventEmitter(DefaultViewManager.prototype);\n\n module.exports = DefaultViewManager;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/managers/default/index.js\n// module id = 11\n// module chunks = 0","var EventEmitter = require('event-emitter');\nvar path = require('path');\nvar core = require('./core');\nvar replace = require('./replacements');\nvar Hook = require('./hook');\nvar EpubCFI = require('./epubcfi');\nvar Queue = require('./queue');\nvar Layout = require('./layout');\nvar Mapping = require('./mapping');\nvar Path = require('./core').Path;\n\n/**\n * [Rendition description]\n * @class\n * @param {Book} book\n * @param {object} options\n * @param {int} options.width\n * @param {int} options.height\n * @param {string} options.ignoreClass\n * @param {string} options.manager\n * @param {string} options.view\n * @param {string} options.layout\n * @param {string} options.spread\n * @param {int} options.minSpreadWidth overridden by spread: none (never) / both (always)\n */\nfunction Rendition(book, options) {\n\n\tthis.settings = core.extend(this.settings || {}, {\n\t\twidth: null,\n\t\theight: null,\n\t\tignoreClass: '',\n\t\tmanager: \"default\",\n\t\tview: \"iframe\",\n\t\tflow: null,\n\t\tlayout: null,\n\t\tspread: null,\n\t\tminSpreadWidth: 800\n\t});\n\n\tcore.extend(this.settings, options);\n\n\tif (typeof(this.settings.manager) === \"object\") {\n\t\tthis.manager = this.settings.manager;\n\t}\n\n\tthis.viewSettings = {\n\t\tignoreClass: this.settings.ignoreClass\n\t};\n\n\tthis.book = book;\n\n\tthis.views = null;\n\n\t/**\n\t * Adds Hook methods to the Rendition prototype\n\t * @property {Hook} hooks\n\t */\n\tthis.hooks = {};\n\tthis.hooks.display = new Hook(this);\n\tthis.hooks.serialize = new Hook(this);\n\t/**\n\t * @property {method} hooks.content\n\t * @type {Hook}\n\t */\n\tthis.hooks.content = new Hook(this);\n\tthis.hooks.layout = new Hook(this);\n\tthis.hooks.render = new Hook(this);\n\tthis.hooks.show = new Hook(this);\n\n\tthis.hooks.content.register(replace.links.bind(this));\n\tthis.hooks.content.register(this.passViewEvents.bind(this));\n\n\t// this.hooks.display.register(this.afterDisplay.bind(this));\n\n\tthis.epubcfi = new EpubCFI();\n\n\tthis.q = new Queue(this);\n\n\tthis.q.enqueue(this.book.opened);\n\n\t// Block the queue until rendering is started\n\tthis.starting = new core.defer();\n\tthis.started = this.starting.promise;\n\tthis.q.enqueue(this.start);\n};\n\n/**\n * Set the manager function\n * @param {function} manager\n */\nRendition.prototype.setManager = function(manager) {\n\tthis.manager = manager;\n};\n\n/**\n * Require the manager from passed string, or as a function\n * @param {string|function} manager [description]\n * @return {method}\n */\nRendition.prototype.requireManager = function(manager) {\n\tvar viewManager;\n\n\t// If manager is a string, try to load from register managers,\n\t// or require included managers directly\n\tif (typeof manager === \"string\") {\n\t\t// Use global or require\n\t\tviewManager = typeof ePub != \"undefined\" ? ePub.ViewManagers[manager] : undefined; //require('./managers/'+manager);\n\t} else {\n\t\t// otherwise, assume we were passed a function\n\t\tviewManager = manager\n\t}\n\n\treturn viewManager;\n};\n\n/**\n * Require the view from passed string, or as a function\n * @param {string|function} view\n * @return {view}\n */\nRendition.prototype.requireView = function(view) {\n\tvar View;\n\n\tif (typeof view == \"string\") {\n\t\tView = typeof ePub != \"undefined\" ? ePub.Views[view] : undefined; //require('./views/'+view);\n\t} else {\n\t\t// otherwise, assume we were passed a function\n\t\tView = view\n\t}\n\n\treturn View;\n};\n\n/**\n * Start the rendering\n * @return {Promise} rendering has started\n */\nRendition.prototype.start = function(){\n\n\tif(!this.manager) {\n\t\tthis.ViewManager = this.requireManager(this.settings.manager);\n\t\tthis.View = this.requireView(this.settings.view);\n\n\t\tthis.manager = new this.ViewManager({\n\t\t\tview: this.View,\n\t\t\tqueue: this.q,\n\t\t\trequest: this.book.load.bind(this.book),\n\t\t\tsettings: this.settings\n\t\t});\n\t}\n\n\t// Parse metadata to get layout props\n\tthis.settings.globalLayoutProperties = this.determineLayoutProperties(this.book.package.metadata);\n\n\tthis.flow(this.settings.globalLayoutProperties.flow);\n\n\tthis.layout(this.settings.globalLayoutProperties);\n\n\t// Listen for displayed views\n\tthis.manager.on(\"added\", this.afterDisplayed.bind(this));\n\n\t// Listen for resizing\n\tthis.manager.on(\"resized\", this.onResized.bind(this));\n\n\t// Listen for scroll changes\n\tthis.manager.on(\"scroll\", this.reportLocation.bind(this));\n\n\n\tthis.on('displayed', this.reportLocation.bind(this));\n\n\t// Trigger that rendering has started\n\tthis.emit(\"started\");\n\n\t// Start processing queue\n\tthis.starting.resolve();\n};\n\n/**\n * Call to attach the container to an element in the dom\n * Container must be attached before rendering can begin\n * @param {element} element to attach to\n * @return {Promise}\n */\nRendition.prototype.attachTo = function(element){\n\n\treturn this.q.enqueue(function () {\n\n\t\t// Start rendering\n\t\tthis.manager.render(element, {\n\t\t\t\"width\" : this.settings.width,\n\t\t\t\"height\" : this.settings.height\n\t\t});\n\n\t\t// Trigger Attached\n\t\tthis.emit(\"attached\");\n\n\t}.bind(this));\n\n};\n\n/**\n * Display a point in the book\n * The request will be added to the rendering Queue,\n * so it will wait until book is opened, rendering started\n * and all other rendering tasks have finished to be called.\n * @param {string} target Url or EpubCFI\n * @return {Promise}\n */\nRendition.prototype.display = function(target){\n\n\t// if (!this.book.spine.spineItems.length > 0) {\n\t\t// Book isn't open yet\n\t\t// return this.q.enqueue(this.display, target);\n\t// }\n\n\treturn this.q.enqueue(this._display, target);\n\n};\n\n/**\n * Tells the manager what to display immediately\n * @private\n * @param {string} target Url or EpubCFI\n * @return {Promise}\n */\nRendition.prototype._display = function(target){\n\tvar isCfiString = this.epubcfi.isCfiString(target);\n\tvar displaying = new core.defer();\n\tvar displayed = displaying.promise;\n\tvar section;\n\tvar moveTo;\n\n\tsection = this.book.spine.get(target);\n\n\tif(!section){\n\t\tdisplaying.reject(new Error(\"No Section Found\"));\n\t\treturn displayed;\n\t}\n\n\t// Trim the target fragment\n\t// removing the chapter\n\tif(!isCfiString && typeof target === \"string\" &&\n\t\ttarget.indexOf(\"#\") > -1) {\n\t\t\tmoveTo = target.substring(target.indexOf(\"#\")+1);\n\t}\n\n\tif (isCfiString) {\n\t\tmoveTo = target;\n\t}\n\n\treturn this.manager.display(section, moveTo)\n\t\t.then(function(){\n\t\t\tthis.emit(\"displayed\", section);\n\t\t}.bind(this));\n\n};\n\n/*\nRendition.prototype.render = function(view, show) {\n\n\t// view.onLayout = this.layout.format.bind(this.layout);\n\tview.create();\n\n\t// Fit to size of the container, apply padding\n\tthis.manager.resizeView(view);\n\n\t// Render Chain\n\treturn view.section.render(this.book.request)\n\t\t.then(function(contents){\n\t\t\treturn view.load(contents);\n\t\t}.bind(this))\n\t\t.then(function(doc){\n\t\t\treturn this.hooks.content.trigger(view, this);\n\t\t}.bind(this))\n\t\t.then(function(){\n\t\t\tthis.layout.format(view.contents);\n\t\t\treturn this.hooks.layout.trigger(view, this);\n\t\t}.bind(this))\n\t\t.then(function(){\n\t\t\treturn view.display();\n\t\t}.bind(this))\n\t\t.then(function(){\n\t\t\treturn this.hooks.render.trigger(view, this);\n\t\t}.bind(this))\n\t\t.then(function(){\n\t\t\tif(show !== false) {\n\t\t\t\tthis.q.enqueue(function(view){\n\t\t\t\t\tview.show();\n\t\t\t\t}, view);\n\t\t\t}\n\t\t\t// this.map = new Map(view, this.layout);\n\t\t\tthis.hooks.show.trigger(view, this);\n\t\t\tthis.trigger(\"rendered\", view.section);\n\n\t\t}.bind(this))\n\t\t.catch(function(e){\n\t\t\tthis.trigger(\"loaderror\", e);\n\t\t}.bind(this));\n\n};\n*/\n\n/**\n * Report what has been displayed\n * @private\n * @param {*} view\n */\nRendition.prototype.afterDisplayed = function(view){\n\tthis.hooks.content.trigger(view, this);\n\tthis.emit(\"rendered\", view.section);\n\tthis.reportLocation();\n};\n\n/**\n * Report resize events and display the last seen location\n * @private\n */\nRendition.prototype.onResized = function(size){\n\n\tif(this.location) {\n\t\tthis.display(this.location.start);\n\t}\n\n\tthis.emit(\"resized\", {\n\t\twidth: size.width,\n\t\theight: size.height\n\t});\n\n};\n\n/**\n * Move the Rendition to a specific offset\n * Usually you would be better off calling display()\n * @param {object} offset\n */\nRendition.prototype.moveTo = function(offset){\n\tthis.manager.moveTo(offset);\n};\n\n/**\n * Go to the next \"page\" in the rendition\n * @return {Promise}\n */\nRendition.prototype.next = function(){\n\treturn this.q.enqueue(this.manager.next.bind(this.manager))\n\t\t.then(this.reportLocation.bind(this));\n};\n\n/**\n * Go to the previous \"page\" in the rendition\n * @return {Promise}\n */\nRendition.prototype.prev = function(){\n\treturn this.q.enqueue(this.manager.prev.bind(this.manager))\n\t\t.then(this.reportLocation.bind(this));\n};\n\n//-- http://www.idpf.org/epub/301/spec/epub-publications.html#meta-properties-rendering\n/**\n * Determine the Layout properties from metadata and settings\n * @private\n * @param {object} metadata\n * @return {object} properties\n */\nRendition.prototype.determineLayoutProperties = function(metadata){\n\tvar properties;\n\tvar layout = this.settings.layout || metadata.layout || \"reflowable\";\n\tvar spread = this.settings.spread || metadata.spread || \"auto\";\n\tvar orientation = this.settings.orientation || metadata.orientation || \"auto\";\n\tvar flow = this.settings.flow || metadata.flow || \"auto\";\n\tvar viewport = metadata.viewport || \"\";\n\tvar minSpreadWidth = this.settings.minSpreadWidth || metadata.minSpreadWidth || 800;\n\n\tif (this.settings.width >= 0 && this.settings.height >= 0) {\n\t\tviewport = \"width=\"+this.settings.width+\", height=\"+this.settings.height+\"\";\n\t}\n\n\tproperties = {\n\t\tlayout : layout,\n\t\tspread : spread,\n\t\torientation : orientation,\n\t\tflow : flow,\n\t\tviewport : viewport,\n\t\tminSpreadWidth : minSpreadWidth\n\t};\n\n\treturn properties;\n};\n\n// Rendition.prototype.applyLayoutProperties = function(){\n// \tvar settings = this.determineLayoutProperties(this.book.package.metadata);\n//\n// \tthis.flow(settings.flow);\n//\n// \tthis.layout(settings);\n// };\n\n/**\n * Adjust the flow of the rendition to paginated or scrolled\n * (scrolled-continuous vs scrolled-doc are handled by different view managers)\n * @param {string} flow\n */\nRendition.prototype.flow = function(flow){\n\tvar _flow;\n\tif (flow === \"scrolled-doc\" || flow === \"scrolled-continuous\") {\n\t\t_flow = \"scrolled\";\n\t}\n\n\tif (flow === \"auto\" || flow === \"paginated\") {\n\t\t_flow = \"paginated\";\n\t}\n\n\tif (this._layout) {\n\t\tthis._layout.flow(_flow);\n\t}\n\n\tif (this.manager) {\n\t\tthis.manager.updateFlow(_flow);\n\t}\n};\n\n/**\n * Adjust the layout of the rendition to reflowable or pre-paginated\n * @param {object} settings\n */\nRendition.prototype.layout = function(settings){\n\tif (settings) {\n\t\tthis._layout = new Layout(settings);\n\t\tthis._layout.spread(settings.spread, this.settings.minSpreadWidth);\n\n\t\tthis.mapping = new Mapping(this._layout);\n\t}\n\n\tif (this.manager && this._layout) {\n\t\tthis.manager.applyLayout(this._layout);\n\t}\n\n\treturn this._layout;\n};\n\n/**\n * Adjust if the rendition uses spreads\n * @param {string} spread none | auto (TODO: implement landscape, portrait, both)\n * @param {int} min min width to use spreads at\n */\nRendition.prototype.spread = function(spread, min){\n\n\tthis._layout.spread(spread, min);\n\n\tif (this.manager.isRendered()) {\n\t\tthis.manager.updateLayout();\n\t}\n};\n\n/**\n * Report the current location\n * @private\n */\nRendition.prototype.reportLocation = function(){\n\treturn this.q.enqueue(function(){\n\t\tvar location = this.manager.currentLocation();\n\t\tif (location && location.then && typeof location.then === 'function') {\n\t\t\tlocation.then(function(result) {\n\t\t\t\tthis.location = result;\n\n\t\t\t\tthis.percentage = this.book.locations.percentageFromCfi(result);\n\t\t\t\tif (this.percentage != null) {\n\t\t\t\t\tthis.location.percentage = this.percentage;\n\t\t\t\t}\n\n\t\t\t\tthis.emit(\"locationChanged\", this.location);\n\t\t\t}.bind(this));\n\t\t} else if (location) {\n\t\t\tthis.location = location;\n\t\t\tthis.percentage = this.book.locations.percentageFromCfi(location);\n\t\t\tif (this.percentage != null) {\n\t\t\t\tthis.location.percentage = this.percentage;\n\t\t\t}\n\n\t\t\tthis.emit(\"locationChanged\", this.location);\n\t\t}\n\n\t}.bind(this));\n};\n\n/**\n * Get the Current Location CFI\n * @return {EpubCFI} location (may be a promise)\n */\nRendition.prototype.currentLocation = function(){\n\tvar location = this.manager.currentLocation();\n\tif (location && location.then && typeof location.then === 'function') {\n\t\tlocation.then(function(result) {\n\t\t\tvar percentage = this.book.locations.percentageFromCfi(result);\n\t\t\tif (percentage != null) {\n\t\t\t\tresult.percentage = percentage;\n\t\t\t}\n\t\t\treturn result;\n\t\t}.bind(this));\n\t} else if (location) {\n\t\tvar percentage = this.book.locations.percentageFromCfi(location);\n\t\tif (percentage != null) {\n\t\t\tlocation.percentage = percentage;\n\t\t}\n\t\treturn location;\n\t}\n};\n\n/**\n * Remove and Clean Up the Rendition\n */\nRendition.prototype.destroy = function(){\n\t// Clear the queue\n\tthis.q.clear();\n\n\tthis.manager.destroy();\n};\n\n/**\n * Pass the events from a view\n * @private\n * @param {View} view\n */\nRendition.prototype.passViewEvents = function(view){\n\tview.contents.listenedEvents.forEach(function(e){\n\t\tview.on(e, this.triggerViewEvent.bind(this));\n\t}.bind(this));\n\n\tview.on(\"selected\", this.triggerSelectedEvent.bind(this));\n};\n\n/**\n * Emit events passed by a view\n * @private\n * @param {event} e\n */\nRendition.prototype.triggerViewEvent = function(e){\n\tthis.emit(e.type, e);\n};\n\n/**\n * Emit a selection event's CFI Range passed from a a view\n * @private\n * @param {EpubCFI} cfirange\n */\nRendition.prototype.triggerSelectedEvent = function(cfirange){\n\tthis.emit(\"selected\", cfirange);\n};\n\n/**\n * Get a Range from a Visible CFI\n * @param {string} cfi EpubCfi String\n * @param {string} ignoreClass\n * @return {range}\n */\nRendition.prototype.range = function(cfi, ignoreClass){\n\tvar _cfi = new EpubCFI(cfi);\n\tvar found = this.visible().filter(function (view) {\n\t\tif(_cfi.spinePos === view.index) return true;\n\t});\n\n\t// Should only every return 1 item\n\tif (found.length) {\n\t\treturn found[0].range(_cfi, ignoreClass);\n\t}\n};\n\n/**\n * Hook to adjust images to fit in columns\n * @param {View} view\n */\nRendition.prototype.adjustImages = function(view) {\n\n\tview.addStylesheetRules([\n\t\t\t[\"img\",\n\t\t\t\t[\"max-width\", (view.layout.spreadWidth) + \"px\"],\n\t\t\t\t[\"max-height\", (view.layout.height) + \"px\"]\n\t\t\t]\n\t]);\n\treturn new Promise(function(resolve, reject){\n\t\t// Wait to apply\n\t\tsetTimeout(function() {\n\t\t\tresolve();\n\t\t}, 1);\n\t});\n};\n\n//-- Enable binding events to Renderer\nEventEmitter(Rendition.prototype);\n\nmodule.exports = Rendition;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/rendition.js\n// module id = 12\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_13__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"xmldom\"\n// module id = 13\n// module chunks = 0","var EventEmitter = require('event-emitter');\nvar path = require('path');\nvar core = require('./core');\nvar Url = require('./core').Url;\nvar Path = require('./core').Path;\nvar Spine = require('./spine');\nvar Locations = require('./locations');\nvar Container = require('./container');\nvar Packaging = require('./packaging');\nvar Navigation = require('./navigation');\nvar Resources = require('./resources');\nvar PageList = require('./pagelist');\nvar Rendition = require('./rendition');\nvar Archive = require('./archive');\nvar request = require('./request');\nvar EpubCFI = require('./epubcfi');\n\n// Const\nvar CONTAINER_PATH = \"META-INF/container.xml\";\n\n/**\n * Creates a new Book\n * @class\n * @param {string} url\n * @param {object} options\n * @param {method} options.requestMethod a request function to use instead of the default\n * @param {boolean} [options.requestCredentials=undefined] send the xhr request withCredentials\n * @param {object} [options.requestHeaders=undefined] send the xhr request headers\n * @param {string} [options.encoding=binary] optional to pass 'binary' or base64' for archived Epubs\n * @param {string} [options.replacements=base64] use base64, blobUrl, or none for replacing assets in archived Epubs\n * @returns {Book}\n * @example new Book(\"/path/to/book.epub\", {})\n * @example new Book({ replacements: \"blobUrl\" })\n */\nfunction Book(url, options){\n\n\t// Allow passing just options to the Book\n\tif (typeof(options) === \"undefined\"\n\t\t&& typeof(url) === \"object\") {\n\t\toptions = url;\n\t\turl = undefined;\n\t}\n\n\tthis.settings = core.extend(this.settings || {}, {\n\t\trequestMethod: undefined,\n\t\trequestCredentials: undefined,\n\t\trequestHeaders: undefined,\n\t\tencoding: undefined,\n\t\treplacements: 'base64'\n\t});\n\n\tcore.extend(this.settings, options);\n\n\n\t// Promises\n\tthis.opening = new core.defer();\n\t/**\n\t * @property {promise} opened returns after the book is loaded\n\t */\n\tthis.opened = this.opening.promise;\n\tthis.isOpen = false;\n\n\tthis.loading = {\n\t\tmanifest: new core.defer(),\n\t\tspine: new core.defer(),\n\t\tmetadata: new core.defer(),\n\t\tcover: new core.defer(),\n\t\tnavigation: new core.defer(),\n\t\tpageList: new core.defer(),\n\t\tresources: new core.defer()\n\t};\n\n\tthis.loaded = {\n\t\tmanifest: this.loading.manifest.promise,\n\t\tspine: this.loading.spine.promise,\n\t\tmetadata: this.loading.metadata.promise,\n\t\tcover: this.loading.cover.promise,\n\t\tnavigation: this.loading.navigation.promise,\n\t\tpageList: this.loading.pageList.promise,\n\t\tresources: this.loading.resources.promise\n\t};\n\n\t// this.ready = RSVP.hash(this.loaded);\n\t/**\n\t * @property {promise} ready returns after the book is loaded and parsed\n\t * @private\n\t */\n\tthis.ready = Promise.all([this.loaded.manifest,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tthis.loaded.spine,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tthis.loaded.metadata,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tthis.loaded.cover,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tthis.loaded.navigation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tthis.loaded.resources ]);\n\n\n\t// Queue for methods used before opening\n\tthis.isRendered = false;\n\t// this._q = core.queue(this);\n\n\t/**\n\t * @property {method} request\n\t * @private\n\t */\n\tthis.request = this.settings.requestMethod || request;\n\n\t/**\n\t * @property {Spine} spine\n\t */\n\tthis.spine = new Spine();\n\n\t/**\n\t * @property {Locations} locations\n\t */\n\tthis.locations = new Locations(this.spine, this.load.bind(this));\n\n\t/**\n\t * @property {Navigation} navigation\n\t */\n\tthis.navigation = undefined;\n\n\t/**\n\t * @property {PageList} pagelist\n\t */\n\tthis.pageList = new PageList();\n\n\t/**\n\t * @property {Url} url\n\t * @private\n\t */\n\tthis.url = undefined;\n\n\t/**\n\t * @property {Path} path\n\t * @private\n\t */\n\tthis.path = undefined;\n\n\t/**\n\t * @property {boolean} archived\n\t * @private\n\t */\n\tthis.archived = false;\n\n\tif(url) {\n\t\tthis.open(url).catch(function (error) {\n\t\t\tvar err = new Error(\"Cannot load book at \"+ url );\n\t\t\tconsole.error(err);\n\t\t\tthis.emit(\"openFailed\", err);\n\t\t\tconsole.log(error);\n\t\t}.bind(this));\n\t}\n};\n\n/**\n * Open a epub or url\n * @param {string} input URL, Path or ArrayBuffer\n * @param {string} [what] to force opening\n * @returns {Promise} of when the book has been loaded\n * @example book.open(\"/path/to/book.epub\")\n */\nBook.prototype.open = function(input, what){\n\tvar opening;\n\tvar type = what || this.determineType(input);\n\n\tif (type === \"binary\") {\n\t\tthis.archived = true;\n\t\tthis.url = new Url(\"/\", \"\");\n\t\topening = this.openEpub(input);\n\t} else if (type === \"epub\") {\n\t\tthis.archived = true;\n\t\tthis.url = new Url(\"/\", \"\");\n\t\topening = this.request(input, 'binary')\n\t\t\t.then(this.openEpub.bind(this));\n\t} else if(type == \"opf\") {\n\t\tthis.url = new Url(input);\n\t\topening = this.openPackaging(this.url.Path.toString());\n\t} else {\n\t\tthis.url = new Url(input);\n\t\topening = this.openContainer(CONTAINER_PATH)\n\t\t\t.then(this.openPackaging.bind(this));\n\t}\n\n\treturn opening;\n};\n\n/**\n * Open an archived epub\n * @private\n * @param {binary} data\n * @param {[string]} encoding\n * @return {Promise}\n */\nBook.prototype.openEpub = function(data, encoding){\n\treturn this.unarchive(data, encoding || this.settings.encoding)\n\t\t.then(function() {\n\t\t\treturn this.openContainer(CONTAINER_PATH);\n\t\t}.bind(this))\n\t\t.then(function(packagePath) {\n\t\t\treturn this.openPackaging(packagePath);\n\t\t}.bind(this));\n};\n\n/**\n * Open the epub container\n * @private\n * @param {string} url\n * @return {string} packagePath\n */\nBook.prototype.openContainer = function(url){\n\treturn this.load(url)\n\t\t.then(function(xml) {\n\t\t\tthis.container = new Container(xml);\n\t\t\treturn this.resolve(this.container.packagePath);\n\t\t}.bind(this));\n};\n\n/**\n * Open the Open Packaging Format Xml\n * @private\n * @param {string} url\n * @return {Promise}\n */\nBook.prototype.openPackaging = function(url){\n\tvar packageUrl;\n\tthis.path = new Path(url);\n\treturn this.load(url)\n\t\t.then(function(xml) {\n\t\t\tthis.packaging = new Packaging(xml);\n\t\t\treturn this.unpack(this.packaging);\n\t\t}.bind(this));\n};\n\n/**\n * Load a resource from the Book\n * @param {string} path path to the resource to load\n * @return {Promise} returns a promise with the requested resource\n */\nBook.prototype.load = function (path) {\n\tvar resolved;\n\n\tif(this.archived) {\n\t\tresolved = this.resolve(path);\n\t\treturn this.archive.request(resolved);\n\t} else {\n\t\tresolved = this.resolve(path);\n\t\treturn this.request(resolved, null, this.settings.requestCredentials, this.settings.requestHeaders);\n\t}\n};\n\n/**\n * Resolve a path to it's absolute position in the Book\n * @param {string} path\n * @param {[boolean]} absolute force resolving the full URL\n * @return {string} the resolved path string\n */\nBook.prototype.resolve = function (path, absolute) {\n\tvar resolved = path;\n\tvar isAbsolute = (path.indexOf('://') > -1);\n\n\tif (isAbsolute) {\n\t\treturn path;\n\t}\n\n\tif (this.path) {\n\t\tresolved = this.path.resolve(path);\n\t}\n\n\tif(absolute != false && this.url) {\n\t\tresolved = this.url.resolve(resolved);\n\t}\n\n\treturn resolved;\n}\n\n/**\n * Determine the type of they input passed to open\n * @private\n * @param {string} input\n * @return {string} binary | directory | epub | opf\n */\nBook.prototype.determineType = function(input) {\n\tvar url;\n\tvar path;\n\tvar extension;\n\n\tif (typeof(input) != \"string\") {\n\t\treturn \"binary\";\n\t}\n\n\turl = new Url(input);\n\tpath = url.path();\n\textension = path.extension;\n\n\tif (!extension) {\n\t\treturn \"directory\";\n\t}\n\n\tif(extension === \"epub\"){\n\t\treturn \"epub\";\n\t}\n\n\tif(extension === \"opf\"){\n\t\treturn \"opf\";\n\t}\n};\n\n\n/**\n * unpack the contents of the Books packageXml\n * @private\n * @param {document} packageXml XML Document\n */\nBook.prototype.unpack = function(opf){\n\tthis.package = opf;\n\n\tthis.spine.unpack(this.package, this.resolve.bind(this));\n\n\tthis.resources = new Resources(this.package.manifest, {\n\t\tarchive: this.archive,\n\t\tresolver: this.resolve.bind(this),\n\t\treplacements: this.settings.replacements\n\t});\n\n\tthis.loadNavigation(this.package).then(function(toc){\n\t\tthis.toc = toc;\n\t\tthis.loading.navigation.resolve(this.toc);\n\t}.bind(this));\n\n\tthis.cover = this.resolve(this.package.coverPath);\n\n\t// Resolve promises\n\tthis.loading.manifest.resolve(this.package.manifest);\n\tthis.loading.metadata.resolve(this.package.metadata);\n\tthis.loading.spine.resolve(this.spine);\n\tthis.loading.cover.resolve(this.cover);\n\tthis.loading.resources.resolve(this.resources);\n\tthis.loading.pageList.resolve(this.pageList);\n\n\n\tthis.isOpen = true;\n\n\tif(this.archived) {\n\t\tthis.replacements().then(function() {\n\t\t\tthis.opening.resolve(this);\n\t\t}.bind(this));\n\t} else {\n\t\t// Resolve book opened promise\n\t\tthis.opening.resolve(this);\n\t}\n\n};\n\n/**\n * Load Navigation and PageList from package\n * @private\n * @param {document} opf XML Document\n */\nBook.prototype.loadNavigation = function(opf){\n\tvar navPath = opf.navPath || opf.ncxPath;\n\n\tif (!navPath) {\n\t\treturn;\n\t}\n\n\treturn this.load(navPath, 'xml')\n\t\t.then(function(xml) {\n\t\t\tthis.navigation = new Navigation(xml);\n\t\t\tthis.pageList = new PageList(xml);\n\t\t}.bind(this));\n};\n\n/**\n * Alias for book.spine.get\n * @param {string} target\n */\nBook.prototype.section = function(target) {\n\treturn this.spine.get(target);\n};\n\n/**\n * Sugar to render a book\n * @param {element} element element to add the views to\n * @param {[object]} options\n * @return {Rendition}\n */\nBook.prototype.renderTo = function(element, options) {\n\t// var renderMethod = (options && options.method) ?\n\t// options.method :\n\t// \"single\";\n\n\tthis.rendition = new Rendition(this, options);\n\tthis.rendition.attachTo(element);\n\n\treturn this.rendition;\n};\n\n/**\n * Set if request should use withCredentials\n * @param {boolean} credentials\n */\nBook.prototype.setRequestCredentials = function(credentials) {\n\tthis.settings.requestCredentials = credentials;\n};\n\n/**\n * Set headers request should use\n * @param {object} headers\n */\nBook.prototype.setRequestHeaders = function(headers) {\n\tthis.settings.requestHeaders = headers;\n};\n\n/**\n * Unarchive a zipped epub\n * @private\n * @param {binary} input epub data\n * @param {[string]} encoding\n * @return {Archive}\n */\nBook.prototype.unarchive = function(input, encoding){\n\tthis.archive = new Archive();\n\treturn this.archive.open(input, encoding);\n};\n\n/**\n * Get the cover url\n * @return {string} coverUrl\n */\nBook.prototype.coverUrl = function(){\n\tvar retrieved = this.loaded.cover.\n\t\tthen(function(url) {\n\t\t\tif(this.archived) {\n\t\t\t\t// return this.archive.createUrl(this.cover);\n\t\t\t\treturn this.resources.get(this.cover);\n\t\t\t}else{\n\t\t\t\treturn this.cover;\n\t\t\t}\n\t\t}.bind(this));\n\n\n\n\treturn retrieved;\n};\n\n/**\n * load replacement urls\n * @private\n * @return {Promise} completed loading urls\n */\nBook.prototype.replacements = function(){\n\tthis.spine.hooks.serialize.register(function(output, section) {\n\t\tsection.output = this.resources.substitute(output, section.url);\n\t}.bind(this));\n\n\treturn this.resources.replacements().\n\t\tthen(function() {\n\t\t\treturn this.resources.replaceCss();\n\t\t}.bind(this));\n};\n\n/**\n * Find a DOM Range for a given CFI Range\n * @param {EpubCFI} cfiRange a epub cfi range\n * @return {Range}\n */\nBook.prototype.range = function(cfiRange) {\n\tvar cfi = new EpubCFI(cfiRange);\n\tvar item = this.spine.get(cfi.spinePos);\n\n\treturn item.load().then(function (contents) {\n\t\tvar range = cfi.toRange(item.document);\n\t\treturn range;\n\t})\n};\n\n/**\n * Generates the Book Key using the identifer in the manifest or other string provided\n * @param {[string]} identifier to use instead of metadata identifier\n * @return {string} key\n */\nBook.prototype.key = function(identifier){\n\tvar ident = identifier || this.package.metadata.identifier || this.url.filename;\n\treturn \"epubjs:\" + ePub.VERSION + \":\" + ident;\n};\n\n//-- Enable binding events to book\nEventEmitter(Book.prototype);\n\nmodule.exports = Book;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/book.js\n// module id = 16\n// module chunks = 0","var core = require('../../core');\nvar DefaultViewManager = require('../default');\n\nfunction ContinuousViewManager(options) {\n\n\tDefaultViewManager.apply(this, arguments); // call super constructor.\n\n\tthis.name = \"continuous\";\n\n\tthis.settings = core.extend(this.settings || {}, {\n\t\tinfinite: true,\n\t\toverflow: \"auto\",\n\t\taxis: \"vertical\",\n\t\toffset: 500,\n\t\toffsetDelta: 250,\n\t\twidth: undefined,\n\t\theight: undefined\n\t});\n\n\tcore.extend(this.settings, options.settings || {});\n\n\t// Gap can be 0, byt defaults doesn't handle that\n\tif (options.settings.gap != \"undefined\" && options.settings.gap === 0) {\n\t\tthis.settings.gap = options.settings.gap;\n\t}\n\n\t// this.viewSettings.axis = this.settings.axis;\n\tthis.viewSettings = {\n\t\tignoreClass: this.settings.ignoreClass,\n\t\taxis: this.settings.axis,\n\t\tlayout: this.layout,\n\t\twidth: 0,\n\t\theight: 0\n\t};\n\n\tthis.scrollTop = 0;\n\tthis.scrollLeft = 0;\n};\n\n// subclass extends superclass\nContinuousViewManager.prototype = Object.create(DefaultViewManager.prototype);\nContinuousViewManager.prototype.constructor = ContinuousViewManager;\n\nContinuousViewManager.prototype.display = function(section, target){\n\treturn DefaultViewManager.prototype.display.call(this, section, target)\n\t\t.then(function () {\n\t\t\treturn this.fill();\n\t\t}.bind(this));\n};\n\nContinuousViewManager.prototype.fill = function(_full){\n\tvar full = _full || new core.defer();\n\n\tthis.check().then(function(result) {\n\t\tif (result) {\n\t\t\tthis.fill(full);\n\t\t} else {\n\t\t\tfull.resolve();\n\t\t}\n\t}.bind(this));\n\n\treturn full.promise;\n}\n\nContinuousViewManager.prototype.moveTo = function(offset){\n\t// var bounds = this.stage.bounds();\n\t// var dist = Math.floor(offset.top / bounds.height) * bounds.height;\n\tvar distX = 0,\n\t\t\tdistY = 0;\n\n\tvar offsetX = 0,\n\t\t\toffsetY = 0;\n\n\tif(this.settings.axis === \"vertical\") {\n\t\tdistY = offset.top;\n\t\toffsetY = offset.top+this.settings.offset;\n\t} else {\n\t\tdistX = Math.floor(offset.left / this.layout.delta) * this.layout.delta;\n\t\toffsetX = distX+this.settings.offset;\n\t}\n\n\treturn this.check(offsetX, offsetY)\n\t\t.then(function(){\n\t\t\tthis.scrollBy(distX, distY);\n\t\t}.bind(this));\n};\n\n/*\nContinuousViewManager.prototype.afterDisplayed = function(currView){\n\tvar next = currView.section.next();\n\tvar prev = currView.section.prev();\n\tvar index = this.views.indexOf(currView);\n\tvar prevView, nextView;\n\n\tif(index + 1 === this.views.length && next) {\n\t\tnextView = this.createView(next);\n\t\tthis.q.enqueue(this.append.bind(this), nextView);\n\t}\n\n\tif(index === 0 && prev) {\n\t\tprevView = this.createView(prev, this.viewSettings);\n\t\tthis.q.enqueue(this.prepend.bind(this), prevView);\n\t}\n\n\t// this.removeShownListeners(currView);\n\t// currView.onShown = this.afterDisplayed.bind(this);\n\tthis.emit(\"added\", currView.section);\n\n};\n*/\n\nContinuousViewManager.prototype.resize = function(width, height){\n\n\t// Clear the queue\n\tthis.q.clear();\n\n\tthis._stageSize = this.stage.size(width, height);\n\tthis._bounds = this.bounds();\n\n\t// Update for new views\n\tthis.viewSettings.width = this._stageSize.width;\n\tthis.viewSettings.height = this._stageSize.height;\n\n\t// Update for existing views\n\tthis.views.each(function(view) {\n\t\tview.size(this._stageSize.width, this._stageSize.height);\n\t}.bind(this));\n\n\tthis.updateLayout();\n\n\t// if(this.location) {\n\t// this.rendition.display(this.location.start);\n\t// }\n\n\tthis.emit(\"resized\", {\n\t\twidth: this.stage.width,\n\t\theight: this.stage.height\n\t});\n\n};\n\nContinuousViewManager.prototype.onResized = function(e) {\n\n\t// this.views.clear();\n\n\tclearTimeout(this.resizeTimeout);\n\tthis.resizeTimeout = setTimeout(function(){\n\t\tthis.resize();\n\t}.bind(this), 150);\n};\n\nContinuousViewManager.prototype.afterResized = function(view){\n\tthis.emit(\"resize\", view.section);\n};\n\n// Remove Previous Listeners if present\nContinuousViewManager.prototype.removeShownListeners = function(view){\n\n\t// view.off(\"shown\", this.afterDisplayed);\n\t// view.off(\"shown\", this.afterDisplayedAbove);\n\tview.onDisplayed = function(){};\n\n};\n\n\n// ContinuousViewManager.prototype.append = function(section){\n// \treturn this.q.enqueue(function() {\n//\n// \t\tthis._append(section);\n//\n//\n// \t}.bind(this));\n// };\n//\n// ContinuousViewManager.prototype.prepend = function(section){\n// \treturn this.q.enqueue(function() {\n//\n// \t\tthis._prepend(section);\n//\n// \t}.bind(this));\n//\n// };\n\nContinuousViewManager.prototype.append = function(section){\n\tvar view = this.createView(section);\n\tthis.views.append(view);\n\treturn view;\n};\n\nContinuousViewManager.prototype.prepend = function(section){\n\tvar view = this.createView(section);\n\n\tview.on(\"resized\", this.counter.bind(this));\n\n\tthis.views.prepend(view);\n\treturn view;\n};\n\nContinuousViewManager.prototype.counter = function(bounds){\n\n\tif(this.settings.axis === \"vertical\") {\n\t\tthis.scrollBy(0, bounds.heightDelta, true);\n\t} else {\n\t\tthis.scrollBy(bounds.widthDelta, 0, true);\n\t}\n\n};\n\nContinuousViewManager.prototype.update = function(_offset){\n\tvar container = this.bounds();\n\tvar views = this.views.all();\n\tvar viewsLength = views.length;\n\tvar visible = [];\n\tvar offset = typeof _offset != \"undefined\" ? _offset : (this.settings.offset || 0);\n\tvar isVisible;\n\tvar view;\n\n\tvar updating = new core.defer();\n\tvar promises = [];\n\n\tfor (var i = 0; i < viewsLength; i++) {\n\t\tview = views[i];\n\n\t\tisVisible = this.isVisible(view, offset, offset, container);\n\n\t\tif(isVisible === true) {\n\t\t\tif (!view.displayed) {\n\t\t\t\tpromises.push(view.display(this.request).then(function (view) {\n\t\t\t\t\tview.show();\n\t\t\t\t}));\n\t\t\t}\n\t\t\tvisible.push(view);\n\t\t} else {\n\t\t\tthis.q.enqueue(view.destroy.bind(view));\n\n\t\t\tclearTimeout(this.trimTimeout);\n\t\t\tthis.trimTimeout = setTimeout(function(){\n\t\t\t\tthis.q.enqueue(this.trim.bind(this));\n\t\t\t}.bind(this), 250);\n\t\t}\n\n\t}\n\n\tif(promises.length){\n\t\treturn Promise.all(promises);\n\t} else {\n\t\tupdating.resolve();\n\t\treturn updating.promise;\n\t}\n\n};\n\nContinuousViewManager.prototype.check = function(_offsetLeft, _offsetTop){\n\tvar last, first, next, prev;\n\n\tvar checking = new core.defer();\n\tvar newViews = [];\n\n\tvar horizontal = (this.settings.axis === \"horizontal\");\n\tvar delta = this.settings.offset || 0;\n\n\tif (_offsetLeft && horizontal) {\n\t\tdelta = _offsetLeft;\n\t}\n\n\tif (_offsetTop && !horizontal) {\n\t\tdelta = _offsetTop;\n\t}\n\n\tvar bounds = this._bounds; // bounds saved this until resize\n\n\tvar offset = horizontal ? this.scrollLeft : this.scrollTop;\n\tvar visibleLength = horizontal ? bounds.width : bounds.height;\n\tvar contentLength = horizontal ? this.container.scrollWidth : this.container.scrollHeight;\n\n\tif (offset + visibleLength + delta >= contentLength) {\n\t\tlast = this.views.last();\n\t\tnext = last && last.section.next();\n\t\tif(next) {\n\t\t\tnewViews.push(this.append(next));\n\t\t}\n\t}\n\n\tif (offset - delta < 0 ) {\n\t\tfirst = this.views.first();\n\t\tprev = first && first.section.prev();\n\t\tif(prev) {\n\t\t\tnewViews.push(this.prepend(prev));\n\t\t}\n\t}\n\n\tif(newViews.length){\n\t\t// Promise.all(promises)\n\t\t\t// .then(function() {\n\t\t\t\t// Check to see if anything new is on screen after rendering\n\t\t\t\treturn this.q.enqueue(function(){\n\t\t\t\t\treturn this.update(delta);\n\t\t\t\t}.bind(this));\n\n\n\t\t\t// }.bind(this));\n\n\t} else {\n\t\tchecking.resolve(false);\n\t\treturn checking.promise;\n\t}\n\n\n};\n\nContinuousViewManager.prototype.trim = function(){\n\tvar task = new core.defer();\n\tvar displayed = this.views.displayed();\n\tvar first = displayed[0];\n\tvar last = displayed[displayed.length-1];\n\tvar firstIndex = this.views.indexOf(first);\n\tvar lastIndex = this.views.indexOf(last);\n\tvar above = this.views.slice(0, firstIndex);\n\tvar below = this.views.slice(lastIndex+1);\n\n\t// Erase all but last above\n\tfor (var i = 0; i < above.length-1; i++) {\n\t\tthis.erase(above[i], above);\n\t}\n\n\t// Erase all except first below\n\tfor (var j = 1; j < below.length; j++) {\n\t\tthis.erase(below[j]);\n\t}\n\n\ttask.resolve();\n\treturn task.promise;\n};\n\nContinuousViewManager.prototype.erase = function(view, above){ //Trim\n\n\tvar prevTop;\n\tvar prevLeft;\n\n\tif(this.settings.height) {\n\t\tprevTop = this.container.scrollTop;\n\t\tprevLeft = this.container.scrollLeft;\n\t} else {\n\t\tprevTop = window.scrollY;\n\t\tprevLeft = window.scrollX;\n\t}\n\n\tvar bounds = view.bounds();\n\n\tthis.views.remove(view);\n\n\tif(above) {\n\n\t\tif(this.settings.axis === \"vertical\") {\n\t\t\tthis.scrollTo(0, prevTop - bounds.height, true);\n\t\t} else {\n\t\t\tthis.scrollTo(prevLeft - bounds.width, 0, true);\n\t\t}\n\t}\n\n};\n\nContinuousViewManager.prototype.addEventListeners = function(stage){\n\n\twindow.addEventListener('unload', function(e){\n\t\tthis.ignore = true;\n\t\t// this.scrollTo(0,0);\n\t\tthis.destroy();\n\t}.bind(this));\n\n\tthis.addScrollListeners();\n};\n\nContinuousViewManager.prototype.addScrollListeners = function() {\n\tvar scroller;\n\n\tthis.tick = core.requestAnimationFrame;\n\n\tif(this.settings.height) {\n\t\tthis.prevScrollTop = this.container.scrollTop;\n\t\tthis.prevScrollLeft = this.container.scrollLeft;\n\t} else {\n\t\tthis.prevScrollTop = window.scrollY;\n\t\tthis.prevScrollLeft = window.scrollX;\n\t}\n\n\tthis.scrollDeltaVert = 0;\n\tthis.scrollDeltaHorz = 0;\n\n\tif(this.settings.height) {\n\t\tscroller = this.container;\n\t\tthis.scrollTop = this.container.scrollTop;\n\t\tthis.scrollLeft = this.container.scrollLeft;\n\t} else {\n\t\tscroller = window;\n\t\tthis.scrollTop = window.scrollY;\n\t\tthis.scrollLeft = window.scrollX;\n\t}\n\n\tscroller.addEventListener(\"scroll\", this.onScroll.bind(this));\n\n\t// this.tick.call(window, this.onScroll.bind(this));\n\n\tthis.scrolled = false;\n\n};\n\nContinuousViewManager.prototype.onScroll = function(){\n\n\t// if(!this.ignore) {\n\n\t\tif(this.settings.height) {\n\t\t\tscrollTop = this.container.scrollTop;\n\t\t\tscrollLeft = this.container.scrollLeft;\n\t\t} else {\n\t\t\tscrollTop = window.scrollY;\n\t\t\tscrollLeft = window.scrollX;\n\t\t}\n\n\t\tthis.scrollTop = scrollTop;\n\t\tthis.scrollLeft = scrollLeft;\n\n\t\tif(!this.ignore) {\n\n\t\t\tif((this.scrollDeltaVert === 0 &&\n\t\t\t\t this.scrollDeltaHorz === 0) ||\n\t\t\t\t this.scrollDeltaVert > this.settings.offsetDelta ||\n\t\t\t\t this.scrollDeltaHorz > this.settings.offsetDelta) {\n\n\t\t\t\tthis.q.enqueue(function() {\n\t\t\t\t\tthis.check();\n\t\t\t\t}.bind(this));\n\t\t\t\t// this.check();\n\n\t\t\t\tthis.scrollDeltaVert = 0;\n\t\t\t\tthis.scrollDeltaHorz = 0;\n\n\t\t\t\tthis.emit(\"scroll\", {\n\t\t\t\t\ttop: scrollTop,\n\t\t\t\t\tleft: scrollLeft\n\t\t\t\t});\n\n\t\t\t\tclearTimeout(this.afterScrolled);\n\t\t\t\tthis.afterScrolled = setTimeout(function () {\n\t\t\t\t\tthis.emit(\"scrolled\", {\n\t\t\t\t\t\ttop: this.scrollTop,\n\t\t\t\t\t\tleft: this.scrollLeft\n\t\t\t\t\t});\n\t\t\t\t}.bind(this));\n\n\t\t\t}\n\n\t\t} else {\n\t\t\tthis.ignore = false;\n\t\t}\n\n\t\tthis.scrollDeltaVert += Math.abs(scrollTop-this.prevScrollTop);\n\t\tthis.scrollDeltaHorz += Math.abs(scrollLeft-this.prevScrollLeft);\n\n\t\tthis.prevScrollTop = scrollTop;\n\t\tthis.prevScrollLeft = scrollLeft;\n\n\t\tclearTimeout(this.scrollTimeout);\n\t\tthis.scrollTimeout = setTimeout(function(){\n\t\t\tthis.scrollDeltaVert = 0;\n\t\t\tthis.scrollDeltaHorz = 0;\n\t\t}.bind(this), 150);\n\n\n\t\tthis.scrolled = false;\n\t// }\n\n\t// this.tick.call(window, this.onScroll.bind(this));\n\n};\n\n\n// ContinuousViewManager.prototype.resizeView = function(view) {\n//\n// \tif(this.settings.axis === \"horizontal\") {\n// \t\tview.lock(\"height\", this.stage.width, this.stage.height);\n// \t} else {\n// \t\tview.lock(\"width\", this.stage.width, this.stage.height);\n// \t}\n//\n// };\n\nContinuousViewManager.prototype.currentLocation = function(){\n\n\tif (this.settings.axis === \"vertical\") {\n\t\tthis.location = this.scrolledLocation();\n\t} else {\n\t\tthis.location = this.paginatedLocation();\n\t}\n\n\treturn this.location;\n};\n\nContinuousViewManager.prototype.scrolledLocation = function(){\n\n\tvar visible = this.visible();\n\tvar startPage, endPage;\n\n\tvar container = this.container.getBoundingClientRect();\n\n\tif(visible.length === 1) {\n\t\treturn this.mapping.page(visible[0].contents, visible[0].section.cfiBase);\n\t}\n\n\tif(visible.length > 1) {\n\n\t\tstartPage = this.mapping.page(visible[0].contents, visible[0].section.cfiBase);\n\t\tendPage = this.mapping.page(visible[visible.length-1].contents, visible[visible.length-1].section.cfiBase);\n\n\t\treturn {\n\t\t\tstart: startPage.start,\n\t\t\tend: endPage.end\n\t\t};\n\t}\n\n};\n\nContinuousViewManager.prototype.paginatedLocation = function(){\n\tvar visible = this.visible();\n\tvar startA, startB, endA, endB;\n\tvar pageLeft, pageRight;\n\tvar container = this.container.getBoundingClientRect();\n\n\tif(visible.length === 1) {\n\t\tstartA = container.left - visible[0].position().left;\n\t\tendA = startA + this.layout.spreadWidth;\n\n\t\treturn this.mapping.page(visible[0].contents, visible[0].section.cfiBase, startA, endA);\n\t}\n\n\tif(visible.length > 1) {\n\n\t\t// Left Col\n\t\tstartA = container.left - visible[0].position().left;\n\t\tendA = startA + this.layout.columnWidth;\n\n\t\t// Right Col\n\t\tstartB = container.left + this.layout.spreadWidth - visible[visible.length-1].position().left;\n\t\tendB = startB + this.layout.columnWidth;\n\n\t\tpageLeft = this.mapping.page(visible[0].contents, visible[0].section.cfiBase, startA, endA);\n\t\tpageRight = this.mapping.page(visible[visible.length-1].contents, visible[visible.length-1].section.cfiBase, startB, endB);\n\n\t\treturn {\n\t\t\tstart: pageLeft.start,\n\t\t\tend: pageRight.end\n\t\t};\n\t}\n};\n\n/*\nContinuous.prototype.current = function(what){\n\tvar view, top;\n\tvar container = this.container.getBoundingClientRect();\n\tvar length = this.views.length - 1;\n\n\tif(this.settings.axis === \"horizontal\") {\n\n\t\tfor (var i = length; i >= 0; i--) {\n\t\t\tview = this.views[i];\n\t\t\tleft = view.position().left;\n\n\t\t\tif(left < container.right) {\n\n\t\t\t\tif(this._current == view) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tthis._current = view;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t} else {\n\n\t\tfor (var i = length; i >= 0; i--) {\n\t\t\tview = this.views[i];\n\t\t\ttop = view.bounds().top;\n\t\t\tif(top < container.bottom) {\n\n\t\t\t\tif(this._current == view) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tthis._current = view;\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn this._current;\n};\n*/\n\nContinuousViewManager.prototype.updateLayout = function() {\n\n\tif (!this.stage) {\n\t\treturn;\n\t}\n\n\tif(this.settings.axis === \"vertical\") {\n\t\tthis.layout.calculate(this._stageSize.width, this._stageSize.height);\n\t} else {\n\t\tthis.layout.calculate(\n\t\t\tthis._stageSize.width,\n\t\t\tthis._stageSize.height,\n\t\t\tthis.settings.gap\n\t\t);\n\n\t\t// Set the look ahead offset for what is visible\n\t\tthis.settings.offset = this.layout.delta;\n\n\t\tthis.stage.addStyleRules(\"iframe\", [{\"margin-right\" : this.layout.gap + \"px\"}]);\n\n\t}\n\n\t// Set the dimensions for views\n\tthis.viewSettings.width = this.layout.width;\n\tthis.viewSettings.height = this.layout.height;\n\n\tthis.setLayout(this.layout);\n\n};\n\nContinuousViewManager.prototype.next = function(){\n\n\tif(this.settings.axis === \"horizontal\") {\n\n\t\tthis.scrollLeft = this.container.scrollLeft;\n\n\t\tif(this.container.scrollLeft +\n\t\t\t this.container.offsetWidth +\n\t\t\t this.layout.delta < this.container.scrollWidth) {\n\t\t\tthis.scrollBy(this.layout.delta, 0);\n\t\t} else {\n\t\t\tthis.scrollTo(this.container.scrollWidth - this.layout.delta, 0);\n\t\t}\n\n\t} else {\n\t\tthis.scrollBy(0, this.layout.height);\n\t}\n};\n\nContinuousViewManager.prototype.prev = function(){\n\tif(this.settings.axis === \"horizontal\") {\n\t\tthis.scrollBy(-this.layout.delta, 0);\n\t} else {\n\t\tthis.scrollBy(0, -this.layout.height);\n\t}\n};\n\nContinuousViewManager.prototype.updateFlow = function(flow){\n\tvar axis = (flow === \"paginated\") ? \"horizontal\" : \"vertical\";\n\n\tthis.settings.axis = axis;\n\n\tthis.viewSettings.axis = axis;\n\n\tthis.settings.overflow = (flow === \"paginated\") ? \"hidden\" : \"auto\";\n\n\t// this.views.each(function(view){\n\t// \tview.setAxis(axis);\n\t// });\n\n\tif (this.settings.axis === \"vertical\") {\n\t\tthis.settings.infinite = true;\n\t} else {\n\t\tthis.settings.infinite = false;\n\t}\n\n};\nmodule.exports = ContinuousViewManager;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/managers/continuous/index.js\n// module id = 17\n// module chunks = 0","var EventEmitter = require('event-emitter');\nvar core = require('../../core');\nvar EpubCFI = require('../../epubcfi');\nvar Contents = require('../../contents');\n\nfunction IframeView(section, options) {\n\tthis.settings = core.extend({\n\t\tignoreClass : '',\n\t\taxis: 'vertical',\n\t\twidth: 0,\n\t\theight: 0,\n\t\tlayout: undefined,\n\t\tglobalLayoutProperties: {},\n\t}, options || {});\n\n\tthis.id = \"epubjs-view-\" + core.uuid();\n\tthis.section = section;\n\tthis.index = section.index;\n\n\tthis.element = this.container(this.settings.axis);\n\n\tthis.added = false;\n\tthis.displayed = false;\n\tthis.rendered = false;\n\n\tthis.width = this.settings.width;\n\tthis.height = this.settings.height;\n\n\tthis.fixedWidth = 0;\n\tthis.fixedHeight = 0;\n\n\t// Blank Cfi for Parsing\n\tthis.epubcfi = new EpubCFI();\n\n\tthis.layout = this.settings.layout;\n\t// Dom events to listen for\n\t// this.listenedEvents = [\"keydown\", \"keyup\", \"keypressed\", \"mouseup\", \"mousedown\", \"click\", \"touchend\", \"touchstart\"];\n};\n\nIframeView.prototype.container = function(axis) {\n\tvar element = document.createElement('div');\n\n\telement.classList.add(\"epub-view\");\n\n\t// this.element.style.minHeight = \"100px\";\n\telement.style.height = \"0px\";\n\telement.style.width = \"0px\";\n\telement.style.overflow = \"hidden\";\n\n\tif(axis && axis == \"horizontal\"){\n\t\telement.style.display = \"inline-block\";\n\t} else {\n\t\telement.style.display = \"block\";\n\t}\n\n\treturn element;\n};\n\nIframeView.prototype.create = function() {\n\n\tif(this.iframe) {\n\t\treturn this.iframe;\n\t}\n\n\tif(!this.element) {\n\t\tthis.element = this.createContainer();\n\t}\n\n\tthis.iframe = document.createElement('iframe');\n\tthis.iframe.id = this.id;\n\tthis.iframe.scrolling = \"no\"; // Might need to be removed: breaks ios width calculations\n\tthis.iframe.style.overflow = \"hidden\";\n\tthis.iframe.seamless = \"seamless\";\n\t// Back up if seamless isn't supported\n\tthis.iframe.style.border = \"none\";\n\n\tthis.resizing = true;\n\n\t// this.iframe.style.display = \"none\";\n\tthis.element.style.visibility = \"hidden\";\n\tthis.iframe.style.visibility = \"hidden\";\n\n\tthis.iframe.style.width = \"0\";\n\tthis.iframe.style.height = \"0\";\n\tthis._width = 0;\n\tthis._height = 0;\n\n\tthis.element.appendChild(this.iframe);\n\tthis.added = true;\n\n\tthis.elementBounds = core.bounds(this.element);\n\n\t// if(width || height){\n\t// this.resize(width, height);\n\t// } else if(this.width && this.height){\n\t// this.resize(this.width, this.height);\n\t// } else {\n\t// this.iframeBounds = core.bounds(this.iframe);\n\t// }\n\n\t// Firefox has trouble with baseURI and srcdoc\n\t// TODO: Disable for now in firefox\n\n\tif(!!(\"srcdoc\" in this.iframe)) {\n\t\tthis.supportsSrcdoc = true;\n\t} else {\n\t\tthis.supportsSrcdoc = false;\n\t}\n\n\treturn this.iframe;\n};\n\nIframeView.prototype.render = function(request, show) {\n\n\t// view.onLayout = this.layout.format.bind(this.layout);\n\tthis.create();\n\n\t// Fit to size of the container, apply padding\n\tthis.size();\n\n\tif(!this.sectionRender) {\n\t\tthis.sectionRender = this.section.render(request);\n\t}\n\n\t// Render Chain\n\treturn this.sectionRender\n\t\t.then(function(contents){\n\t\t\treturn this.load(contents);\n\t\t}.bind(this))\n\t\t// .then(function(doc){\n\t\t// \treturn this.hooks.content.trigger(view, this);\n\t\t// }.bind(this))\n\t\t.then(function(){\n\t\t\t// this.settings.layout.format(view.contents);\n\t\t\t// return this.hooks.layout.trigger(view, this);\n\t\t}.bind(this))\n\t\t// .then(function(){\n\t\t// \treturn this.display();\n\t\t// }.bind(this))\n\t\t// .then(function(){\n\t\t// \treturn this.hooks.render.trigger(view, this);\n\t\t// }.bind(this))\n\t\t.then(function(){\n\n\t\t\t// apply the layout function to the contents\n\t\t\tthis.settings.layout.format(this.contents);\n\n\t\t\t// Expand the iframe to the full size of the content\n\t\t\tthis.expand();\n\n\t\t\t// Listen for events that require an expansion of the iframe\n\t\t\tthis.addListeners();\n\n\t\t\tif(show !== false) {\n\t\t\t\t//this.q.enqueue(function(view){\n\t\t\t\t\t// this.show();\n\t\t\t\t//}, view);\n\t\t\t}\n\t\t\t// this.map = new Map(view, this.layout);\n\t\t\t//this.hooks.show.trigger(view, this);\n\t\t\tthis.emit(\"rendered\", this.section);\n\n\t\t}.bind(this))\n\t\t.catch(function(e){\n\t\t\tconsole.error(e);\n\t\t\tthis.emit(\"loaderror\", e);\n\t\t}.bind(this));\n\n};\n\n// Determine locks base on settings\nIframeView.prototype.size = function(_width, _height) {\n\tvar width = _width || this.settings.width;\n\tvar height = _height || this.settings.height;\n\n\tif(this.layout.name === \"pre-paginated\") {\n\t\tthis.lock(\"both\", width, height);\n\t} else if(this.settings.axis === \"horizontal\") {\n\t\tthis.lock(\"height\", width, height);\n\t} else {\n\t\tthis.lock(\"width\", width, height);\n\t}\n\n};\n\n// Lock an axis to element dimensions, taking borders into account\nIframeView.prototype.lock = function(what, width, height) {\n\tvar elBorders = core.borders(this.element);\n\tvar iframeBorders;\n\n\tif(this.iframe) {\n\t\tiframeBorders = core.borders(this.iframe);\n\t} else {\n\t\tiframeBorders = {width: 0, height: 0};\n\t}\n\n\tif(what == \"width\" && core.isNumber(width)){\n\t\tthis.lockedWidth = width - elBorders.width - iframeBorders.width;\n\t\tthis.resize(this.lockedWidth, width); // width keeps ratio correct\n\t}\n\n\tif(what == \"height\" && core.isNumber(height)){\n\t\tthis.lockedHeight = height - elBorders.height - iframeBorders.height;\n\t\tthis.resize(width, this.lockedHeight);\n\t}\n\n\tif(what === \"both\" &&\n\t\t core.isNumber(width) &&\n\t\t core.isNumber(height)){\n\n\t\tthis.lockedWidth = width - elBorders.width - iframeBorders.width;\n\t\tthis.lockedHeight = height - elBorders.height - iframeBorders.height;\n\n\t\tthis.resize(this.lockedWidth, this.lockedHeight);\n\t}\n\n\tif(this.displayed && this.iframe) {\n\n\t\t\t// this.contents.layout();\n\t\t\tthis.expand();\n\n\t}\n\n\n\n};\n\n// Resize a single axis based on content dimensions\nIframeView.prototype.expand = function(force) {\n\tvar width = this.lockedWidth;\n\tvar height = this.lockedHeight;\n\tvar columns;\n\n\tvar textWidth, textHeight;\n\n\tif(!this.iframe || this._expanding) return;\n\n\tthis._expanding = true;\n\n\t// Expand Horizontally\n\t// if(height && !width) {\n\tif(this.settings.axis === \"horizontal\") {\n\t\t// Get the width of the text\n\t\ttextWidth = this.contents.textWidth();\n\t\t// Check if the textWidth has changed\n\t\tif(textWidth != this._textWidth){\n\t\t\t// Get the contentWidth by resizing the iframe\n\t\t\t// Check with a min reset of the textWidth\n\t\t\twidth = this.contentWidth(textWidth);\n\n\t\t\tcolumns = Math.ceil(width / (this.settings.layout.columnWidth + this.settings.layout.gap));\n\n\t\t\tif ( this.settings.layout.divisor > 1 &&\n\t\t\t\t\t this.settings.layout.name === \"reflowable\" &&\n\t\t\t\t\t(columns % 2 > 0)) {\n\t\t\t\t\t// add a blank page\n\t\t\t\t\twidth += this.settings.layout.gap + this.settings.layout.columnWidth;\n\t\t\t}\n\n\t\t\t// Save the textWdith\n\t\t\tthis._textWidth = textWidth;\n\t\t\t// Save the contentWidth\n\t\t\tthis._contentWidth = width;\n\t\t} else {\n\t\t\t// Otherwise assume content height hasn't changed\n\t\t\twidth = this._contentWidth;\n\t\t}\n\t} // Expand Vertically\n\telse if(this.settings.axis === \"vertical\") {\n\t\ttextHeight = this.contents.textHeight();\n\t\tif(textHeight != this._textHeight){\n\t\t\theight = this.contentHeight(textHeight);\n\t\t\tthis._textHeight = textHeight;\n\t\t\tthis._contentHeight = height;\n\t\t} else {\n\t\t\theight = this._contentHeight;\n\t\t}\n\n\t}\n\n\t// Only Resize if dimensions have changed or\n\t// if Frame is still hidden, so needs reframing\n\tif(this._needsReframe || width != this._width || height != this._height){\n\t\tthis.resize(width, height);\n\t}\n\n\tthis._expanding = false;\n};\n\nIframeView.prototype.contentWidth = function(min) {\n\tvar prev;\n\tvar width;\n\n\t// Save previous width\n\tprev = this.iframe.style.width;\n\t// Set the iframe size to min, width will only ever be greater\n\t// Will preserve the aspect ratio\n\tthis.iframe.style.width = (min || 0) + \"px\";\n\t// Get the scroll overflow width\n\twidth = this.contents.scrollWidth();\n\t// Reset iframe size back\n\tthis.iframe.style.width = prev;\n\treturn width;\n};\n\nIframeView.prototype.contentHeight = function(min) {\n\tvar prev;\n\tvar height;\n\n\tprev = this.iframe.style.height;\n\tthis.iframe.style.height = (min || 0) + \"px\";\n\theight = this.contents.scrollHeight();\n\n\tthis.iframe.style.height = prev;\n\treturn height;\n};\n\n\nIframeView.prototype.resize = function(width, height) {\n\n\tif(!this.iframe) return;\n\n\tif(core.isNumber(width)){\n\t\tthis.iframe.style.width = width + \"px\";\n\t\tthis._width = width;\n\t}\n\n\tif(core.isNumber(height)){\n\t\tthis.iframe.style.height = height + \"px\";\n\t\tthis._height = height;\n\t}\n\n\tthis.iframeBounds = core.bounds(this.iframe);\n\n\tthis.reframe(this.iframeBounds.width, this.iframeBounds.height);\n\n};\n\nIframeView.prototype.reframe = function(width, height) {\n\tvar size;\n\n\t// if(!this.displayed) {\n\t// this._needsReframe = true;\n\t// return;\n\t// }\n\tif(core.isNumber(width)){\n\t\tthis.element.style.width = width + \"px\";\n\t}\n\n\tif(core.isNumber(height)){\n\t\tthis.element.style.height = height + \"px\";\n\t}\n\n\tthis.prevBounds = this.elementBounds;\n\n\tthis.elementBounds = core.bounds(this.element);\n\n\tsize = {\n\t\twidth: this.elementBounds.width,\n\t\theight: this.elementBounds.height,\n\t\twidthDelta: this.elementBounds.width - this.prevBounds.width,\n\t\theightDelta: this.elementBounds.height - this.prevBounds.height,\n\t};\n\n\tthis.onResize(this, size);\n\n\tthis.emit(\"resized\", size);\n\n};\n\n\nIframeView.prototype.load = function(contents) {\n\tvar loading = new core.defer();\n\tvar loaded = loading.promise;\n\n\tif(!this.iframe) {\n\t\tloading.reject(new Error(\"No Iframe Available\"));\n\t\treturn loaded;\n\t}\n\n\tthis.iframe.onload = function(event) {\n\n\t\tthis.onLoad(event, loading);\n\n\t}.bind(this);\n\n\tif(this.supportsSrcdoc){\n\t\tthis.iframe.srcdoc = contents;\n\t} else {\n\n\t\tthis.document = this.iframe.contentDocument;\n\n\t\tif(!this.document) {\n\t\t\tloading.reject(new Error(\"No Document Available\"));\n\t\t\treturn loaded;\n\t\t}\n\n\t\tthis.iframe.contentDocument.open();\n\t\tthis.iframe.contentDocument.write(contents);\n\t\tthis.iframe.contentDocument.close();\n\n\t}\n\n\treturn loaded;\n};\n\nIframeView.prototype.onLoad = function(event, promise) {\n\n\t\tthis.window = this.iframe.contentWindow;\n\t\tthis.document = this.iframe.contentDocument;\n\n\t\tthis.contents = new Contents(this.document, this.document.body, this.section.cfiBase);\n\n\t\tthis.rendering = false;\n\n\t\tvar link = this.document.querySelector(\"link[rel='canonical']\");\n\t\tif (link) {\n\t\t\tlink.setAttribute(\"href\", this.section.url);\n\t\t} else {\n\t\t\tlink = this.document.createElement(\"link\");\n\t\t\tlink.setAttribute(\"rel\", \"canonical\");\n\t\t\tlink.setAttribute(\"href\", this.section.url);\n\t\t\tthis.document.querySelector(\"head\").appendChild(link);\n\t\t}\n\n\t\tthis.contents.on(\"expand\", function () {\n\t\t\tif(this.displayed && this.iframe) {\n\t\t\t\t\tthis.expand();\n\t\t\t}\n\t\t});\n\n\t\tpromise.resolve(this.contents);\n};\n\n\n\n// IframeView.prototype.layout = function(layoutFunc) {\n//\n// this.iframe.style.display = \"inline-block\";\n//\n// // Reset Body Styles\n// // this.document.body.style.margin = \"0\";\n// //this.document.body.style.display = \"inline-block\";\n// //this.document.documentElement.style.width = \"auto\";\n//\n// if(layoutFunc){\n// this.layoutFunc = layoutFunc;\n// }\n//\n// this.contents.layout(this.layoutFunc);\n//\n// };\n//\n// IframeView.prototype.onLayout = function(view) {\n// // stub\n// };\n\nIframeView.prototype.setLayout = function(layout) {\n\tthis.layout = layout;\n};\n\nIframeView.prototype.setAxis = function(axis) {\n\tthis.settings.axis = axis;\n};\n\nIframeView.prototype.resizeListenters = function() {\n\t// Test size again\n\tclearTimeout(this.expanding);\n\tthis.expanding = setTimeout(this.expand.bind(this), 350);\n};\n\nIframeView.prototype.addListeners = function() {\n\t//TODO: Add content listeners for expanding\n};\n\nIframeView.prototype.removeListeners = function(layoutFunc) {\n\t//TODO: remove content listeners for expanding\n};\n\nIframeView.prototype.display = function(request) {\n\tvar displayed = new core.defer();\n\n\tif (!this.displayed) {\n\n\t\tthis.render(request).then(function () {\n\n\t\t\tthis.emit(\"displayed\", this);\n\t\t\tthis.onDisplayed(this);\n\n\t\t\tthis.displayed = true;\n\t\t\tdisplayed.resolve(this);\n\n\t\t}.bind(this));\n\n\t} else {\n\t\tdisplayed.resolve(this);\n\t}\n\n\n\treturn displayed.promise;\n};\n\nIframeView.prototype.show = function() {\n\n\tthis.element.style.visibility = \"visible\";\n\n\tif(this.iframe){\n\t\tthis.iframe.style.visibility = \"visible\";\n\t}\n\n\tthis.emit(\"shown\", this);\n};\n\nIframeView.prototype.hide = function() {\n\t// this.iframe.style.display = \"none\";\n\tthis.element.style.visibility = \"hidden\";\n\tthis.iframe.style.visibility = \"hidden\";\n\n\tthis.stopExpanding = true;\n\tthis.emit(\"hidden\", this);\n};\n\nIframeView.prototype.position = function() {\n\treturn this.element.getBoundingClientRect();\n};\n\nIframeView.prototype.locationOf = function(target) {\n\tvar parentPos = this.iframe.getBoundingClientRect();\n\tvar targetPos = this.contents.locationOf(target, this.settings.ignoreClass);\n\n\treturn {\n\t\t\"left\": window.scrollX + parentPos.left + targetPos.left,\n\t\t\"top\": window.scrollY + parentPos.top + targetPos.top\n\t};\n};\n\nIframeView.prototype.onDisplayed = function(view) {\n\t// Stub, override with a custom functions\n};\n\nIframeView.prototype.onResize = function(view, e) {\n\t// Stub, override with a custom functions\n};\n\nIframeView.prototype.bounds = function() {\n\tif(!this.elementBounds) {\n\t\tthis.elementBounds = core.bounds(this.element);\n\t}\n\treturn this.elementBounds;\n};\n\nIframeView.prototype.destroy = function() {\n\n\tif(this.displayed){\n\t\tthis.displayed = false;\n\n\t\tthis.removeListeners();\n\n\t\tthis.stopExpanding = true;\n\t\tthis.element.removeChild(this.iframe);\n\t\tthis.displayed = false;\n\t\tthis.iframe = null;\n\n\t\tthis._textWidth = null;\n\t\tthis._textHeight = null;\n\t\tthis._width = null;\n\t\tthis._height = null;\n\t}\n\t// this.element.style.height = \"0px\";\n\t// this.element.style.width = \"0px\";\n};\n\nEventEmitter(IframeView.prototype);\n\nmodule.exports = IframeView;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/managers/views/iframe.js\n// module id = 18\n// module chunks = 0","/*\n From Zip.js, by Gildas Lormeau\nedited down\n */\n\nvar table = {\n\t\"application\" : {\n\t\t\"ecmascript\" : [ \"es\", \"ecma\" ],\n\t\t\"javascript\" : \"js\",\n\t\t\"ogg\" : \"ogx\",\n\t\t\"pdf\" : \"pdf\",\n\t\t\"postscript\" : [ \"ps\", \"ai\", \"eps\", \"epsi\", \"epsf\", \"eps2\", \"eps3\" ],\n\t\t\"rdf+xml\" : \"rdf\",\n\t\t\"smil\" : [ \"smi\", \"smil\" ],\n\t\t\"xhtml+xml\" : [ \"xhtml\", \"xht\" ],\n\t\t\"xml\" : [ \"xml\", \"xsl\", \"xsd\", \"opf\", \"ncx\" ],\n\t\t\"zip\" : \"zip\",\n\t\t\"x-httpd-eruby\" : \"rhtml\",\n\t\t\"x-latex\" : \"latex\",\n\t\t\"x-maker\" : [ \"frm\", \"maker\", \"frame\", \"fm\", \"fb\", \"book\", \"fbdoc\" ],\n\t\t\"x-object\" : \"o\",\n\t\t\"x-shockwave-flash\" : [ \"swf\", \"swfl\" ],\n\t\t\"x-silverlight\" : \"scr\",\n\t\t\"epub+zip\" : \"epub\",\n\t\t\"font-tdpfr\" : \"pfr\",\n\t\t\"inkml+xml\" : [ \"ink\", \"inkml\" ],\n\t\t\"json\" : \"json\",\n\t\t\"jsonml+json\" : \"jsonml\",\n\t\t\"mathml+xml\" : \"mathml\",\n\t\t\"metalink+xml\" : \"metalink\",\n\t\t\"mp4\" : \"mp4s\",\n\t\t// \"oebps-package+xml\" : \"opf\",\n\t\t\"omdoc+xml\" : \"omdoc\",\n\t\t\"oxps\" : \"oxps\",\n\t\t\"vnd.amazon.ebook\" : \"azw\",\n\t\t\"widget\" : \"wgt\",\n\t\t// \"x-dtbncx+xml\" : \"ncx\",\n\t\t\"x-dtbook+xml\" : \"dtb\",\n\t\t\"x-dtbresource+xml\" : \"res\",\n\t\t\"x-font-bdf\" : \"bdf\",\n\t\t\"x-font-ghostscript\" : \"gsf\",\n\t\t\"x-font-linux-psf\" : \"psf\",\n\t\t\"x-font-otf\" : \"otf\",\n\t\t\"x-font-pcf\" : \"pcf\",\n\t\t\"x-font-snf\" : \"snf\",\n\t\t\"x-font-ttf\" : [ \"ttf\", \"ttc\" ],\n\t\t\"x-font-type1\" : [ \"pfa\", \"pfb\", \"pfm\", \"afm\" ],\n\t\t\"x-font-woff\" : \"woff\",\n\t\t\"x-mobipocket-ebook\" : [ \"prc\", \"mobi\" ],\n\t\t\"x-mspublisher\" : \"pub\",\n\t\t\"x-nzb\" : \"nzb\",\n\t\t\"x-tgif\" : \"obj\",\n\t\t\"xaml+xml\" : \"xaml\",\n\t\t\"xml-dtd\" : \"dtd\",\n\t\t\"xproc+xml\" : \"xpl\",\n\t\t\"xslt+xml\" : \"xslt\",\n\t\t\"internet-property-stream\" : \"acx\",\n\t\t\"x-compress\" : \"z\",\n\t\t\"x-compressed\" : \"tgz\",\n\t\t\"x-gzip\" : \"gz\",\n\t},\n\t\"audio\" : {\n\t\t\"flac\" : \"flac\",\n\t\t\"midi\" : [ \"mid\", \"midi\", \"kar\", \"rmi\" ],\n\t\t\"mpeg\" : [ \"mpga\", \"mpega\", \"mp2\", \"mp3\", \"m4a\", \"mp2a\", \"m2a\", \"m3a\" ],\n\t\t\"mpegurl\" : \"m3u\",\n\t\t\"ogg\" : [ \"oga\", \"ogg\", \"spx\" ],\n\t\t\"x-aiff\" : [ \"aif\", \"aiff\", \"aifc\" ],\n\t\t\"x-ms-wma\" : \"wma\",\n\t\t\"x-wav\" : \"wav\",\n\t\t\"adpcm\" : \"adp\",\n\t\t\"mp4\" : \"mp4a\",\n\t\t\"webm\" : \"weba\",\n\t\t\"x-aac\" : \"aac\",\n\t\t\"x-caf\" : \"caf\",\n\t\t\"x-matroska\" : \"mka\",\n\t\t\"x-pn-realaudio-plugin\" : \"rmp\",\n\t\t\"xm\" : \"xm\",\n\t\t\"mid\" : [ \"mid\", \"rmi\" ]\n\t},\n\t\"image\" : {\n\t\t\"gif\" : \"gif\",\n\t\t\"ief\" : \"ief\",\n\t\t\"jpeg\" : [ \"jpeg\", \"jpg\", \"jpe\" ],\n\t\t\"pcx\" : \"pcx\",\n\t\t\"png\" : \"png\",\n\t\t\"svg+xml\" : [ \"svg\", \"svgz\" ],\n\t\t\"tiff\" : [ \"tiff\", \"tif\" ],\n\t\t\"x-icon\" : \"ico\",\n\t\t\"bmp\" : \"bmp\",\n\t\t\"webp\" : \"webp\",\n\t\t\"x-pict\" : [ \"pic\", \"pct\" ],\n\t\t\"x-tga\" : \"tga\",\n\t\t\"cis-cod\" : \"cod\"\n\t},\n\t\"text\" : {\n\t\t\"cache-manifest\" : [ \"manifest\", \"appcache\" ],\n\t\t\"css\" : \"css\",\n\t\t\"csv\" : \"csv\",\n\t\t\"html\" : [ \"html\", \"htm\", \"shtml\", \"stm\" ],\n\t\t\"mathml\" : \"mml\",\n\t\t\"plain\" : [ \"txt\", \"text\", \"brf\", \"conf\", \"def\", \"list\", \"log\", \"in\", \"bas\" ],\n\t\t\"richtext\" : \"rtx\",\n\t\t\"tab-separated-values\" : \"tsv\",\n\t\t\"x-bibtex\" : \"bib\"\n\t},\n\t\"video\" : {\n\t\t\"mpeg\" : [ \"mpeg\", \"mpg\", \"mpe\", \"m1v\", \"m2v\", \"mp2\", \"mpa\", \"mpv2\" ],\n\t\t\"mp4\" : [ \"mp4\", \"mp4v\", \"mpg4\" ],\n\t\t\"quicktime\" : [ \"qt\", \"mov\" ],\n\t\t\"ogg\" : \"ogv\",\n\t\t\"vnd.mpegurl\" : [ \"mxu\", \"m4u\" ],\n\t\t\"x-flv\" : \"flv\",\n\t\t\"x-la-asf\" : [ \"lsf\", \"lsx\" ],\n\t\t\"x-mng\" : \"mng\",\n\t\t\"x-ms-asf\" : [ \"asf\", \"asx\", \"asr\" ],\n\t\t\"x-ms-wm\" : \"wm\",\n\t\t\"x-ms-wmv\" : \"wmv\",\n\t\t\"x-ms-wmx\" : \"wmx\",\n\t\t\"x-ms-wvx\" : \"wvx\",\n\t\t\"x-msvideo\" : \"avi\",\n\t\t\"x-sgi-movie\" : \"movie\",\n\t\t\"x-matroska\" : [ \"mpv\", \"mkv\", \"mk3d\", \"mks\" ],\n\t\t\"3gpp2\" : \"3g2\",\n\t\t\"h261\" : \"h261\",\n\t\t\"h263\" : \"h263\",\n\t\t\"h264\" : \"h264\",\n\t\t\"jpeg\" : \"jpgv\",\n\t\t\"jpm\" : [ \"jpm\", \"jpgm\" ],\n\t\t\"mj2\" : [ \"mj2\", \"mjp2\" ],\n\t\t\"vnd.ms-playready.media.pyv\" : \"pyv\",\n\t\t\"vnd.uvvu.mp4\" : [ \"uvu\", \"uvvu\" ],\n\t\t\"vnd.vivo\" : \"viv\",\n\t\t\"webm\" : \"webm\",\n\t\t\"x-f4v\" : \"f4v\",\n\t\t\"x-m4v\" : \"m4v\",\n\t\t\"x-ms-vob\" : \"vob\",\n\t\t\"x-smv\" : \"smv\"\n\t}\n};\n\nvar mimeTypes = (function() {\n\tvar type, subtype, val, index, mimeTypes = {};\n\tfor (type in table) {\n\t\tif (table.hasOwnProperty(type)) {\n\t\t\tfor (subtype in table[type]) {\n\t\t\t\tif (table[type].hasOwnProperty(subtype)) {\n\t\t\t\t\tval = table[type][subtype];\n\t\t\t\t\tif (typeof val == \"string\") {\n\t\t\t\t\t\tmimeTypes[val] = type + \"/\" + subtype;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfor (index = 0; index < val.length; index++) {\n\t\t\t\t\t\t\tmimeTypes[val[index]] = type + \"/\" + subtype;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn mimeTypes;\n})();\n\nvar defaultValue = \"text/plain\";//\"application/octet-stream\";\n\nfunction lookup(filename) {\n\treturn filename && mimeTypes[filename.split(\".\").pop().toLowerCase()] || defaultValue;\n};\n\nmodule.exports = {\n\t'lookup': lookup\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./libs/mime/mime.js\n// module id = 19\n// module chunks = 0","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction placeHoldersCount (b64) {\n var len = b64.length\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // the number of equal signs (place holders)\n // if there are two placeholders, than the two characters before it\n // represent one byte\n // if there is only one, then the three characters before it represent 2 bytes\n // this is just a cheap hack to not do indexOf twice\n return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0\n}\n\nfunction byteLength (b64) {\n // base64 is 4/3 + up to two characters of the original data\n return b64.length * 3 / 4 - placeHoldersCount(b64)\n}\n\nfunction toByteArray (b64) {\n var i, j, l, tmp, placeHolders, arr\n var len = b64.length\n placeHolders = placeHoldersCount(b64)\n\n arr = new Arr(len * 3 / 4 - placeHolders)\n\n // if there are placeholders, only get up to the last complete 4 chars\n l = placeHolders > 0 ? len - 4 : len\n\n var L = 0\n\n for (i = 0, j = 0; i < l; i += 4, j += 3) {\n tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]\n arr[L++] = (tmp >> 16) & 0xFF\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n if (placeHolders === 2) {\n tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[L++] = tmp & 0xFF\n } else if (placeHolders === 1) {\n tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var output = ''\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n output += lookup[tmp >> 2]\n output += lookup[(tmp << 4) & 0x3F]\n output += '=='\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + (uint8[len - 1])\n output += lookup[tmp >> 10]\n output += lookup[(tmp >> 4) & 0x3F]\n output += lookup[(tmp << 2) & 0x3F]\n output += '='\n }\n\n parts.push(output)\n\n return parts.join('')\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/base64-js/index.js\n// module id = 20\n// module chunks = 0","'use strict';\n\nvar assign = require('es5-ext/object/assign')\n , normalizeOpts = require('es5-ext/object/normalize-options')\n , isCallable = require('es5-ext/object/is-callable')\n , contains = require('es5-ext/string/#/contains')\n\n , d;\n\nd = module.exports = function (dscr, value/*, options*/) {\n\tvar c, e, w, options, desc;\n\tif ((arguments.length < 2) || (typeof dscr !== 'string')) {\n\t\toptions = value;\n\t\tvalue = dscr;\n\t\tdscr = null;\n\t} else {\n\t\toptions = arguments[2];\n\t}\n\tif (dscr == null) {\n\t\tc = w = true;\n\t\te = false;\n\t} else {\n\t\tc = contains.call(dscr, 'c');\n\t\te = contains.call(dscr, 'e');\n\t\tw = contains.call(dscr, 'w');\n\t}\n\n\tdesc = { value: value, configurable: c, enumerable: e, writable: w };\n\treturn !options ? desc : assign(normalizeOpts(options), desc);\n};\n\nd.gs = function (dscr, get, set/*, options*/) {\n\tvar c, e, options, desc;\n\tif (typeof dscr !== 'string') {\n\t\toptions = set;\n\t\tset = get;\n\t\tget = dscr;\n\t\tdscr = null;\n\t} else {\n\t\toptions = arguments[3];\n\t}\n\tif (get == null) {\n\t\tget = undefined;\n\t} else if (!isCallable(get)) {\n\t\toptions = get;\n\t\tget = set = undefined;\n\t} else if (set == null) {\n\t\tset = undefined;\n\t} else if (!isCallable(set)) {\n\t\toptions = set;\n\t\tset = undefined;\n\t}\n\tif (dscr == null) {\n\t\tc = true;\n\t\te = false;\n\t} else {\n\t\tc = contains.call(dscr, 'c');\n\t\te = contains.call(dscr, 'e');\n\t}\n\n\tdesc = { get: get, set: set, configurable: c, enumerable: e };\n\treturn !options ? desc : assign(normalizeOpts(options), desc);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/d/index.js\n// module id = 21\n// module chunks = 0","'use strict';\n\nmodule.exports = require('./is-implemented')()\n\t? Object.assign\n\t: require('./shim');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/assign/index.js\n// module id = 22\n// module chunks = 0","'use strict';\n\nmodule.exports = function () {\n\tvar assign = Object.assign, obj;\n\tif (typeof assign !== 'function') return false;\n\tobj = { foo: 'raz' };\n\tassign(obj, { bar: 'dwa' }, { trzy: 'trzy' });\n\treturn (obj.foo + obj.bar + obj.trzy) === 'razdwatrzy';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/assign/is-implemented.js\n// module id = 23\n// module chunks = 0","'use strict';\n\nvar keys = require('../keys')\n , value = require('../valid-value')\n\n , max = Math.max;\n\nmodule.exports = function (dest, src/*, …srcn*/) {\n\tvar error, i, l = max(arguments.length, 2), assign;\n\tdest = Object(value(dest));\n\tassign = function (key) {\n\t\ttry { dest[key] = src[key]; } catch (e) {\n\t\t\tif (!error) error = e;\n\t\t}\n\t};\n\tfor (i = 1; i < l; ++i) {\n\t\tsrc = arguments[i];\n\t\tkeys(src).forEach(assign);\n\t}\n\tif (error !== undefined) throw error;\n\treturn dest;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/assign/shim.js\n// module id = 24\n// module chunks = 0","// Deprecated\n\n'use strict';\n\nmodule.exports = function (obj) { return typeof obj === 'function'; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/is-callable.js\n// module id = 25\n// module chunks = 0","'use strict';\n\nmodule.exports = require('./is-implemented')()\n\t? Object.keys\n\t: require('./shim');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/keys/index.js\n// module id = 26\n// module chunks = 0","'use strict';\n\nmodule.exports = function () {\n\ttry {\n\t\tObject.keys('primitive');\n\t\treturn true;\n\t} catch (e) { return false; }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/keys/is-implemented.js\n// module id = 27\n// module chunks = 0","'use strict';\n\nvar keys = Object.keys;\n\nmodule.exports = function (object) {\n\treturn keys(object == null ? object : Object(object));\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/keys/shim.js\n// module id = 28\n// module chunks = 0","'use strict';\n\nvar forEach = Array.prototype.forEach, create = Object.create;\n\nvar process = function (src, obj) {\n\tvar key;\n\tfor (key in src) obj[key] = src[key];\n};\n\nmodule.exports = function (options/*, …options*/) {\n\tvar result = create(null);\n\tforEach.call(arguments, function (options) {\n\t\tif (options == null) return;\n\t\tprocess(Object(options), result);\n\t});\n\treturn result;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/normalize-options.js\n// module id = 29\n// module chunks = 0","'use strict';\n\nmodule.exports = function (fn) {\n\tif (typeof fn !== 'function') throw new TypeError(fn + \" is not a function\");\n\treturn fn;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/valid-callable.js\n// module id = 30\n// module chunks = 0","'use strict';\n\nmodule.exports = function (value) {\n\tif (value == null) throw new TypeError(\"Cannot use null or undefined\");\n\treturn value;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/valid-value.js\n// module id = 31\n// module chunks = 0","'use strict';\n\nmodule.exports = require('./is-implemented')()\n\t? String.prototype.contains\n\t: require('./shim');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/string/#/contains/index.js\n// module id = 32\n// module chunks = 0","'use strict';\n\nvar str = 'razdwatrzy';\n\nmodule.exports = function () {\n\tif (typeof str.contains !== 'function') return false;\n\treturn ((str.contains('dwa') === true) && (str.contains('foo') === false));\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/string/#/contains/is-implemented.js\n// module id = 33\n// module chunks = 0","'use strict';\n\nvar indexOf = String.prototype.indexOf;\n\nmodule.exports = function (searchString/*, position*/) {\n\treturn indexOf.call(this, searchString, arguments[1]) > -1;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/string/#/contains/shim.js\n// module id = 34\n// module chunks = 0","var core = require('./core');\nvar request = require('./request');\nvar mime = require('../libs/mime/mime');\nvar Path = require('./core').Path;\n\n/**\n * Handles Unzipping a requesting files from an Epub Archive\n * @class\n */\nfunction Archive() {\n\tthis.zip = undefined;\n\tthis.checkRequirements();\n\tthis.urlCache = {};\n}\n\n/**\n * Checks to see if JSZip exists in global namspace,\n * Requires JSZip if it isn't there\n * @private\n */\nArchive.prototype.checkRequirements = function(){\n\ttry {\n\t\tif (typeof JSZip === 'undefined') {\n\t\t\tJSZip = require('jszip');\n\t\t}\n\t\tthis.zip = new JSZip();\n\t} catch (e) {\n\t\tconsole.error(\"JSZip lib not loaded\");\n\t}\n};\n\n/**\n * Open an archive\n * @param {binary} input\n * @param {boolean} isBase64 tells JSZip if the input data is base64 encoded\n * @return {Promise} zipfile\n */\nArchive.prototype.open = function(input, isBase64){\n\treturn this.zip.loadAsync(input, {\"base64\": isBase64});\n};\n\n/**\n * Load and Open an archive\n * @param {string} zipUrl\n * @param {boolean} isBase64 tells JSZip if the input data is base64 encoded\n * @return {Promise} zipfile\n */\nArchive.prototype.openUrl = function(zipUrl, isBase64){\n\treturn request(zipUrl, \"binary\")\n\t\t.then(function(data){\n\t\t\treturn this.zip.loadAsync(data, {\"base64\": isBase64});\n\t\t}.bind(this));\n};\n\n/**\n * Request\n * @param {string} url a url to request from the archive\n * @param {[string]} type specify the type of the returned result\n * @return {Promise}\n */\nArchive.prototype.request = function(url, type){\n\tvar deferred = new core.defer();\n\tvar response;\n\tvar r;\n\tvar path = new Path(url);\n\n\t// If type isn't set, determine it from the file extension\n\tif(!type) {\n\t\ttype = path.extension;\n\t}\n\n\tif(type == 'blob'){\n\t\tresponse = this.getBlob(url);\n\t} else {\n\t\tresponse = this.getText(url);\n\t}\n\n\tif (response) {\n\t\tresponse.then(function (r) {\n\t\t\tresult = this.handleResponse(r, type);\n\t\t\tdeferred.resolve(result);\n\t\t}.bind(this));\n\t} else {\n\t\tdeferred.reject({\n\t\t\tmessage : \"File not found in the epub: \" + url,\n\t\t\tstack : new Error().stack\n\t\t});\n\t}\n\treturn deferred.promise;\n};\n\n/**\n * Handle the response from request\n * @private\n * @param {any} response\n * @param {[string]} type\n * @return {any} the parsed result\n */\nArchive.prototype.handleResponse = function(response, type){\n\tvar r;\n\n\tif(type == \"json\") {\n\t\tr = JSON.parse(response);\n\t}\n\telse\n\tif(core.isXml(type)) {\n\t\tr = core.parse(response, \"text/xml\");\n\t}\n\telse\n\tif(type == 'xhtml') {\n\t\tr = core.parse(response, \"application/xhtml+xml\");\n\t}\n\telse\n\tif(type == 'html' || type == 'htm') {\n\t\tr = core.parse(response, \"text/html\");\n\t } else {\n\t\t r = response;\n\t }\n\n\treturn r;\n};\n\n/**\n * Get a Blob from Archive by Url\n * @param {string} url\n * @param {[string]} mimeType\n * @return {Blob}\n */\nArchive.prototype.getBlob = function(url, mimeType){\n\tvar decodededUrl = window.decodeURIComponent(url.substr(1)); // Remove first slash\n\tvar entry = this.zip.file(decodededUrl);\n\n\tif(entry) {\n\t\tmimeType = mimeType || mime.lookup(entry.name);\n\t\treturn entry.async(\"uint8array\").then(function(uint8array) {\n\t\t\treturn new Blob([uint8array], {type : mimeType});\n\t\t});\n\t}\n};\n\n/**\n * Get Text from Archive by Url\n * @param {string} url\n * @param {[string]} encoding\n * @return {string}\n */\nArchive.prototype.getText = function(url, encoding){\n\tvar decodededUrl = window.decodeURIComponent(url.substr(1)); // Remove first slash\n\tvar entry = this.zip.file(decodededUrl);\n\n\tif(entry) {\n\t\treturn entry.async(\"string\").then(function(text) {\n\t\t\treturn text;\n\t\t});\n\t}\n};\n\n/**\n * Get a base64 encoded result from Archive by Url\n * @param {string} url\n * @param {[string]} mimeType\n * @return {string} base64 encoded\n */\nArchive.prototype.getBase64 = function(url, mimeType){\n\tvar decodededUrl = window.decodeURIComponent(url.substr(1)); // Remove first slash\n\tvar entry = this.zip.file(decodededUrl);\n\n\tif(entry) {\n\t\tmimeType = mimeType || mime.lookup(entry.name);\n\t\treturn entry.async(\"base64\").then(function(data) {\n\t\t\treturn \"data:\" + mimeType + \";base64,\" + data;\n\t\t});\n\t}\n};\n\n/**\n * Create a Url from an unarchived item\n * @param {string} url\n * @param {[object]} options.base64 use base64 encoding or blob url\n * @return {Promise} url promise with Url string\n */\nArchive.prototype.createUrl = function(url, options){\n\tvar deferred = new core.defer();\n\tvar _URL = window.URL || window.webkitURL || window.mozURL;\n\tvar tempUrl;\n\tvar blob;\n\tvar response;\n\tvar useBase64 = options && options.base64;\n\n\tif(url in this.urlCache) {\n\t\tdeferred.resolve(this.urlCache[url]);\n\t\treturn deferred.promise;\n\t}\n\n\tif (useBase64) {\n\t\tresponse = this.getBase64(url);\n\n\t\tif (response) {\n\t\t\tresponse.then(function(tempUrl) {\n\n\t\t\t\tthis.urlCache[url] = tempUrl;\n\t\t\t\tdeferred.resolve(tempUrl);\n\n\t\t\t}.bind(this));\n\n\t\t}\n\n\t} else {\n\n\t\tresponse = this.getBlob(url);\n\n\t\tif (response) {\n\t\t\tresponse.then(function(blob) {\n\n\t\t\t\ttempUrl = _URL.createObjectURL(blob);\n\t\t\t\tthis.urlCache[url] = tempUrl;\n\t\t\t\tdeferred.resolve(tempUrl);\n\n\t\t\t}.bind(this));\n\n\t\t}\n\t}\n\n\n\tif (!response) {\n\t\tdeferred.reject({\n\t\t\tmessage : \"File not found in the epub: \" + url,\n\t\t\tstack : new Error().stack\n\t\t});\n\t}\n\n\treturn deferred.promise;\n};\n\n/**\n * Revoke Temp Url for a achive item\n * @param {string} url url of the item in the archive\n */\nArchive.prototype.revokeUrl = function(url){\n\tvar _URL = window.URL || window.webkitURL || window.mozURL;\n\tvar fromCache = this.urlCache[url];\n\tif(fromCache) _URL.revokeObjectURL(fromCache);\n};\n\nmodule.exports = Archive;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/archive.js\n// module id = 36\n// module chunks = 0","var path = require('path');\nvar core = require('./core');\nvar EpubCFI = require('./epubcfi');\n\n/**\n * Handles Parsing and Accessing an Epub Container\n * @class\n * @param {[document]} containerDocument xml document\n */\nfunction Container(containerDocument) {\n\tif (containerDocument) {\n\t\tthis.parse(containerDocument);\n\t}\n};\n\n/**\n * Parse the Container XML\n * @param {document} containerDocument\n */\nContainer.prototype.parse = function(containerDocument){\n\t\t//-- \n\t\tvar rootfile, fullpath, folder, encoding;\n\n\t\tif(!containerDocument) {\n\t\t\tconsole.error(\"Container File Not Found\");\n\t\t\treturn;\n\t\t}\n\n\t\trootfile = core.qs(containerDocument, \"rootfile\");\n\n\t\tif(!rootfile) {\n\t\t\tconsole.error(\"No RootFile Found\");\n\t\t\treturn;\n\t\t}\n\n\t\tthis.packagePath = rootfile.getAttribute('full-path');\n\t\tthis.directory = path.dirname(this.packagePath);\n\t\tthis.encoding = containerDocument.xmlEncoding;\n};\n\nmodule.exports = Container;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/container.js\n// module id = 37\n// module chunks = 0","var core = require('./core');\n\n/**\n * Figures out the CSS to apply for a layout\n * @class\n * @param {object} settings\n * @param {[string=reflowable]} settings.layout\n * @param {[string]} settings.spread\n * @param {[int=800]} settings.minSpreadWidth\n * @param {[boolean=false]} settings.evenSpreads\n */\nfunction Layout(settings){\n\tthis.name = settings.layout || \"reflowable\";\n\tthis._spread = (settings.spread === \"none\") ? false : true;\n\tthis._minSpreadWidth = settings.minSpreadWidth || 800;\n\tthis._evenSpreads = settings.evenSpreads || false;\n\n\tif (settings.flow === \"scrolled-continuous\" ||\n\t\t\tsettings.flow === \"scrolled-doc\") {\n\t\tthis._flow = \"scrolled\";\n\t} else {\n\t\tthis._flow = \"paginated\";\n\t}\n\n\n\tthis.width = 0;\n\tthis.height = 0;\n\tthis.spreadWidth = 0;\n\tthis.delta = 0;\n\n\tthis.columnWidth = 0;\n\tthis.gap = 0;\n\tthis.divisor = 1;\n};\n\n/**\n * Switch the flow between paginated and scrolled\n * @param {string} flow paginated | scrolled\n */\nLayout.prototype.flow = function(flow) {\n\tthis._flow = (flow === \"paginated\") ? \"paginated\" : \"scrolled\";\n}\n\n/**\n * Switch between using spreads or not, and set the\n * width at which they switch to single.\n * @param {string} spread true | false\n * @param {boolean} min integer in pixels\n */\nLayout.prototype.spread = function(spread, min) {\n\n\tthis._spread = (spread === \"none\") ? false : true;\n\n\tif (min >= 0) {\n\t\tthis._minSpreadWidth = min;\n\t}\n}\n\n/**\n * Calculate the dimensions of the pagination\n * @param {number} _width [description]\n * @param {number} _height [description]\n * @param {number} _gap [description]\n */\nLayout.prototype.calculate = function(_width, _height, _gap){\n\n\tvar divisor = 1;\n\tvar gap = _gap || 0;\n\n\t//-- Check the width and create even width columns\n\tvar fullWidth = Math.floor(_width);\n\tvar width = _width;\n\n\tvar section = Math.floor(width / 8);\n\n\tvar colWidth;\n\tvar spreadWidth;\n\tvar delta;\n\n\tif (this._spread && width >= this._minSpreadWidth) {\n\t\tdivisor = 2;\n\t} else {\n\t\tdivisor = 1;\n\t}\n\n\tif (this.name === \"reflowable\" && this._flow === \"paginated\" && !(_gap >= 0)) {\n\t\tgap = ((section % 2 === 0) ? section : section - 1);\n\t}\n\n\tif (this.name === \"pre-paginated\" ) {\n\t\tgap = 0;\n\t}\n\n\t//-- Double Page\n\tif(divisor > 1) {\n\t\tcolWidth = Math.floor((width - gap) / divisor);\n\t} else {\n\t\tcolWidth = width;\n\t}\n\n\tif (this.name === \"pre-paginated\" && divisor > 1) {\n\t\twidth = colWidth;\n\t}\n\n\tspreadWidth = colWidth * divisor;\n\n\tdelta = (colWidth + gap) * divisor;\n\n\tthis.width = width;\n\tthis.height = _height;\n\tthis.spreadWidth = spreadWidth;\n\tthis.delta = delta;\n\n\tthis.columnWidth = colWidth;\n\tthis.gap = gap;\n\tthis.divisor = divisor;\n};\n\n/**\n * Apply Css to a Document\n * @param {Contents} contents\n * @return {[Promise]}\n */\nLayout.prototype.format = function(contents){\n\tvar formating;\n\n\tif (this.name === \"pre-paginated\") {\n\t\tformating = contents.fit(this.columnWidth, this.height);\n\t} else if (this._flow === \"paginated\") {\n\t\tformating = contents.columns(this.width, this.height, this.columnWidth, this.gap);\n\t} else { // scrolled\n\t\tformating = contents.size(this.width, null);\n\t}\n\n\treturn formating; // might be a promise in some View Managers\n};\n\n/**\n * Count number of pages\n * @param {number} totalWidth\n * @return {number} spreads\n * @return {number} pages\n */\nLayout.prototype.count = function(totalWidth) {\n\t// var totalWidth = contents.scrollWidth();\n\tvar spreads = Math.ceil( totalWidth / this.spreadWidth);\n\n\treturn {\n\t\tspreads : spreads,\n\t\tpages : spreads * this.divisor\n\t};\n};\n\nmodule.exports = Layout;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/layout.js\n// module id = 38\n// module chunks = 0","var core = require('./core');\nvar Queue = require('./queue');\nvar EpubCFI = require('./epubcfi');\nvar EventEmitter = require('event-emitter');\n\n/**\n * Find Locations for a Book\n * @param {Spine} spine\n * @param {request} request\n */\nfunction Locations(spine, request) {\n\tthis.spine = spine;\n\tthis.request = request;\n\n\tthis.q = new Queue(this);\n\tthis.epubcfi = new EpubCFI();\n\n\tthis._locations = [];\n\tthis.total = 0;\n\n\tthis.break = 150;\n\n\tthis._current = 0;\n\n};\n\n/**\n * Load all of sections in the book to generate locations\n * @param {int} chars how many chars to split on\n * @return {object} locations\n */\nLocations.prototype.generate = function(chars) {\n\n\tif (chars) {\n\t\tthis.break = chars;\n\t}\n\n\tthis.q.pause();\n\n\tthis.spine.each(function(section) {\n\n\t\tthis.q.enqueue(this.process, section);\n\n\t}.bind(this));\n\n\treturn this.q.run().then(function() {\n\t\tthis.total = this._locations.length-1;\n\n\t\tif (this._currentCfi) {\n\t\t\tthis.currentLocation = this._currentCfi;\n\t\t}\n\n\t\treturn this._locations;\n\t\t// console.log(this.percentage(this.book.rendition.location.start), this.percentage(this.book.rendition.location.end));\n\t}.bind(this));\n\n};\n\nLocations.prototype.process = function(section) {\n\n\treturn section.load(this.request)\n\t\t.then(function(contents) {\n\n\t\t\tvar range;\n\t\t\tvar doc = contents.ownerDocument;\n\t\t\tvar body = core.qs(doc, 'body');\n\t\t\tvar counter = 0;\n\n\t\t\tthis.sprint(body, function(node) {\n\t\t\t\tvar len = node.length;\n\t\t\t\tvar dist;\n\t\t\t\tvar pos = 0;\n\n\t\t\t\t// Start range\n\t\t\t\tif (counter == 0) {\n\t\t\t\t\trange = doc.createRange();\n\t\t\t\t\trange.setStart(node, 0);\n\t\t\t\t}\n\n\t\t\t\tdist = this.break - counter;\n\n\t\t\t\t// Node is smaller than a break\n\t\t\t\tif(dist > len){\n\t\t\t\t\tcounter += len;\n\t\t\t\t\tpos = len;\n\t\t\t\t}\n\n\t\t\t\twhile (pos < len) {\n\t\t\t\t\tcounter = this.break;\n\t\t\t\t\tpos += this.break;\n\n\t\t\t\t\t// Gone over\n\t\t\t\t\tif(pos >= len){\n\t\t\t\t\t\t// Continue counter for next node\n\t\t\t\t\t\tcounter = len - (pos - this.break);\n\n\t\t\t\t\t// At End\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// End the previous range\n\t\t\t\t\t\trange.setEnd(node, pos);\n\t\t\t\t\t\tcfi = section.cfiFromRange(range);\n\t\t\t\t\t\tthis._locations.push(cfi);\n\t\t\t\t\t\tcounter = 0;\n\n\t\t\t\t\t\t// Start new range\n\t\t\t\t\t\tpos += 1;\n\t\t\t\t\t\trange = doc.createRange();\n\t\t\t\t\t\trange.setStart(node, pos);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\n\t\t\t}.bind(this));\n\n\t\t\t// Close remaining\n\t\t\tif (range) {\n\t\t\t\trange.setEnd(prev, prev.length);\n\t\t\t\tcfi = section.cfiFromRange(range);\n\t\t\t\tthis._locations.push(cfi)\n\t\t\t\tcounter = 0;\n\t\t\t}\n\n\t\t}.bind(this));\n\n};\n\nLocations.prototype.sprint = function(root, func) {\n\tvar treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, null, false);\n\n\twhile ((node = treeWalker.nextNode())) {\n\t\tfunc(node);\n\t}\n\n};\n\nLocations.prototype.locationFromCfi = function(cfi){\n\t// Check if the location has not been set yet\n\tif(this._locations.length === 0) {\n\t\treturn -1;\n\t}\n\treturn core.locationOf(cfi.start, this._locations, this.epubcfi.compare);\n};\n\nLocations.prototype.percentageFromCfi = function(cfi) {\n\tif(this._locations.length === 0) {\n\t\treturn null;\n\t}\n\t// Find closest cfi\n\tvar loc = this.locationFromCfi(cfi);\n\t// Get percentage in total\n\treturn this.percentageFromLocation(loc);\n};\n\nLocations.prototype.percentageFromLocation = function(loc) {\n\tif (!loc || !this.total) {\n\t\treturn 0;\n\t}\n\treturn (loc / this.total);\n};\n\nLocations.prototype.cfiFromLocation = function(loc){\n\tvar cfi = -1;\n\t// check that pg is an int\n\tif(typeof loc != \"number\"){\n\t\tloc = parseInt(pg);\n\t}\n\n\tif(loc >= 0 && loc < this._locations.length) {\n\t\tcfi = this._locations[loc];\n\t}\n\n\treturn cfi;\n};\n\nLocations.prototype.cfiFromPercentage = function(value){\n\tvar percentage = (value > 1) ? value / 100 : value; // Normalize value to 0-1\n\tvar loc = Math.ceil(this.total * percentage);\n\n\treturn this.cfiFromLocation(loc);\n};\n\nLocations.prototype.load = function(locations){\n\tthis._locations = JSON.parse(locations);\n\tthis.total = this._locations.length-1;\n\treturn this._locations;\n};\n\nLocations.prototype.save = function(json){\n\treturn JSON.stringify(this._locations);\n};\n\nLocations.prototype.getCurrent = function(json){\n\treturn this._current;\n};\n\nLocations.prototype.setCurrent = function(curr){\n\tvar loc;\n\n\tif(typeof curr == \"string\"){\n\t\tthis._currentCfi = curr;\n\t} else if (typeof curr == \"number\") {\n\t\tthis._current = curr;\n\t} else {\n\t\treturn;\n\t}\n\n\tif(this._locations.length === 0) {\n\t\treturn;\n\t}\n\n\tif(typeof curr == \"string\"){\n\t\tloc = this.locationFromCfi(curr);\n\t\tthis._current = loc;\n\t} else {\n\t\tloc = curr;\n\t}\n\n\tthis.emit(\"changed\", {\n\t\tpercentage: this.percentageFromLocation(loc)\n\t});\n};\n\nObject.defineProperty(Locations.prototype, 'currentLocation', {\n\tget: function () {\n\t\treturn this._current;\n\t},\n\tset: function (curr) {\n\t\tthis.setCurrent(curr);\n\t}\n});\n\nEventEmitter(Locations.prototype);\n\nmodule.exports = Locations;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/locations.js\n// module id = 39\n// module chunks = 0","var core = require('../../core');\n\nfunction Stage(_options) {\n\tthis.settings = _options || {};\n\tthis.id = \"epubjs-container-\" + core.uuid();\n\n\tthis.container = this.create(this.settings);\n\n\tif(this.settings.hidden) {\n\t\tthis.wrapper = this.wrap(this.container);\n\t}\n\n}\n\n/*\n* Creates an element to render to.\n* Resizes to passed width and height or to the elements size\n*/\nStage.prototype.create = function(options){\n\tvar height = options.height;// !== false ? options.height : \"100%\";\n\tvar width = options.width;// !== false ? options.width : \"100%\";\n\tvar overflow = options.overflow || false;\n\tvar axis = options.axis || \"vertical\";\n\n\tif(options.height && core.isNumber(options.height)) {\n\t\theight = options.height + \"px\";\n\t}\n\n\tif(options.width && core.isNumber(options.width)) {\n\t\twidth = options.width + \"px\";\n\t}\n\n\t// Create new container element\n\tcontainer = document.createElement(\"div\");\n\n\tcontainer.id = this.id;\n\tcontainer.classList.add(\"epub-container\");\n\n\t// Style Element\n\t// container.style.fontSize = \"0\";\n\tcontainer.style.wordSpacing = \"0\";\n\tcontainer.style.lineHeight = \"0\";\n\tcontainer.style.verticalAlign = \"top\";\n\n\tif(axis === \"horizontal\") {\n\t\tcontainer.style.whiteSpace = \"nowrap\";\n\t}\n\n\tif(width){\n\t\tcontainer.style.width = width;\n\t}\n\n\tif(height){\n\t\tcontainer.style.height = height;\n\t}\n\n\tif (overflow) {\n\t\tcontainer.style.overflow = overflow;\n\t}\n\n\treturn container;\n};\n\nStage.wrap = function(container) {\n\tvar wrapper = document.createElement(\"div\");\n\n\twrapper.style.visibility = \"hidden\";\n\twrapper.style.overflow = \"hidden\";\n\twrapper.style.width = \"0\";\n\twrapper.style.height = \"0\";\n\n\twrapper.appendChild(container);\n\treturn wrapper;\n};\n\n\nStage.prototype.getElement = function(_element){\n\tvar element;\n\n\tif(core.isElement(_element)) {\n\t\telement = _element;\n\t} else if (typeof _element === \"string\") {\n\t\telement = document.getElementById(_element);\n\t}\n\n\tif(!element){\n\t\tconsole.error(\"Not an Element\");\n\t\treturn;\n\t}\n\n\treturn element;\n};\n\nStage.prototype.attachTo = function(what){\n\n\tvar element = this.getElement(what);\n\tvar base;\n\n\tif(!element){\n\t\treturn;\n\t}\n\n\tif(this.settings.hidden) {\n\t\tbase = this.wrapper;\n\t} else {\n\t\tbase = this.container;\n\t}\n\n\telement.appendChild(base);\n\n\tthis.element = element;\n\n\treturn element;\n\n};\n\nStage.prototype.getContainer = function() {\n\treturn this.container;\n};\n\nStage.prototype.onResize = function(func){\n\t// Only listen to window for resize event if width and height are not fixed.\n\t// This applies if it is set to a percent or auto.\n\tif(!core.isNumber(this.settings.width) ||\n\t\t !core.isNumber(this.settings.height) ) {\n\t\twindow.addEventListener(\"resize\", func, false);\n\t}\n\n};\n\nStage.prototype.size = function(width, height){\n\tvar bounds;\n\t// var width = _width || this.settings.width;\n\t// var height = _height || this.settings.height;\n\n\t// If width or height are set to false, inherit them from containing element\n\tif(width === null) {\n\t\tbounds = this.element.getBoundingClientRect();\n\n\t\tif(bounds.width) {\n\t\t\twidth = bounds.width;\n\t\t\tthis.container.style.width = bounds.width + \"px\";\n\t\t}\n\t}\n\n\tif(height === null) {\n\t\tbounds = bounds || this.element.getBoundingClientRect();\n\n\t\tif(bounds.height) {\n\t\t\theight = bounds.height;\n\t\t\tthis.container.style.height = bounds.height + \"px\";\n\t\t}\n\n\t}\n\n\tif(!core.isNumber(width)) {\n\t\tbounds = this.container.getBoundingClientRect();\n\t\twidth = bounds.width;\n\t\t//height = bounds.height;\n\t}\n\n\tif(!core.isNumber(height)) {\n\t\tbounds = bounds || this.container.getBoundingClientRect();\n\t\t//width = bounds.width;\n\t\theight = bounds.height;\n\t}\n\n\n\tthis.containerStyles = window.getComputedStyle(this.container);\n\n\tthis.containerPadding = {\n\t\tleft: parseFloat(this.containerStyles[\"padding-left\"]) || 0,\n\t\tright: parseFloat(this.containerStyles[\"padding-right\"]) || 0,\n\t\ttop: parseFloat(this.containerStyles[\"padding-top\"]) || 0,\n\t\tbottom: parseFloat(this.containerStyles[\"padding-bottom\"]) || 0\n\t};\n\n\treturn {\n\t\twidth: width -\n\t\t\t\t\t\tthis.containerPadding.left -\n\t\t\t\t\t\tthis.containerPadding.right,\n\t\theight: height -\n\t\t\t\t\t\tthis.containerPadding.top -\n\t\t\t\t\t\tthis.containerPadding.bottom\n\t};\n\n};\n\nStage.prototype.bounds = function(){\n\n\tif(!this.container) {\n\t\treturn core.windowBounds();\n\t} else {\n\t\treturn this.container.getBoundingClientRect();\n\t}\n\n}\n\nStage.prototype.getSheet = function(){\n\tvar style = document.createElement(\"style\");\n\n\t// WebKit hack --> https://davidwalsh.name/add-rules-stylesheets\n\tstyle.appendChild(document.createTextNode(\"\"));\n\n\tdocument.head.appendChild(style);\n\n\treturn style.sheet;\n}\n\nStage.prototype.addStyleRules = function(selector, rulesArray){\n\tvar scope = \"#\" + this.id + \" \";\n\tvar rules = \"\";\n\n\tif(!this.sheet){\n\t\tthis.sheet = this.getSheet();\n\t}\n\n\trulesArray.forEach(function(set) {\n\t\tfor (var prop in set) {\n\t\t\tif(set.hasOwnProperty(prop)) {\n\t\t\t\trules += prop + \":\" + set[prop] + \";\";\n\t\t\t}\n\t\t}\n\t})\n\n\tthis.sheet.insertRule(scope + selector + \" {\" + rules + \"}\", 0);\n}\n\n\n\nmodule.exports = Stage;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/managers/helpers/stage.js\n// module id = 40\n// module chunks = 0","function Views(container) {\n\tthis.container = container;\n\tthis._views = [];\n\tthis.length = 0;\n\tthis.hidden = false;\n};\n\nViews.prototype.all = function() {\n\treturn this._views;\n};\n\nViews.prototype.first = function() {\n\treturn this._views[0];\n};\n\nViews.prototype.last = function() {\n\treturn this._views[this._views.length-1];\n};\n\nViews.prototype.indexOf = function(view) {\n\treturn this._views.indexOf(view);\n};\n\nViews.prototype.slice = function() {\n\treturn this._views.slice.apply(this._views, arguments);\n};\n\nViews.prototype.get = function(i) {\n\treturn this._views[i];\n};\n\nViews.prototype.append = function(view){\n\tthis._views.push(view);\n\tif(this.container){\n\t\tthis.container.appendChild(view.element);\n\t}\n\tthis.length++;\n\treturn view;\n};\n\nViews.prototype.prepend = function(view){\n\tthis._views.unshift(view);\n\tif(this.container){\n\t\tthis.container.insertBefore(view.element, this.container.firstChild);\n\t}\n\tthis.length++;\n\treturn view;\n};\n\nViews.prototype.insert = function(view, index) {\n\tthis._views.splice(index, 0, view);\n\n\tif(this.container){\n\t\tif(index < this.container.children.length){\n\t\t\tthis.container.insertBefore(view.element, this.container.children[index]);\n\t\t} else {\n\t\t\tthis.container.appendChild(view.element);\n\t\t}\n\t}\n\n\tthis.length++;\n\treturn view;\n};\n\nViews.prototype.remove = function(view) {\n\tvar index = this._views.indexOf(view);\n\n\tif(index > -1) {\n\t\tthis._views.splice(index, 1);\n\t}\n\n\n\tthis.destroy(view);\n\n\tthis.length--;\n};\n\nViews.prototype.destroy = function(view) {\n\tif(view.displayed){\n\t\tview.destroy();\n\t}\n\n\tif(this.container){\n\t\t this.container.removeChild(view.element);\n\t}\n\tview = null;\n};\n\n// Iterators\n\nViews.prototype.each = function() {\n\treturn this._views.forEach.apply(this._views, arguments);\n};\n\nViews.prototype.clear = function(){\n\t// Remove all views\n\tvar view;\n\tvar len = this.length;\n\n\tif(!this.length) return;\n\n\tfor (var i = 0; i < len; i++) {\n\t\tview = this._views[i];\n\t\tthis.destroy(view);\n\t}\n\n\tthis._views = [];\n\tthis.length = 0;\n};\n\nViews.prototype.find = function(section){\n\n\tvar view;\n\tvar len = this.length;\n\n\tfor (var i = 0; i < len; i++) {\n\t\tview = this._views[i];\n\t\tif(view.displayed && view.section.index == section.index) {\n\t\t\treturn view;\n\t\t}\n\t}\n\n};\n\nViews.prototype.displayed = function(){\n\tvar displayed = [];\n\tvar view;\n\tvar len = this.length;\n\n\tfor (var i = 0; i < len; i++) {\n\t\tview = this._views[i];\n\t\tif(view.displayed){\n\t\t\tdisplayed.push(view);\n\t\t}\n\t}\n\treturn displayed;\n};\n\nViews.prototype.show = function(){\n\tvar view;\n\tvar len = this.length;\n\n\tfor (var i = 0; i < len; i++) {\n\t\tview = this._views[i];\n\t\tif(view.displayed){\n\t\t\tview.show();\n\t\t}\n\t}\n\tthis.hidden = false;\n};\n\nViews.prototype.hide = function(){\n\tvar view;\n\tvar len = this.length;\n\n\tfor (var i = 0; i < len; i++) {\n\t\tview = this._views[i];\n\t\tif(view.displayed){\n\t\t\tview.hide();\n\t\t}\n\t}\n\tthis.hidden = true;\n};\n\nmodule.exports = Views;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/managers/helpers/views.js\n// module id = 41\n// module chunks = 0","var core = require('./core');\nvar path = require('path');\n\n/**\n * Navigation Parser\n * @param {document} xml navigation html / xhtml / ncx\n */\nfunction Navigation(xml){\n\tthis.toc = [];\n\tthis.tocByHref = {};\n\tthis.tocById = {};\n\n\tif (xml) {\n\t\tthis.parse(xml);\n\t}\n};\n\n/**\n * Parse out the navigation items\n * @param {document} xml navigation html / xhtml / ncx\n */\nNavigation.prototype.parse = function(xml) {\n\tvar html = core.qs(xml, \"html\");\n\tvar ncx = core.qs(xml, \"ncx\");\n\n\tif(html) {\n\t\tthis.toc = this.parseNav(xml);\n\t} else if(ncx){\n\t\tthis.toc = this.parseNcx(xml);\n\t}\n\n\tthis.unpack(this.toc);\n};\n\n/**\n * Unpack navigation items\n * @private\n * @param {array} toc\n */\nNavigation.prototype.unpack = function(toc) {\n\tvar item;\n\n\tfor (var i = 0; i < toc.length; i++) {\n\t\titem = toc[i];\n\t\tthis.tocByHref[item.href] = i;\n\t\tthis.tocById[item.id] = i;\n\t}\n\n};\n\n/**\n * Get an item from the navigation\n * @param {string} target\n * @return {object} navItems\n */\nNavigation.prototype.get = function(target) {\n\tvar index;\n\n\tif(!target) {\n\t\treturn this.toc;\n\t}\n\n\tif(target.indexOf(\"#\") === 0) {\n\t\tindex = this.tocById[target.substring(1)];\n\t} else if(target in this.tocByHref){\n\t\tindex = this.tocByHref[target];\n\t}\n\n\treturn this.toc[index];\n};\n\n/**\n * Parse from a Epub > 3.0 Nav\n * @private\n * @param {document} navHtml\n * @return {array} navigation list\n */\nNavigation.prototype.parseNav = function(navHtml){\n\tvar navElement = core.querySelectorByType(navHtml, \"nav\", \"toc\");\n\tvar navItems = navElement ? core.qsa(navElement, \"li\") : [];\n\tvar length = navItems.length;\n\tvar i;\n\tvar toc = {};\n\tvar list = [];\n\tvar item, parent;\n\n\tif(!navItems || length === 0) return list;\n\n\tfor (i = 0; i < length; ++i) {\n\t\titem = this.navItem(navItems[i]);\n\t\ttoc[item.id] = item;\n\t\tif(!item.parent) {\n\t\t\tlist.push(item);\n\t\t} else {\n\t\t\tparent = toc[item.parent];\n\t\t\tparent.subitems.push(item);\n\t\t}\n\t}\n\n\treturn list;\n};\n\n/**\n * Create a navItem\n * @private\n * @param {element} item\n * @return {object} navItem\n */\nNavigation.prototype.navItem = function(item){\n\tvar id = item.getAttribute('id') || false,\n\t\t\tcontent = core.qs(item, \"a\"),\n\t\t\tsrc = content.getAttribute('href') || '',\n\t\t\ttext = content.textContent || \"\",\n\t\t\tsubitems = [],\n\t\t\tparentNode = item.parentNode,\n\t\t\tparent;\n\n\tif(parentNode && parentNode.nodeName === \"navPoint\") {\n\t\tparent = parentNode.getAttribute('id');\n\t}\n\n\treturn {\n\t\t\"id\": id,\n\t\t\"href\": src,\n\t\t\"label\": text,\n\t\t\"subitems\" : subitems,\n\t\t\"parent\" : parent\n\t};\n};\n\n/**\n * Parse from a Epub > 3.0 NC\n * @private\n * @param {document} navHtml\n * @return {array} navigation list\n */\nNavigation.prototype.parseNcx = function(tocXml){\n\tvar navPoints = core.qsa(tocXml, \"navPoint\");\n\tvar length = navPoints.length;\n\tvar i;\n\tvar toc = {};\n\tvar list = [];\n\tvar item, parent;\n\n\tif(!navPoints || length === 0) return list;\n\n\tfor (i = 0; i < length; ++i) {\n\t\titem = this.ncxItem(navPoints[i]);\n\t\ttoc[item.id] = item;\n\t\tif(!item.parent) {\n\t\t\tlist.push(item);\n\t\t} else {\n\t\t\tparent = toc[item.parent];\n\t\t\tparent.subitems.push(item);\n\t\t}\n\t}\n\n\treturn list;\n};\n\n/**\n * Create a ncxItem\n * @private\n * @param {element} item\n * @return {object} ncxItem\n */\nNavigation.prototype.ncxItem = function(item){\n\tvar id = item.getAttribute('id') || false,\n\t\t\tcontent = core.qs(item, \"content\"),\n\t\t\tsrc = content.getAttribute('src'),\n\t\t\tnavLabel = core.qs(item, \"navLabel\"),\n\t\t\ttext = navLabel.textContent ? navLabel.textContent : \"\",\n\t\t\tsubitems = [],\n\t\t\tparentNode = item.parentNode,\n\t\t\tparent;\n\n\tif(parentNode && parentNode.nodeName === \"navPoint\") {\n\t\tparent = parentNode.getAttribute('id');\n\t}\n\n\n\treturn {\n\t\t\"id\": id,\n\t\t\"href\": src,\n\t\t\"label\": text,\n\t\t\"subitems\" : subitems,\n\t\t\"parent\" : parent\n\t};\n};\n\nmodule.exports = Navigation;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/navigation.js\n// module id = 42\n// module chunks = 0","var path = require('path');\nvar core = require('./core');\nvar EpubCFI = require('./epubcfi');\n\n/**\n * Open Packaging Format Parser\n * @class\n * @param {document} packageDocument OPF XML\n */\nfunction Packaging(packageDocument) {\n\tif (packageDocument) {\n\t\tthis.parse(packageDocument);\n\t}\n};\n\n/**\n * Parse OPF XML\n * @param {document} packageDocument OPF XML\n * @return {object} parsed package parts\n */\nPackaging.prototype.parse = function(packageDocument){\n\tvar metadataNode, manifestNode, spineNode;\n\n\tif(!packageDocument) {\n\t\tconsole.error(\"Package File Not Found\");\n\t\treturn;\n\t}\n\n\tmetadataNode = core.qs(packageDocument, \"metadata\");\n\tif(!metadataNode) {\n\t\tconsole.error(\"No Metadata Found\");\n\t\treturn;\n\t}\n\n\tmanifestNode = core.qs(packageDocument, \"manifest\");\n\tif(!manifestNode) {\n\t\tconsole.error(\"No Manifest Found\");\n\t\treturn;\n\t}\n\n\tspineNode = core.qs(packageDocument, \"spine\");\n\tif(!spineNode) {\n\t\tconsole.error(\"No Spine Found\");\n\t\treturn;\n\t}\n\n\tthis.manifest = this.parseManifest(manifestNode);\n\tthis.navPath = this.findNavPath(manifestNode);\n\tthis.ncxPath = this.findNcxPath(manifestNode, spineNode);\n\tthis.coverPath = this.findCoverPath(packageDocument);\n\n\tthis.spineNodeIndex = Array.prototype.indexOf.call(spineNode.parentNode.childNodes, spineNode);\n\n\tthis.spine = this.parseSpine(spineNode, this.manifest);\n\n\tthis.metadata = this.parseMetadata(metadataNode);\n\n\tthis.metadata.direction = spineNode.getAttribute(\"page-progression-direction\");\n\n\n\treturn {\n\t\t'metadata' : this.metadata,\n\t\t'spine' : this.spine,\n\t\t'manifest' : this.manifest,\n\t\t'navPath' : this.navPath,\n\t\t'ncxPath' : this.ncxPath,\n\t\t'coverPath': this.coverPath,\n\t\t'spineNodeIndex' : this.spineNodeIndex\n\t};\n};\n\n/**\n * Parse Metadata\n * @private\n * @param {document} xml\n * @return {object} metadata\n */\nPackaging.prototype.parseMetadata = function(xml){\n\tvar metadata = {};\n\n\tmetadata.title = this.getElementText(xml, 'title');\n\tmetadata.creator = this.getElementText(xml, 'creator');\n\tmetadata.description = this.getElementText(xml, 'description');\n\n\tmetadata.pubdate = this.getElementText(xml, 'date');\n\n\tmetadata.publisher = this.getElementText(xml, 'publisher');\n\n\tmetadata.identifier = this.getElementText(xml, \"identifier\");\n\tmetadata.language = this.getElementText(xml, \"language\");\n\tmetadata.rights = this.getElementText(xml, \"rights\");\n\n\tmetadata.modified_date = this.getPropertyText(xml, 'dcterms:modified');\n\n\tmetadata.layout = this.getPropertyText(xml, \"rendition:layout\");\n\tmetadata.orientation = this.getPropertyText(xml, 'rendition:orientation');\n\tmetadata.flow = this.getPropertyText(xml, 'rendition:flow');\n\tmetadata.viewport = this.getPropertyText(xml, 'rendition:viewport');\n\t// metadata.page_prog_dir = packageXml.querySelector(\"spine\").getAttribute(\"page-progression-direction\");\n\n\treturn metadata;\n};\n\n/**\n * Parse Manifest\n * @private\n * @param {document} manifestXml\n * @return {object} manifest\n */\nPackaging.prototype.parseManifest = function(manifestXml){\n\tvar manifest = {};\n\n\t//-- Turn items into an array\n\t// var selected = manifestXml.querySelectorAll(\"item\");\n\tvar selected = core.qsa(manifestXml, \"item\");\n\tvar items = Array.prototype.slice.call(selected);\n\n\t//-- Create an object with the id as key\n\titems.forEach(function(item){\n\t\tvar id = item.getAttribute('id'),\n\t\t\t\thref = item.getAttribute('href') || '',\n\t\t\t\ttype = item.getAttribute('media-type') || '',\n\t\t\t\tproperties = item.getAttribute('properties') || '';\n\n\t\tmanifest[id] = {\n\t\t\t'href' : href,\n\t\t\t// 'url' : href,\n\t\t\t'type' : type,\n\t\t\t'properties' : properties.length ? properties.split(' ') : []\n\t\t};\n\n\t});\n\n\treturn manifest;\n\n};\n\n/**\n * Parse Spine\n * @param {document} spineXml\n * @param {Packaging.manifest} manifest\n * @return {object} spine\n */\nPackaging.prototype.parseSpine = function(spineXml, manifest){\n\tvar spine = [];\n\n\tvar selected = spineXml.getElementsByTagName(\"itemref\"),\n\t\t\titems = Array.prototype.slice.call(selected);\n\n\tvar epubcfi = new EpubCFI();\n\n\t//-- Add to array to mantain ordering and cross reference with manifest\n\titems.forEach(function(item, index){\n\t\tvar idref = item.getAttribute('idref');\n\t\t// var cfiBase = epubcfi.generateChapterComponent(spineNodeIndex, index, Id);\n\t\tvar props = item.getAttribute('properties') || '';\n\t\tvar propArray = props.length ? props.split(' ') : [];\n\t\t// var manifestProps = manifest[Id].properties;\n\t\t// var manifestPropArray = manifestProps.length ? manifestProps.split(' ') : [];\n\n\t\tvar itemref = {\n\t\t\t'idref' : idref,\n\t\t\t'linear' : item.getAttribute('linear') || '',\n\t\t\t'properties' : propArray,\n\t\t\t// 'href' : manifest[Id].href,\n\t\t\t// 'url' : manifest[Id].url,\n\t\t\t'index' : index\n\t\t\t// 'cfiBase' : cfiBase\n\t\t};\n\t\tspine.push(itemref);\n\t});\n\n\treturn spine;\n};\n\n/**\n * Find TOC NAV\n * @private\n */\nPackaging.prototype.findNavPath = function(manifestNode){\n\t// Find item with property 'nav'\n\t// Should catch nav irregardless of order\n\t// var node = manifestNode.querySelector(\"item[properties$='nav'], item[properties^='nav '], item[properties*=' nav ']\");\n\tvar node = core.qsp(manifestNode, \"item\", {\"properties\":\"nav\"});\n\treturn node ? node.getAttribute('href') : false;\n};\n\n/**\n * Find TOC NCX\n * media-type=\"application/x-dtbncx+xml\" href=\"toc.ncx\"\n * @private\n */\nPackaging.prototype.findNcxPath = function(manifestNode, spineNode){\n\t// var node = manifestNode.querySelector(\"item[media-type='application/x-dtbncx+xml']\");\n\tvar node = core.qsp(manifestNode, \"item\", {\"media-type\":\"application/x-dtbncx+xml\"});\n\tvar tocId;\n\n\t// If we can't find the toc by media-type then try to look for id of the item in the spine attributes as\n\t// according to http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.4.1.2,\n\t// \"The item that describes the NCX must be referenced by the spine toc attribute.\"\n\tif (!node) {\n\t\ttocId = spineNode.getAttribute(\"toc\");\n\t\tif(tocId) {\n\t\t\t// node = manifestNode.querySelector(\"item[id='\" + tocId + \"']\");\n\t\t\tnode = manifestNode.getElementById(tocId);\n\t\t}\n\t}\n\n\treturn node ? node.getAttribute('href') : false;\n};\n\n/**\n * Find the Cover Path\n * \n * Fallback for Epub 2.0\n * @param {document} packageXml\n * @return {string} href\n */\nPackaging.prototype.findCoverPath = function(packageXml){\n\tvar pkg = core.qs(packageXml, \"package\");\n\tvar epubVersion = pkg.getAttribute('version');\n\n\tif (epubVersion === '2.0') {\n\t\tvar metaCover = core.qsp(packageXml, 'meta', {'name':'cover'});\n\t\tif (metaCover) {\n\t\t\tvar coverId = metaCover.getAttribute('content');\n\t\t\t// var cover = packageXml.querySelector(\"item[id='\" + coverId + \"']\");\n\t\t\tvar cover = packageXml.getElementById(coverId);\n\t\t\treturn cover ? cover.getAttribute('href') : false;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}\n\telse {\n\t\t// var node = packageXml.querySelector(\"item[properties='cover-image']\");\n\t\tvar node = core.qsp(packageXml, 'item', {'properties':'cover-image'});\n\t\treturn node ? node.getAttribute('href') : false;\n\t}\n};\n\n/**\n * Get text of a namespaced element\n * @private\n * @param {document} xml\n * @param {string} tag\n * @return {string} text\n */\nPackaging.prototype.getElementText = function(xml, tag){\n\tvar found = xml.getElementsByTagNameNS(\"http://purl.org/dc/elements/1.1/\", tag),\n\t\tel;\n\n\tif(!found || found.length === 0) return '';\n\n\tel = found[0];\n\n\tif(el.childNodes.length){\n\t\treturn el.childNodes[0].nodeValue;\n\t}\n\n\treturn '';\n\n};\n\n/**\n * Get text by property\n * @private\n * @param {document} xml\n * @param {string} property\n * @return {string} text\n */\nPackaging.prototype.getPropertyText = function(xml, property){\n\tvar el = core.qsp(xml, \"meta\", {\"property\":property});\n\n\tif(el && el.childNodes.length){\n\t\treturn el.childNodes[0].nodeValue;\n\t}\n\n\treturn '';\n};\n\nmodule.exports = Packaging;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/packaging.js\n// module id = 43\n// module chunks = 0","var EpubCFI = require('./epubcfi');\nvar core = require('./core');\n\n/**\n * Page List Parser\n * @param {[document]} xml\n */\nfunction PageList(xml) {\n\tthis.pages = [];\n\tthis.locations = [];\n\tthis.epubcfi = new EpubCFI();\n\n\tif (xml) {\n\t\tthis.pageList = this.parse(xml);\n\t}\n\n\tif(this.pageList && this.pageList.length) {\n\t\tthis.process(this.pageList);\n\t}\n};\n\n/**\n * Parse PageList Xml\n * @param {document} xml\n */\nPageList.prototype.parse = function(xml) {\n\tvar html = core.qs(xml, \"html\");\n\t// var ncx = core.qs(xml, \"ncx\");\n\n\tif(html) {\n\t\tthis.toc = this.parseNav(xml);\n\t} else if(ncx){ // Not supported\n\t\t// this.toc = this.parseNcx(xml);\n\t\treturn;\n\t}\n\n};\n\n/**\n * Parse a Nav PageList\n * @private\n * @param {document} navHtml\n * @return {PageList.item[]} list\n */\nPageList.prototype.parseNav = function(navHtml){\n\tvar navElement = core.querySelectorByType(navHtml, \"nav\", \"page-list\");\n\tvar navItems = navElement ? core.qsa(navElement, \"li\") : [];\n\tvar length = navItems.length;\n\tvar i;\n\tvar toc = {};\n\tvar list = [];\n\tvar item;\n\n\tif(!navItems || length === 0) return list;\n\n\tfor (i = 0; i < length; ++i) {\n\t\titem = this.item(navItems[i]);\n\t\tlist.push(item);\n\t}\n\n\treturn list;\n};\n\n/**\n * Page List Item\n * @private\n * @param {object} item\n * @return {object} pageListItem\n */\nPageList.prototype.item = function(item){\n\tvar id = item.getAttribute('id') || false,\n\t\tcontent = core.qs(item, \"a\"),\n\t\thref = content.getAttribute('href') || '',\n\t\ttext = content.textContent || \"\",\n\t\tpage = parseInt(text),\n\t\tisCfi = href.indexOf(\"epubcfi\"),\n\t\tsplit,\n\t\tpackageUrl,\n\t\tcfi;\n\n\tif(isCfi != -1) {\n\t\tsplit = href.split(\"#\");\n\t\tpackageUrl = split[0];\n\t\tcfi = split.length > 1 ? split[1] : false;\n\t\treturn {\n\t\t\t\"cfi\" : cfi,\n\t\t\t\"href\" : href,\n\t\t\t\"packageUrl\" : packageUrl,\n\t\t\t\"page\" : page\n\t\t};\n\t} else {\n\t\treturn {\n\t\t\t\"href\" : href,\n\t\t\t\"page\" : page\n\t\t};\n\t}\n};\n\n/**\n * Process pageList items\n * @private\n * @param {array} pageList\n */\nPageList.prototype.process = function(pageList){\n\tpageList.forEach(function(item){\n\t\tthis.pages.push(item.page);\n\t\tif (item.cfi) {\n\t\t\tthis.locations.push(item.cfi);\n\t\t}\n\t}, this);\n\tthis.firstPage = parseInt(this.pages[0]);\n\tthis.lastPage = parseInt(this.pages[this.pages.length-1]);\n\tthis.totalPages = this.lastPage - this.firstPage;\n};\n\n\n/**\n * Replace HREFs with CFI\n * TODO: implement getting CFI from Href\n */\nPageList.prototype.addCFIs = function() {\n\tthis.pageList.forEach(function(pg){\n\t\tif(!pg.cfi) {\n\t\t\t// epubcfi.generateCfiFromHref(pg.href, book).then(function(cfi){\n\t\t\t// \tpg.cfi = cfi;\n\t\t\t// \tpg.packageUrl = book.settings.packageUrl;\n\t\t\t// });\n\t\t}\n\t});\n}\n\n/*\nEPUBJS.EpubCFI.prototype.generateCfiFromHref = function(href, book) {\n var uri = EPUBJS.core.uri(href);\n var path = uri.path;\n var fragment = uri.fragment;\n var spinePos = book.spineIndexByURL[path];\n var loaded;\n var deferred = new RSVP.defer();\n var epubcfi = new EPUBJS.EpubCFI();\n var spineItem;\n\n if(typeof spinePos !== \"undefined\"){\n spineItem = book.spine[spinePos];\n loaded = book.loadXml(spineItem.url);\n loaded.then(function(doc){\n var element = doc.getElementById(fragment);\n var cfi;\n cfi = epubcfi.generateCfiFromElement(element, spineItem.cfiBase);\n deferred.resolve(cfi);\n });\n }\n\n return deferred.promise;\n};\n*/\n\n/**\n * Get a PageList result from a EpubCFI\n * @param {string} cfi EpubCFI String\n * @return {string} page\n */\nPageList.prototype.pageFromCfi = function(cfi){\n\tvar pg = -1;\n\n\t// Check if the pageList has not been set yet\n\tif(this.locations.length === 0) {\n\t\treturn -1;\n\t}\n\n\t// TODO: check if CFI is valid?\n\n\t// check if the cfi is in the location list\n\t// var index = this.locations.indexOf(cfi);\n\tvar index = core.indexOfSorted(cfi, this.locations, this.epubcfi.compare);\n\tif(index != -1) {\n\t\tpg = this.pages[index];\n\t} else {\n\t\t// Otherwise add it to the list of locations\n\t\t// Insert it in the correct position in the locations page\n\t\t//index = EPUBJS.core.insert(cfi, this.locations, this.epubcfi.compare);\n\t\tindex = EPUBJS.core.locationOf(cfi, this.locations, this.epubcfi.compare);\n\t\t// Get the page at the location just before the new one, or return the first\n\t\tpg = index-1 >= 0 ? this.pages[index-1] : this.pages[0];\n\t\tif(pg !== undefined) {\n\t\t\t// Add the new page in so that the locations and page array match up\n\t\t\t//this.pages.splice(index, 0, pg);\n\t\t} else {\n\t\t\tpg = -1;\n\t\t}\n\n\t}\n\treturn pg;\n};\n\n/**\n * Get an EpubCFI from a Page List Item\n * @param {string} pg\n * @return {string} cfi\n */\nPageList.prototype.cfiFromPage = function(pg){\n\tvar cfi = -1;\n\t// check that pg is an int\n\tif(typeof pg != \"number\"){\n\t\tpg = parseInt(pg);\n\t}\n\n\t// check if the cfi is in the page list\n\t// Pages could be unsorted.\n\tvar index = this.pages.indexOf(pg);\n\tif(index != -1) {\n\t\tcfi = this.locations[index];\n\t}\n\t// TODO: handle pages not in the list\n\treturn cfi;\n};\n\n/**\n * Get a Page from Book percentage\n * @param {number} percent\n * @return {string} page\n */\nPageList.prototype.pageFromPercentage = function(percent){\n\tvar pg = Math.round(this.totalPages * percent);\n\treturn pg;\n};\n\n/**\n * Returns a value between 0 - 1 corresponding to the location of a page\n * @param {int} pg the page\n * @return {number} percentage\n */\nPageList.prototype.percentageFromPage = function(pg){\n\tvar percentage = (pg - this.firstPage) / this.totalPages;\n\treturn Math.round(percentage * 1000) / 1000;\n};\n\n/**\n * Returns a value between 0 - 1 corresponding to the location of a cfi\n * @param {string} cfi EpubCFI String\n * @return {number} percentage\n */\nPageList.prototype.percentageFromCfi = function(cfi){\n\tvar pg = this.pageFromCfi(cfi);\n\tvar percentage = this.percentageFromPage(pg);\n\treturn percentage;\n};\n\nmodule.exports = PageList;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/pagelist.js\n// module id = 44\n// module chunks = 0","var replace = require('./replacements');\nvar core = require('./core');\nvar Path = require('./core').Path;\nvar path = require('path');\n\n/**\n * Handle Package Resources\n * @class\n * @param {Manifest} manifest\n * @param {[object]} options\n * @param {[string='base64']} options.replacements\n * @param {[Archive]} options.archive\n * @param {[method]} options.resolver\n */\nfunction Resources(manifest, options) {\n\tthis.settings = {\n\t\treplacements: (options && options.replacements) || 'base64',\n\t\tarchive: (options && options.archive),\n\t\tresolver: (options && options.resolver)\n\t};\n\tthis.manifest = manifest;\n\tthis.resources = Object.keys(manifest).\n\t\tmap(function (key){\n\t\t\treturn manifest[key];\n\t\t});\n\n\tthis.replacementUrls = [];\n\n\tthis.split();\n\tthis.splitUrls();\n}\n\n/**\n * Split resources by type\n * @private\n */\nResources.prototype.split = function(){\n\n\t// HTML\n\tthis.html = this.resources.\n\t\tfilter(function (item){\n\t\t\tif (item.type === \"application/xhtml+xml\" ||\n\t\t\t\t\titem.type === \"text/html\") {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n\n\t// Exclude HTML\n\tthis.assets = this.resources.\n\t\tfilter(function (item){\n\t\t\tif (item.type !== \"application/xhtml+xml\" &&\n\t\t\t\t\titem.type !== \"text/html\") {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n\n\t// Only CSS\n\tthis.css = this.resources.\n\t\tfilter(function (item){\n\t\t\tif (item.type === \"text/css\") {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n};\n\n/**\n * Convert split resources into Urls\n * @private\n */\nResources.prototype.splitUrls = function(){\n\n\t// All Assets Urls\n\tthis.urls = this.assets.\n\t\tmap(function(item) {\n\t\t\treturn item.href;\n\t\t}.bind(this));\n\n\t// Css Urls\n\tthis.cssUrls = this.css.map(function(item) {\n\t\treturn item.href;\n\t});\n\n};\n\n/**\n * Create blob urls for all the assets\n * @param {Archive} archive\n * @param {resolver} resolver Url resolver\n * @return {Promise} returns replacement urls\n */\nResources.prototype.replacements = function(archive, resolver){\n\tarchive = archive || this.settings.archive;\n\tresolver = resolver || this.settings.resolver;\n\n\tif (this.settings.replacements === \"none\") {\n\t\treturn new Promise(function(resolve, reject) {\n\t\t\tresolve(this.urls);\n\t\t}.bind(this));\n\t}\n\n\tvar replacements = this.urls.\n\t\tmap(function(url) {\n\t\t\tvar absolute = resolver(url);\n\n\t\t\treturn archive.createUrl(absolute, {\"base64\": (this.settings.replacements === \"base64\")});\n\t\t}.bind(this))\n\n\treturn Promise.all(replacements)\n\t\t.then(function(replacementUrls) {\n\t\t\tthis.replacementUrls = replacementUrls;\n\t\t\treturn replacementUrls;\n\t\t}.bind(this));\n};\n\n/**\n * Replace URLs in CSS resources\n * @private\n * @param {[Archive]} archive\n * @param {[method]} resolver\n * @return {Promise}\n */\nResources.prototype.replaceCss = function(archive, resolver){\n\tvar replaced = [];\n\tarchive = archive || this.settings.archive;\n\tresolver = resolver || this.settings.resolver;\n\tthis.cssUrls.forEach(function(href) {\n\t\tvar replacement = this.createCssFile(href, archive, resolver)\n\t\t\t.then(function (replacementUrl) {\n\t\t\t\t// switch the url in the replacementUrls\n\t\t\t\tvar indexInUrls = this.urls.indexOf(href);\n\t\t\t\tif (indexInUrls > -1) {\n\t\t\t\t\tthis.replacementUrls[indexInUrls] = replacementUrl;\n\t\t\t\t}\n\t\t\t}.bind(this));\n\n\t\treplaced.push(replacement);\n\t}.bind(this));\n\treturn Promise.all(replaced);\n};\n\n/**\n * Create a new CSS file with the replaced URLs\n * @private\n * @param {string} href the original css file\n * @param {[Archive]} archive\n * @param {[method]} resolver\n * @return {Promise} returns a BlobUrl to the new CSS file or a data url\n */\nResources.prototype.createCssFile = function(href, archive, resolver){\n\t\tvar newUrl;\n\t\tvar indexInUrls;\n\t\tarchive = archive || this.settings.archive;\n\t\tresolver = resolver || this.settings.resolver;\n\n\t\tif (path.isAbsolute(href)) {\n\t\t\treturn new Promise(function(resolve, reject){\n\t\t\t\tresolve(urls, replacementUrls);\n\t\t\t});\n\t\t}\n\n\t\tvar absolute = resolver(href);\n\n\t\t// Get the text of the css file from the archive\n\t\tvar textResponse = archive.getText(absolute);\n\t\t// Get asset links relative to css file\n\t\tvar relUrls = this.urls.map(function(assetHref) {\n\t\t\t\tvar resolved = resolver(assetHref);\n\t\t\t\tvar relative = new Path(absolute).relative(resolved);\n\n\t\t\t\treturn relative;\n\t\t\t}.bind(this));\n\n\t\treturn textResponse.then(function (text) {\n\t\t\t// Replacements in the css text\n\t\t\ttext = replace.substitute(text, relUrls, this.replacementUrls);\n\n\t\t\t// Get the new url\n\t\t\tif (this.settings.replacements === \"base64\") {\n\t\t\t\tnewUrl = core.createBase64Url(text, 'text/css');\n\t\t\t} else {\n\t\t\t\tnewUrl = core.createBlobUrl(text, 'text/css');\n\t\t\t}\n\n\t\t\treturn newUrl;\n\t\t}.bind(this));\n\n};\n\n/**\n * Resolve all resources URLs relative to an absolute URL\n * @param {string} absolute to be resolved to\n * @param {[resolver]} resolver\n * @return {string[]} array with relative Urls\n */\nResources.prototype.relativeTo = function(absolute, resolver){\n\tresolver = resolver || this.settings.resolver;\n\n\t// Get Urls relative to current sections\n\treturn this.urls.\n\t\tmap(function(href) {\n\t\t\tvar resolved = resolver(href);\n\t\t\tvar relative = new Path(absolute).relative(resolved);\n\t\t\treturn relative;\n\t\t}.bind(this));\n};\n\n/**\n * Get a URL for a resource\n * @param {string} path\n * @return {string} url\n */\nResources.prototype.get = function(path) {\n\tvar indexInUrls = this.urls.indexOf(path);\n\tif (indexInUrls === -1) {\n\t\treturn;\n\t}\n\tif (this.replacementUrls.length) {\n\t\treturn new Promise(function(resolve, reject) {\n\t\t\tresolve(this.replacementUrls[indexInUrls]);\n\t\t}.bind(this));\n\t} else {\n\t\treturn archive.createUrl(absolute,\n\t\t\t{\"base64\": (this.settings.replacements === \"base64\")})\n\t}\n}\n\nmodule.exports = Resources;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/resources.js\n// module id = 45\n// module chunks = 0","var core = require('./core');\nvar EpubCFI = require('./epubcfi');\nvar Hook = require('./hook');\nvar Url = require('./core').Url;\n\n/**\n * Represents a Section of the Book\n * In most books this is equivelent to a Chapter\n * @param {object} item The spine item representing the section\n * @param {object} hooks hooks for serialize and content\n */\nfunction Section(item, hooks){\n\t\tthis.idref = item.idref;\n\t\tthis.linear = item.linear;\n\t\tthis.properties = item.properties;\n\t\tthis.index = item.index;\n\t\tthis.href = item.href;\n\t\tthis.url = item.url;\n\t\tthis.next = item.next;\n\t\tthis.prev = item.prev;\n\n\t\tthis.cfiBase = item.cfiBase;\n\n\t\tif (hooks) {\n\t\t\tthis.hooks = hooks;\n\t\t} else {\n\t\t\tthis.hooks = {};\n\t\t\tthis.hooks.serialize = new Hook(this);\n\t\t\tthis.hooks.content = new Hook(this);\n\t\t}\n\n};\n\n/**\n * Load the section from its url\n * @param {method} _request a request method to use for loading\n * @return {document} a promise with the xml document\n */\nSection.prototype.load = function(_request){\n\tvar request = _request || this.request || require('./request');\n\tvar loading = new core.defer();\n\tvar loaded = loading.promise;\n\n\tif(this.contents) {\n\t\tloading.resolve(this.contents);\n\t} else {\n\t\trequest(this.url)\n\t\t\t.then(function(xml){\n\t\t\t\tvar base;\n\t\t\t\tvar directory = new Url(this.url).directory;\n\n\t\t\t\tthis.document = xml;\n\t\t\t\tthis.contents = xml.documentElement;\n\n\t\t\t\treturn this.hooks.content.trigger(this.document, this);\n\t\t\t}.bind(this))\n\t\t\t.then(function(){\n\t\t\t\tloading.resolve(this.contents);\n\t\t\t}.bind(this))\n\t\t\t.catch(function(error){\n\t\t\t\tloading.reject(error);\n\t\t\t});\n\t}\n\n\treturn loaded;\n};\n\n/**\n * Adds a base tag for resolving urls in the section\n * @private\n * @param {document} _document\n */\nSection.prototype.base = function(_document){\n\t\tvar task = new core.defer();\n\t\tvar base = _document.createElement(\"base\"); // TODO: check if exists\n\t\tvar head;\n\n\t\tbase.setAttribute(\"href\", window.location.origin + \"/\" +this.url);\n\n\t\tif(_document) {\n\t\t\thead = _document.querySelector(\"head\");\n\t\t}\n\t\tif(head) {\n\t\t\thead.insertBefore(base, head.firstChild);\n\t\t\ttask.resolve();\n\t\t} else {\n\t\t\ttask.reject(new Error(\"No head to insert into\"));\n\t\t}\n\n\n\t\treturn task.promise;\n};\n\n/**\n * Render the contents of a section\n * @param {method} _request a request method to use for loading\n * @return {string} output a serialized XML Document\n */\nSection.prototype.render = function(_request){\n\tvar rendering = new core.defer();\n\tvar rendered = rendering.promise;\n\tthis.output; // TODO: better way to return this from hooks?\n\n\tthis.load(_request).\n\t\tthen(function(contents){\n\t\t\tvar serializer;\n\n\t\t\tif (typeof XMLSerializer === \"undefined\") {\n\t\t\t\tXMLSerializer = require('xmldom').XMLSerializer;\n\t\t\t}\n\t\t\tserializer = new XMLSerializer();\n\t\t\tthis.output = serializer.serializeToString(contents);\n\t\t\treturn this.output;\n\t\t}.bind(this)).\n\t\tthen(function(){\n\t\t\treturn this.hooks.serialize.trigger(this.output, this);\n\t\t}.bind(this)).\n\t\tthen(function(){\n\t\t\trendering.resolve(this.output);\n\t\t}.bind(this))\n\t\t.catch(function(error){\n\t\t\trendering.reject(error);\n\t\t});\n\n\treturn rendered;\n};\n\n/**\n * Find a string in a section\n * TODO: need reimplementation from v0.2\n * @param {string} query [description]\n * @return {[type]} [description]\n */\nSection.prototype.find = function(query){\n\n};\n\n/**\n* Reconciles the current chapters layout properies with\n* the global layout properities.\n* @param {object} global The globa layout settings object, chapter properties string\n* @return {object} layoutProperties Object with layout properties\n*/\nSection.prototype.reconcileLayoutSettings = function(global){\n\t//-- Get the global defaults\n\tvar settings = {\n\t\tlayout : global.layout,\n\t\tspread : global.spread,\n\t\torientation : global.orientation\n\t};\n\n\t//-- Get the chapter's display type\n\tthis.properties.forEach(function(prop){\n\t\tvar rendition = prop.replace(\"rendition:\", '');\n\t\tvar split = rendition.indexOf(\"-\");\n\t\tvar property, value;\n\n\t\tif(split != -1){\n\t\t\tproperty = rendition.slice(0, split);\n\t\t\tvalue = rendition.slice(split+1);\n\n\t\t\tsettings[property] = value;\n\t\t}\n\t});\n return settings;\n};\n\n/**\n * Get a CFI from a Range in the Section\n * @param {range} _range\n * @return {string} cfi an EpubCFI string\n */\nSection.prototype.cfiFromRange = function(_range) {\n\treturn new EpubCFI(_range, this.cfiBase).toString();\n};\n\n/**\n * Get a CFI from an Element in the Section\n * @param {element} el\n * @return {string} cfi an EpubCFI string\n */\nSection.prototype.cfiFromElement = function(el) {\n\treturn new EpubCFI(el, this.cfiBase).toString();\n};\n\nmodule.exports = Section;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/section.js\n// module id = 46\n// module chunks = 0","var core = require('./core');\nvar EpubCFI = require('./epubcfi');\nvar Hook = require('./hook');\nvar Section = require('./section');\nvar replacements = require('./replacements');\n\n/**\n * A collection of Spine Items\n */\nfunction Spine(){\n\tthis.spineItems = [];\n\tthis.spineByHref = {};\n\tthis.spineById = {};\n\n\tthis.hooks = {};\n\tthis.hooks.serialize = new Hook();\n\tthis.hooks.content = new Hook();\n\n\t// Register replacements\n\tthis.hooks.content.register(replacements.base);\n\tthis.hooks.content.register(replacements.canonical);\n\n\tthis.epubcfi = new EpubCFI();\n\n\tthis.loaded = false;\n};\n\n/**\n * Unpack items from a opf into spine items\n * @param {Package} _package\n * @param {method} resolver URL resolver\n */\nSpine.prototype.unpack = function(_package, resolver) {\n\n\tthis.items = _package.spine;\n\tthis.manifest = _package.manifest;\n\tthis.spineNodeIndex = _package.spineNodeIndex;\n\tthis.baseUrl = _package.baseUrl || _package.basePath || '';\n\tthis.length = this.items.length;\n\n\tthis.items.forEach(function(item, index){\n\t\tvar href, url;\n\t\tvar manifestItem = this.manifest[item.idref];\n\t\tvar spineItem;\n\n\t\titem.cfiBase = this.epubcfi.generateChapterComponent(this.spineNodeIndex, item.index, item.idref);\n\n\t\tif(manifestItem) {\n\t\t\titem.href = manifestItem.href;\n\t\t\titem.url = resolver(item.href, true);\n\n\t\t\tif(manifestItem.properties.length){\n\t\t\t\titem.properties.push.apply(item.properties, manifestItem.properties);\n\t\t\t}\n\t\t}\n\n\t\titem.prev = function(){ return this.get(index-1); }.bind(this);\n\t\titem.next = function(){ return this.get(index+1); }.bind(this);\n\n\t\tspineItem = new Section(item, this.hooks);\n\n\t\tthis.append(spineItem);\n\n\n\t}.bind(this));\n\n\tthis.loaded = true;\n};\n\n/**\n * Get an item from the spine\n * @param {[string|int]} target\n * @return {Section} section\n * @example spine.get();\n * @example spine.get(1);\n * @example spine.get(\"chap1.html\");\n * @example spine.get(\"#id1234\");\n */\nSpine.prototype.get = function(target) {\n\tvar index = 0;\n\n\tif(this.epubcfi.isCfiString(target)) {\n\t\tcfi = new EpubCFI(target);\n\t\tindex = cfi.spinePos;\n\t} else if(target && (typeof target === \"number\" || isNaN(target) === false)){\n\t\tindex = target;\n\t} else if(target && target.indexOf(\"#\") === 0) {\n\t\tindex = this.spineById[target.substring(1)];\n\t} else if(target) {\n\t\t// Remove fragments\n\t\ttarget = target.split(\"#\")[0];\n\t\tindex = this.spineByHref[target];\n\t}\n\n\treturn this.spineItems[index] || null;\n};\n\n/**\n * Append a Section to the Spine\n * @private\n * @param {Section} section\n */\nSpine.prototype.append = function(section) {\n\tvar index = this.spineItems.length;\n\tsection.index = index;\n\n\tthis.spineItems.push(section);\n\n\tthis.spineByHref[section.href] = index;\n\tthis.spineById[section.idref] = index;\n\n\treturn index;\n};\n\n/**\n * Prepend a Section to the Spine\n * @private\n * @param {Section} section\n */\nSpine.prototype.prepend = function(section) {\n\tvar index = this.spineItems.unshift(section);\n\tthis.spineByHref[section.href] = 0;\n\tthis.spineById[section.idref] = 0;\n\n\t// Re-index\n\tthis.spineItems.forEach(function(item, index){\n\t\titem.index = index;\n\t});\n\n\treturn 0;\n};\n\n// Spine.prototype.insert = function(section, index) {\n//\n// };\n\n/**\n * Remove a Section from the Spine\n * @private\n * @param {Section} section\n */\nSpine.prototype.remove = function(section) {\n\tvar index = this.spineItems.indexOf(section);\n\n\tif(index > -1) {\n\t\tdelete this.spineByHref[section.href];\n\t\tdelete this.spineById[section.idref];\n\n\t\treturn this.spineItems.splice(index, 1);\n\t}\n};\n\n/**\n * Loop over the Sections in the Spine\n * @return {method} forEach\n */\nSpine.prototype.each = function() {\n\treturn this.spineItems.forEach.apply(this.spineItems, arguments);\n};\n\nmodule.exports = Spine;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/spine.js\n// module id = 47\n// module chunks = 0","if(typeof __WEBPACK_EXTERNAL_MODULE_48__ === 'undefined') {var e = new Error(\"Cannot find module \\\"JSZip\\\"\"); e.code = 'MODULE_NOT_FOUND'; throw e;}\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_48__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"JSZip\"\n// module id = 48\n// module chunks = 0","var Book = require('./book');\nvar EpubCFI = require('./epubcfi');\nvar Rendition = require('./rendition');\nvar Contents = require('./contents');\n\n/**\n * Creates a new Book\n * @param {string|ArrayBuffer} url URL, Path or ArrayBuffer\n * @param {object} options to pass to the book\n * @returns {Book} a new Book object\n * @example ePub(\"/path/to/book.epub\", {})\n */\nfunction ePub(url, options) {\n\treturn new Book(url, options);\n};\n\nePub.VERSION = \"0.3.0\";\n\nePub.CFI = EpubCFI;\nePub.Rendition = Rendition;\nePub.Contents = Contents;\n\nePub.ViewManagers = {};\nePub.Views = {};\n/**\n * register plugins\n */\nePub.register = {\n\t/**\n\t * register a new view manager\n\t */\n\tmanager : function(name, manager){\n\t\treturn ePub.ViewManagers[name] = manager;\n\t},\n\t/**\n\t * register a new view\n\t */\n\tview : function(name, view){\n\t\treturn ePub.Views[name] = view;\n\t}\n};\n\n// Default Views\nePub.register.view(\"iframe\", require('./managers/views/iframe'));\n\n// Default View Managers\nePub.register.manager(\"default\", require('./managers/default'));\nePub.register.manager(\"continuous\", require('./managers/continuous'));\n\nmodule.exports = ePub;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/epub.js\n// module id = 50\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/epub.min.js b/dist/epub.min.js index 1b53591..c808f45 100644 --- a/dist/epub.min.js +++ b/dist/epub.min.js @@ -1,4 +1,4 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(function(){try{return require("JSZip")}catch(t){}}(),require("xmldom")):"function"==typeof define&&define.amd?define(["JSZip","xmldom"],e):"object"==typeof exports?exports.ePub=e(function(){try{return require("JSZip")}catch(t){}}(),require("xmldom")):t.ePub=e(t.JSZip,t.xmldom)}(this,function(t,e){return function(t){function e(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,e,i){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var i=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=50)}([function(t,e,i){function n(t,e){var i=t.indexOf("://")>-1,n=t;if(this.Url=void 0,this.href=t,this.protocol="",this.origin="",this.fragment="",this.search="",this.base=e,i||"string"==typeof e||(this.base=window&&window.location.href),i||this.base)try{this.Url=new URL(t,this.base),this.href=this.Url.href,this.protocol=this.Url.protocol,this.origin=this.Url.origin,this.fragment=this.Url.fragment,this.search=this.Url.search,n=this.Url.pathname}catch(o){this.Url=void 0}this.Path=new s(n),this.directory=this.Path.directory,this.filename=this.Path.filename,this.extension=this.Path.extension}function s(t){var e,i;e=t.indexOf("://"),e>-1&&(t=new URL(t).pathname),i=this.parse(t),this.path=t,this.isDirectory(t)?this.directory=t:this.directory=i.dir+"/",this.filename=i.base,this.extension=i.ext.slice(1)}function o(t){return!(!t||1!=t.nodeType)}function r(){var t=(new Date).getTime(),e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:7&i|8).toString(16)});return e}function h(t){for(var e=-1,i=Object.keys(t),n=i.length,s=Array(n);++ee?1:t0?a:a+1:0===o?a:o===-1?g(t,e,i,a,h):g(t,e,i,r,a))}function m(t,e,i,n,s){var o,r=n||0,h=s||e.length,a=parseInt(r+(h-r)/2);return i||(i=function(t,e){return t>e?1:t-1}function E(t,e){var i=new Blob([t],{type:e});return i}function S(t,e){var i,n=window.URL||window.webkitURL||window.mozURL,s=this.createBlob(t,e);return i=n.createObjectURL(s)}function _(t,e){var i,n;if("string"==typeof t)return i=btoa(t),n="data:"+e+";base64,"+i}function C(t){return Object.prototype.toString.call(t).slice(8,-1)}function N(t,e){var n;return"undefined"==typeof DOMParser&&(DOMParser=i(13).DOMParser),n=(new DOMParser).parseFromString(t,e)}function L(t,e){var i;return"undefined"!=typeof t.querySelector?t.querySelector(e):(i=t.getElementsByTagName(e),i.length?i[0]:void 0)}function k(t,e){return"undefined"!=typeof t.querySelector?t.querySelectorAll(e):t.getElementsByTagName(e)}function z(t,e,i){var n,s;if("undefined"!=typeof t.querySelector){e+="[";for(var o in i)e+=o+"='"+i[o]+"'";return e+="]",t.querySelector(e)}if(n=t.getElementsByTagName(e),s=Array.prototype.slice.call(n,0).filter(function(t){for(var e in i)if(t.getAttribute(e)===i[e])return!0;return!1}))return s[0]}function q(t,e){var i=new FileReader;i.readAsDataURL(t),i.onloadend=function(){e(i.result)}}function P(){this.resolve=null,this.reject=null,this.id=r(),this.promise=new Promise(function(t,e){this.resolve=t,this.reject=e}.bind(this)),Object.freeze(this)}function O(t,e,i){var n;if("undefined"!=typeof t.querySelector&&(n=t.querySelector(e+'[*|type="'+i+'"]')),n&&0!==n.length)return n;n=this.qsa(t,e);for(var s=0;s-1;return i?t:(e=R.resolve(this.directory,t),this.origin+e)},n.prototype.relative=function(t){return R.relative(t,this.directory)},n.prototype.toString=function(){return this.href},s.prototype.parse=function(t){return R.parse(t)},s.prototype.isAbsolute=function(t){return R.isAbsolute(t||this.path)},s.prototype.isDirectory=function(t){return"/"===t.charAt(t.length-1)},s.prototype.resolve=function(t){return R.resolve(this.directory,t)},s.prototype.relative=function(t){return R.relative(this.directory,t)},s.prototype.splitPath=function(t){return this.splitPathRe.exec(t).slice(1)},s.prototype.toString=function(){return this.path},t.exports={isElement:o,uuid:r,values:h,resolveUrl:a,indexOfSorted:m,documentHeight:c,isNumber:p,prefixed:l,defaults:u,extend:d,insert:f,locationOf:g,indexOfSorted:m,requestAnimationFrame:A,bounds:y,borders:v,windowBounds:w,cleanStringForXpath:b,indexOfTextNode:x,isXml:T,createBlob:E,createBlobUrl:S,type:C,parse:N,qs:L,qsa:k,qsp:z,blob2base64:q,createBase64Url:_,defer:P,Url:n,Path:s,querySelectorByType:O}},function(t,e,i){function n(t,e,i){var o;if(this.str="",this.base={},this.spinePos=0,this.range=!1,this.path={},this.start=null,this.end=null,!(this instanceof n))return new n(t,e,i);if("string"==typeof e?this.base=this.parseComponent(e):"object"==typeof e&&e.steps&&(this.base=e),o=this.checkType(t),"string"===o)return this.str=t,s.extend(this,this.parse(t));if("range"===o)return s.extend(this,this.fromRange(t,this.base,i));if("node"===o)return s.extend(this,this.fromNode(t,this.base,i));if("EpubCFI"===o&&t.path)return t;if(t)throw new TypeError("not a valid argument for EpubCFI");return this}var s=i(0);n.prototype.checkType=function(t){return this.isCfiString(t)?"string":"object"==typeof t&&"Range"===s.type(t)?"range":"object"==typeof t&&"undefined"!=typeof t.nodeType?"node":"object"==typeof t&&t instanceof n&&"EpubCFI"},n.prototype.parse=function(t){var e,i,n,s={spinePos:-1,range:!1,base:{},path:{},start:null,end:null};return"string"!=typeof t?{spinePos:-1}:(0===t.indexOf("epubcfi(")&&")"===t[t.length-1]&&(t=t.slice(8,t.length-1)),(e=this.getChapterComponent(t))?(s.base=this.parseComponent(e),i=this.getPathComponent(t),s.path=this.parseComponent(i),n=this.getRange(t),n&&(s.range=!0,s.start=this.parseComponent(n[0]),s.end=this.parseComponent(n[1])),s.spinePos=s.base.steps[1].index,s):{spinePos:-1})},n.prototype.parseComponent=function(t){var e,i={steps:[],terminal:{offset:null,assertion:null}},n=t.split(":"),s=n[0].split("/");return n.length>1&&(e=n[1],i.terminal=this.parseTerminal(e)),""===s[0]&&s.shift(),i.steps=s.map(function(t){return this.parseStep(t)}.bind(this)),i},n.prototype.parseStep=function(t){var e,i,n,s,o;if(s=t.match(/\[(.*)\]/),s&&s[1]&&(o=s[1]),i=parseInt(t),!isNaN(i))return i%2===0?(e="element",n=i/2-1):(e="text",n=(i-1)/2),{type:e,index:n,id:o||null}},n.prototype.parseTerminal=function(t){var e,i,n=t.match(/\[(.*)\]/);return n&&n[1]?(e=parseInt(t.split("[")[0])||null,i=n[1]):e=parseInt(t)||null,{offset:e,assertion:i}},n.prototype.getChapterComponent=function(t){var e=t.split("!");return e[0]},n.prototype.getPathComponent=function(t){var e=t.split("!");if(e[1])return ranges=e[1].split(","),ranges[0]},n.prototype.getRange=function(t){var e=t.split(",");return 3===e.length&&[e[1],e[2]]},n.prototype.getCharecterOffsetComponent=function(t){var e=t.split(":");return e[1]||""},n.prototype.joinSteps=function(t){return t?t.map(function(t){var e="";return"element"===t.type&&(e+=2*(t.index+1)),"text"===t.type&&(e+=1+2*t.index),t.id&&(e+="["+t.id+"]"),e}).join("/"):""},n.prototype.segmentString=function(t){var e="/";return e+=this.joinSteps(t.steps),t.terminal&&null!=t.terminal.offset&&(e+=":"+t.terminal.offset),t.terminal&&null!=t.terminal.assertion&&(e+="["+t.terminal.assertion+"]"),e},n.prototype.toString=function(){var t="epubcfi(";return t+=this.segmentString(this.base),t+="!",t+=this.segmentString(this.path),this.start&&(t+=",",t+=this.segmentString(this.start)),this.end&&(t+=",",t+=this.segmentString(this.end)),t+=")"},n.prototype.compare=function(t,e){if("string"==typeof t&&(t=new n(t)),"string"==typeof e&&(e=new n(e)),t.spinePos>e.spinePos)return 1;if(t.spinePose.path.steps[i].index)return 1;if(t.path.steps[i].indexe.path.terminal.offset?1:t.path.terminal.offset=0&&(s.terminal.offset=e,"text"!=s.steps[s.steps.length-1].type&&s.steps.push({type:"text",index:0})),s},n.prototype.equalStep=function(t,e){return!(!t||!e)&&(t.index===e.index&&t.id===e.id&&t.type===e.type)},n.prototype.fromRange=function(t,e,i){var n={range:!1,base:{},path:{},start:null,end:null},s=t.startContainer,o=t.endContainer,r=t.startOffset,h=t.endOffset,a=!1;if(i&&(a=null!=s.ownerDocument.querySelector("."+i)),"string"==typeof e?(n.base=this.parseComponent(e),n.spinePos=n.base.steps[1].index):"object"==typeof e&&(n.base=e),t.collapsed)a&&(r=this.patchOffset(s,r,i)),n.path=this.pathTo(s,r,i);else{n.range=!0,a&&(r=this.patchOffset(s,r,i)),n.start=this.pathTo(s,r,i),a&&(h=this.patchOffset(o,h,i)),n.end=this.pathTo(o,h,i),n.path={steps:[],terminal:null};var c,p=n.start.steps.length;for(c=0;c0&&s===Node.TEXT_NODE&&o===Node.TEXT_NODE?r[n]=h:e===s&&(h+=1,r[n]=h),o=s;return r},n.prototype.position=function(t){var e,i;return t.nodeType===Node.ELEMENT_NODE?(e=t.parentNode.children,i=Array.prototype.indexOf.call(e,t)):(e=this.textNodes(t.parentNode),i=e.indexOf(t)),i},n.prototype.filteredPosition=function(t,e){var i,n,s;return t.nodeType===Node.ELEMENT_NODE?(i=t.parentNode.children,s=this.normalizedMap(i,Node.ELEMENT_NODE,e)):(i=t.parentNode.childNodes,t.parentNode.classList.contains(e)&&(t=t.parentNode,i=t.parentNode.childNodes),s=this.normalizedMap(i,Node.TEXT_NODE,e)),n=Array.prototype.indexOf.call(i,t),s[n]},n.prototype.stepsToXpath=function(t){var e=[".","*"];return t.forEach(function(t){var i=t.index+1;t.id?e.push("*[position()="+i+" and @id='"+t.id+"']"):"text"===t.type?e.push("text()["+i+"]"):e.push("*["+i+"]")}),e.join("/")},n.prototype.stepsToQuerySelector=function(t){var e=["html"];return t.forEach(function(t){var i=t.index+1;t.id?e.push("#"+t.id):"text"===t.type||e.push("*:nth-child("+i+")")}),e.join(">")},n.prototype.textNodes=function(t,e){return Array.prototype.slice.call(t.childNodes).filter(function(t){return t.nodeType===Node.TEXT_NODE||!(!e||!t.classList.contains(e))})},n.prototype.walkToNode=function(t,e,i){var n,s,o=e||document,r=o.documentElement,h=t.length;for(s=0;so)){h=s.nodeType===Node.ELEMENT_NODE?s.childNodes[0]:s;break}e-=o}}return{container:h,offset:e}},n.prototype.toRange=function(t,e){var i,n,s,o,r,h,a,c=t||document,p=c.createRange(),l=this,u=!!e&&null!=c.querySelector("."+e);if(l.range?(i=l.start,r=l.path.steps.concat(i.steps),s=this.findNode(r,c,u?e:null),n=l.end,h=l.path.steps.concat(n.steps),o=this.findNode(h,c,u?e:null)):(i=l.path,r=l.path.steps,s=this.findNode(l.path.steps,c,u?e:null)),!s)return null;try{null!=i.terminal.offset?p.setStart(s,i.terminal.offset):p.setStart(s,0)}catch(d){a=this.fixMiss(r,i.terminal.offset,c,u?e:null),p.setStart(a.container,a.offset)}if(o)try{null!=n.terminal.offset?p.setEnd(o,n.terminal.offset):p.setEnd(o,0)}catch(d){a=this.fixMiss(h,l.end.terminal.offset,c,u?e:null),p.setEnd(a.container,a.offset)}return p},n.prototype.isCfiString=function(t){return"string"==typeof t&&0===t.indexOf("epubcfi(")&&")"===t[t.length-1]},n.prototype.generateChapterComponent=function(t,e,i){var n=parseInt(e),s=t+1,o="/"+s+"/";return o+=2*(n+1),i&&(o+="["+i+"]"),o},t.exports=n},function(t,e,i){"use strict";(function(e){function i(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+t)}function n(t,e){for(var i,n="",s=-1,o=0,r=0;r<=t.length;++r){if(r2){for(var h=n.length-1,a=h;a>=0&&47!==n.charCodeAt(a);--a);if(a!==h){n=a===-1?"":n.slice(0,a),s=r,o=0;continue}}else if(2===n.length||1===n.length){n="",s=r,o=0;continue}e&&(n.length>0?n+="/..":n="..")}else n.length>0?n+="/"+t.slice(s+1,r):n=t.slice(s+1,r);s=r,o=0}else 46===i&&o!==-1?++o:o=-1}return n}function s(t,e){var i=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return i?i===e.root?i+n:i+t+n:n}var o={resolve:function(){for(var t,s="",o=!1,r=arguments.length-1;r>=-1&&!o;r--){var h;r>=0?h=arguments[r]:(void 0===t&&(t=e.cwd()),h=t),i(h),0!==h.length&&(s=h+"/"+s,o=47===h.charCodeAt(0))}return s=n(s,!o),o?s.length>0?"/"+s:"/":s.length>0?s:"."},normalize:function(t){if(i(t),0===t.length)return".";var e=47===t.charCodeAt(0),s=47===t.charCodeAt(t.length-1);return t=n(t,!e),0!==t.length||e||(t="."),t.length>0&&s&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return i(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e0&&(void 0===t?t=n:t+="/"+n)}return void 0===t?".":o.normalize(t)},relative:function(t,e){if(i(t),i(e),t===e)return"";if(t=o.resolve(t),e=o.resolve(e),t===e)return"";for(var n=1;np){if(47===e.charCodeAt(h+u))return e.slice(h+u+1);if(0===u)return e.slice(h+u)}else r>p&&(47===t.charCodeAt(n+u)?l=u:0===u&&(l=0));break}var d=t.charCodeAt(n+u),f=e.charCodeAt(h+u);if(d!==f)break;47===d&&(l=u)}var g="";for(u=n+l+1;u<=s;++u)u!==s&&47!==t.charCodeAt(u)||(g+=0===g.length?"..":"/..");return g.length>0?g+e.slice(h+l):(h+=l,47===e.charCodeAt(h)&&++h,e.slice(h))},_makeLong:function(t){return t},dirname:function(t){if(i(t),0===t.length)return".";for(var e=t.charCodeAt(0),n=47===e,s=-1,o=!0,r=t.length-1;r>=1;--r)if(e=t.charCodeAt(r),47===e){if(!o){s=r;break}}else o=!1;return s===-1?n?"/":".":n&&1===s?"//":t.slice(0,s)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');i(t);var n,s=0,o=-1,r=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var h=e.length-1,a=-1;for(n=t.length-1;n>=0;--n){var c=t.charCodeAt(n);if(47===c){if(!r){s=n+1;break}}else a===-1&&(r=!1,a=n+1),h>=0&&(c===e.charCodeAt(h)?--h===-1&&(o=n):(h=-1,o=a))}return s===o?o=a:o===-1&&(o=t.length),t.slice(s,o)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!r){s=n+1;break}}else o===-1&&(r=!1,o=n+1);return o===-1?"":t.slice(s,o)},extname:function(t){i(t);for(var e=-1,n=0,s=-1,o=!0,r=0,h=t.length-1;h>=0;--h){var a=t.charCodeAt(h);if(47!==a)s===-1&&(o=!1,s=h+1),46===a?e===-1?e=h:1!==r&&(r=1):e!==-1&&(r=-1);else if(!o){n=h+1;break}}return e===-1||s===-1||0===r||1===r&&e===s-1&&e===n+1?"":t.slice(e,s)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('Parameter "pathObject" must be an object, not '+typeof t);return s("/",t)},parse:function(t){i(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var n,s=t.charCodeAt(0),o=47===s;o?(e.root="/",n=1):n=0;for(var r=-1,h=0,a=-1,c=!0,p=t.length-1,l=0;p>=n;--p)if(s=t.charCodeAt(p),47!==s)a===-1&&(c=!1,a=p+1),46===s?r===-1?r=p:1!==l&&(l=1):r!==-1&&(l=-1);else if(!c){h=p+1;break}return r===-1||a===-1||0===l||1===l&&r===a-1&&r===h+1?a!==-1&&(0===h&&o?e.base=e.name=t.slice(1,a):e.base=e.name=t.slice(h,a)):(0===h&&o?(e.name=t.slice(1,r),e.base=t.slice(1,a)):(e.name=t.slice(h,r),e.base=t.slice(h,a)),e.ext=t.slice(r,a)),h>0?e.dir=t.slice(0,h-1):o&&(e.dir="/"),e},sep:"/",delimiter:":",posix:null};t.exports=o}).call(e,i(4))},function(t,e,i){"use strict";var n,s,o,r,h,a,c,p=i(21),l=i(30),u=Function.prototype.apply,d=Function.prototype.call,f=Object.create,g=Object.defineProperty,m=Object.defineProperties,y=Object.prototype.hasOwnProperty,v={configurable:!0,enumerable:!1,writable:!0};n=function(t,e){var i;return l(e),y.call(this,"__ee__")?i=this.__ee__:(i=v.value=f(null),g(this,"__ee__",v),v.value=null),i[t]?"object"==typeof i[t]?i[t].push(e):i[t]=[i[t],e]:i[t]=e,this},s=function(t,e){var i,s;return l(e),s=this,n.call(this,t,i=function(){o.call(s,t,i),u.call(e,this,arguments)}),i.__eeOnceListener__=e,this},o=function(t,e){var i,n,s,o;if(l(e),!y.call(this,"__ee__"))return this;if(i=this.__ee__,!i[t])return this;if(n=i[t],"object"==typeof n)for(o=0;s=n[o];++o)s!==e&&s.__eeOnceListener__!==e||(2===n.length?i[t]=n[o?0:1]:n.splice(o,1));else n!==e&&n.__eeOnceListener__!==e||delete i[t];return this},r=function(t){var e,i,n,s,o;if(y.call(this,"__ee__")&&(s=this.__ee__[t]))if("object"==typeof s){for(i=arguments.length,o=new Array(i-1),e=1;e1)for(var i=1;i0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}},!1);(i=s.nextNode())&&!(n=e(i)););return n},n.prototype.findRanges=function(t){for(var e,i,n=[],s=t.contents.scrollWidth(),o=this.layout.count(s),r=this.layout.column,h=this.layout.gap,a=0;a=e&&n<=i?t:s>e?t:(r=t,void o.push(t))}))return this.findTextStartRange(s,e,i);return this.findTextStartRange(r,e,i)},n.prototype.findEnd=function(t,e,i){for(var n,s,o=[t],r=t;o.length;)if(n=o.shift(),s=this.walk(n,function(t){var e,n,s,h;return t.nodeType==Node.TEXT_NODE?(h=document.createRange(),h.selectNodeContents(t),s=h.getBoundingClientRect()):s=t.getBoundingClientRect(),e=s.left,n=s.right,e>i&&r?r:n>i?t:(r=t,void o.push(t))}))return this.findTextEndRange(s,e,i);return this.findTextEndRange(r,e,i)},n.prototype.findTextStartRange=function(t,e,i){for(var n,s,o,r=this.splitTextNodeIntoRanges(t),h=0;h=e)return s;n=s}return r[0]},n.prototype.findTextEndRange=function(t,e,i){for(var n,s,o,r=this.splitTextNodeIntoRanges(t),h=0;hi&&n)return n;if(o.right>i)return s;n=s}return r[r.length-1]},n.prototype.splitTextNodeIntoRanges=function(t,e){var i,n=[],s=t.textContent||"",o=s.trim(),r=t.ownerDocument,h=e||" ";if(pos=o.indexOf(h),pos===-1||t.nodeType!=Node.TEXT_NODE)return i=r.createRange(),i.selectNodeContents(t),[i];for(i=r.createRange(),i.setStart(t,0),i.setEnd(t,pos),n.push(i),i=!1;pos!=-1;)pos=o.indexOf(h,pos+1),pos>0&&(i&&(i.setEnd(t,pos),n.push(i)),i=r.createRange(),i.setStart(t,pos+1));return i&&(i.setEnd(t,o.length),n.push(i)),n},n.prototype.rangePairToCfiPair=function(t,e){var i=e.start,n=e.end;return i.collapse(!0),n.collapse(!0),startCfi=new s(i,t).toString(),endCfi=new s(n,t).toString(),{start:startCfi,end:endCfi}},n.prototype.rangeListToCfiList=function(t,e){for(var i,n=[],s=0;s-1&&(id=t.substring(t.indexOf("#")+1),el=this.document.getElementById(id),el&&(i=el.getBoundingClientRect(),n.left=i.left,n.top=i.top)),n},n.prototype.addStylesheet=function(t){return new Promise(function(e,i){var n,s=!1;return this.document?(n=this.document.createElement("link"),n.type="text/css",n.rel="stylesheet",n.href=t,n.onload=n.onreadystatechange=function(){s||this.readyState&&"complete"!=this.readyState||(s=!0,setTimeout(function(){e(!0)},1))},void this.document.head.appendChild(n)):void e(!1)}.bind(this))},n.prototype.addStylesheetRules=function(t){var e,i;if(this.document){e=this.document.createElement("style"),this.document.head.appendChild(e),i=e.sheet;for(var n=0,s=t.length;n0&&(e=t.getRangeAt(0),e.collapsed||(i=new r(e,this.cfiBase).toString(),this.emit("selected",i),this.emit("selectedRange",e)))},n.prototype.range=function(t,e){var i=new r(t);return i.toRange(this.document,e)},n.prototype.map=function(t){var e=new h(t);return e.section()},n.prototype.size=function(t,e){t>=0&&this.width(t),e>=0&&this.height(e),this.css("margin","0"),this.css("boxSizing","border-box")},n.prototype.columns=function(t,e,i,n){var s=o.prefixed("columnAxis"),r=o.prefixed("columnGap"),h=o.prefixed("columnWidth"),a=o.prefixed("columnFill");this.width(t),this.height(e),this.viewport({width:t,height:e,scale:1}),this.css("overflowY","hidden"),this.css("margin","0"),this.css("boxSizing","border-box"),this.css("maxWidth","inherit"),this.css(s,"horizontal"),this.css(a,"auto"),this.css(r,n+"px"),this.css(h,i+"px")},n.prototype.scale=function(t,e,i){var t="scale("+t+")",n="";this.css("transformOrigin","top left"),(e>=0||i>=0)&&(n=" translate("+(e||0)+"px, "+(i||0)+"px )"),this.css("transform",t+n)},n.prototype.fit=function(t,e){var i=this.viewport(),n=t/i.width,s=e/i.height,o=n1&&(e=t.next()))return this.add(e)}.bind(this)).then(function(t){e&&(offset=t.locationOf(e),this.moveTo(offset)),this.views.show(),i.resolve()}.bind(this)),n)},n.prototype.afterDisplayed=function(t){this.emit("added",t)},n.prototype.afterResized=function(t){this.emit("resize",t.section)},n.prototype.moveTo=function(t){var e=0,i=0;"vertical"===this.settings.axis?i=t.top:(e=Math.floor(t.left/this.layout.delta)*this.layout.delta,e+this.layout.delta>this.container.scrollWidth&&(e=this.container.scrollWidth-this.layout.delta)),this.scrollTo(e,i)},n.prototype.add=function(t){var e=this.createView(t);return this.views.append(e),e.onDisplayed=this.afterDisplayed.bind(this),e.onResize=this.afterResized.bind(this),e.display(this.request)},n.prototype.append=function(t){var e=this.createView(t);return this.views.append(e),e.display(this.request)},n.prototype.prepend=function(t){var e=this.createView(t);return this.views.prepend(e),e.display(this.request)},n.prototype.next=function(){var t,e;if(this.views.length)return"horizontal"===this.settings.axis?(this.scrollLeft=this.container.scrollLeft,e=this.container.scrollLeft+this.container.offsetWidth+this.layout.delta,e1&&(e=t.next()))return this.append(e)}.bind(this)).then(function(){this.views.show()}.bind(this))):void 0},n.prototype.prev=function(){var t,e;if(this.views.length)return"horizontal"===this.settings.axis?(this.scrollLeft=this.container.scrollLeft,e=this.container.scrollLeft,e>0?this.scrollBy(-this.layout.delta,0):t=this.views.first().section.prev()):t=this.views.first().section.prev(),t?(this.views.clear(),this.prepend(t).then(function(){var e;if(this.layout.name&&this.layout.divisor>1&&(e=t.prev()))return this.prepend(e)}.bind(this)).then(function(){"horizontal"===this.settings.axis&&this.scrollTo(this.container.scrollWidth-this.layout.delta,0),this.views.show()}.bind(this))):void 0},n.prototype.current=function(){var t=this.visible();return t.length?t[t.length-1]:null},n.prototype.currentLocation=function(){var t,e,i;if(this.views.length)return t=this.views.first(),e=container.left-t.position().left,i=e+this.layout.spread,this.mapping.page(t,t.section.cfiBase)},n.prototype.isVisible=function(t,e,i,n){var s=t.position(),o=n||this.bounds();return"horizontal"===this.settings.axis&&s.right>o.left-e&&s.lefto.top-e&&s.top-1&&(i=t.substring(t.indexOf("#")+1)),n&&(i=t),this.manager.display(e,i).then(function(){this.emit("displayed",e)}.bind(this))):(s.reject(new Error("No Section Found")),r)},n.prototype.afterDisplayed=function(t){this.hooks.content.trigger(t,this),this.emit("rendered",t.section),this.reportLocation()},n.prototype.onResized=function(){this.location&&this.display(this.location.start),this.emit("resized",{width:size.width,height:size.height})},n.prototype.moveTo=function(t){this.manager.moveTo(t)},n.prototype.next=function(){return this.q.enqueue(this.manager.next.bind(this.manager)).then(this.reportLocation.bind(this))},n.prototype.prev=function(){return this.q.enqueue(this.manager.prev.bind(this.manager)).then(this.reportLocation.bind(this))},n.prototype.determineLayoutProperties=function(t){var e,i=this.settings.layout||t.layout||"reflowable",n=this.settings.spread||t.spread||"auto",s=this.settings.orientation||t.orientation||"auto",o=this.settings.flow||t.flow||"auto",r=t.viewport||"",h=this.settings.minSpreadWidth||t.minSpreadWidth||800;return this.settings.width>=0&&this.settings.height>=0&&(r="width="+this.settings.width+", height="+this.settings.height),e={layout:i,spread:n,orientation:s,flow:o,viewport:r,minSpreadWidth:h}},n.prototype.flow=function(t){var e;"scrolled-doc"!==t&&"scrolled-continuous"!==t||(e="scrolled"),"auto"!==t&&"paginated"!==t||(e="paginated"),this._layout&&this._layout.flow(e),this.manager&&this.manager.updateFlow(e)},n.prototype.layout=function(t){return t&&(this._layout=new p(t),this._layout.spread(t.spread,this.settings.minSpreadWidth),this.mapping=new l(this._layout)),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this._layout},n.prototype.spread=function(t,e){this._layout.spread(t,e),this.manager.isRendered()&&this.manager.updateLayout()},n.prototype.reportLocation=function(){return this.q.enqueue(function(){var t=this.manager.currentLocation();t&&t.then&&"function"==typeof t.then?t.then(function(t){this.location=t,this.emit("locationChanged",this.location)}.bind(this)):t&&(this.location=t,this.emit("locationChanged",this.location))}.bind(this))},n.prototype.destroy=function(){this.q.clear(),this.manager.destroy()},n.prototype.passViewEvents=function(t){t.contents.listenedEvents.forEach(function(e){t.on(e,this.triggerViewEvent.bind(this))}.bind(this)),t.on("selected",this.triggerSelectedEvent.bind(this))},n.prototype.triggerViewEvent=function(t){this.emit(t.type,t)},n.prototype.triggerSelectedEvent=function(t){this.emit("selected",t)},n.prototype.range=function(t,e){var i=new a(t),n=this.visible().filter(function(t){if(i.spinePos===t.index)return!0});if(n.length)return n[0].range(i,e)},n.prototype.adjustImages=function(t){return t.addStylesheetRules([["img",["max-width",t.layout.spreadWidth+"px"],["max-height",t.layout.height+"px"]]]),new Promise(function(t,e){setTimeout(function(){t()},1)})},s(n.prototype),t.exports=n},function(t,i){t.exports=e},,,function(t,e,i){function n(t,e){"undefined"==typeof e&&"object"==typeof t&&(e=t,t=void 0),this.settings=o.extend(this.settings||{},{requestMethod:void 0,requestCredentials:void 0,requestHeaders:void 0,encoding:void 0,replacements:"base64"}),o.extend(this.settings,e),this.opening=new o.defer,this.opened=this.opening.promise,this.isOpen=!1,this.loading={manifest:new o.defer,spine:new o.defer,metadata:new o.defer,cover:new o.defer,navigation:new o.defer,pageList:new o.defer,resources:new o.defer},this.loaded={manifest:this.loading.manifest.promise,spine:this.loading.spine.promise,metadata:this.loading.metadata.promise,cover:this.loading.cover.promise,navigation:this.loading.navigation.promise,pageList:this.loading.pageList.promise,resources:this.loading.resources.promise},this.ready=Promise.all([this.loaded.manifest,this.loaded.spine,this.loaded.metadata,this.loaded.cover,this.loaded.navigation,this.loaded.resources]),this.isRendered=!1,this.request=this.settings.requestMethod||y,this.spine=new a,this.locations=new c(this.spine,this.load),this.navigation=void 0,this.pageList=new f,this.url=void 0,this.path=void 0,this.archived=!1,t&&this.open(t)["catch"](function(e){var i=new Error("Cannot load book at "+t);console.error(i),this.emit("openFailed",i),console.log(e)}.bind(this))}var s=i(3),o=(i(2),i(0)),r=i(0).Url,h=i(0).Path,a=i(47),c=i(39),p=i(37),l=i(43),u=i(42),d=i(45),f=i(44),g=i(12),m=i(36),y=i(9),v=i(1),w="META-INF/container.xml";n.prototype.open=function(t,e){var i,n=e||this.determineType(t);return"binary"===n?(this.archived=!0,this.url=new r("/",""),i=this.openEpub(t)):"epub"===n?(this.archived=!0,this.url=new r("/",""),i=this.request(t,"binary").then(this.openEpub.bind(this))):"opf"==n?(this.url=new r(t),i=this.openPackaging(t)):(this.url=new r(t),i=this.openContainer(w).then(this.openPackaging.bind(this))),i},n.prototype.openEpub=function(t,e){return this.unarchive(t,e||this.settings.encoding).then(function(){return this.openContainer(w)}.bind(this)).then(function(t){return this.openPackaging(t)}.bind(this))},n.prototype.openContainer=function(t){return this.load(t).then(function(t){return this.container=new p(t),this.resolve(this.container.packagePath)}.bind(this))},n.prototype.openPackaging=function(t){return this.path=new h(t),this.load(t).then(function(t){return this.packaging=new l(t),this.unpack(this.packaging)}.bind(this))},n.prototype.load=function(t){var e;return this.archived?(e=this.resolve(t),this.archive.request(e)):(e=this.resolve(t),this.request(e,null,this.settings.requestCredentials,this.settings.requestHeaders))},n.prototype.resolve=function(t,e){var i=t,n=t.indexOf("://")>-1;return n?t:(this.path&&(i=this.path.resolve(t)),0!=e&&this.url&&(i=this.url.resolve(i)),i)},n.prototype.determineType=function(t){var e,i,n;return"string"!=typeof t?"binary":(e=new r(t),i=e.path(),n=i.extension,n?"epub"===n?"epub":"opf"===n?"opf":void 0:"directory")},n.prototype.unpack=function(t){this["package"]=t,this.spine.unpack(this["package"],this.resolve.bind(this)),this.resources=new d(this["package"].manifest,{archive:this.archive,resolver:this.resolve.bind(this),replacements:this.settings.replacements}),this.loadNavigation(this["package"]).then(function(t){this.toc=t,this.loading.navigation.resolve(this.toc)}.bind(this)),this.cover=this.resolve(this["package"].coverPath),this.loading.manifest.resolve(this["package"].manifest),this.loading.metadata.resolve(this["package"].metadata),this.loading.spine.resolve(this.spine),this.loading.cover.resolve(this.cover),this.loading.resources.resolve(this.resources),this.loading.pageList.resolve(this.pageList),this.isOpen=!0,this.archived?this.replacements().then(function(){this.opening.resolve(this)}.bind(this)):this.opening.resolve(this)},n.prototype.loadNavigation=function(t){var e=t.navPath||t.ncxPath;if(e)return this.load(e,"xml").then(function(t){this.navigation=new u(t),this.pageList=new f(t)}.bind(this))},n.prototype.section=function(t){return this.spine.get(t)},n.prototype.renderTo=function(t,e){return this.rendition=new g(this,e),this.rendition.attachTo(t),this.rendition},n.prototype.setRequestCredentials=function(t){this.settings.requestCredentials=t},n.prototype.setRequestHeaders=function(t){this.settings.requestHeaders=t},n.prototype.unarchive=function(t,e){return this.archive=new m,this.archive.open(t,e)},n.prototype.coverUrl=function(){var t=this.loaded.cover.then(function(t){return this.archived?this.resources.get(this.cover):this.cover}.bind(this));return t},n.prototype.replacements=function(){return this.spine.hooks.serialize.register(function(t,e){e.output=this.resources.substitute(t,e.url)}.bind(this)),this.resources.replacements().then(function(){return this.resources.replaceCss()}.bind(this))},n.prototype.range=function(t){var e=new v(t),i=this.spine.get(e.spinePos);return i.load().then(function(t){var n=e.toRange(i.document);return n})},s(n.prototype),t.exports=n},function(t,e,i){function n(t){o.apply(this,arguments),this.name="continuous",this.settings=s.extend(this.settings||{},{infinite:!0,overflow:"auto",axis:"vertical",offset:500,offsetDelta:250,width:void 0,height:void 0}),s.extend(this.settings,t.settings||{}),"undefined"!=t.settings.gap&&0===t.settings.gap&&(this.settings.gap=t.settings.gap),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,layout:this.layout,width:0,height:0},this.scrollTop=0,this.scrollLeft=0}var s=i(0),o=i(11);n.prototype=Object.create(o.prototype),n.prototype.constructor=n,n.prototype.display=function(t,e){return o.prototype.display.call(this,t,e).then(function(){return this.fill()}.bind(this))},n.prototype.fill=function(t){var e=t||new s.defer;return this.check().then(function(t){t?this.fill(e):e.resolve()}.bind(this)),e.promise},n.prototype.moveTo=function(t){var e=0,i=0,n=0,s=0;return"vertical"===this.settings.axis?(i=t.top,s=t.top+this.settings.offset):(e=Math.floor(t.left/this.layout.delta)*this.layout.delta,n=e+this.settings.offset),this.check(n,s).then(function(){this.scrollBy(e,i)}.bind(this))},n.prototype.resize=function(t,e){this.q.clear(),this._stageSize=this.stage.size(t,e),this._bounds=this.bounds(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.views.each(function(t){t.size(this._stageSize.width,this._stageSize.height)}.bind(this)),this.updateLayout(),this.emit("resized",{width:this.stage.width,height:this.stage.height})},n.prototype.onResized=function(t){clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(function(){this.resize()}.bind(this),150)},n.prototype.afterResized=function(t){this.emit("resize",t.section)},n.prototype.removeShownListeners=function(t){t.onDisplayed=function(){}},n.prototype.append=function(t){var e=this.createView(t);return this.views.append(e),e},n.prototype.prepend=function(t){var e=this.createView(t);return e.on("resized",this.counter.bind(this)),this.views.prepend(e),e},n.prototype.counter=function(t){"vertical"===this.settings.axis?this.scrollBy(0,t.heightDelta,!0):this.scrollBy(t.widthDelta,0,!0)},n.prototype.update=function(t){for(var e,i,n=this.bounds(),o=this.views.all(),r=o.length,h=[],a="undefined"!=typeof t?t:this.settings.offset||0,c=new s.defer,p=[],l=0;l=f&&(i=this.views.last(),o=i&&i.section.next(),o&&a.push(this.append(o))),u-p<0&&(n=this.views.first(),r=n&&n.section.prev(),r&&a.push(this.prepend(r))),a.length?this.q.enqueue(function(){return this.update(p)}.bind(this)):(h.resolve(!1),h.promise)},n.prototype.trim=function(){for(var t=new s.defer,e=this.views.displayed(),i=e[0],n=e[e.length-1],o=this.views.indexOf(i),r=this.views.indexOf(n),h=this.views.slice(0,o),a=this.views.slice(r+1),c=0;cthis.settings.offsetDelta||this.scrollDeltaHorz>this.settings.offsetDelta)&&(this.q.enqueue(function(){this.check()}.bind(this)),this.scrollDeltaVert=0,this.scrollDeltaHorz=0,this.emit("scroll",{top:scrollTop,left:scrollLeft}),clearTimeout(this.afterScrolled),this.afterScrolled=setTimeout(function(){this.emit("scrolled",{top:this.scrollTop,left:this.scrollLeft})}.bind(this))),this.scrollDeltaVert+=Math.abs(scrollTop-this.prevScrollTop),this.scrollDeltaHorz+=Math.abs(scrollLeft-this.prevScrollLeft),this.prevScrollTop=scrollTop,this.prevScrollLeft=scrollLeft,clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(function(){this.scrollDeltaVert=0,this.scrollDeltaHorz=0}.bind(this),150),this.scrolled=!1},n.prototype.currentLocation=function(){return"vertical"===this.settings.axis?this.location=this.scrolledLocation():this.location=this.paginatedLocation(),this.location},n.prototype.scrolledLocation=function(){var t,e,i=this.visible();this.container.getBoundingClientRect();return 1===i.length?this.mapping.page(i[0].contents,i[0].section.cfiBase):i.length>1?(t=this.mapping.page(i[0].contents,i[0].section.cfiBase),e=this.mapping.page(i[i.length-1].contents,i[i.length-1].section.cfiBase),{start:t.start,end:e.end}):void 0},n.prototype.paginatedLocation=function(){var t,e,i,n,s,o,r=this.visible(),h=this.container.getBoundingClientRect();return 1===r.length?(t=h.left-r[0].position().left,i=t+this.layout.spreadWidth,this.mapping.page(r[0].contents,r[0].section.cfiBase,t,i)):r.length>1?(t=h.left-r[0].position().left,i=t+this.layout.columnWidth,e=h.left+this.layout.spreadWidth-r[r.length-1].position().left,n=e+this.layout.columnWidth,s=this.mapping.page(r[0].contents,r[0].section.cfiBase,t,i),o=this.mapping.page(r[r.length-1].contents,r[r.length-1].section.cfiBase,e,n),{start:s.start,end:o.end}):void 0},n.prototype.updateLayout=function(){this.stage&&("vertical"===this.settings.axis?this.layout.calculate(this._stageSize.width,this._stageSize.height):(this.layout.calculate(this._stageSize.width,this._stageSize.height,this.settings.gap), -this.settings.offset=this.layout.delta,this.stage.addStyleRules("iframe",[{"margin-right":this.layout.gap+"px"}])),this.viewSettings.width=this.layout.width,this.viewSettings.height=this.layout.height,this.setLayout(this.layout))},n.prototype.next=function(){"horizontal"===this.settings.axis?(this.scrollLeft=this.container.scrollLeft,this.container.scrollLeft+this.container.offsetWidth+this.layout.delta1&&"reflowable"===this.settings.layout.name&&e%2>0&&(s+=this.settings.layout.gap+this.settings.layout.columnWidth),this._textWidth=i,this._contentWidth=s):s=this._contentWidth):"vertical"===this.settings.axis&&(n=this.contents.textHeight(),n!=this._textHeight?(o=this.contentHeight(n),this._textHeight=n,this._contentHeight=o):o=this._contentHeight),(this._needsReframe||s!=this._width||o!=this._height)&&this.resize(s,o),this._expanding=!1)},n.prototype.contentWidth=function(t){var e,i;return e=this.iframe.style.width,this.iframe.style.width=(t||0)+"px",i=this.contents.scrollWidth(),this.iframe.style.width=e,i},n.prototype.contentHeight=function(t){var e,i;return e=this.iframe.style.height,this.iframe.style.height=(t||0)+"px",i=this.contents.scrollHeight(),this.iframe.style.height=e,i},n.prototype.resize=function(t,e){this.iframe&&(o.isNumber(t)&&(this.iframe.style.width=t+"px",this._width=t),o.isNumber(e)&&(this.iframe.style.height=e+"px",this._height=e),this.iframeBounds=o.bounds(this.iframe),this.reframe(this.iframeBounds.width,this.iframeBounds.height))},n.prototype.reframe=function(t,e){var i;o.isNumber(t)&&(this.element.style.width=t+"px"),o.isNumber(e)&&(this.element.style.height=e+"px"),this.prevBounds=this.elementBounds,this.elementBounds=o.bounds(this.element),i={width:this.elementBounds.width,height:this.elementBounds.height,widthDelta:this.elementBounds.width-this.prevBounds.width,heightDelta:this.elementBounds.height-this.prevBounds.height},this.onResize(this,i),this.emit("resized",i)},n.prototype.load=function(t){var e=new o.defer,i=e.promise;if(!this.iframe)return e.reject(new Error("No Iframe Available")),i;if(this.iframe.onload=function(t){this.onLoad(t,e)}.bind(this),this.supportsSrcdoc)this.iframe.srcdoc=t;else{if(this.document=this.iframe.contentDocument,!this.document)return e.reject(new Error("No Document Available")),i;this.iframe.contentDocument.open(),this.iframe.contentDocument.write(t),this.iframe.contentDocument.close()}return i},n.prototype.onLoad=function(t,e){this.window=this.iframe.contentWindow,this.document=this.iframe.contentDocument,this.contents=new h(this.document,this.document.body,this.section.cfiBase),this.rendering=!1;var i=this.document.querySelector("link[rel='canonical']");i?i.setAttribute("href",this.section.url):(i=this.document.createElement("link"),i.setAttribute("rel","canonical"),i.setAttribute("href",this.section.url),this.document.querySelector("head").appendChild(i)),this.contents.on("expand",function(){this.displayed&&this.iframe&&this.expand()}),e.resolve(this.contents)},n.prototype.setLayout=function(t){this.layout=t},n.prototype.setAxis=function(t){this.settings.axis=t},n.prototype.resizeListenters=function(){clearTimeout(this.expanding),this.expanding=setTimeout(this.expand.bind(this),350)},n.prototype.addListeners=function(){},n.prototype.removeListeners=function(t){},n.prototype.display=function(t){var e=new o.defer;return this.displayed?e.resolve(this):this.render(t).then(function(){this.emit("displayed",this),this.onDisplayed(this),this.displayed=!0,e.resolve(this)}.bind(this)),e.promise},n.prototype.show=function(){this.element.style.visibility="visible",this.iframe&&(this.iframe.style.visibility="visible"),this.emit("shown",this)},n.prototype.hide=function(){this.element.style.visibility="hidden",this.iframe.style.visibility="hidden",this.stopExpanding=!0,this.emit("hidden",this)},n.prototype.position=function(){return this.element.getBoundingClientRect()},n.prototype.locationOf=function(t){var e=this.iframe.getBoundingClientRect(),i=this.contents.locationOf(t,this.settings.ignoreClass);return{left:window.scrollX+e.left+i.left,top:window.scrollY+e.top+i.top}},n.prototype.onDisplayed=function(t){},n.prototype.onResize=function(t,e){},n.prototype.bounds=function(){return this.elementBounds||(this.elementBounds=o.bounds(this.element)),this.elementBounds},n.prototype.destroy=function(){this.displayed&&(this.displayed=!1,this.removeListeners(),this.stopExpanding=!0,this.element.removeChild(this.iframe),this.displayed=!1,this.iframe=null,this._textWidth=null,this._textHeight=null,this._width=null,this._height=null)},s(n.prototype),t.exports=n},function(t,e){function i(t){return t&&s[t.split(".").pop().toLowerCase()]||o}var n={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"}},s=function(){var t,e,i,s,o={};for(t in n)if(n.hasOwnProperty(t))for(e in n[t])if(n[t].hasOwnProperty(e))if(i=n[t][e],"string"==typeof i)o[i]=t+"/"+e;else for(s=0;s0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function n(t){return 3*t.length/4-i(t)}function s(t){var e,n,s,o,r,h,a=t.length;r=i(t),h=new p(3*a/4-r),s=r>0?a-4:a;var l=0;for(e=0,n=0;e>16&255,h[l++]=o>>8&255,h[l++]=255&o;return 2===r?(o=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,h[l++]=255&o):1===r&&(o=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,h[l++]=o>>8&255,h[l++]=255&o),h}function o(t){return a[t>>18&63]+a[t>>12&63]+a[t>>6&63]+a[63&t]}function r(t,e,i){for(var n,s=[],r=e;rp?p:c+h));return 1===n?(e=t[i-1],s+=a[e>>2],s+=a[e<<4&63],s+="=="):2===n&&(e=(t[i-2]<<8)+t[i-1],s+=a[e>>10],s+=a[e>>4&63],s+=a[e<<2&63],s+="="),o.push(s),o.join("")}e.byteLength=n,e.toByteArray=s,e.fromByteArray=h;for(var a=[],c=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,d=l.length;u-1}},,function(t,e,i){function n(){this.zip=void 0,this.checkRequirements(),this.urlCache={}}var s=i(0),o=i(9),r=i(19),h=i(0).Path;n.prototype.checkRequirements=function(){try{"undefined"==typeof JSZip&&(JSZip=i(48)),this.zip=new JSZip}catch(t){console.error("JSZip lib not loaded")}},n.prototype.open=function(t,e){return this.zip.loadAsync(t,{base64:e})},n.prototype.openUrl=function(t,e){return o(t,"binary").then(function(t){return this.zip.loadAsync(t,{base64:e})}.bind(this))},n.prototype.request=function(t,e){var i,n=new s.defer,o=new h(t);return e||(e=o.extension),i="blob"==e?this.getBlob(t):this.getText(t),i?i.then(function(t){result=this.handleResponse(t,e),n.resolve(result)}.bind(this)):n.reject({message:"File not found in the epub: "+t,stack:(new Error).stack}),n.promise},n.prototype.handleResponse=function(t,e){var i;return i="json"==e?JSON.parse(t):s.isXml(e)?s.parse(t,"text/xml"):"xhtml"==e?s.parse(t,"application/xhtml+xml"):"html"==e||"htm"==e?s.parse(t,"text/html"):t},n.prototype.getBlob=function(t,e){var i=window.decodeURIComponent(t.substr(1)),n=this.zip.file(i);if(n)return e=e||r.lookup(n.name),n.async("uint8array").then(function(t){return new Blob([t],{type:e})})},n.prototype.getText=function(t,e){var i=window.decodeURIComponent(t.substr(1)),n=this.zip.file(i);if(n)return n.async("string").then(function(t){return t})},n.prototype.getBase64=function(t,e){var i=window.decodeURIComponent(t.substr(1)),n=this.zip.file(i);if(n)return e=e||r.lookup(n.name),n.async("base64").then(function(t){return"data:"+e+";base64,"+t})},n.prototype.createUrl=function(t,e){var i,n,o=new s.defer,r=window.URL||window.webkitURL||window.mozURL,h=e&&e.base64;return t in this.urlCache?(o.resolve(this.urlCache[t]),o.promise):(h?(n=this.getBase64(t),n&&n.then(function(e){this.urlCache[t]=e,o.resolve(e)}.bind(this))):(n=this.getBlob(t),n&&n.then(function(e){i=r.createObjectURL(e),this.urlCache[t]=i,o.resolve(i)}.bind(this))),n||o.reject({message:"File not found in the epub: "+t,stack:(new Error).stack}),o.promise)},n.prototype.revokeUrl=function(t){var e=window.URL||window.webkitURL||window.mozURL,i=this.urlCache[t];i&&e.revokeObjectURL(i)},t.exports=n},function(t,e,i){function n(t){t&&this.parse(t)}var s=i(2),o=i(0);i(1);n.prototype.parse=function(t){var e;return t?(e=o.qs(t,"rootfile"))?(this.packagePath=e.getAttribute("full-path"),this.directory=s.dirname(this.packagePath),void(this.encoding=t.xmlEncoding)):void console.error("No RootFile Found"):void console.error("Container File Not Found")},t.exports=n},function(t,e,i){function n(t){this.name=t.layout||"reflowable",this._spread="none"!==t.spread,this._minSpreadWidth=t.minSpreadWidth||800,this._evenSpreads=t.evenSpreads||!1,"scrolled-continuous"===t.flow||"scrolled-doc"===t.flow?this._flow="scrolled":this._flow="paginated",this.width=0,this.height=0,this.spreadWidth=0,this.delta=0,this.columnWidth=0,this.gap=0,this.divisor=1}i(0);n.prototype.flow=function(t){this._flow="paginated"===t?"paginated":"scrolled"},n.prototype.spread=function(t,e){this._spread="none"!==t,e>=0&&(this._minSpreadWidth=e)},n.prototype.calculate=function(t,e,i){var n,s,o,r=1,h=i||0,a=(Math.floor(t),t),c=Math.floor(a/8);r=this._spread&&a>=this._minSpreadWidth?2:1,"reflowable"!==this.name||"paginated"!==this._flow||i>=0||(h=c%2===0?c:c-1),"pre-paginated"===this.name&&(h=0),n=r>1?Math.floor((a-h)/r):a,"pre-paginated"===this.name&&r>1&&(a=n),s=n*r,o=(n+h)*r,this.width=a,this.height=e,this.spreadWidth=s,this.delta=o,this.columnWidth=n,this.gap=h,this.divisor=r},n.prototype.format=function(t){var e;return e="pre-paginated"===this.name?t.fit(this.columnWidth,this.height):"paginated"===this._flow?t.columns(this.width,this.height,this.columnWidth,this.gap):t.size(this.width,null)},n.prototype.count=function(t){var e=Math.ceil(t/this.spreadWidth);return{spreads:e,pages:e*this.divisor}},t.exports=n},function(t,e,i){function n(t,e){this.spine=t,this.request=e,this.q=new o(this),this.epubcfi=new r,this._locations=[],this.total=0,this["break"]=150,this._current=0}var s=i(0),o=i(7),r=i(1),h=i(3);n.prototype.generate=function(t){return t&&(this["break"]=t),this.q.pause(),this.spine.each(function(t){this.q.enqueue(this.process,t)}.bind(this)),this.q.run().then(function(){return this.total=this._locations.length-1,this._currentCfi&&(this.currentLocation=this._currentCfi),this._locations}.bind(this))},n.prototype.process=function(t){return t.load(this.request).then(function(e){var i,n=e.ownerDocument,s=0;this.sprint(e,function(e){var o,r=e.length,h=0;for(0==s&&(i=n.createRange(),i.setStart(e,0)),o=this["break"]-s,o>r&&(s+=r,h=r);h=r?s=r-(h-this["break"]):(i.setEnd(e,h),cfi=t.cfiFromRange(i),this._locations.push(cfi),s=0,h+=1,i=n.createRange(),i.setStart(e,h))}.bind(this)),i&&(i.setEnd(prev,prev.length),cfi=t.cfiFromRange(i),this._locations.push(cfi),s=0)}.bind(this))},n.prototype.sprint=function(t,e){for(var i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,null,!1);node=i.nextNode();)e(node)},n.prototype.locationFromCfi=function(t){return 0===this._locations.length?-1:s.locationOf(t,this._locations,this.epubcfi.compare)},n.prototype.precentageFromCfi=function(t){var e=this.locationFromCfi(t);return this.precentageFromLocation(e)},n.prototype.percentageFromLocation=function(t){return t&&this.total?t/this.total:0},n.prototype.cfiFromLocation=function(t){var e=-1;return"number"!=typeof t&&(t=parseInt(pg)),t>=0&&t1?t/100:t,i=Math.ceil(this.total*e);return this.cfiFromLocation(i)},n.prototype.load=function(t){return this._locations=JSON.parse(t),this.total=this._locations.length-1,this._locations},n.prototype.save=function(t){return JSON.stringify(this._locations)},n.prototype.getCurrent=function(t){return this._current},n.prototype.setCurrent=function(t){var e;if("string"==typeof t)this._currentCfi=t;else{if("number"!=typeof t)return;this._current=t}0!==this._locations.length&&("string"==typeof t?(e=this.locationFromCfi(t),this._current=e):e=t,this.emit("changed",{percentage:this.precentageFromLocation(e)}))},Object.defineProperty(n.prototype,"currentLocation",{get:function(){return this._current},set:function(t){this.setCurrent(t)}}),h(n.prototype),t.exports=n},function(t,e,i){function n(t){this.settings=t||{},this.id="epubjs-container-"+s.uuid(),this.container=this.create(this.settings),this.settings.hidden&&(this.wrapper=this.wrap(this.container))}var s=i(0);n.prototype.create=function(t){var e=t.height,i=t.width,n=t.overflow||!1,o=t.axis||"vertical";return t.height&&s.isNumber(t.height)&&(e=t.height+"px"),t.width&&s.isNumber(t.width)&&(i=t.width+"px"),container=document.createElement("div"),container.id=this.id,container.classList.add("epub-container"),container.style.wordSpacing="0",container.style.lineHeight="0",container.style.verticalAlign="top","horizontal"===o&&(container.style.whiteSpace="nowrap"),i&&(container.style.width=i),e&&(container.style.height=e),n&&(container.style.overflow=n),container},n.wrap=function(t){var e=document.createElement("div");return e.style.visibility="hidden",e.style.overflow="hidden",e.style.width="0",e.style.height="0",e.appendChild(t),e},n.prototype.getElement=function(t){var e;return s.isElement(t)?e=t:"string"==typeof t&&(e=document.getElementById(t)),e?e:void console.error("Not an Element")},n.prototype.attachTo=function(t){var e,i=this.getElement(t);if(i)return e=this.settings.hidden?this.wrapper:this.container,i.appendChild(e),this.element=i,i},n.prototype.getContainer=function(){return this.container},n.prototype.onResize=function(t){s.isNumber(this.settings.width)&&s.isNumber(this.settings.height)||window.addEventListener("resize",t,!1)},n.prototype.size=function(t,e){var i;return null===t&&(i=this.element.getBoundingClientRect(),i.width&&(t=i.width,this.container.style.width=i.width+"px")),null===e&&(i=i||this.element.getBoundingClientRect(),i.height&&(e=i.height,this.container.style.height=i.height+"px")),s.isNumber(t)||(i=this.container.getBoundingClientRect(),t=i.width),s.isNumber(e)||(i=i||this.container.getBoundingClientRect(),e=i.height),this.containerStyles=window.getComputedStyle(this.container),this.containerPadding={left:parseFloat(this.containerStyles["padding-left"])||0,right:parseFloat(this.containerStyles["padding-right"])||0,top:parseFloat(this.containerStyles["padding-top"])||0,bottom:parseFloat(this.containerStyles["padding-bottom"])||0},{width:t-this.containerPadding.left-this.containerPadding.right,height:e-this.containerPadding.top-this.containerPadding.bottom}},n.prototype.bounds=function(){return this.container?this.container.getBoundingClientRect():s.windowBounds()},n.prototype.getSheet=function(){var t=document.createElement("style");return t.appendChild(document.createTextNode("")),document.head.appendChild(t),t.sheet},n.prototype.addStyleRules=function(t,e){var i="#"+this.id+" ",n="";this.sheet||(this.sheet=this.getSheet()),e.forEach(function(t){for(var e in t)t.hasOwnProperty(e)&&(n+=e+":"+t[e]+";")}),this.sheet.insertRule(i+t+" {"+n+"}",0)},t.exports=n},function(t,e){function i(t){this.container=t,this._views=[],this.length=0,this.hidden=!1}i.prototype.all=function(){return this._views},i.prototype.first=function(){return this._views[0]},i.prototype.last=function(){return this._views[this._views.length-1]},i.prototype.indexOf=function(t){return this._views.indexOf(t)},i.prototype.slice=function(){return this._views.slice.apply(this._views,arguments)},i.prototype.get=function(t){return this._views[t]},i.prototype.append=function(t){return this._views.push(t),this.container&&this.container.appendChild(t.element),this.length++,t},i.prototype.prepend=function(t){return this._views.unshift(t),this.container&&this.container.insertBefore(t.element,this.container.firstChild),this.length++,t},i.prototype.insert=function(t,e){return this._views.splice(e,0,t),this.container&&(e-1&&this._views.splice(e,1),this.destroy(t),this.length--},i.prototype.destroy=function(t){t.displayed&&t.destroy(),this.container&&this.container.removeChild(t.element),t=null},i.prototype.each=function(){return this._views.forEach.apply(this._views,arguments)},i.prototype.clear=function(){var t,e=this.length;if(this.length){for(var i=0;i1&&e[1],{cfi:n,href:r,packageUrl:i,page:a}):{href:r,page:a}},n.prototype.process=function(t){t.forEach(function(t){this.pages.push(t.page),t.cfi&&this.locations.push(t.cfi)},this),this.firstPage=parseInt(this.pages[0]),this.lastPage=parseInt(this.pages[this.pages.length-1]),this.totalPages=this.lastPage-this.firstPage},n.prototype.addCFIs=function(){this.pageList.forEach(function(t){!t.cfi})},n.prototype.pageFromCfi=function(t){var e=-1;if(0===this.locations.length)return-1;var i=o.indexOfSorted(t,this.locations,this.epubcfi.compare);return i!=-1?e=this.pages[i]:(i=EPUBJS.core.locationOf(t,this.locations,this.epubcfi.compare),e=i-1>=0?this.pages[i-1]:this.pages[0],void 0!==e||(e=-1)),e},n.prototype.cfiFromPage=function(t){var e=-1;"number"!=typeof t&&(t=parseInt(t)); -var i=this.pages.indexOf(t);return i!=-1&&(e=this.locations[i]),e},n.prototype.pageFromPercentage=function(t){var e=Math.round(this.totalPages*t);return e},n.prototype.percentageFromPage=function(t){var e=(t-this.firstPage)/this.totalPages;return Math.round(1e3*e)/1e3},n.prototype.percentageFromCfi=function(t){var e=this.pageFromCfi(t),i=this.percentageFromPage(e);return i},t.exports=n},function(t,e,i){function n(t,e){this.settings={replacements:e&&e.replacements||"base64",archive:e&&e.archive,resolver:e&&e.resolver},this.manifest=t,this.resources=Object.keys(t).map(function(e){return t[e]}),this.replacementUrls=[],this.split(),this.splitUrls()}var s=i(8),o=i(0),r=i(0).Path,h=i(2);n.prototype.split=function(){this.html=this.resources.filter(function(t){if("application/xhtml+xml"===t.type||"text/html"===t.type)return!0}),this.assets=this.resources.filter(function(t){if("application/xhtml+xml"!==t.type&&"text/html"!==t.type)return!0}),this.css=this.resources.filter(function(t){if("text/css"===t.type)return!0})},n.prototype.splitUrls=function(){this.urls=this.assets.map(function(t){return t.href}.bind(this)),this.cssUrls=this.css.map(function(t){return t.href})},n.prototype.replacements=function(t,e){if(t=t||this.settings.archive,e=e||this.settings.resolver,"none"===this.settings.replacements)return new Promise(function(t,e){t(this.urls)}.bind(this));var i=this.urls.map(function(i){var n=e(i);return t.createUrl(n,{base64:"base64"===this.settings.replacements})}.bind(this));return Promise.all(i).then(function(t){return this.replacementUrls=t,t}.bind(this))},n.prototype.replaceCss=function(t,e){var i=[];return t=t||this.settings.archive,e=e||this.settings.resolver,this.cssUrls.forEach(function(n){var s=this.createCssFile(n,t,e).then(function(t){var e=this.urls.indexOf(n);e>-1&&(this.replacementUrls[e]=t)}.bind(this));i.push(s)}.bind(this)),Promise.all(i)},n.prototype.createCssFile=function(t,e,i){var n;if(e=e||this.settings.archive,i=i||this.settings.resolver,h.isAbsolute(t))return new Promise(function(t,e){t(urls,replacementUrls)});var a=i(t),c=e.getText(a),p=this.urls.map(function(t){var e=i(t),n=new r(a).relative(e);return n}.bind(this));return c.then(function(t){return t=s.substitute(t,p,this.replacementUrls),n="base64"===this.settings.replacements?o.createBase64Url(t,"text/css"):o.createBlobUrl(t,"text/css")}.bind(this))},n.prototype.relativeTo=function(t,e){return e=e||this.settings.resolver,this.urls.map(function(i){var n=e(i),s=new r(t).relative(n);return s}.bind(this))},n.prototype.get=function(t){var e=this.urls.indexOf(t);if(e!==-1)return this.replacementUrls.length?new Promise(function(t,i){t(this.replacementUrls[e])}.bind(this)):archive.createUrl(absolute,{base64:"base64"===this.settings.replacements})},t.exports=n},function(t,e,i){function n(t,e){this.idref=t.idref,this.linear=t.linear,this.properties=t.properties,this.index=t.index,this.href=t.href,this.url=t.url,this.next=t.next,this.prev=t.prev,this.cfiBase=t.cfiBase,e?this.hooks=e:(this.hooks={},this.hooks.serialize=new r(this),this.hooks.content=new r(this))}var s=i(0),o=i(1),r=i(5),h=i(0).Url;n.prototype.load=function(t){var e=t||this.request||i(9),n=new s.defer,o=n.promise;return this.contents?n.resolve(this.contents):e(this.url).then(function(t){new h(this.url).directory;return this.document=t,this.contents=t.documentElement,this.hooks.content.trigger(this.document,this)}.bind(this)).then(function(){n.resolve(this.contents)}.bind(this))["catch"](function(t){n.reject(t)}),o},n.prototype.base=function(t){var e,i=new s.defer,n=t.createElement("base");return n.setAttribute("href",window.location.origin+"/"+this.url),t&&(e=t.querySelector("head")),e?(e.insertBefore(n,e.firstChild),i.resolve()):i.reject(new Error("No head to insert into")),i.promise},n.prototype.render=function(t){var e=new s.defer,n=e.promise;return this.output,this.load(t).then(function(t){var e;return"undefined"==typeof XMLSerializer&&(XMLSerializer=i(13).XMLSerializer),e=new XMLSerializer,this.output=e.serializeToString(t),this.output}.bind(this)).then(function(){return this.hooks.serialize.trigger(this.output,this)}.bind(this)).then(function(){e.resolve(this.output)}.bind(this))["catch"](function(t){e.reject(t)}),n},n.prototype.find=function(t){},n.prototype.reconcileLayoutSettings=function(t){var e={layout:t.layout,spread:t.spread,orientation:t.orientation};return this.properties.forEach(function(t){var i,n,s=t.replace("rendition:",""),o=s.indexOf("-");o!=-1&&(i=s.slice(0,o),n=s.slice(o+1),e[i]=n)}),e},n.prototype.cfiFromRange=function(t){return new o(t,this.cfiBase).toString()},n.prototype.cfiFromElement=function(t){return new o(t,this.cfiBase).toString()},t.exports=n},function(t,e,i){function n(){this.spineItems=[],this.spineByHref={},this.spineById={},this.hooks={},this.hooks.serialize=new o,this.hooks.content=new o,this.hooks.content.register(h.base),this.hooks.content.register(h.canonical),this.epubcfi=new s,this.loaded=!1}var s=(i(0),i(1)),o=i(5),r=i(46),h=i(8);n.prototype.unpack=function(t,e){this.items=t.spine,this.manifest=t.manifest,this.spineNodeIndex=t.spineNodeIndex,this.baseUrl=t.baseUrl||t.basePath||"",this.length=this.items.length,this.items.forEach(function(t,i){var n,s=this.manifest[t.idref];t.cfiBase=this.epubcfi.generateChapterComponent(this.spineNodeIndex,t.index,t.idref),s&&(t.href=s.href,t.url=e(t.href,!0),s.properties.length&&t.properties.push.apply(t.properties,s.properties)),t.prev=function(){return this.get(i-1)}.bind(this),t.next=function(){return this.get(i+1)}.bind(this),n=new r(t,this.hooks),this.append(n)}.bind(this)),this.loaded=!0},n.prototype.get=function(t){var e=0;return this.epubcfi.isCfiString(t)?(cfi=new s(t),e=cfi.spinePos):!t||"number"!=typeof t&&isNaN(t)!==!1?t&&0===t.indexOf("#")?e=this.spineById[t.substring(1)]:t&&(t=t.split("#")[0],e=this.spineByHref[t]):e=t,this.spineItems[e]||null},n.prototype.append=function(t){var e=this.spineItems.length;return t.index=e,this.spineItems.push(t),this.spineByHref[t.href]=e,this.spineById[t.idref]=e,e},n.prototype.prepend=function(t){this.spineItems.unshift(t);return this.spineByHref[t.href]=0,this.spineById[t.idref]=0,this.spineItems.forEach(function(t,e){t.index=e}),0},n.prototype.remove=function(t){var e=this.spineItems.indexOf(t);if(e>-1)return delete this.spineByHref[t.href],delete this.spineById[t.idref],this.spineItems.splice(e,1)},n.prototype.each=function(){return this.spineItems.forEach.apply(this.spineItems,arguments)},t.exports=n},function(e,i){if("undefined"==typeof t){var n=new Error('Cannot find module "JSZip"');throw n.code="MODULE_NOT_FOUND",n}e.exports=t},,function(t,e,i){function n(t,e){return new s(t,e)}var s=i(16),o=i(1),r=i(12),h=i(10);n.VERSION="0.3.0",n.CFI=o,n.Rendition=r,n.Contents=h,n.ViewManagers={},n.Views={},n.register={manager:function(t,e){return n.ViewManagers[t]=e},view:function(t,e){return n.Views[t]=e}},n.register.view("iframe",i(18)),n.register.manager("default",i(11)),n.register.manager("continuous",i(17)),t.exports=n}])}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(function(){try{return require("JSZip")}catch(t){}}(),require("xmldom")):"function"==typeof define&&define.amd?define(["JSZip","xmldom"],e):"object"==typeof exports?exports.ePub=e(function(){try{return require("JSZip")}catch(t){}}(),require("xmldom")):t.ePub=e(t.JSZip,t.xmldom)}(this,function(t,e){return function(t){function e(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,e,i){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var i=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=50)}([function(t,e,i){function n(t,e){var i=t.indexOf("://")>-1,n=t;if(this.Url=void 0,this.href=t,this.protocol="",this.origin="",this.fragment="",this.search="",this.base=e,i||"string"==typeof e||(this.base=window&&window.location.href),i||this.base)try{this.Url=new URL(t,this.base),this.href=this.Url.href,this.protocol=this.Url.protocol,this.origin=this.Url.origin,this.fragment=this.Url.fragment,this.search=this.Url.search,n=this.Url.pathname}catch(o){this.Url=void 0}this.Path=new s(n),this.directory=this.Path.directory,this.filename=this.Path.filename,this.extension=this.Path.extension}function s(t){var e,i;e=t.indexOf("://"),e>-1&&(t=new URL(t).pathname),i=this.parse(t),this.path=t,this.isDirectory(t)?this.directory=t:this.directory=i.dir+"/",this.filename=i.base,this.extension=i.ext.slice(1)}function o(t){return!(!t||1!=t.nodeType)}function r(){var t=(new Date).getTime(),e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:7&i|8).toString(16)});return e}function h(t){for(var e=-1,i=Object.keys(t),n=i.length,s=Array(n);++ee?1:t0?a:a+1:0===o?a:o===-1?g(t,e,i,a,h):g(t,e,i,r,a))}function m(t,e,i,n,s){var o,r=n||0,h=s||e.length,a=parseInt(r+(h-r)/2);return i||(i=function(t,e){return t>e?1:t-1}function E(t,e){var i=new Blob([t],{type:e});return i}function S(t,e){var i,n=window.URL||window.webkitURL||window.mozURL,s=this.createBlob(t,e);return i=n.createObjectURL(s)}function C(t,e){var i,n;if("string"==typeof t)return i=btoa(t),n="data:"+e+";base64,"+i}function _(t){return Object.prototype.toString.call(t).slice(8,-1)}function L(t,e){var n;return"undefined"==typeof DOMParser&&(DOMParser=i(13).DOMParser),n=(new DOMParser).parseFromString(t,e)}function N(t,e){var i;return"undefined"!=typeof t.querySelector?t.querySelector(e):(i=t.getElementsByTagName(e),i.length?i[0]:void 0)}function k(t,e){return"undefined"!=typeof t.querySelector?t.querySelectorAll(e):t.getElementsByTagName(e)}function q(t,e,i){var n,s;if("undefined"!=typeof t.querySelector){e+="[";for(var o in i)e+=o+"='"+i[o]+"'";return e+="]",t.querySelector(e)}if(n=t.getElementsByTagName(e),s=Array.prototype.slice.call(n,0).filter(function(t){for(var e in i)if(t.getAttribute(e)===i[e])return!0;return!1}))return s[0]}function z(t,e){var i=new FileReader;i.readAsDataURL(t),i.onloadend=function(){e(i.result)}}function P(){this.resolve=null,this.reject=null,this.id=r(),this.promise=new Promise(function(t,e){this.resolve=t,this.reject=e}.bind(this)),Object.freeze(this)}function O(t,e,i){var n;if("undefined"!=typeof t.querySelector&&(n=t.querySelector(e+'[*|type="'+i+'"]')),n&&0!==n.length)return n;n=this.qsa(t,e);for(var s=0;s-1;return i?t:(e=R.resolve(this.directory,t),this.origin+e)},n.prototype.relative=function(t){return R.relative(t,this.directory)},n.prototype.toString=function(){return this.href},s.prototype.parse=function(t){return R.parse(t)},s.prototype.isAbsolute=function(t){return R.isAbsolute(t||this.path)},s.prototype.isDirectory=function(t){return"/"===t.charAt(t.length-1)},s.prototype.resolve=function(t){return R.resolve(this.directory,t)},s.prototype.relative=function(t){return R.relative(this.directory,t)},s.prototype.splitPath=function(t){return this.splitPathRe.exec(t).slice(1)},s.prototype.toString=function(){return this.path},t.exports={isElement:o,uuid:r,values:h,resolveUrl:a,indexOfSorted:m,documentHeight:c,isNumber:p,prefixed:l,defaults:u,extend:d,insert:f,locationOf:g,indexOfSorted:m,requestAnimationFrame:A,bounds:y,borders:v,windowBounds:w,cleanStringForXpath:b,indexOfTextNode:x,isXml:T,createBlob:E,createBlobUrl:S,type:_,parse:L,qs:N,qsa:k,qsp:q,blob2base64:z,createBase64Url:C,defer:P,Url:n,Path:s,querySelectorByType:O}},function(t,e,i){function n(t,e,i){var o;if(this.str="",this.base={},this.spinePos=0,this.range=!1,this.path={},this.start=null,this.end=null,!(this instanceof n))return new n(t,e,i);if("string"==typeof e?this.base=this.parseComponent(e):"object"==typeof e&&e.steps&&(this.base=e),o=this.checkType(t),"string"===o)return this.str=t,s.extend(this,this.parse(t));if("range"===o)return s.extend(this,this.fromRange(t,this.base,i));if("node"===o)return s.extend(this,this.fromNode(t,this.base,i));if("EpubCFI"===o&&t.path)return t;if(t)throw new TypeError("not a valid argument for EpubCFI");return this}var s=i(0);n.prototype.checkType=function(t){return this.isCfiString(t)?"string":"object"==typeof t&&"Range"===s.type(t)?"range":"object"==typeof t&&"undefined"!=typeof t.nodeType?"node":"object"==typeof t&&t instanceof n&&"EpubCFI"},n.prototype.parse=function(t){var e,i,n,s={spinePos:-1,range:!1,base:{},path:{},start:null,end:null};return"string"!=typeof t?{spinePos:-1}:(0===t.indexOf("epubcfi(")&&")"===t[t.length-1]&&(t=t.slice(8,t.length-1)),(e=this.getChapterComponent(t))?(s.base=this.parseComponent(e),i=this.getPathComponent(t),s.path=this.parseComponent(i),n=this.getRange(t),n&&(s.range=!0,s.start=this.parseComponent(n[0]),s.end=this.parseComponent(n[1])),s.spinePos=s.base.steps[1].index,s):{spinePos:-1})},n.prototype.parseComponent=function(t){var e,i={steps:[],terminal:{offset:null,assertion:null}},n=t.split(":"),s=n[0].split("/");return n.length>1&&(e=n[1],i.terminal=this.parseTerminal(e)),""===s[0]&&s.shift(),i.steps=s.map(function(t){return this.parseStep(t)}.bind(this)),i},n.prototype.parseStep=function(t){var e,i,n,s,o;if(s=t.match(/\[(.*)\]/),s&&s[1]&&(o=s[1]),i=parseInt(t),!isNaN(i))return i%2===0?(e="element",n=i/2-1):(e="text",n=(i-1)/2),{type:e,index:n,id:o||null}},n.prototype.parseTerminal=function(t){var e,i,n=t.match(/\[(.*)\]/);return n&&n[1]?(e=parseInt(t.split("[")[0])||null,i=n[1]):e=parseInt(t)||null,{offset:e,assertion:i}},n.prototype.getChapterComponent=function(t){var e=t.split("!");return e[0]},n.prototype.getPathComponent=function(t){var e=t.split("!");if(e[1])return ranges=e[1].split(","),ranges[0]},n.prototype.getRange=function(t){var e=t.split(",");return 3===e.length&&[e[1],e[2]]},n.prototype.getCharecterOffsetComponent=function(t){var e=t.split(":");return e[1]||""},n.prototype.joinSteps=function(t){return t?t.map(function(t){var e="";return"element"===t.type&&(e+=2*(t.index+1)),"text"===t.type&&(e+=1+2*t.index),t.id&&(e+="["+t.id+"]"),e}).join("/"):""},n.prototype.segmentString=function(t){var e="/";return e+=this.joinSteps(t.steps),t.terminal&&null!=t.terminal.offset&&(e+=":"+t.terminal.offset),t.terminal&&null!=t.terminal.assertion&&(e+="["+t.terminal.assertion+"]"),e},n.prototype.toString=function(){var t="epubcfi(";return t+=this.segmentString(this.base),t+="!",t+=this.segmentString(this.path),this.start&&(t+=",",t+=this.segmentString(this.start)),this.end&&(t+=",",t+=this.segmentString(this.end)),t+=")"},n.prototype.compare=function(t,e){var i,s,o,r;if("string"==typeof t&&(t=new n(t)),"string"==typeof e&&(e=new n(e)),t.spinePos>e.spinePos)return 1;if(t.spinePoss[h].index)return 1;if(i[h].indexr.offset?1:o.offset=0&&(s.terminal.offset=e,"text"!=s.steps[s.steps.length-1].type&&s.steps.push({type:"text",index:0})),s},n.prototype.equalStep=function(t,e){return!(!t||!e)&&(t.index===e.index&&t.id===e.id&&t.type===e.type)},n.prototype.fromRange=function(t,e,i){var n={range:!1,base:{},path:{},start:null,end:null},s=t.startContainer,o=t.endContainer,r=t.startOffset,h=t.endOffset,a=!1;if(i&&(a=null!=s.ownerDocument.querySelector("."+i)),"string"==typeof e?(n.base=this.parseComponent(e),n.spinePos=n.base.steps[1].index):"object"==typeof e&&(n.base=e),t.collapsed)a&&(r=this.patchOffset(s,r,i)),n.path=this.pathTo(s,r,i);else{n.range=!0,a&&(r=this.patchOffset(s,r,i)),n.start=this.pathTo(s,r,i),a&&(h=this.patchOffset(o,h,i)),n.end=this.pathTo(o,h,i),n.path={steps:[],terminal:null};var c,p=n.start.steps.length;for(c=0;c0&&s===Node.TEXT_NODE&&o===Node.TEXT_NODE?r[n]=h:e===s&&(h+=1,r[n]=h),o=s;return r},n.prototype.position=function(t){var e,i;return t.nodeType===Node.ELEMENT_NODE?(e=t.parentNode.children,i=Array.prototype.indexOf.call(e,t)):(e=this.textNodes(t.parentNode),i=e.indexOf(t)),i},n.prototype.filteredPosition=function(t,e){var i,n,s;return t.nodeType===Node.ELEMENT_NODE?(i=t.parentNode.children,s=this.normalizedMap(i,Node.ELEMENT_NODE,e)):(i=t.parentNode.childNodes,t.parentNode.classList.contains(e)&&(t=t.parentNode,i=t.parentNode.childNodes),s=this.normalizedMap(i,Node.TEXT_NODE,e)),n=Array.prototype.indexOf.call(i,t),s[n]},n.prototype.stepsToXpath=function(t){var e=[".","*"];return t.forEach(function(t){var i=t.index+1;t.id?e.push("*[position()="+i+" and @id='"+t.id+"']"):"text"===t.type?e.push("text()["+i+"]"):e.push("*["+i+"]")}),e.join("/")},n.prototype.stepsToQuerySelector=function(t){var e=["html"];return t.forEach(function(t){var i=t.index+1;t.id?e.push("#"+t.id):"text"===t.type||e.push("*:nth-child("+i+")")}),e.join(">")},n.prototype.textNodes=function(t,e){return Array.prototype.slice.call(t.childNodes).filter(function(t){return t.nodeType===Node.TEXT_NODE||!(!e||!t.classList.contains(e))})},n.prototype.walkToNode=function(t,e,i){var n,s,o=e||document,r=o.documentElement,h=t.length;for(s=0;so)){h=s.nodeType===Node.ELEMENT_NODE?s.childNodes[0]:s;break}e-=o}}return{container:h,offset:e}},n.prototype.toRange=function(t,e){var i,n,s,o,r,h,a,c=t||document,p=c.createRange(),l=this,u=!!e&&null!=c.querySelector("."+e);if(l.range?(i=l.start,r=l.path.steps.concat(i.steps),s=this.findNode(r,c,u?e:null),n=l.end,h=l.path.steps.concat(n.steps),o=this.findNode(h,c,u?e:null)):(i=l.path,r=l.path.steps,s=this.findNode(l.path.steps,c,u?e:null)),!s)return null;try{null!=i.terminal.offset?p.setStart(s,i.terminal.offset):p.setStart(s,0)}catch(d){a=this.fixMiss(r,i.terminal.offset,c,u?e:null),p.setStart(a.container,a.offset)}if(o)try{null!=n.terminal.offset?p.setEnd(o,n.terminal.offset):p.setEnd(o,0)}catch(d){a=this.fixMiss(h,l.end.terminal.offset,c,u?e:null),p.setEnd(a.container,a.offset)}return p},n.prototype.isCfiString=function(t){return"string"==typeof t&&0===t.indexOf("epubcfi(")&&")"===t[t.length-1]},n.prototype.generateChapterComponent=function(t,e,i){var n=parseInt(e),s=t+1,o="/"+s+"/";return o+=2*(n+1),i&&(o+="["+i+"]"),o},t.exports=n},function(t,e,i){"use strict";(function(e){function i(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+t)}function n(t,e){for(var i,n="",s=-1,o=0,r=0;r<=t.length;++r){if(r2){for(var h=n.length-1,a=h;a>=0&&47!==n.charCodeAt(a);--a);if(a!==h){n=a===-1?"":n.slice(0,a),s=r,o=0;continue}}else if(2===n.length||1===n.length){n="",s=r,o=0;continue}e&&(n.length>0?n+="/..":n="..")}else n.length>0?n+="/"+t.slice(s+1,r):n=t.slice(s+1,r);s=r,o=0}else 46===i&&o!==-1?++o:o=-1}return n}function s(t,e){var i=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return i?i===e.root?i+n:i+t+n:n}var o={resolve:function(){for(var t,s="",o=!1,r=arguments.length-1;r>=-1&&!o;r--){var h;r>=0?h=arguments[r]:(void 0===t&&(t=e.cwd()),h=t),i(h),0!==h.length&&(s=h+"/"+s,o=47===h.charCodeAt(0))}return s=n(s,!o),o?s.length>0?"/"+s:"/":s.length>0?s:"."},normalize:function(t){if(i(t),0===t.length)return".";var e=47===t.charCodeAt(0),s=47===t.charCodeAt(t.length-1);return t=n(t,!e),0!==t.length||e||(t="."),t.length>0&&s&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return i(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e0&&(void 0===t?t=n:t+="/"+n)}return void 0===t?".":o.normalize(t)},relative:function(t,e){if(i(t),i(e),t===e)return"";if(t=o.resolve(t),e=o.resolve(e),t===e)return"";for(var n=1;np){if(47===e.charCodeAt(h+u))return e.slice(h+u+1);if(0===u)return e.slice(h+u)}else r>p&&(47===t.charCodeAt(n+u)?l=u:0===u&&(l=0));break}var d=t.charCodeAt(n+u),f=e.charCodeAt(h+u);if(d!==f)break;47===d&&(l=u)}var g="";for(u=n+l+1;u<=s;++u)u!==s&&47!==t.charCodeAt(u)||(g+=0===g.length?"..":"/..");return g.length>0?g+e.slice(h+l):(h+=l,47===e.charCodeAt(h)&&++h,e.slice(h))},_makeLong:function(t){return t},dirname:function(t){if(i(t),0===t.length)return".";for(var e=t.charCodeAt(0),n=47===e,s=-1,o=!0,r=t.length-1;r>=1;--r)if(e=t.charCodeAt(r),47===e){if(!o){s=r;break}}else o=!1;return s===-1?n?"/":".":n&&1===s?"//":t.slice(0,s)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');i(t);var n,s=0,o=-1,r=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var h=e.length-1,a=-1;for(n=t.length-1;n>=0;--n){var c=t.charCodeAt(n);if(47===c){if(!r){s=n+1;break}}else a===-1&&(r=!1,a=n+1),h>=0&&(c===e.charCodeAt(h)?--h===-1&&(o=n):(h=-1,o=a))}return s===o?o=a:o===-1&&(o=t.length),t.slice(s,o)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!r){s=n+1;break}}else o===-1&&(r=!1,o=n+1);return o===-1?"":t.slice(s,o)},extname:function(t){i(t);for(var e=-1,n=0,s=-1,o=!0,r=0,h=t.length-1;h>=0;--h){var a=t.charCodeAt(h);if(47!==a)s===-1&&(o=!1,s=h+1),46===a?e===-1?e=h:1!==r&&(r=1):e!==-1&&(r=-1);else if(!o){n=h+1;break}}return e===-1||s===-1||0===r||1===r&&e===s-1&&e===n+1?"":t.slice(e,s)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('Parameter "pathObject" must be an object, not '+typeof t);return s("/",t)},parse:function(t){i(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var n,s=t.charCodeAt(0),o=47===s;o?(e.root="/",n=1):n=0;for(var r=-1,h=0,a=-1,c=!0,p=t.length-1,l=0;p>=n;--p)if(s=t.charCodeAt(p),47!==s)a===-1&&(c=!1,a=p+1),46===s?r===-1?r=p:1!==l&&(l=1):r!==-1&&(l=-1);else if(!c){h=p+1;break}return r===-1||a===-1||0===l||1===l&&r===a-1&&r===h+1?a!==-1&&(0===h&&o?e.base=e.name=t.slice(1,a):e.base=e.name=t.slice(h,a)):(0===h&&o?(e.name=t.slice(1,r),e.base=t.slice(1,a)):(e.name=t.slice(h,r),e.base=t.slice(h,a)),e.ext=t.slice(r,a)),h>0?e.dir=t.slice(0,h-1):o&&(e.dir="/"),e},sep:"/",delimiter:":",posix:null};t.exports=o}).call(e,i(4))},function(t,e,i){"use strict";var n,s,o,r,h,a,c,p=i(21),l=i(30),u=Function.prototype.apply,d=Function.prototype.call,f=Object.create,g=Object.defineProperty,m=Object.defineProperties,y=Object.prototype.hasOwnProperty,v={configurable:!0,enumerable:!1,writable:!0};n=function(t,e){var i;return l(e),y.call(this,"__ee__")?i=this.__ee__:(i=v.value=f(null),g(this,"__ee__",v),v.value=null),i[t]?"object"==typeof i[t]?i[t].push(e):i[t]=[i[t],e]:i[t]=e,this},s=function(t,e){var i,s;return l(e),s=this,n.call(this,t,i=function(){o.call(s,t,i),u.call(e,this,arguments)}),i.__eeOnceListener__=e,this},o=function(t,e){var i,n,s,o;if(l(e),!y.call(this,"__ee__"))return this;if(i=this.__ee__,!i[t])return this;if(n=i[t],"object"==typeof n)for(o=0;s=n[o];++o)s!==e&&s.__eeOnceListener__!==e||(2===n.length?i[t]=n[o?0:1]:n.splice(o,1));else n!==e&&n.__eeOnceListener__!==e||delete i[t];return this},r=function(t){var e,i,n,s,o;if(y.call(this,"__ee__")&&(s=this.__ee__[t]))if("object"==typeof s){for(i=arguments.length,o=new Array(i-1),e=1;e1)for(var i=1;i0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}},!1);(i=s.nextNode())&&!(n=e(i)););return n},n.prototype.findRanges=function(t){for(var e,i,n=[],s=t.contents.scrollWidth(),o=this.layout.count(s),r=this.layout.column,h=this.layout.gap,a=0;a=e&&n<=i?t:s>e?t:(r=t,void o.push(t))}))return this.findTextStartRange(s,e,i);return this.findTextStartRange(r,e,i)},n.prototype.findEnd=function(t,e,i){for(var n,s,o=[t],r=t;o.length;)if(n=o.shift(),s=this.walk(n,function(t){var e,n,s,h;return t.nodeType==Node.TEXT_NODE?(h=document.createRange(),h.selectNodeContents(t),s=h.getBoundingClientRect()):s=t.getBoundingClientRect(),e=s.left,n=s.right,e>i&&r?r:n>i?t:(r=t,void o.push(t))}))return this.findTextEndRange(s,e,i);return this.findTextEndRange(r,e,i)},n.prototype.findTextStartRange=function(t,e,i){for(var n,s,o,r=this.splitTextNodeIntoRanges(t),h=0;h=e)return s;n=s}return r[0]},n.prototype.findTextEndRange=function(t,e,i){for(var n,s,o,r=this.splitTextNodeIntoRanges(t),h=0;hi&&n)return n;if(o.right>i)return s;n=s}return r[r.length-1]},n.prototype.splitTextNodeIntoRanges=function(t,e){var i,n=[],s=t.textContent||"",o=s.trim(),r=t.ownerDocument,h=e||" ";if(pos=o.indexOf(h),pos===-1||t.nodeType!=Node.TEXT_NODE)return i=r.createRange(),i.selectNodeContents(t),[i];for(i=r.createRange(),i.setStart(t,0),i.setEnd(t,pos),n.push(i),i=!1;pos!=-1;)pos=o.indexOf(h,pos+1),pos>0&&(i&&(i.setEnd(t,pos),n.push(i)),i=r.createRange(),i.setStart(t,pos+1));return i&&(i.setEnd(t,o.length),n.push(i)),n},n.prototype.rangePairToCfiPair=function(t,e){var i=e.start,n=e.end;return i.collapse(!0),n.collapse(!0),startCfi=new s(i,t).toString(),endCfi=new s(n,t).toString(),{start:startCfi,end:endCfi}},n.prototype.rangeListToCfiList=function(t,e){for(var i,n=[],s=0;s-1&&(id=t.substring(t.indexOf("#")+1),el=this.document.getElementById(id),el&&(i=el.getBoundingClientRect(),n.left=i.left,n.top=i.top)),n},n.prototype.addStylesheet=function(t){return new Promise(function(e,i){var n,s=!1;return this.document?(n=this.document.createElement("link"),n.type="text/css",n.rel="stylesheet",n.href=t,n.onload=n.onreadystatechange=function(){s||this.readyState&&"complete"!=this.readyState||(s=!0,setTimeout(function(){e(!0)},1))},void this.document.head.appendChild(n)):void e(!1)}.bind(this))},n.prototype.addStylesheetRules=function(t){var e,i;if(this.document){e=this.document.createElement("style"),this.document.head.appendChild(e),i=e.sheet;for(var n=0,s=t.length;n0&&(e=t.getRangeAt(0),e.collapsed||(i=new r(e,this.cfiBase).toString(),this.emit("selected",i),this.emit("selectedRange",e)))},n.prototype.range=function(t,e){var i=new r(t);return i.toRange(this.document,e)},n.prototype.map=function(t){var e=new h(t);return e.section()},n.prototype.size=function(t,e){t>=0&&this.width(t),e>=0&&this.height(e),this.css("margin","0"),this.css("boxSizing","border-box")},n.prototype.columns=function(t,e,i,n){var s=o.prefixed("columnAxis"),r=o.prefixed("columnGap"),h=o.prefixed("columnWidth"),a=o.prefixed("columnFill");this.width(t),this.height(e),this.viewport({width:t,height:e,scale:1}),this.css("overflowY","hidden"),this.css("margin","0"),this.css("boxSizing","border-box"),this.css("maxWidth","inherit"),this.css(s,"horizontal"),this.css(a,"auto"),this.css(r,n+"px"),this.css(h,i+"px")},n.prototype.scale=function(t,e,i){var t="scale("+t+")",n="";this.css("transformOrigin","top left"),(e>=0||i>=0)&&(n=" translate("+(e||0)+"px, "+(i||0)+"px )"),this.css("transform",t+n)},n.prototype.fit=function(t,e){var i=this.viewport(),n=t/i.width,s=e/i.height,o=n1&&(e=t.next()))return this.add(e)}.bind(this)).then(function(){this.views.show(),i.resolve()}.bind(this)),n)},n.prototype.afterDisplayed=function(t){this.emit("added",t)},n.prototype.afterResized=function(t){this.emit("resize",t.section)},n.prototype.moveTo=function(t){var e=0,i=0;"vertical"===this.settings.axis?i=t.top:(e=Math.floor(t.left/this.layout.delta)*this.layout.delta,e+this.layout.delta>this.container.scrollWidth&&(e=this.container.scrollWidth-this.layout.delta)),this.scrollTo(e,i)},n.prototype.add=function(t){var e=this.createView(t);return this.views.append(e),e.onDisplayed=this.afterDisplayed.bind(this),e.onResize=this.afterResized.bind(this),e.display(this.request)},n.prototype.append=function(t){var e=this.createView(t);return this.views.append(e),e.display(this.request)},n.prototype.prepend=function(t){var e=this.createView(t);return this.views.prepend(e),e.display(this.request)},n.prototype.next=function(){var t,e;if(this.views.length)return"horizontal"===this.settings.axis?(this.scrollLeft=this.container.scrollLeft,e=this.container.scrollLeft+this.container.offsetWidth+this.layout.delta,e1&&(e=t.next()))return this.append(e)}.bind(this)).then(function(){this.views.show()}.bind(this))):void 0},n.prototype.prev=function(){var t,e;if(this.views.length)return"horizontal"===this.settings.axis?(this.scrollLeft=this.container.scrollLeft,e=this.container.scrollLeft,e>0?this.scrollBy(-this.layout.delta,0):t=this.views.first().section.prev()):t=this.views.first().section.prev(),t?(this.views.clear(),this.prepend(t).then(function(){var e;if(this.layout.name&&this.layout.divisor>1&&(e=t.prev()))return this.prepend(e)}.bind(this)).then(function(){"horizontal"===this.settings.axis&&this.scrollTo(this.container.scrollWidth-this.layout.delta,0),this.views.show()}.bind(this))):void 0},n.prototype.current=function(){var t=this.visible();return t.length?t[t.length-1]:null},n.prototype.currentLocation=function(){return"vertical"===this.settings.axis?this.location=this.scrolledLocation():this.location=this.paginatedLocation(),this.location},n.prototype.scrolledLocation=function(){var t;if(this.views.length)return t=this.views.first(),this.mapping.page(t,t.section.cfiBase)},n.prototype.paginatedLocation=function(){var t,e,i;if(this.views.length)return t=this.views.first(),e=this._bounds.left-t.position().left,i=e+this.layout.spreadWidth,this.mapping.page(t,t.section.cfiBase,e,i)},n.prototype.isVisible=function(t,e,i,n){var s=t.position(),o=n||this.bounds();return"horizontal"===this.settings.axis&&s.right>o.left-e&&s.lefto.top-e&&s.top-1&&(i=t.substring(t.indexOf("#")+1)),n&&(i=t),this.manager.display(e,i).then(function(){this.emit("displayed",e)}.bind(this))):(s.reject(new Error("No Section Found")),r)},n.prototype.afterDisplayed=function(t){this.hooks.content.trigger(t,this),this.emit("rendered",t.section),this.reportLocation()},n.prototype.onResized=function(t){this.location&&this.display(this.location.start),this.emit("resized",{width:t.width,height:t.height})},n.prototype.moveTo=function(t){this.manager.moveTo(t)},n.prototype.next=function(){return this.q.enqueue(this.manager.next.bind(this.manager)).then(this.reportLocation.bind(this))},n.prototype.prev=function(){return this.q.enqueue(this.manager.prev.bind(this.manager)).then(this.reportLocation.bind(this))},n.prototype.determineLayoutProperties=function(t){var e,i=this.settings.layout||t.layout||"reflowable",n=this.settings.spread||t.spread||"auto",s=this.settings.orientation||t.orientation||"auto",o=this.settings.flow||t.flow||"auto",r=t.viewport||"",h=this.settings.minSpreadWidth||t.minSpreadWidth||800;return this.settings.width>=0&&this.settings.height>=0&&(r="width="+this.settings.width+", height="+this.settings.height),e={layout:i,spread:n,orientation:s,flow:o,viewport:r,minSpreadWidth:h}},n.prototype.flow=function(t){var e;"scrolled-doc"!==t&&"scrolled-continuous"!==t||(e="scrolled"),"auto"!==t&&"paginated"!==t||(e="paginated"),this._layout&&this._layout.flow(e),this.manager&&this.manager.updateFlow(e)},n.prototype.layout=function(t){return t&&(this._layout=new p(t),this._layout.spread(t.spread,this.settings.minSpreadWidth),this.mapping=new l(this._layout)),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this._layout},n.prototype.spread=function(t,e){this._layout.spread(t,e),this.manager.isRendered()&&this.manager.updateLayout()},n.prototype.reportLocation=function(){return this.q.enqueue(function(){var t=this.manager.currentLocation();t&&t.then&&"function"==typeof t.then?t.then(function(t){this.location=t,this.percentage=this.book.locations.percentageFromCfi(t),null!=this.percentage&&(this.location.percentage=this.percentage),this.emit("locationChanged",this.location)}.bind(this)):t&&(this.location=t,this.percentage=this.book.locations.percentageFromCfi(t),null!=this.percentage&&(this.location.percentage=this.percentage),this.emit("locationChanged",this.location))}.bind(this))},n.prototype.currentLocation=function(){var t=this.manager.currentLocation();if(t&&t.then&&"function"==typeof t.then)t.then(function(t){var e=this.book.locations.percentageFromCfi(t);return null!=e&&(t.percentage=e),t}.bind(this));else if(t){var e=this.book.locations.percentageFromCfi(t);return null!=e&&(t.percentage=e),t}},n.prototype.destroy=function(){this.q.clear(),this.manager.destroy()},n.prototype.passViewEvents=function(t){t.contents.listenedEvents.forEach(function(e){t.on(e,this.triggerViewEvent.bind(this))}.bind(this)),t.on("selected",this.triggerSelectedEvent.bind(this))},n.prototype.triggerViewEvent=function(t){this.emit(t.type,t)},n.prototype.triggerSelectedEvent=function(t){this.emit("selected",t)},n.prototype.range=function(t,e){var i=new a(t),n=this.visible().filter(function(t){if(i.spinePos===t.index)return!0});if(n.length)return n[0].range(i,e)},n.prototype.adjustImages=function(t){return t.addStylesheetRules([["img",["max-width",t.layout.spreadWidth+"px"],["max-height",t.layout.height+"px"]]]),new Promise(function(t,e){setTimeout(function(){t()},1)})},s(n.prototype),t.exports=n},function(t,i){t.exports=e},,,function(t,e,i){function n(t,e){"undefined"==typeof e&&"object"==typeof t&&(e=t,t=void 0),this.settings=o.extend(this.settings||{},{requestMethod:void 0,requestCredentials:void 0,requestHeaders:void 0,encoding:void 0,replacements:"base64"}),o.extend(this.settings,e),this.opening=new o.defer,this.opened=this.opening.promise,this.isOpen=!1,this.loading={manifest:new o.defer,spine:new o.defer,metadata:new o.defer,cover:new o.defer,navigation:new o.defer,pageList:new o.defer,resources:new o.defer},this.loaded={manifest:this.loading.manifest.promise,spine:this.loading.spine.promise,metadata:this.loading.metadata.promise,cover:this.loading.cover.promise,navigation:this.loading.navigation.promise,pageList:this.loading.pageList.promise,resources:this.loading.resources.promise},this.ready=Promise.all([this.loaded.manifest,this.loaded.spine,this.loaded.metadata,this.loaded.cover,this.loaded.navigation,this.loaded.resources]),this.isRendered=!1,this.request=this.settings.requestMethod||y,this.spine=new a,this.locations=new c(this.spine,this.load.bind(this)),this.navigation=void 0,this.pageList=new f,this.url=void 0,this.path=void 0,this.archived=!1,t&&this.open(t)["catch"](function(e){var i=new Error("Cannot load book at "+t);console.error(i),this.emit("openFailed",i),console.log(e)}.bind(this))}var s=i(3),o=(i(2),i(0)),r=i(0).Url,h=i(0).Path,a=i(47),c=i(39),p=i(37),l=i(43),u=i(42),d=i(45),f=i(44),g=i(12),m=i(36),y=i(9),v=i(1),w="META-INF/container.xml";n.prototype.open=function(t,e){var i,n=e||this.determineType(t);return"binary"===n?(this.archived=!0,this.url=new r("/",""),i=this.openEpub(t)):"epub"===n?(this.archived=!0,this.url=new r("/",""),i=this.request(t,"binary").then(this.openEpub.bind(this))):"opf"==n?(this.url=new r(t),i=this.openPackaging(this.url.Path.toString())):(this.url=new r(t),i=this.openContainer(w).then(this.openPackaging.bind(this))),i},n.prototype.openEpub=function(t,e){return this.unarchive(t,e||this.settings.encoding).then(function(){return this.openContainer(w)}.bind(this)).then(function(t){return this.openPackaging(t)}.bind(this))},n.prototype.openContainer=function(t){return this.load(t).then(function(t){return this.container=new p(t),this.resolve(this.container.packagePath)}.bind(this))},n.prototype.openPackaging=function(t){return this.path=new h(t),this.load(t).then(function(t){return this.packaging=new l(t),this.unpack(this.packaging)}.bind(this))},n.prototype.load=function(t){var e;return this.archived?(e=this.resolve(t),this.archive.request(e)):(e=this.resolve(t),this.request(e,null,this.settings.requestCredentials,this.settings.requestHeaders))},n.prototype.resolve=function(t,e){var i=t,n=t.indexOf("://")>-1;return n?t:(this.path&&(i=this.path.resolve(t)),0!=e&&this.url&&(i=this.url.resolve(i)),i)},n.prototype.determineType=function(t){var e,i,n;return"string"!=typeof t?"binary":(e=new r(t),i=e.path(),n=i.extension,n?"epub"===n?"epub":"opf"===n?"opf":void 0:"directory")},n.prototype.unpack=function(t){this["package"]=t,this.spine.unpack(this["package"],this.resolve.bind(this)),this.resources=new d(this["package"].manifest,{archive:this.archive,resolver:this.resolve.bind(this),replacements:this.settings.replacements}),this.loadNavigation(this["package"]).then(function(t){this.toc=t,this.loading.navigation.resolve(this.toc)}.bind(this)),this.cover=this.resolve(this["package"].coverPath),this.loading.manifest.resolve(this["package"].manifest),this.loading.metadata.resolve(this["package"].metadata),this.loading.spine.resolve(this.spine),this.loading.cover.resolve(this.cover),this.loading.resources.resolve(this.resources),this.loading.pageList.resolve(this.pageList),this.isOpen=!0,this.archived?this.replacements().then(function(){this.opening.resolve(this)}.bind(this)):this.opening.resolve(this)},n.prototype.loadNavigation=function(t){var e=t.navPath||t.ncxPath;if(e)return this.load(e,"xml").then(function(t){this.navigation=new u(t),this.pageList=new f(t)}.bind(this))},n.prototype.section=function(t){return this.spine.get(t)},n.prototype.renderTo=function(t,e){return this.rendition=new g(this,e),this.rendition.attachTo(t),this.rendition},n.prototype.setRequestCredentials=function(t){this.settings.requestCredentials=t},n.prototype.setRequestHeaders=function(t){this.settings.requestHeaders=t},n.prototype.unarchive=function(t,e){return this.archive=new m,this.archive.open(t,e)},n.prototype.coverUrl=function(){var t=this.loaded.cover.then(function(t){return this.archived?this.resources.get(this.cover):this.cover}.bind(this));return t},n.prototype.replacements=function(){return this.spine.hooks.serialize.register(function(t,e){e.output=this.resources.substitute(t,e.url)}.bind(this)),this.resources.replacements().then(function(){return this.resources.replaceCss()}.bind(this))},n.prototype.range=function(t){var e=new v(t),i=this.spine.get(e.spinePos);return i.load().then(function(t){var n=e.toRange(i.document);return n})},n.prototype.key=function(t){var e=t||this["package"].metadata.identifier||this.url.filename;return"epubjs:"+ePub.VERSION+":"+e},s(n.prototype),t.exports=n},function(t,e,i){function n(t){o.apply(this,arguments),this.name="continuous",this.settings=s.extend(this.settings||{},{infinite:!0,overflow:"auto",axis:"vertical",offset:500,offsetDelta:250,width:void 0,height:void 0}),s.extend(this.settings,t.settings||{}),"undefined"!=t.settings.gap&&0===t.settings.gap&&(this.settings.gap=t.settings.gap),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,layout:this.layout,width:0,height:0},this.scrollTop=0,this.scrollLeft=0}var s=i(0),o=i(11);n.prototype=Object.create(o.prototype),n.prototype.constructor=n,n.prototype.display=function(t,e){return o.prototype.display.call(this,t,e).then(function(){return this.fill()}.bind(this))},n.prototype.fill=function(t){var e=t||new s.defer;return this.check().then(function(t){t?this.fill(e):e.resolve()}.bind(this)),e.promise},n.prototype.moveTo=function(t){var e=0,i=0,n=0,s=0;return"vertical"===this.settings.axis?(i=t.top,s=t.top+this.settings.offset):(e=Math.floor(t.left/this.layout.delta)*this.layout.delta,n=e+this.settings.offset),this.check(n,s).then(function(){this.scrollBy(e,i)}.bind(this))},n.prototype.resize=function(t,e){this.q.clear(),this._stageSize=this.stage.size(t,e),this._bounds=this.bounds(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.views.each(function(t){t.size(this._stageSize.width,this._stageSize.height)}.bind(this)),this.updateLayout(),this.emit("resized",{width:this.stage.width,height:this.stage.height})},n.prototype.onResized=function(t){clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(function(){this.resize()}.bind(this),150)},n.prototype.afterResized=function(t){this.emit("resize",t.section)},n.prototype.removeShownListeners=function(t){t.onDisplayed=function(){}},n.prototype.append=function(t){var e=this.createView(t);return this.views.append(e),e},n.prototype.prepend=function(t){var e=this.createView(t);return e.on("resized",this.counter.bind(this)),this.views.prepend(e),e},n.prototype.counter=function(t){"vertical"===this.settings.axis?this.scrollBy(0,t.heightDelta,!0):this.scrollBy(t.widthDelta,0,!0)},n.prototype.update=function(t){for(var e,i,n=this.bounds(),o=this.views.all(),r=o.length,h=[],a="undefined"!=typeof t?t:this.settings.offset||0,c=new s.defer,p=[],l=0;l=f&&(i=this.views.last(),o=i&&i.section.next(),o&&a.push(this.append(o))),u-p<0&&(n=this.views.first(),r=n&&n.section.prev(),r&&a.push(this.prepend(r))),a.length?this.q.enqueue(function(){return this.update(p)}.bind(this)):(h.resolve(!1),h.promise)},n.prototype.trim=function(){for(var t=new s.defer,e=this.views.displayed(),i=e[0],n=e[e.length-1],o=this.views.indexOf(i),r=this.views.indexOf(n),h=this.views.slice(0,o),a=this.views.slice(r+1),c=0;cthis.settings.offsetDelta||this.scrollDeltaHorz>this.settings.offsetDelta)&&(this.q.enqueue(function(){this.check()}.bind(this)),this.scrollDeltaVert=0,this.scrollDeltaHorz=0,this.emit("scroll",{top:scrollTop,left:scrollLeft}),clearTimeout(this.afterScrolled),this.afterScrolled=setTimeout(function(){this.emit("scrolled",{top:this.scrollTop,left:this.scrollLeft})}.bind(this))),this.scrollDeltaVert+=Math.abs(scrollTop-this.prevScrollTop),this.scrollDeltaHorz+=Math.abs(scrollLeft-this.prevScrollLeft),this.prevScrollTop=scrollTop,this.prevScrollLeft=scrollLeft,clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(function(){this.scrollDeltaVert=0,this.scrollDeltaHorz=0}.bind(this),150),this.scrolled=!1},n.prototype.currentLocation=function(){return"vertical"===this.settings.axis?this.location=this.scrolledLocation():this.location=this.paginatedLocation(), +this.location},n.prototype.scrolledLocation=function(){var t,e,i=this.visible();this.container.getBoundingClientRect();return 1===i.length?this.mapping.page(i[0].contents,i[0].section.cfiBase):i.length>1?(t=this.mapping.page(i[0].contents,i[0].section.cfiBase),e=this.mapping.page(i[i.length-1].contents,i[i.length-1].section.cfiBase),{start:t.start,end:e.end}):void 0},n.prototype.paginatedLocation=function(){var t,e,i,n,s,o,r=this.visible(),h=this.container.getBoundingClientRect();return 1===r.length?(t=h.left-r[0].position().left,i=t+this.layout.spreadWidth,this.mapping.page(r[0].contents,r[0].section.cfiBase,t,i)):r.length>1?(t=h.left-r[0].position().left,i=t+this.layout.columnWidth,e=h.left+this.layout.spreadWidth-r[r.length-1].position().left,n=e+this.layout.columnWidth,s=this.mapping.page(r[0].contents,r[0].section.cfiBase,t,i),o=this.mapping.page(r[r.length-1].contents,r[r.length-1].section.cfiBase,e,n),{start:s.start,end:o.end}):void 0},n.prototype.updateLayout=function(){this.stage&&("vertical"===this.settings.axis?this.layout.calculate(this._stageSize.width,this._stageSize.height):(this.layout.calculate(this._stageSize.width,this._stageSize.height,this.settings.gap),this.settings.offset=this.layout.delta,this.stage.addStyleRules("iframe",[{"margin-right":this.layout.gap+"px"}])),this.viewSettings.width=this.layout.width,this.viewSettings.height=this.layout.height,this.setLayout(this.layout))},n.prototype.next=function(){"horizontal"===this.settings.axis?(this.scrollLeft=this.container.scrollLeft,this.container.scrollLeft+this.container.offsetWidth+this.layout.delta1&&"reflowable"===this.settings.layout.name&&e%2>0&&(s+=this.settings.layout.gap+this.settings.layout.columnWidth),this._textWidth=i,this._contentWidth=s):s=this._contentWidth):"vertical"===this.settings.axis&&(n=this.contents.textHeight(),n!=this._textHeight?(o=this.contentHeight(n),this._textHeight=n,this._contentHeight=o):o=this._contentHeight),(this._needsReframe||s!=this._width||o!=this._height)&&this.resize(s,o),this._expanding=!1)},n.prototype.contentWidth=function(t){var e,i;return e=this.iframe.style.width,this.iframe.style.width=(t||0)+"px",i=this.contents.scrollWidth(),this.iframe.style.width=e,i},n.prototype.contentHeight=function(t){var e,i;return e=this.iframe.style.height,this.iframe.style.height=(t||0)+"px",i=this.contents.scrollHeight(),this.iframe.style.height=e,i},n.prototype.resize=function(t,e){this.iframe&&(o.isNumber(t)&&(this.iframe.style.width=t+"px",this._width=t),o.isNumber(e)&&(this.iframe.style.height=e+"px",this._height=e),this.iframeBounds=o.bounds(this.iframe),this.reframe(this.iframeBounds.width,this.iframeBounds.height))},n.prototype.reframe=function(t,e){var i;o.isNumber(t)&&(this.element.style.width=t+"px"),o.isNumber(e)&&(this.element.style.height=e+"px"),this.prevBounds=this.elementBounds,this.elementBounds=o.bounds(this.element),i={width:this.elementBounds.width,height:this.elementBounds.height,widthDelta:this.elementBounds.width-this.prevBounds.width,heightDelta:this.elementBounds.height-this.prevBounds.height},this.onResize(this,i),this.emit("resized",i)},n.prototype.load=function(t){var e=new o.defer,i=e.promise;if(!this.iframe)return e.reject(new Error("No Iframe Available")),i;if(this.iframe.onload=function(t){this.onLoad(t,e)}.bind(this),this.supportsSrcdoc)this.iframe.srcdoc=t;else{if(this.document=this.iframe.contentDocument,!this.document)return e.reject(new Error("No Document Available")),i;this.iframe.contentDocument.open(),this.iframe.contentDocument.write(t),this.iframe.contentDocument.close()}return i},n.prototype.onLoad=function(t,e){this.window=this.iframe.contentWindow,this.document=this.iframe.contentDocument,this.contents=new h(this.document,this.document.body,this.section.cfiBase),this.rendering=!1;var i=this.document.querySelector("link[rel='canonical']");i?i.setAttribute("href",this.section.url):(i=this.document.createElement("link"),i.setAttribute("rel","canonical"),i.setAttribute("href",this.section.url),this.document.querySelector("head").appendChild(i)),this.contents.on("expand",function(){this.displayed&&this.iframe&&this.expand()}),e.resolve(this.contents)},n.prototype.setLayout=function(t){this.layout=t},n.prototype.setAxis=function(t){this.settings.axis=t},n.prototype.resizeListenters=function(){clearTimeout(this.expanding),this.expanding=setTimeout(this.expand.bind(this),350)},n.prototype.addListeners=function(){},n.prototype.removeListeners=function(t){},n.prototype.display=function(t){var e=new o.defer;return this.displayed?e.resolve(this):this.render(t).then(function(){this.emit("displayed",this),this.onDisplayed(this),this.displayed=!0,e.resolve(this)}.bind(this)),e.promise},n.prototype.show=function(){this.element.style.visibility="visible",this.iframe&&(this.iframe.style.visibility="visible"),this.emit("shown",this)},n.prototype.hide=function(){this.element.style.visibility="hidden",this.iframe.style.visibility="hidden",this.stopExpanding=!0,this.emit("hidden",this)},n.prototype.position=function(){return this.element.getBoundingClientRect()},n.prototype.locationOf=function(t){var e=this.iframe.getBoundingClientRect(),i=this.contents.locationOf(t,this.settings.ignoreClass);return{left:window.scrollX+e.left+i.left,top:window.scrollY+e.top+i.top}},n.prototype.onDisplayed=function(t){},n.prototype.onResize=function(t,e){},n.prototype.bounds=function(){return this.elementBounds||(this.elementBounds=o.bounds(this.element)),this.elementBounds},n.prototype.destroy=function(){this.displayed&&(this.displayed=!1,this.removeListeners(),this.stopExpanding=!0,this.element.removeChild(this.iframe),this.displayed=!1,this.iframe=null,this._textWidth=null,this._textHeight=null,this._width=null,this._height=null)},s(n.prototype),t.exports=n},function(t,e){function i(t){return t&&s[t.split(".").pop().toLowerCase()]||o}var n={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"}},s=function(){var t,e,i,s,o={};for(t in n)if(n.hasOwnProperty(t))for(e in n[t])if(n[t].hasOwnProperty(e))if(i=n[t][e],"string"==typeof i)o[i]=t+"/"+e;else for(s=0;s0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function n(t){return 3*t.length/4-i(t)}function s(t){var e,n,s,o,r,h,a=t.length;r=i(t),h=new p(3*a/4-r),s=r>0?a-4:a;var l=0;for(e=0,n=0;e>16&255,h[l++]=o>>8&255,h[l++]=255&o;return 2===r?(o=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,h[l++]=255&o):1===r&&(o=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,h[l++]=o>>8&255,h[l++]=255&o),h}function o(t){return a[t>>18&63]+a[t>>12&63]+a[t>>6&63]+a[63&t]}function r(t,e,i){for(var n,s=[],r=e;rp?p:c+h));return 1===n?(e=t[i-1],s+=a[e>>2],s+=a[e<<4&63],s+="=="):2===n&&(e=(t[i-2]<<8)+t[i-1],s+=a[e>>10],s+=a[e>>4&63],s+=a[e<<2&63],s+="="),o.push(s),o.join("")}e.byteLength=n,e.toByteArray=s,e.fromByteArray=h;for(var a=[],c=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,d=l.length;u-1}},,function(t,e,i){function n(){this.zip=void 0,this.checkRequirements(),this.urlCache={}}var s=i(0),o=i(9),r=i(19),h=i(0).Path;n.prototype.checkRequirements=function(){try{"undefined"==typeof JSZip&&(JSZip=i(48)),this.zip=new JSZip}catch(t){console.error("JSZip lib not loaded")}},n.prototype.open=function(t,e){return this.zip.loadAsync(t,{base64:e})},n.prototype.openUrl=function(t,e){return o(t,"binary").then(function(t){return this.zip.loadAsync(t,{base64:e})}.bind(this))},n.prototype.request=function(t,e){var i,n=new s.defer,o=new h(t);return e||(e=o.extension),i="blob"==e?this.getBlob(t):this.getText(t),i?i.then(function(t){result=this.handleResponse(t,e),n.resolve(result)}.bind(this)):n.reject({message:"File not found in the epub: "+t,stack:(new Error).stack}),n.promise},n.prototype.handleResponse=function(t,e){var i;return i="json"==e?JSON.parse(t):s.isXml(e)?s.parse(t,"text/xml"):"xhtml"==e?s.parse(t,"application/xhtml+xml"):"html"==e||"htm"==e?s.parse(t,"text/html"):t},n.prototype.getBlob=function(t,e){var i=window.decodeURIComponent(t.substr(1)),n=this.zip.file(i);if(n)return e=e||r.lookup(n.name),n.async("uint8array").then(function(t){return new Blob([t],{type:e})})},n.prototype.getText=function(t,e){var i=window.decodeURIComponent(t.substr(1)),n=this.zip.file(i);if(n)return n.async("string").then(function(t){return t})},n.prototype.getBase64=function(t,e){var i=window.decodeURIComponent(t.substr(1)),n=this.zip.file(i);if(n)return e=e||r.lookup(n.name),n.async("base64").then(function(t){return"data:"+e+";base64,"+t})},n.prototype.createUrl=function(t,e){var i,n,o=new s.defer,r=window.URL||window.webkitURL||window.mozURL,h=e&&e.base64;return t in this.urlCache?(o.resolve(this.urlCache[t]),o.promise):(h?(n=this.getBase64(t),n&&n.then(function(e){this.urlCache[t]=e,o.resolve(e)}.bind(this))):(n=this.getBlob(t),n&&n.then(function(e){i=r.createObjectURL(e),this.urlCache[t]=i,o.resolve(i)}.bind(this))),n||o.reject({message:"File not found in the epub: "+t,stack:(new Error).stack}),o.promise)},n.prototype.revokeUrl=function(t){var e=window.URL||window.webkitURL||window.mozURL,i=this.urlCache[t];i&&e.revokeObjectURL(i)},t.exports=n},function(t,e,i){function n(t){t&&this.parse(t)}var s=i(2),o=i(0);i(1);n.prototype.parse=function(t){var e;return t?(e=o.qs(t,"rootfile"))?(this.packagePath=e.getAttribute("full-path"),this.directory=s.dirname(this.packagePath),void(this.encoding=t.xmlEncoding)):void console.error("No RootFile Found"):void console.error("Container File Not Found")},t.exports=n},function(t,e,i){function n(t){this.name=t.layout||"reflowable",this._spread="none"!==t.spread,this._minSpreadWidth=t.minSpreadWidth||800,this._evenSpreads=t.evenSpreads||!1,"scrolled-continuous"===t.flow||"scrolled-doc"===t.flow?this._flow="scrolled":this._flow="paginated",this.width=0,this.height=0,this.spreadWidth=0,this.delta=0,this.columnWidth=0,this.gap=0,this.divisor=1}i(0);n.prototype.flow=function(t){this._flow="paginated"===t?"paginated":"scrolled"},n.prototype.spread=function(t,e){this._spread="none"!==t,e>=0&&(this._minSpreadWidth=e)},n.prototype.calculate=function(t,e,i){var n,s,o,r=1,h=i||0,a=(Math.floor(t),t),c=Math.floor(a/8);r=this._spread&&a>=this._minSpreadWidth?2:1,"reflowable"!==this.name||"paginated"!==this._flow||i>=0||(h=c%2===0?c:c-1),"pre-paginated"===this.name&&(h=0),n=r>1?Math.floor((a-h)/r):a,"pre-paginated"===this.name&&r>1&&(a=n),s=n*r,o=(n+h)*r,this.width=a,this.height=e,this.spreadWidth=s,this.delta=o,this.columnWidth=n,this.gap=h,this.divisor=r},n.prototype.format=function(t){var e;return e="pre-paginated"===this.name?t.fit(this.columnWidth,this.height):"paginated"===this._flow?t.columns(this.width,this.height,this.columnWidth,this.gap):t.size(this.width,null)},n.prototype.count=function(t){var e=Math.ceil(t/this.spreadWidth);return{spreads:e,pages:e*this.divisor}},t.exports=n},function(t,e,i){function n(t,e){this.spine=t,this.request=e,this.q=new o(this),this.epubcfi=new r,this._locations=[],this.total=0,this["break"]=150,this._current=0}var s=i(0),o=i(7),r=i(1),h=i(3);n.prototype.generate=function(t){return t&&(this["break"]=t),this.q.pause(),this.spine.each(function(t){this.q.enqueue(this.process,t)}.bind(this)),this.q.run().then(function(){return this.total=this._locations.length-1,this._currentCfi&&(this.currentLocation=this._currentCfi),this._locations}.bind(this))},n.prototype.process=function(t){return t.load(this.request).then(function(e){var i,n=e.ownerDocument,o=s.qs(n,"body"),r=0;this.sprint(o,function(e){var s,o=e.length,h=0;for(0==r&&(i=n.createRange(),i.setStart(e,0)),s=this["break"]-r,s>o&&(r+=o,h=o);h=o?r=o-(h-this["break"]):(i.setEnd(e,h),cfi=t.cfiFromRange(i),this._locations.push(cfi),r=0,h+=1,i=n.createRange(),i.setStart(e,h))}.bind(this)),i&&(i.setEnd(prev,prev.length),cfi=t.cfiFromRange(i),this._locations.push(cfi),r=0)}.bind(this))},n.prototype.sprint=function(t,e){for(var i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,null,!1);node=i.nextNode();)e(node)},n.prototype.locationFromCfi=function(t){return 0===this._locations.length?-1:s.locationOf(t.start,this._locations,this.epubcfi.compare)},n.prototype.percentageFromCfi=function(t){if(0===this._locations.length)return null;var e=this.locationFromCfi(t);return this.percentageFromLocation(e)},n.prototype.percentageFromLocation=function(t){return t&&this.total?t/this.total:0},n.prototype.cfiFromLocation=function(t){var e=-1;return"number"!=typeof t&&(t=parseInt(pg)),t>=0&&t1?t/100:t,i=Math.ceil(this.total*e);return this.cfiFromLocation(i)},n.prototype.load=function(t){return this._locations=JSON.parse(t),this.total=this._locations.length-1,this._locations},n.prototype.save=function(t){return JSON.stringify(this._locations)},n.prototype.getCurrent=function(t){return this._current},n.prototype.setCurrent=function(t){var e;if("string"==typeof t)this._currentCfi=t;else{if("number"!=typeof t)return;this._current=t}0!==this._locations.length&&("string"==typeof t?(e=this.locationFromCfi(t),this._current=e):e=t,this.emit("changed",{percentage:this.percentageFromLocation(e)}))},Object.defineProperty(n.prototype,"currentLocation",{get:function(){return this._current},set:function(t){this.setCurrent(t)}}),h(n.prototype),t.exports=n},function(t,e,i){function n(t){this.settings=t||{},this.id="epubjs-container-"+s.uuid(),this.container=this.create(this.settings),this.settings.hidden&&(this.wrapper=this.wrap(this.container))}var s=i(0);n.prototype.create=function(t){var e=t.height,i=t.width,n=t.overflow||!1,o=t.axis||"vertical";return t.height&&s.isNumber(t.height)&&(e=t.height+"px"),t.width&&s.isNumber(t.width)&&(i=t.width+"px"),container=document.createElement("div"),container.id=this.id,container.classList.add("epub-container"),container.style.wordSpacing="0",container.style.lineHeight="0",container.style.verticalAlign="top","horizontal"===o&&(container.style.whiteSpace="nowrap"),i&&(container.style.width=i),e&&(container.style.height=e),n&&(container.style.overflow=n),container},n.wrap=function(t){var e=document.createElement("div");return e.style.visibility="hidden",e.style.overflow="hidden",e.style.width="0",e.style.height="0",e.appendChild(t),e},n.prototype.getElement=function(t){var e;return s.isElement(t)?e=t:"string"==typeof t&&(e=document.getElementById(t)),e?e:void console.error("Not an Element")},n.prototype.attachTo=function(t){var e,i=this.getElement(t);if(i)return e=this.settings.hidden?this.wrapper:this.container,i.appendChild(e),this.element=i,i},n.prototype.getContainer=function(){return this.container},n.prototype.onResize=function(t){s.isNumber(this.settings.width)&&s.isNumber(this.settings.height)||window.addEventListener("resize",t,!1)},n.prototype.size=function(t,e){var i;return null===t&&(i=this.element.getBoundingClientRect(),i.width&&(t=i.width,this.container.style.width=i.width+"px")),null===e&&(i=i||this.element.getBoundingClientRect(),i.height&&(e=i.height,this.container.style.height=i.height+"px")),s.isNumber(t)||(i=this.container.getBoundingClientRect(),t=i.width),s.isNumber(e)||(i=i||this.container.getBoundingClientRect(),e=i.height),this.containerStyles=window.getComputedStyle(this.container),this.containerPadding={left:parseFloat(this.containerStyles["padding-left"])||0,right:parseFloat(this.containerStyles["padding-right"])||0,top:parseFloat(this.containerStyles["padding-top"])||0,bottom:parseFloat(this.containerStyles["padding-bottom"])||0},{width:t-this.containerPadding.left-this.containerPadding.right,height:e-this.containerPadding.top-this.containerPadding.bottom}},n.prototype.bounds=function(){return this.container?this.container.getBoundingClientRect():s.windowBounds()},n.prototype.getSheet=function(){var t=document.createElement("style");return t.appendChild(document.createTextNode("")),document.head.appendChild(t),t.sheet},n.prototype.addStyleRules=function(t,e){var i="#"+this.id+" ",n="";this.sheet||(this.sheet=this.getSheet()),e.forEach(function(t){for(var e in t)t.hasOwnProperty(e)&&(n+=e+":"+t[e]+";")}),this.sheet.insertRule(i+t+" {"+n+"}",0)},t.exports=n},function(t,e){function i(t){this.container=t,this._views=[],this.length=0,this.hidden=!1}i.prototype.all=function(){return this._views},i.prototype.first=function(){return this._views[0]},i.prototype.last=function(){return this._views[this._views.length-1]},i.prototype.indexOf=function(t){return this._views.indexOf(t)},i.prototype.slice=function(){return this._views.slice.apply(this._views,arguments)},i.prototype.get=function(t){return this._views[t]},i.prototype.append=function(t){return this._views.push(t),this.container&&this.container.appendChild(t.element),this.length++,t},i.prototype.prepend=function(t){return this._views.unshift(t),this.container&&this.container.insertBefore(t.element,this.container.firstChild),this.length++,t},i.prototype.insert=function(t,e){return this._views.splice(e,0,t),this.container&&(e-1&&this._views.splice(e,1),this.destroy(t),this.length--},i.prototype.destroy=function(t){t.displayed&&t.destroy(),this.container&&this.container.removeChild(t.element),t=null},i.prototype.each=function(){return this._views.forEach.apply(this._views,arguments)},i.prototype.clear=function(){var t,e=this.length;if(this.length){for(var i=0;i1&&e[1],{cfi:n,href:r,packageUrl:i,page:a}):{href:r,page:a}},n.prototype.process=function(t){t.forEach(function(t){this.pages.push(t.page),t.cfi&&this.locations.push(t.cfi)},this),this.firstPage=parseInt(this.pages[0]),this.lastPage=parseInt(this.pages[this.pages.length-1]),this.totalPages=this.lastPage-this.firstPage},n.prototype.addCFIs=function(){this.pageList.forEach(function(t){!t.cfi})},n.prototype.pageFromCfi=function(t){var e=-1;if(0===this.locations.length)return-1;var i=o.indexOfSorted(t,this.locations,this.epubcfi.compare);return i!=-1?e=this.pages[i]:(i=EPUBJS.core.locationOf(t,this.locations,this.epubcfi.compare),e=i-1>=0?this.pages[i-1]:this.pages[0],void 0!==e||(e=-1)),e},n.prototype.cfiFromPage=function(t){var e=-1;"number"!=typeof t&&(t=parseInt(t));var i=this.pages.indexOf(t);return i!=-1&&(e=this.locations[i]),e},n.prototype.pageFromPercentage=function(t){var e=Math.round(this.totalPages*t);return e},n.prototype.percentageFromPage=function(t){var e=(t-this.firstPage)/this.totalPages;return Math.round(1e3*e)/1e3},n.prototype.percentageFromCfi=function(t){var e=this.pageFromCfi(t),i=this.percentageFromPage(e);return i},t.exports=n},function(t,e,i){function n(t,e){this.settings={replacements:e&&e.replacements||"base64",archive:e&&e.archive,resolver:e&&e.resolver},this.manifest=t,this.resources=Object.keys(t).map(function(e){return t[e]}),this.replacementUrls=[],this.split(),this.splitUrls()}var s=i(8),o=i(0),r=i(0).Path,h=i(2);n.prototype.split=function(){this.html=this.resources.filter(function(t){if("application/xhtml+xml"===t.type||"text/html"===t.type)return!0}),this.assets=this.resources.filter(function(t){if("application/xhtml+xml"!==t.type&&"text/html"!==t.type)return!0}),this.css=this.resources.filter(function(t){if("text/css"===t.type)return!0})},n.prototype.splitUrls=function(){this.urls=this.assets.map(function(t){return t.href}.bind(this)),this.cssUrls=this.css.map(function(t){return t.href})},n.prototype.replacements=function(t,e){if(t=t||this.settings.archive,e=e||this.settings.resolver,"none"===this.settings.replacements)return new Promise(function(t,e){t(this.urls)}.bind(this));var i=this.urls.map(function(i){var n=e(i);return t.createUrl(n,{base64:"base64"===this.settings.replacements})}.bind(this));return Promise.all(i).then(function(t){return this.replacementUrls=t,t}.bind(this))},n.prototype.replaceCss=function(t,e){var i=[];return t=t||this.settings.archive,e=e||this.settings.resolver,this.cssUrls.forEach(function(n){var s=this.createCssFile(n,t,e).then(function(t){var e=this.urls.indexOf(n);e>-1&&(this.replacementUrls[e]=t)}.bind(this));i.push(s)}.bind(this)),Promise.all(i)},n.prototype.createCssFile=function(t,e,i){var n;if(e=e||this.settings.archive,i=i||this.settings.resolver,h.isAbsolute(t))return new Promise(function(t,e){t(urls,replacementUrls)});var a=i(t),c=e.getText(a),p=this.urls.map(function(t){var e=i(t),n=new r(a).relative(e);return n}.bind(this));return c.then(function(t){return t=s.substitute(t,p,this.replacementUrls),n="base64"===this.settings.replacements?o.createBase64Url(t,"text/css"):o.createBlobUrl(t,"text/css")}.bind(this))},n.prototype.relativeTo=function(t,e){return e=e||this.settings.resolver,this.urls.map(function(i){var n=e(i),s=new r(t).relative(n);return s}.bind(this))},n.prototype.get=function(t){var e=this.urls.indexOf(t);if(e!==-1)return this.replacementUrls.length?new Promise(function(t,i){t(this.replacementUrls[e])}.bind(this)):archive.createUrl(absolute,{base64:"base64"===this.settings.replacements})},t.exports=n},function(t,e,i){function n(t,e){this.idref=t.idref,this.linear=t.linear,this.properties=t.properties,this.index=t.index,this.href=t.href,this.url=t.url,this.next=t.next,this.prev=t.prev,this.cfiBase=t.cfiBase,e?this.hooks=e:(this.hooks={},this.hooks.serialize=new r(this),this.hooks.content=new r(this))}var s=i(0),o=i(1),r=i(5),h=i(0).Url;n.prototype.load=function(t){var e=t||this.request||i(9),n=new s.defer,o=n.promise;return this.contents?n.resolve(this.contents):e(this.url).then(function(t){new h(this.url).directory;return this.document=t,this.contents=t.documentElement,this.hooks.content.trigger(this.document,this)}.bind(this)).then(function(){n.resolve(this.contents)}.bind(this))["catch"](function(t){n.reject(t)}),o},n.prototype.base=function(t){var e,i=new s.defer,n=t.createElement("base");return n.setAttribute("href",window.location.origin+"/"+this.url),t&&(e=t.querySelector("head")),e?(e.insertBefore(n,e.firstChild),i.resolve()):i.reject(new Error("No head to insert into")),i.promise},n.prototype.render=function(t){var e=new s.defer,n=e.promise;return this.output,this.load(t).then(function(t){var e;return"undefined"==typeof XMLSerializer&&(XMLSerializer=i(13).XMLSerializer),e=new XMLSerializer,this.output=e.serializeToString(t),this.output}.bind(this)).then(function(){return this.hooks.serialize.trigger(this.output,this)}.bind(this)).then(function(){e.resolve(this.output)}.bind(this))["catch"](function(t){e.reject(t)}),n},n.prototype.find=function(t){},n.prototype.reconcileLayoutSettings=function(t){var e={layout:t.layout,spread:t.spread,orientation:t.orientation};return this.properties.forEach(function(t){var i,n,s=t.replace("rendition:",""),o=s.indexOf("-");o!=-1&&(i=s.slice(0,o),n=s.slice(o+1),e[i]=n)}),e},n.prototype.cfiFromRange=function(t){return new o(t,this.cfiBase).toString()},n.prototype.cfiFromElement=function(t){return new o(t,this.cfiBase).toString()},t.exports=n},function(t,e,i){function n(){this.spineItems=[],this.spineByHref={},this.spineById={},this.hooks={},this.hooks.serialize=new o,this.hooks.content=new o,this.hooks.content.register(h.base),this.hooks.content.register(h.canonical),this.epubcfi=new s,this.loaded=!1}var s=(i(0),i(1)),o=i(5),r=i(46),h=i(8);n.prototype.unpack=function(t,e){this.items=t.spine,this.manifest=t.manifest,this.spineNodeIndex=t.spineNodeIndex,this.baseUrl=t.baseUrl||t.basePath||"",this.length=this.items.length,this.items.forEach(function(t,i){var n,s=this.manifest[t.idref];t.cfiBase=this.epubcfi.generateChapterComponent(this.spineNodeIndex,t.index,t.idref),s&&(t.href=s.href,t.url=e(t.href,!0),s.properties.length&&t.properties.push.apply(t.properties,s.properties)),t.prev=function(){return this.get(i-1)}.bind(this),t.next=function(){return this.get(i+1)}.bind(this),n=new r(t,this.hooks),this.append(n)}.bind(this)),this.loaded=!0},n.prototype.get=function(t){var e=0;return this.epubcfi.isCfiString(t)?(cfi=new s(t),e=cfi.spinePos):!t||"number"!=typeof t&&isNaN(t)!==!1?t&&0===t.indexOf("#")?e=this.spineById[t.substring(1)]:t&&(t=t.split("#")[0],e=this.spineByHref[t]):e=t,this.spineItems[e]||null},n.prototype.append=function(t){var e=this.spineItems.length;return t.index=e,this.spineItems.push(t),this.spineByHref[t.href]=e,this.spineById[t.idref]=e,e},n.prototype.prepend=function(t){this.spineItems.unshift(t);return this.spineByHref[t.href]=0,this.spineById[t.idref]=0,this.spineItems.forEach(function(t,e){t.index=e}),0},n.prototype.remove=function(t){var e=this.spineItems.indexOf(t);if(e>-1)return delete this.spineByHref[t.href],delete this.spineById[t.idref],this.spineItems.splice(e,1)},n.prototype.each=function(){return this.spineItems.forEach.apply(this.spineItems,arguments)},t.exports=n},function(e,i){if("undefined"==typeof t){var n=new Error('Cannot find module "JSZip"');throw n.code="MODULE_NOT_FOUND",n}e.exports=t},,function(t,e,i){function n(t,e){return new s(t,e)}var s=i(16),o=i(1),r=i(12),h=i(10);n.VERSION="0.3.0",n.CFI=o,n.Rendition=r,n.Contents=h,n.ViewManagers={},n.Views={},n.register={manager:function(t,e){return n.ViewManagers[t]=e},view:function(t,e){return n.Views[t]=e}},n.register.view("iframe",i(18)),n.register.manager("default",i(11)),n.register.manager("continuous",i(17)),t.exports=n}])}); \ No newline at end of file diff --git a/dist/polyfills.js b/dist/polyfills.js index 0f38ec3..2fdea87 100644 --- a/dist/polyfills.js +++ b/dist/polyfills.js @@ -77,13 +77,24 @@ return /******/ (function(modules) { // webpackBootstrap /******/ ({ /***/ 14: -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { -/* Any copyright is dedicated to the Public Domain. +"use strict"; +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ - -(function(scope) { - 'use strict'; +'use strict'; +(function (root, factory) { + if (true) { + // AMD. Register as an anonymous module. + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else if (typeof module === 'object' && module.exports) { + // Node + module.exports = factory(global); + } else { + // Browser globals (root is window) + root.URL = factory(root); + } +}(this, function (scope) { // feature detect for URL constructor var hasWorkingUrl = false; @@ -96,7 +107,7 @@ return /******/ (function(modules) { // webpackBootstrap } if (hasWorkingUrl) - return; + return scope.URL; var relative = Object.create(null); relative['ftp'] = 21; @@ -692,14 +703,8 @@ return /******/ (function(modules) { // webpackBootstrap }; } - scope.URL = jURL; - - // Export for CommonJS - if (typeof module === 'object' && module.exports) { - module.exports = jURL; - } - -})(this); + return jURL; +})); /***/ }, diff --git a/dist/polyfills.js.map b/dist/polyfills.js.map index e317100..9f73ab6 100644 --- a/dist/polyfills.js.map +++ b/dist/polyfills.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition?5ca6","webpack:///webpack/bootstrap e56d9891783b1b6486a9?8d8d","webpack:///./libs/url/url.js","webpack:///./~/es6-promise/dist/es6-promise.auto.js","webpack:///(webpack)/buildin/global.js","webpack:///./~/process/browser.js?82e4","webpack:///vertx (ignored)"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA,YAAI;AACJ;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;AC9DA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA,sCAAsC;AACtC,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC;;;;;;;;uDC5mBD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC,qBAAqB;;AAEtB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,iFAAiF;;AAEjF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B,sBAAsB;;AAEhD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,UAAU,IAAI;AACd;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,wBAAwB;AACzC;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,uCAAuC;AACxD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;AACA;AACA,UAAU,MAAM;AAChB,UAAU,OAAO;AACjB;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,UAAU,MAAM;AAChB;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA,qBAAqB,YAAY;AACjC;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;AACA;AACA,UAAU,IAAI;AACd;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;;AAEA;AACA,UAAU,SAAS;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,eAAe;AACf;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA,YAAY,SAAS;AACrB,YAAY,SAAS;AACrB;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,YAAY,SAAS;AACrB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA,yC;;;;;;;;ACtoCA;;AAEA;AACA,iBAAiB,aAAa,EAAE;;AAEhC;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C;;;;;;;;AClBA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;AACA,4BAA4B,UAAU;;;;;;;;ACnLtC,e","file":"polyfills.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ePub\"] = factory();\n\telse\n\t\troot[\"ePub\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmory imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmory exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tObject.defineProperty(exports, name, {\n \t\t\tconfigurable: false,\n \t\t\tenumerable: true,\n \t\t\tget: getter\n \t\t});\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/dist/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 51);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e56d9891783b1b6486a9","/* Any copyright is dedicated to the Public Domain.\n * http://creativecommons.org/publicdomain/zero/1.0/ */\n\n(function(scope) {\n 'use strict';\n\n // feature detect for URL constructor\n var hasWorkingUrl = false;\n if (!scope.forceJURL) {\n try {\n var u = new URL('b', 'http://a');\n u.pathname = 'c%20d';\n hasWorkingUrl = u.href === 'http://a/c%20d';\n } catch(e) {}\n }\n\n if (hasWorkingUrl)\n return;\n\n var relative = Object.create(null);\n relative['ftp'] = 21;\n relative['file'] = 0;\n relative['gopher'] = 70;\n relative['http'] = 80;\n relative['https'] = 443;\n relative['ws'] = 80;\n relative['wss'] = 443;\n\n var relativePathDotMapping = Object.create(null);\n relativePathDotMapping['%2e'] = '.';\n relativePathDotMapping['.%2e'] = '..';\n relativePathDotMapping['%2e.'] = '..';\n relativePathDotMapping['%2e%2e'] = '..';\n\n function isRelativeScheme(scheme) {\n return relative[scheme] !== undefined;\n }\n\n function invalid() {\n clear.call(this);\n this._isInvalid = true;\n }\n\n function IDNAToASCII(h) {\n if ('' == h) {\n invalid.call(this)\n }\n // XXX\n return h.toLowerCase()\n }\n\n function percentEscape(c) {\n var unicode = c.charCodeAt(0);\n if (unicode > 0x20 &&\n unicode < 0x7F &&\n // \" # < > ? `\n [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) == -1\n ) {\n return c;\n }\n return encodeURIComponent(c);\n }\n\n function percentEscapeQuery(c) {\n // XXX This actually needs to encode c using encoding and then\n // convert the bytes one-by-one.\n\n var unicode = c.charCodeAt(0);\n if (unicode > 0x20 &&\n unicode < 0x7F &&\n // \" # < > ` (do not escape '?')\n [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) == -1\n ) {\n return c;\n }\n return encodeURIComponent(c);\n }\n\n var EOF = undefined,\n ALPHA = /[a-zA-Z]/,\n ALPHANUMERIC = /[a-zA-Z0-9\\+\\-\\.]/;\n\n function parse(input, stateOverride, base) {\n function err(message) {\n errors.push(message)\n }\n\n var state = stateOverride || 'scheme start',\n cursor = 0,\n buffer = '',\n seenAt = false,\n seenBracket = false,\n errors = [];\n\n loop: while ((input[cursor - 1] != EOF || cursor == 0) && !this._isInvalid) {\n var c = input[cursor];\n switch (state) {\n case 'scheme start':\n if (c && ALPHA.test(c)) {\n buffer += c.toLowerCase(); // ASCII-safe\n state = 'scheme';\n } else if (!stateOverride) {\n buffer = '';\n state = 'no scheme';\n continue;\n } else {\n err('Invalid scheme.');\n break loop;\n }\n break;\n\n case 'scheme':\n if (c && ALPHANUMERIC.test(c)) {\n buffer += c.toLowerCase(); // ASCII-safe\n } else if (':' == c) {\n this._scheme = buffer;\n buffer = '';\n if (stateOverride) {\n break loop;\n }\n if (isRelativeScheme(this._scheme)) {\n this._isRelative = true;\n }\n if ('file' == this._scheme) {\n state = 'relative';\n } else if (this._isRelative && base && base._scheme == this._scheme) {\n state = 'relative or authority';\n } else if (this._isRelative) {\n state = 'authority first slash';\n } else {\n state = 'scheme data';\n }\n } else if (!stateOverride) {\n buffer = '';\n cursor = 0;\n state = 'no scheme';\n continue;\n } else if (EOF == c) {\n break loop;\n } else {\n err('Code point not allowed in scheme: ' + c)\n break loop;\n }\n break;\n\n case 'scheme data':\n if ('?' == c) {\n this._query = '?';\n state = 'query';\n } else if ('#' == c) {\n this._fragment = '#';\n state = 'fragment';\n } else {\n // XXX error handling\n if (EOF != c && '\\t' != c && '\\n' != c && '\\r' != c) {\n this._schemeData += percentEscape(c);\n }\n }\n break;\n\n case 'no scheme':\n if (!base || !(isRelativeScheme(base._scheme))) {\n err('Missing scheme.');\n invalid.call(this);\n } else {\n state = 'relative';\n continue;\n }\n break;\n\n case 'relative or authority':\n if ('/' == c && '/' == input[cursor+1]) {\n state = 'authority ignore slashes';\n } else {\n err('Expected /, got: ' + c);\n state = 'relative';\n continue\n }\n break;\n\n case 'relative':\n this._isRelative = true;\n if ('file' != this._scheme)\n this._scheme = base._scheme;\n if (EOF == c) {\n this._host = base._host;\n this._port = base._port;\n this._path = base._path.slice();\n this._query = base._query;\n this._username = base._username;\n this._password = base._password;\n break loop;\n } else if ('/' == c || '\\\\' == c) {\n if ('\\\\' == c)\n err('\\\\ is an invalid code point.');\n state = 'relative slash';\n } else if ('?' == c) {\n this._host = base._host;\n this._port = base._port;\n this._path = base._path.slice();\n this._query = '?';\n this._username = base._username;\n this._password = base._password;\n state = 'query';\n } else if ('#' == c) {\n this._host = base._host;\n this._port = base._port;\n this._path = base._path.slice();\n this._query = base._query;\n this._fragment = '#';\n this._username = base._username;\n this._password = base._password;\n state = 'fragment';\n } else {\n var nextC = input[cursor+1]\n var nextNextC = input[cursor+2]\n if (\n 'file' != this._scheme || !ALPHA.test(c) ||\n (nextC != ':' && nextC != '|') ||\n (EOF != nextNextC && '/' != nextNextC && '\\\\' != nextNextC && '?' != nextNextC && '#' != nextNextC)) {\n this._host = base._host;\n this._port = base._port;\n this._username = base._username;\n this._password = base._password;\n this._path = base._path.slice();\n this._path.pop();\n }\n state = 'relative path';\n continue;\n }\n break;\n\n case 'relative slash':\n if ('/' == c || '\\\\' == c) {\n if ('\\\\' == c) {\n err('\\\\ is an invalid code point.');\n }\n if ('file' == this._scheme) {\n state = 'file host';\n } else {\n state = 'authority ignore slashes';\n }\n } else {\n if ('file' != this._scheme) {\n this._host = base._host;\n this._port = base._port;\n this._username = base._username;\n this._password = base._password;\n }\n state = 'relative path';\n continue;\n }\n break;\n\n case 'authority first slash':\n if ('/' == c) {\n state = 'authority second slash';\n } else {\n err(\"Expected '/', got: \" + c);\n state = 'authority ignore slashes';\n continue;\n }\n break;\n\n case 'authority second slash':\n state = 'authority ignore slashes';\n if ('/' != c) {\n err(\"Expected '/', got: \" + c);\n continue;\n }\n break;\n\n case 'authority ignore slashes':\n if ('/' != c && '\\\\' != c) {\n state = 'authority';\n continue;\n } else {\n err('Expected authority, got: ' + c);\n }\n break;\n\n case 'authority':\n if ('@' == c) {\n if (seenAt) {\n err('@ already seen.');\n buffer += '%40';\n }\n seenAt = true;\n for (var i = 0; i < buffer.length; i++) {\n var cp = buffer[i];\n if ('\\t' == cp || '\\n' == cp || '\\r' == cp) {\n err('Invalid whitespace in authority.');\n continue;\n }\n // XXX check URL code points\n if (':' == cp && null === this._password) {\n this._password = '';\n continue;\n }\n var tempC = percentEscape(cp);\n (null !== this._password) ? this._password += tempC : this._username += tempC;\n }\n buffer = '';\n } else if (EOF == c || '/' == c || '\\\\' == c || '?' == c || '#' == c) {\n cursor -= buffer.length;\n buffer = '';\n state = 'host';\n continue;\n } else {\n buffer += c;\n }\n break;\n\n case 'file host':\n if (EOF == c || '/' == c || '\\\\' == c || '?' == c || '#' == c) {\n if (buffer.length == 2 && ALPHA.test(buffer[0]) && (buffer[1] == ':' || buffer[1] == '|')) {\n state = 'relative path';\n } else if (buffer.length == 0) {\n state = 'relative path start';\n } else {\n this._host = IDNAToASCII.call(this, buffer);\n buffer = '';\n state = 'relative path start';\n }\n continue;\n } else if ('\\t' == c || '\\n' == c || '\\r' == c) {\n err('Invalid whitespace in file host.');\n } else {\n buffer += c;\n }\n break;\n\n case 'host':\n case 'hostname':\n if (':' == c && !seenBracket) {\n // XXX host parsing\n this._host = IDNAToASCII.call(this, buffer);\n buffer = '';\n state = 'port';\n if ('hostname' == stateOverride) {\n break loop;\n }\n } else if (EOF == c || '/' == c || '\\\\' == c || '?' == c || '#' == c) {\n this._host = IDNAToASCII.call(this, buffer);\n buffer = '';\n state = 'relative path start';\n if (stateOverride) {\n break loop;\n }\n continue;\n } else if ('\\t' != c && '\\n' != c && '\\r' != c) {\n if ('[' == c) {\n seenBracket = true;\n } else if (']' == c) {\n seenBracket = false;\n }\n buffer += c;\n } else {\n err('Invalid code point in host/hostname: ' + c);\n }\n break;\n\n case 'port':\n if (/[0-9]/.test(c)) {\n buffer += c;\n } else if (EOF == c || '/' == c || '\\\\' == c || '?' == c || '#' == c || stateOverride) {\n if ('' != buffer) {\n var temp = parseInt(buffer, 10);\n if (temp != relative[this._scheme]) {\n this._port = temp + '';\n }\n buffer = '';\n }\n if (stateOverride) {\n break loop;\n }\n state = 'relative path start';\n continue;\n } else if ('\\t' == c || '\\n' == c || '\\r' == c) {\n err('Invalid code point in port: ' + c);\n } else {\n invalid.call(this);\n }\n break;\n\n case 'relative path start':\n if ('\\\\' == c)\n err(\"'\\\\' not allowed in path.\");\n state = 'relative path';\n if ('/' != c && '\\\\' != c) {\n continue;\n }\n break;\n\n case 'relative path':\n if (EOF == c || '/' == c || '\\\\' == c || (!stateOverride && ('?' == c || '#' == c))) {\n if ('\\\\' == c) {\n err('\\\\ not allowed in relative path.');\n }\n var tmp;\n if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {\n buffer = tmp;\n }\n if ('..' == buffer) {\n this._path.pop();\n if ('/' != c && '\\\\' != c) {\n this._path.push('');\n }\n } else if ('.' == buffer && '/' != c && '\\\\' != c) {\n this._path.push('');\n } else if ('.' != buffer) {\n if ('file' == this._scheme && this._path.length == 0 && buffer.length == 2 && ALPHA.test(buffer[0]) && buffer[1] == '|') {\n buffer = buffer[0] + ':';\n }\n this._path.push(buffer);\n }\n buffer = '';\n if ('?' == c) {\n this._query = '?';\n state = 'query';\n } else if ('#' == c) {\n this._fragment = '#';\n state = 'fragment';\n }\n } else if ('\\t' != c && '\\n' != c && '\\r' != c) {\n buffer += percentEscape(c);\n }\n break;\n\n case 'query':\n if (!stateOverride && '#' == c) {\n this._fragment = '#';\n state = 'fragment';\n } else if (EOF != c && '\\t' != c && '\\n' != c && '\\r' != c) {\n this._query += percentEscapeQuery(c);\n }\n break;\n\n case 'fragment':\n if (EOF != c && '\\t' != c && '\\n' != c && '\\r' != c) {\n this._fragment += c;\n }\n break;\n }\n\n cursor++;\n }\n }\n\n function clear() {\n this._scheme = '';\n this._schemeData = '';\n this._username = '';\n this._password = null;\n this._host = '';\n this._port = '';\n this._path = [];\n this._query = '';\n this._fragment = '';\n this._isInvalid = false;\n this._isRelative = false;\n }\n\n // Does not process domain names or IP addresses.\n // Does not handle encoding for the query parameter.\n function jURL(url, base /* , encoding */) {\n if (base !== undefined && !(base instanceof jURL))\n base = new jURL(String(base));\n\n this._url = url;\n clear.call(this);\n\n var input = url.replace(/^[ \\t\\r\\n\\f]+|[ \\t\\r\\n\\f]+$/g, '');\n // encoding = encoding || 'utf-8'\n\n parse.call(this, input, null, base);\n }\n\n jURL.prototype = {\n toString: function() {\n return this.href;\n },\n get href() {\n if (this._isInvalid)\n return this._url;\n\n var authority = '';\n if ('' != this._username || null != this._password) {\n authority = this._username +\n (null != this._password ? ':' + this._password : '') + '@';\n }\n\n return this.protocol +\n (this._isRelative ? '//' + authority + this.host : '') +\n this.pathname + this._query + this._fragment;\n },\n set href(href) {\n clear.call(this);\n parse.call(this, href);\n },\n\n get protocol() {\n return this._scheme + ':';\n },\n set protocol(protocol) {\n if (this._isInvalid)\n return;\n parse.call(this, protocol + ':', 'scheme start');\n },\n\n get host() {\n return this._isInvalid ? '' : this._port ?\n this._host + ':' + this._port : this._host;\n },\n set host(host) {\n if (this._isInvalid || !this._isRelative)\n return;\n parse.call(this, host, 'host');\n },\n\n get hostname() {\n return this._host;\n },\n set hostname(hostname) {\n if (this._isInvalid || !this._isRelative)\n return;\n parse.call(this, hostname, 'hostname');\n },\n\n get port() {\n return this._port;\n },\n set port(port) {\n if (this._isInvalid || !this._isRelative)\n return;\n parse.call(this, port, 'port');\n },\n\n get pathname() {\n return this._isInvalid ? '' : this._isRelative ?\n '/' + this._path.join('/') : this._schemeData;\n },\n set pathname(pathname) {\n if (this._isInvalid || !this._isRelative)\n return;\n this._path = [];\n parse.call(this, pathname, 'relative path start');\n },\n\n get search() {\n return this._isInvalid || !this._query || '?' == this._query ?\n '' : this._query;\n },\n set search(search) {\n if (this._isInvalid || !this._isRelative)\n return;\n this._query = '?';\n if ('?' == search[0])\n search = search.slice(1);\n parse.call(this, search, 'query');\n },\n\n get hash() {\n return this._isInvalid || !this._fragment || '#' == this._fragment ?\n '' : this._fragment;\n },\n set hash(hash) {\n if (this._isInvalid)\n return;\n this._fragment = '#';\n if ('#' == hash[0])\n hash = hash.slice(1);\n parse.call(this, hash, 'fragment');\n },\n\n get origin() {\n var host;\n if (this._isInvalid || !this._scheme) {\n return '';\n }\n // javascript: Gecko returns String(\"\"), WebKit/Blink String(\"null\")\n // Gecko throws error for \"data://\"\n // data: Gecko returns \"\", Blink returns \"data://\", WebKit returns \"null\"\n // Gecko returns String(\"\") for file: mailto:\n // WebKit/Blink returns String(\"SCHEME://\") for file: mailto:\n switch (this._scheme) {\n case 'data':\n case 'file':\n case 'javascript':\n case 'mailto':\n return 'null';\n }\n host = this.host;\n if (!host) {\n return '';\n }\n return this._scheme + '://' + host;\n }\n };\n\n // Copy over the static methods\n var OriginalURL = scope.URL;\n if (OriginalURL) {\n jURL.createObjectURL = function(blob) {\n // IE extension allows a second optional options argument.\n // http://msdn.microsoft.com/en-us/library/ie/hh772302(v=vs.85).aspx\n return OriginalURL.createObjectURL.apply(OriginalURL, arguments);\n };\n jURL.revokeObjectURL = function(url) {\n OriginalURL.revokeObjectURL(url);\n };\n }\n\n scope.URL = jURL;\n\n\t// Export for CommonJS\n if (typeof module === 'object' && module.exports) {\n module.exports = jURL;\n }\n\n})(this);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./libs/url/url.js\n// module id = 14\n// module chunks = 1","/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE\n * @version 4.0.5\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global.ES6Promise = factory());\n}(this, (function () { 'use strict';\n\nfunction objectOrFunction(x) {\n return typeof x === 'function' || typeof x === 'object' && x !== null;\n}\n\nfunction isFunction(x) {\n return typeof x === 'function';\n}\n\nvar _isArray = undefined;\nif (!Array.isArray) {\n _isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n} else {\n _isArray = Array.isArray;\n}\n\nvar isArray = _isArray;\n\nvar len = 0;\nvar vertxNext = undefined;\nvar customSchedulerFn = undefined;\n\nvar asap = function asap(callback, arg) {\n queue[len] = callback;\n queue[len + 1] = arg;\n len += 2;\n if (len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (customSchedulerFn) {\n customSchedulerFn(flush);\n } else {\n scheduleFlush();\n }\n }\n};\n\nfunction setScheduler(scheduleFn) {\n customSchedulerFn = scheduleFn;\n}\n\nfunction setAsap(asapFn) {\n asap = asapFn;\n}\n\nvar browserWindow = typeof window !== 'undefined' ? window : undefined;\nvar browserGlobal = browserWindow || {};\nvar BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;\nvar isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';\n\n// test for web worker but not in IE10\nvar isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';\n\n// node\nfunction useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function () {\n return process.nextTick(flush);\n };\n}\n\n// vertx\nfunction useVertxTimer() {\n if (typeof vertxNext !== 'undefined') {\n return function () {\n vertxNext(flush);\n };\n }\n\n return useSetTimeout();\n}\n\nfunction useMutationObserver() {\n var iterations = 0;\n var observer = new BrowserMutationObserver(flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function () {\n node.data = iterations = ++iterations % 2;\n };\n}\n\n// web worker\nfunction useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = flush;\n return function () {\n return channel.port2.postMessage(0);\n };\n}\n\nfunction useSetTimeout() {\n // Store setTimeout reference so es6-promise will be unaffected by\n // other code modifying setTimeout (like sinon.useFakeTimers())\n var globalSetTimeout = setTimeout;\n return function () {\n return globalSetTimeout(flush, 1);\n };\n}\n\nvar queue = new Array(1000);\nfunction flush() {\n for (var i = 0; i < len; i += 2) {\n var callback = queue[i];\n var arg = queue[i + 1];\n\n callback(arg);\n\n queue[i] = undefined;\n queue[i + 1] = undefined;\n }\n\n len = 0;\n}\n\nfunction attemptVertx() {\n try {\n var r = require;\n var vertx = r('vertx');\n vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return useVertxTimer();\n } catch (e) {\n return useSetTimeout();\n }\n}\n\nvar scheduleFlush = undefined;\n// Decide what async method to use to triggering processing of queued callbacks:\nif (isNode) {\n scheduleFlush = useNextTick();\n} else if (BrowserMutationObserver) {\n scheduleFlush = useMutationObserver();\n} else if (isWorker) {\n scheduleFlush = useMessageChannel();\n} else if (browserWindow === undefined && typeof require === 'function') {\n scheduleFlush = attemptVertx();\n} else {\n scheduleFlush = useSetTimeout();\n}\n\nfunction then(onFulfillment, onRejection) {\n var _arguments = arguments;\n\n var parent = this;\n\n var child = new this.constructor(noop);\n\n if (child[PROMISE_ID] === undefined) {\n makePromise(child);\n }\n\n var _state = parent._state;\n\n if (_state) {\n (function () {\n var callback = _arguments[_state - 1];\n asap(function () {\n return invokeCallback(_state, child, callback, parent._result);\n });\n })();\n } else {\n subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n}\n\n/**\n `Promise.resolve` returns a promise that will become resolved with the\n passed `value`. It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n resolve(1);\n });\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.resolve(1);\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n @method resolve\n @static\n @param {Any} value value that the returned promise will be resolved with\n Useful for tooling.\n @return {Promise} a promise that will become fulfilled with the given\n `value`\n*/\nfunction resolve(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(noop);\n _resolve(promise, object);\n return promise;\n}\n\nvar PROMISE_ID = Math.random().toString(36).substring(16);\n\nfunction noop() {}\n\nvar PENDING = void 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\n\nvar GET_THEN_ERROR = new ErrorObject();\n\nfunction selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n}\n\nfunction cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n}\n\nfunction getThen(promise) {\n try {\n return promise.then;\n } catch (error) {\n GET_THEN_ERROR.error = error;\n return GET_THEN_ERROR;\n }\n}\n\nfunction tryThen(then, value, fulfillmentHandler, rejectionHandler) {\n try {\n then.call(value, fulfillmentHandler, rejectionHandler);\n } catch (e) {\n return e;\n }\n}\n\nfunction handleForeignThenable(promise, thenable, then) {\n asap(function (promise) {\n var sealed = false;\n var error = tryThen(then, thenable, function (value) {\n if (sealed) {\n return;\n }\n sealed = true;\n if (thenable !== value) {\n _resolve(promise, value);\n } else {\n fulfill(promise, value);\n }\n }, function (reason) {\n if (sealed) {\n return;\n }\n sealed = true;\n\n _reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n _reject(promise, error);\n }\n }, promise);\n}\n\nfunction handleOwnThenable(promise, thenable) {\n if (thenable._state === FULFILLED) {\n fulfill(promise, thenable._result);\n } else if (thenable._state === REJECTED) {\n _reject(promise, thenable._result);\n } else {\n subscribe(thenable, undefined, function (value) {\n return _resolve(promise, value);\n }, function (reason) {\n return _reject(promise, reason);\n });\n }\n}\n\nfunction handleMaybeThenable(promise, maybeThenable, then$$) {\n if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {\n handleOwnThenable(promise, maybeThenable);\n } else {\n if (then$$ === GET_THEN_ERROR) {\n _reject(promise, GET_THEN_ERROR.error);\n } else if (then$$ === undefined) {\n fulfill(promise, maybeThenable);\n } else if (isFunction(then$$)) {\n handleForeignThenable(promise, maybeThenable, then$$);\n } else {\n fulfill(promise, maybeThenable);\n }\n }\n}\n\nfunction _resolve(promise, value) {\n if (promise === value) {\n _reject(promise, selfFulfillment());\n } else if (objectOrFunction(value)) {\n handleMaybeThenable(promise, value, getThen(value));\n } else {\n fulfill(promise, value);\n }\n}\n\nfunction publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n publish(promise);\n}\n\nfunction fulfill(promise, value) {\n if (promise._state !== PENDING) {\n return;\n }\n\n promise._result = value;\n promise._state = FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n asap(publish, promise);\n }\n}\n\nfunction _reject(promise, reason) {\n if (promise._state !== PENDING) {\n return;\n }\n promise._state = REJECTED;\n promise._result = reason;\n\n asap(publishRejection, promise);\n}\n\nfunction subscribe(parent, child, onFulfillment, onRejection) {\n var _subscribers = parent._subscribers;\n var length = _subscribers.length;\n\n parent._onerror = null;\n\n _subscribers[length] = child;\n _subscribers[length + FULFILLED] = onFulfillment;\n _subscribers[length + REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n asap(publish, parent);\n }\n}\n\nfunction publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) {\n return;\n }\n\n var child = undefined,\n callback = undefined,\n detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n}\n\nfunction ErrorObject() {\n this.error = null;\n}\n\nvar TRY_CATCH_ERROR = new ErrorObject();\n\nfunction tryCatch(callback, detail) {\n try {\n return callback(detail);\n } catch (e) {\n TRY_CATCH_ERROR.error = e;\n return TRY_CATCH_ERROR;\n }\n}\n\nfunction invokeCallback(settled, promise, callback, detail) {\n var hasCallback = isFunction(callback),\n value = undefined,\n error = undefined,\n succeeded = undefined,\n failed = undefined;\n\n if (hasCallback) {\n value = tryCatch(callback, detail);\n\n if (value === TRY_CATCH_ERROR) {\n failed = true;\n error = value.error;\n value = null;\n } else {\n succeeded = true;\n }\n\n if (promise === value) {\n _reject(promise, cannotReturnOwn());\n return;\n }\n } else {\n value = detail;\n succeeded = true;\n }\n\n if (promise._state !== PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n _resolve(promise, value);\n } else if (failed) {\n _reject(promise, error);\n } else if (settled === FULFILLED) {\n fulfill(promise, value);\n } else if (settled === REJECTED) {\n _reject(promise, value);\n }\n}\n\nfunction initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value) {\n _resolve(promise, value);\n }, function rejectPromise(reason) {\n _reject(promise, reason);\n });\n } catch (e) {\n _reject(promise, e);\n }\n}\n\nvar id = 0;\nfunction nextId() {\n return id++;\n}\n\nfunction makePromise(promise) {\n promise[PROMISE_ID] = id++;\n promise._state = undefined;\n promise._result = undefined;\n promise._subscribers = [];\n}\n\nfunction Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(noop);\n\n if (!this.promise[PROMISE_ID]) {\n makePromise(this.promise);\n }\n\n if (isArray(input)) {\n this._input = input;\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate();\n if (this._remaining === 0) {\n fulfill(this.promise, this._result);\n }\n }\n } else {\n _reject(this.promise, validationError());\n }\n}\n\nfunction validationError() {\n return new Error('Array Methods must be provided an Array');\n};\n\nEnumerator.prototype._enumerate = function () {\n var length = this.length;\n var _input = this._input;\n\n for (var i = 0; this._state === PENDING && i < length; i++) {\n this._eachEntry(_input[i], i);\n }\n};\n\nEnumerator.prototype._eachEntry = function (entry, i) {\n var c = this._instanceConstructor;\n var resolve$$ = c.resolve;\n\n if (resolve$$ === resolve) {\n var _then = getThen(entry);\n\n if (_then === then && entry._state !== PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof _then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === Promise) {\n var promise = new c(noop);\n handleMaybeThenable(promise, entry, _then);\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function (resolve$$) {\n return resolve$$(entry);\n }), i);\n }\n } else {\n this._willSettleAt(resolve$$(entry), i);\n }\n};\n\nEnumerator.prototype._settledAt = function (state, i, value) {\n var promise = this.promise;\n\n if (promise._state === PENDING) {\n this._remaining--;\n\n if (state === REJECTED) {\n _reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n fulfill(promise, this._result);\n }\n};\n\nEnumerator.prototype._willSettleAt = function (promise, i) {\n var enumerator = this;\n\n subscribe(promise, undefined, function (value) {\n return enumerator._settledAt(FULFILLED, i, value);\n }, function (reason) {\n return enumerator._settledAt(REJECTED, i, reason);\n });\n};\n\n/**\n `Promise.all` accepts an array of promises, and returns a new promise which\n is fulfilled with an array of fulfillment values for the passed promises, or\n rejected with the reason of the first passed promise to be rejected. It casts all\n elements of the passed iterable to promises as it runs this algorithm.\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = resolve(2);\n let promise3 = resolve(3);\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // The array here would be [ 1, 2, 3 ];\n });\n ```\n\n If any of the `promises` given to `all` are rejected, the first promise\n that is rejected will be given as an argument to the returned promises's\n rejection handler. For example:\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = reject(new Error(\"2\"));\n let promise3 = reject(new Error(\"3\"));\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // Code here never runs because there are rejected promises!\n }, function(error) {\n // error.message === \"2\"\n });\n ```\n\n @method all\n @static\n @param {Array} entries array of promises\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled when all `promises` have been\n fulfilled, or rejected if any of them become rejected.\n @static\n*/\nfunction all(entries) {\n return new Enumerator(this, entries).promise;\n}\n\n/**\n `Promise.race` returns a new promise which is settled in the same way as the\n first passed promise to settle.\n\n Example:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 2');\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // result === 'promise 2' because it was resolved before promise1\n // was resolved.\n });\n ```\n\n `Promise.race` is deterministic in that only the state of the first\n settled promise matters. For example, even if other promises given to the\n `promises` array argument are resolved, but the first settled promise has\n become rejected before the other promises became fulfilled, the returned\n promise will become rejected:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n reject(new Error('promise 2'));\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // Code here never runs\n }, function(reason){\n // reason.message === 'promise 2' because promise 2 became rejected before\n // promise 1 became fulfilled\n });\n ```\n\n An example real-world use case is implementing timeouts:\n\n ```javascript\n Promise.race([ajax('foo.json'), timeout(5000)])\n ```\n\n @method race\n @static\n @param {Array} promises array of promises to observe\n Useful for tooling.\n @return {Promise} a promise which settles in the same way as the first passed\n promise to settle.\n*/\nfunction race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (!isArray(entries)) {\n return new Constructor(function (_, reject) {\n return reject(new TypeError('You must pass an array to race.'));\n });\n } else {\n return new Constructor(function (resolve, reject) {\n var length = entries.length;\n for (var i = 0; i < length; i++) {\n Constructor.resolve(entries[i]).then(resolve, reject);\n }\n });\n }\n}\n\n/**\n `Promise.reject` returns a promise rejected with the passed `reason`.\n It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n reject(new Error('WHOOPS'));\n });\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.reject(new Error('WHOOPS'));\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n @method reject\n @static\n @param {Any} reason value that the returned promise will be rejected with.\n Useful for tooling.\n @return {Promise} a promise rejected with the given `reason`.\n*/\nfunction reject(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(noop);\n _reject(promise, reason);\n return promise;\n}\n\nfunction needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n}\n\nfunction needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n}\n\n/**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n let promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n let xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {function} resolver\n Useful for tooling.\n @constructor\n*/\nfunction Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n\n if (noop !== resolver) {\n typeof resolver !== 'function' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n}\n\nPromise.all = all;\nPromise.race = race;\nPromise.resolve = resolve;\nPromise.reject = reject;\nPromise._setScheduler = setScheduler;\nPromise._setAsap = setAsap;\nPromise._asap = asap;\n\nPromise.prototype = {\n constructor: Promise,\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n \n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n \n Chaining\n --------\n \n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n \n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n \n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n \n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n \n Assimilation\n ------------\n \n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n \n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n \n If the assimliated promise rejects, then the downstream promise will also reject.\n \n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n \n Simple Example\n --------------\n \n Synchronous Example\n \n ```javascript\n let result;\n \n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n \n Errback Example\n \n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n \n Promise Example;\n \n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n \n Advanced Example\n --------------\n \n Synchronous Example\n \n ```javascript\n let author, books;\n \n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n \n Errback Example\n \n ```js\n \n function foundBooks(books) {\n \n }\n \n function failure(reason) {\n \n }\n \n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n \n Promise Example;\n \n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n \n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n then: then,\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n \n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n \n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n \n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n \n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n 'catch': function _catch(onRejection) {\n return this.then(null, onRejection);\n }\n};\n\nfunction polyfill() {\n var local = undefined;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n } catch (e) {\n // silently ignored\n }\n\n if (promiseToString === '[object Promise]' && !P.cast) {\n return;\n }\n }\n\n local.Promise = Promise;\n}\n\n// Strange compat..\nPromise.polyfill = polyfill;\nPromise.Promise = Promise;\n\nreturn Promise;\n\n})));\n\nES6Promise.polyfill();\n//# sourceMappingURL=es6-promise.auto.map\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es6-promise/dist/es6-promise.auto.js\n// module id = 15\n// module chunks = 1","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() { return this; })();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 35\n// module chunks = 1","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/process/browser.js\n// module id = 4\n// module chunks = 0 1","/* (ignored) */\n\n\n//////////////////\n// WEBPACK FOOTER\n// vertx (ignored)\n// module id = 49\n// module chunks = 1"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition?5ca6","webpack:///webpack/bootstrap 34da14c1966138acf4e6?cecd","webpack:///./libs/url/url.js","webpack:///./~/es6-promise/dist/es6-promise.auto.js","webpack:///(webpack)/buildin/global.js","webpack:///./~/process/browser.js?82e4","webpack:///vertx (ignored)"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA,YAAI;AACJ;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;AC9DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA,sCAAsC;AACtC,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;;;;;;;uDChnBD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC,qBAAqB;;AAEtB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,iFAAiF;;AAEjF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B,sBAAsB;;AAEhD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,UAAU,IAAI;AACd;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,wBAAwB;AACzC;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,uCAAuC;AACxD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;AACA;AACA,UAAU,MAAM;AAChB,UAAU,OAAO;AACjB;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,UAAU,MAAM;AAChB;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA,qBAAqB,YAAY;AACjC;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;AACA;AACA,UAAU,IAAI;AACd;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;;AAEA;AACA,UAAU,SAAS;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,eAAe;AACf;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA,YAAY,SAAS;AACrB,YAAY,SAAS;AACrB;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,YAAY,SAAS;AACrB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED;AACA,yC;;;;;;;;ACtoCA;;AAEA;AACA,iBAAiB,aAAa,EAAE;;AAEhC;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C;;;;;;;;AClBA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;AACA,4BAA4B,UAAU;;;;;;;;ACnLtC,e","file":"polyfills.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ePub\"] = factory();\n\telse\n\t\troot[\"ePub\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmory imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmory exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tObject.defineProperty(exports, name, {\n \t\t\tconfigurable: false,\n \t\t\tenumerable: true,\n \t\t\tget: getter\n \t\t});\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/dist/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 51);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 34da14c1966138acf4e6","/* Any copyright is dedicated to the Public Domain.\n * http://creativecommons.org/publicdomain/zero/1.0/ */\n'use strict';\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define([], factory);\n } else if (typeof module === 'object' && module.exports) {\n // Node\n module.exports = factory(global);\n } else {\n // Browser globals (root is window)\n root.URL = factory(root);\n }\n}(this, function (scope) {\n\n // feature detect for URL constructor\n var hasWorkingUrl = false;\n if (!scope.forceJURL) {\n try {\n var u = new URL('b', 'http://a');\n u.pathname = 'c%20d';\n hasWorkingUrl = u.href === 'http://a/c%20d';\n } catch(e) {}\n }\n\n if (hasWorkingUrl)\n return scope.URL;\n\n var relative = Object.create(null);\n relative['ftp'] = 21;\n relative['file'] = 0;\n relative['gopher'] = 70;\n relative['http'] = 80;\n relative['https'] = 443;\n relative['ws'] = 80;\n relative['wss'] = 443;\n\n var relativePathDotMapping = Object.create(null);\n relativePathDotMapping['%2e'] = '.';\n relativePathDotMapping['.%2e'] = '..';\n relativePathDotMapping['%2e.'] = '..';\n relativePathDotMapping['%2e%2e'] = '..';\n\n function isRelativeScheme(scheme) {\n return relative[scheme] !== undefined;\n }\n\n function invalid() {\n clear.call(this);\n this._isInvalid = true;\n }\n\n function IDNAToASCII(h) {\n if ('' == h) {\n invalid.call(this)\n }\n // XXX\n return h.toLowerCase()\n }\n\n function percentEscape(c) {\n var unicode = c.charCodeAt(0);\n if (unicode > 0x20 &&\n unicode < 0x7F &&\n // \" # < > ? `\n [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) == -1\n ) {\n return c;\n }\n return encodeURIComponent(c);\n }\n\n function percentEscapeQuery(c) {\n // XXX This actually needs to encode c using encoding and then\n // convert the bytes one-by-one.\n\n var unicode = c.charCodeAt(0);\n if (unicode > 0x20 &&\n unicode < 0x7F &&\n // \" # < > ` (do not escape '?')\n [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) == -1\n ) {\n return c;\n }\n return encodeURIComponent(c);\n }\n\n var EOF = undefined,\n ALPHA = /[a-zA-Z]/,\n ALPHANUMERIC = /[a-zA-Z0-9\\+\\-\\.]/;\n\n function parse(input, stateOverride, base) {\n function err(message) {\n errors.push(message)\n }\n\n var state = stateOverride || 'scheme start',\n cursor = 0,\n buffer = '',\n seenAt = false,\n seenBracket = false,\n errors = [];\n\n loop: while ((input[cursor - 1] != EOF || cursor == 0) && !this._isInvalid) {\n var c = input[cursor];\n switch (state) {\n case 'scheme start':\n if (c && ALPHA.test(c)) {\n buffer += c.toLowerCase(); // ASCII-safe\n state = 'scheme';\n } else if (!stateOverride) {\n buffer = '';\n state = 'no scheme';\n continue;\n } else {\n err('Invalid scheme.');\n break loop;\n }\n break;\n\n case 'scheme':\n if (c && ALPHANUMERIC.test(c)) {\n buffer += c.toLowerCase(); // ASCII-safe\n } else if (':' == c) {\n this._scheme = buffer;\n buffer = '';\n if (stateOverride) {\n break loop;\n }\n if (isRelativeScheme(this._scheme)) {\n this._isRelative = true;\n }\n if ('file' == this._scheme) {\n state = 'relative';\n } else if (this._isRelative && base && base._scheme == this._scheme) {\n state = 'relative or authority';\n } else if (this._isRelative) {\n state = 'authority first slash';\n } else {\n state = 'scheme data';\n }\n } else if (!stateOverride) {\n buffer = '';\n cursor = 0;\n state = 'no scheme';\n continue;\n } else if (EOF == c) {\n break loop;\n } else {\n err('Code point not allowed in scheme: ' + c)\n break loop;\n }\n break;\n\n case 'scheme data':\n if ('?' == c) {\n this._query = '?';\n state = 'query';\n } else if ('#' == c) {\n this._fragment = '#';\n state = 'fragment';\n } else {\n // XXX error handling\n if (EOF != c && '\\t' != c && '\\n' != c && '\\r' != c) {\n this._schemeData += percentEscape(c);\n }\n }\n break;\n\n case 'no scheme':\n if (!base || !(isRelativeScheme(base._scheme))) {\n err('Missing scheme.');\n invalid.call(this);\n } else {\n state = 'relative';\n continue;\n }\n break;\n\n case 'relative or authority':\n if ('/' == c && '/' == input[cursor+1]) {\n state = 'authority ignore slashes';\n } else {\n err('Expected /, got: ' + c);\n state = 'relative';\n continue\n }\n break;\n\n case 'relative':\n this._isRelative = true;\n if ('file' != this._scheme)\n this._scheme = base._scheme;\n if (EOF == c) {\n this._host = base._host;\n this._port = base._port;\n this._path = base._path.slice();\n this._query = base._query;\n this._username = base._username;\n this._password = base._password;\n break loop;\n } else if ('/' == c || '\\\\' == c) {\n if ('\\\\' == c)\n err('\\\\ is an invalid code point.');\n state = 'relative slash';\n } else if ('?' == c) {\n this._host = base._host;\n this._port = base._port;\n this._path = base._path.slice();\n this._query = '?';\n this._username = base._username;\n this._password = base._password;\n state = 'query';\n } else if ('#' == c) {\n this._host = base._host;\n this._port = base._port;\n this._path = base._path.slice();\n this._query = base._query;\n this._fragment = '#';\n this._username = base._username;\n this._password = base._password;\n state = 'fragment';\n } else {\n var nextC = input[cursor+1]\n var nextNextC = input[cursor+2]\n if (\n 'file' != this._scheme || !ALPHA.test(c) ||\n (nextC != ':' && nextC != '|') ||\n (EOF != nextNextC && '/' != nextNextC && '\\\\' != nextNextC && '?' != nextNextC && '#' != nextNextC)) {\n this._host = base._host;\n this._port = base._port;\n this._username = base._username;\n this._password = base._password;\n this._path = base._path.slice();\n this._path.pop();\n }\n state = 'relative path';\n continue;\n }\n break;\n\n case 'relative slash':\n if ('/' == c || '\\\\' == c) {\n if ('\\\\' == c) {\n err('\\\\ is an invalid code point.');\n }\n if ('file' == this._scheme) {\n state = 'file host';\n } else {\n state = 'authority ignore slashes';\n }\n } else {\n if ('file' != this._scheme) {\n this._host = base._host;\n this._port = base._port;\n this._username = base._username;\n this._password = base._password;\n }\n state = 'relative path';\n continue;\n }\n break;\n\n case 'authority first slash':\n if ('/' == c) {\n state = 'authority second slash';\n } else {\n err(\"Expected '/', got: \" + c);\n state = 'authority ignore slashes';\n continue;\n }\n break;\n\n case 'authority second slash':\n state = 'authority ignore slashes';\n if ('/' != c) {\n err(\"Expected '/', got: \" + c);\n continue;\n }\n break;\n\n case 'authority ignore slashes':\n if ('/' != c && '\\\\' != c) {\n state = 'authority';\n continue;\n } else {\n err('Expected authority, got: ' + c);\n }\n break;\n\n case 'authority':\n if ('@' == c) {\n if (seenAt) {\n err('@ already seen.');\n buffer += '%40';\n }\n seenAt = true;\n for (var i = 0; i < buffer.length; i++) {\n var cp = buffer[i];\n if ('\\t' == cp || '\\n' == cp || '\\r' == cp) {\n err('Invalid whitespace in authority.');\n continue;\n }\n // XXX check URL code points\n if (':' == cp && null === this._password) {\n this._password = '';\n continue;\n }\n var tempC = percentEscape(cp);\n (null !== this._password) ? this._password += tempC : this._username += tempC;\n }\n buffer = '';\n } else if (EOF == c || '/' == c || '\\\\' == c || '?' == c || '#' == c) {\n cursor -= buffer.length;\n buffer = '';\n state = 'host';\n continue;\n } else {\n buffer += c;\n }\n break;\n\n case 'file host':\n if (EOF == c || '/' == c || '\\\\' == c || '?' == c || '#' == c) {\n if (buffer.length == 2 && ALPHA.test(buffer[0]) && (buffer[1] == ':' || buffer[1] == '|')) {\n state = 'relative path';\n } else if (buffer.length == 0) {\n state = 'relative path start';\n } else {\n this._host = IDNAToASCII.call(this, buffer);\n buffer = '';\n state = 'relative path start';\n }\n continue;\n } else if ('\\t' == c || '\\n' == c || '\\r' == c) {\n err('Invalid whitespace in file host.');\n } else {\n buffer += c;\n }\n break;\n\n case 'host':\n case 'hostname':\n if (':' == c && !seenBracket) {\n // XXX host parsing\n this._host = IDNAToASCII.call(this, buffer);\n buffer = '';\n state = 'port';\n if ('hostname' == stateOverride) {\n break loop;\n }\n } else if (EOF == c || '/' == c || '\\\\' == c || '?' == c || '#' == c) {\n this._host = IDNAToASCII.call(this, buffer);\n buffer = '';\n state = 'relative path start';\n if (stateOverride) {\n break loop;\n }\n continue;\n } else if ('\\t' != c && '\\n' != c && '\\r' != c) {\n if ('[' == c) {\n seenBracket = true;\n } else if (']' == c) {\n seenBracket = false;\n }\n buffer += c;\n } else {\n err('Invalid code point in host/hostname: ' + c);\n }\n break;\n\n case 'port':\n if (/[0-9]/.test(c)) {\n buffer += c;\n } else if (EOF == c || '/' == c || '\\\\' == c || '?' == c || '#' == c || stateOverride) {\n if ('' != buffer) {\n var temp = parseInt(buffer, 10);\n if (temp != relative[this._scheme]) {\n this._port = temp + '';\n }\n buffer = '';\n }\n if (stateOverride) {\n break loop;\n }\n state = 'relative path start';\n continue;\n } else if ('\\t' == c || '\\n' == c || '\\r' == c) {\n err('Invalid code point in port: ' + c);\n } else {\n invalid.call(this);\n }\n break;\n\n case 'relative path start':\n if ('\\\\' == c)\n err(\"'\\\\' not allowed in path.\");\n state = 'relative path';\n if ('/' != c && '\\\\' != c) {\n continue;\n }\n break;\n\n case 'relative path':\n if (EOF == c || '/' == c || '\\\\' == c || (!stateOverride && ('?' == c || '#' == c))) {\n if ('\\\\' == c) {\n err('\\\\ not allowed in relative path.');\n }\n var tmp;\n if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {\n buffer = tmp;\n }\n if ('..' == buffer) {\n this._path.pop();\n if ('/' != c && '\\\\' != c) {\n this._path.push('');\n }\n } else if ('.' == buffer && '/' != c && '\\\\' != c) {\n this._path.push('');\n } else if ('.' != buffer) {\n if ('file' == this._scheme && this._path.length == 0 && buffer.length == 2 && ALPHA.test(buffer[0]) && buffer[1] == '|') {\n buffer = buffer[0] + ':';\n }\n this._path.push(buffer);\n }\n buffer = '';\n if ('?' == c) {\n this._query = '?';\n state = 'query';\n } else if ('#' == c) {\n this._fragment = '#';\n state = 'fragment';\n }\n } else if ('\\t' != c && '\\n' != c && '\\r' != c) {\n buffer += percentEscape(c);\n }\n break;\n\n case 'query':\n if (!stateOverride && '#' == c) {\n this._fragment = '#';\n state = 'fragment';\n } else if (EOF != c && '\\t' != c && '\\n' != c && '\\r' != c) {\n this._query += percentEscapeQuery(c);\n }\n break;\n\n case 'fragment':\n if (EOF != c && '\\t' != c && '\\n' != c && '\\r' != c) {\n this._fragment += c;\n }\n break;\n }\n\n cursor++;\n }\n }\n\n function clear() {\n this._scheme = '';\n this._schemeData = '';\n this._username = '';\n this._password = null;\n this._host = '';\n this._port = '';\n this._path = [];\n this._query = '';\n this._fragment = '';\n this._isInvalid = false;\n this._isRelative = false;\n }\n\n // Does not process domain names or IP addresses.\n // Does not handle encoding for the query parameter.\n function jURL(url, base /* , encoding */) {\n if (base !== undefined && !(base instanceof jURL))\n base = new jURL(String(base));\n\n this._url = url;\n clear.call(this);\n\n var input = url.replace(/^[ \\t\\r\\n\\f]+|[ \\t\\r\\n\\f]+$/g, '');\n // encoding = encoding || 'utf-8'\n\n parse.call(this, input, null, base);\n }\n\n jURL.prototype = {\n toString: function() {\n return this.href;\n },\n get href() {\n if (this._isInvalid)\n return this._url;\n\n var authority = '';\n if ('' != this._username || null != this._password) {\n authority = this._username +\n (null != this._password ? ':' + this._password : '') + '@';\n }\n\n return this.protocol +\n (this._isRelative ? '//' + authority + this.host : '') +\n this.pathname + this._query + this._fragment;\n },\n set href(href) {\n clear.call(this);\n parse.call(this, href);\n },\n\n get protocol() {\n return this._scheme + ':';\n },\n set protocol(protocol) {\n if (this._isInvalid)\n return;\n parse.call(this, protocol + ':', 'scheme start');\n },\n\n get host() {\n return this._isInvalid ? '' : this._port ?\n this._host + ':' + this._port : this._host;\n },\n set host(host) {\n if (this._isInvalid || !this._isRelative)\n return;\n parse.call(this, host, 'host');\n },\n\n get hostname() {\n return this._host;\n },\n set hostname(hostname) {\n if (this._isInvalid || !this._isRelative)\n return;\n parse.call(this, hostname, 'hostname');\n },\n\n get port() {\n return this._port;\n },\n set port(port) {\n if (this._isInvalid || !this._isRelative)\n return;\n parse.call(this, port, 'port');\n },\n\n get pathname() {\n return this._isInvalid ? '' : this._isRelative ?\n '/' + this._path.join('/') : this._schemeData;\n },\n set pathname(pathname) {\n if (this._isInvalid || !this._isRelative)\n return;\n this._path = [];\n parse.call(this, pathname, 'relative path start');\n },\n\n get search() {\n return this._isInvalid || !this._query || '?' == this._query ?\n '' : this._query;\n },\n set search(search) {\n if (this._isInvalid || !this._isRelative)\n return;\n this._query = '?';\n if ('?' == search[0])\n search = search.slice(1);\n parse.call(this, search, 'query');\n },\n\n get hash() {\n return this._isInvalid || !this._fragment || '#' == this._fragment ?\n '' : this._fragment;\n },\n set hash(hash) {\n if (this._isInvalid)\n return;\n this._fragment = '#';\n if ('#' == hash[0])\n hash = hash.slice(1);\n parse.call(this, hash, 'fragment');\n },\n\n get origin() {\n var host;\n if (this._isInvalid || !this._scheme) {\n return '';\n }\n // javascript: Gecko returns String(\"\"), WebKit/Blink String(\"null\")\n // Gecko throws error for \"data://\"\n // data: Gecko returns \"\", Blink returns \"data://\", WebKit returns \"null\"\n // Gecko returns String(\"\") for file: mailto:\n // WebKit/Blink returns String(\"SCHEME://\") for file: mailto:\n switch (this._scheme) {\n case 'data':\n case 'file':\n case 'javascript':\n case 'mailto':\n return 'null';\n }\n host = this.host;\n if (!host) {\n return '';\n }\n return this._scheme + '://' + host;\n }\n };\n\n // Copy over the static methods\n var OriginalURL = scope.URL;\n if (OriginalURL) {\n jURL.createObjectURL = function(blob) {\n // IE extension allows a second optional options argument.\n // http://msdn.microsoft.com/en-us/library/ie/hh772302(v=vs.85).aspx\n return OriginalURL.createObjectURL.apply(OriginalURL, arguments);\n };\n jURL.revokeObjectURL = function(url) {\n OriginalURL.revokeObjectURL(url);\n };\n }\n\n return jURL;\n}));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./libs/url/url.js\n// module id = 14\n// module chunks = 1","/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE\n * @version 4.0.5\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global.ES6Promise = factory());\n}(this, (function () { 'use strict';\n\nfunction objectOrFunction(x) {\n return typeof x === 'function' || typeof x === 'object' && x !== null;\n}\n\nfunction isFunction(x) {\n return typeof x === 'function';\n}\n\nvar _isArray = undefined;\nif (!Array.isArray) {\n _isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n} else {\n _isArray = Array.isArray;\n}\n\nvar isArray = _isArray;\n\nvar len = 0;\nvar vertxNext = undefined;\nvar customSchedulerFn = undefined;\n\nvar asap = function asap(callback, arg) {\n queue[len] = callback;\n queue[len + 1] = arg;\n len += 2;\n if (len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (customSchedulerFn) {\n customSchedulerFn(flush);\n } else {\n scheduleFlush();\n }\n }\n};\n\nfunction setScheduler(scheduleFn) {\n customSchedulerFn = scheduleFn;\n}\n\nfunction setAsap(asapFn) {\n asap = asapFn;\n}\n\nvar browserWindow = typeof window !== 'undefined' ? window : undefined;\nvar browserGlobal = browserWindow || {};\nvar BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;\nvar isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';\n\n// test for web worker but not in IE10\nvar isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';\n\n// node\nfunction useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function () {\n return process.nextTick(flush);\n };\n}\n\n// vertx\nfunction useVertxTimer() {\n if (typeof vertxNext !== 'undefined') {\n return function () {\n vertxNext(flush);\n };\n }\n\n return useSetTimeout();\n}\n\nfunction useMutationObserver() {\n var iterations = 0;\n var observer = new BrowserMutationObserver(flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function () {\n node.data = iterations = ++iterations % 2;\n };\n}\n\n// web worker\nfunction useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = flush;\n return function () {\n return channel.port2.postMessage(0);\n };\n}\n\nfunction useSetTimeout() {\n // Store setTimeout reference so es6-promise will be unaffected by\n // other code modifying setTimeout (like sinon.useFakeTimers())\n var globalSetTimeout = setTimeout;\n return function () {\n return globalSetTimeout(flush, 1);\n };\n}\n\nvar queue = new Array(1000);\nfunction flush() {\n for (var i = 0; i < len; i += 2) {\n var callback = queue[i];\n var arg = queue[i + 1];\n\n callback(arg);\n\n queue[i] = undefined;\n queue[i + 1] = undefined;\n }\n\n len = 0;\n}\n\nfunction attemptVertx() {\n try {\n var r = require;\n var vertx = r('vertx');\n vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return useVertxTimer();\n } catch (e) {\n return useSetTimeout();\n }\n}\n\nvar scheduleFlush = undefined;\n// Decide what async method to use to triggering processing of queued callbacks:\nif (isNode) {\n scheduleFlush = useNextTick();\n} else if (BrowserMutationObserver) {\n scheduleFlush = useMutationObserver();\n} else if (isWorker) {\n scheduleFlush = useMessageChannel();\n} else if (browserWindow === undefined && typeof require === 'function') {\n scheduleFlush = attemptVertx();\n} else {\n scheduleFlush = useSetTimeout();\n}\n\nfunction then(onFulfillment, onRejection) {\n var _arguments = arguments;\n\n var parent = this;\n\n var child = new this.constructor(noop);\n\n if (child[PROMISE_ID] === undefined) {\n makePromise(child);\n }\n\n var _state = parent._state;\n\n if (_state) {\n (function () {\n var callback = _arguments[_state - 1];\n asap(function () {\n return invokeCallback(_state, child, callback, parent._result);\n });\n })();\n } else {\n subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n}\n\n/**\n `Promise.resolve` returns a promise that will become resolved with the\n passed `value`. It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n resolve(1);\n });\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.resolve(1);\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n @method resolve\n @static\n @param {Any} value value that the returned promise will be resolved with\n Useful for tooling.\n @return {Promise} a promise that will become fulfilled with the given\n `value`\n*/\nfunction resolve(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(noop);\n _resolve(promise, object);\n return promise;\n}\n\nvar PROMISE_ID = Math.random().toString(36).substring(16);\n\nfunction noop() {}\n\nvar PENDING = void 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\n\nvar GET_THEN_ERROR = new ErrorObject();\n\nfunction selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n}\n\nfunction cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n}\n\nfunction getThen(promise) {\n try {\n return promise.then;\n } catch (error) {\n GET_THEN_ERROR.error = error;\n return GET_THEN_ERROR;\n }\n}\n\nfunction tryThen(then, value, fulfillmentHandler, rejectionHandler) {\n try {\n then.call(value, fulfillmentHandler, rejectionHandler);\n } catch (e) {\n return e;\n }\n}\n\nfunction handleForeignThenable(promise, thenable, then) {\n asap(function (promise) {\n var sealed = false;\n var error = tryThen(then, thenable, function (value) {\n if (sealed) {\n return;\n }\n sealed = true;\n if (thenable !== value) {\n _resolve(promise, value);\n } else {\n fulfill(promise, value);\n }\n }, function (reason) {\n if (sealed) {\n return;\n }\n sealed = true;\n\n _reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n _reject(promise, error);\n }\n }, promise);\n}\n\nfunction handleOwnThenable(promise, thenable) {\n if (thenable._state === FULFILLED) {\n fulfill(promise, thenable._result);\n } else if (thenable._state === REJECTED) {\n _reject(promise, thenable._result);\n } else {\n subscribe(thenable, undefined, function (value) {\n return _resolve(promise, value);\n }, function (reason) {\n return _reject(promise, reason);\n });\n }\n}\n\nfunction handleMaybeThenable(promise, maybeThenable, then$$) {\n if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {\n handleOwnThenable(promise, maybeThenable);\n } else {\n if (then$$ === GET_THEN_ERROR) {\n _reject(promise, GET_THEN_ERROR.error);\n } else if (then$$ === undefined) {\n fulfill(promise, maybeThenable);\n } else if (isFunction(then$$)) {\n handleForeignThenable(promise, maybeThenable, then$$);\n } else {\n fulfill(promise, maybeThenable);\n }\n }\n}\n\nfunction _resolve(promise, value) {\n if (promise === value) {\n _reject(promise, selfFulfillment());\n } else if (objectOrFunction(value)) {\n handleMaybeThenable(promise, value, getThen(value));\n } else {\n fulfill(promise, value);\n }\n}\n\nfunction publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n publish(promise);\n}\n\nfunction fulfill(promise, value) {\n if (promise._state !== PENDING) {\n return;\n }\n\n promise._result = value;\n promise._state = FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n asap(publish, promise);\n }\n}\n\nfunction _reject(promise, reason) {\n if (promise._state !== PENDING) {\n return;\n }\n promise._state = REJECTED;\n promise._result = reason;\n\n asap(publishRejection, promise);\n}\n\nfunction subscribe(parent, child, onFulfillment, onRejection) {\n var _subscribers = parent._subscribers;\n var length = _subscribers.length;\n\n parent._onerror = null;\n\n _subscribers[length] = child;\n _subscribers[length + FULFILLED] = onFulfillment;\n _subscribers[length + REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n asap(publish, parent);\n }\n}\n\nfunction publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) {\n return;\n }\n\n var child = undefined,\n callback = undefined,\n detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n}\n\nfunction ErrorObject() {\n this.error = null;\n}\n\nvar TRY_CATCH_ERROR = new ErrorObject();\n\nfunction tryCatch(callback, detail) {\n try {\n return callback(detail);\n } catch (e) {\n TRY_CATCH_ERROR.error = e;\n return TRY_CATCH_ERROR;\n }\n}\n\nfunction invokeCallback(settled, promise, callback, detail) {\n var hasCallback = isFunction(callback),\n value = undefined,\n error = undefined,\n succeeded = undefined,\n failed = undefined;\n\n if (hasCallback) {\n value = tryCatch(callback, detail);\n\n if (value === TRY_CATCH_ERROR) {\n failed = true;\n error = value.error;\n value = null;\n } else {\n succeeded = true;\n }\n\n if (promise === value) {\n _reject(promise, cannotReturnOwn());\n return;\n }\n } else {\n value = detail;\n succeeded = true;\n }\n\n if (promise._state !== PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n _resolve(promise, value);\n } else if (failed) {\n _reject(promise, error);\n } else if (settled === FULFILLED) {\n fulfill(promise, value);\n } else if (settled === REJECTED) {\n _reject(promise, value);\n }\n}\n\nfunction initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value) {\n _resolve(promise, value);\n }, function rejectPromise(reason) {\n _reject(promise, reason);\n });\n } catch (e) {\n _reject(promise, e);\n }\n}\n\nvar id = 0;\nfunction nextId() {\n return id++;\n}\n\nfunction makePromise(promise) {\n promise[PROMISE_ID] = id++;\n promise._state = undefined;\n promise._result = undefined;\n promise._subscribers = [];\n}\n\nfunction Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(noop);\n\n if (!this.promise[PROMISE_ID]) {\n makePromise(this.promise);\n }\n\n if (isArray(input)) {\n this._input = input;\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate();\n if (this._remaining === 0) {\n fulfill(this.promise, this._result);\n }\n }\n } else {\n _reject(this.promise, validationError());\n }\n}\n\nfunction validationError() {\n return new Error('Array Methods must be provided an Array');\n};\n\nEnumerator.prototype._enumerate = function () {\n var length = this.length;\n var _input = this._input;\n\n for (var i = 0; this._state === PENDING && i < length; i++) {\n this._eachEntry(_input[i], i);\n }\n};\n\nEnumerator.prototype._eachEntry = function (entry, i) {\n var c = this._instanceConstructor;\n var resolve$$ = c.resolve;\n\n if (resolve$$ === resolve) {\n var _then = getThen(entry);\n\n if (_then === then && entry._state !== PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof _then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === Promise) {\n var promise = new c(noop);\n handleMaybeThenable(promise, entry, _then);\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function (resolve$$) {\n return resolve$$(entry);\n }), i);\n }\n } else {\n this._willSettleAt(resolve$$(entry), i);\n }\n};\n\nEnumerator.prototype._settledAt = function (state, i, value) {\n var promise = this.promise;\n\n if (promise._state === PENDING) {\n this._remaining--;\n\n if (state === REJECTED) {\n _reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n fulfill(promise, this._result);\n }\n};\n\nEnumerator.prototype._willSettleAt = function (promise, i) {\n var enumerator = this;\n\n subscribe(promise, undefined, function (value) {\n return enumerator._settledAt(FULFILLED, i, value);\n }, function (reason) {\n return enumerator._settledAt(REJECTED, i, reason);\n });\n};\n\n/**\n `Promise.all` accepts an array of promises, and returns a new promise which\n is fulfilled with an array of fulfillment values for the passed promises, or\n rejected with the reason of the first passed promise to be rejected. It casts all\n elements of the passed iterable to promises as it runs this algorithm.\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = resolve(2);\n let promise3 = resolve(3);\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // The array here would be [ 1, 2, 3 ];\n });\n ```\n\n If any of the `promises` given to `all` are rejected, the first promise\n that is rejected will be given as an argument to the returned promises's\n rejection handler. For example:\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = reject(new Error(\"2\"));\n let promise3 = reject(new Error(\"3\"));\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // Code here never runs because there are rejected promises!\n }, function(error) {\n // error.message === \"2\"\n });\n ```\n\n @method all\n @static\n @param {Array} entries array of promises\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled when all `promises` have been\n fulfilled, or rejected if any of them become rejected.\n @static\n*/\nfunction all(entries) {\n return new Enumerator(this, entries).promise;\n}\n\n/**\n `Promise.race` returns a new promise which is settled in the same way as the\n first passed promise to settle.\n\n Example:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 2');\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // result === 'promise 2' because it was resolved before promise1\n // was resolved.\n });\n ```\n\n `Promise.race` is deterministic in that only the state of the first\n settled promise matters. For example, even if other promises given to the\n `promises` array argument are resolved, but the first settled promise has\n become rejected before the other promises became fulfilled, the returned\n promise will become rejected:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n reject(new Error('promise 2'));\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // Code here never runs\n }, function(reason){\n // reason.message === 'promise 2' because promise 2 became rejected before\n // promise 1 became fulfilled\n });\n ```\n\n An example real-world use case is implementing timeouts:\n\n ```javascript\n Promise.race([ajax('foo.json'), timeout(5000)])\n ```\n\n @method race\n @static\n @param {Array} promises array of promises to observe\n Useful for tooling.\n @return {Promise} a promise which settles in the same way as the first passed\n promise to settle.\n*/\nfunction race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (!isArray(entries)) {\n return new Constructor(function (_, reject) {\n return reject(new TypeError('You must pass an array to race.'));\n });\n } else {\n return new Constructor(function (resolve, reject) {\n var length = entries.length;\n for (var i = 0; i < length; i++) {\n Constructor.resolve(entries[i]).then(resolve, reject);\n }\n });\n }\n}\n\n/**\n `Promise.reject` returns a promise rejected with the passed `reason`.\n It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n reject(new Error('WHOOPS'));\n });\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.reject(new Error('WHOOPS'));\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n @method reject\n @static\n @param {Any} reason value that the returned promise will be rejected with.\n Useful for tooling.\n @return {Promise} a promise rejected with the given `reason`.\n*/\nfunction reject(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(noop);\n _reject(promise, reason);\n return promise;\n}\n\nfunction needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n}\n\nfunction needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n}\n\n/**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n let promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n let xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {function} resolver\n Useful for tooling.\n @constructor\n*/\nfunction Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n\n if (noop !== resolver) {\n typeof resolver !== 'function' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n}\n\nPromise.all = all;\nPromise.race = race;\nPromise.resolve = resolve;\nPromise.reject = reject;\nPromise._setScheduler = setScheduler;\nPromise._setAsap = setAsap;\nPromise._asap = asap;\n\nPromise.prototype = {\n constructor: Promise,\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n \n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n \n Chaining\n --------\n \n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n \n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n \n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n \n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n \n Assimilation\n ------------\n \n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n \n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n \n If the assimliated promise rejects, then the downstream promise will also reject.\n \n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n \n Simple Example\n --------------\n \n Synchronous Example\n \n ```javascript\n let result;\n \n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n \n Errback Example\n \n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n \n Promise Example;\n \n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n \n Advanced Example\n --------------\n \n Synchronous Example\n \n ```javascript\n let author, books;\n \n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n \n Errback Example\n \n ```js\n \n function foundBooks(books) {\n \n }\n \n function failure(reason) {\n \n }\n \n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n \n Promise Example;\n \n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n \n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n then: then,\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n \n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n \n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n \n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n \n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n 'catch': function _catch(onRejection) {\n return this.then(null, onRejection);\n }\n};\n\nfunction polyfill() {\n var local = undefined;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n } catch (e) {\n // silently ignored\n }\n\n if (promiseToString === '[object Promise]' && !P.cast) {\n return;\n }\n }\n\n local.Promise = Promise;\n}\n\n// Strange compat..\nPromise.polyfill = polyfill;\nPromise.Promise = Promise;\n\nreturn Promise;\n\n})));\n\nES6Promise.polyfill();\n//# sourceMappingURL=es6-promise.auto.map\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es6-promise/dist/es6-promise.auto.js\n// module id = 15\n// module chunks = 1","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() { return this; })();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 35\n// module chunks = 1","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/process/browser.js\n// module id = 4\n// module chunks = 0 1","/* (ignored) */\n\n\n//////////////////\n// WEBPACK FOOTER\n// vertx (ignored)\n// module id = 49\n// module chunks = 1"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/polyfills.min.js b/dist/polyfills.min.js index 3546369..f490e10 100644 --- a/dist/polyfills.min.js +++ b/dist/polyfills.min.js @@ -1,10 +1,8 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ePub=e():t.ePub=e()}(this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,e,i){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var i=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=51)}({14:function(t,e){/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ -!function(e){"use strict";function i(t){return void 0!==_[t]}function n(){c.call(this),this._isInvalid=!0}function r(t){return""==t&&n.call(this),t.toLowerCase()}function s(t){var e=t.charCodeAt(0);return e>32&&e<127&&[34,35,60,62,63,96].indexOf(e)==-1?t:encodeURIComponent(t)}function o(t){var e=t.charCodeAt(0);return e>32&&e<127&&[34,35,60,62,96].indexOf(e)==-1?t:encodeURIComponent(t)}function a(t,e,a){function c(t){y.push(t)}var h=e||"scheme start",u=0,l="",f=!1,b=!1,y=[];t:for(;(t[u-1]!=v||0==u)&&!this._isInvalid;){var g=t[u];switch(h){case"scheme start":if(!g||!d.test(g)){if(e){c("Invalid scheme.");break t}l="",h="no scheme";continue}l+=g.toLowerCase(),h="scheme";break;case"scheme":if(g&&m.test(g))l+=g.toLowerCase();else{if(":"!=g){if(e){if(v==g)break t;c("Code point not allowed in scheme: "+g);break t}l="",u=0,h="no scheme";continue}if(this._scheme=l,l="",e)break t;i(this._scheme)&&(this._isRelative=!0),h="file"==this._scheme?"relative":this._isRelative&&a&&a._scheme==this._scheme?"relative or authority":this._isRelative?"authority first slash":"scheme data"}break;case"scheme data":"?"==g?(this._query="?",h="query"):"#"==g?(this._fragment="#",h="fragment"):v!=g&&"\t"!=g&&"\n"!=g&&"\r"!=g&&(this._schemeData+=s(g));break;case"no scheme":if(a&&i(a._scheme)){h="relative";continue}c("Missing scheme."),n.call(this);break;case"relative or authority":if("/"!=g||"/"!=t[u+1]){c("Expected /, got: "+g),h="relative";continue}h="authority ignore slashes";break;case"relative":if(this._isRelative=!0,"file"!=this._scheme&&(this._scheme=a._scheme),v==g){this._host=a._host,this._port=a._port,this._path=a._path.slice(),this._query=a._query,this._username=a._username,this._password=a._password;break t}if("/"==g||"\\"==g)"\\"==g&&c("\\ is an invalid code point."),h="relative slash";else if("?"==g)this._host=a._host,this._port=a._port,this._path=a._path.slice(),this._query="?",this._username=a._username,this._password=a._password,h="query";else{if("#"!=g){var w=t[u+1],j=t[u+2];("file"!=this._scheme||!d.test(g)||":"!=w&&"|"!=w||v!=j&&"/"!=j&&"\\"!=j&&"?"!=j&&"#"!=j)&&(this._host=a._host,this._port=a._port,this._username=a._username,this._password=a._password,this._path=a._path.slice(),this._path.pop()),h="relative path";continue}this._host=a._host,this._port=a._port,this._path=a._path.slice(),this._query=a._query,this._fragment="#",this._username=a._username,this._password=a._password,h="fragment"}break;case"relative slash":if("/"!=g&&"\\"!=g){"file"!=this._scheme&&(this._host=a._host,this._port=a._port,this._username=a._username,this._password=a._password),h="relative path";continue}"\\"==g&&c("\\ is an invalid code point."),h="file"==this._scheme?"file host":"authority ignore slashes";break;case"authority first slash":if("/"!=g){c("Expected '/', got: "+g),h="authority ignore slashes";continue}h="authority second slash";break;case"authority second slash":if(h="authority ignore slashes","/"!=g){c("Expected '/', got: "+g);continue}break;case"authority ignore slashes":if("/"!=g&&"\\"!=g){h="authority";continue}c("Expected authority, got: "+g);break;case"authority":if("@"==g){f&&(c("@ already seen."),l+="%40"),f=!0;for(var O=0;O32&&e<127&&[34,35,60,62,63,96].indexOf(e)==-1?t:encodeURIComponent(t)}function s(t){var e=t.charCodeAt(0);return e>32&&e<127&&[34,35,60,62,96].indexOf(e)==-1?t:encodeURIComponent(t)}function o(t,o,a){function c(t){y.push(t)}var h=o||"scheme start",u=0,l="",m=!1,b=!1,y=[];t:for(;(t[u-1]!=p||0==u)&&!this._isInvalid;){var g=t[u];switch(h){case"scheme start":if(!g||!v.test(g)){if(o){c("Invalid scheme.");break t}l="",h="no scheme";continue}l+=g.toLowerCase(),h="scheme";break;case"scheme":if(g&&d.test(g))l+=g.toLowerCase();else{if(":"!=g){if(o){if(p==g)break t;c("Code point not allowed in scheme: "+g);break t}l="",u=0,h="no scheme";continue}if(this._scheme=l,l="",o)break t;e(this._scheme)&&(this._isRelative=!0),h="file"==this._scheme?"relative":this._isRelative&&a&&a._scheme==this._scheme?"relative or authority":this._isRelative?"authority first slash":"scheme data"}break;case"scheme data":"?"==g?(this._query="?",h="query"):"#"==g?(this._fragment="#",h="fragment"):p!=g&&"\t"!=g&&"\n"!=g&&"\r"!=g&&(this._schemeData+=r(g));break;case"no scheme":if(a&&e(a._scheme)){h="relative";continue}c("Missing scheme."),i.call(this);break;case"relative or authority":if("/"!=g||"/"!=t[u+1]){c("Expected /, got: "+g),h="relative";continue}h="authority ignore slashes";break;case"relative":if(this._isRelative=!0,"file"!=this._scheme&&(this._scheme=a._scheme),p==g){this._host=a._host,this._port=a._port,this._path=a._path.slice(),this._query=a._query,this._username=a._username,this._password=a._password;break t}if("/"==g||"\\"==g)"\\"==g&&c("\\ is an invalid code point."),h="relative slash";else if("?"==g)this._host=a._host,this._port=a._port,this._path=a._path.slice(),this._query="?",this._username=a._username,this._password=a._password,h="query";else{if("#"!=g){var w=t[u+1],j=t[u+2];("file"!=this._scheme||!v.test(g)||":"!=w&&"|"!=w||p!=j&&"/"!=j&&"\\"!=j&&"?"!=j&&"#"!=j)&&(this._host=a._host,this._port=a._port,this._username=a._username,this._password=a._password,this._path=a._path.slice(),this._path.pop()),h="relative path";continue}this._host=a._host,this._port=a._port,this._path=a._path.slice(),this._query=a._query,this._fragment="#",this._username=a._username,this._password=a._password,h="fragment"}break;case"relative slash":if("/"!=g&&"\\"!=g){"file"!=this._scheme&&(this._host=a._host,this._port=a._port,this._username=a._username,this._password=a._password),h="relative path";continue}"\\"==g&&c("\\ is an invalid code point."),h="file"==this._scheme?"file host":"authority ignore slashes";break;case"authority first slash":if("/"!=g){c("Expected '/', got: "+g),h="authority ignore slashes";continue}h="authority second slash";break;case"authority second slash":if(h="authority ignore slashes","/"!=g){c("Expected '/', got: "+g);continue}break;case"authority ignore slashes":if("/"!=g&&"\\"!=g){h="authority";continue}c("Expected authority, got: "+g);break;case"authority":if("@"==g){m&&(c("@ already seen."),l+="%40"),m=!0;for(var O=0;O1)for(var i=1;i1)for(var i=1;i +
  • + #key +
  • + @@ -671,9 +677,9 @@
  • - #reportLocation + #currentLocation
  • base64) - use base64, blobs, or none for replacing assets in archived Epubs + use base64, blobUrl, or none for replacing assets in archived Epubs @@ -1208,6 +1214,9 @@
    new Book("/path/to/book.epub", {})
    + +
    new Book({ replacements: "blobUrl" })
    + @@ -2069,6 +2078,72 @@ + + + + + +
    +
    +
    + + key(identifier) +
    +
    + @@ -6067,11 +6142,11 @@ Usually you would be better off calling display()

    -
    +
    - reportLocation() + currentLocation()