diff --git a/dist/epub.js b/dist/epub.js
index 446c23b..48ec3b4 100644
--- a/dist/epub.js
+++ b/dist/epub.js
@@ -82,88 +82,110 @@ var base64 = __webpack_require__(21);
var path = __webpack_require__(3);
var requestAnimationFrame = (typeof window != 'undefined') ? (window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame) : false;
-/*
-//-- Parse the different parts of a url, returning a object
-function uri(url){
- var uri = {
- protocol : '',
- host : '',
- path : '',
- origin : '',
- directory : '',
- base : '',
- filename : '',
- extension : '',
- fragment : '',
- href : url
- },
- doubleSlash = url.indexOf('://'),
- search = url.indexOf('?'),
- fragment = url.indexOf("#"),
- withoutProtocol,
- dot,
- firstSlash;
- if(fragment != -1) {
- uri.fragment = url.slice(fragment + 1);
- url = url.slice(0, fragment);
+/**
+ * creates a uri object
+ * @param {string} urlString a url string (relative or absolute)
+ * @param {[string]} baseString optional base for the url,
+ * default to window.location.href
+ * @return {object} url
+ */
+function Url(urlString, baseString) {
+ var absolute = (urlString.indexOf('://') > -1);
+
+ this.href = urlString;
+ this.protocol = "";
+ this.origin = "";
+ this.fragment = "";
+ this.search = "";
+ this.base = baseString || undefined;
+
+ if (!absolute && !baseString) {
+ this.base = window && window.location.href;
}
- if(search != -1) {
- uri.search = url.slice(search + 1);
- url = url.slice(0, search);
- href = url;
+ try {
+ this.Url = new URL(urlString, 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;
+ } catch (e) {
+ // console.error(e);
+ this.Url = undefined;
}
- if(doubleSlash != -1) {
- uri.protocol = url.slice(0, doubleSlash);
- withoutProtocol = url.slice(doubleSlash+3);
- firstSlash = withoutProtocol.indexOf('/');
+ this.Path = new Path(this.Url.pathname);
+ this.directory = this.Path.directory;
+ this.filename = this.Path.filename;
+ this.extension = this.Path.extension;
- if(firstSlash === -1) {
- uri.host = uri.path;
- uri.path = "";
- } else {
- uri.host = withoutProtocol.slice(0, firstSlash);
- uri.path = withoutProtocol.slice(firstSlash);
- }
+ this.path = this.origin + this.directory;
+}
- uri.origin = uri.protocol + "://" + uri.host;
+Url.prototype.resolve = function (what) {
+ var fullpath = path.resolve(this.directory, what);
+ return this.origin + fullpath;
+};
- uri.directory = folder(uri.path);
+Url.prototype.relative = function (what) {
+ return path.relative(what, this.directory);
+};
- uri.base = uri.origin + uri.directory;
- // return origin;
+function Path(pathString) {
+ var protocol;
+ var parsed;
+
+ protocol = pathString.indexOf('://');
+ if (protocol > -1) {
+ pathString = new URL(pathString).pathname;
+ }
+
+ parsed = this.parse(pathString);
+
+ this.path = pathString;
+
+ if (this.isDirectory(pathString)) {
+ this.directory = pathString;
} else {
- uri.path = url;
- uri.directory = folder(url);
- uri.base = uri.directory;
+ this.directory = parsed.dir + "/";
}
- //-- Filename
- uri.filename = url.replace(uri.base, '');
- dot = uri.filename.lastIndexOf('.');
- if(dot != -1) {
- uri.extension = uri.filename.slice(dot+1);
+ this.filename = parsed.base;
+ this.extension = parsed.ext.slice(1);
+
+}
+
+Path.prototype.parse = function (what) {
+ return path.parse(what);
+};
+
+Path.prototype.isDirectory = function (what) {
+ return (what.charAt(what.length-1) === '/');
+};
+
+Path.prototype.resolve = function (what) {
+ return path.resolve(this.directory, what);
+};
+
+Path.prototype.relative = function (what) {
+ console.log(what, this.directory);
+ return path.relative(what, this.directory);
+};
+
+Path.prototype.splitPath = function(filename) {
+ return this.splitPathRe.exec(filename).slice(1);
+};
+
+function assertPath(path) {
+ if (typeof path !== 'string') {
+ throw new TypeError('Path must be a string. Received ', path);
}
- return uri;
};
-//-- Parse out the folder, will return everything before the last slash
-function folder(url){
-
- var lastSlash = url.lastIndexOf('/');
-
- if(lastSlash == -1) var folder = '';
-
- folder = url.slice(0, lastSlash + 1);
-
- return folder;
-
-};
-*/
-
function extension(_url) {
var url;
var pathname;
@@ -239,7 +261,7 @@ function resolveUrl(base, path) {
paths;
// if(uri.host) {
- // return path;
+ // return path;
// }
if(baseDirectory[0] === "/") {
@@ -479,10 +501,10 @@ function windowBounds() {
};
//https://stackoverflow.com/questions/13482352/xquery-looking-for-text-with-single-quote/13483496#13483496
-function cleanStringForXpath(str) {
+function cleanStringForXpath(str) {
var parts = str.match(/[^'"]+|['"]/g);
parts = parts.map(function(part){
- if (part === "'") {
+ if (part === "'") {
return '\"\'\"'; // output "'"
}
@@ -685,7 +707,10 @@ module.exports = {
'qsp' : qsp,
'blob2base64' : blob2base64,
'createBase64Url': createBase64Url,
- 'defer': defer
+ 'defer': defer,
+ 'Url': Url,
+ 'Path': Path
+
};
@@ -1775,230 +1800,555 @@ exports.methods = methods;
/* 3 */
/***/ function(module, exports, __webpack_require__) {
-/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
+"use strict";
+/* WEBPACK VAR INJECTION */(function(process) {'use strict';
-// resolves . and .. elements in a path array with directory names there
-// must be no slashes, empty elements, or device names (c:\) in the array
-// (so also no leading and trailing slashes - it does not distinguish
-// relative and absolute paths)
-function normalizeArray(parts, allowAboveRoot) {
- // if the path tries to go above the root, `up` ends up > 0
- var up = 0;
- for (var i = parts.length - 1; i >= 0; i--) {
- var last = parts[i];
- if (last === '.') {
- parts.splice(i, 1);
- } else if (last === '..') {
- parts.splice(i, 1);
- up++;
- } else if (up) {
- parts.splice(i, 1);
- up--;
- }
+function assertPath(path) {
+ if (typeof path !== 'string') {
+ throw new TypeError('Path must be a string. Received ' + path);
}
-
- // if the path is allowed to go above the root, restore leading ..s
- if (allowAboveRoot) {
- for (; up--; up) {
- parts.unshift('..');
- }
- }
-
- return parts;
}
-// Split a filename into [root, dir, basename, ext], unix version
-// 'root' is just a slash, or nothing.
-var splitPathRe =
- /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
-var splitPath = function(filename) {
- return splitPathRe.exec(filename).slice(1);
-};
-
-// path.resolve([from ...], to)
-// posix version
-exports.resolve = function() {
- var resolvedPath = '',
- resolvedAbsolute = false;
-
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
- var path = (i >= 0) ? arguments[i] : process.cwd();
-
- // Skip empty and invalid entries
- if (typeof path !== 'string') {
- throw new TypeError('Arguments to path.resolve must be strings');
- } else if (!path) {
- continue;
- }
-
- resolvedPath = path + '/' + resolvedPath;
- resolvedAbsolute = path.charAt(0) === '/';
- }
-
- // At this point the path should be resolved to a full absolute path, but
- // handle relative paths to be safe (might happen when process.cwd() fails)
-
- // Normalize the path
- resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
- return !!p;
- }), !resolvedAbsolute).join('/');
-
- return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
-};
-
-// path.normalize(path)
-// posix version
-exports.normalize = function(path) {
- var isAbsolute = exports.isAbsolute(path),
- trailingSlash = substr(path, -1) === '/';
-
- // Normalize the path
- path = normalizeArray(filter(path.split('/'), function(p) {
- return !!p;
- }), !isAbsolute).join('/');
-
- if (!path && !isAbsolute) {
- path = '.';
- }
- if (path && trailingSlash) {
- path += '/';
- }
-
- return (isAbsolute ? '/' : '') + path;
-};
-
-// posix version
-exports.isAbsolute = function(path) {
- return path.charAt(0) === '/';
-};
-
-// posix version
-exports.join = function() {
- var paths = Array.prototype.slice.call(arguments, 0);
- return exports.normalize(filter(paths, function(p, index) {
- if (typeof p !== 'string') {
- throw new TypeError('Arguments to path.join must be strings');
- }
- return p;
- }).join('/'));
-};
-
-
-// path.relative(from, to)
-// posix version
-exports.relative = function(from, to) {
- from = exports.resolve(from).substr(1);
- to = exports.resolve(to).substr(1);
-
- function trim(arr) {
- var start = 0;
- for (; start < arr.length; start++) {
- if (arr[start] !== '') break;
- }
-
- var end = arr.length - 1;
- for (; end >= 0; end--) {
- if (arr[end] !== '') break;
- }
-
- if (start > end) return [];
- return arr.slice(start, end - start + 1);
- }
-
- var fromParts = trim(from.split('/'));
- var toParts = trim(to.split('/'));
-
- var length = Math.min(fromParts.length, toParts.length);
- var samePartsLength = length;
- for (var i = 0; i < length; i++) {
- if (fromParts[i] !== toParts[i]) {
- samePartsLength = i;
+// Resolves . and .. elements in a path with directory names
+function normalizeStringPosix(path, allowAboveRoot) {
+ var res = '';
+ var lastSlash = -1;
+ var dots = 0;
+ var code;
+ for (var i = 0; i <= path.length; ++i) {
+ if (i < path.length)
+ code = path.charCodeAt(i);
+ else if (code === 47/*/*/)
break;
+ else
+ code = 47/*/*/;
+ if (code === 47/*/*/) {
+ if (lastSlash === i - 1 || dots === 1) {
+ // NOOP
+ } else if (lastSlash !== i - 1 && dots === 2) {
+ if (res.length < 2 ||
+ res.charCodeAt(res.length - 1) !== 46/*.*/ ||
+ res.charCodeAt(res.length - 2) !== 46/*.*/) {
+ if (res.length > 2) {
+ const start = res.length - 1;
+ var j = start;
+ for (; j >= 0; --j) {
+ if (res.charCodeAt(j) === 47/*/*/)
+ break;
+ }
+ if (j !== start) {
+ if (j === -1)
+ res = '';
+ else
+ res = res.slice(0, j);
+ lastSlash = i;
+ dots = 0;
+ continue;
+ }
+ } else if (res.length === 2 || res.length === 1) {
+ res = '';
+ lastSlash = i;
+ dots = 0;
+ continue;
+ }
+ }
+ if (allowAboveRoot) {
+ if (res.length > 0)
+ res += '/..';
+ else
+ res = '..';
+ }
+ } else {
+ if (res.length > 0)
+ res += '/' + path.slice(lastSlash + 1, i);
+ else
+ res = path.slice(lastSlash + 1, i);
+ }
+ lastSlash = i;
+ dots = 0;
+ } else if (code === 46/*.*/ && dots !== -1) {
+ ++dots;
+ } else {
+ dots = -1;
}
}
-
- var outputParts = [];
- for (var i = samePartsLength; i < fromParts.length; i++) {
- outputParts.push('..');
- }
-
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
-
- return outputParts.join('/');
-};
-
-exports.sep = '/';
-exports.delimiter = ':';
-
-exports.dirname = function(path) {
- var result = splitPath(path),
- root = result[0],
- dir = result[1];
-
- if (!root && !dir) {
- // No dirname whatsoever
- return '.';
- }
-
- if (dir) {
- // It has a dirname, strip trailing slash
- dir = dir.substr(0, dir.length - 1);
- }
-
- return root + dir;
-};
-
-
-exports.basename = function(path, ext) {
- var f = splitPath(path)[2];
- // TODO: make this comparison case-insensitive on windows?
- if (ext && f.substr(-1 * ext.length) === ext) {
- f = f.substr(0, f.length - ext.length);
- }
- return f;
-};
-
-
-exports.extname = function(path) {
- return splitPath(path)[3];
-};
-
-function filter (xs, f) {
- if (xs.filter) return xs.filter(f);
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- if (f(xs[i], i, xs)) res.push(xs[i]);
- }
- return res;
+ return res;
}
-// String.prototype.substr - negative index don't work in IE8
-var substr = 'ab'.substr(-1) === 'b'
- ? function (str, start, len) { return str.substr(start, len) }
- : function (str, start, len) {
- if (start < 0) start = str.length + start;
- return str.substr(start, len);
+function _format(sep, pathObject) {
+ const dir = pathObject.dir || pathObject.root;
+ const base = pathObject.base ||
+ ((pathObject.name || '') + (pathObject.ext || ''));
+ if (!dir) {
+ return base;
+ }
+ if (dir === pathObject.root) {
+ return dir + base;
+ }
+ return dir + sep + base;
+}
+
+const posix = {
+ // path.resolve([from ...], to)
+ resolve: function resolve() {
+ var resolvedPath = '';
+ var resolvedAbsolute = false;
+ var cwd;
+
+ for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
+ var path;
+ if (i >= 0)
+ path = arguments[i];
+ else {
+ if (cwd === undefined)
+ cwd = process.cwd();
+ path = cwd;
+ }
+
+ assertPath(path);
+
+ // Skip empty entries
+ if (path.length === 0) {
+ continue;
+ }
+
+ resolvedPath = path + '/' + resolvedPath;
+ resolvedAbsolute = path.charCodeAt(0) === 47/*/*/;
}
-;
+
+ // At this point the path should be resolved to a full absolute path, but
+ // handle relative paths to be safe (might happen when process.cwd() fails)
+
+ // Normalize the path
+ resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
+
+ if (resolvedAbsolute) {
+ if (resolvedPath.length > 0)
+ return '/' + resolvedPath;
+ else
+ return '/';
+ } else if (resolvedPath.length > 0) {
+ return resolvedPath;
+ } else {
+ return '.';
+ }
+ },
+
+
+ normalize: function normalize(path) {
+ assertPath(path);
+
+ if (path.length === 0)
+ return '.';
+
+ const isAbsolute = path.charCodeAt(0) === 47/*/*/;
+ const trailingSeparator = path.charCodeAt(path.length - 1) === 47/*/*/;
+
+ // Normalize the path
+ path = normalizeStringPosix(path, !isAbsolute);
+
+ if (path.length === 0 && !isAbsolute)
+ path = '.';
+ if (path.length > 0 && trailingSeparator)
+ path += '/';
+
+ if (isAbsolute)
+ return '/' + path;
+ return path;
+ },
+
+
+ isAbsolute: function isAbsolute(path) {
+ assertPath(path);
+ return path.length > 0 && path.charCodeAt(0) === 47/*/*/;
+ },
+
+
+ join: function join() {
+ if (arguments.length === 0)
+ return '.';
+ var joined;
+ for (var i = 0; i < arguments.length; ++i) {
+ var arg = arguments[i];
+ assertPath(arg);
+ if (arg.length > 0) {
+ if (joined === undefined)
+ joined = arg;
+ else
+ joined += '/' + arg;
+ }
+ }
+ if (joined === undefined)
+ return '.';
+ return posix.normalize(joined);
+ },
+
+
+ relative: function relative(from, to) {
+ assertPath(from);
+ assertPath(to);
+
+ if (from === to)
+ return '';
+
+ from = posix.resolve(from);
+ to = posix.resolve(to);
+
+ if (from === to)
+ return '';
+
+ // Trim any leading backslashes
+ var fromStart = 1;
+ for (; fromStart < from.length; ++fromStart) {
+ if (from.charCodeAt(fromStart) !== 47/*/*/)
+ break;
+ }
+ var fromEnd = from.length;
+ var fromLen = (fromEnd - fromStart);
+
+ // Trim any leading backslashes
+ var toStart = 1;
+ for (; toStart < to.length; ++toStart) {
+ if (to.charCodeAt(toStart) !== 47/*/*/)
+ break;
+ }
+ var toEnd = to.length;
+ var toLen = (toEnd - toStart);
+
+ // Compare paths to find the longest common path from root
+ var length = (fromLen < toLen ? fromLen : toLen);
+ var lastCommonSep = -1;
+ var i = 0;
+ for (; i <= length; ++i) {
+ if (i === length) {
+ if (toLen > length) {
+ if (to.charCodeAt(toStart + i) === 47/*/*/) {
+ // We get here if `from` is the exact base path for `to`.
+ // For example: from='/foo/bar'; to='/foo/bar/baz'
+ return to.slice(toStart + i + 1);
+ } else if (i === 0) {
+ // We get here if `from` is the root
+ // For example: from='/'; to='/foo'
+ return to.slice(toStart + i);
+ }
+ } else if (fromLen > length) {
+ if (from.charCodeAt(fromStart + i) === 47/*/*/) {
+ // We get here if `to` is the exact base path for `from`.
+ // For example: from='/foo/bar/baz'; to='/foo/bar'
+ lastCommonSep = i;
+ } else if (i === 0) {
+ // We get here if `to` is the root.
+ // For example: from='/foo'; to='/'
+ lastCommonSep = 0;
+ }
+ }
+ break;
+ }
+ var fromCode = from.charCodeAt(fromStart + i);
+ var toCode = to.charCodeAt(toStart + i);
+ if (fromCode !== toCode)
+ break;
+ else if (fromCode === 47/*/*/)
+ lastCommonSep = i;
+ }
+
+ var out = '';
+ // Generate the relative path based on the path difference between `to`
+ // and `from`
+ for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
+ if (i === fromEnd || from.charCodeAt(i) === 47/*/*/) {
+ if (out.length === 0)
+ out += '..';
+ else
+ out += '/..';
+ }
+ }
+
+ // Lastly, append the rest of the destination (`to`) path that comes after
+ // the common path parts
+ if (out.length > 0)
+ return out + to.slice(toStart + lastCommonSep);
+ else {
+ toStart += lastCommonSep;
+ if (to.charCodeAt(toStart) === 47/*/*/)
+ ++toStart;
+ return to.slice(toStart);
+ }
+ },
+
+
+ _makeLong: function _makeLong(path) {
+ return path;
+ },
+
+
+ dirname: function dirname(path) {
+ assertPath(path);
+ if (path.length === 0)
+ return '.';
+ var code = path.charCodeAt(0);
+ var hasRoot = (code === 47/*/*/);
+ var end = -1;
+ var matchedSlash = true;
+ for (var i = path.length - 1; i >= 1; --i) {
+ code = path.charCodeAt(i);
+ if (code === 47/*/*/) {
+ if (!matchedSlash) {
+ end = i;
+ break;
+ }
+ } else {
+ // We saw the first non-path separator
+ matchedSlash = false;
+ }
+ }
+
+ if (end === -1)
+ return hasRoot ? '/' : '.';
+ if (hasRoot && end === 1)
+ return '//';
+ return path.slice(0, end);
+ },
+
+
+ basename: function basename(path, ext) {
+ if (ext !== undefined && typeof ext !== 'string')
+ throw new TypeError('"ext" argument must be a string');
+ assertPath(path);
+
+ var start = 0;
+ var end = -1;
+ var matchedSlash = true;
+ var i;
+
+ if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
+ if (ext.length === path.length && ext === path)
+ return '';
+ var extIdx = ext.length - 1;
+ var firstNonSlashEnd = -1;
+ for (i = path.length - 1; i >= 0; --i) {
+ const code = path.charCodeAt(i);
+ if (code === 47/*/*/) {
+ // If we reached a path separator that was not part of a set of path
+ // separators at the end of the string, stop now
+ if (!matchedSlash) {
+ start = i + 1;
+ break;
+ }
+ } else {
+ if (firstNonSlashEnd === -1) {
+ // We saw the first non-path separator, remember this index in case
+ // we need it if the extension ends up not matching
+ matchedSlash = false;
+ firstNonSlashEnd = i + 1;
+ }
+ if (extIdx >= 0) {
+ // Try to match the explicit extension
+ if (code === ext.charCodeAt(extIdx)) {
+ if (--extIdx === -1) {
+ // We matched the extension, so mark this as the end of our path
+ // component
+ end = i;
+ }
+ } else {
+ // Extension does not match, so our result is the entire path
+ // component
+ extIdx = -1;
+ end = firstNonSlashEnd;
+ }
+ }
+ }
+ }
+
+ if (start === end)
+ end = firstNonSlashEnd;
+ else if (end === -1)
+ end = path.length;
+ return path.slice(start, end);
+ } else {
+ for (i = path.length - 1; i >= 0; --i) {
+ if (path.charCodeAt(i) === 47/*/*/) {
+ // If we reached a path separator that was not part of a set of path
+ // separators at the end of the string, stop now
+ if (!matchedSlash) {
+ start = i + 1;
+ break;
+ }
+ } else if (end === -1) {
+ // We saw the first non-path separator, mark this as the end of our
+ // path component
+ matchedSlash = false;
+ end = i + 1;
+ }
+ }
+
+ if (end === -1)
+ return '';
+ return path.slice(start, end);
+ }
+ },
+
+
+ extname: function extname(path) {
+ assertPath(path);
+ var startDot = -1;
+ var startPart = 0;
+ var end = -1;
+ var matchedSlash = true;
+ // Track the state of characters (if any) we see before our first dot and
+ // after any path separator we find
+ var preDotState = 0;
+ for (var i = path.length - 1; i >= 0; --i) {
+ const code = path.charCodeAt(i);
+ if (code === 47/*/*/) {
+ // If we reached a path separator that was not part of a set of path
+ // separators at the end of the string, stop now
+ if (!matchedSlash) {
+ startPart = i + 1;
+ break;
+ }
+ continue;
+ }
+ if (end === -1) {
+ // We saw the first non-path separator, mark this as the end of our
+ // extension
+ matchedSlash = false;
+ end = i + 1;
+ }
+ if (code === 46/*.*/) {
+ // If this is our first dot, mark it as the start of our extension
+ if (startDot === -1)
+ startDot = i;
+ else if (preDotState !== 1)
+ preDotState = 1;
+ } else if (startDot !== -1) {
+ // We saw a non-dot and non-path separator before our dot, so we should
+ // have a good chance at having a non-empty extension
+ preDotState = -1;
+ }
+ }
+
+ if (startDot === -1 ||
+ end === -1 ||
+ // We saw a non-dot character immediately before the dot
+ preDotState === 0 ||
+ // The (right-most) trimmed path component is exactly '..'
+ (preDotState === 1 &&
+ startDot === end - 1 &&
+ startDot === startPart + 1)) {
+ return '';
+ }
+ return path.slice(startDot, end);
+ },
+
+
+ format: function format(pathObject) {
+ if (pathObject === null || typeof pathObject !== 'object') {
+ throw new TypeError(
+ `Parameter "pathObject" must be an object, not ${typeof pathObject}`
+ );
+ }
+ return _format('/', pathObject);
+ },
+
+
+ parse: function parse(path) {
+ assertPath(path);
+
+ var ret = { root: '', dir: '', base: '', ext: '', name: '' };
+ if (path.length === 0)
+ return ret;
+ var code = path.charCodeAt(0);
+ var isAbsolute = (code === 47/*/*/);
+ var start;
+ if (isAbsolute) {
+ ret.root = '/';
+ start = 1;
+ } else {
+ start = 0;
+ }
+ var startDot = -1;
+ var startPart = 0;
+ var end = -1;
+ var matchedSlash = true;
+ var i = path.length - 1;
+
+ // Track the state of characters (if any) we see before our first dot and
+ // after any path separator we find
+ var preDotState = 0;
+
+ // Get non-dir info
+ for (; i >= start; --i) {
+ code = path.charCodeAt(i);
+ if (code === 47/*/*/) {
+ // If we reached a path separator that was not part of a set of path
+ // separators at the end of the string, stop now
+ if (!matchedSlash) {
+ startPart = i + 1;
+ break;
+ }
+ continue;
+ }
+ if (end === -1) {
+ // We saw the first non-path separator, mark this as the end of our
+ // extension
+ matchedSlash = false;
+ end = i + 1;
+ }
+ if (code === 46/*.*/) {
+ // If this is our first dot, mark it as the start of our extension
+ if (startDot === -1)
+ startDot = i;
+ else if (preDotState !== 1)
+ preDotState = 1;
+ } else if (startDot !== -1) {
+ // We saw a non-dot and non-path separator before our dot, so we should
+ // have a good chance at having a non-empty extension
+ preDotState = -1;
+ }
+ }
+
+ if (startDot === -1 ||
+ end === -1 ||
+ // We saw a non-dot character immediately before the dot
+ preDotState === 0 ||
+ // The (right-most) trimmed path component is exactly '..'
+ (preDotState === 1 &&
+ startDot === end - 1 &&
+ startDot === startPart + 1)) {
+ if (end !== -1) {
+ if (startPart === 0 && isAbsolute)
+ ret.base = ret.name = path.slice(1, end);
+ else
+ ret.base = ret.name = path.slice(startPart, end);
+ }
+ } else {
+ if (startPart === 0 && isAbsolute) {
+ ret.name = path.slice(1, startDot);
+ ret.base = path.slice(1, end);
+ } else {
+ ret.name = path.slice(startPart, startDot);
+ ret.base = path.slice(startPart, end);
+ }
+ ret.ext = path.slice(startDot, end);
+ }
+
+ if (startPart > 0)
+ ret.dir = path.slice(0, startPart - 1);
+ else if (isAbsolute)
+ ret.dir = '/';
+
+ return ret;
+ },
+
+
+ sep: '/',
+ delimiter: ':',
+ posix: null
+};
+
+
+module.exports = posix;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
@@ -3091,7 +3441,7 @@ Contents.prototype.viewport = function(options) {
var $viewport = this.document.querySelector("meta[name='viewport']");
var newContent = '';
- /**
+ /*
* check for the viewport size
*
*/
@@ -5411,7 +5761,16 @@ var Unarchive = __webpack_require__(44);
var request = __webpack_require__(4);
var EpubCFI = __webpack_require__(1);
-function Book(_url, options){
+/**
+ * Creates a new Book
+ * @class
+ * @param {string} _url
+ * @param {object} options
+ * @param {method} options.requestMethod a request function to use instead of the default
+ * @returns {Book}
+ * @example new Book("/path/to/book.epub", {})
+ */
+function Book(url, options){
this.settings = core.extend(this.settings || {}, {
requestMethod: this.requestMethod
@@ -5422,11 +5781,12 @@ function Book(_url, options){
// Promises
this.opening = new core.defer();
+ /**
+ * @property {promise} opened returns after the book is loaded
+ */
this.opened = this.opening.promise;
this.isOpen = false;
- this.url = undefined;
-
this.loading = {
manifest: new core.defer(),
spine: new core.defer(),
@@ -5446,6 +5806,9 @@ function Book(_url, options){
};
// this.ready = RSVP.hash(this.loaded);
+ /**
+ * @property {promise} ready returns after the book is loaded and parsed
+ */
this.ready = Promise.all([this.loaded.manifest,
this.loaded.spine,
this.loaded.metadata,
@@ -5458,14 +5821,34 @@ function Book(_url, options){
this.isRendered = false;
// this._q = core.queue(this);
+ /**
+ * @property {method} request
+ */
this.request = this.settings.requestMethod.bind(this);
+ /**
+ * @property {Spine} spine
+ */
this.spine = new Spine(this.request);
+
+ /**
+ * @property {Locations} locations
+ */
this.locations = new Locations(this.spine, this.request);
- if(_url) {
- this.open(_url).catch(function (error) {
- var err = new Error("Cannot load book at "+ _url );
+ /**
+ * @property {Navigation} navigation
+ */
+ this.navigation = undefined;
+
+ /**
+ * @member {string} url the book url
+ */
+ this.url = undefined;
+
+ if(url) {
+ this.open(url).catch(function (error) {
+ var err = new Error("Cannot load book at "+ url );
console.error(err);
this.emit("loadFailed", error);
@@ -5473,6 +5856,13 @@ function Book(_url, options){
}
};
+/**
+ * open a url
+ * @param {string} _url URL, Path or ArrayBuffer
+ * @param {object} [options] to force opening
+ * @returns {Promise} of when the book has been loaded
+ * @example book.open("/path/to/book.epub", { base64: false })
+ */
Book.prototype.open = function(_url, options){
var url;
var pathname;
@@ -5631,6 +6021,10 @@ Book.prototype.open = function(_url, options){
return this.opened;
};
+/**
+ * unpack the contents of the Books packageXml
+ * @param {document} packageXml XML Document
+ */
Book.prototype.unpack = function(packageXml){
var book = this,
parse = new Parser();
@@ -5642,7 +6036,6 @@ Book.prototype.unpack = function(packageXml){
book.package.baseUrl = book.baseUrl; // Provides a url base for resolving paths
book.package.basePath = book.basePath; // Provides a url base for resolving paths
- console.log("book.baseUrl", book.baseUrl );
this.spine.load(book.package);
@@ -5662,12 +6055,17 @@ Book.prototype.unpack = function(packageXml){
}
};
-// Alias for book.spine.get
+/**
+ * Alias for book.spine.get
+ * @param {string} target
+ */
Book.prototype.section = function(target) {
return this.spine.get(target);
};
-// Sugar to render a book
+/**
+ * Sugar to render a book
+ */
Book.prototype.renderTo = function(element, options) {
// var renderMethod = (options && options.method) ?
// options.method :
@@ -5679,6 +6077,9 @@ Book.prototype.renderTo = function(element, options) {
return this.rendition;
};
+/**
+ * Switch request methods depending on if book is archived or not
+ */
Book.prototype.requestMethod = function(_url) {
// Switch request methods
if(this.unarchived) {
@@ -5697,12 +6098,17 @@ Book.prototype.setRequestHeaders = function(_headers) {
this.requestHeaders = _headers;
};
+/**
+ * Unarchive a zipped epub
+ */
Book.prototype.unarchive = function(bookUrl, isBase64){
this.unarchived = new Unarchive();
return this.unarchived.open(bookUrl, isBase64);
};
-//-- Checks if url has a .epub or .zip extension, or is ArrayBuffer (of zip/epub)
+/**
+ * Checks if url has a .epub or .zip extension, or is ArrayBuffer (of zip/epub)
+ */
Book.prototype.isArchivedUrl = function(bookUrl){
var extension;
@@ -5726,7 +6132,9 @@ Book.prototype.isArchivedUrl = function(bookUrl){
return false;
};
-//-- Returns the cover
+/**
+ * Get the cover url
+ */
Book.prototype.coverUrl = function(){
var retrieved = this.loaded.cover.
then(function(url) {
@@ -5742,6 +6150,9 @@ Book.prototype.coverUrl = function(){
return retrieved;
};
+/**
+ * Find a DOM Range for a given CFI Range
+ */
Book.prototype.range = function(cfiRange) {
var cfi = new EpubCFI(cfiRange);
var item = this.spine.get(cfi.spinePos);
@@ -7967,7 +8378,7 @@ function Stage(_options) {
}
-/**
+/*
* Creates an element to render to.
* Resizes to passed width and height or to the elements size
*/
@@ -8592,7 +9003,7 @@ Section.prototype.find = function(_query){
};
-/**
+/*
* Reconciles the current chapters layout properies with
* the global layout properities.
* Takes: global layout settings object, chapter properties string
@@ -8791,12 +9202,10 @@ function Unarchive() {
Unarchive.prototype.checkRequirements = function(callback){
try {
- if (typeof JSZip !== 'undefined') {
- this.zip = new JSZip();
- } else {
+ if (typeof JSZip === 'undefined') {
JSZip = __webpack_require__(45);
- this.zip = new JSZip();
}
+ this.zip = new JSZip();
} catch (e) {
console.error("JSZip lib not loaded");
}
@@ -8983,8 +9392,16 @@ var EpubCFI = __webpack_require__(1);
var Rendition = __webpack_require__(11);
var Contents = __webpack_require__(9);
-function ePub(_url) {
- return new Book(_url);
+/**
+ * Creates a new Book
+ * @param {string|ArrayBuffer} url URL, Path or ArrayBuffer
+ * @param {object} options to pass to the book
+ * @param options.requestMethod the request function to use
+ * @returns {Book} a new Book object
+ * @example ePub("/path/to/book.epub", {})
+ */
+function ePub(url, options) {
+ return new Book(url, options);
};
ePub.VERSION = "0.3.0";
@@ -8995,10 +9412,19 @@ ePub.Contents = Contents;
ePub.ViewManagers = {};
ePub.Views = {};
+/**
+ * register plugins
+ */
ePub.register = {
+ /**
+ * register a new view manager
+ */
manager : function(name, manager){
return ePub.ViewManagers[name] = manager;
},
+ /**
+ * register a new view
+ */
view : function(name, view){
return ePub.Views[name] = view;
}
diff --git a/dist/epub.js.map b/dist/epub.js.map
index 9b46778..bf64bf4 100644
--- a/dist/epub.js.map
+++ b/dist/epub.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 23c5bd6142f634f3e8a0","webpack:///./src/core.js","webpack:///./src/epubcfi.js","webpack:///./~/event-emitter/index.js","webpack:///./~/path-browserify/index.js","webpack:///./src/request.js","webpack:///./~/process/browser.js","webpack:///./src/hook.js","webpack:///./src/mapping.js","webpack:///./src/queue.js","webpack:///./src/contents.js","webpack:///./src/managers/default/index.js","webpack:///./src/rendition.js","webpack:///./src/parser.js","webpack:///./src/replacements.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/layout.js","webpack:///./src/locations.js","webpack:///./src/managers/helpers/stage.js","webpack:///./src/managers/helpers/views.js","webpack:///./src/navigation.js","webpack:///./src/section.js","webpack:///./src/spine.js","webpack:///./src/unarchive.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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;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;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;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;;;;;;;AChmBA;;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;;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;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,gCAAgC,QAAQ;AACxC;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,MAAM;AAChB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,6BAA6B,IAAI;AACjC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,oCAAoC,8BAA8B;AAClE;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,oBAAoB;AAC9B;AACA;;AAEA;AACA,UAAU,UAAU;AACpB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B,sBAAsB;AACrD;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,eAAe;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;;;;;;;;AC/NA;;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;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;;;;;;;ACxJA;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;;AAEA;AACA,qCAAqC;AACrC,+CAA+C;;AAE/C;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,sBAAsB;AACrC;AACA;AACA,GAAG;AACH;AACA,iBAAiB,yBAAyB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;;;AAGF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;;;;;;ACxDA;;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;AACA;AACA;AACA;;AAEA;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;;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;;AAEA;;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;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,EAAE;;AAEF;;AAEA;;AAEA;;;;;;;AC/LA;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;;AAEA;;AAEA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oFAAoF;AACpF,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,mEAAmE;AACnE,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;;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;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA,EAAE;;AAEF;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;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;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;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;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,GAAG;AACH;AACA;AACA;;AAEA,EAAE;AACF;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,kCAAkC;AACvF,IAAI;;AAEJ;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL,IAAI;AACJ;AACA;AACA,IAAI;AACJ,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,IAAI;;AAEJ;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;;AAEJ,GAAG;;AAEH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA,GAAG;;;AAGH;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;;AAEA;AACA;;AAEA;;;;;;;ACxmBA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,4CAA4C,mBAAmB;AAC/D;AACA;;AAEA;AACA;AACA;AACA,4CAA4C,wCAAwC;AACpF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;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;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,iCAAiC,oBAAoB;;AAErD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,EAAE;;AAEF;;AAEA;;AAEA;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,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,YAAY,YAAY;AACxB;AACA;AACA;;AAEA;AACA;;AAEA;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;;;;;;;AC1eA;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;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;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;;;;;;;AC5HA,gD;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,gDAAgD;AAChD;AACA,EAAE;;AAEF;;;AAGA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,IAAI;;AAEJ,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA,yCAAyC;AACzC,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA,EAAE;AACF;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;;AAEA,kDAAkD;AAClD;AACA;AACA;;AAEA,qCAAqC;AACrC,uCAAuC;AACvC;;AAEA;;AAEA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,GAAG;;;;AAIH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;;AAEA;;AAEA;AACA;;;;;;;ACpWA;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;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;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;;AAEA;AACA;AACA,EAAE;AACF;AACA,EAAE,OAAO;AACT;AACA;;AAEA,kBAAkB;AAClB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACvHA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;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;;;;;;;AC9NA;;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;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;;;;;;;AC7GA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;;;AAGA;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,6CAA6C;AAC7C;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;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;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;;;;;;ACzJA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,0BAA0B,EAAE;AACtD;;AAEA;AACA,0BAA0B,0BAA0B,EAAE;AACtD;;AAEA;;AAEA;;;AAGA,EAAE;;AAEF;AACA;;AAEA;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;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;;;;;;ACtIA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,mBAAmB;AACxD,EAAE;AACF;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA,6DAA6D;AAC7D;AACA;;AAEA;AACA;AACA;AACA,kCAAkC,gBAAgB;AAClD,GAAG;AACH;AACA;;AAEA;AACA,6DAA6D;AAC7D;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA,6DAA6D;AAC7D;AACA;;AAEA;AACA;AACA;AACA,iCAAiC;AACjC,GAAG;AACH;AACA;;AAEA;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;AACA;AACA;;AAEA;;;;;;;ACzLA,2DAA2D,kDAAkD,6BAA6B;AAC1I,gD;;;;;;;ACDA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;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_45__, __WEBPACK_EXTERNAL_MODULE_14__) {\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 = 47);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 23c5bd6142f634f3e8a0","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//-- Parse the different parts of a url, returning a object\nfunction uri(url){\n\tvar uri = {\n\t\t\t\tprotocol : '',\n\t\t\t\thost : '',\n\t\t\t\tpath : '',\n\t\t\t\torigin : '',\n\t\t\t\tdirectory : '',\n\t\t\t\tbase : '',\n\t\t\t\tfilename : '',\n\t\t\t\textension : '',\n\t\t\t\tfragment : '',\n\t\t\t\thref : url\n\t\t\t},\n\t\t\tdoubleSlash = url.indexOf('://'),\n\t\t\tsearch = url.indexOf('?'),\n\t\t\tfragment = url.indexOf(\"#\"),\n\t\t\twithoutProtocol,\n\t\t\tdot,\n\t\t\tfirstSlash;\n\n\tif(fragment != -1) {\n\t\turi.fragment = url.slice(fragment + 1);\n\t\turl = url.slice(0, fragment);\n\t}\n\n\tif(search != -1) {\n\t\turi.search = url.slice(search + 1);\n\t\turl = url.slice(0, search);\n\t\thref = url;\n\t}\n\n\tif(doubleSlash != -1) {\n\t\turi.protocol = url.slice(0, doubleSlash);\n\t\twithoutProtocol = url.slice(doubleSlash+3);\n\t\tfirstSlash = withoutProtocol.indexOf('/');\n\n\t\tif(firstSlash === -1) {\n\t\t\turi.host = uri.path;\n\t\t\turi.path = \"\";\n\t\t} else {\n\t\t\turi.host = withoutProtocol.slice(0, firstSlash);\n\t\t\turi.path = withoutProtocol.slice(firstSlash);\n\t\t}\n\n\n\t\turi.origin = uri.protocol + \"://\" + uri.host;\n\n\t\turi.directory = folder(uri.path);\n\n\t\turi.base = uri.origin + uri.directory;\n\t\t// return origin;\n\t} else {\n\t\turi.path = url;\n\t\turi.directory = folder(url);\n\t\turi.base = uri.directory;\n\t}\n\n\t//-- Filename\n\turi.filename = url.replace(uri.base, '');\n\tdot = uri.filename.lastIndexOf('.');\n\tif(dot != -1) {\n\t\turi.extension = uri.filename.slice(dot+1);\n\t}\n\treturn uri;\n};\n\n//-- Parse out the folder, will return everything before the last slash\nfunction folder(url){\n\n\tvar lastSlash = url.lastIndexOf('/');\n\n\tif(lastSlash == -1) var folder = '';\n\n\tfolder = url.slice(0, lastSlash + 1);\n\n\treturn folder;\n\n};\n*/\n\nfunction extension(_url) {\n\tvar url;\n\tvar pathname;\n\tvar ext;\n\n\ttry {\n\t\turl = new Url(url);\n\t\tpathname = url.pathname;\n\t} catch (e) {\n\t\tpathname = _url;\n\t}\n\n\text = path.extname(pathname);\n\tif (ext) {\n\t\treturn ext.slice(1);\n\t}\n\n\treturn '';\n}\n\nfunction directory(_url) {\n\tvar url;\n\tvar pathname;\n\tvar ext;\n\n\ttry {\n\t\turl = new Url(url);\n\t\tpathname = url.pathname;\n\t} catch (e) {\n\t\tpathname = _url;\n\t}\n\n\treturn path.dirname(pathname);\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// 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) {\n\t\tvar parts = str.match(/[^'\"]+|['\"]/g);\n\t\tparts = parts.map(function(part){\n\t\t\t\tif (part === \"'\") {\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\nfunction defer() {\n\t// From: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred#backwards_forwards_compatible\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\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\nmodule.exports = {\n\t// 'uri': uri,\n\t// 'folder': folder,\n\t'extension' : extension,\n\t'directory' : directory,\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};\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\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 = 2\n// module chunks = 0","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe =\n /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\nvar splitPath = function(filename) {\n return splitPathRe.exec(filename).slice(1);\n};\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\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 = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function(path) {\n var result = splitPath(path),\n root = result[0],\n dir = result[1];\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.';\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.substr(0, dir.length - 1);\n }\n\n return root + dir;\n};\n\n\nexports.basename = function(path, ext) {\n var f = splitPath(path)[2];\n // TODO: make this comparison case-insensitive on windows?\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\n\nexports.extname = function(path) {\n return splitPath(path)[3];\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/path-browserify/index.js\n// module id = 3\n// module chunks = 0","var core = require('./core');\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\t// uri = new URI(url);\n\t\t// type = uri.suffix();\n\t\ttype = core.extension(url);\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 = 4\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 = 5\n// module chunks = 0 1","//-- 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\n// this.content = new EPUBJS.Hook();\n// this.content.register(function(){});\n// this.content.trigger(args).then(function(){});\n\nfunction Hook(context){\n\tthis.context = context || this;\n\tthis.hooks = [];\n};\n\n// Adds a function to be run before a hook completes\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// Triggers a hook to run all functions\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 = 6\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 = 7\n// module chunks = 0","var core = require('./core');\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// Add an item to the queue\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// Run one item\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// Run all sequentially, at convince\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// Flush all, as quickly as possible\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// Clear all items in wait\nQueue.prototype.clear = function(){\n\tthis._q = [];\n\tthis.running = false;\n};\n\nQueue.prototype.length = function(){\n\treturn this._q.length;\n};\n\nQueue.prototype.pause = function(){\n\tthis.paused = true;\n};\n\n// Create a new task from a callback\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 = 8\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 = 9\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 = 10\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');\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, //-- overridden by spread: none (never) / both (always),\n\t\tuseBase64: true\n\t});\n\n\tcore.extend(this.settings, options);\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//-- Adds Hook methods to the Rendition prototype\n\tthis.hooks = {};\n\tthis.hooks.display = new Hook(this);\n\tthis.hooks.serialize = new Hook(this);\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\t// this.starting = new core.defer();\n\t// this.started = this.starting.promise;\n\tthis.q.enqueue(this.start);\n\n\tif(this.book.unarchived) {\n\t\tthis.q.enqueue(this.replacements.bind(this));\n\t}\n\n};\n\nRendition.prototype.setManager = function(manager) {\n\tthis.manager = manager;\n};\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\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\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.request,\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\t// this.starting.resolve();\n};\n\n// Call to attach the container to an element in the dom\n// Container must be attached before rendering can begin\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\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\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\nRendition.prototype.afterDisplayed = function(view){\n\tthis.hooks.content.trigger(view, this);\n\tthis.emit(\"rendered\", view.section);\n\tthis.reportLocation();\n};\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\nRendition.prototype.moveTo = function(offset){\n\tthis.manager.moveTo(offset);\n};\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\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\nRendition.prototype.determineLayoutProperties = function(metadata){\n\tvar settings;\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\tsettings = {\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 settings;\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// paginated | scrolled\n// (scrolled-continuous vs scrolled-doc are handled by different view managers)\nRendition.prototype.flow = function(_flow){\n\tvar flow;\n\tif (_flow === \"scrolled-doc\" || _flow === \"scrolled-continuous\") {\n\t\tflow = \"scrolled\";\n\t}\n\n\tif (_flow === \"auto\" || _flow === \"paginated\") {\n\t\tflow = \"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// reflowable | pre-paginated\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// none | auto (TODO: implement landscape, portrait, both)\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\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\nRendition.prototype.destroy = function(){\n\t// Clear the queue\n\tthis.q.clear();\n\n\tthis.manager.destroy();\n};\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\nRendition.prototype.triggerViewEvent = function(e){\n\tthis.emit(e.type, e);\n};\n\nRendition.prototype.triggerSelectedEvent = function(cfirange){\n\tthis.emit(\"selected\", cfirange);\n};\n\nRendition.prototype.replacements = function(){\n\t// Wait for loading\n\t// return this.q.enqueue(function () {\n\t\t// Get thes books manifest\n\t\tvar manifest = this.book.package.manifest;\n\t\tvar manifestArray = Object.keys(manifest).\n\t\t\tmap(function (key){\n\t\t\t\treturn manifest[key];\n\t\t\t});\n\n\t\t// Exclude HTML\n\t\tvar items = manifestArray.\n\t\t\tfilter(function (item){\n\t\t\t\tif (item.type != \"application/xhtml+xml\" &&\n\t\t\t\t\t\titem.type != \"text/html\") {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t});\n\n\t\t// Only CSS\n\t\tvar css = items.\n\t\t\tfilter(function (item){\n\t\t\t\tif (item.type === \"text/css\") {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t});\n\n\t\t// Css Urls\n\t\tvar cssUrls = css.map(function(item) {\n\t\t\treturn item.href;\n\t\t});\n\n\t\t// All Assets Urls\n\t\tvar urls = items.\n\t\t\tmap(function(item) {\n\t\t\t\treturn item.href;\n\t\t\t}.bind(this));\n\n\t\t// Create blob urls for all the assets\n\t\tvar processing = urls.\n\t\t\tmap(function(url) {\n\t\t\t\t// var absolute = new URL(url, this.book.baseUrl).toString();\n\t\t\t\tvar absolute = path.resolve(this.book.basePath, url);\n\t\t\t\t// Full url from archive base\n\t\t\t\treturn this.book.unarchived.createUrl(absolute, {\"base64\": this.settings.useBase64});\n\t\t\t}.bind(this));\n\n\t\tvar replacementUrls;\n\n\t\t// After all the urls are created\n\t\treturn Promise.all(processing)\n\t\t\t.then(function(_replacementUrls) {\n\t\t\t\tvar replaced = [];\n\n\t\t\t\treplacementUrls = _replacementUrls;\n\n\t\t\t\t// Replace Asset Urls in the text of all css files\n\t\t\t\tcssUrls.forEach(function(href) {\n\t\t\t\t\treplaced.push(this.replaceCss(href, urls, replacementUrls));\n\t\t\t\t}.bind(this));\n\n\t\t\t\treturn Promise.all(replaced);\n\n\t\t\t}.bind(this))\n\t\t\t.then(function () {\n\t\t\t\t// Replace Asset Urls in chapters\n\t\t\t\t// by registering a hook after the sections contents has been serialized\n\t\t\t\tthis.book.spine.hooks.serialize.register(function(output, section) {\n\n\t\t\t\t\tthis.replaceAssets(section, urls, replacementUrls);\n\n\t\t\t\t}.bind(this));\n\n\t\t\t}.bind(this))\n\t\t\t.catch(function(reason){\n\t\t\t\tconsole.error(reason);\n\t\t\t});\n\t// }.bind(this));\n};\n\nRendition.prototype.replaceCss = function(href, urls, replacementUrls){\n\t\tvar newUrl;\n\t\tvar indexInUrls;\n\n\t\t// Find the absolute url of the css file\n\t\t// var fileUri = URI(href);\n\t\t// var absolute = fileUri.absoluteTo(this.book.baseUrl).toString();\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 fileUri;\n\t\tvar absolute;\n\t\tif (this.book.baseUrl) {\n\t\t\tfileUri = new URL(href, this.book.baseUrl);\n\t\t\tabsolute = fileUri.toString();\n\t\t} else {\n\t\t\tabsolute = path.resolve(this.book.basePath, href);\n\t\t}\n\n\n\t\t// Get the text of the css file from the archive\n\t\tvar textResponse = this.book.unarchived.getText(absolute);\n\t\t// Get asset links relative to css file\n\t\tvar relUrls = urls.\n\t\t\tmap(function(assetHref) {\n\t\t\t\t// var assetUri = URI(assetHref).absoluteTo(this.book.baseUrl);\n\t\t\t\t// var relative = assetUri.relativeTo(absolute).toString();\n\n\t\t\t\tvar assetUrl;\n\t\t\t\tvar relativeUrl;\n\t\t\t\tif (this.book.baseUrl) {\n\t\t\t\t\tassetUrl = new URL(assetHref, this.book.baseUrl);\n\t\t\t\t\trelative = path.relative(path.dirname(fileUri.pathname), assetUrl.pathname);\n\t\t\t\t} else {\n\t\t\t\t\tassetUrl = path.resolve(this.book.basePath, assetHref);\n\t\t\t\t\trelative = path.relative(path.dirname(absolute), assetUrl);\n\t\t\t\t}\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, replacementUrls);\n\n\t\t\t// Get the new url\n\t\t\tif (this.settings.useBase64) {\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\t// switch the url in the replacementUrls\n\t\t\tindexInUrls = urls.indexOf(href);\n\t\t\tif (indexInUrls > -1) {\n\t\t\t\treplacementUrls[indexInUrls] = newUrl;\n\t\t\t}\n\n\t\t\treturn new Promise(function(resolve, reject){\n\t\t\t\tresolve(urls, replacementUrls);\n\t\t\t});\n\n\t\t}.bind(this));\n\n};\n\nRendition.prototype.replaceAssets = function(section, urls, replacementUrls){\n\t// var fileUri = URI(section.url);\n\tvar fileUri;\n\tvar absolute;\n\tif (this.book.baseUrl) {\n\t\tfileUri = new URL(section.url, this.book.baseUrl);\n\t\tabsolute = fileUri.toString();\n\t} else {\n\t\tabsolute = path.resolve(this.book.basePath, section.url);\n\t}\n\n\t// Get Urls relative to current sections\n\tvar relUrls = urls.\n\t\tmap(function(href) {\n\t\t\t// var assetUri = URI(href).absoluteTo(this.book.baseUrl);\n\t\t\t// var relative = assetUri.relativeTo(fileUri).toString();\n\n\t\t\tvar assetUrl;\n\t\t\tvar relativeUrl;\n\t\t\tif (this.book.baseUrl) {\n\t\t\t\tassetUrl = new URL(href, this.book.baseUrl);\n\t\t\t\trelative = path.relative(path.dirname(fileUri.pathname), assetUrl.pathname);\n\t\t\t} else {\n\t\t\t\tassetUrl = path.resolve(this.book.basePath, href);\n\t\t\t\trelative = path.relative(path.dirname(absolute), assetUrl);\n\t\t\t}\n\n\t\t\treturn relative;\n\t\t}.bind(this));\n\n\n\tsection.output = replace.substitute(section.output, relUrls, replacementUrls);\n};\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\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 = 11\n// module chunks = 0","var path = require('path');\nvar core = require('./core');\nvar EpubCFI = require('./epubcfi');\n\n\nfunction Parser(){};\n\nParser.prototype.container = function(containerXml){\n\t\t//-- \n\t\tvar rootfile, fullpath, folder, encoding;\n\n\t\tif(!containerXml) {\n\t\t\tconsole.error(\"Container File Not Found\");\n\t\t\treturn;\n\t\t}\n\n\t\trootfile = core.qs(containerXml, \"rootfile\");\n\n\t\tif(!rootfile) {\n\t\t\tconsole.error(\"No RootFile Found\");\n\t\t\treturn;\n\t\t}\n\n\t\tfullpath = rootfile.getAttribute('full-path');\n\t\tfolder = path.dirname(fullpath);\n\t\tencoding = containerXml.xmlEncoding;\n\n\t\t//-- Now that we have the path we can parse the contents\n\t\treturn {\n\t\t\t'packagePath' : fullpath,\n\t\t\t'basePath' : folder,\n\t\t\t'encoding' : encoding\n\t\t};\n};\n\nParser.prototype.identifier = function(packageXml){\n\tvar metadataNode;\n\n\tif(!packageXml) {\n\t\tconsole.error(\"Package File Not Found\");\n\t\treturn;\n\t}\n\n\tmetadataNode = core.qs(packageXml, \"metadata\");\n\n\tif(!metadataNode) {\n\t\tconsole.error(\"No Metadata Found\");\n\t\treturn;\n\t}\n\n\treturn this.getElementText(metadataNode, \"identifier\");\n};\n\nParser.prototype.packageContents = function(packageXml){\n\tvar parse = this;\n\tvar metadataNode, manifestNode, spineNode;\n\tvar manifest, navPath, ncxPath, coverPath;\n\tvar spineNodeIndex;\n\tvar spine;\n\tvar spineIndexByURL;\n\tvar metadata;\n\n\tif(!packageXml) {\n\t\tconsole.error(\"Package File Not Found\");\n\t\treturn;\n\t}\n\n\tmetadataNode = core.qs(packageXml, \"metadata\");\n\tif(!metadataNode) {\n\t\tconsole.error(\"No Metadata Found\");\n\t\treturn;\n\t}\n\n\tmanifestNode = core.qs(packageXml, \"manifest\");\n\tif(!manifestNode) {\n\t\tconsole.error(\"No Manifest Found\");\n\t\treturn;\n\t}\n\n\tspineNode = core.qs(packageXml, \"spine\");\n\tif(!spineNode) {\n\t\tconsole.error(\"No Spine Found\");\n\t\treturn;\n\t}\n\n\tmanifest = parse.manifest(manifestNode);\n\tnavPath = parse.findNavPath(manifestNode);\n\tncxPath = parse.findNcxPath(manifestNode, spineNode);\n\tcoverPath = parse.findCoverPath(packageXml);\n\n\tspineNodeIndex = Array.prototype.indexOf.call(spineNode.parentNode.childNodes, spineNode);\n\n\tspine = parse.spine(spineNode, manifest);\n\n\tmetadata = parse.metadata(metadataNode);\n\n\tmetadata.direction = spineNode.getAttribute(\"page-progression-direction\");\n\n\treturn {\n\t\t'metadata' : metadata,\n\t\t'spine' : spine,\n\t\t'manifest' : manifest,\n\t\t'navPath' : navPath,\n\t\t'ncxPath' : ncxPath,\n\t\t'coverPath': coverPath,\n\t\t'spineNodeIndex' : spineNodeIndex\n\t};\n};\n\n//-- Find TOC NAV\nParser.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//-- Find TOC NCX: media-type=\"application/x-dtbncx+xml\" href=\"toc.ncx\"\nParser.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//-- Expanded to match Readium web components\nParser.prototype.metadata = function(xml){\n\tvar metadata = {},\n\t\t\tp = this;\n\n\tmetadata.title = p.getElementText(xml, 'title');\n\tmetadata.creator = p.getElementText(xml, 'creator');\n\tmetadata.description = p.getElementText(xml, 'description');\n\n\tmetadata.pubdate = p.getElementText(xml, 'date');\n\n\tmetadata.publisher = p.getElementText(xml, 'publisher');\n\n\tmetadata.identifier = p.getElementText(xml, \"identifier\");\n\tmetadata.language = p.getElementText(xml, \"language\");\n\tmetadata.rights = p.getElementText(xml, \"rights\");\n\n\tmetadata.modified_date = p.getPropertyText(xml, 'dcterms:modified');\n\n\tmetadata.layout = p.getPropertyText(xml, \"rendition:layout\");\n\tmetadata.orientation = p.getPropertyText(xml, 'rendition:orientation');\n\tmetadata.flow = p.getPropertyText(xml, 'rendition:flow');\n\tmetadata.viewport = p.getPropertyText(xml, 'rendition:viewport');\n\t// metadata.page_prog_dir = packageXml.querySelector(\"spine\").getAttribute(\"page-progression-direction\");\n\n\treturn metadata;\n};\n\n//-- Find Cover: \n//-- Fallback for Epub 2.0\nParser.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\nParser.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\nParser.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\nParser.prototype.querySelectorText = function(xml, q){\n\tvar el = xml.querySelector(q);\n\n\tif(el && el.childNodes.length){\n\t\treturn el.childNodes[0].nodeValue;\n\t}\n\n\treturn '';\n};\n\nParser.prototype.manifest = 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\nParser.prototype.spine = 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\nParser.prototype.querySelectorByType = function(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 = core.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\nParser.prototype.nav = function(navHtml, spineIndexByURL, bookSpine){\n\tvar navElement = this.querySelectorByType(navHtml, \"nav\", \"toc\");\n\t// var navItems = navElement ? navElement.querySelectorAll(\"ol li\") : [];\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], spineIndexByURL, bookSpine);\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\nParser.prototype.navItem = function(item, spineIndexByURL, bookSpine){\n\tvar id = item.getAttribute('id') || false,\n\t\t\t// content = item.querySelector(\"a, span\"),\n\t\t\tcontent = core.qs(item, \"a\"),\n\t\t\tsrc = content.getAttribute('href') || '',\n\t\t\ttext = content.textContent || \"\",\n\t\t\t// split = src.split(\"#\"),\n\t\t\t// baseUrl = split[0],\n\t\t\t// spinePos = spineIndexByURL[baseUrl],\n\t\t\t// spineItem = bookSpine[spinePos],\n\t\t\tsubitems = [],\n\t\t\tparentNode = item.parentNode,\n\t\t\tparent;\n\t\t\t// cfi = spineItem ? spineItem.cfi : '';\n\n\tif(parentNode && parentNode.nodeName === \"navPoint\") {\n\t\tparent = parentNode.getAttribute('id');\n\t}\n\n\t/*\n\tif(!id) {\n\t\tif(spinePos) {\n\t\t\tspineItem = bookSpine[spinePos];\n\t\t\tid = spineItem.id;\n\t\t\tcfi = spineItem.cfi;\n\t\t} else {\n\t\t\tid = 'epubjs-autogen-toc-id-' + EPUBJS.core.uuid();\n\t\t\titem.setAttribute('id', id);\n\t\t}\n\t}\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\nParser.prototype.ncx = function(tocXml, spineIndexByURL, bookSpine){\n\t// var navPoints = tocXml.querySelectorAll(\"navMap navPoint\");\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], spineIndexByURL, bookSpine);\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\nParser.prototype.ncxItem = function(item, spineIndexByURL, bookSpine){\n\tvar id = item.getAttribute('id') || false,\n\t\t\t// content = item.querySelector(\"content\"),\n\t\t\tcontent = core.qs(item, \"content\"),\n\t\t\tsrc = content.getAttribute('src'),\n\t\t\t// navLabel = item.querySelector(\"navLabel\"),\n\t\t\tnavLabel = core.qs(item, \"navLabel\"),\n\t\t\ttext = navLabel.textContent ? navLabel.textContent : \"\",\n\t\t\t// split = src.split(\"#\"),\n\t\t\t// baseUrl = split[0],\n\t\t\t// spinePos = spineIndexByURL[baseUrl],\n\t\t\t// spineItem = bookSpine[spinePos],\n\t\t\tsubitems = [],\n\t\t\tparentNode = item.parentNode,\n\t\t\tparent;\n\t\t\t// cfi = spineItem ? spineItem.cfi : '';\n\n\tif(parentNode && parentNode.nodeName === \"navPoint\") {\n\t\tparent = parentNode.getAttribute('id');\n\t}\n\n\t/*\n\tif(!id) {\n\t\tif(spinePos) {\n\t\t\tspineItem = bookSpine[spinePos];\n\t\t\tid = spineItem.id;\n\t\t\tcfi = spineItem.cfi;\n\t\t} else {\n\t\t\tid = 'epubjs-autogen-toc-id-' + EPUBJS.core.uuid();\n\t\t\titem.setAttribute('id', id);\n\t\t}\n\t}\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\nParser.prototype.pageList = function(navHtml, spineIndexByURL, bookSpine){\n\tvar navElement = this.querySelectorByType(navHtml, \"nav\", \"page-list\");\n\t// var navItems = navElement ? navElement.querySelectorAll(\"ol li\") : [];\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.pageListItem(navItems[i], spineIndexByURL, bookSpine);\n\t\tlist.push(item);\n\t}\n\n\treturn list;\n};\n\nParser.prototype.pageListItem = function(item, spineIndexByURL, bookSpine){\n\tvar id = item.getAttribute('id') || false,\n\t\t// content = item.querySelector(\"a\"),\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\nmodule.exports = Parser;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/parser.js\n// module id = 12\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 linkUrl;\n\t\tvar linkPath;\n\t\tvar relative;\n\n\t\tif (this.book.baseUrl) {\n\t\t\tlinkUrl = new URL(href, this.book.baseUrl);\n\t\t\trelative = path.relative(path.dirname(linkUrl.pathname), this.book.packagePath);\n\t\t} else {\n\t\t\tlinkPath = path.resolve(this.book.basePath, href);\n\t\t\trelative = path.relative(this.book.packagePath, linkPath);\n\t\t}\n\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 = 13\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_14__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"xmldom\"\n// module id = 14\n// module chunks = 0","var EventEmitter = require('event-emitter');\nvar path = require('path');\nvar core = require('./core');\nvar Spine = require('./spine');\nvar Locations = require('./locations');\nvar Parser = require('./parser');\nvar Navigation = require('./navigation');\nvar Rendition = require('./rendition');\nvar Unarchive = require('./unarchive');\nvar request = require('./request');\nvar EpubCFI = require('./epubcfi');\n\nfunction Book(_url, options){\n\n\tthis.settings = core.extend(this.settings || {}, {\n\t\trequestMethod: this.requestMethod\n\t});\n\n\tcore.extend(this.settings, options);\n\n\n\t// Promises\n\tthis.opening = new core.defer();\n\tthis.opened = this.opening.promise;\n\tthis.isOpen = false;\n\n\tthis.url = undefined;\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};\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};\n\n\t// this.ready = RSVP.hash(this.loaded);\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.pageList ]);\n\n\n\t// Queue for methods used before opening\n\tthis.isRendered = false;\n\t// this._q = core.queue(this);\n\n\tthis.request = this.settings.requestMethod.bind(this);\n\n\tthis.spine = new Spine(this.request);\n\tthis.locations = new Locations(this.spine, this.request);\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\n\t\t\tthis.emit(\"loadFailed\", error);\n\t\t}.bind(this));\n\t}\n};\n\nBook.prototype.open = function(_url, options){\n\tvar url;\n\tvar pathname;\n\tvar parse = new Parser();\n\tvar epubPackage;\n\tvar epubContainer;\n\tvar book = this;\n\tvar containerPath = \"META-INF/container.xml\";\n\tvar location;\n\tvar isArrayBuffer = false;\n\tvar isBase64 = options && options.base64;\n\n\tif(!_url) {\n\t\tthis.opening.resolve(this);\n\t\treturn this.opened;\n\t}\n\n\t// Reuse parsed url or create a new uri object\n\t// if(typeof(_url) === \"object\") {\n\t// uri = _url;\n\t// } else {\n\t// uri = core.uri(_url);\n\t// }\n\tif (_url instanceof ArrayBuffer || isBase64) {\n\t\tisArrayBuffer = true;\n\t\tthis.url = '/';\n\t}\n\n\tif (window && window.location && !isArrayBuffer) {\n\t\t// absoluteUri = uri.absoluteTo(window.location.href);\n\t\turl = new URL(_url, window.location.href);\n\t\tpathname = url.pathname;\n\t\t// this.url = absoluteUri.toString();\n\t\tthis.url = url.toString();\n\t} else if (window && window.location) {\n\t\tthis.url = window.location.href;\n\t} else {\n\t\tthis.url = _url;\n\t}\n\n\t// Find path to the Container\n\t// if(uri && uri.suffix() === \"opf\") {\n\tif(url && core.extension(pathname) === \"opf\") {\n\t\t// Direct link to package, no container\n\t\tthis.packageUrl = _url;\n\t\tthis.containerUrl = '';\n\n\t\tif(url.origin) {\n\t\t\t// this.baseUrl = uri.origin() + uri.directory() + \"/\";\n\t\t\tthis.baseUrl = url.origin + path.dirname(pathname) + \"/\";\n\t\t// } else if(absoluteUri){\n\t\t// \tthis.baseUrl = absoluteUri.origin();\n\t\t// \tthis.baseUrl += absoluteUri.directory() + \"/\";\n\t\t} else {\n\t\t\tthis.baseUrl = path.dirname(pathname) + \"/\";\n\t\t}\n\n\t\tepubPackage = this.request(this.packageUrl)\n\t\t\t.catch(function(error) {\n\t\t\t\tbook.opening.reject(error);\n\t\t\t});\n\n\t} else if(isArrayBuffer || isBase64 || this.isArchivedUrl(_url)) {\n\t\t// Book is archived\n\t\tthis.url = '';\n\t\t// this.containerUrl = URI(containerPath).absoluteTo(this.url).toString();\n\t\tthis.containerUrl = path.resolve(\"\", containerPath);\n\n\t\tepubContainer = this.unarchive(_url, isBase64).\n\t\t\tthen(function() {\n\t\t\t\treturn this.request(this.containerUrl);\n\t\t\t}.bind(this))\n\t\t\t.catch(function(error) {\n\t\t\t\tbook.opening.reject(error);\n\t\t\t});\n\t}\n\t// Find the path to the Package from the container\n\telse if (!core.extension(pathname)) {\n\n\t\tthis.containerUrl = this.url + containerPath;\n\n\t\tepubContainer = this.request(this.containerUrl)\n\t\t\t.catch(function(error) {\n\t\t\t\t// handle errors in loading container\n\t\t\t\tbook.opening.reject(error);\n\t\t\t});\n\t}\n\n\tif (epubContainer) {\n\t\tepubPackage = epubContainer.\n\t\t\tthen(function(containerXml){\n\t\t\t\treturn parse.container(containerXml); // Container has path to content\n\t\t\t}).\n\t\t\tthen(function(paths){\n\t\t\t\t// var packageUri = URI(paths.packagePath);\n\t\t\t\t// var absPackageUri = packageUri.absoluteTo(book.url);\n\t\t\t\tvar packageUrl;\n\n\t\t\t\tif (book.url) {\n\t\t\t\t\tpackageUrl = new URL(paths.packagePath, book.url);\n\t\t\t\t\tbook.packageUrl = packageUrl.toString();\n\t\t\t\t} else {\n\t\t\t\t\tbook.packageUrl = \"/\" + paths.packagePath;\n\t\t\t\t}\n\n\t\t\t\tbook.packagePath = paths.packagePath;\n\t\t\t\tbook.encoding = paths.encoding;\n\n\t\t\t\t// Set Url relative to the content\n\t\t\t\tif(packageUrl && packageUrl.origin) {\n\t\t\t\t\tbook.baseUrl = book.url + path.dirname(paths.packagePath) + \"/\";\n\t\t\t\t} else {\n\t\t\t\t\tif(path.dirname(paths.packagePath)) {\n\t\t\t\t\t\tbook.baseUrl = \"\"\n\t\t\t\t\t\tbook.basePath = \"/\" + path.dirname(paths.packagePath) + \"/\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbook.basePath = \"/\"\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn book.request(book.packageUrl);\n\t\t\t}).catch(function(error) {\n\t\t\t\t// handle errors in either of the two requests\n\t\t\t\tbook.opening.reject(error);\n\t\t\t});\n\t}\n\n\tepubPackage.then(function(packageXml) {\n\n\t\tif (!packageXml) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Get package information from epub opf\n\t\tbook.unpack(packageXml);\n\n\t\t// Resolve promises\n\t\tbook.loading.manifest.resolve(book.package.manifest);\n\t\tbook.loading.metadata.resolve(book.package.metadata);\n\t\tbook.loading.spine.resolve(book.spine);\n\t\tbook.loading.cover.resolve(book.cover);\n\n\t\tbook.isOpen = true;\n\n\t\t// Clear queue of any waiting book request\n\n\t\t// Resolve book opened promise\n\t\tbook.opening.resolve(book);\n\n\t}).catch(function(error) {\n\t\t// handle errors in parsing the book\n\t\t// console.error(error.message, error.stack);\n\t\tbook.opening.reject(error);\n\t});\n\n\treturn this.opened;\n};\n\nBook.prototype.unpack = function(packageXml){\n\tvar book = this,\n\t\t\tparse = new Parser();\n\n\tbook.package = parse.packageContents(packageXml); // Extract info from contents\n\tif(!book.package) {\n\t\treturn;\n\t}\n\n\tbook.package.baseUrl = book.baseUrl; // Provides a url base for resolving paths\n\tbook.package.basePath = book.basePath; // Provides a url base for resolving paths\n\tconsole.log(\"book.baseUrl\", book.baseUrl );\n\n\tthis.spine.load(book.package);\n\n\tbook.navigation = new Navigation(book.package, this.request);\n\tbook.navigation.load().then(function(toc){\n\t\tbook.toc = toc;\n\t\tbook.loading.navigation.resolve(book.toc);\n\t});\n\n\t// //-- Set Global Layout setting based on metadata\n\t// MOVE TO RENDER\n\t// book.globalLayoutProperties = book.parseLayoutProperties(book.package.metadata);\n\tif (book.baseUrl) {\n\t\tbook.cover = new URL(book.package.coverPath, book.baseUrl).toString();\n\t} else {\n\t\tbook.cover = path.resolve(book.baseUrl, book.package.coverPath);\n\t}\n};\n\n// Alias for book.spine.get\nBook.prototype.section = function(target) {\n\treturn this.spine.get(target);\n};\n\n// Sugar to render a book\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\nBook.prototype.requestMethod = function(_url) {\n\t// Switch request methods\n\tif(this.unarchived) {\n\t\treturn this.unarchived.request(_url);\n\t} else {\n\t\treturn request(_url, null, this.requestCredentials, this.requestHeaders);\n\t}\n\n};\n\nBook.prototype.setRequestCredentials = function(_credentials) {\n\tthis.requestCredentials = _credentials;\n};\n\nBook.prototype.setRequestHeaders = function(_headers) {\n\tthis.requestHeaders = _headers;\n};\n\nBook.prototype.unarchive = function(bookUrl, isBase64){\n\tthis.unarchived = new Unarchive();\n\treturn this.unarchived.open(bookUrl, isBase64);\n};\n\n//-- Checks if url has a .epub or .zip extension, or is ArrayBuffer (of zip/epub)\nBook.prototype.isArchivedUrl = function(bookUrl){\n\tvar extension;\n\n\tif (bookUrl instanceof ArrayBuffer) {\n\t\treturn true;\n\t}\n\n\t// Reuse parsed url or create a new uri object\n\t// if(typeof(bookUrl) === \"object\") {\n\t// uri = bookUrl;\n\t// } else {\n\t// uri = core.uri(bookUrl);\n\t// }\n\t// uri = URI(bookUrl);\n\textension = core.extension(bookUrl);\n\n\tif(extension && (extension == \"epub\" || extension == \"zip\")){\n\t\treturn true;\n\t}\n\n\treturn false;\n};\n\n//-- Returns the cover\nBook.prototype.coverUrl = function(){\n\tvar retrieved = this.loaded.cover.\n\t\tthen(function(url) {\n\t\t\tif(this.unarchived) {\n\t\t\t\treturn this.unarchived.createUrl(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\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\nmodule.exports = Book;\n\n//-- Enable binding events to book\nEventEmitter(Book.prototype);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/book.js\n// module id = 17\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 = 18\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 = 19\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 = 20\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 = 21\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 = 22\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 = 23\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 = 24\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 = 25\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 = 26\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 = 27\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 = 28\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 = 29\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 = 30\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 = 31\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 = 32\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 = 33\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 = 34\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 = 35\n// module chunks = 0","var core = require('./core');\n\nfunction Layout(settings){\n\tthis.name = settings.layout || \"reflowable\";\n\tthis._spread = (settings.spread === \"none\") ? false : true;\n\tthis._minSpreadWidth = settings.spread || 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// paginated | scrolled\nLayout.prototype.flow = function(flow) {\n\tthis._flow = (flow === \"paginated\") ? \"paginated\" : \"scrolled\";\n}\n\n// true | false\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\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\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\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 = 37\n// module chunks = 0","var core = require('./core');\nvar Queue = require('./queue');\nvar EpubCFI = require('./epubcfi');\nvar EventEmitter = require('event-emitter');\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// Load all of sections in the book\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 = 38\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 = 39\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 = 40\n// module chunks = 0","var core = require('./core');\nvar Parser = require('./parser');\nvar path = require('path');\n\nfunction Navigation(_package, _request){\n\tvar navigation = this;\n\tvar parse = new Parser();\n\tvar request = _request || require('./request');\n\n\tthis.package = _package;\n\tthis.toc = [];\n\tthis.tocByHref = {};\n\tthis.tocById = {};\n\n\tif(_package.navPath) {\n\t\tif (_package.baseUrl) {\n\t\t\tthis.navUrl = new URL(_package.navPath, _package.baseUrl).toString();\n\t\t} else {\n\t\t\tthis.navUrl = path.resolve(_package.basePath, _package.navPath);\n\t\t}\n\t\tthis.nav = {};\n\n\t\tthis.nav.load = function(_request){\n\t\t\tvar loading = new core.defer();\n\t\t\tvar loaded = loading.promise;\n\n\t\t\trequest(navigation.navUrl, 'xml').then(function(xml){\n\t\t\t\tnavigation.toc = parse.nav(xml);\n\t\t\t\tnavigation.loaded(navigation.toc);\n\t\t\t\tloading.resolve(navigation.toc);\n\t\t\t});\n\n\t\t\treturn loaded;\n\t\t};\n\n\t}\n\n\tif(_package.ncxPath) {\n\t\tif (_package.baseUrl) {\n\t\t\tthis.ncxUrl = new URL(_package.ncxPath, _package.baseUrl).toString();\n\t\t} else {\n\t\t\tthis.ncxUrl = path.resolve(_package.basePath, _package.ncxPath);\n\t\t}\n\n\t\tthis.ncx = {};\n\n\t\tthis.ncx.load = function(_request){\n\t\t\tvar loading = new core.defer();\n\t\t\tvar loaded = loading.promise;\n\n\t\t\trequest(navigation.ncxUrl, 'xml').then(function(xml){\n\t\t\t\tnavigation.toc = parse.toc(xml);\n\t\t\t\tnavigation.loaded(navigation.toc);\n\t\t\t\tloading.resolve(navigation.toc);\n\t\t\t});\n\n\t\t\treturn loaded;\n\t\t};\n\n\t}\n};\n\n// Load the navigation\nNavigation.prototype.load = function(_request) {\n\tvar request = _request || require('./request');\n\tvar loading, loaded;\n\n\tif(this.nav) {\n\t\tloading = this.nav.load();\n\t} else if(this.ncx) {\n\t\tloading = this.ncx.load();\n\t} else {\n\t\tloaded = new core.defer();\n\t\tloaded.resolve([]);\n\t\tloading = loaded.promise;\n\t}\n\n\treturn loading;\n\n};\n\nNavigation.prototype.loaded = 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// Get an item from the navigation\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\nmodule.exports = Navigation;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/navigation.js\n// module id = 41\n// module chunks = 0","var core = require('./core');\nvar EpubCFI = require('./epubcfi');\nvar Hook = require('./hook');\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\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 = core.directory(this.url);\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\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\t\tconsole.log(window.location.origin + \"/\" +this.url);\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\nSection.prototype.beforeSectionLoad = function(){\n\t// Stub for a hook - replace me for now\n};\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\nSection.prototype.find = function(_query){\n\n};\n\n/**\n* Reconciles the current chapters layout properies with\n* the global layout properities.\n* Takes: global layout settings object, chapter properties string\n* Returns: 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\nSection.prototype.cfiFromRange = function(_range) {\n\treturn new EpubCFI(_range, this.cfiBase).toString();\n};\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 = 42\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\nfunction Spine(_request){\n\tthis.request = _request;\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\nSpine.prototype.load = function(_package) {\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 = this.baseUrl + item.href;\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\t// if(index > 0) {\n\t\t\titem.prev = function(){ return this.get(index-1); }.bind(this);\n\t\t// }\n\n\t\t// if(index+1 < this.items.length) {\n\t\t\titem.next = function(){ return this.get(index+1); }.bind(this);\n\t\t// }\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// book.spine.get();\n// book.spine.get(1);\n// book.spine.get(\"chap1.html\");\n// book.spine.get(\"#id1234\");\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\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\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\nSpine.prototype.insert = function(section, index) {\n\n};\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\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 = 43\n// module chunks = 0","var core = require('./core');\nvar request = require('./request');\nvar mime = require('../libs/mime/mime');\n\nfunction Unarchive() {\n\n\tthis.checkRequirements();\n\tthis.urlCache = {};\n\n}\n\nUnarchive.prototype.checkRequirements = function(callback){\n\ttry {\n\t\tif (typeof JSZip !== 'undefined') {\n\t\t\tthis.zip = new JSZip();\n\t\t} else {\n\t\t\tJSZip = require('jszip');\n\t\t\tthis.zip = new JSZip();\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(\"JSZip lib not loaded\");\n\t}\n};\n\nUnarchive.prototype.open = function(zipUrl, isBase64){\n\tif (zipUrl instanceof ArrayBuffer || isBase64) {\n\t\treturn this.zip.loadAsync(zipUrl, {\"base64\": isBase64});\n\t} else {\n\t\treturn request(zipUrl, \"binary\")\n\t\t\t.then(function(data){\n\t\t\t\treturn this.zip.loadAsync(data);\n\t\t\t}.bind(this));\n\t}\n};\n\nUnarchive.prototype.request = function(url, type){\n\tvar deferred = new core.defer();\n\tvar response;\n\tvar r;\n\n\t// If type isn't set, determine it from the file extension\n\tif(!type) {\n\t\ttype = core.extension(url);\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\nUnarchive.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\nUnarchive.prototype.getBlob = function(url, _mimeType){\n\tvar decodededUrl = window.decodeURIComponent(url.substr(1)); // Remove first slash\n\tvar entry = this.zip.file(decodededUrl);\n\tvar mimeType;\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\nUnarchive.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\nUnarchive.prototype.getBase64 = function(url, _mimeType){\n\tvar decodededUrl = window.decodeURIComponent(url.substr(1)); // Remove first slash\n\tvar entry = this.zip.file(decodededUrl);\n\tvar mimeType;\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\nUnarchive.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\nUnarchive.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 = Unarchive;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/unarchive.js\n// module id = 44\n// module chunks = 0","if(typeof __WEBPACK_EXTERNAL_MODULE_45__ === 'undefined') {var e = new Error(\"Cannot find module \\\"JSZip\\\"\"); e.code = 'MODULE_NOT_FOUND'; throw e;}\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_45__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"JSZip\"\n// module id = 45\n// module chunks = 0","var Book = require('./book');\nvar EpubCFI = require('./epubcfi');\nvar Rendition = require('./rendition');\nvar Contents = require('./contents');\n\nfunction ePub(_url) {\n\treturn new Book(_url);\n};\n\nePub.VERSION = \"0.3.0\";\n\nePub.CFI = EpubCFI;\nePub.Rendition = Rendition;\nePub.Contents = Contents;\n\nePub.ViewManagers = {};\nePub.Views = {};\nePub.register = {\n\tmanager : function(name, manager){\n\t\treturn ePub.ViewManagers[name] = manager;\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 = 47\n// module chunks = 0"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 07404e07252e3f8682e4","webpack:///./src/core.js","webpack:///./src/epubcfi.js","webpack:///./~/event-emitter/index.js","webpack:///./~/path-webpack/path.js","webpack:///./src/request.js","webpack:///./~/process/browser.js","webpack:///./src/hook.js","webpack:///./src/mapping.js","webpack:///./src/queue.js","webpack:///./src/contents.js","webpack:///./src/managers/default/index.js","webpack:///./src/rendition.js","webpack:///./src/parser.js","webpack:///./src/replacements.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/layout.js","webpack:///./src/locations.js","webpack:///./src/managers/helpers/stage.js","webpack:///./src/managers/helpers/views.js","webpack:///./src/navigation.js","webpack:///./src/section.js","webpack:///./src/spine.js","webpack:///./src/unarchive.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;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;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;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;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;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;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;;AAEA;;;;;;;ACznBA;;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;;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;;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,yDAAyD,kBAAkB;AAC3E;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,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;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;;;;;;;ACxJA;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;;AAEA;AACA,qCAAqC;AACrC,+CAA+C;;AAE/C;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,sBAAsB;AACrC;AACA;AACA,GAAG;AACH;AACA,iBAAiB,yBAAyB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;;;AAGF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;;;;;;ACxDA;;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;AACA;AACA;AACA;;AAEA;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;;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;;AAEA;;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;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,EAAE;;AAEF;;AAEA;;AAEA;;;;;;;AC/LA;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;;AAEA;;AAEA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oFAAoF;AACpF,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,mEAAmE;AACnE,EAAE;AACF;AACA;AACA;;AAEA;AACA;;AAEA;;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;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA,EAAE;;AAEF;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;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;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;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;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,GAAG;AACH;AACA;AACA;;AAEA,EAAE;AACF;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,kCAAkC;AACvF,IAAI;;AAEJ;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL,IAAI;AACJ;AACA;AACA,IAAI;AACJ,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,IAAI;;AAEJ;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;;AAEJ,GAAG;;AAEH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA,GAAG;;;AAGH;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;;AAEA;AACA;;AAEA;;;;;;;ACxmBA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,4CAA4C,mBAAmB;AAC/D;AACA;;AAEA;AACA;AACA;AACA,4CAA4C,wCAAwC;AACpF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;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;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,iCAAiC,oBAAoB;;AAErD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,EAAE;;AAEF;;AAEA;;AAEA;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,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,YAAY,YAAY;AACxB;AACA;AACA;;AAEA;AACA;;AAEA;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;;;;;;;AC1eA;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;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;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;;;;;;;AC5HA,gD;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa;AACb,6CAA6C;AAC7C;AACA;;AAEA,gDAAgD;AAChD;AACA,EAAE;;AAEF;;;AAGA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA,eAAe,OAAO;AACtB;AACA;;AAEA;AACA,eAAe,MAAM;AACrB;AACA;;AAEA;AACA,eAAe,UAAU;AACzB;AACA;;AAEA;AACA,eAAe,WAAW;AAC1B;AACA;;AAEA;AACA,aAAa,OAAO;AACpB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB,6CAA6C,gBAAgB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,IAAI;;AAEJ,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA,yCAAyC;AACzC,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA,EAAE;AACF;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA,kDAAkD;AAClD;AACA;AACA;;AAEA,qCAAqC;AACrC,uCAAuC;;AAEvC;;AAEA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,GAAG;;;;AAIH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;;AAEA;;AAEA;AACA;;;;;;;ACjaA;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;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;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;;AAEA;AACA;AACA,EAAE;AACF;AACA,EAAE,OAAO;AACT;AACA;;AAEA,kBAAkB;AAClB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACvHA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;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;;;;;;;AC9NA;;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;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;;;;;;;AC7GA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;;;AAGA;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,6CAA6C;AAC7C;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;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;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;;;;;;ACzJA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,0BAA0B,EAAE;AACtD;;AAEA;AACA,0BAA0B,0BAA0B,EAAE;AACtD;;AAEA;;AAEA;;;AAGA,EAAE;;AAEF;AACA;;AAEA;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;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;;;;;;ACtIA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,mBAAmB;AACxD,EAAE;AACF;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA,6DAA6D;AAC7D;AACA;;AAEA;AACA;AACA;AACA,kCAAkC,gBAAgB;AAClD,GAAG;AACH;AACA;;AAEA;AACA,6DAA6D;AAC7D;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA,6DAA6D;AAC7D;AACA;;AAEA;AACA;AACA;AACA,iCAAiC;AACjC,GAAG;AACH;AACA;;AAEA;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;AACA;AACA;;AAEA;;;;;;;ACvLA,2DAA2D,kDAAkD,6BAA6B;AAC1I,gD;;;;;;;ACDA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,mBAAmB;AAC9B,WAAW,OAAO;AAClB;AACA,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_45__, __WEBPACK_EXTERNAL_MODULE_14__) {\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 = 47);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 07404e07252e3f8682e4","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\n\tthis.href = urlString;\n\tthis.protocol = \"\";\n\tthis.origin = \"\";\n\tthis.fragment = \"\";\n\tthis.search = \"\";\n\tthis.base = baseString || undefined;\n\n\tif (!absolute && !baseString) {\n\t\tthis.base = window && window.location.href;\n\t}\n\n\ttry {\n\t\tthis.Url = new URL(urlString, this.base);\n\t\tthis.href = this.Url.href;\n\n\t\tthis.protocol = this.Url.protocol;\n\t\tthis.origin = this.Url.origin;\n\t\tthis.fragment = this.Url.fragment;\n\t\tthis.search = this.Url.search;\n\t} catch (e) {\n\t\t// console.error(e);\n\t\tthis.Url = undefined;\n\t}\n\n\tthis.Path = new Path(this.Url.pathname);\n\tthis.directory = this.Path.directory;\n\tthis.filename = this.Path.filename;\n\tthis.extension = this.Path.extension;\n\n\tthis.path = this.origin + this.directory;\n\n}\n\nUrl.prototype.resolve = function (what) {\n\tvar fullpath = 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\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.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\tconsole.log(what, this.directory);\n\treturn path.relative(what, this.directory);\n};\n\nPath.prototype.splitPath = function(filename) {\n\treturn this.splitPathRe.exec(filename).slice(1);\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 extension(_url) {\n\tvar url;\n\tvar pathname;\n\tvar ext;\n\n\ttry {\n\t\turl = new Url(url);\n\t\tpathname = url.pathname;\n\t} catch (e) {\n\t\tpathname = _url;\n\t}\n\n\text = path.extname(pathname);\n\tif (ext) {\n\t\treturn ext.slice(1);\n\t}\n\n\treturn '';\n}\n\nfunction directory(_url) {\n\tvar url;\n\tvar pathname;\n\tvar ext;\n\n\ttry {\n\t\turl = new Url(url);\n\t\tpathname = url.pathname;\n\t} catch (e) {\n\t\tpathname = _url;\n\t}\n\n\treturn path.dirname(pathname);\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\nfunction defer() {\n\t// From: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred#backwards_forwards_compatible\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\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\nmodule.exports = {\n\t// 'uri': uri,\n\t// 'folder': folder,\n\t'extension' : extension,\n\t'directory' : directory,\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\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\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 = 2\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 const 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 const dir = pathObject.dir || pathObject.root;\n const 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\nconst 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 const isAbsolute = path.charCodeAt(0) === 47/*/*/;\n const 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 const 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 const 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 = 3\n// module chunks = 0","var core = require('./core');\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\t// uri = new URI(url);\n\t\t// type = uri.suffix();\n\t\ttype = core.extension(url);\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 = 4\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 = 5\n// module chunks = 0 1","//-- 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\n// this.content = new EPUBJS.Hook();\n// this.content.register(function(){});\n// this.content.trigger(args).then(function(){});\n\nfunction Hook(context){\n\tthis.context = context || this;\n\tthis.hooks = [];\n};\n\n// Adds a function to be run before a hook completes\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// Triggers a hook to run all functions\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 = 6\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 = 7\n// module chunks = 0","var core = require('./core');\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// Add an item to the queue\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// Run one item\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// Run all sequentially, at convince\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// Flush all, as quickly as possible\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// Clear all items in wait\nQueue.prototype.clear = function(){\n\tthis._q = [];\n\tthis.running = false;\n};\n\nQueue.prototype.length = function(){\n\treturn this._q.length;\n};\n\nQueue.prototype.pause = function(){\n\tthis.paused = true;\n};\n\n// Create a new task from a callback\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 = 8\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 = 9\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 = 10\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');\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, //-- overridden by spread: none (never) / both (always),\n\t\tuseBase64: true\n\t});\n\n\tcore.extend(this.settings, options);\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//-- Adds Hook methods to the Rendition prototype\n\tthis.hooks = {};\n\tthis.hooks.display = new Hook(this);\n\tthis.hooks.serialize = new Hook(this);\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\t// this.starting = new core.defer();\n\t// this.started = this.starting.promise;\n\tthis.q.enqueue(this.start);\n\n\tif(this.book.unarchived) {\n\t\tthis.q.enqueue(this.replacements.bind(this));\n\t}\n\n};\n\nRendition.prototype.setManager = function(manager) {\n\tthis.manager = manager;\n};\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\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\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.request,\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\t// this.starting.resolve();\n};\n\n// Call to attach the container to an element in the dom\n// Container must be attached before rendering can begin\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\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\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\nRendition.prototype.afterDisplayed = function(view){\n\tthis.hooks.content.trigger(view, this);\n\tthis.emit(\"rendered\", view.section);\n\tthis.reportLocation();\n};\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\nRendition.prototype.moveTo = function(offset){\n\tthis.manager.moveTo(offset);\n};\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\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\nRendition.prototype.determineLayoutProperties = function(metadata){\n\tvar settings;\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\tsettings = {\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 settings;\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// paginated | scrolled\n// (scrolled-continuous vs scrolled-doc are handled by different view managers)\nRendition.prototype.flow = function(_flow){\n\tvar flow;\n\tif (_flow === \"scrolled-doc\" || _flow === \"scrolled-continuous\") {\n\t\tflow = \"scrolled\";\n\t}\n\n\tif (_flow === \"auto\" || _flow === \"paginated\") {\n\t\tflow = \"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// reflowable | pre-paginated\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// none | auto (TODO: implement landscape, portrait, both)\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\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\nRendition.prototype.destroy = function(){\n\t// Clear the queue\n\tthis.q.clear();\n\n\tthis.manager.destroy();\n};\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\nRendition.prototype.triggerViewEvent = function(e){\n\tthis.emit(e.type, e);\n};\n\nRendition.prototype.triggerSelectedEvent = function(cfirange){\n\tthis.emit(\"selected\", cfirange);\n};\n\nRendition.prototype.replacements = function(){\n\t// Wait for loading\n\t// return this.q.enqueue(function () {\n\t\t// Get thes books manifest\n\t\tvar manifest = this.book.package.manifest;\n\t\tvar manifestArray = Object.keys(manifest).\n\t\t\tmap(function (key){\n\t\t\t\treturn manifest[key];\n\t\t\t});\n\n\t\t// Exclude HTML\n\t\tvar items = manifestArray.\n\t\t\tfilter(function (item){\n\t\t\t\tif (item.type != \"application/xhtml+xml\" &&\n\t\t\t\t\t\titem.type != \"text/html\") {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t});\n\n\t\t// Only CSS\n\t\tvar css = items.\n\t\t\tfilter(function (item){\n\t\t\t\tif (item.type === \"text/css\") {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t});\n\n\t\t// Css Urls\n\t\tvar cssUrls = css.map(function(item) {\n\t\t\treturn item.href;\n\t\t});\n\n\t\t// All Assets Urls\n\t\tvar urls = items.\n\t\t\tmap(function(item) {\n\t\t\t\treturn item.href;\n\t\t\t}.bind(this));\n\n\t\t// Create blob urls for all the assets\n\t\tvar processing = urls.\n\t\t\tmap(function(url) {\n\t\t\t\t// var absolute = new URL(url, this.book.baseUrl).toString();\n\t\t\t\tvar absolute = path.resolve(this.book.basePath, url);\n\t\t\t\t// Full url from archive base\n\t\t\t\treturn this.book.unarchived.createUrl(absolute, {\"base64\": this.settings.useBase64});\n\t\t\t}.bind(this));\n\n\t\tvar replacementUrls;\n\n\t\t// After all the urls are created\n\t\treturn Promise.all(processing)\n\t\t\t.then(function(_replacementUrls) {\n\t\t\t\tvar replaced = [];\n\n\t\t\t\treplacementUrls = _replacementUrls;\n\n\t\t\t\t// Replace Asset Urls in the text of all css files\n\t\t\t\tcssUrls.forEach(function(href) {\n\t\t\t\t\treplaced.push(this.replaceCss(href, urls, replacementUrls));\n\t\t\t\t}.bind(this));\n\n\t\t\t\treturn Promise.all(replaced);\n\n\t\t\t}.bind(this))\n\t\t\t.then(function () {\n\t\t\t\t// Replace Asset Urls in chapters\n\t\t\t\t// by registering a hook after the sections contents has been serialized\n\t\t\t\tthis.book.spine.hooks.serialize.register(function(output, section) {\n\n\t\t\t\t\tthis.replaceAssets(section, urls, replacementUrls);\n\n\t\t\t\t}.bind(this));\n\n\t\t\t}.bind(this))\n\t\t\t.catch(function(reason){\n\t\t\t\tconsole.error(reason);\n\t\t\t});\n\t// }.bind(this));\n};\n\nRendition.prototype.replaceCss = function(href, urls, replacementUrls){\n\t\tvar newUrl;\n\t\tvar indexInUrls;\n\n\t\t// Find the absolute url of the css file\n\t\t// var fileUri = URI(href);\n\t\t// var absolute = fileUri.absoluteTo(this.book.baseUrl).toString();\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 fileUri;\n\t\tvar absolute;\n\t\tif (this.book.baseUrl) {\n\t\t\tfileUri = new URL(href, this.book.baseUrl);\n\t\t\tabsolute = fileUri.toString();\n\t\t} else {\n\t\t\tabsolute = path.resolve(this.book.basePath, href);\n\t\t}\n\n\n\t\t// Get the text of the css file from the archive\n\t\tvar textResponse = this.book.unarchived.getText(absolute);\n\t\t// Get asset links relative to css file\n\t\tvar relUrls = urls.\n\t\t\tmap(function(assetHref) {\n\t\t\t\t// var assetUri = URI(assetHref).absoluteTo(this.book.baseUrl);\n\t\t\t\t// var relative = assetUri.relativeTo(absolute).toString();\n\n\t\t\t\tvar assetUrl;\n\t\t\t\tvar relativeUrl;\n\t\t\t\tif (this.book.baseUrl) {\n\t\t\t\t\tassetUrl = new URL(assetHref, this.book.baseUrl);\n\t\t\t\t\trelative = path.relative(path.dirname(fileUri.pathname), assetUrl.pathname);\n\t\t\t\t} else {\n\t\t\t\t\tassetUrl = path.resolve(this.book.basePath, assetHref);\n\t\t\t\t\trelative = path.relative(path.dirname(absolute), assetUrl);\n\t\t\t\t}\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, replacementUrls);\n\n\t\t\t// Get the new url\n\t\t\tif (this.settings.useBase64) {\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\t// switch the url in the replacementUrls\n\t\t\tindexInUrls = urls.indexOf(href);\n\t\t\tif (indexInUrls > -1) {\n\t\t\t\treplacementUrls[indexInUrls] = newUrl;\n\t\t\t}\n\n\t\t\treturn new Promise(function(resolve, reject){\n\t\t\t\tresolve(urls, replacementUrls);\n\t\t\t});\n\n\t\t}.bind(this));\n\n};\n\nRendition.prototype.replaceAssets = function(section, urls, replacementUrls){\n\t// var fileUri = URI(section.url);\n\tvar fileUri;\n\tvar absolute;\n\tif (this.book.baseUrl) {\n\t\tfileUri = new URL(section.url, this.book.baseUrl);\n\t\tabsolute = fileUri.toString();\n\t} else {\n\t\tabsolute = path.resolve(this.book.basePath, section.url);\n\t}\n\n\t// Get Urls relative to current sections\n\tvar relUrls = urls.\n\t\tmap(function(href) {\n\t\t\t// var assetUri = URI(href).absoluteTo(this.book.baseUrl);\n\t\t\t// var relative = assetUri.relativeTo(fileUri).toString();\n\n\t\t\tvar assetUrl;\n\t\t\tvar relativeUrl;\n\t\t\tif (this.book.baseUrl) {\n\t\t\t\tassetUrl = new URL(href, this.book.baseUrl);\n\t\t\t\trelative = path.relative(path.dirname(fileUri.pathname), assetUrl.pathname);\n\t\t\t} else {\n\t\t\t\tassetUrl = path.resolve(this.book.basePath, href);\n\t\t\t\trelative = path.relative(path.dirname(absolute), assetUrl);\n\t\t\t}\n\n\t\t\treturn relative;\n\t\t}.bind(this));\n\n\n\tsection.output = replace.substitute(section.output, relUrls, replacementUrls);\n};\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\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 = 11\n// module chunks = 0","var path = require('path');\nvar core = require('./core');\nvar EpubCFI = require('./epubcfi');\n\n\nfunction Parser(){};\n\nParser.prototype.container = function(containerXml){\n\t\t//-- \n\t\tvar rootfile, fullpath, folder, encoding;\n\n\t\tif(!containerXml) {\n\t\t\tconsole.error(\"Container File Not Found\");\n\t\t\treturn;\n\t\t}\n\n\t\trootfile = core.qs(containerXml, \"rootfile\");\n\n\t\tif(!rootfile) {\n\t\t\tconsole.error(\"No RootFile Found\");\n\t\t\treturn;\n\t\t}\n\n\t\tfullpath = rootfile.getAttribute('full-path');\n\t\tfolder = path.dirname(fullpath);\n\t\tencoding = containerXml.xmlEncoding;\n\n\t\t//-- Now that we have the path we can parse the contents\n\t\treturn {\n\t\t\t'packagePath' : fullpath,\n\t\t\t'basePath' : folder,\n\t\t\t'encoding' : encoding\n\t\t};\n};\n\nParser.prototype.identifier = function(packageXml){\n\tvar metadataNode;\n\n\tif(!packageXml) {\n\t\tconsole.error(\"Package File Not Found\");\n\t\treturn;\n\t}\n\n\tmetadataNode = core.qs(packageXml, \"metadata\");\n\n\tif(!metadataNode) {\n\t\tconsole.error(\"No Metadata Found\");\n\t\treturn;\n\t}\n\n\treturn this.getElementText(metadataNode, \"identifier\");\n};\n\nParser.prototype.packageContents = function(packageXml){\n\tvar parse = this;\n\tvar metadataNode, manifestNode, spineNode;\n\tvar manifest, navPath, ncxPath, coverPath;\n\tvar spineNodeIndex;\n\tvar spine;\n\tvar spineIndexByURL;\n\tvar metadata;\n\n\tif(!packageXml) {\n\t\tconsole.error(\"Package File Not Found\");\n\t\treturn;\n\t}\n\n\tmetadataNode = core.qs(packageXml, \"metadata\");\n\tif(!metadataNode) {\n\t\tconsole.error(\"No Metadata Found\");\n\t\treturn;\n\t}\n\n\tmanifestNode = core.qs(packageXml, \"manifest\");\n\tif(!manifestNode) {\n\t\tconsole.error(\"No Manifest Found\");\n\t\treturn;\n\t}\n\n\tspineNode = core.qs(packageXml, \"spine\");\n\tif(!spineNode) {\n\t\tconsole.error(\"No Spine Found\");\n\t\treturn;\n\t}\n\n\tmanifest = parse.manifest(manifestNode);\n\tnavPath = parse.findNavPath(manifestNode);\n\tncxPath = parse.findNcxPath(manifestNode, spineNode);\n\tcoverPath = parse.findCoverPath(packageXml);\n\n\tspineNodeIndex = Array.prototype.indexOf.call(spineNode.parentNode.childNodes, spineNode);\n\n\tspine = parse.spine(spineNode, manifest);\n\n\tmetadata = parse.metadata(metadataNode);\n\n\tmetadata.direction = spineNode.getAttribute(\"page-progression-direction\");\n\n\treturn {\n\t\t'metadata' : metadata,\n\t\t'spine' : spine,\n\t\t'manifest' : manifest,\n\t\t'navPath' : navPath,\n\t\t'ncxPath' : ncxPath,\n\t\t'coverPath': coverPath,\n\t\t'spineNodeIndex' : spineNodeIndex\n\t};\n};\n\n//-- Find TOC NAV\nParser.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//-- Find TOC NCX: media-type=\"application/x-dtbncx+xml\" href=\"toc.ncx\"\nParser.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//-- Expanded to match Readium web components\nParser.prototype.metadata = function(xml){\n\tvar metadata = {},\n\t\t\tp = this;\n\n\tmetadata.title = p.getElementText(xml, 'title');\n\tmetadata.creator = p.getElementText(xml, 'creator');\n\tmetadata.description = p.getElementText(xml, 'description');\n\n\tmetadata.pubdate = p.getElementText(xml, 'date');\n\n\tmetadata.publisher = p.getElementText(xml, 'publisher');\n\n\tmetadata.identifier = p.getElementText(xml, \"identifier\");\n\tmetadata.language = p.getElementText(xml, \"language\");\n\tmetadata.rights = p.getElementText(xml, \"rights\");\n\n\tmetadata.modified_date = p.getPropertyText(xml, 'dcterms:modified');\n\n\tmetadata.layout = p.getPropertyText(xml, \"rendition:layout\");\n\tmetadata.orientation = p.getPropertyText(xml, 'rendition:orientation');\n\tmetadata.flow = p.getPropertyText(xml, 'rendition:flow');\n\tmetadata.viewport = p.getPropertyText(xml, 'rendition:viewport');\n\t// metadata.page_prog_dir = packageXml.querySelector(\"spine\").getAttribute(\"page-progression-direction\");\n\n\treturn metadata;\n};\n\n//-- Find Cover: \n//-- Fallback for Epub 2.0\nParser.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\nParser.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\nParser.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\nParser.prototype.querySelectorText = function(xml, q){\n\tvar el = xml.querySelector(q);\n\n\tif(el && el.childNodes.length){\n\t\treturn el.childNodes[0].nodeValue;\n\t}\n\n\treturn '';\n};\n\nParser.prototype.manifest = 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\nParser.prototype.spine = 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\nParser.prototype.querySelectorByType = function(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 = core.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\nParser.prototype.nav = function(navHtml, spineIndexByURL, bookSpine){\n\tvar navElement = this.querySelectorByType(navHtml, \"nav\", \"toc\");\n\t// var navItems = navElement ? navElement.querySelectorAll(\"ol li\") : [];\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], spineIndexByURL, bookSpine);\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\nParser.prototype.navItem = function(item, spineIndexByURL, bookSpine){\n\tvar id = item.getAttribute('id') || false,\n\t\t\t// content = item.querySelector(\"a, span\"),\n\t\t\tcontent = core.qs(item, \"a\"),\n\t\t\tsrc = content.getAttribute('href') || '',\n\t\t\ttext = content.textContent || \"\",\n\t\t\t// split = src.split(\"#\"),\n\t\t\t// baseUrl = split[0],\n\t\t\t// spinePos = spineIndexByURL[baseUrl],\n\t\t\t// spineItem = bookSpine[spinePos],\n\t\t\tsubitems = [],\n\t\t\tparentNode = item.parentNode,\n\t\t\tparent;\n\t\t\t// cfi = spineItem ? spineItem.cfi : '';\n\n\tif(parentNode && parentNode.nodeName === \"navPoint\") {\n\t\tparent = parentNode.getAttribute('id');\n\t}\n\n\t/*\n\tif(!id) {\n\t\tif(spinePos) {\n\t\t\tspineItem = bookSpine[spinePos];\n\t\t\tid = spineItem.id;\n\t\t\tcfi = spineItem.cfi;\n\t\t} else {\n\t\t\tid = 'epubjs-autogen-toc-id-' + EPUBJS.core.uuid();\n\t\t\titem.setAttribute('id', id);\n\t\t}\n\t}\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\nParser.prototype.ncx = function(tocXml, spineIndexByURL, bookSpine){\n\t// var navPoints = tocXml.querySelectorAll(\"navMap navPoint\");\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], spineIndexByURL, bookSpine);\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\nParser.prototype.ncxItem = function(item, spineIndexByURL, bookSpine){\n\tvar id = item.getAttribute('id') || false,\n\t\t\t// content = item.querySelector(\"content\"),\n\t\t\tcontent = core.qs(item, \"content\"),\n\t\t\tsrc = content.getAttribute('src'),\n\t\t\t// navLabel = item.querySelector(\"navLabel\"),\n\t\t\tnavLabel = core.qs(item, \"navLabel\"),\n\t\t\ttext = navLabel.textContent ? navLabel.textContent : \"\",\n\t\t\t// split = src.split(\"#\"),\n\t\t\t// baseUrl = split[0],\n\t\t\t// spinePos = spineIndexByURL[baseUrl],\n\t\t\t// spineItem = bookSpine[spinePos],\n\t\t\tsubitems = [],\n\t\t\tparentNode = item.parentNode,\n\t\t\tparent;\n\t\t\t// cfi = spineItem ? spineItem.cfi : '';\n\n\tif(parentNode && parentNode.nodeName === \"navPoint\") {\n\t\tparent = parentNode.getAttribute('id');\n\t}\n\n\t/*\n\tif(!id) {\n\t\tif(spinePos) {\n\t\t\tspineItem = bookSpine[spinePos];\n\t\t\tid = spineItem.id;\n\t\t\tcfi = spineItem.cfi;\n\t\t} else {\n\t\t\tid = 'epubjs-autogen-toc-id-' + EPUBJS.core.uuid();\n\t\t\titem.setAttribute('id', id);\n\t\t}\n\t}\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\nParser.prototype.pageList = function(navHtml, spineIndexByURL, bookSpine){\n\tvar navElement = this.querySelectorByType(navHtml, \"nav\", \"page-list\");\n\t// var navItems = navElement ? navElement.querySelectorAll(\"ol li\") : [];\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.pageListItem(navItems[i], spineIndexByURL, bookSpine);\n\t\tlist.push(item);\n\t}\n\n\treturn list;\n};\n\nParser.prototype.pageListItem = function(item, spineIndexByURL, bookSpine){\n\tvar id = item.getAttribute('id') || false,\n\t\t// content = item.querySelector(\"a\"),\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\nmodule.exports = Parser;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/parser.js\n// module id = 12\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 linkUrl;\n\t\tvar linkPath;\n\t\tvar relative;\n\n\t\tif (this.book.baseUrl) {\n\t\t\tlinkUrl = new URL(href, this.book.baseUrl);\n\t\t\trelative = path.relative(path.dirname(linkUrl.pathname), this.book.packagePath);\n\t\t} else {\n\t\t\tlinkPath = path.resolve(this.book.basePath, href);\n\t\t\trelative = path.relative(this.book.packagePath, linkPath);\n\t\t}\n\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 = 13\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_14__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"xmldom\"\n// module id = 14\n// module chunks = 0","var EventEmitter = require('event-emitter');\nvar path = require('path');\nvar core = require('./core');\nvar Spine = require('./spine');\nvar Locations = require('./locations');\nvar Parser = require('./parser');\nvar Navigation = require('./navigation');\nvar Rendition = require('./rendition');\nvar Unarchive = require('./unarchive');\nvar request = require('./request');\nvar EpubCFI = require('./epubcfi');\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 * @returns {Book}\n * @example new Book(\"/path/to/book.epub\", {})\n */\nfunction Book(url, options){\n\n\tthis.settings = core.extend(this.settings || {}, {\n\t\trequestMethod: this.requestMethod\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};\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};\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 */\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.pageList ]);\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 */\n\tthis.request = this.settings.requestMethod.bind(this);\n\n\t/**\n\t * @property {Spine} spine\n\t */\n\tthis.spine = new Spine(this.request);\n\n\t/**\n\t * @property {Locations} locations\n\t */\n\tthis.locations = new Locations(this.spine, this.request);\n\n\t/**\n\t * @property {Navigation} navigation\n\t */\n\tthis.navigation = undefined;\n\n\t/**\n\t * @member {string} url the book url\n\t */\n\tthis.url = undefined;\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\n\t\t\tthis.emit(\"loadFailed\", error);\n\t\t}.bind(this));\n\t}\n};\n\n/**\n * open a url\n * @param {string} _url URL, Path or ArrayBuffer\n * @param {object} [options] to force opening\n * @returns {Promise} of when the book has been loaded\n * @example book.open(\"/path/to/book.epub\", { base64: false })\n */\nBook.prototype.open = function(_url, options){\n\tvar url;\n\tvar pathname;\n\tvar parse = new Parser();\n\tvar epubPackage;\n\tvar epubContainer;\n\tvar book = this;\n\tvar containerPath = \"META-INF/container.xml\";\n\tvar location;\n\tvar isArrayBuffer = false;\n\tvar isBase64 = options && options.base64;\n\n\tif(!_url) {\n\t\tthis.opening.resolve(this);\n\t\treturn this.opened;\n\t}\n\n\t// Reuse parsed url or create a new uri object\n\t// if(typeof(_url) === \"object\") {\n\t// uri = _url;\n\t// } else {\n\t// uri = core.uri(_url);\n\t// }\n\tif (_url instanceof ArrayBuffer || isBase64) {\n\t\tisArrayBuffer = true;\n\t\tthis.url = '/';\n\t}\n\n\tif (window && window.location && !isArrayBuffer) {\n\t\t// absoluteUri = uri.absoluteTo(window.location.href);\n\t\turl = new URL(_url, window.location.href);\n\t\tpathname = url.pathname;\n\t\t// this.url = absoluteUri.toString();\n\t\tthis.url = url.toString();\n\t} else if (window && window.location) {\n\t\tthis.url = window.location.href;\n\t} else {\n\t\tthis.url = _url;\n\t}\n\n\t// Find path to the Container\n\t// if(uri && uri.suffix() === \"opf\") {\n\tif(url && core.extension(pathname) === \"opf\") {\n\t\t// Direct link to package, no container\n\t\tthis.packageUrl = _url;\n\t\tthis.containerUrl = '';\n\n\t\tif(url.origin) {\n\t\t\t// this.baseUrl = uri.origin() + uri.directory() + \"/\";\n\t\t\tthis.baseUrl = url.origin + path.dirname(pathname) + \"/\";\n\t\t// } else if(absoluteUri){\n\t\t// \tthis.baseUrl = absoluteUri.origin();\n\t\t// \tthis.baseUrl += absoluteUri.directory() + \"/\";\n\t\t} else {\n\t\t\tthis.baseUrl = path.dirname(pathname) + \"/\";\n\t\t}\n\n\t\tepubPackage = this.request(this.packageUrl)\n\t\t\t.catch(function(error) {\n\t\t\t\tbook.opening.reject(error);\n\t\t\t});\n\n\t} else if(isArrayBuffer || isBase64 || this.isArchivedUrl(_url)) {\n\t\t// Book is archived\n\t\tthis.url = '';\n\t\t// this.containerUrl = URI(containerPath).absoluteTo(this.url).toString();\n\t\tthis.containerUrl = path.resolve(\"\", containerPath);\n\n\t\tepubContainer = this.unarchive(_url, isBase64).\n\t\t\tthen(function() {\n\t\t\t\treturn this.request(this.containerUrl);\n\t\t\t}.bind(this))\n\t\t\t.catch(function(error) {\n\t\t\t\tbook.opening.reject(error);\n\t\t\t});\n\t}\n\t// Find the path to the Package from the container\n\telse if (!core.extension(pathname)) {\n\n\t\tthis.containerUrl = this.url + containerPath;\n\n\t\tepubContainer = this.request(this.containerUrl)\n\t\t\t.catch(function(error) {\n\t\t\t\t// handle errors in loading container\n\t\t\t\tbook.opening.reject(error);\n\t\t\t});\n\t}\n\n\tif (epubContainer) {\n\t\tepubPackage = epubContainer.\n\t\t\tthen(function(containerXml){\n\t\t\t\treturn parse.container(containerXml); // Container has path to content\n\t\t\t}).\n\t\t\tthen(function(paths){\n\t\t\t\t// var packageUri = URI(paths.packagePath);\n\t\t\t\t// var absPackageUri = packageUri.absoluteTo(book.url);\n\t\t\t\tvar packageUrl;\n\n\t\t\t\tif (book.url) {\n\t\t\t\t\tpackageUrl = new URL(paths.packagePath, book.url);\n\t\t\t\t\tbook.packageUrl = packageUrl.toString();\n\t\t\t\t} else {\n\t\t\t\t\tbook.packageUrl = \"/\" + paths.packagePath;\n\t\t\t\t}\n\n\t\t\t\tbook.packagePath = paths.packagePath;\n\t\t\t\tbook.encoding = paths.encoding;\n\n\t\t\t\t// Set Url relative to the content\n\t\t\t\tif(packageUrl && packageUrl.origin) {\n\t\t\t\t\tbook.baseUrl = book.url + path.dirname(paths.packagePath) + \"/\";\n\t\t\t\t} else {\n\t\t\t\t\tif(path.dirname(paths.packagePath)) {\n\t\t\t\t\t\tbook.baseUrl = \"\"\n\t\t\t\t\t\tbook.basePath = \"/\" + path.dirname(paths.packagePath) + \"/\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbook.basePath = \"/\"\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn book.request(book.packageUrl);\n\t\t\t}).catch(function(error) {\n\t\t\t\t// handle errors in either of the two requests\n\t\t\t\tbook.opening.reject(error);\n\t\t\t});\n\t}\n\n\tepubPackage.then(function(packageXml) {\n\n\t\tif (!packageXml) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Get package information from epub opf\n\t\tbook.unpack(packageXml);\n\n\t\t// Resolve promises\n\t\tbook.loading.manifest.resolve(book.package.manifest);\n\t\tbook.loading.metadata.resolve(book.package.metadata);\n\t\tbook.loading.spine.resolve(book.spine);\n\t\tbook.loading.cover.resolve(book.cover);\n\n\t\tbook.isOpen = true;\n\n\t\t// Clear queue of any waiting book request\n\n\t\t// Resolve book opened promise\n\t\tbook.opening.resolve(book);\n\n\t}).catch(function(error) {\n\t\t// handle errors in parsing the book\n\t\t// console.error(error.message, error.stack);\n\t\tbook.opening.reject(error);\n\t});\n\n\treturn this.opened;\n};\n\n/**\n * unpack the contents of the Books packageXml\n * @param {document} packageXml XML Document\n */\nBook.prototype.unpack = function(packageXml){\n\tvar book = this,\n\t\t\tparse = new Parser();\n\n\tbook.package = parse.packageContents(packageXml); // Extract info from contents\n\tif(!book.package) {\n\t\treturn;\n\t}\n\n\tbook.package.baseUrl = book.baseUrl; // Provides a url base for resolving paths\n\tbook.package.basePath = book.basePath; // Provides a url base for resolving paths\n\n\tthis.spine.load(book.package);\n\n\tbook.navigation = new Navigation(book.package, this.request);\n\tbook.navigation.load().then(function(toc){\n\t\tbook.toc = toc;\n\t\tbook.loading.navigation.resolve(book.toc);\n\t});\n\n\t// //-- Set Global Layout setting based on metadata\n\t// MOVE TO RENDER\n\t// book.globalLayoutProperties = book.parseLayoutProperties(book.package.metadata);\n\tif (book.baseUrl) {\n\t\tbook.cover = new URL(book.package.coverPath, book.baseUrl).toString();\n\t} else {\n\t\tbook.cover = path.resolve(book.baseUrl, book.package.coverPath);\n\t}\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 */\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 * Switch request methods depending on if book is archived or not\n */\nBook.prototype.requestMethod = function(_url) {\n\t// Switch request methods\n\tif(this.unarchived) {\n\t\treturn this.unarchived.request(_url);\n\t} else {\n\t\treturn request(_url, null, this.requestCredentials, this.requestHeaders);\n\t}\n\n};\n\nBook.prototype.setRequestCredentials = function(_credentials) {\n\tthis.requestCredentials = _credentials;\n};\n\nBook.prototype.setRequestHeaders = function(_headers) {\n\tthis.requestHeaders = _headers;\n};\n\n/**\n * Unarchive a zipped epub\n */\nBook.prototype.unarchive = function(bookUrl, isBase64){\n\tthis.unarchived = new Unarchive();\n\treturn this.unarchived.open(bookUrl, isBase64);\n};\n\n/**\n * Checks if url has a .epub or .zip extension, or is ArrayBuffer (of zip/epub)\n */\nBook.prototype.isArchivedUrl = function(bookUrl){\n\tvar extension;\n\n\tif (bookUrl instanceof ArrayBuffer) {\n\t\treturn true;\n\t}\n\n\t// Reuse parsed url or create a new uri object\n\t// if(typeof(bookUrl) === \"object\") {\n\t// uri = bookUrl;\n\t// } else {\n\t// uri = core.uri(bookUrl);\n\t// }\n\t// uri = URI(bookUrl);\n\textension = core.extension(bookUrl);\n\n\tif(extension && (extension == \"epub\" || extension == \"zip\")){\n\t\treturn true;\n\t}\n\n\treturn false;\n};\n\n/**\n * Get the cover url\n */\nBook.prototype.coverUrl = function(){\n\tvar retrieved = this.loaded.cover.\n\t\tthen(function(url) {\n\t\t\tif(this.unarchived) {\n\t\t\t\treturn this.unarchived.createUrl(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 * Find a DOM Range for a given CFI 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\nmodule.exports = Book;\n\n//-- Enable binding events to book\nEventEmitter(Book.prototype);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/book.js\n// module id = 17\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 = 18\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 = 19\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 = 20\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 = 21\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 = 22\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 = 23\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 = 24\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 = 25\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 = 26\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 = 27\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 = 28\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 = 29\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 = 30\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 = 31\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 = 32\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 = 33\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 = 34\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 = 35\n// module chunks = 0","var core = require('./core');\n\nfunction Layout(settings){\n\tthis.name = settings.layout || \"reflowable\";\n\tthis._spread = (settings.spread === \"none\") ? false : true;\n\tthis._minSpreadWidth = settings.spread || 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// paginated | scrolled\nLayout.prototype.flow = function(flow) {\n\tthis._flow = (flow === \"paginated\") ? \"paginated\" : \"scrolled\";\n}\n\n// true | false\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\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\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\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 = 37\n// module chunks = 0","var core = require('./core');\nvar Queue = require('./queue');\nvar EpubCFI = require('./epubcfi');\nvar EventEmitter = require('event-emitter');\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// Load all of sections in the book\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 = 38\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 = 39\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 = 40\n// module chunks = 0","var core = require('./core');\nvar Parser = require('./parser');\nvar path = require('path');\n\nfunction Navigation(_package, _request){\n\tvar navigation = this;\n\tvar parse = new Parser();\n\tvar request = _request || require('./request');\n\n\tthis.package = _package;\n\tthis.toc = [];\n\tthis.tocByHref = {};\n\tthis.tocById = {};\n\n\tif(_package.navPath) {\n\t\tif (_package.baseUrl) {\n\t\t\tthis.navUrl = new URL(_package.navPath, _package.baseUrl).toString();\n\t\t} else {\n\t\t\tthis.navUrl = path.resolve(_package.basePath, _package.navPath);\n\t\t}\n\t\tthis.nav = {};\n\n\t\tthis.nav.load = function(_request){\n\t\t\tvar loading = new core.defer();\n\t\t\tvar loaded = loading.promise;\n\n\t\t\trequest(navigation.navUrl, 'xml').then(function(xml){\n\t\t\t\tnavigation.toc = parse.nav(xml);\n\t\t\t\tnavigation.loaded(navigation.toc);\n\t\t\t\tloading.resolve(navigation.toc);\n\t\t\t});\n\n\t\t\treturn loaded;\n\t\t};\n\n\t}\n\n\tif(_package.ncxPath) {\n\t\tif (_package.baseUrl) {\n\t\t\tthis.ncxUrl = new URL(_package.ncxPath, _package.baseUrl).toString();\n\t\t} else {\n\t\t\tthis.ncxUrl = path.resolve(_package.basePath, _package.ncxPath);\n\t\t}\n\n\t\tthis.ncx = {};\n\n\t\tthis.ncx.load = function(_request){\n\t\t\tvar loading = new core.defer();\n\t\t\tvar loaded = loading.promise;\n\n\t\t\trequest(navigation.ncxUrl, 'xml').then(function(xml){\n\t\t\t\tnavigation.toc = parse.toc(xml);\n\t\t\t\tnavigation.loaded(navigation.toc);\n\t\t\t\tloading.resolve(navigation.toc);\n\t\t\t});\n\n\t\t\treturn loaded;\n\t\t};\n\n\t}\n};\n\n// Load the navigation\nNavigation.prototype.load = function(_request) {\n\tvar request = _request || require('./request');\n\tvar loading, loaded;\n\n\tif(this.nav) {\n\t\tloading = this.nav.load();\n\t} else if(this.ncx) {\n\t\tloading = this.ncx.load();\n\t} else {\n\t\tloaded = new core.defer();\n\t\tloaded.resolve([]);\n\t\tloading = loaded.promise;\n\t}\n\n\treturn loading;\n\n};\n\nNavigation.prototype.loaded = 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// Get an item from the navigation\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\nmodule.exports = Navigation;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/navigation.js\n// module id = 41\n// module chunks = 0","var core = require('./core');\nvar EpubCFI = require('./epubcfi');\nvar Hook = require('./hook');\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\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 = core.directory(this.url);\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\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\t\tconsole.log(window.location.origin + \"/\" +this.url);\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\nSection.prototype.beforeSectionLoad = function(){\n\t// Stub for a hook - replace me for now\n};\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\nSection.prototype.find = function(_query){\n\n};\n\n/*\n* Reconciles the current chapters layout properies with\n* the global layout properities.\n* Takes: global layout settings object, chapter properties string\n* Returns: 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\nSection.prototype.cfiFromRange = function(_range) {\n\treturn new EpubCFI(_range, this.cfiBase).toString();\n};\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 = 42\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\nfunction Spine(_request){\n\tthis.request = _request;\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\nSpine.prototype.load = function(_package) {\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 = this.baseUrl + item.href;\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\t// if(index > 0) {\n\t\t\titem.prev = function(){ return this.get(index-1); }.bind(this);\n\t\t// }\n\n\t\t// if(index+1 < this.items.length) {\n\t\t\titem.next = function(){ return this.get(index+1); }.bind(this);\n\t\t// }\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// book.spine.get();\n// book.spine.get(1);\n// book.spine.get(\"chap1.html\");\n// book.spine.get(\"#id1234\");\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\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\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\nSpine.prototype.insert = function(section, index) {\n\n};\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\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 = 43\n// module chunks = 0","var core = require('./core');\nvar request = require('./request');\nvar mime = require('../libs/mime/mime');\n\nfunction Unarchive() {\n\n\tthis.checkRequirements();\n\tthis.urlCache = {};\n\n}\n\nUnarchive.prototype.checkRequirements = function(callback){\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\nUnarchive.prototype.open = function(zipUrl, isBase64){\n\tif (zipUrl instanceof ArrayBuffer || isBase64) {\n\t\treturn this.zip.loadAsync(zipUrl, {\"base64\": isBase64});\n\t} else {\n\t\treturn request(zipUrl, \"binary\")\n\t\t\t.then(function(data){\n\t\t\t\treturn this.zip.loadAsync(data);\n\t\t\t}.bind(this));\n\t}\n};\n\nUnarchive.prototype.request = function(url, type){\n\tvar deferred = new core.defer();\n\tvar response;\n\tvar r;\n\n\t// If type isn't set, determine it from the file extension\n\tif(!type) {\n\t\ttype = core.extension(url);\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\nUnarchive.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\nUnarchive.prototype.getBlob = function(url, _mimeType){\n\tvar decodededUrl = window.decodeURIComponent(url.substr(1)); // Remove first slash\n\tvar entry = this.zip.file(decodededUrl);\n\tvar mimeType;\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\nUnarchive.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\nUnarchive.prototype.getBase64 = function(url, _mimeType){\n\tvar decodededUrl = window.decodeURIComponent(url.substr(1)); // Remove first slash\n\tvar entry = this.zip.file(decodededUrl);\n\tvar mimeType;\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\nUnarchive.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\nUnarchive.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 = Unarchive;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/unarchive.js\n// module id = 44\n// module chunks = 0","if(typeof __WEBPACK_EXTERNAL_MODULE_45__ === 'undefined') {var e = new Error(\"Cannot find module \\\"JSZip\\\"\"); e.code = 'MODULE_NOT_FOUND'; throw e;}\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_45__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"JSZip\"\n// module id = 45\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 * @param options.requestMethod the request function to use\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 = 47\n// module chunks = 0"],"sourceRoot":""}
\ No newline at end of file
diff --git a/dist/polyfills.js.map b/dist/polyfills.js.map
index 035154e..21d5967 100644
--- a/dist/polyfills.js.map
+++ b/dist/polyfills.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///webpack/universalModuleDefinition?5ca6","webpack:///webpack/bootstrap 23c5bd6142f634f3e8a0?fd52","webpack:///./~/es6-promise/dist/es6-promise.auto.js","webpack:///./~/js-polyfills/url.js","webpack:///(webpack)/buildin/global.js","webpack:///vertx (ignored)","webpack:///./~/process/browser.js?82e4"],"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;;;;;;;;uDC9DA;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;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,kBAAkB,2BAA2B;AAC7C,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qCAAqC,mCAAmC;;AAExE;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA,yBAAyB,2BAA2B;AACpD;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA,2BAA2B,2BAA2B;;AAEtD;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB;AAChB;AACA,oBAAoB;AACpB;AACA,kBAAkB;AAClB;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB;AAChB;AACA,oBAAoB;AACpB;AACA,kBAAkB;AAClB;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB;AAChB;AACA,oBAAoB;AACpB;AACA,kBAAkB;AAClB;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA,2DAA2D;AAC3D;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,QAAQ,qBAAqB,aAAa,EAAE,EAAE,EAAE;AACtF;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;;;;AAIA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,sBAAsB,EAAE;AAClD,2BAA2B,mBAAmB,iBAAiB,gBAAgB,EAAE;AACjF;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,OAAO;AACP;AACA,0BAA0B,0BAA0B,EAAE;AACtD,2BAA2B,uBAAuB,EAAE;AACpD;AACA,OAAO;AACP;AACA,0BAA0B,0BAA0B,EAAE;AACtD,2BAA2B,uBAAuB,EAAE;AACpD;AACA,OAAO;AACP;AACA,0BAA0B,0BAA0B,EAAE;AACtD,2BAA2B,uBAAuB,EAAE;AACpD;AACA,OAAO;AACP;AACA;AACA;AACA,oBAAoB,mDAAmD;AACvE;AACA,SAAS;AACT,2BAA2B,mBAAmB,EAAE;AAChD;AACA,OAAO;AACP;AACA,0BAA0B,0BAA0B,EAAE;AACtD,2BAA2B,uBAAuB,EAAE;AACpD;AACA,OAAO;AACP;AACA,0BAA0B,sBAAsB,EAAE;AAClD,2BAA2B,mBAAmB,EAAE;AAChD;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,2BAA2B,uBAAuB,EAAE;AACpD;AACA,OAAO;AACP;AACA,0BAA0B,wBAAwB,EAAE;AACpD;AACA;AACA,8BAA8B,iBAAiB;AAC/C,SAAS;AACT;AACA,OAAO;AACP;AACA,0BAA0B,qBAAqB,EAAE;AACjD;AACA,OAAO;AACP;AACA,0BAA0B,sBAAsB,EAAE;AAClD,2BAA2B,mBAAmB,iBAAiB,EAAE;AACjE;AACA,OAAO;AACP;AACA,2BAA2B,4BAA4B,EAAE;AACzD;AACA,OAAO;AACP;AACA,2BAA2B,2BAA2B,EAAE;AACxD;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC;;;;;;;;ACvaD;;AAEA;AACA,iBAAiB,aAAa,EAAE;;AAEhC;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C;;;;;;;;AClBA,e;;;;;;;;;;;;;;;;ACAA;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","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 = 48);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 23c5bd6142f634f3e8a0","/*!\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","// URL Polyfill\n// Draft specification: https://url.spec.whatwg.org\n\n// Notes:\n// - Primarily useful for parsing URLs and modifying query parameters\n// - Should work in IE8+ and everything more modern\n\n(function (global) {\n 'use strict';\n\n // Browsers may have:\n // * No global URL object\n // * URL with static methods only - may have a dummy constructor\n // * URL with members except searchParams\n // * Full URL API support\n var origURL = global.URL;\n var nativeURL;\n try {\n if (origURL) {\n nativeURL = new global.URL('http://example.com');\n if ('searchParams' in nativeURL)\n return;\n if (!('href' in nativeURL))\n nativeURL = undefined;\n }\n } catch (_) {}\n\n // NOTE: Doesn't do the encoding/decoding dance\n function urlencoded_serialize(pairs) {\n var output = '', first = true;\n pairs.forEach(function (pair) {\n var name = encodeURIComponent(pair.name);\n var value = encodeURIComponent(pair.value);\n if (!first) output += '&';\n output += name + '=' + value;\n first = false;\n });\n return output.replace(/%20/g, '+');\n }\n\n // NOTE: Doesn't do the encoding/decoding dance\n function urlencoded_parse(input, isindex) {\n var sequences = input.split('&');\n if (isindex && sequences[0].indexOf('=') === -1)\n sequences[0] = '=' + sequences[0];\n var pairs = [];\n sequences.forEach(function (bytes) {\n if (bytes.length === 0) return;\n var index = bytes.indexOf('=');\n if (index !== -1) {\n var name = bytes.substring(0, index);\n var value = bytes.substring(index + 1);\n } else {\n name = bytes;\n value = '';\n }\n name = name.replace(/\\+/g, ' ');\n value = value.replace(/\\+/g, ' ');\n pairs.push({ name: name, value: value });\n });\n var output = [];\n pairs.forEach(function (pair) {\n output.push({\n name: decodeURIComponent(pair.name),\n value: decodeURIComponent(pair.value)\n });\n });\n return output;\n }\n\n\n function URLUtils(url) {\n if (nativeURL)\n return new origURL(url);\n var anchor = document.createElement('a');\n anchor.href = url;\n return anchor;\n }\n\n function URLSearchParams(init) {\n var $this = this;\n this._list = [];\n\n if (init === undefined || init === null)\n init = '';\n\n if (Object(init) !== init || (init instanceof URLSearchParams))\n init = String(init);\n\n if (typeof init === 'string') {\n if (init.substring(0, 1) === '?') {\n init = init.substring(1);\n }\n this._list = urlencoded_parse(init);\n }\n\n this._url_object = null;\n this._setList = function (list) { if (!updating) $this._list = list; };\n\n var updating = false;\n this._update_steps = function() {\n if (updating) return;\n updating = true;\n\n if (!$this._url_object) return;\n\n // Partial workaround for IE issue with 'about:'\n if ($this._url_object.protocol === 'about:' &&\n $this._url_object.pathname.indexOf('?') !== -1) {\n $this._url_object.pathname = $this._url_object.pathname.split('?')[0];\n }\n\n $this._url_object.search = urlencoded_serialize($this._list);\n\n updating = false;\n };\n }\n\n\n Object.defineProperties(URLSearchParams.prototype, {\n append: {\n value: function (name, value) {\n this._list.push({ name: name, value: value });\n this._update_steps();\n }, writable: true, enumerable: true, configurable: true\n },\n\n 'delete': {\n value: function (name) {\n for (var i = 0; i < this._list.length;) {\n if (this._list[i].name === name)\n this._list.splice(i, 1);\n else\n ++i;\n }\n this._update_steps();\n }, writable: true, enumerable: true, configurable: true\n },\n\n get: {\n value: function (name) {\n for (var i = 0; i < this._list.length; ++i) {\n if (this._list[i].name === name)\n return this._list[i].value;\n }\n return null;\n }, writable: true, enumerable: true, configurable: true\n },\n\n getAll: {\n value: function (name) {\n var result = [];\n for (var i = 0; i < this._list.length; ++i) {\n if (this._list[i].name === name)\n result.push(this._list[i].value);\n }\n return result;\n }, writable: true, enumerable: true, configurable: true\n },\n\n has: {\n value: function (name) {\n for (var i = 0; i < this._list.length; ++i) {\n if (this._list[i].name === name)\n return true;\n }\n return false;\n }, writable: true, enumerable: true, configurable: true\n },\n\n set: {\n value: function (name, value) {\n var found = false;\n for (var i = 0; i < this._list.length;) {\n if (this._list[i].name === name) {\n if (!found) {\n this._list[i].value = value;\n found = true;\n ++i;\n } else {\n this._list.splice(i, 1);\n }\n } else {\n ++i;\n }\n }\n\n if (!found)\n this._list.push({ name: name, value: value });\n\n this._update_steps();\n }, writable: true, enumerable: true, configurable: true\n },\n\n entries: {\n value: function() {\n var $this = this, index = 0;\n return { next: function() {\n if (index >= $this._list.length)\n return {done: true, value: undefined};\n var pair = $this._list[index++];\n return {done: false, value: [pair.name, pair.value]};\n }};\n }, writable: true, enumerable: true, configurable: true\n },\n\n keys: {\n value: function() {\n var $this = this, index = 0;\n return { next: function() {\n if (index >= $this._list.length)\n return {done: true, value: undefined};\n var pair = $this._list[index++];\n return {done: false, value: pair.name};\n }};\n }, writable: true, enumerable: true, configurable: true\n },\n\n values: {\n value: function() {\n var $this = this, index = 0;\n return { next: function() {\n if (index >= $this._list.length)\n return {done: true, value: undefined};\n var pair = $this._list[index++];\n return {done: false, value: pair.value};\n }};\n }, writable: true, enumerable: true, configurable: true\n },\n\n forEach: {\n value: function(callback) {\n var thisArg = (arguments.length > 1) ? arguments[1] : undefined;\n this._list.forEach(function(pair, index) {\n callback.call(thisArg, pair.value, pair.name);\n });\n\n }, writable: true, enumerable: true, configurable: true\n },\n\n toString: {\n value: function () {\n return urlencoded_serialize(this._list);\n }, writable: true, enumerable: false, configurable: true\n }\n });\n\n if ('Symbol' in global && 'iterator' in global.Symbol) {\n Object.defineProperty(URLSearchParams.prototype, global.Symbol.iterator, {\n value: URLSearchParams.prototype.entries,\n writable: true, enumerable: true, configurable: true});\n }\n\n function URL(url, base) {\n if (!(this instanceof global.URL))\n throw new TypeError(\"Failed to construct 'URL': Please use the 'new' operator.\");\n\n if (base) {\n url = (function () {\n if (nativeURL) return new origURL(url, base).href;\n\n var doc;\n // Use another document/base tag/anchor for relative URL resolution, if possible\n if (document.implementation && document.implementation.createHTMLDocument) {\n doc = document.implementation.createHTMLDocument('');\n } else if (document.implementation && document.implementation.createDocument) {\n doc = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', null);\n doc.documentElement.appendChild(doc.createElement('head'));\n doc.documentElement.appendChild(doc.createElement('body'));\n } else if (window.ActiveXObject) {\n doc = new window.ActiveXObject('htmlfile');\n doc.write('<\\/head><\\/body>');\n doc.close();\n }\n\n if (!doc) throw Error('base not supported');\n\n var baseTag = doc.createElement('base');\n baseTag.href = base;\n doc.getElementsByTagName('head')[0].appendChild(baseTag);\n var anchor = doc.createElement('a');\n anchor.href = url;\n return anchor.href;\n }());\n }\n\n // An inner object implementing URLUtils (either a native URL\n // object or an HTMLAnchorElement instance) is used to perform the\n // URL algorithms. With full ES5 getter/setter support, return a\n // regular object For IE8's limited getter/setter support, a\n // different HTMLAnchorElement is returned with properties\n // overridden\n\n var instance = URLUtils(url || '');\n\n // Detect for ES5 getter/setter support\n // (an Object.defineProperties polyfill that doesn't support getters/setters may throw)\n var ES5_GET_SET = (function() {\n if (!('defineProperties' in Object)) return false;\n try {\n var obj = {};\n Object.defineProperties(obj, { prop: { 'get': function () { return true; } } });\n return obj.prop;\n } catch (_) {\n return false;\n }\n })();\n\n var self = ES5_GET_SET ? this : document.createElement('a');\n\n\n\n var query_object = new URLSearchParams(\n instance.search ? instance.search.substring(1) : null);\n query_object._url_object = self;\n\n Object.defineProperties(self, {\n href: {\n get: function () { return instance.href; },\n set: function (v) { instance.href = v; tidy_instance(); update_steps(); },\n enumerable: true, configurable: true\n },\n origin: {\n get: function () {\n if ('origin' in instance) return instance.origin;\n return this.protocol + '//' + this.host;\n },\n enumerable: true, configurable: true\n },\n protocol: {\n get: function () { return instance.protocol; },\n set: function (v) { instance.protocol = v; },\n enumerable: true, configurable: true\n },\n username: {\n get: function () { return instance.username; },\n set: function (v) { instance.username = v; },\n enumerable: true, configurable: true\n },\n password: {\n get: function () { return instance.password; },\n set: function (v) { instance.password = v; },\n enumerable: true, configurable: true\n },\n host: {\n get: function () {\n // IE returns default port in |host|\n var re = {'http:': /:80$/, 'https:': /:443$/, 'ftp:': /:21$/}[instance.protocol];\n return re ? instance.host.replace(re, '') : instance.host;\n },\n set: function (v) { instance.host = v; },\n enumerable: true, configurable: true\n },\n hostname: {\n get: function () { return instance.hostname; },\n set: function (v) { instance.hostname = v; },\n enumerable: true, configurable: true\n },\n port: {\n get: function () { return instance.port; },\n set: function (v) { instance.port = v; },\n enumerable: true, configurable: true\n },\n pathname: {\n get: function () {\n // IE does not include leading '/' in |pathname|\n if (instance.pathname.charAt(0) !== '/') return '/' + instance.pathname;\n return instance.pathname;\n },\n set: function (v) { instance.pathname = v; },\n enumerable: true, configurable: true\n },\n search: {\n get: function () { return instance.search; },\n set: function (v) {\n if (instance.search === v) return;\n instance.search = v; tidy_instance(); update_steps();\n },\n enumerable: true, configurable: true\n },\n searchParams: {\n get: function () { return query_object; },\n enumerable: true, configurable: true\n },\n hash: {\n get: function () { return instance.hash; },\n set: function (v) { instance.hash = v; tidy_instance(); },\n enumerable: true, configurable: true\n },\n toString: {\n value: function() { return instance.toString(); },\n enumerable: false, configurable: true\n },\n valueOf: {\n value: function() { return instance.valueOf(); },\n enumerable: false, configurable: true\n }\n });\n\n function tidy_instance() {\n var href = instance.href.replace(/#$|\\?$|\\?(?=#)/g, '');\n if (instance.href !== href)\n instance.href = href;\n }\n\n function update_steps() {\n query_object._setList(instance.search ? urlencoded_parse(instance.search.substring(1)) : []);\n query_object._update_steps();\n };\n\n return self;\n }\n\n if (origURL) {\n for (var i in origURL) {\n if (origURL.hasOwnProperty(i) && typeof origURL[i] === 'function')\n URL[i] = origURL[i];\n }\n }\n\n global.URL = URL;\n global.URLSearchParams = URLSearchParams;\n\n}(self));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/js-polyfills/url.js\n// module id = 16\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 = 36\n// module chunks = 1","/* (ignored) */\n\n\n//////////////////\n// WEBPACK FOOTER\n// vertx (ignored)\n// module id = 46\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 = 5\n// module chunks = 0 1"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///webpack/universalModuleDefinition?5ca6","webpack:///webpack/bootstrap 07404e07252e3f8682e4?e8ce","webpack:///./~/es6-promise/dist/es6-promise.auto.js","webpack:///./~/js-polyfills/url.js","webpack:///(webpack)/buildin/global.js","webpack:///vertx (ignored)","webpack:///./~/process/browser.js?82e4"],"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;;;;;;;;uDC9DA;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;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,kBAAkB,2BAA2B;AAC7C,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qCAAqC,mCAAmC;;AAExE;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA,yBAAyB,2BAA2B;AACpD;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA,2BAA2B,2BAA2B;;AAEtD;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB;AAChB;AACA,oBAAoB;AACpB;AACA,kBAAkB;AAClB;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB;AAChB;AACA,oBAAoB;AACpB;AACA,kBAAkB;AAClB;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB;AAChB;AACA,oBAAoB;AACpB;AACA,kBAAkB;AAClB;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;;AAEH;AACA;AACA;AACA,2DAA2D;AAC3D;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,QAAQ,qBAAqB,aAAa,EAAE,EAAE,EAAE;AACtF;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;;;;AAIA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,sBAAsB,EAAE;AAClD,2BAA2B,mBAAmB,iBAAiB,gBAAgB,EAAE;AACjF;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,OAAO;AACP;AACA,0BAA0B,0BAA0B,EAAE;AACtD,2BAA2B,uBAAuB,EAAE;AACpD;AACA,OAAO;AACP;AACA,0BAA0B,0BAA0B,EAAE;AACtD,2BAA2B,uBAAuB,EAAE;AACpD;AACA,OAAO;AACP;AACA,0BAA0B,0BAA0B,EAAE;AACtD,2BAA2B,uBAAuB,EAAE;AACpD;AACA,OAAO;AACP;AACA;AACA;AACA,oBAAoB,mDAAmD;AACvE;AACA,SAAS;AACT,2BAA2B,mBAAmB,EAAE;AAChD;AACA,OAAO;AACP;AACA,0BAA0B,0BAA0B,EAAE;AACtD,2BAA2B,uBAAuB,EAAE;AACpD;AACA,OAAO;AACP;AACA,0BAA0B,sBAAsB,EAAE;AAClD,2BAA2B,mBAAmB,EAAE;AAChD;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,2BAA2B,uBAAuB,EAAE;AACpD;AACA,OAAO;AACP;AACA,0BAA0B,wBAAwB,EAAE;AACpD;AACA;AACA,8BAA8B,iBAAiB;AAC/C,SAAS;AACT;AACA,OAAO;AACP;AACA,0BAA0B,qBAAqB,EAAE;AACjD;AACA,OAAO;AACP;AACA,0BAA0B,sBAAsB,EAAE;AAClD,2BAA2B,mBAAmB,iBAAiB,EAAE;AACjE;AACA,OAAO;AACP;AACA,2BAA2B,4BAA4B,EAAE;AACzD;AACA,OAAO;AACP;AACA,2BAA2B,2BAA2B,EAAE;AACxD;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC;;;;;;;;ACvaD;;AAEA;AACA,iBAAiB,aAAa,EAAE;;AAEhC;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C;;;;;;;;AClBA,e;;;;;;;;;;;;;;;;ACAA;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","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 = 48);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 07404e07252e3f8682e4","/*!\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","// URL Polyfill\n// Draft specification: https://url.spec.whatwg.org\n\n// Notes:\n// - Primarily useful for parsing URLs and modifying query parameters\n// - Should work in IE8+ and everything more modern\n\n(function (global) {\n 'use strict';\n\n // Browsers may have:\n // * No global URL object\n // * URL with static methods only - may have a dummy constructor\n // * URL with members except searchParams\n // * Full URL API support\n var origURL = global.URL;\n var nativeURL;\n try {\n if (origURL) {\n nativeURL = new global.URL('http://example.com');\n if ('searchParams' in nativeURL)\n return;\n if (!('href' in nativeURL))\n nativeURL = undefined;\n }\n } catch (_) {}\n\n // NOTE: Doesn't do the encoding/decoding dance\n function urlencoded_serialize(pairs) {\n var output = '', first = true;\n pairs.forEach(function (pair) {\n var name = encodeURIComponent(pair.name);\n var value = encodeURIComponent(pair.value);\n if (!first) output += '&';\n output += name + '=' + value;\n first = false;\n });\n return output.replace(/%20/g, '+');\n }\n\n // NOTE: Doesn't do the encoding/decoding dance\n function urlencoded_parse(input, isindex) {\n var sequences = input.split('&');\n if (isindex && sequences[0].indexOf('=') === -1)\n sequences[0] = '=' + sequences[0];\n var pairs = [];\n sequences.forEach(function (bytes) {\n if (bytes.length === 0) return;\n var index = bytes.indexOf('=');\n if (index !== -1) {\n var name = bytes.substring(0, index);\n var value = bytes.substring(index + 1);\n } else {\n name = bytes;\n value = '';\n }\n name = name.replace(/\\+/g, ' ');\n value = value.replace(/\\+/g, ' ');\n pairs.push({ name: name, value: value });\n });\n var output = [];\n pairs.forEach(function (pair) {\n output.push({\n name: decodeURIComponent(pair.name),\n value: decodeURIComponent(pair.value)\n });\n });\n return output;\n }\n\n\n function URLUtils(url) {\n if (nativeURL)\n return new origURL(url);\n var anchor = document.createElement('a');\n anchor.href = url;\n return anchor;\n }\n\n function URLSearchParams(init) {\n var $this = this;\n this._list = [];\n\n if (init === undefined || init === null)\n init = '';\n\n if (Object(init) !== init || (init instanceof URLSearchParams))\n init = String(init);\n\n if (typeof init === 'string') {\n if (init.substring(0, 1) === '?') {\n init = init.substring(1);\n }\n this._list = urlencoded_parse(init);\n }\n\n this._url_object = null;\n this._setList = function (list) { if (!updating) $this._list = list; };\n\n var updating = false;\n this._update_steps = function() {\n if (updating) return;\n updating = true;\n\n if (!$this._url_object) return;\n\n // Partial workaround for IE issue with 'about:'\n if ($this._url_object.protocol === 'about:' &&\n $this._url_object.pathname.indexOf('?') !== -1) {\n $this._url_object.pathname = $this._url_object.pathname.split('?')[0];\n }\n\n $this._url_object.search = urlencoded_serialize($this._list);\n\n updating = false;\n };\n }\n\n\n Object.defineProperties(URLSearchParams.prototype, {\n append: {\n value: function (name, value) {\n this._list.push({ name: name, value: value });\n this._update_steps();\n }, writable: true, enumerable: true, configurable: true\n },\n\n 'delete': {\n value: function (name) {\n for (var i = 0; i < this._list.length;) {\n if (this._list[i].name === name)\n this._list.splice(i, 1);\n else\n ++i;\n }\n this._update_steps();\n }, writable: true, enumerable: true, configurable: true\n },\n\n get: {\n value: function (name) {\n for (var i = 0; i < this._list.length; ++i) {\n if (this._list[i].name === name)\n return this._list[i].value;\n }\n return null;\n }, writable: true, enumerable: true, configurable: true\n },\n\n getAll: {\n value: function (name) {\n var result = [];\n for (var i = 0; i < this._list.length; ++i) {\n if (this._list[i].name === name)\n result.push(this._list[i].value);\n }\n return result;\n }, writable: true, enumerable: true, configurable: true\n },\n\n has: {\n value: function (name) {\n for (var i = 0; i < this._list.length; ++i) {\n if (this._list[i].name === name)\n return true;\n }\n return false;\n }, writable: true, enumerable: true, configurable: true\n },\n\n set: {\n value: function (name, value) {\n var found = false;\n for (var i = 0; i < this._list.length;) {\n if (this._list[i].name === name) {\n if (!found) {\n this._list[i].value = value;\n found = true;\n ++i;\n } else {\n this._list.splice(i, 1);\n }\n } else {\n ++i;\n }\n }\n\n if (!found)\n this._list.push({ name: name, value: value });\n\n this._update_steps();\n }, writable: true, enumerable: true, configurable: true\n },\n\n entries: {\n value: function() {\n var $this = this, index = 0;\n return { next: function() {\n if (index >= $this._list.length)\n return {done: true, value: undefined};\n var pair = $this._list[index++];\n return {done: false, value: [pair.name, pair.value]};\n }};\n }, writable: true, enumerable: true, configurable: true\n },\n\n keys: {\n value: function() {\n var $this = this, index = 0;\n return { next: function() {\n if (index >= $this._list.length)\n return {done: true, value: undefined};\n var pair = $this._list[index++];\n return {done: false, value: pair.name};\n }};\n }, writable: true, enumerable: true, configurable: true\n },\n\n values: {\n value: function() {\n var $this = this, index = 0;\n return { next: function() {\n if (index >= $this._list.length)\n return {done: true, value: undefined};\n var pair = $this._list[index++];\n return {done: false, value: pair.value};\n }};\n }, writable: true, enumerable: true, configurable: true\n },\n\n forEach: {\n value: function(callback) {\n var thisArg = (arguments.length > 1) ? arguments[1] : undefined;\n this._list.forEach(function(pair, index) {\n callback.call(thisArg, pair.value, pair.name);\n });\n\n }, writable: true, enumerable: true, configurable: true\n },\n\n toString: {\n value: function () {\n return urlencoded_serialize(this._list);\n }, writable: true, enumerable: false, configurable: true\n }\n });\n\n if ('Symbol' in global && 'iterator' in global.Symbol) {\n Object.defineProperty(URLSearchParams.prototype, global.Symbol.iterator, {\n value: URLSearchParams.prototype.entries,\n writable: true, enumerable: true, configurable: true});\n }\n\n function URL(url, base) {\n if (!(this instanceof global.URL))\n throw new TypeError(\"Failed to construct 'URL': Please use the 'new' operator.\");\n\n if (base) {\n url = (function () {\n if (nativeURL) return new origURL(url, base).href;\n\n var doc;\n // Use another document/base tag/anchor for relative URL resolution, if possible\n if (document.implementation && document.implementation.createHTMLDocument) {\n doc = document.implementation.createHTMLDocument('');\n } else if (document.implementation && document.implementation.createDocument) {\n doc = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', null);\n doc.documentElement.appendChild(doc.createElement('head'));\n doc.documentElement.appendChild(doc.createElement('body'));\n } else if (window.ActiveXObject) {\n doc = new window.ActiveXObject('htmlfile');\n doc.write('<\\/head><\\/body>');\n doc.close();\n }\n\n if (!doc) throw Error('base not supported');\n\n var baseTag = doc.createElement('base');\n baseTag.href = base;\n doc.getElementsByTagName('head')[0].appendChild(baseTag);\n var anchor = doc.createElement('a');\n anchor.href = url;\n return anchor.href;\n }());\n }\n\n // An inner object implementing URLUtils (either a native URL\n // object or an HTMLAnchorElement instance) is used to perform the\n // URL algorithms. With full ES5 getter/setter support, return a\n // regular object For IE8's limited getter/setter support, a\n // different HTMLAnchorElement is returned with properties\n // overridden\n\n var instance = URLUtils(url || '');\n\n // Detect for ES5 getter/setter support\n // (an Object.defineProperties polyfill that doesn't support getters/setters may throw)\n var ES5_GET_SET = (function() {\n if (!('defineProperties' in Object)) return false;\n try {\n var obj = {};\n Object.defineProperties(obj, { prop: { 'get': function () { return true; } } });\n return obj.prop;\n } catch (_) {\n return false;\n }\n })();\n\n var self = ES5_GET_SET ? this : document.createElement('a');\n\n\n\n var query_object = new URLSearchParams(\n instance.search ? instance.search.substring(1) : null);\n query_object._url_object = self;\n\n Object.defineProperties(self, {\n href: {\n get: function () { return instance.href; },\n set: function (v) { instance.href = v; tidy_instance(); update_steps(); },\n enumerable: true, configurable: true\n },\n origin: {\n get: function () {\n if ('origin' in instance) return instance.origin;\n return this.protocol + '//' + this.host;\n },\n enumerable: true, configurable: true\n },\n protocol: {\n get: function () { return instance.protocol; },\n set: function (v) { instance.protocol = v; },\n enumerable: true, configurable: true\n },\n username: {\n get: function () { return instance.username; },\n set: function (v) { instance.username = v; },\n enumerable: true, configurable: true\n },\n password: {\n get: function () { return instance.password; },\n set: function (v) { instance.password = v; },\n enumerable: true, configurable: true\n },\n host: {\n get: function () {\n // IE returns default port in |host|\n var re = {'http:': /:80$/, 'https:': /:443$/, 'ftp:': /:21$/}[instance.protocol];\n return re ? instance.host.replace(re, '') : instance.host;\n },\n set: function (v) { instance.host = v; },\n enumerable: true, configurable: true\n },\n hostname: {\n get: function () { return instance.hostname; },\n set: function (v) { instance.hostname = v; },\n enumerable: true, configurable: true\n },\n port: {\n get: function () { return instance.port; },\n set: function (v) { instance.port = v; },\n enumerable: true, configurable: true\n },\n pathname: {\n get: function () {\n // IE does not include leading '/' in |pathname|\n if (instance.pathname.charAt(0) !== '/') return '/' + instance.pathname;\n return instance.pathname;\n },\n set: function (v) { instance.pathname = v; },\n enumerable: true, configurable: true\n },\n search: {\n get: function () { return instance.search; },\n set: function (v) {\n if (instance.search === v) return;\n instance.search = v; tidy_instance(); update_steps();\n },\n enumerable: true, configurable: true\n },\n searchParams: {\n get: function () { return query_object; },\n enumerable: true, configurable: true\n },\n hash: {\n get: function () { return instance.hash; },\n set: function (v) { instance.hash = v; tidy_instance(); },\n enumerable: true, configurable: true\n },\n toString: {\n value: function() { return instance.toString(); },\n enumerable: false, configurable: true\n },\n valueOf: {\n value: function() { return instance.valueOf(); },\n enumerable: false, configurable: true\n }\n });\n\n function tidy_instance() {\n var href = instance.href.replace(/#$|\\?$|\\?(?=#)/g, '');\n if (instance.href !== href)\n instance.href = href;\n }\n\n function update_steps() {\n query_object._setList(instance.search ? urlencoded_parse(instance.search.substring(1)) : []);\n query_object._update_steps();\n };\n\n return self;\n }\n\n if (origURL) {\n for (var i in origURL) {\n if (origURL.hasOwnProperty(i) && typeof origURL[i] === 'function')\n URL[i] = origURL[i];\n }\n }\n\n global.URL = URL;\n global.URLSearchParams = URLSearchParams;\n\n}(self));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/js-polyfills/url.js\n// module id = 16\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 = 36\n// module chunks = 1","/* (ignored) */\n\n\n//////////////////\n// WEBPACK FOOTER\n// vertx (ignored)\n// module id = 46\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 = 5\n// module chunks = 0 1"],"sourceRoot":""}
\ No newline at end of file
diff --git a/gulpfile.js b/gulpfile.js
index 7331f3f..05d9c8e 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -30,6 +30,8 @@ watchConfig.watch = true;
// create a single instance of the compiler to allow caching
var watchCompiler = webpack(watchConfig);
+var buildDocs = require('gulp-documentation');
+
// Lint JS
gulp.task('lint', function() {
return gulp.src('src/*.js')
@@ -123,6 +125,24 @@ gulp.task("serve", function(callback) {
});
+gulp.task('docs:md', function () {
+ return gulp.src('./src/epub.js')
+ .pipe(buildDocs({ format: 'md' }))
+ .pipe(gulp.dest('documentation/md'));
+});
+
+gulp.task('docs:html', function () {
+ return gulp.src('./src/epub.js')
+ .pipe(buildDocs({ format: 'html' }))
+ .pipe(gulp.dest('documentation/html'));
+});
+
+gulp.task('docs:watch', function () {
+ return gulp.watch('./src/**/*.js', ['docs:html']);
+});
+
+gulp.task('docs', ['docs:html', 'docs:md']);
+
// Default
gulp.task('default', ['lint', 'bundle']);
diff --git a/karma.conf.js b/karma.conf.js
index 157b792..53b0587 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -48,7 +48,12 @@ module.exports = function(config) {
"jszip": "JSZip",
"xmldom": "xmldom"
},
- devtool: 'inline-source-map'
+ devtool: 'inline-source-map',
+ resolve: {
+ alias: {
+ path: "path-webpack"
+ }
+ }
},
webpackMiddleware: {
@@ -70,7 +75,7 @@ module.exports = function(config) {
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
- logLevel: config.LOG_DEBUG,
+ logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
diff --git a/package.json b/package.json
index 87e830d..b896240 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
"gulp": "^3.9.0",
"gulp-concat": "^2.3.4",
"gulp-connect": "~3.1.1",
+ "gulp-documentation": "fchasen/gulp-documentation",
"gulp-jshint": "^2.0.0",
"gulp-plumber": "^1.1.0",
"gulp-rename": "^1.2.0",
@@ -40,6 +41,7 @@
"mocha-loader": "^1.0.0",
"morgan": "^1.1.1",
"optimist": "^0.6.1",
+ "path-webpack": "^0.0.2",
"portfinder": "^1.0.2",
"raw-loader": "^0.5.1",
"serve-static": "^1.3.1",
diff --git a/src/book.js b/src/book.js
index ace0194..6b6d6e5 100644
--- a/src/book.js
+++ b/src/book.js
@@ -1,19 +1,37 @@
var EventEmitter = require('event-emitter');
var path = require('path');
var core = require('./core');
+var Url = require('./core').Url;
+var Path = require('./core').Path;
var Spine = require('./spine');
var Locations = require('./locations');
var Parser = require('./parser');
+var Container = require('./container');
+var Packaging = require('./packaging');
var Navigation = require('./navigation');
var Rendition = require('./rendition');
var Unarchive = require('./unarchive');
var request = require('./request');
var EpubCFI = require('./epubcfi');
-function Book(_url, options){
+// Const
+var CONTAINER_PATH = "META-INF/container.xml";
+
+/**
+ * Creates a new Book
+ * @class
+ * @param {string} _url
+ * @param {object} options
+ * @param {method} options.requestMethod a request function to use instead of the default
+ * @returns {Book}
+ * @example new Book("/path/to/book.epub", {})
+ */
+function Book(url, options){
this.settings = core.extend(this.settings || {}, {
- requestMethod: this.requestMethod
+ requestMethod: this.requestMethod,
+ requestCredentials: undefined,
+ encoding: undefined // optional to pass 'binary' or base64' for archived Epubs
});
core.extend(this.settings, options);
@@ -21,11 +39,12 @@ function Book(_url, options){
// Promises
this.opening = new core.defer();
+ /**
+ * @property {promise} opened returns after the book is loaded
+ */
this.opened = this.opening.promise;
this.isOpen = false;
- this.url = undefined;
-
this.loading = {
manifest: new core.defer(),
spine: new core.defer(),
@@ -45,6 +64,9 @@ function Book(_url, options){
};
// this.ready = RSVP.hash(this.loaded);
+ /**
+ * @property {promise} ready returns after the book is loaded and parsed
+ */
this.ready = Promise.all([this.loaded.manifest,
this.loaded.spine,
this.loaded.metadata,
@@ -57,216 +79,214 @@ function Book(_url, options){
this.isRendered = false;
// this._q = core.queue(this);
- this.request = this.settings.requestMethod.bind(this);
+ /**
+ * @property {method} request
+ */
+ this.request = this.settings.requestMethod || request;
- this.spine = new Spine(this.request);
- this.locations = new Locations(this.spine, this.request);
+ /**
+ * @property {Spine} spine
+ */
+ this.spine = new Spine();
- if(_url) {
- this.open(_url).catch(function (error) {
- var err = new Error("Cannot load book at "+ _url );
+ /**
+ * @property {Locations} locations
+ */
+ this.locations = new Locations(this.spine, this.load);
+
+ /**
+ * @property {Navigation} navigation
+ */
+ this.navigation = undefined;
+
+ this.url = undefined;
+ this.path = undefined;
+
+ this.archived = false;
+
+ if(url) {
+ this.open(url).catch(function (error) {
+ var err = new Error("Cannot load book at "+ url );
console.error(err);
+ console.error(error);
- this.emit("loadFailed", error);
+ this.emit("openFailed", err);
}.bind(this));
}
};
-Book.prototype.open = function(_url, options){
- var url;
- var pathname;
- var parse = new Parser();
- var epubPackage;
- var epubContainer;
- var book = this;
- var containerPath = "META-INF/container.xml";
- var location;
- var isArrayBuffer = false;
- var isBase64 = options && options.base64;
+/**
+ * open a url
+ * @param {string} input URL, Path or ArrayBuffer
+ * @param {string} [what] to force opening
+ * @returns {Promise} of when the book has been loaded
+ * @example book.open("/path/to/book.epub")
+ */
+Book.prototype.open = function(input, what){
+ var opening;
+ var type = what || this.determineType(input);
- if(!_url) {
- this.opening.resolve(this);
- return this.opened;
- }
-
- // Reuse parsed url or create a new uri object
- // if(typeof(_url) === "object") {
- // uri = _url;
- // } else {
- // uri = core.uri(_url);
- // }
- if (_url instanceof ArrayBuffer || isBase64) {
- isArrayBuffer = true;
- this.url = '/';
- }
-
- if (window && window.location && !isArrayBuffer) {
- // absoluteUri = uri.absoluteTo(window.location.href);
- url = new URL(_url, window.location.href);
- pathname = url.pathname;
- // this.url = absoluteUri.toString();
- this.url = url.toString();
- } else if (window && window.location) {
- this.url = window.location.href;
+ if (type === "binary") {
+ this.archived = true;
+ opening = this.openEpub(input);
+ } else if (type === "epub") {
+ this.archived = true;
+ opening = this.request(input, 'binary')
+ .then(function(epubData) {
+ return this.openEpub(epubData);
+ }.bind(this));
+ } else if(type == "opf") {
+ this.url = new Url(input);
+ opening = this.openPackaging(input);
} else {
- this.url = _url;
- }
-
- // Find path to the Container
- // if(uri && uri.suffix() === "opf") {
- if(url && core.extension(pathname) === "opf") {
- // Direct link to package, no container
- this.packageUrl = _url;
- this.containerUrl = '';
-
- if(url.origin) {
- // this.baseUrl = uri.origin() + uri.directory() + "/";
- this.baseUrl = url.origin + path.dirname(pathname) + "/";
- // } else if(absoluteUri){
- // this.baseUrl = absoluteUri.origin();
- // this.baseUrl += absoluteUri.directory() + "/";
- } else {
- this.baseUrl = path.dirname(pathname) + "/";
- }
-
- epubPackage = this.request(this.packageUrl)
- .catch(function(error) {
- book.opening.reject(error);
- });
-
- } else if(isArrayBuffer || isBase64 || this.isArchivedUrl(_url)) {
- // Book is archived
- this.url = '';
- // this.containerUrl = URI(containerPath).absoluteTo(this.url).toString();
- this.containerUrl = path.resolve("", containerPath);
-
- epubContainer = this.unarchive(_url, isBase64).
- then(function() {
- return this.request(this.containerUrl);
+ this.url = new Url(input);
+ opening = this.openContainer(CONTAINER_PATH)
+ .then(function(packagePath) {
+ return this.openPackaging(packagePath);
}.bind(this))
- .catch(function(error) {
- book.opening.reject(error);
- });
- }
- // Find the path to the Package from the container
- else if (!core.extension(pathname)) {
-
- this.containerUrl = this.url + containerPath;
-
- epubContainer = this.request(this.containerUrl)
- .catch(function(error) {
- // handle errors in loading container
- book.opening.reject(error);
- });
}
- if (epubContainer) {
- epubPackage = epubContainer.
- then(function(containerXml){
- return parse.container(containerXml); // Container has path to content
- }).
- then(function(paths){
- // var packageUri = URI(paths.packagePath);
- // var absPackageUri = packageUri.absoluteTo(book.url);
- var packageUrl;
-
- if (book.url) {
- packageUrl = new URL(paths.packagePath, book.url);
- book.packageUrl = packageUrl.toString();
- } else {
- book.packageUrl = "/" + paths.packagePath;
- }
-
- book.packagePath = paths.packagePath;
- book.encoding = paths.encoding;
-
- // Set Url relative to the content
- if(packageUrl && packageUrl.origin) {
- book.baseUrl = book.url + path.dirname(paths.packagePath) + "/";
- } else {
- if(path.dirname(paths.packagePath)) {
- book.baseUrl = ""
- book.basePath = "/" + path.dirname(paths.packagePath) + "/";
- } else {
- book.basePath = "/"
- }
- }
-
- return book.request(book.packageUrl);
- }).catch(function(error) {
- // handle errors in either of the two requests
- book.opening.reject(error);
- });
- }
-
- epubPackage.then(function(packageXml) {
-
- if (!packageXml) {
- return;
- }
-
- // Get package information from epub opf
- book.unpack(packageXml);
-
- // Resolve promises
- book.loading.manifest.resolve(book.package.manifest);
- book.loading.metadata.resolve(book.package.metadata);
- book.loading.spine.resolve(book.spine);
- book.loading.cover.resolve(book.cover);
-
- book.isOpen = true;
-
- // Clear queue of any waiting book request
-
- // Resolve book opened promise
- book.opening.resolve(book);
-
- }).catch(function(error) {
- // handle errors in parsing the book
- // console.error(error.message, error.stack);
- book.opening.reject(error);
- });
-
- return this.opened;
+ return opening;
};
-Book.prototype.unpack = function(packageXml){
- var book = this,
- parse = new Parser();
+Book.prototype.openEpub = function(data, encoding){
+ return this.unarchive(data, encoding || this.settings.encoding)
+ .then(function() {
+ return this.openContainer("/" + CONTAINER_PATH);
+ }.bind(this))
+ .then(function(packagePath) {
+ return this.openPackaging("/" + packagePath);
+ }.bind(this));
+};
- book.package = parse.packageContents(packageXml); // Extract info from contents
- if(!book.package) {
+Book.prototype.openContainer = function(url){
+ return this.load(url)
+ .then(function(xml) {
+ this.container = new Container(xml);
+ return this.container.packagePath;
+ }.bind(this));
+};
+
+Book.prototype.openPackaging = function(url){
+ var packageUrl;
+ this.path = new Path(url);
+
+ return this.load(url)
+ .then(function(xml) {
+ this.packaging = new Packaging(xml);
+ return this.unpack(this.packaging);
+ }.bind(this));
+};
+
+Book.prototype.load = function (path) {
+ var resolved;
+ if(this.unarchived) {
+ resolved = this.resolve(path);
+ return this.unarchived.request(resolved);
+ } else {
+ resolved = this.resolve(path);
+ return this.request(resolved, null, this.requestCredentials, this.requestHeaders);
+ }
+};
+
+Book.prototype.resolve = function (path, absolute) {
+ var resolved = path;
+ var isAbsolute = (path.indexOf('://') > -1);
+
+ if (isAbsolute) {
+ return path;
+ }
+
+ if (this.path) {
+ resolved = this.path.resolve(path);
+ }
+
+ if(absolute != false && this.url) {
+ resolved = this.url.resolve(resolved);
+ }
+
+ return resolved;
+}
+
+Book.prototype.determineType = function(input) {
+ var url;
+ var path;
+ var extension;
+
+ if (typeof(input) != "string") {
+ return "binary";
+ }
+
+ url = new Url(input);
+ path = url.path();
+ extension = path.extension;
+
+ if (!extension) {
+ return "directory";
+ }
+
+ if(extension === "epub"){
+ return "epub";
+ }
+
+ if(extension === "opf"){
+ return "opf";
+ }
+};
+
+
+/**
+ * unpack the contents of the Books packageXml
+ * @param {document} packageXml XML Document
+ */
+Book.prototype.unpack = function(opf){
+ this.package = opf;
+
+ this.spine.unpack(this.package, this.resolve.bind(this));
+
+ this.loadNavigation(this.package).then(function(toc){
+ this.toc = toc;
+ this.loading.navigation.resolve(this.toc);
+ }.bind(this));
+
+ this.cover = this.resolve(this.package.coverPath);
+
+ // Resolve promises
+ 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.isOpen = true;
+
+ // Resolve book opened promise
+ this.opening.resolve(this);
+};
+
+Book.prototype.loadNavigation = function(opf){
+ var navPath = opf.navPath || opf.ncxPath;
+
+ if (!navPath) {
return;
}
- book.package.baseUrl = book.baseUrl; // Provides a url base for resolving paths
- book.package.basePath = book.basePath; // Provides a url base for resolving paths
- console.log("book.baseUrl", book.baseUrl );
-
- this.spine.load(book.package);
-
- book.navigation = new Navigation(book.package, this.request);
- book.navigation.load().then(function(toc){
- book.toc = toc;
- book.loading.navigation.resolve(book.toc);
- });
-
- // //-- Set Global Layout setting based on metadata
- // MOVE TO RENDER
- // book.globalLayoutProperties = book.parseLayoutProperties(book.package.metadata);
- if (book.baseUrl) {
- book.cover = new URL(book.package.coverPath, book.baseUrl).toString();
- } else {
- book.cover = path.resolve(book.baseUrl, book.package.coverPath);
- }
+ return this.load(navPath, 'xml')
+ .then(function(xml) {
+ this.navigation = new Navigation(xml);
+ }.bind(this));
};
-// Alias for book.spine.get
+/**
+ * Alias for book.spine.get
+ * @param {string} target
+ */
Book.prototype.section = function(target) {
return this.spine.get(target);
};
-// Sugar to render a book
+/**
+ * Sugar to render a book
+ */
Book.prototype.renderTo = function(element, options) {
// var renderMethod = (options && options.method) ?
// options.method :
@@ -278,15 +298,6 @@ Book.prototype.renderTo = function(element, options) {
return this.rendition;
};
-Book.prototype.requestMethod = function(_url) {
- // Switch request methods
- if(this.unarchived) {
- return this.unarchived.request(_url);
- } else {
- return request(_url, null, this.requestCredentials, this.requestHeaders);
- }
-
-};
Book.prototype.setRequestCredentials = function(_credentials) {
this.requestCredentials = _credentials;
@@ -296,12 +307,17 @@ Book.prototype.setRequestHeaders = function(_headers) {
this.requestHeaders = _headers;
};
-Book.prototype.unarchive = function(bookUrl, isBase64){
+/**
+ * Unarchive a zipped epub
+ */
+Book.prototype.unarchive = function(bookUrl, encoding){
this.unarchived = new Unarchive();
- return this.unarchived.open(bookUrl, isBase64);
+ return this.unarchived.open(bookUrl, encoding);
};
-//-- Checks if url has a .epub or .zip extension, or is ArrayBuffer (of zip/epub)
+/**
+ * Checks if url has a .epub or .zip extension, or is ArrayBuffer (of zip/epub)
+ */
Book.prototype.isArchivedUrl = function(bookUrl){
var extension;
@@ -325,7 +341,9 @@ Book.prototype.isArchivedUrl = function(bookUrl){
return false;
};
-//-- Returns the cover
+/**
+ * Get the cover url
+ */
Book.prototype.coverUrl = function(){
var retrieved = this.loaded.cover.
then(function(url) {
@@ -341,6 +359,9 @@ Book.prototype.coverUrl = function(){
return retrieved;
};
+/**
+ * Find a DOM Range for a given CFI Range
+ */
Book.prototype.range = function(cfiRange) {
var cfi = new EpubCFI(cfiRange);
var item = this.spine.get(cfi.spinePos);
@@ -351,7 +372,7 @@ Book.prototype.range = function(cfiRange) {
})
};
-module.exports = Book;
-
//-- Enable binding events to book
EventEmitter(Book.prototype);
+
+module.exports = Book;
diff --git a/src/container.js b/src/container.js
new file mode 100644
index 0000000..2f7088e
--- /dev/null
+++ b/src/container.js
@@ -0,0 +1,33 @@
+var path = require('path');
+var core = require('./core');
+var EpubCFI = require('./epubcfi');
+
+
+function Container(containerDocument) {
+ if (containerDocument) {
+ this.parse(containerDocument);
+ }
+};
+
+Container.prototype.parse = function(containerDocument){
+ //--
+ var rootfile, fullpath, folder, encoding;
+
+ if(!containerDocument) {
+ console.error("Container File Not Found");
+ return;
+ }
+
+ rootfile = core.qs(containerDocument, "rootfile");
+
+ if(!rootfile) {
+ console.error("No RootFile Found");
+ return;
+ }
+
+ this.packagePath = rootfile.getAttribute('full-path');
+ this.directory = path.dirname(this.packagePath);
+ this.encoding = containerDocument.xmlEncoding;
+};
+
+module.exports = Container;
diff --git a/src/contents.js b/src/contents.js
index 54ddb0b..866cb67 100644
--- a/src/contents.js
+++ b/src/contents.js
@@ -174,7 +174,7 @@ Contents.prototype.viewport = function(options) {
var $viewport = this.document.querySelector("meta[name='viewport']");
var newContent = '';
- /**
+ /*
* check for the viewport size
*
*/
diff --git a/src/core.js b/src/core.js
index 7df69f9..d34d43a 100644
--- a/src/core.js
+++ b/src/core.js
@@ -2,88 +2,126 @@ var base64 = require('base64-js');
var path = require('path');
var requestAnimationFrame = (typeof window != 'undefined') ? (window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame) : false;
-/*
-//-- Parse the different parts of a url, returning a object
-function uri(url){
- var uri = {
- protocol : '',
- host : '',
- path : '',
- origin : '',
- directory : '',
- base : '',
- filename : '',
- extension : '',
- fragment : '',
- href : url
- },
- doubleSlash = url.indexOf('://'),
- search = url.indexOf('?'),
- fragment = url.indexOf("#"),
- withoutProtocol,
- dot,
- firstSlash;
- if(fragment != -1) {
- uri.fragment = url.slice(fragment + 1);
- url = url.slice(0, fragment);
+/**
+ * creates a uri object
+ * @param {string} urlString a url string (relative or absolute)
+ * @param {[string]} baseString optional base for the url,
+ * default to window.location.href
+ * @return {object} url
+ */
+function Url(urlString, baseString) {
+ var absolute = (urlString.indexOf('://') > -1);
+
+ this.href = urlString;
+ this.protocol = "";
+ this.origin = "";
+ this.fragment = "";
+ this.search = "";
+ this.base = baseString || undefined;
+
+ if (!absolute && !baseString) {
+ this.base = window && window.location.href;
}
- if(search != -1) {
- uri.search = url.slice(search + 1);
- url = url.slice(0, search);
- href = url;
+ try {
+ this.Url = new URL(urlString, 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;
+ } catch (e) {
+ // console.error(e);
+ this.Url = undefined;
}
- if(doubleSlash != -1) {
- uri.protocol = url.slice(0, doubleSlash);
- withoutProtocol = url.slice(doubleSlash+3);
- firstSlash = withoutProtocol.indexOf('/');
+ this.Path = new Path(this.Url.pathname);
+ this.directory = this.Path.directory;
+ this.filename = this.Path.filename;
+ this.extension = this.Path.extension;
- if(firstSlash === -1) {
- uri.host = uri.path;
- uri.path = "";
- } else {
- uri.host = withoutProtocol.slice(0, firstSlash);
- uri.path = withoutProtocol.slice(firstSlash);
- }
+}
+Url.prototype.path = function () {
+ return this.Path;
+};
- uri.origin = uri.protocol + "://" + uri.host;
+Url.prototype.resolve = function (what) {
+ var isAbsolute = (what.indexOf('://') > -1);
+ var fullpath;
- uri.directory = folder(uri.path);
+ if (isAbsolute) {
+ return what;
+ }
- uri.base = uri.origin + uri.directory;
- // return origin;
+ fullpath = path.resolve(this.directory, what);
+ return this.origin + fullpath;
+};
+
+Url.prototype.relative = function (what) {
+ return path.relative(what, this.directory);
+};
+
+Url.prototype.toString = function () {
+ return this.href;
+};
+
+function Path(pathString) {
+ var protocol;
+ var parsed;
+
+ protocol = pathString.indexOf('://');
+ if (protocol > -1) {
+ pathString = new URL(pathString).pathname;
+ }
+
+ parsed = this.parse(pathString);
+
+ this.path = pathString;
+
+ if (this.isDirectory(pathString)) {
+ this.directory = pathString;
} else {
- uri.path = url;
- uri.directory = folder(url);
- uri.base = uri.directory;
+ this.directory = parsed.dir + "/";
}
- //-- Filename
- uri.filename = url.replace(uri.base, '');
- dot = uri.filename.lastIndexOf('.');
- if(dot != -1) {
- uri.extension = uri.filename.slice(dot+1);
+ this.filename = parsed.base;
+ this.extension = parsed.ext.slice(1);
+
+}
+
+Path.prototype.parse = function (what) {
+ return path.parse(what);
+};
+
+Path.prototype.isDirectory = function (what) {
+ return (what.charAt(what.length-1) === '/');
+};
+
+Path.prototype.resolve = function (what) {
+ return path.resolve(this.directory, what);
+};
+
+Path.prototype.relative = function (what) {
+ return path.relative(this.directory, what);
+};
+
+Path.prototype.splitPath = function(filename) {
+ return this.splitPathRe.exec(filename).slice(1);
+};
+
+Path.prototype.toString = function () {
+ return this.path;
+};
+
+function assertPath(path) {
+ if (typeof path !== 'string') {
+ throw new TypeError('Path must be a string. Received ', path);
}
- return uri;
};
-//-- Parse out the folder, will return everything before the last slash
-function folder(url){
-
- var lastSlash = url.lastIndexOf('/');
-
- if(lastSlash == -1) var folder = '';
-
- folder = url.slice(0, lastSlash + 1);
-
- return folder;
-
-};
-*/
-
function extension(_url) {
var url;
var pathname;
@@ -159,7 +197,7 @@ function resolveUrl(base, path) {
paths;
// if(uri.host) {
- // return path;
+ // return path;
// }
if(baseDirectory[0] === "/") {
@@ -399,10 +437,10 @@ function windowBounds() {
};
//https://stackoverflow.com/questions/13482352/xquery-looking-for-text-with-single-quote/13483496#13483496
-function cleanStringForXpath(str) {
+function cleanStringForXpath(str) {
var parts = str.match(/[^'"]+|['"]/g);
parts = parts.map(function(part){
- if (part === "'") {
+ if (part === "'") {
return '\"\'\"'; // output "'"
}
@@ -571,9 +609,27 @@ function defer() {
Object.freeze(this);
}
+ function querySelectorByType(html, element, type){
+ var query;
+ if (typeof html.querySelector != "undefined") {
+ query = html.querySelector(element+'[*|type="'+type+'"]');
+ }
+ // Handle IE not supporting namespaced epub:type in querySelector
+ if(!query || query.length === 0) {
+ query = core.qsa(html, element);
+ for (var i = 0; i < query.length; i++) {
+ if(query[i].getAttributeNS("http://www.idpf.org/2007/ops", "type") === type) {
+ return query[i];
+ }
+ }
+ } else {
+ return query;
+ }
+}
+
+
+
module.exports = {
- // 'uri': uri,
- // 'folder': folder,
'extension' : extension,
'directory' : directory,
'isElement': isElement,
@@ -605,5 +661,8 @@ module.exports = {
'qsp' : qsp,
'blob2base64' : blob2base64,
'createBase64Url': createBase64Url,
- 'defer': defer
+ 'defer': defer,
+ 'Url': Url,
+ 'Path': Path,
+ 'querySelectorByType': querySelectorByType
};
diff --git a/src/epub.js b/src/epub.js
index 6601fd5..2a8089b 100644
--- a/src/epub.js
+++ b/src/epub.js
@@ -3,8 +3,16 @@ var EpubCFI = require('./epubcfi');
var Rendition = require('./rendition');
var Contents = require('./contents');
-function ePub(_url) {
- return new Book(_url);
+/**
+ * Creates a new Book
+ * @param {string|ArrayBuffer} url URL, Path or ArrayBuffer
+ * @param {object} options to pass to the book
+ * @param options.requestMethod the request function to use
+ * @returns {Book} a new Book object
+ * @example ePub("/path/to/book.epub", {})
+ */
+function ePub(url, options) {
+ return new Book(url, options);
};
ePub.VERSION = "0.3.0";
@@ -15,10 +23,19 @@ ePub.Contents = Contents;
ePub.ViewManagers = {};
ePub.Views = {};
+/**
+ * register plugins
+ */
ePub.register = {
+ /**
+ * register a new view manager
+ */
manager : function(name, manager){
return ePub.ViewManagers[name] = manager;
},
+ /**
+ * register a new view
+ */
view : function(name, view){
return ePub.Views[name] = view;
}
diff --git a/src/managers/helpers/stage.js b/src/managers/helpers/stage.js
index fb3d2fe..8f4c08c 100644
--- a/src/managers/helpers/stage.js
+++ b/src/managers/helpers/stage.js
@@ -12,7 +12,7 @@ function Stage(_options) {
}
-/**
+/*
* Creates an element to render to.
* Resizes to passed width and height or to the elements size
*/
diff --git a/src/navigation.js b/src/navigation.js
index c304424..4000aea 100644
--- a/src/navigation.js
+++ b/src/navigation.js
@@ -1,85 +1,30 @@
var core = require('./core');
-var Parser = require('./parser');
var path = require('path');
-function Navigation(_package, _request){
- var navigation = this;
- var parse = new Parser();
- var request = _request || require('./request');
-
- this.package = _package;
+function Navigation(xml){
this.toc = [];
this.tocByHref = {};
this.tocById = {};
- if(_package.navPath) {
- if (_package.baseUrl) {
- this.navUrl = new URL(_package.navPath, _package.baseUrl).toString();
- } else {
- this.navUrl = path.resolve(_package.basePath, _package.navPath);
- }
- this.nav = {};
-
- this.nav.load = function(_request){
- var loading = new core.defer();
- var loaded = loading.promise;
-
- request(navigation.navUrl, 'xml').then(function(xml){
- navigation.toc = parse.nav(xml);
- navigation.loaded(navigation.toc);
- loading.resolve(navigation.toc);
- });
-
- return loaded;
- };
-
- }
-
- if(_package.ncxPath) {
- if (_package.baseUrl) {
- this.ncxUrl = new URL(_package.ncxPath, _package.baseUrl).toString();
- } else {
- this.ncxUrl = path.resolve(_package.basePath, _package.ncxPath);
- }
-
- this.ncx = {};
-
- this.ncx.load = function(_request){
- var loading = new core.defer();
- var loaded = loading.promise;
-
- request(navigation.ncxUrl, 'xml').then(function(xml){
- navigation.toc = parse.toc(xml);
- navigation.loaded(navigation.toc);
- loading.resolve(navigation.toc);
- });
-
- return loaded;
- };
-
+ if (xml) {
+ this.parse(xml);
}
};
-// Load the navigation
-Navigation.prototype.load = function(_request) {
- var request = _request || require('./request');
- var loading, loaded;
+Navigation.prototype.parse = function(xml) {
+ var html = core.qs(xml, "html");
+ var ncx = core.qs(xml, "ncx");
- if(this.nav) {
- loading = this.nav.load();
- } else if(this.ncx) {
- loading = this.ncx.load();
- } else {
- loaded = new core.defer();
- loaded.resolve([]);
- loading = loaded.promise;
+ if(html) {
+ this.toc = this.parseNav(xml);
+ } else if(ncx){
+ this.toc = this.parseNcx(xml);
}
- return loading;
-
+ this.unpack(this.toc);
};
-Navigation.prototype.loaded = function(toc) {
+Navigation.prototype.unpack = function(toc) {
var item;
for (var i = 0; i < toc.length; i++) {
@@ -107,4 +52,139 @@ Navigation.prototype.get = function(target) {
return this.toc[index];
};
+Navigation.prototype.parseNav = function(navHtml, spineIndexByURL, bookSpine){
+ var navElement = core.querySelectorByType(navHtml, "nav", "toc");
+ // var navItems = navElement ? navElement.querySelectorAll("ol li") : [];
+ var navItems = navElement ? core.qsa(navElement, "li") : [];
+ var length = navItems.length;
+ var i;
+ var toc = {};
+ var list = [];
+ var item, parent;
+
+ if(!navItems || length === 0) return list;
+
+ for (i = 0; i < length; ++i) {
+ item = this.navItem(navItems[i], spineIndexByURL, bookSpine);
+ toc[item.id] = item;
+ if(!item.parent) {
+ list.push(item);
+ } else {
+ parent = toc[item.parent];
+ parent.subitems.push(item);
+ }
+ }
+
+ return list;
+};
+
+Navigation.prototype.navItem = function(item, spineIndexByURL, bookSpine){
+ var id = item.getAttribute('id') || false,
+ // content = item.querySelector("a, span"),
+ content = core.qs(item, "a"),
+ src = content.getAttribute('href') || '',
+ text = content.textContent || "",
+ // split = src.split("#"),
+ // baseUrl = split[0],
+ // spinePos = spineIndexByURL[baseUrl],
+ // spineItem = bookSpine[spinePos],
+ subitems = [],
+ parentNode = item.parentNode,
+ parent;
+ // cfi = spineItem ? spineItem.cfi : '';
+
+ if(parentNode && parentNode.nodeName === "navPoint") {
+ parent = parentNode.getAttribute('id');
+ }
+
+ /*
+ if(!id) {
+ if(spinePos) {
+ spineItem = bookSpine[spinePos];
+ id = spineItem.id;
+ cfi = spineItem.cfi;
+ } else {
+ id = 'epubjs-autogen-toc-id-' + EPUBJS.core.uuid();
+ item.setAttribute('id', id);
+ }
+ }
+ */
+
+ return {
+ "id": id,
+ "href": src,
+ "label": text,
+ "subitems" : subitems,
+ "parent" : parent
+ };
+};
+
+Navigation.prototype.parseNcx = function(tocXml, spineIndexByURL, bookSpine){
+ // var navPoints = tocXml.querySelectorAll("navMap navPoint");
+ var navPoints = core.qsa(tocXml, "navPoint");
+ var length = navPoints.length;
+ var i;
+ var toc = {};
+ var list = [];
+ var item, parent;
+
+ if(!navPoints || length === 0) return list;
+
+ for (i = 0; i < length; ++i) {
+ item = this.ncxItem(navPoints[i], spineIndexByURL, bookSpine);
+ toc[item.id] = item;
+ if(!item.parent) {
+ list.push(item);
+ } else {
+ parent = toc[item.parent];
+ parent.subitems.push(item);
+ }
+ }
+
+ return list;
+};
+
+Navigation.prototype.ncxItem = function(item, spineIndexByURL, bookSpine){
+ var id = item.getAttribute('id') || false,
+ // content = item.querySelector("content"),
+ content = core.qs(item, "content"),
+ src = content.getAttribute('src'),
+ // navLabel = item.querySelector("navLabel"),
+ navLabel = core.qs(item, "navLabel"),
+ text = navLabel.textContent ? navLabel.textContent : "",
+ // split = src.split("#"),
+ // baseUrl = split[0],
+ // spinePos = spineIndexByURL[baseUrl],
+ // spineItem = bookSpine[spinePos],
+ subitems = [],
+ parentNode = item.parentNode,
+ parent;
+ // cfi = spineItem ? spineItem.cfi : '';
+
+ if(parentNode && parentNode.nodeName === "navPoint") {
+ parent = parentNode.getAttribute('id');
+ }
+
+ /*
+ if(!id) {
+ if(spinePos) {
+ spineItem = bookSpine[spinePos];
+ id = spineItem.id;
+ cfi = spineItem.cfi;
+ } else {
+ id = 'epubjs-autogen-toc-id-' + EPUBJS.core.uuid();
+ item.setAttribute('id', id);
+ }
+ }
+ */
+
+ return {
+ "id": id,
+ "href": src,
+ "label": text,
+ "subitems" : subitems,
+ "parent" : parent
+ };
+};
+
module.exports = Navigation;
diff --git a/src/packaging.js b/src/packaging.js
new file mode 100644
index 0000000..2a2f6db
--- /dev/null
+++ b/src/packaging.js
@@ -0,0 +1,234 @@
+var path = require('path');
+var core = require('./core');
+var EpubCFI = require('./epubcfi');
+
+
+function Packaging(packageDocument) {
+ if (packageDocument) {
+ this.parse(packageDocument);
+ }
+};
+
+Packaging.prototype.parse = function(packageDocument){
+ var metadataNode, manifestNode, spineNode;
+
+ if(!packageDocument) {
+ console.error("Package File Not Found");
+ return;
+ }
+
+ metadataNode = core.qs(packageDocument, "metadata");
+ if(!metadataNode) {
+ console.error("No Metadata Found");
+ return;
+ }
+
+ manifestNode = core.qs(packageDocument, "manifest");
+ if(!manifestNode) {
+ console.error("No Manifest Found");
+ return;
+ }
+
+ spineNode = core.qs(packageDocument, "spine");
+ if(!spineNode) {
+ console.error("No Spine Found");
+ return;
+ }
+
+ this.manifest = this.parseManifest(manifestNode);
+ this.navPath = this.findNavPath(manifestNode);
+ this.ncxPath = this.findNcxPath(manifestNode, spineNode);
+ this.coverPath = this.findCoverPath(packageDocument);
+
+ this.spineNodeIndex = Array.prototype.indexOf.call(spineNode.parentNode.childNodes, spineNode);
+
+ this.spine = this.parseSpine(spineNode, this.manifest);
+
+ this.metadata = this.parseMetadata(metadataNode);
+
+ this.metadata.direction = spineNode.getAttribute("page-progression-direction");
+
+
+ return {
+ 'metadata' : this.metadata,
+ 'spine' : this.spine,
+ 'manifest' : this.manifest,
+ 'navPath' : this.navPath,
+ 'ncxPath' : this.ncxPath,
+ 'coverPath': this.coverPath,
+ 'spineNodeIndex' : this.spineNodeIndex
+ };
+};
+
+Packaging.prototype.parseMetadata = function(xml){
+ var metadata = {};
+
+ metadata.title = this.getElementText(xml, 'title');
+ metadata.creator = this.getElementText(xml, 'creator');
+ metadata.description = this.getElementText(xml, 'description');
+
+ metadata.pubdate = this.getElementText(xml, 'date');
+
+ metadata.publisher = this.getElementText(xml, 'publisher');
+
+ metadata.identifier = this.getElementText(xml, "identifier");
+ metadata.language = this.getElementText(xml, "language");
+ metadata.rights = this.getElementText(xml, "rights");
+
+ metadata.modified_date = this.getPropertyText(xml, 'dcterms:modified');
+
+ metadata.layout = this.getPropertyText(xml, "rendition:layout");
+ metadata.orientation = this.getPropertyText(xml, 'rendition:orientation');
+ metadata.flow = this.getPropertyText(xml, 'rendition:flow');
+ metadata.viewport = this.getPropertyText(xml, 'rendition:viewport');
+ // metadata.page_prog_dir = packageXml.querySelector("spine").getAttribute("page-progression-direction");
+
+ return metadata;
+};
+
+Packaging.prototype.parseManifest = function(manifestXml){
+ var manifest = {};
+
+ //-- Turn items into an array
+ // var selected = manifestXml.querySelectorAll("item");
+ var selected = core.qsa(manifestXml, "item");
+ var items = Array.prototype.slice.call(selected);
+
+ //-- Create an object with the id as key
+ items.forEach(function(item){
+ var id = item.getAttribute('id'),
+ href = item.getAttribute('href') || '',
+ type = item.getAttribute('media-type') || '',
+ properties = item.getAttribute('properties') || '';
+
+ manifest[id] = {
+ 'href' : href,
+ // 'url' : href,
+ 'type' : type,
+ 'properties' : properties.length ? properties.split(' ') : []
+ };
+
+ });
+
+ return manifest;
+
+};
+
+Packaging.prototype.parseSpine = function(spineXml, manifest){
+ var spine = [];
+
+ var selected = spineXml.getElementsByTagName("itemref"),
+ items = Array.prototype.slice.call(selected);
+
+ var epubcfi = new EpubCFI();
+
+ //-- Add to array to mantain ordering and cross reference with manifest
+ items.forEach(function(item, index){
+ var idref = item.getAttribute('idref');
+ // var cfiBase = epubcfi.generateChapterComponent(spineNodeIndex, index, Id);
+ var props = item.getAttribute('properties') || '';
+ var propArray = props.length ? props.split(' ') : [];
+ // var manifestProps = manifest[Id].properties;
+ // var manifestPropArray = manifestProps.length ? manifestProps.split(' ') : [];
+
+ var itemref = {
+ 'idref' : idref,
+ 'linear' : item.getAttribute('linear') || '',
+ 'properties' : propArray,
+ // 'href' : manifest[Id].href,
+ // 'url' : manifest[Id].url,
+ 'index' : index
+ // 'cfiBase' : cfiBase
+ };
+ spine.push(itemref);
+ });
+
+ return spine;
+};
+
+/**
+ * Find TOC NAV
+ */
+Packaging.prototype.findNavPath = function(manifestNode){
+ // Find item with property 'nav'
+ // Should catch nav irregardless of order
+ // var node = manifestNode.querySelector("item[properties$='nav'], item[properties^='nav '], item[properties*=' nav ']");
+ var node = core.qsp(manifestNode, "item", {"properties":"nav"});
+ return node ? node.getAttribute('href') : false;
+};
+
+/**
+ * Find TOC NCX
+ * media-type="application/x-dtbncx+xml" href="toc.ncx"
+ */
+Packaging.prototype.findNcxPath = function(manifestNode, spineNode){
+ // var node = manifestNode.querySelector("item[media-type='application/x-dtbncx+xml']");
+ var node = core.qsp(manifestNode, "item", {"media-type":"application/x-dtbncx+xml"});
+ var tocId;
+
+ // If we can't find the toc by media-type then try to look for id of the item in the spine attributes as
+ // according to http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.4.1.2,
+ // "The item that describes the NCX must be referenced by the spine toc attribute."
+ if (!node) {
+ tocId = spineNode.getAttribute("toc");
+ if(tocId) {
+ // node = manifestNode.querySelector("item[id='" + tocId + "']");
+ node = manifestNode.getElementById(tocId);
+ }
+ }
+
+ return node ? node.getAttribute('href') : false;
+};
+
+//-- Find Cover:
+//-- Fallback for Epub 2.0
+Packaging.prototype.findCoverPath = function(packageXml){
+ var pkg = core.qs(packageXml, "package");
+ var epubVersion = pkg.getAttribute('version');
+
+ if (epubVersion === '2.0') {
+ var metaCover = core.qsp(packageXml, 'meta', {'name':'cover'});
+ if (metaCover) {
+ var coverId = metaCover.getAttribute('content');
+ // var cover = packageXml.querySelector("item[id='" + coverId + "']");
+ var cover = packageXml.getElementById(coverId);
+ return cover ? cover.getAttribute('href') : false;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ // var node = packageXml.querySelector("item[properties='cover-image']");
+ var node = core.qsp(packageXml, 'item', {'properties':'cover-image'});
+ return node ? node.getAttribute('href') : false;
+ }
+};
+
+Packaging.prototype.getElementText = function(xml, tag){
+ var found = xml.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/", tag),
+ el;
+
+ if(!found || found.length === 0) return '';
+
+ el = found[0];
+
+ if(el.childNodes.length){
+ return el.childNodes[0].nodeValue;
+ }
+
+ return '';
+
+};
+
+Packaging.prototype.getPropertyText = function(xml, property){
+ var el = core.qsp(xml, "meta", {"property":property});
+
+ if(el && el.childNodes.length){
+ return el.childNodes[0].nodeValue;
+ }
+
+ return '';
+};
+
+module.exports = Packaging;
diff --git a/src/parser.js b/src/parser.js
index 3b07818..0735f14 100644
--- a/src/parser.js
+++ b/src/parser.js
@@ -5,216 +5,7 @@ var EpubCFI = require('./epubcfi');
function Parser(){};
-Parser.prototype.container = function(containerXml){
- //--
- var rootfile, fullpath, folder, encoding;
-
- if(!containerXml) {
- console.error("Container File Not Found");
- return;
- }
-
- rootfile = core.qs(containerXml, "rootfile");
-
- if(!rootfile) {
- console.error("No RootFile Found");
- return;
- }
-
- fullpath = rootfile.getAttribute('full-path');
- folder = path.dirname(fullpath);
- encoding = containerXml.xmlEncoding;
-
- //-- Now that we have the path we can parse the contents
- return {
- 'packagePath' : fullpath,
- 'basePath' : folder,
- 'encoding' : encoding
- };
-};
-
-Parser.prototype.identifier = function(packageXml){
- var metadataNode;
-
- if(!packageXml) {
- console.error("Package File Not Found");
- return;
- }
-
- metadataNode = core.qs(packageXml, "metadata");
-
- if(!metadataNode) {
- console.error("No Metadata Found");
- return;
- }
-
- return this.getElementText(metadataNode, "identifier");
-};
-
-Parser.prototype.packageContents = function(packageXml){
- var parse = this;
- var metadataNode, manifestNode, spineNode;
- var manifest, navPath, ncxPath, coverPath;
- var spineNodeIndex;
- var spine;
- var spineIndexByURL;
- var metadata;
-
- if(!packageXml) {
- console.error("Package File Not Found");
- return;
- }
-
- metadataNode = core.qs(packageXml, "metadata");
- if(!metadataNode) {
- console.error("No Metadata Found");
- return;
- }
-
- manifestNode = core.qs(packageXml, "manifest");
- if(!manifestNode) {
- console.error("No Manifest Found");
- return;
- }
-
- spineNode = core.qs(packageXml, "spine");
- if(!spineNode) {
- console.error("No Spine Found");
- return;
- }
-
- manifest = parse.manifest(manifestNode);
- navPath = parse.findNavPath(manifestNode);
- ncxPath = parse.findNcxPath(manifestNode, spineNode);
- coverPath = parse.findCoverPath(packageXml);
-
- spineNodeIndex = Array.prototype.indexOf.call(spineNode.parentNode.childNodes, spineNode);
-
- spine = parse.spine(spineNode, manifest);
-
- metadata = parse.metadata(metadataNode);
-
- metadata.direction = spineNode.getAttribute("page-progression-direction");
-
- return {
- 'metadata' : metadata,
- 'spine' : spine,
- 'manifest' : manifest,
- 'navPath' : navPath,
- 'ncxPath' : ncxPath,
- 'coverPath': coverPath,
- 'spineNodeIndex' : spineNodeIndex
- };
-};
-
-//-- Find TOC NAV
-Parser.prototype.findNavPath = function(manifestNode){
- // Find item with property 'nav'
- // Should catch nav irregardless of order
- // var node = manifestNode.querySelector("item[properties$='nav'], item[properties^='nav '], item[properties*=' nav ']");
- var node = core.qsp(manifestNode, "item", {"properties":"nav"});
- return node ? node.getAttribute('href') : false;
-};
-
-//-- Find TOC NCX: media-type="application/x-dtbncx+xml" href="toc.ncx"
-Parser.prototype.findNcxPath = function(manifestNode, spineNode){
- // var node = manifestNode.querySelector("item[media-type='application/x-dtbncx+xml']");
- var node = core.qsp(manifestNode, "item", {"media-type":"application/x-dtbncx+xml"});
- var tocId;
-
- // If we can't find the toc by media-type then try to look for id of the item in the spine attributes as
- // according to http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.4.1.2,
- // "The item that describes the NCX must be referenced by the spine toc attribute."
- if (!node) {
- tocId = spineNode.getAttribute("toc");
- if(tocId) {
- // node = manifestNode.querySelector("item[id='" + tocId + "']");
- node = manifestNode.getElementById(tocId);
- }
- }
-
- return node ? node.getAttribute('href') : false;
-};
-
-//-- Expanded to match Readium web components
-Parser.prototype.metadata = function(xml){
- var metadata = {},
- p = this;
-
- metadata.title = p.getElementText(xml, 'title');
- metadata.creator = p.getElementText(xml, 'creator');
- metadata.description = p.getElementText(xml, 'description');
-
- metadata.pubdate = p.getElementText(xml, 'date');
-
- metadata.publisher = p.getElementText(xml, 'publisher');
-
- metadata.identifier = p.getElementText(xml, "identifier");
- metadata.language = p.getElementText(xml, "language");
- metadata.rights = p.getElementText(xml, "rights");
-
- metadata.modified_date = p.getPropertyText(xml, 'dcterms:modified');
-
- metadata.layout = p.getPropertyText(xml, "rendition:layout");
- metadata.orientation = p.getPropertyText(xml, 'rendition:orientation');
- metadata.flow = p.getPropertyText(xml, 'rendition:flow');
- metadata.viewport = p.getPropertyText(xml, 'rendition:viewport');
- // metadata.page_prog_dir = packageXml.querySelector("spine").getAttribute("page-progression-direction");
-
- return metadata;
-};
-
-//-- Find Cover:
-//-- Fallback for Epub 2.0
-Parser.prototype.findCoverPath = function(packageXml){
- var pkg = core.qs(packageXml, "package");
- var epubVersion = pkg.getAttribute('version');
-
- if (epubVersion === '2.0') {
- var metaCover = core.qsp(packageXml, 'meta', {'name':'cover'});
- if (metaCover) {
- var coverId = metaCover.getAttribute('content');
- // var cover = packageXml.querySelector("item[id='" + coverId + "']");
- var cover = packageXml.getElementById(coverId);
- return cover ? cover.getAttribute('href') : false;
- }
- else {
- return false;
- }
- }
- else {
- // var node = packageXml.querySelector("item[properties='cover-image']");
- var node = core.qsp(packageXml, 'item', {'properties':'cover-image'});
- return node ? node.getAttribute('href') : false;
- }
-};
-
-Parser.prototype.getElementText = function(xml, tag){
- var found = xml.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/", tag),
- el;
-
- if(!found || found.length === 0) return '';
-
- el = found[0];
-
- if(el.childNodes.length){
- return el.childNodes[0].nodeValue;
- }
-
- return '';
-
-};
-
-Parser.prototype.getPropertyText = function(xml, property){
- var el = core.qsp(xml, "meta", {"property":property});
-
- if(el && el.childNodes.length){
- return el.childNodes[0].nodeValue;
- }
-
- return '';
-};
-
+/*
Parser.prototype.querySelectorText = function(xml, q){
var el = xml.querySelector(q);
@@ -224,66 +15,7 @@ Parser.prototype.querySelectorText = function(xml, q){
return '';
};
-
-Parser.prototype.manifest = function(manifestXml){
- var manifest = {};
-
- //-- Turn items into an array
- // var selected = manifestXml.querySelectorAll("item");
- var selected = core.qsa(manifestXml, "item");
- var items = Array.prototype.slice.call(selected);
-
- //-- Create an object with the id as key
- items.forEach(function(item){
- var id = item.getAttribute('id'),
- href = item.getAttribute('href') || '',
- type = item.getAttribute('media-type') || '',
- properties = item.getAttribute('properties') || '';
-
- manifest[id] = {
- 'href' : href,
- // 'url' : href,
- 'type' : type,
- 'properties' : properties.length ? properties.split(' ') : []
- };
-
- });
-
- return manifest;
-
-};
-
-Parser.prototype.spine = function(spineXml, manifest){
- var spine = [];
-
- var selected = spineXml.getElementsByTagName("itemref"),
- items = Array.prototype.slice.call(selected);
-
- var epubcfi = new EpubCFI();
-
- //-- Add to array to mantain ordering and cross reference with manifest
- items.forEach(function(item, index){
- var idref = item.getAttribute('idref');
- // var cfiBase = epubcfi.generateChapterComponent(spineNodeIndex, index, Id);
- var props = item.getAttribute('properties') || '';
- var propArray = props.length ? props.split(' ') : [];
- // var manifestProps = manifest[Id].properties;
- // var manifestPropArray = manifestProps.length ? manifestProps.split(' ') : [];
-
- var itemref = {
- 'idref' : idref,
- 'linear' : item.getAttribute('linear') || '',
- 'properties' : propArray,
- // 'href' : manifest[Id].href,
- // 'url' : manifest[Id].url,
- 'index' : index
- // 'cfiBase' : cfiBase
- };
- spine.push(itemref);
- });
-
- return spine;
-};
+*/
Parser.prototype.querySelectorByType = function(html, element, type){
var query;
@@ -303,140 +35,7 @@ Parser.prototype.querySelectorByType = function(html, element, type){
}
};
-Parser.prototype.nav = function(navHtml, spineIndexByURL, bookSpine){
- var navElement = this.querySelectorByType(navHtml, "nav", "toc");
- // var navItems = navElement ? navElement.querySelectorAll("ol li") : [];
- var navItems = navElement ? core.qsa(navElement, "li") : [];
- var length = navItems.length;
- var i;
- var toc = {};
- var list = [];
- var item, parent;
- if(!navItems || length === 0) return list;
-
- for (i = 0; i < length; ++i) {
- item = this.navItem(navItems[i], spineIndexByURL, bookSpine);
- toc[item.id] = item;
- if(!item.parent) {
- list.push(item);
- } else {
- parent = toc[item.parent];
- parent.subitems.push(item);
- }
- }
-
- return list;
-};
-
-Parser.prototype.navItem = function(item, spineIndexByURL, bookSpine){
- var id = item.getAttribute('id') || false,
- // content = item.querySelector("a, span"),
- content = core.qs(item, "a"),
- src = content.getAttribute('href') || '',
- text = content.textContent || "",
- // split = src.split("#"),
- // baseUrl = split[0],
- // spinePos = spineIndexByURL[baseUrl],
- // spineItem = bookSpine[spinePos],
- subitems = [],
- parentNode = item.parentNode,
- parent;
- // cfi = spineItem ? spineItem.cfi : '';
-
- if(parentNode && parentNode.nodeName === "navPoint") {
- parent = parentNode.getAttribute('id');
- }
-
- /*
- if(!id) {
- if(spinePos) {
- spineItem = bookSpine[spinePos];
- id = spineItem.id;
- cfi = spineItem.cfi;
- } else {
- id = 'epubjs-autogen-toc-id-' + EPUBJS.core.uuid();
- item.setAttribute('id', id);
- }
- }
- */
-
- return {
- "id": id,
- "href": src,
- "label": text,
- "subitems" : subitems,
- "parent" : parent
- };
-};
-
-Parser.prototype.ncx = function(tocXml, spineIndexByURL, bookSpine){
- // var navPoints = tocXml.querySelectorAll("navMap navPoint");
- var navPoints = core.qsa(tocXml, "navPoint");
- var length = navPoints.length;
- var i;
- var toc = {};
- var list = [];
- var item, parent;
-
- if(!navPoints || length === 0) return list;
-
- for (i = 0; i < length; ++i) {
- item = this.ncxItem(navPoints[i], spineIndexByURL, bookSpine);
- toc[item.id] = item;
- if(!item.parent) {
- list.push(item);
- } else {
- parent = toc[item.parent];
- parent.subitems.push(item);
- }
- }
-
- return list;
-};
-
-Parser.prototype.ncxItem = function(item, spineIndexByURL, bookSpine){
- var id = item.getAttribute('id') || false,
- // content = item.querySelector("content"),
- content = core.qs(item, "content"),
- src = content.getAttribute('src'),
- // navLabel = item.querySelector("navLabel"),
- navLabel = core.qs(item, "navLabel"),
- text = navLabel.textContent ? navLabel.textContent : "",
- // split = src.split("#"),
- // baseUrl = split[0],
- // spinePos = spineIndexByURL[baseUrl],
- // spineItem = bookSpine[spinePos],
- subitems = [],
- parentNode = item.parentNode,
- parent;
- // cfi = spineItem ? spineItem.cfi : '';
-
- if(parentNode && parentNode.nodeName === "navPoint") {
- parent = parentNode.getAttribute('id');
- }
-
- /*
- if(!id) {
- if(spinePos) {
- spineItem = bookSpine[spinePos];
- id = spineItem.id;
- cfi = spineItem.cfi;
- } else {
- id = 'epubjs-autogen-toc-id-' + EPUBJS.core.uuid();
- item.setAttribute('id', id);
- }
- }
- */
-
- return {
- "id": id,
- "href": src,
- "label": text,
- "subitems" : subitems,
- "parent" : parent
- };
-};
Parser.prototype.pageList = function(navHtml, spineIndexByURL, bookSpine){
var navElement = this.querySelectorByType(navHtml, "nav", "page-list");
diff --git a/src/rendition.js b/src/rendition.js
index 7cf156f..60f16e8 100644
--- a/src/rendition.js
+++ b/src/rendition.js
@@ -7,6 +7,7 @@ var EpubCFI = require('./epubcfi');
var Queue = require('./queue');
var Layout = require('./layout');
var Mapping = require('./mapping');
+var Path = require('./core').Path;
function Rendition(book, options) {
@@ -58,7 +59,7 @@ function Rendition(book, options) {
// this.started = this.starting.promise;
this.q.enqueue(this.start);
- if(this.book.unarchived) {
+ if(this.book.archived) {
this.q.enqueue(this.replacements.bind(this));
}
@@ -106,7 +107,7 @@ Rendition.prototype.start = function(){
this.manager = new this.ViewManager({
view: this.View,
queue: this.q,
- request: this.book.request,
+ request: this.book.load.bind(this.book),
settings: this.settings
});
}
@@ -441,7 +442,7 @@ Rendition.prototype.replacements = function(){
var processing = urls.
map(function(url) {
// var absolute = new URL(url, this.book.baseUrl).toString();
- var absolute = path.resolve(this.book.basePath, url);
+ var absolute = this.book.resolve(url);
// Full url from archive base
return this.book.unarchived.createUrl(absolute, {"base64": this.settings.useBase64});
}.bind(this));
@@ -494,32 +495,15 @@ Rendition.prototype.replaceCss = function(href, urls, replacementUrls){
}
var fileUri;
- var absolute;
- if (this.book.baseUrl) {
- fileUri = new URL(href, this.book.baseUrl);
- absolute = fileUri.toString();
- } else {
- absolute = path.resolve(this.book.basePath, href);
- }
-
+ var absolute = this.book.resolve(href);
// Get the text of the css file from the archive
var textResponse = this.book.unarchived.getText(absolute);
// Get asset links relative to css file
var relUrls = urls.
map(function(assetHref) {
- // var assetUri = URI(assetHref).absoluteTo(this.book.baseUrl);
- // var relative = assetUri.relativeTo(absolute).toString();
-
- var assetUrl;
- var relativeUrl;
- if (this.book.baseUrl) {
- assetUrl = new URL(assetHref, this.book.baseUrl);
- relative = path.relative(path.dirname(fileUri.pathname), assetUrl.pathname);
- } else {
- assetUrl = path.resolve(this.book.basePath, assetHref);
- relative = path.relative(path.dirname(absolute), assetUrl);
- }
+ var resolved = this.book.resolve(assetHref);
+ var relative = new Path(absolute).relative(resolved);
return relative;
}.bind(this));
@@ -552,34 +536,17 @@ Rendition.prototype.replaceCss = function(href, urls, replacementUrls){
Rendition.prototype.replaceAssets = function(section, urls, replacementUrls){
// var fileUri = URI(section.url);
var fileUri;
- var absolute;
- if (this.book.baseUrl) {
- fileUri = new URL(section.url, this.book.baseUrl);
- absolute = fileUri.toString();
- } else {
- absolute = path.resolve(this.book.basePath, section.url);
- }
+ var absolute = section.url;
// Get Urls relative to current sections
var relUrls = urls.
map(function(href) {
- // var assetUri = URI(href).absoluteTo(this.book.baseUrl);
- // var relative = assetUri.relativeTo(fileUri).toString();
-
- var assetUrl;
- var relativeUrl;
- if (this.book.baseUrl) {
- assetUrl = new URL(href, this.book.baseUrl);
- relative = path.relative(path.dirname(fileUri.pathname), assetUrl.pathname);
- } else {
- assetUrl = path.resolve(this.book.basePath, href);
- relative = path.relative(path.dirname(absolute), assetUrl);
- }
+ var resolved = this.book.resolve(href);
+ var relative = new Path(absolute).relative(resolved);
return relative;
}.bind(this));
-
section.output = replace.substitute(section.output, relUrls, replacementUrls);
};
diff --git a/src/replacements.js b/src/replacements.js
index dd5a4f7..d83b398 100644
--- a/src/replacements.js
+++ b/src/replacements.js
@@ -57,18 +57,8 @@ function links(view, renderer) {
// var linkUri = URI(href);
// var absolute = linkUri.absoluteTo(view.section.url);
// var relative = absolute.relativeTo(this.book.baseUrl).toString();
- var linkUrl;
- var linkPath;
- var relative;
-
- if (this.book.baseUrl) {
- linkUrl = new URL(href, this.book.baseUrl);
- relative = path.relative(path.dirname(linkUrl.pathname), this.book.packagePath);
- } else {
- linkPath = path.resolve(this.book.basePath, href);
- relative = path.relative(this.book.packagePath, linkPath);
- }
-
+ var relative = this.book.resolve(href, false);
+
if(linkUrl && linkUrl.protocol){
link.setAttribute("target", "_blank");
diff --git a/src/section.js b/src/section.js
index 43a06d1..39fa38c 100644
--- a/src/section.js
+++ b/src/section.js
@@ -58,7 +58,6 @@ Section.prototype.base = function(_document){
var task = new core.defer();
var base = _document.createElement("base"); // TODO: check if exists
var head;
- console.log(window.location.origin + "/" +this.url);
base.setAttribute("href", window.location.origin + "/" +this.url);
@@ -113,7 +112,7 @@ Section.prototype.find = function(_query){
};
-/**
+/*
* Reconciles the current chapters layout properies with
* the global layout properities.
* Takes: global layout settings object, chapter properties string
diff --git a/src/spine.js b/src/spine.js
index 04a2280..9cf8450 100644
--- a/src/spine.js
+++ b/src/spine.js
@@ -4,8 +4,7 @@ var Hook = require('./hook');
var Section = require('./section');
var replacements = require('./replacements');
-function Spine(_request){
- this.request = _request;
+function Spine(){
this.spineItems = [];
this.spineByHref = {};
this.spineById = {};
@@ -23,7 +22,7 @@ function Spine(_request){
this.loaded = false;
};
-Spine.prototype.load = function(_package) {
+Spine.prototype.unpack = function(_package, resolver) {
this.items = _package.spine;
this.manifest = _package.manifest;
@@ -40,7 +39,7 @@ Spine.prototype.load = function(_package) {
if(manifestItem) {
item.href = manifestItem.href;
- item.url = this.baseUrl + item.href;
+ item.url = resolver(item.href, true);
if(manifestItem.properties.length){
item.properties.push.apply(item.properties, manifestItem.properties);
diff --git a/src/unarchive.js b/src/unarchive.js
index 4f9407f..ccefc0d 100644
--- a/src/unarchive.js
+++ b/src/unarchive.js
@@ -11,26 +11,24 @@ function Unarchive() {
Unarchive.prototype.checkRequirements = function(callback){
try {
- if (typeof JSZip !== 'undefined') {
- this.zip = new JSZip();
- } else {
+ if (typeof JSZip === 'undefined') {
JSZip = require('jszip');
- this.zip = new JSZip();
}
+ this.zip = new JSZip();
} catch (e) {
console.error("JSZip lib not loaded");
}
};
-Unarchive.prototype.open = function(zipUrl, isBase64){
- if (zipUrl instanceof ArrayBuffer || isBase64) {
- return this.zip.loadAsync(zipUrl, {"base64": isBase64});
- } else {
- return request(zipUrl, "binary")
- .then(function(data){
- return this.zip.loadAsync(data);
- }.bind(this));
- }
+Unarchive.prototype.open = function(input, isBase64){
+ return this.zip.loadAsync(input, {"base64": isBase64});
+};
+
+Unarchive.prototype.openUrl = function(zipUrl, isBase64){
+ return request(zipUrl, "binary")
+ .then(function(data){
+ return this.zip.loadAsync(data, {"base64": isBase64});
+ }.bind(this));
};
Unarchive.prototype.request = function(url, type){
diff --git a/test/book.js b/test/book.js
new file mode 100644
index 0000000..0c3b820
--- /dev/null
+++ b/test/book.js
@@ -0,0 +1,11 @@
+var assert = require('assert');
+describe('Book', function() {
+
+ var Book = require('../src/book');
+
+ before(function(){
+
+ });
+
+
+})
diff --git a/test/core.js b/test/core.js
new file mode 100644
index 0000000..7901601
--- /dev/null
+++ b/test/core.js
@@ -0,0 +1,171 @@
+var assert = require('assert');
+describe('Core', function() {
+
+
+ before(function(){
+
+ });
+
+
+ describe('Url', function () {
+
+ var Url = require('../src/core').Url;
+
+ it("Url()", function() {
+ var url = new Url("http://example.com/fred/chasen/derf.html");
+
+ assert.equal( url.href, "http://example.com/fred/chasen/derf.html" );
+ assert.equal( url.directory, "/fred/chasen/" );
+ assert.equal( url.extension, "html" );
+ assert.equal( url.filename, "derf.html" );
+ assert.equal( url.origin, "http://example.com" );
+ assert.equal( url.protocol, "http:" );
+ assert.equal( url.search, "" );
+ });
+
+ describe('#resolve()', function () {
+ it("should join subfolders", function() {
+ var a = "http://example.com/fred/chasen/";
+ var b = "ops/derf.html";
+
+ var resolved = new Url(a).resolve(b);
+ assert.equal( resolved, "http://example.com/fred/chasen/ops/derf.html" );
+ });
+
+ it("should resolve up a level", function() {
+ var a = "http://example.com/fred/chasen/index.html";
+ var b = "../derf.html";
+
+ var resolved = new Url(a).resolve(b);
+ assert.equal( resolved, "http://example.com/fred/derf.html" );
+ });
+
+ it("should resolve absolute", function() {
+ var a = "http://example.com/fred/chasen/index.html";
+ var b = "/derf.html";
+
+ var resolved = new Url(a).resolve(b);
+ assert.equal( resolved, "http://example.com/derf.html" );
+ });
+
+ it("should resolve with search strings", function() {
+ var a = "http://example.com/fred/chasen/index.html?debug=true";
+ var b = "/derf.html";
+
+ var resolved = new Url(a).resolve(b);
+ assert.equal( resolved, "http://example.com/derf.html" );
+ });
+
+ });
+ });
+
+ describe('Path', function () {
+
+ var Path = require('../src/core').Path;
+
+ it("Path()", function() {
+ var path = new Path("/fred/chasen/derf.html");
+
+ assert.equal( path.path, "/fred/chasen/derf.html" );
+ assert.equal( path.directory, "/fred/chasen/" );
+ assert.equal( path.extension, "html" );
+ assert.equal( path.filename, "derf.html" );
+ });
+
+ it("Strip out url", function() {
+ var path = new Path("http://example.com/fred/chasen/derf.html");
+
+ assert.equal( path.path, "/fred/chasen/derf.html" );
+ assert.equal( path.directory, "/fred/chasen/" );
+ assert.equal( path.extension, "html" );
+ assert.equal( path.filename, "derf.html" );
+ });
+
+ describe('#parse()', function () {
+ it("should parse a path", function() {
+ var path = Path.prototype.parse("/fred/chasen/derf.html");
+
+ assert.equal( path.dir, "/fred/chasen" );
+ assert.equal( path.base, "derf.html" );
+ assert.equal( path.ext, ".html" );
+ });
+
+ it("should parse a relative path", function() {
+ var path = Path.prototype.parse("fred/chasen/derf.html");
+
+ assert.equal( path.dir, "fred/chasen" );
+ assert.equal( path.base, "derf.html" );
+ assert.equal( path.ext, ".html" );
+ });
+ });
+
+ describe('#isDirectory()', function () {
+ it("should recognize a directory", function() {
+ var directory = Path.prototype.isDirectory("/fred/chasen/");
+ var notDirectory = Path.prototype.isDirectory("/fred/chasen/derf.html");
+
+ assert(directory, "/fred/chasen/ is a directory" );
+ assert(!notDirectory, "/fred/chasen/derf.html is not directory" );
+ });
+ });
+
+ describe('#resolve()', function () {
+
+ it("should resolve a path", function() {
+ var a = "/fred/chasen/index.html";
+ var b = "derf.html";
+
+ var resolved = new Path(a).resolve(b);
+ assert.equal(resolved, "/fred/chasen/derf.html" );
+ });
+
+ it("should resolve a relative path", function() {
+ var a = "fred/chasen/index.html";
+ var b = "derf.html";
+
+ var resolved = new Path(a).resolve(b);
+ assert.equal(resolved, "/fred/chasen/derf.html" );
+ });
+
+ it("should resolve a level up", function() {
+ var a = "/fred/chasen/index.html";
+ var b = "../derf.html";
+
+ var resolved = new Path(a).resolve(b);
+ assert.equal(resolved, "/fred/derf.html" );
+ });
+
+ });
+
+ describe('#relative()', function () {
+
+ it("should find a relative path at the same level", function() {
+ var a = "/fred/chasen/index.html";
+ var b = "/fred/chasen/derf.html";
+
+ var relative = new Path(a).relative(b);
+ assert.equal(relative, "derf.html" );
+ });
+
+ it("should find a relative path down a level", function() {
+ var a = "/fred/chasen/index.html";
+ var b = "/fred/chasen/ops/derf.html";
+
+ var relative = new Path(a).relative(b);
+ assert.equal(relative, "ops/derf.html" );
+ });
+
+ it("should resolve a level up", function() {
+ var a = "/fred/chasen/index.html";
+ var b = "/fred/derf.html";
+
+ var relative = new Path(a).relative(b);
+ assert.equal(relative, "../derf.html" );
+ });
+
+ });
+
+
+ });
+
+});
diff --git a/test/epub.js b/test/epub.js
index 24b358f..ed5cb37 100644
--- a/test/epub.js
+++ b/test/epub.js
@@ -29,25 +29,23 @@ describe('ePub', function() {
// server.restore();
});
- it('should open a epub', function(done) {
+ it('should open a epub', function() {
var book = ePub("/fixtures/alice/OPS/package.opf");
- book.opened.then(function(){
+ return book.opened.then(function(){
assert.equal( book.isOpen, true, "book is opened" );
- assert.equal( book.url, "http://localhost:9876/fixtures/alice/OPS/package.opf", "book url is passed to new Book" );
- done();
+ assert.equal( book.url.toString(), "http://localhost:9876/fixtures/alice/OPS/package.opf", "book url is passed to new Book" );
});
});
- it('should open a archived epub', function(done) {
+ it('should open a archived epub', function() {
var book = ePub("/fixtures/alice.epub");
assert(typeof (JSZip) !== "undefined", "JSZip is present" );
- book.opened.then(function(){
+ return book.opened.then(function(){
assert.equal( book.isOpen, true, "book is opened" );
- assert.equal( book.url, "", "book url is empty as book is archived" );
- done();
+ assert( book.unarchived, "book is unarchived" );
});
});
diff --git a/webpack.config.js b/webpack.config.js
index 0e8275a..3d40bcf 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -26,6 +26,11 @@ module.exports = {
plugins: [
// new webpack.IgnorePlugin(/punycode|IPv6/),
],
+ resolve: {
+ alias: {
+ path: "path-webpack"
+ }
+ },
devServer: {
host: hostname,
port: port,