@internetarchive/bookreader 5.0.0-48-alpha0 → 5.0.0-48-alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1061,7 +1061,7 @@
1061
1061
  .stroke-color {
1062
1062
  stroke: var(--iconStrokeColor);
1063
1063
  }
1064
- `}render(){return xt}}function jt(e){return(jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Pt(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Et(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Lt(e,t){return(Lt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function It(e,t){if(t&&("object"===jt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Mt(e){return(Mt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}customElements.define("ia-icon-dl",Bt),n(9653);var zt,Dt,Tt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Lt(e,t)}(l,e);var t,n,r,i,a,s=(i=l,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Mt(i);if(a){var n=Mt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return It(this,e)});function l(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(e=s.call(this)).downloads=[],e.expiration=0,e.renderHeader=!1,e.isBookProtected=!1,e}return t=l,r=[{key:"properties",get:function(){return{downloads:{type:Array},expiration:{type:Number},renderHeader:{type:Boolean},isBookProtected:{type:Boolean}}}},{key:"styles",get:function(){var e=(0,o.iv)(Ct||(Ct=Pt(["\n :host {\n display: block;\n height: 100%;\n padding: 1.5rem 0;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n }\n\n a.close ia-icon {\n --iconWidth: 18px;\n --iconHeight: 18px;\n }\n a.close {\n justify-self: end;\n }\n\n header {\n display: flex;\n align-items: center;\n padding: 0 2rem;\n }\n header p {\n padding: 0;\n margin: 0;\n font-size: 1.2rem;\n font-weight: bold;\n font-style: italic;\n }\n header div {\n display: flex;\n align-items: baseline;\n } \n\n h2 {\n font-size: 1.6rem;\n }\n\n h3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 1.4rem;\n }\n\n ul {\n padding: 0;\n margin: 0;\n list-style: none;\n }\n\n p {\n margin: .3rem 0 0 0;\n }\n\n li,\n ul + p {\n padding-bottom: 1.2rem;\n font-size: 1.2rem;\n line-height: 140%;\n }\n "])));return[We,e]}}],(n=[{key:"render",value:function(){return(0,o.dy)(st||(st=Pt(["\n ","\n ","\n ","\n "])),this.header,this.loanExpiryMessage,this.renderDownloadOptions())}},{key:"header",get:function(){return this.renderHeader?(0,o.dy)(lt||(lt=Pt(["\n <header>\n <h3>Read offline</h3>\n ","\n </header>\n "])),this.formatsCount):o.Ld}},{key:"formatsCount",get:function(){var e=this.downloads.length;return e?(0,o.dy)(ct||(ct=Pt(["<p>"," format","</p>"])),e,e>1?"s":""):(0,o.dy)(ut||(ut=Pt([""])))}},{key:"loanExpiryMessage",get:function(){return this.expiration?(0,o.dy)(dt||(dt=Pt(["<h2>These files will expire in "," days.</h2>"])),this.expiration):(0,o.dy)(ht||(ht=Pt([""])))}},{key:"renderDownloadOptions",value:function(){var e=this,t=[];return["pdf","epub","lcppdf","lcpepub","adobepdf","adobeepub"].forEach((function(n){e.downloads[n]&&t.push(e.downloadOption(n,e.downloads[n]))})),(0,o.dy)(ft||(ft=Pt(["\n <ul>\n ","\n </ul>\n "])),t)}},{key:"downloadOption",value:function(e,t){var n;return/^adobe/.test(e)?(0,o.dy)(pt||(pt=Pt(['\n <li>\n <a\n href="','"\n data-event-click-tracking="BookReader|Download-','"\n >',"</a>\n ","\n </li>\n "])),t,e,this.menuText[e].linkText,null!==(n=this.menuText[e].message)&&void 0!==n?n:o.Ld):(0,o.dy)(mt||(mt=Pt(['\n <li>\n <a class="ia-button link primary"\n href="','"\n data-event-click-tracking="BookReader|Download-','"\n >',"</a>\n ","\n </li>\n "])),t,e,this.menuText[e].linkText,this.menuText[e].message?(0,o.dy)(vt||(vt=Pt(["<p>","</p>"])),this.menuText[e].message):o.Ld)}},{key:"menuText",get:function(){return{pdf:{linkText:"Get high-resolution PDF",message:(0,o.dy)(bt||(bt=Pt([""])))},epub:{linkText:"Get text-based ebook",message:(0,o.dy)(yt||(yt=Pt(["Smaller size. May contain some errors."])))},lcppdf:{linkText:"Get high-resolution PDF",message:this.lcpNote},lcpepub:{linkText:"Get text-based ebook",message:(0,o.dy)(gt||(gt=Pt(["Smaller size. May contain some errors. ",""])),this.lcpNote)},adobepdf:{linkText:"Get legacy Adobe DRM PDF version here.",message:this.adobeNote},adobeepub:{linkText:"Get legacy Adobe DRM EPUB version here.",message:this.adobeNote}}}},{key:"lcpNote",get:function(){return(0,o.dy)(kt||(kt=Pt(['\n Requires having an LCP-compatible e-reader installed like Aldiko Next (<a href="https://apps.apple.com/us/app/aldiko-next/id1476410111">iOS</a>, <a href="https://play.google.com/store/apps/details?id=com.aldiko.android">Android</a>) or <a href="https://www.edrlab.org/software/thorium-reader/">Thorium</a>.\n '])))}},{key:"adobeNote",get:function(){return(0,o.dy)(wt||(wt=Pt(['\n Requires a compatible e-reader like <a hef="https://www.adobe.com/solutions/ebook/digital-editions.html">Adobe Digital Editions</a>.\n '])))}}])&&Et(t.prototype,n),r&&Et(t,r),Object.defineProperty(t,"prototype",{writable:!1}),l}(o.oi);function At(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _t(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_t(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Rt(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function $t(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}customElements.define("ia-book-downloads",Tt);var Ht=function(){function e(t){var n,r=t.bookreader;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.icon=(0,o.dy)(zt||(zt=Rt(['<ia-icon-dl style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon-dl>']))),this.label="Read offline",this.menuDetails="",this.downloads=[],this.id="downloads",this.component="",this.isBookProtected=(null==r||null===(n=r.options)||void 0===n?void 0:n.isProtected)||!1}var t,n;return t=e,(n=[{key:"update",value:function(e){this.computeAvailableTypes(e),this.component=this.menu,this.component.isBookProtected=this.isBookProtected;var t=1===this.downloads.length?"":"s";this.menuDetails="(".concat(this.downloads.length," format").concat(t,")")}},{key:"computeAvailableTypes",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=t.reduce((function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=At(n,2),r=o[0],i=void 0===r?"":r,a=o[1],s=void 0===a?"":a;if(!i)return t;var l=i.toLowerCase();return"pdf"!==l&&"epub"!==l||!e.isbookProtected||(l="adobe".concat(l)),t[l]=s,t}),{});this.downloads=n}},{key:"menu",get:function(){return(0,o.dy)(Dt||(Dt=Rt(["<ia-book-downloads .downloads=","></ia-book-downloads>"])),this.downloads)}}])&&$t(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),Ft=(n(9600),o.dy`
1064
+ `}render(){return xt}}function jt(e){return(jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Pt(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Et(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Lt(e,t){return(Lt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function It(e,t){if(t&&("object"===jt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Mt(e){return(Mt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}customElements.define("ia-icon-dl",Bt),n(9653);var zt,Dt,Tt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Lt(e,t)}(l,e);var t,n,r,i,a,s=(i=l,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Mt(i);if(a){var n=Mt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return It(this,e)});function l(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(e=s.call(this)).downloads=[],e.expiration=0,e.renderHeader=!1,e.isBookProtected=!1,e}return t=l,r=[{key:"properties",get:function(){return{downloads:{type:Array},expiration:{type:Number},renderHeader:{type:Boolean},isBookProtected:{type:Boolean}}}},{key:"styles",get:function(){var e=(0,o.iv)(Ct||(Ct=Pt(["\n :host {\n display: block;\n height: 100%;\n padding: 1.5rem 0;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n }\n\n a.close ia-icon {\n --iconWidth: 18px;\n --iconHeight: 18px;\n }\n a.close {\n justify-self: end;\n }\n\n header {\n display: flex;\n align-items: center;\n padding: 0 2rem;\n }\n header p {\n padding: 0;\n margin: 0;\n font-size: 1.2rem;\n font-weight: bold;\n font-style: italic;\n }\n header div {\n display: flex;\n align-items: baseline;\n } \n\n h2 {\n font-size: 1.6rem;\n }\n\n h3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 1.4rem;\n }\n\n ul {\n padding: 0;\n margin: 0;\n list-style: none;\n }\n\n p {\n margin: .3rem 0 0 0;\n }\n\n li,\n ul + p {\n padding-bottom: 1.2rem;\n font-size: 1.2rem;\n line-height: 140%;\n }\n "])));return[We,e]}}],(n=[{key:"render",value:function(){return(0,o.dy)(st||(st=Pt(["\n ","\n ","\n ","\n "])),this.header,this.loanExpiryMessage,this.renderDownloadOptions())}},{key:"header",get:function(){return this.renderHeader?(0,o.dy)(lt||(lt=Pt(["\n <header>\n <h3>Read offline</h3>\n ","\n </header>\n "])),this.formatsCount):o.Ld}},{key:"formatsCount",get:function(){var e=this.downloads.length;return e?(0,o.dy)(ct||(ct=Pt(["<p>"," format","</p>"])),e,e>1?"s":""):(0,o.dy)(ut||(ut=Pt([""])))}},{key:"loanExpiryMessage",get:function(){return this.expiration?(0,o.dy)(dt||(dt=Pt(["<h2>These files will expire in "," days.</h2>"])),this.expiration):(0,o.dy)(ht||(ht=Pt([""])))}},{key:"renderDownloadOptions",value:function(){var e=this,t=[];return["pdf","epub","lcppdf","lcpepub","adobepdf","adobeepub"].forEach((function(n){e.downloads[n]&&t.push(e.downloadOption(n,e.downloads[n]))})),(0,o.dy)(ft||(ft=Pt(["\n <ul>\n ","\n </ul>\n "])),t)}},{key:"downloadOption",value:function(e,t){var n;return/^adobe/.test(e)?(0,o.dy)(pt||(pt=Pt(['\n <li>\n <a\n href="','"\n data-event-click-tracking="BookReader|Download-','"\n >',"</a>\n ","\n </li>\n "])),t,e,this.menuText[e].linkText,null!==(n=this.menuText[e].message)&&void 0!==n?n:o.Ld):(0,o.dy)(mt||(mt=Pt(['\n <li>\n <a class="ia-button link primary"\n href="','"\n data-event-click-tracking="BookReader|Download-','"\n >',"</a>\n ","\n </li>\n "])),t,e,this.menuText[e].linkText,this.menuText[e].message?(0,o.dy)(vt||(vt=Pt(["<p>","</p>"])),this.menuText[e].message):o.Ld)}},{key:"menuText",get:function(){return{pdf:{linkText:"Get high-resolution PDF",message:(0,o.dy)(bt||(bt=Pt([""])))},epub:{linkText:"Get text-based ebook",message:(0,o.dy)(yt||(yt=Pt(["Smaller size. May contain some errors."])))},lcppdf:{linkText:"Get high-resolution PDF",message:this.lcpNote},lcpepub:{linkText:"Get text-based ebook",message:(0,o.dy)(gt||(gt=Pt(["Smaller size. May contain some errors. ",""])),this.lcpNote)},adobepdf:{linkText:"Get legacy Adobe DRM PDF version here.",message:this.adobeNote},adobeepub:{linkText:"Get legacy Adobe DRM EPUB version here.",message:this.adobeNote}}}},{key:"lcpNote",get:function(){return(0,o.dy)(kt||(kt=Pt(['\n Requires having an LCP-compatible e-reader installed like Aldiko Next (<a href="https://apps.apple.com/us/app/aldiko-next/id1476410111">iOS</a>, <a href="https://play.google.com/store/apps/details?id=com.aldiko.android">Android</a>) or <a href="https://www.edrlab.org/software/thorium-reader/">Thorium</a>.\n '])))}},{key:"adobeNote",get:function(){return(0,o.dy)(wt||(wt=Pt(['\n Requires a compatible e-reader like <a hef="https://www.adobe.com/solutions/ebook/digital-editions.html">Adobe Digital Editions</a>.\n '])))}}])&&Et(t.prototype,n),r&&Et(t,r),Object.defineProperty(t,"prototype",{writable:!1}),l}(o.oi);function At(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _t(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_t(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Rt(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function $t(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}customElements.define("ia-book-downloads",Tt);var Ht=function(){function e(t){var n,r=t.bookreader;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.icon=(0,o.dy)(zt||(zt=Rt(['<ia-icon-dl style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon-dl>']))),this.label="Read offline",this.menuDetails="",this.downloads=[],this.id="downloads",this.component="",this.isBookProtected=(null==r||null===(n=r.options)||void 0===n?void 0:n.isProtected)||!1}var t,n;return t=e,(n=[{key:"update",value:function(e){this.computeAvailableTypes(e),this.component=this.menu,this.component.isBookProtected=this.isBookProtected;var t=1===this.downloads.length?"":"s";this.menuDetails="(".concat(this.downloads.length," format").concat(t,")")}},{key:"computeAvailableTypes",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=t.reduce((function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=At(n,2),r=o[0],i=void 0===r?"":r,a=o[1],s=void 0===a?"":a;if(!i)return t;var l=i.toLowerCase();return"pdf"!==l&&"epub"!==l||!e.isBookProtected||(l="adobe".concat(l)),t[l]=s,t}),{});this.downloads=n}},{key:"menu",get:function(){return(0,o.dy)(Dt||(Dt=Rt(["<ia-book-downloads .downloads=","></ia-book-downloads>"])),this.downloads)}}])&&$t(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),Ft=(n(9600),o.dy`
1065
1065
  <svg
1066
1066
  viewBox="0 0 24 24"
1067
1067
  xmlns="http://www.w3.org/2000/svg"