Socket
Socket
Sign inDemoInstall

jepub

Package Overview
Dependencies
16
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 2.1.0

2

demo/script.js

@@ -5,3 +5,3 @@ /* eslint-disable no-console */

const cover = await fetch('./cover-image.jpg').then(response => {
if (response.ok) return response.blob();
if (response.ok) return response.arrayBuffer();
throw 'Network response was not ok.';

@@ -8,0 +8,0 @@ });

@@ -1,2 +0,9 @@

/*! jepub - 2.0.1 | (c) 2018 lelinhtinh | ISC | https://github.com/lelinhtinh/jEpub#readme */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("jEpub",[],e):"object"==typeof exports?exports.jEpub=e():t.jEpub=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";var i=n(1),o=n(2);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=o(n(3)),r=o(n(4)),l=i(n(5)),s=o(n(6)),h=o(n(7)),p=o(n(8)),c=o(n(9)),f=o(n(10)),d=o(n(11)),m=o(n(12)),u=o(n(13)),g=o(n(14)),y=o(n(15)),x=o(n(16)),v=function(){function t(){(0,a.default)(this,t),this._I18n={},this._Info={},this._Uuid={},this._Date=null,this._Cover=null,this._Pages=[],this._Images=[],this._Zip={}}return(0,r.default)(t,[{key:"init",value:function(t){if(!JSZip.support.blob)throw"This browser does not support Blob";if(this._Info=Object.assign({},{i18n:"vi",title:"undefined",author:"undefined",publisher:"undefined",description:"",tags:[]},t),this._Uuid={scheme:"uuid",id:l.uuidv4()},this._Date=l.getISODate(),!s.default[this._Info.i18n])throw"Unknown Language: ".concat(this._Info.i18n);return this._I18n=s.default[this._Info.i18n],this._Zip=new JSZip,this._Zip.file("mimetype",y.default),this._Zip.file("META-INF/container.xml",h.default),this._Zip.file("OEBPS/jackson.css",c.default),this._Zip.file("OEBPS/title-page.html",ejs.render(u.default,{i18n:this._I18n,title:this._Info.title,author:this._Info.author,publisher:this._Info.publisher,description:l.parseDOM(this._Info.description),tags:this._Info.tags},{client:!0})),this}},{key:"date",value:function(t){if(t instanceof Date)return this._Date=l.getISODate(t),this;throw"Date object is not valid"}},{key:"uuid",value:function(t){if(l.isEmpty(t))throw"UUID value is empty";var e="uuid";return l.validateUrl(t)&&(e="URI"),this._Uuid={scheme:e,id:t},this}},{key:"cover",value:function(t){if(t instanceof Blob){var e=l.mime2ext(t.type);if(!e)throw"Image data is not allowed";return this._Cover={type:t.type,path:"OEBPS/cover-image.".concat(e)},this._Zip.file(this._Cover.path,t),this._Zip.file("OEBPS/front-cover.html",ejs.render(p.default,{i18n:this._I18n,cover:this._Cover},{client:!0})),this}throw"Cover data is not valid"}},{key:"image",value:function(t,e){if(t instanceof Blob){var n=l.mime2ext(t.type);if(!n)throw"Image data is not allowed";var i="assets/".concat(e,".").concat(n);return this._Images[e]={type:t.type,path:i},this._Zip.file("OEBPS/".concat(i),t),this}throw"Image data is not valid"}},{key:"notes",value:function(t){if(l.isEmpty(t))throw"Notes is empty";return this._Zip.file("OEBPS/notes.html",ejs.render(f.default,{i18n:this._I18n,notes:l.parseDOM(t)},{client:!0})),this}},{key:"add",value:function(t,e){if(l.isEmpty(t))throw"Title is empty";if(l.isEmpty(e))throw"Content of ".concat(t," is empty");return Array.isArray(e)||(e=ejs.compile(e,{client:!0})({image:this._Images},function(t){return'<img src="'.concat(t?t.path:"data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=",'" alt=""></img>')}),e=l.parseDOM(e)),this._Zip.file("OEBPS/page-".concat(this._Pages.length,".html"),ejs.render(d.default,{i18n:this._I18n,title:t,content:e},{client:!0})),this._Pages.push(t),this}},{key:"generate",value:function(){var t=this._Zip.file("OEBPS/notes.html");return t=!!t,this._Zip.file("book.opf",ejs.render(g.default,{i18n:this._I18n,uuid:this._Uuid,date:this._Date,title:this._Info.title,author:this._Info.author,publisher:this._Info.publisher,description:l.html2text(this._Info.description,!0),tags:this._Info.tags,cover:this._Cover,pages:this._Pages,notes:t,images:this._Images},{client:!0})),this._Zip.file("OEBPS/table-of-contents.html",ejs.render(m.default,{i18n:this._I18n,pages:this._Pages},{client:!0})),this._Zip.file("toc.ncx",ejs.render(x.default,{i18n:this._I18n,uuid:this._Uuid,title:this._Info.title,author:this._Info.author,pages:this._Pages,notes:t},{client:!0})),this._Zip.generateAsync({type:"blob",mimeType:y.default,compression:"DEFLATE",compressionOptions:{level:9}})}}],[{key:"html2text",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return l.html2text(t,e)}}]),t}();e.default=v,t.exports=e.default},function(t,e){t.exports=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};i.get||i.set?Object.defineProperty(e,n,i):e[n]=t[n]}return e.default=t,e}},function(t,e){t.exports=function(t){return t&&t.__esModule?t:{default:t}}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}t.exports=function(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}},function(t,e,n){"use strict";function i(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=(new DOMParser).parseFromString("<!doctype html><body>".concat(t),"text/html");return e?n.body.textContent.trim():n=(n=(new XMLSerializer).serializeToString(n.body)).replace(/(^<body\s?[^>]*>|<\/body>$)/g,"")}Object.defineProperty(e,"__esModule",{value:!0}),e.uuidv4=function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(t){return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)})},e.isEmpty=function(t){if(null===t)return!0;if("number"==typeof t)return!1;if("string"==typeof t)return!t.trim();return!1},e.getISODate=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date).toISOString()},e.parseDOM=i,e.html2text=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t=i(t=(t=(t=(t=(t=(t=(t=t.replace(/<style([\s\S]*?)<\/style>/gi,"")).replace(/<script([\s\S]*?)<\/script>/gi,"")).replace(/<\/(div|p|li|dd|h[1-6])>/gi,"\n")).replace(/<(br|hr)\s*[\/]?>/gi,"\n")).replace(/<li>/gi,"+ ")).replace(/<[^>]+>/g,"")).replace(/\n{3,}/g,"\n\n"),!0),e&&(t=t.replace(/\n+/g," "));return t},e.validateUrl=function(t){return/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i.test(t)},e.mime2ext=function(t){var e=null;switch(t){case"image/gif":e="gif";break;case"image/apng":e="apng";break;case"image/jpg":case"image/jpeg":e="jpg";break;case"image/png":e="png";break;case"image/webp":e="webp";break;case"image/svg+xml":e="svg";break;case"image/bmp":e="bmp";break;default:e=null}return e}},function(t){t.exports={en:{code:"en",cover:"Cover",toc:"Table of Contents",info:"Information",note:"Notes"},vi:{code:"vi",cover:"Bìa sách",toc:"Mục lục",info:"Giới thiệu",note:"Ghi chú"}}},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">\n\t<rootfiles>\n\t\t<rootfile full-path="book.opf" media-type="application/oebps-package+xml" />\n\t</rootfiles>\n</container>'},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= i18n.code %>">\n\n<head>\n\t<title><%= i18n.cover %></title>\n\t<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />\n\t<link rel="stylesheet" href="jackson.css" type="text/css" />\n</head>\n\n<body>\n\t<div id="cover-image">\n\t\t<img src="../<%= cover.path %>" alt="<%= i18n.cover %>" />\n\t</div>\n</body>\n\n</html>\n'},function(t,e){t.exports='/* Jackson EPUB v1.0 | Copyright 2011-2013 Book Oven Inc. (PressBooks.com) support@pressbooks.com */#toc a:after,a{text-decoration:none}h1,h2,h2.chapter-title,h3,h4{hyphens:none;-webkit-hyphens:none}#title-page h1.title,h1,h2,h3,h4{hyphens:none;-webkit-hypens:none;font-family:sans-serif}div.ugc>p.no-indent,p.no-indent{margin-top:1em!important;text-indent:0!important}body{font-family:sans-serif;line-height:1.4em}h1,h2,h3,h4{line-height:1.3em;margin-top:1em;margin-bottom:.5em;font-weight:400;text-indent:0;text-align:center;letter-spacing:1px;word-spacing:2px;page-break-after:avoid}div.ugc p.indent,p{margin:0}div.ugc p.indent,p,p+p{text-indent:1.5em}.no-indent,div.ugc p.indent,p,p.no-indent{line-height:1.4em;text-align:left}p{font-family:sans-serif}p+p{margin-top:0}.no-indent,p.no-indent{text-indent:0;margin-top:1em}ul{margin-left:1em;padding-left:1em}#title-page h1.title{font-size:3em;margin-top:2em;margin-bottom:0;padding-bottom:5px;text-transform:uppercase;text-align:right}#title-page h2.subtitle{font-family:sans-serif;font-size:1.5em;margin-top:0;padding-top:5px;text-align:right;hyphens:none;-webkit-hypens:none}#title-page h3.author,#title-page h4.publisher{font-family:sans-serif;margin-top:2em;text-align:right;-webkit-hypens:none;hyphens:none}#title-page h3.author{font-size:1.2em;font-weight:400}#title-page h4.publisher{float:bottom;font-size:.9em;margin-bottom:0}#toc ul{font-size:.9em;line-height:1.3em}#toc li,#toc ul{list-style:none;margin:0;padding:0;text-align:left}#toc li{margin-bottom:5px}#toc a{border:none;color:inherit;text-align:left}#toc h1,div.chapter-title-wrap>h2.chapter-title,div.part-title-wrap{text-align:right;font-family:sans-serif}#toc a:after{font-style:normal}#toc h1{font-size:2em;font-weight:lighter;line-height:1.2em;margin-top:0;hyphens:none;-webkit-hyphens:none}div.part-title-wrap{margin-top:2em;margin-bottom:2em;hyphens:none;-webkit-hyphens:none}div.chapter .chapter-title-wrap>h2:first-of-type{counter-reset:footnote}div.chapter-title-wrap{margin-bottom:2.5em;margin-top:3em;hyphens:none;-webkit-hyphens:none}div.chapter-title-wrap>h3.chapter-number{font-family:sans-serif;text-align:right;font-weight:400;font-size:2em;line-height:1.2em;margin-top:-.5em;display:block}div.chapter-title-wrap>h2.chapter-title{font-size:2em;font-weight:lighter;line-height:1.2em;hyphens:none;-webkit-hyphens:none}img{height:auto;max-width:100%}div.chapter-ugc>p:first-of-type::first-letter{font-family:sans-serif;font-size:3.5em;padding-right:5px;margin-right:0}h1,h2,h3,h4,h5,h6{color:#9A3257}#title-page>.title:before,.chapter-title-wrap h2.chapter-title::before{color:#FFB035}.firstcharacter{color:#9A3257}@media amzn-kf8{#title-page h1.title::after,#title-page h1.title::before,.chapter-title-wrap h2.chapter-title::after,.chapter-title-wrap h2.chapter-title::before{content:""}}@media amzn-mobi{#toc,span.toc-chapter-title{text-align:left}#toc{font-style:normal;font-weight:400;border:0}#toc h1{font-size:1em;font-style:normal;font-weight:400}#toc li,span.toc-chapter-title{font-style:normal;font-weight:400;font-size:.7em}#toc a{font-style:normal;font-weight:400}.chapter-ugc p,.indent,.no-indent,.ugc p,body,p,p.indent,p.no-indent{font-family:sans-serif;font-style:normal;font-weight:400}.chapter-ugc p,.ugc p,p{font-size:1em}.no-indent,p.no-indent{font-size:1em;text-indent:0;margin-top:.5em}.indent,p.indent{font-size:1em;text-indent:1.5em;margin-top:0}h1,h2,h3{font-weight:700}h1,h2,h3,h4{font-style:normal;margin-top:.5em;margin-bottom:.5em;text-align:center}h1{font-size:1.4em}h2{font-size:1.3em}h3{font-size:1.2em}h4{font-weight:400;font-size:1.1em}ul{margin-top:1em;margin-bottom:1em}h1.title,h2.subtitle,h3.author,h4.publisher{font-weight:400;font-style:normal}h1.title{font-size:2em;margin-top:2em}h2.subtitle{font-size:1em}div.chapter-title-wrap{font-size:1.5em;margin-top:0;margin-bottom:0}h2.chapter-title,h3.chapter-number{font-weight:400;font-style:normal;margin-top:1em;margin-bottom:1em;text-align:center}h3.chapter-number{font-size:1.2em}h2.chapter-title{font-size:1.5em}li,ul{text-align:right!important}}div.chapter-title-wrap>.chapter-number{display:none!important}'},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= i18n.code %>">\n\n<head>\n\t<title><%= i18n.note %></title>\n\t<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />\n\t<link rel="stylesheet" href="jackson.css" type="text/css" />\n</head>\n\n<body>\n\t<div id="notes-page">\n\t\t<div class="ugc">\n <%- notes %>\n\t\t</div>\n\t</div>\n</body>\n\n</html>\n'},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= i18n.code %>">\n\n<head>\n\t<title><%= title %></title>\n\t<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />\n\t<link rel="stylesheet" href="jackson.css" type="text/css" />\n</head>\n\n<body>\n\t<div class="chapter type-1">\n\t\t<div class="chapter-title-wrap">\n\t\t\t<h3 class="chapter-number"></h3>\n\t\t\t<h2 class="chapter-title"><%= title %></h2>\n\t\t</div>\n\t\t<div class="ugc chapter-ugc">\n <% if (Array.isArray(content)) { %>\n <% content.forEach(item => { %>\n <p class="indent"><%= item %></p>\n <% }); %>\n <% } else { %>\n <%- content %>\n <% } %>\n\t\t</div>\n\t</div>\n</body>\n\n</html>\n'},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= i18n.code %>">\n\n<head>\n\t<title><%= i18n.toc %></title>\n\t<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />\n\t<link rel="stylesheet" href="jackson.css" type="text/css" />\n</head>\n\n<body>\n\t<div id="toc">\n\t\t<h1><%= i18n.toc %></h1>\n\t\t<ul>\n <% pages.forEach((title, index) => { %>\n <li class="chaptertype-1">\n <a href="page-<%= index %>.html">\n <span class="toc-chapter-title"><%= title %></span>\n </a>\n </li>\n <% }); %>\n\t\t</ul>\n\t</div>\n</body>\n\n</html>\n'},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= i18n.code %>">\n\n<head>\n\t<title><%= i18n.info %></title>\n\t<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />\n\t<link rel="stylesheet" href="jackson.css" type="text/css" />\n</head>\n\n<body>\n\t<div id="title-page">\n\t\t<h1 class="title"><%= title %></h1>\n\t\t<h2 class="subtitle"></h2>\n\t\t<h3 class="author"><%= author %></h3>\n\t\t<h4 class="publisher"><%= publisher %></h4>\n\t</div>\n <% if (Array.isArray(tags) && tags.length) { %>\n <div class="part-title-wrap">\n <% tags = tags.join(\'</code>, <code>\'); %>\n <code><%- tags %></code>\n </div>\n <% } %>\n <% if (description) { %>\n <div class="ugc">\n <%- description %>\n </div>\n <% } %>\n</body>\n\n</html>\n'},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<package version="2.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="PrimaryID">\n\n\t<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">\n\t\t<dc:title><%= title %></dc:title>\n\t\t<dc:language><%= i18n.code %></dc:language>\n\t\t<dc:identifier id="PrimaryID" opf:scheme="<%= uuid.scheme %>"><%= uuid.id %></dc:identifier>\n <dc:date opf:event="publication"><%= date %></dc:date>\n <% if (description) { %>\n\t\t <dc:description><%= description %></dc:description>\n <% } %>\n\t\t<dc:creator opf:role="aut"><%= author %></dc:creator>\n\t\t<dc:publisher><%= publisher %></dc:publisher>\n <% if (cover) { %>\n\t\t <meta name="cover" content="cover-image" />\n <% } %>\n <% if (Array.isArray(tags) && tags.length) tags.forEach(tag => { %>\n <dc:subject><%= tag %></dc:subject>\n <% }); %>\n\t</metadata>\n\n\t<manifest>\n <% if (cover) { %>\n\t\t <item id="front-cover" href="OEBPS/front-cover.html" media-type="application/xhtml+xml" />\n <% } %>\n\t\t<item id="title-page" href="OEBPS/title-page.html" media-type="application/xhtml+xml" />\n\t\t<item id="notes" href="OEBPS/notes.html" media-type="application/xhtml+xml" />\n\t\t<item id="table-of-contents" href="OEBPS/table-of-contents.html" media-type="application/xhtml+xml" />\n <% pages.forEach((page, index) => { %>\n <item id="page-<%= index %>" href="OEBPS/page-<%= index %>.html" media-type="application/xhtml+xml" />\n <% }); %>\n <% if (cover) { %>\n\t\t <item id="cover-image" href="<%= cover.path %>" media-type="<%= cover.type %>" />\n <% } %>\n\t\t<item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml" />\n\t\t<item id="stylesheet" href="OEBPS/jackson.css" media-type="text/css" />\n <% Object.keys(images).forEach(name => { %>\n <item id="<%= name %>" href="OEBPS/<%= images[name].path %>" media-type="<%= images[name].type %>" />\n <% }); %>\n\t</manifest>\n\n\t<spine toc="ncx">\n <% if (cover) { %>\n\t\t <itemref idref="front-cover" linear="no" />\n <% } %>\n\t\t<itemref idref="title-page" linear="yes" />\n\t\t<itemref idref="table-of-contents" linear="yes" />\n <% pages.forEach((page, index) => { %>\n <itemref idref="page-<%= index %>" linear="yes" />\n <% }); %>\n <% if (notes) { %>\n <itemref idref="notes" linear="yes" />\n <% } %>\n\t</spine>\n\n\t<guide>\n <% if (cover) { %>\n\t\t <reference type="cover" title="<%= i18n.cover %>" href="OEBPS/front-cover.html" />\n <% } %>\n\t\t<reference type="toc" title="<%= i18n.toc %>" href="OEBPS/table-of-contents.html" />\n\t</guide>\n\n</package>\n'},function(t,e){t.exports="application/epub+zip"},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">\n\n<ncx version="2005-1" xml:lang="<%= i18n.code %>" xmlns="http://www.daisy.org/z3986/2005/ncx/">\n\t<head>\n\t\t<meta name="dtb:uid" content="<%= uuid.id %>" />\n\t\t<meta name="dtb:depth" content="2" />\n\t\t<meta name="dtb:totalPageCount" content="0" />\n\t\t<meta name="dtb:maxPageNumber" content="0" />\n\t</head>\n\n\t<docTitle>\n\t\t<text><%= title %></text>\n\t</docTitle>\n\n\t<docAuthor>\n\t\t<text><%= author %></text>\n\t</docAuthor>\n\n\t<navMap>\n\t\t<navPoint id="title-page" playOrder="1">\n\t\t\t<navLabel>\n\t\t\t\t<text><%= i18n.info %></text>\n\t\t\t</navLabel>\n\t\t\t<content src="OEBPS/title-page.html" />\n\t\t</navPoint>\n\t\t<navPoint id="table-of-contents" playOrder="2">\n\t\t\t<navLabel>\n\t\t\t\t<text><%= i18n.toc %></text>\n\t\t\t</navLabel>\n\t\t\t<content src="OEBPS/table-of-contents.html" />\n\t\t</navPoint>\n <% pages.forEach((title, index) => { %>\n <navPoint id="page-<%= index %>" playOrder="<%= (index + 3) %>">\n <navLabel>\n <text><%= title %></text>\n </navLabel>\n <content src="OEBPS/page-<%= index %>.html" />\n </navPoint>\n <% }); %>\n <% if (notes) { %>\n <navPoint id="notes-page" playOrder="2">\n <navLabel>\n <text><%= i18n.note %></text>\n </navLabel>\n <content src="OEBPS/notes.html" />\n </navPoint>\n <% } %>\n\t</navMap>\n</ncx>\n'}])});
/*! jepub - 2.1.0 | (c) 2018 lelinhtinh | ISC | https://lelinhtinh.github.io/jEpub/ */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("jEpub",[],e):"object"==typeof exports?exports.jEpub=e():t.jEpub=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";var i=n(1),r=n(2);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=r(n(3)),a=r(n(4)),f=i(n(5)),s=r(n(6)),u=r(n(13)),p=r(n(14)),h=r(n(15)),l=r(n(16)),c=r(n(17)),m=r(n(18)),d=r(n(19)),g=r(n(20)),y=r(n(21)),x=r(n(22)),v=r(n(23)),w=function(){function t(){(0,o.default)(this,t),this._I18n={},this._Info={},this._Uuid={},this._Date=null,this._Cover=null,this._Pages=[],this._Images=[],this._Zip={}}return(0,a.default)(t,[{key:"init",value:function(t){if(this._Info=Object.assign({},{i18n:"vi",title:"undefined",author:"undefined",publisher:"undefined",description:"",tags:[]},t),this._Uuid={scheme:"uuid",id:f.uuidv4()},this._Date=f.getISODate(),!u.default[this._Info.i18n])throw"Unknown Language: ".concat(this._Info.i18n);return this._I18n=u.default[this._Info.i18n],this._Zip=new JSZip,this._Zip.file("mimetype",x.default),this._Zip.file("META-INF/container.xml",p.default),this._Zip.file("OEBPS/jackson.css",l.default),this._Zip.file("OEBPS/title-page.html",ejs.render(g.default,{i18n:this._I18n,title:this._Info.title,author:this._Info.author,publisher:this._Info.publisher,description:f.parseDOM(this._Info.description),tags:this._Info.tags},{client:!0})),this}},{key:"date",value:function(t){if(t instanceof Date)return this._Date=f.getISODate(t),this;throw"Date object is not valid"}},{key:"uuid",value:function(t){if(f.isEmpty(t))throw"UUID value is empty";var e="uuid";return f.validateUrl(t)&&(e="URI"),this._Uuid={scheme:e,id:t},this}},{key:"cover",value:function(t){var e;if(t instanceof Blob)e=f.mime2ext(t.type);else{if(!(t instanceof ArrayBuffer))throw"Cover data is not valid";(e=(0,s.default)(new Uint8Array(t)))&&(e=f.mime2ext(e.mime))}if(!e)throw"Cover data is not allowed";return this._Cover={type:t.type,path:"OEBPS/cover-image.".concat(e)},this._Zip.file(this._Cover.path,t),this._Zip.file("OEBPS/front-cover.html",ejs.render(h.default,{i18n:this._I18n,cover:this._Cover},{client:!0})),this}},{key:"image",value:function(t,e){var n;if(t instanceof Blob)n=f.mime2ext(t.type);else{if(!(t instanceof ArrayBuffer))throw"Image data is not valid";(n=(0,s.default)(new Uint8Array(t)))&&(n=f.mime2ext(n.mime))}if(!n)throw"Image data is not allowed";var i="assets/".concat(e,".").concat(n);return this._Images[e]={type:t.type,path:i},this._Zip.file("OEBPS/".concat(i),t),this}},{key:"notes",value:function(t){if(f.isEmpty(t))throw"Notes is empty";return this._Zip.file("OEBPS/notes.html",ejs.render(c.default,{i18n:this._I18n,notes:f.parseDOM(t)},{client:!0})),this}},{key:"add",value:function(t,e){if(f.isEmpty(t))throw"Title is empty";if(f.isEmpty(e))throw"Content of ".concat(t," is empty");return Array.isArray(e)||(e=ejs.compile(e,{client:!0})({image:this._Images},function(t){return'<img src="'.concat(t?t.path:"data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=",'" alt=""></img>')}),e=f.parseDOM(e)),this._Zip.file("OEBPS/page-".concat(this._Pages.length,".html"),ejs.render(m.default,{i18n:this._I18n,title:t,content:e},{client:!0})),this._Pages.push(t),this}},{key:"generate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"blob";if(!JSZip.support[t])throw"This browser does not support ".concat(t);var e=this._Zip.file("OEBPS/notes.html");return e=!!e,this._Zip.file("book.opf",ejs.render(y.default,{i18n:this._I18n,uuid:this._Uuid,date:this._Date,title:this._Info.title,author:this._Info.author,publisher:this._Info.publisher,description:f.html2text(this._Info.description,!0),tags:this._Info.tags,cover:this._Cover,pages:this._Pages,notes:e,images:this._Images},{client:!0})),this._Zip.file("OEBPS/table-of-contents.html",ejs.render(d.default,{i18n:this._I18n,pages:this._Pages},{client:!0})),this._Zip.file("toc.ncx",ejs.render(v.default,{i18n:this._I18n,uuid:this._Uuid,title:this._Info.title,author:this._Info.author,pages:this._Pages,notes:e},{client:!0})),this._Zip.generateAsync({type:t,mimeType:x.default,compression:"DEFLATE",compressionOptions:{level:9}})}}],[{key:"html2text",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return f.html2text(t,e)}}]),t}();e.default=w,t.exports=e.default},function(t,e){t.exports=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};i.get||i.set?Object.defineProperty(e,n,i):e[n]=t[n]}return e.default=t,e}},function(t,e){t.exports=function(t){return t&&t.__esModule?t:{default:t}}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}t.exports=function(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}},function(t,e,n){"use strict";function i(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=(new DOMParser).parseFromString("<!doctype html><body>".concat(t),"text/html");return e?n.body.textContent.trim():n=(n=(new XMLSerializer).serializeToString(n.body)).replace(/(^<body\s?[^>]*>|<\/body>$)/g,"")}Object.defineProperty(e,"__esModule",{value:!0}),e.uuidv4=function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(t){return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)})},e.isEmpty=function(t){if(null===t)return!0;if("number"==typeof t)return!1;if("string"==typeof t)return!t.trim();return!1},e.getISODate=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date).toISOString()},e.parseDOM=i,e.html2text=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t=i(t=(t=(t=(t=(t=(t=(t=t.replace(/<style([\s\S]*?)<\/style>/gi,"")).replace(/<script([\s\S]*?)<\/script>/gi,"")).replace(/<\/(div|p|li|dd|h[1-6])>/gi,"\n")).replace(/<(br|hr)\s*[\/]?>/gi,"\n")).replace(/<li>/gi,"+ ")).replace(/<[^>]+>/g,"")).replace(/\n{3,}/g,"\n\n"),!0),e&&(t=t.replace(/\n+/g," "));return t},e.validateUrl=function(t){return/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i.test(t)},e.mime2ext=function(t){var e=null;switch(t){case"image/gif":e="gif";break;case"image/apng":e="apng";break;case"image/jpg":case"image/jpeg":e="jpg";break;case"image/png":e="png";break;case"image/webp":e="webp";break;case"image/svg+xml":e="svg";break;case"image/bmp":e="bmp";break;default:e=null}return e}},function(t,e,n){"use strict";const i=n(7),r=new Set(["jpg","png","gif","webp","flif","cr2","tif","bmp","jxr","psd","ico","bpg","jp2","jpm","jpx","heic","cur","dcm"]),o=t=>{const e=i(t);return r.has(e&&e.ext)?e:null};t.exports=o,t.exports.default=o,Object.defineProperty(o,"minimumBytes",{value:i.minimumBytes})},function(module,exports,__webpack_require__){"use strict";(function(Buffer){const toBytes=t=>[...t].map(t=>t.charCodeAt(0)),xpiZipFilename=toBytes("META-INF/mozilla.rsa"),oxmlContentTypes=toBytes("[Content_Types].xml"),oxmlRels=toBytes("_rels/.rels");function readUInt64LE(t,e=0){let n=t[e],i=1,r=0;for(;++r<8;)i*=256,n+=t[e+r]*i;return n}const fileType=t=>{if(!(t instanceof Uint8Array||t instanceof ArrayBuffer||Buffer.isBuffer(t)))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof t}\``);const e=t instanceof Uint8Array?t:new Uint8Array(t);if(!(e&&e.length>1))return null;const n=(t,n)=>{n=Object.assign({offset:0},n);for(let i=0;i<t.length;i++)if(n.mask){if(t[i]!==(n.mask[i]&e[i+n.offset]))return!1}else if(t[i]!==e[i+n.offset])return!1;return!0},i=(t,e)=>n(toBytes(t),e);if(n([255,216,255]))return{ext:"jpg",mime:"image/jpeg"};if(n([137,80,78,71,13,10,26,10]))return{ext:"png",mime:"image/png"};if(n([71,73,70]))return{ext:"gif",mime:"image/gif"};if(n([87,69,66,80],{offset:8}))return{ext:"webp",mime:"image/webp"};if(n([70,76,73,70]))return{ext:"flif",mime:"image/flif"};if((n([73,73,42,0])||n([77,77,0,42]))&&n([67,82],{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(n([73,73,42,0])||n([77,77,0,42]))return{ext:"tif",mime:"image/tiff"};if(n([66,77]))return{ext:"bmp",mime:"image/bmp"};if(n([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(n([56,66,80,83]))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(n([80,75,3,4])){if(n([109,105,109,101,116,121,112,101,97,112,112,108,105,99,97,116,105,111,110,47,101,112,117,98,43,122,105,112],{offset:30}))return{ext:"epub",mime:"application/epub+zip"};if(n(xpiZipFilename,{offset:30}))return{ext:"xpi",mime:"application/x-xpinstall"};if(i("mimetypeapplication/vnd.oasis.opendocument.text",{offset:30}))return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};if(i("mimetypeapplication/vnd.oasis.opendocument.spreadsheet",{offset:30}))return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};if(i("mimetypeapplication/vnd.oasis.opendocument.presentation",{offset:30}))return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"};const t=(t,e=0)=>t.findIndex((t,n,i)=>n>=e&&80===i[n]&&75===i[n+1]&&3===i[n+2]&&4===i[n+3]);let r=0,o=!1,a=null;do{const f=r+30;if(o||(o=n(oxmlContentTypes,{offset:f})||n(oxmlRels,{offset:f})),a||(i("word/",{offset:f})?a={ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}:i("ppt/",{offset:f})?a={ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}:i("xl/",{offset:f})&&(a={ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})),o&&a)return a;r=t(e,f)}while(r>=0);if(a)return a}if(n([80,75])&&(3===e[2]||5===e[2]||7===e[2])&&(4===e[3]||6===e[3]||8===e[3]))return{ext:"zip",mime:"application/zip"};if(n([117,115,116,97,114],{offset:257}))return{ext:"tar",mime:"application/x-tar"};if(n([82,97,114,33,26,7])&&(0===e[6]||1===e[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(n([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(n([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(n([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(n([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(n([51,103,112,53])||n([0,0,0])&&n([102,116,121,112],{offset:4})&&(n([109,112,52,49],{offset:8})||n([109,112,52,50],{offset:8})||n([105,115,111,109],{offset:8})||n([105,115,111,50],{offset:8})||n([109,109,112,52],{offset:8})||n([77,52,86],{offset:8})||n([100,97,115,104],{offset:8})))return{ext:"mp4",mime:"video/mp4"};if(n([77,84,104,100]))return{ext:"mid",mime:"audio/midi"};if(n([26,69,223,163])){const t=e.subarray(4,4100),n=t.findIndex((t,e,n)=>66===n[e]&&130===n[e+1]);if(-1!==n){const e=n+3,i=n=>[...n].every((n,i)=>t[e+i]===n.charCodeAt(0));if(i("matroska"))return{ext:"mkv",mime:"video/x-matroska"};if(i("webm"))return{ext:"webm",mime:"video/webm"}}}if(n([0,0,0,20,102,116,121,112,113,116,32,32])||n([102,114,101,101],{offset:4})||n([102,116,121,112,113,116,32,32],{offset:4})||n([109,100,97,116],{offset:4})||n([109,111,111,118],{offset:4})||n([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(n([82,73,70,70])){if(n([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(n([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/vnd.wave"};if(n([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(n([48,38,178,117,142,102,207,17,166,217])){let t=30;do{const i=readUInt64LE(e,t+16);if(n([145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101],{offset:t})){if(n([64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43],{offset:t+24}))return{ext:"wma",mime:"audio/x-ms-wma"};if(n([192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43],{offset:t+24}))return{ext:"wmv",mime:"video/x-ms-asf"};break}t+=i}while(t+24<=e.length);return{ext:"asf",mime:"application/vnd.ms-asf"}}if(n([0,0,1,186])||n([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(n([102,116,121,112,51,103],{offset:4}))return{ext:"3gp",mime:"video/3gpp"};for(let t=0;t<2&&t<e.length-16;t++){if(n([73,68,51],{offset:t})||n([255,226],{offset:t,mask:[255,226]}))return{ext:"mp3",mime:"audio/mpeg"};if(n([255,228],{offset:t,mask:[255,228]}))return{ext:"mp2",mime:"audio/mpeg"};if(n([255,248],{offset:t,mask:[255,252]}))return{ext:"mp2",mime:"audio/mpeg"};if(n([255,240],{offset:t,mask:[255,252]}))return{ext:"mp4",mime:"audio/mpeg"}}if(n([102,116,121,112,77,52,65],{offset:4}))return{ext:"m4a",mime:"audio/mp4"};if(n([79,112,117,115,72,101,97,100],{offset:28}))return{ext:"opus",mime:"audio/opus"};if(n([79,103,103,83]))return n([128,116,104,101,111,114,97],{offset:28})?{ext:"ogv",mime:"video/ogg"}:n([1,118,105,100,101,111,0],{offset:28})?{ext:"ogm",mime:"video/ogg"}:n([127,70,76,65,67],{offset:28})?{ext:"oga",mime:"audio/ogg"}:n([83,112,101,101,120,32,32],{offset:28})?{ext:"spx",mime:"audio/ogg"}:n([1,118,111,114,98,105,115],{offset:28})?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"};if(n([102,76,97,67]))return{ext:"flac",mime:"audio/x-flac"};if(n([77,65,67,32]))return{ext:"ape",mime:"audio/ape"};if(n([119,118,112,107]))return{ext:"wv",mime:"audio/wavpack"};if(n([35,33,65,77,82,10]))return{ext:"amr",mime:"audio/amr"};if(n([37,80,68,70]))return{ext:"pdf",mime:"application/pdf"};if(n([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if((67===e[0]||70===e[0])&&n([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(n([123,92,114,116,102]))return{ext:"rtf",mime:"application/rtf"};if(n([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(n([119,79,70,70])&&(n([0,1,0,0],{offset:4})||n([79,84,84,79],{offset:4})))return{ext:"woff",mime:"font/woff"};if(n([119,79,70,50])&&(n([0,1,0,0],{offset:4})||n([79,84,84,79],{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(n([76,80],{offset:34})&&(n([0,0,1],{offset:8})||n([1,0,2],{offset:8})||n([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(n([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(n([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(n([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(n([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(n([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(n([37,33]))return{ext:"ps",mime:"application/postscript"};if(n([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(n([83,81,76,105]))return{ext:"sqlite",mime:"application/x-sqlite3"};if(n([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(n([67,114,50,52]))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(n([77,83,67,70])||n([73,83,99,40]))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(n([33,60,97,114,99,104,62,10,100,101,98,105,97,110,45,98,105,110,97,114,121]))return{ext:"deb",mime:"application/x-deb"};if(n([33,60,97,114,99,104,62]))return{ext:"ar",mime:"application/x-unix-archive"};if(n([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(n([31,160])||n([31,157]))return{ext:"Z",mime:"application/x-compress"};if(n([76,90,73,80]))return{ext:"lz",mime:"application/x-lzip"};if(n([208,207,17,224,161,177,26,225]))return{ext:"msi",mime:"application/x-msi"};if(n([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(n([71],{offset:4})&&(n([71],{offset:192})||n([71],{offset:196})))return{ext:"mts",mime:"video/mp2t"};if(n([66,76,69,78,68,69,82]))return{ext:"blend",mime:"application/x-blender"};if(n([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(n([0,0,0,12,106,80,32,32,13,10,135,10])){if(n([106,112,50,32],{offset:20}))return{ext:"jp2",mime:"image/jp2"};if(n([106,112,120,32],{offset:20}))return{ext:"jpx",mime:"image/jpx"};if(n([106,112,109,32],{offset:20}))return{ext:"jpm",mime:"image/jpm"};if(n([109,106,112,50],{offset:20}))return{ext:"mj2",mime:"image/mj2"}}if(n([70,79,82,77]))return{ext:"aif",mime:"audio/aiff"};if(i("<?xml "))return{ext:"xml",mime:"application/xml"};if(n([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(n([102,116,121,112],{offset:4})){if(n([109,105,102,49],{offset:8}))return{ext:"heic",mime:"image/heif"};if(n([109,115,102,49],{offset:8}))return{ext:"heic",mime:"image/heif-sequence"};if(n([104,101,105,99],{offset:8})||n([104,101,105,120],{offset:8}))return{ext:"heic",mime:"image/heic"};if(n([104,101,118,99],{offset:8})||n([104,101,118,120],{offset:8}))return{ext:"heic",mime:"image/heic-sequence"}}return n([171,75,84,88,32,49,49,187,13,10,26,10])?{ext:"ktx",mime:"image/ktx"}:n([68,73,67,77],{offset:128})?{ext:"dcm",mime:"application/dicom"}:n([77,80,43])?{ext:"mpc",mime:"audio/x-musepack"}:n([77,80,67,75])?{ext:"mpc",mime:"audio/x-musepack"}:n([66,69,71,73,78,58])?{ext:"ics",mime:"text/calendar"}:n([103,108,84,70,2,0,0,0])?{ext:"glb",mime:"model/gltf-binary"}:n([212,195,178,161])||n([161,178,195,212])?{ext:"pcap",mime:"application/vnd.tcpdump.pcap"}:null};module.exports=fileType,module.exports.default=fileType,Object.defineProperty(fileType,"minimumBytes",{value:4100}),module.exports.stream=(readableStream=>new Promise((resolve,reject)=>{const stream=eval("require")("stream");readableStream.once("readable",()=>{const t=new stream.PassThrough,e=readableStream.read(module.exports.minimumBytes)||readableStream.read();try{t.fileType=fileType(e)}catch(t){reject(t)}readableStream.unshift(e),stream.pipeline?resolve(stream.pipeline(readableStream,t,()=>{})):resolve(readableStream.pipe(t))})}))}).call(this,__webpack_require__(8).Buffer)},function(t,e,n){"use strict";(function(t){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
var i=n(10),r=n(11),o=n(12);function a(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function f(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=s.prototype:(null===t&&(t=new s(e)),t.length=e),t}function s(t,e,n){if(!(s.TYPED_ARRAY_SUPPORT||this instanceof s))return new s(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return u(this,t,e,n)}function u(t,e,n,i){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,i){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(i||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,n):new Uint8Array(e,n,i);s.TYPED_ARRAY_SUPPORT?(t=e).__proto__=s.prototype:t=l(t,e);return t}(t,e,n,i):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!s.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var i=0|m(e,n),r=(t=f(t,i)).write(e,n);r!==i&&(t=t.slice(0,r));return t}(t,e,n):function(t,e){if(s.isBuffer(e)){var n=0|c(e.length);return 0===(t=f(t,n)).length?t:(e.copy(t,0,0,n),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?f(t,0):l(t,e);if("Buffer"===e.type&&o(e.data))return l(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function p(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(p(e),t=f(t,e<0?0:0|c(e)),!s.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function l(t,e){var n=e.length<0?0:0|c(e.length);t=f(t,n);for(var i=0;i<n;i+=1)t[i]=255&e[i];return t}function c(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function m(t,e){if(s.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Y(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return N(t).length;default:if(i)return Y(t).length;e=(""+e).toLowerCase(),i=!0}}function d(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function g(t,e,n,i,r){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof e&&(e=s.from(e,i)),s.isBuffer(e))return 0===e.length?-1:y(t,e,n,i,r);if("number"==typeof e)return e&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,i,r){var o,a=1,f=t.length,s=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;a=2,f/=2,s/=2,n/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(r){var p=-1;for(o=n;o<f;o++)if(u(t,o)===u(e,-1===p?0:o-p)){if(-1===p&&(p=o),o-p+1===s)return p*a}else-1!==p&&(o-=o-p),p=-1}else for(n+s>f&&(n=f-s),o=n;o>=0;o--){for(var h=!0,l=0;l<s;l++)if(u(t,o+l)!==u(e,l)){h=!1;break}if(h)return o}return-1}function x(t,e,n,i){n=Number(n)||0;var r=t.length-n;i?(i=Number(i))>r&&(i=r):i=r;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var a=0;a<i;++a){var f=parseInt(e.substr(2*a,2),16);if(isNaN(f))return a;t[n+a]=f}return a}function v(t,e,n,i){return F(Y(e,t.length-n),t,n,i)}function w(t,e,n,i){return F(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,i)}function b(t,e,n,i){return w(t,e,n,i)}function _(t,e,n,i){return F(N(e),t,n,i)}function E(t,e,n,i){return F(function(t,e){for(var n,i,r,o=[],a=0;a<t.length&&!((e-=2)<0);++a)n=t.charCodeAt(a),i=n>>8,r=n%256,o.push(r),o.push(i);return o}(e,t.length-n),t,n,i)}function A(t,e,n){return 0===e&&n===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,n))}function P(t,e,n){n=Math.min(t.length,n);for(var i=[],r=e;r<n;){var o,a,f,s,u=t[r],p=null,h=u>239?4:u>223?3:u>191?2:1;if(r+h<=n)switch(h){case 1:u<128&&(p=u);break;case 2:128==(192&(o=t[r+1]))&&(s=(31&u)<<6|63&o)>127&&(p=s);break;case 3:o=t[r+1],a=t[r+2],128==(192&o)&&128==(192&a)&&(s=(15&u)<<12|(63&o)<<6|63&a)>2047&&(s<55296||s>57343)&&(p=s);break;case 4:o=t[r+1],a=t[r+2],f=t[r+3],128==(192&o)&&128==(192&a)&&128==(192&f)&&(s=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&f)>65535&&s<1114112&&(p=s)}null===p?(p=65533,h=1):p>65535&&(p-=65536,i.push(p>>>10&1023|55296),p=56320|1023&p),i.push(p),r+=h}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);var n="",i=0;for(;i<e;)n+=String.fromCharCode.apply(String,t.slice(i,i+=T));return n}(i)}e.Buffer=s,e.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},e.INSPECT_MAX_BYTES=50,s.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),s.poolSize=8192,s._augment=function(t){return t.__proto__=s.prototype,t},s.from=function(t,e,n){return u(null,t,e,n)},s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0})),s.alloc=function(t,e,n){return function(t,e,n,i){return p(e),e<=0?f(t,e):void 0!==n?"string"==typeof i?f(t,e).fill(n,i):f(t,e).fill(n):f(t,e)}(null,t,e,n)},s.allocUnsafe=function(t){return h(null,t)},s.allocUnsafeSlow=function(t){return h(null,t)},s.isBuffer=function(t){return!(null==t||!t._isBuffer)},s.compare=function(t,e){if(!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,i=e.length,r=0,o=Math.min(n,i);r<o;++r)if(t[r]!==e[r]){n=t[r],i=e[r];break}return n<i?-1:i<n?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=s.allocUnsafe(e),r=0;for(n=0;n<t.length;++n){var a=t[n];if(!s.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,r),r+=a.length}return i},s.byteLength=m,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)d(this,e,e+1);return this},s.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)d(this,e,e+3),d(this,e+1,e+2);return this},s.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},s.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?P(this,0,t):function(t,e,n){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,n);case"utf8":case"utf-8":return P(this,e,n);case"ascii":return B(this,e,n);case"latin1":case"binary":return S(this,e,n);case"base64":return A(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}.apply(this,arguments)},s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},s.prototype.compare=function(t,e,n,i,r){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(r>>>=0)-(i>>>=0),a=(n>>>=0)-(e>>>=0),f=Math.min(o,a),u=this.slice(i,r),p=t.slice(e,n),h=0;h<f;++h)if(u[h]!==p[h]){o=u[h],a=p[h];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},s.prototype.indexOf=function(t,e,n){return g(this,t,e,n,!0)},s.prototype.lastIndexOf=function(t,e,n){return g(this,t,e,n,!1)},s.prototype.write=function(t,e,n,i){if(void 0===e)i="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)i=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return x(this,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":return w(this,t,e,n);case"latin1":case"binary":return b(this,t,e,n);case"base64":return _(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function B(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;r<n;++r)i+=String.fromCharCode(127&t[r]);return i}function S(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;r<n;++r)i+=String.fromCharCode(t[r]);return i}function O(t,e,n){var i=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>i)&&(n=i);for(var r="",o=e;o<n;++o)r+=M(t[o]);return r}function I(t,e,n){for(var i=t.slice(e,n),r="",o=0;o<i.length;o+=2)r+=String.fromCharCode(i[o]+256*i[o+1]);return r}function R(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function U(t,e,n,i,r,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||e<o)throw new RangeError('"value" argument is out of bounds');if(n+i>t.length)throw new RangeError("Index out of range")}function k(t,e,n,i){e<0&&(e=65535+e+1);for(var r=0,o=Math.min(t.length-n,2);r<o;++r)t[n+r]=(e&255<<8*(i?r:1-r))>>>8*(i?r:1-r)}function D(t,e,n,i){e<0&&(e=4294967295+e+1);for(var r=0,o=Math.min(t.length-n,4);r<o;++r)t[n+r]=e>>>8*(i?r:3-r)&255}function C(t,e,n,i,r,o){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(t,e,n,i,o){return o||C(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function z(t,e,n,i,o){return o||C(t,0,n,8),r.write(t,e,n,i,52,8),n+8}s.prototype.slice=function(t,e){var n,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e<t&&(e=t),s.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=s.prototype;else{var r=e-t;n=new s(r,void 0);for(var o=0;o<r;++o)n[o]=this[o+t]}return n},s.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var i=this[t],r=1,o=0;++o<e&&(r*=256);)i+=this[t+o]*r;return i},s.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var i=this[t+--e],r=1;e>0&&(r*=256);)i+=this[t+--e]*r;return i},s.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var i=this[t],r=1,o=0;++o<e&&(r*=256);)i+=this[t+o]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var i=e,r=1,o=this[t+--i];i>0&&(r*=256);)o+=this[t+--i]*r;return o>=(r*=128)&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),r.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),r.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),r.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),r.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,n,i){(t=+t,e|=0,n|=0,i)||U(this,t,e,n,Math.pow(2,8*n)-1,0);var r=1,o=0;for(this[e]=255&t;++o<n&&(r*=256);)this[e+o]=t/r&255;return e+n},s.prototype.writeUIntBE=function(t,e,n,i){(t=+t,e|=0,n|=0,i)||U(this,t,e,n,Math.pow(2,8*n)-1,0);var r=n-1,o=1;for(this[e+r]=255&t;--r>=0&&(o*=256);)this[e+r]=t/o&255;return e+n},s.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},s.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},s.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):D(this,t,e,!0),e+4},s.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},s.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);U(this,t,e,n,r-1,-r)}var o=0,a=1,f=0;for(this[e]=255&t;++o<n&&(a*=256);)t<0&&0===f&&0!==this[e+o-1]&&(f=1),this[e+o]=(t/a>>0)-f&255;return e+n},s.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);U(this,t,e,n,r-1,-r)}var o=n-1,a=1,f=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===f&&0!==this[e+o+1]&&(f=1),this[e+o]=(t/a>>0)-f&255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},s.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},s.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):D(this,t,e,!0),e+4},s.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||U(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},s.prototype.writeFloatLE=function(t,e,n){return j(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return j(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return z(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return z(this,t,e,!1,n)},s.prototype.copy=function(t,e,n,i){if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);var r,o=i-n;if(this===t&&n<e&&e<i)for(r=o-1;r>=0;--r)t[r+e]=this[r+n];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(r=0;r<o;++r)t[r+e]=this[r+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},s.prototype.fill=function(t,e,n,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),1===t.length){var r=t.charCodeAt(0);r<256&&(t=r)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var a=s.isBuffer(t)?t:Y(new s(t,i).toString()),f=a.length;for(o=0;o<n-e;++o)this[o+e]=a[o%f]}return this};var L=/[^+\/0-9A-Za-z-_]/g;function M(t){return t<16?"0"+t.toString(16):t.toString(16)}function Y(t,e){var n;e=e||1/0;for(var i=t.length,r=null,o=[],a=0;a<i;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===i){(e-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function N(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,n,i){for(var r=0;r<i&&!(r+n>=e.length||r>=t.length);++r)e[r+n]=t[r];return r}}).call(this,n(9))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";e.byteLength=function(t){var e=u(t),n=e[0],i=e[1];return 3*(n+i)/4-i},e.toByteArray=function(t){for(var e,n=u(t),i=n[0],a=n[1],f=new o(function(t,e,n){return 3*(e+n)/4-n}(0,i,a)),s=0,p=a>0?i-4:i,h=0;h<p;h+=4)e=r[t.charCodeAt(h)]<<18|r[t.charCodeAt(h+1)]<<12|r[t.charCodeAt(h+2)]<<6|r[t.charCodeAt(h+3)],f[s++]=e>>16&255,f[s++]=e>>8&255,f[s++]=255&e;2===a&&(e=r[t.charCodeAt(h)]<<2|r[t.charCodeAt(h+1)]>>4,f[s++]=255&e);1===a&&(e=r[t.charCodeAt(h)]<<10|r[t.charCodeAt(h+1)]<<4|r[t.charCodeAt(h+2)]>>2,f[s++]=e>>8&255,f[s++]=255&e);return f},e.fromByteArray=function(t){for(var e,n=t.length,r=n%3,o=[],a=0,f=n-r;a<f;a+=16383)o.push(p(t,a,a+16383>f?f:a+16383));1===r?(e=t[n-1],o.push(i[e>>2]+i[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],o.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return o.join("")};for(var i=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,s=a.length;f<s;++f)i[f]=a[f],r[a.charCodeAt(f)]=f;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function p(t,e,n){for(var r,o,a=[],f=e;f<n;f+=3)r=(t[f]<<16&16711680)+(t[f+1]<<8&65280)+(255&t[f+2]),a.push(i[(o=r)>>18&63]+i[o>>12&63]+i[o>>6&63]+i[63&o]);return a.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,n,i,r){var o,a,f=8*r-i-1,s=(1<<f)-1,u=s>>1,p=-7,h=n?r-1:0,l=n?-1:1,c=t[e+h];for(h+=l,o=c&(1<<-p)-1,c>>=-p,p+=f;p>0;o=256*o+t[e+h],h+=l,p-=8);for(a=o&(1<<-p)-1,o>>=-p,p+=i;p>0;a=256*a+t[e+h],h+=l,p-=8);if(0===o)o=1-u;else{if(o===s)return a?NaN:1/0*(c?-1:1);a+=Math.pow(2,i),o-=u}return(c?-1:1)*a*Math.pow(2,o-i)},e.write=function(t,e,n,i,r,o){var a,f,s,u=8*o-r-1,p=(1<<u)-1,h=p>>1,l=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,c=i?0:o-1,m=i?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,a=p):(a=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-a))<1&&(a--,s*=2),(e+=a+h>=1?l/s:l*Math.pow(2,1-h))*s>=2&&(a++,s/=2),a+h>=p?(f=0,a=p):a+h>=1?(f=(e*s-1)*Math.pow(2,r),a+=h):(f=e*Math.pow(2,h-1)*Math.pow(2,r),a=0));r>=8;t[n+c]=255&f,c+=m,f/=256,r-=8);for(a=a<<r|f,u+=r;u>0;t[n+c]=255&a,c+=m,a/=256,u-=8);t[n+c-m]|=128*d}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t){t.exports={en:{code:"en",cover:"Cover",toc:"Table of Contents",info:"Information",note:"Notes"},vi:{code:"vi",cover:"Bìa sách",toc:"Mục lục",info:"Giới thiệu",note:"Ghi chú"}}},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">\n\t<rootfiles>\n\t\t<rootfile full-path="book.opf" media-type="application/oebps-package+xml" />\n\t</rootfiles>\n</container>'},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= i18n.code %>">\n\n<head>\n\t<title><%= i18n.cover %></title>\n\t<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />\n\t<link rel="stylesheet" href="jackson.css" type="text/css" />\n</head>\n\n<body>\n\t<div id="cover-image">\n\t\t<img src="../<%= cover.path %>" alt="<%= i18n.cover %>" />\n\t</div>\n</body>\n\n</html>\n'},function(t,e){t.exports='/* Jackson EPUB v1.0 | Copyright 2011-2013 Book Oven Inc. (PressBooks.com) support@pressbooks.com */#toc a:after,a{text-decoration:none}h1,h2,h2.chapter-title,h3,h4{hyphens:none;-webkit-hyphens:none}#title-page h1.title,h1,h2,h3,h4{hyphens:none;-webkit-hypens:none;font-family:sans-serif}div.ugc>p.no-indent,p.no-indent{margin-top:1em!important;text-indent:0!important}body{font-family:sans-serif;line-height:1.4em}h1,h2,h3,h4{line-height:1.3em;margin-top:1em;margin-bottom:.5em;font-weight:400;text-indent:0;text-align:center;letter-spacing:1px;word-spacing:2px;page-break-after:avoid}div.ugc p.indent,p{margin:0}div.ugc p.indent,p,p+p{text-indent:1.5em}.no-indent,div.ugc p.indent,p,p.no-indent{line-height:1.4em;text-align:left}p{font-family:sans-serif}p+p{margin-top:0}.no-indent,p.no-indent{text-indent:0;margin-top:1em}ul{margin-left:1em;padding-left:1em}#title-page h1.title{font-size:3em;margin-top:2em;margin-bottom:0;padding-bottom:5px;text-transform:uppercase;text-align:right}#title-page h2.subtitle{font-family:sans-serif;font-size:1.5em;margin-top:0;padding-top:5px;text-align:right;hyphens:none;-webkit-hypens:none}#title-page h3.author,#title-page h4.publisher{font-family:sans-serif;margin-top:2em;text-align:right;-webkit-hypens:none;hyphens:none}#title-page h3.author{font-size:1.2em;font-weight:400}#title-page h4.publisher{float:bottom;font-size:.9em;margin-bottom:0}#toc ul{font-size:.9em;line-height:1.3em}#toc li,#toc ul{list-style:none;margin:0;padding:0;text-align:left}#toc li{margin-bottom:5px}#toc a{border:none;color:inherit;text-align:left}#toc h1,div.chapter-title-wrap>h2.chapter-title,div.part-title-wrap{text-align:right;font-family:sans-serif}#toc a:after{font-style:normal}#toc h1{font-size:2em;font-weight:lighter;line-height:1.2em;margin-top:0;hyphens:none;-webkit-hyphens:none}div.part-title-wrap{margin-top:2em;margin-bottom:2em;hyphens:none;-webkit-hyphens:none}div.chapter .chapter-title-wrap>h2:first-of-type{counter-reset:footnote}div.chapter-title-wrap{margin-bottom:2.5em;margin-top:3em;hyphens:none;-webkit-hyphens:none}div.chapter-title-wrap>h3.chapter-number{font-family:sans-serif;text-align:right;font-weight:400;font-size:2em;line-height:1.2em;margin-top:-.5em;display:block}div.chapter-title-wrap>h2.chapter-title{font-size:2em;font-weight:lighter;line-height:1.2em;hyphens:none;-webkit-hyphens:none}img{height:auto;max-width:100%}div.chapter-ugc>p:first-of-type::first-letter{font-family:sans-serif;font-size:3.5em;padding-right:5px;margin-right:0}h1,h2,h3,h4,h5,h6{color:#9A3257}#title-page>.title:before,.chapter-title-wrap h2.chapter-title::before{color:#FFB035}.firstcharacter{color:#9A3257}@media amzn-kf8{#title-page h1.title::after,#title-page h1.title::before,.chapter-title-wrap h2.chapter-title::after,.chapter-title-wrap h2.chapter-title::before{content:""}}@media amzn-mobi{#toc,span.toc-chapter-title{text-align:left}#toc{font-style:normal;font-weight:400;border:0}#toc h1{font-size:1em;font-style:normal;font-weight:400}#toc li,span.toc-chapter-title{font-style:normal;font-weight:400;font-size:.7em}#toc a{font-style:normal;font-weight:400}.chapter-ugc p,.indent,.no-indent,.ugc p,body,p,p.indent,p.no-indent{font-family:sans-serif;font-style:normal;font-weight:400}.chapter-ugc p,.ugc p,p{font-size:1em}.no-indent,p.no-indent{font-size:1em;text-indent:0;margin-top:.5em}.indent,p.indent{font-size:1em;text-indent:1.5em;margin-top:0}h1,h2,h3{font-weight:700}h1,h2,h3,h4{font-style:normal;margin-top:.5em;margin-bottom:.5em;text-align:center}h1{font-size:1.4em}h2{font-size:1.3em}h3{font-size:1.2em}h4{font-weight:400;font-size:1.1em}ul{margin-top:1em;margin-bottom:1em}h1.title,h2.subtitle,h3.author,h4.publisher{font-weight:400;font-style:normal}h1.title{font-size:2em;margin-top:2em}h2.subtitle{font-size:1em}div.chapter-title-wrap{font-size:1.5em;margin-top:0;margin-bottom:0}h2.chapter-title,h3.chapter-number{font-weight:400;font-style:normal;margin-top:1em;margin-bottom:1em;text-align:center}h3.chapter-number{font-size:1.2em}h2.chapter-title{font-size:1.5em}li,ul{text-align:right!important}}div.chapter-title-wrap>.chapter-number{display:none!important}'},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= i18n.code %>">\n\n<head>\n\t<title><%= i18n.note %></title>\n\t<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />\n\t<link rel="stylesheet" href="jackson.css" type="text/css" />\n</head>\n\n<body>\n\t<div id="notes-page">\n\t\t<div class="ugc">\n <%- notes %>\n\t\t</div>\n\t</div>\n</body>\n\n</html>\n'},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= i18n.code %>">\n\n<head>\n\t<title><%= title %></title>\n\t<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />\n\t<link rel="stylesheet" href="jackson.css" type="text/css" />\n</head>\n\n<body>\n\t<div class="chapter type-1">\n\t\t<div class="chapter-title-wrap">\n\t\t\t<h3 class="chapter-number"></h3>\n\t\t\t<h2 class="chapter-title"><%= title %></h2>\n\t\t</div>\n\t\t<div class="ugc chapter-ugc">\n <% if (Array.isArray(content)) { %>\n <% content.forEach(item => { %>\n <p class="indent"><%= item %></p>\n <% }); %>\n <% } else { %>\n <%- content %>\n <% } %>\n\t\t</div>\n\t</div>\n</body>\n\n</html>\n'},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= i18n.code %>">\n\n<head>\n\t<title><%= i18n.toc %></title>\n\t<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />\n\t<link rel="stylesheet" href="jackson.css" type="text/css" />\n</head>\n\n<body>\n\t<div id="toc">\n\t\t<h1><%= i18n.toc %></h1>\n\t\t<ul>\n <% pages.forEach((title, index) => { %>\n <li class="chaptertype-1">\n <a href="page-<%= index %>.html">\n <span class="toc-chapter-title"><%= title %></span>\n </a>\n </li>\n <% }); %>\n\t\t</ul>\n\t</div>\n</body>\n\n</html>\n'},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= i18n.code %>">\n\n<head>\n\t<title><%= i18n.info %></title>\n\t<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />\n\t<link rel="stylesheet" href="jackson.css" type="text/css" />\n</head>\n\n<body>\n\t<div id="title-page">\n\t\t<h1 class="title"><%= title %></h1>\n\t\t<h2 class="subtitle"></h2>\n\t\t<h3 class="author"><%= author %></h3>\n\t\t<h4 class="publisher"><%= publisher %></h4>\n\t</div>\n <% if (Array.isArray(tags) && tags.length) { %>\n <div class="part-title-wrap">\n <% tags = tags.join(\'</code>, <code>\'); %>\n <code><%- tags %></code>\n </div>\n <% } %>\n <% if (description) { %>\n <div class="ugc">\n <%- description %>\n </div>\n <% } %>\n</body>\n\n</html>\n'},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<package version="2.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="PrimaryID">\n\n\t<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">\n\t\t<dc:title><%= title %></dc:title>\n\t\t<dc:language><%= i18n.code %></dc:language>\n\t\t<dc:identifier id="PrimaryID" opf:scheme="<%= uuid.scheme %>"><%= uuid.id %></dc:identifier>\n <dc:date opf:event="publication"><%= date %></dc:date>\n <% if (description) { %>\n\t\t <dc:description><%= description %></dc:description>\n <% } %>\n\t\t<dc:creator opf:role="aut"><%= author %></dc:creator>\n\t\t<dc:publisher><%= publisher %></dc:publisher>\n <% if (cover) { %>\n\t\t <meta name="cover" content="cover-image" />\n <% } %>\n <% if (Array.isArray(tags) && tags.length) tags.forEach(tag => { %>\n <dc:subject><%= tag %></dc:subject>\n <% }); %>\n\t</metadata>\n\n\t<manifest>\n <% if (cover) { %>\n\t\t <item id="front-cover" href="OEBPS/front-cover.html" media-type="application/xhtml+xml" />\n <% } %>\n\t\t<item id="title-page" href="OEBPS/title-page.html" media-type="application/xhtml+xml" />\n\t\t<item id="notes" href="OEBPS/notes.html" media-type="application/xhtml+xml" />\n\t\t<item id="table-of-contents" href="OEBPS/table-of-contents.html" media-type="application/xhtml+xml" />\n <% pages.forEach((page, index) => { %>\n <item id="page-<%= index %>" href="OEBPS/page-<%= index %>.html" media-type="application/xhtml+xml" />\n <% }); %>\n <% if (cover) { %>\n\t\t <item id="cover-image" href="<%= cover.path %>" media-type="<%= cover.type %>" />\n <% } %>\n\t\t<item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml" />\n\t\t<item id="stylesheet" href="OEBPS/jackson.css" media-type="text/css" />\n <% Object.keys(images).forEach(name => { %>\n <item id="<%= name %>" href="OEBPS/<%= images[name].path %>" media-type="<%= images[name].type %>" />\n <% }); %>\n\t</manifest>\n\n\t<spine toc="ncx">\n <% if (cover) { %>\n\t\t <itemref idref="front-cover" linear="no" />\n <% } %>\n\t\t<itemref idref="title-page" linear="yes" />\n\t\t<itemref idref="table-of-contents" linear="yes" />\n <% pages.forEach((page, index) => { %>\n <itemref idref="page-<%= index %>" linear="yes" />\n <% }); %>\n <% if (notes) { %>\n <itemref idref="notes" linear="yes" />\n <% } %>\n\t</spine>\n\n\t<guide>\n <% if (cover) { %>\n\t\t <reference type="cover" title="<%= i18n.cover %>" href="OEBPS/front-cover.html" />\n <% } %>\n\t\t<reference type="toc" title="<%= i18n.toc %>" href="OEBPS/table-of-contents.html" />\n\t</guide>\n\n</package>\n'},function(t,e){t.exports="application/epub+zip"},function(t,e){t.exports='<?xml version="1.0" encoding="UTF-8" ?>\n<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">\n\n<ncx version="2005-1" xml:lang="<%= i18n.code %>" xmlns="http://www.daisy.org/z3986/2005/ncx/">\n\t<head>\n\t\t<meta name="dtb:uid" content="<%= uuid.id %>" />\n\t\t<meta name="dtb:depth" content="2" />\n\t\t<meta name="dtb:totalPageCount" content="0" />\n\t\t<meta name="dtb:maxPageNumber" content="0" />\n\t</head>\n\n\t<docTitle>\n\t\t<text><%= title %></text>\n\t</docTitle>\n\n\t<docAuthor>\n\t\t<text><%= author %></text>\n\t</docAuthor>\n\n\t<navMap>\n\t\t<navPoint id="title-page" playOrder="1">\n\t\t\t<navLabel>\n\t\t\t\t<text><%= i18n.info %></text>\n\t\t\t</navLabel>\n\t\t\t<content src="OEBPS/title-page.html" />\n\t\t</navPoint>\n\t\t<navPoint id="table-of-contents" playOrder="2">\n\t\t\t<navLabel>\n\t\t\t\t<text><%= i18n.toc %></text>\n\t\t\t</navLabel>\n\t\t\t<content src="OEBPS/table-of-contents.html" />\n\t\t</navPoint>\n <% pages.forEach((title, index) => { %>\n <navPoint id="page-<%= index %>" playOrder="<%= (index + 3) %>">\n <navLabel>\n <text><%= title %></text>\n </navLabel>\n <content src="OEBPS/page-<%= index %>.html" />\n </navPoint>\n <% }); %>\n <% if (notes) { %>\n <navPoint id="notes-page" playOrder="2">\n <navLabel>\n <text><%= i18n.note %></text>\n </navLabel>\n <content src="OEBPS/notes.html" />\n </navPoint>\n <% } %>\n\t</navMap>\n</ncx>\n'}])});
{
"name": "jepub",
"version": "2.0.1",
"version": "2.1.0",
"description": "Generate simple EPUB books with JavaScript.",

@@ -37,5 +37,6 @@ "main": "src/jepub.js",

},
"homepage": "https://github.com/lelinhtinh/jEpub#readme",
"homepage": "https://lelinhtinh.github.io/jEpub/",
"dependencies": {
"ejs": "^2.6.1",
"image-type": "^4.1.0",
"jszip": "^3.2.1"

@@ -42,0 +43,0 @@ },

@@ -80,6 +80,6 @@ # jEpub

```typescript
jepub.cover(blob: object)
jepub.cover(data: object)
```
- **blob**: Blob Object from XMLHttpRequest.
- **data**: A Blob or an ArrayBuffer object from XMLHttpRequest.

@@ -108,6 +108,6 @@ ### Add notes

```typescript
jepub.image(blob: object, IMG_ID: string)
jepub.image(data: object, IMG_ID: string)
```
- **blob**: Blob Object from XMLHttpRequest.
- **data**: A Blob or an ArrayBuffer object from XMLHttpRequest.
- **IMG_ID**: Unique id.

@@ -120,5 +120,7 @@

```typescript
jepub.generate()
jepub.generate(type = 'blob')
```
- **type**: The type of EPUB to return. See [JSZip type option](https://stuk.github.io/jszip/documentation/api_jszip/generate_async.html#type-option).
### Static methods `+`

@@ -125,0 +127,0 @@

'use strict';
import * as utils from './utils';
import imageType from 'image-type';

@@ -33,4 +34,2 @@ import language from './i18n.json';

init(details) {
if (!JSZip.support.blob) throw 'This browser does not support Blob';
this._Info = Object.assign({}, {

@@ -100,36 +99,46 @@ i18n: 'vi',

cover(data) {
let ext;
if (data instanceof Blob) {
const ext = utils.mime2ext(data.type);
if (!ext) throw 'Image data is not allowed';
this._Cover = {
type: data.type,
path: `OEBPS/cover-image.${ext}`
};
this._Zip.file(this._Cover.path, data);
this._Zip.file('OEBPS/front-cover.html', ejs.render(cover, {
i18n: this._I18n,
cover: this._Cover
}, {
client: true
}));
return this;
ext = utils.mime2ext(data.type);
} else if (data instanceof ArrayBuffer) {
ext = imageType(new Uint8Array(data));
if (ext) ext = utils.mime2ext(ext.mime);
} else {
throw 'Cover data is not valid';
}
if (!ext) throw 'Cover data is not allowed';
this._Cover = {
type: data.type,
path: `OEBPS/cover-image.${ext}`
};
this._Zip.file(this._Cover.path, data);
this._Zip.file('OEBPS/front-cover.html', ejs.render(cover, {
i18n: this._I18n,
cover: this._Cover
}, {
client: true
}));
return this;
}
image(data, name) {
let ext;
if (data instanceof Blob) {
const ext = utils.mime2ext(data.type);
if (!ext) throw 'Image data is not allowed';
const filePath = `assets/${name}.${ext}`;
this._Images[name] = {
type: data.type,
path: filePath
};
this._Zip.file(`OEBPS/${filePath}`, data);
return this;
ext = utils.mime2ext(data.type);
} else if (data instanceof ArrayBuffer) {
ext = imageType(new Uint8Array(data));
if (ext) ext = utils.mime2ext(ext.mime);
} else {
throw 'Image data is not valid';
}
if (!ext) throw 'Image data is not allowed';
const filePath = `assets/${name}.${ext}`;
this._Images[name] = {
type: data.type,
path: filePath
};
this._Zip.file(`OEBPS/${filePath}`, data);
return this;
}

@@ -180,3 +189,5 @@

generate() {
generate(type = 'blob') {
if (!JSZip.support[type]) throw `This browser does not support ${type}`;
let notes = this._Zip.file('OEBPS/notes.html');

@@ -221,3 +232,3 @@ notes = !notes ? false : true;

return this._Zip.generateAsync({
type: 'blob',
type: type,
mimeType: mime,

@@ -224,0 +235,0 @@ compression: 'DEFLATE',

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc