@thegetty/quire-cli 0.20.1 → 0.20.4
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.
- package/CHANGELOG.md +46 -0
- package/bin/.DS_Store +0 -0
- package/bin/go-iiif/.DS_Store +0 -0
- package/bin/index.js +1 -1
- package/bin/starters/.DS_Store +0 -0
- package/bin/starters/default/.gitignore +14 -0
- package/bin/starters/default/config/_default/config.yml +53 -0
- package/bin/starters/default/config/development/config.yml +14 -0
- package/bin/themes/default/.gitignore +13 -0
- package/bin/themes/default/layouts/contents/single.html +2 -2
- package/bin/themes/default/layouts/data/search-index.html +1 -1
- package/bin/themes/default/layouts/partials/cite-this.html +2 -2
- package/bin/themes/default/layouts/partials/contents-list/closing-tags.html +10 -3
- package/bin/themes/default/layouts/partials/contents-list/contents-list.html +24 -9
- package/bin/themes/default/layouts/partials/contents-list/file-dir.html +7 -0
- package/bin/themes/default/layouts/partials/contents-list/file-path.html +10 -0
- package/bin/themes/default/layouts/partials/contents-list.html +207 -0
- package/bin/themes/default/layouts/partials/figure-caption.html +1 -0
- package/bin/themes/default/layouts/partials/figure-fallback.html +31 -0
- package/bin/themes/default/layouts/partials/figure-image.html +44 -0
- package/bin/themes/default/layouts/partials/figure-label.html +15 -0
- package/bin/themes/default/layouts/partials/figure-soundcloud.html +25 -0
- package/bin/themes/default/layouts/partials/figure-table.html +44 -0
- package/bin/themes/default/layouts/partials/figure-vimeo.html +24 -0
- package/bin/themes/default/layouts/partials/figure-website.html +21 -0
- package/bin/themes/default/layouts/partials/figure-youtube.html +23 -0
- package/bin/themes/default/layouts/partials/figures/media-types/vimeo.html +3 -1
- package/bin/themes/default/layouts/partials/menu.html +1 -1
- package/bin/themes/default/layouts/partials/page-bibliography.html +1 -1
- package/bin/themes/default/layouts/shortcodes/q-bibliography.html +8 -8
- package/bin/themes/default/layouts/shortcodes/q-figure-new.html +70 -0
- package/bin/themes/default/package-lock.json +13198 -0
- package/bin/themes/default/source/css/components/quire-contents-list.scss +22 -18
- package/bin/themes/default/source/css/print.scss +1 -1
- package/bin/themes/default/source/js/popup.js +14 -10
- package/bin/themes/default/static/img/icons/baseline-headset-24px.png +0 -0
- package/bin/themes/default/static/img/icons/baseline-videocam-24px.png +0 -0
- package/bin/themes/default/static/img/icons/baseline-website-24px.png +0 -0
- package/bin/themes/default/tests/.gitkeep +0 -0
- package/bin/themes/default/tests/e2e/.eslintrc.js +9 -0
- package/bin/themes/default/tests/e2e/fixtures/blns.json +483 -0
- package/bin/themes/default/tests/e2e/plugins/index.js +22 -0
- package/bin/themes/default/tests/e2e/specs/quire-contents.spec.js +52 -0
- package/bin/themes/default/tests/e2e/specs/quire-contributors.spec.js +66 -0
- package/bin/themes/default/tests/e2e/specs/quire-entry.spec.js +104 -0
- package/bin/themes/default/tests/e2e/specs/quire-essay.spec.js +105 -0
- package/bin/themes/default/tests/e2e/specs/quire-menu.spec.js +38 -0
- package/bin/themes/default/tests/e2e/specs/quire-modal.spec.js +69 -0
- package/bin/themes/default/tests/e2e/specs/quire-next-back-buttons.spec.js +27 -0
- package/bin/themes/default/tests/e2e/specs/quire-page.spec.js +28 -0
- package/bin/themes/default/tests/e2e/specs/quire-search.spec.js +48 -0
- package/bin/themes/default/tests/e2e/specs/quire-splash.spec.js +38 -0
- package/bin/themes/default/tests/e2e/support/commands.js +25 -0
- package/bin/themes/default/tests/e2e/support/index.js +20 -0
- package/package.json +1 -1
- package/bin/themes/default/static/css/application.css +0 -12072
- package/bin/themes/default/static/js/application.js +0 -92
package/bin/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var quire=function(t){"use strict";function e(t,e){return t(e={exports:{}},e.exports),e.exports}var j=e(function(t){var e=function(a){var u,t=Object.prototype,s=t.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var i,o,a,c,e=e&&e.prototype instanceof g?e:g,e=Object.create(e.prototype),r=new j(r||[]);return e._invoke=(i=t,o=n,a=r,c=l,function(t,e){if(c===p)throw new Error("Generator is already running");if(c===d){if("throw"===t)throw e;return P()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){var r=function t(e,n){var r=e.iterator[n.method];if(r===u){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=u,t(e,n),"throw"===n.method))return v;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}r=f(r,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,v;var r=r.arg;if(!r)return n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v;{if(!r.done)return r;n[e.resultName]=r.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=u)}n.delegate=null;return v}(n,a);if(r){if(r===v)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===l)throw c=d,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=p;r=f(i,o,a);if("normal"===r.type){if(c=a.done?d:h,r.arg!==v)return{value:r.arg,done:a.done}}else"throw"===r.type&&(c=d,a.method="throw",a.arg=r.arg)}}),e}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var l="suspendedStart",h="suspendedYield",p="executing",d="completed",v={};function g(){}function y(){}function m(){}var b={};b[r]=function(){return this};e=Object.getPrototypeOf,e=e&&e(e(E([])));e&&e!==t&&s.call(e,r)&&(b=e);var w=m.prototype=g.prototype=Object.create(b);function x(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function S(a,c){var e;this._invoke=function(n,r){function t(){return new c(function(t,e){!function e(t,n,r,i){t=f(a[t],a,n);if("throw"!==t.type){var o=t.arg,n=o.value;return n&&"object"==typeof n&&s.call(n,"__await")?c.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):c.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)})}i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function E(e){if(e){var t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,t=function t(){for(;++n<e.length;)if(s.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=u,t.done=!0,t};return t.next=t}}return{next:P}}function P(){return{value:u,done:!0}}return((y.prototype=w.constructor=m).constructor=y).displayName=o(m,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,o(t,i,"GeneratorFunction")),t.prototype=Object.create(w),t},a.awrap=function(t){return{__await:t}},x(S.prototype),S.prototype[n]=function(){return this},a.AsyncIterator=S,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new S(c(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},x(w),o(w,i,"Generator"),w[r]=function(){return this},w.toString=function(){return"[object Generator]"},a.keys=function(n){var t,r=[];for(t in n)r.push(t);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=E,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=s.call(i,"catchLoc"),c=s.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r,i=n.completion;return"throw"===i.type&&(r=i.arg,k(n)),r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=u),v}},a}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}});function u(t,e,n,r,i,o,a){try{var c=t[o](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,i)}var E=function(c){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=c.apply(t,a);function i(t){u(r,e,n,i,o,"next",t)}function o(t){u(r,e,n,i,o,"throw",t)}i(void 0)})}};var a=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var c=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t},n=e(function(e){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(t){return typeof t}:e.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}e.exports=n});var i=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var s=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?i(t):e},f=e(function(e){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}e.exports=n}),o=e(function(n){function r(t,e){return n.exports=r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(t,e)}n.exports=r});var l=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)},h=require("events"),p=require("util"),d=require("fs-extra"),v=p.promisify(d.writeFile),g=require("rimraf"),y=require("sanitize-html"),m=(require("path"),require("cheerio")),b=function(t,e){e.fail("".concat(t)),process.exit(1),removeHTML()},w=function(){function r(t,e){var n;return a(this,r),(n=s(this,f(r).call(this))).data=t,n.spinner=e,n.data&&E(j.mark(function t(){return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,n.buildEpubFiles(n.data);case 3:t.next=8;break;case 5:t.prev=5,t.t0=t.catch(0),b(t.t0,n.spinner);case 8:case"end":return t.stop()}},t,null,[[0,5]])}))(),n}var e;return l(r,h),c(r,[{key:"removeHTML",value:function(){g("html/",function(){return!0})}},{key:"createReformatedHashLinkArrAndcreateLinkArr",value:function(i){return new Promise(function(t,e){var n,r;""===i?e(new Error("Something went wrong. Please try again."),null):(n=[],r=[],i.pages.forEach(function(t){var e=void 0!==t.reformatedHashLinkArr?t.reformatedHashLinkArr:"";n.push(e);t=void 0!==t.linkTitleArr?t.linkTitleArr:"";r.push(t)}),t([r,n]))})}},{key:"buildMetadata",value:function(f){return new Promise(function(t,e){if(""===f)e(new Error("Something went wrong. Please try again."),null);else if(void 0===f.title||null===f.title||""===f.title)e(new Error("A title for your publication must be specified in the publication.yml file."),null);else if(void 0===f.language||null===f.language||""===f.language)e(new Error("A language for your publication must be specified in the publication.yml file."),null);else{delete f.pages;var n,r="";for(n in f)if(void 0!==f[n]&&null!==f[n]&&"string"!=typeof f[n]){if(0<f[n].length){var i,o,a=f[n];if("creators"===n)for(var c in a)a.hasOwnProperty(c)&&void 0!==a[c]&&null!==a[c]&&""!==a[c]&&(!0===(i=a[c]).fullname?r+='<dc:creator opf:role="'.concat(i.role,'">').concat(i.name,"</dc:creator>"):r+='<dc:creator opf:file-as="'.concat(i["file-as"],'" opf:role="').concat(i.role,'">').concat(i.name,"</dc:creator>"));else if("contributors"===n)for(var u in a)a.hasOwnProperty(u)&&void 0!==a[u]&&null!==a[u]&&""!==a[u]&&(!0===(o=a[u]).fullname?r+='<dc:contributor opf:role="'.concat(o.role,'">').concat(o.name,"</dc:contributor>"):r+='<dc:contributor opf:file-as="'.concat(o["file-as"],'" opf:role="').concat(o.role,'">').concat(o.name,"</dc:contributor>"));else for(var s in a)a.hasOwnProperty(s)&&void 0!==a[s]&&null!==a[s]&&""!==a[s]&&(r+="<dc:".concat(s,">").concat(a[s],"</dc:").concat(s,">"))}}else"title"!==n&&void 0!==f[n]&&null!==f[n]&&""!==f[n]&&(r+="<dc:".concat(n,">").concat(f[n],"</dc:").concat(n,">"));v("html/dc.xml",r),t(r)}})}},{key:"buildHTML",value:function(o,c,u){return new Promise(function(t,r){var e,a,n,i;""===o||""===c||""===u?r(new Error("Something went wrong. Please try again."),null):(e=[],o.pages.forEach(function(t){t=void 0!==t.body?t.body:"";e.push(t)}),i=e.join(" "),i=y(i,{allowedTags:["h1","h2","h3","h4","h5","h6","blockquote","p","a","ul","ol","nl","li","b","i","strong","em","hr","br","div","table","thead","caption","tbody","tr","th","td","dl","dt","dd","pre","html","title","iframe","header","footer","body","form","img","meta","link","strike","code","main","article","section","aside","span","figure","sup","sub","figcaption"],allowedAttributes:{a:["href","name","target","class","id"],img:["src","width","height","class","id"],iframe:["src","width","height","class","id"],div:["id","class"],main:["id","class"],article:["id","class"],ul:["id","class"],ol:["id","class"],li:["id","class"],nav:["id","class"],meta:["name","content"],link:["rel","href"],p:["id","class"],h1:["id","class"],h2:["id","class"],h3:["id","class"],h4:["id","class"],h5:["id","class"],h6:["id","class"],span:["id","class"],sup:["id","class"],sub:["id","class"],figure:["id","class"],figcaption:["id","class"],blockquote:["id","class"],table:["id","class"],td:["id","class"],tr:["id","class"],th:["id","class"],dl:["id","class"],dt:["id","class"],dd:["id","class"],html:["id","class"],body:["id","class"],section:["id","class"],aside:["id","class"]},selfClosing:["br","hr","area","base","basefont","input","meta","img"],allowedSchemes:["http","https","ftp","mailto"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:[],allowProtocolRelative:!0,allowedIframeHostnames:["www.youtube.com","player.vimeo.com"]}),i="\n <!DOCTYPE html>\n <html>\n <head>\n <title>".concat(o.title,"</title>\n </head>\n <body>\n <div>\n ").concat(i,"\n </div>\n </body>\n </html>\n "),i=(a=m.load(i,{decodeEntities:!1}))("html"),n={},i.find("[id]").attr("id",function(t,e){return n[e]=(n[e]||0)+1,-1===e.indexOf("fn-")&&-1===e.indexOf("fnref-")&&1<n[e]?e="".concat(e,"-").concat(n[e]):e}),i.find(".remove-from-epub, .visually-hidden, .is-screen-only, .is-print-only").remove(),i.find(".quire-figure--group").each(function(t,e){var n=a(e).html();return a(e).replaceWith("".concat(n))}),i.find("figure").each(function(t,e){var n,r=void 0!==a(e).find("img").attr("id")?a(e).find("img").attr("id"):"",i=void 0!==a(e).find("img").attr("src")?a(e).find("img").attr("src"):"",o=a(e).find("figcaption");return o.length&&(n=a("<figcaption></figcaption>"),o.each(function(t,e){n.append(a(e).html()),t<o.length-1&&n.append("<br/>")})),a(e).replaceWith('<span id="'.concat(r,'"></span><figure><img src="').concat(i,'"/>').concat(n,"</figure>"))}),i.find("a").attr("href",function(t,e){var n;return-1!==e.indexOf("empty")&&(n=e.replace("#empty-",""),r(new Error("Fragment identifier on page ".concat(n,' of <a href="#"></a> could not be found. Please correct this and try again.')),null)),function(t,e){if(t.match(/^(https|http|www)/))return t;if(-1!==t.indexOf("#")){for(var n=t.split("#"),r=0;r<e.length;r++){var i=e[r].link.replace(/[^a-zA-Z0-9 ]/g,"");if(n[0].replace(/[^a-zA-Z0-9 ]/g,"")===i)return t="#".concat(n[1],"-").concat(e[r].title)}return t}for(var o=0;o<e.length;o++)if(t===e[o].link)return t="#".concat(e[o].title);return t}(e,c)}),i.find("sup").each(function(t,e){var n=a(e).attr(),r=a(e).html(),i=void 0!==n.class?'class="'.concat(n.class,'"'):"",n=void 0!==n.id?'id="'.concat(n.id,'"'):"";return a(e).replaceWith("<sup><span ".concat(i," ").concat(n,">").concat(r,"</span></sup>"))}),d.existsSync("epub/template.xhtml")?d.copyFileSync("epub/template.xhtml","html/template.xhtml"):v("html/template.xhtml",'<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE html>\n<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" $if(lang)$ xml:lang="$lang$" $endif$>\n\n<head>\n <meta charset="utf-8" />\n <meta name="generator" content="pandoc" />\n <title>$pagetitle$</title>\n <style type="text/css">\n $if(quotes)$ q {\n quotes: "“" "”" "‘" "’";\n }\n\n $endif$\n </style>\n $if(highlighting-css)$\n <style type="text/css">\n $highlighting-css$\n </style>\n $endif$ $for(css)$\n <link rel="stylesheet" type="text/css" href="$css$" /> $endfor$ $for(header-includes)$ $header-includes$ $endfor$\n</head>\n<body$if(coverpage)$ id="cover" $endif$>\n \n $if(titlepage)$\n <section epub:type="titlepage">\n $for(title)$ $if(title.type)$\n <h1 class="$title.type$">$title.text$</h1>\n $else$\n <h1 class="title">$title$</h1>\n $endif$ $endfor$ $if(subtitle)$\n <p class="subtitle">$subtitle$</p>\n $endif$ $for(author)$\n <p class="author">$author$</p>\n $endfor$ $for(creator)$\n <p class="$creator.role$">$creator.text$</p>\n $endfor$ $if(publisher)$\n <p class="publisher">$publisher$</p>\n $endif$ $if(date)$\n <p class="date">$date$</p>\n $endif$ $if(rights)$\n <div class="rights">$rights$</div>\n $endif$\n </section>\n $else$ \n\n $for(include-before)$ \n $include-before$ \n $endfor$ \n \n $body$ \n \n $for(include-after)$ \n $include-after$ \n $endfor$ \n\n $endif$\n </body>\n\n</html>'),i=a("<div>").append(i.clone()).html(),v("html/epub.xhtml",i),t(a.html()))})}},{key:"buildEpubFiles",value:(e=E(j.mark(function t(n){var r;return j.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,d.existsSync("./html")||d.mkdirSync("./html"),e.next=5,this.createReformatedHashLinkArrAndcreateLinkArr(n);case 5:return r=e.sent,e.next=8,this.buildHTML(n,r[0],r[1]);case 8:return e.next=10,this.buildMetadata(n);case 10:return e.abrupt("return",new Promise(function(t){return t(!0)}));case 13:return e.prev=13,e.t0=e.catch(0),b(e.t0,this.spinner),e.abrupt("return",new Promise(function(t){return t(e.t0)}));case 17:case"end":return e.stop()}},t,this,[[0,13]])})),function(t){return e.apply(this,arguments)})}]),r}(),x=require("cheerio"),S=require("path"),_=require("upath"),k=function(){function r(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{outputDir:"site",imageDir:"img"};a(this,r),this.config=n,this.epubTitle=e,this.$=x.load(t),this.content=this.$("#main")||this.$(".quire__primary__inner"),this.title=this.determineTitle(),this.chapterId=this.determineChapterId(),this.images=this.content.find("img"),this.links=this.content.find("a"),this.reformatedHashLinkArr="",this.reformatPage();t={title:this.title,body:this.body(),reformatedHashLinkArr:this.reformatedHashLinkArr};return this.href()&&(t.linkTitleArr={},t.href=this.href(),t.linkTitleArr.link=this.santizeUrl(this.href()),t.linkTitleArr.title=this.pandocTitle(this.chapterId)),t}return c(r,[{key:"santizeUrl",value:function(t){if(void 0!==t)return t=t.toLowerCase().trim().replace(".xhtml","").replace(/^\//,"").replace(/\/$/,"").replace(/\./g,"")}},{key:"pandocTitle",value:function(t){return(t=t!==this.epubTitle?t.replace(/[^a-zA-Z0-9 ]/g," "):t.replace(/\’/g,"").replace(/[^a-zA-Z0-9.]/g," ")).toLowerCase().replace(/\s\s+/g," ").trim().replace(/\s/g,"-")}},{key:"attrMatches",value:function(t,e,n){return this.$(t).attr(e).match(n)}},{key:"epubLink",value:function(t){if(t.match(/^(https|http|www)/))return t;if(-1!==t.indexOf("#"))return t;t=_.normalize(t.replace("localhost:1313","")).replace(/^\//,"").replace(/\/$/,"").replace(/\./g,"").replace(/\’/g,"");return t=""!==t?"".concat(t):"#".concat(this.pandocTitle(this.epubTitle))}},{key:"determineTitle",value:function(){var t;return this.content.find("h1")?t=this.content.find("h1").text():this.content.find("h2")&&(t=this.content.find("h2").text()),t||"Cover"}},{key:"determineChapterId",value:function(){var t;return this.content.find(".quire-contents-header > h1")&&void 0!==this.content.find(".quire-contents-header > h1").attr("id")&&(t=this.content.find(".quire-contents-header > h1").attr("id")),(t=this.content.find("h1.quire-page__header__title")&&void 0!==this.content.find("h1.quire-page__header__title").attr("id")?this.content.find("h1.quire-page__header__title").attr("id"):t)||this.epubTitle}},{key:"body",value:function(){return this.$.xml(this.content)}},{key:"href",value:function(){var t=this.$('link[rel="canonical"]');return t?this.epubLink(t.attr("href")):null}},{key:"reformatPage",value:function(){var n,r,i=this;i.content.find('[id*=":"]').attr("id",function(t,e){return e.replace(":","-")}),i.images.attr("src",function(t,e){e=e.replace(/^(\.+\/)+img\//,"");return S.resolve(S.join(i.config.outputDir,i.config.imageDir),e).replace(/\/localhost:1313/,i.config.outputDir)}),n={},r=[],i.links.not(function(t,e){return i.attrMatches(e,"href",/^#/)}).attr("href",function(t,e){return"".concat(i.epubLink(e))}),i.links.filter(function(t,e){return-1!==i.$(e).attr("href").indexOf("#")}).filter(function(t,e){return"#"!==i.$(e).attr("href").charAt(0)}).attr("href",function(t,e){return e.toLowerCase()}).attr("href",function(t,e){return decodeURIComponent(e)}).attr("href",function(t,e){return decodeURI(e)}).attr("href",function(t,e){return e.match(/^(https|http|www)/)?e:(e=e.replace("//localhost:1313","").replace(/^\//,"").replace(/\/$/,"").replace(":","-").replace(".","-").replace(/\s/g,"-"),r.push({internalLinksOtherPage:"#".concat(e)}),"".concat(e))}),i.links.filter(function(t,e){return i.attrMatches(e,"href",/^#/)}).filter(function(t,e){return-1===i.$(e).attr("href").indexOf("/")}).attr("href",function(t,e){return e.toLowerCase()}).attr("href",function(t,e){return decodeURIComponent(e)}).attr("href",function(t,e){return decodeURI(e)}).attr("href",function(t,e){return e.replace("#cover","#".concat(i.pandocTitle(i.epubTitle)))}).attr("href",function(t,e){return e!=="#".concat(i.pandocTitle(i.epubTitle))?e.replace(/[^a-zA-Z0-9 ]/g," "):e}).attr("href",function(t,e){return(e=e.substring(1)).replace(/\s\s+/g," ")}).attr("href",function(t,e){return e.replace(":","-")}).attr("href",function(t,e){return(e=(e=""!==e?e:"empty").replace(/\s/g,"-"))!=="".concat(i.pandocTitle(i.epubTitle))?(r.push({internalLinks:"#".concat(e,"-").concat(i.pandocTitle(i.chapterId)),mdPage:"".concat(i.pandocTitle(i.chapterId))}),"#".concat(e,"-").concat(i.pandocTitle(i.chapterId))):(r.push({internalLinks:"#".concat(e)}),"#".concat(e))}),"contents"===i.pandocTitle(i.title)&&i.links.filter(function(t,e){return i.attrMatches(e,"href",/^#/)}).attr("href",function(t,e){return n[e]=(n[e]||0)+1,1<n[e]?(r.push({tocInternalLinks:"".concat(e,"-").concat(n[e])}),e="".concat(e,"-").concat(n[e])):e}),i.reformatedHashLinkArr=r,i.content.find("h1").each(function(t,e){var n=void 0!==(n=i.$(e).attr("id"))?n.toLowerCase().replace(/[^a-zA-Z0-9 ]/g," ").replace(/\s\s+/g," ").replace(/\s/g,"-"):"cover";return i.$(e).attr("id",n)}),i.content.find("[id]").not("h1").attr("id",function(t,e){return decodeURIComponent(e)}).attr("id",function(t,e){return decodeURI(e)}).attr("id",function(t,e){return e.toLowerCase()}).attr("id",function(t,e){return e.replace(/[^a-zA-Z0-9 ]/g," ")}).attr("id",function(t,e){return e.replace(/\s\s+/g," ")}).attr("id",function(t,e){return e.replace(/\s/g,"-")}).attr("id",function(t,e){return"".concat(e,"-").concat(i.pandocTitle(i.chapterId))})}}]),r}();function P(t,e){for(var n=0,r=t.length-1;0<=r;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;)t.unshift("..");return t}function F(t){return O.exec(t).slice(1)}var O=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;function A(){for(var t="",e=!1,n=arguments.length-1;-1<=n&&!e;n--){var r=0<=n?arguments[n]:"/";if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(t=r+"/"+t,e="/"===r.charAt(0))}return(e?"/":"")+(t=P(T(t.split("/"),function(t){return!!t}),!e).join("/"))||"."}function L(t){var e=I(t),n="/"===$(t,-1);return(t=!(t=P(T(t.split("/"),function(t){return!!t}),!e).join("/"))&&!e?".":t)&&n&&(t+="/"),(e?"/":"")+t}function I(t){return"/"===t.charAt(0)}var M={extname:function(t){return F(t)[3]},basename:function(t,e){return t=F(t)[2],t=e&&t.substr(-1*e.length)===e?t.substr(0,t.length-e.length):t},dirname:function(t){var t=(e=F(t))[0],e=e[1];return t||e?t+(e=e&&e.substr(0,e.length-1)):"."},sep:"/",delimiter:":",relative:function(t,e){function n(t){for(var e=0;e<t.length&&""===t[e];e++);for(var n=t.length-1;0<=n&&""===t[n];n--);return n<e?[]:t.slice(e,n-e+1)}t=A(t).substr(1),e=A(e).substr(1);for(var r=n(t.split("/")),i=n(e.split("/")),o=Math.min(r.length,i.length),a=o,c=0;c<o;c++)if(r[c]!==i[c]){a=c;break}for(var u=[],c=a;c<r.length;c++)u.push("..");return(u=u.concat(i.slice(a))).join("/")},join:function(){return L(T(Array.prototype.slice.call(arguments,0),function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},isAbsolute:I,normalize:L,resolve:A};function T(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}var $="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)},R=require("command-exists").sync,C=require("fs-extra"),N=require("js-yaml"),q=require("url").URL;function U(t,e){return D.apply(this,arguments)}function D(){return(D=E(j.mark(function t(e,n){return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,C.ensureDir(n);case 2:if(C.existsSync(e)){t.next=4;break}throw new Error("".concat(e," does not exist"));case 4:return t.next=6,C.copy(e,n);case 6:return t.abrupt("return",!0);case 7:case"end":return t.stop()}},t)}))).apply(this,arguments)}function B(t){return N.safeLoad(C.readFileSync(t,"utf8"))}function G(e){if(C.existsSync(e))return new Promise(function(t){t(C.unlinkSync(e))})}function W(t){return!R(t)}function z(e){if("string"==typeof e){-1===e.indexOf("://")&&-1<e.indexOf(":")&&(e="http://"+e);try{return new q(e).pathname}catch(t){if(t instanceof TypeError)return M.parse(e||"").name}}}function V(){return"win32"===process.platform}function H(t,e){return 1===e?t:"".concat(t,"s")}var Y=require("events"),K=require("lodash"),J=require("axios"),Z=require("path"),X=require("url").URL,Q=require("striptags"),tt=function(){function r(t,e){var n;return a(this,r),(n=s(this,f(r).call(this))).data=t,n.config=e,n.outputDir=n.config.outputDir||"site",n.imageDir=n.config.imageDir||"img",n}var t,e;return l(r,Y),c(r,[{key:"title",value:function(){return this.data.subtitle&&this.data.reading_line?"".concat(this.data.title,": ").concat(this.data.subtitle," ").concat(this.data.reading_line):this.data.subtitle?"".concat(this.data.title,": ").concat(this.data.subtitle):"".concat(this.data.title)}},{key:"creators",value:function(){return!!this.data.contributor&&K.castArray(this.data.contributor).filter(function(t){return"primary"===t.type}).map(function(t){var e=t.full_name||"".concat(t.first_name," ").concat(t.last_name),n={name:e,role:"".concat(t.role||"aut")};return t.last_name&&t.first_name?n["file-as"]="".concat(t.last_name,", ").concat(t.first_name):(e=e.split(" "),n["file-as"]="".concat(e[1],", ").concat(e[0]),n.fullname=!0),n})}},{key:"contributors",value:function(){return!!this.data.contributor&&K.castArray(this.data.contributor).filter(function(t){return"secondary"===t.type}).map(function(t){var e=t.full_name||"".concat(t.first_name," ").concat(t.last_name),n={name:e,role:"".concat(t.role||"ctb")};return t.last_name&&t.first_name?n["file-as"]="".concat(t.last_name,", ").concat(t.first_name):(e=e.split(" "),n["file-as"]="".concat(e[1],", ").concat(e[0]),n.fullname=!0),n})}},{key:"publishers",value:function(){return!!this.data.publishers&&K.castArray(this.data.publishers).map(function(t){return t.location?"".concat(t.name,", ").concat(t.location):"".concat(t.name)})}},{key:"loadChapterURLs",value:(e=E(j.mark(function t(){var e;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.data.chapters,e=e.map(function(t){return J.get(t,{adapter:require("axios/lib/adapters/http")})}),t.next=4,Promise.all(e);case 4:return e=t.sent,t.abrupt("return",e);case 6:case"end":return t.stop()}},t,this)})),function(){return e.apply(this,arguments)})},{key:"generate",value:(t=E(j.mark(function t(){var e,n,r=this;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e={title:this.title(),cover:this.data.promo_image,url:this.data.publisher[0].url,isbn:this.data.identifier.isbn,language:this.data.language,date:this.data.pub_date,creators:this.creators(),contributors:this.contributors(),publisher:this.data.publisher[0].name,description:Q(this.data.description.full).replace(/\r?\n|\r/g," "),rights:this.data.copyright,css:this.getStylesheetUrl()},t.next=3,this.loadChapterURLs();case 3:return n=t.sent,n=n.map(function(t){return new k(t.data,e.title,{outputDir:r.outputDir,imageDir:r.imageDir})}),e.pages=n,t.abrupt("return",new Promise(function(t){return t(e),e}));case 7:case"end":return t.stop()}},t,this)})),function(){return t.apply(this,arguments)})},{key:"getStylesheetUrl",value:function(){var t=z(this.config.baseURL),t=Z.join(t,"css","epub.css");return[new X(t,"http://localhost:1313").href.toLowerCase()]}}]),r}(),et=require("execa"),nt=require("fs-extra"),rt=require("ora"),it=require("path"),ot=require("rimraf");function at(){return(at=E(j.mark(function t(){var a,c,u,s,f,l,h,r,i,e,n,o,p,d,v,g,y,m,b,w,x,S,_,k;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return k=function(){var t,e;h.length&&(t=h.filter(function(t){return"error"===t.status}),a.clear(),console.log("::Summary::"),e="Processed ".concat(h.length," ").concat(H("item",h.length)),e+=t.length?" with ".concat(t.length," ").concat(H("failure",t.length)):"",console.log(e),t.length&&(console.log("\nUnable to process the following files."),t.forEach(function(t){a.fail("".concat(t.image," - ").concat(t.message))})),console.log("\n"),a.succeed("Completed processing images.\n"))},_=function(){return(_=E(j.mark(function t(){var e,n,r,i;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:for(e=nt.readdirSync(u),n=0;n<s.length;n++)r=it.parse(s[n]).base,i=it.parse(s[n]).name,e.includes(i)?h.push({image:r,status:"success"}):h.push({image:r,status:"error",message:"Ensure file has proper exif headings"});case 2:case"end":return t.stop()}},t)}))).apply(this,arguments)},S=function(){return _.apply(this,arguments)},x=function(){return(x=E(j.mark(function t(){return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,S();case 2:v(it.normalize("static/img/iiif/processed")),p(),k();case 5:case"end":return t.stop()}},t)}))).apply(this,arguments)},w=function(){return x.apply(this,arguments)},b=function(){return(b=E(j.mark(function t(){return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(l=s.length,console.log("\nProcessing project image resources for IIIF."),0===l)return console.log("\n"),a.fail("No images found in ".concat(c,"\n")),t.abrupt("return");t.next=6;break;case 6:return console.log("\nGenerating IIIF image tiles may take a while depending on the size of each image file.\n"),a.start("Processing ".concat(l," ").concat(H("image",s.length),"...")),t.next=10,E(j.mark(function t(){var e,n,r,i,o;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n=!(e=!0),r=void 0,t.prev=3,i=s[Symbol.iterator]();case 5:if(e=(o=i.next()).done){t.next=12;break}return o=o.value,t.next=9,d(o).then(function(){l--,f++}).catch(function(){l--}).finally(function(){a.start("Processed ".concat(f,"/").concat(s.length," ").concat(H("image",s.length),"..."))});case 9:e=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),n=!0,r=t.t0;case 18:t.prev=18,t.prev=19,e||null==i.return||i.return();case 21:if(t.prev=21,n)throw r;t.next=24;break;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}},t,null,[[3,14,18,26],[19,,21,25]])}))();case 10:case"end":return t.stop()}},t)}))).apply(this,arguments)},m=function(){return b.apply(this,arguments)},y=function(){if(!nt.existsSync(c))throw a.fail("'".concat(c,"' directory was not found!")),new error;for(var o=nt.readdirSync(c),t=0;t<o.length;t++)!function(t){var e=(i=it.parse(o[t])).ext,n=i.name,r=(i.base,it.join(c,o[t])),i=it.join(u,n);(n=[".jp2",".jpg",".jpeg",".png",".svg",".tif",".tiff"]).some(function(t){return t===e.toLowerCase()})?s.push(r):[".ai",".bmp",".gif",".heif",".ind",".pdf",".psd",".raw",".webp"].some(function(t){return t===e.toLowerCase()})&&h.push({image:o[t],status:"error",message:"File type must be one of the following: ".concat(n.join(", "),".")}),nt.existsSync(i)&&nt.lstatSync(i).isDirectory()&&ot.sync(i)}(t)},g=function(){return(g=E(j.mark(function t(e){var n,r,i,o,a;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:i=nt.readdirSync(e).map(function(t){return it.join(e,t)}),n=i.filter(function(t){return nt.statSync(t).isFile()}),o=i.filter(function(t){return!n.includes(t)}),o.reduce(function(t,e){return t.concat(v(e))},[]),n.length&&n[0].includes("color")&&(r=n[0],a=r.substr(0,r.lastIndexOf("/")),i=a+"/default.jpg",o=n[1],a=a+"/default.jpg.attrs",nt.renameSync(r,i),nt.renameSync(o,a));case 5:case"end":return t.stop()}},t)}))).apply(this,arguments)},v=function(t){return g.apply(this,arguments)},d=function(t){var e="file://".concat(it.normalize(__dirname)).concat(it.normalize(i)),n="".concat(it.normalize(__dirname)).concat(it.normalize(r)),t=it.parse(t).base;return et(n,["-config-source",e,"-quality","default","-verbose","-refresh","-noextension","-scale-factors","32,16,8,4,2,1",t])},p=function(){return nt.unlinkSync(n)},o=function(){var t=JSON.parse(nt.readFileSync(e));t.images.source.path=it.normalize(process.cwd()+"/"+c),t.derivatives.cache.path=it.normalize(process.cwd()+"/"+u),t=JSON.stringify(t,null,2),nt.writeFileSync(n,t,"utf8")},a=rt(),c="static/img/iiif/",u="static/img/iiif/processed",s=[],f=0,h=[],r=V()?"/go-iiif/bin/iiif-tile-seed-win":"linux"===process.platform?"/go-iiif/bin/iiif-tile-seed-linux":"/go-iiif/bin/iiif-tile-seed-macos",i="/go-iiif/config/",e=it.join(__dirname,it.normalize("/go-iiif/config/config.template")),n=it.join(__dirname,it.normalize("/go-iiif/config/config.json")),nt.existsSync(u)||nt.mkdirSync(u,{recursive:!0}),t.abrupt("return",new Promise(function(t,e){try{o()}catch(t){a.fail("Failed to generate go-iiif config"),e(t)}try{y()}catch(t){a.fail("Failed to slice any images!"),e(t)}m().then(function(){w(),t()}).catch(function(t){e(t)})}));case 25:case"end":return t.stop()}},t)}))).apply(this,arguments)}function qt(t){try{return!!t()}catch(t){return!0}}function ct(t){return Nt?Ct.createElement(t):{}}function Ut(t,e){if(!zt(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!zt(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!zt(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!zt(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}function Dt(t){return"Symbol(".concat(void 0===t?"":t,")_",(++Zt+Xt).toString(36))}function ut(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}var st=require("events"),ft=require("lodash"),lt=require("execa"),ht=require("yaml-front-matter"),pt=require("fs-extra"),dt=require("glob"),vt=require("hugo-bin"),gt=require("path"),yt=require("child_process").spawn,mt=require("child_process").spawnSync,bt=require("child_process").execFileSync,wt=require("child_process").execSync,xt=(require("util").promisify(pt.writeFile),require("url").URL),St=require("chalk"),_t=require("ora"),kt=require("js-yaml"),jt=require("perf_hooks").performance,Et=function(){function n(t){var e;return a(this,n),(e=s(this,f(n).call(this))).config=e.loadConfig(),e.config.publishDir||(e.config.publishDir="site"),e.theme=e.config.theme,e.chapters=e.loadChapters(),e.verbose=t,e}var r,i,o,e,t;return l(n,st),c(n,[{key:"runPandoc",value:function(t,e){e=["--from=html-native_divs+native_spans","--to=epub ".concat(gt.join("html","epub.xhtml")),"--output=".concat(t),"--epub-metadata=".concat(gt.join("html","dc.xml")),"--epub-cover-image=".concat(e),"--template=".concat(gt.join("html","template.xhtml")),"--css=".concat(gt.join(this.config.publishDir,"css","epub.css")),"--standalone"];wt("pandoc ".concat(e.join(" ")))}},{key:"getBaseUrl",value:function(t){var e=this;return t.map(function(t){return e.loadConfig(t)}).filter(function(t){return void 0!==t.baseURL})}},{key:"iiif",value:(t=E(j.mark(function t(){return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,function(){return at.apply(this,arguments)}();case 2:case"end":return t.stop()}},t)})),function(){return t.apply(this,arguments)})},{key:"loadConfig",value:function(t){try{return B(t||"config.yml")}catch(t){this.emit("error",t)}}},{key:"loadBookData",value:function(){try{return B(gt.join("data","publication.yml"))}catch(t){this.emit("error",t)}}},{key:"loadChapters",value:function(){var t=dt.sync(gt.join(this.config.contentDir||"content","**","*.md"));return ft.sortBy(t,function(t){return ht.loadFront(t).weight})}},{key:"preview",value:function(t){t=void 0!==t?t:"webpack.config.dev.js",t=gt.join("webpack",t);var e=this.verbose?"inherit":["pipe","pipe",process.stderr],n=gt.join("themes",this.theme),r=V()?"webpack.cmd":"webpack",i=gt.join("node_modules",".bin",r);this.emit("info","Launching preview server");r=_t({text:"Launching preview server"}).start();this.webpack=yt(i,["--watch","-d","--progress","--color","--config",t],{cwd:n,stdio:e}),this.hugo=this.spawnHugo("server","--config=config.yml,".concat(gt.join("config","environments","dev.yml")),"--watch"),r.info("Navigate to http://localhost:1313 to see your changes."),r.info('Press Control+C or type "quire stop" to stop the preview.')}},{key:"install",value:function(){var i=this;return new Promise(function(t){var e=i.config.theme,n=V()?"npm.cmd":"npm",r=_t({text:"Installing theme dependencies..."}).start();mt(n,["install"],{cwd:gt.join("themes",e),stdio:"inherit"}),r.succeed("Theme dependencies successfully installed."),r.succeed("Run quire preview to view changes locally."),t(!0)})}},{key:"buildTheme",value:function(t,e){e=e.replace(/\/?$/,"/"),t=void 0!==t?t:"webpack.config.dev.js";var n=["--config",t=gt.join("webpack",t)];-1!==t.indexOf("prod")&&(n.push("--output-public-path"),n.push(e));t=this.verbose?"inherit":["pipe","pipe",process.stderr],e=V()?"webpack.cmd":"webpack",e=gt.join("node_modules",".bin",e);return lt(e,n,{cwd:gt.join("themes",this.theme),stdio:t})}},{key:"buildWeb",value:(e=E(j.mark(function t(n){var r,i,o,a=this;return j.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=["config.yml",gt.join("config","site.yml")],n&&r.push(gt.join("config","environments","".concat(n,".yml"))),r.forEach(function(t){t=a.loadConfig(t);a.config=ft.merge(a.config,t)}),i=""!==this.getBaseUrl(r)?this.getBaseUrl(r):"/",i=void 0!==i[0]&&" "!==i[0].baseURL&&""!==i[0].baseURL?i[0].baseURL:"/",o=_t({text:"Building theme assets..."}).start(),e.prev=6,e.next=9,this.buildTheme("webpack.config.prod.js",i);case 9:return o.stopAndPersist({symbol:"✔ ",text:"Assets built"}),bt(vt,["--config="+r.join(",")],{stdio:"inherit"}),o.succeed("Site built successfully"),o.succeed("Files output to: ".concat(this.config.publishDir)),e.abrupt("return",new Promise(function(t){t(!0)}));case 16:return e.prev=16,e.t0=e.catch(6),e.abrupt("return",new Promise(function(t){t(e.t0),a.errorExit("".concat(e.t0),o)}));case 19:case"end":return e.stop()}},t,this,[[6,16]])})),function(t){return e.apply(this,arguments)})},{key:"getURLforChapter",value:function(t){var e=this.config.contentDir||"content",n=gt.parse(gt.relative(e,t)),r=z(this.config.baseURL),i="http://localhost:1313";if(ht.loadFront(t).url){e=ht.loadFront(t).url;return new xt(gt.join(r,e),i).href.toLowerCase()}if(ht.loadFront(t).slug){t=ht.loadFront(t).slug;return new xt(gt.join(r,n.dir,t),i).href.toLowerCase()}return("_index"===n.name||"index"===n.name?new xt(gt.join(r,n.dir),i):new xt(gt.join(r,n.dir,n.name),i)).href.toLowerCase()}},{key:"buildPDF",value:(o=E(j.mark(function t(n,r){var i,o,a,c,u,s,f,l,h,p=this;return j.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,G(gt.join("themes",this.theme,"static","css","application.css"));case 2:return i=V()?'C:\\"Program Files (x86)"\\Prince\\engine\\bin\\prince.exe':"prince",o=_t("Building PDF").start(),a=jt.now(),V()||this.checkForCommand(i,o),c=["config.yml",gt.join("config","pdf.yml")],r&&c.push(gt.join("config","environments","".concat(r,".yml"))),c.forEach(function(t){t=p.loadConfig(t);p.config=ft.merge(p.config,t)}),n=void 0!==n?n:gt.join("static","downloads","output"),-1!==(u=gt.basename(n)).indexOf(".")&&(u=(n=u.split("."))[0]),s=n.substring(0,n.lastIndexOf("/")),e.prev=13,e.next=16,pt.ensureDir(s);case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(13),this.errorExit("".concat(e.t0),o);case 21:return s=void 0!==s&&""!==s?s:gt.join("static","downloads"),u=void 0!==u&&""!==u?u:"output",f=gt.join(s,u),l=""!==this.getBaseUrl(c)?this.getBaseUrl(c):"localhost:1313",h=void 0!==l[0]&&" "!==l[0].baseURL&&""!==l[0].baseURL?l[0].baseURL:"localhost:1313",l="http://",h.substr(0,l.length)!==l&&(h=l+h),e.prev=28,e.next=31,this.buildTheme("webpack.config.prod.js",h);case 31:return e.next=33,this.spawnHugo("server","--config="+c.join(","));case 33:return this.hugo=e.sent,e.next=36,this.hugo.ready;case 36:return e.sent&&(h=this.loadChapters(),h=ft.filter(h,function(t){return!1!==ht.loadFront(t).pdf}).map(function(t){return p.getURLforChapter(t)}),pt.existsSync(gt.join("themes",this.theme,"static","css","application.css")),wt("".concat(i," ").concat(h.toString().replace(/,/g," ")," -o ").concat(f,".pdf --no-warn-css-unsupported --no-warn-css-unknown --no-warn-css")),o.succeed("PDF output to: ".concat(f,".pdf")),o.info("Execution Time: ".concat(((jt.now()-a)/1e3).toFixed(3)," seconds"))),e.abrupt("return",new Promise(function(t){t(!0),p.hugo.kill()}));case 41:return e.prev=41,e.t1=e.catch(28),e.abrupt("return",new Promise(function(t){t(!1),p.hugo.kill(),p.errorExit("".concat(e.t1),o)}));case 44:case"end":return e.stop()}},t,this,[[13,18],[28,41]])})),function(t,e){return o.apply(this,arguments)})},{key:"buildEpub",value:(i=E(j.mark(function t(n,r){var i,o,a,c,u,s,f,l,h,p,d,v=this;return j.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=_t("Building EPUB").start(),o=jt.now(),this.checkForCommand("pandoc",i),e.next=5,G(gt.join("themes",this.theme,"static","css","epub.css"));case 5:c=["config.yml",gt.join("config","epub.yml")],r&&c.push(gt.join("config","environments","".concat(r,".yml"))),c.forEach(function(t){t=v.loadConfig(t);v.config=ft.merge(v.config,t)}),e.prev=8,a=kt.safeLoad(pt.readFileSync(gt.join("data","publication.yml"),"utf8")),e.next=16;break;case 12:if(e.prev=12,e.t0=e.catch(8),e.t0)return e.abrupt("return",this.errorExit("".concat(e.t0),i));e.next=16;break;case 16:return void 0!==a.title&&""!==a.title&&null!==a.title||this.errorExit("A title for your publication must be specified in the publication.yml file.",i),void 0!==a.language&&""!==a.language&&null!==a.language||this.errorExit("A language for your publication must be specified in the publication.yml file.",i),s=""!==this.getBaseUrl(c)?this.getBaseUrl(c):"/",u=void 0!==s[0]&&" "!==s[0].baseURL&&""!==s[0].baseURL?s[0].baseURL:"/",e.prev=20,e.next=23,this.spawnHugo("server","--renderToDisk","--config="+c.join(","));case 23:return this.hugo=e.sent,e.next=26,this.buildTheme("webpack.config.epub.js",u);case 26:return e.next=28,this.hugo.ready;case 28:if(e.sent)return e.next=32,pt.copy(gt.join("themes",this.theme,"static","css","epub.css"),gt.join(this.config.publishDir,"css","epub.css"));e.next=62;break;case 32:return s=this.loadBookData(),f=this.config,s.chapters=this.chapters.filter(function(t){return!1!==ht.loadFront(t).epub}).map(function(t){return v.getURLforChapter(t)}),e.next=37,new tt(s,f);case 37:return f=e.sent,e.next=40,f.generate();case 40:return p=e.sent,e.next=43,new w(p,i);case 43:if(l=e.sent,pt.existsSync("html"))return h=void 0!==n?n:gt.join("static","downloads","output"),d=gt.dirname(h),gt.basename(h),e.next=52,pt.ensureDir(d);e.next=62;break;case 52:return p=l.data.cover?gt.join("static","img",l.data.cover.replace("http://localhost:1313/img/","")):"",d="".concat(h,".epub"),this.runPandoc(d,p),i.succeed("Filepath: ".concat(h,".epub")),i.info("Execution Time: ".concat(((jt.now()-o)/1e3).toFixed(3)," seconds")),e.next=59,G(gt.join("site","source.js"));case 59:return e.next=61,G(gt.join("themes",this.theme,"static","source.js"));case 61:return e.abrupt("return",new Promise(function(t){t(!0),v.hugo.kill(),l.removeHTML()}));case 62:e.next=67;break;case 64:return e.prev=64,e.t1=e.catch(20),e.abrupt("return",new Promise(function(t){t(!1),v.hugo.kill(),v.errorExit("".concat(e.t1),i)}));case 67:case"end":return e.stop()}},t,this,[[8,12],[20,64]])})),function(t,e){return i.apply(this,arguments)})},{key:"buildMobi",value:(r=E(j.mark(function t(n,r){var i,o,a,c,u,s,f,l,h,p,d,v,g,y=this;return j.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=_t("Building MOBI").start(),o=jt.now(),this.checkForCommand("pandoc",i),e.next=5,G(gt.join("themes",this.theme,"static","css","epub.css"));case 5:c=["config.yml",gt.join("config","epub.yml")],r&&c.push(gt.join("config","environments","".concat(r,".yml"))),c.forEach(function(t){t=y.loadConfig(t);y.config=ft.merge(y.config,t)}),e.prev=8,a=kt.safeLoad(pt.readFileSync(gt.join("data","publication.yml"),"utf8")),e.next=16;break;case 12:if(e.prev=12,e.t0=e.catch(8),e.t0)return e.abrupt("return",this.errorExit("".concat(e.t0),i));e.next=16;break;case 16:return void 0!==a.title&&""!==a.title&&null!==a.title||this.errorExit("A title for your publication must be specified in the publication.yml file.",i),void 0!==a.language&&""!==a.language&&null!==a.language||this.errorExit("A language for your publication must be specified in the publication.yml file.",i),f=""!==this.getBaseUrl(c)?this.getBaseUrl(c):"/",u=void 0!==f[0]&&" "!==f[0].baseURL&&""!==f[0].baseURL?f[0].baseURL:"/",e.prev=20,e.next=23,this.spawnHugo("server","--renderToDisk","--config="+c.join(","));case 23:return this.hugo=e.sent,e.next=26,this.buildTheme("webpack.config.epub.js",u);case 26:return e.next=28,this.hugo.ready;case 28:if(e.sent)return e.next=32,pt.copy(gt.join("themes",this.theme,"static","css","epub.css"),gt.join(this.config.publishDir,"css","epub.css"));e.next=65;break;case 32:return s=this.loadBookData(),f=this.config,s.chapters=this.chapters.filter(function(t){return!1!==ht.loadFront(t).epub}).map(function(t){return y.getURLforChapter(t)}),e.next=37,new tt(s,f);case 37:return g=e.sent,e.next=40,g.generate();case 40:return v=e.sent,e.next=43,new w(v,i);case 43:if(l=e.sent,pt.existsSync("html"))return h=void 0!==n?n:gt.join("static","downloads","output"),p=gt.dirname(h),d=gt.basename(h),e.next=52,pt.ensureDir(p);e.next=65;break;case 52:return g=l.data.cover?gt.join("static","img",l.data.cover):"",v="".concat(h,"-mobi.epub"),this.runPandoc(v,g),g=V()?"C:\\Program Files (x86)\\Kindle Previewer 3\\lib\\fc\\bin\\kindlegen":"/Applications/Kindle Previewer 3.app/Contents/lib/fc/bin/kindlegen",pt.existsSync(g)||this.errorExit("Warning: Kindle Previewer is required to generate MOBI files. Please visit https://kdp.amazon.com/en_US/help/topic/G202131170 for more info and install instructions.",i),wt('"'.concat(g,'" ').concat(h,"-mobi.epub -o ").concat(d,".mobi")),i.succeed("Filepath: ".concat(p,".mobi")),i.info("Execution Time: ".concat(((jt.now()-o)/1e3).toFixed(3)," seconds")),e.next=62,G(v);case 62:return this.hugo.kill(),l.removeHTML(),e.abrupt("return",new Promise(function(t,e){t(!0)}));case 65:e.next=70;break;case 67:return e.prev=67,e.t1=e.catch(20),e.abrupt("return",new Promise(function(t){t(!1),y.hugo.kill(),y.errorExit("".concat(e.t1),i)}));case 70:case"end":return e.stop()}},t,this,[[8,12],[20,67]])})),function(t,e){return r.apply(this,arguments)})},{key:"checkForCommand",value:function(t,e){W(t)&&this.errorExit("Please install ".concat(t," before continuing."),e)}},{key:"errorExit",value:function(t,e){e.fail(t),process.exit(1)}},{key:"spawnHugo",value:function(){var n,r,i=this,o="",a=yt(vt,Array.prototype.slice.call(arguments));return a.ready=new Promise(function(t,e){r=t,n=e}),a.stdout.on("data",function(t){var e=t.toString(),t=St.cyan(e);i.verbose&&console.log(t),-1<e.indexOf("Press Ctrl+C to stop")&&r(e,a)}),a.stderr.on("data",function(t){o+=t.toString()}),a.on("exit",function(t,e){o&&(i.emit("error",o),n(o,a))}),a}}]),n}(),Pt=require("events"),Ft=require("chalk"),Ot=(require("execa"),require("child_process").execSync,require("path")),At=(require("rimraf"),require("child_process").spawnSync),Lt=require("readline"),It=require("fs-extra"),Mt=function(){function e(){var t;return a(this,e),(t=s(this,f(e).call(this))).on("debug",t.debug),t.on("epub",t.epub),t.on("error",t.warn),t.on("process",t.process),t.on("install",t.install),t.on("mobi",t.mobi),t.on("new",t.create),t.on("pdf",t.pdf),t.on("preview",t.preview),t.once("shutdown",t.shutdown),t.on("site",t.site),t.on("template",t.template),t.isVerbose=!1,t}var n,t,r,i,o;return l(e,Pt),c(e,[{key:"create",value:function(t){var r=this,e=Ot.resolve(__dirname,"..","bin"),i="default",o="default",a=Ot.resolve(e,"starters",i),c=Ot.resolve(e,"themes",o),u=Ot.resolve(t),s=Ot.resolve(t,"themes",o);return new Promise(function(){var n=E(j.mark(function t(e,n){return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!W("git")){t.next=4;break}r.error("Please install Git before continuing."),t.next=29;break;case 4:if(!It.existsSync(u)){t.next=8;break}r.error("".concat(u," directory already exists, please select another project name.")),t.next=29;break;case 8:return r.notice("Creating project..."),r.notice("Using starter: ".concat(i)),t.next=12,U(a,u);case 12:return r.notice("Using theme: ".concat(o)),t.next=15,U(c,s);case 15:return r.notice("Initializing git in the new project directory..."),process.chdir(u),It.mkdirSync(Ot.join(a,"static","img","iiif"),{recursive:!0}),At("git",["init"]),W("git-lfs")?r.warn("Warning: Git LFS (Large File Storage) is required to publish repositories with files over 100 MB to GitHub. See documentation for more info and install instructions: https://quire.getty.edu/documentation/github. This message will not impact initialization of new project directory."):At("git-lfs",["track",'"static/downloads/**/*"','"static/img/**/*"']),r.notice("Committing starter files..."),At("git",["add","-A"]),At("git",["commit","-m","Add starter and theme to project"]),r.notice("Installing dependencies. This may take a minute..."),r.npmInstall(s),r.confirm("Theme and dependencies successfully installed."),r.notice("Run quire preview in your project folder to view changes locally."),e(!0),t.abrupt("return",!0);case 29:case"end":return t.stop()}},t)}));return function(t,e){return n.apply(this,arguments)}}())}},{key:"process",value:function(t){var e=this;this.project=new Et(this.verbose),this.project[t]||(this.error("".concat(t," is not a valid process option.")),this.shutdown()),this.project.on("info",this.notice),this.project.on("error",function(t){e.error(t),e.shutdown()}),this.project[t]()}},{key:"preview",value:function(){var e=this;return new Promise(function(t){e.project=new Et(e.verbose),e.project.on("info",e.notice),e.project.on("error",function(t){e.error(t),e.shutdown()}),e.project.preview(),e.listen(),t(!0)})}},{key:"site",value:(o=E(j.mark(function t(e){var n;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(n=new Et(this.verbose)).on("info",this.notice),n.on("error",this.error),t.prev=3,t.next=6,n.buildWeb(e);case 6:return t.abrupt("return",!0);case 9:return t.prev=9,t.t0=t.catch(3),t.abrupt("return",!1);case 12:case"end":return t.stop()}},t,this,[[3,9]])})),function(t){return o.apply(this,arguments)})},{key:"epub",value:(i=E(j.mark(function t(e,n){var r;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(r=new Et(this.verbose)).on("info",this.notice),r.on("error",this.error),t.prev=3,t.next=6,r.buildEpub(e,n);case 6:return t.abrupt("return",!0);case 9:return t.prev=9,t.t0=t.catch(3),t.abrupt("return",!1);case 12:case"end":return t.stop()}},t,this,[[3,9]])})),function(t,e){return i.apply(this,arguments)})},{key:"template",value:function(t){var e=new Et(this.verbose);e.on("info",this.notice),e.on("error",this.error),e.downloadTemplate(t)}},{key:"mobi",value:(r=E(j.mark(function t(e,n){var r;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(r=new Et(this.verbose)).on("info",this.notice),r.on("error",this.error),t.prev=3,t.next=6,r.buildMobi(e,n);case 6:return t.abrupt("return",!0);case 9:return t.prev=9,t.t0=t.catch(3),t.abrupt("return",!1);case 12:case"end":return t.stop()}},t,this,[[3,9]])})),function(t,e){return r.apply(this,arguments)})},{key:"install",value:(t=E(j.mark(function t(){var e;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(e=new Et(this.verbose)).on("info",this.notice),e.on("error",this.error),t.prev=3,t.next=6,e.install();case 6:return t.abrupt("return",!0);case 9:return t.prev=9,t.t0=t.catch(3),t.abrupt("return",!1);case 12:case"end":return t.stop()}},t,this,[[3,9]])})),function(){return t.apply(this,arguments)})},{key:"pdf",value:(n=E(j.mark(function t(e,n){var r;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(r=new Et(this.verbose)).on("info",this.notice),r.on("error",this.error),t.prev=3,t.next=6,r.buildPDF(e,n);case 6:return t.abrupt("return",!0);case 9:return t.prev=9,t.t0=t.catch(3),t.abrupt("return",!1);case 12:case"end":return t.stop()}},t,this,[[3,9]])})),function(t,e){return n.apply(this,arguments)})},{key:"debug",value:function(){var t=new Et(this.verbose);t.on("info",this.notice),t.on("error",this.error),console.log(t)}},{key:"confirm",value:function(t){console.log(Ft.green(t))}},{key:"error",value:function(t){console.log(Ft.red(t+"Run `quire preview --verbose` for details")),process.exitCode=1}},{key:"notice",value:function(t){console.log(t)}},{key:"npmInstall",value:function(t){var e=V()?"npm.cmd":"npm";t=t||process.cwd(),At(e,["install"],{cwd:t},function(t){t&&this.emit("error",t)})}},{key:"shutdown",value:function(t){this.notice("Shutting down Quire"),this.project&&this.project.hasOwnProperty("hugo")&&this.project.hugo&&this.project.hugo.kill(),this.project&&this.project.hasOwnProperty("webpack")&&this.project.webpack&&this.project.webpack.kill(),t||process.exit(),process.exit()}},{key:"warn",value:function(t){console.log(Ft.yellow(t)),process.exitCode=1}},{key:"listen",value:function(){var e=this,n=Lt.createInterface({input:process.stdin});n.on("line",function(t){t=t.replace("quire ","");"stop"===t?(e.shutdown(),n.close()):console.log(Ft.yellow("No method for: ".concat(t)))})}},{key:"verbose",set:function(t){this.isVerbose=t},get:function(){return this.isVerbose}}]),e}(),Bt=e(function(t){t=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)}),Tt={}.hasOwnProperty,Gt=function(t,e){return Tt.call(t,e)},Wt=!qt(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),$t=e(function(t){t=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=t)}),zt=($t.version,function(t){return"object"==typeof t?null!==t:"function"==typeof t}),Rt=function(t){if(!zt(t))throw TypeError(t+" is not an object!");return t},Ct=Bt.document,Nt=zt(Ct)&&zt(Ct.createElement),Vt=!Wt&&!qt(function(){return 7!=Object.defineProperty(ct("div"),"a",{get:function(){return 7}}).a}),Ht=Object.defineProperty,Yt={f:Wt?Object.defineProperty:function(t,e,n){if(Rt(t),e=Ut(e,!0),Rt(n),Vt)try{return Ht(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},Kt=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},Jt=Wt?function(t,e,n){return Yt.f(t,e,Kt(1,n))}:function(t,e,n){return t[e]=n,t},Zt=0,Xt=Math.random(),Qt=e(function(t){var e="__core-js_shared__",n=Bt[e]||(Bt[e]={});(t.exports=function(t,e){return n[t]||(n[t]=void 0!==e?e:{})})("versions",[]).push({version:$t.version,mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})}),te=Qt("native-function-to-string",Function.toString),ee=e(function(t){var o=Dt("src"),e="toString",a=(""+te).split(e);$t.inspectSource=function(t){return te.call(t)},(t.exports=function(t,e,n,r){var i="function"==typeof n;i&&(Gt(n,"name")||Jt(n,"name",e)),t[e]!==n&&(i&&(Gt(n,o)||Jt(n,o,t[e]?""+t[e]:a.join(String(e)))),t===Bt?t[e]=n:r?t[e]?t[e]=n:Jt(t,e,n):(delete t[e],Jt(t,e,n)))})(Function.prototype,e,function(){return"function"==typeof this&&this[o]||te.call(this)})}),ne=function(r,i,t){if(ut(r),void 0===i)return r;switch(t){case 1:return function(t){return r.call(i,t)};case 2:return function(t,e){return r.call(i,t,e)};case 3:return function(t,e,n){return r.call(i,t,e,n)}}return function(){return r.apply(i,arguments)}},re="prototype",ie=function(t,e,n){var r,i,o,a=t&ie.F,c=t&ie.G,u=t&ie.S,s=t&ie.P,f=t&ie.B,l=c?Bt:u?Bt[e]||(Bt[e]={}):(Bt[e]||{})[re],h=c?$t:$t[e]||($t[e]={}),p=h[re]||(h[re]={});for(r in n=c?e:n)i=((o=!a&&l&&void 0!==l[r])?l:n)[r],o=f&&o?ne(i,Bt):s&&"function"==typeof i?ne(Function.call,i):i,l&&ee(l,r,i,t&ie.U),h[r]!=i&&Jt(h,r,o),s&&p[r]!=i&&(p[r]=i)};Bt.core=$t,ie.F=1,ie.G=2,ie.S=4,ie.P=8,ie.B=16,ie.W=32,ie.U=64,ie.R=128;function oe(t,e,n){t&&!Gt(t=n?t:t.prototype,Se)&&xe(t,Se,{configurable:!0,value:e})}function ae(t){var e=$t.Symbol||($t.Symbol=Bt.Symbol||{});"_"==t.charAt(0)||t in e||ke(e,t,{value:_e.f(t)})}function ce(t){return je.call(t).slice(8,-1)}function ue(t){if(null==t)throw TypeError("Can't call method on "+t);return t}function se(t){return Ee(ue(t))}function fe(t){return isNaN(t=+t)?0:(0<t?Fe:Pe)(t)}function le(t,e){return(t=fe(t))<0?Le(t+e,0):Ie(t,e)}function he(c){return function(t,e,n){var r,i=se(t),o=Ae(i.length),a=le(n,o);if(c&&e!=e){for(;a<o;)if((r=i[a++])!=r)return!0}else for(;a<o;a++)if((c||a in i)&&i[a]===e)return c||a||0;return!c&&-1}}function pe(t,e){var n,r=se(t),i=0,o=[];for(n in r)n!=Re&&Gt(r,n)&&o.push(n);for(;e.length>i;)Gt(r,n=e[i++])&&(~$e(o,n)||o.push(n));return o}function de(t){return Object(ue(t))}function ve(){}function ge(t){var e=gn[t]=Ye(un[ln]);return e._k=t,e}function ye(t,e){Rt(t);for(var n,r=function(t){var e=Ne(t),n=qe.f;if(n)for(var r,i=n(t),o=Ue.f,a=0;i.length>a;)o.call(t,r=i[a++])&&e.push(r);return e}(e=se(e)),i=0,o=r.length;i<o;)kn(t,n=r[i++],e[n]);return t}var me=ie,be=e(function(t){function n(t){e(t,r,{value:{i:"O"+ ++i,w:{}}})}var r=Dt("meta"),e=Yt.f,i=0,o=Object.isExtensible||function(){return!0},a=!qt(function(){return o(Object.preventExtensions({}))}),c=t.exports={KEY:r,NEED:!1,fastKey:function(t,e){if(!zt(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!Gt(t,r)){if(!o(t))return"F";if(!e)return"E";n(t)}return t[r].i},getWeak:function(t,e){if(!Gt(t,r)){if(!o(t))return!0;if(!e)return!1;n(t)}return t[r].w},onFreeze:function(t){return a&&c.NEED&&o(t)&&!Gt(t,r)&&n(t),t}}}),we=(be.KEY,be.NEED,be.fastKey,be.getWeak,be.onFreeze,e(function(t){var e=Qt("wks"),n=Bt.Symbol,r="function"==typeof n;(t.exports=function(t){return e[t]||(e[t]=r&&n[t]||(r?n:Dt)("Symbol."+t))}).store=e})),xe=Yt.f,Se=we("toStringTag"),_e={f:we},ke=Yt.f,je={}.toString,Ee=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==ce(t)?t.split(""):Object(t)},Pe=Math.ceil,Fe=Math.floor,Oe=Math.min,Ae=function(t){return 0<t?Oe(fe(t),9007199254740991):0},Le=Math.max,Ie=Math.min,Me=Qt("keys"),Te=function(t){return Me[t]||(Me[t]=Dt(t))},$e=he(!1),Re=Te("IE_PROTO"),Ce="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Ne=Object.keys||function(t){return pe(t,Ce)},qe={f:Object.getOwnPropertySymbols},Ue={f:{}.propertyIsEnumerable},De=Array.isArray||function(t){return"Array"==ce(t)},Be=Wt?Object.defineProperties:function(t,e){Rt(t);for(var n,r=Ne(e),i=r.length,o=0;o<i;)Yt.f(t,n=r[o++],e[n]);return t},Ge=Bt.document,We=Ge&&Ge.documentElement,ze=Te("IE_PROTO"),Ve="prototype",He=function(){var t=ct("iframe"),e=Ce.length;for(t.style.display="none",We.appendChild(t),t.src="javascript:",(t=t.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),He=t.F;e--;)delete He[Ve][Ce[e]];return He()},Ye=Object.create||function(t,e){var n;return null!==t?(ve[Ve]=Rt(t),n=new ve,ve[Ve]=null,n[ze]=t):n=He(),void 0===e?n:Be(n,e)},Ke=Ce.concat("length","prototype"),Je={f:Object.getOwnPropertyNames||function(t){return pe(t,Ke)}},Ze=Je.f,Xe={}.toString,Qe="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],tn={f:function(t){return Qe&&"[object Window]"==Xe.call(t)?function(t){try{return Ze(t)}catch(t){return Qe.slice()}}(t):Ze(se(t))}},en=Object.getOwnPropertyDescriptor,nn={f:Wt?en:function(t,e){if(t=se(t),e=Ut(e,!0),Vt)try{return en(t,e)}catch(t){}if(Gt(t,e))return Kt(!Ue.f.call(t,e),t[e])}},rn=be.KEY,on=nn.f,an=Yt.f,cn=tn.f,un=Bt.Symbol,sn=Bt.JSON,fn=sn&&sn.stringify,ln="prototype",hn=we("_hidden"),pn=we("toPrimitive"),dn={}.propertyIsEnumerable,vn=Qt("symbol-registry"),gn=Qt("symbols"),yn=Qt("op-symbols"),mn=Object[ln],bn="function"==typeof un&&!!qe.f,wn=Bt.QObject,xn=!wn||!wn[ln]||!wn[ln].findChild,Sn=Wt&&qt(function(){return 7!=Ye(an({},"a",{get:function(){return an(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=on(mn,e);r&&delete mn[e],an(t,e,n),r&&t!==mn&&an(mn,e,r)}:an,_n=bn&&"symbol"==typeof un.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof un},kn=function(t,e,n){return t===mn&&kn(yn,e,n),Rt(t),e=Ut(e,!0),Rt(n),Gt(gn,e)?(n.enumerable?(Gt(t,hn)&&t[hn][e]&&(t[hn][e]=!1),n=Ye(n,{enumerable:Kt(0,!1)})):(Gt(t,hn)||an(t,hn,Kt(1,{})),t[hn][e]=!0),Sn(t,e,n)):an(t,e,n)},jn=function(t){var e=dn.call(this,t=Ut(t,!0));return!(this===mn&&Gt(gn,t)&&!Gt(yn,t))&&(!(e||!Gt(this,t)||!Gt(gn,t)||Gt(this,hn)&&this[hn][t])||e)},p=function(t,e){if(t=se(t),e=Ut(e,!0),t!==mn||!Gt(gn,e)||Gt(yn,e)){var n=on(t,e);return!n||!Gt(gn,e)||Gt(t,hn)&&t[hn][e]||(n.enumerable=!0),n}},Ge=function(t){for(var e,n=cn(se(t)),r=[],i=0;n.length>i;)Gt(gn,e=n[i++])||e==hn||e==rn||r.push(e);return r},wn=function(t){for(var e,n=t===mn,r=cn(n?yn:se(t)),i=[],o=0;r.length>o;)!Gt(gn,e=r[o++])||n&&!Gt(mn,e)||i.push(gn[e]);return i};bn||(ee((un=function(){if(this instanceof un)throw TypeError("Symbol is not a constructor!");var e=Dt(0<arguments.length?arguments[0]:void 0),n=function(t){this===mn&&n.call(yn,t),Gt(this,hn)&&Gt(this[hn],e)&&(this[hn][e]=!1),Sn(this,e,Kt(1,t))};return Wt&&xn&&Sn(mn,e,{configurable:!0,set:n}),ge(e)})[ln],"toString",function(){return this._k}),nn.f=p,Yt.f=kn,Je.f=tn.f=Ge,Ue.f=jn,qe.f=wn,Wt&&ee(mn,"propertyIsEnumerable",jn,!0),_e.f=function(t){return ge(we(t))}),me(me.G+me.W+me.F*!bn,{Symbol:un});for(var En="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),Pn=0;En.length>Pn;)we(En[Pn++]);for(var Fn=Ne(we.store),On=0;Fn.length>On;)ae(Fn[On++]);me(me.S+me.F*!bn,"Symbol",{for:function(t){return Gt(vn,t+="")?vn[t]:vn[t]=un(t)},keyFor:function(t){if(!_n(t))throw TypeError(t+" is not a symbol!");for(var e in vn)if(vn[e]===t)return e},useSetter:function(){xn=!0},useSimple:function(){xn=!1}}),me(me.S+me.F*!bn,"Object",{create:function(t,e){return void 0===e?Ye(t):ye(Ye(t),e)},defineProperty:kn,defineProperties:ye,getOwnPropertyDescriptor:p,getOwnPropertyNames:Ge,getOwnPropertySymbols:wn});jn=qt(function(){qe.f(1)});me(me.S+me.F*jn,"Object",{getOwnPropertySymbols:function(t){return qe.f(de(t))}}),sn&&me(me.S+me.F*(!bn||qt(function(){var t=un();return"[null]"!=fn([t])||"{}"!=fn({a:t})||"{}"!=fn(Object(t))})),"JSON",{stringify:function(t){for(var e,n,r=[t],i=1;i<arguments.length;)r.push(arguments[i++]);if(n=e=r[1],(zt(e)||void 0!==t)&&!_n(t))return De(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!_n(e))return e}),r[1]=e,fn.apply(sn,r)}}),un[ln][pn]||Jt(un[ln],pn,un[ln].valueOf),oe(un,"Symbol"),oe(Math,"Math",!0),oe(Bt.JSON,"JSON",!0),me(me.S,"Object",{create:Ye}),me(me.S+me.F*!Wt,"Object",{defineProperty:Yt.f}),me(me.S+me.F*!Wt,"Object",{defineProperties:Be});var p=function(t,e){var n=($t.Object||{})[t]||Object[t],r={};r[t]=e(n),me(me.S+me.F*qt(function(){n(1)}),"Object",r)},An=nn.f;p("getOwnPropertyDescriptor",function(){return function(t,e){return An(se(t),e)}});var Ln=Te("IE_PROTO"),In=Object.prototype,Mn=Object.getPrototypeOf||function(t){return t=de(t),Gt(t,Ln)?t[Ln]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?In:null};p("getPrototypeOf",function(){return function(t){return Mn(de(t))}}),p("keys",function(){return function(t){return Ne(de(t))}}),p("getOwnPropertyNames",function(){return tn.f});var Tn=be.onFreeze;p("freeze",function(e){return function(t){return e&&zt(t)?e(Tn(t)):t}});var $n=be.onFreeze;p("seal",function(e){return function(t){return e&&zt(t)?e($n(t)):t}});var Rn=be.onFreeze;p("preventExtensions",function(e){return function(t){return e&&zt(t)?e(Rn(t)):t}}),p("isFrozen",function(e){return function(t){return!zt(t)||!!e&&e(t)}}),p("isSealed",function(e){return function(t){return!zt(t)||!!e&&e(t)}}),p("isExtensible",function(e){return function(t){return!!zt(t)&&(!e||e(t))}});var Cn=Object.assign,Nn=!Cn||qt(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=Cn({},t)[n]||Object.keys(Cn({},e)).join("")!=r})?function(t,e){for(var n=de(t),r=arguments.length,i=1,o=qe.f,a=Ue.f;i<r;)for(var c,u=Ee(arguments[i++]),s=o?Ne(u).concat(o(u)):Ne(u),f=s.length,l=0;l<f;)c=s[l++],Wt&&!a.call(u,c)||(n[c]=u[c]);return n}:Cn;me(me.S+me.F,"Object",{assign:Nn});var qn=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e};me(me.S,"Object",{is:qn});function Un(t,e){if(Rt(t),!zt(e)&&null!==e)throw TypeError(e+": can't set as prototype!")}var Dn={set:Object.setPrototypeOf||("__proto__"in{}?function(t,n,r){try{(r=ne(Function.call,nn.f(Object.prototype,"__proto__").set,2))(t,[]),n=!(t instanceof Array)}catch(t){n=!0}return function(t,e){return Un(t,e),n?t.__proto__=e:r(t,e),t}}({},!1):void 0),check:Un};me(me.S,"Object",{setPrototypeOf:Dn.set});function Bn(t){var e;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(t=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),Gn))?t:Wn?ce(e):"Object"==(t=ce(e))&&"function"==typeof e.callee?"Arguments":t}var Gn=we("toStringTag"),Wn="Arguments"==ce(function(){return arguments}()),Ge={};Ge[we("toStringTag")]="z",Ge+""!="[object z]"&&ee(Object.prototype,"toString",function(){return"[object "+Bn(this)+"]"},!0);function zn(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}var Vn=[].slice,Hn={},Yn=Function.bind||function(e){var n=ut(this),r=Vn.call(arguments,1),i=function(){var t=r.concat(Vn.call(arguments));return this instanceof i?function(t,e,n){if(!(e in Hn)){for(var r=[],i=0;i<e;i++)r[i]="a["+i+"]";Hn[e]=Function("F,a","return new F("+r.join(",")+")")}return Hn[e](t,n)}(n,t.length,t):zn(n,t,e)};return zt(n.prototype)&&(i.prototype=n.prototype),i};me(me.P,"Function",{bind:Yn});var wn=Yt.f,jn=Function.prototype,Kn=/^\s*function ([^ (]*)/;"name"in jn||Wt&&wn(jn,"name",{configurable:!0,get:function(){try{return(""+this).match(Kn)[1]}catch(t){return""}}});bn=we("hasInstance"),pn=Function.prototype;bn in pn||Yt.f(pn,bn,{value:function(t){if("function"!=typeof this||!zt(t))return!1;if(!zt(this.prototype))return t instanceof this;for(;t=Mn(t);)if(this.prototype===t)return!0;return!1}});var Jn="\t\n\v\f\r \u2028\u2029\ufeff",Te="["+Jn+"]",Zn=RegExp("^"+Te+Te+"*"),Xn=RegExp(Te+Te+"*$"),p=function(t,e,n){var r={},i=qt(function(){return Jn[t]()||"
"!="
"[t]()}),e=r[t]=i?e(Qn):Jn[t];n&&(r[n]=e),me(me.P+me.F*i,"String",r)},Qn=p.trim=function(t,e){return t=String(ue(t)),1&e&&(t=t.replace(Zn,"")),t=2&e?t.replace(Xn,""):t},Ge=p,tr=Bt.parseInt,er=Ge.trim,nr=/^[-+]?0[xX]/,wn=8!==tr(Jn+"08")||22!==tr(Jn+"0x16")?function(t,e){t=er(String(t),3);return tr(t,e>>>0||(nr.test(t)?16:10))}:tr;me(me.G+me.F*(parseInt!=wn),{parseInt:wn});var rr=Bt.parseFloat,ir=Ge.trim,jn=1/rr(Jn+"-0")!=-1/0?function(t){var e=ir(String(t),3),t=rr(e);return 0===t&&"-"==e.charAt(0)?-0:t}:rr;me(me.G+me.F*(parseFloat!=jn),{parseFloat:jn});function or(t,e,n){var r;return(e=e.constructor)!==n&&"function"==typeof e&&(r=e.prototype)!==n.prototype&&zt(r)&&cr&&cr(t,r),t}function ar(t){var e=Ut(t,!1);if("string"==typeof e&&2<e.length){var n,r,i=(e=gr?e.trim():fr(e,3)).charCodeAt(0);if(43===i||45===i){if(88===(t=e.charCodeAt(2))||120===t)return NaN}else if(48===i){switch(e.charCodeAt(1)){case 66:case 98:n=2,r=49;break;case 79:case 111:n=8,r=55;break;default:return+e}for(var o,a=e.slice(2),c=0,u=a.length;c<u;c++)if((o=a.charCodeAt(c))<48||r<o)return NaN;return parseInt(a,n)}}return+e}var cr=Dn.set,pn=Je.f,ur=nn.f,sr=Yt.f,fr=Ge.trim,lr="Number",hr=Bt[lr],pr=hr,dr=hr.prototype,vr=ce(Ye(dr))==lr,gr="trim"in String.prototype;if(!hr(" 0o1")||!hr("0b1")||hr("+0x1")){hr=function(t){var t=arguments.length<1?0:t,e=this;return e instanceof hr&&(vr?qt(function(){dr.valueOf.call(e)}):ce(e)!=lr)?or(new pr(ar(t)),e,hr):ar(t)};for(var yr,mr=Wt?pn(pr):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),br=0;mr.length>br;br++)Gt(pr,yr=mr[br])&&!Gt(hr,yr)&&sr(hr,yr,ur(pr,yr));(hr.prototype=dr).constructor=hr,ee(Bt,lr,hr)}function wr(t,e){if("number"!=typeof t&&"Number"!=ce(t))throw TypeError(e);return+t}function xr(t){var e=String(ue(this)),n="",r=fe(t);if(r<0||r==1/0)throw RangeError("Count can't be negative");for(;0<r;(r>>>=1)&&(e+=e))1&r&&(n+=e);return n}function Sr(t,e){for(var n=-1,r=e;++n<6;)r+=t*Pr[n],Pr[n]=r%1e7,r=Er(r/1e7)}function _r(t){for(var e=6,n=0;0<=--e;)n+=Pr[e],Pr[e]=Er(n/t),n=n%t*1e7}function kr(){for(var t,e=6,n="";0<=--e;)""===n&&0!==e&&0===Pr[e]||(t=String(Pr[e]),n=""===n?t:n+xr.call("0",7-t.length)+t);return n}var jr=1..toFixed,Er=Math.floor,Pr=[0,0,0,0,0,0],Fr="Number.toFixed: incorrect invocation!",Or=function(t,e,n){return 0===e?n:e%2==1?Or(t,e-1,n*t):Or(t*t,e/2,n)};me(me.P+me.F*(!!jr&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==0xde0b6b3a7640080.toFixed(0))||!qt(function(){jr.call({})})),"Number",{toFixed:function(t){var e,n,r=wr(this,Fr),i=fe(t),o="",t="0";if(i<0||20<i)throw RangeError(Fr);if(r!=r)return"NaN";if(r<=-1e21||1e21<=r)return String(r);if(r<0&&(o="-",r=-r),1e-21<r)if(r=(n=function(t){for(var e=0,n=t;4096<=n;)e+=12,n/=4096;for(;2<=n;)e+=1,n/=2;return e}(r*Or(2,69,1))-69)<0?r*Or(2,-n,1):r/Or(2,n,1),r*=4503599627370496,0<(n=52-n)){for(Sr(0,r),e=i;7<=e;)Sr(1e7,0),e-=7;for(Sr(Or(10,e,1),0),e=n-1;23<=e;)_r(1<<23),e-=23;_r(1<<e),Sr(1,1),_r(2),t=kr()}else Sr(0,r),Sr(1<<-n,0),t=kr()+xr.call("0",i);return t=0<i?o+((n=t.length)<=i?"0."+xr.call("0",i-n)+t:t.slice(0,n-i)+"."+t.slice(n-i)):o+t}});var Ar=1..toPrecision;me(me.P+me.F*(qt(function(){return"1"!==Ar.call(1,void 0)})||!qt(function(){Ar.call({})})),"Number",{toPrecision:function(t){var e=wr(this,"Number#toPrecision: incorrect invocation!");return void 0===t?Ar.call(e):Ar.call(e,t)}}),me(me.S,"Number",{EPSILON:Math.pow(2,-52)});var Lr=Bt.isFinite;me(me.S,"Number",{isFinite:function(t){return"number"==typeof t&&Lr(t)}});function Ir(t){return!zt(t)&&isFinite(t)&&Mr(t)===t}var Mr=Math.floor;me(me.S,"Number",{isInteger:Ir}),me(me.S,"Number",{isNaN:function(t){return t!=t}});var Tr=Math.abs;me(me.S,"Number",{isSafeInteger:function(t){return Ir(t)&&Tr(t)<=9007199254740991}}),me(me.S,"Number",{MAX_SAFE_INTEGER:9007199254740991}),me(me.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991}),me(me.S+me.F*(Number.parseFloat!=jn),"Number",{parseFloat:jn}),me(me.S+me.F*(Number.parseInt!=wn),"Number",{parseInt:wn});var $r=Math.log1p||function(t){return-1e-8<(t=+t)&&t<1e-8?t-t*t/2:Math.log(1+t)},Rr=Math.sqrt,bn=Math.acosh;me(me.S+me.F*!(bn&&710==Math.floor(bn(Number.MAX_VALUE))&&bn(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:94906265.62425156<t?Math.log(t)+Math.LN2:$r(t-1+Rr(t-1)*Rr(t+1))}});Te=Math.asinh;me(me.S+me.F*!(Te&&0<1/Te(0)),"Math",{asinh:function t(e){return isFinite(e=+e)&&0!=e?e<0?-t(-e):Math.log(e+Math.sqrt(e*e+1)):e}});p=Math.atanh;me(me.S+me.F*!(p&&1/p(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}});var Cr=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1};me(me.S,"Math",{cbrt:function(t){return Cr(t=+t)*Math.pow(Math.abs(t),1/3)}}),me(me.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}});var Nr=Math.exp;me(me.S,"Math",{cosh:function(t){return(Nr(t=+t)+Nr(-t))/2}});var pn=Math.expm1,qr=!pn||22025.465794806718<pn(10)||pn(10)<22025.465794806718||-2e-17!=pn(-2e-17)?function(t){return 0==(t=+t)?t:-1e-6<t&&t<1e-6?t+t*t/2:Math.exp(t)-1}:pn;me(me.S+me.F*(qr!=Math.expm1),"Math",{expm1:qr});var jn=Math.pow,Ur=jn(2,-52),Dr=jn(2,-23),Br=jn(2,127)*(2-Dr),Gr=jn(2,-126),wn=Math.fround||function(t){var e=Math.abs(t),n=Cr(t);return e<Gr?n*(e/Gr/Dr+1/Ur-1/Ur)*Gr*Dr:Br<(e=(t=(1+Dr/Ur)*e)-(t-e))||e!=e?n*(1/0):n*e};me(me.S,"Math",{fround:wn});var Wr=Math.abs;me(me.S,"Math",{hypot:function(t,e){for(var n,r,i=0,o=0,a=arguments.length,c=0;o<a;)c<(n=Wr(arguments[o++]))?(i=i*(r=c/n)*r+1,c=n):i+=0<n?(r=n/c)*r:n;return c===1/0?1/0:c*Math.sqrt(i)}});var zr=Math.imul;me(me.S+me.F*qt(function(){return-5!=zr(4294967295,5)||2!=zr.length}),"Math",{imul:function(t,e){var n=65535,r=+t,i=+e,t=n&r,e=n&i;return 0|t*e+((n&r>>>16)*e+t*(n&i>>>16)<<16>>>0)}}),me(me.S,"Math",{log10:function(t){return Math.log(t)*Math.LOG10E}}),me(me.S,"Math",{log1p:$r}),me(me.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}}),me(me.S,"Math",{sign:Cr});var Vr=Math.exp;me(me.S+me.F*qt(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(qr(t)-qr(-t))/2:(Vr(t-1)-Vr(-t-1))*(Math.E/2)}});var Hr=Math.exp;me(me.S,"Math",{tanh:function(t){var e=qr(t=+t),n=qr(-t);return e==1/0?1:n==1/0?-1:(e-n)/(Hr(t)+Hr(-t))}}),me(me.S,"Math",{trunc:function(t){return(0<t?Math.floor:Math.ceil)(t)}});var Yr=String.fromCharCode,bn=String.fromCodePoint;me(me.S+me.F*(!!bn&&1!=bn.length),"String",{fromCodePoint:function(t){for(var e,n=[],r=arguments.length,i=0;i<r;){if(e=+arguments[i++],le(e,1114111)!==e)throw RangeError(e+" is not a valid code point");n.push(e<65536?Yr(e):Yr(55296+((e-=65536)>>10),e%1024+56320))}return n.join("")}}),me(me.S,"String",{raw:function(t){for(var e=se(t.raw),n=Ae(e.length),r=arguments.length,i=[],o=0;o<n;)i.push(String(e[o++])),o<r&&i.push(String(arguments[o]));return i.join("")}}),Ge("trim",function(t){return function(){return t(this,3)}});var Te=function(o){return function(t,e){var n,r=String(ue(t)),i=fe(e),t=r.length;return i<0||t<=i?o?"":void 0:(e=r.charCodeAt(i))<55296||56319<e||i+1===t||(n=r.charCodeAt(i+1))<56320||57343<n?o?r.charAt(i):e:o?r.slice(i,i+2):n-56320+(e-55296<<10)+65536}},Kr={},Jr={};Jt(Jr,we("iterator"),function(){return this});function Zr(t,e,n){t.prototype=Ye(Jr,{next:Kt(1,n)}),oe(t,e+" Iterator")}function Xr(){return this}function Qr(t,e,n,r,i,o,a){function c(t){if(!ei&&t in d)return d[t];switch(t){case"keys":case ni:return function(){return new n(this,t)}}return function(){return new n(this,t)}}Zr(n,e,r);var u,s,f,l=e+" Iterator",h=i==ni,p=!1,d=t.prototype,v=d[ti]||d["@@iterator"]||i&&d[i],g=v||c(i),y=i?h?c("entries"):g:void 0;if((r="Array"==e&&d.entries||v)&&(f=Mn(r.call(new t)))!==Object.prototype&&f.next&&(oe(f,l,!0),"function"!=typeof f[ti]&&Jt(f,ti,Xr)),h&&v&&v.name!==ni&&(p=!0,g=function(){return v.call(this)}),!ei&&!p&&d[ti]||Jt(d,ti,g),Kr[e]=g,Kr[l]=Xr,i)if(u={values:h?g:c(ni),keys:o?g:c("keys"),entries:y},a)for(s in u)s in d||ee(d,s,u[s]);else me(me.P+me.F*(ei||p),e,u);return u}var ti=we("iterator"),ei=!([].keys&&"next"in[].keys()),ni="values",ri=Te(!0);Qr(String,"String",function(t){this._t=String(t),this._i=0},function(){var t=this._t,e=this._i;return e>=t.length?{value:void 0,done:!0}:(e=ri(t,e),this._i+=e.length,{value:e,done:!1})});var ii=Te(!1);me(me.P,"String",{codePointAt:function(t){return ii(this,t)}});function oi(t){var e;return zt(t)&&(void 0!==(e=t[ci])?!!e:"RegExp"==ce(t))}function ai(t,e,n){if(oi(e))throw TypeError("String#"+n+" doesn't accept regex!");return String(ue(t))}var ci=we("match"),ui=we("match"),p=function(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[ui]=!1,!"/./"[e](n)}catch(t){}}return!0},si="endsWith",fi=""[si];me(me.P+me.F*p(si),"String",{endsWith:function(t){var e=ai(this,t,si),n=1<arguments.length?arguments[1]:void 0,r=Ae(e.length),r=void 0===n?r:Math.min(Ae(n),r),t=String(t);return fi?fi.call(e,t,r):e.slice(r-t.length,r)===t}});var li="includes";me(me.P+me.F*p(li),"String",{includes:function(t){return!!~ai(this,t,li).indexOf(t,1<arguments.length?arguments[1]:void 0)}}),me(me.P,"String",{repeat:xr});var hi="startsWith",pi=""[hi];me(me.P+me.F*p(hi),"String",{startsWith:function(t){var e=ai(this,t,hi),n=Ae(Math.min(1<arguments.length?arguments[1]:void 0,e.length)),t=String(t);return pi?pi.call(e,t,n):e.slice(n,n+t.length)===t}});function di(t,e,n,r){var i=String(ue(t)),t="<"+e;return""!==n&&(t+=" "+n+'="'+String(r).replace(vi,""")+'"'),t+">"+i+"</"+e+">"}var vi=/"/g,pn=function(e,t){var n={};n[e]=t(di),me(me.P+me.F*qt(function(){var t=""[e]('"');return t!==t.toLowerCase()||3<t.split('"').length}),"String",n)};pn("anchor",function(e){return function(t){return e(this,"a","name",t)}}),pn("big",function(t){return function(){return t(this,"big","","")}}),pn("blink",function(t){return function(){return t(this,"blink","","")}}),pn("bold",function(t){return function(){return t(this,"b","","")}}),pn("fixed",function(t){return function(){return t(this,"tt","","")}}),pn("fontcolor",function(e){return function(t){return e(this,"font","color",t)}}),pn("fontsize",function(e){return function(t){return e(this,"font","size",t)}}),pn("italics",function(t){return function(){return t(this,"i","","")}}),pn("link",function(e){return function(t){return e(this,"a","href",t)}}),pn("small",function(t){return function(){return t(this,"small","","")}}),pn("strike",function(t){return function(){return t(this,"strike","","")}}),pn("sub",function(t){return function(){return t(this,"sub","","")}}),pn("sup",function(t){return function(){return t(this,"sup","","")}}),me(me.S,"Date",{now:function(){return(new Date).getTime()}}),me(me.P+me.F*qt(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}),"Date",{toJSON:function(t){var e=de(this),n=Ut(e);return"number"!=typeof n||isFinite(n)?e.toISOString():null}});function gi(t){return 9<t?t:"0"+t}var yi=Date.prototype.getTime,mi=Date.prototype.toISOString,jn=qt(function(){return"0385-07-25T07:06:39.999Z"!=mi.call(new Date(-5e13-1))})||!qt(function(){mi.call(new Date(NaN))})?function(){if(!isFinite(yi.call(this)))throw RangeError("Invalid time value");var t=this,e=t.getUTCFullYear(),n=t.getUTCMilliseconds(),r=e<0?"-":9999<e?"+":"";return r+("00000"+Math.abs(e)).slice(r?-6:-4)+"-"+gi(t.getUTCMonth()+1)+"-"+gi(t.getUTCDate())+"T"+gi(t.getUTCHours())+":"+gi(t.getUTCMinutes())+":"+gi(t.getUTCSeconds())+"."+(99<n?n:"0"+gi(n))+"Z"}:mi;me(me.P+me.F*(Date.prototype.toISOString!==jn),"Date",{toISOString:jn});var wn=Date.prototype,bi="Invalid Date",bn="toString",wi=wn[bn],xi=wn.getTime;new Date(NaN)+""!=bi&&ee(wn,bn,function(){var t=xi.call(this);return t==t?wi.call(this):bi});p=we("toPrimitive"),pn=Date.prototype;p in pn||Jt(pn,p,function(t){if("string"!==t&&"number"!==t&&"default"!==t)throw TypeError("Incorrect hint");return Ut(Rt(this),"number"!=t)}),me(me.S,"Array",{isArray:De});function Si(e,t,n,r){try{return r?t(Rt(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&Rt(i.call(e)),t}}function _i(t){return void 0!==t&&(Kr.Array===t||Ei[ji]===t)}function ki(t,e,n){e in t?Yt.f(t,e,Kt(0,n)):t[e]=n}var ji=we("iterator"),Ei=Array.prototype,Pi=we("iterator"),Fi=$t.getIteratorMethod=function(t){if(null!=t)return t[Pi]||t["@@iterator"]||Kr[Bn(t)]},Oi=we("iterator"),Ai=!1;try{var Li=[7][Oi]();Li.return=function(){Ai=!0},Array.from(Li,function(){throw 2})}catch(t){}function Ii(t,e){if(!e&&!Ai)return!1;var n=!1;try{var r=[7],i=r[Oi]();i.next=function(){return{done:n=!0}},r[Oi]=function(){return i},t(r)}catch(t){}return n}me(me.S+me.F*!Ii(function(t){Array.from(t)}),"Array",{from:function(t){var e,n,r,i,o=de(t),a="function"==typeof this?this:Array,c=arguments.length,u=1<c?arguments[1]:void 0,s=void 0!==u,f=0,t=Fi(o);if(s&&(u=ne(u,2<c?arguments[2]:void 0,2)),null==t||a==Array&&_i(t))for(n=new a(e=Ae(o.length));f<e;f++)ki(n,f,s?u(o[f],f):o[f]);else for(i=t.call(o),n=new a;!(r=i.next()).done;f++)ki(n,f,s?Si(i,u,[r.value,f],!0):r.value);return n.length=f,n}}),me(me.S+me.F*qt(function(){function t(){}return!(Array.of.call(t)instanceof t)}),"Array",{of:function(){for(var t=0,e=arguments.length,n=new("function"==typeof this?this:Array)(e);t<e;)ki(n,t,arguments[t++]);return n.length=e,n}});var jn=function(t,e){return!!t&&qt(function(){e?t.call(null,function(){},1):t.call(null)})},Mi=[].join;me(me.P+me.F*(Ee!=Object||!jn(Mi)),"Array",{join:function(t){return Mi.call(se(this),void 0===t?",":t)}});var Ti=[].slice;me(me.P+me.F*qt(function(){We&&Ti.call(We)}),"Array",{slice:function(t,e){var n=Ae(this.length),r=ce(this);if(e=void 0===e?n:e,"Array"==r)return Ti.call(this,t,e);for(var i=le(t,n),n=le(e,n),o=Ae(n-i),a=new Array(o),c=0;c<o;c++)a[c]="String"==r?this.charAt(i+c):this[i+c];return a}});var $i=[].sort,Ri=[1,2,3];me(me.P+me.F*(qt(function(){Ri.sort(void 0)})||!qt(function(){Ri.sort(null)})||!jn($i)),"Array",{sort:function(t){return void 0===t?$i.call(de(this)):$i.call(de(this),ut(t))}});function Ci(t,e){return De(t=t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!De(n.prototype)||(n=void 0),zt(n)&&null===(n=n[qi])&&(n=void 0)),new(void 0===n?Array:n)(e);var n}function Ni(l,t){var h=1==l,p=2==l,d=3==l,v=4==l,g=6==l,y=5==l||g,m=t||Ci;return function(t,e,n){for(var r,i,o=de(t),a=Ee(o),c=ne(e,n,3),u=Ae(a.length),s=0,f=h?m(t,u):p?m(t,0):void 0;s<u;s++)if((y||s in a)&&(i=c(r=a[s],s,o),l))if(h)f[s]=i;else if(i)switch(l){case 3:return!0;case 5:return r;case 6:return s;case 2:f.push(r)}else if(v)return!1;return g?-1:d||v?v:f}}var qi=we("species"),Ui=Ni(0),wn=jn([].forEach,!0);me(me.P+me.F*!wn,"Array",{forEach:function(t){return Ui(this,t,arguments[1])}});var Di=Ni(1);me(me.P+me.F*!jn([].map,!0),"Array",{map:function(t){return Di(this,t,arguments[1])}});var Bi=Ni(2);me(me.P+me.F*!jn([].filter,!0),"Array",{filter:function(t){return Bi(this,t,arguments[1])}});var Gi=Ni(3);me(me.P+me.F*!jn([].some,!0),"Array",{some:function(t){return Gi(this,t,arguments[1])}});var Wi=Ni(4);me(me.P+me.F*!jn([].every,!0),"Array",{every:function(t){return Wi(this,t,arguments[1])}});function zi(t,e,n,r,i){ut(e);var o=de(t),a=Ee(o),c=Ae(o.length),u=i?c-1:0,s=i?-1:1;if(n<2)for(;;){if(u in a){r=a[u],u+=s;break}if(u+=s,i?u<0:c<=u)throw TypeError("Reduce of empty array with no initial value")}for(;i?0<=u:u<c;u+=s)u in a&&(r=e(r,a[u],u,o));return r}me(me.P+me.F*!jn([].reduce,!0),"Array",{reduce:function(t){return zi(this,t,arguments.length,arguments[1],!1)}}),me(me.P+me.F*!jn([].reduceRight,!0),"Array",{reduceRight:function(t){return zi(this,t,arguments.length,arguments[1],!0)}});var Vi=he(!1),Hi=[].indexOf,Yi=!!Hi&&1/[1].indexOf(1,-0)<0;me(me.P+me.F*(Yi||!jn(Hi)),"Array",{indexOf:function(t){return Yi?Hi.apply(this,arguments)||0:Vi(this,t,arguments[1])}});var Ki=[].lastIndexOf,Ji=!!Ki&&1/[1].lastIndexOf(1,-0)<0;me(me.P+me.F*(Ji||!jn(Ki)),"Array",{lastIndexOf:function(t){if(Ji)return Ki.apply(this,arguments)||0;var e=se(this),n=Ae(e.length),r=n-1;for((r=1<arguments.length?Math.min(r,fe(arguments[1])):r)<0&&(r=n+r);0<=r;r--)if(r in e&&e[r]===t)return r||0;return-1}});var Zi=[].copyWithin||function(t,e){var n=de(this),r=Ae(n.length),i=le(t,r),o=le(e,r),e=2<arguments.length?arguments[2]:void 0,a=Math.min((void 0===e?r:le(e,r))-o,r-i),c=1;for(o<i&&i<o+a&&(c=-1,o+=a-1,i+=a-1);0<a--;)o in n?n[i]=n[o]:delete n[i],i+=c,o+=c;return n},Xi=we("unscopables"),Qi=Array.prototype;null==Qi[Xi]&&Jt(Qi,Xi,{});bn=function(t){Qi[Xi][t]=!0};me(me.P,"Array",{copyWithin:Zi}),bn("copyWithin");function to(t){for(var e=de(this),n=Ae(e.length),r=arguments.length,i=le(1<r?arguments[1]:void 0,n),o=void 0===(r=2<r?arguments[2]:void 0)?n:le(r,n);i<o;)e[i++]=t;return e}me(me.P,"Array",{fill:to}),bn("fill");var eo=Ni(5),pn="find",no=!0;pn in[]&&Array(1)[pn](function(){no=!1}),me(me.P+me.F*no,"Array",{find:function(t){return eo(this,t,1<arguments.length?arguments[1]:void 0)}}),bn(pn);var ro=Ni(6),p="findIndex",io=!0;p in[]&&Array(1)[p](function(){io=!1}),me(me.P+me.F*io,"Array",{findIndex:function(t){return ro(this,t,1<arguments.length?arguments[1]:void 0)}}),bn(p);function oo(t){t=Bt[t],Wt&&t&&!t[ao]&&Yt.f(t,ao,{configurable:!0,get:function(){return this}})}var ao=we("species");oo("Array");function co(t,e){return{value:e,done:!!t}}var uo=Qr(Array,"Array",function(t,e){this._t=se(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,co(1)):co(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values");Kr.Arguments=Kr.Array,bn("keys"),bn("values"),bn("entries");function so(){var t=Rt(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}var fo=Yt.f,wn=Je.f,lo=Bt.RegExp,ho=lo,po=lo.prototype,vo=/a/g,go=/a/g,yo=new lo(vo)!==vo;if(Wt&&(!yo||qt(function(){return go[we("match")]=!1,lo(vo)!=vo||lo(go)==go||"/a/i"!=lo(vo,"i")}))){lo=function(t,e){var n=this instanceof lo,r=oi(t),i=void 0===e;return!n&&r&&t.constructor===lo&&i?t:or(yo?new ho(r&&!i?t.source:t,e):ho((r=t instanceof lo)?t.source:t,r&&i?so.call(t):e),n?this:po,lo)};for(var mo=wn(ho),bo=0;mo.length>bo;)!function(e){e in lo||fo(lo,e,{configurable:!0,get:function(){return ho[e]},set:function(t){ho[e]=t}})}(mo[bo++]);(po.constructor=lo).prototype=po,ee(Bt,"RegExp",lo)}oo("RegExp");var wo=RegExp.prototype.exec,xo=String.prototype.replace,jn=wo,So="lastIndex",_o=(pn=/a/,p=/b*/g,wo.call(pn,"a"),wo.call(p,"a"),0!==pn[So]||0!==p[So]),ko=void 0!==/()??/.exec("")[1],jo=jn=_o||ko?function(t){var e,n,r,i,o=this;return ko&&(n=new RegExp("^"+o.source+"$(?!\\s)",so.call(o))),_o&&(e=o[So]),r=wo.call(o,t),_o&&r&&(o[So]=o.global?r.index+r[0].length:e),ko&&r&&1<r.length&&xo.call(r[0],n,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)}),r}:jn;me({target:"RegExp",proto:!0,forced:jo!==/./.exec},{exec:jo}),Wt&&"g"!=/./g.flags&&Yt.f(RegExp.prototype,"flags",{configurable:!0,get:so});var Eo="toString",Po=/./[Eo],wn=function(t){ee(RegExp.prototype,Eo,t,!0)};qt(function(){return"/a/b"!=Po.call({source:"a",flags:"b"})})?wn(function(){var t=Rt(this);return"/".concat(t.source,"/","flags"in t?t.flags:!Wt&&t instanceof RegExp?so.call(t):void 0)}):Po.name!=Eo&&wn(function(){return Po.call(this)});function Fo(t,e,n){return e+(n?Ao(t,e).length:1)}function Oo(t,e){var n=t.exec;if("function"==typeof n){n=n.call(t,e);if("object"!=typeof n)throw new TypeError("RegExp exec method returned something other than an Object or null");return n}if("RegExp"!==Bn(t))throw new TypeError("RegExp#exec called on incompatible receiver");return Lo.call(t,e)}var Ao=Te(!0),Lo=RegExp.prototype.exec,Io=we("species"),Mo=!qt(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),To=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};t="ab".split(t);return 2===t.length&&"a"===t[0]&&"b"===t[1]}(),pn=function(n,t,e){var o,r,i=we(n),a=!qt(function(){var t={};return t[i]=function(){return 7},7!=""[n](t)}),c=a?!qt(function(){var t=!1,e=/a/;return e.exec=function(){return t=!0,null},"split"===n&&(e.constructor={},e.constructor[Io]=function(){return e}),e[i](""),!t}):void 0;a&&c&&("replace"!==n||Mo)&&("split"!==n||To)||(o=/./[i],e=(c=e(ue,i,""[n],function(t,e,n,r,i){return e.exec===jo?a&&!i?{done:!0,value:o.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}))[0],r=c[1],ee(String.prototype,n,e),Jt(RegExp.prototype,i,2==t?function(t,e){return r.call(t,this,e)}:function(t){return r.call(t,this)}))};pn("match",1,function(r,i,u,s){return[function(t){var e=r(this),n=null==t?void 0:t[i];return void 0!==n?n.call(t,e):new RegExp(t)[i](String(e))},function(t){var e=s(u,t,this);if(e.done)return e.value;var n=Rt(t),r=String(this);if(!n.global)return Oo(n,r);for(var i=n.unicode,o=[],a=n.lastIndex=0;null!==(c=Oo(n,r));){var c=String(c[0]);""===(o[a]=c)&&(n.lastIndex=Fo(r,Ae(n.lastIndex),i)),a++}return 0===a?null:o}]});var $o=Math.max,Ro=Math.min,Co=Math.floor,No=/\$([$&`']|\d\d?|<[^>]*>)/g,qo=/\$([$&`']|\d\d?)/g;pn("replace",2,function(i,o,w,x){return[function(t,e){var n=i(this),r=null==t?void 0:t[o];return void 0!==r?r.call(t,n,e):w.call(String(n),t,e)},function(t,e){var n=x(w,t,this,e);if(n.done)return n.value;var r=Rt(t),i=String(this),o="function"==typeof e;o||(e=String(e));var a,c=r.global;c&&(a=r.unicode,r.lastIndex=0);for(var u=[];;){var s=Oo(r,i);if(null===s)break;if(u.push(s),!c)break;""===String(s[0])&&(r.lastIndex=Fo(i,Ae(r.lastIndex),a))}for(var f,l="",h=0,p=0;p<u.length;p++){s=u[p];for(var d=String(s[0]),v=$o(Ro(fe(s.index),i.length),0),g=[],y=1;y<s.length;y++)g.push(void 0===(f=s[y])?f:String(f));var m,b=s.groups,b=o?(m=[d].concat(g,v,i),void 0!==b&&m.push(b),String(e.apply(void 0,m))):function(o,a,c,u,s,t){var f=c+o.length,l=u.length,e=qo;void 0!==s&&(s=de(s),e=No);return w.call(t,e,function(t,e){var n;switch(e.charAt(0)){case"$":return"$";case"&":return o;case"`":return a.slice(0,c);case"'":return a.slice(f);case"<":n=s[e.slice(1,-1)];break;default:var r=+e;if(0==r)return t;if(l<r){var i=Co(r/10);return 0===i?t:i<=l?void 0===u[i-1]?e.charAt(1):u[i-1]+e.charAt(1):t}n=u[r-1]}return void 0===n?"":n})}(d,i,v,g,b,e);h<=v&&(l+=i.slice(h,v)+b,h=v+d.length)}return l+i.slice(h)}]}),pn("search",1,function(r,i,o,a){return[function(t){var e=r(this),n=null==t?void 0:t[i];return void 0!==n?n.call(t,e):new RegExp(t)[i](String(e))},function(t){var e=a(o,t,this);if(e.done)return e.value;var n=Rt(t),e=String(this),t=n.lastIndex;qn(t,0)||(n.lastIndex=0);e=Oo(n,e);return qn(n.lastIndex,t)||(n.lastIndex=t),null===e?-1:e.index}]});function Uo(t,e){var n;return void 0===(t=Rt(t).constructor)||null==(n=Rt(t)[Do])?e:ut(n)}var Do=we("species"),Bo=Math.min,Go=[].push,Wo="split",zo="length",Vo="lastIndex",Ho=4294967295,Yo=!qt(function(){RegExp(Ho,"y")});pn("split",2,function(i,o,d,v){var g="c"=="abbc"[Wo](/(b)*/)[1]||4!="test"[Wo](/(?:)/,-1)[zo]||2!="ab"[Wo](/(?:ab)*/)[zo]||4!="."[Wo](/(.?)(.?)/)[zo]||1<"."[Wo](/()()/)[zo]||""[Wo](/.?/)[zo]?function(t,e){var n=String(this);if(void 0===t&&0===e)return[];if(!oi(t))return d.call(n,t,e);for(var r,i,o,a=[],c=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),u=0,s=void 0===e?Ho:e>>>0,f=new RegExp(t.source,c+"g");(r=jo.call(f,n))&&!(u<(i=f[Vo])&&(a.push(n.slice(u,r.index)),1<r[zo]&&r.index<n[zo]&&Go.apply(a,r.slice(1)),o=r[0][zo],u=i,a[zo]>=s));)f[Vo]===r.index&&f[Vo]++;return u===n[zo]?!o&&f.test("")||a.push(""):a.push(n.slice(u)),a[zo]>s?a.slice(0,s):a}:"0"[Wo](void 0,0)[zo]?function(t,e){return void 0===t&&0===e?[]:d.call(this,t,e)}:d;return[function(t,e){var n=i(this),r=null==t?void 0:t[o];return void 0!==r?r.call(t,n,e):g.call(String(n),t,e)},function(t,e){var n=v(g,t,this,e,g!==d);if(n.done)return n.value;var r=Rt(t),i=String(this),n=Uo(r,RegExp),o=r.unicode,t=(r.ignoreCase?"i":"")+(r.multiline?"m":"")+(r.unicode?"u":"")+(Yo?"y":"g"),a=new n(Yo?r:"^(?:"+r.source+")",t),c=void 0===e?Ho:e>>>0;if(0==c)return[];if(0===i.length)return null===Oo(a,i)?[i]:[];for(var u=0,s=0,f=[];s<i.length;){a.lastIndex=Yo?s:0;var l,h=Oo(a,Yo?i:i.slice(s));if(null===h||(l=Bo(Ae(a.lastIndex+(Yo?0:s)),i.length))===u)s=Fo(i,s,o);else{if(f.push(i.slice(u,s)),f.length===c)return f;for(var p=1;p<=h.length-1;p++)if(f.push(h[p]),f.length===c)return f;s=u=l}}return f.push(i.slice(u)),f}]});function Ko(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}function Jo(){var t,e=+this;na.hasOwnProperty(e)&&(t=na[e],delete na[e],t())}var Zo,Xo=e(function(t){var l={},h={},t=t.exports=function(t,e,n,r,i){var o,a,c,u,i=i?function(){return t}:Fi(t),s=ne(n,r,e?2:1),f=0;if("function"!=typeof i)throw TypeError(t+" is not iterable!");if(_i(i)){for(o=Ae(t.length);f<o;f++)if((u=e?s(Rt(a=t[f])[0],a[1]):s(t[f]))===l||u===h)return u}else for(c=i.call(t);!(a=c.next()).done;)if((u=Si(c,s,a.value,e))===l||u===h)return u};t.BREAK=l,t.RETURN=h}),Qo=Bt.process,p=Bt.setImmediate,jn=Bt.clearImmediate,wn=Bt.MessageChannel,ta=Bt.Dispatch,ea=0,na={},ra="onreadystatechange",Te=function(t){Jo.call(t.data)};p&&jn||(p=function(t){for(var e=[],n=1;n<arguments.length;)e.push(arguments[n++]);return na[++ea]=function(){zn("function"==typeof t?t:Function(t),e)},Zo(ea),ea},jn=function(t){delete na[t]},"process"==ce(Qo)?Zo=function(t){Qo.nextTick(ne(Jo,t,1))}:ta&&ta.now?Zo=function(t){ta.now(ne(Jo,t,1))}:wn?(wn=(pn=new wn).port2,pn.port1.onmessage=Te,Zo=ne(wn.postMessage,wn,1)):Bt.addEventListener&&"function"==typeof postMessage&&!Bt.importScripts?(Zo=function(t){Bt.postMessage(t+"","*")},Bt.addEventListener("message",Te,!1)):Zo=ra in ct("script")?function(t){We.appendChild(ct("script"))[ra]=function(){We.removeChild(this),Jo.call(t)}}:function(t){setTimeout(ne(Jo,t,1),0)});var Te={set:p,clear:jn},ia=Te.set,oa=Bt.MutationObserver||Bt.WebKitMutationObserver,aa=Bt.process,ca=Bt.Promise,ua="process"==ce(aa);function sa(t){var n,r;this.promise=new t(function(t,e){if(void 0!==n||void 0!==r)throw TypeError("Bad Promise constructor");n=t,r=e}),this.resolve=ut(n),this.reject=ut(r)}function fa(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}function la(t,e){return Rt(t),zt(e)&&e.constructor===t?e:((0,(t=ba.f(t)).resolve)(e),t.promise)}function ha(t,e,n){for(var r in e)ee(t,r,e[r],n);return t}var pa,da,va,ga,ya,ma,ba={f:function(t){return new sa(t)}},p=Bt.navigator,wa=p&&p.userAgent||"",xa=Te.set,Sa=(ga=ua?function(){aa.nextTick(_a)}:!oa||Bt.navigator&&Bt.navigator.standalone?ca&&ca.resolve?(va=ca.resolve(void 0),function(){va.then(_a)}):function(){ia.call(Bt,_a)}:(ya=!0,ma=document.createTextNode(""),new oa(_a).observe(ma,{characterData:!0}),function(){ma.data=ya=!ya}),function(t){t={fn:t,next:void 0};da&&(da.next=t),pa||(pa=t,ga()),da=t});function _a(){var t,e;for(ua&&(t=aa.domain)&&t.exit();pa;){e=pa.fn,pa=pa.next;try{e()}catch(t){throw pa?ga():da=void 0,t}}da=void 0,t&&t.enter()}function ka(){}function ja(t){var e;return!(!zt(t)||"function"!=typeof(e=t.then))&&e}function Ea(f,e){var n;f._n||(f._n=!0,n=f._c,Sa(function(){for(var u=f._v,s=1==f._s,t=0;n.length>t;)!function(t){var e,n,r,i=s?t.ok:t.fail,o=t.resolve,a=t.reject,c=t.domain;try{i?(s||(2==f._h&&Da(f),f._h=1),!0===i?e=u:(c&&c.enter(),e=i(u),c&&(c.exit(),r=!0)),e===t.promise?a(Ma("Promise-chain cycle")):(n=ja(e))?n.call(e,o,a):o(e)):a(u)}catch(t){c&&!r&&c.exit(),a(t)}}(n[t++]);f._c=[],f._n=!1,e&&!f._h&&qa(f)}))}function Pa(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),Ea(e,!0))}var Fa,Oa,Aa,La,Ia="Promise",Ma=Bt.TypeError,Ta=Bt.process,jn=Ta&&Ta.versions,$a=jn&&jn.v8||"",Ra=Bt[Ia],Ca="process"==Bn(Ta),Na=Oa=ba.f,p=!!function(){try{var t=Ra.resolve(1),e=(t.constructor={})[we("species")]=function(t){t(ka,ka)};return(Ca||"function"==typeof PromiseRejectionEvent)&&t.then(ka)instanceof e&&0!==$a.indexOf("6.6")&&-1===wa.indexOf("Chrome/66")}catch(t){}}(),qa=function(i){xa.call(Bt,function(){var t,e,n=i._v,r=Ua(i);if(r&&(t=fa(function(){Ca?Ta.emit("unhandledRejection",n,i):(e=Bt.onunhandledrejection)?e({promise:i,reason:n}):(e=Bt.console)&&e.error&&e.error("Unhandled promise rejection",n)}),i._h=Ca||Ua(i)?2:1),i._a=void 0,r&&t.e)throw t.v})},Ua=function(t){return 1!==t._h&&0===(t._a||t._c).length},Da=function(e){xa.call(Bt,function(){var t;Ca?Ta.emit("rejectionHandled",e):(t=Bt.onrejectionhandled)&&t({promise:e,reason:e._v})})},Ba=function(t){var n,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===t)throw Ma("Promise can't be resolved itself");(n=ja(t))?Sa(function(){var e={_w:r,_d:!1};try{n.call(t,ne(Ba,e,1),ne(Pa,e,1))}catch(t){Pa.call(e,t)}}):(r._v=t,r._s=1,Ea(r,!1))}catch(t){Pa.call({_w:r,_d:!1},t)}}};p||(Ra=function(t){Ko(this,Ra,Ia,"_h"),ut(t),Fa.call(this);try{t(ne(Ba,this,1),ne(Pa,this,1))}catch(t){Pa.call(this,t)}},(Fa=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=ha(Ra.prototype,{then:function(t,e){var n=Na(Uo(this,Ra));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=Ca?Ta.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&Ea(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),Aa=function(){var t=new Fa;this.promise=t,this.resolve=ne(Ba,t,1),this.reject=ne(Pa,t,1)},ba.f=Na=function(t){return t===Ra||t===La?new Aa:Oa(t)}),me(me.G+me.W+me.F*!p,{Promise:Ra}),oe(Ra,Ia),oo(Ia),La=$t[Ia],me(me.S+me.F*!p,Ia,{reject:function(t){var e=Na(this);return(0,e.reject)(t),e.promise}}),me(me.S+me.F*!p,Ia,{resolve:function(t){return la(this,t)}}),me(me.S+me.F*!(p&&Ii(function(t){Ra.all(t).catch(ka)})),Ia,{all:function(t){var a=this,e=Na(a),c=e.resolve,u=e.reject,n=fa(function(){var r=[],i=0,o=1;Xo(t,!1,function(t){var e=i++,n=!1;r.push(void 0),o++,a.resolve(t).then(function(t){n||(n=!0,r[e]=t,--o||c(r))},u)}),--o||c(r)});return n.e&&u(n.v),e.promise},race:function(t){var e=this,n=Na(e),r=n.reject,i=fa(function(){Xo(t,!1,function(t){e.resolve(t).then(n.resolve,r)})});return i.e&&r(i.v),n.promise}});function Ga(t,e){if(!zt(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}function Wa(t,e){var n,r=Ka(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n}function za(n,t,e,r,i,o){function a(t){var n=v[t];ee(v,t,"delete"==t?function(t){return!(o&&!zt(t))&&n.call(this,0===t?0:t)}:"has"==t?function(t){return!(o&&!zt(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return o&&!zt(t)?void 0:n.call(this,0===t?0:t)}:"add"==t?function(t){return n.call(this,0===t?0:t),this}:function(t,e){return n.call(this,0===t?0:t,e),this})}var c,u,s,f,l,h=Bt[n],p=h,d=i?"set":"add",v=p&&p.prototype,g={};return"function"==typeof p&&(o||v.forEach&&!qt(function(){(new p).entries().next()}))?(u=(c=new p)[d](o?{}:-0,1)!=c,s=qt(function(){c.has(1)}),f=Ii(function(t){new p(t)}),l=!o&&qt(function(){for(var t=new p,e=5;e--;)t[d](e,e);return!t.has(-0)}),f||(((p=t(function(t,e){Ko(t,p,n);t=or(new h,t,p);return null!=e&&Xo(e,i,t[d],t),t})).prototype=v).constructor=p),(s||l)&&(a("delete"),a("has"),i&&a("get")),(l||u)&&a(d),o&&v.clear&&delete v.clear):(p=r.getConstructor(t,n,i,d),ha(p.prototype,e),be.NEED=!0),oe(p,n),g[n]=p,me(me.G+me.W+me.F*(p!=h),g),o||r.setStrong(p,n,i),p}function Va(t){return t._l||(t._l=new nc)}function Ha(t,e){return Qa(t.a,function(t){return t[0]===e})}var Ya=Yt.f,Ka=be.fastKey,Ja=Wt?"_s":"size",Za={getConstructor:function(t,i,n,r){var o=t(function(t,e){Ko(t,o,i,"_i"),t._t=i,t._i=Ye(null),t._f=void 0,t._l=void 0,t[Ja]=0,null!=e&&Xo(e,n,t[r],t)});return ha(o.prototype,{clear:function(){for(var t=Ga(this,i),e=t._i,n=t._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete e[n.i];t._f=t._l=void 0,t[Ja]=0},delete:function(t){var e,n=Ga(this,i),r=Wa(n,t);return r&&(e=r.n,t=r.p,delete n._i[r.i],r.r=!0,t&&(t.n=e),e&&(e.p=t),n._f==r&&(n._f=e),n._l==r&&(n._l=t),n[Ja]--),!!r},forEach:function(t){Ga(this,i);for(var e,n=ne(t,1<arguments.length?arguments[1]:void 0,3);e=e?e.n:this._f;)for(n(e.v,e.k,this);e&&e.r;)e=e.p},has:function(t){return!!Wa(Ga(this,i),t)}}),Wt&&Ya(o.prototype,"size",{get:function(){return Ga(this,i)[Ja]}}),o},def:function(t,e,n){var r,i=Wa(t,e);return i?i.v=n:(t._l=i={i:r=Ka(e,!0),k:e,v:n,p:n=t._l,n:void 0,r:!1},t._f||(t._f=i),n&&(n.n=i),t[Ja]++,"F"!==r&&(t._i[r]=i)),t},getEntry:Wa,setStrong:function(t,n,e){Qr(t,n,function(t,e){this._t=Ga(t,n),this._k=e,this._l=void 0},function(){for(var t=this,e=t._k,n=t._l;n&&n.r;)n=n.p;return t._t&&(t._l=n=n?n.n:t._t._f)?co(0,"keys"==e?n.k:"values"==e?n.v:[n.k,n.v]):(t._t=void 0,co(1))},e?"entries":"values",!e,!0),oo(n)}},Xa=(za("Map",function(t){return function(){return t(this,0<arguments.length?arguments[0]:void 0)}},{get:function(t){t=Za.getEntry(Ga(this,"Map"),t);return t&&t.v},set:function(t,e){return Za.def(Ga(this,"Map"),0===t?0:t,e)}},Za,!0),za("Set",function(t){return function(){return t(this,0<arguments.length?arguments[0]:void 0)}},{add:function(t){return Za.def(Ga(this,"Set"),t=0===t?0:t,t)}},Za),be.getWeak),Qa=Ni(5),tc=Ni(6),ec=0,nc=function(){this.a=[]};nc.prototype={get:function(t){t=Ha(this,t);if(t)return t[1]},has:function(t){return!!Ha(this,t)},set:function(t,e){var n=Ha(this,t);n?n[1]=e:this.a.push([t,e])},delete:function(e){var t=tc(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}};var rc={getConstructor:function(t,n,r,i){var o=t(function(t,e){Ko(t,o,n,"_i"),t._t=n,t._i=ec++,t._l=void 0,null!=e&&Xo(e,r,t[i],t)});return ha(o.prototype,{delete:function(t){if(!zt(t))return!1;var e=Xa(t);return!0===e?Va(Ga(this,n)).delete(t):e&&Gt(e,this._i)&&delete e[this._i]},has:function(t){if(!zt(t))return!1;var e=Xa(t);return!0===e?Va(Ga(this,n)).has(t):e&&Gt(e,this._i)}}),o},def:function(t,e,n){var r=Xa(Rt(e),!0);return!0===r?Va(t).set(e,n):r[t._i]=n,t},ufstore:Va},ic=(e(function(t){function e(t){return function(){return t(this,0<arguments.length?arguments[0]:void 0)}}var i,n=Ni(0),r=!Bt.ActiveXObject&&"ActiveXObject"in Bt,o="WeakMap",a=be.getWeak,c=Object.isExtensible,u=rc.ufstore,s={get:function(t){if(zt(t)){var e=a(t);return!0===e?u(Ga(this,o)).get(t):e?e[this._i]:void 0}},set:function(t,e){return rc.def(Ga(this,o),t,e)}},f=t.exports=za(o,e,s,rc,!0,!0);r&&(i=rc.getConstructor(e,o),Nn(i.prototype,s),be.NEED=!0,n(["delete","has","get","set"],function(n){var t=f.prototype,r=t[n];ee(t,n,function(t,e){if(!zt(t)||c(t))return r.call(this,t,e);this._f||(this._f=new i);e=this._f[n](t,e);return"set"==n?this:e})}))}),"WeakSet");za(ic,function(t){return function(){return t(this,0<arguments.length?arguments[0]:void 0)}},{add:function(t){return rc.def(Ga(this,ic),t,!0)}},rc,!1,!0);for(var oc,ac=Dt("typed_array"),cc=Dt("view"),jn=!(!Bt.ArrayBuffer||!Bt.DataView),uc=jn,sc=0,fc="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");sc<9;)(oc=Bt[fc[sc++]])?(Jt(oc.prototype,ac,!0),Jt(oc.prototype,cc,!0)):uc=!1;function lc(t){if(void 0===t)return 0;var e=fe(t),t=Ae(e);if(e!==t)throw RangeError("Wrong length!");return t}var hc={ABV:jn,CONSTR:uc,TYPED:ac,VIEW:cc},pc=e(function(t,e){var n=Je.f,r=Yt.f,i="ArrayBuffer",o="DataView",a="prototype",f="Wrong index!",c=Bt[i],u=Bt[o],s=Bt.Math,l=Bt.RangeError,h=Bt.Infinity,p=c,d=s.abs,v=s.pow,g=s.floor,y=s.log,m=s.LN2,b="byteLength",s="byteOffset",w=Wt?"_b":"buffer",x=Wt?"_l":b,S=Wt?"_o":s;function _(t,e,n){var r,i,o=new Array(n),a=8*n-e-1,c=(1<<a)-1,u=c>>1,s=23===e?v(2,-24)-v(2,-77):0,f=0,l=t<0||0===t&&1/t<0?1:0;for((t=d(t))!=t||t===h?(i=t!=t?1:0,r=c):(r=g(y(t)/m),t*(n=v(2,-r))<1&&(r--,n*=2),2<=(t+=1<=r+u?s/n:s*v(2,1-u))*n&&(r++,n/=2),c<=r+u?(i=0,r=c):1<=r+u?(i=(t*n-1)*v(2,e),r+=u):(i=t*v(2,u-1)*v(2,e),r=0));8<=e;o[f++]=255&i,i/=256,e-=8);for(r=r<<e|i,a+=e;0<a;o[f++]=255&r,r/=256,a-=8);return o[--f]|=128*l,o}function k(t,e,n){var r,i=8*n-e-1,o=(1<<i)-1,a=o>>1,c=i-7,u=n-1,n=t[u--],s=127&n;for(n>>=7;0<c;s=256*s+t[u],u--,c-=8);for(r=s&(1<<-c)-1,s>>=-c,c+=e;0<c;r=256*r+t[u],u--,c-=8);if(0===s)s=1-a;else{if(s===o)return r?NaN:n?-h:h;r+=v(2,e),s-=a}return(n?-1:1)*r*v(2,s-e)}function j(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function E(t){return[255&t]}function P(t){return[255&t,t>>8&255]}function F(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function O(t){return _(t,52,8)}function A(t){return _(t,23,4)}function L(t,e,n){r(t[a],e,{get:function(){return this[n]}})}function I(t,e,n,r){var i=lc(+n);if(i+e>t[x])throw l(f);n=t[w]._b,t=i+t[S],e=n.slice(t,t+e);return r?e:e.reverse()}function M(t,e,n,r,i,o){n=lc(+n);if(n+e>t[x])throw l(f);for(var a=t[w]._b,c=n+t[S],u=r(+i),s=0;s<e;s++)a[c+s]=u[o?s:e-s-1]}if(hc.ABV){if(!qt(function(){c(1)})||!qt(function(){new c(-1)})||qt(function(){return new c,new c(1.5),new c(NaN),c.name!=i})){for(var T,$=(c=function(t){return Ko(this,c),new p(lc(t))})[a]=p[a],R=n(p),C=0;R.length>C;)(T=R[C++])in c||Jt(c,T,p[T]);$.constructor=c}var $=new u(new c(2)),N=u[a].setInt8;$.setInt8(0,2147483648),$.setInt8(1,2147483649),!$.getInt8(0)&&$.getInt8(1)||ha(u[a],{setInt8:function(t,e){N.call(this,t,e<<24>>24)},setUint8:function(t,e){N.call(this,t,e<<24>>24)}},!0)}else c=function(t){Ko(this,c,i);t=lc(t);this._b=to.call(new Array(t),0),this[x]=t},u=function(t,e,n){Ko(this,u,o),Ko(t,c,o);var r=t[x],e=fe(e);if(e<0||r<e)throw l("Wrong offset!");if(r<e+(n=void 0===n?r-e:Ae(n)))throw l("Wrong length!");this[w]=t,this[S]=e,this[x]=n},Wt&&(L(c,b,"_l"),L(u,"buffer","_b"),L(u,b,"_l"),L(u,s,"_o")),ha(u[a],{getInt8:function(t){return I(this,1,t)[0]<<24>>24},getUint8:function(t){return I(this,1,t)[0]},getInt16:function(t){t=I(this,2,t,arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(t){t=I(this,2,t,arguments[1]);return t[1]<<8|t[0]},getInt32:function(t){return j(I(this,4,t,arguments[1]))},getUint32:function(t){return j(I(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return k(I(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return k(I(this,8,t,arguments[1]),52,8)},setInt8:function(t,e){M(this,1,t,E,e)},setUint8:function(t,e){M(this,1,t,E,e)},setInt16:function(t,e){M(this,2,t,P,e,arguments[2])},setUint16:function(t,e){M(this,2,t,P,e,arguments[2])},setInt32:function(t,e){M(this,4,t,F,e,arguments[2])},setUint32:function(t,e){M(this,4,t,F,e,arguments[2])},setFloat32:function(t,e){M(this,4,t,A,e,arguments[2])},setFloat64:function(t,e){M(this,8,t,O,e,arguments[2])}});oe(c,i),oe(u,o),Jt(u[a],hc.VIEW,!0),e[i]=c,e[o]=u}),p=Bt.ArrayBuffer,dc=pc.ArrayBuffer,vc=pc.DataView,gc=hc.ABV&&p.isView,yc=dc.prototype.slice,mc=hc.VIEW,jn="ArrayBuffer";me(me.G+me.W+me.F*(p!==dc),{ArrayBuffer:dc}),me(me.S+me.F*!hc.CONSTR,jn,{isView:function(t){return gc&&gc(t)||zt(t)&&mc in t}}),me(me.P+me.U+me.F*qt(function(){return!new dc(2).slice(1,void 0).byteLength}),jn,{slice:function(t,e){if(void 0!==yc&&void 0===e)return yc.call(Rt(this),t);for(var n=Rt(this).byteLength,r=le(t,n),i=le(void 0===e?n:e,n),n=new(Uo(this,dc))(Ae(i-r)),o=new vc(this),a=new vc(n),c=0;r<i;)a.setUint8(c++,o.getUint8(r++));return n}}),oo(jn),me(me.G+me.W+me.F*!hc.ABV,{DataView:pc.DataView});jn=e(function(t){var p,d,v,g,l,y,n,m,e,r,b,w,i,o,a,x,S,h,_,k,j,E,P,c,u,s,F,O,A,f,L,I,M,T,$,R,C,N,q,U,D,B,G,W,z,V,H,Y,K,J,Z,X,Q,tt,et,nt,rt,it,ot,at,ct,ut,st,ft,lt,ht,pt,dt,vt,gt,yt,mt,bt,wt,xt,St,_t,kt,jt,Et,Pt,Ft,Ot,At,Lt,It,Mt,Tt,$t,Rt,Ct,Nt;Wt?(p=Bt,d=qt,v=me,g=hc,l=ne,y=Ko,n=Kt,m=Jt,e=ha,r=fe,b=Ae,w=lc,i=le,o=Ut,a=Gt,x=Bn,S=zt,h=de,_=_i,k=Ye,j=Mn,E=Je.f,P=Fi,Rt=Dt,Et=we,Ct=Ni,c=he,u=Uo,s=uo,F=Kr,O=Ii,A=oo,f=to,L=Zi,M=nn,T=(I=Yt).f,$=M.f,R=p.RangeError,C=p.TypeError,N=p.Uint8Array,U="Shared"+(q="ArrayBuffer"),D="BYTES_PER_ELEMENT",B="prototype",dt=Array[B],G=pc.ArrayBuffer,W=pc.DataView,z=Ct(0),V=Ct(2),H=Ct(3),Y=Ct(4),K=Ct(5),J=Ct(6),Z=c(!0),X=c(!1),Q=s.values,tt=s.keys,et=s.entries,nt=dt.lastIndexOf,rt=dt.reduce,it=dt.reduceRight,ot=dt.join,at=dt.sort,ct=dt.slice,ut=dt.toString,st=dt.toLocaleString,ft=Et("iterator"),lt=Et("toStringTag"),ht=Rt("typed_constructor"),pt=Rt("def_constructor"),dt=g.CONSTR,vt=g.TYPED,gt=g.VIEW,yt="Wrong length!",mt=Ct(1,function(t,e){return _t(u(t,t[pt]),e)}),bt=d(function(){return 1===new N(new Uint16Array([1]).buffer)[0]}),wt=!!N&&!!N[B].set&&d(function(){new N(1).set({})}),xt=function(t,e){t=r(t);if(t<0||t%e)throw R("Wrong offset!");return t},St=function(t){if(S(t)&&vt in t)return t;throw C(t+" is not a typed array!")},_t=function(t,e){if(!(S(t)&&ht in t))throw C("It is not a typed array constructor!");return new t(e)},kt=function(t,e){return jt(u(t,t[pt]),e)},jt=function(t,e){for(var n=0,r=e.length,i=_t(t,r);n<r;)i[n]=e[n++];return i},Et=function(t,e,n){T(t,e,{get:function(){return this._d[n]}})},Pt=function(t){var e,n,r,i,o,a,c=h(t),u=arguments.length,s=1<u?arguments[1]:void 0,f=void 0!==s,t=P(c);if(null!=t&&!_(t)){for(a=t.call(c),r=[],e=0;!(o=a.next()).done;e++)r.push(o.value);c=r}for(f&&2<u&&(s=l(s,arguments[2],2)),e=0,n=b(c.length),i=_t(this,n);e<n;e++)i[e]=f?s(c[e],e):c[e];return i},Ft=function(){for(var t=0,e=arguments.length,n=_t(this,e);t<e;)n[t]=arguments[t++];return n},Ot=!!N&&d(function(){st.call(new N(1))}),At=function(){return st.apply(Ot?ct.call(St(this)):St(this),arguments)},Lt={copyWithin:function(t,e){return L.call(St(this),t,e,2<arguments.length?arguments[2]:void 0)},every:function(t){return Y(St(this),t,1<arguments.length?arguments[1]:void 0)},fill:function(t){return f.apply(St(this),arguments)},filter:function(t){return kt(this,V(St(this),t,1<arguments.length?arguments[1]:void 0))},find:function(t){return K(St(this),t,1<arguments.length?arguments[1]:void 0)},findIndex:function(t){return J(St(this),t,1<arguments.length?arguments[1]:void 0)},forEach:function(t){z(St(this),t,1<arguments.length?arguments[1]:void 0)},indexOf:function(t){return X(St(this),t,1<arguments.length?arguments[1]:void 0)},includes:function(t){return Z(St(this),t,1<arguments.length?arguments[1]:void 0)},join:function(t){return ot.apply(St(this),arguments)},lastIndexOf:function(t){return nt.apply(St(this),arguments)},map:function(t){return mt(St(this),t,1<arguments.length?arguments[1]:void 0)},reduce:function(t){return rt.apply(St(this),arguments)},reduceRight:function(t){return it.apply(St(this),arguments)},reverse:function(){for(var t,e=this,n=St(e).length,r=Math.floor(n/2),i=0;i<r;)t=e[i],e[i++]=e[--n],e[n]=t;return e},some:function(t){return H(St(this),t,1<arguments.length?arguments[1]:void 0)},sort:function(t){return at.call(St(this),t)},subarray:function(t,e){var n=St(this),r=n.length,t=i(t,r);return new(u(n,n[pt]))(n.buffer,n.byteOffset+t*n.BYTES_PER_ELEMENT,b((void 0===e?r:i(e,r))-t))}},It=function(t,e){return kt(this,ct.call(St(this),t,e))},Mt=function(t){St(this);var e=xt(arguments[1],1),n=this.length,r=h(t),i=b(r.length),o=0;if(n<i+e)throw R(yt);for(;o<i;)this[e+o]=r[o++]},Tt={entries:function(){return et.call(St(this))},keys:function(){return tt.call(St(this))},values:function(){return Q.call(St(this))}},$t=function(t,e){return S(t)&&t[vt]&&"symbol"!=typeof e&&e in t&&String(+e)==String(e)},Rt=function(t,e){return $t(t,e=o(e,!0))?n(2,t[e]):$(t,e)},Ct=function(t,e,n){return!($t(t,e=o(e,!0))&&S(n)&&a(n,"value"))||a(n,"get")||a(n,"set")||n.configurable||a(n,"writable")&&!n.writable||a(n,"enumerable")&&!n.enumerable?T(t,e,n):(t[e]=n.value,t)},dt||(M.f=Rt,I.f=Ct),v(v.S+v.F*!dt,"Object",{getOwnPropertyDescriptor:Rt,defineProperty:Ct}),d(function(){ut.call({})})&&(ut=st=function(){return ot.call(this)}),Nt=e({},Lt),e(Nt,Tt),m(Nt,ft,Tt.values),e(Nt,{slice:It,set:Mt,constructor:function(){},toString:ut,toLocaleString:At}),Et(Nt,"buffer","b"),Et(Nt,"byteOffset","o"),Et(Nt,"byteLength","l"),Et(Nt,"length","e"),T(Nt,lt,{get:function(){return this[vt]}}),t.exports=function(t,s,e,r){function f(t,e){T(t,e,{get:function(){return function(t,e){t=t._d;return t.v[n](e*s+t.o,bt)}(this,e)},set:function(t){return function(t,e,n){t=t._d;r&&(n=(n=Math.round(n))<0?0:255<n?255:255&n),t.v[i](e*s+t.o,n,bt)}(this,e,t)},enumerable:!0})}var l=t+((r=!!r)?"Clamped":"")+"Array",n="get"+t,i="set"+t,h=p[l],o=h||{},a=h&&j(h),c=!h||!g.ABV,t={},u=h&&h[B];c?(h=e(function(t,e,n,r){y(t,h,l,"_d");var i,o,a,c=0,u=0;if(S(e)){if(!(e instanceof G||(a=x(e))==q||a==U))return vt in e?jt(h,e):Pt.call(h,e);a=e,u=xt(n,s);n=e.byteLength;if(void 0===r){if(n%s)throw R(yt);if((i=n-u)<0)throw R(yt)}else if(n<(i=b(r)*s)+u)throw R(yt);o=i/s}else o=w(e),a=new G(i=o*s);for(m(t,"_d",{b:a,o:u,l:i,e:o,v:new W(a)});c<o;)f(t,c++)}),u=h[B]=k(Nt),m(u,"constructor",h)):d(function(){h(1)})&&d(function(){new h(-1)})&&O(function(t){new h,new h(null),new h(1.5),new h(t)},!0)||(h=e(function(t,e,n,r){var i;return y(t,h,l),S(e)?e instanceof G||(i=x(e))==q||i==U?void 0!==r?new o(e,xt(n,s),r):void 0!==n?new o(e,xt(n,s)):new o(e):vt in e?jt(h,e):Pt.call(h,e):new o(w(e))}),z(a!==Function.prototype?E(o).concat(E(a)):E(o),function(t){t in h||m(h,t,o[t])}),(h[B]=u).constructor=h);c=u[ft],e=!!c&&("values"==c.name||null==c.name),a=Tt.values;m(h,ht,!0),m(u,vt,l),m(u,gt,!0),m(u,pt,h),(r?new h(1)[lt]==l:lt in u)||T(u,lt,{get:function(){return l}}),t[l]=h,v(v.G+v.W+v.F*(h!=o),t),v(v.S,l,{BYTES_PER_ELEMENT:s}),v(v.S+v.F*d(function(){o.of.call(h,1)}),l,{from:Pt,of:Ft}),D in u||m(u,D,s),v(v.P,l,Lt),A(l),v(v.P+v.F*wt,l,{set:Mt}),v(v.P+v.F*!e,l,Tt),u.toString!=ut&&(u.toString=ut),v(v.P+v.F*d(function(){new h(1).slice()}),l,{slice:It}),v(v.P+v.F*(d(function(){return[1,2].toLocaleString()!=new h([1,2]).toLocaleString()})||!d(function(){u.toLocaleString.call([1,2])})),l,{toLocaleString:At}),F[l]=e?c:a,e||m(u,ft,a)}):t.exports=function(){}});jn("Int8",1,function(r){return function(t,e,n){return r(this,t,e,n)}}),jn("Uint8",1,function(r){return function(t,e,n){return r(this,t,e,n)}}),jn("Uint8",1,function(r){return function(t,e,n){return r(this,t,e,n)}},!0),jn("Int16",2,function(r){return function(t,e,n){return r(this,t,e,n)}}),jn("Uint16",2,function(r){return function(t,e,n){return r(this,t,e,n)}}),jn("Int32",4,function(r){return function(t,e,n){return r(this,t,e,n)}}),jn("Uint32",4,function(r){return function(t,e,n){return r(this,t,e,n)}}),jn("Float32",4,function(r){return function(t,e,n){return r(this,t,e,n)}}),jn("Float64",8,function(r){return function(t,e,n){return r(this,t,e,n)}});var bc=(Bt.Reflect||{}).apply,wc=Function.apply;me(me.S+me.F*!qt(function(){bc(function(){})}),"Reflect",{apply:function(t,e,n){t=ut(t),n=Rt(n);return bc?bc(t,e,n):wc.call(t,e,n)}});var xc=(Bt.Reflect||{}).construct,Sc=qt(function(){function t(){}return!(xc(function(){},[],t)instanceof t)}),_c=!qt(function(){xc(function(){})});me(me.S+me.F*(Sc||_c),"Reflect",{construct:function(t,e){ut(t),Rt(e);var n=arguments.length<3?t:ut(arguments[2]);if(_c&&!Sc)return xc(t,e,n);if(t==n){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var r=[null];return r.push.apply(r,e),new(Yn.apply(t,r))}r=n.prototype,n=Ye(zt(r)?r:Object.prototype),r=Function.apply.call(t,n,e);return zt(r)?r:n}}),me(me.S+me.F*qt(function(){Reflect.defineProperty(Yt.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(t,e,n){Rt(t),e=Ut(e,!0),Rt(n);try{return Yt.f(t,e,n),!0}catch(t){return!1}}});var kc=nn.f;me(me.S,"Reflect",{deleteProperty:function(t,e){var n=kc(Rt(t),e);return!(n&&!n.configurable)&&delete t[e]}});function jc(t){this._t=Rt(t),this._i=0;var e,n=this._k=[];for(e in t)n.push(e)}Zr(jc,"Object",function(){var t,e=this._k;do{if(this._i>=e.length)return{value:void 0,done:!0}}while(!((t=e[this._i++])in this._t));return{value:t,done:!1}}),me(me.S,"Reflect",{enumerate:function(t){return new jc(t)}}),me(me.S,"Reflect",{get:function t(e,n){var r,i=arguments.length<3?e:arguments[2];return Rt(e)===i?e[n]:(r=nn.f(e,n))?Gt(r,"value")?r.value:void 0!==r.get?r.get.call(i):void 0:zt(e=Mn(e))?t(e,n,i):void 0}}),me(me.S,"Reflect",{getOwnPropertyDescriptor:function(t,e){return nn.f(Rt(t),e)}}),me(me.S,"Reflect",{getPrototypeOf:function(t){return Mn(Rt(t))}}),me(me.S,"Reflect",{has:function(t,e){return e in t}});var Ec=Object.isExtensible;me(me.S,"Reflect",{isExtensible:function(t){return Rt(t),!Ec||Ec(t)}});var jn=Bt.Reflect,Pc=jn&&jn.ownKeys||function(t){var e=Je.f(Rt(t)),n=qe.f;return n?e.concat(n(t)):e};me(me.S,"Reflect",{ownKeys:Pc});var Fc=Object.preventExtensions;me(me.S,"Reflect",{preventExtensions:function(t){Rt(t);try{return Fc&&Fc(t),!0}catch(t){return!1}}}),me(me.S,"Reflect",{set:function t(e,n,r){var i,o=arguments.length<4?e:arguments[3],a=nn.f(Rt(e),n);if(!a){if(zt(i=Mn(e)))return t(i,n,r,o);a=Kt(0)}if(Gt(a,"value")){if(!1===a.writable||!zt(o))return!1;if(i=nn.f(o,n)){if(i.get||i.set||!1===i.writable)return!1;i.value=r,Yt.f(o,n,i)}else Yt.f(o,n,Kt(0,r));return!0}return void 0!==a.set&&(a.set.call(o,r),!0)}}),Dn&&me(me.S,"Reflect",{setPrototypeOf:function(t,e){Dn.check(t,e);try{return Dn.set(t,e),!0}catch(t){return!1}}});var Oc=he(!0);me(me.P,"Array",{includes:function(t){return Oc(this,t,1<arguments.length?arguments[1]:void 0)}}),bn("includes");$t.Array.includes;var Ac=we("isConcatSpreadable");var Lc=function t(e,n,r,i,o,a,c,u){for(var s,f,l=o,h=0,p=!!c&&ne(c,u,3);h<i;){if(h in r){if(s=p?p(r[h],h,n):r[h],f=!1,(f=zt(s)?void 0!==(f=s[Ac])?!!f:De(s):f)&&0<a)l=t(e,n,s,Ae(s.length),l,a-1)-1;else{if(9007199254740991<=l)throw TypeError();e[l]=s}l++}h++}return l};me(me.P,"Array",{flatMap:function(t){var e,n,r=de(this);return ut(t),e=Ae(r.length),n=Ci(r,0),Lc(n,r,r,e,0,1,t,arguments[1]),n}}),bn("flatMap");function Ic(t,e,n,r){var i=String(ue(t)),t=i.length,n=void 0===n?" ":String(n);return(e=Ae(e))<=t||""==n?i:(t=e-t,(n=xr.call(n,Math.ceil(t/n.length))).length>t&&(n=n.slice(0,t)),r?n+i:i+n)}$t.Array.flatMap;bn=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(wa);me(me.P+me.F*bn,"String",{padStart:function(t){return Ic(this,t,1<arguments.length?arguments[1]:void 0,!0)}});$t.String.padStart;bn=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(wa);me(me.P+me.F*bn,"String",{padEnd:function(t){return Ic(this,t,1<arguments.length?arguments[1]:void 0,!1)}});$t.String.padEnd;Ge("trimLeft",function(t){return function(){return t(this,1)}},"trimStart");$t.String.trimLeft;Ge("trimRight",function(t){return function(){return t(this,2)}},"trimEnd");$t.String.trimRight;ae("asyncIterator");_e.f("asyncIterator");me(me.S,"Object",{getOwnPropertyDescriptors:function(t){for(var e,n,r=se(t),i=nn.f,o=Pc(r),a={},c=0;o.length>c;)void 0!==(n=i(r,e=o[c++]))&&ki(a,e,n);return a}});$t.Object.getOwnPropertyDescriptors;var Mc=Ue.f,bn=function(c){return function(t){for(var e,n=se(t),r=Ne(n),i=r.length,o=0,a=[];o<i;)e=r[o++],Wt&&!Mc.call(n,e)||a.push(c?[e,n[e]]:n[e]);return a}},Tc=bn(!1);me(me.S,"Object",{values:function(t){return Tc(t)}});$t.Object.values;var $c=bn(!0);me(me.S,"Object",{entries:function(t){return $c(t)}});$t.Object.entries;me(me.P+me.R,"Promise",{finally:function(e){var n=Uo(this,$t.Promise||Bt.Promise),t="function"==typeof e;return this.then(t?function(t){return la(n,e()).then(function(){return t})}:e,t?function(t){return la(n,e()).then(function(){throw t})}:e)}});$t.Promise.finally;var Rc=[].slice,Ge=/MSIE .\./.test(wa),bn=function(i){return function(t,e){var n=2<arguments.length,r=n&&Rc.call(arguments,2);return i(n?function(){("function"==typeof t?t:Function(t)).apply(this,r)}:t,e)}};me(me.G+me.B+me.F*Ge,{setTimeout:bn(Bt.setTimeout),setInterval:bn(Bt.setInterval)}),me(me.G+me.B,{setImmediate:Te.set,clearImmediate:Te.clear});for(var Cc=we("iterator"),Nc=we("toStringTag"),qc=Kr.Array,Uc={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},Dc=Ne(Uc),Bc=0;Bc<Dc.length;Bc++){var Gc,Wc=Dc[Bc],zc=Uc[Wc],Vc=Bt[Wc],Hc=Vc&&Vc.prototype;if(Hc&&(Hc[Cc]||Jt(Hc,Cc,qc),Hc[Nc]||Jt(Hc,Nc,Wc),Kr[Wc]=qc,zc))for(Gc in uo)Hc[Gc]||ee(Hc,Gc,uo[Gc],!0)}function Yc(r,i,t){if(!function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(r),void 0===i)return r;switch(t){case 1:return function(t){return r.call(i,t)};case 2:return function(t,e){return r.call(i,t,e)};case 3:return function(t,e,n){return r.call(i,t,e,n)}}return function(){return r.apply(i,arguments)}}function Kc(t){return"object"==typeof t?null!==t:"function"==typeof t}function Jc(t){if(!Kc(t))throw TypeError(t+" is not an object!");return t}var Zc=e(function(t){t=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)}),Xc=e(function(t){t=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=t)}),bn=(Xc.version,function(t){try{return!!t()}catch(t){return!0}}),Te=!bn(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),Qc=Zc.document,tu=Kc(Qc)&&Kc(Qc.createElement),eu=!Te&&!bn(function(){return 7!=Object.defineProperty(tu?Qc.createElement("div"):{},"a",{get:function(){return 7}}).a}),nu=Object.defineProperty,ru={f:Te?Object.defineProperty:function(t,e,n){if(Jc(t),e=function(t,e){if(!Kc(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!Kc(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!Kc(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!Kc(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}(e,!0),Jc(n),eu)try{return nu(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},iu=Te?function(t,e,n){return ru.f(t,e,{enumerable:!((e=1)&e),configurable:!(2&e),writable:!(4&e),value:n})}:function(t,e,n){return t[e]=n,t},ou={}.hasOwnProperty,au="prototype",cu=function(t,e,n){var r,i,o,a,c=t&cu.F,u=t&cu.G,s=t&cu.S,f=t&cu.P,l=t&cu.B,h=t&cu.W,p=u?Xc:Xc[e]||(Xc[e]={}),d=p[au],v=u?Zc:s?Zc[e]:(Zc[e]||{})[au];for(r in n=u?e:n)(i=!c&&v&&void 0!==v[r])&&(o=p,a=r,ou.call(o,a))||(a=(i?v:n)[r],p[r]=u&&"function"!=typeof v[r]?n[r]:l&&i?Yc(a,Zc):h&&v[r]==a?function(r){function t(t,e,n){if(this instanceof r){switch(arguments.length){case 0:return new r;case 1:return new r(t);case 2:return new r(t,e)}return new r(t,e,n)}return r.apply(this,arguments)}return t[au]=r[au],t}(a):f&&"function"==typeof a?Yc(Function.call,a):a,f&&((p.virtual||(p.virtual={}))[r]=a,t&cu.R&&d&&!d[r]&&iu(d,r,a)))};cu.F=1,cu.G=2,cu.S=4,cu.P=8,cu.B=16,cu.W=32,cu.U=64,cu.R=128,cu(cu.G,{global:Zc});var uu,su=Xc.global,fu=e(function(t){var e,n=(e=su)&&e.__esModule?e:{default:e};n.default._babelPolyfill&&"undefined"!=typeof console&&console.warn&&console.warn("@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning."),n.default._babelPolyfill=!0});(uu=fu)&&uu.__esModule&&Object.prototype.hasOwnProperty.call(uu,"default")&&uu.default;var lu=require("commander"),hu=new Mt;return lu.allowUnknownOption(!1),process.on("SIGINT",function(){hu.emit("shutdown")}),lu.version("v".concat(require("../package").version)).option("-v, --verbose","log verbose output").option("-f, --file","Add Filename and optional new filepath").option("-e, --env","Add environment variable"),lu.command("new <projectName>").description("Create a new Quire project in the current directory.").action(function(t){hu.verbose=lu.verbose,hu.emit("new",t)}),lu.command("preview [options]").description("Run the preview server in the current directory").action(function(){hu.verbose=lu.verbose,hu.emit("preview")}),lu.command("install").description("Install this project's theme dependencies").action(function(){hu.verbose=lu.verbose,hu.emit("install")}),lu.command("site [env]").option("-e, --env","Add environment variable").alias("build").description("Run the build command in the current directory").action(function(t){hu.verbose=lu.verbose,hu.emit("site",t)}),lu.command("pdf [file] [env]").option("-f, --file","Add Filename and optional new filepath").option("-e, --env","Add environment variable").description("Generate a PDF version of the current project").action(function(t,e){hu.verbose=lu.verbose,hu.emit("pdf",t,e)}),lu.command("epub [file] [env]").option("-f, --file","Add Filename and optional new filepath").option("-e, --env","Add environment variable").description("Generate an EPUB version of the current project").action(function(t,e){hu.verbose=lu.verbose,hu.emit("epub",t,e)}),lu.command("process").option("--iiif","Tile images for IIIF.").description("Run Quire processes.").action(function(e){var t=e.options.map(function(t){return t.long.replace("--","")}).find(function(t){return e[t]});if(!t)return console.error('"quire process" requires an option. Run "quire process --help" to list options.'),!1;hu.verbose=lu.verbose,hu.emit("process",t)}),lu.command("mobi [file] [env]").option("-f, --file","Add Filename and optional new filepath").option("-e, --env","Add environment variable").description("Generate an MOBI version of the current project").action(function(t,e){hu.verbose=lu.verbose,hu.emit("mobi",t,e)}),lu.command("template [type]").option("-t, --type","Select template to download (Currently only EPUB supported)").description("Download templates to customize your file output (Currently only EPUB supported)").action(function(t){hu.verbose=lu.verbose,hu.emit("template",t)}),lu.command("debug").description("Development use only - log info about current project").action(function(){hu.verbose=lu.verbose,hu.emit("debug")}),lu.on("command:*",function(){console.error("Invalid command: %s\n",lu.args.join(" ")),lu.help(),process.exit(1)}),lu.parse(process.argv),process.argv.slice(2).length||(lu.help(),process.exit(1)),t.commandMissing=W,t.copy=U,t.copyDirRecursive=function i(o,a,c){C.mkdirSync(a,{recursive:!0}),C.readdirSync(o).forEach(function(t){var e=M.join(o,t),n=M.join(a,t),r=c&&e.includes(c.join(",")),t=C.statSync(e).isFile();r||(t?C.copyFileSync(M.resolve(e),M.resolve(n)):i(e,n,c))})},t.deleteFolderRecursive=function n(r){C.existsSync(r)&&(C.readdirSync(r).forEach(function(t,e){t=r+"/"+t,C.statSync(t).isDirectory()?n(t):C.unlinkSync(t)}),C.rmdirSync(r))},t.determineBaseURL=z,t.isWin32=V,t.pluralize=H,t.readYAML=B,t.removeFile=G,t}({});
|
|
2
|
+
var quire=function(t){"use strict";function e(t,e){return t(e={exports:{}},e.exports),e.exports}var j=e(function(t){var e=function(a){var u,t=Object.prototype,s=t.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var i,o,a,c,e=e&&e.prototype instanceof g?e:g,e=Object.create(e.prototype),r=new j(r||[]);return e._invoke=(i=t,o=n,a=r,c=l,function(t,e){if(c===p)throw new Error("Generator is already running");if(c===d){if("throw"===t)throw e;return P()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){var r=function t(e,n){var r=e.iterator[n.method];if(r===u){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=u,t(e,n),"throw"===n.method))return v;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}r=f(r,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,v;var r=r.arg;if(!r)return n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v;{if(!r.done)return r;n[e.resultName]=r.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=u)}n.delegate=null;return v}(n,a);if(r){if(r===v)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===l)throw c=d,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=p;r=f(i,o,a);if("normal"===r.type){if(c=a.done?d:h,r.arg!==v)return{value:r.arg,done:a.done}}else"throw"===r.type&&(c=d,a.method="throw",a.arg=r.arg)}}),e}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var l="suspendedStart",h="suspendedYield",p="executing",d="completed",v={};function g(){}function y(){}function m(){}var b={};b[r]=function(){return this};e=Object.getPrototypeOf,e=e&&e(e(E([])));e&&e!==t&&s.call(e,r)&&(b=e);var w=m.prototype=g.prototype=Object.create(b);function x(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function S(a,c){var e;this._invoke=function(n,r){function t(){return new c(function(t,e){!function e(t,n,r,i){t=f(a[t],a,n);if("throw"!==t.type){var o=t.arg,n=o.value;return n&&"object"==typeof n&&s.call(n,"__await")?c.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):c.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)})}i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function E(e){if(e){var t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,t=function t(){for(;++n<e.length;)if(s.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=u,t.done=!0,t};return t.next=t}}return{next:P}}function P(){return{value:u,done:!0}}return((y.prototype=w.constructor=m).constructor=y).displayName=o(m,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,o(t,i,"GeneratorFunction")),t.prototype=Object.create(w),t},a.awrap=function(t){return{__await:t}},x(S.prototype),S.prototype[n]=function(){return this},a.AsyncIterator=S,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new S(c(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},x(w),o(w,i,"Generator"),w[r]=function(){return this},w.toString=function(){return"[object Generator]"},a.keys=function(n){var t,r=[];for(t in n)r.push(t);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=E,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=s.call(i,"catchLoc"),c=s.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r,i=n.completion;return"throw"===i.type&&(r=i.arg,k(n)),r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=u),v}},a}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}});function u(t,e,n,r,i,o,a){try{var c=t[o](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,i)}var E=function(c){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=c.apply(t,a);function i(t){u(r,e,n,i,o,"next",t)}function o(t){u(r,e,n,i,o,"throw",t)}i(void 0)})}};var a=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var c=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t},n=e(function(e){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(t){return typeof t}:e.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}e.exports=n});var i=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var s=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?i(t):e},f=e(function(e){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}e.exports=n}),o=e(function(n){function r(t,e){return n.exports=r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(t,e)}n.exports=r});var l=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)},h=require("events"),p=require("util"),d=require("fs-extra"),v=p.promisify(d.writeFile),g=require("rimraf"),y=require("sanitize-html"),m=(require("path"),require("cheerio")),b=function(t,e){e.fail("".concat(t)),process.exit(1),removeHTML()},w=function(){function r(t,e){var n;return a(this,r),(n=s(this,f(r).call(this))).data=t,n.spinner=e,n.data&&E(j.mark(function t(){return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,n.buildEpubFiles(n.data);case 3:t.next=8;break;case 5:t.prev=5,t.t0=t.catch(0),b(t.t0,n.spinner);case 8:case"end":return t.stop()}},t,null,[[0,5]])}))(),n}var e;return l(r,h),c(r,[{key:"removeHTML",value:function(){g("html/",function(){return!0})}},{key:"createReformatedHashLinkArrAndcreateLinkArr",value:function(i){return new Promise(function(t,e){var n,r;""===i?e(new Error("Something went wrong. Please try again."),null):(n=[],r=[],i.pages.forEach(function(t){var e=void 0!==t.reformatedHashLinkArr?t.reformatedHashLinkArr:"";n.push(e);t=void 0!==t.linkTitleArr?t.linkTitleArr:"";r.push(t)}),t([r,n]))})}},{key:"buildMetadata",value:function(f){return new Promise(function(t,e){if(""===f)e(new Error("Something went wrong. Please try again."),null);else if(void 0===f.title||null===f.title||""===f.title)e(new Error("A title for your publication must be specified in the publication.yml file."),null);else if(void 0===f.language||null===f.language||""===f.language)e(new Error("A language for your publication must be specified in the publication.yml file."),null);else{delete f.pages;var n,r="";for(n in f)if(void 0!==f[n]&&null!==f[n]&&"string"!=typeof f[n]){if(0<f[n].length){var i,o,a=f[n];if("creators"===n)for(var c in a)a.hasOwnProperty(c)&&void 0!==a[c]&&null!==a[c]&&""!==a[c]&&(!0===(i=a[c]).fullname?r+='<dc:creator opf:role="'.concat(i.role,'">').concat(i.name,"</dc:creator>"):r+='<dc:creator opf:file-as="'.concat(i["file-as"],'" opf:role="').concat(i.role,'">').concat(i.name,"</dc:creator>"));else if("contributors"===n)for(var u in a)a.hasOwnProperty(u)&&void 0!==a[u]&&null!==a[u]&&""!==a[u]&&(!0===(o=a[u]).fullname?r+='<dc:contributor opf:role="'.concat(o.role,'">').concat(o.name,"</dc:contributor>"):r+='<dc:contributor opf:file-as="'.concat(o["file-as"],'" opf:role="').concat(o.role,'">').concat(o.name,"</dc:contributor>"));else for(var s in a)a.hasOwnProperty(s)&&void 0!==a[s]&&null!==a[s]&&""!==a[s]&&(r+="<dc:".concat(s,">").concat(a[s],"</dc:").concat(s,">"))}}else"title"!==n&&void 0!==f[n]&&null!==f[n]&&""!==f[n]&&(r+="<dc:".concat(n,">").concat(f[n],"</dc:").concat(n,">"));v("html/dc.xml",r),t(r)}})}},{key:"buildHTML",value:function(o,c,u){return new Promise(function(t,r){var e,a,n,i;""===o||""===c||""===u?r(new Error("Something went wrong. Please try again."),null):(e=[],o.pages.forEach(function(t){t=void 0!==t.body?t.body:"";e.push(t)}),i=e.join(" "),i=y(i,{allowedTags:["h1","h2","h3","h4","h5","h6","blockquote","p","a","ul","ol","nl","li","b","i","strong","em","hr","br","div","table","thead","caption","tbody","tr","th","td","dl","dt","dd","pre","html","title","iframe","header","footer","body","form","img","meta","link","strike","code","main","article","section","aside","span","figure","sup","sub","figcaption"],allowedAttributes:{a:["href","name","target","class","id"],img:["src","width","height","class","id"],iframe:["src","width","height","class","id"],div:["id","class"],main:["id","class"],article:["id","class"],ul:["id","class"],ol:["id","class"],li:["id","class"],nav:["id","class"],meta:["name","content"],link:["rel","href"],p:["id","class"],h1:["id","class"],h2:["id","class"],h3:["id","class"],h4:["id","class"],h5:["id","class"],h6:["id","class"],span:["id","class"],sup:["id","class"],sub:["id","class"],figure:["id","class"],figcaption:["id","class"],blockquote:["id","class"],table:["id","class"],td:["id","class"],tr:["id","class"],th:["id","class"],dl:["id","class"],dt:["id","class"],dd:["id","class"],html:["id","class"],body:["id","class"],section:["id","class"],aside:["id","class"]},selfClosing:["br","hr","area","base","basefont","input","meta","img"],allowedSchemes:["http","https","ftp","mailto"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:[],allowProtocolRelative:!0,allowedIframeHostnames:["www.youtube.com","player.vimeo.com"]}),i="\n <!DOCTYPE html>\n <html>\n <head>\n <title>".concat(o.title,"</title>\n </head>\n <body>\n <div>\n ").concat(i,"\n </div>\n </body>\n </html>\n "),i=(a=m.load(i,{decodeEntities:!1}))("html"),n={},i.find("[id]").attr("id",function(t,e){return n[e]=(n[e]||0)+1,-1===e.indexOf("fn-")&&-1===e.indexOf("fnref-")&&1<n[e]?e="".concat(e,"-").concat(n[e]):e}),i.find(".remove-from-epub, .visually-hidden, .is-screen-only, .is-print-only").remove(),i.find(".quire-figure--group").each(function(t,e){var n=a(e).html();return a(e).replaceWith("".concat(n))}),i.find("figure").each(function(t,e){var n,r=void 0!==a(e).find("img").attr("id")?a(e).find("img").attr("id"):"",i=void 0!==a(e).find("img").attr("src")?a(e).find("img").attr("src"):"",o=a(e).find("figcaption");return o.length&&(n=a("<figcaption></figcaption>"),o.each(function(t,e){n.append(a(e).html()),t<o.length-1&&n.append("<br/>")})),a(e).replaceWith('<span id="'.concat(r,'"></span><figure><img src="').concat(i,'"/>').concat(n,"</figure>"))}),i.find("a").attr("href",function(t,e){var n;return-1!==e.indexOf("empty")&&(n=e.replace("#empty-",""),r(new Error("Fragment identifier on page ".concat(n,' of <a href="#"></a> could not be found. Please correct this and try again.')),null)),function(t,e){if(t.match(/^(https|http|www)/))return t;if(-1!==t.indexOf("#")){for(var n=t.split("#"),r=0;r<e.length;r++){var i=e[r].link.replace(/[^a-zA-Z0-9 ]/g,"");if(n[0].replace(/[^a-zA-Z0-9 ]/g,"")===i)return t="#".concat(n[1],"-").concat(e[r].title)}return t}for(var o=0;o<e.length;o++)if(t===e[o].link)return t="#".concat(e[o].title);return t}(e,c)}),i.find("sup").each(function(t,e){var n=a(e).attr(),r=a(e).html(),i=void 0!==n.class?'class="'.concat(n.class,'"'):"",n=void 0!==n.id?'id="'.concat(n.id,'"'):"";return a(e).replaceWith("<sup><span ".concat(i," ").concat(n,">").concat(r,"</span></sup>"))}),d.existsSync("epub/template.xhtml")?d.copyFileSync("epub/template.xhtml","html/template.xhtml"):v("html/template.xhtml",'<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE html>\n<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" $if(lang)$ xml:lang="$lang$" $endif$>\n\n<head>\n <meta charset="utf-8" />\n <meta name="generator" content="pandoc" />\n <title>$pagetitle$</title>\n <style type="text/css">\n $if(quotes)$ q {\n quotes: "“" "”" "‘" "’";\n }\n\n $endif$\n </style>\n $if(highlighting-css)$\n <style type="text/css">\n $highlighting-css$\n </style>\n $endif$ $for(css)$\n <link rel="stylesheet" type="text/css" href="$css$" /> $endfor$ $for(header-includes)$ $header-includes$ $endfor$\n</head>\n<body$if(coverpage)$ id="cover" $endif$>\n \n $if(titlepage)$\n <section epub:type="titlepage">\n $for(title)$ $if(title.type)$\n <h1 class="$title.type$">$title.text$</h1>\n $else$\n <h1 class="title">$title$</h1>\n $endif$ $endfor$ $if(subtitle)$\n <p class="subtitle">$subtitle$</p>\n $endif$ $for(author)$\n <p class="author">$author$</p>\n $endfor$ $for(creator)$\n <p class="$creator.role$">$creator.text$</p>\n $endfor$ $if(publisher)$\n <p class="publisher">$publisher$</p>\n $endif$ $if(date)$\n <p class="date">$date$</p>\n $endif$ $if(rights)$\n <div class="rights">$rights$</div>\n $endif$\n </section>\n $else$ \n\n $for(include-before)$ \n $include-before$ \n $endfor$ \n \n $body$ \n \n $for(include-after)$ \n $include-after$ \n $endfor$ \n\n $endif$\n </body>\n\n</html>'),i=a("<div>").append(i.clone()).html(),v("html/epub.xhtml",i),t(a.html()))})}},{key:"buildEpubFiles",value:(e=E(j.mark(function t(n){var r;return j.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,d.existsSync("./html")||d.mkdirSync("./html"),e.next=5,this.createReformatedHashLinkArrAndcreateLinkArr(n);case 5:return r=e.sent,e.next=8,this.buildHTML(n,r[0],r[1]);case 8:return e.next=10,this.buildMetadata(n);case 10:return e.abrupt("return",new Promise(function(t){return t(!0)}));case 13:return e.prev=13,e.t0=e.catch(0),b(e.t0,this.spinner),e.abrupt("return",new Promise(function(t){return t(e.t0)}));case 17:case"end":return e.stop()}},t,this,[[0,13]])})),function(t){return e.apply(this,arguments)})}]),r}(),x=require("cheerio"),S=require("path"),_=require("upath"),k=function(){function r(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{outputDir:"site",imageDir:"img"};a(this,r),this.config=n,this.epubTitle=e,this.$=x.load(t),this.content=this.$("#main")||this.$(".quire__primary__inner"),this.title=this.determineTitle(),this.chapterId=this.determineChapterId(),this.images=this.content.find("img"),this.links=this.content.find("a"),this.reformatedHashLinkArr="",this.reformatPage();t={title:this.title,body:this.body(),reformatedHashLinkArr:this.reformatedHashLinkArr};return this.href()&&(t.linkTitleArr={},t.href=this.href(),t.linkTitleArr.link=this.santizeUrl(this.href()),t.linkTitleArr.title=this.pandocTitle(this.chapterId)),t}return c(r,[{key:"santizeUrl",value:function(t){if(void 0!==t)return t=t.toLowerCase().trim().replace(".xhtml","").replace(/^\//,"").replace(/\/$/,"").replace(/\./g,"")}},{key:"pandocTitle",value:function(t){return(t=t!==this.epubTitle?t.replace(/[^a-zA-Z0-9 ]/g," "):t.replace(/\’/g,"").replace(/[^a-zA-Z0-9.]/g," ")).toLowerCase().replace(/\s\s+/g," ").trim().replace(/\s/g,"-")}},{key:"attrMatches",value:function(t,e,n){return this.$(t).attr(e).match(n)}},{key:"epubLink",value:function(t){if(t.match(/^(https|http|www)/))return t;if(-1!==t.indexOf("#"))return t;t=_.normalize(t.replace("localhost:1313","")).replace(/^\//,"").replace(/\/$/,"").replace(/\./g,"").replace(/\’/g,"");return t=""!==t?"".concat(t):"#".concat(this.pandocTitle(this.epubTitle))}},{key:"determineTitle",value:function(){var t;return this.content.find("h1")?t=this.content.find("h1").text():this.content.find("h2")&&(t=this.content.find("h2").text()),t||"Cover"}},{key:"determineChapterId",value:function(){var t;return this.content.find(".quire-contents-header > h1")&&void 0!==this.content.find(".quire-contents-header > h1").attr("id")&&(t=this.content.find(".quire-contents-header > h1").attr("id")),(t=this.content.find("h1.quire-page__header__title")&&void 0!==this.content.find("h1.quire-page__header__title").attr("id")?this.content.find("h1.quire-page__header__title").attr("id"):t)||this.epubTitle}},{key:"body",value:function(){return this.$.xml(this.content)}},{key:"href",value:function(){var t=this.$('link[rel="canonical"]');return t?this.epubLink(t.attr("href")):null}},{key:"reformatPage",value:function(){var n,r,i=this;i.content.find('[id*=":"]').attr("id",function(t,e){return e.replace(":","-")}),i.images.attr("src",function(t,e){e=e.replace(/^(\.+\/)+img\//,"");return S.resolve(S.join(i.config.outputDir,i.config.imageDir),e).replace(/\/localhost:1313/,i.config.outputDir)}),n={},r=[],i.links.not(function(t,e){return i.attrMatches(e,"href",/^#/)}).attr("href",function(t,e){return"".concat(i.epubLink(e))}),i.links.filter(function(t,e){return-1!==i.$(e).attr("href").indexOf("#")}).filter(function(t,e){return"#"!==i.$(e).attr("href").charAt(0)}).attr("href",function(t,e){return e.toLowerCase()}).attr("href",function(t,e){return decodeURIComponent(e)}).attr("href",function(t,e){return decodeURI(e)}).attr("href",function(t,e){return e.match(/^(https|http|www)/)?e:(e=e.replace("//localhost:1313","").replace(/^\//,"").replace(/\/$/,"").replace(":","-").replace(".","-").replace(/\s/g,"-"),r.push({internalLinksOtherPage:"#".concat(e)}),"".concat(e))}),i.links.filter(function(t,e){return i.attrMatches(e,"href",/^#/)}).filter(function(t,e){return-1===i.$(e).attr("href").indexOf("/")}).attr("href",function(t,e){return e.toLowerCase()}).attr("href",function(t,e){return decodeURIComponent(e)}).attr("href",function(t,e){return decodeURI(e)}).attr("href",function(t,e){return e.replace("#cover","#".concat(i.pandocTitle(i.epubTitle)))}).attr("href",function(t,e){return e!=="#".concat(i.pandocTitle(i.epubTitle))?e.replace(/[^a-zA-Z0-9 ]/g," "):e}).attr("href",function(t,e){return(e=e.substring(1)).replace(/\s\s+/g," ")}).attr("href",function(t,e){return e.replace(":","-")}).attr("href",function(t,e){return(e=(e=""!==e?e:"empty").replace(/\s/g,"-"))!=="".concat(i.pandocTitle(i.epubTitle))?(r.push({internalLinks:"#".concat(e,"-").concat(i.pandocTitle(i.chapterId)),mdPage:"".concat(i.pandocTitle(i.chapterId))}),"#".concat(e,"-").concat(i.pandocTitle(i.chapterId))):(r.push({internalLinks:"#".concat(e)}),"#".concat(e))}),"contents"===i.pandocTitle(i.title)&&i.links.filter(function(t,e){return i.attrMatches(e,"href",/^#/)}).attr("href",function(t,e){return n[e]=(n[e]||0)+1,1<n[e]?(r.push({tocInternalLinks:"".concat(e,"-").concat(n[e])}),e="".concat(e,"-").concat(n[e])):e}),i.reformatedHashLinkArr=r,i.content.find("h1").each(function(t,e){var n=void 0!==(n=i.$(e).attr("id"))?n.toLowerCase().replace(/[^a-zA-Z0-9 ]/g," ").replace(/\s\s+/g," ").replace(/\s/g,"-"):"cover";return i.$(e).attr("id",n)}),i.content.find("[id]").not("h1").attr("id",function(t,e){return decodeURIComponent(e)}).attr("id",function(t,e){return decodeURI(e)}).attr("id",function(t,e){return e.toLowerCase()}).attr("id",function(t,e){return e.replace(/[^a-zA-Z0-9 ]/g," ")}).attr("id",function(t,e){return e.replace(/\s\s+/g," ")}).attr("id",function(t,e){return e.replace(/\s/g,"-")}).attr("id",function(t,e){return"".concat(e,"-").concat(i.pandocTitle(i.chapterId))})}}]),r}();function P(t,e){for(var n=0,r=t.length-1;0<=r;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;)t.unshift("..");return t}function F(t){return O.exec(t).slice(1)}var O=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;function A(){for(var t="",e=!1,n=arguments.length-1;-1<=n&&!e;n--){var r=0<=n?arguments[n]:"/";if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(t=r+"/"+t,e="/"===r.charAt(0))}return(e?"/":"")+(t=P(T(t.split("/"),function(t){return!!t}),!e).join("/"))||"."}function L(t){var e=I(t),n="/"===$(t,-1);return(t=!(t=P(T(t.split("/"),function(t){return!!t}),!e).join("/"))&&!e?".":t)&&n&&(t+="/"),(e?"/":"")+t}function I(t){return"/"===t.charAt(0)}var M={extname:function(t){return F(t)[3]},basename:function(t,e){return t=F(t)[2],t=e&&t.substr(-1*e.length)===e?t.substr(0,t.length-e.length):t},dirname:function(t){var t=(e=F(t))[0],e=e[1];return t||e?t+(e=e&&e.substr(0,e.length-1)):"."},sep:"/",delimiter:":",relative:function(t,e){function n(t){for(var e=0;e<t.length&&""===t[e];e++);for(var n=t.length-1;0<=n&&""===t[n];n--);return n<e?[]:t.slice(e,n-e+1)}t=A(t).substr(1),e=A(e).substr(1);for(var r=n(t.split("/")),i=n(e.split("/")),o=Math.min(r.length,i.length),a=o,c=0;c<o;c++)if(r[c]!==i[c]){a=c;break}for(var u=[],c=a;c<r.length;c++)u.push("..");return(u=u.concat(i.slice(a))).join("/")},join:function(){return L(T(Array.prototype.slice.call(arguments,0),function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},isAbsolute:I,normalize:L,resolve:A};function T(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}var $="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)},R=require("command-exists").sync,C=require("fs-extra"),N=require("js-yaml"),q=require("url").URL;function U(t,e){return D.apply(this,arguments)}function D(){return(D=E(j.mark(function t(e,n){return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,C.ensureDir(n);case 2:if(C.existsSync(e)){t.next=4;break}throw new Error("".concat(e," does not exist"));case 4:return t.next=6,C.copy(e,n);case 6:return t.abrupt("return",!0);case 7:case"end":return t.stop()}},t)}))).apply(this,arguments)}function B(t){return N.safeLoad(C.readFileSync(t,"utf8"))}function G(e){if(C.existsSync(e))return new Promise(function(t){t(C.unlinkSync(e))})}function W(t){return!R(t)}function z(e){if("string"==typeof e){-1===e.indexOf("://")&&-1<e.indexOf(":")&&(e="http://"+e);try{return new q(e).pathname}catch(t){if(t instanceof TypeError)return M.parse(e||"").name}}}function V(){return"win32"===process.platform}function H(t,e){return 1===e?t:"".concat(t,"s")}var Y=require("events"),K=require("lodash"),J=require("axios"),Z=require("path"),X=require("url").URL,Q=require("striptags"),tt=function(){function r(t,e){var n;return a(this,r),(n=s(this,f(r).call(this))).data=t,n.config=e,n.outputDir=n.config.outputDir||"site",n.imageDir=n.config.imageDir||"img",n}var t,e;return l(r,Y),c(r,[{key:"title",value:function(){return this.data.subtitle&&this.data.reading_line?"".concat(this.data.title,": ").concat(this.data.subtitle," ").concat(this.data.reading_line):this.data.subtitle?"".concat(this.data.title,": ").concat(this.data.subtitle):"".concat(this.data.title)}},{key:"creators",value:function(){return!!this.data.contributor&&K.castArray(this.data.contributor).filter(function(t){return"primary"===t.type}).map(function(t){var e=t.full_name||"".concat(t.first_name," ").concat(t.last_name),n={name:e,role:"".concat(t.role||"aut")};return t.last_name&&t.first_name?n["file-as"]="".concat(t.last_name,", ").concat(t.first_name):(e=e.split(" "),n["file-as"]="".concat(e[1],", ").concat(e[0]),n.fullname=!0),n})}},{key:"contributors",value:function(){return!!this.data.contributor&&K.castArray(this.data.contributor).filter(function(t){return"secondary"===t.type}).map(function(t){var e=t.full_name||"".concat(t.first_name," ").concat(t.last_name),n={name:e,role:"".concat(t.role||"ctb")};return t.last_name&&t.first_name?n["file-as"]="".concat(t.last_name,", ").concat(t.first_name):(e=e.split(" "),n["file-as"]="".concat(e[1],", ").concat(e[0]),n.fullname=!0),n})}},{key:"publishers",value:function(){return!!this.data.publishers&&K.castArray(this.data.publishers).map(function(t){return t.location?"".concat(t.name,", ").concat(t.location):"".concat(t.name)})}},{key:"loadChapterURLs",value:(e=E(j.mark(function t(){var e;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.data.chapters,e=e.map(function(t){return J.get(t,{adapter:require("axios/lib/adapters/http")})}),t.next=4,Promise.all(e);case 4:return e=t.sent,t.abrupt("return",e);case 6:case"end":return t.stop()}},t,this)})),function(){return e.apply(this,arguments)})},{key:"generate",value:(t=E(j.mark(function t(){var e,n,r=this;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e={title:this.title(),cover:this.data.promo_image,url:this.data.publisher[0].url,isbn:this.data.identifier.isbn,language:this.data.language,date:this.data.pub_date,creators:this.creators(),contributors:this.contributors(),publisher:this.data.publisher[0].name,description:Q(this.data.description.full).replace(/\r?\n|\r/g," "),rights:this.data.copyright,css:this.getStylesheetUrl()},t.next=3,this.loadChapterURLs();case 3:return n=t.sent,n=n.map(function(t){return new k(t.data,e.title,{outputDir:r.outputDir,imageDir:r.imageDir})}),e.pages=n,t.abrupt("return",new Promise(function(t){return t(e),e}));case 7:case"end":return t.stop()}},t,this)})),function(){return t.apply(this,arguments)})},{key:"getStylesheetUrl",value:function(){var t=z(this.config.baseURL),t=Z.join(t,"css","epub.css");return[new X(t,"http://localhost:1313").href.toLowerCase()]}}]),r}(),et=require("execa"),nt=require("fs-extra"),rt=require("ora"),it=require("path"),ot=require("rimraf");function at(){return(at=E(j.mark(function t(){var a,c,u,s,f,l,h,r,i,e,n,o,p,d,v,g,y,m,b,w,x,S,_,k;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return k=function(){var t,e;h.length&&(t=h.filter(function(t){return"error"===t.status}),a.clear(),console.log("::Summary::"),e="Processed ".concat(h.length," ").concat(H("item",h.length)),e+=t.length?" with ".concat(t.length," ").concat(H("failure",t.length)):"",console.log(e),t.length&&(console.log("\nUnable to process the following files."),t.forEach(function(t){a.fail("".concat(t.image," - ").concat(t.message))})),console.log("\n"),a.succeed("Completed processing images.\n"))},_=function(){return(_=E(j.mark(function t(){var e,n,r,i;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:for(e=nt.readdirSync(u),n=0;n<s.length;n++)r=it.parse(s[n]).base,i=it.parse(s[n]).name,e.includes(i)?h.push({image:r,status:"success"}):h.push({image:r,status:"error",message:"Ensure file has proper exif headings"});case 2:case"end":return t.stop()}},t)}))).apply(this,arguments)},S=function(){return _.apply(this,arguments)},x=function(){return(x=E(j.mark(function t(){return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,S();case 2:v(it.normalize("static/img/iiif/processed")),p(),k();case 5:case"end":return t.stop()}},t)}))).apply(this,arguments)},w=function(){return x.apply(this,arguments)},b=function(){return(b=E(j.mark(function t(){return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(l=s.length,console.log("\nProcessing project image resources for IIIF."),0===l)return console.log("\n"),a.fail("No images found in ".concat(c,"\n")),t.abrupt("return");t.next=6;break;case 6:return console.log("\nGenerating IIIF image tiles may take a while depending on the size of each image file.\n"),a.start("Processing ".concat(l," ").concat(H("image",s.length),"...")),t.next=10,E(j.mark(function t(){var e,n,r,i,o;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n=!(e=!0),r=void 0,t.prev=3,i=s[Symbol.iterator]();case 5:if(e=(o=i.next()).done){t.next=12;break}return o=o.value,t.next=9,d(o).then(function(){l--,f++}).catch(function(){l--}).finally(function(){a.start("Processed ".concat(f,"/").concat(s.length," ").concat(H("image",s.length),"..."))});case 9:e=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),n=!0,r=t.t0;case 18:t.prev=18,t.prev=19,e||null==i.return||i.return();case 21:if(t.prev=21,n)throw r;t.next=24;break;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}},t,null,[[3,14,18,26],[19,,21,25]])}))();case 10:case"end":return t.stop()}},t)}))).apply(this,arguments)},m=function(){return b.apply(this,arguments)},y=function(){if(!nt.existsSync(c))throw a.fail("'".concat(c,"' directory was not found!")),new error;for(var o=nt.readdirSync(c),t=0;t<o.length;t++)!function(t){var e=(i=it.parse(o[t])).ext,n=i.name,r=(i.base,it.join(c,o[t])),i=it.join(u,n);(n=[".jp2",".jpg",".jpeg",".png",".svg",".tif",".tiff"]).some(function(t){return t===e.toLowerCase()})?s.push(r):[".ai",".bmp",".gif",".heif",".ind",".pdf",".psd",".raw",".webp"].some(function(t){return t===e.toLowerCase()})&&h.push({image:o[t],status:"error",message:"File type must be one of the following: ".concat(n.join(", "),".")}),nt.existsSync(i)&&nt.lstatSync(i).isDirectory()&&ot.sync(i)}(t)},g=function(){return(g=E(j.mark(function t(e){var n,r,i,o,a;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:i=nt.readdirSync(e).map(function(t){return it.join(e,t)}),n=i.filter(function(t){return nt.statSync(t).isFile()}),o=i.filter(function(t){return!n.includes(t)}),o.reduce(function(t,e){return t.concat(v(e))},[]),n.length&&n[0].includes("color")&&(r=n[0],a=r.substr(0,r.lastIndexOf("/")),i=a+"/default.jpg",o=n[1],a=a+"/default.jpg.attrs",nt.renameSync(r,i),nt.renameSync(o,a));case 5:case"end":return t.stop()}},t)}))).apply(this,arguments)},v=function(t){return g.apply(this,arguments)},d=function(t){var e="file://".concat(it.normalize(__dirname)).concat(it.normalize(i)),n="".concat(it.normalize(__dirname)).concat(it.normalize(r)),t=it.parse(t).base;return et(n,["-config-source",e,"-quality","default","-verbose","-refresh","-noextension","-scale-factors","32,16,8,4,2,1",t])},p=function(){return nt.unlinkSync(n)},o=function(){var t=JSON.parse(nt.readFileSync(e));t.images.source.path=it.normalize(process.cwd()+"/"+c),t.derivatives.cache.path=it.normalize(process.cwd()+"/"+u),t=JSON.stringify(t,null,2),nt.writeFileSync(n,t,"utf8")},a=rt(),c="static/img/iiif/",u="static/img/iiif/processed",s=[],f=0,h=[],r=V()?"/go-iiif/bin/iiif-tile-seed-win":"linux"===process.platform?"/go-iiif/bin/iiif-tile-seed-linux":"/go-iiif/bin/iiif-tile-seed-macos",i="/go-iiif/config/",e=it.join(__dirname,it.normalize("/go-iiif/config/config.template")),n=it.join(__dirname,it.normalize("/go-iiif/config/config.json")),nt.existsSync(u)||nt.mkdirSync(u,{recursive:!0}),t.abrupt("return",new Promise(function(t,e){try{o()}catch(t){a.fail("Failed to generate go-iiif config"),e(t)}try{y()}catch(t){a.fail("Failed to slice any images!"),e(t)}m().then(function(){w(),t()}).catch(function(t){e(t)})}));case 25:case"end":return t.stop()}},t)}))).apply(this,arguments)}function qt(t){try{return!!t()}catch(t){return!0}}function ct(t){return Nt?Ct.createElement(t):{}}function Ut(t,e){if(!zt(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!zt(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!zt(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!zt(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}function Dt(t){return"Symbol(".concat(void 0===t?"":t,")_",(++Zt+Xt).toString(36))}function ut(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}var st=require("events"),ft=require("lodash"),lt=require("execa"),ht=require("yaml-front-matter"),pt=require("fs-extra"),dt=require("glob"),vt=require("hugo-bin"),gt=require("path"),yt=require("child_process").spawn,mt=require("child_process").spawnSync,bt=require("child_process").execFileSync,wt=require("child_process").execSync,xt=(require("util").promisify(pt.writeFile),require("url").URL),St=require("chalk"),_t=require("ora"),kt=require("js-yaml"),jt=require("perf_hooks").performance,Et=function(){function n(t){var e;return a(this,n),(e=s(this,f(n).call(this))).config=e.loadConfig(),e.config.publishDir||(e.config.publishDir="site"),e.theme=e.config.theme,e.chapters=e.loadChapters(),e.verbose=t,e}var r,i,o,e,t;return l(n,st),c(n,[{key:"runPandoc",value:function(t,e){e=["--from=html-native_divs+native_spans","--to=epub ".concat(gt.join("html","epub.xhtml")),"--output=".concat(t),"--epub-metadata=".concat(gt.join("html","dc.xml")),"--epub-cover-image=".concat(e),"--template=".concat(gt.join("html","template.xhtml")),"--css=".concat(gt.join(this.config.publishDir,"css","epub.css")),"--standalone"];wt("pandoc ".concat(e.join(" ")))}},{key:"getBaseUrl",value:function(t){var e=this;return t.map(function(t){return e.loadConfig(t)}).filter(function(t){return void 0!==t.baseURL})}},{key:"iiif",value:(t=E(j.mark(function t(){return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,function(){return at.apply(this,arguments)}();case 2:case"end":return t.stop()}},t)})),function(){return t.apply(this,arguments)})},{key:"loadConfig",value:function(t){try{return B(t||"config.yml")}catch(t){this.emit("error",t)}}},{key:"loadBookData",value:function(){try{return B(gt.join("data","publication.yml"))}catch(t){this.emit("error",t)}}},{key:"loadChapters",value:function(){var t=dt.sync(gt.join(this.config.contentDir||"content","**","*.md"));return ft.sortBy(t,function(t){return ht.loadFront(t).weight})}},{key:"preview",value:function(t){t=void 0!==t?t:"webpack.config.dev.js",t=gt.join("webpack",t);var e=this.verbose?"inherit":["pipe","pipe",process.stderr],n=gt.join("themes",this.theme),r=V()?"webpack.cmd":"webpack",i=gt.join("node_modules",".bin",r);this.emit("info","Launching preview server");r=_t({text:"Launching preview server"}).start();this.webpack=yt(i,["--watch","-d","--progress","--color","--config",t],{cwd:n,stdio:e}),this.hugo=this.spawnHugo("server","--config=config.yml,".concat(gt.join("config","environments","dev.yml")),"--watch","--disableFastRender"),r.info("Navigate to http://localhost:1313 to see your changes."),r.info('Press Control+C or type "quire stop" to stop the preview.')}},{key:"install",value:function(){var i=this;return new Promise(function(t){var e=i.config.theme,n=V()?"npm.cmd":"npm",r=_t({text:"Installing theme dependencies..."}).start();mt(n,["install"],{cwd:gt.join("themes",e),stdio:"inherit"}),r.succeed("Theme dependencies successfully installed."),r.succeed("Run quire preview to view changes locally."),t(!0)})}},{key:"buildTheme",value:function(t,e){e=e.replace(/\/?$/,"/"),t=void 0!==t?t:"webpack.config.dev.js";var n=["--config",t=gt.join("webpack",t)];-1!==t.indexOf("prod")&&(n.push("--output-public-path"),n.push(e));t=this.verbose?"inherit":["pipe","pipe",process.stderr],e=V()?"webpack.cmd":"webpack",e=gt.join("node_modules",".bin",e);return lt(e,n,{cwd:gt.join("themes",this.theme),stdio:t})}},{key:"buildWeb",value:(e=E(j.mark(function t(n){var r,i,o,a=this;return j.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=["config.yml",gt.join("config","site.yml")],n&&r.push(gt.join("config","environments","".concat(n,".yml"))),r.forEach(function(t){t=a.loadConfig(t);a.config=ft.merge(a.config,t)}),i=""!==this.getBaseUrl(r)?this.getBaseUrl(r):"/",i=void 0!==i[0]&&" "!==i[0].baseURL&&""!==i[0].baseURL?i[0].baseURL:"/",o=_t({text:"Building theme assets..."}).start(),e.prev=6,e.next=9,this.buildTheme("webpack.config.prod.js",i);case 9:return o.stopAndPersist({symbol:"✔ ",text:"Assets built"}),bt(vt,["--config="+r.join(",")],{stdio:"inherit"}),o.succeed("Site built successfully"),o.succeed("Files output to: ".concat(this.config.publishDir)),e.abrupt("return",new Promise(function(t){t(!0)}));case 16:return e.prev=16,e.t0=e.catch(6),e.abrupt("return",new Promise(function(t){t(e.t0),a.errorExit("".concat(e.t0),o)}));case 19:case"end":return e.stop()}},t,this,[[6,16]])})),function(t){return e.apply(this,arguments)})},{key:"getURLforChapter",value:function(t){var e=this.config.contentDir||"content",n=gt.parse(gt.relative(e,t)),r=z(this.config.baseURL),i="http://localhost:1313";if(ht.loadFront(t).url){e=ht.loadFront(t).url;return new xt(gt.join(r,e),i).href.toLowerCase()}if(ht.loadFront(t).slug){t=ht.loadFront(t).slug;return new xt(gt.join(r,n.dir,t),i).href.toLowerCase()}return("_index"===n.name||"index"===n.name?new xt(gt.join(r,n.dir),i):new xt(gt.join(r,n.dir,n.name),i)).href.toLowerCase()}},{key:"buildPDF",value:(o=E(j.mark(function t(n,r){var i,o,a,c,u,s,f,l,h,p=this;return j.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,G(gt.join("themes",this.theme,"static","css","application.css"));case 2:return i=V()?'C:\\"Program Files (x86)"\\Prince\\engine\\bin\\prince.exe':"prince",o=_t("Building PDF").start(),a=jt.now(),V()||this.checkForCommand(i,o),c=["config.yml",gt.join("config","pdf.yml")],r&&c.push(gt.join("config","environments","".concat(r,".yml"))),c.forEach(function(t){t=p.loadConfig(t);p.config=ft.merge(p.config,t)}),n=void 0!==n?n:gt.join("static","downloads","output"),-1!==(u=gt.basename(n)).indexOf(".")&&(u=(n=u.split("."))[0]),s=n.substring(0,n.lastIndexOf("/")),e.prev=13,e.next=16,pt.ensureDir(s);case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(13),this.errorExit("".concat(e.t0),o);case 21:return s=void 0!==s&&""!==s?s:gt.join("static","downloads"),u=void 0!==u&&""!==u?u:"output",f=gt.join(s,u),l=""!==this.getBaseUrl(c)?this.getBaseUrl(c):"localhost:1313",h=void 0!==l[0]&&" "!==l[0].baseURL&&""!==l[0].baseURL?l[0].baseURL:"localhost:1313",l="http://",h.substr(0,l.length)!==l&&(h=l+h),e.prev=28,e.next=31,this.buildTheme("webpack.config.prod.js",h);case 31:return e.next=33,this.spawnHugo("server","--config="+c.join(","),"--disableFastRender");case 33:return this.hugo=e.sent,e.next=36,this.hugo.ready;case 36:return e.sent&&(h=this.loadChapters(),h=ft.filter(h,function(t){return!1!==ht.loadFront(t).pdf}).map(function(t){return p.getURLforChapter(t)}),pt.existsSync(gt.join("themes",this.theme,"static","css","application.css")),wt("".concat(i," ").concat(h.toString().replace(/,/g," ")," -o ").concat(f,".pdf --no-warn-css-unsupported --no-warn-css-unknown --no-warn-css")),o.succeed("PDF output to: ".concat(f,".pdf")),o.info("Execution Time: ".concat(((jt.now()-a)/1e3).toFixed(3)," seconds"))),e.abrupt("return",new Promise(function(t){t(!0),p.hugo.kill()}));case 41:return e.prev=41,e.t1=e.catch(28),e.abrupt("return",new Promise(function(t){t(!1),p.hugo.kill(),p.errorExit("".concat(e.t1),o)}));case 44:case"end":return e.stop()}},t,this,[[13,18],[28,41]])})),function(t,e){return o.apply(this,arguments)})},{key:"buildEpub",value:(i=E(j.mark(function t(n,r){var i,o,a,c,u,s,f,l,h,p,d,v=this;return j.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=_t("Building EPUB").start(),o=jt.now(),this.checkForCommand("pandoc",i),e.next=5,G(gt.join("themes",this.theme,"static","css","epub.css"));case 5:c=["config.yml",gt.join("config","epub.yml")],r&&c.push(gt.join("config","environments","".concat(r,".yml"))),c.forEach(function(t){t=v.loadConfig(t);v.config=ft.merge(v.config,t)}),e.prev=8,a=kt.safeLoad(pt.readFileSync(gt.join("data","publication.yml"),"utf8")),e.next=16;break;case 12:if(e.prev=12,e.t0=e.catch(8),e.t0)return e.abrupt("return",this.errorExit("".concat(e.t0),i));e.next=16;break;case 16:return void 0!==a.title&&""!==a.title&&null!==a.title||this.errorExit("A title for your publication must be specified in the publication.yml file.",i),void 0!==a.language&&""!==a.language&&null!==a.language||this.errorExit("A language for your publication must be specified in the publication.yml file.",i),s=""!==this.getBaseUrl(c)?this.getBaseUrl(c):"/",u=void 0!==s[0]&&" "!==s[0].baseURL&&""!==s[0].baseURL?s[0].baseURL:"/",e.prev=20,e.next=23,this.spawnHugo("server","--renderToDisk","--config="+c.join(","),"--disableFastRender");case 23:return this.hugo=e.sent,e.next=26,this.buildTheme("webpack.config.epub.js",u);case 26:return e.next=28,this.hugo.ready;case 28:if(e.sent)return e.next=32,pt.copy(gt.join("themes",this.theme,"static","css","epub.css"),gt.join(this.config.publishDir,"css","epub.css"));e.next=62;break;case 32:return s=this.loadBookData(),f=this.config,s.chapters=this.chapters.filter(function(t){return!1!==ht.loadFront(t).epub}).map(function(t){return v.getURLforChapter(t)}),e.next=37,new tt(s,f);case 37:return f=e.sent,e.next=40,f.generate();case 40:return p=e.sent,e.next=43,new w(p,i);case 43:if(l=e.sent,pt.existsSync("html"))return h=void 0!==n?n:gt.join("static","downloads","output"),d=gt.dirname(h),gt.basename(h),e.next=52,pt.ensureDir(d);e.next=62;break;case 52:return p=l.data.cover?gt.join("static","img",l.data.cover.replace("http://localhost:1313/img/","")):"",d="".concat(h,".epub"),this.runPandoc(d,p),i.succeed("Filepath: ".concat(h,".epub")),i.info("Execution Time: ".concat(((jt.now()-o)/1e3).toFixed(3)," seconds")),e.next=59,G(gt.join("site","source.js"));case 59:return e.next=61,G(gt.join("themes",this.theme,"static","source.js"));case 61:return e.abrupt("return",new Promise(function(t){t(!0),v.hugo.kill(),l.removeHTML()}));case 62:e.next=67;break;case 64:return e.prev=64,e.t1=e.catch(20),e.abrupt("return",new Promise(function(t){t(!1),v.hugo.kill(),v.errorExit("".concat(e.t1),i)}));case 67:case"end":return e.stop()}},t,this,[[8,12],[20,64]])})),function(t,e){return i.apply(this,arguments)})},{key:"buildMobi",value:(r=E(j.mark(function t(n,r){var i,o,a,c,u,s,f,l,h,p,d,v,g,y=this;return j.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=_t("Building MOBI").start(),o=jt.now(),this.checkForCommand("pandoc",i),e.next=5,G(gt.join("themes",this.theme,"static","css","epub.css"));case 5:c=["config.yml",gt.join("config","epub.yml")],r&&c.push(gt.join("config","environments","".concat(r,".yml"))),c.forEach(function(t){t=y.loadConfig(t);y.config=ft.merge(y.config,t)}),e.prev=8,a=kt.safeLoad(pt.readFileSync(gt.join("data","publication.yml"),"utf8")),e.next=16;break;case 12:if(e.prev=12,e.t0=e.catch(8),e.t0)return e.abrupt("return",this.errorExit("".concat(e.t0),i));e.next=16;break;case 16:return void 0!==a.title&&""!==a.title&&null!==a.title||this.errorExit("A title for your publication must be specified in the publication.yml file.",i),void 0!==a.language&&""!==a.language&&null!==a.language||this.errorExit("A language for your publication must be specified in the publication.yml file.",i),f=""!==this.getBaseUrl(c)?this.getBaseUrl(c):"/",u=void 0!==f[0]&&" "!==f[0].baseURL&&""!==f[0].baseURL?f[0].baseURL:"/",e.prev=20,e.next=23,this.spawnHugo("server","--renderToDisk","--config="+c.join(","),"--disableFastRender");case 23:return this.hugo=e.sent,e.next=26,this.buildTheme("webpack.config.epub.js",u);case 26:return e.next=28,this.hugo.ready;case 28:if(e.sent)return e.next=32,pt.copy(gt.join("themes",this.theme,"static","css","epub.css"),gt.join(this.config.publishDir,"css","epub.css"));e.next=65;break;case 32:return s=this.loadBookData(),f=this.config,s.chapters=this.chapters.filter(function(t){return!1!==ht.loadFront(t).epub}).map(function(t){return y.getURLforChapter(t)}),e.next=37,new tt(s,f);case 37:return g=e.sent,e.next=40,g.generate();case 40:return v=e.sent,e.next=43,new w(v,i);case 43:if(l=e.sent,pt.existsSync("html"))return h=void 0!==n?n:gt.join("static","downloads","output"),p=gt.dirname(h),d=gt.basename(h),e.next=52,pt.ensureDir(p);e.next=65;break;case 52:return g=l.data.cover?gt.join("static","img",l.data.cover):"",v="".concat(h,"-mobi.epub"),this.runPandoc(v,g),g=V()?"C:\\Program Files (x86)\\Kindle Previewer 3\\lib\\fc\\bin\\kindlegen":"/Applications/Kindle Previewer 3.app/Contents/lib/fc/bin/kindlegen",pt.existsSync(g)||this.errorExit("Warning: Kindle Previewer is required to generate MOBI files. Please visit https://kdp.amazon.com/en_US/help/topic/G202131170 for more info and install instructions.",i),wt('"'.concat(g,'" ').concat(h,"-mobi.epub -o ").concat(d,".mobi")),i.succeed("Filepath: ".concat(p,".mobi")),i.info("Execution Time: ".concat(((jt.now()-o)/1e3).toFixed(3)," seconds")),e.next=62,G(v);case 62:return this.hugo.kill(),l.removeHTML(),e.abrupt("return",new Promise(function(t,e){t(!0)}));case 65:e.next=70;break;case 67:return e.prev=67,e.t1=e.catch(20),e.abrupt("return",new Promise(function(t){t(!1),y.hugo.kill(),y.errorExit("".concat(e.t1),i)}));case 70:case"end":return e.stop()}},t,this,[[8,12],[20,67]])})),function(t,e){return r.apply(this,arguments)})},{key:"checkForCommand",value:function(t,e){W(t)&&this.errorExit("Please install ".concat(t," before continuing."),e)}},{key:"errorExit",value:function(t,e){e.fail(t),process.exit(1)}},{key:"spawnHugo",value:function(){var n,r,i=this,o="",a=yt(vt,Array.prototype.slice.call(arguments));return a.ready=new Promise(function(t,e){r=t,n=e}),a.stdout.on("data",function(t){var e=t.toString(),t=St.cyan(e);i.verbose&&console.log(t),-1<e.indexOf("Press Ctrl+C to stop")&&r(e,a)}),a.stderr.on("data",function(t){o+=t.toString()}),a.on("exit",function(t,e){o&&(i.emit("error",o),n(o,a))}),a}}]),n}(),Pt=require("events"),Ft=require("chalk"),Ot=(require("execa"),require("child_process").execSync,require("path")),At=(require("rimraf"),require("child_process").spawnSync),Lt=require("readline"),It=require("fs-extra"),Mt=function(){function e(){var t;return a(this,e),(t=s(this,f(e).call(this))).on("debug",t.debug),t.on("epub",t.epub),t.on("error",t.warn),t.on("process",t.process),t.on("install",t.install),t.on("mobi",t.mobi),t.on("new",t.create),t.on("pdf",t.pdf),t.on("preview",t.preview),t.once("shutdown",t.shutdown),t.on("site",t.site),t.on("template",t.template),t.isVerbose=!1,t}var n,t,r,i,o;return l(e,Pt),c(e,[{key:"create",value:function(t){var r=this,e=Ot.resolve(__dirname,"..","bin"),i="default",o="default",a=Ot.resolve(e,"starters",i),c=Ot.resolve(e,"themes",o),u=Ot.resolve(t),s=Ot.resolve(t,"themes",o);return new Promise(function(){var n=E(j.mark(function t(e,n){return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!W("git")){t.next=4;break}r.error("Please install Git before continuing."),t.next=29;break;case 4:if(!It.existsSync(u)){t.next=8;break}r.error("".concat(u," directory already exists, please select another project name.")),t.next=29;break;case 8:return r.notice("Creating project..."),r.notice("Using starter: ".concat(i)),t.next=12,U(a,u);case 12:return r.notice("Using theme: ".concat(o)),t.next=15,U(c,s);case 15:return r.notice("Initializing git in the new project directory..."),process.chdir(u),It.mkdirSync(Ot.join(a,"static","img","iiif"),{recursive:!0}),At("git",["init"]),W("git-lfs")?r.warn("Warning: Git LFS (Large File Storage) is required to publish repositories with files over 100 MB to GitHub. See documentation for more info and install instructions: https://quire.getty.edu/documentation/github. This message will not impact initialization of new project directory."):At("git-lfs",["track",'"static/downloads/**/*"','"static/img/**/*"']),r.notice("Committing starter files..."),At("git",["add","-A"]),At("git",["commit","-m","Add starter and theme to project"]),r.notice("Installing dependencies. This may take a minute..."),r.npmInstall(s),r.confirm("Theme and dependencies successfully installed."),r.notice("Run quire preview in your project folder to view changes locally."),e(!0),t.abrupt("return",!0);case 29:case"end":return t.stop()}},t)}));return function(t,e){return n.apply(this,arguments)}}())}},{key:"process",value:function(t){var e=this;this.project=new Et(this.verbose),this.project[t]||(this.error("".concat(t," is not a valid process option.")),this.shutdown()),this.project.on("info",this.notice),this.project.on("error",function(t){e.error(t),e.shutdown()}),this.project[t]()}},{key:"preview",value:function(){var e=this;return new Promise(function(t){e.project=new Et(e.verbose),e.project.on("info",e.notice),e.project.on("error",function(t){e.error(t),e.shutdown()}),e.project.preview(),e.listen(),t(!0)})}},{key:"site",value:(o=E(j.mark(function t(e){var n;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(n=new Et(this.verbose)).on("info",this.notice),n.on("error",this.error),t.prev=3,t.next=6,n.buildWeb(e);case 6:return t.abrupt("return",!0);case 9:return t.prev=9,t.t0=t.catch(3),t.abrupt("return",!1);case 12:case"end":return t.stop()}},t,this,[[3,9]])})),function(t){return o.apply(this,arguments)})},{key:"epub",value:(i=E(j.mark(function t(e,n){var r;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(r=new Et(this.verbose)).on("info",this.notice),r.on("error",this.error),t.prev=3,t.next=6,r.buildEpub(e,n);case 6:return t.abrupt("return",!0);case 9:return t.prev=9,t.t0=t.catch(3),t.abrupt("return",!1);case 12:case"end":return t.stop()}},t,this,[[3,9]])})),function(t,e){return i.apply(this,arguments)})},{key:"template",value:function(t){var e=new Et(this.verbose);e.on("info",this.notice),e.on("error",this.error),e.downloadTemplate(t)}},{key:"mobi",value:(r=E(j.mark(function t(e,n){var r;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(r=new Et(this.verbose)).on("info",this.notice),r.on("error",this.error),t.prev=3,t.next=6,r.buildMobi(e,n);case 6:return t.abrupt("return",!0);case 9:return t.prev=9,t.t0=t.catch(3),t.abrupt("return",!1);case 12:case"end":return t.stop()}},t,this,[[3,9]])})),function(t,e){return r.apply(this,arguments)})},{key:"install",value:(t=E(j.mark(function t(){var e;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(e=new Et(this.verbose)).on("info",this.notice),e.on("error",this.error),t.prev=3,t.next=6,e.install();case 6:return t.abrupt("return",!0);case 9:return t.prev=9,t.t0=t.catch(3),t.abrupt("return",!1);case 12:case"end":return t.stop()}},t,this,[[3,9]])})),function(){return t.apply(this,arguments)})},{key:"pdf",value:(n=E(j.mark(function t(e,n){var r;return j.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(r=new Et(this.verbose)).on("info",this.notice),r.on("error",this.error),t.prev=3,t.next=6,r.buildPDF(e,n);case 6:return t.abrupt("return",!0);case 9:return t.prev=9,t.t0=t.catch(3),t.abrupt("return",!1);case 12:case"end":return t.stop()}},t,this,[[3,9]])})),function(t,e){return n.apply(this,arguments)})},{key:"debug",value:function(){var t=new Et(this.verbose);t.on("info",this.notice),t.on("error",this.error),console.log(t)}},{key:"confirm",value:function(t){console.log(Ft.green(t))}},{key:"error",value:function(t){console.log(Ft.red(t+"Run `quire preview --verbose` for details")),process.exitCode=1}},{key:"notice",value:function(t){console.log(t)}},{key:"npmInstall",value:function(t){var e=V()?"npm.cmd":"npm";t=t||process.cwd(),At(e,["install"],{cwd:t},function(t){t&&this.emit("error",t)})}},{key:"shutdown",value:function(t){this.notice("Shutting down Quire"),this.project&&this.project.hasOwnProperty("hugo")&&this.project.hugo&&this.project.hugo.kill(),this.project&&this.project.hasOwnProperty("webpack")&&this.project.webpack&&this.project.webpack.kill(),t||process.exit(),process.exit()}},{key:"warn",value:function(t){console.log(Ft.yellow(t)),process.exitCode=1}},{key:"listen",value:function(){var e=this,n=Lt.createInterface({input:process.stdin});n.on("line",function(t){t=t.replace("quire ","");"stop"===t?(e.shutdown(),n.close()):console.log(Ft.yellow("No method for: ".concat(t)))})}},{key:"verbose",set:function(t){this.isVerbose=t},get:function(){return this.isVerbose}}]),e}(),Bt=e(function(t){t=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)}),Tt={}.hasOwnProperty,Gt=function(t,e){return Tt.call(t,e)},Wt=!qt(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),$t=e(function(t){t=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=t)}),zt=($t.version,function(t){return"object"==typeof t?null!==t:"function"==typeof t}),Rt=function(t){if(!zt(t))throw TypeError(t+" is not an object!");return t},Ct=Bt.document,Nt=zt(Ct)&&zt(Ct.createElement),Vt=!Wt&&!qt(function(){return 7!=Object.defineProperty(ct("div"),"a",{get:function(){return 7}}).a}),Ht=Object.defineProperty,Yt={f:Wt?Object.defineProperty:function(t,e,n){if(Rt(t),e=Ut(e,!0),Rt(n),Vt)try{return Ht(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},Kt=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},Jt=Wt?function(t,e,n){return Yt.f(t,e,Kt(1,n))}:function(t,e,n){return t[e]=n,t},Zt=0,Xt=Math.random(),Qt=e(function(t){var e="__core-js_shared__",n=Bt[e]||(Bt[e]={});(t.exports=function(t,e){return n[t]||(n[t]=void 0!==e?e:{})})("versions",[]).push({version:$t.version,mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})}),te=Qt("native-function-to-string",Function.toString),ee=e(function(t){var o=Dt("src"),e="toString",a=(""+te).split(e);$t.inspectSource=function(t){return te.call(t)},(t.exports=function(t,e,n,r){var i="function"==typeof n;i&&(Gt(n,"name")||Jt(n,"name",e)),t[e]!==n&&(i&&(Gt(n,o)||Jt(n,o,t[e]?""+t[e]:a.join(String(e)))),t===Bt?t[e]=n:r?t[e]?t[e]=n:Jt(t,e,n):(delete t[e],Jt(t,e,n)))})(Function.prototype,e,function(){return"function"==typeof this&&this[o]||te.call(this)})}),ne=function(r,i,t){if(ut(r),void 0===i)return r;switch(t){case 1:return function(t){return r.call(i,t)};case 2:return function(t,e){return r.call(i,t,e)};case 3:return function(t,e,n){return r.call(i,t,e,n)}}return function(){return r.apply(i,arguments)}},re="prototype",ie=function(t,e,n){var r,i,o,a=t&ie.F,c=t&ie.G,u=t&ie.S,s=t&ie.P,f=t&ie.B,l=c?Bt:u?Bt[e]||(Bt[e]={}):(Bt[e]||{})[re],h=c?$t:$t[e]||($t[e]={}),p=h[re]||(h[re]={});for(r in n=c?e:n)i=((o=!a&&l&&void 0!==l[r])?l:n)[r],o=f&&o?ne(i,Bt):s&&"function"==typeof i?ne(Function.call,i):i,l&&ee(l,r,i,t&ie.U),h[r]!=i&&Jt(h,r,o),s&&p[r]!=i&&(p[r]=i)};Bt.core=$t,ie.F=1,ie.G=2,ie.S=4,ie.P=8,ie.B=16,ie.W=32,ie.U=64,ie.R=128;function oe(t,e,n){t&&!Gt(t=n?t:t.prototype,Se)&&xe(t,Se,{configurable:!0,value:e})}function ae(t){var e=$t.Symbol||($t.Symbol=Bt.Symbol||{});"_"==t.charAt(0)||t in e||ke(e,t,{value:_e.f(t)})}function ce(t){return je.call(t).slice(8,-1)}function ue(t){if(null==t)throw TypeError("Can't call method on "+t);return t}function se(t){return Ee(ue(t))}function fe(t){return isNaN(t=+t)?0:(0<t?Fe:Pe)(t)}function le(t,e){return(t=fe(t))<0?Le(t+e,0):Ie(t,e)}function he(c){return function(t,e,n){var r,i=se(t),o=Ae(i.length),a=le(n,o);if(c&&e!=e){for(;a<o;)if((r=i[a++])!=r)return!0}else for(;a<o;a++)if((c||a in i)&&i[a]===e)return c||a||0;return!c&&-1}}function pe(t,e){var n,r=se(t),i=0,o=[];for(n in r)n!=Re&&Gt(r,n)&&o.push(n);for(;e.length>i;)Gt(r,n=e[i++])&&(~$e(o,n)||o.push(n));return o}function de(t){return Object(ue(t))}function ve(){}function ge(t){var e=gn[t]=Ye(un[ln]);return e._k=t,e}function ye(t,e){Rt(t);for(var n,r=function(t){var e=Ne(t),n=qe.f;if(n)for(var r,i=n(t),o=Ue.f,a=0;i.length>a;)o.call(t,r=i[a++])&&e.push(r);return e}(e=se(e)),i=0,o=r.length;i<o;)kn(t,n=r[i++],e[n]);return t}var me=ie,be=e(function(t){function n(t){e(t,r,{value:{i:"O"+ ++i,w:{}}})}var r=Dt("meta"),e=Yt.f,i=0,o=Object.isExtensible||function(){return!0},a=!qt(function(){return o(Object.preventExtensions({}))}),c=t.exports={KEY:r,NEED:!1,fastKey:function(t,e){if(!zt(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!Gt(t,r)){if(!o(t))return"F";if(!e)return"E";n(t)}return t[r].i},getWeak:function(t,e){if(!Gt(t,r)){if(!o(t))return!0;if(!e)return!1;n(t)}return t[r].w},onFreeze:function(t){return a&&c.NEED&&o(t)&&!Gt(t,r)&&n(t),t}}}),we=(be.KEY,be.NEED,be.fastKey,be.getWeak,be.onFreeze,e(function(t){var e=Qt("wks"),n=Bt.Symbol,r="function"==typeof n;(t.exports=function(t){return e[t]||(e[t]=r&&n[t]||(r?n:Dt)("Symbol."+t))}).store=e})),xe=Yt.f,Se=we("toStringTag"),_e={f:we},ke=Yt.f,je={}.toString,Ee=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==ce(t)?t.split(""):Object(t)},Pe=Math.ceil,Fe=Math.floor,Oe=Math.min,Ae=function(t){return 0<t?Oe(fe(t),9007199254740991):0},Le=Math.max,Ie=Math.min,Me=Qt("keys"),Te=function(t){return Me[t]||(Me[t]=Dt(t))},$e=he(!1),Re=Te("IE_PROTO"),Ce="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Ne=Object.keys||function(t){return pe(t,Ce)},qe={f:Object.getOwnPropertySymbols},Ue={f:{}.propertyIsEnumerable},De=Array.isArray||function(t){return"Array"==ce(t)},Be=Wt?Object.defineProperties:function(t,e){Rt(t);for(var n,r=Ne(e),i=r.length,o=0;o<i;)Yt.f(t,n=r[o++],e[n]);return t},Ge=Bt.document,We=Ge&&Ge.documentElement,ze=Te("IE_PROTO"),Ve="prototype",He=function(){var t=ct("iframe"),e=Ce.length;for(t.style.display="none",We.appendChild(t),t.src="javascript:",(t=t.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),He=t.F;e--;)delete He[Ve][Ce[e]];return He()},Ye=Object.create||function(t,e){var n;return null!==t?(ve[Ve]=Rt(t),n=new ve,ve[Ve]=null,n[ze]=t):n=He(),void 0===e?n:Be(n,e)},Ke=Ce.concat("length","prototype"),Je={f:Object.getOwnPropertyNames||function(t){return pe(t,Ke)}},Ze=Je.f,Xe={}.toString,Qe="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],tn={f:function(t){return Qe&&"[object Window]"==Xe.call(t)?function(t){try{return Ze(t)}catch(t){return Qe.slice()}}(t):Ze(se(t))}},en=Object.getOwnPropertyDescriptor,nn={f:Wt?en:function(t,e){if(t=se(t),e=Ut(e,!0),Vt)try{return en(t,e)}catch(t){}if(Gt(t,e))return Kt(!Ue.f.call(t,e),t[e])}},rn=be.KEY,on=nn.f,an=Yt.f,cn=tn.f,un=Bt.Symbol,sn=Bt.JSON,fn=sn&&sn.stringify,ln="prototype",hn=we("_hidden"),pn=we("toPrimitive"),dn={}.propertyIsEnumerable,vn=Qt("symbol-registry"),gn=Qt("symbols"),yn=Qt("op-symbols"),mn=Object[ln],bn="function"==typeof un&&!!qe.f,wn=Bt.QObject,xn=!wn||!wn[ln]||!wn[ln].findChild,Sn=Wt&&qt(function(){return 7!=Ye(an({},"a",{get:function(){return an(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=on(mn,e);r&&delete mn[e],an(t,e,n),r&&t!==mn&&an(mn,e,r)}:an,_n=bn&&"symbol"==typeof un.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof un},kn=function(t,e,n){return t===mn&&kn(yn,e,n),Rt(t),e=Ut(e,!0),Rt(n),Gt(gn,e)?(n.enumerable?(Gt(t,hn)&&t[hn][e]&&(t[hn][e]=!1),n=Ye(n,{enumerable:Kt(0,!1)})):(Gt(t,hn)||an(t,hn,Kt(1,{})),t[hn][e]=!0),Sn(t,e,n)):an(t,e,n)},jn=function(t){var e=dn.call(this,t=Ut(t,!0));return!(this===mn&&Gt(gn,t)&&!Gt(yn,t))&&(!(e||!Gt(this,t)||!Gt(gn,t)||Gt(this,hn)&&this[hn][t])||e)},p=function(t,e){if(t=se(t),e=Ut(e,!0),t!==mn||!Gt(gn,e)||Gt(yn,e)){var n=on(t,e);return!n||!Gt(gn,e)||Gt(t,hn)&&t[hn][e]||(n.enumerable=!0),n}},Ge=function(t){for(var e,n=cn(se(t)),r=[],i=0;n.length>i;)Gt(gn,e=n[i++])||e==hn||e==rn||r.push(e);return r},wn=function(t){for(var e,n=t===mn,r=cn(n?yn:se(t)),i=[],o=0;r.length>o;)!Gt(gn,e=r[o++])||n&&!Gt(mn,e)||i.push(gn[e]);return i};bn||(ee((un=function(){if(this instanceof un)throw TypeError("Symbol is not a constructor!");var e=Dt(0<arguments.length?arguments[0]:void 0),n=function(t){this===mn&&n.call(yn,t),Gt(this,hn)&&Gt(this[hn],e)&&(this[hn][e]=!1),Sn(this,e,Kt(1,t))};return Wt&&xn&&Sn(mn,e,{configurable:!0,set:n}),ge(e)})[ln],"toString",function(){return this._k}),nn.f=p,Yt.f=kn,Je.f=tn.f=Ge,Ue.f=jn,qe.f=wn,Wt&&ee(mn,"propertyIsEnumerable",jn,!0),_e.f=function(t){return ge(we(t))}),me(me.G+me.W+me.F*!bn,{Symbol:un});for(var En="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),Pn=0;En.length>Pn;)we(En[Pn++]);for(var Fn=Ne(we.store),On=0;Fn.length>On;)ae(Fn[On++]);me(me.S+me.F*!bn,"Symbol",{for:function(t){return Gt(vn,t+="")?vn[t]:vn[t]=un(t)},keyFor:function(t){if(!_n(t))throw TypeError(t+" is not a symbol!");for(var e in vn)if(vn[e]===t)return e},useSetter:function(){xn=!0},useSimple:function(){xn=!1}}),me(me.S+me.F*!bn,"Object",{create:function(t,e){return void 0===e?Ye(t):ye(Ye(t),e)},defineProperty:kn,defineProperties:ye,getOwnPropertyDescriptor:p,getOwnPropertyNames:Ge,getOwnPropertySymbols:wn});jn=qt(function(){qe.f(1)});me(me.S+me.F*jn,"Object",{getOwnPropertySymbols:function(t){return qe.f(de(t))}}),sn&&me(me.S+me.F*(!bn||qt(function(){var t=un();return"[null]"!=fn([t])||"{}"!=fn({a:t})||"{}"!=fn(Object(t))})),"JSON",{stringify:function(t){for(var e,n,r=[t],i=1;i<arguments.length;)r.push(arguments[i++]);if(n=e=r[1],(zt(e)||void 0!==t)&&!_n(t))return De(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!_n(e))return e}),r[1]=e,fn.apply(sn,r)}}),un[ln][pn]||Jt(un[ln],pn,un[ln].valueOf),oe(un,"Symbol"),oe(Math,"Math",!0),oe(Bt.JSON,"JSON",!0),me(me.S,"Object",{create:Ye}),me(me.S+me.F*!Wt,"Object",{defineProperty:Yt.f}),me(me.S+me.F*!Wt,"Object",{defineProperties:Be});var p=function(t,e){var n=($t.Object||{})[t]||Object[t],r={};r[t]=e(n),me(me.S+me.F*qt(function(){n(1)}),"Object",r)},An=nn.f;p("getOwnPropertyDescriptor",function(){return function(t,e){return An(se(t),e)}});var Ln=Te("IE_PROTO"),In=Object.prototype,Mn=Object.getPrototypeOf||function(t){return t=de(t),Gt(t,Ln)?t[Ln]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?In:null};p("getPrototypeOf",function(){return function(t){return Mn(de(t))}}),p("keys",function(){return function(t){return Ne(de(t))}}),p("getOwnPropertyNames",function(){return tn.f});var Tn=be.onFreeze;p("freeze",function(e){return function(t){return e&&zt(t)?e(Tn(t)):t}});var $n=be.onFreeze;p("seal",function(e){return function(t){return e&&zt(t)?e($n(t)):t}});var Rn=be.onFreeze;p("preventExtensions",function(e){return function(t){return e&&zt(t)?e(Rn(t)):t}}),p("isFrozen",function(e){return function(t){return!zt(t)||!!e&&e(t)}}),p("isSealed",function(e){return function(t){return!zt(t)||!!e&&e(t)}}),p("isExtensible",function(e){return function(t){return!!zt(t)&&(!e||e(t))}});var Cn=Object.assign,Nn=!Cn||qt(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=Cn({},t)[n]||Object.keys(Cn({},e)).join("")!=r})?function(t,e){for(var n=de(t),r=arguments.length,i=1,o=qe.f,a=Ue.f;i<r;)for(var c,u=Ee(arguments[i++]),s=o?Ne(u).concat(o(u)):Ne(u),f=s.length,l=0;l<f;)c=s[l++],Wt&&!a.call(u,c)||(n[c]=u[c]);return n}:Cn;me(me.S+me.F,"Object",{assign:Nn});var qn=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e};me(me.S,"Object",{is:qn});function Un(t,e){if(Rt(t),!zt(e)&&null!==e)throw TypeError(e+": can't set as prototype!")}var Dn={set:Object.setPrototypeOf||("__proto__"in{}?function(t,n,r){try{(r=ne(Function.call,nn.f(Object.prototype,"__proto__").set,2))(t,[]),n=!(t instanceof Array)}catch(t){n=!0}return function(t,e){return Un(t,e),n?t.__proto__=e:r(t,e),t}}({},!1):void 0),check:Un};me(me.S,"Object",{setPrototypeOf:Dn.set});function Bn(t){var e;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(t=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),Gn))?t:Wn?ce(e):"Object"==(t=ce(e))&&"function"==typeof e.callee?"Arguments":t}var Gn=we("toStringTag"),Wn="Arguments"==ce(function(){return arguments}()),Ge={};Ge[we("toStringTag")]="z",Ge+""!="[object z]"&&ee(Object.prototype,"toString",function(){return"[object "+Bn(this)+"]"},!0);function zn(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}var Vn=[].slice,Hn={},Yn=Function.bind||function(e){var n=ut(this),r=Vn.call(arguments,1),i=function(){var t=r.concat(Vn.call(arguments));return this instanceof i?function(t,e,n){if(!(e in Hn)){for(var r=[],i=0;i<e;i++)r[i]="a["+i+"]";Hn[e]=Function("F,a","return new F("+r.join(",")+")")}return Hn[e](t,n)}(n,t.length,t):zn(n,t,e)};return zt(n.prototype)&&(i.prototype=n.prototype),i};me(me.P,"Function",{bind:Yn});var wn=Yt.f,jn=Function.prototype,Kn=/^\s*function ([^ (]*)/;"name"in jn||Wt&&wn(jn,"name",{configurable:!0,get:function(){try{return(""+this).match(Kn)[1]}catch(t){return""}}});bn=we("hasInstance"),pn=Function.prototype;bn in pn||Yt.f(pn,bn,{value:function(t){if("function"!=typeof this||!zt(t))return!1;if(!zt(this.prototype))return t instanceof this;for(;t=Mn(t);)if(this.prototype===t)return!0;return!1}});var Jn="\t\n\v\f\r \u2028\u2029\ufeff",Te="["+Jn+"]",Zn=RegExp("^"+Te+Te+"*"),Xn=RegExp(Te+Te+"*$"),p=function(t,e,n){var r={},i=qt(function(){return Jn[t]()||"
"!="
"[t]()}),e=r[t]=i?e(Qn):Jn[t];n&&(r[n]=e),me(me.P+me.F*i,"String",r)},Qn=p.trim=function(t,e){return t=String(ue(t)),1&e&&(t=t.replace(Zn,"")),t=2&e?t.replace(Xn,""):t},Ge=p,tr=Bt.parseInt,er=Ge.trim,nr=/^[-+]?0[xX]/,wn=8!==tr(Jn+"08")||22!==tr(Jn+"0x16")?function(t,e){t=er(String(t),3);return tr(t,e>>>0||(nr.test(t)?16:10))}:tr;me(me.G+me.F*(parseInt!=wn),{parseInt:wn});var rr=Bt.parseFloat,ir=Ge.trim,jn=1/rr(Jn+"-0")!=-1/0?function(t){var e=ir(String(t),3),t=rr(e);return 0===t&&"-"==e.charAt(0)?-0:t}:rr;me(me.G+me.F*(parseFloat!=jn),{parseFloat:jn});function or(t,e,n){var r;return(e=e.constructor)!==n&&"function"==typeof e&&(r=e.prototype)!==n.prototype&&zt(r)&&cr&&cr(t,r),t}function ar(t){var e=Ut(t,!1);if("string"==typeof e&&2<e.length){var n,r,i=(e=gr?e.trim():fr(e,3)).charCodeAt(0);if(43===i||45===i){if(88===(t=e.charCodeAt(2))||120===t)return NaN}else if(48===i){switch(e.charCodeAt(1)){case 66:case 98:n=2,r=49;break;case 79:case 111:n=8,r=55;break;default:return+e}for(var o,a=e.slice(2),c=0,u=a.length;c<u;c++)if((o=a.charCodeAt(c))<48||r<o)return NaN;return parseInt(a,n)}}return+e}var cr=Dn.set,pn=Je.f,ur=nn.f,sr=Yt.f,fr=Ge.trim,lr="Number",hr=Bt[lr],pr=hr,dr=hr.prototype,vr=ce(Ye(dr))==lr,gr="trim"in String.prototype;if(!hr(" 0o1")||!hr("0b1")||hr("+0x1")){hr=function(t){var t=arguments.length<1?0:t,e=this;return e instanceof hr&&(vr?qt(function(){dr.valueOf.call(e)}):ce(e)!=lr)?or(new pr(ar(t)),e,hr):ar(t)};for(var yr,mr=Wt?pn(pr):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),br=0;mr.length>br;br++)Gt(pr,yr=mr[br])&&!Gt(hr,yr)&&sr(hr,yr,ur(pr,yr));(hr.prototype=dr).constructor=hr,ee(Bt,lr,hr)}function wr(t,e){if("number"!=typeof t&&"Number"!=ce(t))throw TypeError(e);return+t}function xr(t){var e=String(ue(this)),n="",r=fe(t);if(r<0||r==1/0)throw RangeError("Count can't be negative");for(;0<r;(r>>>=1)&&(e+=e))1&r&&(n+=e);return n}function Sr(t,e){for(var n=-1,r=e;++n<6;)r+=t*Pr[n],Pr[n]=r%1e7,r=Er(r/1e7)}function _r(t){for(var e=6,n=0;0<=--e;)n+=Pr[e],Pr[e]=Er(n/t),n=n%t*1e7}function kr(){for(var t,e=6,n="";0<=--e;)""===n&&0!==e&&0===Pr[e]||(t=String(Pr[e]),n=""===n?t:n+xr.call("0",7-t.length)+t);return n}var jr=1..toFixed,Er=Math.floor,Pr=[0,0,0,0,0,0],Fr="Number.toFixed: incorrect invocation!",Or=function(t,e,n){return 0===e?n:e%2==1?Or(t,e-1,n*t):Or(t*t,e/2,n)};me(me.P+me.F*(!!jr&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==0xde0b6b3a7640080.toFixed(0))||!qt(function(){jr.call({})})),"Number",{toFixed:function(t){var e,n,r=wr(this,Fr),i=fe(t),o="",t="0";if(i<0||20<i)throw RangeError(Fr);if(r!=r)return"NaN";if(r<=-1e21||1e21<=r)return String(r);if(r<0&&(o="-",r=-r),1e-21<r)if(r=(n=function(t){for(var e=0,n=t;4096<=n;)e+=12,n/=4096;for(;2<=n;)e+=1,n/=2;return e}(r*Or(2,69,1))-69)<0?r*Or(2,-n,1):r/Or(2,n,1),r*=4503599627370496,0<(n=52-n)){for(Sr(0,r),e=i;7<=e;)Sr(1e7,0),e-=7;for(Sr(Or(10,e,1),0),e=n-1;23<=e;)_r(1<<23),e-=23;_r(1<<e),Sr(1,1),_r(2),t=kr()}else Sr(0,r),Sr(1<<-n,0),t=kr()+xr.call("0",i);return t=0<i?o+((n=t.length)<=i?"0."+xr.call("0",i-n)+t:t.slice(0,n-i)+"."+t.slice(n-i)):o+t}});var Ar=1..toPrecision;me(me.P+me.F*(qt(function(){return"1"!==Ar.call(1,void 0)})||!qt(function(){Ar.call({})})),"Number",{toPrecision:function(t){var e=wr(this,"Number#toPrecision: incorrect invocation!");return void 0===t?Ar.call(e):Ar.call(e,t)}}),me(me.S,"Number",{EPSILON:Math.pow(2,-52)});var Lr=Bt.isFinite;me(me.S,"Number",{isFinite:function(t){return"number"==typeof t&&Lr(t)}});function Ir(t){return!zt(t)&&isFinite(t)&&Mr(t)===t}var Mr=Math.floor;me(me.S,"Number",{isInteger:Ir}),me(me.S,"Number",{isNaN:function(t){return t!=t}});var Tr=Math.abs;me(me.S,"Number",{isSafeInteger:function(t){return Ir(t)&&Tr(t)<=9007199254740991}}),me(me.S,"Number",{MAX_SAFE_INTEGER:9007199254740991}),me(me.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991}),me(me.S+me.F*(Number.parseFloat!=jn),"Number",{parseFloat:jn}),me(me.S+me.F*(Number.parseInt!=wn),"Number",{parseInt:wn});var $r=Math.log1p||function(t){return-1e-8<(t=+t)&&t<1e-8?t-t*t/2:Math.log(1+t)},Rr=Math.sqrt,bn=Math.acosh;me(me.S+me.F*!(bn&&710==Math.floor(bn(Number.MAX_VALUE))&&bn(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:94906265.62425156<t?Math.log(t)+Math.LN2:$r(t-1+Rr(t-1)*Rr(t+1))}});Te=Math.asinh;me(me.S+me.F*!(Te&&0<1/Te(0)),"Math",{asinh:function t(e){return isFinite(e=+e)&&0!=e?e<0?-t(-e):Math.log(e+Math.sqrt(e*e+1)):e}});p=Math.atanh;me(me.S+me.F*!(p&&1/p(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}});var Cr=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1};me(me.S,"Math",{cbrt:function(t){return Cr(t=+t)*Math.pow(Math.abs(t),1/3)}}),me(me.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}});var Nr=Math.exp;me(me.S,"Math",{cosh:function(t){return(Nr(t=+t)+Nr(-t))/2}});var pn=Math.expm1,qr=!pn||22025.465794806718<pn(10)||pn(10)<22025.465794806718||-2e-17!=pn(-2e-17)?function(t){return 0==(t=+t)?t:-1e-6<t&&t<1e-6?t+t*t/2:Math.exp(t)-1}:pn;me(me.S+me.F*(qr!=Math.expm1),"Math",{expm1:qr});var jn=Math.pow,Ur=jn(2,-52),Dr=jn(2,-23),Br=jn(2,127)*(2-Dr),Gr=jn(2,-126),wn=Math.fround||function(t){var e=Math.abs(t),n=Cr(t);return e<Gr?n*(e/Gr/Dr+1/Ur-1/Ur)*Gr*Dr:Br<(e=(t=(1+Dr/Ur)*e)-(t-e))||e!=e?n*(1/0):n*e};me(me.S,"Math",{fround:wn});var Wr=Math.abs;me(me.S,"Math",{hypot:function(t,e){for(var n,r,i=0,o=0,a=arguments.length,c=0;o<a;)c<(n=Wr(arguments[o++]))?(i=i*(r=c/n)*r+1,c=n):i+=0<n?(r=n/c)*r:n;return c===1/0?1/0:c*Math.sqrt(i)}});var zr=Math.imul;me(me.S+me.F*qt(function(){return-5!=zr(4294967295,5)||2!=zr.length}),"Math",{imul:function(t,e){var n=65535,r=+t,i=+e,t=n&r,e=n&i;return 0|t*e+((n&r>>>16)*e+t*(n&i>>>16)<<16>>>0)}}),me(me.S,"Math",{log10:function(t){return Math.log(t)*Math.LOG10E}}),me(me.S,"Math",{log1p:$r}),me(me.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}}),me(me.S,"Math",{sign:Cr});var Vr=Math.exp;me(me.S+me.F*qt(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(qr(t)-qr(-t))/2:(Vr(t-1)-Vr(-t-1))*(Math.E/2)}});var Hr=Math.exp;me(me.S,"Math",{tanh:function(t){var e=qr(t=+t),n=qr(-t);return e==1/0?1:n==1/0?-1:(e-n)/(Hr(t)+Hr(-t))}}),me(me.S,"Math",{trunc:function(t){return(0<t?Math.floor:Math.ceil)(t)}});var Yr=String.fromCharCode,bn=String.fromCodePoint;me(me.S+me.F*(!!bn&&1!=bn.length),"String",{fromCodePoint:function(t){for(var e,n=[],r=arguments.length,i=0;i<r;){if(e=+arguments[i++],le(e,1114111)!==e)throw RangeError(e+" is not a valid code point");n.push(e<65536?Yr(e):Yr(55296+((e-=65536)>>10),e%1024+56320))}return n.join("")}}),me(me.S,"String",{raw:function(t){for(var e=se(t.raw),n=Ae(e.length),r=arguments.length,i=[],o=0;o<n;)i.push(String(e[o++])),o<r&&i.push(String(arguments[o]));return i.join("")}}),Ge("trim",function(t){return function(){return t(this,3)}});var Te=function(o){return function(t,e){var n,r=String(ue(t)),i=fe(e),t=r.length;return i<0||t<=i?o?"":void 0:(e=r.charCodeAt(i))<55296||56319<e||i+1===t||(n=r.charCodeAt(i+1))<56320||57343<n?o?r.charAt(i):e:o?r.slice(i,i+2):n-56320+(e-55296<<10)+65536}},Kr={},Jr={};Jt(Jr,we("iterator"),function(){return this});function Zr(t,e,n){t.prototype=Ye(Jr,{next:Kt(1,n)}),oe(t,e+" Iterator")}function Xr(){return this}function Qr(t,e,n,r,i,o,a){function c(t){if(!ei&&t in d)return d[t];switch(t){case"keys":case ni:return function(){return new n(this,t)}}return function(){return new n(this,t)}}Zr(n,e,r);var u,s,f,l=e+" Iterator",h=i==ni,p=!1,d=t.prototype,v=d[ti]||d["@@iterator"]||i&&d[i],g=v||c(i),y=i?h?c("entries"):g:void 0;if((r="Array"==e&&d.entries||v)&&(f=Mn(r.call(new t)))!==Object.prototype&&f.next&&(oe(f,l,!0),"function"!=typeof f[ti]&&Jt(f,ti,Xr)),h&&v&&v.name!==ni&&(p=!0,g=function(){return v.call(this)}),!ei&&!p&&d[ti]||Jt(d,ti,g),Kr[e]=g,Kr[l]=Xr,i)if(u={values:h?g:c(ni),keys:o?g:c("keys"),entries:y},a)for(s in u)s in d||ee(d,s,u[s]);else me(me.P+me.F*(ei||p),e,u);return u}var ti=we("iterator"),ei=!([].keys&&"next"in[].keys()),ni="values",ri=Te(!0);Qr(String,"String",function(t){this._t=String(t),this._i=0},function(){var t=this._t,e=this._i;return e>=t.length?{value:void 0,done:!0}:(e=ri(t,e),this._i+=e.length,{value:e,done:!1})});var ii=Te(!1);me(me.P,"String",{codePointAt:function(t){return ii(this,t)}});function oi(t){var e;return zt(t)&&(void 0!==(e=t[ci])?!!e:"RegExp"==ce(t))}function ai(t,e,n){if(oi(e))throw TypeError("String#"+n+" doesn't accept regex!");return String(ue(t))}var ci=we("match"),ui=we("match"),p=function(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[ui]=!1,!"/./"[e](n)}catch(t){}}return!0},si="endsWith",fi=""[si];me(me.P+me.F*p(si),"String",{endsWith:function(t){var e=ai(this,t,si),n=1<arguments.length?arguments[1]:void 0,r=Ae(e.length),r=void 0===n?r:Math.min(Ae(n),r),t=String(t);return fi?fi.call(e,t,r):e.slice(r-t.length,r)===t}});var li="includes";me(me.P+me.F*p(li),"String",{includes:function(t){return!!~ai(this,t,li).indexOf(t,1<arguments.length?arguments[1]:void 0)}}),me(me.P,"String",{repeat:xr});var hi="startsWith",pi=""[hi];me(me.P+me.F*p(hi),"String",{startsWith:function(t){var e=ai(this,t,hi),n=Ae(Math.min(1<arguments.length?arguments[1]:void 0,e.length)),t=String(t);return pi?pi.call(e,t,n):e.slice(n,n+t.length)===t}});function di(t,e,n,r){var i=String(ue(t)),t="<"+e;return""!==n&&(t+=" "+n+'="'+String(r).replace(vi,""")+'"'),t+">"+i+"</"+e+">"}var vi=/"/g,pn=function(e,t){var n={};n[e]=t(di),me(me.P+me.F*qt(function(){var t=""[e]('"');return t!==t.toLowerCase()||3<t.split('"').length}),"String",n)};pn("anchor",function(e){return function(t){return e(this,"a","name",t)}}),pn("big",function(t){return function(){return t(this,"big","","")}}),pn("blink",function(t){return function(){return t(this,"blink","","")}}),pn("bold",function(t){return function(){return t(this,"b","","")}}),pn("fixed",function(t){return function(){return t(this,"tt","","")}}),pn("fontcolor",function(e){return function(t){return e(this,"font","color",t)}}),pn("fontsize",function(e){return function(t){return e(this,"font","size",t)}}),pn("italics",function(t){return function(){return t(this,"i","","")}}),pn("link",function(e){return function(t){return e(this,"a","href",t)}}),pn("small",function(t){return function(){return t(this,"small","","")}}),pn("strike",function(t){return function(){return t(this,"strike","","")}}),pn("sub",function(t){return function(){return t(this,"sub","","")}}),pn("sup",function(t){return function(){return t(this,"sup","","")}}),me(me.S,"Date",{now:function(){return(new Date).getTime()}}),me(me.P+me.F*qt(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}),"Date",{toJSON:function(t){var e=de(this),n=Ut(e);return"number"!=typeof n||isFinite(n)?e.toISOString():null}});function gi(t){return 9<t?t:"0"+t}var yi=Date.prototype.getTime,mi=Date.prototype.toISOString,jn=qt(function(){return"0385-07-25T07:06:39.999Z"!=mi.call(new Date(-5e13-1))})||!qt(function(){mi.call(new Date(NaN))})?function(){if(!isFinite(yi.call(this)))throw RangeError("Invalid time value");var t=this,e=t.getUTCFullYear(),n=t.getUTCMilliseconds(),r=e<0?"-":9999<e?"+":"";return r+("00000"+Math.abs(e)).slice(r?-6:-4)+"-"+gi(t.getUTCMonth()+1)+"-"+gi(t.getUTCDate())+"T"+gi(t.getUTCHours())+":"+gi(t.getUTCMinutes())+":"+gi(t.getUTCSeconds())+"."+(99<n?n:"0"+gi(n))+"Z"}:mi;me(me.P+me.F*(Date.prototype.toISOString!==jn),"Date",{toISOString:jn});var wn=Date.prototype,bi="Invalid Date",bn="toString",wi=wn[bn],xi=wn.getTime;new Date(NaN)+""!=bi&&ee(wn,bn,function(){var t=xi.call(this);return t==t?wi.call(this):bi});p=we("toPrimitive"),pn=Date.prototype;p in pn||Jt(pn,p,function(t){if("string"!==t&&"number"!==t&&"default"!==t)throw TypeError("Incorrect hint");return Ut(Rt(this),"number"!=t)}),me(me.S,"Array",{isArray:De});function Si(e,t,n,r){try{return r?t(Rt(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&Rt(i.call(e)),t}}function _i(t){return void 0!==t&&(Kr.Array===t||Ei[ji]===t)}function ki(t,e,n){e in t?Yt.f(t,e,Kt(0,n)):t[e]=n}var ji=we("iterator"),Ei=Array.prototype,Pi=we("iterator"),Fi=$t.getIteratorMethod=function(t){if(null!=t)return t[Pi]||t["@@iterator"]||Kr[Bn(t)]},Oi=we("iterator"),Ai=!1;try{var Li=[7][Oi]();Li.return=function(){Ai=!0},Array.from(Li,function(){throw 2})}catch(t){}function Ii(t,e){if(!e&&!Ai)return!1;var n=!1;try{var r=[7],i=r[Oi]();i.next=function(){return{done:n=!0}},r[Oi]=function(){return i},t(r)}catch(t){}return n}me(me.S+me.F*!Ii(function(t){Array.from(t)}),"Array",{from:function(t){var e,n,r,i,o=de(t),a="function"==typeof this?this:Array,c=arguments.length,u=1<c?arguments[1]:void 0,s=void 0!==u,f=0,t=Fi(o);if(s&&(u=ne(u,2<c?arguments[2]:void 0,2)),null==t||a==Array&&_i(t))for(n=new a(e=Ae(o.length));f<e;f++)ki(n,f,s?u(o[f],f):o[f]);else for(i=t.call(o),n=new a;!(r=i.next()).done;f++)ki(n,f,s?Si(i,u,[r.value,f],!0):r.value);return n.length=f,n}}),me(me.S+me.F*qt(function(){function t(){}return!(Array.of.call(t)instanceof t)}),"Array",{of:function(){for(var t=0,e=arguments.length,n=new("function"==typeof this?this:Array)(e);t<e;)ki(n,t,arguments[t++]);return n.length=e,n}});var jn=function(t,e){return!!t&&qt(function(){e?t.call(null,function(){},1):t.call(null)})},Mi=[].join;me(me.P+me.F*(Ee!=Object||!jn(Mi)),"Array",{join:function(t){return Mi.call(se(this),void 0===t?",":t)}});var Ti=[].slice;me(me.P+me.F*qt(function(){We&&Ti.call(We)}),"Array",{slice:function(t,e){var n=Ae(this.length),r=ce(this);if(e=void 0===e?n:e,"Array"==r)return Ti.call(this,t,e);for(var i=le(t,n),n=le(e,n),o=Ae(n-i),a=new Array(o),c=0;c<o;c++)a[c]="String"==r?this.charAt(i+c):this[i+c];return a}});var $i=[].sort,Ri=[1,2,3];me(me.P+me.F*(qt(function(){Ri.sort(void 0)})||!qt(function(){Ri.sort(null)})||!jn($i)),"Array",{sort:function(t){return void 0===t?$i.call(de(this)):$i.call(de(this),ut(t))}});function Ci(t,e){return De(t=t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!De(n.prototype)||(n=void 0),zt(n)&&null===(n=n[qi])&&(n=void 0)),new(void 0===n?Array:n)(e);var n}function Ni(l,t){var h=1==l,p=2==l,d=3==l,v=4==l,g=6==l,y=5==l||g,m=t||Ci;return function(t,e,n){for(var r,i,o=de(t),a=Ee(o),c=ne(e,n,3),u=Ae(a.length),s=0,f=h?m(t,u):p?m(t,0):void 0;s<u;s++)if((y||s in a)&&(i=c(r=a[s],s,o),l))if(h)f[s]=i;else if(i)switch(l){case 3:return!0;case 5:return r;case 6:return s;case 2:f.push(r)}else if(v)return!1;return g?-1:d||v?v:f}}var qi=we("species"),Ui=Ni(0),wn=jn([].forEach,!0);me(me.P+me.F*!wn,"Array",{forEach:function(t){return Ui(this,t,arguments[1])}});var Di=Ni(1);me(me.P+me.F*!jn([].map,!0),"Array",{map:function(t){return Di(this,t,arguments[1])}});var Bi=Ni(2);me(me.P+me.F*!jn([].filter,!0),"Array",{filter:function(t){return Bi(this,t,arguments[1])}});var Gi=Ni(3);me(me.P+me.F*!jn([].some,!0),"Array",{some:function(t){return Gi(this,t,arguments[1])}});var Wi=Ni(4);me(me.P+me.F*!jn([].every,!0),"Array",{every:function(t){return Wi(this,t,arguments[1])}});function zi(t,e,n,r,i){ut(e);var o=de(t),a=Ee(o),c=Ae(o.length),u=i?c-1:0,s=i?-1:1;if(n<2)for(;;){if(u in a){r=a[u],u+=s;break}if(u+=s,i?u<0:c<=u)throw TypeError("Reduce of empty array with no initial value")}for(;i?0<=u:u<c;u+=s)u in a&&(r=e(r,a[u],u,o));return r}me(me.P+me.F*!jn([].reduce,!0),"Array",{reduce:function(t){return zi(this,t,arguments.length,arguments[1],!1)}}),me(me.P+me.F*!jn([].reduceRight,!0),"Array",{reduceRight:function(t){return zi(this,t,arguments.length,arguments[1],!0)}});var Vi=he(!1),Hi=[].indexOf,Yi=!!Hi&&1/[1].indexOf(1,-0)<0;me(me.P+me.F*(Yi||!jn(Hi)),"Array",{indexOf:function(t){return Yi?Hi.apply(this,arguments)||0:Vi(this,t,arguments[1])}});var Ki=[].lastIndexOf,Ji=!!Ki&&1/[1].lastIndexOf(1,-0)<0;me(me.P+me.F*(Ji||!jn(Ki)),"Array",{lastIndexOf:function(t){if(Ji)return Ki.apply(this,arguments)||0;var e=se(this),n=Ae(e.length),r=n-1;for((r=1<arguments.length?Math.min(r,fe(arguments[1])):r)<0&&(r=n+r);0<=r;r--)if(r in e&&e[r]===t)return r||0;return-1}});var Zi=[].copyWithin||function(t,e){var n=de(this),r=Ae(n.length),i=le(t,r),o=le(e,r),e=2<arguments.length?arguments[2]:void 0,a=Math.min((void 0===e?r:le(e,r))-o,r-i),c=1;for(o<i&&i<o+a&&(c=-1,o+=a-1,i+=a-1);0<a--;)o in n?n[i]=n[o]:delete n[i],i+=c,o+=c;return n},Xi=we("unscopables"),Qi=Array.prototype;null==Qi[Xi]&&Jt(Qi,Xi,{});bn=function(t){Qi[Xi][t]=!0};me(me.P,"Array",{copyWithin:Zi}),bn("copyWithin");function to(t){for(var e=de(this),n=Ae(e.length),r=arguments.length,i=le(1<r?arguments[1]:void 0,n),o=void 0===(r=2<r?arguments[2]:void 0)?n:le(r,n);i<o;)e[i++]=t;return e}me(me.P,"Array",{fill:to}),bn("fill");var eo=Ni(5),pn="find",no=!0;pn in[]&&Array(1)[pn](function(){no=!1}),me(me.P+me.F*no,"Array",{find:function(t){return eo(this,t,1<arguments.length?arguments[1]:void 0)}}),bn(pn);var ro=Ni(6),p="findIndex",io=!0;p in[]&&Array(1)[p](function(){io=!1}),me(me.P+me.F*io,"Array",{findIndex:function(t){return ro(this,t,1<arguments.length?arguments[1]:void 0)}}),bn(p);function oo(t){t=Bt[t],Wt&&t&&!t[ao]&&Yt.f(t,ao,{configurable:!0,get:function(){return this}})}var ao=we("species");oo("Array");function co(t,e){return{value:e,done:!!t}}var uo=Qr(Array,"Array",function(t,e){this._t=se(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,co(1)):co(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values");Kr.Arguments=Kr.Array,bn("keys"),bn("values"),bn("entries");function so(){var t=Rt(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}var fo=Yt.f,wn=Je.f,lo=Bt.RegExp,ho=lo,po=lo.prototype,vo=/a/g,go=/a/g,yo=new lo(vo)!==vo;if(Wt&&(!yo||qt(function(){return go[we("match")]=!1,lo(vo)!=vo||lo(go)==go||"/a/i"!=lo(vo,"i")}))){lo=function(t,e){var n=this instanceof lo,r=oi(t),i=void 0===e;return!n&&r&&t.constructor===lo&&i?t:or(yo?new ho(r&&!i?t.source:t,e):ho((r=t instanceof lo)?t.source:t,r&&i?so.call(t):e),n?this:po,lo)};for(var mo=wn(ho),bo=0;mo.length>bo;)!function(e){e in lo||fo(lo,e,{configurable:!0,get:function(){return ho[e]},set:function(t){ho[e]=t}})}(mo[bo++]);(po.constructor=lo).prototype=po,ee(Bt,"RegExp",lo)}oo("RegExp");var wo=RegExp.prototype.exec,xo=String.prototype.replace,jn=wo,So="lastIndex",_o=(pn=/a/,p=/b*/g,wo.call(pn,"a"),wo.call(p,"a"),0!==pn[So]||0!==p[So]),ko=void 0!==/()??/.exec("")[1],jo=jn=_o||ko?function(t){var e,n,r,i,o=this;return ko&&(n=new RegExp("^"+o.source+"$(?!\\s)",so.call(o))),_o&&(e=o[So]),r=wo.call(o,t),_o&&r&&(o[So]=o.global?r.index+r[0].length:e),ko&&r&&1<r.length&&xo.call(r[0],n,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)}),r}:jn;me({target:"RegExp",proto:!0,forced:jo!==/./.exec},{exec:jo}),Wt&&"g"!=/./g.flags&&Yt.f(RegExp.prototype,"flags",{configurable:!0,get:so});var Eo="toString",Po=/./[Eo],wn=function(t){ee(RegExp.prototype,Eo,t,!0)};qt(function(){return"/a/b"!=Po.call({source:"a",flags:"b"})})?wn(function(){var t=Rt(this);return"/".concat(t.source,"/","flags"in t?t.flags:!Wt&&t instanceof RegExp?so.call(t):void 0)}):Po.name!=Eo&&wn(function(){return Po.call(this)});function Fo(t,e,n){return e+(n?Ao(t,e).length:1)}function Oo(t,e){var n=t.exec;if("function"==typeof n){n=n.call(t,e);if("object"!=typeof n)throw new TypeError("RegExp exec method returned something other than an Object or null");return n}if("RegExp"!==Bn(t))throw new TypeError("RegExp#exec called on incompatible receiver");return Lo.call(t,e)}var Ao=Te(!0),Lo=RegExp.prototype.exec,Io=we("species"),Mo=!qt(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),To=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};t="ab".split(t);return 2===t.length&&"a"===t[0]&&"b"===t[1]}(),pn=function(n,t,e){var o,r,i=we(n),a=!qt(function(){var t={};return t[i]=function(){return 7},7!=""[n](t)}),c=a?!qt(function(){var t=!1,e=/a/;return e.exec=function(){return t=!0,null},"split"===n&&(e.constructor={},e.constructor[Io]=function(){return e}),e[i](""),!t}):void 0;a&&c&&("replace"!==n||Mo)&&("split"!==n||To)||(o=/./[i],e=(c=e(ue,i,""[n],function(t,e,n,r,i){return e.exec===jo?a&&!i?{done:!0,value:o.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}))[0],r=c[1],ee(String.prototype,n,e),Jt(RegExp.prototype,i,2==t?function(t,e){return r.call(t,this,e)}:function(t){return r.call(t,this)}))};pn("match",1,function(r,i,u,s){return[function(t){var e=r(this),n=null==t?void 0:t[i];return void 0!==n?n.call(t,e):new RegExp(t)[i](String(e))},function(t){var e=s(u,t,this);if(e.done)return e.value;var n=Rt(t),r=String(this);if(!n.global)return Oo(n,r);for(var i=n.unicode,o=[],a=n.lastIndex=0;null!==(c=Oo(n,r));){var c=String(c[0]);""===(o[a]=c)&&(n.lastIndex=Fo(r,Ae(n.lastIndex),i)),a++}return 0===a?null:o}]});var $o=Math.max,Ro=Math.min,Co=Math.floor,No=/\$([$&`']|\d\d?|<[^>]*>)/g,qo=/\$([$&`']|\d\d?)/g;pn("replace",2,function(i,o,w,x){return[function(t,e){var n=i(this),r=null==t?void 0:t[o];return void 0!==r?r.call(t,n,e):w.call(String(n),t,e)},function(t,e){var n=x(w,t,this,e);if(n.done)return n.value;var r=Rt(t),i=String(this),o="function"==typeof e;o||(e=String(e));var a,c=r.global;c&&(a=r.unicode,r.lastIndex=0);for(var u=[];;){var s=Oo(r,i);if(null===s)break;if(u.push(s),!c)break;""===String(s[0])&&(r.lastIndex=Fo(i,Ae(r.lastIndex),a))}for(var f,l="",h=0,p=0;p<u.length;p++){s=u[p];for(var d=String(s[0]),v=$o(Ro(fe(s.index),i.length),0),g=[],y=1;y<s.length;y++)g.push(void 0===(f=s[y])?f:String(f));var m,b=s.groups,b=o?(m=[d].concat(g,v,i),void 0!==b&&m.push(b),String(e.apply(void 0,m))):function(o,a,c,u,s,t){var f=c+o.length,l=u.length,e=qo;void 0!==s&&(s=de(s),e=No);return w.call(t,e,function(t,e){var n;switch(e.charAt(0)){case"$":return"$";case"&":return o;case"`":return a.slice(0,c);case"'":return a.slice(f);case"<":n=s[e.slice(1,-1)];break;default:var r=+e;if(0==r)return t;if(l<r){var i=Co(r/10);return 0===i?t:i<=l?void 0===u[i-1]?e.charAt(1):u[i-1]+e.charAt(1):t}n=u[r-1]}return void 0===n?"":n})}(d,i,v,g,b,e);h<=v&&(l+=i.slice(h,v)+b,h=v+d.length)}return l+i.slice(h)}]}),pn("search",1,function(r,i,o,a){return[function(t){var e=r(this),n=null==t?void 0:t[i];return void 0!==n?n.call(t,e):new RegExp(t)[i](String(e))},function(t){var e=a(o,t,this);if(e.done)return e.value;var n=Rt(t),e=String(this),t=n.lastIndex;qn(t,0)||(n.lastIndex=0);e=Oo(n,e);return qn(n.lastIndex,t)||(n.lastIndex=t),null===e?-1:e.index}]});function Uo(t,e){var n;return void 0===(t=Rt(t).constructor)||null==(n=Rt(t)[Do])?e:ut(n)}var Do=we("species"),Bo=Math.min,Go=[].push,Wo="split",zo="length",Vo="lastIndex",Ho=4294967295,Yo=!qt(function(){RegExp(Ho,"y")});pn("split",2,function(i,o,d,v){var g="c"=="abbc"[Wo](/(b)*/)[1]||4!="test"[Wo](/(?:)/,-1)[zo]||2!="ab"[Wo](/(?:ab)*/)[zo]||4!="."[Wo](/(.?)(.?)/)[zo]||1<"."[Wo](/()()/)[zo]||""[Wo](/.?/)[zo]?function(t,e){var n=String(this);if(void 0===t&&0===e)return[];if(!oi(t))return d.call(n,t,e);for(var r,i,o,a=[],c=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),u=0,s=void 0===e?Ho:e>>>0,f=new RegExp(t.source,c+"g");(r=jo.call(f,n))&&!(u<(i=f[Vo])&&(a.push(n.slice(u,r.index)),1<r[zo]&&r.index<n[zo]&&Go.apply(a,r.slice(1)),o=r[0][zo],u=i,a[zo]>=s));)f[Vo]===r.index&&f[Vo]++;return u===n[zo]?!o&&f.test("")||a.push(""):a.push(n.slice(u)),a[zo]>s?a.slice(0,s):a}:"0"[Wo](void 0,0)[zo]?function(t,e){return void 0===t&&0===e?[]:d.call(this,t,e)}:d;return[function(t,e){var n=i(this),r=null==t?void 0:t[o];return void 0!==r?r.call(t,n,e):g.call(String(n),t,e)},function(t,e){var n=v(g,t,this,e,g!==d);if(n.done)return n.value;var r=Rt(t),i=String(this),n=Uo(r,RegExp),o=r.unicode,t=(r.ignoreCase?"i":"")+(r.multiline?"m":"")+(r.unicode?"u":"")+(Yo?"y":"g"),a=new n(Yo?r:"^(?:"+r.source+")",t),c=void 0===e?Ho:e>>>0;if(0==c)return[];if(0===i.length)return null===Oo(a,i)?[i]:[];for(var u=0,s=0,f=[];s<i.length;){a.lastIndex=Yo?s:0;var l,h=Oo(a,Yo?i:i.slice(s));if(null===h||(l=Bo(Ae(a.lastIndex+(Yo?0:s)),i.length))===u)s=Fo(i,s,o);else{if(f.push(i.slice(u,s)),f.length===c)return f;for(var p=1;p<=h.length-1;p++)if(f.push(h[p]),f.length===c)return f;s=u=l}}return f.push(i.slice(u)),f}]});function Ko(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}function Jo(){var t,e=+this;na.hasOwnProperty(e)&&(t=na[e],delete na[e],t())}var Zo,Xo=e(function(t){var l={},h={},t=t.exports=function(t,e,n,r,i){var o,a,c,u,i=i?function(){return t}:Fi(t),s=ne(n,r,e?2:1),f=0;if("function"!=typeof i)throw TypeError(t+" is not iterable!");if(_i(i)){for(o=Ae(t.length);f<o;f++)if((u=e?s(Rt(a=t[f])[0],a[1]):s(t[f]))===l||u===h)return u}else for(c=i.call(t);!(a=c.next()).done;)if((u=Si(c,s,a.value,e))===l||u===h)return u};t.BREAK=l,t.RETURN=h}),Qo=Bt.process,p=Bt.setImmediate,jn=Bt.clearImmediate,wn=Bt.MessageChannel,ta=Bt.Dispatch,ea=0,na={},ra="onreadystatechange",Te=function(t){Jo.call(t.data)};p&&jn||(p=function(t){for(var e=[],n=1;n<arguments.length;)e.push(arguments[n++]);return na[++ea]=function(){zn("function"==typeof t?t:Function(t),e)},Zo(ea),ea},jn=function(t){delete na[t]},"process"==ce(Qo)?Zo=function(t){Qo.nextTick(ne(Jo,t,1))}:ta&&ta.now?Zo=function(t){ta.now(ne(Jo,t,1))}:wn?(wn=(pn=new wn).port2,pn.port1.onmessage=Te,Zo=ne(wn.postMessage,wn,1)):Bt.addEventListener&&"function"==typeof postMessage&&!Bt.importScripts?(Zo=function(t){Bt.postMessage(t+"","*")},Bt.addEventListener("message",Te,!1)):Zo=ra in ct("script")?function(t){We.appendChild(ct("script"))[ra]=function(){We.removeChild(this),Jo.call(t)}}:function(t){setTimeout(ne(Jo,t,1),0)});var Te={set:p,clear:jn},ia=Te.set,oa=Bt.MutationObserver||Bt.WebKitMutationObserver,aa=Bt.process,ca=Bt.Promise,ua="process"==ce(aa);function sa(t){var n,r;this.promise=new t(function(t,e){if(void 0!==n||void 0!==r)throw TypeError("Bad Promise constructor");n=t,r=e}),this.resolve=ut(n),this.reject=ut(r)}function fa(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}function la(t,e){return Rt(t),zt(e)&&e.constructor===t?e:((0,(t=ba.f(t)).resolve)(e),t.promise)}function ha(t,e,n){for(var r in e)ee(t,r,e[r],n);return t}var pa,da,va,ga,ya,ma,ba={f:function(t){return new sa(t)}},p=Bt.navigator,wa=p&&p.userAgent||"",xa=Te.set,Sa=(ga=ua?function(){aa.nextTick(_a)}:!oa||Bt.navigator&&Bt.navigator.standalone?ca&&ca.resolve?(va=ca.resolve(void 0),function(){va.then(_a)}):function(){ia.call(Bt,_a)}:(ya=!0,ma=document.createTextNode(""),new oa(_a).observe(ma,{characterData:!0}),function(){ma.data=ya=!ya}),function(t){t={fn:t,next:void 0};da&&(da.next=t),pa||(pa=t,ga()),da=t});function _a(){var t,e;for(ua&&(t=aa.domain)&&t.exit();pa;){e=pa.fn,pa=pa.next;try{e()}catch(t){throw pa?ga():da=void 0,t}}da=void 0,t&&t.enter()}function ka(){}function ja(t){var e;return!(!zt(t)||"function"!=typeof(e=t.then))&&e}function Ea(f,e){var n;f._n||(f._n=!0,n=f._c,Sa(function(){for(var u=f._v,s=1==f._s,t=0;n.length>t;)!function(t){var e,n,r,i=s?t.ok:t.fail,o=t.resolve,a=t.reject,c=t.domain;try{i?(s||(2==f._h&&Da(f),f._h=1),!0===i?e=u:(c&&c.enter(),e=i(u),c&&(c.exit(),r=!0)),e===t.promise?a(Ma("Promise-chain cycle")):(n=ja(e))?n.call(e,o,a):o(e)):a(u)}catch(t){c&&!r&&c.exit(),a(t)}}(n[t++]);f._c=[],f._n=!1,e&&!f._h&&qa(f)}))}function Pa(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),Ea(e,!0))}var Fa,Oa,Aa,La,Ia="Promise",Ma=Bt.TypeError,Ta=Bt.process,jn=Ta&&Ta.versions,$a=jn&&jn.v8||"",Ra=Bt[Ia],Ca="process"==Bn(Ta),Na=Oa=ba.f,p=!!function(){try{var t=Ra.resolve(1),e=(t.constructor={})[we("species")]=function(t){t(ka,ka)};return(Ca||"function"==typeof PromiseRejectionEvent)&&t.then(ka)instanceof e&&0!==$a.indexOf("6.6")&&-1===wa.indexOf("Chrome/66")}catch(t){}}(),qa=function(i){xa.call(Bt,function(){var t,e,n=i._v,r=Ua(i);if(r&&(t=fa(function(){Ca?Ta.emit("unhandledRejection",n,i):(e=Bt.onunhandledrejection)?e({promise:i,reason:n}):(e=Bt.console)&&e.error&&e.error("Unhandled promise rejection",n)}),i._h=Ca||Ua(i)?2:1),i._a=void 0,r&&t.e)throw t.v})},Ua=function(t){return 1!==t._h&&0===(t._a||t._c).length},Da=function(e){xa.call(Bt,function(){var t;Ca?Ta.emit("rejectionHandled",e):(t=Bt.onrejectionhandled)&&t({promise:e,reason:e._v})})},Ba=function(t){var n,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===t)throw Ma("Promise can't be resolved itself");(n=ja(t))?Sa(function(){var e={_w:r,_d:!1};try{n.call(t,ne(Ba,e,1),ne(Pa,e,1))}catch(t){Pa.call(e,t)}}):(r._v=t,r._s=1,Ea(r,!1))}catch(t){Pa.call({_w:r,_d:!1},t)}}};p||(Ra=function(t){Ko(this,Ra,Ia,"_h"),ut(t),Fa.call(this);try{t(ne(Ba,this,1),ne(Pa,this,1))}catch(t){Pa.call(this,t)}},(Fa=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=ha(Ra.prototype,{then:function(t,e){var n=Na(Uo(this,Ra));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=Ca?Ta.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&Ea(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),Aa=function(){var t=new Fa;this.promise=t,this.resolve=ne(Ba,t,1),this.reject=ne(Pa,t,1)},ba.f=Na=function(t){return t===Ra||t===La?new Aa:Oa(t)}),me(me.G+me.W+me.F*!p,{Promise:Ra}),oe(Ra,Ia),oo(Ia),La=$t[Ia],me(me.S+me.F*!p,Ia,{reject:function(t){var e=Na(this);return(0,e.reject)(t),e.promise}}),me(me.S+me.F*!p,Ia,{resolve:function(t){return la(this,t)}}),me(me.S+me.F*!(p&&Ii(function(t){Ra.all(t).catch(ka)})),Ia,{all:function(t){var a=this,e=Na(a),c=e.resolve,u=e.reject,n=fa(function(){var r=[],i=0,o=1;Xo(t,!1,function(t){var e=i++,n=!1;r.push(void 0),o++,a.resolve(t).then(function(t){n||(n=!0,r[e]=t,--o||c(r))},u)}),--o||c(r)});return n.e&&u(n.v),e.promise},race:function(t){var e=this,n=Na(e),r=n.reject,i=fa(function(){Xo(t,!1,function(t){e.resolve(t).then(n.resolve,r)})});return i.e&&r(i.v),n.promise}});function Ga(t,e){if(!zt(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}function Wa(t,e){var n,r=Ka(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n}function za(n,t,e,r,i,o){function a(t){var n=v[t];ee(v,t,"delete"==t?function(t){return!(o&&!zt(t))&&n.call(this,0===t?0:t)}:"has"==t?function(t){return!(o&&!zt(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return o&&!zt(t)?void 0:n.call(this,0===t?0:t)}:"add"==t?function(t){return n.call(this,0===t?0:t),this}:function(t,e){return n.call(this,0===t?0:t,e),this})}var c,u,s,f,l,h=Bt[n],p=h,d=i?"set":"add",v=p&&p.prototype,g={};return"function"==typeof p&&(o||v.forEach&&!qt(function(){(new p).entries().next()}))?(u=(c=new p)[d](o?{}:-0,1)!=c,s=qt(function(){c.has(1)}),f=Ii(function(t){new p(t)}),l=!o&&qt(function(){for(var t=new p,e=5;e--;)t[d](e,e);return!t.has(-0)}),f||(((p=t(function(t,e){Ko(t,p,n);t=or(new h,t,p);return null!=e&&Xo(e,i,t[d],t),t})).prototype=v).constructor=p),(s||l)&&(a("delete"),a("has"),i&&a("get")),(l||u)&&a(d),o&&v.clear&&delete v.clear):(p=r.getConstructor(t,n,i,d),ha(p.prototype,e),be.NEED=!0),oe(p,n),g[n]=p,me(me.G+me.W+me.F*(p!=h),g),o||r.setStrong(p,n,i),p}function Va(t){return t._l||(t._l=new nc)}function Ha(t,e){return Qa(t.a,function(t){return t[0]===e})}var Ya=Yt.f,Ka=be.fastKey,Ja=Wt?"_s":"size",Za={getConstructor:function(t,i,n,r){var o=t(function(t,e){Ko(t,o,i,"_i"),t._t=i,t._i=Ye(null),t._f=void 0,t._l=void 0,t[Ja]=0,null!=e&&Xo(e,n,t[r],t)});return ha(o.prototype,{clear:function(){for(var t=Ga(this,i),e=t._i,n=t._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete e[n.i];t._f=t._l=void 0,t[Ja]=0},delete:function(t){var e,n=Ga(this,i),r=Wa(n,t);return r&&(e=r.n,t=r.p,delete n._i[r.i],r.r=!0,t&&(t.n=e),e&&(e.p=t),n._f==r&&(n._f=e),n._l==r&&(n._l=t),n[Ja]--),!!r},forEach:function(t){Ga(this,i);for(var e,n=ne(t,1<arguments.length?arguments[1]:void 0,3);e=e?e.n:this._f;)for(n(e.v,e.k,this);e&&e.r;)e=e.p},has:function(t){return!!Wa(Ga(this,i),t)}}),Wt&&Ya(o.prototype,"size",{get:function(){return Ga(this,i)[Ja]}}),o},def:function(t,e,n){var r,i=Wa(t,e);return i?i.v=n:(t._l=i={i:r=Ka(e,!0),k:e,v:n,p:n=t._l,n:void 0,r:!1},t._f||(t._f=i),n&&(n.n=i),t[Ja]++,"F"!==r&&(t._i[r]=i)),t},getEntry:Wa,setStrong:function(t,n,e){Qr(t,n,function(t,e){this._t=Ga(t,n),this._k=e,this._l=void 0},function(){for(var t=this,e=t._k,n=t._l;n&&n.r;)n=n.p;return t._t&&(t._l=n=n?n.n:t._t._f)?co(0,"keys"==e?n.k:"values"==e?n.v:[n.k,n.v]):(t._t=void 0,co(1))},e?"entries":"values",!e,!0),oo(n)}},Xa=(za("Map",function(t){return function(){return t(this,0<arguments.length?arguments[0]:void 0)}},{get:function(t){t=Za.getEntry(Ga(this,"Map"),t);return t&&t.v},set:function(t,e){return Za.def(Ga(this,"Map"),0===t?0:t,e)}},Za,!0),za("Set",function(t){return function(){return t(this,0<arguments.length?arguments[0]:void 0)}},{add:function(t){return Za.def(Ga(this,"Set"),t=0===t?0:t,t)}},Za),be.getWeak),Qa=Ni(5),tc=Ni(6),ec=0,nc=function(){this.a=[]};nc.prototype={get:function(t){t=Ha(this,t);if(t)return t[1]},has:function(t){return!!Ha(this,t)},set:function(t,e){var n=Ha(this,t);n?n[1]=e:this.a.push([t,e])},delete:function(e){var t=tc(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}};var rc={getConstructor:function(t,n,r,i){var o=t(function(t,e){Ko(t,o,n,"_i"),t._t=n,t._i=ec++,t._l=void 0,null!=e&&Xo(e,r,t[i],t)});return ha(o.prototype,{delete:function(t){if(!zt(t))return!1;var e=Xa(t);return!0===e?Va(Ga(this,n)).delete(t):e&&Gt(e,this._i)&&delete e[this._i]},has:function(t){if(!zt(t))return!1;var e=Xa(t);return!0===e?Va(Ga(this,n)).has(t):e&&Gt(e,this._i)}}),o},def:function(t,e,n){var r=Xa(Rt(e),!0);return!0===r?Va(t).set(e,n):r[t._i]=n,t},ufstore:Va},ic=(e(function(t){function e(t){return function(){return t(this,0<arguments.length?arguments[0]:void 0)}}var i,n=Ni(0),r=!Bt.ActiveXObject&&"ActiveXObject"in Bt,o="WeakMap",a=be.getWeak,c=Object.isExtensible,u=rc.ufstore,s={get:function(t){if(zt(t)){var e=a(t);return!0===e?u(Ga(this,o)).get(t):e?e[this._i]:void 0}},set:function(t,e){return rc.def(Ga(this,o),t,e)}},f=t.exports=za(o,e,s,rc,!0,!0);r&&(i=rc.getConstructor(e,o),Nn(i.prototype,s),be.NEED=!0,n(["delete","has","get","set"],function(n){var t=f.prototype,r=t[n];ee(t,n,function(t,e){if(!zt(t)||c(t))return r.call(this,t,e);this._f||(this._f=new i);e=this._f[n](t,e);return"set"==n?this:e})}))}),"WeakSet");za(ic,function(t){return function(){return t(this,0<arguments.length?arguments[0]:void 0)}},{add:function(t){return rc.def(Ga(this,ic),t,!0)}},rc,!1,!0);for(var oc,ac=Dt("typed_array"),cc=Dt("view"),jn=!(!Bt.ArrayBuffer||!Bt.DataView),uc=jn,sc=0,fc="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");sc<9;)(oc=Bt[fc[sc++]])?(Jt(oc.prototype,ac,!0),Jt(oc.prototype,cc,!0)):uc=!1;function lc(t){if(void 0===t)return 0;var e=fe(t),t=Ae(e);if(e!==t)throw RangeError("Wrong length!");return t}var hc={ABV:jn,CONSTR:uc,TYPED:ac,VIEW:cc},pc=e(function(t,e){var n=Je.f,r=Yt.f,i="ArrayBuffer",o="DataView",a="prototype",f="Wrong index!",c=Bt[i],u=Bt[o],s=Bt.Math,l=Bt.RangeError,h=Bt.Infinity,p=c,d=s.abs,v=s.pow,g=s.floor,y=s.log,m=s.LN2,b="byteLength",s="byteOffset",w=Wt?"_b":"buffer",x=Wt?"_l":b,S=Wt?"_o":s;function _(t,e,n){var r,i,o=new Array(n),a=8*n-e-1,c=(1<<a)-1,u=c>>1,s=23===e?v(2,-24)-v(2,-77):0,f=0,l=t<0||0===t&&1/t<0?1:0;for((t=d(t))!=t||t===h?(i=t!=t?1:0,r=c):(r=g(y(t)/m),t*(n=v(2,-r))<1&&(r--,n*=2),2<=(t+=1<=r+u?s/n:s*v(2,1-u))*n&&(r++,n/=2),c<=r+u?(i=0,r=c):1<=r+u?(i=(t*n-1)*v(2,e),r+=u):(i=t*v(2,u-1)*v(2,e),r=0));8<=e;o[f++]=255&i,i/=256,e-=8);for(r=r<<e|i,a+=e;0<a;o[f++]=255&r,r/=256,a-=8);return o[--f]|=128*l,o}function k(t,e,n){var r,i=8*n-e-1,o=(1<<i)-1,a=o>>1,c=i-7,u=n-1,n=t[u--],s=127&n;for(n>>=7;0<c;s=256*s+t[u],u--,c-=8);for(r=s&(1<<-c)-1,s>>=-c,c+=e;0<c;r=256*r+t[u],u--,c-=8);if(0===s)s=1-a;else{if(s===o)return r?NaN:n?-h:h;r+=v(2,e),s-=a}return(n?-1:1)*r*v(2,s-e)}function j(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function E(t){return[255&t]}function P(t){return[255&t,t>>8&255]}function F(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function O(t){return _(t,52,8)}function A(t){return _(t,23,4)}function L(t,e,n){r(t[a],e,{get:function(){return this[n]}})}function I(t,e,n,r){var i=lc(+n);if(i+e>t[x])throw l(f);n=t[w]._b,t=i+t[S],e=n.slice(t,t+e);return r?e:e.reverse()}function M(t,e,n,r,i,o){n=lc(+n);if(n+e>t[x])throw l(f);for(var a=t[w]._b,c=n+t[S],u=r(+i),s=0;s<e;s++)a[c+s]=u[o?s:e-s-1]}if(hc.ABV){if(!qt(function(){c(1)})||!qt(function(){new c(-1)})||qt(function(){return new c,new c(1.5),new c(NaN),c.name!=i})){for(var T,$=(c=function(t){return Ko(this,c),new p(lc(t))})[a]=p[a],R=n(p),C=0;R.length>C;)(T=R[C++])in c||Jt(c,T,p[T]);$.constructor=c}var $=new u(new c(2)),N=u[a].setInt8;$.setInt8(0,2147483648),$.setInt8(1,2147483649),!$.getInt8(0)&&$.getInt8(1)||ha(u[a],{setInt8:function(t,e){N.call(this,t,e<<24>>24)},setUint8:function(t,e){N.call(this,t,e<<24>>24)}},!0)}else c=function(t){Ko(this,c,i);t=lc(t);this._b=to.call(new Array(t),0),this[x]=t},u=function(t,e,n){Ko(this,u,o),Ko(t,c,o);var r=t[x],e=fe(e);if(e<0||r<e)throw l("Wrong offset!");if(r<e+(n=void 0===n?r-e:Ae(n)))throw l("Wrong length!");this[w]=t,this[S]=e,this[x]=n},Wt&&(L(c,b,"_l"),L(u,"buffer","_b"),L(u,b,"_l"),L(u,s,"_o")),ha(u[a],{getInt8:function(t){return I(this,1,t)[0]<<24>>24},getUint8:function(t){return I(this,1,t)[0]},getInt16:function(t){t=I(this,2,t,arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(t){t=I(this,2,t,arguments[1]);return t[1]<<8|t[0]},getInt32:function(t){return j(I(this,4,t,arguments[1]))},getUint32:function(t){return j(I(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return k(I(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return k(I(this,8,t,arguments[1]),52,8)},setInt8:function(t,e){M(this,1,t,E,e)},setUint8:function(t,e){M(this,1,t,E,e)},setInt16:function(t,e){M(this,2,t,P,e,arguments[2])},setUint16:function(t,e){M(this,2,t,P,e,arguments[2])},setInt32:function(t,e){M(this,4,t,F,e,arguments[2])},setUint32:function(t,e){M(this,4,t,F,e,arguments[2])},setFloat32:function(t,e){M(this,4,t,A,e,arguments[2])},setFloat64:function(t,e){M(this,8,t,O,e,arguments[2])}});oe(c,i),oe(u,o),Jt(u[a],hc.VIEW,!0),e[i]=c,e[o]=u}),p=Bt.ArrayBuffer,dc=pc.ArrayBuffer,vc=pc.DataView,gc=hc.ABV&&p.isView,yc=dc.prototype.slice,mc=hc.VIEW,jn="ArrayBuffer";me(me.G+me.W+me.F*(p!==dc),{ArrayBuffer:dc}),me(me.S+me.F*!hc.CONSTR,jn,{isView:function(t){return gc&&gc(t)||zt(t)&&mc in t}}),me(me.P+me.U+me.F*qt(function(){return!new dc(2).slice(1,void 0).byteLength}),jn,{slice:function(t,e){if(void 0!==yc&&void 0===e)return yc.call(Rt(this),t);for(var n=Rt(this).byteLength,r=le(t,n),i=le(void 0===e?n:e,n),n=new(Uo(this,dc))(Ae(i-r)),o=new vc(this),a=new vc(n),c=0;r<i;)a.setUint8(c++,o.getUint8(r++));return n}}),oo(jn),me(me.G+me.W+me.F*!hc.ABV,{DataView:pc.DataView});jn=e(function(t){var p,d,v,g,l,y,n,m,e,r,b,w,i,o,a,x,S,h,_,k,j,E,P,c,u,s,F,O,A,f,L,I,M,T,$,R,C,N,q,U,D,B,G,W,z,V,H,Y,K,J,Z,X,Q,tt,et,nt,rt,it,ot,at,ct,ut,st,ft,lt,ht,pt,dt,vt,gt,yt,mt,bt,wt,xt,St,_t,kt,jt,Et,Pt,Ft,Ot,At,Lt,It,Mt,Tt,$t,Rt,Ct,Nt;Wt?(p=Bt,d=qt,v=me,g=hc,l=ne,y=Ko,n=Kt,m=Jt,e=ha,r=fe,b=Ae,w=lc,i=le,o=Ut,a=Gt,x=Bn,S=zt,h=de,_=_i,k=Ye,j=Mn,E=Je.f,P=Fi,Rt=Dt,Et=we,Ct=Ni,c=he,u=Uo,s=uo,F=Kr,O=Ii,A=oo,f=to,L=Zi,M=nn,T=(I=Yt).f,$=M.f,R=p.RangeError,C=p.TypeError,N=p.Uint8Array,U="Shared"+(q="ArrayBuffer"),D="BYTES_PER_ELEMENT",B="prototype",dt=Array[B],G=pc.ArrayBuffer,W=pc.DataView,z=Ct(0),V=Ct(2),H=Ct(3),Y=Ct(4),K=Ct(5),J=Ct(6),Z=c(!0),X=c(!1),Q=s.values,tt=s.keys,et=s.entries,nt=dt.lastIndexOf,rt=dt.reduce,it=dt.reduceRight,ot=dt.join,at=dt.sort,ct=dt.slice,ut=dt.toString,st=dt.toLocaleString,ft=Et("iterator"),lt=Et("toStringTag"),ht=Rt("typed_constructor"),pt=Rt("def_constructor"),dt=g.CONSTR,vt=g.TYPED,gt=g.VIEW,yt="Wrong length!",mt=Ct(1,function(t,e){return _t(u(t,t[pt]),e)}),bt=d(function(){return 1===new N(new Uint16Array([1]).buffer)[0]}),wt=!!N&&!!N[B].set&&d(function(){new N(1).set({})}),xt=function(t,e){t=r(t);if(t<0||t%e)throw R("Wrong offset!");return t},St=function(t){if(S(t)&&vt in t)return t;throw C(t+" is not a typed array!")},_t=function(t,e){if(!(S(t)&&ht in t))throw C("It is not a typed array constructor!");return new t(e)},kt=function(t,e){return jt(u(t,t[pt]),e)},jt=function(t,e){for(var n=0,r=e.length,i=_t(t,r);n<r;)i[n]=e[n++];return i},Et=function(t,e,n){T(t,e,{get:function(){return this._d[n]}})},Pt=function(t){var e,n,r,i,o,a,c=h(t),u=arguments.length,s=1<u?arguments[1]:void 0,f=void 0!==s,t=P(c);if(null!=t&&!_(t)){for(a=t.call(c),r=[],e=0;!(o=a.next()).done;e++)r.push(o.value);c=r}for(f&&2<u&&(s=l(s,arguments[2],2)),e=0,n=b(c.length),i=_t(this,n);e<n;e++)i[e]=f?s(c[e],e):c[e];return i},Ft=function(){for(var t=0,e=arguments.length,n=_t(this,e);t<e;)n[t]=arguments[t++];return n},Ot=!!N&&d(function(){st.call(new N(1))}),At=function(){return st.apply(Ot?ct.call(St(this)):St(this),arguments)},Lt={copyWithin:function(t,e){return L.call(St(this),t,e,2<arguments.length?arguments[2]:void 0)},every:function(t){return Y(St(this),t,1<arguments.length?arguments[1]:void 0)},fill:function(t){return f.apply(St(this),arguments)},filter:function(t){return kt(this,V(St(this),t,1<arguments.length?arguments[1]:void 0))},find:function(t){return K(St(this),t,1<arguments.length?arguments[1]:void 0)},findIndex:function(t){return J(St(this),t,1<arguments.length?arguments[1]:void 0)},forEach:function(t){z(St(this),t,1<arguments.length?arguments[1]:void 0)},indexOf:function(t){return X(St(this),t,1<arguments.length?arguments[1]:void 0)},includes:function(t){return Z(St(this),t,1<arguments.length?arguments[1]:void 0)},join:function(t){return ot.apply(St(this),arguments)},lastIndexOf:function(t){return nt.apply(St(this),arguments)},map:function(t){return mt(St(this),t,1<arguments.length?arguments[1]:void 0)},reduce:function(t){return rt.apply(St(this),arguments)},reduceRight:function(t){return it.apply(St(this),arguments)},reverse:function(){for(var t,e=this,n=St(e).length,r=Math.floor(n/2),i=0;i<r;)t=e[i],e[i++]=e[--n],e[n]=t;return e},some:function(t){return H(St(this),t,1<arguments.length?arguments[1]:void 0)},sort:function(t){return at.call(St(this),t)},subarray:function(t,e){var n=St(this),r=n.length,t=i(t,r);return new(u(n,n[pt]))(n.buffer,n.byteOffset+t*n.BYTES_PER_ELEMENT,b((void 0===e?r:i(e,r))-t))}},It=function(t,e){return kt(this,ct.call(St(this),t,e))},Mt=function(t){St(this);var e=xt(arguments[1],1),n=this.length,r=h(t),i=b(r.length),o=0;if(n<i+e)throw R(yt);for(;o<i;)this[e+o]=r[o++]},Tt={entries:function(){return et.call(St(this))},keys:function(){return tt.call(St(this))},values:function(){return Q.call(St(this))}},$t=function(t,e){return S(t)&&t[vt]&&"symbol"!=typeof e&&e in t&&String(+e)==String(e)},Rt=function(t,e){return $t(t,e=o(e,!0))?n(2,t[e]):$(t,e)},Ct=function(t,e,n){return!($t(t,e=o(e,!0))&&S(n)&&a(n,"value"))||a(n,"get")||a(n,"set")||n.configurable||a(n,"writable")&&!n.writable||a(n,"enumerable")&&!n.enumerable?T(t,e,n):(t[e]=n.value,t)},dt||(M.f=Rt,I.f=Ct),v(v.S+v.F*!dt,"Object",{getOwnPropertyDescriptor:Rt,defineProperty:Ct}),d(function(){ut.call({})})&&(ut=st=function(){return ot.call(this)}),Nt=e({},Lt),e(Nt,Tt),m(Nt,ft,Tt.values),e(Nt,{slice:It,set:Mt,constructor:function(){},toString:ut,toLocaleString:At}),Et(Nt,"buffer","b"),Et(Nt,"byteOffset","o"),Et(Nt,"byteLength","l"),Et(Nt,"length","e"),T(Nt,lt,{get:function(){return this[vt]}}),t.exports=function(t,s,e,r){function f(t,e){T(t,e,{get:function(){return function(t,e){t=t._d;return t.v[n](e*s+t.o,bt)}(this,e)},set:function(t){return function(t,e,n){t=t._d;r&&(n=(n=Math.round(n))<0?0:255<n?255:255&n),t.v[i](e*s+t.o,n,bt)}(this,e,t)},enumerable:!0})}var l=t+((r=!!r)?"Clamped":"")+"Array",n="get"+t,i="set"+t,h=p[l],o=h||{},a=h&&j(h),c=!h||!g.ABV,t={},u=h&&h[B];c?(h=e(function(t,e,n,r){y(t,h,l,"_d");var i,o,a,c=0,u=0;if(S(e)){if(!(e instanceof G||(a=x(e))==q||a==U))return vt in e?jt(h,e):Pt.call(h,e);a=e,u=xt(n,s);n=e.byteLength;if(void 0===r){if(n%s)throw R(yt);if((i=n-u)<0)throw R(yt)}else if(n<(i=b(r)*s)+u)throw R(yt);o=i/s}else o=w(e),a=new G(i=o*s);for(m(t,"_d",{b:a,o:u,l:i,e:o,v:new W(a)});c<o;)f(t,c++)}),u=h[B]=k(Nt),m(u,"constructor",h)):d(function(){h(1)})&&d(function(){new h(-1)})&&O(function(t){new h,new h(null),new h(1.5),new h(t)},!0)||(h=e(function(t,e,n,r){var i;return y(t,h,l),S(e)?e instanceof G||(i=x(e))==q||i==U?void 0!==r?new o(e,xt(n,s),r):void 0!==n?new o(e,xt(n,s)):new o(e):vt in e?jt(h,e):Pt.call(h,e):new o(w(e))}),z(a!==Function.prototype?E(o).concat(E(a)):E(o),function(t){t in h||m(h,t,o[t])}),(h[B]=u).constructor=h);c=u[ft],e=!!c&&("values"==c.name||null==c.name),a=Tt.values;m(h,ht,!0),m(u,vt,l),m(u,gt,!0),m(u,pt,h),(r?new h(1)[lt]==l:lt in u)||T(u,lt,{get:function(){return l}}),t[l]=h,v(v.G+v.W+v.F*(h!=o),t),v(v.S,l,{BYTES_PER_ELEMENT:s}),v(v.S+v.F*d(function(){o.of.call(h,1)}),l,{from:Pt,of:Ft}),D in u||m(u,D,s),v(v.P,l,Lt),A(l),v(v.P+v.F*wt,l,{set:Mt}),v(v.P+v.F*!e,l,Tt),u.toString!=ut&&(u.toString=ut),v(v.P+v.F*d(function(){new h(1).slice()}),l,{slice:It}),v(v.P+v.F*(d(function(){return[1,2].toLocaleString()!=new h([1,2]).toLocaleString()})||!d(function(){u.toLocaleString.call([1,2])})),l,{toLocaleString:At}),F[l]=e?c:a,e||m(u,ft,a)}):t.exports=function(){}});jn("Int8",1,function(r){return function(t,e,n){return r(this,t,e,n)}}),jn("Uint8",1,function(r){return function(t,e,n){return r(this,t,e,n)}}),jn("Uint8",1,function(r){return function(t,e,n){return r(this,t,e,n)}},!0),jn("Int16",2,function(r){return function(t,e,n){return r(this,t,e,n)}}),jn("Uint16",2,function(r){return function(t,e,n){return r(this,t,e,n)}}),jn("Int32",4,function(r){return function(t,e,n){return r(this,t,e,n)}}),jn("Uint32",4,function(r){return function(t,e,n){return r(this,t,e,n)}}),jn("Float32",4,function(r){return function(t,e,n){return r(this,t,e,n)}}),jn("Float64",8,function(r){return function(t,e,n){return r(this,t,e,n)}});var bc=(Bt.Reflect||{}).apply,wc=Function.apply;me(me.S+me.F*!qt(function(){bc(function(){})}),"Reflect",{apply:function(t,e,n){t=ut(t),n=Rt(n);return bc?bc(t,e,n):wc.call(t,e,n)}});var xc=(Bt.Reflect||{}).construct,Sc=qt(function(){function t(){}return!(xc(function(){},[],t)instanceof t)}),_c=!qt(function(){xc(function(){})});me(me.S+me.F*(Sc||_c),"Reflect",{construct:function(t,e){ut(t),Rt(e);var n=arguments.length<3?t:ut(arguments[2]);if(_c&&!Sc)return xc(t,e,n);if(t==n){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var r=[null];return r.push.apply(r,e),new(Yn.apply(t,r))}r=n.prototype,n=Ye(zt(r)?r:Object.prototype),r=Function.apply.call(t,n,e);return zt(r)?r:n}}),me(me.S+me.F*qt(function(){Reflect.defineProperty(Yt.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(t,e,n){Rt(t),e=Ut(e,!0),Rt(n);try{return Yt.f(t,e,n),!0}catch(t){return!1}}});var kc=nn.f;me(me.S,"Reflect",{deleteProperty:function(t,e){var n=kc(Rt(t),e);return!(n&&!n.configurable)&&delete t[e]}});function jc(t){this._t=Rt(t),this._i=0;var e,n=this._k=[];for(e in t)n.push(e)}Zr(jc,"Object",function(){var t,e=this._k;do{if(this._i>=e.length)return{value:void 0,done:!0}}while(!((t=e[this._i++])in this._t));return{value:t,done:!1}}),me(me.S,"Reflect",{enumerate:function(t){return new jc(t)}}),me(me.S,"Reflect",{get:function t(e,n){var r,i=arguments.length<3?e:arguments[2];return Rt(e)===i?e[n]:(r=nn.f(e,n))?Gt(r,"value")?r.value:void 0!==r.get?r.get.call(i):void 0:zt(e=Mn(e))?t(e,n,i):void 0}}),me(me.S,"Reflect",{getOwnPropertyDescriptor:function(t,e){return nn.f(Rt(t),e)}}),me(me.S,"Reflect",{getPrototypeOf:function(t){return Mn(Rt(t))}}),me(me.S,"Reflect",{has:function(t,e){return e in t}});var Ec=Object.isExtensible;me(me.S,"Reflect",{isExtensible:function(t){return Rt(t),!Ec||Ec(t)}});var jn=Bt.Reflect,Pc=jn&&jn.ownKeys||function(t){var e=Je.f(Rt(t)),n=qe.f;return n?e.concat(n(t)):e};me(me.S,"Reflect",{ownKeys:Pc});var Fc=Object.preventExtensions;me(me.S,"Reflect",{preventExtensions:function(t){Rt(t);try{return Fc&&Fc(t),!0}catch(t){return!1}}}),me(me.S,"Reflect",{set:function t(e,n,r){var i,o=arguments.length<4?e:arguments[3],a=nn.f(Rt(e),n);if(!a){if(zt(i=Mn(e)))return t(i,n,r,o);a=Kt(0)}if(Gt(a,"value")){if(!1===a.writable||!zt(o))return!1;if(i=nn.f(o,n)){if(i.get||i.set||!1===i.writable)return!1;i.value=r,Yt.f(o,n,i)}else Yt.f(o,n,Kt(0,r));return!0}return void 0!==a.set&&(a.set.call(o,r),!0)}}),Dn&&me(me.S,"Reflect",{setPrototypeOf:function(t,e){Dn.check(t,e);try{return Dn.set(t,e),!0}catch(t){return!1}}});var Oc=he(!0);me(me.P,"Array",{includes:function(t){return Oc(this,t,1<arguments.length?arguments[1]:void 0)}}),bn("includes");$t.Array.includes;var Ac=we("isConcatSpreadable");var Lc=function t(e,n,r,i,o,a,c,u){for(var s,f,l=o,h=0,p=!!c&&ne(c,u,3);h<i;){if(h in r){if(s=p?p(r[h],h,n):r[h],f=!1,(f=zt(s)?void 0!==(f=s[Ac])?!!f:De(s):f)&&0<a)l=t(e,n,s,Ae(s.length),l,a-1)-1;else{if(9007199254740991<=l)throw TypeError();e[l]=s}l++}h++}return l};me(me.P,"Array",{flatMap:function(t){var e,n,r=de(this);return ut(t),e=Ae(r.length),n=Ci(r,0),Lc(n,r,r,e,0,1,t,arguments[1]),n}}),bn("flatMap");function Ic(t,e,n,r){var i=String(ue(t)),t=i.length,n=void 0===n?" ":String(n);return(e=Ae(e))<=t||""==n?i:(t=e-t,(n=xr.call(n,Math.ceil(t/n.length))).length>t&&(n=n.slice(0,t)),r?n+i:i+n)}$t.Array.flatMap;bn=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(wa);me(me.P+me.F*bn,"String",{padStart:function(t){return Ic(this,t,1<arguments.length?arguments[1]:void 0,!0)}});$t.String.padStart;bn=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(wa);me(me.P+me.F*bn,"String",{padEnd:function(t){return Ic(this,t,1<arguments.length?arguments[1]:void 0,!1)}});$t.String.padEnd;Ge("trimLeft",function(t){return function(){return t(this,1)}},"trimStart");$t.String.trimLeft;Ge("trimRight",function(t){return function(){return t(this,2)}},"trimEnd");$t.String.trimRight;ae("asyncIterator");_e.f("asyncIterator");me(me.S,"Object",{getOwnPropertyDescriptors:function(t){for(var e,n,r=se(t),i=nn.f,o=Pc(r),a={},c=0;o.length>c;)void 0!==(n=i(r,e=o[c++]))&&ki(a,e,n);return a}});$t.Object.getOwnPropertyDescriptors;var Mc=Ue.f,bn=function(c){return function(t){for(var e,n=se(t),r=Ne(n),i=r.length,o=0,a=[];o<i;)e=r[o++],Wt&&!Mc.call(n,e)||a.push(c?[e,n[e]]:n[e]);return a}},Tc=bn(!1);me(me.S,"Object",{values:function(t){return Tc(t)}});$t.Object.values;var $c=bn(!0);me(me.S,"Object",{entries:function(t){return $c(t)}});$t.Object.entries;me(me.P+me.R,"Promise",{finally:function(e){var n=Uo(this,$t.Promise||Bt.Promise),t="function"==typeof e;return this.then(t?function(t){return la(n,e()).then(function(){return t})}:e,t?function(t){return la(n,e()).then(function(){throw t})}:e)}});$t.Promise.finally;var Rc=[].slice,Ge=/MSIE .\./.test(wa),bn=function(i){return function(t,e){var n=2<arguments.length,r=n&&Rc.call(arguments,2);return i(n?function(){("function"==typeof t?t:Function(t)).apply(this,r)}:t,e)}};me(me.G+me.B+me.F*Ge,{setTimeout:bn(Bt.setTimeout),setInterval:bn(Bt.setInterval)}),me(me.G+me.B,{setImmediate:Te.set,clearImmediate:Te.clear});for(var Cc=we("iterator"),Nc=we("toStringTag"),qc=Kr.Array,Uc={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},Dc=Ne(Uc),Bc=0;Bc<Dc.length;Bc++){var Gc,Wc=Dc[Bc],zc=Uc[Wc],Vc=Bt[Wc],Hc=Vc&&Vc.prototype;if(Hc&&(Hc[Cc]||Jt(Hc,Cc,qc),Hc[Nc]||Jt(Hc,Nc,Wc),Kr[Wc]=qc,zc))for(Gc in uo)Hc[Gc]||ee(Hc,Gc,uo[Gc],!0)}function Yc(r,i,t){if(!function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(r),void 0===i)return r;switch(t){case 1:return function(t){return r.call(i,t)};case 2:return function(t,e){return r.call(i,t,e)};case 3:return function(t,e,n){return r.call(i,t,e,n)}}return function(){return r.apply(i,arguments)}}function Kc(t){return"object"==typeof t?null!==t:"function"==typeof t}function Jc(t){if(!Kc(t))throw TypeError(t+" is not an object!");return t}var Zc=e(function(t){t=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)}),Xc=e(function(t){t=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=t)}),bn=(Xc.version,function(t){try{return!!t()}catch(t){return!0}}),Te=!bn(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),Qc=Zc.document,tu=Kc(Qc)&&Kc(Qc.createElement),eu=!Te&&!bn(function(){return 7!=Object.defineProperty(tu?Qc.createElement("div"):{},"a",{get:function(){return 7}}).a}),nu=Object.defineProperty,ru={f:Te?Object.defineProperty:function(t,e,n){if(Jc(t),e=function(t,e){if(!Kc(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!Kc(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!Kc(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!Kc(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}(e,!0),Jc(n),eu)try{return nu(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},iu=Te?function(t,e,n){return ru.f(t,e,{enumerable:!((e=1)&e),configurable:!(2&e),writable:!(4&e),value:n})}:function(t,e,n){return t[e]=n,t},ou={}.hasOwnProperty,au="prototype",cu=function(t,e,n){var r,i,o,a,c=t&cu.F,u=t&cu.G,s=t&cu.S,f=t&cu.P,l=t&cu.B,h=t&cu.W,p=u?Xc:Xc[e]||(Xc[e]={}),d=p[au],v=u?Zc:s?Zc[e]:(Zc[e]||{})[au];for(r in n=u?e:n)(i=!c&&v&&void 0!==v[r])&&(o=p,a=r,ou.call(o,a))||(a=(i?v:n)[r],p[r]=u&&"function"!=typeof v[r]?n[r]:l&&i?Yc(a,Zc):h&&v[r]==a?function(r){function t(t,e,n){if(this instanceof r){switch(arguments.length){case 0:return new r;case 1:return new r(t);case 2:return new r(t,e)}return new r(t,e,n)}return r.apply(this,arguments)}return t[au]=r[au],t}(a):f&&"function"==typeof a?Yc(Function.call,a):a,f&&((p.virtual||(p.virtual={}))[r]=a,t&cu.R&&d&&!d[r]&&iu(d,r,a)))};cu.F=1,cu.G=2,cu.S=4,cu.P=8,cu.B=16,cu.W=32,cu.U=64,cu.R=128,cu(cu.G,{global:Zc});var uu,su=Xc.global,fu=e(function(t){var e,n=(e=su)&&e.__esModule?e:{default:e};n.default._babelPolyfill&&"undefined"!=typeof console&&console.warn&&console.warn("@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning."),n.default._babelPolyfill=!0});(uu=fu)&&uu.__esModule&&Object.prototype.hasOwnProperty.call(uu,"default")&&uu.default;var lu=require("commander"),hu=new Mt;return lu.allowUnknownOption(!1),process.on("SIGINT",function(){hu.emit("shutdown")}),lu.version("v".concat(require("../package").version)).option("-v, --verbose","log verbose output").option("-f, --file","Add Filename and optional new filepath").option("-e, --env","Add environment variable"),lu.command("new <projectName>").description("Create a new Quire project in the current directory.").action(function(t){hu.verbose=lu.verbose,hu.emit("new",t)}),lu.command("preview [options]").description("Run the preview server in the current directory").action(function(){hu.verbose=lu.verbose,hu.emit("preview")}),lu.command("install").description("Install this project's theme dependencies").action(function(){hu.verbose=lu.verbose,hu.emit("install")}),lu.command("site [env]").option("-e, --env","Add environment variable").alias("build").description("Run the build command in the current directory").action(function(t){hu.verbose=lu.verbose,hu.emit("site",t)}),lu.command("pdf [file] [env]").option("-f, --file","Add Filename and optional new filepath").option("-e, --env","Add environment variable").description("Generate a PDF version of the current project").action(function(t,e){hu.verbose=lu.verbose,hu.emit("pdf",t,e)}),lu.command("epub [file] [env]").option("-f, --file","Add Filename and optional new filepath").option("-e, --env","Add environment variable").description("Generate an EPUB version of the current project").action(function(t,e){hu.verbose=lu.verbose,hu.emit("epub",t,e)}),lu.command("process").option("--iiif","Tile images for IIIF.").description("Run Quire processes.").action(function(e){var t=e.options.map(function(t){return t.long.replace("--","")}).find(function(t){return e[t]});if(!t)return console.error('"quire process" requires an option. Run "quire process --help" to list options.'),!1;hu.verbose=lu.verbose,hu.emit("process",t)}),lu.command("mobi [file] [env]").option("-f, --file","Add Filename and optional new filepath").option("-e, --env","Add environment variable").description("Generate an MOBI version of the current project").action(function(t,e){hu.verbose=lu.verbose,hu.emit("mobi",t,e)}),lu.command("template [type]").option("-t, --type","Select template to download (Currently only EPUB supported)").description("Download templates to customize your file output (Currently only EPUB supported)").action(function(t){hu.verbose=lu.verbose,hu.emit("template",t)}),lu.command("debug").description("Development use only - log info about current project").action(function(){hu.verbose=lu.verbose,hu.emit("debug")}),lu.on("command:*",function(){console.error("Invalid command: %s\n",lu.args.join(" ")),lu.help(),process.exit(1)}),lu.parse(process.argv),process.argv.slice(2).length||(lu.help(),process.exit(1)),t.commandMissing=W,t.copy=U,t.copyDirRecursive=function i(o,a,c){C.mkdirSync(a,{recursive:!0}),C.readdirSync(o).forEach(function(t){var e=M.join(o,t),n=M.join(a,t),r=c&&e.includes(c.join(",")),t=C.statSync(e).isFile();r||(t?C.copyFileSync(M.resolve(e),M.resolve(n)):i(e,n,c))})},t.deleteFolderRecursive=function n(r){C.existsSync(r)&&(C.readdirSync(r).forEach(function(t,e){t=r+"/"+t,C.statSync(t).isDirectory()?n(t):C.unlinkSync(t)}),C.rmdirSync(r))},t.determineBaseURL=z,t.isWin32=V,t.pluralize=H,t.readYAML=B,t.removeFile=G,t}({});
|