combine-word
Version:
A package to merge multiple Word (.docx) documents into one, including headers, footers, and metadata.
1 lines • 120 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.CombineWord=t():e.CombineWord=t()}(this,(()=>{return e={39:(e,t,r)=>{"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=r(668);t.uncompressInputType=n?"uint8array":"array",t.compressInputType=n?"uint8array":"array",t.magic="\b\0",t.compress=function(e,t){return i.deflateRaw(e,{level:t.level||-1})},t.uncompress=function(e){return i.inflateRaw(e)}},43:(e,t,r)=>{"use strict";var n=r(654);function i(e){if(e){this.data=e,this.length=this.data.length,this.index=0,this.zero=0;for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}}i.prototype=new n,i.prototype.byteAt=function(e){return this.data[this.zero+e]},i.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),a=this.length-4;a>=0;--a)if(this.data[a]===t&&this.data[a+1]===r&&this.data[a+2]===n&&this.data[a+3]===i)return a-this.zero;return-1},i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},e.exports=i},51:(e,t)=>{"use strict";t.base64=!1,t.binary=!1,t.dir=!1,t.createFolders=!1,t.date=null,t.compression=null,t.compressionOptions=null,t.comment=null,t.unixPermissions=null,t.dosPermissions=null},61:e=>{"use strict";e.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}},78:(e,t,r)=>{"use strict";t.STORE={magic:"\0\0",compress:function(e,t){return e},uncompress:function(e){return e},compressInputType:null,uncompressInputType:null},t.DEFLATE=r(39)},83:(e,t,r)=>{"use strict";var n=r(447),i=r(805),a=r(996),s=r(681),o=r(674),l=r(61),d=r(414),c=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var r=n.inflateInit2(this.strm,t.windowBits);if(r!==s.Z_OK)throw new Error(o[r]);if(this.header=new d,n.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=a.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=n.inflateSetDictionary(this.strm,t.dictionary))!==s.Z_OK))throw new Error(o[r])}function h(e,t){var r=new u(t);if(r.push(e,!0),r.err)throw r.msg||o[r.err];return r.result}u.prototype.push=function(e,t){var r,o,l,d,u,h=this.strm,f=this.options.chunkSize,p=this.options.dictionary,m=!1;if(this.ended)return!1;o=t===~~t?t:!0===t?s.Z_FINISH:s.Z_NO_FLUSH,"string"==typeof e?h.input=a.binstring2buf(e):"[object ArrayBuffer]"===c.call(e)?h.input=new Uint8Array(e):h.input=e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new i.Buf8(f),h.next_out=0,h.avail_out=f),(r=n.inflate(h,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&p&&(r=n.inflateSetDictionary(this.strm,p)),r===s.Z_BUF_ERROR&&!0===m&&(r=s.Z_OK,m=!1),r!==s.Z_STREAM_END&&r!==s.Z_OK)return this.onEnd(r),this.ended=!0,!1;h.next_out&&(0!==h.avail_out&&r!==s.Z_STREAM_END&&(0!==h.avail_in||o!==s.Z_FINISH&&o!==s.Z_SYNC_FLUSH)||("string"===this.options.to?(l=a.utf8border(h.output,h.next_out),d=h.next_out-l,u=a.buf2string(h.output,l),h.next_out=d,h.avail_out=f-d,d&&i.arraySet(h.output,h.output,l,d,0),this.onData(u)):this.onData(i.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(m=!0)}while((h.avail_in>0||0===h.avail_out)&&r!==s.Z_STREAM_END);return r===s.Z_STREAM_END&&(o=s.Z_FINISH),o===s.Z_FINISH?(r=n.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===s.Z_OK):o!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),h.avail_out=0,!0)},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){e===s.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Inflate=u,t.inflate=h,t.inflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},t.ungzip=h},132:(e,t,r)=>{"use strict";var n=r(954),i=r(78),a=r(327);function s(e){return e}function o(e,t){for(var r=0;r<e.length;++r)t[r]=255&e.charCodeAt(r);return t}function l(e){var r=65536,n=[],i=e.length,s=t.getTypeOf(e),o=0,l=!0;try{switch(s){case"uint8array":String.fromCharCode.apply(null,new Uint8Array(0));break;case"nodebuffer":String.fromCharCode.apply(null,a(0))}}catch(e){l=!1}if(!l){for(var d="",c=0;c<e.length;c++)d+=String.fromCharCode(e[c]);return d}for(;o<i&&r>1;)try{"array"===s||"nodebuffer"===s?n.push(String.fromCharCode.apply(null,e.slice(o,Math.min(o+r,i)))):n.push(String.fromCharCode.apply(null,e.subarray(o,Math.min(o+r,i)))),o+=r}catch(e){r=Math.floor(r/2)}return n.join("")}function d(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}t.string2binary=function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(255&e.charCodeAt(r));return t},t.arrayBuffer2Blob=function(e,r){t.checkSupport("blob"),r=r||"application/zip";try{return new Blob([e],{type:r})}catch(t){try{var n=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder);return n.append(e),n.getBlob(r)}catch(e){throw new Error("Bug : can't construct the Blob.")}}},t.applyFromCharCode=l;var c={};c.string={string:s,array:function(e){return o(e,new Array(e.length))},arraybuffer:function(e){return c.string.uint8array(e).buffer},uint8array:function(e){return o(e,new Uint8Array(e.length))},nodebuffer:function(e){return o(e,a(e.length))}},c.array={string:l,array:s,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return a(e)}},c.arraybuffer={string:function(e){return l(new Uint8Array(e))},array:function(e){return d(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:s,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return a(new Uint8Array(e))}},c.uint8array={string:l,array:function(e){return d(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:s,nodebuffer:function(e){return a(e)}},c.nodebuffer={string:l,array:function(e){return d(e,new Array(e.length))},arraybuffer:function(e){return c.nodebuffer.uint8array(e).buffer},uint8array:function(e){return d(e,new Uint8Array(e.length))},nodebuffer:s},t.transformTo=function(e,r){if(r||(r=""),!e)return r;t.checkSupport(e);var n=t.getTypeOf(r);return c[n][e](r)},t.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":n.nodebuffer&&a.test(e)?"nodebuffer":n.uint8array&&e instanceof Uint8Array?"uint8array":n.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},t.checkSupport=function(e){if(!n[e.toLowerCase()])throw new Error(e+" is not supported by this browser")},t.MAX_VALUE_16BITS=65535,t.MAX_VALUE_32BITS=-1,t.pretty=function(e){var t,r,n="";for(r=0;r<(e||"").length;r++)n+="\\x"+((t=e.charCodeAt(r))<16?"0":"")+t.toString(16).toUpperCase();return n},t.findCompression=function(e){for(var t in i)if(i.hasOwnProperty(t)&&i[t].magic===e)return i[t];return null},t.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},t.extend=function(){var e,t,r={};for(e=0;e<arguments.length;e++)for(t in arguments[e])arguments[e].hasOwnProperty(t)&&void 0===r[t]&&(r[t]=arguments[e][t]);return r}},152:(e,t,r)=>{function n(e){this.options=e||{locator:{}}}function i(){this.cdata=!1}function a(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function s(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function o(e,t,r){return"string"==typeof e?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}function l(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}n.prototype.parseFromString=function(e,t){var r=this.options,n=new u,a=r.domBuilder||new i,o=r.errorHandler,l=r.locator,c=r.xmlns||{},h=/\/x?html?$/.test(t),f=h?d.entityMap:{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return l&&a.setDocumentLocator(l),n.errorHandler=function(e,t,r){if(!e){if(t instanceof i)return t;e=t}var n={},a=e instanceof Function;function o(t){var i=e[t];!i&&a&&(i=2==e.length?function(r){e(t,r)}:e),n[t]=i&&function(e){i("[xmldom "+t+"]\t"+e+s(r))}||function(){}}return r=r||{},o("warning"),o("error"),o("fatalError"),n}(o,a,l),n.domBuilder=r.domBuilder||a,h&&(c[""]="http://www.w3.org/1999/xhtml"),c.xml=c.xml||"http://www.w3.org/XML/1998/namespace",e&&"string"==typeof e?n.parse(e,c,f):n.errorHandler.error("invalid doc source"),a.doc},i.prototype={startDocument:function(){this.doc=(new f).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,r,n){var i=this.doc,s=i.createElementNS(e,r||t),o=n.length;l(this,s),this.currentElement=s,this.locator&&a(this.locator,s);for(var d=0;d<o;d++){e=n.getURI(d);var c=n.getValue(d),u=(r=n.getQName(d),i.createAttributeNS(e,r));this.locator&&a(n.getLocator(d),u),u.value=u.nodeValue=c,s.setAttributeNode(u)}},endElement:function(e,t,r){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&a(this.locator,r),l(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=o.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(e);else n=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&a(this.locator,n)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,r){e=o.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&a(this.locator,n),l(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r){var n=this.doc.implementation;if(n&&n.createDocumentType){var i=n.createDocumentType(e,t,r);this.locator&&a(this.locator,i),l(this,i)}},warning:function(e){console.warn("[xmldom warning]\t"+e,s(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,s(this.locator))},fatalError:function(e){throw new h(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){i.prototype[e]=function(){return null}}));var d=r(828),c=r(938),u=c.XMLReader,h=c.ParseError,f=t.DOMImplementation=r(266).DOMImplementation;t.XMLSerializer=r(266).XMLSerializer,t.DOMParser=n,t.__DOMHandler=i},171:(e,t,r)=>{"use strict";var n=r(132),i=function(e){this.data=new Uint8Array(e),this.index=0};i.prototype={append:function(e){0!==e.length&&(e=n.transformTo("uint8array",e),this.data.set(e,this.index),this.index+=e.length)},finalize:function(){return this.data}},e.exports=i},222:(e,t,r)=>{"use strict";for(var n=r(132),i=r(954),a=r(327),s=new Array(256),o=0;o<256;o++)s[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;s[254]=s[254]=1;var l=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+s[e[r]]>t?r:t},d=function(e){var t,r,i,a,o=e.length,l=new Array(2*o);for(r=0,t=0;t<o;)if((i=e[t++])<128)l[r++]=i;else if((a=s[i])>4)l[r++]=65533,t+=a-1;else{for(i&=2===a?31:3===a?15:7;a>1&&t<o;)i=i<<6|63&e[t++],a--;a>1?l[r++]=65533:i<65536?l[r++]=i:(i-=65536,l[r++]=55296|i>>10&1023,l[r++]=56320|1023&i)}return l.length!==r&&(l.subarray?l=l.subarray(0,r):l.length=r),n.applyFromCharCode(l)};t.utf8encode=function(e){return i.nodebuffer?a(e,"utf-8"):function(e){var t,r,n,a,s,o=e.length,l=0;for(a=0;a<o;a++)55296==(64512&(r=e.charCodeAt(a)))&&a+1<o&&56320==(64512&(n=e.charCodeAt(a+1)))&&(r=65536+(r-55296<<10)+(n-56320),a++),l+=r<128?1:r<2048?2:r<65536?3:4;for(t=i.uint8array?new Uint8Array(l):new Array(l),s=0,a=0;s<l;a++)55296==(64512&(r=e.charCodeAt(a)))&&a+1<o&&56320==(64512&(n=e.charCodeAt(a+1)))&&(r=65536+(r-55296<<10)+(n-56320),a++),r<128?t[s++]=r:r<2048?(t[s++]=192|r>>>6,t[s++]=128|63&r):r<65536?(t[s++]=224|r>>>12,t[s++]=128|r>>>6&63,t[s++]=128|63&r):(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63,t[s++]=128|r>>>6&63,t[s++]=128|63&r);return t}(e)},t.utf8decode=function(e){if(i.nodebuffer)return n.transformTo("nodebuffer",e).toString("utf-8");for(var t=[],r=0,a=(e=n.transformTo(i.uint8array?"uint8array":"array",e)).length;r<a;){var s=l(e,Math.min(r+65536,a));i.uint8array?t.push(d(e.subarray(r,s))):t.push(d(e.slice(r,s))),r=s}return t.join("")}},249:(e,t,r)=>{const{DOMParser:n,XMLSerializer:i}=r(152);function a(e,t=[]){const r="[Content_Types].xml",a=e.file(r).asText();if(!a||0===t.length)return;const s=(new n).parseFromString(a,"application/xml"),o=s.getElementsByTagName("Override");for(let e=0;e<o.length;e++){const r=o[e],n=r.getAttribute("PartName");for(const e of t){const t=`/${e.oldName}`,i=`/${e.newName}`;n===t&&r.setAttribute("PartName",i)}}const l=(new i).serializeToString(s);e.file(r,l)}function s(e,t,r,n){const i=e.getElementsByTagName(t)[0];if(i){const e=i.getAttribute(r);e&&i.setAttribute(r,n[e]||e)}}function o(e){const t=["w:p","w:tr"],r={"w14:textId":"77777777","w:rsidR":"00000000","w:rsidRDefault":"00000000"};for(const n of t){const t=e.getElementsByTagName(n);Array.from(t).forEach((e=>{for(const[t,n]of Object.entries(r))e.hasAttribute(t)&&e.setAttribute(t,n)}))}}function l(e,t){const r="combine_id_"+(new Date).getTime();for(const[n,i]of Object.entries(t)){const t=new RegExp(`"${n}"`,"g");e=e.replace(t,`"${r}${i}"`)}return e.replace(new RegExp(`${r}`,"g"),"")}function d(e,t){const r="word/document.xml";let a=e.file(r).asText();a=l(a,t);const s=(new n).parseFromString(a,"application/xml");o(s);const d=(new i).serializeToString(s);e.file(r,d)}function c(e,t){const r=e.folder("word");r&&Object.keys(r.files).forEach((a=>{if(["word/header","word/footer"].some((e=>a.startsWith(e)))){let s=r.files[a].asText();s=l(s,t);const d=(new n).parseFromString(s,"application/xml");o(d);const c=(new i).serializeToString(d);e.file(a,c)}}))}e.exports={processRels:function(e){const t="word/_rels/document.xml.rels",r={headerIndex:1,footerIndex:1,mediaIndex:1};let s=1;const o=[];for(let l=0;l<e.length;l++){const c=e[l],u=new n,h=c.file(t).asText(),f=u.parseFromString(h,"application/xml"),p=f.getElementsByTagName("Relationship"),m=[],g={};for(let e=0;e<p.length;e++){const t=p[e];let n="",i="";const a=t.getAttribute("Target");if(["header","footer","media/"].some((e=>a.startsWith(e)))||!o.includes(a)){if(["header","footer","media/"].some((e=>a.startsWith(e)))||o.push(a),a.includes("header")){n=a.split("/").pop();const e=n.slice(n.lastIndexOf("."));i=`header${r.headerIndex++}${e}`}if(a.includes("footer")){n=a.split("/").pop();const e=n.slice(n.lastIndexOf("."));i=`footer${r.footerIndex++}${e}`}if(a.includes("media/")&&(n=a,i=n.replace(/(\d+)(?=\.[^.]+$)/,""+r.mediaIndex++)),n){const e=c.file(`word/${n}`).asUint8Array();e&&m.push({oldName:`word/${n}`,newName:`word/${i}`,folder:e}),t.setAttribute("Target",i)}if(0===l){const e=t.getAttribute("Id");s=e&&Number(e.replace("rId",""))>s?Number(e.replace("rId","")):s}else{const e=t.getAttribute("Id"),r="rId"+s++;t.setAttribute("Id",r),g[e]=r}}}const _=(new i).serializeToString(f);c.file(t,_),0===l&&s++,m.forEach((e=>{c.remove(e.oldName)})),m.forEach((e=>{c.file(e.newName,e.folder)})),d(c,g),a(c,m)}},processStyles:function(e){const t="word/styles.xml",r=new n,a=new i;for(let n=0;n<e.length;n++){const i=e[n],o=i.file(t).asText(),l=r.parseFromString(o,"application/xml"),u=l.getElementsByTagName("w:style"),h=Array.from(u);h.sort(((e,t)=>{const r=e.getAttribute("w:styleId"),n=t.getAttribute("w:styleId");return/^\d+$/.test(r)&&/^\d+$/.test(n)?Number(r)-Number(n):r.localeCompare(n)}));const f={},p=["w:basedOn","w:next","w:link","w:numId"];let m=-1,g=0;for(let e=0;e<h.length;e++){const t=h[e];let r,n=t.getAttribute("w:styleId");f[n]||(/^\d+$/.test(n)?(r=Number(m)+0,g=Number(m)>g?Number(m):g):(r=-1===m?"a":"a"+m,m++),f[n]=r),r=f[n],t.setAttribute("w:styleId",r);for(const e of p)s(t,e,"w:val",f)}const _=a.serializeToString(l);i.file(t,_),d(i,f),c(i,f)}},getMaxRelationshipId:function(e){const t=[],r=[],i=[];for(let a=0;a<e.length;a++){const s=e[a],o=new n,l=s.file("word/_rels/document.xml.rels").asText(),d=o.parseFromString(l,"application/xml").getElementsByTagName("Relationship");for(let e=0;e<d.length;e++){const n=d[e].getAttribute("Id"),a=parseInt(n.replace("rId",""),10),s=d[e].getAttribute("Type"),o=d[e].getAttribute("Target").replace(".xml","");if("http://schemas.openxmlformats.org/officeDocument/2006/relationships/header"===s){const e=parseInt(o.replace("header",""),10);r.push(e)}if("http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"===s){const e=parseInt(o.replace("footer",""),10);i.push(e)}isNaN(a)||t.push(a)}}const a=t.length>0?Math.max(...t):0;return{rindex:+a,rid:`rId${a}`,hindex:+(r.length>0?Math.max(...r):0),findex:+(i.length>0?Math.max(...i):0)}},createBlankHeaderXml:function(e,t,r){const a="word/_rels/document.xml.rels",s=`word/header${r}.xml`,o="word/header1.xml",l="[Content_Types].xml",d="http://schemas.openxmlformats.org/wordprocessingml/2006/main",c="http://schemas.openxmlformats.org/package/2006/content-types";if(e.file(o)){const t=e.file(o).asText(),r=(new n).parseFromString(t,"application/xml"),a=r.documentElement;for(;a.firstChild;)a.removeChild(a.firstChild);const l=r.createElementNS(d,"w:p"),c=r.createElementNS(d,"w:r"),u=r.createElementNS(d,"w:t");c.appendChild(u),l.appendChild(c),a.appendChild(l);const h=new i;e.file(s,h.serializeToString(r))}else{const t=`\n <w:hdr xmlns:w="${d}">\n <w:p>\n <w:r>\n <w:t></w:t>\n </w:r>\n </w:p>\n </w:hdr>\n `.trim();e.file(s,t)}const u=e.file(a);if(!u)throw new Error(`未找到关系文件: ${a}`);const h=u.asText(),f=new n,p=f.parseFromString(h,"application/xml"),m=p.createElementNS("http://schemas.openxmlformats.org/package/2006/relationships","Relationship");m.setAttribute("Id",t),m.setAttribute("Type","http://schemas.openxmlformats.org/officeDocument/2006/relationships/header"),m.setAttribute("Target",`header${r}.xml`),p.documentElement.appendChild(m);const g=new i;e.file(a,g.serializeToString(p));const _=e.file(l);if(!_)throw new Error(`未找到内容类型文件: ${l}`);const w=_.asText(),b=f.parseFromString(w,"application/xml"),v=b.documentElement;if(!Array.from(v.getElementsByTagNameNS(c,"Override")).find((e=>e.getAttribute("PartName")===`/${s}`))){const t=b.createElementNS(c,"Override");t.setAttribute("PartName",`/${s}`),t.setAttribute("ContentType","application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml"),v.appendChild(t),e.file(l,g.serializeToString(b))}},createBlankFooterXml:function(e,t,r){const a="word/_rels/document.xml.rels",s=`word/footer${r}.xml`,o="word/footer1.xml",l="[Content_Types].xml",d="http://schemas.openxmlformats.org/wordprocessingml/2006/main",c="http://schemas.openxmlformats.org/package/2006/content-types";if(e.file(o)){const t=e.file(o).asText(),r=(new n).parseFromString(t,"application/xml"),a=r.documentElement;for(;a.firstChild;)a.removeChild(a.firstChild);const l=r.createElementNS(d,"w:p"),c=r.createElementNS(d,"w:r"),u=r.createElementNS(d,"w:t");c.appendChild(u),l.appendChild(c),a.appendChild(l);const h=new i;e.file(s,h.serializeToString(r))}else{const t=`\n <w:ftr xmlns:w="${d}">\n <w:p>\n <w:r>\n <w:t></w:t>\n </w:r>\n </w:p>\n </w:ftr>\n `.trim();e.file(s,t)}const u=e.file(a);if(!u)throw new Error(`未找到关系文件: ${a}`);const h=u.asText(),f=new n,p=f.parseFromString(h,"application/xml"),m=p.createElementNS("http://schemas.openxmlformats.org/package/2006/relationships","Relationship");m.setAttribute("Id",t),m.setAttribute("Type","http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"),m.setAttribute("Target",`footer${r}.xml`),p.documentElement.appendChild(m);const g=new i;e.file(a,g.serializeToString(p));const _=e.file(l);if(!_)throw new Error(`未找到内容类型文件: ${l}`);const w=_.asText(),b=f.parseFromString(w,"application/xml"),v=b.documentElement;if(!Array.from(v.getElementsByTagNameNS(c,"Override")).find((e=>e.getAttribute("PartName")===`/${s}`))){const t=b.createElementNS(c,"Override");t.setAttribute("PartName",`/${s}`),t.setAttribute("ContentType","application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml"),v.appendChild(t),e.file(l,g.serializeToString(b))}}}},259:(e,t,r)=>{"use strict";var n=r(654),i=r(132);function a(e,t){this.data=e,t||(this.data=i.string2binary(this.data)),this.length=this.data.length,this.index=0,this.zero=0}a.prototype=new n,a.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},a.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},a.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},e.exports=a},266:(e,t)=>{function r(e,t){for(var r in e)t[r]=e[r]}function n(e,t){var n=e.prototype;if(!(n instanceof t)){function i(){}i.prototype=t.prototype,r(n,i=new i),e.prototype=n=i}n.constructor!=e&&("function"!=typeof e&&console.error("unknow Class:"+e),n.constructor=e)}var i={},a=i.ELEMENT_NODE=1,s=i.ATTRIBUTE_NODE=2,o=i.TEXT_NODE=3,l=i.CDATA_SECTION_NODE=4,d=i.ENTITY_REFERENCE_NODE=5,c=i.ENTITY_NODE=6,u=i.PROCESSING_INSTRUCTION_NODE=7,h=i.COMMENT_NODE=8,f=i.DOCUMENT_NODE=9,p=i.DOCUMENT_TYPE_NODE=10,m=i.DOCUMENT_FRAGMENT_NODE=11,g=i.NOTATION_NODE=12,_={},w={},b=(_.INDEX_SIZE_ERR=(w[1]="Index size error",1),_.DOMSTRING_SIZE_ERR=(w[2]="DOMString size error",2),_.HIERARCHY_REQUEST_ERR=(w[3]="Hierarchy request error",3)),v=(_.WRONG_DOCUMENT_ERR=(w[4]="Wrong document",4),_.INVALID_CHARACTER_ERR=(w[5]="Invalid character",5),_.NO_DATA_ALLOWED_ERR=(w[6]="No data allowed",6),_.NO_MODIFICATION_ALLOWED_ERR=(w[7]="No modification allowed",7),_.NOT_FOUND_ERR=(w[8]="Not found",8)),y=(_.NOT_SUPPORTED_ERR=(w[9]="Not supported",9),_.INUSE_ATTRIBUTE_ERR=(w[10]="Attribute in use",10));function x(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,w[e]),this.message=w[e],Error.captureStackTrace&&Error.captureStackTrace(this,x);return r.code=e,t&&(this.message=this.message+": "+t),r}function E(){}function N(e,t){this._node=e,this._refresh=t,C(this)}function C(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var n=e._refresh(e._node);ne(e,"length",n.length),r(n,e),e._inc=t}}function k(){}function S(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function T(e,t,r,n){if(n?t[S(t,n)]=r:t[t.length++]=r,e){r.ownerElement=e;var i=e.ownerDocument;i&&(n&&R(i,e,n),function(e,t,r){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==r.namespaceURI&&(t._nsMap[r.prefix?r.localName:""]=r.value)}(i,e,r))}}function A(e,t,r){var n=S(t,r);if(!(n>=0))throw x(v,new Error(e.tagName+"@"+r));for(var i=t.length-1;n<i;)t[n]=t[++n];if(t.length=i,e){var a=e.ownerDocument;a&&(R(a,e,r),r.ownerElement=null)}}function I(e){if(this._features={},e)for(var t in e)this._features=e[t]}function z(){}function D(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function O(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(O(e,t))return!0}while(e=e.nextSibling)}function B(){}function R(e,t,r,n){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==r.namespaceURI&&delete t._nsMap[r.prefix?r.localName:""]}function F(e,t,r){if(e&&e._inc){e._inc++;var n=t.childNodes;if(r)n[n.length++]=r;else{for(var i=t.firstChild,a=0;i;)n[a++]=i,i=i.nextSibling;n.length=a}}}function L(e,t){var r=t.previousSibling,n=t.nextSibling;return r?r.nextSibling=n:e.firstChild=n,n?n.previousSibling=r:e.lastChild=r,F(e.ownerDocument,e),t}function M(e,t,r){var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===m){var i=t.firstChild;if(null==i)return t;var a=t.lastChild}else i=a=t;var s=r?r.previousSibling:e.lastChild;i.previousSibling=s,a.nextSibling=r,s?s.nextSibling=i:e.firstChild=i,null==r?e.lastChild=a:r.previousSibling=a;do{i.parentNode=e}while(i!==a&&(i=i.nextSibling));return F(e.ownerDocument||e,e),t.nodeType==m&&(t.firstChild=t.lastChild=null),t}function U(){this._nsMap={}}function P(){}function Z(){}function $(){}function j(){}function H(){}function X(){}function V(){}function W(){}function Y(){}function q(){}function K(){}function G(){}function Q(e,t){var r=[],n=9==this.nodeType&&this.documentElement||this,i=n.prefix,a=n.namespaceURI;if(a&&null==i&&null==(i=n.lookupPrefix(a)))var s=[{namespace:a,prefix:null}];return ee(this,r,e,t,s),r.join("")}function J(e,t,r){var n=e.prefix||"",i=e.namespaceURI;if(!n&&!i)return!1;if("xml"===n&&"http://www.w3.org/XML/1998/namespace"===i||"http://www.w3.org/2000/xmlns/"==i)return!1;for(var a=r.length;a--;){var s=r[a];if(s.prefix==n)return s.namespace!=i}return!0}function ee(e,t,r,n,i){if(n){if(!(e=n(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case a:i||(i=[]),i.length;var c=e.attributes,g=c.length,_=e.firstChild,w=e.tagName;r="http://www.w3.org/1999/xhtml"===e.namespaceURI||r,t.push("<",w);for(var b=0;b<g;b++)"xmlns"==(v=c.item(b)).prefix?i.push({prefix:v.localName,namespace:v.value}):"xmlns"==v.nodeName&&i.push({prefix:"",namespace:v.value});for(b=0;b<g;b++){var v;if(J(v=c.item(b),0,i)){var y=v.prefix||"",x=v.namespaceURI,E=y?" xmlns:"+y:" xmlns";t.push(E,'="',x,'"'),i.push({prefix:y,namespace:x})}ee(v,t,r,n,i)}if(J(e,0,i)&&(y=e.prefix||"",(x=e.namespaceURI)&&(E=y?" xmlns:"+y:" xmlns",t.push(E,'="',x,'"'),i.push({prefix:y,namespace:x}))),_||r&&!/^(?:meta|link|img|br|hr|input)$/i.test(w)){if(t.push(">"),r&&/^script$/i.test(w))for(;_;)_.data?t.push(_.data):ee(_,t,r,n,i),_=_.nextSibling;else for(;_;)ee(_,t,r,n,i),_=_.nextSibling;t.push("</",w,">")}else t.push("/>");return;case f:case m:for(_=e.firstChild;_;)ee(_,t,r,n,i),_=_.nextSibling;return;case s:return t.push(" ",e.name,'="',e.value.replace(/[<&"]/g,D),'"');case o:return t.push(e.data.replace(/[<&]/g,D).replace(/]]>/g,"]]>"));case l:return t.push("<![CDATA[",e.data,"]]>");case h:return t.push("\x3c!--",e.data,"--\x3e");case p:var N=e.publicId,C=e.systemId;if(t.push("<!DOCTYPE ",e.name),N)t.push(" PUBLIC ",N),C&&"."!=C&&t.push(" ",C),t.push(">");else if(C&&"."!=C)t.push(" SYSTEM ",C,">");else{var k=e.internalSubset;k&&t.push(" [",k,"]"),t.push(">")}return;case u:return t.push("<?",e.target," ",e.data,"?>");case d:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function te(e,t,r){var n;switch(t.nodeType){case a:(n=t.cloneNode(!1)).ownerDocument=e;case m:break;case s:r=!0}if(n||(n=t.cloneNode(!1)),n.ownerDocument=e,n.parentNode=null,r)for(var i=t.firstChild;i;)n.appendChild(te(e,i,r)),i=i.nextSibling;return n}function re(e,t,r){var n=new t.constructor;for(var i in t){var o=t[i];"object"!=typeof o&&o!=n[i]&&(n[i]=o)}switch(t.childNodes&&(n.childNodes=new E),n.ownerDocument=e,n.nodeType){case a:var l=t.attributes,d=n.attributes=new k,c=l.length;d._ownerElement=n;for(var u=0;u<c;u++)n.setAttributeNode(re(e,l.item(u),!0));break;case s:r=!0}if(r)for(var h=t.firstChild;h;)n.appendChild(re(e,h,r)),h=h.nextSibling;return n}function ne(e,t,r){e[t]=r}_.INVALID_STATE_ERR=(w[11]="Invalid state",11),_.SYNTAX_ERR=(w[12]="Syntax error",12),_.INVALID_MODIFICATION_ERR=(w[13]="Invalid modification",13),_.NAMESPACE_ERR=(w[14]="Invalid namespace",14),_.INVALID_ACCESS_ERR=(w[15]="Invalid access",15),x.prototype=Error.prototype,r(_,x),E.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var r=[],n=0;n<this.length;n++)ee(this[n],r,e,t);return r.join("")}},N.prototype.item=function(e){return C(this),this[e]},n(N,E),k.prototype={length:0,item:E.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var r=this[t];if(r.nodeName==e)return r}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new x(y);var r=this.getNamedItem(e.nodeName);return T(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t,r=e.ownerElement;if(r&&r!=this._ownerElement)throw new x(y);return t=this.getNamedItemNS(e.namespaceURI,e.localName),T(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return A(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return A(this._ownerElement,this,r),r},getNamedItemNS:function(e,t){for(var r=this.length;r--;){var n=this[r];if(n.localName==t&&n.namespaceURI==e)return n}return null}},I.prototype={hasFeature:function(e,t){var r=this._features[e.toLowerCase()];return!(!r||t&&!(t in r))},createDocument:function(e,t,r){var n=new B;if(n.implementation=this,n.childNodes=new E,n.doctype=r,r&&n.appendChild(r),t){var i=n.createElementNS(e,t);n.appendChild(i)}return n},createDocumentType:function(e,t,r){var n=new X;return n.name=e,n.nodeName=e,n.publicId=t,n.systemId=r,n}},z.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return M(this,e,t)},replaceChild:function(e,t){this.insertBefore(e,t),t&&this.removeChild(t)},removeChild:function(e){return L(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return re(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==o&&e.nodeType==o?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r)for(var n in r)if(r[n]==e)return n;t=t.nodeType==s?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&e in r)return r[e];t=t.nodeType==s?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},r(i,z),r(i,z.prototype),B.prototype={nodeName:"#document",nodeType:f,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==m){for(var r=e.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,t),r=n}return e}return null==this.documentElement&&e.nodeType==a&&(this.documentElement=e),M(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),L(this,e)},importNode:function(e,t){return te(this,e,t)},getElementById:function(e){var t=null;return O(this.documentElement,(function(r){if(r.nodeType==a&&r.getAttribute("id")==e)return t=r,!0})),t},getElementsByClassName:function(e){var t=new RegExp("(^|\\s)"+e+"(\\s|$)");return new N(this,(function(e){var r=[];return O(e.documentElement,(function(n){n!==e&&n.nodeType==a&&t.test(n.getAttribute("class"))&&r.push(n)})),r}))},createElement:function(e){var t=new U;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.childNodes=new E,(t.attributes=new k)._ownerElement=t,t},createDocumentFragment:function(){var e=new q;return e.ownerDocument=this,e.childNodes=new E,e},createTextNode:function(e){var t=new $;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new j;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new H;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new K;return r.ownerDocument=this,r.tagName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new P;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Y;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new U,n=t.split(":"),i=r.attributes=new k;return r.childNodes=new E,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=e,2==n.length?(r.prefix=n[0],r.localName=n[1]):r.localName=t,i._ownerElement=r,r},createAttributeNS:function(e,t){var r=new P,n=t.split(":");return r.ownerDocument=this,r.nodeName=t,r.name=t,r.namespaceURI=e,r.specified=!0,2==n.length?(r.prefix=n[0],r.localName=n[1]):r.localName=t,r}},n(B,z),U.prototype={nodeType:a,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===m?this.insertBefore(e,null):function(e,t){var r=t.parentNode;if(r){var n=e.lastChild;r.removeChild(t),n=e.lastChild}return n=e.lastChild,t.parentNode=e,t.previousSibling=n,t.nextSibling=null,n?n.nextSibling=t:e.firstChild=t,e.lastChild=t,F(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);return r&&r.value||""},setAttributeNS:function(e,t,r){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+r,this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new N(this,(function(t){var r=[];return O(t,(function(n){n===t||n.nodeType!=a||"*"!==e&&n.tagName!=e||r.push(n)})),r}))},getElementsByTagNameNS:function(e,t){return new N(this,(function(r){var n=[];return O(r,(function(i){i===r||i.nodeType!==a||"*"!==e&&i.namespaceURI!==e||"*"!==t&&i.localName!=t||n.push(i)})),n}))}},B.prototype.getElementsByTagName=U.prototype.getElementsByTagName,B.prototype.getElementsByTagNameNS=U.prototype.getElementsByTagNameNS,n(U,z),P.prototype.nodeType=s,n(P,z),Z.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(w[b])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,r){r=this.data.substring(0,e)+r+this.data.substring(e+t),this.nodeValue=this.data=r,this.length=r.length}},n(Z,z),$.prototype={nodeName:"#text",nodeType:o,splitText:function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},n($,Z),j.prototype={nodeName:"#comment",nodeType:h},n(j,Z),H.prototype={nodeName:"#cdata-section",nodeType:l},n(H,Z),X.prototype.nodeType=p,n(X,z),V.prototype.nodeType=g,n(V,z),W.prototype.nodeType=c,n(W,z),Y.prototype.nodeType=d,n(Y,z),q.prototype.nodeName="#document-fragment",q.prototype.nodeType=m,n(q,z),K.prototype.nodeType=u,n(K,z),G.prototype.serializeToString=function(e,t,r){return Q.call(e,t,r)},z.prototype.toString=Q;try{if(Object.defineProperty){function ie(e){switch(e.nodeType){case a:case m:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(ie(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(N.prototype,"length",{get:function(){return C(this),this.$$length}}),Object.defineProperty(z.prototype,"textContent",{get:function(){return ie(this)},set:function(e){switch(this.nodeType){case a:case m:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),ne=function(e,t,r){e["$$"+t]=r}}}catch(ae){}t.DOMImplementation=I,t.XMLSerializer=G},269:e=>{"use strict";e.exports=function(e,t,r,n){for(var i=65535&e,a=e>>>16&65535,s=0;0!==r;){r-=s=r>2e3?2e3:r;do{a=a+(i=i+t[n++]|0)|0}while(--s);i%=65521,a%=65521}return i|a<<16}},293:e=>{"use strict";e.exports=function(e,t){var r,n,i,a,s,o,l,d,c,u,h,f,p,m,g,_,w,b,v,y,x,E,N,C,k;r=e.state,n=e.next_in,C=e.input,i=n+(e.avail_in-5),a=e.next_out,k=e.output,s=a-(t-e.avail_out),o=a+(e.avail_out-257),l=r.dmax,d=r.wsize,c=r.whave,u=r.wnext,h=r.window,f=r.hold,p=r.bits,m=r.lencode,g=r.distcode,_=(1<<r.lenbits)-1,w=(1<<r.distbits)-1;e:do{p<15&&(f+=C[n++]<<p,p+=8,f+=C[n++]<<p,p+=8),b=m[f&_];t:for(;;){if(f>>>=v=b>>>24,p-=v,0==(v=b>>>16&255))k[a++]=65535&b;else{if(!(16&v)){if(64&v){if(32&v){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}b=m[(65535&b)+(f&(1<<v)-1)];continue t}for(y=65535&b,(v&=15)&&(p<v&&(f+=C[n++]<<p,p+=8),y+=f&(1<<v)-1,f>>>=v,p-=v),p<15&&(f+=C[n++]<<p,p+=8,f+=C[n++]<<p,p+=8),b=g[f&w];;){if(f>>>=v=b>>>24,p-=v,16&(v=b>>>16&255)){if(x=65535&b,p<(v&=15)&&(f+=C[n++]<<p,(p+=8)<v&&(f+=C[n++]<<p,p+=8)),(x+=f&(1<<v)-1)>l){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=v,p-=v,x>(v=a-s)){if((v=x-v)>c&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(E=0,N=h,0===u){if(E+=d-v,v<y){y-=v;do{k[a++]=h[E++]}while(--v);E=a-x,N=k}}else if(u<v){if(E+=d+u-v,(v-=u)<y){y-=v;do{k[a++]=h[E++]}while(--v);if(E=0,u<y){y-=v=u;do{k[a++]=h[E++]}while(--v);E=a-x,N=k}}}else if(E+=u-v,v<y){y-=v;do{k[a++]=h[E++]}while(--v);E=a-x,N=k}for(;y>2;)k[a++]=N[E++],k[a++]=N[E++],k[a++]=N[E++],y-=3;y&&(k[a++]=N[E++],y>1&&(k[a++]=N[E++]))}else{E=a-x;do{k[a++]=k[E++],k[a++]=k[E++],k[a++]=k[E++],y-=3}while(y>2);y&&(k[a++]=k[E++],y>1&&(k[a++]=k[E++]))}break}if(64&v){e.msg="invalid distance code",r.mode=30;break e}b=g[(65535&b)+(f&(1<<v)-1)]}}break}}while(n<i&&a<o);n-=y=p>>3,f&=(1<<(p-=y<<3))-1,e.next_in=n,e.next_out=a,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=a<o?o-a+257:257-(a-o),r.hold=f,r.bits=p}},303:(e,t,r)=>{"use strict";var n=r(411),i=r(805),a=r(996),s=r(674),o=r(61),l=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=i.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;var r=n.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(s[r]);if(t.header&&n.deflateSetHeader(this.strm,t.header),t.dictionary){var c;if(c="string"==typeof t.dictionary?a.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=n.deflateSetDictionary(this.strm,c)))throw new Error(s[r]);this._dict_set=!0}}function c(e,t){var r=new d(t);if(r.push(e,!0),r.err)throw r.msg||s[r.err];return r.result}d.prototype.push=function(e,t){var r,s,o=this.strm,d=this.options.chunkSize;if(this.ended)return!1;s=t===~~t?t:!0===t?4:0,"string"==typeof e?o.input=a.string2buf(e):"[object ArrayBuffer]"===l.call(e)?o.input=new Uint8Array(e):o.input=e,o.next_in=0,o.avail_in=o.input.length;do{if(0===o.avail_out&&(o.output=new i.Buf8(d),o.next_out=0,o.avail_out=d),1!==(r=n.deflate(o,s))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==o.avail_out&&(0!==o.avail_in||4!==s&&2!==s)||("string"===this.options.to?this.onData(a.buf2binstring(i.shrinkBuf(o.output,o.next_out))):this.onData(i.shrinkBuf(o.output,o.next_out)))}while((o.avail_in>0||0===o.avail_out)&&1!==r);return 4===s?(r=n.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==s||(this.onEnd(0),o.avail_out=0,!0)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Deflate=d,t.deflate=c,t.deflateRaw=function(e,t){return(t=t||{}).raw=!0,c(e,t)},t.gzip=function(e,t){return(t=t||{}).gzip=!0,c(e,t)}},324:(e,t,r)=>{const{DOMParser:n,XMLSerializer:i}=r(152),{getMaxRelationshipId:a,createBlankHeaderXml:s,createBlankFooterXml:o}=r(249);function l(e,t,r){if(null==r)return;let n=e.getElementsByTagName(t)[0];n?n.textContent=r:(n=e.createElement(t),n.textContent=r,e.documentElement.appendChild(n))}e.exports={combineDocuments:function(e,t){const r="word/document.xml",l=[];let d,c,u,h=!1,f=!1;const{rindex:p,hindex:m,findex:g}=a(e);for(let i=0;i<e.length;i++){const a=e[i],s=!(i!==e.length-1),o=!(0!==i),m=a.file(r).asText(),g=(new n).parseFromString(m,"application/xml"),_=g.getElementsByTagName("w:body")[0];if(o){d=g.cloneNode(!0);const e=d.getElementsByTagName("w:body")[0];for(;e.firstChild;)e.removeChild(e.firstChild)}const w=_.cloneNode(!0),b=w.getElementsByTagName("w:sectPr");Array.from(b).forEach((e=>{if(e.parentNode===w&&!s){e.parentNode.removeChild(e);const r=w.ownerDocument,n=r.createElement("w:p"),i=r.createElement("w:pPr"),a=r.createElement("w:rPr");if(i.appendChild(a),i.appendChild(e),n.appendChild(i),t){const t=Array.from(e.childNodes).some((e=>"w:headerReference"===e.tagName&&"default"===e.getAttribute("w:type"))),i=Array.from(e.childNodes).some((e=>"w:footerReference"===e.tagName&&"default"===e.getAttribute("w:type")));if(t&&(h=!0),i&&(f=!0),!t){c=u&&!c?`rId${p+2}`:c||`rId${p+1}`;const t=r.createElement("w:headerReference");t.setAttribute("w:type","default"),t.setAttribute("r:id",c),e.appendChild(t)}if(!i){u=!u&&c?`rId${p+2}`:u||`rId${p+1}`;const t=r.createElement("w:footerReference");t.setAttribute("w:type","default"),t.setAttribute("r:id",u),e.appendChild(t)}const a=r.createElement("w:r"),s=r.createElement("w:br");s.setAttribute("w:type","page"),a.appendChild(s),n.appendChild(a),w.appendChild(n)}}})),l.push(w)}const _=d.getElementsByTagName("w:body")[0];l.forEach((e=>{Array.from(e.childNodes).forEach((e=>{_.appendChild(e)}))})),h&&s(e[0],c,m+1),f&&o(e[0],u,g+1);const w=(new i).serializeToString(d);e[0].file(r,w)},combineRelationships:function(e){let t,r,a;const s="word/_rels/document.xml.rels",o="[Content_Types].xml",l="word/fontTable.xml";for(const i of e){const e=i.file(s).asText(),d=new n,c=d.parseFromString(e,"application/xml"),u=c.getElementsByTagName("Relationship");if(t){const e=t.getElementsByTagName("Relationships")[0],r=Array.from(e.getElementsByTagName("Relationship")).map((e=>e.getAttribute("Target")));for(let t=0;t<u.length;t++){const n=u[t],i=n.getAttribute("Target");r.includes(i)||(e.appendChild(n.cloneNode(!0)),r.push(i))}}else t=c;const h=i.file(o).asText(),f=d.parseFromString(h,"application/xml"),p=f.getElementsByTagName("Override"),m=f.getElementsByTagName("Default");if(r){const e=r.getElementsByTagName("Types")[0],t=Array.from(e.getElementsByTagName("Override")).map((e=>e.getAttribute("PartName")));for(let r=0;r<p.length;r++){const n=p[r],i=n.getAttribute("PartName");t.includes(i)||(e.appendChild(n.cloneNode(!0)),t.push(i))}const n=Array.from(e.getElementsByTagName("Default")).map((e=>e.getAttribute("Extension")));for(let t=0;t<m.length;t++){const r=m[t],i=r.getAttribute("Extension");n.includes(i)||(e.appendChild(r.cloneNode(!0)),n.push(i))}}else r=f;const g=i.file(l).asText(),_=d.parseFromString(g,"application/xml");if(a){const e=a.getElementsByTagName("w:fonts")[0],t=Array.from(e.getElementsByTagName("w:font")).map((e=>e.getAttribute("w:name"))),r=_.getElementsByTagName("w:font");for(let n=0;n<r.length;n++){const i=r[n],a=i.getAttribute("w:name");t.includes(a)||(e.appendChild(i.cloneNode(!0)),t.push(a))}}else a=_}const d=new i,c=d.serializeToString(t),u=d.serializeToString(r),h=d.serializeToString(a);e[0].file(s,c),e[0].file(o,u),e[0].file(l,h)},combineAppInfo:function(e){const t="docProps/app.xml",r={Pages:0,Words:0,Characters:0,Lines:0,CharactersWithSpaces:0};for(let i=0;i<e.length;i++){const a=e[i].file(t).asText(),s=(new n).parseFromString(a,"application/xml"),o=s.getElementsByTagName("Pages")[0]?.textContent||0,l=s.getElementsByTagName("Words")[0]?.textContent||0,d=s.getElementsByTagName("Characters")[0]?.textContent||0,c=s.getElementsByTagName("Lines")[0]?.textContent||0,u=s.getElementsByTagName("CharactersWithSpaces")[0]?.textContent||0;r.Pages+=parseInt(o,10),r.Words+=parseInt(l,10),r.Characters+=parseInt(d,10),r.Lines+=parseInt(c,10),r.CharactersWithSpaces+=parseInt(u,10)}const a=e[0].file(t).asText(),s=(new n).parseFromString(a,"application/xml"),o=s.getElementsByTagName("Properties")[0];o.getElementsByTagName("Pages")[0].textContent=r.Pages.toString(),o.getElementsByTagName("Words")[0].textContent=r.Words.toString(),o.getElementsByTagName("Characters")[0].textContent=r.Characters.toString(),o.getElementsByTagName("Lines")[0].textContent=r.Lines.toString(),o.getElementsByTagName("CharactersWithSpaces")[0].textContent=r.CharactersWithSpaces.toString();const l=(new i).serializeToString(s);e[0].file(t,l)},mergeFiles:function(e){let t,r;const a="word/styles.xml",s=[];for(const i of e)if(t){const e=i.folder();e&&Object.keys(e.files).forEach((i=>{if(i.startsWith("word/")||i.startsWith("customXml/")){const r=e.files[i];r.dir||i.startsWith("word/_rels/document.xml.rels")||i.startsWith("word/document.xml")||s.includes(i)||(s.push(i),t.file(i,r.asUint8Array()))}if(i===a){const t=e.files[i].asText(),a=(new n).parseFromString(t,"application/xml").getElementsByTagName("w:styles")[0];a&&r&&Array.from(a.childNodes).forEach((e=>{"w:style"===e.tagName&&r.appendChild(e)}))}}))}else{t=i;const e=i.file(a).asText(),s=(new n).parseFromString(e,"application/xml");r=s.getElementsByTagName("w:styles")[0]}const o=(new i).serializeToString(r);return t.file(a,o),t},updateCore:function(e,t={title:"",subject:"",author:"",vision:"",keywords:"",description:"",lastModifiedBy:""}){const r="docProps/core.xml",a=e[0].file(r).asText();if(!a)return void console.warn("coreProperties.xml not found in the first file.");const s=new Date;s.setMilliseconds(0);const o=s.toISOString().slice(0,17)+"00Z",d={"dc:title":t.title,"dc:subject":t.subject,"dc:creator":t.author,"cp:keywords":t.keywords,"dc:description":t.description,"cp:lastModifiedBy":t.lastModifiedBy,"cp:revision":t.vision,"dcterms:modified":o},c=(new n).parseFromString(a,"application/xml");for(const[e,t]of Object.entries(d))l(c,e,t);const u=(new i).serializeToString(c);e[0].file(r,u)}}},327:e=>{"use strict";e.exports=function(e,t){return new Buffer(e,t)},e.exports.test=function(e){return Buffer.isBuffer(e)}},404:(e,t,r)=>{"use strict";var n=r(259),i=r(132),a=r(807),s=r(442),o=r(954);function l(e,t){this.options=e,this.loadOptions=t}l.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},prepareCompressedContent:function(e,t,r){return function(){var n=e.index;e.setIndex(t);var i=e.readData(r);return e.setIndex(n),i}},prepareContent:function(e,t,r,n,a){return function(){var e=i.transformTo(n.uncompressInputType,this.getCompressedContent()),t=n.uncompress(e);if(t.length!==a)throw new Error("Bug : uncompressed data size mismatch");return t}},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),-1==this.compressedSize||-1==this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize == -1 || uncompressedSize == -1)");if(null===(t=i.findCompression(this.compressionMethod)))throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");if(this.decompressed=new a,this.decompressed.compressedSize=this.compressedSize,this.decompressed.uncompressedSize=this.uncompressedSize,this.decompressed.crc32=this.crc32,this.decompressed.compressionMethod=this.compressionMethod,this.decompressed.getCompressedContent=this.prepareCompressedContent(e,e.index,this.compressedSize,t),this.decompressed.getContent=this.prepareContent(e,e.index,this.compressedSize,t,this.uncompressedSize),this.loadOptions.checkCRC32&&(this.decompressed=i.transformTo("string",this.decompressed.getContent()),s.crc32(this.decompressed)!==this.crc32))throw new Error("Corrupted zip : CRC32 mismatch")},readCentralPart:function(e){if(this.versionMadeBy=e.readInt(2),this.versionNeeded=e.readInt(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4),this.fileNameLength=e.readInt(2),this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");this.fileName=e.readData(this.fileNameLength),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0===e&&(this.dosPermissions=63&this.externalFileAttributes),3===e&&(this.unixPermissions=this.externalFileAttributes>>