/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ var vd=Object.create;var ar=Object.defineProperty,gd=Object.defineProperties,md=Object.getOwnPropertyDescriptor,_d=Object.getOwnPropertyDescriptors,yd=Object.getOwnPropertyNames,Eo=Object.getOwnPropertySymbols,bd=Object.getPrototypeOf,xo=Object.prototype.hasOwnProperty,wd=Object.prototype.propertyIsEnumerable;var So=(r,e,t)=>e in r?ar(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,or=(r,e)=>{for(var t in e||(e={}))xo.call(e,t)&&So(r,t,e[t]);if(Eo)for(var t of Eo(e))wd.call(e,t)&&So(r,t,e[t]);return r},lr=(r,e)=>gd(r,_d(e)),To=r=>ar(r,"__esModule",{value:!0});var As=(r,e)=>()=>(r&&(e=r(r=0)),e);var $=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ko=(r,e)=>{To(r);for(var t in e)ar(r,t,{get:e[t],enumerable:!0})},Ed=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of yd(e))!xo.call(r,i)&&i!=="default"&&ar(r,i,{get:()=>e[i],enumerable:!(t=md(e,i))||t.enumerable});return r},Zr=r=>Ed(To(ar(r!=null?vd(bd(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var Tt=(r,e,t)=>new Promise((i,n)=>{var s=l=>{try{o(t.next(l))}catch(u){n(u)}},a=l=>{try{o(t.throw(l))}catch(u){n(u)}},o=l=>l.done?i(l.value):Promise.resolve(l.value).then(s,a);o((t=t.apply(r,e)).next())});function Jt(r,e){for(var t in e)r[t]=e[t];return r}function Do(r){var e=r.parentNode;e&&e.removeChild(r)}function et(r,e,t){var i,n,s,a={};for(s in e)s=="key"?i=e[s]:s=="ref"?n=e[s]:a[s]=e[s];if(arguments.length>2&&(a.children=arguments.length>3?ur.call(arguments,2):t),typeof r=="function"&&r.defaultProps!=null)for(s in r.defaultProps)a[s]===void 0&&(a[s]=r.defaultProps[s]);return fr(r,a,i,n,null)}function fr(r,e,t,i,n){var s={type:r,props:e,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:n==null?++Co:n};return n==null&&ue.vnode!=null&&ue.vnode(s),s}function Yr(){return{current:null}}function kt(r){return r.children}function mt(r,e){this.props=r,this.context=e}function Ai(r,e){if(e==null)return r.__?Ai(r.__,r.__.__k.indexOf(r)+1):null;for(var t;e0?fr(v.type,v.props,v.key,null,v.__v):v)!=null){if(v.__=t,v.__b=t.__b+1,(c=_[f])===null||c&&v.key==c.key&&v.type===c.type)_[f]=void 0;else for(d=0;d2&&(a.children=arguments.length>3?ur.call(arguments,2):t),fr(r.type,a,i||r.key,n||r.ref,null)}function Kr(r,e){var t={__c:e="__cC"+Ao++,__:r,Consumer:function(i,n){return i.children(n)},Provider:function(i){var n,s;return this.getChildContext||(n=[],(s={})[e]=this,this.getChildContext=function(){return s},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&n.some(Ds)},this.sub=function(a){n.push(a);var o=a.componentWillUnmount;a.componentWillUnmount=function(){n.splice(n.indexOf(a),1),o&&o.call(a)}}),i.children}};return t.Provider.__=t.Consumer.contextType=t}var ur,ue,Co,Sd,hr,No,Ro,Ao,Xr,Io,Td,Jr=As(()=>{Xr={},Io=[],Td=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;ur=Io.slice,ue={__e:function(r,e,t,i){for(var n,s,a;e=e.__;)if((n=e.__c)&&!n.__)try{if((s=n.constructor)&&s.getDerivedStateFromError!=null&&(n.setState(s.getDerivedStateFromError(r)),a=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(r,i||{}),a=n.__d),a)return n.__E=n}catch(o){r=o}throw r}},Co=0,Sd=function(r){return r!=null&&r.constructor===void 0},mt.prototype.setState=function(r,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Jt({},this.state),typeof r=="function"&&(r=r(Jt({},t),this.props)),r&&Jt(t,r),r!=null&&this.__v&&(e&&this.__h.push(e),Ds(this))},mt.prototype.forceUpdate=function(r){this.__v&&(this.__e=!0,r&&this.__h.push(r),Ds(this))},mt.prototype.render=kt,hr=[],No=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Gr.__r=0,Ao=0});function Pi(r,e){ue.__h&&ue.__h(tt,r,Di||e),Di=0;var t=tt.__H||(tt.__H={__:[],__h:[]});return r>=t.__.length&&t.__.push({}),t.__[r]}function Li(r){return Di=1,Qr(Qo,r)}function Qr(r,e,t){var i=Pi(di++,2);return i.t=r,i.__c||(i.__=[t?t(e):Qo(void 0,e),function(n){var s=i.t(i.__[0],n);i.__[0]!==s&&(i.__=[s,i.__[1]],i.__c.setState({}))}],i.__c=tt),i.__}function cr(r,e){var t=Pi(di++,3);!ue.__s&&qs(t.__H,e)&&(t.__=r,t.__H=e,tt.__H.__h.push(t))}function en(r,e){var t=Pi(di++,4);!ue.__s&&qs(t.__H,e)&&(t.__=r,t.__H=e,tt.__h.push(t))}function dr(r){return Di=5,pr(function(){return{current:r}},[])}function zs(r,e,t){Di=6,en(function(){return typeof r=="function"?(r(e()),function(){return r(null)}):r?(r.current=e(),function(){return r.current=null}):void 0},t==null?t:t.concat(r))}function pr(r,e){var t=Pi(di++,7);return qs(t.__H,e)&&(t.__=r(),t.__H=e,t.__h=r),t.__}function Ms(r,e){return Di=8,pr(function(){return r},e)}function Bs(r){var e=tt.context[r.__c],t=Pi(di++,9);return t.c=r,e?(t.__==null&&(t.__=!0,e.sub(tt)),e.props.value):r.__}function Us(r,e){ue.useDebugValue&&ue.useDebugValue(e?e(r):r)}function Nd(r){var e=Pi(di++,10),t=Li();return e.__=r,tt.componentDidCatch||(tt.componentDidCatch=function(i){e.__&&e.__(i),t[1](i)}),[t[0],function(){t[1](void 0)}]}function Rd(){for(var r;r=Zo.shift();)if(r.__P)try{r.__H.__h.forEach(tn),r.__H.__h.forEach(Fs),r.__H.__h=[]}catch(e){r.__H.__h=[],ue.__e(e,r.__v)}}function tn(r){var e=tt,t=r.__c;typeof t=="function"&&(r.__c=void 0,t()),tt=e}function Fs(r){var e=tt;r.__c=r.__(),tt=e}function qs(r,e){return!r||r.length!==e.length||e.some(function(t,i){return t!==r[i]})}function Qo(r,e){return typeof e=="function"?e(r):e}var di,tt,Ho,Di,Zo,Xo,Yo,Go,$o,Ko,Jo,Ws=As(()=>{Jr();Di=0,Zo=[],Xo=ue.__b,Yo=ue.__r,Go=ue.diffed,$o=ue.__c,Ko=ue.unmount;ue.__b=function(r){tt=null,Xo&&Xo(r)},ue.__r=function(r){Yo&&Yo(r),di=0;var e=(tt=r.__c).__H;e&&(e.__h.forEach(tn),e.__h.forEach(Fs),e.__h=[])},ue.diffed=function(r){Go&&Go(r);var e=r.__c;e&&e.__H&&e.__H.__h.length&&(Zo.push(e)!==1&&Ho===ue.requestAnimationFrame||((Ho=ue.requestAnimationFrame)||function(t){var i,n=function(){clearTimeout(s),Jo&&cancelAnimationFrame(i),setTimeout(t)},s=setTimeout(n,100);Jo&&(i=requestAnimationFrame(n))})(Rd)),tt=null},ue.__c=function(r,e){e.some(function(t){try{t.__h.forEach(tn),t.__h=t.__h.filter(function(i){return!i.__||Fs(i)})}catch(i){e.some(function(n){n.__h&&(n.__h=[])}),e=[],ue.__e(i,t.__v)}}),$o&&$o(r,e)},ue.unmount=function(r){Ko&&Ko(r);var e,t=r.__c;t&&t.__H&&(t.__H.__.forEach(function(i){try{tn(i)}catch(n){e=n}}),e&&ue.__e(e,t.__v))};Jo=typeof requestAnimationFrame=="function"});var Sl={};ko(Sl,{Children:()=>sl,Component:()=>mt,Fragment:()=>kt,PureComponent:()=>rn,StrictMode:()=>Wd,Suspense:()=>vr,SuspenseList:()=>zi,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>_l,cloneElement:()=>bl,createContext:()=>Kr,createElement:()=>et,createFactory:()=>yl,createPortal:()=>hl,createRef:()=>Yr,default:()=>Hs,findDOMNode:()=>wl,flushSync:()=>xl,forwardRef:()=>rl,hydrate:()=>cl,isValidElement:()=>Vs,lazy:()=>ll,memo:()=>tl,render:()=>nn,unmountComponentAtNode:()=>gr,unstable_batchedUpdates:()=>El,useCallback:()=>Ms,useContext:()=>Bs,useDebugValue:()=>Us,useEffect:()=>cr,useErrorBoundary:()=>Nd,useImperativeHandle:()=>zs,useLayoutEffect:()=>en,useMemo:()=>pr,useReducer:()=>Qr,useRef:()=>dr,useState:()=>Li,version:()=>qd});function el(r,e){for(var t in e)r[t]=e[t];return r}function js(r,e){for(var t in r)if(t!=="__source"&&!(t in e))return!0;for(var i in e)if(i!=="__source"&&r[i]!==e[i])return!0;return!1}function rn(r){this.props=r}function tl(r,e){function t(n){var s=this.props.ref,a=s==n.ref;return!a&&s&&(s.call?s(null):s.current=null),e?!e(this.props,n)||!a:js(this.props,n)}function i(n){return this.shouldComponentUpdate=t,et(r,n)}return i.displayName="Memo("+(r.displayName||r.name)+")",i.prototype.isReactComponent=!0,i.__f=!0,i}function rl(r){function e(t){var i=el({},t);return delete i.ref,r(i,t.ref||null)}return e.$$typeof=Ad,e.render=e,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(r.displayName||r.name)+")",e}function vr(){this.__u=0,this.t=null,this.__b=null}function ol(r){var e=r.__.__c;return e&&e.__e&&e.__e(r)}function ll(r){var e,t,i;function n(s){if(e||(e=r()).then(function(a){t=a.default||a},function(a){i=a}),i)throw i;if(!t)throw e;return et(t,s)}return n.displayName="Lazy",n.__f=!0,n}function zi(){this.u=null,this.o=null}function Dd(r){return this.getChildContext=function(){return r.context},r.children}function Pd(r){var e=this,t=r.i;e.componentWillUnmount=function(){Ii(null,e.l),e.l=null,e.i=null},e.i&&e.i!==t&&e.componentWillUnmount(),r.__v?(e.l||(e.i=t,e.l={nodeType:1,parentNode:t,childNodes:[],appendChild:function(i){this.childNodes.push(i),e.i.appendChild(i)},insertBefore:function(i,n){this.childNodes.push(i),e.i.appendChild(i)},removeChild:function(i){this.childNodes.splice(this.childNodes.indexOf(i)>>>1,1),e.i.removeChild(i)}}),Ii(et(Dd,{context:e.context},r.__v),e.l)):e.l&&e.componentWillUnmount()}function hl(r,e){return et(Pd,{__v:r,i:e})}function nn(r,e,t){return e.__k==null&&(e.textContent=""),Ii(r,e),typeof t=="function"&&t(),r?r.__c:null}function cl(r,e,t){return Ls(r,e),typeof t=="function"&&t(),r?r.__c:null}function Bd(){}function Ud(){return this.cancelBubble}function Fd(){return this.defaultPrevented}function yl(r){return et.bind(null,r)}function Vs(r){return!!r&&r.$$typeof===fl}function bl(r){return Vs(r)?Vo.apply(null,arguments):r}function gr(r){return!!r.__k&&(Ii(null,r),!0)}function wl(r){return r&&(r.base||r.nodeType===1&&r)||null}var il,Ad,nl,sl,Id,al,ul,fl,Ld,zd,Md,dl,pl,vl,gl,ml,_l,qd,El,xl,Wd,Hs,Mi=As(()=>{Ws();Ws();Jr();Jr();(rn.prototype=new mt).isPureReactComponent=!0,rn.prototype.shouldComponentUpdate=function(r,e){return js(this.props,r)||js(this.state,e)};il=ue.__b;ue.__b=function(r){r.type&&r.type.__f&&r.ref&&(r.props.ref=r.ref,r.ref=null),il&&il(r)};Ad=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;nl=function(r,e){return r==null?null:Zt(Zt(r).map(e))},sl={map:nl,forEach:nl,count:function(r){return r?Zt(r).length:0},only:function(r){var e=Zt(r);if(e.length!==1)throw"Children.only";return e[0]},toArray:Zt},Id=ue.__e;ue.__e=function(r,e,t,i){if(r.then){for(var n,s=e;s=s.__;)if((n=s.__c)&&n.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k),n.__c(r,e)}Id(r,e,t,i)};al=ue.unmount;ue.unmount=function(r){var e=r.__c;e&&e.__R&&e.__R(),e&&r.__h===!0&&(r.type=null),al&&al(r)},(vr.prototype=new mt).__c=function(r,e){var t=e.__c,i=this;i.t==null&&(i.t=[]),i.t.push(t);var n=ol(i.__v),s=!1,a=function(){s||(s=!0,t.__R=null,n?n(o):o())};t.__R=a;var o=function(){if(!--i.__u){if(i.state.__e){var u=i.state.__e;i.__v.__k[0]=function d(c,v,g){return c&&(c.__v=null,c.__k=c.__k&&c.__k.map(function(O){return d(O,v,g)}),c.__c&&c.__c.__P===v&&(c.__e&&g.insertBefore(c.__e,c.__d),c.__c.__e=!0,c.__c.__P=g)),c}(u,u.__c.__P,u.__c.__O)}var f;for(i.setState({__e:i.__b=null});f=i.t.pop();)f.forceUpdate()}},l=e.__h===!0;i.__u++||l||i.setState({__e:i.__b=i.__v.__k[0]}),r.then(a,a)},vr.prototype.componentWillUnmount=function(){this.t=[]},vr.prototype.render=function(r,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=function s(a,o,l){return a&&(a.__c&&a.__c.__H&&(a.__c.__H.__.forEach(function(u){typeof u.__c=="function"&&u.__c()}),a.__c.__H=null),(a=el({},a)).__c!=null&&(a.__c.__P===l&&(a.__c.__P=o),a.__c=null),a.__k=a.__k&&a.__k.map(function(u){return s(u,o,l)})),a}(this.__b,t,i.__O=i.__P)}this.__b=null}var n=e.__e&&et(kt,null,r.fallback);return n&&(n.__h=null),[et(kt,null,e.__e?null:r.children),n]};ul=function(r,e,t){if(++t[1]===t[0]&&r.o.delete(e),r.props.revealOrder&&(r.props.revealOrder[0]!=="t"||!r.o.size))for(t=r.u;t;){for(;t.length>3;)t.pop()();if(t[1]{Tl.exports=(Mi(),Sl)});var Ol=$((Fy,kl)=>{"use strict";var jd="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";kl.exports=jd});var Al=$((qy,Rl)=>{"use strict";var Vd=Ol();function Cl(){}function Nl(){}Nl.resetWarningCache=Cl;Rl.exports=function(){function r(i,n,s,a,o,l){if(l!==Vd){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}r.isRequired=r;function e(){return r}var t={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:e,element:r,elementType:r,instanceOf:e,node:r,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Nl,resetWarningCache:Cl};return t.PropTypes=t,t}});var Zs=$((Vy,Il)=>{Il.exports=Al()();var Wy,jy});var Xs=$((Hy,Dl)=>{"use strict";var Hd=void 0;Dl.exports=function(r){return r!==Hd&&r!==null}});var Ll=$((Zy,Pl)=>{"use strict";var Zd=Xs(),Xd={object:!0,function:!0,undefined:!0};Pl.exports=function(r){return Zd(r)?hasOwnProperty.call(Xd,typeof r):!1}});var Ml=$((Xy,zl)=>{"use strict";var Yd=Ll();zl.exports=function(r){if(!Yd(r))return!1;try{return r.constructor?r.constructor.prototype===r:!1}catch(e){return!1}}});var Ul=$((Yy,Bl)=>{"use strict";var Gd=Ml();Bl.exports=function(r){if(typeof r!="function"||!hasOwnProperty.call(r,"length"))return!1;try{if(typeof r.length!="number"||typeof r.call!="function"||typeof r.apply!="function")return!1}catch(e){return!1}return!Gd(r)}});var ql=$((Gy,Fl)=>{"use strict";var $d=Ul(),Kd=/^\s*class[\s{/}]/,Jd=Function.prototype.toString;Fl.exports=function(r){return!(!$d(r)||Kd.test(Jd.call(r)))}});var jl=$(($y,Wl)=>{"use strict";Wl.exports=function(){var r=Object.assign,e;return typeof r!="function"?!1:(e={foo:"raz"},r(e,{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}});var Hl=$((Ky,Vl)=>{"use strict";Vl.exports=function(){try{return Object.keys("primitive"),!0}catch(r){return!1}}});var Xl=$((Jy,Zl)=>{"use strict";Zl.exports=function(){}});var an=$((Qy,Yl)=>{"use strict";var Qd=Xl()();Yl.exports=function(r){return r!==Qd&&r!==null}});var $l=$((e0,Gl)=>{"use strict";var ep=an(),tp=Object.keys;Gl.exports=function(r){return tp(ep(r)?Object(r):r)}});var Jl=$((t0,Kl)=>{"use strict";Kl.exports=Hl()()?Object.keys:$l()});var eu=$((i0,Ql)=>{"use strict";var ip=an();Ql.exports=function(r){if(!ip(r))throw new TypeError("Cannot use null or undefined");return r}});var iu=$((r0,tu)=>{"use strict";var rp=Jl(),np=eu(),sp=Math.max;tu.exports=function(r,e){var t,i,n=sp(arguments.length,2),s;for(r=Object(np(r)),s=function(a){try{r[a]=e[a]}catch(o){t||(t=o)}},i=1;i{"use strict";ru.exports=jl()()?Object.assign:iu()});var au=$((s0,su)=>{"use strict";var ap=an(),op=Array.prototype.forEach,lp=Object.create,up=function(r,e){var t;for(t in r)e[t]=r[t]};su.exports=function(r){var e=lp(null);return op.call(arguments,function(t){!ap(t)||up(Object(t),e)}),e}});var lu=$((a0,ou)=>{"use strict";var Ys="razdwatrzy";ou.exports=function(){return typeof Ys.contains!="function"?!1:Ys.contains("dwa")===!0&&Ys.contains("foo")===!1}});var hu=$((o0,uu)=>{"use strict";var hp=String.prototype.indexOf;uu.exports=function(r){return hp.call(this,r,arguments[1])>-1}});var cu=$((l0,fu)=>{"use strict";fu.exports=lu()()?String.prototype.contains:hu()});var mu=$((u0,gu)=>{"use strict";var on=Xs(),du=ql(),pu=nu(),vu=au(),mr=cu(),fp=gu.exports=function(r,e){var t,i,n,s,a;return arguments.length<2||typeof r!="string"?(s=e,e=r,r=null):s=arguments[2],on(r)?(t=mr.call(r,"c"),i=mr.call(r,"e"),n=mr.call(r,"w")):(t=n=!0,i=!1),a={value:e,configurable:t,enumerable:i,writable:n},s?pu(vu(s),a):a};fp.gs=function(r,e,t){var i,n,s,a;return typeof r!="string"?(s=t,t=e,e=r,r=null):s=arguments[3],on(e)?du(e)?on(t)?du(t)||(s=t,t=void 0):t=void 0:(s=e,e=t=void 0):e=void 0,on(r)?(i=mr.call(r,"c"),n=mr.call(r,"e")):(i=!0,n=!1),a={get:e,set:t,configurable:i,enumerable:n},s?pu(vu(s),a):a}});var yu=$((h0,_u)=>{"use strict";_u.exports=function(r){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}});var Ft=$((ra,Su)=>{"use strict";var ln=mu(),Gs=yu(),$s=Function.prototype.apply,Ks=Function.prototype.call,bu=Object.create,cp=Object.defineProperty,wu=Object.defineProperties,Js=Object.prototype.hasOwnProperty,Qs={configurable:!0,enumerable:!1,writable:!0},un,ea,hn,ta,Eu,ia,xu;un=function(r,e){var t;return Gs(e),Js.call(this,"__ee__")?t=this.__ee__:(t=Qs.value=bu(null),cp(this,"__ee__",Qs),Qs.value=null),t[r]?typeof t[r]=="object"?t[r].push(e):t[r]=[t[r],e]:t[r]=e,this};ea=function(r,e){var t,i;return Gs(e),i=this,un.call(this,r,t=function(){hn.call(i,r,t),$s.call(e,this,arguments)}),t.__eeOnceListener__=e,this};hn=function(r,e){var t,i,n,s;if(Gs(e),!Js.call(this,"__ee__"))return this;if(t=this.__ee__,!t[r])return this;if(i=t[r],typeof i=="object")for(s=0;n=i[s];++s)(n===e||n.__eeOnceListener__===e)&&(i.length===2?t[r]=i[s?0:1]:i.splice(s,1));else(i===e||i.__eeOnceListener__===e)&&delete t[r];return this};ta=function(r){var e,t,i,n,s;if(!!Js.call(this,"__ee__")&&(n=this.__ee__[r],!!n))if(typeof n=="object"){for(t=arguments.length,s=new Array(t-1),e=1;e{"use strict";function na(r,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(r):r}var Tu=na({HTML:"text/html",isHTML:function(r){return r===Tu.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),ku=na({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(r){return r===ku.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});fn.freeze=na;fn.MIME_TYPE=Tu;fn.NAMESPACE=ku});var pa=$(si=>{var dp=_r(),yr=dp.NAMESPACE;function pp(r){return r!==""}function vp(r){return r?r.split(/[\t\n\f\r ]+/).filter(pp):[]}function gp(r,e){return r.hasOwnProperty(e)||(r[e]=!0),r}function Ou(r){if(!r)return[];var e=vp(r);return Object.keys(e.reduce(gp,{}))}function mp(r){return function(e){return r&&r.indexOf(e)!==-1}}function br(r,e){for(var t in r)e[t]=r[t]}function vt(r,e){var t=r.prototype;if(!(t instanceof e)){let n=function(){};var i=n;n.prototype=e.prototype,n=new n,br(t,n),r.prototype=t=n}t.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),t.constructor=r)}var gt={},qt=gt.ELEMENT_NODE=1,Bi=gt.ATTRIBUTE_NODE=2,cn=gt.TEXT_NODE=3,Cu=gt.CDATA_SECTION_NODE=4,Nu=gt.ENTITY_REFERENCE_NODE=5,_p=gt.ENTITY_NODE=6,Ru=gt.PROCESSING_INSTRUCTION_NODE=7,Au=gt.COMMENT_NODE=8,Iu=gt.DOCUMENT_NODE=9,Du=gt.DOCUMENT_TYPE_NODE=10,Qt=gt.DOCUMENT_FRAGMENT_NODE=11,yp=gt.NOTATION_NODE=12,st={},Je={},c0=st.INDEX_SIZE_ERR=(Je[1]="Index size error",1),d0=st.DOMSTRING_SIZE_ERR=(Je[2]="DOMString size error",2),bp=st.HIERARCHY_REQUEST_ERR=(Je[3]="Hierarchy request error",3),p0=st.WRONG_DOCUMENT_ERR=(Je[4]="Wrong document",4),v0=st.INVALID_CHARACTER_ERR=(Je[5]="Invalid character",5),g0=st.NO_DATA_ALLOWED_ERR=(Je[6]="No data allowed",6),m0=st.NO_MODIFICATION_ALLOWED_ERR=(Je[7]="No modification allowed",7),wp=st.NOT_FOUND_ERR=(Je[8]="Not found",8),_0=st.NOT_SUPPORTED_ERR=(Je[9]="Not supported",9),Pu=st.INUSE_ATTRIBUTE_ERR=(Je[10]="Attribute in use",10),y0=st.INVALID_STATE_ERR=(Je[11]="Invalid state",11),b0=st.SYNTAX_ERR=(Je[12]="Syntax error",12),w0=st.INVALID_MODIFICATION_ERR=(Je[13]="Invalid modification",13),E0=st.NAMESPACE_ERR=(Je[14]="Invalid namespace",14),x0=st.INVALID_ACCESS_ERR=(Je[15]="Invalid access",15);function pi(r,e){if(e instanceof Error)var t=e;else t=this,Error.call(this,Je[r]),this.message=Je[r],Error.captureStackTrace&&Error.captureStackTrace(this,pi);return t.code=r,e&&(this.message=this.message+": "+e),t}pi.prototype=Error.prototype;br(st,pi);function ei(){}ei.prototype={length:0,item:function(r){return this[r]||null},toString:function(r,e){for(var t=[],i=0;i=0){for(var n=e.length-1;i0},lookupPrefix:function(r){for(var e=this;e;){var t=e._nsMap;if(t){for(var i in t)if(t[i]==r)return i}e=e.nodeType==Bi?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(r){for(var e=this;e;){var t=e._nsMap;if(t&&r in t)return t[r];e=e.nodeType==Bi?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(r){var e=this.lookupPrefix(r);return e==null}};function Uu(r){return r=="<"&&"<"||r==">"&&">"||r=="&"&&"&"||r=='"'&&"""||"&#"+r.charCodeAt()+";"}br(gt,at);br(gt,at.prototype);function wr(r,e){if(e(r))return!0;if(r=r.firstChild)do if(wr(r,e))return!0;while(r=r.nextSibling)}function Er(){}function Ep(r,e,t){r&&r._inc++;var i=t.namespaceURI;i===yr.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function Fu(r,e,t,i){r&&r._inc++;var n=t.namespaceURI;n===yr.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function aa(r,e,t){if(r&&r._inc){r._inc++;var i=e.childNodes;if(t)i[i.length++]=t;else{for(var n=e.firstChild,s=0;n;)i[s++]=n,n=n.nextSibling;i.length=s}}}function qu(r,e){var t=e.previousSibling,i=e.nextSibling;return t?t.nextSibling=i:r.firstChild=i,i?i.previousSibling=t:r.lastChild=t,aa(r.ownerDocument,r),e}function Wu(r,e,t){var i=e.parentNode;if(i&&i.removeChild(e),e.nodeType===Qt){var n=e.firstChild;if(n==null)return e;var s=e.lastChild}else n=s=e;var a=t?t.previousSibling:r.lastChild;n.previousSibling=a,s.nextSibling=t,a?a.nextSibling=n:r.firstChild=n,t==null?r.lastChild=s:t.previousSibling=s;do n.parentNode=r;while(n!==s&&(n=n.nextSibling));return aa(r.ownerDocument||r,r),e.nodeType==Qt&&(e.firstChild=e.lastChild=null),e}function xp(r,e){var t=e.parentNode;if(t){var i=r.lastChild;t.removeChild(e);var i=r.lastChild}var i=r.lastChild;return e.parentNode=r,e.previousSibling=i,e.nextSibling=null,i?i.nextSibling=e:r.firstChild=e,r.lastChild=e,aa(r.ownerDocument,r,e),e}Er.prototype={nodeName:"#document",nodeType:Iu,doctype:null,documentElement:null,_inc:1,insertBefore:function(r,e){if(r.nodeType==Qt){for(var t=r.firstChild;t;){var i=t.nextSibling;this.insertBefore(t,e),t=i}return r}return this.documentElement==null&&r.nodeType==qt&&(this.documentElement=r),Wu(this,r,e),r.ownerDocument=this,r},removeChild:function(r){return this.documentElement==r&&(this.documentElement=null),qu(this,r)},importNode:function(r,e){return Yu(this,r,e)},getElementById:function(r){var e=null;return wr(this.documentElement,function(t){if(t.nodeType==qt&&t.getAttribute("id")==r)return e=t,!0}),e},getElementsByClassName:function(r){var e=Ou(r);return new Ui(this,function(t){var i=[];return e.length>0&&wr(t.documentElement,function(n){if(n!==t&&n.nodeType===qt){var s=n.getAttribute("class");if(s){var a=r===s;if(!a){var o=Ou(s);a=e.every(mp(o))}a&&i.push(n)}}}),i})},createElement:function(r){var e=new vi;e.ownerDocument=this,e.nodeName=r,e.tagName=r,e.localName=r,e.childNodes=new ei;var t=e.attributes=new dn;return t._ownerElement=e,e},createDocumentFragment:function(){var r=new gn;return r.ownerDocument=this,r.childNodes=new ei,r},createTextNode:function(r){var e=new oa;return e.ownerDocument=this,e.appendData(r),e},createComment:function(r){var e=new la;return e.ownerDocument=this,e.appendData(r),e},createCDATASection:function(r){var e=new ua;return e.ownerDocument=this,e.appendData(r),e},createProcessingInstruction:function(r,e){var t=new fa;return t.ownerDocument=this,t.tagName=t.target=r,t.nodeValue=t.data=e,t},createAttribute:function(r){var e=new pn;return e.ownerDocument=this,e.name=r,e.nodeName=r,e.localName=r,e.specified=!0,e},createEntityReference:function(r){var e=new ha;return e.ownerDocument=this,e.nodeName=r,e},createElementNS:function(r,e){var t=new vi,i=e.split(":"),n=t.attributes=new dn;return t.childNodes=new ei,t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.namespaceURI=r,i.length==2?(t.prefix=i[0],t.localName=i[1]):t.localName=e,n._ownerElement=t,t},createAttributeNS:function(r,e){var t=new pn,i=e.split(":");return t.ownerDocument=this,t.nodeName=e,t.name=e,t.namespaceURI=r,t.specified=!0,i.length==2?(t.prefix=i[0],t.localName=i[1]):t.localName=e,t}};vt(Er,at);function vi(){this._nsMap={}}vi.prototype={nodeType:qt,hasAttribute:function(r){return this.getAttributeNode(r)!=null},getAttribute:function(r){var e=this.getAttributeNode(r);return e&&e.value||""},getAttributeNode:function(r){return this.attributes.getNamedItem(r)},setAttribute:function(r,e){var t=this.ownerDocument.createAttribute(r);t.value=t.nodeValue=""+e,this.setAttributeNode(t)},removeAttribute:function(r){var e=this.getAttributeNode(r);e&&this.removeAttributeNode(e)},appendChild:function(r){return r.nodeType===Qt?this.insertBefore(r,null):xp(this,r)},setAttributeNode:function(r){return this.attributes.setNamedItem(r)},setAttributeNodeNS:function(r){return this.attributes.setNamedItemNS(r)},removeAttributeNode:function(r){return this.attributes.removeNamedItem(r.nodeName)},removeAttributeNS:function(r,e){var t=this.getAttributeNodeNS(r,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(r,e){return this.getAttributeNodeNS(r,e)!=null},getAttributeNS:function(r,e){var t=this.getAttributeNodeNS(r,e);return t&&t.value||""},setAttributeNS:function(r,e,t){var i=this.ownerDocument.createAttributeNS(r,e);i.value=i.nodeValue=""+t,this.setAttributeNode(i)},getAttributeNodeNS:function(r,e){return this.attributes.getNamedItemNS(r,e)},getElementsByTagName:function(r){return new Ui(this,function(e){var t=[];return wr(e,function(i){i!==e&&i.nodeType==qt&&(r==="*"||i.tagName==r)&&t.push(i)}),t})},getElementsByTagNameNS:function(r,e){return new Ui(this,function(t){var i=[];return wr(t,function(n){n!==t&&n.nodeType===qt&&(r==="*"||n.namespaceURI===r)&&(e==="*"||n.localName==e)&&i.push(n)}),i})}};Er.prototype.getElementsByTagName=vi.prototype.getElementsByTagName;Er.prototype.getElementsByTagNameNS=vi.prototype.getElementsByTagNameNS;vt(vi,at);function pn(){}pn.prototype.nodeType=Bi;vt(pn,at);function xr(){}xr.prototype={data:"",substringData:function(r,e){return this.data.substring(r,r+e)},appendData:function(r){r=this.data+r,this.nodeValue=this.data=r,this.length=r.length},insertData:function(r,e){this.replaceData(r,0,e)},appendChild:function(r){throw new Error(Je[bp])},deleteData:function(r,e){this.replaceData(r,e,"")},replaceData:function(r,e,t){var i=this.data.substring(0,r),n=this.data.substring(r+e);t=i+t+n,this.nodeValue=this.data=t,this.length=t.length}};vt(xr,at);function oa(){}oa.prototype={nodeName:"#text",nodeType:cn,splitText:function(r){var e=this.data,t=e.substring(r);e=e.substring(0,r),this.data=this.nodeValue=e,this.length=e.length;var i=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}};vt(oa,xr);function la(){}la.prototype={nodeName:"#comment",nodeType:Au};vt(la,xr);function ua(){}ua.prototype={nodeName:"#cdata-section",nodeType:Cu};vt(ua,xr);function vn(){}vn.prototype.nodeType=Du;vt(vn,at);function ju(){}ju.prototype.nodeType=yp;vt(ju,at);function Vu(){}Vu.prototype.nodeType=_p;vt(Vu,at);function ha(){}ha.prototype.nodeType=Nu;vt(ha,at);function gn(){}gn.prototype.nodeName="#document-fragment";gn.prototype.nodeType=Qt;vt(gn,at);function fa(){}fa.prototype.nodeType=Ru;vt(fa,at);function Hu(){}Hu.prototype.serializeToString=function(r,e,t){return Zu.call(r,e,t)};at.prototype.toString=Zu;function Zu(r,e){var t=[],i=this.nodeType==9&&this.documentElement||this,n=i.prefix,s=i.namespaceURI;if(s&&n==null){var n=i.lookupPrefix(s);if(n==null)var a=[{namespace:s,prefix:null}]}return Fi(this,t,r,e,a),t.join("")}function Xu(r,e,t){var i=r.prefix||"",n=r.namespaceURI;if(!n||i==="xml"&&n===yr.XML||n===yr.XMLNS)return!1;for(var s=t.length;s--;){var a=t[s];if(a.prefix===i)return a.namespace!==n}return!0}function ca(r,e,t){r.push(" ",e,'="',t.replace(/[<&"]/g,Uu),'"')}function Fi(r,e,t,i,n){if(n||(n=[]),i)if(r=i(r),r){if(typeof r=="string"){e.push(r);return}}else return;switch(r.nodeType){case qt:var s=r.attributes,a=s.length,o=r.firstChild,l=r.tagName;t=yr.isHTML(r.namespaceURI)||t;var u=l;if(!t&&!r.prefix&&r.namespaceURI){for(var f,d=0;d=0;c--){var v=n[c];if(v.prefix===""&&v.namespace===r.namespaceURI){f=v.namespace;break}}if(f!==r.namespaceURI)for(var c=n.length-1;c>=0;c--){var v=n[c];if(v.namespace===r.namespaceURI){v.prefix&&(u=v.prefix+":"+l);break}}}e.push("<",u);for(var g=0;g"),t&&/^script$/i.test(l))for(;o;)o.data?e.push(o.data):Fi(o,e,t,i,n.slice()),o=o.nextSibling;else for(;o;)Fi(o,e,t,i,n.slice()),o=o.nextSibling;e.push("")}else e.push("/>");return;case Iu:case Qt:for(var o=r.firstChild;o;)Fi(o,e,t,i,n.slice()),o=o.nextSibling;return;case Bi:return ca(e,r.name,r.value);case cn:return e.push(r.data.replace(/[<&]/g,Uu).replace(/]]>/g,"]]>"));case Cu:return e.push("");case Au:return e.push("");case Du:var p=r.publicId,y=r.systemId;if(e.push("");else if(y&&y!=".")e.push(" SYSTEM ",y,">");else{var T=r.internalSubset;T&&e.push(" [",T,"]"),e.push(">")}return;case Ru:return e.push("");case Nu:return e.push("&",r.nodeName,";");default:e.push("??",r.nodeName)}}function Yu(r,e,t){var i;switch(e.nodeType){case qt:i=e.cloneNode(!1),i.ownerDocument=r;case Qt:break;case Bi:t=!0;break}if(i||(i=e.cloneNode(!1)),i.ownerDocument=r,i.parentNode=null,t)for(var n=e.firstChild;n;)i.appendChild(Yu(r,n,t)),n=n.nextSibling;return i}function da(r,e,t){var i=new e.constructor;for(var n in e){var s=e[n];typeof s!="object"&&s!=i[n]&&(i[n]=s)}switch(e.childNodes&&(i.childNodes=new ei),i.ownerDocument=r,i.nodeType){case qt:var a=e.attributes,o=i.attributes=new dn,l=a.length;o._ownerElement=i;for(var u=0;u{var $u=_r().freeze;Sr.XML_ENTITIES=$u({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});Sr.HTML_ENTITIES=$u({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",times:"\xD7",divide:"\xF7",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",euro:"\u20AC",trade:"\u2122",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"});Sr.entityMap=Sr.HTML_ENTITIES});var sh=$(ga=>{var Tr=_r().NAMESPACE,va=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Ju=new RegExp("[\\-\\.0-9"+va.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Qu=new RegExp("^"+va.source+Ju.source+"*(?::"+va.source+Ju.source+"*)?$"),kr=0,ai=1,qi=2,Or=3,Wi=4,ji=5,Cr=6,mn=7;function Vi(r,e){this.message=r,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Vi)}Vi.prototype=new Error;Vi.prototype.name=Vi.name;function eh(){}eh.prototype={parse:function(r,e,t){var i=this.domBuilder;i.startDocument(),rh(e,e={}),Sp(r,e,t,i,this.errorHandler),i.endDocument()}};function Sp(r,e,t,i,n){function s(ie){if(ie>65535){ie-=65536;var de=55296+(ie>>10),fe=56320+(ie&1023);return String.fromCharCode(de,fe)}else return String.fromCharCode(ie)}function a(ie){var de=ie.slice(1,-1);return de in t?t[de]:de.charAt(0)==="#"?s(parseInt(de.substr(1).replace("x","0x"))):(n.error("entity not found:"+ie),ie)}function o(ie){if(ie>O){var de=r.substring(O,ie).replace(/&#?\w+;/g,a);c&&l(O),i.characters(de,0,ie-O),O=ie}}function l(ie,de){for(;ie>=f&&(de=d.exec(r));)u=de.index,f=u+de[0].length,c.lineNumber++;c.columnNumber=ie-u+1}for(var u=0,f=0,d=/.*(?:\r\n?|\n)|.*$/g,c=i.locator,v=[{currentNSMap:e}],g={},O=0;;){try{var k=r.indexOf("<",O);if(k<0){if(!r.substr(O).match(/^\s*$/)){var _=i.doc,p=_.createTextNode(r.substr(O));_.appendChild(p),i.currentElement=p}return}switch(k>O&&o(k),r.charAt(k+1)){case"/":var y=r.indexOf(">",k+3),T=r.substring(k+2,y).replace(/[ \t\n\r]+$/g,""),P=v.pop();y<0?(T=r.substring(k+2).replace(/[\s<].*/,""),n.error("end tag name: "+T+" is not complete:"+P.tagName),y=k+1+T.length):T.match(/\sO?O=y:o(Math.max(k,O)+1)}}function th(r,e){return e.lineNumber=r.lineNumber,e.columnNumber=r.columnNumber,e}function Tp(r,e,t,i,n,s){function a(v,g,O){t.attributeNames.hasOwnProperty(v)&&s.fatalError("Attribute "+v+" redefined"),t.addValue(v,g,O)}for(var o,l,u=++e,f=kr;;){var d=r.charAt(u);switch(d){case"=":if(f===ai)o=r.slice(e,u),f=Or;else if(f===qi)f=Or;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(f===Or||f===ai)if(f===ai&&(s.warning('attribute value must after "="'),o=r.slice(e,u)),e=u+1,u=r.indexOf(d,e),u>0)l=r.slice(e,u).replace(/&#?\w+;/g,n),a(o,l,e-1),f=ji;else throw new Error("attribute value no end '"+d+"' match");else if(f==Wi)l=r.slice(e,u).replace(/&#?\w+;/g,n),a(o,l,e),s.warning('attribute "'+o+'" missed start quot('+d+")!!"),e=u+1,f=ji;else throw new Error('attribute value must after "="');break;case"/":switch(f){case kr:t.setTagName(r.slice(e,u));case ji:case Cr:case mn:f=mn,t.closed=!0;case Wi:case ai:case qi:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),f==kr&&t.setTagName(r.slice(e,u)),u;case">":switch(f){case kr:t.setTagName(r.slice(e,u));case ji:case Cr:case mn:break;case Wi:case ai:l=r.slice(e,u),l.slice(-1)==="/"&&(t.closed=!0,l=l.slice(0,-1));case qi:f===qi&&(l=o),f==Wi?(s.warning('attribute "'+l+'" missed quot(")!'),a(o,l.replace(/&#?\w+;/g,n),e)):((!Tr.isHTML(i[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),a(l,l,e));break;case Or:throw new Error("attribute value missed!!")}return u;case"\x80":d=" ";default:if(d<=" ")switch(f){case kr:t.setTagName(r.slice(e,u)),f=Cr;break;case ai:o=r.slice(e,u),f=qi;break;case Wi:var l=r.slice(e,u).replace(/&#?\w+;/g,n);s.warning('attribute "'+l+'" missed quot(")!!'),a(o,l,e);case ji:f=Cr;break}else switch(f){case qi:var c=t.tagName;(!Tr.isHTML(i[""])||!o.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=u,f=ai;break;case ji:s.warning('attribute space is required"'+o+'"!!');case Cr:f=ai,e=u;break;case Or:f=Wi,e=u;break;case mn:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function ih(r,e,t){for(var i=r.tagName,n=null,s=r.length;s--;){var a=r[s],o=a.qName,l=a.value,c=o.indexOf(":");if(c>0)var u=a.prefix=o.slice(0,c),f=o.slice(c+1),d=u==="xmlns"&&f;else f=o,u=null,d=o==="xmlns"&&"";a.localName=f,d!==!1&&(n==null&&(n={},rh(t,t={})),t[d]=n[d]=l,a.uri=Tr.XMLNS,e.startPrefixMapping(d,l))}for(var s=r.length;s--;){a=r[s];var u=a.prefix;u&&(u==="xml"&&(a.uri=Tr.XML),u!=="xmlns"&&(a.uri=t[u||""]))}var c=i.indexOf(":");c>0?(u=r.prefix=i.slice(0,c),f=r.localName=i.slice(c+1)):(u=null,f=r.localName=i);var v=r.uri=t[u||""];if(e.startElement(v,f,i,r),r.closed){if(e.endElement(v,f,i),n)for(u in n)e.endPrefixMapping(u)}else return r.currentNSMap=t,r.localNSMap=n,!0}function kp(r,e,t,i,n){if(/^(?:script|textarea)$/i.test(t)){var s=r.indexOf("",e),a=r.substring(e+1,s);if(/[&<]/.test(a))return/^script$/i.test(t)?(n.characters(a,0,a.length),s):(a=a.replace(/&#?\w+;/g,i),n.characters(a,0,a.length),s)}return e+1}function Op(r,e,t,i){var n=i[t];return n==null&&(n=r.lastIndexOf(""),n",e+4);return s>e?(t.comment(r,e+4,s-e-4),s+3):(i.error("Unclosed comment"),-1)}else return-1;default:if(r.substr(e+3,6)=="CDATA["){var s=r.indexOf("]]>",e+9);return t.startCDATA(),t.characters(r,e+9,s-e-9),t.endCDATA(),s+3}var a=Rp(r,e),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var l=a[1][0],u=!1,f=!1;o>3&&(/^public$/i.test(a[2][0])?(u=a[3][0],f=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(f=a[3][0]));var d=a[o-1];return t.startDTD(l,u,f),t.endDTD(),d.index+d[0].length}}return-1}function Np(r,e,t){var i=r.indexOf("?>",e);if(i){var n=r.substring(e,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(n){var s=n[0].length;return t.processingInstruction(n[1],n[2]),i+2}else return-1}return-1}function nh(){this.attributeNames={}}nh.prototype={setTagName:function(r){if(!Qu.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,e,t){if(!Qu.test(r))throw new Error("invalid attribute:"+r);this.attributeNames[r]=this.length,this[this.length++]={qName:r,value:e,offset:t}},length:0,getLocalName:function(r){return this[r].localName},getLocator:function(r){return this[r].locator},getQName:function(r){return this[r].qName},getURI:function(r){return this[r].uri},getValue:function(r){return this[r].value}};function Rp(r,e){var t,i=[],n=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(n.lastIndex=e,n.exec(r);t=n.exec(r);)if(i.push(t),t[1])return i}ga.XMLReader=eh;ga.ParseError=Vi});var fh=$(Rr=>{var Ap=_r(),ma=pa(),ah=Ku(),oh=sh(),Ip=ma.DOMImplementation,lh=Ap.NAMESPACE,Dp=oh.ParseError,Pp=oh.XMLReader;function uh(r){this.options=r||{locator:{}}}uh.prototype.parseFromString=function(r,e){var t=this.options,i=new Pp,n=t.domBuilder||new Nr,s=t.errorHandler,a=t.locator,o=t.xmlns||{},l=/\/x?html?$/.test(e),u=l?ah.HTML_ENTITIES:ah.XML_ENTITIES;return a&&n.setDocumentLocator(a),i.errorHandler=Lp(s,n,a),i.domBuilder=t.domBuilder||n,l&&(o[""]=lh.HTML),o.xml=o.xml||lh.XML,r&&typeof r=="string"?i.parse(r,o,u):i.errorHandler.error("invalid doc source"),n.doc};function Lp(r,e,t){if(!r){if(e instanceof Nr)return e;r=e}var i={},n=r instanceof Function;t=t||{};function s(a){var o=r[a];!o&&n&&(o=r.length==2?function(l){r(a,l)}:r),i[a]=o&&function(l){o("[xmldom "+a+"] "+l+_a(t))}||function(){}}return s("warning"),s("error"),s("fatalError"),i}function Nr(){this.cdata=!1}function Hi(r,e){e.lineNumber=r.lineNumber,e.columnNumber=r.columnNumber}Nr.prototype={startDocument:function(){this.doc=new Ip().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(r,e,t,i){var n=this.doc,s=n.createElementNS(r,t||e),a=i.length;_n(this,s),this.currentElement=s,this.locator&&Hi(this.locator,s);for(var o=0;o=e+t||e?new java.lang.String(r,e,t)+"":r}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){Nr.prototype[r]=function(){return null}});function _n(r,e){r.currentElement?r.currentElement.appendChild(e):r.doc.appendChild(e)}Rr.__DOMHandler=Nr;Rr.DOMParser=uh;Rr.DOMImplementation=ma.DOMImplementation;Rr.XMLSerializer=ma.XMLSerializer});var ya=$(yn=>{var ch=pa();yn.DOMImplementation=ch.DOMImplementation;yn.XMLSerializer=ch.XMLSerializer;yn.DOMParser=fh().DOMParser});var Ie=$(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.RangeObject=void 0;ve.blob2base64=lv;ve.borders=Yp;ve.bounds=Xp;ve.createBase64Url=iv;ve.createBlob=gh;ve.createBlobUrl=ev;ve.defaults=Vp;ve.defer=uv;ve.documentHeight=Fp;ve.extend=Hp;ve.filterChildren=cv;ve.findChildren=fv;ve.getParentByTagName=dv;ve.indexOfElementNode=Jp;ve.indexOfNode=wa;ve.indexOfSorted=ba;ve.indexOfTextNode=Kp;ve.insert=Zp;ve.isElement=qp;ve.isFloat=Wp;ve.isNumber=vh;ve.isXml=Qp;ve.locationOf=bn;ve.nodeBounds=Gp;ve.parents=xa;ve.parse=nv;ve.prefixed=jp;ve.qs=sv;ve.qsa=mh;ve.qsp=av;ve.querySelectorByType=hv;ve.requestAnimationFrame=void 0;ve.revokeBlobUrl=tv;ve.sprint=ov;ve.treeWalker=_h;ve.type=rv;ve.uuid=ph;ve.walk=Ea;ve.windowBounds=$p;var zp=ya(),Mp=typeof window!="undefined"?window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame:!1;ve.requestAnimationFrame=Mp;var Bp=1,Up=3,dh=typeof URL!="undefined"?URL:typeof window!="undefined"?window.URL||window.webkitURL||window.mozURL:void 0;function ph(){var r=new Date().getTime(),e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var i=(r+Math.random()*16)%16|0;return r=Math.floor(r/16),(t=="x"?i:i&7|8).toString(16)});return e}function Fp(){return Math.max(document.documentElement.clientHeight,document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight)}function qp(r){return!!(r&&r.nodeType==1)}function vh(r){return!isNaN(parseFloat(r))&&isFinite(r)}function Wp(r){let e=parseFloat(r);return vh(r)===!1?!1:typeof r=="string"&&r.indexOf(".")>-1?!0:Math.floor(e)!==e}function jp(r){var e=["Webkit","webkit","Moz","O","ms"],t=["-webkit-","-webkit-","-moz-","-o-","-ms-"],i=r.toLowerCase(),n=e.length;if(typeof document=="undefined"||typeof document.body.style[i]!="undefined")return r;for(var s=0;sf)return 1;if(u=0?o:o+1:l===0?o:l===-1?bn(r,e,t,o,a):bn(r,e,t,s,o))}function ba(r,e,t,i,n){var s=i||0,a=n||e.length,o=parseInt(s+(a-s)/2),l;return t||(t=function(u,f){if(u>f)return 1;if(u-1}function gh(r,e){return new Blob([r],{type:e})}function ev(r,e){var t,i=gh(r,e);return t=dh.createObjectURL(i),t}function tv(r){return dh.revokeObjectURL(r)}function iv(r,e){var t,i;if(typeof r=="string")return t=btoa(r),i="data:"+e+";base64,"+t,i}function rv(r){return Object.prototype.toString.call(r).slice(8,-1)}function nv(r,e,t){var i,n;return typeof DOMParser=="undefined"||t?n=zp.DOMParser:n=DOMParser,r.charCodeAt(0)===65279&&(r=r.slice(1)),i=new n().parseFromString(r,e),i}function sv(r,e){var t;if(!r)throw new Error("No Element Provided");if(typeof r.querySelector!="undefined")return r.querySelector(e);if(t=r.getElementsByTagName(e),t.length)return t[0]}function mh(r,e){return typeof r.querySelector!="undefined"?r.querySelectorAll(e):r.getElementsByTagName(e)}function av(r,e,t){var i,n;if(typeof r.querySelector!="undefined"){e+="[";for(var s in t)e+=s+"~='"+t[s]+"'";return e+="]",r.querySelector(e)}else if(i=r.getElementsByTagName(e),n=Array.prototype.slice.call(i,0).filter(function(a){for(var o in t)if(a.getAttribute(o)===t[o])return!0;return!1}),n)return n[0]}function ov(r,e){var t=r.ownerDocument||r;typeof t.createTreeWalker!="undefined"?_h(r,e,NodeFilter.SHOW_TEXT):Ea(r,function(i){i&&i.nodeType===3&&e(i)},!0)}function _h(r,e,t){var i=document.createTreeWalker(r,t,null,!1);let n;for(;n=i.nextNode();)e(n)}function Ea(r,e){if(e(r))return!0;if(r=r.firstChild,r)do{if(Ea(r,e))return!0;r=r.nextSibling}while(r)}function lv(r){return new Promise(function(e,t){var i=new FileReader;i.readAsDataURL(r),i.onloadend=function(){e(i.result)}})}function uv(){this.resolve=null,this.reject=null,this.id=ph(),this.promise=new Promise((r,e)=>{this.resolve=r,this.reject=e}),Object.freeze(this)}function hv(r,e,t){var i;if(typeof r.querySelector!="undefined"&&(i=r.querySelector(`${e}[*|type="${t}"]`)),!i||i.length===0){i=mh(r,e);for(var n=0;n{"use strict";Sa||(Sa={cwd:function(){return"/"}});var Sa;function Xt(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+r)}function bh(r,e){for(var t="",i=-1,n=0,s,a=0;a<=r.length;++a){if(a2){for(var o=t.length-1,l=o;l>=0&&t.charCodeAt(l)!==47;--l);if(l!==o){l===-1?t="":t=t.slice(0,l),i=a,n=0;continue}}else if(t.length===2||t.length===1){t="",i=a,n=0;continue}}e&&(t.length>0?t+="/..":t="..")}else t.length>0?t+="/"+r.slice(i+1,a):t=r.slice(i+1,a);i=a,n=0}else s===46&&n!==-1?++n:n=-1}return t}function pv(r,e){var t=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+i:t+r+i:i}var wn={resolve:function(){for(var e="",t=!1,i,n=arguments.length-1;n>=-1&&!t;n--){var s;n>=0?s=arguments[n]:(i===void 0&&(i=Sa.cwd()),s=i),Xt(s),s.length!==0&&(e=s+"/"+e,t=s.charCodeAt(0)===47)}return e=bh(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(Xt(e),e.length===0)return".";var t=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=bh(e,!t),e.length===0&&!t&&(e="."),e.length>0&&i&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return Xt(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":wn.normalize(e)},relative:function(e,t){if(Xt(e),Xt(t),e===t||(e=wn.resolve(e),t=wn.resolve(t),e===t))return"";for(var i=1;iu){if(t.charCodeAt(a+d)===47)return t.slice(a+d+1);if(d===0)return t.slice(a+d)}else s>u&&(e.charCodeAt(i+d)===47?f=d:d===0&&(f=0));break}var c=e.charCodeAt(i+d),v=t.charCodeAt(a+d);if(c!==v)break;c===47&&(f=d)}var g="";for(d=i+f+1;d<=n;++d)(d===n||e.charCodeAt(d)===47)&&(g.length===0?g+="..":g+="/..");return g.length>0?g+t.slice(a+f):(a+=f,t.charCodeAt(a)===47&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(Xt(e),e.length===0)return".";for(var t=e.charCodeAt(0),i=t===47,n=-1,s=!0,a=e.length-1;a>=1;--a)if(t=e.charCodeAt(a),t===47){if(!s){n=a;break}}else s=!1;return n===-1?i?"/":".":i&&n===1?"//":e.slice(0,n)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Xt(e);var i=0,n=-1,s=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var o=t.length-1,l=-1;for(a=e.length-1;a>=0;--a){var u=e.charCodeAt(a);if(u===47){if(!s){i=a+1;break}}else l===-1&&(s=!1,l=a+1),o>=0&&(u===t.charCodeAt(o)?--o==-1&&(n=a):(o=-1,n=l))}return i===n?n=l:n===-1&&(n=e.length),e.slice(i,n)}else{for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!s){i=a+1;break}}else n===-1&&(s=!1,n=a+1);return n===-1?"":e.slice(i,n)}},extname:function(e){Xt(e);for(var t=-1,i=0,n=-1,s=!0,a=0,o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!s){i=o+1;break}continue}n===-1&&(s=!1,n=o+1),l===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||n===-1||a===0||a===1&&t===n-1&&t===i+1?"":e.slice(t,n)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('Parameter "pathObject" must be an object, not '+typeof e);return pv("/",e)},parse:function(e){Xt(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var i=e.charCodeAt(0),n=i===47,s;n?(t.root="/",s=1):s=0;for(var a=-1,o=0,l=-1,u=!0,f=e.length-1,d=0;f>=s;--f){if(i=e.charCodeAt(f),i===47){if(!u){o=f+1;break}continue}l===-1&&(u=!1,l=f+1),i===46?a===-1?a=f:d!==1&&(d=1):a!==-1&&(d=-1)}return a===-1||l===-1||d===0||d===1&&a===l-1&&a===o+1?l!==-1&&(o===0&&n?t.base=t.name=e.slice(1,l):t.base=t.name=e.slice(o,l)):(o===0&&n?(t.name=e.slice(1,a),t.base=e.slice(1,l)):(t.name=e.slice(o,a),t.base=e.slice(o,l)),t.ext=e.slice(a,l)),o>0?t.dir=e.slice(0,o-1):n&&(t.dir="/"),t},sep:"/",delimiter:":",posix:null};wh.exports=wn});var oi=$(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.default=void 0;var En=vv(Ar());function vv(r){return r&&r.__esModule?r:{default:r}}var Eh=class{constructor(e){var t,i;t=e.indexOf("://"),t>-1&&(e=new URL(e).pathname),i=this.parse(e),this.path=e,this.isDirectory(e)?this.directory=e:this.directory=i.dir+"/",this.filename=i.base,this.extension=i.ext.slice(1)}parse(e){return En.default.parse(e)}isAbsolute(e){return En.default.isAbsolute(e||this.path)}isDirectory(e){return e.charAt(e.length-1)==="/"}resolve(e){return En.default.resolve(this.directory,e)}relative(e){var t=e&&e.indexOf("://")>-1;return t?e:En.default.relative(this.directory,e)}splitPath(e){return this.splitPathRe.exec(e).slice(1)}toString(){return this.path}},gv=Eh;xn.default=gv});var Ir=$(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.default=void 0;var xh=Th(oi()),Sh=Th(Ar());function Th(r){return r&&r.__esModule?r:{default:r}}var kh=class{constructor(e,t){var i=e.indexOf("://")>-1,n=e,s;if(this.Url=void 0,this.href=e,this.protocol="",this.origin="",this.hash="",this.hash="",this.search="",this.base=t,!i&&t!==!1&&typeof t!="string"&&window&&window.location&&(this.base=window.location.href),i||this.base)try{this.base?this.Url=new URL(e,this.base):this.Url=new URL(e),this.href=this.Url.href,this.protocol=this.Url.protocol,this.origin=this.Url.origin,this.hash=this.Url.hash,this.search=this.Url.search,n=this.Url.pathname+(this.Url.search?this.Url.search:"")}catch(a){this.Url=void 0,this.base&&(s=new xh.default(this.base),n=s.resolve(n))}this.Path=new xh.default(n),this.directory=this.Path.directory,this.filename=this.Path.filename,this.extension=this.Path.extension}path(){return this.Path}resolve(e){var t=e.indexOf("://")>-1,i;return t?e:(i=Sh.default.resolve(this.directory,e),this.origin+i)}relative(e){return Sh.default.relative(e,this.directory)}toString(){return this.href}},mv=kh;Sn.default=mv});var _t=$(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.default=void 0;var li=Ie(),Zi=1,Ot=3,_v=9,ui=class{constructor(e,t,i){var n;if(this.str="",this.base={},this.spinePos=0,this.range=!1,this.path={},this.start=null,this.end=null,!(this instanceof ui))return new ui(e,t,i);if(typeof t=="string"?this.base=this.parseComponent(t):typeof t=="object"&&t.steps&&(this.base=t),n=this.checkType(e),n==="string")return this.str=e,(0,li.extend)(this,this.parse(e));if(n==="range")return(0,li.extend)(this,this.fromRange(e,this.base,i));if(n==="node")return(0,li.extend)(this,this.fromNode(e,this.base,i));if(n==="EpubCFI"&&e.path)return e;if(e)throw new TypeError("not a valid argument for EpubCFI");return this}checkType(e){return this.isCfiString(e)?"string":e&&typeof e=="object"&&((0,li.type)(e)==="Range"||typeof e.startContainer!="undefined")?"range":e&&typeof e=="object"&&typeof e.nodeType!="undefined"?"node":e&&typeof e=="object"&&e instanceof ui?"EpubCFI":!1}parse(e){var t={spinePos:-1,range:!1,base:{},path:{},start:null,end:null},i,n,s;return typeof e!="string"?{spinePos:-1}:(e.indexOf("epubcfi(")===0&&e[e.length-1]===")"&&(e=e.slice(8,e.length-1)),i=this.getChapterComponent(e),i?(t.base=this.parseComponent(i),n=this.getPathComponent(e),t.path=this.parseComponent(n),s=this.getRange(e),s&&(t.range=!0,t.start=this.parseComponent(s[0]),t.end=this.parseComponent(s[1])),t.spinePos=t.base.steps[1].index,t):{spinePos:-1})}parseComponent(e){var t={steps:[],terminal:{offset:null,assertion:null}},i=e.split(":"),n=i[0].split("/"),s;return i.length>1&&(s=i[1],t.terminal=this.parseTerminal(s)),n[0]===""&&n.shift(),t.steps=n.map(function(a){return this.parseStep(a)}.bind(this)),t}parseStep(e){var t,i,n,s,a;if(s=e.match(/\[(.*)\]/),s&&s[1]&&(a=s[1]),i=parseInt(e),!isNaN(i))return i%2==0?(t="element",n=i/2-1):(t="text",n=(i-1)/2),{type:t,index:n,id:a||null}}parseTerminal(e){var t,i,n=e.match(/\[(.*)\]/);return n&&n[1]?(t=parseInt(e.split("[")[0]),i=n[1]):t=parseInt(e),(0,li.isNumber)(t)||(t=null),{offset:t,assertion:i}}getChapterComponent(e){var t=e.split("!");return t[0]}getPathComponent(e){var t=e.split("!");if(t[1])return t[1].split(",")[0]}getRange(e){var t=e.split(",");return t.length===3?[t[1],t[2]]:!1}getCharecterOffsetComponent(e){var t=e.split(":");return t[1]||""}joinSteps(e){return e?e.map(function(t){var i="";return t.type==="element"&&(i+=(t.index+1)*2),t.type==="text"&&(i+=1+2*t.index),t.id&&(i+="["+t.id+"]"),i}).join("/"):""}segmentString(e){var t="/";return t+=this.joinSteps(e.steps),e.terminal&&e.terminal.offset!=null&&(t+=":"+e.terminal.offset),e.terminal&&e.terminal.assertion!=null&&(t+="["+e.terminal.assertion+"]"),t}toString(){var e="epubcfi(";return e+=this.segmentString(this.base),e+="!",e+=this.segmentString(this.path),this.range&&this.start&&(e+=",",e+=this.segmentString(this.start)),this.range&&this.end&&(e+=",",e+=this.segmentString(this.end)),e+=")",e}compare(e,t){var i,n,s,a,o,l,u,u,f,d,c,v;if(typeof e=="string"&&(e=new ui(e)),typeof t=="string"&&(t=new ui(t)),e.spinePos>t.spinePos)return 1;if(e.spinePosn[g].index)return 1;if(i[g].indexa.offset?1:s.offset=0&&(n.terminal.offset=t,n.steps[n.steps.length-1].type!="text"&&n.steps.push({type:"text",index:0})),n}equalStep(e,t){return!e||!t?!1:e.index===t.index&&e.id===t.id&&e.type===t.type}fromRange(e,t,i){var n={range:!1,base:{},path:{},start:null,end:null},s=e.startContainer,a=e.endContainer,o=e.startOffset,l=e.endOffset,u=!1;if(i&&(u=s.ownerDocument.querySelector("."+i)!=null),typeof t=="string"?(n.base=this.parseComponent(t),n.spinePos=n.base.steps[1].index):typeof t=="object"&&(n.base=t),e.collapsed)u&&(o=this.patchOffset(s,o,i)),n.path=this.pathTo(s,o,i);else{n.range=!0,u&&(o=this.patchOffset(s,o,i)),n.start=this.pathTo(s,o,i),u&&(l=this.patchOffset(a,l,i)),n.end=this.pathTo(a,l,i),n.path={steps:[],terminal:null};var f=n.start.steps.length,d;for(d=0;d0&&l===Ot&&u===Ot?n[a]=s:t===l&&(s=s+1,n[a]=s),u=l;return n}position(e){var t,i;return e.nodeType===Zi?(t=e.parentNode.children,t||(t=(0,li.findChildren)(e.parentNode)),i=Array.prototype.indexOf.call(t,e)):(t=this.textNodes(e.parentNode),i=t.indexOf(e)),i}filteredPosition(e,t){var i,n,s;return e.nodeType===Zi?(i=e.parentNode.children,s=this.normalizedMap(i,Zi,t)):(i=e.parentNode.childNodes,e.parentNode.classList.contains(t)&&(e=e.parentNode,i=e.parentNode.childNodes),s=this.normalizedMap(i,Ot,t)),n=Array.prototype.indexOf.call(i,e),s[n]}stepsToXpath(e){var t=[".","*"];return e.forEach(function(i){var n=i.index+1;i.id?t.push("*[position()="+n+" and @id='"+i.id+"']"):i.type==="text"?t.push("text()["+n+"]"):t.push("*["+n+"]")}),t.join("/")}stepsToQuerySelector(e){var t=["html"];return e.forEach(function(i){var n=i.index+1;i.id?t.push("#"+i.id):i.type==="text"||t.push("*:nth-child("+n+")")}),t.join(">")}textNodes(e,t){return Array.prototype.slice.call(e.childNodes).filter(function(i){return i.nodeType===Ot?!0:!!(t&&i.classList.contains(t))})}walkToNode(e,t,i){var n=t||document,s=n.documentElement,a,o,l=e.length,u;for(u=0;uu)t=t-u;else{l.nodeType===Zi?s=l.childNodes[0]:s=l;break}}return{container:s,offset:t}}toRange(e,t){var i=e||document,n,s,a,o,l,u=this,f,d,c=t?i.querySelector("."+t)!=null:!1,v;if(typeof i.createRange!="undefined"?n=i.createRange():n=new li.RangeObject,u.range?(s=u.start,f=u.path.steps.concat(s.steps),o=this.findNode(f,i,c?t:null),a=u.end,d=u.path.steps.concat(a.steps),l=this.findNode(d,i,c?t:null)):(s=u.path,f=u.path.steps,o=this.findNode(u.path.steps,i,c?t:null)),o)try{s.terminal.offset!=null?n.setStart(o,s.terminal.offset):n.setStart(o,0)}catch(g){v=this.fixMiss(f,s.terminal.offset,i,c?t:null),n.setStart(v.container,v.offset)}else return console.log("No startContainer found for",this.toString()),null;if(l)try{a.terminal.offset!=null?n.setEnd(l,a.terminal.offset):n.setEnd(l,0)}catch(g){v=this.fixMiss(d,u.end.terminal.offset,i,c?t:null),n.setEnd(v.container,v.offset)}return n}isCfiString(e){return typeof e=="string"&&e.indexOf("epubcfi(")===0&&e[e.length-1]===")"}generateChapterComponent(e,t,i){var n=parseInt(t),s=(e+1)*2,a="/"+s+"/";return a+=(n+1)*2,i&&(a+="["+i+"]"),a}collapse(e){!this.range||(this.range=!1,e?(this.path.steps=this.path.steps.concat(this.start.steps),this.path.terminal=this.start.terminal):(this.path.steps=this.path.steps.concat(this.end.steps),this.path.terminal=this.end.terminal))}},yv=ui;Tn.default=yv});var On=$(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.default=void 0;var Oh=class{constructor(e){this.context=e||this,this.hooks=[]}register(){for(var e=0;e{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.replaceBase=Ev;mi.replaceCanonical=xv;mi.replaceLinks=Tv;mi.replaceMeta=Sv;mi.substitute=kv;var gi=Ie(),wv=Ch(Ir()),z0=Ch(oi());function Ch(r){return r&&r.__esModule?r:{default:r}}function Ev(r,e){var t,i,n=e.url,s=n.indexOf("://")>-1;!r||(i=(0,gi.qs)(r,"head"),t=(0,gi.qs)(i,"base"),t||(t=r.createElement("base"),i.insertBefore(t,i.firstChild)),!s&&window&&window.location&&(n=window.location.origin+n),t.setAttribute("href",n))}function xv(r,e){var t,i,n=e.canonical;!r||(t=(0,gi.qs)(r,"head"),i=(0,gi.qs)(t,"link[rel='canonical']"),i?i.setAttribute("href",n):(i=r.createElement("link"),i.setAttribute("rel","canonical"),i.setAttribute("href",n),t.appendChild(i)))}function Sv(r,e){var t,i,n=e.idref;!r||(t=(0,gi.qs)(r,"head"),i=(0,gi.qs)(t,"link[property='dc.identifier']"),i?i.setAttribute("content",n):(i=r.createElement("meta"),i.setAttribute("name","dc.identifier"),i.setAttribute("content",n),t.appendChild(i)))}function Tv(r,e){var t=r.querySelectorAll("a[href]");if(!!t.length)for(var i=(0,gi.qs)(r.ownerDocument,"base"),n=i?i.getAttribute("href"):void 0,s=function(o){var l=o.getAttribute("href");if(l.indexOf("mailto:")!==0){var u=l.indexOf("://")>-1;if(u)o.setAttribute("target","_blank");else{var f;try{f=new wv.default(l,n)}catch(d){}o.onclick=function(){return f&&f.hash?e(f.Path.path+f.hash):e(f?f.Path.path:l),!1}}}}.bind(this),a=0;a{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.default=void 0;var Xi=Ie(),Ov=Cv(oi());function Cv(r){return r&&r.__esModule?r:{default:r}}function Nv(r,e,t,i){var n=typeof window!="undefined"?window.URL:!1,s=n?"blob":"arraybuffer",a=new Xi.defer,o=new XMLHttpRequest,l=XMLHttpRequest.prototype,u;"overrideMimeType"in l||Object.defineProperty(l,"overrideMimeType",{value:function(){}}),t&&(o.withCredentials=!0),o.onreadystatechange=d,o.onerror=f,o.open("GET",r,!0);for(u in i)o.setRequestHeader(u,i[u]);e=="json"&&o.setRequestHeader("Accept","application/json"),e||(e=new Ov.default(r).extension),e=="blob"&&(o.responseType=s),(0,Xi.isXml)(e)&&o.overrideMimeType("text/xml"),e=="xhtml",e=="html"||e=="htm",e=="binary"&&(o.responseType="arraybuffer"),o.send();function f(c){a.reject(c)}function d(){if(this.readyState===XMLHttpRequest.DONE){var c=!1;if((this.responseType===""||this.responseType==="document")&&(c=this.responseXML),this.status===200||this.status===0||c){var v;if(!this.response&&!c)return a.reject({status:this.status,message:"Empty Response",stack:new Error().stack}),a.promise;if(this.status===403)return a.reject({status:this.status,response:this.response,message:"Forbidden",stack:new Error().stack}),a.promise;c?v=this.responseXML:(0,Xi.isXml)(e)?v=(0,Xi.parse)(this.response,"text/xml"):e=="xhtml"?v=(0,Xi.parse)(this.response,"application/xhtml+xml"):e=="html"||e=="htm"?v=(0,Xi.parse)(this.response,"text/html"):e=="json"?v=JSON.parse(this.response):e=="blob"?n?v=this.response:v=new Blob([this.response]):v=this.response,a.resolve(v)}else a.reject({status:this.status,message:this.response,stack:new Error().stack})}}return a.promise}var Rv=Nv;Cn.default=Rv});var Ih=$(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.default=void 0;var Ta=Ie(),Nh=ka(_t()),Rh=ka(On()),Av=Dr(),Iv=ka(Pr()),Dv=ya();function ka(r){return r&&r.__esModule?r:{default:r}}var Ah=class{constructor(e,t){this.idref=e.idref,this.linear=e.linear==="yes",this.properties=e.properties,this.index=e.index,this.href=e.href,this.url=e.url,this.canonical=e.canonical,this.next=e.next,this.prev=e.prev,this.cfiBase=e.cfiBase,t?this.hooks=t:(this.hooks={},this.hooks.serialize=new Rh.default(this),this.hooks.content=new Rh.default(this)),this.document=void 0,this.contents=void 0,this.output=void 0}load(e){var t=e||this.request||Iv.default,i=new Ta.defer,n=i.promise;return this.contents?i.resolve(this.contents):t(this.url).then(function(s){return this.document=s,this.contents=s.documentElement,this.hooks.content.trigger(this.document,this)}.bind(this)).then(function(){i.resolve(this.contents)}.bind(this)).catch(function(s){i.reject(s)}),n}base(){return(0,Av.replaceBase)(this.document,this)}render(e){var t=new Ta.defer,i=t.promise;return this.output,this.load(e).then(function(n){var s=typeof navigator!="undefined"&&navigator.userAgent||"",a=s.indexOf("Trident")>=0,o;typeof XMLSerializer=="undefined"||a?o=Dv.DOMParser:o=XMLSerializer;var l=new o;return this.output=l.serializeToString(n),this.output}.bind(this)).then(function(){return this.hooks.serialize.trigger(this.output,this)}.bind(this)).then(function(){t.resolve(this.output)}.bind(this)).catch(function(n){t.reject(n)}),i}find(e){var t=this,i=[],n=e.toLowerCase(),s=function(a){for(var o=a.textContent.toLowerCase(),l=t.document.createRange(),u,f,d=-1,c,v=150;f!=-1;)f=o.indexOf(n,d+1),f!=-1&&(l=t.document.createRange(),l.setStart(a,f),l.setEnd(a,f+n.length),u=t.cfiFromRange(l),a.textContent.lengthO+k.textContent,"").toLowerCase().indexOf(a);if(g!=-1){let O=0,k=g+a.length,_=0,p=0;if(gM+j.textContent.length,0);w.setEnd(P,N>k?k:k-N),y=s.cfiFromRange(w);let C=d.slice(0,_+1).reduce((M,j)=>M+j.textContent,"");C.length>n&&(C=C.substring(g-n/2,g+n/2),C="..."+C+"..."),i.push({cfi:y,excerpt:C})}}},l=document.createTreeWalker(s.document,NodeFilter.SHOW_TEXT,null,!1),u,f=[];for(;u=l.nextNode();)f.push(u),f.length==t&&(o(f.slice(0,t)),f=f.slice(1,t));return f.length>0&&o(f),i}reconcileLayoutSettings(e){var t={layout:e.layout,spread:e.spread,orientation:e.orientation};return this.properties.forEach(function(i){var n=i.replace("rendition:",""),s=n.indexOf("-"),a,o;s!=-1&&(a=n.slice(0,s),o=n.slice(s+1),t[a]=o)}),t}cfiFromRange(e){return new Nh.default(e,this.cfiBase).toString()}cfiFromElement(e){return new Nh.default(e,this.cfiBase).toString()}unload(){this.document=void 0,this.contents=void 0,this.output=void 0}destroy(){this.unload(),this.hooks.serialize.clear(),this.hooks.content.clear(),this.hooks=void 0,this.idref=void 0,this.linear=void 0,this.properties=void 0,this.index=void 0,this.href=void 0,this.url=void 0,this.next=void 0,this.prev=void 0,this.cfiBase=void 0}},Pv=Ah;Nn.default=Pv});var zh=$(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.default=void 0;var Dh=Ca(_t()),Ph=Ca(On()),Lv=Ca(Ih()),Oa=Dr();function Ca(r){return r&&r.__esModule?r:{default:r}}var Lh=class{constructor(){this.spineItems=[],this.spineByHref={},this.spineById={},this.hooks={},this.hooks.serialize=new Ph.default,this.hooks.content=new Ph.default,this.hooks.content.register(Oa.replaceBase),this.hooks.content.register(Oa.replaceCanonical),this.hooks.content.register(Oa.replaceMeta),this.epubcfi=new Dh.default,this.loaded=!1,this.items=void 0,this.manifest=void 0,this.spineNodeIndex=void 0,this.baseUrl=void 0,this.length=void 0}unpack(e,t,i){this.items=e.spine,this.manifest=e.manifest,this.spineNodeIndex=e.spineNodeIndex,this.baseUrl=e.baseUrl||e.basePath||"",this.length=this.items.length,this.items.forEach((n,s)=>{var a=this.manifest[n.idref],o;n.index=s,n.cfiBase=this.epubcfi.generateChapterComponent(this.spineNodeIndex,n.index,n.id),n.href&&(n.url=t(n.href,!0),n.canonical=i(n.href)),a&&(n.href=a.href,n.url=t(n.href,!0),n.canonical=i(n.href),a.properties.length&&n.properties.push.apply(n.properties,a.properties)),n.linear==="yes"?(n.prev=function(){let l=n.index;for(;l>0;){let u=this.get(l-1);if(u&&u.linear)return u;l-=1}}.bind(this),n.next=function(){let l=n.index;for(;l-1)return delete this.spineByHref[e.href],delete this.spineById[e.idref],this.spineItems.splice(t,1)}each(){return this.spineItems.forEach.apply(this.spineItems,arguments)}first(){let e=0;do{let t=this.get(e);if(t&&t.linear)return t;e+=1}while(e=0)}destroy(){this.each(e=>e.destroy()),this.spineItems=void 0,this.spineByHref=void 0,this.spineById=void 0,this.hooks.serialize.clear(),this.hooks.content.clear(),this.hooks=void 0,this.epubcfi=void 0,this.loaded=!1,this.items=void 0,this.manifest=void 0,this.spineNodeIndex=void 0,this.baseUrl=void 0,this.length=void 0}},zv=Lh;Rn.default=zv});var In=$(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.default=Yi.Task=void 0;var An=Ie(),Mh=class{constructor(e){this._q=[],this.context=e,this.tick=An.requestAnimationFrame,this.running=!1,this.paused=!1}enqueue(){var e,t,i,n=[].shift.call(arguments),s=arguments;if(!n)throw new Error("No Task Provided");return typeof n=="function"?(e=new An.defer,t=e.promise,i={task:n,args:s,deferred:e,promise:t}):i={promise:n},this._q.push(i),this.paused==!1&&!this.running&&this.run(),i.promise}dequeue(){var e,t,i;if(this._q.length&&!this.paused){if(e=this._q.shift(),t=e.task,t)return i=t.apply(this.context,e.args),i&&typeof i.then=="function"?i.then(function(){e.deferred.resolve.apply(this.context,arguments)}.bind(this),function(){e.deferred.reject.apply(this.context,arguments)}.bind(this)):(e.deferred.resolve.apply(this.context,i),e.promise);if(e.promise)return e.promise}else return e=new An.defer,e.deferred.resolve(),e.promise}dump(){for(;this._q.length;)this.dequeue()}run(){return this.running||(this.running=!0,this.defered=new An.defer),this.tick.call(window,()=>{this._q.length?this.dequeue().then(function(){this.run()}.bind(this)):(this.defered.resolve(),this.running=void 0)}),this.paused==!0&&(this.paused=!1),this.defered.promise}flush(){if(this.running)return this.running;if(this._q.length)return this.running=this.dequeue().then(function(){return this.running=void 0,this.flush()}.bind(this)),this.running}clear(){this._q=[]}length(){return this._q.length}pause(){this.paused=!0}stop(){this._q=[],this.running=!1,this.paused=!0}},Bh=class{constructor(e,t,i){return function(){var n=arguments||[];return new Promise((s,a)=>{var o=function(l,u){!l&&u?a(u):s(l)};n.push(o),e.apply(i||this,n)})}}};Yi.Task=Bh;var Mv=Mh;Yi.default=Mv});var Ct=$(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});hi.EVENTS=hi.EPUBJS_VERSION=hi.DOM_EVENTS=void 0;var Bv="0.3";hi.EPUBJS_VERSION=Bv;var Uv=["keydown","keyup","keypressed","mouseup","mousedown","mousemove","click","touchend","touchstart","touchmove"];hi.DOM_EVENTS=Uv;var Fv={BOOK:{OPEN_FAILED:"openFailed"},CONTENTS:{EXPAND:"expand",RESIZE:"resize",SELECTED:"selected",SELECTED_RANGE:"selectedRange",LINK_CLICKED:"linkClicked"},LOCATIONS:{CHANGED:"changed"},MANAGERS:{RESIZE:"resize",RESIZED:"resized",ORIENTATION_CHANGE:"orientationchange",ADDED:"added",SCROLL:"scroll",SCROLLED:"scrolled",REMOVED:"removed"},VIEWS:{AXIS:"axis",WRITING_MODE:"writingMode",LOAD_ERROR:"loaderror",RENDERED:"rendered",RESIZED:"resized",DISPLAYED:"displayed",SHOWN:"shown",HIDDEN:"hidden",MARK_CLICKED:"markClicked"},RENDITION:{STARTED:"started",ATTACHED:"attached",DISPLAYED:"displayed",DISPLAY_ERROR:"displayerror",RENDERED:"rendered",REMOVED:"removed",RESIZED:"resized",ORIENTATION_CHANGE:"orientationchange",LOCATION_CHANGED:"locationChanged",RELOCATED:"relocated",MARK_CLICKED:"markClicked",SELECTED:"selected",LAYOUT:"layout"},LAYOUT:{UPDATED:"updated"},ANNOTATION:{ATTACH:"attach",DETACH:"detach"}};hi.EVENTS=Fv});var Uh=$(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.default=void 0;var _i=Ie(),qv=Na(In()),fi=Na(_t()),Wv=Ct(),jv=Na(Ft());function Na(r){return r&&r.__esModule?r:{default:r}}var Ra=class{constructor(e,t,i){this.spine=e,this.request=t,this.pause=i||100,this.q=new qv.default(this),this.epubcfi=new fi.default,this._locations=[],this._locationsWords=[],this.total=0,this.break=150,this._current=0,this._wordCounter=0,this.currentLocation="",this._currentCfi="",this.processingTimeout=void 0}generate(e){return e&&(this.break=e),this.q.pause(),this.spine.each(function(t){t.linear&&this.q.enqueue(this.process.bind(this),t)}.bind(this)),this.q.run().then(function(){return this.total=this._locations.length-1,this._currentCfi&&(this.currentLocation=this._currentCfi),this._locations}.bind(this))}createRange(){return{startContainer:void 0,startOffset:void 0,endContainer:void 0,endOffset:void 0}}process(e){return e.load(this.request).then(function(t){var i=new _i.defer,n=this.parse(t,e.cfiBase);return this._locations=this._locations.concat(n),e.unload(),this.processingTimeout=setTimeout(()=>i.resolve(n),this.pause),i.promise}.bind(this))}parse(e,t,i){var n=[],s,a=e.ownerDocument,o=(0,_i.qs)(a,"body"),l=0,u,f=i||this.break,d=function(c){var v=c.length,g,O=0;if(c.textContent.trim().length===0)return!1;for(l==0&&(s=this.createRange(),s.startContainer=c,s.startOffset=0),g=f-l,g>v&&(l+=v,O=v);O=v)l+=v-O,O=v;else{O+=g,s.endContainer=c,s.endOffset=O;let k=new fi.default(s,t).toString();n.push(k),l=0}u=c};if((0,_i.sprint)(o,d.bind(this)),s&&s.startContainer&&u){s.endContainer=u,s.endOffset=u.length;let c=new fi.default(s,t).toString();n.push(c),l=0}return n}generateFromWords(e,t,i){var n=e?new fi.default(e):void 0;return this.q.pause(),this._locationsWords=[],this._wordCounter=0,this.spine.each(function(s){s.linear&&(n?s.index>=n.spinePos&&this.q.enqueue(this.processWords.bind(this),s,t,n,i):this.q.enqueue(this.processWords.bind(this),s,t,n,i))}.bind(this)),this.q.run().then(function(){return this._currentCfi&&(this.currentLocation=this._currentCfi),this._locationsWords}.bind(this))}processWords(e,t,i,n){return n&&this._locationsWords.length>=n?Promise.resolve():e.load(this.request).then(function(s){var a=new _i.defer,o=this.parseWords(s,e,t,i),l=n-this._locationsWords.length;return this._locationsWords=this._locationsWords.concat(o.length>=n?o.slice(0,l):o),e.unload(),this.processingTimeout=setTimeout(()=>a.resolve(o),this.pause),a.promise}.bind(this))}countWords(e){return e=e.replace(/(^\s*)|(\s*$)/gi,""),e=e.replace(/[ ]{2,}/gi," "),e=e.replace(/\n /,` `),e.split(" ").length}parseWords(e,t,i,n){var s=t.cfiBase,a=[],o=e.ownerDocument,l=(0,_i.qs)(o,"body"),u,f=i,d=n?n.spinePos!==t.index:!0,c;n&&t.index===n.spinePos&&(c=n.findNode(n.range?n.path.steps.concat(n.start.steps):n.path.steps,e.ownerDocument));var v=function(g){if(!d)if(g===c)d=!0;else return!1;if(g.textContent.length<10&&g.textContent.trim().length===0)return!1;var O=this.countWords(g.textContent),k,_=0;if(O===0)return!1;for(k=f-this._wordCounter,k>O&&(this._wordCounter+=O,_=O);_=O)this._wordCounter+=O-_,_=O;else{_+=k;let p=new fi.default(g,s);a.push({cfi:p.toString(),wordCount:this._wordCounter}),this._wordCounter=0}u=g};return(0,_i.sprint)(l,v.bind(this)),a}locationFromCfi(e){let t;return fi.default.prototype.isCfiString(e)&&(e=new fi.default(e)),this._locations.length===0?-1:(t=(0,_i.locationOf)(e,this._locations,this.epubcfi.compare),t>this.total?this.total:t)}percentageFromCfi(e){if(this._locations.length===0)return null;var t=this.locationFromCfi(e);return this.percentageFromLocation(t)}percentageFromLocation(e){return!e||!this.total?0:e/this.total}cfiFromLocation(e){var t=-1;return typeof e!="number"&&(e=parseInt(e)),e>=0&&e1&&console.warn("Normalize cfiFromPercentage value to between 0 - 1"),e>=1){let i=new fi.default(this._locations[this.total]);return i.collapse(),i.toString()}return t=Math.ceil(this.total*e),this.cfiFromLocation(t)}load(e){return typeof e=="string"?this._locations=JSON.parse(e):this._locations=e,this.total=this._locations.length-1,this._locations}save(){return JSON.stringify(this._locations)}getCurrent(){return this._current}setCurrent(e){var t;if(typeof e=="string")this._currentCfi=e;else if(typeof e=="number")this._current=e;else return;this._locations.length!==0&&(typeof e=="string"?(t=this.locationFromCfi(e),this._current=t):t=e,this.emit(Wv.EVENTS.LOCATIONS.CHANGED,{percentage:this.percentageFromLocation(t)}))}get currentLocation(){return this._current}set currentLocation(e){this.setCurrent(e)}length(){return this._locations.length}destroy(){this.spine=void 0,this.request=void 0,this.pause=void 0,this.q.stop(),this.q=void 0,this.epubcfi=void 0,this._locations=void 0,this.total=void 0,this.break=void 0,this._current=void 0,this.currentLocation=void 0,this._currentCfi=void 0,clearTimeout(this.processingTimeout)}};(0,jv.default)(Ra.prototype);var Vv=Ra;Dn.default=Vv});var qh=$(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.default=void 0;var Hv=Xv(Ar()),Zv=Ie();function Xv(r){return r&&r.__esModule?r:{default:r}}var Fh=class{constructor(e){this.packagePath="",this.directory="",this.encoding="",e&&this.parse(e)}parse(e){var t;if(!e)throw new Error("Container File Not Found");if(t=(0,Zv.qs)(e,"rootfile"),!t)throw new Error("No RootFile Found");this.packagePath=t.getAttribute("full-path"),this.directory=Hv.default.dirname(this.packagePath),this.encoding=e.xmlEncoding}destroy(){this.packagePath=void 0,this.directory=void 0,this.encoding=void 0}},Yv=Fh;Pn.default=Yv});var jh=$(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.default=void 0;var Nt=Ie(),Wh=class{constructor(e){this.manifest={},this.navPath="",this.ncxPath="",this.coverPath="",this.spineNodeIndex=0,this.spine=[],this.metadata={},e&&this.parse(e)}parse(e){var t,i,n;if(!e)throw new Error("Package File Not Found");if(t=(0,Nt.qs)(e,"metadata"),!t)throw new Error("No Metadata Found");if(i=(0,Nt.qs)(e,"manifest"),!i)throw new Error("No Manifest Found");if(n=(0,Nt.qs)(e,"spine"),!n)throw new Error("No Spine Found");return this.manifest=this.parseManifest(i),this.navPath=this.findNavPath(i),this.ncxPath=this.findNcxPath(i,n),this.coverPath=this.findCoverPath(e),this.spineNodeIndex=(0,Nt.indexOfElementNode)(n),this.spine=this.parseSpine(n,this.manifest),this.uniqueIdentifier=this.findUniqueIdentifier(e),this.metadata=this.parseMetadata(t),this.metadata.direction=n.getAttribute("page-progression-direction"),{metadata:this.metadata,spine:this.spine,manifest:this.manifest,navPath:this.navPath,ncxPath:this.ncxPath,coverPath:this.coverPath,spineNodeIndex:this.spineNodeIndex}}parseMetadata(e){var t={};return t.title=this.getElementText(e,"title"),t.creator=this.getElementText(e,"creator"),t.description=this.getElementText(e,"description"),t.pubdate=this.getElementText(e,"date"),t.publisher=this.getElementText(e,"publisher"),t.identifier=this.getElementText(e,"identifier"),t.language=this.getElementText(e,"language"),t.rights=this.getElementText(e,"rights"),t.modified_date=this.getPropertyText(e,"dcterms:modified"),t.layout=this.getPropertyText(e,"rendition:layout"),t.orientation=this.getPropertyText(e,"rendition:orientation"),t.flow=this.getPropertyText(e,"rendition:flow"),t.viewport=this.getPropertyText(e,"rendition:viewport"),t.media_active_class=this.getPropertyText(e,"media:active-class"),t.spread=this.getPropertyText(e,"rendition:spread"),t}parseManifest(e){var t={},i=(0,Nt.qsa)(e,"item"),n=Array.prototype.slice.call(i);return n.forEach(function(s){var a=s.getAttribute("id"),o=s.getAttribute("href")||"",l=s.getAttribute("media-type")||"",u=s.getAttribute("media-overlay")||"",f=s.getAttribute("properties")||"";t[a]={href:o,type:l,overlay:u,properties:f.length?f.split(" "):[]}}),t}parseSpine(e,t){var i=[],n=(0,Nt.qsa)(e,"itemref"),s=Array.prototype.slice.call(n);return s.forEach(function(a,o){var l=a.getAttribute("idref"),u=a.getAttribute("properties")||"",f=u.length?u.split(" "):[],d={id:a.getAttribute("id"),idref:l,linear:a.getAttribute("linear")||"yes",properties:f,index:o};i.push(d)}),i}findUniqueIdentifier(e){var t=e.documentElement.getAttribute("unique-identifier");if(!t)return"";var i=e.getElementById(t);return i&&i.localName==="identifier"&&i.namespaceURI==="http://purl.org/dc/elements/1.1/"&&i.childNodes.length>0?i.childNodes[0].nodeValue.trim():""}findNavPath(e){var t=(0,Nt.qsp)(e,"item",{properties:"nav"});return t?t.getAttribute("href"):!1}findNcxPath(e,t){var i=(0,Nt.qsp)(e,"item",{"media-type":"application/x-dtbncx+xml"}),n;return i||(n=t.getAttribute("toc"),n&&(i=e.querySelector(`#${n}`))),i?i.getAttribute("href"):!1}findCoverPath(e){var t=(0,Nt.qs)(e,"package"),i=t.getAttribute("version"),n=(0,Nt.qsp)(e,"item",{properties:"cover-image"});if(n)return n.getAttribute("href");var s=(0,Nt.qsp)(e,"meta",{name:"cover"});if(s){var a=s.getAttribute("content"),o=e.getElementById(a);return o?o.getAttribute("href"):""}else return!1}getElementText(e,t){var i=e.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/",t),n;return!i||i.length===0?"":(n=i[0],n.childNodes.length?n.childNodes[0].nodeValue:"")}getPropertyText(e,t){var i=(0,Nt.qsp)(e,"meta",{property:t});return i&&i.childNodes.length?i.childNodes[0].nodeValue:""}load(e){this.metadata=e.metadata;let t=e.readingOrder||e.spine;return this.spine=t.map((i,n)=>(i.index=n,i.linear=i.linear||"yes",i)),e.resources.forEach((i,n)=>{this.manifest[n]=i,i.rel&&i.rel[0]==="cover"&&(this.coverPath=i.href)}),this.spineNodeIndex=0,this.toc=e.toc.map((i,n)=>(i.label=i.title,i)),{metadata:this.metadata,spine:this.spine,manifest:this.manifest,navPath:this.navPath,ncxPath:this.ncxPath,coverPath:this.coverPath,spineNodeIndex:this.spineNodeIndex,toc:this.toc}}destroy(){this.manifest=void 0,this.navPath=void 0,this.ncxPath=void 0,this.coverPath=void 0,this.spineNodeIndex=void 0,this.spine=void 0,this.metadata=void 0}},Gv=Wh;Ln.default=Gv});var Hh=$(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.default=void 0;var yt=Ie(),Vh=class{constructor(e){this.toc=[],this.tocByHref={},this.tocById={},this.landmarks=[],this.landmarksByType={},this.length=0,e&&this.parse(e)}parse(e){let t=e.nodeType,i,n;t&&(i=(0,yt.qs)(e,"html"),n=(0,yt.qs)(e,"ncx")),t?i?(this.toc=this.parseNav(e),this.landmarks=this.parseLandmarks(e)):n&&(this.toc=this.parseNcx(e)):this.toc=this.load(e),this.length=0,this.unpack(this.toc)}unpack(e){for(var t,i=0;i(t.label=t.title,t.subitems=t.children?this.load(t.children):[],t))}forEach(e){return this.toc.forEach(e)}},$v=Vh;zn.default=$v});var Bn=$(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.default=void 0;var Lr={application:{ecmascript:["es","ecma"],javascript:"js",ogg:"ogx",pdf:"pdf",postscript:["ps","ai","eps","epsi","epsf","eps2","eps3"],"rdf+xml":"rdf",smil:["smi","smil"],"xhtml+xml":["xhtml","xht"],xml:["xml","xsl","xsd","opf","ncx"],zip:"zip","x-httpd-eruby":"rhtml","x-latex":"latex","x-maker":["frm","maker","frame","fm","fb","book","fbdoc"],"x-object":"o","x-shockwave-flash":["swf","swfl"],"x-silverlight":"scr","epub+zip":"epub","font-tdpfr":"pfr","inkml+xml":["ink","inkml"],json:"json","jsonml+json":"jsonml","mathml+xml":"mathml","metalink+xml":"metalink",mp4:"mp4s","omdoc+xml":"omdoc",oxps:"oxps","vnd.amazon.ebook":"azw",widget:"wgt","x-dtbook+xml":"dtb","x-dtbresource+xml":"res","x-font-bdf":"bdf","x-font-ghostscript":"gsf","x-font-linux-psf":"psf","x-font-otf":"otf","x-font-pcf":"pcf","x-font-snf":"snf","x-font-ttf":["ttf","ttc"],"x-font-type1":["pfa","pfb","pfm","afm"],"x-font-woff":"woff","x-mobipocket-ebook":["prc","mobi"],"x-mspublisher":"pub","x-nzb":"nzb","x-tgif":"obj","xaml+xml":"xaml","xml-dtd":"dtd","xproc+xml":"xpl","xslt+xml":"xslt","internet-property-stream":"acx","x-compress":"z","x-compressed":"tgz","x-gzip":"gz"},audio:{flac:"flac",midi:["mid","midi","kar","rmi"],mpeg:["mpga","mpega","mp2","mp3","m4a","mp2a","m2a","m3a"],mpegurl:"m3u",ogg:["oga","ogg","spx"],"x-aiff":["aif","aiff","aifc"],"x-ms-wma":"wma","x-wav":"wav",adpcm:"adp",mp4:"mp4a",webm:"weba","x-aac":"aac","x-caf":"caf","x-matroska":"mka","x-pn-realaudio-plugin":"rmp",xm:"xm",mid:["mid","rmi"]},image:{gif:"gif",ief:"ief",jpeg:["jpeg","jpg","jpe"],pcx:"pcx",png:"png","svg+xml":["svg","svgz"],tiff:["tiff","tif"],"x-icon":"ico",bmp:"bmp",webp:"webp","x-pict":["pic","pct"],"x-tga":"tga","cis-cod":"cod"},text:{"cache-manifest":["manifest","appcache"],css:"css",csv:"csv",html:["html","htm","shtml","stm"],mathml:"mml",plain:["txt","text","brf","conf","def","list","log","in","bas"],richtext:"rtx","tab-separated-values":"tsv","x-bibtex":"bib"},video:{mpeg:["mpeg","mpg","mpe","m1v","m2v","mp2","mpa","mpv2"],mp4:["mp4","mp4v","mpg4"],quicktime:["qt","mov"],ogg:"ogv","vnd.mpegurl":["mxu","m4u"],"x-flv":"flv","x-la-asf":["lsf","lsx"],"x-mng":"mng","x-ms-asf":["asf","asx","asr"],"x-ms-wm":"wm","x-ms-wmv":"wmv","x-ms-wmx":"wmx","x-ms-wvx":"wvx","x-msvideo":"avi","x-sgi-movie":"movie","x-matroska":["mpv","mkv","mk3d","mks"],"3gpp2":"3g2",h261:"h261",h263:"h263",h264:"h264",jpeg:"jpgv",jpm:["jpm","jpgm"],mj2:["mj2","mjp2"],"vnd.ms-playready.media.pyv":"pyv","vnd.uvvu.mp4":["uvu","uvvu"],"vnd.vivo":"viv",webm:"webm","x-f4v":"f4v","x-m4v":"m4v","x-ms-vob":"vob","x-smv":"smv"}},Kv=function(){var r,e,t,i,n={};for(r in Lr)if(Lr.hasOwnProperty(r)){for(e in Lr[r])if(Lr[r].hasOwnProperty(e))if(t=Lr[r][e],typeof t=="string")n[t]=r+"/"+e;else for(i=0;i{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.default=void 0;var Zh=Dr(),zr=Ie(),tg=Un(Ir()),ig=Un(Bn()),Xh=Un(oi()),rg=Un(Ar());function Un(r){return r&&r.__esModule?r:{default:r}}var Yh=class{constructor(e,t){this.settings={replacements:t&&t.replacements||"base64",archive:t&&t.archive,resolver:t&&t.resolver,request:t&&t.request},this.process(e)}process(e){this.manifest=e,this.resources=Object.keys(e).map(function(t){return e[t]}),this.replacementUrls=[],this.html=[],this.assets=[],this.css=[],this.urls=[],this.cssUrls=[],this.split(),this.splitUrls()}split(){this.html=this.resources.filter(function(e){if(e.type==="application/xhtml+xml"||e.type==="text/html")return!0}),this.assets=this.resources.filter(function(e){if(e.type!=="application/xhtml+xml"&&e.type!=="text/html")return!0}),this.css=this.resources.filter(function(e){if(e.type==="text/css")return!0})}splitUrls(){this.urls=this.assets.map(function(e){return e.href}.bind(this)),this.cssUrls=this.css.map(function(e){return e.href})}createUrl(e){var t=new tg.default(e),i=ig.default.lookup(t.filename);return this.settings.archive?this.settings.archive.createUrl(e,{base64:this.settings.replacements==="base64"}):this.settings.replacements==="base64"?this.settings.request(e,"blob").then(n=>(0,zr.blob2base64)(n)).then(n=>(0,zr.createBase64Url)(n,i)):this.settings.request(e,"blob").then(n=>(0,zr.createBlobUrl)(n,i))}replacements(){if(this.settings.replacements==="none")return new Promise(function(t){t(this.urls)}.bind(this));var e=this.urls.map(t=>{var i=this.settings.resolver(t);return this.createUrl(i).catch(n=>(console.error(n),null))});return Promise.all(e).then(t=>(this.replacementUrls=t.filter(i=>typeof i=="string"),t))}replaceCss(e,t){var i=[];return e=e||this.settings.archive,t=t||this.settings.resolver,this.cssUrls.forEach(function(n){var s=this.createCssFile(n,e,t).then(function(a){var o=this.urls.indexOf(n);o>-1&&(this.replacementUrls[o]=a)}.bind(this));i.push(s)}.bind(this)),Promise.all(i)}createCssFile(e){var t;if(rg.default.isAbsolute(e))return new Promise(function(a){a()});var i=this.settings.resolver(e),n;this.settings.archive?n=this.settings.archive.getText(i):n=this.settings.request(i,"text");var s=this.urls.map(a=>{var o=this.settings.resolver(a),l=new Xh.default(i).relative(o);return l});return n?n.then(a=>(a=(0,Zh.substitute)(a,s,this.replacementUrls),this.settings.replacements==="base64"?t=(0,zr.createBase64Url)(a,"text/css"):t=(0,zr.createBlobUrl)(a,"text/css"),t),a=>new Promise(function(o){o()})):new Promise(function(a){a()})}relativeTo(e,t){return t=t||this.settings.resolver,this.urls.map(function(i){var n=t(i),s=new Xh.default(e).relative(n);return s}.bind(this))}get(e){var t=this.urls.indexOf(e);if(t!==-1)return this.replacementUrls.length?new Promise(function(i,n){i(this.replacementUrls[t])}.bind(this)):this.createUrl(e)}substitute(e,t){var i;return t?i=this.relativeTo(t):i=this.urls,(0,Zh.substitute)(e,i,this.replacementUrls)}destroy(){this.settings=void 0,this.manifest=void 0,this.resources=void 0,this.replacementUrls=void 0,this.html=void 0,this.assets=void 0,this.css=void 0,this.urls=void 0,this.cssUrls=void 0}},ng=Yh;Fn.default=ng});var Kh=$(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.default=void 0;var sg=ag(_t()),Rt=Ie();function ag(r){return r&&r.__esModule?r:{default:r}}var $h=class{constructor(e){this.pages=[],this.locations=[],this.epubcfi=new sg.default,this.firstPage=0,this.lastPage=0,this.totalPages=0,this.toc=void 0,this.ncx=void 0,e&&(this.pageList=this.parse(e)),this.pageList&&this.pageList.length&&this.process(this.pageList)}parse(e){var t=(0,Rt.qs)(e,"html"),i=(0,Rt.qs)(e,"ncx");if(t)return this.parseNav(e);if(i)return this.parseNcx(e)}parseNav(e){var t=(0,Rt.querySelectorByType)(e,"nav","page-list"),i=t?(0,Rt.qsa)(t,"li"):[],n=i.length,s,a=[],o;if(!i||n===0)return a;for(s=0;s1?o[1]:!1,{cfi:u,href:i,packageUrl:l,page:s}):{href:i,page:s}}process(e){e.forEach(function(t){this.pages.push(t.page),t.cfi&&this.locations.push(t.cfi)},this),this.firstPage=parseInt(this.pages[0]),this.lastPage=parseInt(this.pages[this.pages.length-1]),this.totalPages=this.lastPage-this.firstPage}pageFromCfi(e){var t=-1;if(this.locations.length===0)return-1;var i=(0,Rt.indexOfSorted)(e,this.locations,this.epubcfi.compare);return i!=-1?t=this.pages[i]:(i=(0,Rt.locationOf)(e,this.locations,this.epubcfi.compare),t=i-1>=0?this.pages[i-1]:this.pages[0],t!==void 0||(t=-1)),t}cfiFromPage(e){var t=-1;typeof e!="number"&&(e=parseInt(e));var i=this.pages.indexOf(e);return i!=-1&&(t=this.locations[i]),t}pageFromPercentage(e){var t=Math.round(this.totalPages*e);return t}percentageFromPage(e){var t=(e-this.firstPage)/this.totalPages;return Math.round(t*1e3)/1e3}percentageFromCfi(e){var t=this.pageFromCfi(e),i=this.percentageFromPage(t);return i}destroy(){this.pages=void 0,this.locations=void 0,this.epubcfi=void 0,this.pageList=void 0,this.toc=void 0,this.ncx=void 0}},og=$h;qn.default=og});var Ia=$(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.default=void 0;var lg=Ie(),ug=Ct(),hg=fg(Ft());function fg(r){return r&&r.__esModule?r:{default:r}}var Aa=class{constructor(e){this.settings=e,this.name=e.layout||"reflowable",this._spread=e.spread!=="none",this._minSpreadWidth=e.minSpreadWidth||800,this._evenSpreads=e.evenSpreads||!1,e.flow==="scrolled"||e.flow==="scrolled-continuous"||e.flow==="scrolled-doc"?this._flow="scrolled":this._flow="paginated",this.width=0,this.height=0,this.spreadWidth=0,this.delta=0,this.columnWidth=0,this.gap=0,this.divisor=1,this.props={name:this.name,spread:this._spread,flow:this._flow,width:0,height:0,spreadWidth:0,delta:0,columnWidth:0,gap:0,divisor:1}}flow(e){return typeof e!="undefined"&&(e==="scrolled"||e==="scrolled-continuous"||e==="scrolled-doc"?this._flow="scrolled":this._flow="paginated",this.update({flow:this._flow})),this._flow}spread(e,t){return e&&(this._spread=e!=="none",this.update({spread:this._spread})),t>=0&&(this._minSpreadWidth=t),this._spread}calculate(e,t,i){var n=1,s=i||0,a=e,o=t,l=Math.floor(a/12),u,f,d,c;this._spread&&a>=this._minSpreadWidth?n=2:n=1,this.name==="reflowable"&&this._flow==="paginated"&&!(i>=0)&&(s=l%2==0?l:l-1),this.name==="pre-paginated"&&(s=0),n>1?(u=a/n-s,d=u+s):(u=a,d=a),this.name==="pre-paginated"&&n>1&&(a=u),f=u*n+s,c=a,this.width=a,this.height=o,this.spreadWidth=f,this.pageWidth=d,this.delta=c,this.columnWidth=u,this.gap=s,this.divisor=n,this.update({width:a,height:o,spreadWidth:f,pageWidth:d,delta:c,columnWidth:u,gap:s,divisor:n})}format(e,t,i){var n;return this.name==="pre-paginated"?n=e.fit(this.columnWidth,this.height,t):this._flow==="paginated"?n=e.columns(this.width,this.height,this.columnWidth,this.gap,this.settings.direction):i&&i==="horizontal"?n=e.size(null,this.height):n=e.size(this.width,null),n}count(e,t){let i,n;return this.name==="pre-paginated"?(i=1,n=1):this._flow==="paginated"?(t=t||this.delta,i=Math.ceil(e/t),n=i*this.divisor):(t=t||this.height,i=Math.ceil(e/t),n=i),{spreads:i,pages:n}}update(e){if(Object.keys(e).forEach(t=>{this.props[t]===e[t]&&delete e[t]}),Object.keys(e).length>0){let t=(0,lg.extend)(this.props,e);this.emit(ug.EVENTS.LAYOUT.UPDATED,t,e)}}};(0,hg.default)(Aa.prototype);var cg=Aa;Wn.default=cg});var Qh=$(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.default=void 0;var dg=pg(Ir());function pg(r){return r&&r.__esModule?r:{default:r}}var Jh=class{constructor(e){this.rendition=e,this._themes={default:{rules:{},url:"",serialized:""}},this._overrides={},this._current="default",this._injected=[],this.rendition.hooks.content.register(this.inject.bind(this)),this.rendition.hooks.content.register(this.overrides.bind(this))}register(){if(arguments.length!==0){if(arguments.length===1&&typeof arguments[0]=="object")return this.registerThemes(arguments[0]);if(arguments.length===1&&typeof arguments[0]=="string")return this.default(arguments[0]);if(arguments.length===2&&typeof arguments[1]=="string")return this.registerUrl(arguments[0],arguments[1]);if(arguments.length===2&&typeof arguments[1]=="object")return this.registerRules(arguments[0],arguments[1])}}default(e){if(!!e){if(typeof e=="string")return this.registerUrl("default",e);if(typeof e=="object")return this.registerRules("default",e)}}registerThemes(e){for(var t in e)e.hasOwnProperty(t)&&(typeof e[t]=="string"?this.registerUrl(t,e[t]):this.registerRules(t,e[t]))}registerCss(e,t){this._themes[e]={serialized:t},(this._injected[e]||e=="default")&&this.update(e)}registerUrl(e,t){var i=new dg.default(t);this._themes[e]={url:i.toString()},(this._injected[e]||e=="default")&&this.update(e)}registerRules(e,t){this._themes[e]={rules:t},(this._injected[e]||e=="default")&&this.update(e)}select(e){var t=this._current,i;this._current=e,this.update(e),i=this.rendition.getContents(),i.forEach(n=>{n.removeClass(t),n.addClass(e)})}update(e){var t=this.rendition.getContents();t.forEach(i=>{this.add(e,i)})}inject(e){var t=[],i=this._themes,n;for(var s in i)i.hasOwnProperty(s)&&(s===this._current||s==="default")&&(n=i[s],(n.rules&&Object.keys(n.rules).length>0||n.url&&t.indexOf(n.url)===-1)&&this.add(s,e),this._injected.push(s));this._current!="default"&&e.addClass(this._current)}add(e,t){var i=this._themes[e];!i||!t||(i.url?t.addStylesheet(i.url):i.serialized?(t.addStylesheetCss(i.serialized,e),i.injected=!0):i.rules&&(t.addStylesheetRules(i.rules,e),i.injected=!0))}override(e,t,i){var n=this.rendition.getContents();this._overrides[e]={value:t,priority:i===!0},n.forEach(s=>{s.css(e,this._overrides[e].value,this._overrides[e].priority)})}removeOverride(e){var t=this.rendition.getContents();delete this._overrides[e],t.forEach(i=>{i.css(e)})}overrides(e){var t=this._overrides;for(var i in t)t.hasOwnProperty(i)&&e.css(i,t[i].value,t[i].priority)}fontSize(e){this.override("font-size",e)}font(e){this.override("font-family",e,!0)}destroy(){this.rendition=void 0,this._themes=void 0,this._overrides=void 0,this._current=void 0,this._injected=void 0}},vg=Jh;jn.default=vg});var Da=$(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.default=void 0;var Vn=gg(_t()),ef=Ie();function gg(r){return r&&r.__esModule?r:{default:r}}var tf=class{constructor(e,t,i,n=!1){this.layout=e,this.horizontal=i==="horizontal",this.direction=t||"ltr",this._dev=n}section(e){var t=this.findRanges(e),i=this.rangeListToCfiList(e.section.cfiBase,t);return i}page(e,t,i,n){var s=e&&e.document?e.document.body:!1,a;if(!!s){if(a=this.rangePairToCfiPair(t,{start:this.findStart(s,i,n),end:this.findEnd(s,i,n)}),this._dev===!0){let o=e.document,l=new Vn.default(a.start).toRange(o),u=new Vn.default(a.end).toRange(o),f=o.defaultView.getSelection(),d=o.createRange();f.removeAllRanges(),d.setStart(l.startContainer,l.startOffset),d.setEnd(u.endContainer,u.endOffset),f.addRange(d)}return a}}walk(e,t){if(!(e&&e.nodeType===Node.TEXT_NODE)){var i={acceptNode:function(l){return l.data.trim().length>0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}},n=i.acceptNode;n.acceptNode=i.acceptNode;for(var s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,n,!1),a,o;(a=s.nextNode())&&(o=t(a),!o););return o}}findRanges(e){for(var t=[],i=e.contents.scrollWidth(),n=Math.ceil(i/this.layout.spreadWidth),s=n*this.layout.divisor,a=this.layout.columnWidth,o=this.layout.gap,l,u,f=0;f{var u,f,d,c,v,g;if(v=(0,ef.nodeBounds)(l),this.horizontal&&this.direction==="ltr"){if(u=this.horizontal?v.left:v.top,f=this.horizontal?v.right:v.bottom,u>=t&&u<=i)return l;if(f>t)return l;o=l,n.push(l)}else if(this.horizontal&&this.direction==="rtl"){if(u=v.left,f=v.right,f<=i&&f>=t)return l;if(u=t&&d<=i)return l;if(c>t)return l;o=l,n.push(l)}}),a)return this.findTextStartRange(a,t,i);return this.findTextStartRange(o,t,i)}findEnd(e,t,i){for(var n=[e],s,a=e,o;n.length;)if(s=n.shift(),o=this.walk(s,l=>{var u,f,d,c,v,g;if(v=(0,ef.nodeBounds)(l),this.horizontal&&this.direction==="ltr"){if(u=Math.round(v.left),f=Math.round(v.right),u>i&&a)return a;if(f>i)return l;a=l,n.push(l)}else if(this.horizontal&&this.direction==="rtl"){if(u=Math.round(this.horizontal?v.left:v.top),f=Math.round(this.horizontal?v.right:v.bottom),fi&&a)return a;if(c>i)return l;a=l,n.push(l)}}),o)return this.findTextEndRange(o,t,i);return this.findTextEndRange(a,t,i)}findTextStartRange(e,t,i){for(var n=this.splitTextNodeIntoRanges(e),s,a,o,l,u,f=0;f=t)return s}else if(this.horizontal&&this.direction==="rtl"){if(u=a.right,u<=i)return s}else if(l=a.top,l>=t)return s;return n[0]}findTextEndRange(e,t,i){for(var n=this.splitTextNodeIntoRanges(e),s,a,o,l,u,f,d,c=0;ci&&s)return s;if(u>i)return a}else if(this.horizontal&&this.direction==="rtl"){if(l=o.left,u=o.right,ui&&s)return s;if(d>i)return a}s=a}return n[n.length-1]}splitTextNodeIntoRanges(e,t){var i=[],n=e.textContent||"",s=n.trim(),a,o=e.ownerDocument,l=t||" ",u=s.indexOf(l);if(u===-1||e.nodeType!=Node.TEXT_NODE)return a=o.createRange(),a.selectNodeContents(e),[a];for(a=o.createRange(),a.setStart(e,0),a.setEnd(e,u),i.push(a),a=!1;u!=-1;)u=s.indexOf(l,u+1),u>0&&(a&&(a.setEnd(e,u),i.push(a)),a=o.createRange(),a.setStart(e,u+1));return a&&(a.setEnd(e,s.length),i.push(a)),i}rangePairToCfiPair(e,t){var i=t.start,n=t.end;i.collapse(!0),n.collapse(!1);let s=new Vn.default(i,e).toString(),a=new Vn.default(n,e).toString();return{start:s,end:a}}rangeListToCfiList(e,t){for(var i=[],n,s=0;s{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.default=void 0;var _g=Pa(Ft()),Wt=Ie(),Gi=Pa(_t()),rf=Pa(Da()),yg=Dr(),ti=Ct();function Pa(r){return r&&r.__esModule?r:{default:r}}var nf=typeof navigator!="undefined",bg=nf&&/Chrome/.test(navigator.userAgent),sf=nf&&!bg&&/AppleWebKit/.test(navigator.userAgent),wg=1,La=class{constructor(e,t,i,n){this.epubcfi=new Gi.default,this.document=e,this.documentElement=this.document.documentElement,this.content=t||this.document.body,this.window=this.document.defaultView,this._size={width:0,height:0},this.sectionIndex=n||0,this.cfiBase=i||"",this.epubReadingSystem("epub.js",ti.EPUBJS_VERSION),this.called=0,this.active=!0,this.listeners()}static get listenedEvents(){return ti.DOM_EVENTS}width(e){var t=this.content;return e&&(0,Wt.isNumber)(e)&&(e=e+"px"),e&&(t.style.width=e),parseInt(this.window.getComputedStyle(t).width)}height(e){var t=this.content;return e&&(0,Wt.isNumber)(e)&&(e=e+"px"),e&&(t.style.height=e),parseInt(this.window.getComputedStyle(t).height)}contentWidth(e){var t=this.content||this.document.body;return e&&(0,Wt.isNumber)(e)&&(e=e+"px"),e&&(t.style.width=e),parseInt(this.window.getComputedStyle(t).width)}contentHeight(e){var t=this.content||this.document.body;return e&&(0,Wt.isNumber)(e)&&(e=e+"px"),e&&(t.style.height=e),parseInt(this.window.getComputedStyle(t).height)}textWidth(){let e,t,i=this.document.createRange(),n=this.content||this.document.body,s=(0,Wt.borders)(n);return i.selectNodeContents(n),e=i.getBoundingClientRect(),t=e.width,s&&s.width&&(t+=s.width),Math.round(t)}textHeight(){let e,t,i=this.document.createRange(),n=this.content||this.document.body;return i.selectNodeContents(n),e=i.getBoundingClientRect(),t=e.bottom,Math.round(t)}scrollWidth(){var e=this.documentElement.scrollWidth;return e}scrollHeight(){var e=this.documentElement.scrollHeight;return e}overflow(e){return e&&(this.documentElement.style.overflow=e),this.window.getComputedStyle(this.documentElement).overflow}overflowX(e){return e&&(this.documentElement.style.overflowX=e),this.window.getComputedStyle(this.documentElement).overflowX}overflowY(e){return e&&(this.documentElement.style.overflowY=e),this.window.getComputedStyle(this.documentElement).overflowY}css(e,t,i){var n=this.content||this.document.body;return t?n.style.setProperty(e,t,i?"important":""):n.style.removeProperty(e),this.window.getComputedStyle(n)[e]}viewport(e){var t,i,n,s,a,o,l=this.document.querySelector("meta[name='viewport']"),u={width:void 0,height:void 0,scale:void 0,minimum:void 0,maximum:void 0,scalable:void 0},f=[],d={};if(l&&l.hasAttribute("content")){let c=l.getAttribute("content"),v=c.match(/width\s*=\s*([^,]*)/),g=c.match(/height\s*=\s*([^,]*)/),O=c.match(/initial-scale\s*=\s*([^,]*)/),k=c.match(/minimum-scale\s*=\s*([^,]*)/),_=c.match(/maximum-scale\s*=\s*([^,]*)/),p=c.match(/user-scalable\s*=\s*([^,]*)/);v&&v.length&&typeof v[1]!="undefined"&&(u.width=v[1]),g&&g.length&&typeof g[1]!="undefined"&&(u.height=g[1]),O&&O.length&&typeof O[1]!="undefined"&&(u.scale=O[1]),k&&k.length&&typeof k[1]!="undefined"&&(u.minimum=k[1]),_&&_.length&&typeof _[1]!="undefined"&&(u.maximum=_[1]),p&&p.length&&typeof p[1]!="undefined"&&(u.scalable=p[1])}return d=(0,Wt.defaults)(e||{},u),e&&(d.width&&f.push("width="+d.width),d.height&&f.push("height="+d.height),d.scale&&f.push("initial-scale="+d.scale),d.scalable==="no"?(f.push("minimum-scale="+d.scale),f.push("maximum-scale="+d.scale),f.push("user-scalable="+d.scalable)):(d.scalable&&f.push("user-scalable="+d.scalable),d.minimum&&f.push("minimum-scale="+d.minimum),d.maximum&&f.push("minimum-scale="+d.maximum)),l||(l=this.document.createElement("meta"),l.setAttribute("name","viewport"),this.document.querySelector("head").appendChild(l)),l.setAttribute("content",f.join(", ")),this.window.scrollTo(0,0)),d}expand(){this.emit(ti.EVENTS.CONTENTS.EXPAND)}listeners(){this.imageLoadListeners(),this.mediaQueryListeners(),this.addEventListeners(),this.addSelectionListeners(),typeof ResizeObserver=="undefined"?(this.resizeListeners(),this.visibilityListeners()):this.resizeObservers(),this.linksHandler()}removeListeners(){this.removeEventListeners(),this.removeSelectionListeners(),this.observer&&this.observer.disconnect(),clearTimeout(this.expanding)}resizeCheck(){let e=this.textWidth(),t=this.textHeight();(e!=this._size.width||t!=this._size.height)&&(this._size={width:e,height:t},this.onResize&&this.onResize(this._size),this.emit(ti.EVENTS.CONTENTS.RESIZE,this._size))}resizeListeners(){var e,t;clearTimeout(this.expanding),requestAnimationFrame(this.resizeCheck.bind(this)),this.expanding=setTimeout(this.resizeListeners.bind(this),350)}visibilityListeners(){document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.active===!1?(this.active=!0,this.resizeListeners()):(this.active=!1,clearTimeout(this.expanding))})}transitionListeners(){let e=this.content;e.style.transitionProperty="font, font-size, font-size-adjust, font-stretch, font-variation-settings, font-weight, width, height",e.style.transitionDuration="0.001ms",e.style.transitionTimingFunction="linear",e.style.transitionDelay="0",this._resizeCheck=this.resizeCheck.bind(this),this.document.addEventListener("transitionend",this._resizeCheck)}mediaQueryListeners(){for(var e=this.document.styleSheets,t=function(o){o.matches&&!this._expanding&&setTimeout(this.expand.bind(this),1)}.bind(this),i=0;i{requestAnimationFrame(this.resizeCheck.bind(this))}),this.observer.observe(this.document.documentElement)}mutationObservers(){this.observer=new MutationObserver(t=>{this.resizeCheck()});let e={attributes:!0,childList:!0,characterData:!0,subtree:!0};this.observer.observe(this.document,e)}imageLoadListeners(){for(var e=this.document.querySelectorAll("img"),t,i=0;i0?(o.setStart(a,s.startOffset-2),o.setEnd(a,s.startOffset),i=o.getBoundingClientRect()):i=a.parentNode.getBoundingClientRect()}catch(l){console.error(l,l.stack)}}else i=s.getBoundingClientRect()}}else if(typeof e=="string"&&e.indexOf("#")>-1){let s=e.substring(e.indexOf("#")+1),a=this.document.getElementById(s);if(a)if(sf){let o=new Range;o.selectNode(a),i=o.getBoundingClientRect()}else i=a.getBoundingClientRect()}return i&&(n.left=i.left,n.top=i.top),n}addStylesheet(e){return new Promise(function(t,i){var n,s=!1;if(!this.document){t(!1);return}if(n=this.document.querySelector("link[href='"+e+"']"),n){t(!0);return}n=this.document.createElement("link"),n.type="text/css",n.rel="stylesheet",n.href=e,n.onload=n.onreadystatechange=function(){!s&&(!this.readyState||this.readyState=="complete")&&(s=!0,setTimeout(()=>{t(!0)},1))},this.document.head.appendChild(n)}.bind(this))}_getStylesheetNode(e){var t;return e="epubjs-inserted-css-"+(e||""),this.document?(t=this.document.getElementById(e),t||(t=this.document.createElement("style"),t.id=e,this.document.head.appendChild(t)),t):!1}addStylesheetCss(e,t){if(!this.document||!e)return!1;var i;return i=this._getStylesheetNode(t),i.innerHTML=e,!0}addStylesheetRules(e,t){var i;if(!(!this.document||!e||e.length===0))if(i=this._getStylesheetNode(t).sheet,Object.prototype.toString.call(e)==="[object Array]")for(var n=0,s=e.length;n{let g=e[v];if(Array.isArray(g))g.forEach(O=>{let _=Object.keys(O).map(p=>`${p}:${O[p]}`).join(";");i.insertRule(`${v}{${_}}`,i.cssRules.length)});else{let k=Object.keys(g).map(_=>`${_}:${g[_]}`).join(";");i.insertRule(`${v}{${k}}`,i.cssRules.length)}})}addScript(e){return new Promise(function(t,i){var n,s=!1;if(!this.document){t(!1);return}n=this.document.createElement("script"),n.type="text/javascript",n.async=!0,n.src=e,n.onload=n.onreadystatechange=function(){!s&&(!this.readyState||this.readyState=="complete")&&(s=!0,setTimeout(function(){t(!0)},1))},this.document.head.appendChild(n)}.bind(this))}addClass(e){var t;!this.document||(t=this.content||this.document.body,t&&t.classList.add(e))}removeClass(e){var t;!this.document||(t=this.content||this.document.body,t&&t.classList.remove(e))}addEventListeners(){!this.document||(this._triggerEvent=this.triggerEvent.bind(this),ti.DOM_EVENTS.forEach(function(e){this.document.addEventListener(e,this._triggerEvent,{passive:!0})},this))}removeEventListeners(){!this.document||(ti.DOM_EVENTS.forEach(function(e){this.document.removeEventListener(e,this._triggerEvent,{passive:!0})},this),this._triggerEvent=void 0)}triggerEvent(e){this.emit(e.type,e)}addSelectionListeners(){!this.document||(this._onSelectionChange=this.onSelectionChange.bind(this),this.document.addEventListener("selectionchange",this._onSelectionChange,{passive:!0}))}removeSelectionListeners(){!this.document||(this.document.removeEventListener("selectionchange",this._onSelectionChange,{passive:!0}),this._onSelectionChange=void 0)}onSelectionChange(e){this.selectionEndTimeout&&clearTimeout(this.selectionEndTimeout),this.selectionEndTimeout=setTimeout(function(){var t=this.window.getSelection();this.triggerSelectedEvent(t)}.bind(this),250)}triggerSelectedEvent(e){var t,i;e&&e.rangeCount>0&&(t=e.getRangeAt(0),t.collapsed||(i=new Gi.default(t,this.cfiBase).toString(),this.emit(ti.EVENTS.CONTENTS.SELECTED,i),this.emit(ti.EVENTS.CONTENTS.SELECTED_RANGE,t)))}range(e,t){var i=new Gi.default(e);return i.toRange(this.document,t)}cfiFromRange(e,t){return new Gi.default(e,this.cfiBase,t).toString()}cfiFromNode(e,t){return new Gi.default(e,this.cfiBase,t).toString()}map(e){var t=new rf.default(e);return t.section()}size(e,t){var i={scale:1,scalable:"no"};this.layoutStyle("scrolling"),e>=0&&(this.width(e),i.width=e,this.css("padding","0 "+e/12+"px")),t>=0&&(this.height(t),i.height=t),this.css("margin","0"),this.css("box-sizing","border-box"),this.viewport(i)}columns(e,t,i,n,s){let a=(0,Wt.prefixed)("column-axis"),o=(0,Wt.prefixed)("column-gap"),l=(0,Wt.prefixed)("column-width"),u=(0,Wt.prefixed)("column-fill"),d=this.writingMode().indexOf("vertical")===0?"vertical":"horizontal";this.layoutStyle("paginated"),s==="rtl"&&d==="horizontal"&&this.direction(s),this.width(e),this.height(t),this.viewport({width:e,height:t,scale:1,scalable:"no"}),this.css("overflow-y","hidden"),this.css("margin","0",!0),d==="vertical"?(this.css("padding-top",n/2+"px",!0),this.css("padding-bottom",n/2+"px",!0),this.css("padding-left","20px"),this.css("padding-right","20px"),this.css(a,"vertical")):(this.css("padding-top","20px"),this.css("padding-bottom","20px"),this.css("padding-left",n/2+"px",!0),this.css("padding-right",n/2+"px",!0),this.css(a,"horizontal")),this.css("box-sizing","border-box"),this.css("max-width","inherit"),this.css(u,"auto"),this.css(o,n+"px"),this.css(l,i+"px"),this.css("-webkit-line-box-contain","block glyphs replaced")}scaler(e,t,i){var n="scale("+e+")",s="";this.css("transform-origin","top left"),(t>=0||i>=0)&&(s=" translate("+(t||0)+"px, "+(i||0)+"px )"),this.css("transform",n+s)}fit(e,t,i){var n=this.viewport(),s=parseInt(n.width),a=parseInt(n.height),o=e/s,l=t/a,u=o{this.emit(ti.EVENTS.CONTENTS.LINK_CLICKED,e)})}writingMode(e){let t=(0,Wt.prefixed)("writing-mode");return e&&this.documentElement&&(this.documentElement.style[t]=e),this.window.getComputedStyle(this.documentElement)[t]||""}layoutStyle(e){return e&&(this._layoutStyle=e,navigator.epubReadingSystem.layoutStyle=this._layoutStyle),this._layoutStyle||"paginated"}epubReadingSystem(e,t){return navigator.epubReadingSystem={name:e,version:t,layoutStyle:this.layoutStyle(),hasFeature:function(i){switch(i){case"dom-manipulation":return!0;case"layout-changes":return!0;case"touch-events":return!0;case"mouse-events":return!0;case"keyboard-events":return!0;case"spine-scripting":return!1;default:return!1}}},navigator.epubReadingSystem}destroy(){this.removeListeners()}};(0,_g.default)(La.prototype);var Eg=La;Zn.default=Eg});var uf=$(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.default=void 0;var xg=of(Ft()),Sg=of(_t()),af=Ct();function of(r){return r&&r.__esModule?r:{default:r}}var lf=class{constructor(e){this.rendition=e,this.highlights=[],this.underlines=[],this.marks=[],this._annotations={},this._annotationsBySectionIndex={},this.rendition.hooks.render.register(this.inject.bind(this)),this.rendition.hooks.unloaded.register(this.clear.bind(this))}add(e,t,i,n,s,a){let o=encodeURI(t+e),u=new Sg.default(t).spinePos,f=new za({type:e,cfiRange:t,data:i,sectionIndex:u,cb:n,className:s,styles:a});return this._annotations[o]=f,u in this._annotationsBySectionIndex?this._annotationsBySectionIndex[u].push(o):this._annotationsBySectionIndex[u]=[o],this.rendition.views().forEach(c=>{f.sectionIndex===c.index&&f.attach(c)}),f}remove(e,t){let i=encodeURI(e+t);if(i in this._annotations){let n=this._annotations[i];if(t&&n.type!==t)return;this.rendition.views().forEach(a=>{this._removeFromAnnotationBySectionIndex(n.sectionIndex,i),n.sectionIndex===a.index&&n.detach(a)}),delete this._annotations[i]}}_removeFromAnnotationBySectionIndex(e,t){this._annotationsBySectionIndex[e]=this._annotationsAt(e).filter(i=>i!==t)}_annotationsAt(e){return this._annotationsBySectionIndex[e]}highlight(e,t,i,n,s){return this.add("highlight",e,t,i,n,s)}underline(e,t,i,n,s){return this.add("underline",e,t,i,n,s)}mark(e,t,i){return this.add("mark",e,t,i)}each(){return this._annotations.forEach.apply(this._annotations,arguments)}inject(e){let t=e.index;t in this._annotationsBySectionIndex&&this._annotationsBySectionIndex[t].forEach(n=>{this._annotations[n].attach(e)})}clear(e){let t=e.index;t in this._annotationsBySectionIndex&&this._annotationsBySectionIndex[t].forEach(n=>{this._annotations[n].detach(e)})}show(){}hide(){}},za=class{constructor({type:e,cfiRange:t,data:i,sectionIndex:n,cb:s,className:a,styles:o}){this.type=e,this.cfiRange=t,this.data=i,this.sectionIndex=n,this.mark=void 0,this.cb=s,this.className=a,this.styles=o}update(e){this.data=e}attach(e){let{cfiRange:t,data:i,type:n,mark:s,cb:a,className:o,styles:l}=this,u;return n==="highlight"?u=e.highlight(t,i,a,o,l):n==="underline"?u=e.underline(t,i,a,o,l):n==="mark"&&(u=e.mark(t,i,a)),this.mark=u,this.emit(af.EVENTS.ANNOTATION.ATTACH,u),u}detach(e){let{cfiRange:t,type:i}=this,n;return e&&(i==="highlight"?n=e.unhighlight(t):i==="underline"?n=e.ununderline(t):i==="mark"&&(n=e.unmark(t))),this.mark=void 0,this.emit(af.EVENTS.ANNOTATION.DETACH,n),n}text(){}};(0,xg.default)(za.prototype);var Tg=lf;Xn.default=Tg});var ff=$(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.createElement=hf;function hf(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}Yn.default={createElement:hf}});var pf=$(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.proxyMouse=cf;Br.clone=df;Br.default={proxyMouse:cf};function cf(r,e){function t(a){for(var o=e.length-1;o>=0;o--){var l=e[o],u=a.clientX,f=a.clientY;if(a.touches&&a.touches.length&&(u=a.touches[0].clientX,f=a.touches[0].clientY),!!kg(l,r,u,f)){l.dispatchEvent(df(a));break}}}if(r.nodeName==="iframe"||r.nodeName==="IFRAME")try{this.target=r.contentDocument}catch(a){this.target=r}else this.target=r;for(var i=["mouseup","mousedown","click","touchstart"],n=0;nc&&k>d}var a=r.getBoundingClientRect();if(!s(a,t,i))return!1;for(var o=r.getClientRects(),l=0,u=o.length;l{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.Underline=Yt.Highlight=Yt.Mark=Yt.Pane=void 0;var Og=function r(e,t,i){e===null&&(e=Function.prototype);var n=Object.getOwnPropertyDescriptor(e,t);if(n===void 0){var s=Object.getPrototypeOf(e);return s===null?void 0:r(s,t,i)}else{if("value"in n)return n.value;var a=n.get;return a===void 0?void 0:a.call(i)}},Gn=function(){function r(e,t){for(var i=0;i1&&arguments[1]!==void 0?arguments[1]:document.body;$n(this,r),this.target=e,this.element=Ur.default.createElement("svg"),this.marks=[],this.element.style.position="absolute",this.element.setAttribute("pointer-events","none"),Rg.default.proxyMouse(this.target,this.marks),this.container=t,this.container.appendChild(this.element),this.render()}return Gn(r,[{key:"addMark",value:function(t){var i=Ur.default.createElement("g");return this.element.appendChild(i),t.bind(i,this.container),this.marks.push(t),t.render(),t}},{key:"removeMark",value:function(t){var i=this.marks.indexOf(t);if(i!==-1){var n=t.unbind();this.element.removeChild(n),this.marks.splice(i,1)}}},{key:"render",value:function(){Pg(this.element,Dg(this.target,this.container));var t=!0,i=!1,n=void 0;try{for(var s=this.marks[Symbol.iterator](),a;!(t=(a=s.next()).done);t=!0){var o=a.value;o.render()}}catch(l){i=!0,n=l}finally{try{!t&&s.return&&s.return()}finally{if(i)throw n}}}}]),r}(),Ag=Yt.Mark=function(){function r(){$n(this,r),this.element=null}return Gn(r,[{key:"bind",value:function(t,i){this.element=t,this.container=i}},{key:"unbind",value:function(){var t=this.element;return this.element=null,t}},{key:"render",value:function(){}},{key:"dispatchEvent",value:function(t){!this.element||this.element.dispatchEvent(t)}},{key:"getBoundingClientRect",value:function(){return this.element.getBoundingClientRect()}},{key:"getClientRects",value:function(){for(var t=[],i=this.element.firstChild;i;)t.push(i.getBoundingClientRect()),i=i.nextSibling;return t}},{key:"filteredRanges",value:function(){var t=Array.from(this.range.getClientRects());return t.filter(function(i){for(var n=0;n=r.left&&e.top>=r.top&&e.bottom<=r.bottom}});var Ua=$(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.default=void 0;var zg=Ma(Ft()),it=Ie(),Mg=Ma(_t()),Bg=Ma(Mr()),bt=Ct(),Kn=_f();function Ma(r){return r&&r.__esModule?r:{default:r}}var Ba=class{constructor(e,t){this.settings=(0,it.extend)({ignoreClass:"",axis:void 0,direction:void 0,width:0,height:0,layout:void 0,globalLayoutProperties:{},method:void 0,forceRight:!1,allowScriptedContent:!1,allowPopups:!1},t||{}),this.id="epubjs-view-"+(0,it.uuid)(),this.section=e,this.index=e.index,this.element=this.container(this.settings.axis),this.added=!1,this.displayed=!1,this.rendered=!1,this.fixedWidth=0,this.fixedHeight=0,this.epubcfi=new Mg.default,this.layout=this.settings.layout,this.pane=void 0,this.highlights={},this.underlines={},this.marks={}}container(e){var t=document.createElement("div");return t.classList.add("epub-view"),t.style.height="0px",t.style.width="0px",t.style.overflow="hidden",t.style.position="relative",t.style.display="block",e&&e=="horizontal"?t.style.flex="none":t.style.flex="initial",t}create(){return this.iframe?this.iframe:(this.element||(this.element=this.createContainer()),this.iframe=document.createElement("iframe"),this.iframe.id=this.id,this.iframe.scrolling="no",this.iframe.style.overflow="hidden",this.iframe.seamless="seamless",this.iframe.style.border="none",this.iframe.sandbox="allow-same-origin",this.settings.allowScriptedContent&&(this.iframe.sandbox+=" allow-scripts"),this.settings.allowPopups&&(this.iframe.sandbox+=" allow-popups"),this.iframe.setAttribute("enable-annotation","true"),this.resizing=!0,this.element.style.visibility="hidden",this.iframe.style.visibility="hidden",this.iframe.style.width="0",this.iframe.style.height="0",this._width=0,this._height=0,this.element.setAttribute("ref",this.index),this.added=!0,this.elementBounds=(0,it.bounds)(this.element),"srcdoc"in this.iframe?this.supportsSrcdoc=!0:this.supportsSrcdoc=!1,this.settings.method||(this.settings.method=this.supportsSrcdoc?"srcdoc":"write"),this.iframe)}render(e,t){return this.create(),this.size(),this.sectionRender||(this.sectionRender=this.section.render(e)),this.sectionRender.then(function(i){return this.load(i)}.bind(this)).then(function(){let i=this.contents.writingMode(),n;return this.settings.flow==="scrolled"?n=i.indexOf("vertical")===0?"horizontal":"vertical":n=i.indexOf("vertical")===0?"vertical":"horizontal",i.indexOf("vertical")===0&&this.settings.flow==="paginated"&&(this.layout.delta=this.layout.height),this.setAxis(n),this.emit(bt.EVENTS.VIEWS.AXIS,n),this.setWritingMode(i),this.emit(bt.EVENTS.VIEWS.WRITING_MODE,i),this.layout.format(this.contents,this.section,this.axis),this.addListeners(),new Promise((s,a)=>{this.expand(),this.settings.forceRight&&(this.element.style.marginLeft=this.width()+"px"),s()})}.bind(this),function(i){return this.emit(bt.EVENTS.VIEWS.LOAD_ERROR,i),new Promise((n,s)=>{s(i)})}.bind(this)).then(function(){this.emit(bt.EVENTS.VIEWS.RENDERED,this.section)}.bind(this))}reset(){this.iframe&&(this.iframe.style.width="0",this.iframe.style.height="0",this._width=0,this._height=0,this._textWidth=void 0,this._contentWidth=void 0,this._textHeight=void 0,this._contentHeight=void 0),this._needsReframe=!0}size(e,t){var i=e||this.settings.width,n=t||this.settings.height;this.layout.name==="pre-paginated"?this.lock("both",i,n):this.settings.axis==="horizontal"?this.lock("height",i,n):this.lock("width",i,n),this.settings.width=i,this.settings.height=n}lock(e,t,i){var n=(0,it.borders)(this.element),s;this.iframe?s=(0,it.borders)(this.iframe):s={width:0,height:0},e=="width"&&(0,it.isNumber)(t)&&(this.lockedWidth=t-n.width-s.width),e=="height"&&(0,it.isNumber)(i)&&(this.lockedHeight=i-n.height-s.height),e==="both"&&(0,it.isNumber)(t)&&(0,it.isNumber)(i)&&(this.lockedWidth=t-n.width-s.width,this.lockedHeight=i-n.height-s.height),this.displayed&&this.iframe&&this.expand()}expand(e){var t=this.lockedWidth,i=this.lockedHeight,n,s,a;!this.iframe||this._expanding||(this._expanding=!0,this.layout.name==="pre-paginated"?(t=this.layout.columnWidth,i=this.layout.height):this.settings.axis==="horizontal"?(t=this.contents.textWidth(),t%this.layout.pageWidth>0&&(t=Math.ceil(t/this.layout.pageWidth)*this.layout.pageWidth),this.settings.forceEvenPages&&(n=t/this.layout.pageWidth,this.layout.divisor>1&&this.layout.name==="reflowable"&&n%2>0&&(t+=this.layout.pageWidth))):this.settings.axis==="vertical"&&(i=this.contents.textHeight(),this.settings.flow==="paginated"&&i%this.layout.height>0&&(i=Math.ceil(i/this.layout.height)*this.layout.height)),(this._needsReframe||t!=this._width||i!=this._height)&&this.reframe(t,i),this._expanding=!1)}reframe(e,t){var i;(0,it.isNumber)(e)&&(this.element.style.width=e+"px",this.iframe.style.width=e+"px",this._width=e),(0,it.isNumber)(t)&&(this.element.style.height=t+"px",this.iframe.style.height=t+"px",this._height=t);let n=this.prevBounds?e-this.prevBounds.width:e,s=this.prevBounds?t-this.prevBounds.height:t;i={width:e,height:t,widthDelta:n,heightDelta:s},this.pane&&this.pane.render(),requestAnimationFrame(()=>{let a;for(let o in this.marks)this.marks.hasOwnProperty(o)&&(a=this.marks[o],this.placeMark(a.element,a.range))}),this.onResize(this,i),this.emit(bt.EVENTS.VIEWS.RESIZED,i),this.prevBounds=i,this.elementBounds=(0,it.bounds)(this.element)}load(e){var t=new it.defer,i=t.promise;if(!this.iframe)return t.reject(new Error("No Iframe Available")),i;if(this.iframe.onload=function(s){this.onLoad(s,t)}.bind(this),this.settings.method==="blobUrl")this.blobUrl=(0,it.createBlobUrl)(e,"application/xhtml+xml"),this.iframe.src=this.blobUrl,this.element.appendChild(this.iframe);else if(this.settings.method==="srcdoc")this.iframe.srcdoc=e,this.element.appendChild(this.iframe);else{if(this.element.appendChild(this.iframe),this.document=this.iframe.contentDocument,!this.document)return t.reject(new Error("No Document Available")),i;if(this.iframe.contentDocument.open(),window.MSApp&&MSApp.execUnsafeLocalFunction){var n=this;MSApp.execUnsafeLocalFunction(function(){n.iframe.contentDocument.write(e)})}else this.iframe.contentDocument.write(e);this.iframe.contentDocument.close()}return i}onLoad(e,t){this.window=this.iframe.contentWindow,this.document=this.iframe.contentDocument,this.contents=new Bg.default(this.document,this.document.body,this.section.cfiBase,this.section.index),this.rendering=!1;var i=this.document.querySelector("link[rel='canonical']");i?i.setAttribute("href",this.section.canonical):(i=this.document.createElement("link"),i.setAttribute("rel","canonical"),i.setAttribute("href",this.section.canonical),this.document.querySelector("head").appendChild(i)),this.contents.on(bt.EVENTS.CONTENTS.EXPAND,()=>{this.displayed&&this.iframe&&(this.expand(),this.contents&&this.layout.format(this.contents))}),this.contents.on(bt.EVENTS.CONTENTS.RESIZE,n=>{this.displayed&&this.iframe&&(this.expand(),this.contents&&this.layout.format(this.contents))}),t.resolve(this.contents)}setLayout(e){this.layout=e,this.contents&&(this.layout.format(this.contents),this.expand())}setAxis(e){this.settings.axis=e,e=="horizontal"?this.element.style.flex="none":this.element.style.flex="initial",this.size()}setWritingMode(e){this.writingMode=e}addListeners(){}removeListeners(e){}display(e){var t=new it.defer;return this.displayed?t.resolve(this):this.render(e).then(function(){this.emit(bt.EVENTS.VIEWS.DISPLAYED,this),this.onDisplayed(this),this.displayed=!0,t.resolve(this)}.bind(this),function(i){t.reject(i,this)}),t.promise}show(){this.element.style.visibility="visible",this.iframe&&(this.iframe.style.visibility="visible",this.iframe.style.transform="translateZ(0)",this.iframe.offsetWidth,this.iframe.style.transform=null),this.emit(bt.EVENTS.VIEWS.SHOWN,this)}hide(){this.element.style.visibility="hidden",this.iframe.style.visibility="hidden",this.stopExpanding=!0,this.emit(bt.EVENTS.VIEWS.HIDDEN,this)}offset(){return{top:this.element.offsetTop,left:this.element.offsetLeft}}width(){return this._width}height(){return this._height}position(){return this.element.getBoundingClientRect()}locationOf(e){var t=this.iframe.getBoundingClientRect(),i=this.contents.locationOf(e,this.settings.ignoreClass);return{left:i.left,top:i.top}}onDisplayed(e){}onResize(e,t){}bounds(e){return(e||!this.elementBounds)&&(this.elementBounds=(0,it.bounds)(this.element)),this.elementBounds}highlight(e,t={},i,n="epubjs-hl",s={}){if(!this.contents)return;let a=Object.assign({fill:"yellow","fill-opacity":"0.3","mix-blend-mode":"multiply"},s),o=this.contents.range(e),l=()=>{this.emit(bt.EVENTS.VIEWS.MARK_CLICKED,e,t)};t.epubcfi=e,this.pane||(this.pane=new Kn.Pane(this.iframe,this.element));let u=new Kn.Highlight(o,n,t,a),f=this.pane.addMark(u);return this.highlights[e]={mark:f,element:f.element,listeners:[l,i]},f.element.setAttribute("ref",n),f.element.addEventListener("click",l),f.element.addEventListener("touchstart",l),i&&(f.element.addEventListener("click",i),f.element.addEventListener("touchstart",i)),f}underline(e,t={},i,n="epubjs-ul",s={}){if(!this.contents)return;let a=Object.assign({stroke:"black","stroke-opacity":"0.3","mix-blend-mode":"multiply"},s),o=this.contents.range(e),l=()=>{this.emit(bt.EVENTS.VIEWS.MARK_CLICKED,e,t)};t.epubcfi=e,this.pane||(this.pane=new Kn.Pane(this.iframe,this.element));let u=new Kn.Underline(o,n,t,a),f=this.pane.addMark(u);return this.underlines[e]={mark:f,element:f.element,listeners:[l,i]},f.element.setAttribute("ref",n),f.element.addEventListener("click",l),f.element.addEventListener("touchstart",l),i&&(f.element.addEventListener("click",i),f.element.addEventListener("touchstart",i)),f}mark(e,t={},i){if(!this.contents)return;if(e in this.marks)return this.marks[e];let n=this.contents.range(e);if(!n)return;let s=n.commonAncestorContainer,a=s.nodeType===1?s:s.parentNode,o=u=>{this.emit(bt.EVENTS.VIEWS.MARK_CLICKED,e,t)};n.collapsed&&s.nodeType===1?(n=new Range,n.selectNodeContents(s)):n.collapsed&&(n=new Range,n.selectNodeContents(a));let l=this.document.createElement("a");return l.setAttribute("ref","epubjs-mk"),l.style.position="absolute",l.dataset.epubcfi=e,t&&Object.keys(t).forEach(u=>{l.dataset[u]=t[u]}),i&&(l.addEventListener("click",i),l.addEventListener("touchstart",i)),l.addEventListener("click",o),l.addEventListener("touchstart",o),this.placeMark(l,n),this.element.appendChild(l),this.marks[e]={element:l,range:n,listeners:[o,i]},a}placeMark(e,t){let i,n,s;if(this.layout.name==="pre-paginated"||this.settings.axis!=="horizontal"){let o=t.getBoundingClientRect();i=o.top,n=o.right}else{let o=t.getClientRects(),l;for(var a=0;a!=o.length;a++)l=o[a],(!s||l.left{i&&(t.element.removeEventListener("click",i),t.element.removeEventListener("touchstart",i))}),delete this.highlights[e])}ununderline(e){let t;e in this.underlines&&(t=this.underlines[e],this.pane.removeMark(t.mark),t.listeners.forEach(i=>{i&&(t.element.removeEventListener("click",i),t.element.removeEventListener("touchstart",i))}),delete this.underlines[e])}unmark(e){let t;e in this.marks&&(t=this.marks[e],this.element.removeChild(t.element),t.listeners.forEach(i=>{i&&(t.element.removeEventListener("click",i),t.element.removeEventListener("touchstart",i))}),delete this.marks[e])}destroy(){for(let e in this.highlights)this.unhighlight(e);for(let e in this.underlines)this.ununderline(e);for(let e in this.marks)this.unmark(e);this.blobUrl&&(0,it.revokeBlobUrl)(this.blobUrl),this.displayed&&(this.displayed=!1,this.removeListeners(),this.contents.destroy(),this.stopExpanding=!0,this.element.removeChild(this.iframe),this.pane&&(this.pane.element.remove(),this.pane=void 0),this.iframe=void 0,this.contents=void 0,this._textWidth=null,this._textHeight=null,this._width=null,this._height=null)}};(0,zg.default)(Ba.prototype);var Ug=Ba;Jn.default=Ug});var bf=$(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.createDefiner=yf;Qn.default=Fg;function Fg(){var r="reverse",e=yf();return document.body.appendChild(e),e.scrollLeft>0?r="default":typeof Element!="undefined"&&Element.prototype.scrollIntoView?(e.children[0].children[1].scrollIntoView(),e.scrollLeft<0&&(r="negative")):(e.scrollLeft=1,e.scrollLeft===0&&(r="negative")),document.body.removeChild(e),r}function yf(){var r=document.createElement("div");r.dir="rtl",r.style.position="fixed",r.style.width="1px",r.style.height="1px",r.style.top="0px",r.style.left="0px",r.style.overflow="hidden";var e=document.createElement("div");e.style.width="2px";var t=document.createElement("span");t.style.width="1px",t.style.display="inline-block";var i=document.createElement("span");return i.style.width="1px",i.style.display="inline-block",e.appendChild(t),e.appendChild(i),r.appendChild(e),r}});var es=$((lb,wf)=>{function qg(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}wf.exports=qg});var xf=$((ub,Ef)=>{var Wg=typeof global=="object"&&global&&global.Object===Object&&global;Ef.exports=Wg});var Fa=$((hb,Sf)=>{var jg=xf(),Vg=typeof self=="object"&&self&&self.Object===Object&&self,Hg=jg||Vg||Function("return this")();Sf.exports=Hg});var kf=$((fb,Tf)=>{var Zg=Fa(),Xg=function(){return Zg.Date.now()};Tf.exports=Xg});var Cf=$((cb,Of)=>{var Yg=/\s/;function Gg(r){for(var e=r.length;e--&&Yg.test(r.charAt(e)););return e}Of.exports=Gg});var Rf=$((db,Nf)=>{var $g=Cf(),Kg=/^\s+/;function Jg(r){return r&&r.slice(0,$g(r)+1).replace(Kg,"")}Nf.exports=Jg});var qa=$((pb,Af)=>{var Qg=Fa(),em=Qg.Symbol;Af.exports=em});var Lf=$((vb,Pf)=>{var If=qa(),Df=Object.prototype,tm=Df.hasOwnProperty,im=Df.toString,Fr=If?If.toStringTag:void 0;function rm(r){var e=tm.call(r,Fr),t=r[Fr];try{r[Fr]=void 0;var i=!0}catch(s){}var n=im.call(r);return i&&(e?r[Fr]=t:delete r[Fr]),n}Pf.exports=rm});var Mf=$((gb,zf)=>{var nm=Object.prototype,sm=nm.toString;function am(r){return sm.call(r)}zf.exports=am});var qf=$((mb,Ff)=>{var Bf=qa(),om=Lf(),lm=Mf(),um="[object Null]",hm="[object Undefined]",Uf=Bf?Bf.toStringTag:void 0;function fm(r){return r==null?r===void 0?hm:um:Uf&&Uf in Object(r)?om(r):lm(r)}Ff.exports=fm});var jf=$((_b,Wf)=>{function cm(r){return r!=null&&typeof r=="object"}Wf.exports=cm});var Hf=$((yb,Vf)=>{var dm=qf(),pm=jf(),vm="[object Symbol]";function gm(r){return typeof r=="symbol"||pm(r)&&dm(r)==vm}Vf.exports=gm});var Gf=$((bb,Yf)=>{var mm=Rf(),Zf=es(),_m=Hf(),Xf=0/0,ym=/^[-+]0x[0-9a-f]+$/i,bm=/^0b[01]+$/i,wm=/^0o[0-7]+$/i,Em=parseInt;function xm(r){if(typeof r=="number")return r;if(_m(r))return Xf;if(Zf(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Zf(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=mm(r);var t=bm.test(r);return t||wm.test(r)?Em(r.slice(2),t?2:8):ym.test(r)?Xf:+r}Yf.exports=xm});var ja=$((wb,Kf)=>{var Sm=es(),Wa=kf(),$f=Gf(),Tm="Expected a function",km=Math.max,Om=Math.min;function Cm(r,e,t){var i,n,s,a,o,l,u=0,f=!1,d=!1,c=!0;if(typeof r!="function")throw new TypeError(Tm);e=$f(e)||0,Sm(t)&&(f=!!t.leading,d="maxWait"in t,s=d?km($f(t.maxWait)||0,e):s,c="trailing"in t?!!t.trailing:c);function v(w){var N=i,C=n;return i=n=void 0,u=w,a=r.apply(C,N),a}function g(w){return u=w,o=setTimeout(_,e),f?v(w):a}function O(w){var N=w-l,C=w-u,M=e-N;return d?Om(M,s-C):M}function k(w){var N=w-l,C=w-u;return l===void 0||N>=e||N<0||d&&C>=s}function _(){var w=Wa();if(k(w))return p(w);o=setTimeout(_,O(w))}function p(w){return o=void 0,c&&i?v(w):(i=n=void 0,a)}function y(){o!==void 0&&clearTimeout(o),u=0,i=l=n=o=void 0}function T(){return o===void 0?a:p(Wa())}function P(){var w=Wa(),N=k(w);if(i=arguments,n=this,l=w,N){if(o===void 0)return g(l);if(d)return clearTimeout(o),o=setTimeout(_,e),v(l)}return o===void 0&&(o=setTimeout(_,e)),a}return P.cancel=y,P.flush=T,P}Kf.exports=Cm});var Qf=$((Eb,Jf)=>{var Nm=ja(),Rm=es(),Am="Expected a function";function Im(r,e,t){var i=!0,n=!0;if(typeof r!="function")throw new TypeError(Am);return Rm(t)&&(i="leading"in t?!!t.leading:i,n="trailing"in t?!!t.trailing:n),Nm(r,e,{leading:i,maxWait:e,trailing:n})}Jf.exports=Im});var tc=$(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.default=void 0;var wt=Ie(),Dm=Pm(Qf());function Pm(r){return r&&r.__esModule?r:{default:r}}var ec=class{constructor(e){this.settings=e||{},this.id="epubjs-container-"+(0,wt.uuid)(),this.container=this.create(this.settings),this.settings.hidden&&(this.wrapper=this.wrap(this.container))}create(e){let t=e.height,i=e.width,n=e.overflow||!1,s=e.axis||"vertical",a=e.direction;(0,wt.extend)(this.settings,e),e.height&&(0,wt.isNumber)(e.height)&&(t=e.height+"px"),e.width&&(0,wt.isNumber)(e.width)&&(i=e.width+"px");let o=document.createElement("div");return o.id=this.id,o.classList.add("epub-container"),o.style.wordSpacing="0",o.style.lineHeight="0",o.style.verticalAlign="top",o.style.position="relative",s==="horizontal"&&(o.style.display="flex",o.style.flexDirection="row",o.style.flexWrap="nowrap"),i&&(o.style.width=i),t&&(o.style.height=t),n&&(n==="scroll"&&s==="vertical"?(o.style["overflow-y"]=n,o.style["overflow-x"]="hidden"):n==="scroll"&&s==="horizontal"?(o.style["overflow-y"]="hidden",o.style["overflow-x"]=n):o.style.overflow=n),a&&(o.dir=a,o.style.direction=a),a&&this.settings.fullsize&&(document.body.style.direction=a),o}wrap(e){var t=document.createElement("div");return t.style.visibility="hidden",t.style.overflow="hidden",t.style.width="0",t.style.height="0",t.appendChild(e),t}getElement(e){var t;if((0,wt.isElement)(e)?t=e:typeof e=="string"&&(t=document.getElementById(e)),!t)throw new Error("Not an Element");return t}attachTo(e){var t=this.getElement(e),i;if(!!t)return this.settings.hidden?i=this.wrapper:i=this.container,t.appendChild(i),this.element=t,t}getContainer(){return this.container}onResize(e){(!(0,wt.isNumber)(this.settings.width)||!(0,wt.isNumber)(this.settings.height))&&(this.resizeFunc=(0,Dm.default)(e,50),window.addEventListener("resize",this.resizeFunc,!1))}onOrientationChange(e){this.orientationChangeFunc=e,window.addEventListener("orientationchange",this.orientationChangeFunc,!1)}size(e,t){var i;let n=e||this.settings.width,s=t||this.settings.height;e===null?(i=this.element.getBoundingClientRect(),i.width&&(e=Math.floor(i.width),this.container.style.width=e+"px")):(0,wt.isNumber)(e)?this.container.style.width=e+"px":this.container.style.width=e,t===null?(i=i||this.element.getBoundingClientRect(),i.height&&(t=i.height,this.container.style.height=t+"px")):(0,wt.isNumber)(t)?this.container.style.height=t+"px":this.container.style.height=t,(0,wt.isNumber)(e)||(e=this.container.clientWidth),(0,wt.isNumber)(t)||(t=this.container.clientHeight),this.containerStyles=window.getComputedStyle(this.container),this.containerPadding={left:parseFloat(this.containerStyles["padding-left"])||0,right:parseFloat(this.containerStyles["padding-right"])||0,top:parseFloat(this.containerStyles["padding-top"])||0,bottom:parseFloat(this.containerStyles["padding-bottom"])||0};let a=(0,wt.windowBounds)(),o=window.getComputedStyle(document.body),l={left:parseFloat(o["padding-left"])||0,right:parseFloat(o["padding-right"])||0,top:parseFloat(o["padding-top"])||0,bottom:parseFloat(o["padding-bottom"])||0};return n||(e=a.width-l.left-l.right),(this.settings.fullsize&&!s||!s)&&(t=a.height-l.top-l.bottom),{width:e-this.containerPadding.left-this.containerPadding.right,height:t-this.containerPadding.top-this.containerPadding.bottom}}bounds(){let e;return this.container.style.overflow!=="visible"&&(e=this.container&&this.container.getBoundingClientRect()),!e||!e.width||!e.height?(0,wt.windowBounds)():e}getSheet(){var e=document.createElement("style");return e.appendChild(document.createTextNode("")),document.head.appendChild(e),e.sheet}addStyleRules(e,t){var i="#"+this.id+" ",n="";this.sheet||(this.sheet=this.getSheet()),t.forEach(function(s){for(var a in s)s.hasOwnProperty(a)&&(n+=a+":"+s[a]+";")}),this.sheet.insertRule(i+e+" {"+n+"}",0)}axis(e){e==="horizontal"?(this.container.style.display="flex",this.container.style.flexDirection="row",this.container.style.flexWrap="nowrap"):this.container.style.display="block",this.settings.axis=e}direction(e){this.container&&(this.container.dir=e,this.container.style.direction=e),this.settings.fullsize&&(document.body.style.direction=e),this.settings.dir=e}overflow(e){this.container&&(e==="scroll"&&this.settings.axis==="vertical"?(this.container.style["overflow-y"]=e,this.container.style["overflow-x"]="hidden"):e==="scroll"&&this.settings.axis==="horizontal"?(this.container.style["overflow-y"]="hidden",this.container.style["overflow-x"]=e):this.container.style.overflow=e),this.settings.overflow=e}destroy(){var e;this.element&&(this.settings.hidden?e=this.wrapper:e=this.container,this.element.contains(this.container)&&this.element.removeChild(this.container),window.removeEventListener("resize",this.resizeFunc),window.removeEventListener("orientationChange",this.orientationChangeFunc))}},Lm=ec;ts.default=Lm});var rc=$(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.default=void 0;var ic=class{constructor(e){this.container=e,this._views=[],this.length=0,this.hidden=!1}all(){return this._views}first(){return this._views[0]}last(){return this._views[this._views.length-1]}indexOf(e){return this._views.indexOf(e)}slice(){return this._views.slice.apply(this._views,arguments)}get(e){return this._views[e]}append(e){return this._views.push(e),this.container&&this.container.appendChild(e.element),this.length++,e}prepend(e){return this._views.unshift(e),this.container&&this.container.insertBefore(e.element,this.container.firstChild),this.length++,e}insert(e,t){return this._views.splice(t,0,e),this.container&&(t-1&&this._views.splice(t,1),this.destroy(e),this.length--}destroy(e){e.displayed&&e.destroy(),this.container&&this.container.removeChild(e.element),e=null}forEach(){return this._views.forEach.apply(this._views,arguments)}clear(){var e,t=this.length;if(!!this.length){for(var i=0;i{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});rs.default=void 0;var Mm=Ki(Ft()),$i=Ie(),Bm=Ki(bf()),nc=Ki(Da()),Um=Ki(In()),Fm=Ki(tc()),qm=Ki(rc()),Et=Ct();function Ki(r){return r&&r.__esModule?r:{default:r}}var Va=class{constructor(e){this.name="default",this.optsSettings=e.settings,this.View=e.view,this.request=e.request,this.renditionQueue=e.queue,this.q=new Um.default(this),this.settings=(0,$i.extend)(this.settings||{},{infinite:!0,hidden:!1,width:void 0,height:void 0,axis:void 0,writingMode:void 0,flow:"scrolled",ignoreClass:"",fullsize:void 0,allowScriptedContent:!1,allowPopups:!1}),(0,$i.extend)(this.settings,e.settings||{}),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,flow:this.settings.flow,layout:this.layout,method:this.settings.method,width:0,height:0,forceEvenPages:!0,allowScriptedContent:this.settings.allowScriptedContent,allowPopups:this.settings.allowPopups},this.rendered=!1}render(e,t){let i=e.tagName;typeof this.settings.fullsize=="undefined"&&i&&(i.toLowerCase()=="body"||i.toLowerCase()=="html")&&(this.settings.fullsize=!0),this.settings.fullsize&&(this.settings.overflow="visible",this.overflow=this.settings.overflow),this.settings.size=t,this.settings.rtlScrollType=(0,Bm.default)(),this.stage=new Fm.default({width:t.width,height:t.height,overflow:this.overflow,hidden:this.settings.hidden,axis:this.settings.axis,fullsize:this.settings.fullsize,direction:this.settings.direction}),this.stage.attachTo(e),this.container=this.stage.getContainer(),this.views=new qm.default(this.container),this._bounds=this.bounds(),this._stageSize=this.stage.size(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.stage.onResize(this.onResized.bind(this)),this.stage.onOrientationChange(this.onOrientationChange.bind(this)),this.addEventListeners(),this.layout&&this.updateLayout(),this.rendered=!0}addEventListeners(){var e;window.addEventListener("unload",function(t){this.destroy()}.bind(this)),this.settings.fullsize?e=window:e=this.container,this._onScroll=this.onScroll.bind(this),e.addEventListener("scroll",this._onScroll)}removeEventListeners(){var e;this.settings.fullsize?e=window:e=this.container,e.removeEventListener("scroll",this._onScroll),this._onScroll=void 0}destroy(){clearTimeout(this.orientationTimeout),clearTimeout(this.resizeTimeout),clearTimeout(this.afterScrolled),this.clear(),this.removeEventListeners(),this.stage.destroy(),this.rendered=!1}onOrientationChange(e){let{orientation:t}=window;this.optsSettings.resizeOnOrientationChange&&this.resize(),clearTimeout(this.orientationTimeout),this.orientationTimeout=setTimeout(function(){this.orientationTimeout=void 0,this.optsSettings.resizeOnOrientationChange&&this.resize(),this.emit(Et.EVENTS.MANAGERS.ORIENTATION_CHANGE,t)}.bind(this),500)}onResized(e){this.resize()}resize(e,t,i){let n=this.stage.size(e,t);if(this.winBounds=(0,$i.windowBounds)(),this.orientationTimeout&&this.winBounds.width===this.winBounds.height){this._stageSize=void 0;return}this._stageSize&&this._stageSize.width===n.width&&this._stageSize.height===n.height||(this._stageSize=n,this._bounds=this.bounds(),this.clear(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.updateLayout(),this.emit(Et.EVENTS.MANAGERS.RESIZED,{width:this._stageSize.width,height:this._stageSize.height},i))}createView(e,t){return new this.View(e,(0,$i.extend)(this.viewSettings,{forceRight:t}))}handleNextPrePaginated(e,t,i){let n;if(this.layout.name==="pre-paginated"&&this.layout.divisor>1){if(e||t.index===0)return;if(n=t.next(),n&&!n.properties.includes("page-spread-left"))return i.call(this,n)}}display(e,t){var i=new $i.defer,n=i.promise;(t===e.href||(0,$i.isNumber)(t))&&(t=void 0);var s=this.views.find(e);if(s&&e&&this.layout.name!=="pre-paginated"){let o=s.offset();if(this.settings.direction==="ltr")this.scrollTo(o.left,o.top,!0);else{let l=s.width();this.scrollTo(o.left+l,o.top,!0)}if(t){let l=s.locationOf(t),u=s.width();this.moveTo(l,u)}return i.resolve(),n}this.clear();let a=!1;return this.layout.name==="pre-paginated"&&this.layout.divisor===2&&e.properties.includes("page-spread-right")&&(a=!0),this.add(e,a).then(function(o){if(t){let l=o.locationOf(t),u=o.width();this.moveTo(l,u)}}.bind(this),o=>{i.reject(o)}).then(function(){return this.handleNextPrePaginated(a,e,this.add)}.bind(this)).then(function(){this.views.show(),i.resolve()}.bind(this)),n}afterDisplayed(e){this.emit(Et.EVENTS.MANAGERS.ADDED,e)}afterResized(e){this.emit(Et.EVENTS.MANAGERS.RESIZE,e.section)}moveTo(e,t){var i=0,n=0;this.isPaginated?(i=Math.floor(e.left/this.layout.delta)*this.layout.delta,i+this.layout.delta>this.container.scrollWidth&&(i=this.container.scrollWidth-this.layout.delta),n=Math.floor(e.top/this.layout.delta)*this.layout.delta,n+this.layout.delta>this.container.scrollHeight&&(n=this.container.scrollHeight-this.layout.delta)):n=e.top,this.settings.direction==="rtl"&&(i=i+this.layout.delta,i=i-t),this.scrollTo(i,n,!0)}add(e,t){var i=this.createView(e,t);return this.views.append(i),i.onDisplayed=this.afterDisplayed.bind(this),i.onResize=this.afterResized.bind(this),i.on(Et.EVENTS.VIEWS.AXIS,n=>{this.updateAxis(n)}),i.on(Et.EVENTS.VIEWS.WRITING_MODE,n=>{this.updateWritingMode(n)}),i.display(this.request)}append(e,t){var i=this.createView(e,t);return this.views.append(i),i.onDisplayed=this.afterDisplayed.bind(this),i.onResize=this.afterResized.bind(this),i.on(Et.EVENTS.VIEWS.AXIS,n=>{this.updateAxis(n)}),i.on(Et.EVENTS.VIEWS.WRITING_MODE,n=>{this.updateWritingMode(n)}),i.display(this.request)}prepend(e,t){var i=this.createView(e,t);return i.on(Et.EVENTS.VIEWS.RESIZED,n=>{this.counter(n)}),this.views.prepend(i),i.onDisplayed=this.afterDisplayed.bind(this),i.onResize=this.afterResized.bind(this),i.on(Et.EVENTS.VIEWS.AXIS,n=>{this.updateAxis(n)}),i.on(Et.EVENTS.VIEWS.WRITING_MODE,n=>{this.updateWritingMode(n)}),i.display(this.request)}counter(e){this.settings.axis==="vertical"?this.scrollBy(0,e.heightDelta,!0):this.scrollBy(e.widthDelta,0,!0)}next(){var e,t;let i=this.settings.direction;if(!!this.views.length&&(this.isPaginated&&this.settings.axis==="horizontal"&&(!i||i==="ltr")?(this.scrollLeft=this.container.scrollLeft,t=this.container.scrollLeft+this.container.offsetWidth+this.layout.delta,t<=this.container.scrollWidth?this.scrollBy(this.layout.delta,0,!0):e=this.views.last().section.next()):this.isPaginated&&this.settings.axis==="horizontal"&&i==="rtl"?(this.scrollLeft=this.container.scrollLeft,this.settings.rtlScrollType==="default"?(t=this.container.scrollLeft,t>0?this.scrollBy(this.layout.delta,0,!0):e=this.views.last().section.next()):(t=this.container.scrollLeft+this.layout.delta*-1,t>this.container.scrollWidth*-1?this.scrollBy(this.layout.delta,0,!0):e=this.views.last().section.next())):this.isPaginated&&this.settings.axis==="vertical"?(this.scrollTop=this.container.scrollTop,this.container.scrollTop+this.container.offsetHeights).then(function(){!this.isPaginated&&this.settings.axis==="horizontal"&&this.settings.direction==="rtl"&&this.settings.rtlScrollType==="default"&&this.scrollTo(this.container.scrollWidth,0,!0),this.views.show()}.bind(this))}}prev(){var e,t;let i=this.settings.direction;if(!!this.views.length&&(this.isPaginated&&this.settings.axis==="horizontal"&&(!i||i==="ltr")?(this.scrollLeft=this.container.scrollLeft,t=this.container.scrollLeft,t>0?this.scrollBy(-this.layout.delta,0,!0):e=this.views.first().section.prev()):this.isPaginated&&this.settings.axis==="horizontal"&&i==="rtl"?(this.scrollLeft=this.container.scrollLeft,this.settings.rtlScrollType==="default"?(t=this.container.scrollLeft+this.container.offsetWidth,t0?this.scrollBy(0,-this.layout.height,!0):e=this.views.first().section.prev()):e=this.views.first().section.prev(),e)){this.clear(),this.updateLayout();let n=!1;return this.layout.name==="pre-paginated"&&this.layout.divisor===2&&typeof e.prev()!="object"&&(n=!0),this.prepend(e,n).then(function(){var s;if(this.layout.name==="pre-paginated"&&this.layout.divisor>1&&(s=e.prev(),s))return this.prepend(s)}.bind(this),s=>s).then(function(){this.isPaginated&&this.settings.axis==="horizontal"&&(this.settings.direction==="rtl"?this.settings.rtlScrollType==="default"?this.scrollTo(0,0,!0):this.scrollTo(this.container.scrollWidth*-1+this.layout.delta,0,!0):this.scrollTo(this.container.scrollWidth-this.layout.delta,0,!0)),this.views.show()}.bind(this))}}current(){var e=this.visible();return e.length?e[e.length-1]:null}clear(){this.views&&(this.views.hide(),this.scrollTo(0,0,!0),this.views.clear())}currentLocation(){return this.updateLayout(),this.isPaginated&&this.settings.axis==="horizontal"?this.location=this.paginatedLocation():this.location=this.scrolledLocation(),this.location}scrolledLocation(){let e=this.visible(),t=this.container.getBoundingClientRect(),i=t.height{let{index:d,href:c}=f.section,v=f.position(),g=f.width(),O=f.height(),k,_,p,y;s?(k=o+t.top-v.top+l,_=k+i-l,y=this.layout.count(O,i).pages,p=i):(k=o+t.left-v.left+l,_=k+n-l,y=this.layout.count(g,n).pages,p=n);let T=Math.ceil(k/p),P=[],w=Math.ceil(_/p);if(this.settings.direction==="rtl"&&!s){let M=T;T=y-w,w=y-M}P=[];for(var N=T;N<=w;N++){let M=N+1;P.push(M)}let C=this.mapping.page(f.contents,f.section.cfiBase,k,_);return{index:d,href:c,pages:P,totalPages:y,mapping:C}})}paginatedLocation(){let e=this.visible(),t=this.container.getBoundingClientRect(),i=0,n=0;return this.settings.fullsize&&(i=window.scrollX),e.map(a=>{let{index:o,href:l}=a.section,u,f=a.position(),d=a.width(),c,v,g;this.settings.direction==="rtl"?(u=t.right-i,g=Math.min(Math.abs(u-f.left),this.layout.width)-n,v=f.width-(f.right-u)-n,c=v-g):(u=t.left+i,g=Math.min(f.right-u,this.layout.width)-n,c=u-f.left+n,v=c+g),n+=g;let O=this.mapping.page(a.contents,a.section.cfiBase,c,v),k=this.layout.count(d).pages,_=Math.floor(c/this.layout.pageWidth),p=[],y=Math.floor(v/this.layout.pageWidth);if(_<0&&(_=0,y=y+1),this.settings.direction==="rtl"){let P=_;_=k-y,y=k-P}for(var T=_+1;T<=y;T++){let P=T;p.push(P)}return{index:o,href:l,pages:p,totalPages:k,mapping:O}})}isVisible(e,t,i,n){var s=e.position(),a=n||this.bounds();return this.settings.axis==="horizontal"&&s.right>a.left-t&&s.lefta.top-t&&s.top0&&this.layout.name==="pre-paginated"&&this.display(this.views.first().section)}updateLayout(){!this.stage||(this._stageSize=this.stage.size(),this.isPaginated?(this.layout.calculate(this._stageSize.width,this._stageSize.height,this.settings.gap),this.settings.offset=this.layout.delta/this.layout.divisor):this.layout.calculate(this._stageSize.width,this._stageSize.height),this.viewSettings.width=this.layout.width,this.viewSettings.height=this.layout.height,this.setLayout(this.layout))}setLayout(e){this.viewSettings.layout=e,this.mapping=new nc.default(e.props,this.settings.direction,this.settings.axis),this.views&&this.views.forEach(function(t){t&&t.setLayout(e)})}updateWritingMode(e){this.writingMode=e}updateAxis(e,t){!t&&e===this.settings.axis||(this.settings.axis=e,this.stage&&this.stage.axis(e),this.viewSettings.axis=e,this.mapping&&(this.mapping=new nc.default(this.layout.props,this.settings.direction,this.settings.axis)),this.layout&&(e==="vertical"?this.layout.spread("none"):this.layout.spread(this.layout.settings.spread)))}updateFlow(e,t="auto"){let i=e==="paginated"||e==="auto";this.isPaginated=i,e==="scrolled-doc"||e==="scrolled-continuous"||e==="scrolled"?this.updateAxis("vertical"):this.updateAxis("horizontal"),this.viewSettings.flow=e,this.settings.overflow?this.overflow=this.settings.overflow:this.overflow=i?"hidden":t,this.stage&&this.stage.overflow(this.overflow),this.updateLayout()}getContents(){var e=[];return this.views&&this.views.forEach(function(t){let i=t&&t.contents;i&&e.push(i)}),e}direction(e="ltr"){this.settings.direction=e,this.stage&&this.stage.direction(e),this.viewSettings.direction=e,this.updateLayout()}isRendered(){return this.rendered}};(0,Mm.default)(Va.prototype);var Wm=Va;rs.default=Wm});var oc=$(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});ss.default=void 0;var sc=Ie(),ac=Ct(),jm=Vm(Ft());function Vm(r){return r&&r.__esModule?r:{default:r}}var Hm=Math.PI/2,Zm={easeOutSine:function(r){return Math.sin(r*Hm)},easeInOutSine:function(r){return-.5*(Math.cos(Math.PI*r)-1)},easeInOutQuint:function(r){return(r/=.5)<1?.5*Math.pow(r,5):.5*(Math.pow(r-2,5)+2)},easeInCubic:function(r){return Math.pow(r,3)}},Ha=class{constructor(e,t){this.settings=(0,sc.extend)({duration:80,minVelocity:.2,minDistance:10,easing:Zm.easeInCubic},t||{}),this.supportsTouch=this.supportsTouch(),this.supportsTouch&&this.setup(e)}setup(e){this.manager=e,this.layout=this.manager.layout,this.fullsize=this.manager.settings.fullsize,this.fullsize?(this.element=this.manager.stage.element,this.scroller=window,this.disableScroll()):(this.element=this.manager.stage.container,this.scroller=this.element,this.element.style.WebkitOverflowScrolling="touch"),this.manager.settings.offset=this.layout.width,this.manager.settings.afterScrolledTimeout=this.settings.duration*2,this.isVertical=this.manager.settings.axis==="vertical",!(!this.manager.isPaginated||this.isVertical)&&(this.touchCanceler=!1,this.resizeCanceler=!1,this.snapping=!1,this.scrollLeft,this.scrollTop,this.startTouchX=void 0,this.startTouchY=void 0,this.startTime=void 0,this.endTouchX=void 0,this.endTouchY=void 0,this.endTime=void 0,this.addListeners())}supportsTouch(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}disableScroll(){this.element.style.overflow="hidden"}enableScroll(){this.element.style.overflow=""}addListeners(){this._onResize=this.onResize.bind(this),window.addEventListener("resize",this._onResize),this._onScroll=this.onScroll.bind(this),this.scroller.addEventListener("scroll",this._onScroll),this._onTouchStart=this.onTouchStart.bind(this),this.scroller.addEventListener("touchstart",this._onTouchStart,{passive:!0}),this.on("touchstart",this._onTouchStart),this._onTouchMove=this.onTouchMove.bind(this),this.scroller.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.on("touchmove",this._onTouchMove),this._onTouchEnd=this.onTouchEnd.bind(this),this.scroller.addEventListener("touchend",this._onTouchEnd,{passive:!0}),this.on("touchend",this._onTouchEnd),this._afterDisplayed=this.afterDisplayed.bind(this),this.manager.on(ac.EVENTS.MANAGERS.ADDED,this._afterDisplayed)}removeListeners(){window.removeEventListener("resize",this._onResize),this._onResize=void 0,this.scroller.removeEventListener("scroll",this._onScroll),this._onScroll=void 0,this.scroller.removeEventListener("touchstart",this._onTouchStart,{passive:!0}),this.off("touchstart",this._onTouchStart),this._onTouchStart=void 0,this.scroller.removeEventListener("touchmove",this._onTouchMove,{passive:!0}),this.off("touchmove",this._onTouchMove),this._onTouchMove=void 0,this.scroller.removeEventListener("touchend",this._onTouchEnd,{passive:!0}),this.off("touchend",this._onTouchEnd),this._onTouchEnd=void 0,this.manager.off(ac.EVENTS.MANAGERS.ADDED,this._afterDisplayed),this._afterDisplayed=void 0}afterDisplayed(e){let t=e.contents;["touchstart","touchmove","touchend"].forEach(i=>{t.on(i,n=>this.triggerViewEvent(n,t))})}triggerViewEvent(e,t){this.emit(e.type,e,t)}onScroll(e){this.scrollLeft=this.fullsize?window.scrollX:this.scroller.scrollLeft,this.scrollTop=this.fullsize?window.scrollY:this.scroller.scrollTop}onResize(e){this.resizeCanceler=!0}onTouchStart(e){let{screenX:t,screenY:i}=e.touches[0];this.fullsize&&this.enableScroll(),this.touchCanceler=!0,this.startTouchX||(this.startTouchX=t,this.startTouchY=i,this.startTime=this.now()),this.endTouchX=t,this.endTouchY=i,this.endTime=this.now()}onTouchMove(e){let{screenX:t,screenY:i}=e.touches[0],n=Math.abs(i-this.endTouchY);this.touchCanceler=!0,!this.fullsize&&n<10&&(this.element.scrollLeft-=t-this.endTouchX),this.endTouchX=t,this.endTouchY=i,this.endTime=this.now()}onTouchEnd(e){this.fullsize&&this.disableScroll(),this.touchCanceler=!1;let t=this.wasSwiped();t!==0?this.snap(t):this.snap(),this.startTouchX=void 0,this.startTouchY=void 0,this.startTime=void 0,this.endTouchX=void 0,this.endTouchY=void 0,this.endTime=void 0}wasSwiped(){let e=this.layout.pageWidth*this.layout.divisor,t=this.endTouchX-this.startTouchX,i=Math.abs(t),n=this.endTime-this.startTime,s=t/n,a=this.settings.minVelocity;if(i<=this.settings.minDistance||i>=e)return 0;if(s>a)return-1;if(s<-a)return 1}needsSnap(){let e=this.scrollLeft,t=this.layout.pageWidth*this.layout.divisor;return e%t!=0}snap(e=0){let t=this.scrollLeft,i=this.layout.pageWidth*this.layout.divisor,n=Math.round(t/i)*i;return e&&(n+=e*i),this.smoothScrollTo(n)}smoothScrollTo(e){let t=new sc.defer,i=this.scrollLeft,n=this.now(),s=this.settings.duration,a=this.settings.easing;this.snapping=!0;function o(){let l=this.now(),u=Math.min(1,(l-n)/s),f=a(u);if(this.touchCanceler||this.resizeCanceler){this.resizeCanceler=!1,this.snapping=!1,t.resolve();return}u<1?(window.requestAnimationFrame(o.bind(this)),this.scrollTo(i+(e-i)*u,0)):(this.scrollTo(e,0),this.snapping=!1,t.resolve())}return o.call(this),t.promise}scrollTo(e=0,t=0){this.fullsize?window.scroll(e,t):(this.scroller.scrollLeft=e,this.scroller.scrollTop=t)}now(){return"now"in window.performance?performance.now():new Date().getTime()}destroy(){!this.scroller||(this.fullsize&&this.enableScroll(),this.removeListeners(),this.scroller=void 0)}};(0,jm.default)(Ha.prototype);var Xm=Ha;ss.default=Xm});var Xa=$(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.default=void 0;var yi=Ie(),lc=Za(ns()),uc=Za(oc()),At=Ct(),Ym=Za(ja());function Za(r){return r&&r.__esModule?r:{default:r}}var hc=class extends lc.default{constructor(e){super(e);this.name="continuous",this.settings=(0,yi.extend)(this.settings||{},{infinite:!0,overflow:void 0,axis:void 0,writingMode:void 0,flow:"scrolled",offset:500,offsetDelta:250,width:void 0,height:void 0,snap:!1,afterScrolledTimeout:10,allowScriptedContent:!1,allowPopups:!1}),(0,yi.extend)(this.settings,e.settings||{}),e.settings.gap!="undefined"&&e.settings.gap===0&&(this.settings.gap=e.settings.gap),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,flow:this.settings.flow,layout:this.layout,width:0,height:0,forceEvenPages:!1,allowScriptedContent:this.settings.allowScriptedContent,allowPopups:this.settings.allowPopups},this.scrollTop=0,this.scrollLeft=0}display(e,t){return lc.default.prototype.display.call(this,e,t).then(function(){return this.fill()}.bind(this))}fill(e){var t=e||new yi.defer;return this.q.enqueue(()=>this.check()).then(i=>{i?this.fill(t):t.resolve()}),t.promise}moveTo(e){var t=0,i=0,n=0,s=0;this.isPaginated?(t=Math.floor(e.left/this.layout.delta)*this.layout.delta,n=t+this.settings.offsetDelta):(i=e.top,s=e.top+this.settings.offsetDelta),(t>0||i>0)&&this.scrollBy(t,i,!0)}afterResized(e){this.emit(At.EVENTS.MANAGERS.RESIZE,e.section)}removeShownListeners(e){e.onDisplayed=function(){}}add(e){var t=this.createView(e);return this.views.append(t),t.on(At.EVENTS.VIEWS.RESIZED,i=>{t.expanded=!0}),t.on(At.EVENTS.VIEWS.AXIS,i=>{this.updateAxis(i)}),t.on(At.EVENTS.VIEWS.WRITING_MODE,i=>{this.updateWritingMode(i)}),t.onDisplayed=this.afterDisplayed.bind(this),t.onResize=this.afterResized.bind(this),t.display(this.request)}append(e){var t=this.createView(e);return t.on(At.EVENTS.VIEWS.RESIZED,i=>{t.expanded=!0}),t.on(At.EVENTS.VIEWS.AXIS,i=>{this.updateAxis(i)}),t.on(At.EVENTS.VIEWS.WRITING_MODE,i=>{this.updateWritingMode(i)}),this.views.append(t),t.onDisplayed=this.afterDisplayed.bind(this),t}prepend(e){var t=this.createView(e);return t.on(At.EVENTS.VIEWS.RESIZED,i=>{this.counter(i),t.expanded=!0}),t.on(At.EVENTS.VIEWS.AXIS,i=>{this.updateAxis(i)}),t.on(At.EVENTS.VIEWS.WRITING_MODE,i=>{this.updateWritingMode(i)}),this.views.prepend(t),t.onDisplayed=this.afterDisplayed.bind(this),t}counter(e){this.settings.axis==="vertical"?this.scrollBy(0,e.heightDelta,!0):this.scrollBy(e.widthDelta,0,!0)}update(e){for(var t=this.bounds(),i=this.views.all(),n=i.length,s=[],a=typeof e!="undefined"?e:this.settings.offset||0,o,l,u=new yi.defer,f=[],d=0;d{l.hide()});f.push(c)}s.push(l)}else this.q.enqueue(l.destroy.bind(l)),clearTimeout(this.trimTimeout),this.trimTimeout=setTimeout(function(){this.q.enqueue(this.trim.bind(this))}.bind(this),250);return f.length?Promise.all(f).catch(c=>{u.reject(c)}):(u.resolve(),u.promise)}check(e,t){var i=new yi.defer,n=[],s=this.settings.axis==="horizontal",a=this.settings.offset||0;e&&s&&(a=e),t&&!s&&(a=t);var o=this._bounds;let l=s?this.scrollLeft:this.scrollTop,u=s?Math.floor(o.width):o.height,f=s?this.container.scrollWidth:this.container.scrollHeight,d=this.writingMode&&this.writingMode.indexOf("vertical")===0?"vertical":"horizontal",c=this.settings.rtlScrollType,v=this.settings.direction==="rtl";this.settings.fullsize?(s&&v&&c==="negative"||!s&&v&&c==="default")&&(l=l*-1):(v&&c==="default"&&d==="horizontal"&&(l=f-u-l),v&&c==="negative"&&d==="horizontal"&&(l=l*-1));let g=()=>{let y=this.views.first(),T=y&&y.section.prev();T&&n.push(this.prepend(T))},O=()=>{let y=this.views.last(),T=y&&y.section.next();T&&n.push(this.append(T))},k=l+u+a,_=l-a;k>=f&&O(),_<0&&g();let p=n.map(y=>y.display(this.request));return n.length?Promise.all(p).then(()=>this.check()).then(()=>this.update(a),y=>y):(this.q.enqueue(function(){this.update()}.bind(this)),i.resolve(!1),i.promise)}trim(){for(var e=new yi.defer,t=this.views.displayed(),i=t[0],n=t[t.length-1],s=this.views.indexOf(i),a=this.views.indexOf(n),o=this.views.slice(0,s),l=this.views.slice(a+1),u=0;u{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.default=void 0;var $m=jt(Ft()),qr=Ie(),bi=jt(On()),fc=jt(_t()),Km=jt(In()),Jm=jt(Ia()),Qm=jt(Qh()),Cb=jt(Mr()),e_=jt(uf()),De=Ct(),t_=jt(Ua()),i_=jt(ns()),r_=jt(Xa());function jt(r){return r&&r.__esModule?r:{default:r}}var Ya=class{constructor(e,t){this.settings=(0,qr.extend)(this.settings||{},{width:null,height:null,ignoreClass:"",manager:"default",view:"iframe",flow:null,layout:null,spread:null,minSpreadWidth:800,stylesheet:null,resizeOnOrientationChange:!0,script:null,snap:!1,defaultDirection:"ltr",allowScriptedContent:!1,allowPopups:!1}),(0,qr.extend)(this.settings,t),typeof this.settings.manager=="object"&&(this.manager=this.settings.manager),this.book=e,this.hooks={},this.hooks.display=new bi.default(this),this.hooks.serialize=new bi.default(this),this.hooks.content=new bi.default(this),this.hooks.unloaded=new bi.default(this),this.hooks.layout=new bi.default(this),this.hooks.render=new bi.default(this),this.hooks.show=new bi.default(this),this.hooks.content.register(this.handleLinks.bind(this)),this.hooks.content.register(this.passEvents.bind(this)),this.hooks.content.register(this.adjustImages.bind(this)),this.book.spine.hooks.content.register(this.injectIdentifier.bind(this)),this.settings.stylesheet&&this.book.spine.hooks.content.register(this.injectStylesheet.bind(this)),this.settings.script&&this.book.spine.hooks.content.register(this.injectScript.bind(this)),this.themes=new Qm.default(this),this.annotations=new e_.default(this),this.epubcfi=new fc.default,this.q=new Km.default(this),this.location=void 0,this.q.enqueue(this.book.opened),this.starting=new qr.defer,this.started=this.starting.promise,this.q.enqueue(this.start)}setManager(e){this.manager=e}requireManager(e){var t;return typeof e=="string"&&e==="default"?t=i_.default:typeof e=="string"&&e==="continuous"?t=r_.default:t=e,t}requireView(e){var t;return typeof e=="string"&&e==="iframe"?t=t_.default:t=e,t}start(){switch(!this.settings.layout&&(this.book.package.metadata.layout==="pre-paginated"||this.book.displayOptions.fixedLayout==="true")&&(this.settings.layout="pre-paginated"),this.book.package.metadata.spread){case"none":this.settings.spread="none";break;case"both":this.settings.spread=!0;break}this.manager||(this.ViewManager=this.requireManager(this.settings.manager),this.View=this.requireView(this.settings.view),this.manager=new this.ViewManager({view:this.View,queue:this.q,request:this.book.load.bind(this.book),settings:this.settings})),this.direction(this.book.package.metadata.direction||this.settings.defaultDirection),this.settings.globalLayoutProperties=this.determineLayoutProperties(this.book.package.metadata),this.flow(this.settings.globalLayoutProperties.flow),this.layout(this.settings.globalLayoutProperties),this.manager.on(De.EVENTS.MANAGERS.ADDED,this.afterDisplayed.bind(this)),this.manager.on(De.EVENTS.MANAGERS.REMOVED,this.afterRemoved.bind(this)),this.manager.on(De.EVENTS.MANAGERS.RESIZED,this.onResized.bind(this)),this.manager.on(De.EVENTS.MANAGERS.ORIENTATION_CHANGE,this.onOrientationChange.bind(this)),this.manager.on(De.EVENTS.MANAGERS.SCROLLED,this.reportLocation.bind(this)),this.emit(De.EVENTS.RENDITION.STARTED),this.starting.resolve()}attachTo(e){return this.q.enqueue(function(){this.manager.render(e,{width:this.settings.width,height:this.settings.height}),this.emit(De.EVENTS.RENDITION.ATTACHED)}.bind(this))}display(e){return this.displaying&&this.displaying.resolve(),this.q.enqueue(this._display,e)}_display(e){if(!!this.book){var t=this.epubcfi.isCfiString(e),i=new qr.defer,n=i.promise,s,a;return this.displaying=i,this.book.locations.length()&&(0,qr.isFloat)(e)&&(e=this.book.locations.cfiFromPercentage(parseFloat(e))),s=this.book.spine.get(e),s?(this.manager.display(s,e).then(()=>{i.resolve(s),this.displaying=void 0,this.emit(De.EVENTS.RENDITION.DISPLAYED,s),this.reportLocation()},o=>{this.emit(De.EVENTS.RENDITION.DISPLAY_ERROR,o)}),n):(i.reject(new Error("No Section Found")),n)}}afterDisplayed(e){e.on(De.EVENTS.VIEWS.MARK_CLICKED,(t,i)=>this.triggerMarkEvent(t,i,e.contents)),this.hooks.render.trigger(e,this).then(()=>{e.contents?this.hooks.content.trigger(e.contents,this).then(()=>{this.emit(De.EVENTS.RENDITION.RENDERED,e.section,e)}):this.emit(De.EVENTS.RENDITION.RENDERED,e.section,e)})}afterRemoved(e){this.hooks.unloaded.trigger(e,this).then(()=>{this.emit(De.EVENTS.RENDITION.REMOVED,e.section,e)})}onResized(e,t){this.emit(De.EVENTS.RENDITION.RESIZED,{width:e.width,height:e.height},t),this.location&&this.location.start&&this.display(t||this.location.start.cfi)}onOrientationChange(e){this.emit(De.EVENTS.RENDITION.ORIENTATION_CHANGE,e)}moveTo(e){this.manager.moveTo(e)}resize(e,t,i){e&&(this.settings.width=e),t&&(this.settings.height=t),this.manager.resize(e,t,i)}clear(){this.manager.clear()}next(){return this.q.enqueue(this.manager.next.bind(this.manager)).then(this.reportLocation.bind(this))}prev(){return this.q.enqueue(this.manager.prev.bind(this.manager)).then(this.reportLocation.bind(this))}determineLayoutProperties(e){var t,i=this.settings.layout||e.layout||"reflowable",n=this.settings.spread||e.spread||"auto",s=this.settings.orientation||e.orientation||"auto",a=this.settings.flow||e.flow||"auto",o=e.viewport||"",l=this.settings.minSpreadWidth||e.minSpreadWidth||800,u=this.settings.direction||e.direction||"ltr";return(this.settings.width===0||this.settings.width>0)&&(this.settings.height===0||this.settings.height>0),t={layout:i,spread:n,orientation:s,flow:a,viewport:o,minSpreadWidth:l,direction:u},t}flow(e){var t=e;(e==="scrolled"||e==="scrolled-doc"||e==="scrolled-continuous")&&(t="scrolled"),(e==="auto"||e==="paginated")&&(t="paginated"),this.settings.flow=e,this._layout&&this._layout.flow(t),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this.manager&&this.manager.updateFlow(t),this.manager&&this.manager.isRendered()&&this.location&&(this.manager.clear(),this.display(this.location.start.cfi))}layout(e){return e&&(this._layout=new Jm.default(e),this._layout.spread(e.spread,this.settings.minSpreadWidth),this._layout.on(De.EVENTS.LAYOUT.UPDATED,(t,i)=>{this.emit(De.EVENTS.RENDITION.LAYOUT,t,i)})),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this._layout}spread(e,t){this.settings.spread=e,t&&(this.settings.minSpreadWidth=t),this._layout&&this._layout.spread(e,t),this.manager&&this.manager.isRendered()&&this.manager.updateLayout()}direction(e){this.settings.direction=e||"ltr",this.manager&&this.manager.direction(this.settings.direction),this.manager&&this.manager.isRendered()&&this.location&&(this.manager.clear(),this.display(this.location.start.cfi))}reportLocation(){return this.q.enqueue(function(){requestAnimationFrame(function(){var i=this.manager.currentLocation();if(i&&i.then&&typeof i.then=="function")i.then(function(n){let s=this.located(n);!s||!s.start||!s.end||(this.location=s,this.emit(De.EVENTS.RENDITION.LOCATION_CHANGED,{index:this.location.start.index,href:this.location.start.href,start:this.location.start.cfi,end:this.location.end.cfi,percentage:this.location.start.percentage}),this.emit(De.EVENTS.RENDITION.RELOCATED,this.location))}.bind(this));else if(i){let n=this.located(i);if(!n||!n.start||!n.end)return;this.location=n,this.emit(De.EVENTS.RENDITION.LOCATION_CHANGED,{index:this.location.start.index,href:this.location.start.href,start:this.location.start.cfi,end:this.location.end.cfi,percentage:this.location.start.percentage}),this.emit(De.EVENTS.RENDITION.RELOCATED,this.location)}}.bind(this))}.bind(this))}currentLocation(){var e=this.manager.currentLocation();if(e&&e.then&&typeof e.then=="function")e.then(function(t){return this.located(t)}.bind(this));else if(e)return this.located(e)}located(e){if(!e.length)return{};let t=e[0],i=e[e.length-1],n={start:{index:t.index,href:t.href,cfi:t.mapping.start,displayed:{page:t.pages[0]||1,total:t.totalPages}},end:{index:i.index,href:i.href,cfi:i.mapping.end,displayed:{page:i.pages[i.pages.length-1]||1,total:i.totalPages}}},s=this.book.locations.locationFromCfi(t.mapping.start),a=this.book.locations.locationFromCfi(i.mapping.end);s!=null&&(n.start.location=s,n.start.percentage=this.book.locations.percentageFromLocation(s)),a!=null&&(n.end.location=a,n.end.percentage=this.book.locations.percentageFromLocation(a));let o=this.book.pageList.pageFromCfi(t.mapping.start),l=this.book.pageList.pageFromCfi(i.mapping.end);return o!=-1&&(n.start.page=o),l!=-1&&(n.end.page=l),i.index===this.book.spine.last().index&&n.end.displayed.page>=n.end.displayed.total&&(n.atEnd=!0),t.index===this.book.spine.first().index&&n.start.displayed.page===1&&(n.atStart=!0),n}destroy(){this.manager&&this.manager.destroy(),this.book=void 0}passEvents(e){De.DOM_EVENTS.forEach(t=>{e.on(t,i=>this.triggerViewEvent(i,e))}),e.on(De.EVENTS.CONTENTS.SELECTED,t=>this.triggerSelectedEvent(t,e))}triggerViewEvent(e,t){this.emit(e.type,e,t)}triggerSelectedEvent(e,t){this.emit(De.EVENTS.RENDITION.SELECTED,e,t)}triggerMarkEvent(e,t,i){this.emit(De.EVENTS.RENDITION.MARK_CLICKED,e,t,i)}getRange(e,t){var i=new fc.default(e),n=this.manager.visible().filter(function(s){if(i.spinePos===s.index)return!0});if(n.length)return n[0].contents.range(i,t)}adjustImages(e){if(this._layout.name==="pre-paginated")return new Promise(function(s){s()});let t=e.window.getComputedStyle(e.content,null),i=(e.content.offsetHeight-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)))*.95,n=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight);return e.addStylesheetRules({img:{"max-width":(this._layout.columnWidth?this._layout.columnWidth-n+"px":"100%")+"!important","max-height":i+"px!important","object-fit":"contain","page-break-inside":"avoid","break-inside":"avoid","box-sizing":"border-box"},svg:{"max-width":(this._layout.columnWidth?this._layout.columnWidth-n+"px":"100%")+"!important","max-height":i+"px!important","page-break-inside":"avoid","break-inside":"avoid"}}),new Promise(function(s,a){setTimeout(function(){s()},1)})}getContents(){return this.manager?this.manager.getContents():[]}views(){return(this.manager?this.manager.views:void 0)||[]}handleLinks(e){e&&e.on(De.EVENTS.CONTENTS.LINK_CLICKED,t=>{let i=this.book.path.relative(t);this.display(i)})}injectStylesheet(e,t){let i=e.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",this.settings.stylesheet),e.getElementsByTagName("head")[0].appendChild(i)}injectScript(e,t){let i=e.createElement("script");i.setAttribute("type","text/javascript"),i.setAttribute("src",this.settings.script),i.textContent=" ",e.getElementsByTagName("head")[0].appendChild(i)}injectIdentifier(e,t){let i=this.book.packaging.metadata.identifier,n=e.createElement("meta");n.setAttribute("name","dc.relation.ispartof"),i&&n.setAttribute("content",i),e.getElementsByTagName("head")[0].appendChild(n)}};(0,$m.default)(Ya.prototype);var n_=Ya;os.default=n_});var dc=$((cc,Ga)=>{(function(r){if(typeof cc=="object"&&typeof Ga!="undefined")Ga.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e=this,e.JSZip=r()}})(function(){var r,e,t;return function i(n,s,a){function o(f,d){if(!s[f]){if(!n[f]){var c=typeof require=="function"&&require;if(!d&&c)return c(f,!0);if(l)return l(f,!0);var v=new Error("Cannot find module '"+f+"'");throw v.code="MODULE_NOT_FOUND",v}var g=s[f]={exports:{}};n[f][0].call(g.exports,function(O){var k=n[f][1][O];return o(k||O)},g,g.exports,i,n,s,a)}return s[f].exports}for(var l=typeof require=="function"&&require,u=0;u>2,O=(d&3)<<4|c>>4,k=T>1?(c&15)<<2|v>>6:64,_=T>2?v&63:64,f.push(l.charAt(g)+l.charAt(O)+l.charAt(k)+l.charAt(_));return f.join("")},s.decode=function(u){var f,d,c,v,g,O,k,_=0,p=0,y="data:";if(u.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");u=u.replace(/[^A-Za-z0-9\+\/\=]/g,"");var T=u.length*3/4;if(u.charAt(u.length-1)===l.charAt(64)&&T--,u.charAt(u.length-2)===l.charAt(64)&&T--,T%1!=0)throw new Error("Invalid base64 input, bad content length.");var P;for(o.uint8array?P=new Uint8Array(T|0):P=new Array(T|0);_>4,d=(g&15)<<4|O>>2,c=(O&3)<<6|k,P[p++]=f,O!==64&&(P[p++]=d),k!==64&&(P[p++]=c);return P}},{"./support":30,"./utils":32}],2:[function(i,n,s){"use strict";var a=i("./external"),o=i("./stream/DataWorker"),l=i("./stream/Crc32Probe"),u=i("./stream/DataLengthProbe");function f(d,c,v,g,O){this.compressedSize=d,this.uncompressedSize=c,this.crc32=v,this.compression=g,this.compressedContent=O}f.prototype={getContentWorker:function(){var d=new o(a.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("data_length")),c=this;return d.on("end",function(){if(this.streamInfo.data_length!==c.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new o(a.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},f.createWorkerFrom=function(d,c,v){return d.pipe(new l).pipe(new u("uncompressedSize")).pipe(c.compressWorker(v)).pipe(new u("compressedSize")).withStreamInfo("compression",c)},n.exports=f},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(i,n,s){"use strict";var a=i("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(o){return new a("STORE compression")},uncompressWorker:function(){return new a("STORE decompression")}},s.DEFLATE=i("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(i,n,s){"use strict";var a=i("./utils");function o(){for(var d,c=[],v=0;v<256;v++){d=v;for(var g=0;g<8;g++)d=d&1?3988292384^d>>>1:d>>>1;c[v]=d}return c}var l=o();function u(d,c,v,g){var O=l,k=g+v;d=d^-1;for(var _=g;_>>8^O[(d^c[_])&255];return d^-1}function f(d,c,v,g){var O=l,k=g+v;d=d^-1;for(var _=g;_>>8^O[(d^c.charCodeAt(_))&255];return d^-1}n.exports=function(c,v){if(typeof c=="undefined"||!c.length)return 0;var g=a.getTypeOf(c)!=="string";return g?u(v|0,c,c.length,0):f(v|0,c,c.length,0)}},{"./utils":32}],5:[function(i,n,s){"use strict";s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(i,n,s){"use strict";var a=null;typeof Promise!="undefined"?a=Promise:a=i("lie"),n.exports={Promise:a}},{lie:37}],7:[function(i,n,s){"use strict";var a=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",o=i("pako"),l=i("./utils"),u=i("./stream/GenericWorker"),f=a?"uint8array":"array";s.magic="\b\0";function d(c,v){u.call(this,"FlateWorker/"+c),this._pako=null,this._pakoAction=c,this._pakoOptions=v,this.meta={}}l.inherits(d,u),d.prototype.processChunk=function(c){this.meta=c.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(f,c.data),!1)},d.prototype.flush=function(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var c=this;this._pako.onData=function(v){c.push({data:v,meta:c.meta})}},s.compressWorker=function(c){return new d("Deflate",c)},s.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(i,n,s){"use strict";var a=i("../utils"),o=i("../stream/GenericWorker"),l=i("../utf8"),u=i("../crc32"),f=i("../signature"),d=function(p,y){var T="",P;for(P=0;P>>8;return T},c=function(p,y){var T=p;return p||(T=y?16893:33204),(T&65535)<<16},v=function(p,y){return(p||0)&63},g=function(p,y,T,P,w,N){var C=p.file,M=p.compression,j=N!==l.utf8encode,q=a.transformTo("string",N(C.name)),G=a.transformTo("string",l.utf8encode(C.name)),H=C.comment,re=a.transformTo("string",N(H)),pe=a.transformTo("string",l.utf8encode(H)),ie=G.length!==C.name.length,de=pe.length!==H.length,fe,ae,be="",Re="",Te="",he=C.dir,Ce=C.date,Ee={crc32:0,compressedSize:0,uncompressedSize:0};(!y||T)&&(Ee.crc32=p.crc32,Ee.compressedSize=p.compressedSize,Ee.uncompressedSize=p.uncompressedSize);var Ge=0;y&&(Ge|=8),!j&&(ie||de)&&(Ge|=2048);var je=0,Me=0;he&&(je|=16),w==="UNIX"?(Me=798,je|=c(C.unixPermissions,he)):(Me=20,je|=v(C.dosPermissions,he)),fe=Ce.getUTCHours(),fe=fe<<6,fe=fe|Ce.getUTCMinutes(),fe=fe<<5,fe=fe|Ce.getUTCSeconds()/2,ae=Ce.getUTCFullYear()-1980,ae=ae<<4,ae=ae|Ce.getUTCMonth()+1,ae=ae<<5,ae=ae|Ce.getUTCDate(),ie&&(Re=d(1,1)+d(u(q),4)+G,be+="up"+d(Re.length,2)+Re),de&&(Te=d(1,1)+d(u(re),4)+pe,be+="uc"+d(Te.length,2)+Te);var _e="";_e+=` \0`,_e+=d(Ge,2),_e+=M.magic,_e+=d(fe,2),_e+=d(ae,2),_e+=d(Ee.crc32,4),_e+=d(Ee.compressedSize,4),_e+=d(Ee.uncompressedSize,4),_e+=d(q.length,2),_e+=d(be.length,2);var Ze=f.LOCAL_FILE_HEADER+_e+q+be,Be=f.CENTRAL_FILE_HEADER+d(Me,2)+_e+d(re.length,2)+"\0\0\0\0"+d(je,4)+d(P,4)+q+be+re;return{fileRecord:Ze,dirRecord:Be}},O=function(p,y,T,P,w){var N="",C=a.transformTo("string",w(P));return N=f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+d(p,2)+d(p,2)+d(y,4)+d(T,4)+d(C.length,2)+C,N},k=function(p){var y="";return y=f.DATA_DESCRIPTOR+d(p.crc32,4)+d(p.compressedSize,4)+d(p.uncompressedSize,4),y};function _(p,y,T,P){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=T,this.encodeFileName=P,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(_,o),_.prototype.push=function(p){var y=p.meta.percent||0,T=this.entriesCount,P=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,o.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:T?(y+100*(T-P-1))/T:100}}))},_.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var y=this.streamFiles&&!p.file.dir;if(y){var T=g(p,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:T.fileRecord,meta:{percent:0}})}else this.accumulate=!0},_.prototype.closedSource=function(p){this.accumulate=!1;var y=this.streamFiles&&!p.file.dir,T=g(p,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(T.dirRecord),y)this.push({data:k(p),meta:{percent:100}});else for(this.push({data:T.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},_.prototype.flush=function(){for(var p=this.bytesWritten,y=0;y0?w.substring(0,N):""},p=function(w){return w.slice(-1)!=="/"&&(w+="/"),w},y=function(w,N){return N=typeof N!="undefined"?N:f.createFolders,w=p(w),this.files[w]||k.call(this,w,null,{dir:!0,createFolders:N}),this.files[w]};function T(w){return Object.prototype.toString.call(w)==="[object RegExp]"}var P={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(w){var N,C,M;for(N in this.files)M=this.files[N],C=N.slice(this.root.length,N.length),C&&N.slice(0,this.root.length)===this.root&&w(C,M)},filter:function(w){var N=[];return this.forEach(function(C,M){w(C,M)&&N.push(M)}),N},file:function(w,N,C){if(arguments.length===1)if(T(w)){var M=w;return this.filter(function(q,G){return!G.dir&&M.test(q)})}else{var j=this.files[this.root+w];return j&&!j.dir?j:null}else w=this.root+w,k.call(this,w,N,C);return this},folder:function(w){if(!w)return this;if(T(w))return this.filter(function(j,q){return q.dir&&w.test(j)});var N=this.root+w,C=y.call(this,N),M=this.clone();return M.root=C.name,M},remove:function(w){w=this.root+w;var N=this.files[w];if(N||(w.slice(-1)!=="/"&&(w+="/"),N=this.files[w]),N&&!N.dir)delete this.files[w];else for(var C=this.filter(function(j,q){return q.name.slice(0,w.length)===w}),M=0;M=0;--g)if(this.data[g]===f&&this.data[g+1]===d&&this.data[g+2]===c&&this.data[g+3]===v)return g-this.zero;return-1},l.prototype.readAndCheckSignature=function(u){var f=u.charCodeAt(0),d=u.charCodeAt(1),c=u.charCodeAt(2),v=u.charCodeAt(3),g=this.readData(4);return f===g[0]&&d===g[1]&&c===g[2]&&v===g[3]},l.prototype.readData=function(u){if(this.checkOffset(u),u===0)return[];var f=this.data.slice(this.zero+this.index,this.zero+this.index+u);return this.index+=u,f},n.exports=l},{"../utils":32,"./DataReader":18}],18:[function(i,n,s){"use strict";var a=i("../utils");function o(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length=this.index;f--)u=(u<<8)+this.byteAt(f);return this.index+=l,u},readString:function(l){return a.transformTo("string",this.readData(l))},readData:function(l){},lastIndexOfSignature:function(l){},readAndCheckSignature:function(l){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC((l>>25&127)+1980,(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(l&31)<<1))}},n.exports=o},{"../utils":32}],19:[function(i,n,s){"use strict";var a=i("./Uint8ArrayReader"),o=i("../utils");function l(u){a.call(this,u)}o.inherits(l,a),l.prototype.readData=function(u){this.checkOffset(u);var f=this.data.slice(this.zero+this.index,this.zero+this.index+u);return this.index+=u,f},n.exports=l},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(i,n,s){"use strict";var a=i("./DataReader"),o=i("../utils");function l(u){a.call(this,u)}o.inherits(l,a),l.prototype.byteAt=function(u){return this.data.charCodeAt(this.zero+u)},l.prototype.lastIndexOfSignature=function(u){return this.data.lastIndexOf(u)-this.zero},l.prototype.readAndCheckSignature=function(u){var f=this.readData(4);return u===f},l.prototype.readData=function(u){this.checkOffset(u);var f=this.data.slice(this.zero+this.index,this.zero+this.index+u);return this.index+=u,f},n.exports=l},{"../utils":32,"./DataReader":18}],21:[function(i,n,s){"use strict";var a=i("./ArrayReader"),o=i("../utils");function l(u){a.call(this,u)}o.inherits(l,a),l.prototype.readData=function(u){if(this.checkOffset(u),u===0)return new Uint8Array(0);var f=this.data.subarray(this.zero+this.index,this.zero+this.index+u);return this.index+=u,f},n.exports=l},{"../utils":32,"./ArrayReader":17}],22:[function(i,n,s){"use strict";var a=i("../utils"),o=i("../support"),l=i("./ArrayReader"),u=i("./StringReader"),f=i("./NodeBufferReader"),d=i("./Uint8ArrayReader");n.exports=function(c){var v=a.getTypeOf(c);return a.checkSupport(v),v==="string"&&!o.uint8array?new u(c):v==="nodebuffer"?new f(c):o.uint8array?new d(a.transformTo("uint8array",c)):new l(a.transformTo("array",c))}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(i,n,s){"use strict";s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(i,n,s){"use strict";var a=i("./GenericWorker"),o=i("../utils");function l(u){a.call(this,"ConvertWorker to "+u),this.destType=u}o.inherits(l,a),l.prototype.processChunk=function(u){this.push({data:o.transformTo(this.destType,u.data),meta:u.meta})},n.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(i,n,s){"use strict";var a=i("./GenericWorker"),o=i("../crc32"),l=i("../utils");function u(){a.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}l.inherits(u,a),u.prototype.processChunk=function(f){this.streamInfo.crc32=o(f.data,this.streamInfo.crc32||0),this.push(f)},n.exports=u},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(i,n,s){"use strict";var a=i("../utils"),o=i("./GenericWorker");function l(u){o.call(this,"DataLengthProbe for "+u),this.propName=u,this.withStreamInfo(u,0)}a.inherits(l,o),l.prototype.processChunk=function(u){if(u){var f=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=f+u.data.length}o.prototype.processChunk.call(this,u)},n.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(i,n,s){"use strict";var a=i("../utils"),o=i("./GenericWorker"),l=16*1024;function u(f){o.call(this,"DataWorker");var d=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,f.then(function(c){d.dataIsReady=!0,d.data=c,d.max=c&&c.length||0,d.type=a.getTypeOf(c),d.isPaused||d._tickAndRepeat()},function(c){d.error(c)})}a.inherits(u,o),u.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},u.prototype.resume=function(){return o.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,a.delay(this._tickAndRepeat,[],this)),!0):!1},u.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(a.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},u.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var f=l,d=null,c=Math.min(this.max,this.index+f);if(this.index>=this.max)return this.end();switch(this.type){case"string":d=this.data.substring(this.index,c);break;case"uint8array":d=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":d=this.data.slice(this.index,c);break}return this.index=c,this.push({data:d,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=u},{"../utils":32,"./GenericWorker":28}],28:[function(i,n,s){"use strict";function a(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}a.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return this.isFinished?!1:(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,l){return this._listeners[o].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,l){if(this._listeners[o])for(var u=0;u "+o:o}},n.exports=a},{}],29:[function(i,n,s){"use strict";var a=i("../utils"),o=i("./ConvertWorker"),l=i("./GenericWorker"),u=i("../base64"),f=i("../support"),d=i("../external"),c=null;if(f.nodestream)try{c=i("../nodejs/NodejsStreamOutputAdapter")}catch(_){}function v(_,p,y){switch(_){case"blob":return a.newBlob(a.transformTo("arraybuffer",p),y);case"base64":return u.encode(p);default:return a.transformTo(_,p)}}function g(_,p){var y,T=0,P=null,w=0;for(y=0;y=252?6:d>=248?5:d>=240?4:d>=224?3:d>=192?2:1;f[254]=f[254]=1;var c=function(_){var p,y,T,P,w,N=_.length,C=0;for(P=0;P>>6,p[w++]=128|y&63):y<65536?(p[w++]=224|y>>>12,p[w++]=128|y>>>6&63,p[w++]=128|y&63):(p[w++]=240|y>>>18,p[w++]=128|y>>>12&63,p[w++]=128|y>>>6&63,p[w++]=128|y&63);return p},v=function(_,p){var y;for(p=p||_.length,p>_.length&&(p=_.length),y=p-1;y>=0&&(_[y]&192)==128;)y--;return y<0||y===0?p:y+f[_[y]]>p?y:p},g=function(_){var p,y,T,P,w,N=_.length,C=new Array(N*2);for(T=0,y=0;y4){C[T++]=65533,y+=w-1;continue}for(P&=w===2?31:w===3?15:7;w>1&&y1){C[T++]=65533;continue}P<65536?C[T++]=P:(P-=65536,C[T++]=55296|P>>10&1023,C[T++]=56320|P&1023)}return C.length!==T&&(C.subarray?C=C.subarray(0,T):C.length=T),a.applyFromCharCode(C)};s.utf8encode=function(p){return o.nodebuffer?l.newBufferFrom(p,"utf-8"):c(p)},s.utf8decode=function(p){return o.nodebuffer?a.transformTo("nodebuffer",p).toString("utf-8"):(p=a.transformTo(o.uint8array?"uint8array":"array",p),g(p))};function O(){u.call(this,"utf-8 decode"),this.leftOver=null}a.inherits(O,u),O.prototype.processChunk=function(_){var p=a.transformTo(o.uint8array?"uint8array":"array",_.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var y=p;p=new Uint8Array(y.length+this.leftOver.length),p.set(this.leftOver,0),p.set(y,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var T=v(p),P=p;T!==p.length&&(o.uint8array?(P=p.subarray(0,T),this.leftOver=p.subarray(T,p.length)):(P=p.slice(0,T),this.leftOver=p.slice(T,p.length))),this.push({data:s.utf8decode(P),meta:_.meta})},O.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=O;function k(){u.call(this,"utf-8 encode")}a.inherits(k,u),k.prototype.processChunk=function(_){this.push({data:s.utf8encode(_.data),meta:_.meta})},s.Utf8EncodeWorker=k},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(i,n,s){"use strict";var a=i("./support"),o=i("./base64"),l=i("./nodejsUtils"),u=i("set-immediate-shim"),f=i("./external");function d(p){var y=null;return a.uint8array?y=new Uint8Array(p.length):y=new Array(p.length),v(p,y)}s.newBlob=function(p,y){s.checkSupport("blob");try{return new Blob([p],{type:y})}catch(w){try{var T=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,P=new T;return P.append(p),P.getBlob(y)}catch(N){throw new Error("Bug : can't construct the Blob.")}}};function c(p){return p}function v(p,y){for(var T=0;T1;)try{return g.stringifyByChunk(p,T,y)}catch(w){y=Math.floor(y/2)}return g.stringifyByChar(p)}s.applyFromCharCode=O;function k(p,y){for(var T=0;T1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var v,g;for(v=0;v0)this.isSignature(O,l.CENTRAL_FILE_HEADER)||(this.reader.zero=_);else if(_<0)throw new Error("Corrupted zip: missing "+Math.abs(_)+" bytes.")},prepareReader:function(v){this.reader=a(v)},load:function(v){this.prepareReader(v),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},n.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(i,n,s){"use strict";var a=i("./reader/readerFor"),o=i("./utils"),l=i("./compressedObject"),u=i("./crc32"),f=i("./utf8"),d=i("./compressions"),c=i("./support"),v=0,g=3,O=function(_){for(var p in d)if(!!d.hasOwnProperty(p)&&d[p].magic===_)return d[p];return null};function k(_,p){this.options=_,this.loadOptions=p}k.prototype={isEncrypted:function(){return(this.bitFlag&1)==1},useUTF8:function(){return(this.bitFlag&2048)==2048},readLocalPart:function(_){var p,y;if(_.skip(22),this.fileNameLength=_.readInt(2),y=_.readInt(2),this.fileName=_.readData(this.fileNameLength),_.skip(y),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(p=O(this.compressionMethod),p===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,p,_.readData(this.compressedSize))},readCentralPart:function(_){this.versionMadeBy=_.readInt(2),_.skip(2),this.bitFlag=_.readInt(2),this.compressionMethod=_.readString(2),this.date=_.readDate(),this.crc32=_.readInt(4),this.compressedSize=_.readInt(4),this.uncompressedSize=_.readInt(4);var p=_.readInt(2);if(this.extraFieldsLength=_.readInt(2),this.fileCommentLength=_.readInt(2),this.diskNumberStart=_.readInt(2),this.internalFileAttributes=_.readInt(2),this.externalFileAttributes=_.readInt(4),this.localHeaderOffset=_.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");_.skip(p),this.readExtraFields(_),this.parseZIP64ExtraField(_),this.fileComment=_.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var _=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),_===v&&(this.dosPermissions=this.externalFileAttributes&63),_===g&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(_){if(!!this.extraFields[1]){var p=a(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(_){var p=_.index+this.extraFieldsLength,y,T,P;for(this.extraFields||(this.extraFields={});_.index+40?M.windowBits=-M.windowBits:M.gzip&&M.windowBits>0&&M.windowBits<16&&(M.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;var j=a.deflateInit2(this.strm,M.level,M.method,M.windowBits,M.memLevel,M.strategy);if(j!==g)throw new Error(u[j]);if(M.header&&a.deflateSetHeader(this.strm,M.header),M.dictionary){var q;if(typeof M.dictionary=="string"?q=l.string2buf(M.dictionary):d.call(M.dictionary)==="[object ArrayBuffer]"?q=new Uint8Array(M.dictionary):q=M.dictionary,j=a.deflateSetDictionary(this.strm,q),j!==g)throw new Error(u[j]);this._dict_set=!0}}T.prototype.push=function(C,M){var j=this.strm,q=this.options.chunkSize,G,H;if(this.ended)return!1;H=M===~~M?M:M===!0?v:c,typeof C=="string"?j.input=l.string2buf(C):d.call(C)==="[object ArrayBuffer]"?j.input=new Uint8Array(C):j.input=C,j.next_in=0,j.avail_in=j.input.length;do{if(j.avail_out===0&&(j.output=new o.Buf8(q),j.next_out=0,j.avail_out=q),G=a.deflate(j,H),G!==O&&G!==g)return this.onEnd(G),this.ended=!0,!1;(j.avail_out===0||j.avail_in===0&&(H===v||H===k))&&(this.options.to==="string"?this.onData(l.buf2binstring(o.shrinkBuf(j.output,j.next_out))):this.onData(o.shrinkBuf(j.output,j.next_out)))}while((j.avail_in>0||j.avail_out===0)&&G!==O);return H===v?(G=a.deflateEnd(this.strm),this.onEnd(G),this.ended=!0,G===g):(H===k&&(this.onEnd(g),j.avail_out=0),!0)},T.prototype.onData=function(C){this.chunks.push(C)},T.prototype.onEnd=function(C){C===g&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=C,this.msg=this.strm.msg};function P(C,M){var j=new T(M);if(j.push(C,!0),j.err)throw j.msg||u[j.err];return j.result}function w(C,M){return M=M||{},M.raw=!0,P(C,M)}function N(C,M){return M=M||{},M.gzip=!0,P(C,M)}s.Deflate=T,s.deflate=P,s.deflateRaw=w,s.gzip=N},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(i,n,s){"use strict";var a=i("./zlib/inflate"),o=i("./utils/common"),l=i("./utils/strings"),u=i("./zlib/constants"),f=i("./zlib/messages"),d=i("./zlib/zstream"),c=i("./zlib/gzheader"),v=Object.prototype.toString;function g(_){if(!(this instanceof g))return new g(_);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},_||{});var p=this.options;p.raw&&p.windowBits>=0&&p.windowBits<16&&(p.windowBits=-p.windowBits,p.windowBits===0&&(p.windowBits=-15)),p.windowBits>=0&&p.windowBits<16&&!(_&&_.windowBits)&&(p.windowBits+=32),p.windowBits>15&&p.windowBits<48&&(p.windowBits&15)==0&&(p.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var y=a.inflateInit2(this.strm,p.windowBits);if(y!==u.Z_OK)throw new Error(f[y]);this.header=new c,a.inflateGetHeader(this.strm,this.header)}g.prototype.push=function(_,p){var y=this.strm,T=this.options.chunkSize,P=this.options.dictionary,w,N,C,M,j,q,G=!1;if(this.ended)return!1;N=p===~~p?p:p===!0?u.Z_FINISH:u.Z_NO_FLUSH,typeof _=="string"?y.input=l.binstring2buf(_):v.call(_)==="[object ArrayBuffer]"?y.input=new Uint8Array(_):y.input=_,y.next_in=0,y.avail_in=y.input.length;do{if(y.avail_out===0&&(y.output=new o.Buf8(T),y.next_out=0,y.avail_out=T),w=a.inflate(y,u.Z_NO_FLUSH),w===u.Z_NEED_DICT&&P&&(typeof P=="string"?q=l.string2buf(P):v.call(P)==="[object ArrayBuffer]"?q=new Uint8Array(P):q=P,w=a.inflateSetDictionary(this.strm,q)),w===u.Z_BUF_ERROR&&G===!0&&(w=u.Z_OK,G=!1),w!==u.Z_STREAM_END&&w!==u.Z_OK)return this.onEnd(w),this.ended=!0,!1;y.next_out&&(y.avail_out===0||w===u.Z_STREAM_END||y.avail_in===0&&(N===u.Z_FINISH||N===u.Z_SYNC_FLUSH))&&(this.options.to==="string"?(C=l.utf8border(y.output,y.next_out),M=y.next_out-C,j=l.buf2string(y.output,C),y.next_out=M,y.avail_out=T-M,M&&o.arraySet(y.output,y.output,C,M,0),this.onData(j)):this.onData(o.shrinkBuf(y.output,y.next_out))),y.avail_in===0&&y.avail_out===0&&(G=!0)}while((y.avail_in>0||y.avail_out===0)&&w!==u.Z_STREAM_END);return w===u.Z_STREAM_END&&(N=u.Z_FINISH),N===u.Z_FINISH?(w=a.inflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===u.Z_OK):(N===u.Z_SYNC_FLUSH&&(this.onEnd(u.Z_OK),y.avail_out=0),!0)},g.prototype.onData=function(_){this.chunks.push(_)},g.prototype.onEnd=function(_){_===u.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=_,this.msg=this.strm.msg};function O(_,p){var y=new g(p);if(y.push(_,!0),y.err)throw y.msg||f[y.err];return y.result}function k(_,p){return p=p||{},p.raw=!0,O(_,p)}s.Inflate=g,s.inflate=O,s.inflateRaw=k,s.ungzip=O},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(i,n,s){"use strict";var a=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";s.assign=function(u){for(var f=Array.prototype.slice.call(arguments,1);f.length;){var d=f.shift();if(!!d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var c in d)d.hasOwnProperty(c)&&(u[c]=d[c])}}return u},s.shrinkBuf=function(u,f){return u.length===f?u:u.subarray?u.subarray(0,f):(u.length=f,u)};var o={arraySet:function(u,f,d,c,v){if(f.subarray&&u.subarray){u.set(f.subarray(d,d+c),v);return}for(var g=0;g=252?6:f>=248?5:f>=240?4:f>=224?3:f>=192?2:1;u[254]=u[254]=1,s.string2buf=function(c){var v,g,O,k,_,p=c.length,y=0;for(k=0;k>>6,v[_++]=128|g&63):g<65536?(v[_++]=224|g>>>12,v[_++]=128|g>>>6&63,v[_++]=128|g&63):(v[_++]=240|g>>>18,v[_++]=128|g>>>12&63,v[_++]=128|g>>>6&63,v[_++]=128|g&63);return v};function d(c,v){if(v<65537&&(c.subarray&&l||!c.subarray&&o))return String.fromCharCode.apply(null,a.shrinkBuf(c,v));for(var g="",O=0;O4){y[O++]=65533,g+=_-1;continue}for(k&=_===2?31:_===3?15:7;_>1&&g1){y[O++]=65533;continue}k<65536?y[O++]=k:(k-=65536,y[O++]=55296|k>>10&1023,y[O++]=56320|k&1023)}return d(y,O)},s.utf8border=function(c,v){var g;for(v=v||c.length,v>c.length&&(v=c.length),g=v-1;g>=0&&(c[g]&192)==128;)g--;return g<0||g===0?v:g+u[c[g]]>v?g:v}},{"./common":41}],43:[function(i,n,s){"use strict";function a(o,l,u,f){for(var d=o&65535|0,c=o>>>16&65535|0,v=0;u!==0;){v=u>2e3?2e3:u,u-=v;do d=d+l[f++]|0,c=c+d|0;while(--v);d%=65521,c%=65521}return d|c<<16|0}n.exports=a},{}],44:[function(i,n,s){"use strict";n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(i,n,s){"use strict";function a(){for(var u,f=[],d=0;d<256;d++){u=d;for(var c=0;c<8;c++)u=u&1?3988292384^u>>>1:u>>>1;f[d]=u}return f}var o=a();function l(u,f,d,c){var v=o,g=c+d;u^=-1;for(var O=c;O>>8^v[(u^f[O])&255];return u^-1}n.exports=l},{}],46:[function(i,n,s){"use strict";var a=i("../utils/common"),o=i("./trees"),l=i("./adler32"),u=i("./crc32"),f=i("./messages"),d=0,c=1,v=3,g=4,O=5,k=0,_=1,p=-2,y=-3,T=-5,P=-1,w=1,N=2,C=3,M=4,j=0,q=2,G=8,H=9,re=15,pe=8,ie=29,de=256,fe=de+1+ie,ae=30,be=19,Re=2*fe+1,Te=15,he=3,Ce=258,Ee=Ce+he+1,Ge=32,je=42,Me=69,_e=73,Ze=91,Be=103,ke=113,Le=666,xe=1,$e=2,Fe=3,ft=4,Se=3;function Ve(h,U){return h.msg=f[U],U}function Dt(h){return(h<<1)-(h>4?9:0)}function rt(h){for(var U=h.length;--U>=0;)h[U]=0}function Qe(h){var U=h.state,F=U.pending;F>h.avail_out&&(F=h.avail_out),F!==0&&(a.arraySet(h.output,U.pending_buf,U.pending_out,F,h.next_out),h.next_out+=F,U.pending_out+=F,h.total_out+=F,h.avail_out-=F,U.pending-=F,U.pending===0&&(U.pending_out=0))}function Ae(h,U){o._tr_flush_block(h,h.block_start>=0?h.block_start:-1,h.strstart-h.block_start,U),h.block_start=h.strstart,Qe(h.strm)}function ge(h,U){h.pending_buf[h.pending++]=U}function lt(h,U){h.pending_buf[h.pending++]=U>>>8&255,h.pending_buf[h.pending++]=U&255}function Gt(h,U,F,b){var A=h.avail_in;return A>b&&(A=b),A===0?0:(h.avail_in-=A,a.arraySet(U,h.input,h.next_in,A,F),h.state.wrap===1?h.adler=l(h.adler,U,A,F):h.state.wrap===2&&(h.adler=u(h.adler,U,A,F)),h.next_in+=A,h.total_in+=A,A)}function Pt(h,U){var F=h.max_chain_length,b=h.strstart,A,B,oe=h.prev_length,te=h.nice_match,se=h.strstart>h.w_size-Ee?h.strstart-(h.w_size-Ee):0,ye=h.window,Mt=h.w_mask,ze=h.prev,we=h.strstart+Ce,qe=ye[b+oe-1],Ke=ye[b+oe];h.prev_length>=h.good_match&&(F>>=2),te>h.lookahead&&(te=h.lookahead);do if(A=U,!(ye[A+oe]!==Ke||ye[A+oe-1]!==qe||ye[A]!==ye[b]||ye[++A]!==ye[b+1])){b+=2,A++;do;while(ye[++b]===ye[++A]&&ye[++b]===ye[++A]&&ye[++b]===ye[++A]&&ye[++b]===ye[++A]&&ye[++b]===ye[++A]&&ye[++b]===ye[++A]&&ye[++b]===ye[++A]&&ye[++b]===ye[++A]&&boe){if(h.match_start=U,oe=B,B>=te)break;qe=ye[b+oe-1],Ke=ye[b+oe]}}while((U=ze[U&Mt])>se&&--F!=0);return oe<=h.lookahead?oe:h.lookahead}function ut(h){var U=h.w_size,F,b,A,B,oe;do{if(B=h.window_size-h.lookahead-h.strstart,h.strstart>=U+(U-Ee)){a.arraySet(h.window,h.window,U,U,0),h.match_start-=U,h.strstart-=U,h.block_start-=U,b=h.hash_size,F=b;do A=h.head[--F],h.head[F]=A>=U?A-U:0;while(--b);b=U,F=b;do A=h.prev[--F],h.prev[F]=A>=U?A-U:0;while(--b);B+=U}if(h.strm.avail_in===0)break;if(b=Gt(h.strm,h.window,h.strstart+h.lookahead,B),h.lookahead+=b,h.lookahead+h.insert>=he)for(oe=h.strstart-h.insert,h.ins_h=h.window[oe],h.ins_h=(h.ins_h<h.pending_buf_size-5&&(F=h.pending_buf_size-5);;){if(h.lookahead<=1){if(ut(h),h.lookahead===0&&U===d)return xe;if(h.lookahead===0)break}h.strstart+=h.lookahead,h.lookahead=0;var b=h.block_start+F;if((h.strstart===0||h.strstart>=b)&&(h.lookahead=h.strstart-b,h.strstart=b,Ae(h,!1),h.strm.avail_out===0)||h.strstart-h.block_start>=h.w_size-Ee&&(Ae(h,!1),h.strm.avail_out===0))return xe}return h.insert=0,U===g?(Ae(h,!0),h.strm.avail_out===0?Fe:ft):(h.strstart>h.block_start&&(Ae(h,!1),h.strm.avail_out===0),xe)}function Lt(h,U){for(var F,b;;){if(h.lookahead=he&&(h.ins_h=(h.ins_h<=he)if(b=o._tr_tally(h,h.strstart-h.match_start,h.match_length-he),h.lookahead-=h.match_length,h.match_length<=h.max_lazy_match&&h.lookahead>=he){h.match_length--;do h.strstart++,h.ins_h=(h.ins_h<=he&&(h.ins_h=(h.ins_h<4096)&&(h.match_length=he-1)),h.prev_length>=he&&h.match_length<=h.prev_length){A=h.strstart+h.lookahead-he,b=o._tr_tally(h,h.strstart-1-h.prev_match,h.prev_length-he),h.lookahead-=h.prev_length-1,h.prev_length-=2;do++h.strstart<=A&&(h.ins_h=(h.ins_h<=he&&h.strstart>0&&(A=h.strstart-1,b=oe[A],b===oe[++A]&&b===oe[++A]&&b===oe[++A])){B=h.strstart+Ce;do;while(b===oe[++A]&&b===oe[++A]&&b===oe[++A]&&b===oe[++A]&&b===oe[++A]&&b===oe[++A]&&b===oe[++A]&&b===oe[++A]&&Ah.lookahead&&(h.match_length=h.lookahead)}if(h.match_length>=he?(F=o._tr_tally(h,1,h.match_length-he),h.lookahead-=h.match_length,h.strstart+=h.match_length,h.match_length=0):(F=o._tr_tally(h,0,h.window[h.strstart]),h.lookahead--,h.strstart++),F&&(Ae(h,!1),h.strm.avail_out===0))return xe}return h.insert=0,U===g?(Ae(h,!0),h.strm.avail_out===0?Fe:ft):h.last_lit&&(Ae(h,!1),h.strm.avail_out===0)?xe:$e}function zt(h,U){for(var F;;){if(h.lookahead===0&&(ut(h),h.lookahead===0)){if(U===d)return xe;break}if(h.match_length=0,F=o._tr_tally(h,0,h.window[h.strstart]),h.lookahead--,h.strstart++,F&&(Ae(h,!1),h.strm.avail_out===0))return xe}return h.insert=0,U===g?(Ae(h,!0),h.strm.avail_out===0?Fe:ft):h.last_lit&&(Ae(h,!1),h.strm.avail_out===0)?xe:$e}function Xe(h,U,F,b,A){this.good_length=h,this.max_lazy=U,this.nice_length=F,this.max_chain=b,this.func=A}var dt;dt=[new Xe(0,0,0,0,$t),new Xe(4,4,8,4,Lt),new Xe(4,5,16,8,Lt),new Xe(4,6,32,32,Lt),new Xe(4,4,16,16,ct),new Xe(8,16,32,32,ct),new Xe(8,16,128,128,ct),new Xe(8,32,128,256,ct),new Xe(32,128,258,1024,ct),new Xe(32,258,258,4096,ct)];function ni(h){h.window_size=2*h.w_size,rt(h.head),h.max_lazy_match=dt[h.level].max_lazy,h.good_match=dt[h.level].good_length,h.nice_match=dt[h.level].nice_length,h.max_chain_length=dt[h.level].max_chain,h.strstart=0,h.block_start=0,h.lookahead=0,h.insert=0,h.match_length=h.prev_length=he-1,h.match_available=0,h.ins_h=0}function x(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=G,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(Re*2),this.dyn_dtree=new a.Buf16((2*ae+1)*2),this.bl_tree=new a.Buf16((2*be+1)*2),rt(this.dyn_ltree),rt(this.dyn_dtree),rt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(Te+1),this.heap=new a.Buf16(2*fe+1),rt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*fe+1),rt(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Z(h){var U;return!h||!h.state?Ve(h,p):(h.total_in=h.total_out=0,h.data_type=q,U=h.state,U.pending=0,U.pending_out=0,U.wrap<0&&(U.wrap=-U.wrap),U.status=U.wrap?je:ke,h.adler=U.wrap===2?0:1,U.last_flush=d,o._tr_init(U),k)}function K(h){var U=Z(h);return U===k&&ni(h.state),U}function ne(h,U){return!h||!h.state||h.state.wrap!==2?p:(h.state.gzhead=U,k)}function I(h,U,F,b,A,B){if(!h)return p;var oe=1;if(U===P&&(U=6),b<0?(oe=0,b=-b):b>15&&(oe=2,b-=16),A<1||A>H||F!==G||b<8||b>15||U<0||U>9||B<0||B>M)return Ve(h,p);b===8&&(b=9);var te=new x;return h.state=te,te.strm=h,te.wrap=oe,te.gzhead=null,te.w_bits=b,te.w_size=1<O||U<0)return h?Ve(h,p):p;if(b=h.state,!h.output||!h.input&&h.avail_in!==0||b.status===Le&&U!==g)return Ve(h,h.avail_out===0?T:p);if(b.strm=h,F=b.last_flush,b.last_flush=U,b.status===je)if(b.wrap===2)h.adler=0,ge(b,31),ge(b,139),ge(b,8),b.gzhead?(ge(b,(b.gzhead.text?1:0)+(b.gzhead.hcrc?2:0)+(b.gzhead.extra?4:0)+(b.gzhead.name?8:0)+(b.gzhead.comment?16:0)),ge(b,b.gzhead.time&255),ge(b,b.gzhead.time>>8&255),ge(b,b.gzhead.time>>16&255),ge(b,b.gzhead.time>>24&255),ge(b,b.level===9?2:b.strategy>=N||b.level<2?4:0),ge(b,b.gzhead.os&255),b.gzhead.extra&&b.gzhead.extra.length&&(ge(b,b.gzhead.extra.length&255),ge(b,b.gzhead.extra.length>>8&255)),b.gzhead.hcrc&&(h.adler=u(h.adler,b.pending_buf,b.pending,0)),b.gzindex=0,b.status=Me):(ge(b,0),ge(b,0),ge(b,0),ge(b,0),ge(b,0),ge(b,b.level===9?2:b.strategy>=N||b.level<2?4:0),ge(b,Se),b.status=ke);else{var oe=G+(b.w_bits-8<<4)<<8,te=-1;b.strategy>=N||b.level<2?te=0:b.level<6?te=1:b.level===6?te=2:te=3,oe|=te<<6,b.strstart!==0&&(oe|=Ge),oe+=31-oe%31,b.status=ke,lt(b,oe),b.strstart!==0&&(lt(b,h.adler>>>16),lt(b,h.adler&65535)),h.adler=1}if(b.status===Me)if(b.gzhead.extra){for(A=b.pending;b.gzindex<(b.gzhead.extra.length&65535)&&!(b.pending===b.pending_buf_size&&(b.gzhead.hcrc&&b.pending>A&&(h.adler=u(h.adler,b.pending_buf,b.pending-A,A)),Qe(h),A=b.pending,b.pending===b.pending_buf_size));)ge(b,b.gzhead.extra[b.gzindex]&255),b.gzindex++;b.gzhead.hcrc&&b.pending>A&&(h.adler=u(h.adler,b.pending_buf,b.pending-A,A)),b.gzindex===b.gzhead.extra.length&&(b.gzindex=0,b.status=_e)}else b.status=_e;if(b.status===_e)if(b.gzhead.name){A=b.pending;do{if(b.pending===b.pending_buf_size&&(b.gzhead.hcrc&&b.pending>A&&(h.adler=u(h.adler,b.pending_buf,b.pending-A,A)),Qe(h),A=b.pending,b.pending===b.pending_buf_size)){B=1;break}b.gzindexA&&(h.adler=u(h.adler,b.pending_buf,b.pending-A,A)),B===0&&(b.gzindex=0,b.status=Ze)}else b.status=Ze;if(b.status===Ze)if(b.gzhead.comment){A=b.pending;do{if(b.pending===b.pending_buf_size&&(b.gzhead.hcrc&&b.pending>A&&(h.adler=u(h.adler,b.pending_buf,b.pending-A,A)),Qe(h),A=b.pending,b.pending===b.pending_buf_size)){B=1;break}b.gzindexA&&(h.adler=u(h.adler,b.pending_buf,b.pending-A,A)),B===0&&(b.status=Be)}else b.status=Be;if(b.status===Be&&(b.gzhead.hcrc?(b.pending+2>b.pending_buf_size&&Qe(h),b.pending+2<=b.pending_buf_size&&(ge(b,h.adler&255),ge(b,h.adler>>8&255),h.adler=0,b.status=ke)):b.status=ke),b.pending!==0){if(Qe(h),h.avail_out===0)return b.last_flush=-1,k}else if(h.avail_in===0&&Dt(U)<=Dt(F)&&U!==g)return Ve(h,T);if(b.status===Le&&h.avail_in!==0)return Ve(h,T);if(h.avail_in!==0||b.lookahead!==0||U!==d&&b.status!==Le){var se=b.strategy===N?zt(b,U):b.strategy===C?Kt(b,U):dt[b.level].func(b,U);if((se===Fe||se===ft)&&(b.status=Le),se===xe||se===Fe)return h.avail_out===0&&(b.last_flush=-1),k;if(se===$e&&(U===c?o._tr_align(b):U!==O&&(o._tr_stored_block(b,0,0,!1),U===v&&(rt(b.head),b.lookahead===0&&(b.strstart=0,b.block_start=0,b.insert=0))),Qe(h),h.avail_out===0))return b.last_flush=-1,k}return U!==g?k:b.wrap<=0?_:(b.wrap===2?(ge(b,h.adler&255),ge(b,h.adler>>8&255),ge(b,h.adler>>16&255),ge(b,h.adler>>24&255),ge(b,h.total_in&255),ge(b,h.total_in>>8&255),ge(b,h.total_in>>16&255),ge(b,h.total_in>>24&255)):(lt(b,h.adler>>>16),lt(b,h.adler&65535)),Qe(h),b.wrap>0&&(b.wrap=-b.wrap),b.pending!==0?k:_)}function X(h){var U;return!h||!h.state?p:(U=h.state.status,U!==je&&U!==Me&&U!==_e&&U!==Ze&&U!==Be&&U!==ke&&U!==Le?Ve(h,p):(h.state=null,U===ke?Ve(h,y):k))}function ce(h,U){var F=U.length,b,A,B,oe,te,se,ye,Mt;if(!h||!h.state||(b=h.state,oe=b.wrap,oe===2||oe===1&&b.status!==je||b.lookahead))return p;for(oe===1&&(h.adler=l(h.adler,U,F,0)),b.wrap=0,F>=b.w_size&&(oe===0&&(rt(b.head),b.strstart=0,b.block_start=0,b.insert=0),Mt=new a.Buf8(b.w_size),a.arraySet(Mt,U,F-b.w_size,b.w_size,0),U=Mt,F=b.w_size),te=h.avail_in,se=h.next_in,ye=h.input,h.avail_in=F,h.next_in=0,h.input=U,ut(b);b.lookahead>=he;){A=b.strstart,B=b.lookahead-(he-1);do b.ins_h=(b.ins_h<>>24,w>>>=H,N-=H,H=G>>>16&255,H===0)ae[g++]=G&65535;else if(H&16){re=G&65535,H&=15,H&&(N>>=H,N-=H),N<15&&(w+=fe[c++]<>>24,w>>>=H,N-=H,H=G>>>16&255,H&16){if(pe=G&65535,H&=15,N_){u.msg="invalid distance too far back",d.mode=a;break e}if(w>>>=H,N-=H,H=g-O,pe>H){if(H=pe-H,H>y&&d.sane){u.msg="invalid distance too far back",d.mode=a;break e}if(ie=0,de=P,T===0){if(ie+=p-H,H2;)ae[g++]=de[ie++],ae[g++]=de[ie++],ae[g++]=de[ie++],re-=3;re&&(ae[g++]=de[ie++],re>1&&(ae[g++]=de[ie++]))}else{ie=g-pe;do ae[g++]=ae[ie++],ae[g++]=ae[ie++],ae[g++]=ae[ie++],re-=3;while(re>2);re&&(ae[g++]=ae[ie++],re>1&&(ae[g++]=ae[ie++]))}}else if((H&64)==0){G=M[(G&65535)+(w&(1<>3,c-=re,N-=re<<3,w&=(1<>>24&255)+(I>>>8&65280)+((I&65280)<<8)+((I&255)<<24)}function Gt(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new a.Buf16(320),this.work=new a.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Pt(I){var W;return!I||!I.state?T:(W=I.state,I.total_in=I.total_out=W.total=0,I.msg="",W.wrap&&(I.adler=W.wrap&1),W.mode=M,W.last=0,W.havedict=0,W.dmax=32768,W.head=null,W.hold=0,W.bits=0,W.lencode=W.lendyn=new a.Buf32(rt),W.distcode=W.distdyn=new a.Buf32(Qe),W.sane=1,W.back=-1,_)}function ut(I){var W;return!I||!I.state?T:(W=I.state,W.wsize=0,W.whave=0,W.wnext=0,Pt(I))}function $t(I,W){var m,X;return!I||!I.state||(X=I.state,W<0?(m=0,W=-W):(m=(W>>4)+1,W<48&&(W&=15)),W&&(W<8||W>15))?T:(X.window!==null&&X.wbits!==W&&(X.window=null),X.wrap=m,X.wbits=W,ut(I))}function Lt(I,W){var m,X;return I?(X=new Gt,I.state=X,X.window=null,m=$t(I,W),m!==_&&(I.state=null),m):T}function ct(I){return Lt(I,ge)}var Kt=!0,zt,Xe;function dt(I){if(Kt){var W;for(zt=new a.Buf32(512),Xe=new a.Buf32(32),W=0;W<144;)I.lens[W++]=8;for(;W<256;)I.lens[W++]=9;for(;W<280;)I.lens[W++]=7;for(;W<288;)I.lens[W++]=8;for(f(c,I.lens,0,288,zt,0,I.work,{bits:9}),W=0;W<32;)I.lens[W++]=5;f(v,I.lens,0,32,Xe,0,I.work,{bits:5}),Kt=!1}I.lencode=zt,I.lenbits=9,I.distcode=Xe,I.distbits=5}function ni(I,W,m,X){var ce,h=I.state;return h.window===null&&(h.wsize=1<=h.wsize?(a.arraySet(h.window,W,m-h.wsize,h.wsize,0),h.wnext=0,h.whave=h.wsize):(ce=h.wsize-h.wnext,ce>X&&(ce=X),a.arraySet(h.window,W,m-X,ce,h.wnext),X-=ce,X?(a.arraySet(h.window,W,m-X,X,0),h.wnext=X,h.whave=h.wsize):(h.wnext+=ce,h.wnext===h.wsize&&(h.wnext=0),h.whave>>8&255,m.check=l(m.check,Ye,2,0),A=0,B=0,m.mode=j;break}if(m.flags=0,m.head&&(m.head.done=!1),!(m.wrap&1)||(((A&255)<<8)+(A>>8))%31){I.msg="incorrect header check",m.mode=Se;break}if((A&15)!==C){I.msg="unknown compression method",m.mode=Se;break}if(A>>>=4,B-=4,Ue=(A&15)+8,m.wbits===0)m.wbits=Ue;else if(Ue>m.wbits){I.msg="invalid window size",m.mode=Se;break}m.dmax=1<>8&1),m.flags&512&&(Ye[0]=A&255,Ye[1]=A>>>8&255,m.check=l(m.check,Ye,2,0)),A=0,B=0,m.mode=q;case q:for(;B<32;){if(F===0)break e;F--,A+=X[h++]<>>8&255,Ye[2]=A>>>16&255,Ye[3]=A>>>24&255,m.check=l(m.check,Ye,4,0)),A=0,B=0,m.mode=G;case G:for(;B<16;){if(F===0)break e;F--,A+=X[h++]<>8),m.flags&512&&(Ye[0]=A&255,Ye[1]=A>>>8&255,m.check=l(m.check,Ye,2,0)),A=0,B=0,m.mode=H;case H:if(m.flags&1024){for(;B<16;){if(F===0)break e;F--,A+=X[h++]<>>8&255,m.check=l(m.check,Ye,2,0)),A=0,B=0}else m.head&&(m.head.extra=null);m.mode=re;case re:if(m.flags&1024&&(se=m.length,se>F&&(se=F),se&&(m.head&&(Ue=m.head.extra_len-m.length,m.head.extra||(m.head.extra=new Array(m.head.extra_len)),a.arraySet(m.head.extra,X,h,se,Ue)),m.flags&512&&(m.check=l(m.check,X,se,h)),F-=se,h+=se,m.length-=se),m.length))break e;m.length=0,m.mode=pe;case pe:if(m.flags&2048){if(F===0)break e;se=0;do Ue=X[h+se++],m.head&&Ue&&m.length<65536&&(m.head.name+=String.fromCharCode(Ue));while(Ue&&se>9&1,m.head.done=!0),I.adler=m.check=0,m.mode=be;break;case fe:for(;B<32;){if(F===0)break e;F--,A+=X[h++]<>>=B&7,B-=B&7,m.mode=$e;break}for(;B<3;){if(F===0)break e;F--,A+=X[h++]<>>=1,B-=1,A&3){case 0:m.mode=Te;break;case 1:if(dt(m),m.mode=Me,W===k){A>>>=2,B-=2;break e}break;case 2:m.mode=Ee;break;case 3:I.msg="invalid block type",m.mode=Se}A>>>=2,B-=2;break;case Te:for(A>>>=B&7,B-=B&7;B<32;){if(F===0)break e;F--,A+=X[h++]<>>16^65535)){I.msg="invalid stored block lengths",m.mode=Se;break}if(m.length=A&65535,A=0,B=0,m.mode=he,W===k)break e;case he:m.mode=Ce;case Ce:if(se=m.length,se){if(se>F&&(se=F),se>b&&(se=b),se===0)break e;a.arraySet(ce,X,h,se,U),F-=se,h+=se,b-=se,U+=se,m.length-=se;break}m.mode=be;break;case Ee:for(;B<14;){if(F===0)break e;F--,A+=X[h++]<>>=5,B-=5,m.ndist=(A&31)+1,A>>>=5,B-=5,m.ncode=(A&15)+4,A>>>=4,B-=4,m.nlen>286||m.ndist>30){I.msg="too many length or distance symbols",m.mode=Se;break}m.have=0,m.mode=Ge;case Ge:for(;m.have>>=3,B-=3}for(;m.have<19;)m.lens[Vr[m.have++]]=0;if(m.lencode=m.lendyn,m.lenbits=7,Bt={bits:m.lenbits},pt=f(d,m.lens,0,19,m.lencode,0,m.work,Bt),m.lenbits=Bt.bits,pt){I.msg="invalid code lengths set",m.mode=Se;break}m.have=0,m.mode=je;case je:for(;m.have>>24,qe=ze>>>16&255,Ke=ze&65535,!(we<=B);){if(F===0)break e;F--,A+=X[h++]<>>=we,B-=we,m.lens[m.have++]=Ke;else{if(Ke===16){for(xt=we+2;B>>=we,B-=we,m.have===0){I.msg="invalid bit length repeat",m.mode=Se;break}Ue=m.lens[m.have-1],se=3+(A&3),A>>>=2,B-=2}else if(Ke===17){for(xt=we+3;B>>=we,B-=we,Ue=0,se=3+(A&7),A>>>=3,B-=3}else{for(xt=we+7;B>>=we,B-=we,Ue=0,se=11+(A&127),A>>>=7,B-=7}if(m.have+se>m.nlen+m.ndist){I.msg="invalid bit length repeat",m.mode=Se;break}for(;se--;)m.lens[m.have++]=Ue}}if(m.mode===Se)break;if(m.lens[256]===0){I.msg="invalid code -- missing end-of-block",m.mode=Se;break}if(m.lenbits=9,Bt={bits:m.lenbits},pt=f(c,m.lens,0,m.nlen,m.lencode,0,m.work,Bt),m.lenbits=Bt.bits,pt){I.msg="invalid literal/lengths set",m.mode=Se;break}if(m.distbits=6,m.distcode=m.distdyn,Bt={bits:m.distbits},pt=f(v,m.lens,m.nlen,m.ndist,m.distcode,0,m.work,Bt),m.distbits=Bt.bits,pt){I.msg="invalid distances set",m.mode=Se;break}if(m.mode=Me,W===k)break e;case Me:m.mode=_e;case _e:if(F>=6&&b>=258){I.next_out=U,I.avail_out=b,I.next_in=h,I.avail_in=F,m.hold=A,m.bits=B,u(I,te),U=I.next_out,ce=I.output,b=I.avail_out,h=I.next_in,X=I.input,F=I.avail_in,A=m.hold,B=m.bits,m.mode===be&&(m.back=-1);break}for(m.back=0;ze=m.lencode[A&(1<>>24,qe=ze>>>16&255,Ke=ze&65535,!(we<=B);){if(F===0)break e;F--,A+=X[h++]<>nt)],we=ze>>>24,qe=ze>>>16&255,Ke=ze&65535,!(nt+we<=B);){if(F===0)break e;F--,A+=X[h++]<>>=nt,B-=nt,m.back+=nt}if(A>>>=we,B-=we,m.back+=we,m.length=Ke,qe===0){m.mode=xe;break}if(qe&32){m.back=-1,m.mode=be;break}if(qe&64){I.msg="invalid literal/length code",m.mode=Se;break}m.extra=qe&15,m.mode=Ze;case Ze:if(m.extra){for(xt=m.extra;B>>=m.extra,B-=m.extra,m.back+=m.extra}m.was=m.length,m.mode=Be;case Be:for(;ze=m.distcode[A&(1<>>24,qe=ze>>>16&255,Ke=ze&65535,!(we<=B);){if(F===0)break e;F--,A+=X[h++]<>nt)],we=ze>>>24,qe=ze>>>16&255,Ke=ze&65535,!(nt+we<=B);){if(F===0)break e;F--,A+=X[h++]<>>=nt,B-=nt,m.back+=nt}if(A>>>=we,B-=we,m.back+=we,qe&64){I.msg="invalid distance code",m.mode=Se;break}m.offset=Ke,m.extra=qe&15,m.mode=ke;case ke:if(m.extra){for(xt=m.extra;B>>=m.extra,B-=m.extra,m.back+=m.extra}if(m.offset>m.dmax){I.msg="invalid distance too far back",m.mode=Se;break}m.mode=Le;case Le:if(b===0)break e;if(se=te-b,m.offset>se){if(se=m.offset-se,se>m.whave&&m.sane){I.msg="invalid distance too far back",m.mode=Se;break}se>m.wnext?(se-=m.wnext,ye=m.wsize-se):ye=m.wnext-se,se>m.length&&(se=m.length),Mt=m.window}else Mt=ce,ye=U-m.offset,se=m.length;se>b&&(se=b),b-=se,m.length-=se;do ce[U++]=Mt[ye++];while(--se);m.length===0&&(m.mode=_e);break;case xe:if(b===0)break e;ce[U++]=m.length,b--,m.mode=_e;break;case $e:if(m.wrap){for(;B<32;){if(F===0)break e;F--,A|=X[h++]<=1&&_e[re]===0;re--);if(pe>re&&(pe=re),re===0)return w[N++]=1<<24|64<<16|0,w[N++]=1<<24|64<<16|0,M.bits=1,0;for(H=1;H0&&(p===f||re!==1))return-1;for(Ze[1]=0,q=1;ql||p===c&&ae>u)return 1;for(;;){Le=q-de,C[G]Me?(xe=Be[ke+C[G]],$e=Ge[je+C[G]]):(xe=32+64,$e=0),Re=1<>de)+Te]=Le<<24|xe<<16|$e|0;while(Te!==0);for(Re=1<>=1;if(Re!==0?(be&=Re-1,be+=Re):be=0,G++,--_e[q]==0){if(q===re)break;q=y[T+C[G]]}if(q>pe&&(be&Ce)!==he){for(de===0&&(de=pe),Ee+=H,ie=q-de,fe=1<l||p===c&&ae>u)return 1;he=be&Ce,w[he]=pe<<24|ie<<16|Ee-N|0}}return be!==0&&(w[Ee+be]=q-de<<24|64<<16|0),M.bits=pe,0}},{"../utils/common":41}],51:[function(i,n,s){"use strict";n.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(i,n,s){"use strict";var a=i("../utils/common"),o=4,l=0,u=1,f=2;function d(x){for(var Z=x.length;--Z>=0;)x[Z]=0}var c=0,v=1,g=2,O=3,k=258,_=29,p=256,y=p+1+_,T=30,P=19,w=2*y+1,N=15,C=16,M=7,j=256,q=16,G=17,H=18,re=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],pe=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],ie=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],de=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],fe=512,ae=new Array((y+2)*2);d(ae);var be=new Array(T*2);d(be);var Re=new Array(fe);d(Re);var Te=new Array(k-O+1);d(Te);var he=new Array(_);d(he);var Ce=new Array(T);d(Ce);function Ee(x,Z,K,ne,I){this.static_tree=x,this.extra_bits=Z,this.extra_base=K,this.elems=ne,this.max_length=I,this.has_stree=x&&x.length}var Ge,je,Me;function _e(x,Z){this.dyn_tree=x,this.max_code=0,this.stat_desc=Z}function Ze(x){return x<256?Re[x]:Re[256+(x>>>7)]}function Be(x,Z){x.pending_buf[x.pending++]=Z&255,x.pending_buf[x.pending++]=Z>>>8&255}function ke(x,Z,K){x.bi_valid>C-K?(x.bi_buf|=Z<>C-x.bi_valid,x.bi_valid+=K-C):(x.bi_buf|=Z<>>=1,K<<=1;while(--Z>0);return K>>>1}function $e(x){x.bi_valid===16?(Be(x,x.bi_buf),x.bi_buf=0,x.bi_valid=0):x.bi_valid>=8&&(x.pending_buf[x.pending++]=x.bi_buf&255,x.bi_buf>>=8,x.bi_valid-=8)}function Fe(x,Z){var K=Z.dyn_tree,ne=Z.max_code,I=Z.stat_desc.static_tree,W=Z.stat_desc.has_stree,m=Z.stat_desc.extra_bits,X=Z.stat_desc.extra_base,ce=Z.stat_desc.max_length,h,U,F,b,A,B,oe=0;for(b=0;b<=N;b++)x.bl_count[b]=0;for(K[x.heap[x.heap_max]*2+1]=0,h=x.heap_max+1;hce&&(b=ce,oe++),K[U*2+1]=b,!(U>ne)&&(x.bl_count[b]++,A=0,U>=X&&(A=m[U-X]),B=K[U*2],x.opt_len+=B*(b+A),W&&(x.static_len+=B*(I[U*2+1]+A)));if(oe!==0){do{for(b=ce-1;x.bl_count[b]===0;)b--;x.bl_count[b]--,x.bl_count[b+1]+=2,x.bl_count[ce]--,oe-=2}while(oe>0);for(b=ce;b!==0;b--)for(U=x.bl_count[b];U!==0;)F=x.heap[--h],!(F>ne)&&(K[F*2+1]!==b&&(x.opt_len+=(b-K[F*2+1])*K[F*2],K[F*2+1]=b),U--)}}function ft(x,Z,K){var ne=new Array(N+1),I=0,W,m;for(W=1;W<=N;W++)ne[W]=I=I+K[W-1]<<1;for(m=0;m<=Z;m++){var X=x[m*2+1];X!==0&&(x[m*2]=xe(ne[X]++,X))}}function Se(){var x,Z,K,ne,I,W=new Array(N+1);for(K=0,ne=0;ne<_-1;ne++)for(he[ne]=K,x=0;x<1<>=7;ne8?Be(x,x.bi_buf):x.bi_valid>0&&(x.pending_buf[x.pending++]=x.bi_buf),x.bi_buf=0,x.bi_valid=0}function rt(x,Z,K,ne){Dt(x),ne&&(Be(x,K),Be(x,~K)),a.arraySet(x.pending_buf,x.window,Z,K,x.pending),x.pending+=K}function Qe(x,Z,K,ne){var I=Z*2,W=K*2;return x[I]>1;m>=1;m--)Ae(x,K,m);h=W;do m=x.heap[1],x.heap[1]=x.heap[x.heap_len--],Ae(x,K,1),X=x.heap[1],x.heap[--x.heap_max]=m,x.heap[--x.heap_max]=X,K[h*2]=K[m*2]+K[X*2],x.depth[h]=(x.depth[m]>=x.depth[X]?x.depth[m]:x.depth[X])+1,K[m*2+1]=K[X*2+1]=h,x.heap[1]=h++,Ae(x,K,1);while(x.heap_len>=2);x.heap[--x.heap_max]=x.heap[1],Fe(x,Z),ft(K,ce,x.bl_count)}function Gt(x,Z,K){var ne,I=-1,W,m=Z[0*2+1],X=0,ce=7,h=4;for(m===0&&(ce=138,h=3),Z[(K+1)*2+1]=65535,ne=0;ne<=K;ne++)W=m,m=Z[(ne+1)*2+1],!(++X=3&&x.bl_tree[de[Z]*2+1]===0;Z--);return x.opt_len+=3*(Z+1)+5+5+4,Z}function $t(x,Z,K,ne){var I;for(ke(x,Z-257,5),ke(x,K-1,5),ke(x,ne-4,4),I=0;I>>=1)if(Z&1&&x.dyn_ltree[K*2]!==0)return l;if(x.dyn_ltree[9*2]!==0||x.dyn_ltree[10*2]!==0||x.dyn_ltree[13*2]!==0)return u;for(K=32;K0?(x.strm.data_type===f&&(x.strm.data_type=Lt(x)),lt(x,x.l_desc),lt(x,x.d_desc),m=ut(x),I=x.opt_len+3+7>>>3,W=x.static_len+3+7>>>3,W<=I&&(I=W)):I=W=K+5,K+4<=I&&Z!==-1?zt(x,Z,K,ne):x.strategy===o||W===I?(ke(x,(v<<1)+(ne?1:0),3),ge(x,ae,be)):(ke(x,(g<<1)+(ne?1:0),3),$t(x,x.l_desc.max_code+1,x.d_desc.max_code+1,m+1),ge(x,x.dyn_ltree,x.dyn_dtree)),Ve(x),ne&&Dt(x)}function ni(x,Z,K){return x.pending_buf[x.d_buf+x.last_lit*2]=Z>>>8&255,x.pending_buf[x.d_buf+x.last_lit*2+1]=Z&255,x.pending_buf[x.l_buf+x.last_lit]=K&255,x.last_lit++,Z===0?x.dyn_ltree[K*2]++:(x.matches++,Z--,x.dyn_ltree[(Te[K]+p+1)*2]++,x.dyn_dtree[Ze(Z)*2]++),x.last_lit===x.lit_bufsize-1}s._tr_init=Kt,s._tr_stored_block=zt,s._tr_flush_block=dt,s._tr_tally=ni,s._tr_align=Xe},{"../utils/common":41}],53:[function(i,n,s){"use strict";function a(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}n.exports=a},{}],54:[function(i,n,s){"use strict";n.exports=typeof setImmediate=="function"?setImmediate:function(){var o=[].slice.apply(arguments);o.splice(1,0,0),setTimeout.apply(null,o)}},{}]},{},[10])(10)})});var gc=$(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.default=void 0;var Ji=Ie(),s_=us(Pr()),pc=us(Bn()),a_=us(oi()),o_=us(dc());function us(r){return r&&r.__esModule?r:{default:r}}var vc=class{constructor(){this.zip=void 0,this.urlCache={},this.checkRequirements()}checkRequirements(){try{this.zip=new o_.default}catch(e){throw new Error("JSZip lib not loaded")}}open(e,t){return this.zip.loadAsync(e,{base64:t})}openUrl(e,t){return(0,s_.default)(e,"binary").then(function(i){return this.zip.loadAsync(i,{base64:t})}.bind(this))}request(e,t){var i=new Ji.defer,n,s=new a_.default(e);return t||(t=s.extension),t=="blob"?n=this.getBlob(e):n=this.getText(e),n?n.then(function(a){let o=this.handleResponse(a,t);i.resolve(o)}.bind(this)):i.reject({message:"File not found in the epub: "+e,stack:new Error().stack}),i.promise}handleResponse(e,t){var i;return t=="json"?i=JSON.parse(e):(0,Ji.isXml)(t)?i=(0,Ji.parse)(e,"text/xml"):t=="xhtml"?i=(0,Ji.parse)(e,"application/xhtml+xml"):t=="html"||t=="htm"?i=(0,Ji.parse)(e,"text/html"):i=e,i}getBlob(e,t){var i=window.decodeURIComponent(e.substr(1)),n=this.zip.file(i);if(n)return t=t||pc.default.lookup(n.name),n.async("uint8array").then(function(s){return new Blob([s],{type:t})})}getText(e,t){var i=window.decodeURIComponent(e.substr(1)),n=this.zip.file(i);if(n)return n.async("string").then(function(s){return s})}getBase64(e,t){var i=window.decodeURIComponent(e.substr(1)),n=this.zip.file(i);if(n)return t=t||pc.default.lookup(n.name),n.async("base64").then(function(s){return"data:"+t+";base64,"+s})}createUrl(e,t){var i=new Ji.defer,n=window.URL||window.webkitURL||window.mozURL,s,a,o=t&&t.base64;return e in this.urlCache?(i.resolve(this.urlCache[e]),i.promise):(o?(a=this.getBase64(e),a&&a.then(function(l){this.urlCache[e]=l,i.resolve(l)}.bind(this))):(a=this.getBlob(e),a&&a.then(function(l){s=n.createObjectURL(l),this.urlCache[e]=s,i.resolve(s)}.bind(this))),a||i.reject({message:"File not found in the epub: "+e,stack:new Error().stack}),i.promise)}revokeUrl(e){var t=window.URL||window.webkitURL||window.mozURL,i=this.urlCache[e];i&&t.revokeObjectURL(i)}destroy(){var e=window.URL||window.webkitURL||window.mozURL;for(let t in this.urlCache)e.revokeObjectURL(t);this.zip=void 0,this.urlCache={}}},l_=vc;hs.default=l_});var _c=$((mc,$a)=>{(function(r){if(typeof mc=="object"&&typeof $a!="undefined")$a.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e=this,e.localforage=r()}})(function(){var r,e,t;return function i(n,s,a){function o(f,d){if(!s[f]){if(!n[f]){var c=typeof require=="function"&&require;if(!d&&c)return c(f,!0);if(l)return l(f,!0);var v=new Error("Cannot find module '"+f+"'");throw v.code="MODULE_NOT_FOUND",v}var g=s[f]={exports:{}};n[f][0].call(g.exports,function(O){var k=n[f][1][O];return o(k||O)},g,g.exports,i,n,s,a)}return s[f].exports}for(var l=typeof require=="function"&&require,u=0;u=43)}}).catch(function(){return!1})}function M(E){return typeof p=="boolean"?c.resolve(p):C(E).then(function(R){return p=R,p})}function j(E){var R=y[E.name],S={};S.promise=new c(function(L,z){S.resolve=L,S.reject=z}),R.deferredOperations.push(S),R.dbReady?R.dbReady=R.dbReady.then(function(){return S.promise}):R.dbReady=S.promise}function q(E){var R=y[E.name],S=R.deferredOperations.pop();if(S)return S.resolve(),S.promise}function G(E,R){var S=y[E.name],L=S.deferredOperations.pop();if(L)return L.reject(R),L.promise}function H(E,R){return new c(function(S,L){if(y[E.name]=y[E.name]||he(),E.db)if(R)j(E),E.db.close();else return S(E.db);var z=[E.name];R&&z.push(E.version);var D=u.open.apply(u,z);R&&(D.onupgradeneeded=function(V){var Y=D.result;try{Y.createObjectStore(E.storeName),V.oldVersion<=1&&Y.createObjectStore(_)}catch(J){if(J.name==="ConstraintError")console.warn('The database "'+E.name+'" has been upgraded from version '+V.oldVersion+" to version "+V.newVersion+', but the storage "'+E.storeName+'" already exists.');else throw J}}),D.onerror=function(V){V.preventDefault(),L(D.error)},D.onsuccess=function(){var V=D.result;V.onversionchange=function(Y){Y.target.close()},S(V),q(E)}})}function re(E){return H(E,!1)}function pe(E){return H(E,!0)}function ie(E,R){if(!E.db)return!0;var S=!E.db.objectStoreNames.contains(E.storeName),L=E.versionE.db.version;if(L&&(E.version!==R&&console.warn('The database "'+E.name+`" can't be downgraded from version `+E.db.version+" to version "+E.version+"."),E.version=E.db.version),z||S){if(S){var D=E.db.version+1;D>E.version&&(E.version=D)}return!0}return!1}function de(E){return new c(function(R,S){var L=new FileReader;L.onerror=S,L.onloadend=function(z){var D=btoa(z.target.result||"");R({__local_forage_encoded_blob:!0,data:D,type:E.type})},L.readAsBinaryString(E)})}function fe(E){var R=N(atob(E.data));return d([R],{type:E.type})}function ae(E){return E&&E.__local_forage_encoded_blob}function be(E){var R=this,S=R._initReady().then(function(){var L=y[R._dbInfo.name];if(L&&L.dbReady)return L.dbReady});return g(S,E,E),S}function Re(E){j(E);for(var R=y[E.name],S=R.forages,L=0;L0&&(!E.db||D.name==="InvalidStateError"||D.name==="NotFoundError"))return c.resolve().then(function(){if(!E.db||D.name==="NotFoundError"&&!E.db.objectStoreNames.contains(E.storeName)&&E.version<=E.db.version)return E.db&&(E.version=E.db.version+1),pe(E)}).then(function(){return Re(E).then(function(){Te(E,R,S,L-1)})}).catch(S);S(D)}}function he(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ce(E){var R=this,S={db:null};if(E)for(var L in E)S[L]=E[L];var z=y[S.name];z||(z=he(),y[S.name]=z),z.forages.push(R),R._initReady||(R._initReady=R.ready,R.ready=be);var D=[];function V(){return c.resolve()}for(var Y=0;Y>4,ee[z++]=(V&15)<<4|Y>>2,ee[z++]=(Y&3)<<6|J&63;return Q}function dt(E){var R=new Uint8Array(E),S="",L;for(L=0;L>2],S+=Fe[(R[L]&3)<<4|R[L+1]>>4],S+=Fe[(R[L+1]&15)<<2|R[L+2]>>6],S+=Fe[R[L+2]&63];return R.length%3==2?S=S.substring(0,S.length-1)+"=":R.length%3==1&&(S=S.substring(0,S.length-2)+"=="),S}function ni(E,R){var S="";if(E&&(S=zt.call(E)),E&&(S==="[object ArrayBuffer]"||E.buffer&&zt.call(E.buffer)==="[object ArrayBuffer]")){var L,z=Ve;E instanceof ArrayBuffer?(L=E,z+=rt):(L=E.buffer,S==="[object Int8Array]"?z+=Ae:S==="[object Uint8Array]"?z+=ge:S==="[object Uint8ClampedArray]"?z+=lt:S==="[object Int16Array]"?z+=Gt:S==="[object Uint16Array]"?z+=ut:S==="[object Int32Array]"?z+=Pt:S==="[object Uint32Array]"?z+=$t:S==="[object Float32Array]"?z+=Lt:S==="[object Float64Array]"?z+=ct:R(new Error("Failed to get type for BinaryArray"))),R(z+dt(L))}else if(S==="[object Blob]"){var D=new FileReader;D.onload=function(){var V=ft+E.type+"~"+dt(this.result);R(Ve+Qe+V)},D.readAsArrayBuffer(E)}else try{R(JSON.stringify(E))}catch(V){console.error("Couldn't convert value into a JSON string: ",E),R(null,V)}}function x(E){if(E.substring(0,Dt)!==Ve)return JSON.parse(E);var R=E.substring(Kt),S=E.substring(Dt,Kt),L;if(S===Qe&&Se.test(R)){var z=R.match(Se);L=z[1],R=R.substring(z[0].length)}var D=Xe(R);switch(S){case rt:return D;case Qe:return d([D],{type:L});case Ae:return new Int8Array(D);case ge:return new Uint8Array(D);case lt:return new Uint8ClampedArray(D);case Gt:return new Int16Array(D);case ut:return new Uint16Array(D);case Pt:return new Int32Array(D);case $t:return new Uint32Array(D);case Lt:return new Float32Array(D);case ct:return new Float64Array(D);default:throw new Error("Unkown type: "+S)}}var Z={serialize:ni,deserialize:x,stringToBuffer:Xe,bufferToString:dt};function K(E,R,S,L){E.executeSql("CREATE TABLE IF NOT EXISTS "+R.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],S,L)}function ne(E){var R=this,S={db:null};if(E)for(var L in E)S[L]=typeof E[L]!="string"?E[L].toString():E[L];var z=new c(function(D,V){try{S.db=openDatabase(S.name,String(S.version),S.description,S.size)}catch(Y){return V(Y)}S.db.transaction(function(Y){K(Y,S,function(){R._dbInfo=S,D()},function(J,Q){V(Q)})},V)});return S.serializer=Z,z}function I(E,R,S,L,z,D){E.executeSql(S,L,z,function(V,Y){Y.code===Y.SYNTAX_ERR?V.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[R.storeName],function(J,Q){Q.rows.length?D(J,Y):K(J,R,function(){J.executeSql(S,L,z,D)},D)},D):D(V,Y)},D)}function W(E,R){var S=this;E=O(E);var L=new c(function(z,D){S.ready().then(function(){var V=S._dbInfo;V.db.transaction(function(Y){I(Y,V,"SELECT * FROM "+V.storeName+" WHERE key = ? LIMIT 1",[E],function(J,Q){var ee=Q.rows.length?Q.rows.item(0).value:null;ee&&(ee=V.serializer.deserialize(ee)),z(ee)},function(J,Q){D(Q)})})}).catch(D)});return v(L,R),L}function m(E,R){var S=this,L=new c(function(z,D){S.ready().then(function(){var V=S._dbInfo;V.db.transaction(function(Y){I(Y,V,"SELECT * FROM "+V.storeName,[],function(J,Q){for(var ee=Q.rows,le=ee.length,me=0;me0){V(X.apply(z,[E,J,S,L-1]));return}Y(me)}})})}).catch(Y)});return v(D,S),D}function ce(E,R,S){return X.apply(this,[E,R,S,1])}function h(E,R){var S=this;E=O(E);var L=new c(function(z,D){S.ready().then(function(){var V=S._dbInfo;V.db.transaction(function(Y){I(Y,V,"DELETE FROM "+V.storeName+" WHERE key = ?",[E],function(){z()},function(J,Q){D(Q)})})}).catch(D)});return v(L,R),L}function U(E){var R=this,S=new c(function(L,z){R.ready().then(function(){var D=R._dbInfo;D.db.transaction(function(V){I(V,D,"DELETE FROM "+D.storeName,[],function(){L()},function(Y,J){z(J)})})}).catch(z)});return v(S,E),S}function F(E){var R=this,S=new c(function(L,z){R.ready().then(function(){var D=R._dbInfo;D.db.transaction(function(V){I(V,D,"SELECT COUNT(key) as c FROM "+D.storeName,[],function(Y,J){var Q=J.rows.item(0).c;L(Q)},function(Y,J){z(J)})})}).catch(z)});return v(S,E),S}function b(E,R){var S=this,L=new c(function(z,D){S.ready().then(function(){var V=S._dbInfo;V.db.transaction(function(Y){I(Y,V,"SELECT key FROM "+V.storeName+" WHERE id = ? LIMIT 1",[E+1],function(J,Q){var ee=Q.rows.length?Q.rows.item(0).key:null;z(ee)},function(J,Q){D(Q)})})}).catch(D)});return v(L,R),L}function A(E){var R=this,S=new c(function(L,z){R.ready().then(function(){var D=R._dbInfo;D.db.transaction(function(V){I(V,D,"SELECT key FROM "+D.storeName,[],function(Y,J){for(var Q=[],ee=0;ee '__WebKitDatabaseInfoTable__'",[],function(z,D){for(var V=[],Y=0;Y0}function we(E){var R=this,S={};if(E)for(var L in E)S[L]=E[L];return S.keyPrefix=ye(E,R._defaultConfig),ze()?(R._dbInfo=S,S.serializer=Z,c.resolve()):c.reject()}function qe(E){var R=this,S=R.ready().then(function(){for(var L=R._dbInfo.keyPrefix,z=localStorage.length-1;z>=0;z--){var D=localStorage.key(z);D.indexOf(L)===0&&localStorage.removeItem(D)}});return v(S,E),S}function Ke(E,R){var S=this;E=O(E);var L=S.ready().then(function(){var z=S._dbInfo,D=localStorage.getItem(z.keyPrefix+E);return D&&(D=z.serializer.deserialize(D)),D});return v(L,R),L}function nt(E,R){var S=this,L=S.ready().then(function(){for(var z=S._dbInfo,D=z.keyPrefix,V=D.length,Y=localStorage.length,J=1,Q=0;Q=0;V--){var Y=localStorage.key(V);Y.indexOf(D)===0&&localStorage.removeItem(Y)}}):z=c.reject("Invalid arguments"),v(z,R),z}var xt={_driver:"localStorageWrapper",_initStorage:we,_support:se(),iterate:nt,getItem:Ke,setItem:Ye,removeItem:pt,clear:qe,length:Ue,key:Ci,keys:Ni,dropInstance:Bt},Vr=function(R,S){return R===S||typeof R=="number"&&typeof S=="number"&&isNaN(R)&&isNaN(S)},ad=function(R,S){for(var L=R.length,z=0;z{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.default=void 0;var ii=Ie(),u_=Wr(Pr()),Ka=Wr(Bn()),h_=Wr(oi()),f_=Wr(Ft()),yc=Wr(_c());function Wr(r){return r&&r.__esModule?r:{default:r}}var Ja=class{constructor(e,t,i){this.urlCache={},this.storage=void 0,this.name=e,this.requester=t||u_.default,this.resolver=i,this.online=!0,this.checkRequirements(),this.addListeners()}checkRequirements(){try{let e;typeof yc.default=="undefined"&&(e=yc.default),this.storage=e.createInstance({name:this.name})}catch(e){throw new Error("localForage lib not loaded")}}addListeners(){this._status=this.status.bind(this),window.addEventListener("online",this._status),window.addEventListener("offline",this._status)}removeListeners(){window.removeEventListener("online",this._status),window.removeEventListener("offline",this._status),this._status=void 0}status(e){let t=navigator.onLine;this.online=t,t?this.emit("online",this):this.emit("offline",this)}add(e,t){let i=e.resources.map(n=>{let{href:s}=n,a=this.resolver(s),o=window.encodeURIComponent(a);return this.storage.getItem(o).then(l=>!l||t?this.requester(a,"binary").then(u=>this.storage.setItem(o,u)):l)});return Promise.all(i)}put(e,t,i){let n=window.encodeURIComponent(e);return this.storage.getItem(n).then(s=>s||this.requester(e,"binary",t,i).then(a=>this.storage.setItem(n,a)))}request(e,t,i,n){return this.online?this.requester(e,t,i,n).then(s=>(this.put(e),s)):this.retrieve(e,t)}retrieve(e,t){var i=new ii.defer,n,s=new h_.default(e);return t||(t=s.extension),t=="blob"?n=this.getBlob(e):n=this.getText(e),n.then(a=>{var o=new ii.defer,l;return a?(l=this.handleResponse(a,t),o.resolve(l)):o.reject({message:"File not found in storage: "+e,stack:new Error().stack}),o.promise})}handleResponse(e,t){var i;return t=="json"?i=JSON.parse(e):(0,ii.isXml)(t)?i=(0,ii.parse)(e,"text/xml"):t=="xhtml"?i=(0,ii.parse)(e,"application/xhtml+xml"):t=="html"||t=="htm"?i=(0,ii.parse)(e,"text/html"):i=e,i}getBlob(e,t){let i=window.encodeURIComponent(e);return this.storage.getItem(i).then(function(n){if(!!n)return t=t||Ka.default.lookup(e),new Blob([n],{type:t})})}getText(e,t){let i=window.encodeURIComponent(e);return t=t||Ka.default.lookup(e),this.storage.getItem(i).then(function(n){var s=new ii.defer,a=new FileReader,o;if(!!n)return o=new Blob([n],{type:t}),a.addEventListener("loadend",()=>{s.resolve(a.result)}),a.readAsText(o,t),s.promise})}getBase64(e,t){let i=window.encodeURIComponent(e);return t=t||Ka.default.lookup(e),this.storage.getItem(i).then(n=>{var s=new ii.defer,a=new FileReader,o;if(!!n)return o=new Blob([n],{type:t}),a.addEventListener("loadend",()=>{s.resolve(a.result)}),a.readAsDataURL(o,t),s.promise})}createUrl(e,t){var i=new ii.defer,n=window.URL||window.webkitURL||window.mozURL,s,a,o=t&&t.base64;return e in this.urlCache?(i.resolve(this.urlCache[e]),i.promise):(o?(a=this.getBase64(e),a&&a.then(function(l){this.urlCache[e]=l,i.resolve(l)}.bind(this))):(a=this.getBlob(e),a&&a.then(function(l){s=n.createObjectURL(l),this.urlCache[e]=s,i.resolve(s)}.bind(this))),a||i.reject({message:"File not found in storage: "+e,stack:new Error().stack}),i.promise)}revokeUrl(e){var t=window.URL||window.webkitURL||window.mozURL,i=this.urlCache[e];i&&t.revokeObjectURL(i)}destroy(){var e=window.URL||window.webkitURL||window.mozURL;for(let t in this.urlCache)e.revokeObjectURL(t);this.urlCache={},this.removeListeners()}};(0,f_.default)(Ja.prototype);var c_=Ja;fs.default=c_});var xc=$(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});cs.default=void 0;var wc=Ie(),Ec=class{constructor(e){this.interactive="",this.fixedLayout="",this.openToSpread="",this.orientationLock="",e&&this.parse(e)}parse(e){if(!e)return this;let t=(0,wc.qs)(e,"display_options");return t?((0,wc.qsa)(t,"option").forEach(n=>{let s="";switch(n.childNodes.length&&(s=n.childNodes[0].nodeValue),n.attributes.name.value){case"interactive":this.interactive=s;break;case"fixed-layout":this.fixedLayout=s;break;case"open-to-spread":this.openToSpread=s;break;case"orientation-lock":this.orientationLock=s;break}}),this):this}destroy(){this.interactive=void 0,this.fixedLayout=void 0,this.openToSpread=void 0,this.orientationLock=void 0}},d_=Ec;cs.default=d_});var ro=$(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.default=void 0;var p_=ot(Ft()),Vt=Ie(),ci=ot(Ir()),Sc=ot(oi()),v_=ot(zh()),g_=ot(Uh()),m_=ot(qh()),Tc=ot(jh()),Qa=ot(Hh()),__=ot(Gh()),eo=ot(Kh()),y_=ot(ls()),b_=ot(gc()),kc=ot(Pr()),w_=ot(_t()),E_=ot(bc()),to=ot(xc()),Oc=Ct();function ot(r){return r&&r.__esModule?r:{default:r}}var Cc="META-INF/container.xml",x_="META-INF/com.apple.ibooks.display-options.xml",Ht={BINARY:"binary",BASE64:"base64",EPUB:"epub",OPF:"opf",MANIFEST:"json",DIRECTORY:"directory"},io=class{constructor(e,t){typeof t=="undefined"&&typeof e!="string"&&!(e instanceof Blob)&&!(e instanceof ArrayBuffer)&&(t=e,e=void 0),this.settings=(0,Vt.extend)(this.settings||{},{requestMethod:void 0,requestCredentials:void 0,requestHeaders:void 0,encoding:void 0,replacements:void 0,canonical:void 0,openAs:void 0,store:void 0}),(0,Vt.extend)(this.settings,t),this.opening=new Vt.defer,this.opened=this.opening.promise,this.isOpen=!1,this.loading={manifest:new Vt.defer,spine:new Vt.defer,metadata:new Vt.defer,cover:new Vt.defer,navigation:new Vt.defer,pageList:new Vt.defer,resources:new Vt.defer,displayOptions:new Vt.defer},this.loaded={manifest:this.loading.manifest.promise,spine:this.loading.spine.promise,metadata:this.loading.metadata.promise,cover:this.loading.cover.promise,navigation:this.loading.navigation.promise,pageList:this.loading.pageList.promise,resources:this.loading.resources.promise,displayOptions:this.loading.displayOptions.promise},this.ready=Promise.all([this.loaded.manifest,this.loaded.spine,this.loaded.metadata,this.loaded.cover,this.loaded.navigation,this.loaded.resources,this.loaded.displayOptions]),this.isRendered=!1,this.request=this.settings.requestMethod||kc.default,this.spine=new v_.default,this.locations=new g_.default(this.spine,this.load.bind(this)),this.navigation=void 0,this.pageList=void 0,this.url=void 0,this.path=void 0,this.archived=!1,this.archive=void 0,this.storage=void 0,this.resources=void 0,this.rendition=void 0,this.container=void 0,this.packaging=void 0,this.displayOptions=void 0,this.settings.store&&this.store(this.settings.store),e&&this.open(e,this.settings.openAs).catch(i=>{var n=new Error("Cannot load book at "+e);this.emit(Oc.EVENTS.BOOK.OPEN_FAILED,n)})}open(e,t){var i,n=t||this.determineType(e);return n===Ht.BINARY?(this.archived=!0,this.url=new ci.default("/",""),i=this.openEpub(e)):n===Ht.BASE64?(this.archived=!0,this.url=new ci.default("/",""),i=this.openEpub(e,n)):n===Ht.EPUB?(this.archived=!0,this.url=new ci.default("/",""),i=this.request(e,"binary",this.settings.requestCredentials,this.settings.requestHeaders).then(this.openEpub.bind(this))):n==Ht.OPF?(this.url=new ci.default(e),i=this.openPackaging(this.url.Path.toString())):n==Ht.MANIFEST?(this.url=new ci.default(e),i=this.openManifest(this.url.Path.toString())):(this.url=new ci.default(e),i=this.openContainer(Cc).then(this.openPackaging.bind(this))),i}openEpub(e,t){return this.unarchive(e,t||this.settings.encoding).then(()=>this.openContainer(Cc)).then(i=>this.openPackaging(i))}openContainer(e){return this.load(e).then(t=>(this.container=new m_.default(t),this.resolve(this.container.packagePath)))}openPackaging(e){return this.path=new Sc.default(e),this.load(e).then(t=>(this.packaging=new Tc.default(t),this.unpack(this.packaging)))}openManifest(e){return this.path=new Sc.default(e),this.load(e).then(t=>(this.packaging=new Tc.default,this.packaging.load(t),this.unpack(this.packaging)))}load(e){var t=this.resolve(e);return this.archived?this.archive.request(t):this.request(t,null,this.settings.requestCredentials,this.settings.requestHeaders)}resolve(e,t){if(!!e){var i=e,n=e.indexOf("://")>-1;return n?e:(this.path&&(i=this.path.resolve(e)),t!=!1&&this.url&&(i=this.url.resolve(i)),i)}}canonical(e){var t=e;return e?(this.settings.canonical?t=this.settings.canonical(e):t=this.resolve(e,!0),t):""}determineType(e){var t,i,n;if(this.settings.encoding==="base64")return Ht.BASE64;if(typeof e!="string")return Ht.BINARY;if(t=new ci.default(e),i=t.path(),n=i.extension,n&&(n=n.replace(/\?.*$/,"")),!n)return Ht.DIRECTORY;if(n==="epub")return Ht.EPUB;if(n==="opf")return Ht.OPF;if(n==="json")return Ht.MANIFEST}unpack(e){this.package=e,this.packaging.metadata.layout===""?this.load(this.url.resolve(x_)).then(t=>{this.displayOptions=new to.default(t),this.loading.displayOptions.resolve(this.displayOptions)}).catch(t=>{this.displayOptions=new to.default,this.loading.displayOptions.resolve(this.displayOptions)}):(this.displayOptions=new to.default,this.loading.displayOptions.resolve(this.displayOptions)),this.spine.unpack(this.packaging,this.resolve.bind(this),this.canonical.bind(this)),this.resources=new __.default(this.packaging.manifest,{archive:this.archive,resolver:this.resolve.bind(this),request:this.request.bind(this),replacements:this.settings.replacements||(this.archived?"blobUrl":"base64")}),this.loadNavigation(this.packaging).then(()=>{this.loading.navigation.resolve(this.navigation)}),this.packaging.coverPath&&(this.cover=this.resolve(this.packaging.coverPath)),this.loading.manifest.resolve(this.packaging.manifest),this.loading.metadata.resolve(this.packaging.metadata),this.loading.spine.resolve(this.spine),this.loading.cover.resolve(this.cover),this.loading.resources.resolve(this.resources),this.loading.pageList.resolve(this.pageList),this.isOpen=!0,this.archived||this.settings.replacements&&this.settings.replacements!="none"?this.replacements().then(()=>{this.loaded.displayOptions.then(()=>{this.opening.resolve(this)})}).catch(t=>{console.error(t)}):this.loaded.displayOptions.then(()=>{this.opening.resolve(this)})}loadNavigation(e){let t=e.navPath||e.ncxPath,i=e.toc;return i?new Promise((n,s)=>{this.navigation=new Qa.default(i),e.pageList&&(this.pageList=new eo.default(e.pageList)),n(this.navigation)}):t?this.load(t,"xml").then(n=>(this.navigation=new Qa.default(n),this.pageList=new eo.default(n),this.navigation)):new Promise((n,s)=>{this.navigation=new Qa.default,this.pageList=new eo.default,n(this.navigation)})}section(e){return this.spine.get(e)}renderTo(e,t){return this.rendition=new y_.default(this,t),this.rendition.attachTo(e),this.rendition}setRequestCredentials(e){this.settings.requestCredentials=e}setRequestHeaders(e){this.settings.requestHeaders=e}unarchive(e,t){return this.archive=new b_.default,this.archive.open(e,t)}store(e){let t=this.settings.replacements&&this.settings.replacements!=="none",i=this.url,n=this.settings.requestMethod||kc.default.bind(this);return this.storage=new E_.default(e,n,this.resolve.bind(this)),this.request=this.storage.request.bind(this.storage),this.opened.then(()=>{this.archived&&(this.storage.requester=this.archive.request.bind(this.archive));let s=(a,o)=>{o.output=this.resources.substitute(a,o.url)};this.resources.settings.replacements=t||"blobUrl",this.resources.replacements().then(()=>this.resources.replaceCss()),this.storage.on("offline",()=>{this.url=new ci.default("/",""),this.spine.hooks.serialize.register(s)}),this.storage.on("online",()=>{this.url=i,this.spine.hooks.serialize.deregister(s)})}),this.storage}coverUrl(){return this.loaded.cover.then(()=>this.cover?this.archived?this.archive.createUrl(this.cover):this.cover:null)}replacements(){return this.spine.hooks.serialize.register((e,t)=>{t.output=this.resources.substitute(e,t.url)}),this.resources.replacements().then(()=>this.resources.replaceCss())}getRange(e){var t=new w_.default(e),i=this.spine.get(t.spinePos),n=this.load.bind(this);return i?i.load(n).then(function(s){var a=t.toRange(i.document);return a}):new Promise((s,a)=>{a("CFI could not be found")})}key(e){var t=e||this.packaging.metadata.identifier||this.url.filename;return`epubjs:${Oc.EPUBJS_VERSION}:${t}`}destroy(){this.opened=void 0,this.loading=void 0,this.loaded=void 0,this.ready=void 0,this.isOpen=!1,this.isRendered=!1,this.spine&&this.spine.destroy(),this.locations&&this.locations.destroy(),this.pageList&&this.pageList.destroy(),this.archive&&this.archive.destroy(),this.resources&&this.resources.destroy(),this.container&&this.container.destroy(),this.packaging&&this.packaging.destroy(),this.rendition&&this.rendition.destroy(),this.displayOptions&&this.displayOptions.destroy(),this.spine=void 0,this.locations=void 0,this.pageList=void 0,this.archive=void 0,this.resources=void 0,this.container=void 0,this.packaging=void 0,this.rendition=void 0,this.navigation=void 0,this.url=void 0,this.path=void 0,this.archived=!1}};(0,p_.default)(io.prototype);var S_=io;ds.default=S_});var Ic=$(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.default=void 0;var Nc=wi(ro()),T_=wi(ls()),k_=wi(_t()),O_=wi(Mr()),C_=N_(Ie()),Rc=Ct(),Pb=wi(Ua()),Lb=wi(ns()),zb=wi(Xa());function Ac(r){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Ac=function(i){return i?t:e})(r)}function N_(r,e){if(!e&&r&&r.__esModule)return r;if(r===null||typeof r!="object"&&typeof r!="function")return{default:r};var t=Ac(e);if(t&&t.has(r))return t.get(r);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in r)if(s!=="default"&&Object.prototype.hasOwnProperty.call(r,s)){var a=n?Object.getOwnPropertyDescriptor(r,s):null;a&&(a.get||a.set)?Object.defineProperty(i,s,a):i[s]=r[s]}return i.default=r,t&&t.set(r,i),i}function wi(r){return r&&r.__esModule?r:{default:r}}function Ei(r,e){return new Nc.default(r,e)}Ei.VERSION=Rc.EPUBJS_VERSION;typeof global!="undefined"&&(global.EPUBJS_VERSION=Rc.EPUBJS_VERSION);Ei.Book=Nc.default;Ei.Rendition=T_.default;Ei.Contents=O_.default;Ei.CFI=k_.default;Ei.utils=C_;var R_=Ei;ps.default=R_});var Dc=$(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});Object.defineProperty(ri,"Book",{enumerable:!0,get:function(){return A_.default}});Object.defineProperty(ri,"Contents",{enumerable:!0,get:function(){return P_.default}});Object.defineProperty(ri,"EpubCFI",{enumerable:!0,get:function(){return I_.default}});Object.defineProperty(ri,"Layout",{enumerable:!0,get:function(){return L_.default}});Object.defineProperty(ri,"Rendition",{enumerable:!0,get:function(){return D_.default}});ri.default=void 0;var A_=Qi(ro()),I_=Qi(_t()),D_=Qi(ls()),P_=Qi(Mr()),L_=Qi(Ia()),z_=Qi(Ic());function Qi(r){return r&&r.__esModule?r:{default:r}}var M_=z_.default;ri.default=M_});var no=$(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.default=void 0;var B_={viewHolder:{position:"relative",height:"100%",width:"100%"},view:{height:"100%"}},U_=B_;vs.default=U_});var Bc=$(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.default=void 0;var gs=W_(sn()),ht=so(Zs()),F_=so(Dc()),q_=so(no());function so(r){return r&&r.__esModule?r:{default:r}}function Pc(r){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Pc=function(n){return n?t:e})(r)}function W_(r,e){if(!e&&r&&r.__esModule)return r;if(r===null||xi(r)!=="object"&&typeof r!="function")return{default:r};var t=Pc(e);if(t&&t.has(r))return t.get(r);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in r)if(s!=="default"&&Object.prototype.hasOwnProperty.call(r,s)){var a=n?Object.getOwnPropertyDescriptor(r,s):null;a&&(a.get||a.set)?Object.defineProperty(i,s,a):i[s]=r[s]}return i.default=r,t&&t.set(r,i),i}function xi(r){return xi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xi(r)}function Lc(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),t.push.apply(t,i)}return t}function j_(r){for(var e=1;e0&&s[0].href?this.rendition.display(s[0].href):this.rendition.display()}},{key:"registerEvents",value:function(){var n=this.props,s=n.handleKeyPress,a=n.handleTextSelected;this.rendition.on("locationChanged",this.onLocationChange),this.rendition.on("keyup",s||this.handleKeyPress),a&&this.rendition.on("selected",a)}},{key:"renderBook",value:function(){var n=this.props.epubViewStyles;return gs.default.createElement("div",{ref:this.viewerRef,style:n.view})}},{key:"render",value:function(){var n=this.state.isLoaded,s=this.props,a=s.loadingView,o=s.epubViewStyles;return gs.default.createElement("div",{style:o.viewHolder},n&&this.renderBook()||a)}}]),t}(gs.Component);uo.defaultProps={loadingView:null,locationChanged:null,tocChanged:null,epubViewStyles:q_.default,epubOptions:{},epubInitOptions:{}};uo.propTypes={url:ht.default.oneOfType([ht.default.string,ht.default.instanceOf(ArrayBuffer)]),loadingView:ht.default.element,location:ht.default.oneOfType([ht.default.string,ht.default.number]),locationChanged:ht.default.func,tocChanged:ht.default.func,epubViewStyles:ht.default.object,epubInitOptions:ht.default.object,epubOptions:ht.default.object,getRendition:ht.default.func,handleKeyPress:ht.default.func,handleTextSelected:ht.default.func};var K_=uo;_s.default=K_});var Zc=$(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});var ys=sn(),Uc="Left",Fc="Right",qc="Up",Wc="Down",er={delta:10,preventScrollOnSwipe:!1,rotationAngle:0,trackMouse:!1,trackTouch:!0,swipeDuration:1/0,touchEventOptions:{passive:!0}},ho={first:!0,initial:[0,0],start:0,swiping:!1,xy:[0,0]},jc="mousemove",Vc="mouseup",J_="touchend",Q_="touchmove",ey="touchstart";function ty(r,e,t,i){return r>e?t>0?Fc:Uc:i>0?Wc:qc}function Hc(r,e){if(e===0)return r;let t=Math.PI/180*e,i=r[0]*Math.cos(t)+r[1]*Math.sin(t),n=r[1]*Math.cos(t)-r[0]*Math.sin(t);return[i,n]}function iy(r,e){let t=f=>{let d="touches"in f;d&&f.touches.length>1||r((c,v)=>{v.trackMouse&&!d&&(document.addEventListener(jc,i),document.addEventListener(Vc,a));let{clientX:g,clientY:O}=d?f.touches[0]:f,k=Hc([g,O],v.rotationAngle);return v.onTouchStartOrOnMouseDown&&v.onTouchStartOrOnMouseDown({event:f}),Object.assign(Object.assign(Object.assign({},c),ho),{initial:k.slice(),xy:k,start:f.timeStamp||0})})},i=f=>{r((d,c)=>{let v="touches"in f;if(v&&f.touches.length>1)return d;if(f.timeStamp-d.start>c.swipeDuration)return d.swiping?Object.assign(Object.assign({},d),{swiping:!1}):d;let{clientX:g,clientY:O}=v?f.touches[0]:f,[k,_]=Hc([g,O],c.rotationAngle),p=k-d.xy[0],y=_-d.xy[1],T=Math.abs(p),P=Math.abs(y),w=(f.timeStamp||0)-d.start,N=Math.sqrt(T*T+P*P)/(w||1),C=[p/(w||1),y/(w||1)],M=ty(T,P,p,y),j=typeof c.delta=="number"?c.delta:c.delta[M.toLowerCase()]||er.delta;if(T{r((d,c)=>{let v;if(d.swiping&&d.eventData){if(f.timeStamp-d.start{document.removeEventListener(jc,i),document.removeEventListener(Vc,a)},a=f=>{s(),n(f)},o=(f,d)=>{let c=()=>{};if(f&&f.addEventListener){let v=Object.assign(Object.assign({},er.touchEventOptions),d.touchEventOptions),g=[[ey,t,v],[Q_,i,Object.assign(Object.assign({},v),d.preventScrollOnSwipe?{passive:!1}:{})],[J_,n,v]];g.forEach(([O,k,_])=>f.addEventListener(O,k,_)),c=()=>g.forEach(([O,k])=>f.removeEventListener(O,k))}return c},u={ref:f=>{f!==null&&r((d,c)=>{if(d.el===f)return d;let v={};return d.el&&d.el!==f&&d.cleanUpTouch&&(d.cleanUpTouch(),v.cleanUpTouch=void 0),c.trackTouch&&f&&(v.cleanUpTouch=o(f,c)),Object.assign(Object.assign(Object.assign({},d),{el:f}),v)})}};return e.trackMouse&&(u.onMouseDown=t),[u,o]}function ry(r,e,t,i){return!e.trackTouch||!r.el?(r.cleanUpTouch&&r.cleanUpTouch(),Object.assign(Object.assign({},r),{cleanUpTouch:void 0})):r.cleanUpTouch?e.preventScrollOnSwipe!==t.preventScrollOnSwipe||e.touchEventOptions.passive!==t.touchEventOptions.passive?(r.cleanUpTouch(),Object.assign(Object.assign({},r),{cleanUpTouch:i(r.el,e)})):r:Object.assign(Object.assign({},r),{cleanUpTouch:i(r.el,e)})}function ny(r){let{trackMouse:e}=r,t=ys.useRef(Object.assign({},ho)),i=ys.useRef(Object.assign({},er)),n=ys.useRef(Object.assign({},i.current));n.current=Object.assign({},i.current),i.current=Object.assign(Object.assign({},er),r);let s;for(s in er)i.current[s]===void 0&&(i.current[s]=er[s]);let[a,o]=ys.useMemo(()=>iy(l=>t.current=l(t.current,i.current),{trackMouse:e}),[e]);return t.current=ry(t.current,i.current,n.current,o),a}Si.DOWN=Wc;Si.LEFT=Uc;Si.RIGHT=Fc;Si.UP=qc;Si.useSwipeable=ny});var fo=$(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.default=void 0;var sy={container:{overflow:"hidden",position:"relative",height:"100%"},readerArea:{position:"relative",zIndex:1,height:"100%",width:"100%",backgroundColor:"#fff",transition:"all .3s ease"},containerExpanded:{transform:"translateX(256px)"},titleArea:{position:"absolute",top:20,left:50,right:50,textAlign:"center",color:"#999"},reader:{position:"absolute",top:50,left:50,bottom:20,right:50},swipeWrapper:{position:"absolute",top:0,left:0,bottom:0,right:0,zIndex:200},prev:{left:1},next:{right:1},arrow:{outline:"none",border:"none",background:"none",position:"absolute",top:"50%",marginTop:-32,fontSize:64,padding:"0 10px",color:"#E2E2E2",fontFamily:"arial, sans-serif",cursor:"pointer",userSelect:"none",appearance:"none",fontWeight:"normal"},arrowHover:{color:"#777"},tocBackground:{position:"absolute",left:256,top:0,bottom:0,right:0,zIndex:1},tocArea:{position:"absolute",left:0,top:0,bottom:0,zIndex:0,width:256,overflowY:"auto",WebkitOverflowScrolling:"touch",background:"#f2f2f2",padding:"10px 0"},tocAreaButton:{userSelect:"none",appearance:"none",background:"none",border:"none",display:"block",fontFamily:"sans-serif",width:"100%",fontSize:".9em",textAlign:"left",padding:".9em 1em",borderBottom:"1px solid #ddd",color:"#aaa",boxSizing:"border-box",outline:"none",cursor:"pointer"},tocButton:{background:"none",border:"none",width:32,height:32,position:"absolute",top:10,left:10,borderRadius:2,outline:"none",cursor:"pointer"},tocButtonExpanded:{background:"#f2f2f2"},tocButtonBar:{position:"absolute",width:"60%",background:"#ccc",height:2,left:"50%",margin:"-1px -30%",top:"50%",transition:"all .5s ease"},tocButtonBarTop:{top:"35%"},tocButtonBottom:{top:"66%"},loadingView:{position:"absolute",top:"50%",left:"10%",right:"10%",color:"#ccc",textAlign:"center",margintop:"-.5em"}},ay=sy;bs.default=ay});var nd=$(Es=>{"use strict";function Ti(r){return Ti=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ti(r)}Object.defineProperty(Es,"__esModule",{value:!0});Es.default=void 0;var Pe=fy(sn()),It=Yc(Zs()),oy=Zc(),ly=vo(),Xc=Yc(fo()),uy=["children"],hy=["title","showToc","loadingView","readerStyles","locationChanged","swipeable","epubViewStyles"];function Yc(r){return r&&r.__esModule?r:{default:r}}function Gc(r){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Gc=function(n){return n?t:e})(r)}function fy(r,e){if(!e&&r&&r.__esModule)return r;if(r===null||Ti(r)!=="object"&&typeof r!="function")return{default:r};var t=Gc(e);if(t&&t.has(r))return t.get(r);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in r)if(s!=="default"&&Object.prototype.hasOwnProperty.call(r,s)){var a=n?Object.getOwnPropertyDescriptor(r,s):null;a&&(a.get||a.set)?Object.defineProperty(i,s,a):i[s]=r[s]}return i.default=r,t&&t.set(r,i),i}function jr(){return jr=Object.assign?Object.assign.bind():function(r){for(var e=1;e=0)&&(!Object.prototype.propertyIsEnumerable.call(r,i)||(t[i]=r[i]))}return t}function vy(r,e){if(r==null)return{};var t={},i=Object.keys(r),n,s;for(s=0;s=0)&&(t[n]=r[n]);return t}var gy=function(e){var t=e.children,i=id(e,uy),n=(0,oy.useSwipeable)(i);return Pe.default.createElement("div",n,t)},rd=function(r){Qc(t,r);var e=ed(t);function t(){var i;$c(this,t);for(var n=arguments.length,s=new Array(n),a=0;a0&&Pe.default.createElement("div",{style:{paddingLeft:10}},l.map(function(u,f){return Pe.default.createElement(t,jr({key:f},n.props,u))})))}}]),t}(Pe.PureComponent);rd.propTypes={label:It.default.string,href:It.default.string,setLocation:It.default.func,styles:It.default.object};var po=function(r){Qc(t,r);var e=ed(t);function t(i){var n;return $c(this,t),n=e.call(this,i),tr(ki(n),"toggleToc",function(){n.setState({expandedToc:!n.state.expandedToc})}),tr(ki(n),"next",function(){var s=n.readerRef.current;s.nextPage()}),tr(ki(n),"prev",function(){var s=n.readerRef.current;s.prevPage()}),tr(ki(n),"onTocChange",function(s){var a=n.props.tocChanged;n.setState({toc:s},function(){return a&&a(s)})}),tr(ki(n),"setLocation",function(s){var a=n.props.locationChanged;n.setState({expandedToc:!1},function(){return a&&a(s)})}),n.readerRef=Pe.default.createRef(),n.state={expandedToc:!1,toc:!1},n}return Jc(t,[{key:"renderToc",value:function(){var n=this,s=this.state,a=s.toc,o=s.expandedToc,l=this.props.readerStyles;return Pe.default.createElement("div",null,Pe.default.createElement("div",{style:l.tocArea},Pe.default.createElement("div",{style:l.toc},a.map(function(u,f){return Pe.default.createElement(rd,jr({},u,{key:f,setLocation:n.setLocation,styles:l.tocAreaButton}))}))),o&&Pe.default.createElement("div",{style:l.tocBackground,onClick:this.toggleToc}))}},{key:"renderTocToggle",value:function(){var n=this.state.expandedToc,s=this.props.readerStyles;return Pe.default.createElement("button",{style:Object.assign({},s.tocButton,n?s.tocButtonExpanded:{}),onClick:this.toggleToc},Pe.default.createElement("span",{style:Object.assign({},s.tocButtonBar,s.tocButtonBarTop)}),Pe.default.createElement("span",{style:Object.assign({},s.tocButtonBar,s.tocButtonBottom)}))}},{key:"render",value:function(){var n=this.props,s=n.title,a=n.showToc,o=n.loadingView,l=n.readerStyles,u=n.locationChanged,f=n.swipeable,d=n.epubViewStyles,c=id(n,hy),v=this.state,g=v.toc,O=v.expandedToc;return Pe.default.createElement("div",{style:l.container},Pe.default.createElement("div",{style:Object.assign({},l.readerArea,O?l.containerExpanded:{})},a&&this.renderTocToggle(),Pe.default.createElement("div",{style:l.titleArea},s),Pe.default.createElement(gy,{onSwipedRight:this.prev,onSwipedLeft:this.next,trackMouse:!0},Pe.default.createElement("div",{style:l.reader},Pe.default.createElement(ly.EpubView,jr({ref:this.readerRef,loadingView:o,epubViewStyles:d},c,{tocChanged:this.onTocChange,locationChanged:u})),f&&Pe.default.createElement("div",{style:l.swipeWrapper}))),Pe.default.createElement("button",{style:Object.assign({},l.arrow,l.prev),onClick:this.prev},"\u2039"),Pe.default.createElement("button",{style:Object.assign({},l.arrow,l.next),onClick:this.next},"\u203A")),a&&g&&this.renderToc())}}]),t}(Pe.PureComponent);po.defaultProps={loadingView:Pe.default.createElement("div",{style:Xc.default.loadingView},"Loading\u2026"),locationChanged:null,tocChanged:null,showToc:!0,readerStyles:Xc.default};po.propTypes={title:It.default.string,loadingView:It.default.element,showToc:It.default.bool,locationChanged:It.default.func,tocChanged:It.default.func,readerStyles:It.default.object,epubViewStyles:It.default.object,swipeable:It.default.bool};var my=po;Es.default=my});var vo=$(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});Object.defineProperty(ir,"EpubView",{enumerable:!0,get:function(){return _y.default}});Object.defineProperty(ir,"EpubViewStyle",{enumerable:!0,get:function(){return yy.default}});Object.defineProperty(ir,"ReactReader",{enumerable:!0,get:function(){return by.default}});Object.defineProperty(ir,"ReactReaderStyle",{enumerable:!0,get:function(){return wy.default}});var _y=xs(Bc()),yy=xs(no()),by=xs(nd()),wy=xs(fo());function xs(r){return r&&r.__esModule?r:{default:r}}});ko(exports,{default:()=>_o});var ks=Zr(require("obsidian"));var Ut=Zr(require("obsidian")),Oo={scrolledView:!1,notePath:"/",useSameFolder:!0,tags:"notes/booknotes"},Is=class extends Ut.PluginSettingTab{constructor(e,t){super(e,t);this.plugin=t}display(){let{containerEl:e}=this;e.empty(),e.createEl("h2",{text:"EPUB Settings"}),new Ut.Setting(e).setName("Scrolled View").setDesc("This enables seamless scrolling between pages.").addToggle(t=>t.setValue(this.plugin.settings.scrolledView).onChange(i=>Tt(this,null,function*(){this.plugin.settings.scrolledView=i,yield this.plugin.saveSettings()}))),new Ut.Setting(e).setName("Same Folder").setDesc("When toggle on, the epub note file will be created in the same folder.").addToggle(t=>t.setValue(this.plugin.settings.useSameFolder).onChange(i=>Tt(this,null,function*(){this.plugin.settings.useSameFolder=i,yield this.plugin.saveSettings()}))),new Ut.Setting(e).setName("Note Folder").setDesc("Choose the default epub note folder. When the Same Folder toggled on, this setting is ineffective.").addDropdown(t=>t.addOptions(xd(this.app)).setValue(this.plugin.settings.notePath).onChange(i=>Tt(this,null,function*(){this.plugin.settings.notePath=i,yield this.plugin.saveSettings()}))),new Ut.Setting(e).setName("Tags").setDesc("Tags added to new note metadata.").addText(t=>{t.inputEl.size=50,t.setValue(this.plugin.settings.tags).onChange(i=>Tt(this,null,function*(){this.plugin.settings.tags=i,yield this.plugin.saveSettings()}))})}};function xd(r){let e={};return Ut.Vault.recurseChildren(r.vault.getRoot(),t=>{t instanceof Ut.TFolder&&(e[t.path]=t.path)}),e}var rr=Zr(require("obsidian"));Mi();Mi();Mi();Mi();var Oi=Zr(vo()),sd=({contents:r,title:e,scrolled:t,tocOffset:i,tocBottomOffset:n,leaf:s})=>{let[a,o]=Li(null),l=dr(null),u=f=>o(f);return cr(()=>{s.view.app.workspace.on("resize",()=>{var c;let f=s.view.containerEl.querySelector("div.epub-container");if(f==null)return;let d=getComputedStyle(f.parentElement);(c=l.current)==null||c.resize(parseFloat(d.width),parseFloat(d.height))})},[s]),et("div",{style:{height:"100vh"}},et(Oi.ReactReader,{title:e,showToc:!0,location:a,locationChanged:u,swipeable:!1,url:r,getRendition:f=>l.current=f,epubOptions:t?{allowPopups:!0,flow:"scrolled",manager:"continuous"}:void 0,readerStyles:lr(or({},Oi.ReactReaderStyle),{arrow:lr(or({},Oi.ReactReaderStyle.arrow),{boxShadow:"none"}),tocArea:lr(or({},Oi.ReactReaderStyle.tocArea),{top:i.toString()+"px",bottom:n.toString()+"px",left:"auto",backgroundColor:"currentColor",height:"auto",whiteSpace:"unset"}),tocButtonExpanded:lr(or({},Oi.ReactReaderStyle.tocButtonExpanded),{backgroundColor:"currentColor"})})}))};var Ss="epub",Ts="epub",go="doc-epub",mo=class extends rr.FileView{constructor(e,t){super(e);this.settings=t}onMoreOptionsMenu(e){e.addItem(t=>{t.setTitle("Create new epub note").setIcon("document").onClick(()=>Tt(this,null,function*(){let i=this.getFileName(),n=this.app.vault.getAbstractFileByPath(i);(n==null||!(n instanceof rr.TFile))&&(n=yield this.app.vault.create(i,this.getFileContent())),this.app.workspace.createLeafBySplit(this.leaf).openFile(n,{active:!0})}))}),e.addSeparator(),super.onMoreOptionsMenu(e)}getFileName(){let e;return this.settings.useSameFolder?e=`${this.file.parent.path}/`:e=this.settings.notePath.endsWith("/")?this.settings.notePath:`${this.settings.notePath}/`,`${e}${this.file.basename}.md`}getFileContent(){return`--- Tags: ${this.settings.tags} Date: ${(0,rr.moment)().toLocaleString()} --- # ${this.file.basename} `}onLoadFile(e){return Tt(this,null,function*(){gr(this.contentEl),this.contentEl.empty();let t=getComputedStyle(this.containerEl.parentElement.querySelector("div.view-header")),i=parseFloat(t.height),n=parseFloat(t.width),s=getComputedStyle(this.containerEl.parentElement.querySelector("div.view-content")),a=parseFloat(s.paddingBottom),o=parseFloat(s.paddingTop),l=(i `),this.registerView(Ts,e=>new mo(e,this.settings));try{this.registerExtensions([Ss],Ts)}catch(e){console.log(`Existing file extension ${Ss}`)}this.addSettingTab(new Is(this.app,this))})}onunload(){}loadSettings(){return Tt(this,null,function*(){this.settings=Object.assign({},Oo,yield this.loadData())})}saveSettings(){return Tt(this,null,function*(){yield this.saveData(this.settings)})}}; /*! JSZip v3.9.1 - A JavaScript class for generating and reading zip files (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/master/LICENSE */ /*! localForage -- Offline Storage, Improved Version 1.10.0 https://localforage.github.io/localForage (c) 2013-2017 Mozilla, Apache License 2.0 */ /* nosourcemap */