@pretextbook/import 0.2.0 → 0.4.0

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.
@@ -1,66 +0,0 @@
1
- "use strict";const Oe=require("@pretextbook/format"),Te=require("@pretextbook/latex-pretext"),Re=require("@pretextbook/remark-pretext"),ae=["\\documentclass","\\begin{document}","\\begin{","\\section","\\chapter","\\title","\\author"],oe=["# ","## ","### ","#### "];function Xt(d){const c=d.trim();return!c||c.startsWith("<")?"pretext":ae.some(e=>c.includes(e))?"latex":oe.some(e=>c.startsWith(e))?"markdown":"pretext"}const Pe=[{kind:"presentation",category:"latex_fonts",macros:["textrm","textit","textbf","textsc","texttt"]}],Vt={kind:"presentation",category:"tex_fonts",pairs:[{from:"rm",to:"textrm"},{from:"em",to:"emph"},{from:"it",to:"textit"},{from:"itshape",to:"textit"},{from:"bf",to:"textbf"},{from:"bfseries",to:"textbf"},{from:"sf",to:"textsf"},{from:"sffamily",to:"textss"},{from:"textsl",to:"testsl"}]},Fe=[{kind:"accessibility",category:"consistency",macros:["renewcommand"]}],Be=[{kind:"unused",category:"conditionals",macros:["if","fi","iffalse","then","else","loop","repeat"]},{kind:"presentation",category:"font_size",macros:["tiny","scriptsize","footnotesize","small","normalsize","large","Large","LARGE","huge","Huge","normalfont"]},{kind:"presentation",category:"spacing_vertical",macros:["smallskip","medskip","bigskip","vfil","vfill"]},{kind:"presentation",category:"archaic_tex",macros:["centerline","centering","noindent","par","linebreak"]},{kind:"mistake",category:"nonstructural",macros:["ensuremath"]},{kind:"archaic",category:"low_level_tex",macros:["relax","makeatletter","makeatother","csname","endcsname","shipout","noexpand","expandafter","clearpage"]},{kind:"archaic",category:"file_manipulation",macros:["newwrite","newread","immediate","write","write18","read","readline","readfile","openin","openout","jobname"]}],De=[{kind:"archaic",category:"low_level_tex",macros:["catcode","newtheorem","maketitle","setlength"]}],je=[{kind:"publisher",category:"zzzzz",macros:["theoremstyle","makeindex","allowdisplaybreaks","frontmatter","mainmatter","appendix","numberwithin","setcounter","tableofcontents","FloatBarrier"]}],Ne=[{kind:"archaic",category:"use_newcommand_only",macros:["def","let","edef","gdef","xdef","global","long"]}],Le=[{kind:"presentation",category:"spacing_horizontal",macros:[{name:"hspace",arity:1}]},{kind:"other",category:"other",macros:[{name:"date",arity:1}]},{kind:"accessibility",category:"colors",macros:[{name:"color",arity:1},{name:"textcolor",arity:1},{name:"mathcolor",arity:1},{name:"definecolor",arity:3}]}],$e=[{kind:"presentation",category:"nonstructural",environments:["center","minipage"]}];function Jt(d){return d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qt(d,c){let e=d;const f=[];for(const{from:a,to:n}of c.pairs){let r,i;c.category==="tex_fonts"?(r=`\\{ *\\\\${Jt(a)}\\b *`,i=`\\${n}{`):(r=`\\\\${Jt(a)}\\b *`,i=`\\${n}`);const l=new RegExp(r,"g"),p=e.match(l);p&&(f.push({action:"replace",severity:"info",kind:c.kind,category:c.category,macro:a,replacement:n,occurrences:p.length}),e=e.replace(l,i))}return{output:e,warnings:f}}function Ue(d){let c=d;const e=[],f=c.match(/\(\\ref\{([^{}]+)\}\)/g);f&&(e.push({action:"rewrite",severity:"info",kind:"presentation",category:"math_refs",macro:"(\\ref{...})",replacement:"\\eqref{...}",occurrences:f.length}),c=c.replace(/\(\\ref\{([^{}]+)\}\)/g,"\\eqref{$1}")),c=c.replace(/(\\vfil)l\b/g,"$1"),c=c.replace(/(\\vfil)(\s*\\vfil\b)+\b/g,"$1");const a=c.match(/(\\vfil)\b/g);return a&&(e.push({action:"rewrite",severity:"info",kind:"presentation",category:"spacing_vertical",macro:"vfil",replacement:"\\vspace{1in}",occurrences:a.length}),c=c.replace(/(\\vfil)\b/g,"\\vspace{1in}")),c=c.replace(/\\vskip\*? *([0-9]+|-) *([a-zA-Z]+).*/g,"\\vspace{$1$2}"),c=c.replace(/(\\vspace)\*? */g,"$1"),c=c.replace(/(\\vspace) *\{([0-9]+|-) *([a-zA-Z]+).*?\}/g,"$1{$2$3}"),{output:c,warnings:e}}function Me(d){const c=d.split("\\begin{document}");if(c.length<2)return{preamble:"",body:d,bibliography:""};const e=c[0];let f=c.slice(1).join("\\begin{document}"),a="";if(/\\begin\{thebibliography\}/.test(f)){const[n,...r]=f.split("\\begin{thebibliography}");f=n,a=r.join("\\begin{thebibliography}")}return{preamble:e,body:f,bibliography:a}}function ce(d){return d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function We(d,c,e){const f=ce(d);if(c==="hasarg"){let a=`\\\\${f}\\b\\*?`;for(let n=0;n<e;n+=1)a+="\\{[^{}]*\\}";return new RegExp(`(${a})`,"g")}return c==="line"?new RegExp(`(\\\\${f}\\b.*)`,"g"):new RegExp(`(\\\\${f}\\b)`,"g")}function ut(d,c,e,f){const{type:a="",action:n="mark",extra:r="",save:i=!1}=e;"macros"in c&&c.macros[0];let l=d;const p=c.macros;for(const w of p){const v=typeof w=="string"?w:w.name,x=typeof w=="string"?0:w.arity,u=We(v,a,x),_=l.match(u);!_||_.length===0||(i&&f.push({action:"save",severity:"warning",kind:c.kind,category:c.category,macro:v,occurrences:_.length,examples:_.slice(0,5),message:r||void 0}),n==="delete"?(f.push({action:"delete",severity:"info",kind:c.kind,category:c.category,macro:v,occurrences:_.length,message:r||void 0}),l=l.replace(u,"")):f.push({action:"anomaly",severity:"warning",kind:c.kind,category:c.category,macro:v,occurrences:_.length,message:r||void 0,examples:_.slice(0,5)}))}return l}function Ze(d,c,e){let f=d;for(const a of c.environments){const n=ce(a),r=new RegExp(`(\\\\(begin|end)\\{\\s*${n}\\})`,"g"),i=f.match(r);i&&i.length>0&&(e.push({action:"delete",severity:"info",kind:c.kind,category:c.category,macro:a,occurrences:i.length}),f=f.replace(r,""))}return f}function He(d){const c=[],e=Me(d);let{preamble:f,body:a}=e;const{bibliography:n}=e;for(const p of Be)f=ut(f,p,{action:"delete"},c),a=ut(a,p,{action:"delete"},c);for(const p of Fe)f=ut(f,p,{type:"line",action:"delete",extra:"in the preamble",save:!0},c),a=ut(a,p,{type:"line",action:"delete",extra:"in the main text",save:!0},c);for(const p of Ne)f=ut(f,p,{type:"line",action:"delete",extra:"in the preamble",save:!0},c),a=ut(a,p,{type:"line",action:"delete",extra:"in the main text",save:!0},c);for(const p of Le)f=ut(f,p,{type:"hasarg",action:"delete"},c),a=ut(a,p,{type:"hasarg",action:"delete"},c);for(const p of De)f=ut(f,p,{type:"line",action:"delete"},c),a=ut(a,p,{type:"line",action:"delete"},c);for(const p of je)f=ut(f,p,{type:"line",action:"delete",extra:"this is a publisher choice in PreTeXt"},c),a=ut(a,p,{type:"line",action:"delete",extra:"this is a publisher choice in PreTeXt"},c);for(const p of Pe)a=ut(a,p,{action:"mark"},c);for(const p of $e)a=Ze(a,p,c);const r=d.includes("\\begin{document}"),i=n.length>0;let l=f;return r?l+=`\\begin{document}
2
- `+a:l=a,i&&(l+=`\\begin{thebibliography}
3
- `+n),{output:l,warnings:c}}function Xe(d){let c=d;return c=c.replace(/\s+%.*/g,""),c=c.replace(/([^\\])%.*/g,"$1"),c=c.replace(/^%.*/,""),c}function Ke(d){return d.replace(/(.*\{)([^{}]+)(\}.*)/,(c,e,f,a)=>{const n=String(f).replace(/\s/g,"_").replace(/[^a-zA-Z0-9_]/g,"-");return`${e}${n}${a}`})}function Ge(d){let c=d;return c=c.replace(/> */g,"\\gt "),c=c.replace(/< */g,"\\lt "),c=c.replace(/(\\(ref|eqref|cref|Cref|label)\{([^{}]+)\})/g,Ke),c}function Ye(d){let c=d;return c=c.replace(/\\begin +/g,"\\begin"),c=c.replace(/\\chapter +/g,"\\chapter"),c=c.replace(/\\section +/g,"\\section"),c=c.replace(/\\section\*/g,"\\section"),c=Xe(c),c=Ge(c),c=c.replace(/\\end\{document\}.*/s,""),c=c.replace(/^\s+/,""),c=c.replace(/\n{3,}/g,`
4
-
5
- `),c}function Qt(d,c=0,e="{",f="}"){let a=d.trimStart();if(!a)return["",""];let n="",r="",i=c;if(i===0&&a[0]!==e)return["",a];for(i===0&&(r=e,i=1,a=a.substring(1));i>0&&a;){const l=a[0];l===e&&n!=="\\"?i+=1:l===f&&n!=="\\"&&(i-=1),r+=l,n==="\\"&&l==="\\"?n=`
6
- `:n=l,a=a.substring(1)}return i===0?[r,a]:["",r.substring(1)]}function le(d){const c=[];let e=Ye(d).replace(/(\n *){3,}/g,`
7
-
8
- `);const f=Ue(e);e=f.output,c.push(...f.warnings);const a=qt(e,Vt);e=a.output,c.push(...a.warnings);const n=qt(e,Vt);e=n.output,c.push(...n.warnings);const r=He(e);return e=r.output.replace(/(\n *){3,}/g,`
9
-
10
- `),c.push(...r.warnings),{output:e,warnings:c}}function Ve(d){const c="\\begin{document}",e="\\end{document}",f=d.indexOf(c);if(f===-1)return{preamble:"",body:d};const a=d.slice(0,f).trim(),n=d.slice(f+c.length),r=n.indexOf(e),i=(r===-1?n:n.slice(0,r)).trim();return{preamble:a,body:i}}function te(d,c){const f=new RegExp(`\\\\${c}(?![a-zA-Z])`).exec(d);if(!f)return"";let a=d.slice(f.index+f[0].length).trimStart();if(a.startsWith("[")){const[r,i]=Qt(a,0,"[","]");r&&(a=i.trimStart())}const[n]=Qt(a);return n?n.slice(1,-1).trim():""}const Je=/^[ \t]*(\\(?:new|renew|provide)command\*?|\\DeclareMathOperator\*?|\\newenvironment\*?)\b/;function ee(d){let c=0;for(let e=0;e<d.length;e++){if(d[e]==="\\"){e++;continue}d[e]==="{"?c++:d[e]==="}"&&c--}return c}function qe(d){const c=d.split(`
11
- `),e=[];let f=0;for(;f<c.length;){if(!Je.test(c[f])){f++;continue}let a=c[f],n=ee(c[f]);for(f++;n>0&&f<c.length;)a+=`
12
- `+c[f],n+=ee(c[f]),f++;e.push(a.trim())}return e.join(`
13
- `)}function Qe(d){const c=/\\documentclass(?:\[[^\]]*\])?\{([^}]+)\}/.exec(d);return c?c[1].trim():"article"}function tr(d){const c=d.replace(/(^|[^\\])%[^\n]*/gm,"$1");return{documentClass:Qe(c),title:te(c,"title"),author:te(c,"author"),macros:qe(c)}}function er(d){if(typeof d=="string")return d;if(typeof d=="object"&&d!==null&&"value"in d){const c=d.value;if(typeof c=="string")return c;if(c!=null)return String(c)}return String(d)}function ue(d){return d.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function fe(d){return d.replace(/\\LaTeX\b/g,"LaTeX").replace(/\\TeX\b/g,"TeX").replace(/\\thanks\{[^{}]*(?:\{[^{}]*\}[^{}]*)?\}/g,"").replace(/\\inst\{[^{}]*\}/g,"").replace(/\\email\{[^{}]*\}/g,"").replace(/\\[a-zA-Z]+\{([^{}]*)\}/g,"$1").replace(/\\\s/g," ").replace(/~/g," ").replace(/\s+/g," ").trim()}function rr(d){const c=[];if(d.macros){const e=d.macros.split(`
14
- `).map(f=>` ${f}`).join(`
15
- `);c.push(` <macros>
16
- ${e}
17
- </macros>`)}if(d.author){const e=d.author.split(/\s+\\and\s+/)[0].trim(),f=ue(fe(e));f&&c.push(` <author>
18
- <personname>${f}</personname>
19
- </author>`)}return c.length===0?"":`<docinfo>
20
- ${c.join(`
21
- `)}
22
- </docinfo>`}function nr(d,c){const e=d.replace(/^\s*<p\s*\/>\s*/g,"").replace(/^\s*<p>\s*<\/p>\s*/g,"").trim();if(!e)return"";const a=/<chapter[\s>]/.test(e)?"book":"article",n=rr(c),r=c.title?` <title>${ue(fe(c.title))}</title>
23
- `:"",i=`<${a}>
24
- ${r}${e}
25
- </${a}>`;return`<pretext>
26
- ${[n,i].filter(Boolean).join(`
27
- `)}
28
- </pretext>`}function Ot(d){const c=d.trim();return c?Oe.formatPretext(c):""}function he(d){const c=d.trim();if(!c)return{pretext:"",cleanedLatex:"",warnings:[]};const{preamble:e,body:f}=Ve(c),a=tr(e),n=f?[`\\documentclass{${a.documentClass}}`,a.macros,"\\begin{document}",f,"\\end{document}"].filter(Boolean).join(`
29
- `):c,{output:r,warnings:i}=le(n);if(!r.trim())return{pretext:"",cleanedLatex:r,warnings:i};const l=f?r+`
30
- \\end{document}`:r,p=er(Te.latexToPretext(l)).trim();if(!p)return{pretext:"",cleanedLatex:r,warnings:i};const w=nr(p,a);return{pretext:w?Ot(w):"",cleanedLatex:r,warnings:i}}function de(d){const c=d.trim();if(!c)return{pretext:"",cleanedMarkdown:""};const e=String(Re.markdownToPretext(c)).trim();return{pretext:e?Ot(e):"",cleanedMarkdown:c}}function pe(d){return d instanceof Error&&d.message.trim()?d.message.trim():"Could not convert source content to PreTeXt."}function me(d,c){const e=Xt(d),f=c??e;try{if(f==="pretext")return{sourceFormat:f,detectedSourceFormat:e,pretextSource:Ot(d),warnings:[]};if(f==="markdown"){const{pretext:i,cleanedMarkdown:l}=de(d);return{sourceFormat:f,detectedSourceFormat:e,pretextSource:i,cleanedNativeSource:l,warnings:[]}}const{pretext:a,cleanedLatex:n,warnings:r}=he(d);return{sourceFormat:f,detectedSourceFormat:e,pretextSource:a,cleanedNativeSource:n,warnings:r}}catch(a){return{sourceFormat:f,detectedSourceFormat:e,pretextError:pe(a),warnings:[]}}}var zt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ir(d){return d&&d.__esModule&&Object.prototype.hasOwnProperty.call(d,"default")?d.default:d}function At(d){throw new Error('Could not dynamically require "'+d+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Rt={exports:{}};var re;function sr(){return re||(re=1,(function(d,c){(function(e){d.exports=e()})(function(){return(function e(f,a,n){function r(p,w){if(!a[p]){if(!f[p]){var v=typeof At=="function"&&At;if(!w&&v)return v(p,!0);if(i)return i(p,!0);var x=new Error("Cannot find module '"+p+"'");throw x.code="MODULE_NOT_FOUND",x}var u=a[p]={exports:{}};f[p][0].call(u.exports,function(_){var o=f[p][1][_];return r(o||_)},u,u.exports,e,f,a,n)}return a[p].exports}for(var i=typeof At=="function"&&At,l=0;l<n.length;l++)r(n[l]);return r})({1:[function(e,f,a){var n=e("./utils"),r=e("./support"),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";a.encode=function(l){for(var p,w,v,x,u,_,o,g=[],h=0,b=l.length,S=b,E=n.getTypeOf(l)!=="string";h<l.length;)S=b-h,v=E?(p=l[h++],w=h<b?l[h++]:0,h<b?l[h++]:0):(p=l.charCodeAt(h++),w=h<b?l.charCodeAt(h++):0,h<b?l.charCodeAt(h++):0),x=p>>2,u=(3&p)<<4|w>>4,_=1<S?(15&w)<<2|v>>6:64,o=2<S?63&v:64,g.push(i.charAt(x)+i.charAt(u)+i.charAt(_)+i.charAt(o));return g.join("")},a.decode=function(l){var p,w,v,x,u,_,o=0,g=0,h="data:";if(l.substr(0,h.length)===h)throw new Error("Invalid base64 input, it looks like a data url.");var b,S=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===i.charAt(64)&&S--,l.charAt(l.length-2)===i.charAt(64)&&S--,S%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=r.uint8array?new Uint8Array(0|S):new Array(0|S);o<l.length;)p=i.indexOf(l.charAt(o++))<<2|(x=i.indexOf(l.charAt(o++)))>>4,w=(15&x)<<4|(u=i.indexOf(l.charAt(o++)))>>2,v=(3&u)<<6|(_=i.indexOf(l.charAt(o++))),b[g++]=p,u!==64&&(b[g++]=w),_!==64&&(b[g++]=v);return b}},{"./support":30,"./utils":32}],2:[function(e,f,a){var n=e("./external"),r=e("./stream/DataWorker"),i=e("./stream/Crc32Probe"),l=e("./stream/DataLengthProbe");function p(w,v,x,u,_){this.compressedSize=w,this.uncompressedSize=v,this.crc32=x,this.compression=u,this.compressedContent=_}p.prototype={getContentWorker:function(){var w=new r(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),v=this;return w.on("end",function(){if(this.streamInfo.data_length!==v.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),w},getCompressedWorker:function(){return new r(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},p.createWorkerFrom=function(w,v,x){return w.pipe(new i).pipe(new l("uncompressedSize")).pipe(v.compressWorker(x)).pipe(new l("compressedSize")).withStreamInfo("compression",v)},f.exports=p},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,f,a){var n=e("./stream/GenericWorker");a.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},a.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,f,a){var n=e("./utils"),r=(function(){for(var i,l=[],p=0;p<256;p++){i=p;for(var w=0;w<8;w++)i=1&i?3988292384^i>>>1:i>>>1;l[p]=i}return l})();f.exports=function(i,l){return i!==void 0&&i.length?n.getTypeOf(i)!=="string"?(function(p,w,v,x){var u=r,_=x+v;p^=-1;for(var o=x;o<_;o++)p=p>>>8^u[255&(p^w[o])];return-1^p})(0|l,i,i.length,0):(function(p,w,v,x){var u=r,_=x+v;p^=-1;for(var o=x;o<_;o++)p=p>>>8^u[255&(p^w.charCodeAt(o))];return-1^p})(0|l,i,i.length,0):0}},{"./utils":32}],5:[function(e,f,a){a.base64=!1,a.binary=!1,a.dir=!1,a.createFolders=!0,a.date=null,a.compression=null,a.compressionOptions=null,a.comment=null,a.unixPermissions=null,a.dosPermissions=null},{}],6:[function(e,f,a){var n=null;n=typeof Promise<"u"?Promise:e("lie"),f.exports={Promise:n}},{lie:37}],7:[function(e,f,a){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",r=e("pako"),i=e("./utils"),l=e("./stream/GenericWorker"),p=n?"uint8array":"array";function w(v,x){l.call(this,"FlateWorker/"+v),this._pako=null,this._pakoAction=v,this._pakoOptions=x,this.meta={}}a.magic="\b\0",i.inherits(w,l),w.prototype.processChunk=function(v){this.meta=v.meta,this._pako===null&&this._createPako(),this._pako.push(i.transformTo(p,v.data),!1)},w.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},w.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},w.prototype._createPako=function(){this._pako=new r[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var v=this;this._pako.onData=function(x){v.push({data:x,meta:v.meta})}},a.compressWorker=function(v){return new w("Deflate",v)},a.uncompressWorker=function(){return new w("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,f,a){function n(u,_){var o,g="";for(o=0;o<_;o++)g+=String.fromCharCode(255&u),u>>>=8;return g}function r(u,_,o,g,h,b){var S,E,z=u.file,R=u.compression,P=b!==p.utf8encode,$=i.transformTo("string",b(z.name)),F=i.transformTo("string",p.utf8encode(z.name)),M=z.comment,Y=i.transformTo("string",b(M)),k=i.transformTo("string",p.utf8encode(M)),B=F.length!==z.name.length,s=k.length!==M.length,j="",Q="",U="",tt=z.dir,W=z.date,q={crc32:0,compressedSize:0,uncompressedSize:0};_&&!o||(q.crc32=u.crc32,q.compressedSize=u.compressedSize,q.uncompressedSize=u.uncompressedSize);var O=0;_&&(O|=8),P||!B&&!s||(O|=2048);var I=0,J=0;tt&&(I|=16),h==="UNIX"?(J=798,I|=(function(X,st){var lt=X;return X||(lt=st?16893:33204),(65535&lt)<<16})(z.unixPermissions,tt)):(J=20,I|=(function(X){return 63&(X||0)})(z.dosPermissions)),S=W.getUTCHours(),S<<=6,S|=W.getUTCMinutes(),S<<=5,S|=W.getUTCSeconds()/2,E=W.getUTCFullYear()-1980,E<<=4,E|=W.getUTCMonth()+1,E<<=5,E|=W.getUTCDate(),B&&(Q=n(1,1)+n(w($),4)+F,j+="up"+n(Q.length,2)+Q),s&&(U=n(1,1)+n(w(Y),4)+k,j+="uc"+n(U.length,2)+U);var K="";return K+=`
31
- \0`,K+=n(O,2),K+=R.magic,K+=n(S,2),K+=n(E,2),K+=n(q.crc32,4),K+=n(q.compressedSize,4),K+=n(q.uncompressedSize,4),K+=n($.length,2),K+=n(j.length,2),{fileRecord:v.LOCAL_FILE_HEADER+K+$+j,dirRecord:v.CENTRAL_FILE_HEADER+n(J,2)+K+n(Y.length,2)+"\0\0\0\0"+n(I,4)+n(g,4)+$+j+Y}}var i=e("../utils"),l=e("../stream/GenericWorker"),p=e("../utf8"),w=e("../crc32"),v=e("../signature");function x(u,_,o,g){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=_,this.zipPlatform=o,this.encodeFileName=g,this.streamFiles=u,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}i.inherits(x,l),x.prototype.push=function(u){var _=u.meta.percent||0,o=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(u):(this.bytesWritten+=u.data.length,l.prototype.push.call(this,{data:u.data,meta:{currentFile:this.currentFile,percent:o?(_+100*(o-g-1))/o:100}}))},x.prototype.openedSource=function(u){this.currentSourceOffset=this.bytesWritten,this.currentFile=u.file.name;var _=this.streamFiles&&!u.file.dir;if(_){var o=r(u,_,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:o.fileRecord,meta:{percent:0}})}else this.accumulate=!0},x.prototype.closedSource=function(u){this.accumulate=!1;var _=this.streamFiles&&!u.file.dir,o=r(u,_,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(o.dirRecord),_)this.push({data:(function(g){return v.DATA_DESCRIPTOR+n(g.crc32,4)+n(g.compressedSize,4)+n(g.uncompressedSize,4)})(u),meta:{percent:100}});else for(this.push({data:o.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},x.prototype.flush=function(){for(var u=this.bytesWritten,_=0;_<this.dirRecords.length;_++)this.push({data:this.dirRecords[_],meta:{percent:100}});var o=this.bytesWritten-u,g=(function(h,b,S,E,z){var R=i.transformTo("string",z(E));return v.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(h,2)+n(h,2)+n(b,4)+n(S,4)+n(R.length,2)+R})(this.dirRecords.length,o,u,this.zipComment,this.encodeFileName);this.push({data:g,meta:{percent:100}})},x.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},x.prototype.registerPrevious=function(u){this._sources.push(u);var _=this;return u.on("data",function(o){_.processChunk(o)}),u.on("end",function(){_.closedSource(_.previous.streamInfo),_._sources.length?_.prepareNextSource():_.end()}),u.on("error",function(o){_.error(o)}),this},x.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},x.prototype.error=function(u){var _=this._sources;if(!l.prototype.error.call(this,u))return!1;for(var o=0;o<_.length;o++)try{_[o].error(u)}catch{}return!0},x.prototype.lock=function(){l.prototype.lock.call(this);for(var u=this._sources,_=0;_<u.length;_++)u[_].lock()},f.exports=x},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,f,a){var n=e("../compressions"),r=e("./ZipFileWorker");a.generateWorker=function(i,l,p){var w=new r(l.streamFiles,p,l.platform,l.encodeFileName),v=0;try{i.forEach(function(x,u){v++;var _=(function(b,S){var E=b||S,z=n[E];if(!z)throw new Error(E+" is not a valid compression method !");return z})(u.options.compression,l.compression),o=u.options.compressionOptions||l.compressionOptions||{},g=u.dir,h=u.date;u._compressWorker(_,o).withStreamInfo("file",{name:x,dir:g,date:h,comment:u.comment||"",unixPermissions:u.unixPermissions,dosPermissions:u.dosPermissions}).pipe(w)}),w.entriesCount=v}catch(x){w.error(x)}return w}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,f,a){function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var r=new n;for(var i in this)typeof this[i]!="function"&&(r[i]=this[i]);return r}}(n.prototype=e("./object")).loadAsync=e("./load"),n.support=e("./support"),n.defaults=e("./defaults"),n.version="3.10.1",n.loadAsync=function(r,i){return new n().loadAsync(r,i)},n.external=e("./external"),f.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,f,a){var n=e("./utils"),r=e("./external"),i=e("./utf8"),l=e("./zipEntries"),p=e("./stream/Crc32Probe"),w=e("./nodejsUtils");function v(x){return new r.Promise(function(u,_){var o=x.decompressed.getContentWorker().pipe(new p);o.on("error",function(g){_(g)}).on("end",function(){o.streamInfo.crc32!==x.decompressed.crc32?_(new Error("Corrupted zip : CRC32 mismatch")):u()}).resume()})}f.exports=function(x,u){var _=this;return u=n.extend(u||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:i.utf8decode}),w.isNode&&w.isStream(x)?r.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",x,!0,u.optimizedBinaryString,u.base64).then(function(o){var g=new l(u);return g.load(o),g}).then(function(o){var g=[r.Promise.resolve(o)],h=o.files;if(u.checkCRC32)for(var b=0;b<h.length;b++)g.push(v(h[b]));return r.Promise.all(g)}).then(function(o){for(var g=o.shift(),h=g.files,b=0;b<h.length;b++){var S=h[b],E=S.fileNameStr,z=n.resolve(S.fileNameStr);_.file(z,S.decompressed,{binary:!0,optimizedBinaryString:!0,date:S.date,dir:S.dir,comment:S.fileCommentStr.length?S.fileCommentStr:null,unixPermissions:S.unixPermissions,dosPermissions:S.dosPermissions,createFolders:u.createFolders}),S.dir||(_.file(z).unsafeOriginalName=E)}return g.zipComment.length&&(_.comment=g.zipComment),_})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,f,a){var n=e("../utils"),r=e("../stream/GenericWorker");function i(l,p){r.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(p)}n.inherits(i,r),i.prototype._bindStream=function(l){var p=this;(this._stream=l).pause(),l.on("data",function(w){p.push({data:w,meta:{percent:0}})}).on("error",function(w){p.isPaused?this.generatedError=w:p.error(w)}).on("end",function(){p.isPaused?p._upstreamEnded=!0:p.end()})},i.prototype.pause=function(){return!!r.prototype.pause.call(this)&&(this._stream.pause(),!0)},i.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},f.exports=i},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,f,a){var n=e("readable-stream").Readable;function r(i,l,p){n.call(this,l),this._helper=i;var w=this;i.on("data",function(v,x){w.push(v)||w._helper.pause(),p&&p(x)}).on("error",function(v){w.emit("error",v)}).on("end",function(){w.push(null)})}e("../utils").inherits(r,n),r.prototype._read=function(){this._helper.resume()},f.exports=r},{"../utils":32,"readable-stream":16}],14:[function(e,f,a){f.exports={isNode:typeof Buffer<"u",newBufferFrom:function(n,r){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(n,r);if(typeof n=="number")throw new Error('The "data" argument must not be a number');return new Buffer(n,r)},allocBuffer:function(n){if(Buffer.alloc)return Buffer.alloc(n);var r=new Buffer(n);return r.fill(0),r},isBuffer:function(n){return Buffer.isBuffer(n)},isStream:function(n){return n&&typeof n.on=="function"&&typeof n.pause=="function"&&typeof n.resume=="function"}}},{}],15:[function(e,f,a){function n(z,R,P){var $,F=i.getTypeOf(R),M=i.extend(P||{},w);M.date=M.date||new Date,M.compression!==null&&(M.compression=M.compression.toUpperCase()),typeof M.unixPermissions=="string"&&(M.unixPermissions=parseInt(M.unixPermissions,8)),M.unixPermissions&&16384&M.unixPermissions&&(M.dir=!0),M.dosPermissions&&16&M.dosPermissions&&(M.dir=!0),M.dir&&(z=h(z)),M.createFolders&&($=g(z))&&b.call(this,$,!0);var Y=F==="string"&&M.binary===!1&&M.base64===!1;P&&P.binary!==void 0||(M.binary=!Y),(R instanceof v&&R.uncompressedSize===0||M.dir||!R||R.length===0)&&(M.base64=!1,M.binary=!0,R="",M.compression="STORE",F="string");var k=null;k=R instanceof v||R instanceof l?R:_.isNode&&_.isStream(R)?new o(z,R):i.prepareContent(z,R,M.binary,M.optimizedBinaryString,M.base64);var B=new x(z,k,M);this.files[z]=B}var r=e("./utf8"),i=e("./utils"),l=e("./stream/GenericWorker"),p=e("./stream/StreamHelper"),w=e("./defaults"),v=e("./compressedObject"),x=e("./zipObject"),u=e("./generate"),_=e("./nodejsUtils"),o=e("./nodejs/NodejsStreamInputAdapter"),g=function(z){z.slice(-1)==="/"&&(z=z.substring(0,z.length-1));var R=z.lastIndexOf("/");return 0<R?z.substring(0,R):""},h=function(z){return z.slice(-1)!=="/"&&(z+="/"),z},b=function(z,R){return R=R!==void 0?R:w.createFolders,z=h(z),this.files[z]||n.call(this,z,null,{dir:!0,createFolders:R}),this.files[z]};function S(z){return Object.prototype.toString.call(z)==="[object RegExp]"}var E={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(z){var R,P,$;for(R in this.files)$=this.files[R],(P=R.slice(this.root.length,R.length))&&R.slice(0,this.root.length)===this.root&&z(P,$)},filter:function(z){var R=[];return this.forEach(function(P,$){z(P,$)&&R.push($)}),R},file:function(z,R,P){if(arguments.length!==1)return z=this.root+z,n.call(this,z,R,P),this;if(S(z)){var $=z;return this.filter(function(M,Y){return!Y.dir&&$.test(M)})}var F=this.files[this.root+z];return F&&!F.dir?F:null},folder:function(z){if(!z)return this;if(S(z))return this.filter(function(F,M){return M.dir&&z.test(F)});var R=this.root+z,P=b.call(this,R),$=this.clone();return $.root=P.name,$},remove:function(z){z=this.root+z;var R=this.files[z];if(R||(z.slice(-1)!=="/"&&(z+="/"),R=this.files[z]),R&&!R.dir)delete this.files[z];else for(var P=this.filter(function(F,M){return M.name.slice(0,z.length)===z}),$=0;$<P.length;$++)delete this.files[P[$].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(z){var R,P={};try{if((P=i.extend(z||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:r.utf8encode})).type=P.type.toLowerCase(),P.compression=P.compression.toUpperCase(),P.type==="binarystring"&&(P.type="string"),!P.type)throw new Error("No output type specified.");i.checkSupport(P.type),P.platform!=="darwin"&&P.platform!=="freebsd"&&P.platform!=="linux"&&P.platform!=="sunos"||(P.platform="UNIX"),P.platform==="win32"&&(P.platform="DOS");var $=P.comment||this.comment||"";R=u.generateWorker(this,P,$)}catch(F){(R=new l("error")).error(F)}return new p(R,P.type||"string",P.mimeType)},generateAsync:function(z,R){return this.generateInternalStream(z).accumulate(R)},generateNodeStream:function(z,R){return(z=z||{}).type||(z.type="nodebuffer"),this.generateInternalStream(z).toNodejsStream(R)}};f.exports=E},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,f,a){f.exports=e("stream")},{stream:void 0}],17:[function(e,f,a){var n=e("./DataReader");function r(i){n.call(this,i);for(var l=0;l<this.data.length;l++)i[l]=255&i[l]}e("../utils").inherits(r,n),r.prototype.byteAt=function(i){return this.data[this.zero+i]},r.prototype.lastIndexOfSignature=function(i){for(var l=i.charCodeAt(0),p=i.charCodeAt(1),w=i.charCodeAt(2),v=i.charCodeAt(3),x=this.length-4;0<=x;--x)if(this.data[x]===l&&this.data[x+1]===p&&this.data[x+2]===w&&this.data[x+3]===v)return x-this.zero;return-1},r.prototype.readAndCheckSignature=function(i){var l=i.charCodeAt(0),p=i.charCodeAt(1),w=i.charCodeAt(2),v=i.charCodeAt(3),x=this.readData(4);return l===x[0]&&p===x[1]&&w===x[2]&&v===x[3]},r.prototype.readData=function(i){if(this.checkOffset(i),i===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,l},f.exports=r},{"../utils":32,"./DataReader":18}],18:[function(e,f,a){var n=e("../utils");function r(i){this.data=i,this.length=i.length,this.index=0,this.zero=0}r.prototype={checkOffset:function(i){this.checkIndex(this.index+i)},checkIndex:function(i){if(this.length<this.zero+i||i<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+i+"). Corrupted zip ?")},setIndex:function(i){this.checkIndex(i),this.index=i},skip:function(i){this.setIndex(this.index+i)},byteAt:function(){},readInt:function(i){var l,p=0;for(this.checkOffset(i),l=this.index+i-1;l>=this.index;l--)p=(p<<8)+this.byteAt(l);return this.index+=i,p},readString:function(i){return n.transformTo("string",this.readData(i))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var i=this.readInt(4);return new Date(Date.UTC(1980+(i>>25&127),(i>>21&15)-1,i>>16&31,i>>11&31,i>>5&63,(31&i)<<1))}},f.exports=r},{"../utils":32}],19:[function(e,f,a){var n=e("./Uint8ArrayReader");function r(i){n.call(this,i)}e("../utils").inherits(r,n),r.prototype.readData=function(i){this.checkOffset(i);var l=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,l},f.exports=r},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,f,a){var n=e("./DataReader");function r(i){n.call(this,i)}e("../utils").inherits(r,n),r.prototype.byteAt=function(i){return this.data.charCodeAt(this.zero+i)},r.prototype.lastIndexOfSignature=function(i){return this.data.lastIndexOf(i)-this.zero},r.prototype.readAndCheckSignature=function(i){return i===this.readData(4)},r.prototype.readData=function(i){this.checkOffset(i);var l=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,l},f.exports=r},{"../utils":32,"./DataReader":18}],21:[function(e,f,a){var n=e("./ArrayReader");function r(i){n.call(this,i)}e("../utils").inherits(r,n),r.prototype.readData=function(i){if(this.checkOffset(i),i===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+i);return this.index+=i,l},f.exports=r},{"../utils":32,"./ArrayReader":17}],22:[function(e,f,a){var n=e("../utils"),r=e("../support"),i=e("./ArrayReader"),l=e("./StringReader"),p=e("./NodeBufferReader"),w=e("./Uint8ArrayReader");f.exports=function(v){var x=n.getTypeOf(v);return n.checkSupport(x),x!=="string"||r.uint8array?x==="nodebuffer"?new p(v):r.uint8array?new w(n.transformTo("uint8array",v)):new i(n.transformTo("array",v)):new l(v)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,f,a){a.LOCAL_FILE_HEADER="PK",a.CENTRAL_FILE_HEADER="PK",a.CENTRAL_DIRECTORY_END="PK",a.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",a.ZIP64_CENTRAL_DIRECTORY_END="PK",a.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,f,a){var n=e("./GenericWorker"),r=e("../utils");function i(l){n.call(this,"ConvertWorker to "+l),this.destType=l}r.inherits(i,n),i.prototype.processChunk=function(l){this.push({data:r.transformTo(this.destType,l.data),meta:l.meta})},f.exports=i},{"../utils":32,"./GenericWorker":28}],25:[function(e,f,a){var n=e("./GenericWorker"),r=e("../crc32");function i(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(i,n),i.prototype.processChunk=function(l){this.streamInfo.crc32=r(l.data,this.streamInfo.crc32||0),this.push(l)},f.exports=i},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,f,a){var n=e("../utils"),r=e("./GenericWorker");function i(l){r.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}n.inherits(i,r),i.prototype.processChunk=function(l){if(l){var p=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=p+l.data.length}r.prototype.processChunk.call(this,l)},f.exports=i},{"../utils":32,"./GenericWorker":28}],27:[function(e,f,a){var n=e("../utils"),r=e("./GenericWorker");function i(l){r.call(this,"DataWorker");var p=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(w){p.dataIsReady=!0,p.data=w,p.max=w&&w.length||0,p.type=n.getTypeOf(w),p.isPaused||p._tickAndRepeat()},function(w){p.error(w)})}n.inherits(i,r),i.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},i.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},i.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},i.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,p=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,p);break;case"uint8array":l=this.data.subarray(this.index,p);break;case"array":case"nodebuffer":l=this.data.slice(this.index,p)}return this.index=p,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},f.exports=i},{"../utils":32,"./GenericWorker":28}],28:[function(e,f,a){function n(r){this.name=r||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(r){this.emit("data",r)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(r){this.emit("error",r)}return!0},error:function(r){return!this.isFinished&&(this.isPaused?this.generatedError=r:(this.isFinished=!0,this.emit("error",r),this.previous&&this.previous.error(r),this.cleanUp()),!0)},on:function(r,i){return this._listeners[r].push(i),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(r,i){if(this._listeners[r])for(var l=0;l<this._listeners[r].length;l++)this._listeners[r][l].call(this,i)},pipe:function(r){return r.registerPrevious(this)},registerPrevious:function(r){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=r.streamInfo,this.mergeStreamInfo(),this.previous=r;var i=this;return r.on("data",function(l){i.processChunk(l)}),r.on("end",function(){i.end()}),r.on("error",function(l){i.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var r=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),r=!0),this.previous&&this.previous.resume(),!r},flush:function(){},processChunk:function(r){this.push(r)},withStreamInfo:function(r,i){return this.extraStreamInfo[r]=i,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var r in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,r)&&(this.streamInfo[r]=this.extraStreamInfo[r])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var r="Worker "+this.name;return this.previous?this.previous+" -> "+r:r}},f.exports=n},{}],29:[function(e,f,a){var n=e("../utils"),r=e("./ConvertWorker"),i=e("./GenericWorker"),l=e("../base64"),p=e("../support"),w=e("../external"),v=null;if(p.nodestream)try{v=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function x(_,o){return new w.Promise(function(g,h){var b=[],S=_._internalType,E=_._outputType,z=_._mimeType;_.on("data",function(R,P){b.push(R),o&&o(P)}).on("error",function(R){b=[],h(R)}).on("end",function(){try{var R=(function(P,$,F){switch(P){case"blob":return n.newBlob(n.transformTo("arraybuffer",$),F);case"base64":return l.encode($);default:return n.transformTo(P,$)}})(E,(function(P,$){var F,M=0,Y=null,k=0;for(F=0;F<$.length;F++)k+=$[F].length;switch(P){case"string":return $.join("");case"array":return Array.prototype.concat.apply([],$);case"uint8array":for(Y=new Uint8Array(k),F=0;F<$.length;F++)Y.set($[F],M),M+=$[F].length;return Y;case"nodebuffer":return Buffer.concat($);default:throw new Error("concat : unsupported type '"+P+"'")}})(S,b),z);g(R)}catch(P){h(P)}b=[]}).resume()})}function u(_,o,g){var h=o;switch(o){case"blob":case"arraybuffer":h="uint8array";break;case"base64":h="string"}try{this._internalType=h,this._outputType=o,this._mimeType=g,n.checkSupport(h),this._worker=_.pipe(new r(h)),_.lock()}catch(b){this._worker=new i("error"),this._worker.error(b)}}u.prototype={accumulate:function(_){return x(this,_)},on:function(_,o){var g=this;return _==="data"?this._worker.on(_,function(h){o.call(g,h.data,h.meta)}):this._worker.on(_,function(){n.delay(o,arguments,g)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(_){if(n.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new v(this,{objectMode:this._outputType!=="nodebuffer"},_)}},f.exports=u},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,f,a){if(a.base64=!0,a.array=!0,a.string=!0,a.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",a.nodebuffer=typeof Buffer<"u",a.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")a.blob=!1;else{var n=new ArrayBuffer(0);try{a.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);r.append(n),a.blob=r.getBlob("application/zip").size===0}catch{a.blob=!1}}}try{a.nodestream=!!e("readable-stream").Readable}catch{a.nodestream=!1}},{"readable-stream":16}],31:[function(e,f,a){for(var n=e("./utils"),r=e("./support"),i=e("./nodejsUtils"),l=e("./stream/GenericWorker"),p=new Array(256),w=0;w<256;w++)p[w]=252<=w?6:248<=w?5:240<=w?4:224<=w?3:192<=w?2:1;p[254]=p[254]=1;function v(){l.call(this,"utf-8 decode"),this.leftOver=null}function x(){l.call(this,"utf-8 encode")}a.utf8encode=function(u){return r.nodebuffer?i.newBufferFrom(u,"utf-8"):(function(_){var o,g,h,b,S,E=_.length,z=0;for(b=0;b<E;b++)(64512&(g=_.charCodeAt(b)))==55296&&b+1<E&&(64512&(h=_.charCodeAt(b+1)))==56320&&(g=65536+(g-55296<<10)+(h-56320),b++),z+=g<128?1:g<2048?2:g<65536?3:4;for(o=r.uint8array?new Uint8Array(z):new Array(z),b=S=0;S<z;b++)(64512&(g=_.charCodeAt(b)))==55296&&b+1<E&&(64512&(h=_.charCodeAt(b+1)))==56320&&(g=65536+(g-55296<<10)+(h-56320),b++),g<128?o[S++]=g:(g<2048?o[S++]=192|g>>>6:(g<65536?o[S++]=224|g>>>12:(o[S++]=240|g>>>18,o[S++]=128|g>>>12&63),o[S++]=128|g>>>6&63),o[S++]=128|63&g);return o})(u)},a.utf8decode=function(u){return r.nodebuffer?n.transformTo("nodebuffer",u).toString("utf-8"):(function(_){var o,g,h,b,S=_.length,E=new Array(2*S);for(o=g=0;o<S;)if((h=_[o++])<128)E[g++]=h;else if(4<(b=p[h]))E[g++]=65533,o+=b-1;else{for(h&=b===2?31:b===3?15:7;1<b&&o<S;)h=h<<6|63&_[o++],b--;1<b?E[g++]=65533:h<65536?E[g++]=h:(h-=65536,E[g++]=55296|h>>10&1023,E[g++]=56320|1023&h)}return E.length!==g&&(E.subarray?E=E.subarray(0,g):E.length=g),n.applyFromCharCode(E)})(u=n.transformTo(r.uint8array?"uint8array":"array",u))},n.inherits(v,l),v.prototype.processChunk=function(u){var _=n.transformTo(r.uint8array?"uint8array":"array",u.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var o=_;(_=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),_.set(o,this.leftOver.length)}else _=this.leftOver.concat(_);this.leftOver=null}var g=(function(b,S){var E;for((S=S||b.length)>b.length&&(S=b.length),E=S-1;0<=E&&(192&b[E])==128;)E--;return E<0||E===0?S:E+p[b[E]]>S?E:S})(_),h=_;g!==_.length&&(r.uint8array?(h=_.subarray(0,g),this.leftOver=_.subarray(g,_.length)):(h=_.slice(0,g),this.leftOver=_.slice(g,_.length))),this.push({data:a.utf8decode(h),meta:u.meta})},v.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:a.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},a.Utf8DecodeWorker=v,n.inherits(x,l),x.prototype.processChunk=function(u){this.push({data:a.utf8encode(u.data),meta:u.meta})},a.Utf8EncodeWorker=x},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,f,a){var n=e("./support"),r=e("./base64"),i=e("./nodejsUtils"),l=e("./external");function p(o){return o}function w(o,g){for(var h=0;h<o.length;++h)g[h]=255&o.charCodeAt(h);return g}e("setimmediate"),a.newBlob=function(o,g){a.checkSupport("blob");try{return new Blob([o],{type:g})}catch{try{var h=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return h.append(o),h.getBlob(g)}catch{throw new Error("Bug : can't construct the Blob.")}}};var v={stringifyByChunk:function(o,g,h){var b=[],S=0,E=o.length;if(E<=h)return String.fromCharCode.apply(null,o);for(;S<E;)g==="array"||g==="nodebuffer"?b.push(String.fromCharCode.apply(null,o.slice(S,Math.min(S+h,E)))):b.push(String.fromCharCode.apply(null,o.subarray(S,Math.min(S+h,E)))),S+=h;return b.join("")},stringifyByChar:function(o){for(var g="",h=0;h<o.length;h++)g+=String.fromCharCode(o[h]);return g},applyCanBeUsed:{uint8array:(function(){try{return n.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return n.nodebuffer&&String.fromCharCode.apply(null,i.allocBuffer(1)).length===1}catch{return!1}})()}};function x(o){var g=65536,h=a.getTypeOf(o),b=!0;if(h==="uint8array"?b=v.applyCanBeUsed.uint8array:h==="nodebuffer"&&(b=v.applyCanBeUsed.nodebuffer),b)for(;1<g;)try{return v.stringifyByChunk(o,h,g)}catch{g=Math.floor(g/2)}return v.stringifyByChar(o)}function u(o,g){for(var h=0;h<o.length;h++)g[h]=o[h];return g}a.applyFromCharCode=x;var _={};_.string={string:p,array:function(o){return w(o,new Array(o.length))},arraybuffer:function(o){return _.string.uint8array(o).buffer},uint8array:function(o){return w(o,new Uint8Array(o.length))},nodebuffer:function(o){return w(o,i.allocBuffer(o.length))}},_.array={string:x,array:p,arraybuffer:function(o){return new Uint8Array(o).buffer},uint8array:function(o){return new Uint8Array(o)},nodebuffer:function(o){return i.newBufferFrom(o)}},_.arraybuffer={string:function(o){return x(new Uint8Array(o))},array:function(o){return u(new Uint8Array(o),new Array(o.byteLength))},arraybuffer:p,uint8array:function(o){return new Uint8Array(o)},nodebuffer:function(o){return i.newBufferFrom(new Uint8Array(o))}},_.uint8array={string:x,array:function(o){return u(o,new Array(o.length))},arraybuffer:function(o){return o.buffer},uint8array:p,nodebuffer:function(o){return i.newBufferFrom(o)}},_.nodebuffer={string:x,array:function(o){return u(o,new Array(o.length))},arraybuffer:function(o){return _.nodebuffer.uint8array(o).buffer},uint8array:function(o){return u(o,new Uint8Array(o.length))},nodebuffer:p},a.transformTo=function(o,g){if(g=g||"",!o)return g;a.checkSupport(o);var h=a.getTypeOf(g);return _[h][o](g)},a.resolve=function(o){for(var g=o.split("/"),h=[],b=0;b<g.length;b++){var S=g[b];S==="."||S===""&&b!==0&&b!==g.length-1||(S===".."?h.pop():h.push(S))}return h.join("/")},a.getTypeOf=function(o){return typeof o=="string"?"string":Object.prototype.toString.call(o)==="[object Array]"?"array":n.nodebuffer&&i.isBuffer(o)?"nodebuffer":n.uint8array&&o instanceof Uint8Array?"uint8array":n.arraybuffer&&o instanceof ArrayBuffer?"arraybuffer":void 0},a.checkSupport=function(o){if(!n[o.toLowerCase()])throw new Error(o+" is not supported by this platform")},a.MAX_VALUE_16BITS=65535,a.MAX_VALUE_32BITS=-1,a.pretty=function(o){var g,h,b="";for(h=0;h<(o||"").length;h++)b+="\\x"+((g=o.charCodeAt(h))<16?"0":"")+g.toString(16).toUpperCase();return b},a.delay=function(o,g,h){setImmediate(function(){o.apply(h||null,g||[])})},a.inherits=function(o,g){function h(){}h.prototype=g.prototype,o.prototype=new h},a.extend=function(){var o,g,h={};for(o=0;o<arguments.length;o++)for(g in arguments[o])Object.prototype.hasOwnProperty.call(arguments[o],g)&&h[g]===void 0&&(h[g]=arguments[o][g]);return h},a.prepareContent=function(o,g,h,b,S){return l.Promise.resolve(g).then(function(E){return n.blob&&(E instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(E))!==-1)&&typeof FileReader<"u"?new l.Promise(function(z,R){var P=new FileReader;P.onload=function($){z($.target.result)},P.onerror=function($){R($.target.error)},P.readAsArrayBuffer(E)}):E}).then(function(E){var z=a.getTypeOf(E);return z?(z==="arraybuffer"?E=a.transformTo("uint8array",E):z==="string"&&(S?E=r.decode(E):h&&b!==!0&&(E=(function(R){return w(R,n.uint8array?new Uint8Array(R.length):new Array(R.length))})(E))),E):l.Promise.reject(new Error("Can't read the data of '"+o+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,f,a){var n=e("./reader/readerFor"),r=e("./utils"),i=e("./signature"),l=e("./zipEntry"),p=e("./support");function w(v){this.files=[],this.loadOptions=v}w.prototype={checkSignature:function(v){if(!this.reader.readAndCheckSignature(v)){this.reader.index-=4;var x=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+r.pretty(x)+", expected "+r.pretty(v)+")")}},isSignature:function(v,x){var u=this.reader.index;this.reader.setIndex(v);var _=this.reader.readString(4)===x;return this.reader.setIndex(u),_},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var v=this.reader.readData(this.zipCommentLength),x=p.uint8array?"uint8array":"array",u=r.transformTo(x,v);this.zipComment=this.loadOptions.decodeFileName(u)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var v,x,u,_=this.zip64EndOfCentralSize-44;0<_;)v=this.reader.readInt(2),x=this.reader.readInt(4),u=this.reader.readData(x),this.zip64ExtensibleData[v]={id:v,length:x,value:u}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var v,x;for(v=0;v<this.files.length;v++)x=this.files[v],this.reader.setIndex(x.localHeaderOffset),this.checkSignature(i.LOCAL_FILE_HEADER),x.readLocalPart(this.reader),x.handleUTF8(),x.processAttributes()},readCentralDir:function(){var v;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(i.CENTRAL_FILE_HEADER);)(v=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(v);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var v=this.reader.lastIndexOfSignature(i.CENTRAL_DIRECTORY_END);if(v<0)throw this.isSignature(0,i.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(v);var x=v;if(this.checkSignature(i.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r.MAX_VALUE_16BITS||this.centralDirRecords===r.MAX_VALUE_16BITS||this.centralDirSize===r.MAX_VALUE_32BITS||this.centralDirOffset===r.MAX_VALUE_32BITS){if(this.zip64=!0,(v=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(v),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,i.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var u=this.centralDirOffset+this.centralDirSize;this.zip64&&(u+=20,u+=12+this.zip64EndOfCentralSize);var _=x-u;if(0<_)this.isSignature(x,i.CENTRAL_FILE_HEADER)||(this.reader.zero=_);else if(_<0)throw new Error("Corrupted zip: missing "+Math.abs(_)+" bytes.")},prepareReader:function(v){this.reader=n(v)},load:function(v){this.prepareReader(v),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},f.exports=w},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,f,a){var n=e("./reader/readerFor"),r=e("./utils"),i=e("./compressedObject"),l=e("./crc32"),p=e("./utf8"),w=e("./compressions"),v=e("./support");function x(u,_){this.options=u,this.loadOptions=_}x.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(u){var _,o;if(u.skip(22),this.fileNameLength=u.readInt(2),o=u.readInt(2),this.fileName=u.readData(this.fileNameLength),u.skip(o),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((_=(function(g){for(var h in w)if(Object.prototype.hasOwnProperty.call(w,h)&&w[h].magic===g)return w[h];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+r.pretty(this.compressionMethod)+" unknown (inner file : "+r.transformTo("string",this.fileName)+")");this.decompressed=new i(this.compressedSize,this.uncompressedSize,this.crc32,_,u.readData(this.compressedSize))},readCentralPart:function(u){this.versionMadeBy=u.readInt(2),u.skip(2),this.bitFlag=u.readInt(2),this.compressionMethod=u.readString(2),this.date=u.readDate(),this.crc32=u.readInt(4),this.compressedSize=u.readInt(4),this.uncompressedSize=u.readInt(4);var _=u.readInt(2);if(this.extraFieldsLength=u.readInt(2),this.fileCommentLength=u.readInt(2),this.diskNumberStart=u.readInt(2),this.internalFileAttributes=u.readInt(2),this.externalFileAttributes=u.readInt(4),this.localHeaderOffset=u.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");u.skip(_),this.readExtraFields(u),this.parseZIP64ExtraField(u),this.fileComment=u.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var u=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),u==0&&(this.dosPermissions=63&this.externalFileAttributes),u==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var u=n(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=u.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=u.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=u.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=u.readInt(4))}},readExtraFields:function(u){var _,o,g,h=u.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});u.index+4<h;)_=u.readInt(2),o=u.readInt(2),g=u.readData(o),this.extraFields[_]={id:_,length:o,value:g};u.setIndex(h)},handleUTF8:function(){var u=v.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=p.utf8decode(this.fileName),this.fileCommentStr=p.utf8decode(this.fileComment);else{var _=this.findExtraFieldUnicodePath();if(_!==null)this.fileNameStr=_;else{var o=r.transformTo(u,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(o)}var g=this.findExtraFieldUnicodeComment();if(g!==null)this.fileCommentStr=g;else{var h=r.transformTo(u,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(h)}}},findExtraFieldUnicodePath:function(){var u=this.extraFields[28789];if(u){var _=n(u.value);return _.readInt(1)!==1||l(this.fileName)!==_.readInt(4)?null:p.utf8decode(_.readData(u.length-5))}return null},findExtraFieldUnicodeComment:function(){var u=this.extraFields[25461];if(u){var _=n(u.value);return _.readInt(1)!==1||l(this.fileComment)!==_.readInt(4)?null:p.utf8decode(_.readData(u.length-5))}return null}},f.exports=x},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,f,a){function n(_,o,g){this.name=_,this.dir=g.dir,this.date=g.date,this.comment=g.comment,this.unixPermissions=g.unixPermissions,this.dosPermissions=g.dosPermissions,this._data=o,this._dataBinary=g.binary,this.options={compression:g.compression,compressionOptions:g.compressionOptions}}var r=e("./stream/StreamHelper"),i=e("./stream/DataWorker"),l=e("./utf8"),p=e("./compressedObject"),w=e("./stream/GenericWorker");n.prototype={internalStream:function(_){var o=null,g="string";try{if(!_)throw new Error("No output type specified.");var h=(g=_.toLowerCase())==="string"||g==="text";g!=="binarystring"&&g!=="text"||(g="string"),o=this._decompressWorker();var b=!this._dataBinary;b&&!h&&(o=o.pipe(new l.Utf8EncodeWorker)),!b&&h&&(o=o.pipe(new l.Utf8DecodeWorker))}catch(S){(o=new w("error")).error(S)}return new r(o,g,"")},async:function(_,o){return this.internalStream(_).accumulate(o)},nodeStream:function(_,o){return this.internalStream(_||"nodebuffer").toNodejsStream(o)},_compressWorker:function(_,o){if(this._data instanceof p&&this._data.compression.magic===_.magic)return this._data.getCompressedWorker();var g=this._decompressWorker();return this._dataBinary||(g=g.pipe(new l.Utf8EncodeWorker)),p.createWorkerFrom(g,_,o)},_decompressWorker:function(){return this._data instanceof p?this._data.getContentWorker():this._data instanceof w?this._data:new i(this._data)}};for(var v=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],x=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},u=0;u<v.length;u++)n.prototype[v[u]]=x;f.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,f,a){(function(n){var r,i,l=n.MutationObserver||n.WebKitMutationObserver;if(l){var p=0,w=new l(_),v=n.document.createTextNode("");w.observe(v,{characterData:!0}),r=function(){v.data=p=++p%2}}else if(n.setImmediate||n.MessageChannel===void 0)r="document"in n&&"onreadystatechange"in n.document.createElement("script")?function(){var o=n.document.createElement("script");o.onreadystatechange=function(){_(),o.onreadystatechange=null,o.parentNode.removeChild(o),o=null},n.document.documentElement.appendChild(o)}:function(){setTimeout(_,0)};else{var x=new n.MessageChannel;x.port1.onmessage=_,r=function(){x.port2.postMessage(0)}}var u=[];function _(){var o,g;i=!0;for(var h=u.length;h;){for(g=u,u=[],o=-1;++o<h;)g[o]();h=u.length}i=!1}f.exports=function(o){u.push(o)!==1||i||r()}}).call(this,typeof zt<"u"?zt:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(e,f,a){var n=e("immediate");function r(){}var i={},l=["REJECTED"],p=["FULFILLED"],w=["PENDING"];function v(h){if(typeof h!="function")throw new TypeError("resolver must be a function");this.state=w,this.queue=[],this.outcome=void 0,h!==r&&o(this,h)}function x(h,b,S){this.promise=h,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof S=="function"&&(this.onRejected=S,this.callRejected=this.otherCallRejected)}function u(h,b,S){n(function(){var E;try{E=b(S)}catch(z){return i.reject(h,z)}E===h?i.reject(h,new TypeError("Cannot resolve promise with itself")):i.resolve(h,E)})}function _(h){var b=h&&h.then;if(h&&(typeof h=="object"||typeof h=="function")&&typeof b=="function")return function(){b.apply(h,arguments)}}function o(h,b){var S=!1;function E(P){S||(S=!0,i.reject(h,P))}function z(P){S||(S=!0,i.resolve(h,P))}var R=g(function(){b(z,E)});R.status==="error"&&E(R.value)}function g(h,b){var S={};try{S.value=h(b),S.status="success"}catch(E){S.status="error",S.value=E}return S}(f.exports=v).prototype.finally=function(h){if(typeof h!="function")return this;var b=this.constructor;return this.then(function(S){return b.resolve(h()).then(function(){return S})},function(S){return b.resolve(h()).then(function(){throw S})})},v.prototype.catch=function(h){return this.then(null,h)},v.prototype.then=function(h,b){if(typeof h!="function"&&this.state===p||typeof b!="function"&&this.state===l)return this;var S=new this.constructor(r);return this.state!==w?u(S,this.state===p?h:b,this.outcome):this.queue.push(new x(S,h,b)),S},x.prototype.callFulfilled=function(h){i.resolve(this.promise,h)},x.prototype.otherCallFulfilled=function(h){u(this.promise,this.onFulfilled,h)},x.prototype.callRejected=function(h){i.reject(this.promise,h)},x.prototype.otherCallRejected=function(h){u(this.promise,this.onRejected,h)},i.resolve=function(h,b){var S=g(_,b);if(S.status==="error")return i.reject(h,S.value);var E=S.value;if(E)o(h,E);else{h.state=p,h.outcome=b;for(var z=-1,R=h.queue.length;++z<R;)h.queue[z].callFulfilled(b)}return h},i.reject=function(h,b){h.state=l,h.outcome=b;for(var S=-1,E=h.queue.length;++S<E;)h.queue[S].callRejected(b);return h},v.resolve=function(h){return h instanceof this?h:i.resolve(new this(r),h)},v.reject=function(h){var b=new this(r);return i.reject(b,h)},v.all=function(h){var b=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var S=h.length,E=!1;if(!S)return this.resolve([]);for(var z=new Array(S),R=0,P=-1,$=new this(r);++P<S;)F(h[P],P);return $;function F(M,Y){b.resolve(M).then(function(k){z[Y]=k,++R!==S||E||(E=!0,i.resolve($,z))},function(k){E||(E=!0,i.reject($,k))})}},v.race=function(h){var b=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var S=h.length,E=!1;if(!S)return this.resolve([]);for(var z=-1,R=new this(r);++z<S;)P=h[z],b.resolve(P).then(function($){E||(E=!0,i.resolve(R,$))},function($){E||(E=!0,i.reject(R,$))});var P;return R}},{immediate:36}],38:[function(e,f,a){var n={};(0,e("./lib/utils/common").assign)(n,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),f.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,f,a){var n=e("./zlib/deflate"),r=e("./utils/common"),i=e("./utils/strings"),l=e("./zlib/messages"),p=e("./zlib/zstream"),w=Object.prototype.toString,v=0,x=-1,u=0,_=8;function o(h){if(!(this instanceof o))return new o(h);this.options=r.assign({level:x,method:_,chunkSize:16384,windowBits:15,memLevel:8,strategy:u,to:""},h||{});var b=this.options;b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new p,this.strm.avail_out=0;var S=n.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(S!==v)throw new Error(l[S]);if(b.header&&n.deflateSetHeader(this.strm,b.header),b.dictionary){var E;if(E=typeof b.dictionary=="string"?i.string2buf(b.dictionary):w.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(S=n.deflateSetDictionary(this.strm,E))!==v)throw new Error(l[S]);this._dict_set=!0}}function g(h,b){var S=new o(b);if(S.push(h,!0),S.err)throw S.msg||l[S.err];return S.result}o.prototype.push=function(h,b){var S,E,z=this.strm,R=this.options.chunkSize;if(this.ended)return!1;E=b===~~b?b:b===!0?4:0,typeof h=="string"?z.input=i.string2buf(h):w.call(h)==="[object ArrayBuffer]"?z.input=new Uint8Array(h):z.input=h,z.next_in=0,z.avail_in=z.input.length;do{if(z.avail_out===0&&(z.output=new r.Buf8(R),z.next_out=0,z.avail_out=R),(S=n.deflate(z,E))!==1&&S!==v)return this.onEnd(S),!(this.ended=!0);z.avail_out!==0&&(z.avail_in!==0||E!==4&&E!==2)||(this.options.to==="string"?this.onData(i.buf2binstring(r.shrinkBuf(z.output,z.next_out))):this.onData(r.shrinkBuf(z.output,z.next_out)))}while((0<z.avail_in||z.avail_out===0)&&S!==1);return E===4?(S=n.deflateEnd(this.strm),this.onEnd(S),this.ended=!0,S===v):E!==2||(this.onEnd(v),!(z.avail_out=0))},o.prototype.onData=function(h){this.chunks.push(h)},o.prototype.onEnd=function(h){h===v&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=h,this.msg=this.strm.msg},a.Deflate=o,a.deflate=g,a.deflateRaw=function(h,b){return(b=b||{}).raw=!0,g(h,b)},a.gzip=function(h,b){return(b=b||{}).gzip=!0,g(h,b)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,f,a){var n=e("./zlib/inflate"),r=e("./utils/common"),i=e("./utils/strings"),l=e("./zlib/constants"),p=e("./zlib/messages"),w=e("./zlib/zstream"),v=e("./zlib/gzheader"),x=Object.prototype.toString;function u(o){if(!(this instanceof u))return new u(o);this.options=r.assign({chunkSize:16384,windowBits:0,to:""},o||{});var g=this.options;g.raw&&0<=g.windowBits&&g.windowBits<16&&(g.windowBits=-g.windowBits,g.windowBits===0&&(g.windowBits=-15)),!(0<=g.windowBits&&g.windowBits<16)||o&&o.windowBits||(g.windowBits+=32),15<g.windowBits&&g.windowBits<48&&(15&g.windowBits)==0&&(g.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new w,this.strm.avail_out=0;var h=n.inflateInit2(this.strm,g.windowBits);if(h!==l.Z_OK)throw new Error(p[h]);this.header=new v,n.inflateGetHeader(this.strm,this.header)}function _(o,g){var h=new u(g);if(h.push(o,!0),h.err)throw h.msg||p[h.err];return h.result}u.prototype.push=function(o,g){var h,b,S,E,z,R,P=this.strm,$=this.options.chunkSize,F=this.options.dictionary,M=!1;if(this.ended)return!1;b=g===~~g?g:g===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof o=="string"?P.input=i.binstring2buf(o):x.call(o)==="[object ArrayBuffer]"?P.input=new Uint8Array(o):P.input=o,P.next_in=0,P.avail_in=P.input.length;do{if(P.avail_out===0&&(P.output=new r.Buf8($),P.next_out=0,P.avail_out=$),(h=n.inflate(P,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&F&&(R=typeof F=="string"?i.string2buf(F):x.call(F)==="[object ArrayBuffer]"?new Uint8Array(F):F,h=n.inflateSetDictionary(this.strm,R)),h===l.Z_BUF_ERROR&&M===!0&&(h=l.Z_OK,M=!1),h!==l.Z_STREAM_END&&h!==l.Z_OK)return this.onEnd(h),!(this.ended=!0);P.next_out&&(P.avail_out!==0&&h!==l.Z_STREAM_END&&(P.avail_in!==0||b!==l.Z_FINISH&&b!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(S=i.utf8border(P.output,P.next_out),E=P.next_out-S,z=i.buf2string(P.output,S),P.next_out=E,P.avail_out=$-E,E&&r.arraySet(P.output,P.output,S,E,0),this.onData(z)):this.onData(r.shrinkBuf(P.output,P.next_out)))),P.avail_in===0&&P.avail_out===0&&(M=!0)}while((0<P.avail_in||P.avail_out===0)&&h!==l.Z_STREAM_END);return h===l.Z_STREAM_END&&(b=l.Z_FINISH),b===l.Z_FINISH?(h=n.inflateEnd(this.strm),this.onEnd(h),this.ended=!0,h===l.Z_OK):b!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(P.avail_out=0))},u.prototype.onData=function(o){this.chunks.push(o)},u.prototype.onEnd=function(o){o===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=o,this.msg=this.strm.msg},a.Inflate=u,a.inflate=_,a.inflateRaw=function(o,g){return(g=g||{}).raw=!0,_(o,g)},a.ungzip=_},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,f,a){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";a.assign=function(l){for(var p=Array.prototype.slice.call(arguments,1);p.length;){var w=p.shift();if(w){if(typeof w!="object")throw new TypeError(w+"must be non-object");for(var v in w)w.hasOwnProperty(v)&&(l[v]=w[v])}}return l},a.shrinkBuf=function(l,p){return l.length===p?l:l.subarray?l.subarray(0,p):(l.length=p,l)};var r={arraySet:function(l,p,w,v,x){if(p.subarray&&l.subarray)l.set(p.subarray(w,w+v),x);else for(var u=0;u<v;u++)l[x+u]=p[w+u]},flattenChunks:function(l){var p,w,v,x,u,_;for(p=v=0,w=l.length;p<w;p++)v+=l[p].length;for(_=new Uint8Array(v),p=x=0,w=l.length;p<w;p++)u=l[p],_.set(u,x),x+=u.length;return _}},i={arraySet:function(l,p,w,v,x){for(var u=0;u<v;u++)l[x+u]=p[w+u]},flattenChunks:function(l){return[].concat.apply([],l)}};a.setTyped=function(l){l?(a.Buf8=Uint8Array,a.Buf16=Uint16Array,a.Buf32=Int32Array,a.assign(a,r)):(a.Buf8=Array,a.Buf16=Array,a.Buf32=Array,a.assign(a,i))},a.setTyped(n)},{}],42:[function(e,f,a){var n=e("./common"),r=!0,i=!0;try{String.fromCharCode.apply(null,[0])}catch{r=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{i=!1}for(var l=new n.Buf8(256),p=0;p<256;p++)l[p]=252<=p?6:248<=p?5:240<=p?4:224<=p?3:192<=p?2:1;function w(v,x){if(x<65537&&(v.subarray&&i||!v.subarray&&r))return String.fromCharCode.apply(null,n.shrinkBuf(v,x));for(var u="",_=0;_<x;_++)u+=String.fromCharCode(v[_]);return u}l[254]=l[254]=1,a.string2buf=function(v){var x,u,_,o,g,h=v.length,b=0;for(o=0;o<h;o++)(64512&(u=v.charCodeAt(o)))==55296&&o+1<h&&(64512&(_=v.charCodeAt(o+1)))==56320&&(u=65536+(u-55296<<10)+(_-56320),o++),b+=u<128?1:u<2048?2:u<65536?3:4;for(x=new n.Buf8(b),o=g=0;g<b;o++)(64512&(u=v.charCodeAt(o)))==55296&&o+1<h&&(64512&(_=v.charCodeAt(o+1)))==56320&&(u=65536+(u-55296<<10)+(_-56320),o++),u<128?x[g++]=u:(u<2048?x[g++]=192|u>>>6:(u<65536?x[g++]=224|u>>>12:(x[g++]=240|u>>>18,x[g++]=128|u>>>12&63),x[g++]=128|u>>>6&63),x[g++]=128|63&u);return x},a.buf2binstring=function(v){return w(v,v.length)},a.binstring2buf=function(v){for(var x=new n.Buf8(v.length),u=0,_=x.length;u<_;u++)x[u]=v.charCodeAt(u);return x},a.buf2string=function(v,x){var u,_,o,g,h=x||v.length,b=new Array(2*h);for(u=_=0;u<h;)if((o=v[u++])<128)b[_++]=o;else if(4<(g=l[o]))b[_++]=65533,u+=g-1;else{for(o&=g===2?31:g===3?15:7;1<g&&u<h;)o=o<<6|63&v[u++],g--;1<g?b[_++]=65533:o<65536?b[_++]=o:(o-=65536,b[_++]=55296|o>>10&1023,b[_++]=56320|1023&o)}return w(b,_)},a.utf8border=function(v,x){var u;for((x=x||v.length)>v.length&&(x=v.length),u=x-1;0<=u&&(192&v[u])==128;)u--;return u<0||u===0?x:u+l[v[u]]>x?u:x}},{"./common":41}],43:[function(e,f,a){f.exports=function(n,r,i,l){for(var p=65535&n|0,w=n>>>16&65535|0,v=0;i!==0;){for(i-=v=2e3<i?2e3:i;w=w+(p=p+r[l++]|0)|0,--v;);p%=65521,w%=65521}return p|w<<16|0}},{}],44:[function(e,f,a){f.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,f,a){var n=(function(){for(var r,i=[],l=0;l<256;l++){r=l;for(var p=0;p<8;p++)r=1&r?3988292384^r>>>1:r>>>1;i[l]=r}return i})();f.exports=function(r,i,l,p){var w=n,v=p+l;r^=-1;for(var x=p;x<v;x++)r=r>>>8^w[255&(r^i[x])];return-1^r}},{}],46:[function(e,f,a){var n,r=e("../utils/common"),i=e("./trees"),l=e("./adler32"),p=e("./crc32"),w=e("./messages"),v=0,x=4,u=0,_=-2,o=-1,g=4,h=2,b=8,S=9,E=286,z=30,R=19,P=2*E+1,$=15,F=3,M=258,Y=M+F+1,k=42,B=113,s=1,j=2,Q=3,U=4;function tt(t,D){return t.msg=w[D],D}function W(t){return(t<<1)-(4<t?9:0)}function q(t){for(var D=t.length;0<=--D;)t[D]=0}function O(t){var D=t.state,T=D.pending;T>t.avail_out&&(T=t.avail_out),T!==0&&(r.arraySet(t.output,D.pending_buf,D.pending_out,T,t.next_out),t.next_out+=T,D.pending_out+=T,t.total_out+=T,t.avail_out-=T,D.pending-=T,D.pending===0&&(D.pending_out=0))}function I(t,D){i._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,D),t.block_start=t.strstart,O(t.strm)}function J(t,D){t.pending_buf[t.pending++]=D}function K(t,D){t.pending_buf[t.pending++]=D>>>8&255,t.pending_buf[t.pending++]=255&D}function X(t,D){var T,y,m=t.max_chain_length,A=t.strstart,N=t.prev_length,L=t.nice_match,C=t.strstart>t.w_size-Y?t.strstart-(t.w_size-Y):0,Z=t.window,G=t.w_mask,H=t.prev,V=t.strstart+M,it=Z[A+N-1],rt=Z[A+N];t.prev_length>=t.good_match&&(m>>=2),L>t.lookahead&&(L=t.lookahead);do if(Z[(T=D)+N]===rt&&Z[T+N-1]===it&&Z[T]===Z[A]&&Z[++T]===Z[A+1]){A+=2,T++;do;while(Z[++A]===Z[++T]&&Z[++A]===Z[++T]&&Z[++A]===Z[++T]&&Z[++A]===Z[++T]&&Z[++A]===Z[++T]&&Z[++A]===Z[++T]&&Z[++A]===Z[++T]&&Z[++A]===Z[++T]&&A<V);if(y=M-(V-A),A=V-M,N<y){if(t.match_start=D,L<=(N=y))break;it=Z[A+N-1],rt=Z[A+N]}}while((D=H[D&G])>C&&--m!=0);return N<=t.lookahead?N:t.lookahead}function st(t){var D,T,y,m,A,N,L,C,Z,G,H=t.w_size;do{if(m=t.window_size-t.lookahead-t.strstart,t.strstart>=H+(H-Y)){for(r.arraySet(t.window,t.window,H,H,0),t.match_start-=H,t.strstart-=H,t.block_start-=H,D=T=t.hash_size;y=t.head[--D],t.head[D]=H<=y?y-H:0,--T;);for(D=T=H;y=t.prev[--D],t.prev[D]=H<=y?y-H:0,--T;);m+=H}if(t.strm.avail_in===0)break;if(N=t.strm,L=t.window,C=t.strstart+t.lookahead,Z=m,G=void 0,G=N.avail_in,Z<G&&(G=Z),T=G===0?0:(N.avail_in-=G,r.arraySet(L,N.input,N.next_in,G,C),N.state.wrap===1?N.adler=l(N.adler,L,G,C):N.state.wrap===2&&(N.adler=p(N.adler,L,G,C)),N.next_in+=G,N.total_in+=G,G),t.lookahead+=T,t.lookahead+t.insert>=F)for(A=t.strstart-t.insert,t.ins_h=t.window[A],t.ins_h=(t.ins_h<<t.hash_shift^t.window[A+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[A+F-1])&t.hash_mask,t.prev[A&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=A,A++,t.insert--,!(t.lookahead+t.insert<F)););}while(t.lookahead<Y&&t.strm.avail_in!==0)}function lt(t,D){for(var T,y;;){if(t.lookahead<Y){if(st(t),t.lookahead<Y&&D===v)return s;if(t.lookahead===0)break}if(T=0,t.lookahead>=F&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+F-1])&t.hash_mask,T=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),T!==0&&t.strstart-T<=t.w_size-Y&&(t.match_length=X(t,T)),t.match_length>=F)if(y=i._tr_tally(t,t.strstart-t.match_start,t.match_length-F),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=F){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+F-1])&t.hash_mask,T=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart,--t.match_length!=0;);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else y=i._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(y&&(I(t,!1),t.strm.avail_out===0))return s}return t.insert=t.strstart<F-1?t.strstart:F-1,D===x?(I(t,!0),t.strm.avail_out===0?Q:U):t.last_lit&&(I(t,!1),t.strm.avail_out===0)?s:j}function et(t,D){for(var T,y,m;;){if(t.lookahead<Y){if(st(t),t.lookahead<Y&&D===v)return s;if(t.lookahead===0)break}if(T=0,t.lookahead>=F&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+F-1])&t.hash_mask,T=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=F-1,T!==0&&t.prev_length<t.max_lazy_match&&t.strstart-T<=t.w_size-Y&&(t.match_length=X(t,T),t.match_length<=5&&(t.strategy===1||t.match_length===F&&4096<t.strstart-t.match_start)&&(t.match_length=F-1)),t.prev_length>=F&&t.match_length<=t.prev_length){for(m=t.strstart+t.lookahead-F,y=i._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-F),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=m&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+F-1])&t.hash_mask,T=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),--t.prev_length!=0;);if(t.match_available=0,t.match_length=F-1,t.strstart++,y&&(I(t,!1),t.strm.avail_out===0))return s}else if(t.match_available){if((y=i._tr_tally(t,0,t.window[t.strstart-1]))&&I(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return s}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(y=i._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<F-1?t.strstart:F-1,D===x?(I(t,!0),t.strm.avail_out===0?Q:U):t.last_lit&&(I(t,!1),t.strm.avail_out===0)?s:j}function nt(t,D,T,y,m){this.good_length=t,this.max_lazy=D,this.nice_length=T,this.max_chain=y,this.func=m}function ct(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=b,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r.Buf16(2*P),this.dyn_dtree=new r.Buf16(2*(2*z+1)),this.bl_tree=new r.Buf16(2*(2*R+1)),q(this.dyn_ltree),q(this.dyn_dtree),q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r.Buf16($+1),this.heap=new r.Buf16(2*E+1),q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r.Buf16(2*E+1),q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function at(t){var D;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=h,(D=t.state).pending=0,D.pending_out=0,D.wrap<0&&(D.wrap=-D.wrap),D.status=D.wrap?k:B,t.adler=D.wrap===2?0:1,D.last_flush=v,i._tr_init(D),u):tt(t,_)}function dt(t){var D=at(t);return D===u&&(function(T){T.window_size=2*T.w_size,q(T.head),T.max_lazy_match=n[T.level].max_lazy,T.good_match=n[T.level].good_length,T.nice_match=n[T.level].nice_length,T.max_chain_length=n[T.level].max_chain,T.strstart=0,T.block_start=0,T.lookahead=0,T.insert=0,T.match_length=T.prev_length=F-1,T.match_available=0,T.ins_h=0})(t.state),D}function ht(t,D,T,y,m,A){if(!t)return _;var N=1;if(D===o&&(D=6),y<0?(N=0,y=-y):15<y&&(N=2,y-=16),m<1||S<m||T!==b||y<8||15<y||D<0||9<D||A<0||g<A)return tt(t,_);y===8&&(y=9);var L=new ct;return(t.state=L).strm=t,L.wrap=N,L.gzhead=null,L.w_bits=y,L.w_size=1<<L.w_bits,L.w_mask=L.w_size-1,L.hash_bits=m+7,L.hash_size=1<<L.hash_bits,L.hash_mask=L.hash_size-1,L.hash_shift=~~((L.hash_bits+F-1)/F),L.window=new r.Buf8(2*L.w_size),L.head=new r.Buf16(L.hash_size),L.prev=new r.Buf16(L.w_size),L.lit_bufsize=1<<m+6,L.pending_buf_size=4*L.lit_bufsize,L.pending_buf=new r.Buf8(L.pending_buf_size),L.d_buf=1*L.lit_bufsize,L.l_buf=3*L.lit_bufsize,L.level=D,L.strategy=A,L.method=T,dt(t)}n=[new nt(0,0,0,0,function(t,D){var T=65535;for(T>t.pending_buf_size-5&&(T=t.pending_buf_size-5);;){if(t.lookahead<=1){if(st(t),t.lookahead===0&&D===v)return s;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var y=t.block_start+T;if((t.strstart===0||t.strstart>=y)&&(t.lookahead=t.strstart-y,t.strstart=y,I(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-Y&&(I(t,!1),t.strm.avail_out===0))return s}return t.insert=0,D===x?(I(t,!0),t.strm.avail_out===0?Q:U):(t.strstart>t.block_start&&(I(t,!1),t.strm.avail_out),s)}),new nt(4,4,8,4,lt),new nt(4,5,16,8,lt),new nt(4,6,32,32,lt),new nt(4,4,16,16,et),new nt(8,16,32,32,et),new nt(8,16,128,128,et),new nt(8,32,128,256,et),new nt(32,128,258,1024,et),new nt(32,258,258,4096,et)],a.deflateInit=function(t,D){return ht(t,D,b,15,8,0)},a.deflateInit2=ht,a.deflateReset=dt,a.deflateResetKeep=at,a.deflateSetHeader=function(t,D){return t&&t.state?t.state.wrap!==2?_:(t.state.gzhead=D,u):_},a.deflate=function(t,D){var T,y,m,A;if(!t||!t.state||5<D||D<0)return t?tt(t,_):_;if(y=t.state,!t.output||!t.input&&t.avail_in!==0||y.status===666&&D!==x)return tt(t,t.avail_out===0?-5:_);if(y.strm=t,T=y.last_flush,y.last_flush=D,y.status===k)if(y.wrap===2)t.adler=0,J(y,31),J(y,139),J(y,8),y.gzhead?(J(y,(y.gzhead.text?1:0)+(y.gzhead.hcrc?2:0)+(y.gzhead.extra?4:0)+(y.gzhead.name?8:0)+(y.gzhead.comment?16:0)),J(y,255&y.gzhead.time),J(y,y.gzhead.time>>8&255),J(y,y.gzhead.time>>16&255),J(y,y.gzhead.time>>24&255),J(y,y.level===9?2:2<=y.strategy||y.level<2?4:0),J(y,255&y.gzhead.os),y.gzhead.extra&&y.gzhead.extra.length&&(J(y,255&y.gzhead.extra.length),J(y,y.gzhead.extra.length>>8&255)),y.gzhead.hcrc&&(t.adler=p(t.adler,y.pending_buf,y.pending,0)),y.gzindex=0,y.status=69):(J(y,0),J(y,0),J(y,0),J(y,0),J(y,0),J(y,y.level===9?2:2<=y.strategy||y.level<2?4:0),J(y,3),y.status=B);else{var N=b+(y.w_bits-8<<4)<<8;N|=(2<=y.strategy||y.level<2?0:y.level<6?1:y.level===6?2:3)<<6,y.strstart!==0&&(N|=32),N+=31-N%31,y.status=B,K(y,N),y.strstart!==0&&(K(y,t.adler>>>16),K(y,65535&t.adler)),t.adler=1}if(y.status===69)if(y.gzhead.extra){for(m=y.pending;y.gzindex<(65535&y.gzhead.extra.length)&&(y.pending!==y.pending_buf_size||(y.gzhead.hcrc&&y.pending>m&&(t.adler=p(t.adler,y.pending_buf,y.pending-m,m)),O(t),m=y.pending,y.pending!==y.pending_buf_size));)J(y,255&y.gzhead.extra[y.gzindex]),y.gzindex++;y.gzhead.hcrc&&y.pending>m&&(t.adler=p(t.adler,y.pending_buf,y.pending-m,m)),y.gzindex===y.gzhead.extra.length&&(y.gzindex=0,y.status=73)}else y.status=73;if(y.status===73)if(y.gzhead.name){m=y.pending;do{if(y.pending===y.pending_buf_size&&(y.gzhead.hcrc&&y.pending>m&&(t.adler=p(t.adler,y.pending_buf,y.pending-m,m)),O(t),m=y.pending,y.pending===y.pending_buf_size)){A=1;break}A=y.gzindex<y.gzhead.name.length?255&y.gzhead.name.charCodeAt(y.gzindex++):0,J(y,A)}while(A!==0);y.gzhead.hcrc&&y.pending>m&&(t.adler=p(t.adler,y.pending_buf,y.pending-m,m)),A===0&&(y.gzindex=0,y.status=91)}else y.status=91;if(y.status===91)if(y.gzhead.comment){m=y.pending;do{if(y.pending===y.pending_buf_size&&(y.gzhead.hcrc&&y.pending>m&&(t.adler=p(t.adler,y.pending_buf,y.pending-m,m)),O(t),m=y.pending,y.pending===y.pending_buf_size)){A=1;break}A=y.gzindex<y.gzhead.comment.length?255&y.gzhead.comment.charCodeAt(y.gzindex++):0,J(y,A)}while(A!==0);y.gzhead.hcrc&&y.pending>m&&(t.adler=p(t.adler,y.pending_buf,y.pending-m,m)),A===0&&(y.status=103)}else y.status=103;if(y.status===103&&(y.gzhead.hcrc?(y.pending+2>y.pending_buf_size&&O(t),y.pending+2<=y.pending_buf_size&&(J(y,255&t.adler),J(y,t.adler>>8&255),t.adler=0,y.status=B)):y.status=B),y.pending!==0){if(O(t),t.avail_out===0)return y.last_flush=-1,u}else if(t.avail_in===0&&W(D)<=W(T)&&D!==x)return tt(t,-5);if(y.status===666&&t.avail_in!==0)return tt(t,-5);if(t.avail_in!==0||y.lookahead!==0||D!==v&&y.status!==666){var L=y.strategy===2?(function(C,Z){for(var G;;){if(C.lookahead===0&&(st(C),C.lookahead===0)){if(Z===v)return s;break}if(C.match_length=0,G=i._tr_tally(C,0,C.window[C.strstart]),C.lookahead--,C.strstart++,G&&(I(C,!1),C.strm.avail_out===0))return s}return C.insert=0,Z===x?(I(C,!0),C.strm.avail_out===0?Q:U):C.last_lit&&(I(C,!1),C.strm.avail_out===0)?s:j})(y,D):y.strategy===3?(function(C,Z){for(var G,H,V,it,rt=C.window;;){if(C.lookahead<=M){if(st(C),C.lookahead<=M&&Z===v)return s;if(C.lookahead===0)break}if(C.match_length=0,C.lookahead>=F&&0<C.strstart&&(H=rt[V=C.strstart-1])===rt[++V]&&H===rt[++V]&&H===rt[++V]){it=C.strstart+M;do;while(H===rt[++V]&&H===rt[++V]&&H===rt[++V]&&H===rt[++V]&&H===rt[++V]&&H===rt[++V]&&H===rt[++V]&&H===rt[++V]&&V<it);C.match_length=M-(it-V),C.match_length>C.lookahead&&(C.match_length=C.lookahead)}if(C.match_length>=F?(G=i._tr_tally(C,1,C.match_length-F),C.lookahead-=C.match_length,C.strstart+=C.match_length,C.match_length=0):(G=i._tr_tally(C,0,C.window[C.strstart]),C.lookahead--,C.strstart++),G&&(I(C,!1),C.strm.avail_out===0))return s}return C.insert=0,Z===x?(I(C,!0),C.strm.avail_out===0?Q:U):C.last_lit&&(I(C,!1),C.strm.avail_out===0)?s:j})(y,D):n[y.level].func(y,D);if(L!==Q&&L!==U||(y.status=666),L===s||L===Q)return t.avail_out===0&&(y.last_flush=-1),u;if(L===j&&(D===1?i._tr_align(y):D!==5&&(i._tr_stored_block(y,0,0,!1),D===3&&(q(y.head),y.lookahead===0&&(y.strstart=0,y.block_start=0,y.insert=0))),O(t),t.avail_out===0))return y.last_flush=-1,u}return D!==x?u:y.wrap<=0?1:(y.wrap===2?(J(y,255&t.adler),J(y,t.adler>>8&255),J(y,t.adler>>16&255),J(y,t.adler>>24&255),J(y,255&t.total_in),J(y,t.total_in>>8&255),J(y,t.total_in>>16&255),J(y,t.total_in>>24&255)):(K(y,t.adler>>>16),K(y,65535&t.adler)),O(t),0<y.wrap&&(y.wrap=-y.wrap),y.pending!==0?u:1)},a.deflateEnd=function(t){var D;return t&&t.state?(D=t.state.status)!==k&&D!==69&&D!==73&&D!==91&&D!==103&&D!==B&&D!==666?tt(t,_):(t.state=null,D===B?tt(t,-3):u):_},a.deflateSetDictionary=function(t,D){var T,y,m,A,N,L,C,Z,G=D.length;if(!t||!t.state||(A=(T=t.state).wrap)===2||A===1&&T.status!==k||T.lookahead)return _;for(A===1&&(t.adler=l(t.adler,D,G,0)),T.wrap=0,G>=T.w_size&&(A===0&&(q(T.head),T.strstart=0,T.block_start=0,T.insert=0),Z=new r.Buf8(T.w_size),r.arraySet(Z,D,G-T.w_size,T.w_size,0),D=Z,G=T.w_size),N=t.avail_in,L=t.next_in,C=t.input,t.avail_in=G,t.next_in=0,t.input=D,st(T);T.lookahead>=F;){for(y=T.strstart,m=T.lookahead-(F-1);T.ins_h=(T.ins_h<<T.hash_shift^T.window[y+F-1])&T.hash_mask,T.prev[y&T.w_mask]=T.head[T.ins_h],T.head[T.ins_h]=y,y++,--m;);T.strstart=y,T.lookahead=F-1,st(T)}return T.strstart+=T.lookahead,T.block_start=T.strstart,T.insert=T.lookahead,T.lookahead=0,T.match_length=T.prev_length=F-1,T.match_available=0,t.next_in=L,t.input=C,t.avail_in=N,T.wrap=A,u},a.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,f,a){f.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,f,a){f.exports=function(n,r){var i,l,p,w,v,x,u,_,o,g,h,b,S,E,z,R,P,$,F,M,Y,k,B,s,j;i=n.state,l=n.next_in,s=n.input,p=l+(n.avail_in-5),w=n.next_out,j=n.output,v=w-(r-n.avail_out),x=w+(n.avail_out-257),u=i.dmax,_=i.wsize,o=i.whave,g=i.wnext,h=i.window,b=i.hold,S=i.bits,E=i.lencode,z=i.distcode,R=(1<<i.lenbits)-1,P=(1<<i.distbits)-1;t:do{S<15&&(b+=s[l++]<<S,S+=8,b+=s[l++]<<S,S+=8),$=E[b&R];e:for(;;){if(b>>>=F=$>>>24,S-=F,(F=$>>>16&255)===0)j[w++]=65535&$;else{if(!(16&F)){if((64&F)==0){$=E[(65535&$)+(b&(1<<F)-1)];continue e}if(32&F){i.mode=12;break t}n.msg="invalid literal/length code",i.mode=30;break t}M=65535&$,(F&=15)&&(S<F&&(b+=s[l++]<<S,S+=8),M+=b&(1<<F)-1,b>>>=F,S-=F),S<15&&(b+=s[l++]<<S,S+=8,b+=s[l++]<<S,S+=8),$=z[b&P];r:for(;;){if(b>>>=F=$>>>24,S-=F,!(16&(F=$>>>16&255))){if((64&F)==0){$=z[(65535&$)+(b&(1<<F)-1)];continue r}n.msg="invalid distance code",i.mode=30;break t}if(Y=65535&$,S<(F&=15)&&(b+=s[l++]<<S,(S+=8)<F&&(b+=s[l++]<<S,S+=8)),u<(Y+=b&(1<<F)-1)){n.msg="invalid distance too far back",i.mode=30;break t}if(b>>>=F,S-=F,(F=w-v)<Y){if(o<(F=Y-F)&&i.sane){n.msg="invalid distance too far back",i.mode=30;break t}if(B=h,(k=0)===g){if(k+=_-F,F<M){for(M-=F;j[w++]=h[k++],--F;);k=w-Y,B=j}}else if(g<F){if(k+=_+g-F,(F-=g)<M){for(M-=F;j[w++]=h[k++],--F;);if(k=0,g<M){for(M-=F=g;j[w++]=h[k++],--F;);k=w-Y,B=j}}}else if(k+=g-F,F<M){for(M-=F;j[w++]=h[k++],--F;);k=w-Y,B=j}for(;2<M;)j[w++]=B[k++],j[w++]=B[k++],j[w++]=B[k++],M-=3;M&&(j[w++]=B[k++],1<M&&(j[w++]=B[k++]))}else{for(k=w-Y;j[w++]=j[k++],j[w++]=j[k++],j[w++]=j[k++],2<(M-=3););M&&(j[w++]=j[k++],1<M&&(j[w++]=j[k++]))}break}}break}}while(l<p&&w<x);l-=M=S>>3,b&=(1<<(S-=M<<3))-1,n.next_in=l,n.next_out=w,n.avail_in=l<p?p-l+5:5-(l-p),n.avail_out=w<x?x-w+257:257-(w-x),i.hold=b,i.bits=S}},{}],49:[function(e,f,a){var n=e("../utils/common"),r=e("./adler32"),i=e("./crc32"),l=e("./inffast"),p=e("./inftrees"),w=1,v=2,x=0,u=-2,_=1,o=852,g=592;function h(k){return(k>>>24&255)+(k>>>8&65280)+((65280&k)<<8)+((255&k)<<24)}function b(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function S(k){var B;return k&&k.state?(B=k.state,k.total_in=k.total_out=B.total=0,k.msg="",B.wrap&&(k.adler=1&B.wrap),B.mode=_,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new n.Buf32(o),B.distcode=B.distdyn=new n.Buf32(g),B.sane=1,B.back=-1,x):u}function E(k){var B;return k&&k.state?((B=k.state).wsize=0,B.whave=0,B.wnext=0,S(k)):u}function z(k,B){var s,j;return k&&k.state?(j=k.state,B<0?(s=0,B=-B):(s=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15<B)?u:(j.window!==null&&j.wbits!==B&&(j.window=null),j.wrap=s,j.wbits=B,E(k))):u}function R(k,B){var s,j;return k?(j=new b,(k.state=j).window=null,(s=z(k,B))!==x&&(k.state=null),s):u}var P,$,F=!0;function M(k){if(F){var B;for(P=new n.Buf32(512),$=new n.Buf32(32),B=0;B<144;)k.lens[B++]=8;for(;B<256;)k.lens[B++]=9;for(;B<280;)k.lens[B++]=7;for(;B<288;)k.lens[B++]=8;for(p(w,k.lens,0,288,P,0,k.work,{bits:9}),B=0;B<32;)k.lens[B++]=5;p(v,k.lens,0,32,$,0,k.work,{bits:5}),F=!1}k.lencode=P,k.lenbits=9,k.distcode=$,k.distbits=5}function Y(k,B,s,j){var Q,U=k.state;return U.window===null&&(U.wsize=1<<U.wbits,U.wnext=0,U.whave=0,U.window=new n.Buf8(U.wsize)),j>=U.wsize?(n.arraySet(U.window,B,s-U.wsize,U.wsize,0),U.wnext=0,U.whave=U.wsize):(j<(Q=U.wsize-U.wnext)&&(Q=j),n.arraySet(U.window,B,s-j,Q,U.wnext),(j-=Q)?(n.arraySet(U.window,B,s-j,j,0),U.wnext=j,U.whave=U.wsize):(U.wnext+=Q,U.wnext===U.wsize&&(U.wnext=0),U.whave<U.wsize&&(U.whave+=Q))),0}a.inflateReset=E,a.inflateReset2=z,a.inflateResetKeep=S,a.inflateInit=function(k){return R(k,15)},a.inflateInit2=R,a.inflate=function(k,B){var s,j,Q,U,tt,W,q,O,I,J,K,X,st,lt,et,nt,ct,at,dt,ht,t,D,T,y,m=0,A=new n.Buf8(4),N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!k||!k.state||!k.output||!k.input&&k.avail_in!==0)return u;(s=k.state).mode===12&&(s.mode=13),tt=k.next_out,Q=k.output,q=k.avail_out,U=k.next_in,j=k.input,W=k.avail_in,O=s.hold,I=s.bits,J=W,K=q,D=x;t:for(;;)switch(s.mode){case _:if(s.wrap===0){s.mode=13;break}for(;I<16;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}if(2&s.wrap&&O===35615){A[s.check=0]=255&O,A[1]=O>>>8&255,s.check=i(s.check,A,2,0),I=O=0,s.mode=2;break}if(s.flags=0,s.head&&(s.head.done=!1),!(1&s.wrap)||(((255&O)<<8)+(O>>8))%31){k.msg="incorrect header check",s.mode=30;break}if((15&O)!=8){k.msg="unknown compression method",s.mode=30;break}if(I-=4,t=8+(15&(O>>>=4)),s.wbits===0)s.wbits=t;else if(t>s.wbits){k.msg="invalid window size",s.mode=30;break}s.dmax=1<<t,k.adler=s.check=1,s.mode=512&O?10:12,I=O=0;break;case 2:for(;I<16;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}if(s.flags=O,(255&s.flags)!=8){k.msg="unknown compression method",s.mode=30;break}if(57344&s.flags){k.msg="unknown header flags set",s.mode=30;break}s.head&&(s.head.text=O>>8&1),512&s.flags&&(A[0]=255&O,A[1]=O>>>8&255,s.check=i(s.check,A,2,0)),I=O=0,s.mode=3;case 3:for(;I<32;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}s.head&&(s.head.time=O),512&s.flags&&(A[0]=255&O,A[1]=O>>>8&255,A[2]=O>>>16&255,A[3]=O>>>24&255,s.check=i(s.check,A,4,0)),I=O=0,s.mode=4;case 4:for(;I<16;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}s.head&&(s.head.xflags=255&O,s.head.os=O>>8),512&s.flags&&(A[0]=255&O,A[1]=O>>>8&255,s.check=i(s.check,A,2,0)),I=O=0,s.mode=5;case 5:if(1024&s.flags){for(;I<16;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}s.length=O,s.head&&(s.head.extra_len=O),512&s.flags&&(A[0]=255&O,A[1]=O>>>8&255,s.check=i(s.check,A,2,0)),I=O=0}else s.head&&(s.head.extra=null);s.mode=6;case 6:if(1024&s.flags&&(W<(X=s.length)&&(X=W),X&&(s.head&&(t=s.head.extra_len-s.length,s.head.extra||(s.head.extra=new Array(s.head.extra_len)),n.arraySet(s.head.extra,j,U,X,t)),512&s.flags&&(s.check=i(s.check,j,X,U)),W-=X,U+=X,s.length-=X),s.length))break t;s.length=0,s.mode=7;case 7:if(2048&s.flags){if(W===0)break t;for(X=0;t=j[U+X++],s.head&&t&&s.length<65536&&(s.head.name+=String.fromCharCode(t)),t&&X<W;);if(512&s.flags&&(s.check=i(s.check,j,X,U)),W-=X,U+=X,t)break t}else s.head&&(s.head.name=null);s.length=0,s.mode=8;case 8:if(4096&s.flags){if(W===0)break t;for(X=0;t=j[U+X++],s.head&&t&&s.length<65536&&(s.head.comment+=String.fromCharCode(t)),t&&X<W;);if(512&s.flags&&(s.check=i(s.check,j,X,U)),W-=X,U+=X,t)break t}else s.head&&(s.head.comment=null);s.mode=9;case 9:if(512&s.flags){for(;I<16;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}if(O!==(65535&s.check)){k.msg="header crc mismatch",s.mode=30;break}I=O=0}s.head&&(s.head.hcrc=s.flags>>9&1,s.head.done=!0),k.adler=s.check=0,s.mode=12;break;case 10:for(;I<32;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}k.adler=s.check=h(O),I=O=0,s.mode=11;case 11:if(s.havedict===0)return k.next_out=tt,k.avail_out=q,k.next_in=U,k.avail_in=W,s.hold=O,s.bits=I,2;k.adler=s.check=1,s.mode=12;case 12:if(B===5||B===6)break t;case 13:if(s.last){O>>>=7&I,I-=7&I,s.mode=27;break}for(;I<3;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}switch(s.last=1&O,I-=1,3&(O>>>=1)){case 0:s.mode=14;break;case 1:if(M(s),s.mode=20,B!==6)break;O>>>=2,I-=2;break t;case 2:s.mode=17;break;case 3:k.msg="invalid block type",s.mode=30}O>>>=2,I-=2;break;case 14:for(O>>>=7&I,I-=7&I;I<32;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}if((65535&O)!=(O>>>16^65535)){k.msg="invalid stored block lengths",s.mode=30;break}if(s.length=65535&O,I=O=0,s.mode=15,B===6)break t;case 15:s.mode=16;case 16:if(X=s.length){if(W<X&&(X=W),q<X&&(X=q),X===0)break t;n.arraySet(Q,j,U,X,tt),W-=X,U+=X,q-=X,tt+=X,s.length-=X;break}s.mode=12;break;case 17:for(;I<14;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}if(s.nlen=257+(31&O),O>>>=5,I-=5,s.ndist=1+(31&O),O>>>=5,I-=5,s.ncode=4+(15&O),O>>>=4,I-=4,286<s.nlen||30<s.ndist){k.msg="too many length or distance symbols",s.mode=30;break}s.have=0,s.mode=18;case 18:for(;s.have<s.ncode;){for(;I<3;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}s.lens[N[s.have++]]=7&O,O>>>=3,I-=3}for(;s.have<19;)s.lens[N[s.have++]]=0;if(s.lencode=s.lendyn,s.lenbits=7,T={bits:s.lenbits},D=p(0,s.lens,0,19,s.lencode,0,s.work,T),s.lenbits=T.bits,D){k.msg="invalid code lengths set",s.mode=30;break}s.have=0,s.mode=19;case 19:for(;s.have<s.nlen+s.ndist;){for(;nt=(m=s.lencode[O&(1<<s.lenbits)-1])>>>16&255,ct=65535&m,!((et=m>>>24)<=I);){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}if(ct<16)O>>>=et,I-=et,s.lens[s.have++]=ct;else{if(ct===16){for(y=et+2;I<y;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}if(O>>>=et,I-=et,s.have===0){k.msg="invalid bit length repeat",s.mode=30;break}t=s.lens[s.have-1],X=3+(3&O),O>>>=2,I-=2}else if(ct===17){for(y=et+3;I<y;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}I-=et,t=0,X=3+(7&(O>>>=et)),O>>>=3,I-=3}else{for(y=et+7;I<y;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}I-=et,t=0,X=11+(127&(O>>>=et)),O>>>=7,I-=7}if(s.have+X>s.nlen+s.ndist){k.msg="invalid bit length repeat",s.mode=30;break}for(;X--;)s.lens[s.have++]=t}}if(s.mode===30)break;if(s.lens[256]===0){k.msg="invalid code -- missing end-of-block",s.mode=30;break}if(s.lenbits=9,T={bits:s.lenbits},D=p(w,s.lens,0,s.nlen,s.lencode,0,s.work,T),s.lenbits=T.bits,D){k.msg="invalid literal/lengths set",s.mode=30;break}if(s.distbits=6,s.distcode=s.distdyn,T={bits:s.distbits},D=p(v,s.lens,s.nlen,s.ndist,s.distcode,0,s.work,T),s.distbits=T.bits,D){k.msg="invalid distances set",s.mode=30;break}if(s.mode=20,B===6)break t;case 20:s.mode=21;case 21:if(6<=W&&258<=q){k.next_out=tt,k.avail_out=q,k.next_in=U,k.avail_in=W,s.hold=O,s.bits=I,l(k,K),tt=k.next_out,Q=k.output,q=k.avail_out,U=k.next_in,j=k.input,W=k.avail_in,O=s.hold,I=s.bits,s.mode===12&&(s.back=-1);break}for(s.back=0;nt=(m=s.lencode[O&(1<<s.lenbits)-1])>>>16&255,ct=65535&m,!((et=m>>>24)<=I);){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}if(nt&&(240&nt)==0){for(at=et,dt=nt,ht=ct;nt=(m=s.lencode[ht+((O&(1<<at+dt)-1)>>at)])>>>16&255,ct=65535&m,!(at+(et=m>>>24)<=I);){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}O>>>=at,I-=at,s.back+=at}if(O>>>=et,I-=et,s.back+=et,s.length=ct,nt===0){s.mode=26;break}if(32&nt){s.back=-1,s.mode=12;break}if(64&nt){k.msg="invalid literal/length code",s.mode=30;break}s.extra=15&nt,s.mode=22;case 22:if(s.extra){for(y=s.extra;I<y;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}s.length+=O&(1<<s.extra)-1,O>>>=s.extra,I-=s.extra,s.back+=s.extra}s.was=s.length,s.mode=23;case 23:for(;nt=(m=s.distcode[O&(1<<s.distbits)-1])>>>16&255,ct=65535&m,!((et=m>>>24)<=I);){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}if((240&nt)==0){for(at=et,dt=nt,ht=ct;nt=(m=s.distcode[ht+((O&(1<<at+dt)-1)>>at)])>>>16&255,ct=65535&m,!(at+(et=m>>>24)<=I);){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}O>>>=at,I-=at,s.back+=at}if(O>>>=et,I-=et,s.back+=et,64&nt){k.msg="invalid distance code",s.mode=30;break}s.offset=ct,s.extra=15&nt,s.mode=24;case 24:if(s.extra){for(y=s.extra;I<y;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}s.offset+=O&(1<<s.extra)-1,O>>>=s.extra,I-=s.extra,s.back+=s.extra}if(s.offset>s.dmax){k.msg="invalid distance too far back",s.mode=30;break}s.mode=25;case 25:if(q===0)break t;if(X=K-q,s.offset>X){if((X=s.offset-X)>s.whave&&s.sane){k.msg="invalid distance too far back",s.mode=30;break}st=X>s.wnext?(X-=s.wnext,s.wsize-X):s.wnext-X,X>s.length&&(X=s.length),lt=s.window}else lt=Q,st=tt-s.offset,X=s.length;for(q<X&&(X=q),q-=X,s.length-=X;Q[tt++]=lt[st++],--X;);s.length===0&&(s.mode=21);break;case 26:if(q===0)break t;Q[tt++]=s.length,q--,s.mode=21;break;case 27:if(s.wrap){for(;I<32;){if(W===0)break t;W--,O|=j[U++]<<I,I+=8}if(K-=q,k.total_out+=K,s.total+=K,K&&(k.adler=s.check=s.flags?i(s.check,Q,K,tt-K):r(s.check,Q,K,tt-K)),K=q,(s.flags?O:h(O))!==s.check){k.msg="incorrect data check",s.mode=30;break}I=O=0}s.mode=28;case 28:if(s.wrap&&s.flags){for(;I<32;){if(W===0)break t;W--,O+=j[U++]<<I,I+=8}if(O!==(4294967295&s.total)){k.msg="incorrect length check",s.mode=30;break}I=O=0}s.mode=29;case 29:D=1;break t;case 30:D=-3;break t;case 31:return-4;default:return u}return k.next_out=tt,k.avail_out=q,k.next_in=U,k.avail_in=W,s.hold=O,s.bits=I,(s.wsize||K!==k.avail_out&&s.mode<30&&(s.mode<27||B!==4))&&Y(k,k.output,k.next_out,K-k.avail_out)?(s.mode=31,-4):(J-=k.avail_in,K-=k.avail_out,k.total_in+=J,k.total_out+=K,s.total+=K,s.wrap&&K&&(k.adler=s.check=s.flags?i(s.check,Q,K,k.next_out-K):r(s.check,Q,K,k.next_out-K)),k.data_type=s.bits+(s.last?64:0)+(s.mode===12?128:0)+(s.mode===20||s.mode===15?256:0),(J==0&&K===0||B===4)&&D===x&&(D=-5),D)},a.inflateEnd=function(k){if(!k||!k.state)return u;var B=k.state;return B.window&&(B.window=null),k.state=null,x},a.inflateGetHeader=function(k,B){var s;return k&&k.state?(2&(s=k.state).wrap)==0?u:((s.head=B).done=!1,x):u},a.inflateSetDictionary=function(k,B){var s,j=B.length;return k&&k.state?(s=k.state).wrap!==0&&s.mode!==11?u:s.mode===11&&r(1,B,j,0)!==s.check?-3:Y(k,B,j,j)?(s.mode=31,-4):(s.havedict=1,x):u},a.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,f,a){var n=e("../utils/common"),r=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],i=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],p=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];f.exports=function(w,v,x,u,_,o,g,h){var b,S,E,z,R,P,$,F,M,Y=h.bits,k=0,B=0,s=0,j=0,Q=0,U=0,tt=0,W=0,q=0,O=0,I=null,J=0,K=new n.Buf16(16),X=new n.Buf16(16),st=null,lt=0;for(k=0;k<=15;k++)K[k]=0;for(B=0;B<u;B++)K[v[x+B]]++;for(Q=Y,j=15;1<=j&&K[j]===0;j--);if(j<Q&&(Q=j),j===0)return _[o++]=20971520,_[o++]=20971520,h.bits=1,0;for(s=1;s<j&&K[s]===0;s++);for(Q<s&&(Q=s),k=W=1;k<=15;k++)if(W<<=1,(W-=K[k])<0)return-1;if(0<W&&(w===0||j!==1))return-1;for(X[1]=0,k=1;k<15;k++)X[k+1]=X[k]+K[k];for(B=0;B<u;B++)v[x+B]!==0&&(g[X[v[x+B]]++]=B);if(P=w===0?(I=st=g,19):w===1?(I=r,J-=257,st=i,lt-=257,256):(I=l,st=p,-1),k=s,R=o,tt=B=O=0,E=-1,z=(q=1<<(U=Q))-1,w===1&&852<q||w===2&&592<q)return 1;for(;;){for($=k-tt,M=g[B]<P?(F=0,g[B]):g[B]>P?(F=st[lt+g[B]],I[J+g[B]]):(F=96,0),b=1<<k-tt,s=S=1<<U;_[R+(O>>tt)+(S-=b)]=$<<24|F<<16|M|0,S!==0;);for(b=1<<k-1;O&b;)b>>=1;if(b!==0?(O&=b-1,O+=b):O=0,B++,--K[k]==0){if(k===j)break;k=v[x+g[B]]}if(Q<k&&(O&z)!==E){for(tt===0&&(tt=Q),R+=s,W=1<<(U=k-tt);U+tt<j&&!((W-=K[U+tt])<=0);)U++,W<<=1;if(q+=1<<U,w===1&&852<q||w===2&&592<q)return 1;_[E=O&z]=Q<<24|U<<16|R-o|0}}return O!==0&&(_[R+O]=k-tt<<24|64<<16|0),h.bits=Q,0}},{"../utils/common":41}],51:[function(e,f,a){f.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,f,a){var n=e("../utils/common"),r=0,i=1;function l(m){for(var A=m.length;0<=--A;)m[A]=0}var p=0,w=29,v=256,x=v+1+w,u=30,_=19,o=2*x+1,g=15,h=16,b=7,S=256,E=16,z=17,R=18,P=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],$=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],F=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Y=new Array(2*(x+2));l(Y);var k=new Array(2*u);l(k);var B=new Array(512);l(B);var s=new Array(256);l(s);var j=new Array(w);l(j);var Q,U,tt,W=new Array(u);function q(m,A,N,L,C){this.static_tree=m,this.extra_bits=A,this.extra_base=N,this.elems=L,this.max_length=C,this.has_stree=m&&m.length}function O(m,A){this.dyn_tree=m,this.max_code=0,this.stat_desc=A}function I(m){return m<256?B[m]:B[256+(m>>>7)]}function J(m,A){m.pending_buf[m.pending++]=255&A,m.pending_buf[m.pending++]=A>>>8&255}function K(m,A,N){m.bi_valid>h-N?(m.bi_buf|=A<<m.bi_valid&65535,J(m,m.bi_buf),m.bi_buf=A>>h-m.bi_valid,m.bi_valid+=N-h):(m.bi_buf|=A<<m.bi_valid&65535,m.bi_valid+=N)}function X(m,A,N){K(m,N[2*A],N[2*A+1])}function st(m,A){for(var N=0;N|=1&m,m>>>=1,N<<=1,0<--A;);return N>>>1}function lt(m,A,N){var L,C,Z=new Array(g+1),G=0;for(L=1;L<=g;L++)Z[L]=G=G+N[L-1]<<1;for(C=0;C<=A;C++){var H=m[2*C+1];H!==0&&(m[2*C]=st(Z[H]++,H))}}function et(m){var A;for(A=0;A<x;A++)m.dyn_ltree[2*A]=0;for(A=0;A<u;A++)m.dyn_dtree[2*A]=0;for(A=0;A<_;A++)m.bl_tree[2*A]=0;m.dyn_ltree[2*S]=1,m.opt_len=m.static_len=0,m.last_lit=m.matches=0}function nt(m){8<m.bi_valid?J(m,m.bi_buf):0<m.bi_valid&&(m.pending_buf[m.pending++]=m.bi_buf),m.bi_buf=0,m.bi_valid=0}function ct(m,A,N,L){var C=2*A,Z=2*N;return m[C]<m[Z]||m[C]===m[Z]&&L[A]<=L[N]}function at(m,A,N){for(var L=m.heap[N],C=N<<1;C<=m.heap_len&&(C<m.heap_len&&ct(A,m.heap[C+1],m.heap[C],m.depth)&&C++,!ct(A,L,m.heap[C],m.depth));)m.heap[N]=m.heap[C],N=C,C<<=1;m.heap[N]=L}function dt(m,A,N){var L,C,Z,G,H=0;if(m.last_lit!==0)for(;L=m.pending_buf[m.d_buf+2*H]<<8|m.pending_buf[m.d_buf+2*H+1],C=m.pending_buf[m.l_buf+H],H++,L===0?X(m,C,A):(X(m,(Z=s[C])+v+1,A),(G=P[Z])!==0&&K(m,C-=j[Z],G),X(m,Z=I(--L),N),(G=$[Z])!==0&&K(m,L-=W[Z],G)),H<m.last_lit;);X(m,S,A)}function ht(m,A){var N,L,C,Z=A.dyn_tree,G=A.stat_desc.static_tree,H=A.stat_desc.has_stree,V=A.stat_desc.elems,it=-1;for(m.heap_len=0,m.heap_max=o,N=0;N<V;N++)Z[2*N]!==0?(m.heap[++m.heap_len]=it=N,m.depth[N]=0):Z[2*N+1]=0;for(;m.heap_len<2;)Z[2*(C=m.heap[++m.heap_len]=it<2?++it:0)]=1,m.depth[C]=0,m.opt_len--,H&&(m.static_len-=G[2*C+1]);for(A.max_code=it,N=m.heap_len>>1;1<=N;N--)at(m,Z,N);for(C=V;N=m.heap[1],m.heap[1]=m.heap[m.heap_len--],at(m,Z,1),L=m.heap[1],m.heap[--m.heap_max]=N,m.heap[--m.heap_max]=L,Z[2*C]=Z[2*N]+Z[2*L],m.depth[C]=(m.depth[N]>=m.depth[L]?m.depth[N]:m.depth[L])+1,Z[2*N+1]=Z[2*L+1]=C,m.heap[1]=C++,at(m,Z,1),2<=m.heap_len;);m.heap[--m.heap_max]=m.heap[1],(function(rt,ft){var bt,pt,yt,ot,St,Tt,mt=ft.dyn_tree,Gt=ft.max_code,Ae=ft.stat_desc.static_tree,Ce=ft.stat_desc.has_stree,Ie=ft.stat_desc.extra_bits,Yt=ft.stat_desc.extra_base,vt=ft.stat_desc.max_length,Et=0;for(ot=0;ot<=g;ot++)rt.bl_count[ot]=0;for(mt[2*rt.heap[rt.heap_max]+1]=0,bt=rt.heap_max+1;bt<o;bt++)vt<(ot=mt[2*mt[2*(pt=rt.heap[bt])+1]+1]+1)&&(ot=vt,Et++),mt[2*pt+1]=ot,Gt<pt||(rt.bl_count[ot]++,St=0,Yt<=pt&&(St=Ie[pt-Yt]),Tt=mt[2*pt],rt.opt_len+=Tt*(ot+St),Ce&&(rt.static_len+=Tt*(Ae[2*pt+1]+St)));if(Et!==0){do{for(ot=vt-1;rt.bl_count[ot]===0;)ot--;rt.bl_count[ot]--,rt.bl_count[ot+1]+=2,rt.bl_count[vt]--,Et-=2}while(0<Et);for(ot=vt;ot!==0;ot--)for(pt=rt.bl_count[ot];pt!==0;)Gt<(yt=rt.heap[--bt])||(mt[2*yt+1]!==ot&&(rt.opt_len+=(ot-mt[2*yt+1])*mt[2*yt],mt[2*yt+1]=ot),pt--)}})(m,A),lt(Z,it,m.bl_count)}function t(m,A,N){var L,C,Z=-1,G=A[1],H=0,V=7,it=4;for(G===0&&(V=138,it=3),A[2*(N+1)+1]=65535,L=0;L<=N;L++)C=G,G=A[2*(L+1)+1],++H<V&&C===G||(H<it?m.bl_tree[2*C]+=H:C!==0?(C!==Z&&m.bl_tree[2*C]++,m.bl_tree[2*E]++):H<=10?m.bl_tree[2*z]++:m.bl_tree[2*R]++,Z=C,it=(H=0)===G?(V=138,3):C===G?(V=6,3):(V=7,4))}function D(m,A,N){var L,C,Z=-1,G=A[1],H=0,V=7,it=4;for(G===0&&(V=138,it=3),L=0;L<=N;L++)if(C=G,G=A[2*(L+1)+1],!(++H<V&&C===G)){if(H<it)for(;X(m,C,m.bl_tree),--H!=0;);else C!==0?(C!==Z&&(X(m,C,m.bl_tree),H--),X(m,E,m.bl_tree),K(m,H-3,2)):H<=10?(X(m,z,m.bl_tree),K(m,H-3,3)):(X(m,R,m.bl_tree),K(m,H-11,7));Z=C,it=(H=0)===G?(V=138,3):C===G?(V=6,3):(V=7,4)}}l(W);var T=!1;function y(m,A,N,L){K(m,(p<<1)+(L?1:0),3),(function(C,Z,G,H){nt(C),J(C,G),J(C,~G),n.arraySet(C.pending_buf,C.window,Z,G,C.pending),C.pending+=G})(m,A,N)}a._tr_init=function(m){T||((function(){var A,N,L,C,Z,G=new Array(g+1);for(C=L=0;C<w-1;C++)for(j[C]=L,A=0;A<1<<P[C];A++)s[L++]=C;for(s[L-1]=C,C=Z=0;C<16;C++)for(W[C]=Z,A=0;A<1<<$[C];A++)B[Z++]=C;for(Z>>=7;C<u;C++)for(W[C]=Z<<7,A=0;A<1<<$[C]-7;A++)B[256+Z++]=C;for(N=0;N<=g;N++)G[N]=0;for(A=0;A<=143;)Y[2*A+1]=8,A++,G[8]++;for(;A<=255;)Y[2*A+1]=9,A++,G[9]++;for(;A<=279;)Y[2*A+1]=7,A++,G[7]++;for(;A<=287;)Y[2*A+1]=8,A++,G[8]++;for(lt(Y,x+1,G),A=0;A<u;A++)k[2*A+1]=5,k[2*A]=st(A,5);Q=new q(Y,P,v+1,x,g),U=new q(k,$,0,u,g),tt=new q(new Array(0),F,0,_,b)})(),T=!0),m.l_desc=new O(m.dyn_ltree,Q),m.d_desc=new O(m.dyn_dtree,U),m.bl_desc=new O(m.bl_tree,tt),m.bi_buf=0,m.bi_valid=0,et(m)},a._tr_stored_block=y,a._tr_flush_block=function(m,A,N,L){var C,Z,G=0;0<m.level?(m.strm.data_type===2&&(m.strm.data_type=(function(H){var V,it=4093624447;for(V=0;V<=31;V++,it>>>=1)if(1&it&&H.dyn_ltree[2*V]!==0)return r;if(H.dyn_ltree[18]!==0||H.dyn_ltree[20]!==0||H.dyn_ltree[26]!==0)return i;for(V=32;V<v;V++)if(H.dyn_ltree[2*V]!==0)return i;return r})(m)),ht(m,m.l_desc),ht(m,m.d_desc),G=(function(H){var V;for(t(H,H.dyn_ltree,H.l_desc.max_code),t(H,H.dyn_dtree,H.d_desc.max_code),ht(H,H.bl_desc),V=_-1;3<=V&&H.bl_tree[2*M[V]+1]===0;V--);return H.opt_len+=3*(V+1)+5+5+4,V})(m),C=m.opt_len+3+7>>>3,(Z=m.static_len+3+7>>>3)<=C&&(C=Z)):C=Z=N+5,N+4<=C&&A!==-1?y(m,A,N,L):m.strategy===4||Z===C?(K(m,2+(L?1:0),3),dt(m,Y,k)):(K(m,4+(L?1:0),3),(function(H,V,it,rt){var ft;for(K(H,V-257,5),K(H,it-1,5),K(H,rt-4,4),ft=0;ft<rt;ft++)K(H,H.bl_tree[2*M[ft]+1],3);D(H,H.dyn_ltree,V-1),D(H,H.dyn_dtree,it-1)})(m,m.l_desc.max_code+1,m.d_desc.max_code+1,G+1),dt(m,m.dyn_ltree,m.dyn_dtree)),et(m),L&&nt(m)},a._tr_tally=function(m,A,N){return m.pending_buf[m.d_buf+2*m.last_lit]=A>>>8&255,m.pending_buf[m.d_buf+2*m.last_lit+1]=255&A,m.pending_buf[m.l_buf+m.last_lit]=255&N,m.last_lit++,A===0?m.dyn_ltree[2*N]++:(m.matches++,A--,m.dyn_ltree[2*(s[N]+v+1)]++,m.dyn_dtree[2*I(A)]++),m.last_lit===m.lit_bufsize-1},a._tr_align=function(m){K(m,2,3),X(m,S,Y),(function(A){A.bi_valid===16?(J(A,A.bi_buf),A.bi_buf=0,A.bi_valid=0):8<=A.bi_valid&&(A.pending_buf[A.pending++]=255&A.bi_buf,A.bi_buf>>=8,A.bi_valid-=8)})(m)}},{"../utils/common":41}],53:[function(e,f,a){f.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,f,a){(function(n){(function(r,i){if(!r.setImmediate){var l,p,w,v,x=1,u={},_=!1,o=r.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(r);g=g&&g.setTimeout?g:r,l={}.toString.call(r.process)==="[object process]"?function(E){process.nextTick(function(){b(E)})}:(function(){if(r.postMessage&&!r.importScripts){var E=!0,z=r.onmessage;return r.onmessage=function(){E=!1},r.postMessage("","*"),r.onmessage=z,E}})()?(v="setImmediate$"+Math.random()+"$",r.addEventListener?r.addEventListener("message",S,!1):r.attachEvent("onmessage",S),function(E){r.postMessage(v+E,"*")}):r.MessageChannel?((w=new MessageChannel).port1.onmessage=function(E){b(E.data)},function(E){w.port2.postMessage(E)}):o&&"onreadystatechange"in o.createElement("script")?(p=o.documentElement,function(E){var z=o.createElement("script");z.onreadystatechange=function(){b(E),z.onreadystatechange=null,p.removeChild(z),z=null},p.appendChild(z)}):function(E){setTimeout(b,0,E)},g.setImmediate=function(E){typeof E!="function"&&(E=new Function(""+E));for(var z=new Array(arguments.length-1),R=0;R<z.length;R++)z[R]=arguments[R+1];var P={callback:E,args:z};return u[x]=P,l(x),x++},g.clearImmediate=h}function h(E){delete u[E]}function b(E){if(_)setTimeout(b,0,E);else{var z=u[E];if(z){_=!0;try{(function(R){var P=R.callback,$=R.args;switch($.length){case 0:P();break;case 1:P($[0]);break;case 2:P($[0],$[1]);break;case 3:P($[0],$[1],$[2]);break;default:P.apply(i,$)}})(z)}finally{h(E),_=!1}}}}function S(E){E.source===r&&typeof E.data=="string"&&E.data.indexOf(v)===0&&b(+E.data.slice(v.length))}})(typeof self>"u"?n===void 0?this:n:self)}).call(this,typeof zt<"u"?zt:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Rt)),Rt.exports}var ar=sr();const or=ir(ar),cr=/<xi:include\b[^>]*\bhref\s*=\s*(?:"([^"]+)"|'([^']+)')[^>]*\/>/g;function lr(d){const c=d.lastIndexOf("/");return c>=0?d.slice(0,c):""}function ur(d){return d.replace(/\\/g,"/").replace(/^\.\//,"")}function fr(d,c,e){const f=lr(c),a=[d,`${d}.ptx`,`${d}.xml`,f?`${f}/${d}`:null,f?`${f}/${d}.ptx`:`${d}.ptx`,f?`${f}/${d}.xml`:`${d}.xml`].filter(n=>n!==null);for(const n of a){const r=ur(n);if(r in e)return r}return null}function hr(d){return d.replace(/^\s*<\?xml[^?]*\?>\s*/,"")}function ge(d,c,e,f=5){let a=0;const n=[],r=[],i=(p,w)=>{let v=!1;return{output:p.replace(cr,(u,_,o)=>{const g=_??o??"",h=fr(g,w,e);return h?r.includes(h)?u:(v=!0,a+=1,hr(e[h])):(n.includes(g)||n.push(g),u)}),changed:v}};let l=d;for(let p=0;p<f;p+=1){r.push(c);const{output:w,changed:v}=i(l,c);if(r.pop(),l=w,!v)break}return{expandedText:l,expandedCount:a,missingIncludes:n}}const dr=/<(pretext|book|article)\b/;function pr(d){const c=Object.keys(d).filter(f=>/\.(ptx|xml)$/i.test(f)).sort();return c.length===0?null:c.find(f=>dr.test(d[f]))??c[0]}const ne=/([a-zA-Z_:][\w:.-]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;function Ct(d){const c={};let e;for(ne.lastIndex=0;(e=ne.exec(d))!==null;)c[e[1]]=e[2]??e[3]??"";return c}function _e(d){const c=[];let e=0;const f=d.length;for(;e<f;){const a=d.indexOf("<",e);if(a<0)break;if(d.startsWith("<!--",a)){const o=d.indexOf("-->",a+4);e=o<0?f:o+3;continue}if(d.startsWith("<![CDATA[",a)){const o=d.indexOf("]]>",a+9);e=o<0?f:o+3;continue}if(d.startsWith("<?",a)){const o=d.indexOf("?>",a+2);e=o<0?f:o+2;continue}if(d.startsWith("<!",a)){const o=d.indexOf(">",a+2);e=o<0?f:o+1;continue}let n=a+1,r=!1;d[n]==="/"&&(r=!0,n+=1);const i=/^[a-zA-Z_:][\w:.-]*/.exec(d.slice(n));if(!i){e=a+1;continue}const l=i[0];n+=l.length;let p=n,w=null;for(;n<f;){const o=d[n];if(w){o===w&&(w=null),n+=1;continue}if(o==='"'||o==="'"){w=o,n+=1;continue}if(o===">")break;n+=1}if(n>=f)break;const v=n+1,x=d.slice(p,n),u=!r&&x.trimEnd().endsWith("/"),_=u?x.replace(/\/\s*$/,""):x;r?c.push({kind:"close",name:l,pos:a,end:v}):u?c.push({kind:"selfclose",name:l,attrs:_,pos:a,end:v}):c.push({kind:"open",name:l,attrs:_,pos:a,end:v}),e=v}return c}function It(d,c){const e=_e(d),f=[];let a=0,n=null;for(const r of e){if(r.kind==="selfclose"){a===0&&r.name===c&&f.push({name:c,start:r.pos,startTagEnd:r.end,contentEnd:r.end,end:r.end,inner:"",outer:d.slice(r.pos,r.end),attributes:Ct(r.attrs)});continue}if(r.kind==="open"){a===0&&r.name===c&&!n&&(n=r),a+=1;continue}a-=1,a<0&&(a=0),n&&a===0&&r.name===c&&(f.push({name:c,start:n.pos,startTagEnd:n.end,contentEnd:r.pos,end:r.end,inner:d.slice(n.end,r.pos),outer:d.slice(n.pos,r.end),attributes:Ct(n.attrs)}),n=null)}return f}function wt(d,c){return It(d,c)[0]??null}function xt(d,c){const e=_e(d);let f=0,a=null,n=-1;for(const r of e){if(r.kind==="selfclose"){if(!a&&r.name===c)return{name:c,start:r.pos,startTagEnd:r.end,contentEnd:r.end,end:r.end,inner:"",outer:d.slice(r.pos,r.end),attributes:Ct(r.attrs)};continue}if(r.kind==="open"){!a&&r.name===c&&(a=r,n=f),f+=1;continue}if(f-=1,f<0&&(f=0),a&&r.name===c&&f===n){const i=a.attrs;return{name:c,start:a.pos,startTagEnd:a.end,contentEnd:r.pos,end:r.end,inner:d.slice(a.end,r.pos),outer:d.slice(a.pos,r.end),attributes:Ct(i)}}}return null}function be(d){return xt(d,"book")?"book":xt(d,"article")?"article":xt(d,"chapter")?"book":"article"}function ye(d){const{mainSource:c,publication:e,outputBase:f="output"}=d;return`<?xml version="1.0" encoding="UTF-8"?>
32
- <project ptx-version="2">
33
- <targets>
34
- <target name="web">
35
- <format>html</format>
36
- <source>${c}</source>
37
- <publication>${e}</publication>
38
- <output-dir>${f}/web</output-dir>
39
- </target>
40
- <target name="print">
41
- <format>pdf</format>
42
- <source>${c}</source>
43
- <publication>${e}</publication>
44
- <output-dir>${f}/print</output-dir>
45
- </target>
46
- </targets>
47
- </project>
48
- `}function ve(){return`<?xml version="1.0" encoding="UTF-8"?>
49
- <publication>
50
- <source>
51
- <directories external="external" generated="generated"/>
52
- </source>
53
- <common>
54
- <chunking level="1"/>
55
- </common>
56
- </publication>
57
- `}function mr(){return`<?xml version="1.0" encoding="UTF-8"?>
58
- `}const gr="http://www.w3.org/2001/XInclude";function we(d){return d.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)}function $t(d,c){const e=String(c).length;return String(d).padStart(Math.max(e,2),"0")}function Ut(d,c){const e=[...c].sort((n,r)=>n.start-r.start);let f="",a=0;for(const n of e)f+=d.slice(a,n.start),f+=n.replacement,a=n.end;return f+=d.slice(a),f}function Mt(d){return d.replace(/<(pretext|book|article|chapter)\b([^>]*)>/,(c,e,f)=>/\bxmlns:xi\s*=/.test(f)?c:`<${e}${f} xmlns:xi="${gr}">`)}function Wt(d){return d.startsWith("<?xml")?d:mr()+d}function Kt(d){return d.trim().replace(/[^a-zA-Z0-9\-_]+/g,"-").replace(/^[^a-zA-Z_]+/,"").replace(/-+$/,"")}class _r{used=new Set;claim(c){let e=c,f=2;for(;this.used.has(e);)e=`${c}-${f}`,f+=1;return this.used.add(e),e}has(c){return this.used.has(c)}}function Pt(d,c,e){const f=d.slice(0,c),a=d.slice(c);return/\bxml:id\s*=\s*(?:"[^"]*"|'[^']*')/.test(f)?f.replace(/\bxml:id\s*=\s*(?:"[^"]*"|'[^']*')/,`xml:id="${e}"`)+a:f.replace(/^<([a-zA-Z_:][\w:.-]*)/,`<$1 xml:id="${e}"`)+a}function Ft(d){const c=wt(d,"title");return c?c.inner.replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim():""}function Bt(d,c,e){const f=d.attributes["xml:id"];if(f){const a=Kt(f)||e,n=c.claim(a);return n!==f?{ref:n,renamedFrom:f,generated:!1}:{ref:n,generated:!1}}return{ref:c.claim(e),generated:!0}}function Dt(d,c,e,f){c.renamedFrom!==void 0?d.push({action:"anomaly",severity:"warning",kind:"structure",category:"renamed_xml_id",macro:e,occurrences:1,message:`<${e}> xml:id \`${c.renamedFrom}\` is not a valid ref (or collides with another); renamed to \`${c.ref}\`. Cross-references to the old id will break.`}):c.generated&&d.push({action:"anomaly",severity:"info",kind:"structure",category:"missing_xml_id",macro:e,occurrences:1,message:`<${e}> at position ${f} has no xml:id; assigned \`${c.ref}\`.`})}function ie(d,c){const e=d.outer.slice(0,d.startTagEnd-d.start),f=d.outer.slice(d.contentEnd-d.start);return e+c+f}function br(d,c){return Object.entries(d).map(([e,f])=>{const a=e.split("/").pop()??e,n=a.replace(/\.[^.]+$/,"");return{ref:c.claim(Kt(n)||"asset"),fileName:a,data:f}})}function xe(d,c={}){const e=[],f=c.documentKind??be(d),a=c.splitChapters??f==="book",n=c.splitSections??!1,r=xt(d,"pretext"),i=r?r.inner:d,l=wt(i,"docinfo"),p=l?.outer.trim()??"";let w=wt(i,"book")??wt(i,"article");if(!w){const b=f==="book"?"book":"article",S=(l?i.slice(0,l.start)+i.slice(l.end):i).trim();w=wt(`<${b}>
59
- ${S}
60
- </${b}>`,b)}if(!w)throw new Error("Could not locate a root element for the division pool.");f==="book"&&w.name!=="book"&&e.push({action:"anomaly",severity:"warning",kind:"structure",category:"missing_root",macro:"book",occurrences:1,message:"Document was treated as a book but no <book> element found; importing with the existing root."});const v=new _r,x=[],u=Bt(w,v,"document");u.renamedFrom!==void 0&&Dt(e,u,w.name,1);const _=Ft(w.inner);let o=w.inner;if(a&&f==="book"){const b=It(w.inner,"chapter"),S=b.map((E,z)=>{const R=Bt(E,v,`ch-${$t(z+1,b.length)}`);Dt(e,R,"chapter",z+1);let P=E.inner;if(n){const $=It(E.inner,"section"),F=$.map((M,Y)=>{const k=Bt(M,v,`${R.ref}-sec-${$t(Y+1,$.length)}`);return Dt(e,k,"section",Y+1),x.push({xmlId:k.ref,type:"section",title:Ft(M.inner),sourceFormat:"pretext",content:Pt(M.outer,M.startTagEnd-M.start,k.ref),isRoot:!1}),{start:M.start,end:M.end,replacement:`<plus:section ref="${k.ref}"/>`}});P=Ut(E.inner,F)}return x.push({xmlId:R.ref,type:"chapter",title:Ft(E.inner),sourceFormat:"pretext",content:Pt(ie(E,P),E.startTagEnd-E.start,R.ref),isRoot:!1}),{start:E.start,end:E.end,replacement:`<plus:chapter ref="${R.ref}"/>`}});o=Ut(w.inner,S)}const g={xmlId:u.ref,type:w.name==="book"?"book":"article",title:_,sourceFormat:"pretext",content:Pt(ie(w,o),w.startTagEnd-w.start,u.ref),isRoot:!0};x.unshift(g);const h=br(c.assets??{},v);return{project:{title:_,docinfo:p,documentKind:f,divisions:x,assets:h},warnings:e}}const jt={mainSourcePath:"source/main.ptx",publicationPath:"publication/publication.ptx",projectFilePath:"project.ptx"},Zt=/<plus:([a-zA-Z][a-zA-Z-]*)\s+ref="([^"]+)"\s*\/>/g;function Ht(d){const c=[];Zt.lastIndex=0;let e;for(;(e=Zt.exec(d))!==null;)c.push(e[2]);return c}function Nt(d,c){const e=we(d)||"division";return e.startsWith(`${c}-`)?e:`${c}-${e}`}function Lt(d,c){let e=c,f=2;for(;d.has(e);)e=`${c}-${f}`,f+=1;return d.add(e),e}function yr(d,c){const e=`${c}-`;return d.startsWith(e)?d.slice(e.length):d}function se(d,c){return d.replace(Zt,(e,f,a)=>{const n=c.get(a);return n?`<xi:include href="${n}"/>`:e})}function ke(d,c={}){const e=c.mainSourcePath??jt.mainSourcePath,f=c.publicationPath??jt.publicationPath,a=c.projectFilePath??jt.projectFilePath,n=c.includeScaffold??!0,r={},i=new Map(d.divisions.map(h=>[h.xmlId,h])),l=d.divisions.find(h=>h.isRoot);if(!l)throw new Error("Division pool has no root division.");const p=new Set,w=new Map,v=e.includes("/")?e.slice(0,e.lastIndexOf("/")+1):"",x=[];for(const h of Ht(l.content)){const b=i.get(h);if(!b)continue;const S=Lt(p,Nt(b.xmlId,"ch"));w.set(b.xmlId,`${S}.ptx`),x.push({division:b,filePath:`${v}${S}.ptx`});const E=new Set;for(const z of Ht(b.content)){const R=i.get(z);if(!R)continue;const P=Lt(E,Nt(yr(R.xmlId,b.xmlId),"sec"));w.set(R.xmlId,`${S}/${P}.ptx`),x.push({division:R,filePath:`${v}${S}/${P}.ptx`})}}const u=new Set(x.map(h=>h.division.xmlId));for(const h of d.divisions){if(h.isRoot||u.has(h.xmlId))continue;const b=h.type==="section"?"sec":"ch",S=Lt(p,Nt(h.xmlId,b));w.set(h.xmlId,`${S}.ptx`),x.push({division:h,filePath:`${v}${S}.ptx`})}for(const{division:h,filePath:b}of x){const S=se(h.content,w),E=S===h.content?S:Mt(S);r[b]=Wt(E)}const _=se(l.content,w),g=`<pretext>
61
- ${d.docinfo?`${d.docinfo}
62
- `:""}${_}
63
- </pretext>`;return r[e]=Wt(_===l.content?g:Mt(g)),n&&(r[a]=ye({mainSource:e,publication:f}),r[f]=ve()),{files:r}}const vr=/\.(tex|zip|md|markdown|ptx|xml|tar\.gz|tgz)$/i,wr=["tex","md","markdown","ptx","xml","bib","sty","txt","pdf","eps","png","ps","bbl"],xr=new Set(["png","jpg","jpeg","gif","pdf","eps","ps","bmp","tiff","tif","webp","ico"]),kr=new Set(["png","jpg","jpeg","gif","svg","bmp","tiff","tif","webp","ico","pdf","eps","ps"]);function Se(d){return xr.has(d.toLowerCase())}function Ee(d){return d.split("/").pop()??d}function Sr(d){const c=Ee(d),e=gt(c);return kr.has(e)?`source/assets/${c}`:null}function Er(d){const c=Ee(d);return gt(c)==="bib"?`source/${c}`:null}function kt(d){return d.replace(/\r\n?/g,`
64
- `).replace(/(\n *){3,}/g,`
65
-
66
- `)}function _t(d){return d.replace(/\\/g,"/").replace(/^\.\//,"")}function zr(d){const c=d.toLowerCase();return c.endsWith(".tar.gz")||c.endsWith(".tgz")?"tar.gz":c.endsWith(".zip")?"zip":c.endsWith(".tex")?"tex":c.endsWith(".md")||c.endsWith(".markdown")?"markdown":c.endsWith(".ptx")||c.endsWith(".xml")?"pretext":null}function Ar(d){const c=(e,f)=>new TextDecoder().decode(d.slice(e,f)).split("\0")[0];return{name:c(0,100),size:parseInt(c(124,136),8)||0,type:c(156,157)}}async function Cr(d){if(typeof DecompressionStream>"u")throw new Error("This runtime does not support gzip decompression.");const f=new ReadableStream({start(l){l.enqueue(new Uint8Array(d)),l.close()}}).pipeThrough(new DecompressionStream("gzip")).getReader(),a=[];for(;;){const{done:l,value:p}=await f.read();if(l)break;a.push(p)}const n=a.reduce((l,p)=>l+p.length,0),r=new Uint8Array(n);let i=0;for(const l of a)r.set(l,i),i+=l.length;return r.buffer}function Ir(d){const c={},e={};let f=0;for(;f<d.length&&!(f+512>d.length);){const a=d.slice(f,f+512),n=Ar(a);if(!n.name)break;f+=512;const r=n.size,i=Math.ceil(r/512)*512;if(n.type==="0"||n.type===""){const l=d.slice(f,f+r),p=_t(n.name);if(Se(gt(p)))e[p]=l;else{const w=new TextDecoder().decode(l);c[p]=kt(w)}}f+=i}return{files:c,assets:e}}async function Or(d){const c=zr(d.name);if(!c)throw new Error("File format not supported: please upload .tex, .md, .ptx, .xml, .zip, or .tar.gz.");if(c==="tex"||c==="markdown"||c==="pretext"){const a=await d.text();return{files:{[_t(d.name)]:kt(a)},assets:{}}}if(c==="zip"){const n=await new or().loadAsync(d),r={},i={};for(const[l,p]of Object.entries(n.files)){if(p.dir)continue;const w=_t(l);if(Se(gt(w)))i[w]=await p.async("uint8array");else{const v=await p.async("string");r[w]=kt(v)}}return{files:r,assets:i}}const e=await d.arrayBuffer(),f=await Cr(e);return Ir(new Uint8Array(f))}function gt(d){const c=d.toLowerCase().match(/\.([^.\/]+)$/);return c?c[1]:""}function Tr(d){const c=Object.keys(d).filter(f=>gt(f)==="tex").sort();return c.length===0?null:c.find(f=>/\\begin *\{document\}/.test(d[f]))??c[0]}function Rr(d){const c=d.lastIndexOf("/");return c>=0?d.slice(0,c):""}function Pr(d,c,e){const f=Rr(c);return[d,`${d}.tex`,f?`${f}/${d}`:d,f?`${f}/${d}.tex`:`${d}.tex`].map(_t).find(n=>n in e)??null}function Fr(d,c,e){let f=0;const a=[],n=i=>{let l=!1;return{output:i.replace(/(\\(input|include) *\{([^{}]+)\})/g,(w,v,x,u)=>{const _=Pr(u,c,e);return _?(l=!0,f+=1,e[_]):(a.includes(u)||a.push(u),w)}),changed:l}};let r=d;for(let i=0;i<3;i+=1){const{output:l,changed:p}=n(r);if(r=l,!p)break}return{expandedText:kt(r),expandedCount:f,missingInputs:a}}function Br(d){const c=Tr(d);if(c)return{sourcePath:c,sourceType:"tex"};const e=Object.keys(d).sort(),f=e.find(i=>{const l=gt(i);return l==="md"||l==="markdown"});if(f)return{sourcePath:f,sourceType:"markdown"};const a=pr(d);if(a)return{sourcePath:a,sourceType:"pretext"};if(e.length===0)throw new Error("No files were found in the uploaded source.");const n=e[0],r=Xt(d[n]);return{sourcePath:n,sourceType:r==="latex"?"tex":r}}function Dr(d){const c={other:0};for(const e of wr)c[e]=0;for(const e of Object.keys(d)){const f=gt(e);f in c?c[f]+=1:c.other+=1}return c}function jr(d,c){const e=Dr(c);d.push({type:"success",message:"File types:"});for(const f of Object.keys(e).sort())e[f]&&d.push({type:"success",message:`${f}: ${e[f]}`})}function Nr(d){return d==="tex"?"latex":d==="markdown"?"markdown":"pretext"}function ze(d,c={}){const e=[];try{const f=Object.fromEntries(Object.entries(d).map(([E,z])=>[_t(E),kt(z)])),a=Object.keys(f).length;e.push({type:"success",message:`Found ${a} file${a===1?"":"s"}.`}),jr(e,f);const{sourcePath:n,sourceType:r}=Br(f);let i=f[n]??"";if(r==="tex"){const E=Object.fromEntries(Object.entries(f).filter(([$])=>gt($)==="tex")),{expandedText:z,expandedCount:R,missingInputs:P}=Fr(i,n,E);i=z,R>0&&e.push({type:"success",message:`Expanded ${R} input/include reference${R===1?"":"s"}.`}),P.length>0&&e.push({type:"error",message:`Missing input/include files: ${P.join(", ")}.`})}else if(r==="pretext"){const E=Object.fromEntries(Object.entries(f).filter(([$])=>{const F=gt($);return F==="ptx"||F==="xml"})),{expandedText:z,expandedCount:R,missingIncludes:P}=ge(i,n,E);i=z,R>0&&e.push({type:"success",message:`Expanded ${R} xi:include reference${R===1?"":"s"}.`}),P.length>0&&e.push({type:"error",message:`Missing xi:include targets: ${P.join(", ")}.`})}e.push({type:"success",message:`Main source file: ${n}`});const l=Nr(r),p=me(i,l);if("pretextError"in p)return{pretextError:p.pretextError,statusMessages:e,warnings:p.warnings};const{buildLayout:w=!0,assets:v={},...x}=c,u={},_={};for(const[E,z]of Object.entries(v)){const R=Sr(E);R&&(u[R]=z,_[E]=z)}const o=xe(p.pretextSource,{documentKind:x.documentKind,splitChapters:w?x.splitChapters:!1,splitSections:w?x.splitSections:!1,assets:_}),g=w?ke(o.project,{mainSourcePath:x.mainSourcePath,publicationPath:x.publicationPath,projectFilePath:x.projectFilePath}).files:{"source/main.ptx":p.pretextSource};for(const[E,z]of Object.entries(f)){const R=Er(E);R&&!(R in g)&&(g[R]=z)}const h=o.project.documentKind,b=[...p.warnings,...o.warnings];let S;return p.cleanedNativeSource!==void 0&&p.cleanedNativeSource.length>0&&(p.sourceFormat==="latex"?S={"source/main.tex":p.cleanedNativeSource}:p.sourceFormat==="markdown"&&(S={"source/main.md":p.cleanedNativeSource})),Object.keys(v).length>0&&e.push({type:"success",message:`Routed ${Object.keys(u).length} binary asset${Object.keys(u).length===1?"":"s"}.`}),{...p,warnings:b,sourcePath:n,sourceName:n.split("/").pop()??n,sourceType:r,project:o.project,files:f,assets:v,outputFiles:g,outputAssets:u,nativeOutputFiles:S,documentKind:h,statusMessages:e}}catch(f){const a=f instanceof Error?f.message:String(f);return e.push({type:"error",message:a}),{pretextError:a,statusMessages:e,warnings:[]}}}async function Lr(d,c={}){const e=[],f=_t(d.name);if(!vr.test(f.toLowerCase()))return{pretextError:"File format not supported: please upload .tex, .md, .ptx, .xml, .zip, or .tar.gz.",statusMessages:[{type:"error",message:"File format not supported: please upload .tex, .md, .ptx, .xml, .zip, or .tar.gz."}],warnings:[]};e.push({type:"loading",message:`Processing ${f}...`});try{const{files:a,assets:n}=await Or(d),r=ze(a,{...c,assets:n});return{...r,statusMessages:[...e,...r.statusMessages]}}catch(a){const n=a instanceof Error?a.message:String(a);return{pretextError:n,statusMessages:[...e,{type:"error",message:n}],warnings:[]}}}function $r(d,c){return c==="converted"?d.outputFiles:d.nativeOutputFiles??d.files}function Ur(d,c){return c==="converted"?d.outputAssets:d.assets}function Mr(d){const c=d.action==="replace"||d.action==="rewrite"?`replaced with \`${d.replacement}\``:d.message??d.action,e=d.occurrences>1?` (x${d.occurrences})`:"";return`[${d.severity}] ${d.macro}: ${c}${e}`}exports.LATEX_FORMAT_MARKERS=ae;exports.MARKDOWN_FORMAT_MARKERS=oe;exports.assetsForImportMode=Ur;exports.buildDivisionPool=xe;exports.cleanLatex=le;exports.convertLatexToPretext=he;exports.convertMarkdownToPretext=de;exports.convertSourceToPretext=me;exports.detectDocumentKind=be;exports.detectSourceFormat=Xt;exports.divisionChildRefs=Ht;exports.ensureXIncludeNamespace=Mt;exports.expandPretextIncludes=ge;exports.filesForImportMode=$r;exports.findAnyElement=xt;exports.findTopLevelElements=It;exports.formatWarningLine=Mr;exports.getConversionErrorMessage=pe;exports.handleImportUploadFile=Lr;exports.importProjectFromFiles=ze;exports.normalizePretextSource=Ot;exports.padIndex=$t;exports.renderProjectPtx=ye;exports.renderPublicationPtx=ve;exports.sanitizeRef=Kt;exports.serializeProjectToFiles=ke;exports.slugify=we;exports.spliceReplacements=Ut;exports.withProlog=Wt;