UNPKG

universalviewer

Version:

The Universal Viewer is a community-developed open source project on a mission to help you share your 📚📜📰📽️📻🗿 with the 🌎

1 lines 14.8 kB
"use strict";(self.webpackChunkUV=self.webpackChunkUV||[]).push([[5936],{1491:(e,t,n)=>{n.d(t,{a:()=>N,b:()=>oe,c:()=>ie,g:()=>ae,h:()=>T,r:()=>d});var r,o=(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},r(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=0,a=!1,l=window,s=document,u={$flags$:0,$resourcesUrl$:"",jmp:function(e){return e()},raf:function(e){return requestAnimationFrame(e)},ael:function(e,t,n,r){return e.addEventListener(t,n,r)},rel:function(e,t,n,r){return e.removeEventListener(t,n,r)}},c=function(){var e=!1;try{s.addEventListener("e",null,Object.defineProperty({},"passive",{get:function(){e=!0}}))}catch(e){}return e}(),$=function(){try{return new CSSStyleSheet,!0}catch(e){}return!1}(),f=new WeakMap,h=function(e){return f.get(e)},d=function(e,t){return f.set(t.$lazyInstance$=e,t)},p=function(e,t){return t in e},m=function(e){return console.error(e)},v=new Map,g=new Map,y=[],b=[],w=[],S=function(e,t){return function(n){e.push(n),a||(a=!0,t&&4&u.$flags$?R(L):u.raf(L))}},E=function(e,t){for(var n=0,r=0;n<e.length&&(r=performance.now())<t;)try{e[n++](r)}catch(e){m(e)}n===e.length?e.length=0:0!==n&&e.splice(0,n)},L=function(){i++,function(e){for(var t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){m(e)}e.length=0}(y);var e=2==(6&u.$flags$)?performance.now()+10*Math.ceil(i*(1/22)):1/0;E(b,e),E(w,e),b.length>0&&(w.push.apply(w,b),b.length=0),(a=y.length+b.length+w.length>0)?u.raf(L):i=0},R=function(e){return Promise.resolve().then(e)},k=S(b,!0),P={},x=function(e){return"object"==(e=typeof e)||"function"===e},N=function(){return l.CSS&&l.CSS.supports&&l.CSS.supports("color","var(--c)")?Promise.resolve():n.e(74).then(n.t.bind(n,74,23)).then((function(){if(u.$cssShim$=l.__stencil_cssshim,u.$cssShim$)return u.$cssShim$.initShim()}))},j="hydrated",C=function(e,t){return void 0===t&&(t=""),function(){}},_=new WeakMap,M=function(e,t,n){var r=C(0,t.$tagName$);!function(e,t,n,r){var o=O(t.$tagName$),i=g.get(o);if(e=11===e.nodeType?e:s,i)if("string"==typeof i){e=e.head||e;var a=_.get(e),l=void 0;if(a||_.set(e,a=new Set),!a.has(o)){if(u.$cssShim$){var c=(l=u.$cssShim$.createHostStyle(r,o,i,!!(10&t.$flags$)))["s-sc"];c&&(o=c,a=null)}else(l=s.createElement("style")).innerHTML=i;e.insertBefore(l,e.querySelector("link")),a&&a.add(o)}}else e.adoptedStyleSheets.includes(i)||(e.adoptedStyleSheets=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,l=i.length;a<l;a++,o++)r[o]=i[a];return r}(e.adoptedStyleSheets,[i]))}(e.getRootNode(),t,0,e),r()},O=function(e,t){return"sc-"+e},T=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=null,i=!1,a=!1,l=[],s=function(t){for(var n=0;n<t.length;n++)o=t[n],Array.isArray(o)?s(o):null!=o&&"boolean"!=typeof o&&((i="function"!=typeof e&&!x(o))&&(o=String(o)),i&&a?l[l.length-1].$text$+=o:l.push(i?I(null,o):o),a=i)};if(s(n),t){var u=t.className||t.class;u&&(t.class="object"!=typeof u?u:Object.keys(u).filter((function(e){return u[e]})).join(" "))}var c=I(e,null);return c.$attrs$=t,l.length>0&&(c.$children$=l),c},I=function(e,t){return{$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null}},H={},A=function(e,t,n,r,o,i){if(n!==r){var a=p(e,t),s=t.toLowerCase();if("class"===t){var c=e.classList,$=U(n),f=U(r);c.remove.apply(c,$.filter((function(e){return e&&!f.includes(e)}))),c.add.apply(c,f.filter((function(e){return e&&!$.includes(e)})))}else if("ref"===t)r&&r(e);else if(a||"o"!==t[0]||"n"!==t[1]){var h=x(r);if((a||h&&null!==r)&&!o)try{if(e.tagName.includes("-"))e[t]=r;else{var d=null==r?"":r;"list"===t?a=!1:null!=n&&e[t]==d||(e[t]=d)}}catch(e){}null==r||!1===r?e.removeAttribute(t):(!a||4&i||o)&&!h&&(r=!0===r?"":r,e.setAttribute(t,r))}else t="-"===t[2]?t.slice(3):p(l,s)?s.slice(2):s[2]+t.slice(3),n&&u.rel(e,t,n,!1),r&&u.ael(e,t,r,!1)}},q=/\s/,U=function(e){return e?e.split(q):[]},z=function(e,t,n,r){var o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,i=e&&e.$attrs$||P,a=t.$attrs$||P;for(r in i)r in a||A(o,r,i[r],void 0,n,t.$flags$);for(r in a)A(o,r,i[r],a[r],n,t.$flags$)},B=function(e,t,n,r){var o,i,a=t.$children$[n],l=0;if(null!==a.$text$)o=a.$elm$=s.createTextNode(a.$text$);else if(o=a.$elm$=s.createElement(a.$tag$),z(null,a,!1),a.$children$)for(l=0;l<a.$children$.length;++l)(i=B(e,a,l))&&o.appendChild(i);return o},W=function(e,t,n,r,o,i){for(var a,l=e;o<=i;++o)r[o]&&(a=B(null,n,o))&&(r[o].$elm$=a,l.insertBefore(a,t))},V=function(e,t,n,r,o){for(;t<=n;++t)(r=e[t])&&(o=r.$elm$,G(r),o.remove())},D=function(e,t){return e.$tag$===t.$tag$},F=function(e,t){var n=t.$elm$=e.$elm$,r=e.$children$,o=t.$children$;null===t.$text$?(z(e,t,!1),null!==r&&null!==o?function(e,t,n,r){for(var o,i=0,a=0,l=t.length-1,s=t[0],u=t[l],c=r.length-1,$=r[0],f=r[c];i<=l&&a<=c;)null==s?s=t[++i]:null==u?u=t[--l]:null==$?$=r[++a]:null==f?f=r[--c]:D(s,$)?(F(s,$),s=t[++i],$=r[++a]):D(u,f)?(F(u,f),u=t[--l],f=r[--c]):D(s,f)?(F(s,f),e.insertBefore(s.$elm$,u.$elm$.nextSibling),s=t[++i],f=r[--c]):D(u,$)?(F(u,$),e.insertBefore(u.$elm$,s.$elm$),u=t[--l],$=r[++a]):(o=B(t&&t[a],n,a),$=r[++a],o&&s.$elm$.parentNode.insertBefore(o,s.$elm$));i>l?W(e,null==r[c+1]?null:r[c+1].$elm$,n,r,a,c):a>c&&V(t,i,l)}(n,r,t,o):null!==o?(null!==e.$text$&&(n.textContent=""),W(n,null,t,o,0,o.length-1)):null!==r&&V(r,0,r.length-1)):e.$text$!==t.$text$&&(n.data=t.$text$)},G=function(e){e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.forEach(G)},K=function(e,t){t&&!e.$onRenderResolve$&&t["s-p"].push(new Promise((function(t){return e.$onRenderResolve$=t})))},Q=function(e,t,n,r){if(t.$flags$|=16,!(4&t.$flags$)){var o=C(0,n.$tagName$),i=t.$ancestorComponent$,a=t.$lazyInstance$,l=function(){return J(e,t,n,a,r)};return K(t,i),r&&(t.$flags$|=256,t.$queuedListeners$&&(t.$queuedListeners$.forEach((function(e){var t=e[0],n=e[1];return Z(a,t,n)})),t.$queuedListeners$=null)),o(),ee(void 0,(function(){return k(l)}))}t.$flags$|=512},J=function(e,t,n,r,o){var i=C(0,n.$tagName$),a=e["s-rc"];o&&M(e,n,t.$modeName$);var l=C(0,n.$tagName$);try{!function(e,t,n,r){var o,i=t.$vnode$||I(null,null),a=(o=r)&&o.$tag$===H?r:T(null,null,r);a.$tag$=null,a.$flags$|=4,t.$vnode$=a,a.$elm$=i.$elm$=e,F(i,a)}(e,t,0,r.render())}catch(e){m(e)}u.$cssShim$&&u.$cssShim$.updateHost(e),t.$flags$&=-17,t.$flags$|=2,a&&(a.forEach((function(e){return e()})),e["s-rc"]=void 0),l(),i();var s=e["s-p"],c=function(){return X(e,t,n)};0===s.length?c():(Promise.all(s).then(c),t.$flags$|=4,s.length=0)},X=function(e,t,n){var r=C(0,n.$tagName$),o=t.$lazyInstance$,i=t.$ancestorComponent$;64&t.$flags$?(Z(o,"componentDidUpdate"),r()):(t.$flags$|=64,e.classList.add(j),r(),t.$onReadyResolve$(e),i||Y()),t.$onInstanceResolve$(e),t.$onRenderResolve$&&(t.$onRenderResolve$(),t.$onRenderResolve$=void 0),512&t.$flags$&&R((function(){return Q(e,t,n,!1)})),t.$flags$&=-517},Y=function(e){s.documentElement.classList.add(j),u.$flags$|=2},Z=function(e,t,n){if(e&&e[t])try{return e[t](n)}catch(e){m(e)}},ee=function(e,t){return e&&e.then?e.then(t):t()},te=function(e,t,n){if(t.$members$){var r=Object.entries(t.$members$),o=e.prototype;if(r.forEach((function(e){var r=e[0],i=e[1][0];31&i||2&n&&32&i?Object.defineProperty(o,r,{get:function(){return e=r,h(this).$instanceValues$.get(e);var e},set:function(e){!function(e,t,n,r){var o,i,a=h(e),l=a.$hostElement$,s=a.$instanceValues$.get(t),u=a.$flags$,c=a.$lazyInstance$;o=n,i=r.$members$[t][0],(n=null==o||x(o)?o:4&i?"false"!==o&&(""===o||!!o):2&i?parseFloat(o):1&i?String(o):o)===s||8&u&&void 0!==s||(a.$instanceValues$.set(t,n),c&&2==(18&u)&&Q(l,a,r,!1))}(this,r,e,t)},configurable:!0,enumerable:!0}):1&n&&64&i&&Object.defineProperty(o,r,{value:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=h(this);return n.$onInstancePromise$.then((function(){var t;return(t=n.$lazyInstance$)[r].apply(t,e)}))}})})),1&n){var i=new Map;o.attributeChangedCallback=function(e,t,n){var r=this;u.jmp((function(){var t=i.get(e);r[t]=(null!==n||"boolean"!=typeof r[t])&&n}))},e.observedAttributes=r.filter((function(e){return e[0],15&e[1][0]})).map((function(e){var t=e[0],n=e[1][1]||t;return i.set(n,t),n}))}}return e},ne=function(e,t,r,o,i){return a=void 0,l=void 0,u=function(){var o,a,l,s,u,c,f;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(h){switch(h.label){case 0:return 0!=(32&t.$flags$)?[3,3]:(t.$flags$|=32,i=function(e,t,r){var o=e.$tagName$.replace(/-/g,"_"),i=e.$lazyBundleIds$,a=v.get(i);return a?a[o]:n(5772)("./"+i+".entry.js").then((function(e){return v.set(i,e),e[o]}),m)}(r),i.then?(o=function(){},[4,i]):[3,2]);case 1:i=h.sent(),o(),h.label=2;case 2:i.isProxied||(te(i,r,2),i.isProxied=!0),a=C(0,r.$tagName$),t.$flags$|=8;try{new i(t)}catch(e){m(e)}t.$flags$&=-9,a(),l=O(r.$tagName$),!g.has(l)&&i.style&&(s=C(0,r.$tagName$),u=i.style,function(e,t,n){var r=g.get(e);$&&n?(r=r||new CSSStyleSheet).replace(t):r=t,g.set(e,r)}(l,u,!!(1&r.$flags$)),s()),h.label=3;case 3:return c=t.$ancestorComponent$,f=function(){return Q(e,t,r,!0)},c&&c["s-rc"]?c["s-rc"].push(f):f(),[2]}}))},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{o(u.next(e))}catch(e){t(e)}}function r(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof s?o:new s((function(e){e(o)}))).then(n,r)}o((u=u.apply(a,l||[])).next())}));var a,l,s,u},re=function(e,t){if(0==(1&u.$flags$)){var n=C(0,t.$tagName$),r=h(e);if(t.$listeners$&&(r.$rmListeners$=function(e,t,n){t.$queuedListeners$=t.$queuedListeners$||[];var r=n.map((function(n){var r=n[0],o=n[1],i=n[2],a=function(e,t){return 8&t?l:e}(e,r),s=function(e,t){return function(n){256&e.$flags$?e.$lazyInstance$[t](n):e.$queuedListeners$.push([t,n])}}(t,i),$=function(e){return c?{passive:0!=(1&e),capture:0!=(2&e)}:0!=(2&e)}(r);return u.ael(a,o,s,$),function(){return u.rel(a,o,s,$)}}));return function(){return r.forEach((function(e){return e()}))}}(e,r,t.$listeners$)),!(1&r.$flags$)){r.$flags$|=1;for(var o=e;o=o.parentNode||o.host;)if(o["s-p"]){K(r,r.$ancestorComponent$=o);break}t.$members$&&Object.entries(t.$members$).forEach((function(t){var n=t[0];if(31&t[1][0]&&e.hasOwnProperty(n)){var r=e[n];delete e[n],e[n]=r}})),R((function(){return ne(e,r,t)}))}n()}},oe=function(e,t){void 0===t&&(t={});var n,r=C(),i=[],a=t.exclude||[],c=s.head,$=l.customElements,d=c.querySelector("meta[charset]"),p=s.createElement("style"),m=[],v=!0;Object.assign(u,t),u.$resourcesUrl$=new URL(t.resourcesUrl||"./",s.baseURI).href,t.syncQueue&&(u.$flags$|=4),e.forEach((function(e){return e[1].forEach((function(t){var r={$flags$:t[0],$tagName$:t[1],$members$:t[2],$listeners$:t[3]};r.$members$=t[2],r.$listeners$=t[3];var l=r.$tagName$,s=function(e){function t(t){var n,r,o=e.call(this,t)||this;return(r={$flags$:0,$hostElement$:n=t=o,$instanceValues$:new Map}).$onInstancePromise$=new Promise((function(e){return r.$onInstanceResolve$=e})),r.$onReadyPromise$=new Promise((function(e){return r.$onReadyResolve$=e})),n["s-p"]=[],n["s-rc"]=[],f.set(n,r),o}return o(t,e),t.prototype.connectedCallback=function(){var e=this;n&&(clearTimeout(n),n=null),v?m.push(this):u.jmp((function(){return re(e,r)}))},t.prototype.disconnectedCallback=function(){var e=this;u.jmp((function(){return function(e){if(0==(1&u.$flags$)){var t=h(e);t.$rmListeners$&&(t.$rmListeners$(),t.$rmListeners$=void 0),u.$cssShim$&&u.$cssShim$.removeHost(e)}}(e)}))},t.prototype["s-hmr"]=function(e){},t.prototype.forceUpdate=function(){!function(e,t){var n=h(e);2==(18&n.$flags$)&&Q(e,n,t,!1)}(this,r)},t.prototype.componentOnReady=function(){return h(this).$onReadyPromise$},t}(HTMLElement);r.$lazyBundleIds$=e[0],a.includes(l)||$.get(l)||(i.push(l),$.define(l,te(s,r,1)))}))})),p.innerHTML=i+"{visibility:hidden}.hydrated{visibility:inherit}",p.setAttribute("data-styles",""),c.insertBefore(p,d?d.nextSibling:c.firstChild),v=!1,m.length>0?m.forEach((function(e){return e.connectedCallback()})):u.jmp((function(){return n=setTimeout(Y,30,"timeout")})),r()},ie=function(e,t,n){var r=ae(e);return{emit:function(e){return r.dispatchEvent(new CustomEvent(t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e}))}}},ae=function(e){return h(e).$hostElement$}},5936:(e,t,n)=>{function r(){var e=window,t=[];return e.customElements&&(!e.Element||e.Element.prototype.closest&&e.Element.prototype.matches&&e.Element.prototype.remove)||t.push(n.e(4646).then(n.t.bind(n,4646,23))),"function"==typeof Object.assign&&Object.entries&&Array.prototype.find&&Array.prototype.includes&&String.prototype.startsWith&&String.prototype.endsWith&&(!e.NodeList||e.NodeList.prototype.forEach)&&e.fetch&&function(){try{var e=new URL("b","http://a");return e.pathname="c%20d","http://a/c%20d"===e.href&&e.searchParams}catch(e){return!1}}()&&"undefined"!=typeof WeakMap||t.push(n.e(8941).then(n.t.bind(n,8941,23))),Promise.all(t)}n.d(t,{m:()=>r,q:()=>i});var o=n(1491),i=function(e,t){return(0,o.a)().then((function(){(0,o.b)([["uv-ebook-reader_2",[[0,"uv-ebook-reader",{width:[1],height:[1],mobileWidth:[2,"mobile-width"],minSpreadWidth:[2,"min-spread-width"],_bookPath:[32],_bookReady:[32],_prevEnabled:[32],_mobile:[32],_nextEnabled:[32],_showDivider:[32],load:[64],resize:[64],display:[64],getBook:[64]},[[8,"keydown","handleKeyDown"]]],[0,"uv-ebook-toc",{toc:[16],selected:[1025],disabled:[4]}]]]],t)}))};!function(){if(void 0!==window.Reflect&&void 0!==window.customElements){var e=HTMLElement;window.HTMLElement=function(){return Reflect.construct(e,[],this.constructor)},HTMLElement.prototype=e.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,e)}}()}}]);