diff --git a/dist/epub.js b/dist/epub.js index 9e3a78a..1a5048f 100644 --- a/dist/epub.js +++ b/dist/epub.js @@ -4453,7 +4453,7 @@ EPUBJS.core.request = function(url, type, withCredentials, headers) { var xhrPrototype = XMLHttpRequest.prototype; var header; - + if (!('overrideMimeType' in xhrPrototype)) { // IE10 might have response, but not overrideMimeType Object.defineProperty(xhrPrototype, 'overrideMimeType', { @@ -4723,7 +4723,7 @@ EPUBJS.core.resolveUrl = function(base, path) { directories.pop(); segments.unshift(part); } else { - segments.push(part); + segments.unshift(part); } }); @@ -6717,7 +6717,6 @@ EPUBJS.View.prototype.layout = function() { console.error("View not shown"); } - // Apply Changes this.resizing = true; this.iframe.style.height = bounds.height + "px"; diff --git a/dist/epub.min.js b/dist/epub.min.js index a78a14a..a741c44 100644 --- a/dist/epub.min.js +++ b/dist/epub.min.js @@ -1,3 +1,3 @@ "undefined"==typeof EPUBJS&&(("undefined"!=typeof window?window:this).EPUBJS={}),EPUBJS.VERSION="0.3.0",EPUBJS.Render={},function(e){"use strict";var t=function(e){return new EPUBJS.Book(e)};t.Render={register:function(e,r){t.Render[e]=r}},"object"==typeof exports?(e.RSVP=require("rsvp"),module.exports=t):"function"==typeof define&&define.amd?define(t):e.ePub=t}(this),function(e){var t,r;!function(){var e={},n={};t=function(t,r,n){e[t]={deps:r,callback:n}},r=function(t){function i(e){if("."!==e.charAt(0))return e;for(var r=e.split("/"),n=t.split("/").slice(0,-1),i=0,s=r.length;s>i;i++){var o=r[i];if(".."===o)n.pop();else{if("."===o)continue;n.push(o)}}return n.join("/")}if(n[t])return n[t];if(n[t]={},!e[t])throw new Error("Could not find module "+t);for(var s,o=e[t],a=o.deps,u=o.callback,h=[],c=0,p=a.length;p>c;c++)h.push("exports"===a[c]?s={}:r(i(a[c])));var l=u.apply(this,h);return n[t]=s||l},r.entries=e}(),t("rsvp/-internal",["./utils","./instrument","./config","exports"],function(e,t,r,n){"use strict";function i(){}function s(e){try{return e.then}catch(t){return U.error=t,U}}function o(e,t,r,n){try{e.call(t,r,n)}catch(i){return i}}function a(e,t,r){E.async(function(e){var n=!1,i=o(r,t,function(r){n||(n=!0,t!==r?c(e,r):l(e,r))},function(t){n||(n=!0,d(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&i&&(n=!0,d(e,i))},e)}function u(e,t){e._onerror=null,t._state===x?l(e,t._result):e._state===B?d(e,t._result):f(t,void 0,function(r){t!==r?c(e,r):l(e,r)},function(t){d(e,t)})}function h(e,t){if(t instanceof e.constructor)u(e,t);else{var r=s(t);r===U?d(e,U.error):void 0===r?l(e,t):_(r)?a(e,t,r):l(e,t)}}function c(e,t){e===t?l(e,t):S(t)?h(e,t):l(e,t)}function p(e){e._onerror&&e._onerror(e._result),m(e)}function l(e,t){e._state===w&&(e._result=t,e._state=x,0===e._subscribers.length?E.instrument&&P("fulfilled",e):E.async(m,e))}function d(e,t){e._state===w&&(e._state=B,e._result=t,E.async(p,e))}function f(e,t,r,n){var i=e._subscribers,s=i.length;e._onerror=null,i[s]=t,i[s+x]=r,i[s+B]=n,0===s&&e._state&&E.async(m,e)}function m(e){var t=e._subscribers,r=e._state;if(E.instrument&&P(r===x?"fulfilled":"rejected",e),0!==t.length){for(var n,i,s=e._result,o=0;oe;e+=2){var t=p[e],r=p[e+1];t(r),p[e]=void 0,p[e+1]=void 0}o=0}var o=0;e["default"]=function(e,t){p[o]=e,p[o+1]=t,o+=2,2===o&&a()};var a,u="undefined"!=typeof window?window:{},h=u.MutationObserver||u.WebKitMutationObserver,c="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,p=new Array(1e3);a="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?t():h?r():c?n():i()}),t("rsvp/config",["./events","exports"],function(e,t){"use strict";function r(e,t){return"onerror"===e?void i.on("error",t):2!==arguments.length?i[e]:void(i[e]=t)}var n=e["default"],i={instrument:!1};n.mixin(i),t.config=i,t.configure=r}),t("rsvp/defer",["./promise","exports"],function(e,t){"use strict";var r=e["default"];t["default"]=function(e){var t={};return t.promise=new r(function(e,r){t.resolve=e,t.reject=r},e),t}}),t("rsvp/enumerator",["./utils","./-internal","exports"],function(e,t,r){"use strict";function n(e,t,r){return e===p?{state:"fulfilled",value:r}:{state:"rejected",reason:r}}function i(e,t,r,n){this._instanceConstructor=e,this.promise=new e(a,n),this._abortOnReject=r,this._validateInput(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._init(),0===this.length?h(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&h(this.promise,this._result))):u(this.promise,this._validationError())}var s=e.isArray,o=e.isMaybeThenable,a=t.noop,u=t.reject,h=t.fulfill,c=t.subscribe,p=t.FULFILLED,l=t.REJECTED,d=t.PENDING,f=!0;r.ABORT_ON_REJECTION=f,r.makeSettledResult=n,i.prototype._validateInput=function(e){return s(e)},i.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},i.prototype._init=function(){this._result=new Array(this.length)},r["default"]=i,i.prototype._enumerate=function(){for(var e=this.length,t=this.promise,r=this._input,n=0;t._state===d&&e>n;n++)this._eachEntry(r[n],n)},i.prototype._eachEntry=function(e,t){var r=this._instanceConstructor;o(e)?e.constructor===r&&e._state!==d?(e._onerror=null,this._settledAt(e._state,t,e._result)):this._willSettleAt(r.resolve(e),t):(this._remaining--,this._result[t]=this._makeResult(p,t,e))},i.prototype._settledAt=function(e,t,r){var n=this.promise;n._state===d&&(this._remaining--,this._abortOnReject&&e===l?u(n,r):this._result[t]=this._makeResult(e,t,r)),0===this._remaining&&h(n,this._result)},i.prototype._makeResult=function(e,t,r){return r},i.prototype._willSettleAt=function(e,t){var r=this;c(e,void 0,function(e){r._settledAt(p,t,e)},function(e){r._settledAt(l,t,e)})}}),t("rsvp/events",["exports"],function(e){"use strict";function t(e,t){for(var r=0,n=e.length;n>r;r++)if(e[r]===t)return r;return-1}function r(e){var t=e._promiseCallbacks;return t||(t=e._promiseCallbacks={}),t}e["default"]={mixin:function(e){return e.on=this.on,e.off=this.off,e.trigger=this.trigger,e._promiseCallbacks=void 0,e},on:function(e,n){var i,s=r(this);i=s[e],i||(i=s[e]=[]),-1===t(i,n)&&i.push(n)},off:function(e,n){var i,s,o=r(this);return n?(i=o[e],s=t(i,n),void(-1!==s&&i.splice(s,1))):void(o[e]=[])},trigger:function(e,t){var n,i,s=r(this);if(n=s[e])for(var o=0;oa;a++)o[a]=t(e[a]);return n.all(o,r).then(function(t){for(var r=new Array(s),n=0,i=0;s>i;i++)t[i]&&(r[n]=e[i],n++);return r.length=n,r})})}}),t("rsvp/hash-settled",["./promise","./enumerator","./promise-hash","./utils","exports"],function(e,t,r,n,i){"use strict";function s(e,t,r){this._superConstructor(e,t,!1,r)}var o=e["default"],a=t.makeSettledResult,u=r["default"],h=t["default"],c=n.o_create;s.prototype=c(u.prototype),s.prototype._superConstructor=h,s.prototype._makeResult=a,s.prototype._validationError=function(){return new Error("hashSettled must be called with an object")},i["default"]=function(e,t){return new s(o,e,t).promise}}),t("rsvp/hash",["./promise","./promise-hash","./enumerator","exports"],function(e,t,r,n){"use strict";{var i=e["default"],s=t["default"];r.ABORT_ON_REJECTION}n["default"]=function(e,t){return new s(i,e,t).promise}}),t("rsvp/instrument",["./config","./utils","exports"],function(e,t,r){"use strict";var n=e.config,i=t.now,s=[];r["default"]=function(e,t,r){1===s.push({name:e,payload:{guid:t._guidKey+t._id,eventName:e,detail:t._result,childGuid:r&&t._guidKey+r._id,label:t._label,timeStamp:i(),stack:new Error(t._label).stack}})&&setTimeout(function(){for(var e,t=0;ta;a++)o[a]=t(e[a]);return n.all(o,r)})}}),t("rsvp/node",["./promise","./utils","exports"],function(e,t,r){"use strict";var n=e["default"],i=t.isArray;r["default"]=function(e,t){function r(){for(var r=arguments.length,i=new Array(r),a=0;r>a;a++)i[a]=arguments[a];var u;return s||o||!t?u=this:("object"==typeof console&&console.warn('Deprecation: RSVP.denodeify() doesn\'t allow setting the "this" binding anymore. Use yourFunction.bind(yourThis) instead.'),u=t),n.all(i).then(function(r){function i(n,i){function a(){for(var e=arguments.length,r=new Array(e),a=0;e>a;a++)r[a]=arguments[a];var u=r[0],h=r[1];if(u)i(u);else if(s)n(r.slice(1));else if(o){var c,p,l={},d=r.slice(1);for(p=0;pa;a++)s=r[a],this._eachEntry(s.entry,s.position)}}),t("rsvp/promise",["./config","./events","./instrument","./utils","./-internal","./promise/cast","./promise/all","./promise/race","./promise/resolve","./promise/reject","exports"],function(e,t,r,n,i,s,o,a,u,h,c){"use strict";function p(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function l(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function d(e,t){this._id=R++,this._label=t,this._subscribers=[],f.instrument&&m("created",this),v!==e&&(g(e)||p(),this instanceof d||l(),S(this,e))}var f=e.config,m=(t["default"],r["default"]),g=(n.objectOrFunction,n.isFunction),y=n.now,v=i.noop,b=(i.resolve,i.reject,i.fulfill,i.subscribe),S=i.initializePromise,_=i.invokeCallback,P=i.FULFILLED,E=s["default"],w=o["default"],x=a["default"],B=u["default"],U=h["default"],J="rsvp_"+y()+"-",R=0;c["default"]=d,d.cast=E,d.all=w,d.race=x,d.resolve=B,d.reject=U,d.prototype={constructor:d,_id:void 0,_guidKey:J,_label:void 0,_state:void 0,_result:void 0,_subscribers:void 0,_onerror:function(e){f.trigger("error",e)},then:function(e,t,r){var n=this;n._onerror=null;var i=new this.constructor(v,r),s=n._state,o=n._result;return f.instrument&&m("chained",n,i),s===P&&e?f.async(function(){_(s,i,e,o)}):b(n,i,e,t),i},"catch":function(e,t){return this.then(null,e,t)},"finally":function(e,t){var r=this.constructor;return this.then(function(t){return r.resolve(e()).then(function(){return t})},function(t){return r.resolve(e()).then(function(){throw t})},t)}}}),t("rsvp/promise/all",["../enumerator","exports"],function(e,t){"use strict";var r=e["default"];t["default"]=function(e,t){return new r(this,e,!0,t).promise}}),t("rsvp/promise/cast",["./resolve","exports"],function(e,t){"use strict";var r=e["default"];t["default"]=r}),t("rsvp/promise/race",["../utils","../-internal","exports"],function(e,t,r){"use strict";var n=e.isArray,i=(e.isFunction,e.isMaybeThenable,t.noop),s=t.resolve,o=t.reject,a=t.subscribe,u=t.PENDING;r["default"]=function(e,t){function r(e){s(p,e)}function h(e){o(p,e)}var c=this,p=new c(i,t);if(!n(e))return o(p,new TypeError("You must pass an array to race.")),p;for(var l=e.length,d=0;p._state===u&&l>d;d++)a(c.resolve(e[d]),void 0,r,h);return p}}),t("rsvp/promise/reject",["../-internal","exports"],function(e,t){"use strict";var r=e.noop,n=e.reject;t["default"]=function(e,t){var i=this,s=new i(r,t);return n(s,e),s}}),t("rsvp/promise/resolve",["../-internal","exports"],function(e,t){"use strict";var r=e.noop,n=e.resolve;t["default"]=function(e,t){var i=this;if(e&&"object"==typeof e&&e.constructor===i)return e;var s=new i(r,t);return n(s,e),s}}),t("rsvp/race",["./promise","exports"],function(e,t){"use strict";var r=e["default"];t["default"]=function(e,t){return r.race(e,t)}}),t("rsvp/reject",["./promise","exports"],function(e,t){"use strict";var r=e["default"];t["default"]=function(e,t){return r.reject(e,t)}}),t("rsvp/resolve",["./promise","exports"],function(e,t){"use strict";var r=e["default"];t["default"]=function(e,t){return r.resolve(e,t)}}),t("rsvp/rethrow",["exports"],function(e){"use strict";e["default"]=function(e){throw setTimeout(function(){throw e}),e}}),t("rsvp/utils",["exports"],function(e){"use strict";function t(e){return"function"==typeof e||"object"==typeof e&&null!==e}function r(e){return"function"==typeof e}function n(e){return"object"==typeof e&&null!==e}e.objectOrFunction=t,e.isFunction=r,e.isMaybeThenable=n;var i;i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var s=i;e.isArray=s;var o=Date.now||function(){return(new Date).getTime()};e.now=o;var a=Object.create||function(e){var t=function(){};return t.prototype=e,t};e.o_create=a}),t("rsvp",["./rsvp/promise","./rsvp/events","./rsvp/node","./rsvp/all","./rsvp/all-settled","./rsvp/race","./rsvp/hash","./rsvp/hash-settled","./rsvp/rethrow","./rsvp/defer","./rsvp/config","./rsvp/map","./rsvp/resolve","./rsvp/reject","./rsvp/filter","./rsvp/asap","exports"],function(e,t,r,n,i,s,o,a,u,h,c,p,l,d,f,m,g){"use strict";function y(e,t){A.async(e,t)}function v(){A.on.apply(A,arguments)}function b(){A.off.apply(A,arguments)}var S=e["default"],_=t["default"],P=r["default"],E=n["default"],w=i["default"],x=s["default"],B=o["default"],U=a["default"],J=u["default"],R=h["default"],A=c.config,I=c.configure,C=p["default"],T=l["default"],k=d["default"],F=f["default"],N=m["default"];if(A.async=N,"undefined"!=typeof window&&"object"==typeof window.__PROMISE_INSTRUMENTATION__){var q=window.__PROMISE_INSTRUMENTATION__;I("instrument",!0);for(var O in q)q.hasOwnProperty(O)&&v(O,q[O])}g.Promise=S,g.EventTarget=_,g.all=E,g.allSettled=w,g.race=x,g.hash=B,g.hashSettled=U,g.rethrow=J,g.defer=R,g.denodeify=P,g.configure=I,g.on=v,g.off=b,g.resolve=T,g.reject=k,g.async=y,g.map=C,g.filter=F}),e.RSVP=r("rsvp")}(self),function(e,t){"use strict";"object"==typeof exports?module.exports=t(require("./punycode"),require("./IPv6"),require("./SecondLevelDomains")):"function"==typeof define&&define.amd?define(["./punycode","./IPv6","./SecondLevelDomains"],t):e.URI=t(e.punycode,e.IPv6,e.SecondLevelDomains,e)}(this,function(e,t,r,n){"use strict";function i(e,t){return this instanceof i?(void 0===e&&(e="undefined"!=typeof location?location.href+"":""),this.href(e),void 0!==t?this.absoluteTo(t):this):new i(e,t)}function s(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function o(e){return void 0===e?"Undefined":String(Object.prototype.toString.call(e)).slice(8,-1)}function a(e){return"Array"===o(e)}function u(e,t){var r,n,i={};if(a(t))for(r=0,n=t.length;n>r;r++)i[t[r]]=!0;else i[t]=!0;for(r=0,n=e.length;n>r;r++)void 0!==i[e[r]]&&(e.splice(r,1),n--,r--);return e}function h(e,t){var r,n;if(a(t)){for(r=0,n=t.length;n>r;r++)if(!h(e,t[r]))return!1;return!0}var i=o(t);for(r=0,n=e.length;n>r;r++)if("RegExp"===i){if("string"==typeof e[r]&&e[r].match(t))return!0}else if(e[r]===t)return!0;return!1}function c(e,t){if(!a(e)||!a(t))return!1;if(e.length!==t.length)return!1;e.sort(),t.sort();for(var r=0,n=e.length;n>r;r++)if(e[r]!==t[r])return!1;return!0}function p(e){return escape(e)}function l(e){return encodeURIComponent(e).replace(/[!'()*]/g,p).replace(/\*/g,"%2A")}var d=n&&n.URI;i.version="1.13.2";var f=i.prototype,m=Object.prototype.hasOwnProperty;i._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,duplicateQueryParameters:i.duplicateQueryParameters,escapeQuerySpace:i.escapeQuerySpace}},i.duplicateQueryParameters=!1,i.escapeQuerySpace=!0,i.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,i.idn_expression=/[^a-z0-9\.-]/i,i.punycode_expression=/(xn--)/i,i.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,i.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,i.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi,i.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/},i.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},i.invalid_hostname_characters=/[^a-zA-Z0-9\.-]/,i.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src"},i.getDomAttribute=function(e){if(!e||!e.nodeName)return void 0;var t=e.nodeName.toLowerCase();return"input"===t&&"image"!==e.type?void 0:i.domAttributes[t]},i.encode=l,i.decode=decodeURIComponent,i.iso8859=function(){i.encode=escape,i.decode=unescape},i.unicode=function(){i.encode=l,i.decode=decodeURIComponent},i.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}}},i.encodeQuery=function(e,t){var r=i.encode(e+"");return void 0===t&&(t=i.escapeQuerySpace),t?r.replace(/%20/g,"+"):r},i.decodeQuery=function(e,t){e+="",void 0===t&&(t=i.escapeQuerySpace);try{return i.decode(t?e.replace(/\+/g,"%20"):e)}catch(r){return e}},i.recodePath=function(e){for(var t=(e+"").split("/"),r=0,n=t.length;n>r;r++)t[r]=i.encodePathSegment(i.decode(t[r]));return t.join("/")},i.decodePath=function(e){for(var t=(e+"").split("/"),r=0,n=t.length;n>r;r++)t[r]=i.decodePathSegment(t[r]);return t.join("/")};var g,y={encode:"encode",decode:"decode"},v=function(e,t){return function(r){return i[t](r+"").replace(i.characters[e][t].expression,function(r){return i.characters[e][t].map[r]})}};for(g in y)i[g+"PathSegment"]=v("pathname",y[g]);i.encodeReserved=v("reserved","encode"),i.parse=function(e,t){var r;return t||(t={}),r=e.indexOf("#"),r>-1&&(t.fragment=e.substring(r+1)||null,e=e.substring(0,r)),r=e.indexOf("?"),r>-1&&(t.query=e.substring(r+1)||null,e=e.substring(0,r)),"//"===e.substring(0,2)?(t.protocol=null,e=e.substring(2),e=i.parseAuthority(e,t)):(r=e.indexOf(":"),r>-1&&(t.protocol=e.substring(0,r)||null,t.protocol&&!t.protocol.match(i.protocol_expression)?t.protocol=void 0:"file"===t.protocol?e=e.substring(r+3):"//"===e.substring(r+1,r+3)?(e=e.substring(r+3),e=i.parseAuthority(e,t)):(e=e.substring(r+1),t.urn=!0))),t.path=e,t},i.parseHost=function(e,t){var r,n,i=e.indexOf("/");return-1===i&&(i=e.length),"["===e.charAt(0)?(r=e.indexOf("]"),t.hostname=e.substring(1,r)||null,t.port=e.substring(r+2,i)||null,"/"===t.port&&(t.port=null)):e.indexOf(":")!==e.lastIndexOf(":")?(t.hostname=e.substring(0,i)||null,t.port=null):(n=e.substring(0,i).split(":"),t.hostname=n[0]||null,t.port=n[1]||null),t.hostname&&"/"!==e.substring(i).charAt(0)&&(i++,e="/"+e),e.substring(i)||"/"},i.parseAuthority=function(e,t){return e=i.parseUserinfo(e,t),i.parseHost(e,t)},i.parseUserinfo=function(e,t){var r,n=e.indexOf("/"),s=n>-1?e.lastIndexOf("@",n):e.indexOf("@");return s>-1&&(-1===n||n>s)?(r=e.substring(0,s).split(":"),t.username=r[0]?i.decode(r[0]):null,r.shift(),t.password=r[0]?i.decode(r.join(":")):null,e=e.substring(s+1)):(t.username=null,t.password=null),e},i.parseQuery=function(e,t){if(!e)return{};if(e=e.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,""),!e)return{};for(var r,n,s,o={},a=e.split("&"),u=a.length,h=0;u>h;h++)r=a[h].split("="),n=i.decodeQuery(r.shift(),t),s=r.length?i.decodeQuery(r.join("="),t):null,o[n]?("string"==typeof o[n]&&(o[n]=[o[n]]),o[n].push(s)):o[n]=s;return o},i.build=function(e){var t="";return e.protocol&&(t+=e.protocol+":"),e.urn||!t&&!e.hostname||(t+="//"),t+=i.buildAuthority(e)||"","string"==typeof e.path&&("/"!==e.path.charAt(0)&&"string"==typeof e.hostname&&(t+="/"),t+=e.path),"string"==typeof e.query&&e.query&&(t+="?"+e.query),"string"==typeof e.fragment&&e.fragment&&(t+="#"+e.fragment),t},i.buildHost=function(e){var t="";return e.hostname?(t+=i.ip6_expression.test(e.hostname)?"["+e.hostname+"]":e.hostname,e.port&&(t+=":"+e.port),t):""},i.buildAuthority=function(e){return i.buildUserinfo(e)+i.buildHost(e)},i.buildUserinfo=function(e){var t="";return e.username&&(t+=i.encode(e.username),e.password&&(t+=":"+i.encode(e.password)),t+="@"),t},i.buildQuery=function(e,t,r){var n,s,o,u,h="";for(s in e)if(m.call(e,s)&&s)if(a(e[s]))for(n={},o=0,u=e[s].length;u>o;o++)void 0!==e[s][o]&&void 0===n[e[s][o]+""]&&(h+="&"+i.buildQueryParameter(s,e[s][o],r),t!==!0&&(n[e[s][o]+""]=!0));else void 0!==e[s]&&(h+="&"+i.buildQueryParameter(s,e[s],r));return h.substring(1)},i.buildQueryParameter=function(e,t,r){return i.encodeQuery(e,r)+(null!==t?"="+i.encodeQuery(t,r):"")},i.addQuery=function(e,t,r){if("object"==typeof t)for(var n in t)m.call(t,n)&&i.addQuery(e,n,t[n]);else{if("string"!=typeof t)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");if(void 0===e[t])return void(e[t]=r);"string"==typeof e[t]&&(e[t]=[e[t]]),a(r)||(r=[r]),e[t]=e[t].concat(r)}},i.removeQuery=function(e,t,r){var n,s,o;if(a(t))for(n=0,s=t.length;s>n;n++)e[t[n]]=void 0;else if("object"==typeof t)for(o in t)m.call(t,o)&&i.removeQuery(e,o,t[o]);else{if("string"!=typeof t)throw new TypeError("URI.addQuery() accepts an object, string as the first parameter");void 0!==r?e[t]===r?e[t]=void 0:a(e[t])&&(e[t]=u(e[t],r)):e[t]=void 0}},i.hasQuery=function(e,t,r,n){if("object"==typeof t){for(var s in t)if(m.call(t,s)&&!i.hasQuery(e,s,t[s]))return!1;return!0}if("string"!=typeof t)throw new TypeError("URI.hasQuery() accepts an object, string as the name parameter");switch(o(r)){case"Undefined":return t in e;case"Boolean":var u=Boolean(a(e[t])?e[t].length:e[t]);return r===u;case"Function":return!!r(e[t],t,e);case"Array":if(!a(e[t]))return!1;var p=n?h:c;return p(e[t],r);case"RegExp":return a(e[t])?n?h(e[t],r):!1:Boolean(e[t]&&e[t].match(r));case"Number":r=String(r);case"String":return a(e[t])?n?h(e[t],r):!1:e[t]===r;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},i.commonPath=function(e,t){var r,n=Math.min(e.length,t.length);for(r=0;n>r;r++)if(e.charAt(r)!==t.charAt(r)){r--;break}return 1>r?e.charAt(0)===t.charAt(0)&&"/"===e.charAt(0)?"/":"":(("/"!==e.charAt(r)||"/"!==t.charAt(r))&&(r=e.substring(0,r).lastIndexOf("/")),e.substring(0,r+1))},i.withinString=function(e,t,r){r||(r={});var n=r.start||i.findUri.start,s=r.end||i.findUri.end,o=r.trim||i.findUri.trim,a=/[a-z0-9-]=["']?$/i;for(n.lastIndex=0;;){var u=n.exec(e);if(!u)break;var h=u.index;if(r.ignoreHtml){var c=e.slice(Math.max(h-3,0),h);if(c&&a.test(c))continue}var p=h+e.slice(h).search(s),l=e.slice(h,p).replace(o,"");if(!r.ignore||!r.ignore.test(l)){p=h+l.length;var d=t(l,h,p,e);e=e.slice(0,h)+d+e.slice(p),n.lastIndex=h+d.length}}return n.lastIndex=0,e},i.ensureValidHostname=function(t){if(t.match(i.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-] and Punycode.js is not available');if(e.toASCII(t).match(i.invalid_hostname_characters))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-]')}},i.noConflict=function(e){if(e){var t={URI:this.noConflict()};return n.URITemplate&&"function"==typeof n.URITemplate.noConflict&&(t.URITemplate=n.URITemplate.noConflict()),n.IPv6&&"function"==typeof n.IPv6.noConflict&&(t.IPv6=n.IPv6.noConflict()),n.SecondLevelDomains&&"function"==typeof n.SecondLevelDomains.noConflict&&(t.SecondLevelDomains=n.SecondLevelDomains.noConflict()),t}return n.URI===this&&(n.URI=d),this},f.build=function(e){return e===!0?this._deferred_build=!0:(void 0===e||this._deferred_build)&&(this._string=i.build(this._parts),this._deferred_build=!1),this},f.clone=function(){return new i(this)},f.valueOf=f.toString=function(){return this.build(!1)._string},y={protocol:"protocol",username:"username",password:"password",hostname:"hostname",port:"port"},v=function(e){return function(t,r){return void 0===t?this._parts[e]||"":(this._parts[e]=t||null,this.build(!r),this)}};for(g in y)f[g]=v(y[g]);y={query:"?",fragment:"#"},v=function(e,t){return function(r,n){return void 0===r?this._parts[e]||"":(null!==r&&(r+="",r.charAt(0)===t&&(r=r.substring(1))),this._parts[e]=r,this.build(!n),this)}};for(g in y)f[g]=v(g,y[g]);y={search:["?","query"],hash:["#","fragment"]},v=function(e,t){return function(r,n){var i=this[e](r,n);return"string"==typeof i&&i.length?t+i:i}};for(g in y)f[g]=v(y[g][1],y[g][0]);f.pathname=function(e,t){if(void 0===e||e===!0){var r=this._parts.path||(this._parts.hostname?"/":"");return e?i.decodePath(r):r}return this._parts.path=e?i.recodePath(e):"/",this.build(!t),this},f.path=f.pathname,f.href=function(e,t){var r;if(void 0===e)return this.toString();this._string="",this._parts=i._parts();var n=e instanceof i,s="object"==typeof e&&(e.hostname||e.path||e.pathname);if(e.nodeName){var o=i.getDomAttribute(e);e=e[o]||"",s=!1}if(!n&&s&&void 0!==e.pathname&&(e=e.toString()),"string"==typeof e)this._parts=i.parse(e,this._parts);else{if(!n&&!s)throw new TypeError("invalid input");var a=n?e._parts:e;for(r in a)m.call(this._parts,r)&&(this._parts[r]=a[r])}return this.build(!t),this},f.is=function(e){var t=!1,n=!1,s=!1,o=!1,a=!1,u=!1,h=!1,c=!this._parts.urn;switch(this._parts.hostname&&(c=!1,n=i.ip4_expression.test(this._parts.hostname),s=i.ip6_expression.test(this._parts.hostname),t=n||s,o=!t,a=o&&r&&r.has(this._parts.hostname),u=o&&i.idn_expression.test(this._parts.hostname),h=o&&i.punycode_expression.test(this._parts.hostname)),e.toLowerCase()){case"relative":return c;case"absolute":return!c;case"domain":case"name":return o;case"sld":return a;case"ip":return t;case"ip4":case"ipv4":case"inet4":return n;case"ip6":case"ipv6":case"inet6":return s;case"idn":return u;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return h}return null};var b=f.protocol,S=f.port,_=f.hostname;f.protocol=function(e,t){if(void 0!==e&&e&&(e=e.replace(/:(\/\/)?$/,""),!e.match(i.protocol_expression)))throw new TypeError('Protocol "'+e+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return b.call(this,e,t)},f.scheme=f.protocol,f.port=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0!==e&&(0===e&&(e=null),e&&(e+="",":"===e.charAt(0)&&(e=e.substring(1)),e.match(/[^0-9]/))))throw new TypeError('Port "'+e+'" contains characters other than [0-9]');return S.call(this,e,t)},f.hostname=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0!==e){var r={};i.parseHost(e,r),e=r.hostname}return _.call(this,e,t)},f.host=function(e,t){return this._parts.urn?void 0===e?"":this:void 0===e?this._parts.hostname?i.buildHost(this._parts):"":(i.parseHost(e,this._parts),this.build(!t),this)},f.authority=function(e,t){return this._parts.urn?void 0===e?"":this:void 0===e?this._parts.hostname?i.buildAuthority(this._parts):"":(i.parseAuthority(e,this._parts),this.build(!t),this)},f.userinfo=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){if(!this._parts.username)return"";var r=i.buildUserinfo(this._parts);return r.substring(0,r.length-1)}return"@"!==e[e.length-1]&&(e+="@"),i.parseUserinfo(e,this._parts),this.build(!t),this},f.resource=function(e,t){var r;return void 0===e?this.path()+this.search()+this.hash():(r=i.parse(e),this._parts.path=r.path,this._parts.query=r.query,this._parts.fragment=r.fragment,this.build(!t),this)},f.subdomain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,r)||""}var n=this._parts.hostname.length-this.domain().length,o=this._parts.hostname.substring(0,n),a=new RegExp("^"+s(o));return e&&"."!==e.charAt(e.length-1)&&(e+="."),e&&i.ensureValidHostname(e),this._parts.hostname=this._parts.hostname.replace(a,e),this.build(!t),this},f.domain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.match(/\./g);if(r&&r.length<2)return this._parts.hostname;var n=this._parts.hostname.length-this.tld(t).length-1;return n=this._parts.hostname.lastIndexOf(".",n-1)+1,this._parts.hostname.substring(n)||""}if(!e)throw new TypeError("cannot set domain empty");if(i.ensureValidHostname(e),!this._parts.hostname||this.is("IP"))this._parts.hostname=e;else{var o=new RegExp(s(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(o,e)}return this.build(!t),this},f.tld=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.lastIndexOf("."),i=this._parts.hostname.substring(n+1);return t!==!0&&r&&r.list[i.toLowerCase()]?r.get(this._parts.hostname)||i:i}var o;if(!e)throw new TypeError("cannot set TLD empty"); -if(e.match(/[^a-zA-Z0-9-]/)){if(!r||!r.is(e))throw new TypeError('TLD "'+e+'" contains characters other than [A-Z0-9]');o=new RegExp(s(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");o=new RegExp(s(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}return this.build(!t),this},f.directory=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||e===!0){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var r=this._parts.path.length-this.filename().length-1,n=this._parts.path.substring(0,r)||(this._parts.hostname?"/":"");return e?i.decodePath(n):n}var o=this._parts.path.length-this.filename().length,a=this._parts.path.substring(0,o),u=new RegExp("^"+s(a));return this.is("relative")||(e||(e="/"),"/"!==e.charAt(0)&&(e="/"+e)),e&&"/"!==e.charAt(e.length-1)&&(e+="/"),e=i.recodePath(e),this._parts.path=this._parts.path.replace(u,e),this.build(!t),this},f.filename=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||e===!0){if(!this._parts.path||"/"===this._parts.path)return"";var r=this._parts.path.lastIndexOf("/"),n=this._parts.path.substring(r+1);return e?i.decodePathSegment(n):n}var o=!1;"/"===e.charAt(0)&&(e=e.substring(1)),e.match(/\.?\//)&&(o=!0);var a=new RegExp(s(this.filename())+"$");return e=i.recodePath(e),this._parts.path=this._parts.path.replace(a,e),o?this.normalizePath(t):this.build(!t),this},f.suffix=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||e===!0){if(!this._parts.path||"/"===this._parts.path)return"";var r,n,o=this.filename(),a=o.lastIndexOf(".");return-1===a?"":(r=o.substring(a+1),n=/^[a-z0-9%]+$/i.test(r)?r:"",e?i.decodePathSegment(n):n)}"."===e.charAt(0)&&(e=e.substring(1));var u,h=this.suffix();if(h)u=new RegExp(e?s(h)+"$":s("."+h)+"$");else{if(!e)return this;this._parts.path+="."+i.recodePath(e)}return u&&(e=i.recodePath(e),this._parts.path=this._parts.path.replace(u,e)),this.build(!t),this},f.segment=function(e,t,r){var n=this._parts.urn?":":"/",i=this.path(),s="/"===i.substring(0,1),o=i.split(n);if(void 0!==e&&"number"!=typeof e&&(r=t,t=e,e=void 0),void 0!==e&&"number"!=typeof e)throw new Error('Bad segment "'+e+'", must be 0-based integer');if(s&&o.shift(),0>e&&(e=Math.max(o.length+e,0)),void 0===t)return void 0===e?o:o[e];if(null===e||void 0===o[e])if(a(t)){o=[];for(var u=0,h=t.length;h>u;u++)(t[u].length||o.length&&o[o.length-1].length)&&(o.length&&!o[o.length-1].length&&o.pop(),o.push(t[u]))}else(t||"string"==typeof t)&&(""===o[o.length-1]?o[o.length-1]=t:o.push(t));else t||"string"==typeof t&&t.length?o[e]=t:o.splice(e,1);return s&&o.unshift(""),this.path(o.join(n),r)},f.segmentCoded=function(e,t,r){var n,s,o;if("number"!=typeof e&&(r=t,t=e,e=void 0),void 0===t){if(n=this.segment(e,t,r),a(n))for(s=0,o=n.length;o>s;s++)n[s]=i.decode(n[s]);else n=void 0!==n?i.decode(n):void 0;return n}if(a(t))for(s=0,o=t.length;o>s;s++)t[s]=i.decode(t[s]);else t="string"==typeof t?i.encode(t):t;return this.segment(e,t,r)};var P=f.query;return f.query=function(e,t){if(e===!0)return i.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"==typeof e){var r=i.parseQuery(this._parts.query,this._parts.escapeQuerySpace),n=e.call(this,r);return this._parts.query=i.buildQuery(n||r,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this}return void 0!==e&&"string"!=typeof e?(this._parts.query=i.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this):P.call(this,e,t)},f.setQuery=function(e,t,r){var n=i.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("object"==typeof e)for(var s in e)m.call(e,s)&&(n[s]=e[s]);else{if("string"!=typeof e)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");n[e]=void 0!==t?t:null}return this._parts.query=i.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(r=t),this.build(!r),this},f.addQuery=function(e,t,r){var n=i.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return i.addQuery(n,e,void 0===t?null:t),this._parts.query=i.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(r=t),this.build(!r),this},f.removeQuery=function(e,t,r){var n=i.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return i.removeQuery(n,e,t),this._parts.query=i.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(r=t),this.build(!r),this},f.hasQuery=function(e,t,r){var n=i.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return i.hasQuery(n,e,t,r)},f.setSearch=f.setQuery,f.addSearch=f.addQuery,f.removeSearch=f.removeQuery,f.hasSearch=f.hasQuery,f.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},f.normalizeProtocol=function(e){return"string"==typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!e)),this},f.normalizeHostname=function(r){return this._parts.hostname&&(this.is("IDN")&&e?this._parts.hostname=e.toASCII(this._parts.hostname):this.is("IPv6")&&t&&(this._parts.hostname=t.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!r)),this},f.normalizePort=function(e){return"string"==typeof this._parts.protocol&&this._parts.port===i.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!e)),this},f.normalizePath=function(e){if(this._parts.urn)return this;if(!this._parts.path||"/"===this._parts.path)return this;var t,r,n,s=this._parts.path,o="";for("/"!==s.charAt(0)&&(t=!0,s="/"+s),s=s.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),t&&(o=s.substring(1).match(/^(\.\.\/)+/)||"",o&&(o=o[0]));;){if(r=s.indexOf("/.."),-1===r)break;0!==r?(n=s.substring(0,r).lastIndexOf("/"),-1===n&&(n=r),s=s.substring(0,n)+s.substring(r+3)):s=s.substring(3)}return t&&this.is("relative")&&(s=o+s.substring(1)),s=i.recodePath(s),this._parts.path=s,this.build(!e),this},f.normalizePathname=f.normalizePath,f.normalizeQuery=function(e){return"string"==typeof this._parts.query&&(this._parts.query.length?this.query(i.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!e)),this},f.normalizeFragment=function(e){return this._parts.fragment||(this._parts.fragment=null,this.build(!e)),this},f.normalizeSearch=f.normalizeQuery,f.normalizeHash=f.normalizeFragment,f.iso8859=function(){var e=i.encode,t=i.decode;return i.encode=escape,i.decode=decodeURIComponent,this.normalize(),i.encode=e,i.decode=t,this},f.unicode=function(){var e=i.encode,t=i.decode;return i.encode=l,i.decode=unescape,this.normalize(),i.encode=e,i.decode=t,this},f.readable=function(){var t=this.clone();t.username("").password("").normalize();var r="";if(t._parts.protocol&&(r+=t._parts.protocol+"://"),t._parts.hostname&&(t.is("punycode")&&e?(r+=e.toUnicode(t._parts.hostname),t._parts.port&&(r+=":"+t._parts.port)):r+=t.host()),t._parts.hostname&&t._parts.path&&"/"!==t._parts.path.charAt(0)&&(r+="/"),r+=t.path(!0),t._parts.query){for(var n="",s=0,o=t._parts.query.split("&"),a=o.length;a>s;s++){var u=(o[s]||"").split("=");n+="&"+i.decodeQuery(u[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),void 0!==u[1]&&(n+="="+i.decodeQuery(u[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}r+="?"+n.substring(1)}return r+=i.decodeQuery(t.hash(),!0)},f.absoluteTo=function(e){var t,r,n,s=this.clone(),o=["protocol","username","password","hostname","port"];if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e instanceof i||(e=new i(e)),s._parts.protocol||(s._parts.protocol=e._parts.protocol),this._parts.hostname)return s;for(r=0;n=o[r];r++)s._parts[n]=e._parts[n];return s._parts.path?".."===s._parts.path.substring(-2)&&(s._parts.path+="/"):(s._parts.path=e._parts.path,s._parts.query||(s._parts.query=e._parts.query)),"/"!==s.path().charAt(0)&&(t=e.directory(),s._parts.path=(t?t+"/":"")+s._parts.path,s.normalizePath()),s.build(),s},f.relativeTo=function(e){var t,r,n,s,o,a=this.clone().normalize();if(a._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e=new i(e).normalize(),t=a._parts,r=e._parts,s=a.path(),o=e.path(),"/"!==s.charAt(0))throw new Error("URI is already relative");if("/"!==o.charAt(0))throw new Error("Cannot calculate a URI relative to another relative URI");if(t.protocol===r.protocol&&(t.protocol=null),t.username!==r.username||t.password!==r.password)return a.build();if(null!==t.protocol||null!==t.username||null!==t.password)return a.build();if(t.hostname!==r.hostname||t.port!==r.port)return a.build();if(t.hostname=null,t.port=null,s===o)return t.path="",a.build();if(n=i.commonPath(a.path(),e.path()),!n)return a.build();var u=r.path.substring(n.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return t.path=u+t.path.substring(n.length),a.build()},f.equals=function(e){var t,r,n,s=this.clone(),o=new i(e),u={},h={},p={};if(s.normalize(),o.normalize(),s.toString()===o.toString())return!0;if(t=s.query(),r=o.query(),s.query(""),o.query(""),s.toString()!==o.toString())return!1;if(t.length!==r.length)return!1;u=i.parseQuery(t,this._parts.escapeQuerySpace),h=i.parseQuery(r,this._parts.escapeQuerySpace);for(n in u)if(m.call(u,n)){if(a(u[n])){if(!c(u[n],h[n]))return!1}else if(u[n]!==h[n])return!1;p[n]=!0}for(n in h)if(m.call(h,n)&&!p[n])return!1;return!0},f.duplicateQueryParameters=function(e){return this._parts.duplicateQueryParameters=!!e,this},f.escapeQuerySpace=function(e){return this._parts.escapeQuerySpace=!!e,this},i}),EPUBJS.Book=function(e){this.opening=new RSVP.defer,this.opened=this.opening.promise,this.isOpen=!1,this.url=void 0,this.spine=new EPUBJS.Spine(this.request),this.loading={manifest:new RSVP.defer,spine:new RSVP.defer,metadata:new RSVP.defer,cover:new RSVP.defer,navigation:new RSVP.defer,pageList:new RSVP.defer},this.loaded={manifest:this.loading.manifest.promise,spine:this.loading.spine.promise,metadata:this.loading.metadata.promise,cover:this.loading.cover.promise,navigation:this.loading.navigation.promise,pageList:this.loading.pageList.promise},this.ready=RSVP.hash(this.loaded),this.isRendered=!1,this._q=EPUBJS.core.queue(this),this.request=this.requestMethod.bind(this),e&&this.open(e)},EPUBJS.Book.prototype.open=function(e){var t,r,n,i=new EPUBJS.Parser,s=this,o="META-INF/container.xml";return e?(t="object"==typeof e?e:EPUBJS.core.uri(e),"opf"===t.extension?(this.packageUrl=t.href,this.containerUrl="",t.origin?this.url=t.origin+"/"+t.directory:window?(n=EPUBJS.core.uri(window.location.href),this.url=EPUBJS.core.resolveUrl(n.base,t.directory)):this.url=t.directory,r=this.request(this.packageUrl)):"epub"===t.extension||"zip"===t.extension?(this.archived=!0,this.url=""):t.extension||(this.containerUrl=e+o,r=this.request(this.containerUrl).then(function(e){return i.container(e)}).then(function(t){var r=EPUBJS.core.uri(t.packagePath);return s.packageUrl=e+t.packagePath,s.url=e+r.directory,s.encoding=t.encoding,s.request(s.packageUrl)}).catch(function(e){console.error("Could not load book at: "+(this.packageUrl||this.containerPath)),s.trigger("book:loadFailed",this.packageUrl||this.containerPath),s.opening.reject(e)})),r.then(function(e){s.unpack(e),s.loading.manifest.resolve(s.package.manifest),s.loading.metadata.resolve(s.package.metadata),s.loading.spine.resolve(s.spine),s.loading.cover.resolve(s.cover),this.isOpen=!0,s.opening.resolve(s)}).catch(function(e){console.error(e.message,e.stack),s.opening.reject(e)}),this.opened):(this.opening.resolve(this),this.opened)},EPUBJS.Book.prototype.unpack=function(e){var t=this,r=new EPUBJS.Parser;t.package=r.packageContents(e),t.package.baseUrl=t.url,this.spine.load(t.package),t.navigation=new EPUBJS.Navigation(t.package,this.request),t.navigation.load().then(function(e){t.toc=e,t.loading.navigation.resolve(t.toc)}),t.cover=t.url+t.package.coverPath},EPUBJS.Book.prototype.section=function(e){return this.spine.get(e)},EPUBJS.Book.prototype.renderTo=function(e,t){var r=new EPUBJS.Renderer(this,t);return r.attachTo(e),r},EPUBJS.Book.prototype.requestMethod=function(e){return this.archived?void 0:EPUBJS.core.request(e,"xml",this.requestCredentials,this.requestHeaders)},EPUBJS.Book.prototype.setRequestCredentials=function(e){this.requestCredentials=e},EPUBJS.Book.prototype.setRequestHeaders=function(e){this.requestHeaders=e},RSVP.EventTarget.mixin(EPUBJS.Book.prototype),RSVP.on("error",function(){}),RSVP.configure("instrument",!0),RSVP.on("rejected",function(e){console.error(e.detail.message,e.detail.stack)}),EPUBJS.core={},EPUBJS.core.request=function(e,t,r,n){function i(){if(this.readyState===this.DONE)if(200===this.status||this.responseXML){var e;e="xml"==t?this.responseXML:"json"==t?JSON.parse(this.response):"blob"==t?o?this.response:new Blob([this.response]):this.response,u.resolve(e)}else u.reject({status:this.status,message:this.response,stack:(new Error).stack})}var s,o=window.URL,a=o?"blob":"arraybuffer",u=new RSVP.defer,h=new XMLHttpRequest,c=XMLHttpRequest.prototype;"overrideMimeType"in c||Object.defineProperty(c,"overrideMimeType",{value:function(){}}),r&&(h.withCredentials=!0),h.open("GET",e,!0);for(s in n)h.setRequestHeader(s,n[s]);return h.onreadystatechange=i,"blob"==t&&(h.responseType=a),"json"==t&&h.setRequestHeader("Accept","application/json"),"xml"==t&&h.overrideMimeType("text/xml"),h.send(),u.promise},EPUBJS.core.uri=function(e){var t,r,n,i={protocol:"",host:"",path:"",origin:"",directory:"",base:"",filename:"",extension:"",fragment:"",href:e},s=e.indexOf("://"),o=e.indexOf("?"),a=e.indexOf("#");return-1!=a&&(i.fragment=e.slice(a+1),e=e.slice(0,a)),-1!=o&&(i.search=e.slice(o+1),e=e.slice(0,o),href=e),-1!=s?(i.protocol=e.slice(0,s),t=e.slice(s+3),n=t.indexOf("/"),-1===n?(i.host=i.path,i.path=""):(i.host=t.slice(0,n),i.path=t.slice(n)),i.origin=i.protocol+"://"+i.host,i.directory=EPUBJS.core.folder(i.path),i.base=i.origin+i.directory):(i.path=e,i.directory=EPUBJS.core.folder(e),i.base=i.directory),i.filename=e.replace(i.base,""),r=i.filename.lastIndexOf("."),-1!=r&&(i.extension=i.filename.slice(r+1)),i},EPUBJS.core.folder=function(e){var t=e.lastIndexOf("/");if(-1==t)var r="";return r=e.slice(0,t+1)},EPUBJS.core.queue=function(e){var t=[],r=e,n=function(e,r,n){return t.push({funcName:e,args:r,context:n}),t},i=function(){var e;t.length&&(e=t.shift(),r[e.funcName].apply(e.context||r,e.args))},s=function(){for(;t.length;)i()},o=function(){t=[]},a=function(){return t.length};return{enqueue:n,dequeue:i,flush:s,clear:o,length:a}},EPUBJS.core.isElement=function(e){return!(!e||1!=e.nodeType)},EPUBJS.core.uuid=function(){var e=(new Date).getTime(),t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?r:7&r|8).toString(16)});return t},EPUBJS.core.values=function(e){for(var t=-1,r=Object.keys(e),n=r.length,i=Array(n);++t0;){if(r=n.shift(),"text"===r.type?(i=o.childNodes[r.index],o=i.parentNode||o):o=r.id?s.getElementById(r.id):a[r.index],"undefined"==typeof o)return console.error("No Element For",r,e.str),!1;a=Array.prototype.slice.call(o.children)}return o},EPUBJS.EpubCFI.prototype.compare=function(e,t){if("string"==typeof e&&(e=new EPUBJS.EpubCFI(e)),"string"==typeof t&&(t=new EPUBJS.EpubCFI(t)),e.spinePos>t.spinePos)return 1;if(e.spinePost.steps[r].index)return 1;if(e.steps[r].indext.characterOffset?1:e.characterOffset=0?(s=i.length,e.characterOffsetr?this.hooks[r].apply(this.context,i):void 0}.bind(this))):(e=n.promise,n.resolve()),e},EPUBJS.Infinite=function(e,t){this.container=e,this.windowHeight=window.innerHeight,this.tick=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,this.scrolled=!1,this.ignore=!1,this.displaying=!1,this.offset=350,this.views=[],this.renderer=t,this.prevScrollTop=0},EPUBJS.Infinite.prototype.start=function(){this.container.addEventListener("scroll",function(){this.ignore?this.ignore=!1:this.scrolled=!0}.bind(this)),window.addEventListener("unload",function(){this.ignore=!0}),this.tick.call(window,this.check.bind(this)),this.scrolled=!1},EPUBJS.Infinite.prototype.forwards=function(){this.trigger("forwards")},EPUBJS.Infinite.prototype.backwards=function(){this.trigger("backwards")},EPUBJS.Infinite.prototype.check=function(){if(this.scrolled&&!this.displaying){var e=this.container.scrollTop,t=(this.container.scrollLeft,this.container.scrollHeight),r=(this.container.scrollWidth,e-this.prevScrollTop),n=this.container.getBoundingClientRect().height,i=e+this.offset>t-n,s=e0?this.forwards():s&&0>r&&this.backwards(),this.prevScrollTop=e,this.scrolled=!1}else this.displaying=!1,this.scrolled=!1;this.tick.call(window,this.check.bind(this))},EPUBJS.Infinite.prototype.scrollBy=function(e,t,r){r&&(this.displaying=!0),this.container.scrollLeft+=e,this.container.scrollTop+=t},EPUBJS.Infinite.prototype.scroll=function(e,t,r){r&&(this.displaying=!0),this.container.scrollLeft=e,this.container.scrollTop=t},RSVP.EventTarget.mixin(EPUBJS.Infinite.prototype),EPUBJS.Layout=function(){},EPUBJS.Layout.prototype.reconcileLayoutSettings=function(e,t){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return t.forEach(function(e){var t,n,i=e.replace("rendition:",""),s=i.indexOf("-");-1!=s&&(t=i.slice(0,s),n=i.slice(s+1),r[t]=n)}),r},EPUBJS.Layout.prototype.determineLayout=function(e){var t=this.determineSpreads(this.minSpreadWidth),r=t?"ReflowableSpreads":"Reflowable",n=!1;return"pre-paginated"===e.layout&&(r="Fixed",n=!0,t=!1),"reflowable"===e.layout&&"none"===e.spread&&(r="Reflowable",n=!1,t=!1),"reflowable"===e.layout&&"both"===e.spread&&(r="ReflowableSpreads",n=!1,t=!0),this.spreads=t,this.render.scroll(n),this.trigger("renderer:spreads",t),r},EPUBJS.Layout.prototype.applyStyles=function(e){for(var t in e)for(var r in this.views)r.setStyle(t,e[t])},EPUBJS.Layout.prototype.setStyle=function(e,t,r){for(var n in this.views)n.setStyle(e,t,r)},EPUBJS.Layout.prototype.removeStyle=function(e){for(var t in this.views)t.removeStyle(e)},EPUBJS.Layout.prototype.applyHeadTags=function(e){for(var t in e)this.render.addHeadTag(t,e[t])},EPUBJS.Navigation=function(e,t){var r=this,n=new EPUBJS.Parser,i=t||EPUBJS.core.request;this.package=e,this.toc=[],this.tocByHref={},this.tocById={},e.navPath&&(this.navUrl=e.baseUrl+e.navPath,this.nav={},this.nav.load=function(){var e=new RSVP.defer,t=e.promise;return i(r.navUrl,"xml").then(function(t){r.toc=n.nav(t),r.loaded(r.toc),e.resolve(r.toc)}),t}),e.ncxPath&&(this.ncxUrl=e.baseUrl+e.ncxPath,this.ncx={},this.ncx.load=function(){var e=new RSVP.defer,t=e.promise;return i(r.ncxUrl,"xml").then(function(t){r.toc=n.ncx(t),r.loaded(r.toc),e.resolve(r.toc)}),t})},EPUBJS.Navigation.prototype.load=function(e){{var t,r;e||EPUBJS.core.request}return this.nav?t=this.nav.load():this.ncx?t=this.ncx.load():(r=new RSVP.defer,r.resolve([]),t=r.promise),t},EPUBJS.Navigation.prototype.loaded=function(e){for(var t,r=0;r=0;o--){var a=i.snapshotItem(o),u=a.getAttribute("id")||!1,h=a.querySelector("content"),c=h.getAttribute("src"),p=a.querySelector("navLabel"),l=p.textContent?p.textContent:"",d=c.split("#"),f=(d[0],t(a));n.unshift({id:u,href:c,label:l,subitems:f,parent:r?r.getAttribute("id"):null})}return n}var r=e.querySelector("navMap");return r?t(r):[]},EPUBJS.Renderer=function(e,t){var r=t||{};this.settings={hidden:r.hidden||!1,viewsLimit:6,width:r.width||!1,height:r.height||!1},this.book=e,this.epubcfi=new EPUBJS.EpubCFI,this.layoutSettings={},this._q=EPUBJS.core.queue(this),this.position=1,this.initialize({width:this.settings.width,height:this.settings.height}),this.rendering=!1,this.views=[],this.positions=[],this.hooks={},this.hooks.display=new EPUBJS.Hook(this),this.hooks.replacements=new EPUBJS.Hook(this)},EPUBJS.Renderer.prototype.initialize=function(e){{var t=e||{},r=t.height?t.height+"px":"100%",n=t.width?t.width+"px":"100%";t.hidden||!1}return this.container=document.createElement("div"),this.infinite=new EPUBJS.Infinite(this.container,this),this.container.style.width=n,this.container.style.height=r,this.container.style.overflow="scroll",t.hidden?(this.wrapper=document.createElement("div"),this.wrapper.style.visibility="hidden",this.wrapper.style.overflow="hidden",this.wrapper.style.width="0",this.wrapper.style.height="0",this.wrapper.appendChild(this.container),this.wrapper):this.container},EPUBJS.Renderer.prototype.resize=function(e,t){var r=e,n=t; +if(e.match(/[^a-zA-Z0-9-]/)){if(!r||!r.is(e))throw new TypeError('TLD "'+e+'" contains characters other than [A-Z0-9]');o=new RegExp(s(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");o=new RegExp(s(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}return this.build(!t),this},f.directory=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||e===!0){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var r=this._parts.path.length-this.filename().length-1,n=this._parts.path.substring(0,r)||(this._parts.hostname?"/":"");return e?i.decodePath(n):n}var o=this._parts.path.length-this.filename().length,a=this._parts.path.substring(0,o),u=new RegExp("^"+s(a));return this.is("relative")||(e||(e="/"),"/"!==e.charAt(0)&&(e="/"+e)),e&&"/"!==e.charAt(e.length-1)&&(e+="/"),e=i.recodePath(e),this._parts.path=this._parts.path.replace(u,e),this.build(!t),this},f.filename=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||e===!0){if(!this._parts.path||"/"===this._parts.path)return"";var r=this._parts.path.lastIndexOf("/"),n=this._parts.path.substring(r+1);return e?i.decodePathSegment(n):n}var o=!1;"/"===e.charAt(0)&&(e=e.substring(1)),e.match(/\.?\//)&&(o=!0);var a=new RegExp(s(this.filename())+"$");return e=i.recodePath(e),this._parts.path=this._parts.path.replace(a,e),o?this.normalizePath(t):this.build(!t),this},f.suffix=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||e===!0){if(!this._parts.path||"/"===this._parts.path)return"";var r,n,o=this.filename(),a=o.lastIndexOf(".");return-1===a?"":(r=o.substring(a+1),n=/^[a-z0-9%]+$/i.test(r)?r:"",e?i.decodePathSegment(n):n)}"."===e.charAt(0)&&(e=e.substring(1));var u,h=this.suffix();if(h)u=new RegExp(e?s(h)+"$":s("."+h)+"$");else{if(!e)return this;this._parts.path+="."+i.recodePath(e)}return u&&(e=i.recodePath(e),this._parts.path=this._parts.path.replace(u,e)),this.build(!t),this},f.segment=function(e,t,r){var n=this._parts.urn?":":"/",i=this.path(),s="/"===i.substring(0,1),o=i.split(n);if(void 0!==e&&"number"!=typeof e&&(r=t,t=e,e=void 0),void 0!==e&&"number"!=typeof e)throw new Error('Bad segment "'+e+'", must be 0-based integer');if(s&&o.shift(),0>e&&(e=Math.max(o.length+e,0)),void 0===t)return void 0===e?o:o[e];if(null===e||void 0===o[e])if(a(t)){o=[];for(var u=0,h=t.length;h>u;u++)(t[u].length||o.length&&o[o.length-1].length)&&(o.length&&!o[o.length-1].length&&o.pop(),o.push(t[u]))}else(t||"string"==typeof t)&&(""===o[o.length-1]?o[o.length-1]=t:o.push(t));else t||"string"==typeof t&&t.length?o[e]=t:o.splice(e,1);return s&&o.unshift(""),this.path(o.join(n),r)},f.segmentCoded=function(e,t,r){var n,s,o;if("number"!=typeof e&&(r=t,t=e,e=void 0),void 0===t){if(n=this.segment(e,t,r),a(n))for(s=0,o=n.length;o>s;s++)n[s]=i.decode(n[s]);else n=void 0!==n?i.decode(n):void 0;return n}if(a(t))for(s=0,o=t.length;o>s;s++)t[s]=i.decode(t[s]);else t="string"==typeof t?i.encode(t):t;return this.segment(e,t,r)};var P=f.query;return f.query=function(e,t){if(e===!0)return i.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"==typeof e){var r=i.parseQuery(this._parts.query,this._parts.escapeQuerySpace),n=e.call(this,r);return this._parts.query=i.buildQuery(n||r,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this}return void 0!==e&&"string"!=typeof e?(this._parts.query=i.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this):P.call(this,e,t)},f.setQuery=function(e,t,r){var n=i.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("object"==typeof e)for(var s in e)m.call(e,s)&&(n[s]=e[s]);else{if("string"!=typeof e)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");n[e]=void 0!==t?t:null}return this._parts.query=i.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(r=t),this.build(!r),this},f.addQuery=function(e,t,r){var n=i.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return i.addQuery(n,e,void 0===t?null:t),this._parts.query=i.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(r=t),this.build(!r),this},f.removeQuery=function(e,t,r){var n=i.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return i.removeQuery(n,e,t),this._parts.query=i.buildQuery(n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(r=t),this.build(!r),this},f.hasQuery=function(e,t,r){var n=i.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return i.hasQuery(n,e,t,r)},f.setSearch=f.setQuery,f.addSearch=f.addQuery,f.removeSearch=f.removeQuery,f.hasSearch=f.hasQuery,f.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},f.normalizeProtocol=function(e){return"string"==typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!e)),this},f.normalizeHostname=function(r){return this._parts.hostname&&(this.is("IDN")&&e?this._parts.hostname=e.toASCII(this._parts.hostname):this.is("IPv6")&&t&&(this._parts.hostname=t.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!r)),this},f.normalizePort=function(e){return"string"==typeof this._parts.protocol&&this._parts.port===i.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!e)),this},f.normalizePath=function(e){if(this._parts.urn)return this;if(!this._parts.path||"/"===this._parts.path)return this;var t,r,n,s=this._parts.path,o="";for("/"!==s.charAt(0)&&(t=!0,s="/"+s),s=s.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),t&&(o=s.substring(1).match(/^(\.\.\/)+/)||"",o&&(o=o[0]));;){if(r=s.indexOf("/.."),-1===r)break;0!==r?(n=s.substring(0,r).lastIndexOf("/"),-1===n&&(n=r),s=s.substring(0,n)+s.substring(r+3)):s=s.substring(3)}return t&&this.is("relative")&&(s=o+s.substring(1)),s=i.recodePath(s),this._parts.path=s,this.build(!e),this},f.normalizePathname=f.normalizePath,f.normalizeQuery=function(e){return"string"==typeof this._parts.query&&(this._parts.query.length?this.query(i.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!e)),this},f.normalizeFragment=function(e){return this._parts.fragment||(this._parts.fragment=null,this.build(!e)),this},f.normalizeSearch=f.normalizeQuery,f.normalizeHash=f.normalizeFragment,f.iso8859=function(){var e=i.encode,t=i.decode;return i.encode=escape,i.decode=decodeURIComponent,this.normalize(),i.encode=e,i.decode=t,this},f.unicode=function(){var e=i.encode,t=i.decode;return i.encode=l,i.decode=unescape,this.normalize(),i.encode=e,i.decode=t,this},f.readable=function(){var t=this.clone();t.username("").password("").normalize();var r="";if(t._parts.protocol&&(r+=t._parts.protocol+"://"),t._parts.hostname&&(t.is("punycode")&&e?(r+=e.toUnicode(t._parts.hostname),t._parts.port&&(r+=":"+t._parts.port)):r+=t.host()),t._parts.hostname&&t._parts.path&&"/"!==t._parts.path.charAt(0)&&(r+="/"),r+=t.path(!0),t._parts.query){for(var n="",s=0,o=t._parts.query.split("&"),a=o.length;a>s;s++){var u=(o[s]||"").split("=");n+="&"+i.decodeQuery(u[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),void 0!==u[1]&&(n+="="+i.decodeQuery(u[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}r+="?"+n.substring(1)}return r+=i.decodeQuery(t.hash(),!0)},f.absoluteTo=function(e){var t,r,n,s=this.clone(),o=["protocol","username","password","hostname","port"];if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e instanceof i||(e=new i(e)),s._parts.protocol||(s._parts.protocol=e._parts.protocol),this._parts.hostname)return s;for(r=0;n=o[r];r++)s._parts[n]=e._parts[n];return s._parts.path?".."===s._parts.path.substring(-2)&&(s._parts.path+="/"):(s._parts.path=e._parts.path,s._parts.query||(s._parts.query=e._parts.query)),"/"!==s.path().charAt(0)&&(t=e.directory(),s._parts.path=(t?t+"/":"")+s._parts.path,s.normalizePath()),s.build(),s},f.relativeTo=function(e){var t,r,n,s,o,a=this.clone().normalize();if(a._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e=new i(e).normalize(),t=a._parts,r=e._parts,s=a.path(),o=e.path(),"/"!==s.charAt(0))throw new Error("URI is already relative");if("/"!==o.charAt(0))throw new Error("Cannot calculate a URI relative to another relative URI");if(t.protocol===r.protocol&&(t.protocol=null),t.username!==r.username||t.password!==r.password)return a.build();if(null!==t.protocol||null!==t.username||null!==t.password)return a.build();if(t.hostname!==r.hostname||t.port!==r.port)return a.build();if(t.hostname=null,t.port=null,s===o)return t.path="",a.build();if(n=i.commonPath(a.path(),e.path()),!n)return a.build();var u=r.path.substring(n.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return t.path=u+t.path.substring(n.length),a.build()},f.equals=function(e){var t,r,n,s=this.clone(),o=new i(e),u={},h={},p={};if(s.normalize(),o.normalize(),s.toString()===o.toString())return!0;if(t=s.query(),r=o.query(),s.query(""),o.query(""),s.toString()!==o.toString())return!1;if(t.length!==r.length)return!1;u=i.parseQuery(t,this._parts.escapeQuerySpace),h=i.parseQuery(r,this._parts.escapeQuerySpace);for(n in u)if(m.call(u,n)){if(a(u[n])){if(!c(u[n],h[n]))return!1}else if(u[n]!==h[n])return!1;p[n]=!0}for(n in h)if(m.call(h,n)&&!p[n])return!1;return!0},f.duplicateQueryParameters=function(e){return this._parts.duplicateQueryParameters=!!e,this},f.escapeQuerySpace=function(e){return this._parts.escapeQuerySpace=!!e,this},i}),EPUBJS.Book=function(e){this.opening=new RSVP.defer,this.opened=this.opening.promise,this.isOpen=!1,this.url=void 0,this.spine=new EPUBJS.Spine(this.request),this.loading={manifest:new RSVP.defer,spine:new RSVP.defer,metadata:new RSVP.defer,cover:new RSVP.defer,navigation:new RSVP.defer,pageList:new RSVP.defer},this.loaded={manifest:this.loading.manifest.promise,spine:this.loading.spine.promise,metadata:this.loading.metadata.promise,cover:this.loading.cover.promise,navigation:this.loading.navigation.promise,pageList:this.loading.pageList.promise},this.ready=RSVP.hash(this.loaded),this.isRendered=!1,this._q=EPUBJS.core.queue(this),this.request=this.requestMethod.bind(this),e&&this.open(e)},EPUBJS.Book.prototype.open=function(e){var t,r,n,i=new EPUBJS.Parser,s=this,o="META-INF/container.xml";return e?(t="object"==typeof e?e:EPUBJS.core.uri(e),"opf"===t.extension?(this.packageUrl=t.href,this.containerUrl="",t.origin?this.url=t.origin+"/"+t.directory:window?(n=EPUBJS.core.uri(window.location.href),this.url=EPUBJS.core.resolveUrl(n.base,t.directory)):this.url=t.directory,r=this.request(this.packageUrl)):"epub"===t.extension||"zip"===t.extension?(this.archived=!0,this.url=""):t.extension||(this.containerUrl=e+o,r=this.request(this.containerUrl).then(function(e){return i.container(e)}).then(function(t){var r=EPUBJS.core.uri(t.packagePath);return s.packageUrl=e+t.packagePath,s.url=e+r.directory,s.encoding=t.encoding,s.request(s.packageUrl)}).catch(function(e){console.error("Could not load book at: "+(this.packageUrl||this.containerPath)),s.trigger("book:loadFailed",this.packageUrl||this.containerPath),s.opening.reject(e)})),r.then(function(e){s.unpack(e),s.loading.manifest.resolve(s.package.manifest),s.loading.metadata.resolve(s.package.metadata),s.loading.spine.resolve(s.spine),s.loading.cover.resolve(s.cover),this.isOpen=!0,s.opening.resolve(s)}).catch(function(e){console.error(e.message,e.stack),s.opening.reject(e)}),this.opened):(this.opening.resolve(this),this.opened)},EPUBJS.Book.prototype.unpack=function(e){var t=this,r=new EPUBJS.Parser;t.package=r.packageContents(e),t.package.baseUrl=t.url,this.spine.load(t.package),t.navigation=new EPUBJS.Navigation(t.package,this.request),t.navigation.load().then(function(e){t.toc=e,t.loading.navigation.resolve(t.toc)}),t.cover=t.url+t.package.coverPath},EPUBJS.Book.prototype.section=function(e){return this.spine.get(e)},EPUBJS.Book.prototype.renderTo=function(e,t){var r=new EPUBJS.Renderer(this,t);return r.attachTo(e),r},EPUBJS.Book.prototype.requestMethod=function(e){return this.archived?void 0:EPUBJS.core.request(e,"xml",this.requestCredentials,this.requestHeaders)},EPUBJS.Book.prototype.setRequestCredentials=function(e){this.requestCredentials=e},EPUBJS.Book.prototype.setRequestHeaders=function(e){this.requestHeaders=e},RSVP.EventTarget.mixin(EPUBJS.Book.prototype),RSVP.on("error",function(){}),RSVP.configure("instrument",!0),RSVP.on("rejected",function(e){console.error(e.detail.message,e.detail.stack)}),EPUBJS.core={},EPUBJS.core.request=function(e,t,r,n){function i(){if(this.readyState===this.DONE)if(200===this.status||this.responseXML){var e;e="xml"==t?this.responseXML:"json"==t?JSON.parse(this.response):"blob"==t?o?this.response:new Blob([this.response]):this.response,u.resolve(e)}else u.reject({status:this.status,message:this.response,stack:(new Error).stack})}var s,o=window.URL,a=o?"blob":"arraybuffer",u=new RSVP.defer,h=new XMLHttpRequest,c=XMLHttpRequest.prototype;"overrideMimeType"in c||Object.defineProperty(c,"overrideMimeType",{value:function(){}}),r&&(h.withCredentials=!0),h.open("GET",e,!0);for(s in n)h.setRequestHeader(s,n[s]);return h.onreadystatechange=i,"blob"==t&&(h.responseType=a),"json"==t&&h.setRequestHeader("Accept","application/json"),"xml"==t&&h.overrideMimeType("text/xml"),h.send(),u.promise},EPUBJS.core.uri=function(e){var t,r,n,i={protocol:"",host:"",path:"",origin:"",directory:"",base:"",filename:"",extension:"",fragment:"",href:e},s=e.indexOf("://"),o=e.indexOf("?"),a=e.indexOf("#");return-1!=a&&(i.fragment=e.slice(a+1),e=e.slice(0,a)),-1!=o&&(i.search=e.slice(o+1),e=e.slice(0,o),href=e),-1!=s?(i.protocol=e.slice(0,s),t=e.slice(s+3),n=t.indexOf("/"),-1===n?(i.host=i.path,i.path=""):(i.host=t.slice(0,n),i.path=t.slice(n)),i.origin=i.protocol+"://"+i.host,i.directory=EPUBJS.core.folder(i.path),i.base=i.origin+i.directory):(i.path=e,i.directory=EPUBJS.core.folder(e),i.base=i.directory),i.filename=e.replace(i.base,""),r=i.filename.lastIndexOf("."),-1!=r&&(i.extension=i.filename.slice(r+1)),i},EPUBJS.core.folder=function(e){var t=e.lastIndexOf("/");if(-1==t)var r="";return r=e.slice(0,t+1)},EPUBJS.core.queue=function(e){var t=[],r=e,n=function(e,r,n){return t.push({funcName:e,args:r,context:n}),t},i=function(){var e;t.length&&(e=t.shift(),r[e.funcName].apply(e.context||r,e.args))},s=function(){for(;t.length;)i()},o=function(){t=[]},a=function(){return t.length};return{enqueue:n,dequeue:i,flush:s,clear:o,length:a}},EPUBJS.core.isElement=function(e){return!(!e||1!=e.nodeType)},EPUBJS.core.uuid=function(){var e=(new Date).getTime(),t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?r:7&r|8).toString(16)});return t},EPUBJS.core.values=function(e){for(var t=-1,r=Object.keys(e),n=r.length,i=Array(n);++t0;){if(r=n.shift(),"text"===r.type?(i=o.childNodes[r.index],o=i.parentNode||o):o=r.id?s.getElementById(r.id):a[r.index],"undefined"==typeof o)return console.error("No Element For",r,e.str),!1;a=Array.prototype.slice.call(o.children)}return o},EPUBJS.EpubCFI.prototype.compare=function(e,t){if("string"==typeof e&&(e=new EPUBJS.EpubCFI(e)),"string"==typeof t&&(t=new EPUBJS.EpubCFI(t)),e.spinePos>t.spinePos)return 1;if(e.spinePost.steps[r].index)return 1;if(e.steps[r].indext.characterOffset?1:e.characterOffset=0?(s=i.length,e.characterOffsetr?this.hooks[r].apply(this.context,i):void 0}.bind(this))):(e=n.promise,n.resolve()),e},EPUBJS.Infinite=function(e,t){this.container=e,this.windowHeight=window.innerHeight,this.tick=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,this.scrolled=!1,this.ignore=!1,this.displaying=!1,this.offset=350,this.views=[],this.renderer=t,this.prevScrollTop=0},EPUBJS.Infinite.prototype.start=function(){this.container.addEventListener("scroll",function(){this.ignore?this.ignore=!1:this.scrolled=!0}.bind(this)),window.addEventListener("unload",function(){this.ignore=!0}),this.tick.call(window,this.check.bind(this)),this.scrolled=!1},EPUBJS.Infinite.prototype.forwards=function(){this.trigger("forwards")},EPUBJS.Infinite.prototype.backwards=function(){this.trigger("backwards")},EPUBJS.Infinite.prototype.check=function(){if(this.scrolled&&!this.displaying){var e=this.container.scrollTop,t=(this.container.scrollLeft,this.container.scrollHeight),r=(this.container.scrollWidth,e-this.prevScrollTop),n=this.container.getBoundingClientRect().height,i=e+this.offset>t-n,s=e0?this.forwards():s&&0>r&&this.backwards(),this.prevScrollTop=e,this.scrolled=!1}else this.displaying=!1,this.scrolled=!1;this.tick.call(window,this.check.bind(this))},EPUBJS.Infinite.prototype.scrollBy=function(e,t,r){r&&(this.displaying=!0),this.container.scrollLeft+=e,this.container.scrollTop+=t},EPUBJS.Infinite.prototype.scroll=function(e,t,r){r&&(this.displaying=!0),this.container.scrollLeft=e,this.container.scrollTop=t},RSVP.EventTarget.mixin(EPUBJS.Infinite.prototype),EPUBJS.Layout=function(){},EPUBJS.Layout.prototype.reconcileLayoutSettings=function(e,t){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return t.forEach(function(e){var t,n,i=e.replace("rendition:",""),s=i.indexOf("-");-1!=s&&(t=i.slice(0,s),n=i.slice(s+1),r[t]=n)}),r},EPUBJS.Layout.prototype.determineLayout=function(e){var t=this.determineSpreads(this.minSpreadWidth),r=t?"ReflowableSpreads":"Reflowable",n=!1;return"pre-paginated"===e.layout&&(r="Fixed",n=!0,t=!1),"reflowable"===e.layout&&"none"===e.spread&&(r="Reflowable",n=!1,t=!1),"reflowable"===e.layout&&"both"===e.spread&&(r="ReflowableSpreads",n=!1,t=!0),this.spreads=t,this.render.scroll(n),this.trigger("renderer:spreads",t),r},EPUBJS.Layout.prototype.applyStyles=function(e){for(var t in e)for(var r in this.views)r.setStyle(t,e[t])},EPUBJS.Layout.prototype.setStyle=function(e,t,r){for(var n in this.views)n.setStyle(e,t,r)},EPUBJS.Layout.prototype.removeStyle=function(e){for(var t in this.views)t.removeStyle(e)},EPUBJS.Layout.prototype.applyHeadTags=function(e){for(var t in e)this.render.addHeadTag(t,e[t])},EPUBJS.Navigation=function(e,t){var r=this,n=new EPUBJS.Parser,i=t||EPUBJS.core.request;this.package=e,this.toc=[],this.tocByHref={},this.tocById={},e.navPath&&(this.navUrl=e.baseUrl+e.navPath,this.nav={},this.nav.load=function(){var e=new RSVP.defer,t=e.promise;return i(r.navUrl,"xml").then(function(t){r.toc=n.nav(t),r.loaded(r.toc),e.resolve(r.toc)}),t}),e.ncxPath&&(this.ncxUrl=e.baseUrl+e.ncxPath,this.ncx={},this.ncx.load=function(){var e=new RSVP.defer,t=e.promise;return i(r.ncxUrl,"xml").then(function(t){r.toc=n.ncx(t),r.loaded(r.toc),e.resolve(r.toc)}),t})},EPUBJS.Navigation.prototype.load=function(e){{var t,r;e||EPUBJS.core.request}return this.nav?t=this.nav.load():this.ncx?t=this.ncx.load():(r=new RSVP.defer,r.resolve([]),t=r.promise),t},EPUBJS.Navigation.prototype.loaded=function(e){for(var t,r=0;r=0;o--){var a=i.snapshotItem(o),u=a.getAttribute("id")||!1,h=a.querySelector("content"),c=h.getAttribute("src"),p=a.querySelector("navLabel"),l=p.textContent?p.textContent:"",d=c.split("#"),f=(d[0],t(a));n.unshift({id:u,href:c,label:l,subitems:f,parent:r?r.getAttribute("id"):null})}return n}var r=e.querySelector("navMap");return r?t(r):[]},EPUBJS.Renderer=function(e,t){var r=t||{};this.settings={hidden:r.hidden||!1,viewsLimit:6,width:r.width||!1,height:r.height||!1},this.book=e,this.epubcfi=new EPUBJS.EpubCFI,this.layoutSettings={},this._q=EPUBJS.core.queue(this),this.position=1,this.initialize({width:this.settings.width,height:this.settings.height}),this.rendering=!1,this.views=[],this.positions=[],this.hooks={},this.hooks.display=new EPUBJS.Hook(this),this.hooks.replacements=new EPUBJS.Hook(this)},EPUBJS.Renderer.prototype.initialize=function(e){{var t=e||{},r=t.height?t.height+"px":"100%",n=t.width?t.width+"px":"100%";t.hidden||!1}return this.container=document.createElement("div"),this.infinite=new EPUBJS.Infinite(this.container,this),this.container.style.width=n,this.container.style.height=r,this.container.style.overflow="scroll",t.hidden?(this.wrapper=document.createElement("div"),this.wrapper.style.visibility="hidden",this.wrapper.style.overflow="hidden",this.wrapper.style.width="0",this.wrapper.style.height="0",this.wrapper.appendChild(this.container),this.wrapper):this.container},EPUBJS.Renderer.prototype.resize=function(e,t){var r=e,n=t; e||(r=window.innerWidth),t||(n=window.innerHeight),this.container.style.width=r+"px",this.container.style.height=n+"px",this.trigger("resized",{width:this.width,height:this.height})},EPUBJS.Renderer.prototype.onResized=function(){var e=this.element.getBoundingClientRect();this.resize(e.width,e.height)},EPUBJS.Renderer.prototype.attachTo=function(e){var t;return EPUBJS.core.isElement(e)?this.element=e:"string"==typeof e&&(this.element=document.getElementById(e)),this.element?(this.element.appendChild(this.container),this.settings.height||this.settings.width||(t=this.element.getBoundingClientRect(),this.resize(t.width,t.height)),this.infinite.start(),this.infinite.on("forwards",function(){var e=this.last().section.index+1;!this.rendering&&e0&&this.backwards()}.bind(this)),window.addEventListener("resize",this.onResized.bind(this),!1),void this.hooks.replacements.register(this.replacements.bind(this))):void console.error("Not an Element")},EPUBJS.Renderer.prototype.clear=function(){this.views.forEach(function(e){e.destroy()}),this.views=[]},EPUBJS.Renderer.prototype.display=function(e){var t=new RSVP.defer,r=t.promise;return this.clear(),this.book.opened.then(function(){var r,n=this.book.spine.get(e);n?(r=this.render(n),r.then(this.fill.bind(this)).then(function(){t.resolve(this)}.bind(this))):t.reject(new Error("No Section Found"))}.bind(this)),r},EPUBJS.Renderer.prototype.render=function(e){var t,r;return e?(r=new EPUBJS.View(e),this.insert(r,e.index),t=r.render(this.book.request),t.then(function(){return this.hooks.display.trigger(r)}.bind(this)).then(function(){return this.hooks.replacements.trigger(r,this)}.bind(this)).then(function(){return this.rendering=!1,r.show(),r}.bind(this)).catch(function(e){this.trigger("loaderror",e)}.bind(this))):(t=new RSVP.defer,t.reject(new Error("No Section Provided")),t.promise)},EPUBJS.Renderer.prototype.forwards=function(){var e,t,r;return e=this.last().section.index+1,this.rendering||e===this.book.spine.length?(t=new RSVP.defer,t.reject(new Error("Reject Forwards")),t.promise):(this.rendering=!0,r=this.book.spine.get(e),t=this.render(r),t.then(function(){var e=this.first(),t=e.bounds(),r=this.container.scrollTop;this.views.length>this.settings.viewsLimit&&(this.remove(e),this.infinite.scroll(0,r-t.height,!0))}.bind(this)),t)},EPUBJS.Renderer.prototype.backwards=function(){var e,t,r;return e=this.first().section.index-1,this.rendering||0>e?(t=new RSVP.defer,t.reject(new Error("Reject Backwards")),t.promise):(this.rendering=!0,r=this.book.spine.get(e),t=this.render(r),t.then(function(){this.infinite.scrollBy(0,this.first().height,!0),this.views.length>this.settings.viewsLimit&&(last=this.last(),this.remove(last))}.bind(this)),t)},EPUBJS.Renderer.prototype.fill=function(){var e=this.container.getBoundingClientRect().height,t=function(){var r=this.last().bounds().bottom,n=new RSVP.defer;return e&&r&&e>r?this.forwards().then(t):(this.rendering=!1,n.resolve(),n.promise)}.bind(this),r=this.first().section.index-1,n=t();return r>0&&n.then(this.backwards.bind(this)),n.then(function(){this.rendering=!1}.bind(this))},EPUBJS.Renderer.prototype.append=function(e){this.views.push(e),e.appendTo(this.container)},EPUBJS.Renderer.prototype.prepend=function(e){this.views.unshift(e),e.prependTo(this.container)},EPUBJS.Renderer.prototype.insert=function(e,t){this.first()?t-this.first().section.index>=0?this.append(e):t-this.last().section.index<=0&&this.prepend(e):this.append(e)},EPUBJS.Renderer.prototype.remove=function(e){var t=this.views.indexOf(e);e.destroy(),t>-1&&this.views.splice(t,1)},EPUBJS.Renderer.prototype.first=function(){return this.views[0]},EPUBJS.Renderer.prototype.last=function(){return this.views[this.views.length-1]},EPUBJS.Renderer.prototype.replacements=function(e,t){for(var r=new RSVP.defer,n=e.document.querySelectorAll("a[href]"),i=function(e){var r=e.getAttribute("href"),n=r.search("://");-1!=n?e.setAttribute("target","_blank"):e.onclick=function(){return t.display(r),!1}},s=0;s-1?(delete this.spineByHref[e.href],delete this.spineById[e.idref],this.spineItems.splice(t,1)):void 0},EPUBJS.View=function(e){this.id="epubjs-view:"+EPUBJS.core.uuid(),this.rendering=new RSVP.defer,this.rendered=this.rendering.promise,this.iframe=this.create(),this.section=e},EPUBJS.View.prototype.create=function(){return this.iframe=document.createElement("iframe"),this.iframe.id=this.id,this.iframe.scrolling="no",this.iframe.seamless="seamless",this.iframe.style.border="none",this.resizing=!0,this.iframe.width="100%",this.iframe.style.height="100%",this.iframe.style.display="none",this.iframe.style.visibility="hidden",this.iframe},EPUBJS.View.prototype.resized=function(){this.resizing?this.resizing=!1:this.layout()},EPUBJS.View.prototype.render=function(e){return this.section.render(e).then(function(e){return this.load(e)}.bind(this)).then(this.display.bind(this)).then(function(){this.rendering.resolve(this)}.bind(this))},EPUBJS.View.prototype.load=function(e){var t=new RSVP.defer,r=t.promise;return this.document=this.iframe.contentDocument,this.iframe.addEventListener("load",function(){this.window=this.iframe.contentWindow,this.document=this.iframe.contentDocument,t.resolve(this)}.bind(this)),this.document.open(),this.document.write(e),this.document.close(),r},EPUBJS.View.prototype.display=function(){var e=new RSVP.defer,t=e.promise;return this.iframe.style.display="block",this.document.body.style.margin="0",this.document.body.style.display="inline-block",this.document.body.style.padding="0 20px 20px 20px",setTimeout(function(){this.window.addEventListener("resize",this.resized.bind(this),!1)}.bind(this),10),"loading"!==this.document.fonts.status?(this.layout(),e.resolve(this)):this.document.fonts.onloading=function(){this.layout(),e.resolve(this)}.bind(this),t},EPUBJS.View.prototype.layout=function(){var e;e=this.document.body.getBoundingClientRect(),(!e||0==e.height&&0==e.width)&&console.error("View not shown"),this.resizing=!0,this.iframe.style.height=e.height+"px",this.width=e.width,this.height=e.height},EPUBJS.View.prototype.observe=function(e){var t=this,r=new MutationObserver(function(e){e.forEach(function(){t.layout()})}),n={attributes:!0,childList:!0,characterData:!0,subtree:!0};return r.observe(e,n),r},EPUBJS.View.prototype.appendTo=function(e){this.element=e,this.element.appendChild(this.iframe)},EPUBJS.View.prototype.prependTo=function(e){this.element=e,e.insertBefore(this.iframe,e.firstChild)},EPUBJS.View.prototype.bounds=function(){return this.iframe.getBoundingClientRect()},EPUBJS.View.prototype.show=function(){this.iframe.style.display="block",this.iframe.style.visibility="visible"},EPUBJS.View.prototype.hide=function(){this.iframe.style.display="none",this.iframe.style.visibility="hidden"},EPUBJS.View.prototype.destroy=function(){this.element.removeChild(this.iframe)}; \ No newline at end of file diff --git a/lib/epubjs/core.js b/lib/epubjs/core.js index d73eef7..46c6ca9 100644 --- a/lib/epubjs/core.js +++ b/lib/epubjs/core.js @@ -13,7 +13,7 @@ EPUBJS.core.request = function(url, type, withCredentials, headers) { var xhrPrototype = XMLHttpRequest.prototype; var header; - + if (!('overrideMimeType' in xhrPrototype)) { // IE10 might have response, but not overrideMimeType Object.defineProperty(xhrPrototype, 'overrideMimeType', { @@ -283,7 +283,7 @@ EPUBJS.core.resolveUrl = function(base, path) { directories.pop(); segments.unshift(part); } else { - segments.push(part); + segments.unshift(part); } }); diff --git a/lib/epubjs/view.js b/lib/epubjs/view.js index 118bebd..6bedfd2 100644 --- a/lib/epubjs/view.js +++ b/lib/epubjs/view.js @@ -117,7 +117,6 @@ EPUBJS.View.prototype.layout = function() { console.error("View not shown"); } - // Apply Changes this.resizing = true; this.iframe.style.height = bounds.height + "px";