Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

easy-template-x

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-template-x - npm Package Compare versions

Comparing version 0.7.3 to 0.8.0

13

CHANGELOG.md
# Change Log
## [0.8.0 - 2019-10-20](https://github.com/alonrbar/easy-template-x/tree/v0.8.0)
### Changed
- **BREAKING**: Delimiters can not contain leading or trailing whitespace.
- Loosen up `TemplateHandlerOptions` typings.
### Fixed
- Loop tag names trimming.
- Custom loop delimiters support.
- Zip export and typings.
## [0.7.3 - 2019-10-11](https://github.com/alonrbar/easy-template-x/tree/v0.7.3)

@@ -4,0 +17,0 @@

2

dist/easy-template-x.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("easy-template-x",[],t):"object"==typeof exports?exports["easy-template-x"]=t():e["easy-template-x"]=t()}(this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=22)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(40);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(11);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(41);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(26);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(27);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(28);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(29);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(30);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var l=r(31);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})});var c=r(32);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})});var d=r(33);Object.keys(d).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return d[e]}})});var u=r(34);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var f=r(35);Object.keys(f).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return f[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(36);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(9);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(37);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(38);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(39);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var l=r(10);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplatePlugin=void 0;t.TemplatePlugin=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}simpleTagReplacements(e,t,r){}containerTagReplacements(e,t,r){}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MimeTypeHelper=t.MimeType=void 0;var n=r(1);let i;t.MimeType=i,function(e){e.Png="image/png",e.Jpeg="image/jpeg",e.Gif="image/gif",e.Bmp="image/bmp",e.Svg="image/svg+xml"}(i||(t.MimeType=i={}));t.MimeTypeHelper=class{static getDefaultExtension(e){switch(e){case i.Png:return"png";case i.Jpeg:return"jpg";case i.Gif:return"gif";case i.Bmp:return"bmp";case i.Svg:return"svg";default:throw new n.UnsupportedFileTypeError(e)}}static getOfficeRelType(e){switch(e){case i.Png:case i.Jpeg:case i.Gif:case i.Bmp:case i.Svg:return"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";default:throw new n.UnsupportedFileTypeError(e)}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(51);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})})},function(e,t,r){"use strict";let n;Object.defineProperty(t,"__esModule",{value:!0}),t.TagDisposition=void 0,t.TagDisposition=n,function(e){e.Open="Open",e.Close="Close",e.SelfClosed="SelfClosed"}(n||(t.TagDisposition=n={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(47);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(57);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(12);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(58);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(13);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var l=r(15);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})});var c=r(59);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})});var d=r(60);Object.keys(d).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return d[e]}})});var u=r(16);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var f=r(3);Object.keys(f).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return f[e]}})});var p=r(17);Object.keys(p).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return p[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(24);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(25);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(43);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(6);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(45);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var l=r(46);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})});var c=r(61);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Base64=void 0;t.Base64=class{static encode(e){return"undefined"!=typeof btoa?btoa(e):new Buffer(e,"binary").toString("base64")}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.inheritsFrom=function(e,t){return e===t||e.prototype instanceof t},t.isPromiseLike=function(e){return!!e&&"object"==typeof e&&"function"==typeof e.then}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XmlNode=t.TEXT_NODE_NAME=t.XmlNodeType=void 0;var n=r(1),i=r(2);let o;t.XmlNodeType=o,function(e){e.Text="Text",e.General="General"}(o||(t.XmlNodeType=o={}));t.TEXT_NODE_NAME="#text";const s={createTextNode:e=>({nodeType:o.Text,nodeName:"#text",textContent:e}),createGeneralNode:e=>({nodeType:o.General,nodeName:e}),encodeValue(e){if(null===e||void 0===e)throw new n.MissingArgumentError("str");if("string"!=typeof e)throw new TypeError(`Expected a string, got '${e.constructor.name}'.`);return e.replace(/[<>&'"]/g,e=>{switch(e){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case"'":return"&apos;";case'"':return"&quot;"}return""})},serialize(e){if(this.isTextNode(e))return this.encodeValue(e.textContent||"");let t="";if(e.attributes){const r=Object.keys(e.attributes);r.length&&(t=" "+r.map(t=>`${t}="${e.attributes[t]}"`).join(" "))}const r=(e.childNodes||[]).length>0,n=r?"":"/",i=`<${e.nodeName}${t}${n}>`;let o;if(r){o=i+e.childNodes.map(e=>this.serialize(e)).join("")+`</${e.nodeName}>`}else o=i;return o},fromDomNode(e){let t;if(e.nodeType===e.TEXT_NODE)t=this.createTextNode(e.textContent);else if(t=this.createGeneralNode(e.nodeName),e.nodeType===e.ELEMENT_NODE){const r=e.attributes;if(r){t.attributes={};for(let e=0;e<r.length;e++){const n=r.item(e);t.attributes[n.name]=n.value}}}if(e.childNodes){let r;t.childNodes=[];for(let n=0;n<e.childNodes.length;n++){const i=e.childNodes.item(n),o=this.fromDomNode(i);t.childNodes.push(o),o.parentNode=t,r&&(r.nextSibling=o),r=o}}return t},isTextNode(e){if(e.nodeType===o.Text||"#text"===e.nodeName){if(e.nodeType!==o.Text||"#text"!==e.nodeName)throw new Error(`Invalid text node. Type: '${e.nodeType}', Name: '${e.nodeName}'.`);return!0}return!1},cloneNode(e,t){if(!e)throw new n.MissingArgumentError("node");if(t){const t=function e(t){const r={};r.nodeType=t.nodeType;r.nodeName=t.nodeName;if(s.isTextNode(t))r.textContent=t.textContent;else{const e=t.attributes;e&&(r.attributes=Object.assign({},e))}if(t.childNodes){let n;r.childNodes=[];for(const i of t.childNodes){const t=e(i);r.childNodes.push(t),t.parentNode=r,n&&(n.nextSibling=t),n=t}}return r}(e);return t.parentNode=null,t}{const t=Object.assign({},e);return t.parentNode=null,t.childNodes=e.childNodes?[]:null,t.nextSibling=null,t}},insertBefore(e,t){if(!e)throw new n.MissingArgumentError("newNode");if(!t)throw new n.MissingArgumentError("referenceNode");if(!t.parentNode)throw new Error("'referenceNode' has no parent");const r=t.parentNode.childNodes.indexOf(t);s.insertChild(t.parentNode,e,r)},insertAfter(e,t){if(!e)throw new n.MissingArgumentError("newNode");if(!t)throw new n.MissingArgumentError("referenceNode");if(!t.parentNode)throw new Error("'referenceNode' has no parent");const r=t.parentNode.childNodes.indexOf(t);s.insertChild(t.parentNode,e,r+1)},insertChild(e,t,r){if(!e)throw new n.MissingArgumentError("parent");if(s.isTextNode(e))throw new Error("Appending children to text nodes is forbidden");if(!t)throw new n.MissingArgumentError("child");if(e.childNodes||(e.childNodes=[]),r===e.childNodes.length)return void s.appendChild(e,t);if(r>e.childNodes.length)throw new RangeError(`Child index ${r} is out of range. Parent has only ${e.childNodes.length} child nodes.`);t.parentNode=e;const i=e.childNodes[r];if(t.nextSibling=i,r>0){e.childNodes[r-1].nextSibling=t}e.childNodes.splice(r,0,t)},appendChild(e,t){if(!e)throw new n.MissingArgumentError("parent");if(s.isTextNode(e))throw new Error("Appending children to text nodes is forbidden");if(!t)throw new n.MissingArgumentError("child");if(e.childNodes||(e.childNodes=[]),e.childNodes.length){e.childNodes[e.childNodes.length-1].nextSibling=t}t.nextSibling=null,t.parentNode=e,e.childNodes.push(t)},remove(e){if(!e)throw new n.MissingArgumentError("node");if(!e.parentNode)throw new Error("Node has no parent");a(e.parentNode,e)},removeChild:a,lastTextChild(e){if(s.isTextNode(e))return e;if(e.childNodes){const t=e.childNodes.filter(e=>s.isTextNode(e));if(t.length){const e=(0,i.last)(t);return e.textContent||(e.textContent=""),e}}const t={nodeType:o.Text,nodeName:"#text",textContent:""};return s.appendChild(e,t),t},removeSiblings(e,t){if(e===t)return[];const r=[];let n;for(e=e.nextSibling;e!==t;){const t=e;e=e.nextSibling,s.remove(t),r.push(t),n&&(n.nextSibling=t),n=t}return r},splitByChild(e,t,r){const n=function(e,t){const r=[];let n=t;for(;n!==e;){const e=n.parentNode;if(!e)throw new Error("Argument descendant is not a descendant of root");const t=e.childNodes.indexOf(n);r.push(t),n=e}return r.reverse()}(e,t),i=s.cloneNode(e,!1),o=n[0]+1;for(;o<e.childNodes.length;){const t=e.childNodes[o];s.remove(t),s.appendChild(i,t)}return e.parentNode&&s.insertAfter(i,e),r&&e.childNodes.length&&s.removeChild(e,e.childNodes.length-1),[e,i]},findParent(e,t){if(!e)return null;for(;e.parentNode;){if(t(e))return e;e=e.parentNode}return null},findParentByName:(e,t)=>s.findParent(e,e=>e.nodeName===t),findChildByName:(e,t)=>e?(e.childNodes||[]).find(e=>e.nodeName===t):null,siblingsInRange(e,t){if(!e)throw new n.MissingArgumentError("firstNode");if(!t)throw new n.MissingArgumentError("lastNode");const r=[];let i=e;for(;i&&i!==t;)r.push(i),i=i.nextSibling;if(!i)throw new Error("Nodes are not siblings.");return r.push(t),r},removeEmptyTextNodes(e){!function e(t){if(!t.childNodes)return t;const r=t.childNodes;t.childNodes=[];for(const n of r){if(s.isTextNode(n)){n.textContent&&n.textContent.match(/\S/)&&t.childNodes.push(n);continue}const r=e(n);t.childNodes.push(r)}return t}(e)}};function a(e,t){if(!e)throw new n.MissingArgumentError("parent");if(null===t||void 0===t)throw new n.MissingArgumentError("childOrIndex");if(!e.childNodes||!e.childNodes.length)throw new Error("Parent node has node children");let r;if("number"==typeof t)r=t;else if(-1===(r=e.childNodes.indexOf(t)))throw new Error("Specified child node is not a child of the specified parent");if(r>=e.childNodes.length)throw new RangeError(`Child index ${r} is out of range. Parent has only ${e.childNodes.length} child nodes.`);const i=e.childNodes[r];if(r>0){e.childNodes[r-1].nextSibling=i.nextSibling}return i.parentNode=null,i.nextSibling=null,e.childNodes.splice(r,1)[0]}t.XmlNode=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImagePlugin=void 0;var n=r(4),i=r(0),o=r(3);let s=1;t.ImagePlugin=class extends o.TemplatePlugin{constructor(...e){var t,r,n;super(...e),n="image",(r="contentType")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n}async simpleTagReplacements(e,t,r){const o=this.utilities.docxParser.containingTextNode(e.xmlTextNode),a=t.getScopeData();if(!a||!a.source)return void i.XmlNode.remove(o);const l=await r.docx.mediaFiles.add(a.source,a.format),c=n.MimeTypeHelper.getOfficeRelType(a.format),d=await r.docx.rels.add(l,c);await r.docx.contentTypes.ensureContentType(a.format);const u=s++,f=this.createMarkup(u,d,a.width,a.height);i.XmlNode.insertAfter(f,o),i.XmlNode.remove(o)}createMarkup(e,t,r,n){const o=`Picture ${e}`,s=`\n <w:drawing>\n <wp:inline distT="0" distB="0" distL="0" distR="0">\n <wp:extent cx="${this.pixelsToEmu(r)}" cy="${this.pixelsToEmu(n)}"/>\n <wp:effectExtent l="0" t="0" r="0" b="0"/>\n <wp:docPr id="${e}" name="${o}"/>\n <wp:cNvGraphicFramePr>\n <a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/>\n </wp:cNvGraphicFramePr>\n <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">\n <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">\n ${this.pictureMarkup(o,t,r,n)}\n </a:graphicData>\n </a:graphic>\n </wp:inline>\n </w:drawing>\n `,a=this.utilities.xmlParser.parse(s);return i.XmlNode.removeEmptyTextNodes(a),a}pictureMarkup(e,t,r,n){return`\n <pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">\n <pic:nvPicPr>\n <pic:cNvPr id="0" name="${e}"/>\n <pic:cNvPicPr>\n <a:picLocks noChangeAspect="1" noChangeArrowheads="1"/>\n </pic:cNvPicPr>\n </pic:nvPicPr>\n <pic:blipFill>\n <a:blip r:embed="${t}">\n <a:extLst>\n <a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}">\n <a14:useLocalDpi xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" val="0"/>\n </a:ext>\n </a:extLst>\n </a:blip>\n <a:srcRect/>\n <a:stretch>\n <a:fillRect/>\n </a:stretch>\n </pic:blipFill>\n <pic:spPr bwMode="auto">\n <a:xfrm>\n <a:off x="0" y="0"/>\n <a:ext cx="${this.pixelsToEmu(r)}" cy="${this.pixelsToEmu(n)}"/>\n </a:xfrm>\n <a:prstGeom prst="rect">\n <a:avLst/>\n </a:prstGeom>\n <a:noFill/>\n <a:ln>\n <a:noFill/>\n </a:ln>\n </pic:spPr>\n </pic:pic>\n `}pixelsToEmu(e){return Math.round(9525*e)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LinkPlugin=void 0;var n=r(5),i=r(0),o=r(3);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class a extends o.TemplatePlugin{constructor(...e){super(...e),s(this,"contentType","link")}async simpleTagReplacements(e,t,r){const n=this.utilities.docxParser.containingTextNode(e.xmlTextNode),o=t.getScopeData();if(!o||!o.target)return void i.XmlNode.remove(n);const s=await r.docx.rels.add(o.target,a.linkRelType,{TargetMode:"External"}),l=this.utilities.docxParser.containingRunNode(n),c=this.generateMarkup(o,s,l);this.insertHyperlinkNode(c,l,n)}generateMarkup(e,t,r){const o=`\n <w:hyperlink r:id="${t}" w:history="1">\n <w:r>\n <w:t>${e.text||e.target}</w:t>\n </w:r>\n </w:hyperlink>\n `,s=this.utilities.xmlParser.parse(o);i.XmlNode.removeEmptyTextNodes(s);const a=r.childNodes.find(e=>e.nodeName===n.DocxParser.RUN_PROPERTIES_NODE);if(a){const e=i.XmlNode.cloneNode(a,!0);s.childNodes[0].childNodes.unshift(e)}return s}insertHyperlinkNode(e,t,r){let o=t.childNodes.filter(e=>e.nodeName===n.DocxParser.TEXT_NODE);if(o.length>1){const[s]=i.XmlNode.splitByChild(t,r,!0);o=s.childNodes.filter(e=>e.nodeName===n.DocxParser.TEXT_NODE),i.XmlNode.insertAfter(e,s),0===o.length&&i.XmlNode.remove(s)}else i.XmlNode.insertAfter(e,t),i.XmlNode.remove(t)}}t.LinkPlugin=a,s(a,"linkRelType","http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Docx=void 0;var n=r(1),i=r(48),o=r(49),s=r(50);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.Docx=class{get documentPath(){return this._documentPath||(this.zip.isFileExist("word/document.xml")?this._documentPath="word/document.xml":this.zip.isFileExist("word/document2.xml")&&(this._documentPath="word/document2.xml")),this._documentPath}constructor(e,t){if(this.zip=e,this.xmlParser=t,a(this,"rels",void 0),a(this,"mediaFiles",void 0),a(this,"contentTypes",void 0),a(this,"_documentPath",void 0),a(this,"_document",void 0),!this.documentPath)throw new n.MalformedFileError("docx");this.rels=new s.Rels(this.documentPath,e,t),this.mediaFiles=new o.MediaFiles(e),this.contentTypes=new i.ContentTypesFile(e,t)}async getDocument(){if(!this._document){const e=await this.zip.getFile(this.documentPath).getContentText();this._document=this.xmlParser.parse(e)}return this._document}async getDocumentText(){const e=await this.getDocument(),t=this.xmlParser.serialize(e);return this.xmlParser.domParse(t).documentElement.textContent}async export(e){return await this.saveChanges(),await this.zip.export(e)}async saveChanges(){const e=await this.getDocument(),t=this.xmlParser.serialize(e);this.zip.setFile(this.documentPath,t),await this.rels.save(),await this.contentTypes.save()}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopPlugin=t.LOOP_CONTENT_TYPE=void 0;var n=r(2),i=r(0),o=r(52),s=r(3);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const l="loop";t.LOOP_CONTENT_TYPE=l;t.LoopPlugin=class extends s.TemplatePlugin{constructor(...e){super(...e),a(this,"contentType",l),a(this,"loopStrategies",[new o.LoopTableStrategy,new o.LoopListStrategy,new o.LoopParagraphStrategy])}setUtilities(e){this.utilities=e,this.loopStrategies.forEach(t=>t.setUtilities(e))}async containerTagReplacements(e,t,r){let i=t.getScopeData();i&&Array.isArray(i)&&i.length||(i=[]);const o=e[0],s=(0,n.last)(e),a=this.loopStrategies.find(e=>e.isApplicable(o,s));if(!a)throw new Error(`No loop strategy found for tag '${o.rawText}'.`);const{firstNode:l,nodesToRepeat:c,lastNode:d}=a.splitBefore(o,s),u=this.repeat(c,i.length),f=await this.compile(u,t,r);a.mergeBack(f,l,d)}repeat(e,t){if(!e.length||!t)return[];const r=[];for(let n=0;n<t;n++){const t=e.map(e=>i.XmlNode.cloneNode(e,!0));r.push(t)}return r}async compile(e,t,r){const n=[];for(let o=0;o<e.length;o++){const s=e[o],a=i.XmlNode.createGeneralNode("dummyRootNode");s.forEach(e=>i.XmlNode.appendChild(a,e)),t.path.push(o),await this.utilities.compiler.compile(a,t,r),t.path.pop();const l=[];for(;a.childNodes&&a.childNodes.length;){const e=i.XmlNode.removeChild(a,0);l.push(e)}n.push(l)}return n}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RawXmlPlugin=void 0;var n=r(0),i=r(3);t.RawXmlPlugin=class extends i.TemplatePlugin{constructor(...e){var t,r,n;super(...e),n="rawXml",(r="contentType")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n}simpleTagReplacements(e,t){const r=this.utilities.docxParser.containingTextNode(e.xmlTextNode),i=t.getScopeData();if(i&&"string"==typeof i.xml){const e=this.utilities.xmlParser.parse(i.xml);n.XmlNode.insertBefore(e,r)}n.XmlNode.remove(r)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextPlugin=t.TEXT_CONTENT_TYPE=void 0;var n=r(5),i=r(0),o=r(3);const s="text";t.TEXT_CONTENT_TYPE=s;t.TextPlugin=class extends o.TemplatePlugin{constructor(...e){var t,r,n;super(...e),n=s,(r="contentType")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n}simpleTagReplacements(e,t){const r=t.getScopeData(),n=(null===r||void 0===r?"":r.toString()).split("\n");n.length<2?this.replaceSingleLine(e.xmlTextNode,n.length?n[0]:""):this.replaceMultiLine(e.xmlTextNode,n)}replaceSingleLine(e,t){e.textContent=t;const r=this.utilities.docxParser.containingTextNode(e);this.utilities.docxParser.setSpacePreserveAttribute(r)}replaceMultiLine(e,t){const r=this.utilities.docxParser.containingRunNode(e);e.textContent=t[0];for(let e=1;e<t.length;e++){const n=this.getLineBreak();i.XmlNode.appendChild(r,n);const o=this.createWordTextNode(t[e]);i.XmlNode.appendChild(r,o)}}getLineBreak(){return i.XmlNode.createGeneralNode("w:br")}createWordTextNode(e){const t=i.XmlNode.createGeneralNode(n.DocxParser.TEXT_NODE);return t.attributes={},this.utilities.docxParser.setSpacePreserveAttribute(t),t.childNodes=[i.XmlNode.createTextNode(e)],t}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Delimiters=void 0;var n=r(0);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.Delimiters=class{constructor(e){if(i(this,"tagStart","{"),i(this,"tagEnd","}"),i(this,"containerTagOpen","#"),i(this,"containerTagClose","/"),Object.assign(this,e),this.encodeAndValidate(),this.containerTagOpen===this.containerTagClose)throw new Error("containerTagOpen can not be equal to containerTagClose")}encodeAndValidate(){const e=["tagStart","tagEnd","containerTagOpen","containerTagClose"];for(const t of e){const e=this[t];if(!e)throw new Error(`${t} must be specified.`);this[t]=n.XmlNode.encodeValue(e)}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateHandlerOptions=void 0;var n=r(18),i=r(7);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.TemplateHandlerOptions=class{constructor(e){if(o(this,"plugins",(0,i.createDefaultPlugins)()),o(this,"defaultContentType",i.TEXT_CONTENT_TYPE),o(this,"containerContentType",i.LOOP_CONTENT_TYPE),o(this,"delimiters",new n.Delimiters),o(this,"maxXmlDepth",20),Object.assign(this,e),e&&(this.delimiters=new n.Delimiters(e.delimiters)),!this.plugins.length)throw new Error("Plugins list can not be empty")}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JsZipHelper=void 0;var n=r(1),i=r(2);t.JsZipHelper=class{static toJsZipOutputType(e){if(!e)throw new n.MissingArgumentError("binaryOrType");let t;if(t="function"==typeof e?e:e.constructor,i.Binary.isBlobConstructor(t))return"blob";if(i.Binary.isArrayBufferConstructor(t))return"arraybuffer";if(i.Binary.isBufferConstructor(t))return"nodebuffer";throw new Error(`Binary type '${t.name}' is not supported.`)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ZipObject=void 0;var n=r(20);t.ZipObject=class{get name(){return this.zipObject.name}set name(e){this.zipObject.name=e}get isDirectory(){return this.zipObject.dir}constructor(e){this.zipObject=e}getContentText(){return this.zipObject.async("text")}getContentBase64(){return this.zipObject.async("binarystring")}getContentBinary(e){const t=n.JsZipHelper.toJsZipOutputType(e);return this.zipObject.async(t)}}},function(e,t,r){e.exports=r(23)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(8);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(1);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(5);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(7);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(2);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var l=r(0);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})});var c=r(18);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})});var d=r(4);Object.keys(d).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return d[e]}})});var u=r(62);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var f=r(63);Object.keys(f).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return f[e]}})});var p=r(19);Object.keys(p).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return p[e]}})})},function(e,t,r){"use strict"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DelimiterSearcher=void 0;var n=r(1),i=r(2),o=r(0);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class a{constructor(){s(this,"delimiterIndex",0),s(this,"openNodes",[]),s(this,"firstMatchIndex",-1)}reset(){this.delimiterIndex=0,this.openNodes=[],this.firstMatchIndex=-1}}t.DelimiterSearcher=class{constructor(e){if(this.docxParser=e,s(this,"maxXmlDepth",20),s(this,"startDelimiter","{"),s(this,"endDelimiter","}"),!e)throw new n.MissingArgumentError("docxParser")}findDelimiters(e){const t=[],r=new a,n=new o.XmlDepthTracker(this.maxXmlDepth);let s=!0;for(;e;){if(this.docxParser.isParagraphNode(e)&&r.reset(),!this.shouldSearchNode(e)){e=this.findNextNode(e,n);continue}r.openNodes.push(e);let o=0;for(;o<e.textContent.length;){const n=s?this.startDelimiter:this.endDelimiter;if(e.textContent[o]===n[r.delimiterIndex])if(-1===r.firstMatchIndex&&(r.firstMatchIndex=o),r.delimiterIndex===n.length-1){if(r.openNodes.length>1){const t=(0,i.first)(r.openNodes),n=(0,i.last)(r.openNodes);this.docxParser.joinTextNodesRange(t,n),o+=t.textContent.length-e.textContent.length,e=t}const n=this.createDelimiterMark(r,s);t.push(n),s=!s,r.reset(),o<e.textContent.length-1&&r.openNodes.push(e)}else r.delimiterIndex++;else-1!==r.firstMatchIndex&&(e=(0,i.first)(r.openNodes),o=r.firstMatchIndex),r.reset(),o<e.textContent.length-1&&r.openNodes.push(e);o++}e=this.findNextNode(e,n)}return t}shouldSearchNode(e){return!!(o.XmlNode.isTextNode(e)&&e.textContent&&e.parentNode&&this.docxParser.isTextNode(e.parentNode))}findNextNode(e,t){if(e.childNodes&&e.childNodes.length)return t.increment(),e.childNodes[0];if(e.nextSibling)return e.nextSibling;for(;e.parentNode;){if(e.parentNode.nextSibling)return t.decrement(),e.parentNode.nextSibling;t.decrement(),e=e.parentNode}return null}createDelimiterMark(e,t){return{index:e.firstMatchIndex,isOpen:t,xmlTextNode:e.openNodes[0]}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MalformedFileError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Malformed file detected. Make sure the file is a valid ${e} file.`),i=void 0,(r="expectedFileType")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.expectedFileType=e,Object.setPrototypeOf(this,n.prototype)}}t.MalformedFileError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MaxXmlDepthError=void 0;class n extends Error{constructor(e){var t,r,i;super(`XML maximum depth reached (max depth: ${e}).`),i=void 0,(r="maxDepth")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.maxDepth=e,Object.setPrototypeOf(this,n.prototype)}}t.MaxXmlDepthError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingArgumentError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Argument '${e}' is missing.`),i=void 0,(r="argName")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.argName=e,Object.setPrototypeOf(this,n.prototype)}}t.MissingArgumentError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingCloseDelimiterError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Close delimiter is missing from '${e}'.`),i=void 0,(r="openDelimiterText")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.openDelimiterText=e,Object.setPrototypeOf(this,n.prototype)}}t.MissingCloseDelimiterError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingStartDelimiterError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Open delimiter is missing from '${e}'.`),i=void 0,(r="closeDelimiterText")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.closeDelimiterText=e,Object.setPrototypeOf(this,n.prototype)}}t.MissingStartDelimiterError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnclosedTagError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Tag '${e}' is never closed.`),i=void 0,(r="tagName")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.tagName=e,Object.setPrototypeOf(this,n.prototype)}}t.UnclosedTagError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnidentifiedFileTypeError=void 0;class n extends Error{constructor(){super("The filetype for this file could not be identified, is this file corrupted?"),Object.setPrototypeOf(this,n.prototype)}}t.UnidentifiedFileTypeError=n},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.UnknownContentTypeError=void 0;class i extends Error{constructor(e,t,r){super(`Content type '${e}' does not have a registered plugin to handle it.`),n(this,"tagRawText",void 0),n(this,"contentType",void 0),n(this,"path",void 0),this.contentType=e,this.tagRawText=t,this.path=r,Object.setPrototypeOf(this,i.prototype)}}t.UnknownContentTypeError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnopenedTagError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Tag '${e}' is closed but was never opened.`),i=void 0,(r="tagName")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.tagName=e,Object.setPrototypeOf(this,n.prototype)}}t.UnopenedTagError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnsupportedFileTypeError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Filetype "${e}" is not supported.`),i=void 0,(r="fileType")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.fileType=e,Object.setPrototypeOf(this,n.prototype)}}t.UnsupportedFileTypeError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pushMany=function(e,t){Array.prototype.push.apply(e,t)},t.first=function(e){return e.length?e[0]:void 0},t.last=function(e){return e.length?e[e.length-1]:void 0},t.toDictionary=function(e,t,r){if(!e.length)return{};const n={};return e.forEach((e,i)=>{const o=t(e,i),s=r?r(e,i):e;if(n[o])throw new Error(`Key '${o}' already exists in the dictionary.`);n[o]=s}),n}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Binary=void 0;var n=r(9),i=r(10);const o={isBlob(e){return this.isBlobConstructor(e.constructor)},isArrayBuffer(e){return this.isArrayBufferConstructor(e.constructor)},isBuffer(e){return this.isBufferConstructor(e.constructor)},isBlobConstructor:e=>"undefined"!=typeof Blob&&(0,i.inheritsFrom)(e,Blob),isArrayBufferConstructor:e=>"undefined"!=typeof ArrayBuffer&&(0,i.inheritsFrom)(e,ArrayBuffer),isBufferConstructor:e=>"undefined"!=typeof Buffer&&(0,i.inheritsFrom)(e,Buffer),toBase64(e){if(this.isBlob(e))return new Promise(t=>{const r=new FileReader;r.onload=function(){const e=n.Base64.encode(this.result);t(e)},r.readAsBinaryString(e)});if(this.isBuffer(e))return Promise.resolve(e.toString("base64"));if(this.isArrayBuffer(e)){const t=new Uint8Array(e).reduce((e,t)=>e+String.fromCharCode(t),""),r=n.Base64.encode(t);return Promise.resolve(r)}throw new Error(`Binary type '${e.constructor.name}' is not supported.`)}};t.Binary=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Path=void 0;t.Path=class{static getFilename(e){const t=e.lastIndexOf("/");return e.substr(t+1)}static getDirectory(e){const t=e.lastIndexOf("/");return e.substring(0,t)}}},function(e,t,r){"use strict";function n(e,t){return e<<t|e>>>32-t}function i(e){let t="";for(let r=7;r>=0;r--){t+=(e>>>4*r&15).toString(16)}return t}Object.defineProperty(t,"__esModule",{value:!0}),t.sha1=function(e){const t=(e=function(e){e=e.replace(/\r\n/g,"\n");let t="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);n<128?t+=String.fromCharCode(n):n>127&&n<2048?(t+=String.fromCharCode(n>>6|192),t+=String.fromCharCode(63&n|128)):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t}(e)).length;let r,o;const s=[];for(r=0;r<t-3;r+=4)o=e.charCodeAt(r)<<24|e.charCodeAt(r+1)<<16|e.charCodeAt(r+2)<<8|e.charCodeAt(r+3),s.push(o);switch(t%4){case 0:r=2147483648;break;case 1:r=e.charCodeAt(t-1)<<24|8388608;break;case 2:r=e.charCodeAt(t-2)<<24|e.charCodeAt(t-1)<<16|32768;break;case 3:r=e.charCodeAt(t-3)<<24|e.charCodeAt(t-2)<<16|e.charCodeAt(t-1)<<8|128}s.push(r);for(;s.length%16!=14;)s.push(0);s.push(t>>>29),s.push(t<<3&4294967295);const a=new Array(80);let l,c,d,u,f,p,h=1732584193,m=4023233417,g=2562383102,b=271733878,y=3285377520;for(let e=0;e<s.length;e+=16){for(r=0;r<16;r++)a[r]=s[e+r];for(r=16;r<=79;r++)a[r]=n(a[r-3]^a[r-8]^a[r-14]^a[r-16],1);for(l=h,c=m,d=g,u=b,f=y,r=0;r<=19;r++)p=n(l,5)+(c&d|~c&u)+f+a[r]+1518500249&4294967295,f=u,u=d,d=n(c,30),c=l,l=p;for(r=20;r<=39;r++)p=n(l,5)+(c^d^u)+f+a[r]+1859775393&4294967295,f=u,u=d,d=n(c,30),c=l,l=p;for(r=40;r<=59;r++)p=n(l,5)+(c&d|c&u|d&u)+f+a[r]+2400959708&4294967295,f=u,u=d,d=n(c,30),c=l,l=p;for(r=60;r<=79;r++)p=n(l,5)+(c^d^u)+f+a[r]+3395469782&4294967295,f=u,u=d,d=n(c,30),c=l,l=p;h=h+l&4294967295,m=m+c&4294967295,g=g+d&4294967295,b=b+u&4294967295,y=y+f&4294967295}return(p=i(h)+i(m)+i(g)+i(b)+i(y)).toLowerCase()}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XmlDepthTracker=void 0;var n=r(1);t.XmlDepthTracker=class{constructor(e){var t,r,n;this.maxDepth=e,n=0,(r="depth")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n}increment(){if(this.depth++,this.depth>this.maxDepth)throw new n.MaxXmlDepthError(this.maxDepth)}decrement(){this.depth--}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XmlParser=void 0;var n=r(42),i=r(1),o=r(11);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class a{parse(e){const t=this.domParse(e);return o.XmlNode.fromDomNode(t.documentElement)}domParse(e){if(null===e||void 0===e)throw new i.MissingArgumentError("str");return a.parser.parseFromString(e,"text/xml")}serialize(e){return a.xmlHeader+o.XmlNode.serialize(e)}}t.XmlParser=a,s(a,"xmlHeader",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),s(a,"parser",new n.DOMParser)},function(e,t){e.exports=require("xmldom")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ScopeData=void 0;var n=r(2);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const o=r(44);t.ScopeData=class{constructor(e){i(this,"path",[]),i(this,"allData",void 0),this.allData=e}getScopeData(){const e=(0,n.last)(this.path);let t,r=this.path.slice();for(;void 0===t&&r.length;){const n=r.slice(0,r.length-1);t=o(this.allData,n.concat(e)),r=n}return t}}},function(e,t){e.exports=require("lodash.get")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TagParser=void 0;var n=r(1),i=r(6);t.TagParser=class{constructor(e,t){var r,i,o;if(this.docParser=e,this.delimiters=t,o=void 0,(i="tagRegex")in(r=this)?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o,!e)throw new n.MissingArgumentError("docParser");if(!t)throw new n.MissingArgumentError("delimiters");this.tagRegex=new RegExp(`^[${t.tagStart}](.*?)[${t.tagEnd}]`,"mi")}parse(e){const t=[];let r,i;for(let o=0;o<e.length;o++){const s=e[o];if(!r&&!s.isOpen){const e=s.xmlTextNode.textContent;throw new n.MissingStartDelimiterError(e)}if(r&&s.isOpen){const e=i.xmlTextNode.textContent;throw new n.MissingCloseDelimiterError(e)}!r&&s.isOpen&&(r={},i=s),r&&!s.isOpen&&(this.normalizeTagNodes(i,s,o,e),r.xmlTextNode=i.xmlTextNode,this.processTag(r),t.push(r),r=null,i=null)}return t}normalizeTagNodes(e,t,r,n){let i=e.xmlTextNode,o=t.xmlTextNode;const s=i===o;e.index>0&&(this.docParser.splitTextNode(i,e.index,!0),s&&(t.index-=e.index)),t.index<o.textContent.length-1&&(o=this.docParser.splitTextNode(o,t.index+1,!0),s&&(i=o)),s||(this.docParser.joinTextNodesRange(i,o),o=i);for(let i=r+1;i<n.length;i++){let r=!1;const o=n[i];if(o.xmlTextNode===e.xmlTextNode&&(o.index-=e.index,r=!0),o.xmlTextNode===t.xmlTextNode&&(o.index-=t.index+1,r=!0),!r)break}e.xmlTextNode=i,t.xmlTextNode=o}processTag(e){e.rawText=e.xmlTextNode.textContent;const t=(this.tagRegex.exec(e.rawText)[1]||"").trim();t&&t.length?t[0]===this.delimiters.containerTagOpen?(e.disposition=i.TagDisposition.Open,e.name=t.slice(1)):t[0]===this.delimiters.containerTagClose?(e.disposition=i.TagDisposition.Close,e.name=t.slice(1)):(e.disposition=i.TagDisposition.SelfClosed,e.name=t):e.disposition=i.TagDisposition.SelfClosed}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateCompiler=void 0;var n=r(1),i=r(7),o=r(2),s=r(6);t.TemplateCompiler=class{constructor(e,t,r,n,i){var s,a,l;this.delimiterSearcher=e,this.tagParser=t,this.defaultContentType=n,this.containerContentType=i,l=void 0,(a="pluginsLookup")in(s=this)?Object.defineProperty(s,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):s[a]=l,this.pluginsLookup=(0,o.toDictionary)(r,e=>e.contentType)}async compile(e,t,r){const n=this.parseTags(e);await this.doTagReplacements(n,t,r)}parseTags(e){const t=this.delimiterSearcher.findDelimiters(e);return this.tagParser.parse(t)}async doTagReplacements(e,t,r){for(let i=0;i<e.length;i++){const a=e[i];t.path.push(a.name);const l=this.detectContentType(a,t),c=this.pluginsLookup[l];if(!c)throw new n.UnknownContentTypeError(l,a.rawText,t.path.join("."));if(a.disposition===s.TagDisposition.SelfClosed){const e=c.simpleTagReplacements(a,t,r);(0,o.isPromiseLike)(e)&&await e}else if(a.disposition===s.TagDisposition.Open){const n=this.findCloseTagIndex(i,a,e),s=e.slice(i,n+1);i=n;const l=c.containerTagReplacements(s,t,r);(0,o.isPromiseLike)(l)&&await l}t.path.pop()}}detectContentType(e,t){if(e.disposition===s.TagDisposition.Open||e.disposition===s.TagDisposition.Close)return this.containerContentType;const r=t.getScopeData();return i.PluginContent.isPluginContent(r)?r._type:this.defaultContentType}findCloseTagIndex(e,t,r){let i=e;for(;i<r.length;i++){const e=r[i];if(e.name===t.name&&e.disposition===s.TagDisposition.Close)break}if(i===r.length)throw new n.UnclosedTagError(t.name);return i}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createDefaultPlugins=function(){return[new o.LoopPlugin,new s.RawXmlPlugin,new n.ImagePlugin,new i.LinkPlugin,new a.TextPlugin]};var n=r(12),i=r(13),o=r(15),s=r(16),a=r(17)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContentTypesFile=void 0;var n=r(4),i=r(0);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class s{constructor(e,t){this.zip=e,this.xmlParser=t,o(this,"addedNew",!1),o(this,"root",void 0),o(this,"contentTypes",void 0)}async ensureContentType(e){if(await this.parseContentTypesFile(),this.contentTypes[e])return;const t=n.MimeTypeHelper.getDefaultExtension(e),r=i.XmlNode.createGeneralNode("Default");r.attributes={Extension:t,ContentType:e},this.root.childNodes.push(r),this.addedNew=!0,this.contentTypes[e]=!0}async count(){return await this.parseContentTypesFile(),this.root.childNodes.filter(e=>!i.XmlNode.isTextNode(e)).length}async save(){if(!this.addedNew)return;const e=this.xmlParser.serialize(this.root);this.zip.setFile(s.contentTypesFilePath,e)}async parseContentTypesFile(){if(this.root)return;const e=await this.zip.getFile(s.contentTypesFilePath).getContentText();this.root=this.xmlParser.parse(e),this.contentTypes={};for(const e of this.root.childNodes){if("Default"!==e.nodeName)continue;const t=e.attributes.ContentType;t&&this.contentTypes[t]}}}t.ContentTypesFile=s,o(s,"contentTypesFilePath","[Content_Types].xml")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediaFiles=void 0;var n=r(4),i=r(2);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class s{constructor(e){this.zip=e,o(this,"hashes",void 0),o(this,"files",new Map),o(this,"nextFileId",0)}async add(e,t){if(this.files.has(e))return this.files.get(e);await this.hashMediaFiles();const r=await i.Binary.toBase64(e),o=(0,i.sha1)(r);let a=Object.keys(this.hashes).find(e=>this.hashes[e]===o);if(a)return a;const l=n.MimeTypeHelper.getDefaultExtension(t);do{this.nextFileId++,a=`${s.mediaDir}/media${this.nextFileId}.${l}`}while(this.hashes[a]);return await this.zip.setFile(a,e),this.hashes[a]=o,this.files.set(e,a),a}async count(){return await this.hashMediaFiles(),Object.keys(this.hashes).length}async hashMediaFiles(){if(!this.hashes){this.hashes={};for(const e of this.zip.listFiles()){if(!e.startsWith(s.mediaDir))continue;const t=i.Path.getFilename(e);if(!t)continue;const r=await this.zip.getFile(e).getContentBase64(),n=(0,i.sha1)(r);this.hashes[t]=n}}}}t.MediaFiles=s,o(s,"mediaDir","word/media")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Rels=void 0;var n=r(2),i=r(0);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.Rels=class{constructor(e,t,r){this.zip=t,this.xmlParser=r,o(this,"root",void 0),o(this,"relIds",void 0),o(this,"relTargets",void 0),o(this,"nextRelId",0),o(this,"partDir",void 0),o(this,"relsFilePath",void 0),this.partDir=n.Path.getDirectory(e);const i=n.Path.getFilename(e);this.relsFilePath=`${this.partDir}/_rels/${i}.rels`}async add(e,t,r){e.startsWith(this.partDir)&&(e=e.substr(this.partDir.length+1)),await this.parseRelsFile();const n=this.getRelTargetKey(t,e);let o=this.relTargets[n];if(o)return o;o=this.getNextRelId();const s=i.XmlNode.createGeneralNode("Relationship");return s.attributes=Object.assign({Id:o,Type:t,Target:e},r),this.root.childNodes.push(s),this.relIds[o]=!0,this.relTargets[n]=o,o}async save(){if(!this.root)return;const e=this.xmlParser.serialize(this.root);this.zip.setFile(this.relsFilePath,e)}getNextRelId(){let e;do{this.nextRelId++,e="rId"+this.nextRelId}while(this.relIds[e]);return e}async parseRelsFile(){if(this.root)return;let e;const t=this.zip.getFile(this.relsFilePath);e=t?await t.getContentText():'<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n </Relationships>',this.root=this.xmlParser.parse(e),this.relIds={},this.relTargets={};for(const e of this.root.childNodes){const t=e.attributes;if(!t)continue;const r=t.Id;if(!r)continue;this.relIds[r]=!0;const n=t.Type,i=t.Target;if(n&&i){const e=this.getRelTargetKey(n,i);this.relTargets[e]=r}}}getRelTargetKey(e,t){return`${e} - ${t}`}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DocxParser=void 0;var n=r(0),i=r(14);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class s{constructor(e){this.xmlParser=e}load(e){return new i.Docx(e,this.xmlParser)}splitTextNode(e,t,r){let i,o;const s=this.containingTextNode(e),a=n.XmlNode.cloneNode(s,!0);if(this.setSpacePreserveAttribute(s),this.setSpacePreserveAttribute(a),r)n.XmlNode.insertBefore(a,s),i=n.XmlNode.lastTextChild(a),o=e;else{const t=s.parentNode.childNodes.indexOf(s);n.XmlNode.insertChild(s.parentNode,a,t+1),i=e,o=n.XmlNode.lastTextChild(a)}const l=i.textContent,c=o.textContent;return i.textContent=l.substring(0,t),o.textContent=c.substring(t),r?i:o}joinTextNodesRange(e,t){const r=this.containingRunNode(e),i=this.containingRunNode(t),o=r.parentNode;if(i.parentNode!==o)throw new Error("Can not join text nodes from separate paragraphs.");const a=this.containingTextNode(e),l=this.containingTextNode(t),c=[];let d=r;for(;d;){let e;for(e=d===r?a:this.firstTextNodeChild(d);e;){if(e.nodeName!==s.TEXT_NODE)continue;const t=n.XmlNode.lastTextChild(e);c.push(t.textContent);const r=e;e=e===l?null:e.nextSibling,r!==a&&n.XmlNode.remove(r)}const t=d;d=d===i?null:d.nextSibling,t.childNodes&&t.childNodes.length||n.XmlNode.remove(t)}n.XmlNode.lastTextChild(a).textContent=c.join("")}joinParagraphs(e,t){if(e===t)return;let r=0;for(;t.childNodes&&r<t.childNodes.length;){const i=t.childNodes[r];i.nodeName===s.RUN_NODE?(n.XmlNode.removeChild(t,r),n.XmlNode.appendChild(e,i)):r++}}setSpacePreserveAttribute(e){e.attributes||(e.attributes={}),e.attributes["xml:space"]||(e.attributes["xml:space"]="preserve")}isTextNode(e){return e.nodeName===s.TEXT_NODE}isTableCellNode(e){return e.nodeName===s.TABLE_CELL_NODE}isParagraphNode(e){return e.nodeName===s.PARAGRAPH_NODE}isListParagraph(e){const t=this.paragraphPropertiesNode(e);return!!n.XmlNode.findChildByName(t,s.NUMBER_PROPERTIES_NODE)}paragraphPropertiesNode(e){if(!this.isParagraphNode(e))throw new Error(`Expected paragraph node but received a '${e.nodeName}' node.`);return n.XmlNode.findChildByName(e,s.PARAGRAPH_PROPERTIES_NODE)}firstTextNodeChild(e){if(!e)return null;if(e.nodeName!==s.RUN_NODE)return null;if(!e.childNodes)return null;for(const t of e.childNodes)if(t.nodeName===s.TEXT_NODE)return t;return null}containingTextNode(e){if(!e)return null;if(!n.XmlNode.isTextNode(e))throw new Error("'Invalid argument node. Expected a XmlTextNode.");return n.XmlNode.findParentByName(e,s.TEXT_NODE)}containingRunNode(e){return n.XmlNode.findParentByName(e,s.RUN_NODE)}containingParagraphNode(e){return n.XmlNode.findParentByName(e,s.PARAGRAPH_NODE)}containingTableRowNode(e){return n.XmlNode.findParentByName(e,s.TABLE_ROW_NODE)}}t.DocxParser=s,o(s,"PARAGRAPH_NODE","w:p"),o(s,"PARAGRAPH_PROPERTIES_NODE","w:pPr"),o(s,"RUN_NODE","w:r"),o(s,"RUN_PROPERTIES_NODE","w:rPr"),o(s,"TEXT_NODE","w:t"),o(s,"TABLE_ROW_NODE","w:tr"),o(s,"TABLE_CELL_NODE","w:tc"),o(s,"NUMBER_PROPERTIES_NODE","w:numPr")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(53);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(54);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(55);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(56);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})})},function(e,t,r){"use strict"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopListStrategy=void 0;var n=r(0);t.LoopListStrategy=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}isApplicable(e,t){const r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode);return this.utilities.docxParser.isListParagraph(r)}splitBefore(e,t){const r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode),i=this.utilities.docxParser.containingParagraphNode(t.xmlTextNode),o=n.XmlNode.siblingsInRange(r,i);return n.XmlNode.remove(e.xmlTextNode),n.XmlNode.remove(t.xmlTextNode),{firstNode:r,nodesToRepeat:o,lastNode:i}}mergeBack(e,t,r){for(const t of e)for(const e of t)n.XmlNode.insertBefore(e,r);n.XmlNode.remove(t),t!==r&&n.XmlNode.remove(r)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopParagraphStrategy=void 0;var n=r(0);t.LoopParagraphStrategy=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}isApplicable(e,t){return!0}splitBefore(e,t){let r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode),i=this.utilities.docxParser.containingParagraphNode(t.xmlTextNode);const o=r===i,s=r.parentNode,a=s.childNodes.indexOf(r),l=o?a:s.childNodes.indexOf(i);let c=n.XmlNode.splitByChild(r,e.xmlTextNode,!0);r=c[0];const d=c[1];o&&(i=d);const u=(c=n.XmlNode.splitByChild(i,t.xmlTextNode,!0))[0];let f;if(i=c[1],n.XmlNode.removeChild(s,a+1),o||n.XmlNode.removeChild(s,l),d.parentNode=null,u.parentNode=null,o)this.utilities.docxParser.joinParagraphs(d,u),f=[d];else{const e=n.XmlNode.removeSiblings(r,i);f=[d].concat(e).concat(u)}return{firstNode:r,nodesToRepeat:f,lastNode:i}}mergeBack(e,t,r){let i=t;for(const t of e){this.utilities.docxParser.joinParagraphs(i,t[0]);for(let e=1;e<t.length;e++)n.XmlNode.insertBefore(t[e],r),i=t[e]}this.utilities.docxParser.joinParagraphs(i,r),n.XmlNode.remove(r)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopTableStrategy=void 0;var n=r(0);t.LoopTableStrategy=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}isApplicable(e,t){const r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode);return!!r.parentNode&&this.utilities.docxParser.isTableCellNode(r.parentNode)}splitBefore(e,t){const r=this.utilities.docxParser.containingTableRowNode(e.xmlTextNode),i=this.utilities.docxParser.containingTableRowNode(t.xmlTextNode),o=n.XmlNode.siblingsInRange(r,i);return n.XmlNode.remove(e.xmlTextNode),n.XmlNode.remove(t.xmlTextNode),{firstNode:r,nodesToRepeat:o,lastNode:i}}mergeBack(e,t,r){for(const t of e)for(const e of t)n.XmlNode.insertBefore(e,r);n.XmlNode.remove(t),t!==r&&n.XmlNode.remove(r)}}},function(e,t,r){"use strict"},function(e,t,r){"use strict"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PluginContent=void 0;const n={isPluginContent:e=>!!e&&"string"==typeof e._type};t.PluginContent=n},function(e,t,r){"use strict"},function(e,t,r){"use strict"},function(e,t,r){"use strict"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateHandler=void 0;var n=r(8),i=r(1),o=r(5),s=r(19),a=r(0),l=r(64);function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.TemplateHandler=class{constructor(e){c(this,"version","0.7.3"),c(this,"xmlParser",new a.XmlParser),c(this,"docxParser",void 0),c(this,"compiler",void 0),c(this,"options",void 0),this.options=new s.TemplateHandlerOptions(e),this.docxParser=new o.DocxParser(this.xmlParser);const t=new n.DelimiterSearcher(this.docxParser);t.startDelimiter=this.options.delimiters.tagStart,t.endDelimiter=this.options.delimiters.tagEnd,t.maxXmlDepth=this.options.maxXmlDepth;const r=new n.TagParser(this.docxParser,this.options.delimiters);this.compiler=new n.TemplateCompiler(t,r,this.options.plugins,this.options.defaultContentType,this.options.containerContentType),this.options.plugins.forEach(e=>{e.setUtilities({xmlParser:this.xmlParser,docxParser:this.docxParser,compiler:this.compiler})})}async process(e,t){const r=await this.loadDocx(e),i=await r.getDocument(),o=new n.ScopeData(t),s={docx:r};return await this.compiler.compile(i,o,s),r.export(e.constructor)}async parseTags(e){const t=await this.loadDocx(e),r=await t.getDocument();return this.compiler.parseTags(r)}async getText(e){const t=await this.loadDocx(e);return await t.getDocumentText()}async getXml(e){const t=await this.loadDocx(e);return await t.getDocument()}async loadDocx(e){let t;try{t=await l.Zip.load(e)}catch(e){throw new i.MalformedFileError("docx")}return this.docxParser.load(t)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(65);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(21);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Zip=void 0;var n=r(66),i=r(20),o=r(21);class s{static async load(e){const t=await n.loadAsync(e);return new s(t)}constructor(e){this.zip=e}getFile(e){return new o.ZipObject(this.zip.files[e])}setFile(e,t){this.zip.file(e,t)}isFileExist(e){return!!this.zip.files[e]}listFiles(){return Object.keys(this.zip.files)}async export(e){const t=i.JsZipHelper.toJsZipOutputType(e);return await this.zip.generateAsync({type:t,compression:"DEFLATE",compressionOptions:{level:6}})}}t.Zip=s},function(e,t){e.exports=require("jszip")}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("easy-template-x",[],t):"object"==typeof exports?exports["easy-template-x"]=t():e["easy-template-x"]=t()}(this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=23)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(41);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(11);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(42);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(27);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(28);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(29);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(30);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(31);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var l=r(32);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})});var c=r(33);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})});var d=r(34);Object.keys(d).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return d[e]}})});var u=r(35);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var f=r(36);Object.keys(f).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return f[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(37);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(9);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(38);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(39);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(40);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var l=r(10);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplatePlugin=void 0;t.TemplatePlugin=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}simpleTagReplacements(e,t,r){}containerTagReplacements(e,t,r){}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MimeTypeHelper=t.MimeType=void 0;var n=r(1);let i;t.MimeType=i,function(e){e.Png="image/png",e.Jpeg="image/jpeg",e.Gif="image/gif",e.Bmp="image/bmp",e.Svg="image/svg+xml"}(i||(t.MimeType=i={}));t.MimeTypeHelper=class{static getDefaultExtension(e){switch(e){case i.Png:return"png";case i.Jpeg:return"jpg";case i.Gif:return"gif";case i.Bmp:return"bmp";case i.Svg:return"svg";default:throw new n.UnsupportedFileTypeError(e)}}static getOfficeRelType(e){switch(e){case i.Png:case i.Jpeg:case i.Gif:case i.Bmp:case i.Svg:return"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";default:throw new n.UnsupportedFileTypeError(e)}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(52);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})})},function(e,t,r){"use strict";let n;Object.defineProperty(t,"__esModule",{value:!0}),t.TagDisposition=void 0,t.TagDisposition=n,function(e){e.Open="Open",e.Close="Close",e.SelfClosed="SelfClosed"}(n||(t.TagDisposition=n={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(48);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(58);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(12);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(59);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(13);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var l=r(15);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})});var c=r(60);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})});var d=r(61);Object.keys(d).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return d[e]}})});var u=r(16);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var f=r(3);Object.keys(f).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return f[e]}})});var p=r(17);Object.keys(p).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return p[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(25);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(26);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(44);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(6);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(46);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var l=r(47);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})});var c=r(62);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Base64=void 0;t.Base64=class{static encode(e){return"undefined"!=typeof btoa?btoa(e):new Buffer(e,"binary").toString("base64")}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.inheritsFrom=function(e,t){return e===t||e.prototype instanceof t},t.isPromiseLike=function(e){return!!e&&"object"==typeof e&&"function"==typeof e.then}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XmlNode=t.TEXT_NODE_NAME=t.XmlNodeType=void 0;var n=r(1),i=r(2);let o;t.XmlNodeType=o,function(e){e.Text="Text",e.General="General"}(o||(t.XmlNodeType=o={}));t.TEXT_NODE_NAME="#text";const s={createTextNode:e=>({nodeType:o.Text,nodeName:"#text",textContent:e}),createGeneralNode:e=>({nodeType:o.General,nodeName:e}),encodeValue(e){if(null===e||void 0===e)throw new n.MissingArgumentError("str");if("string"!=typeof e)throw new TypeError(`Expected a string, got '${e.constructor.name}'.`);return e.replace(/[<>&'"]/g,e=>{switch(e){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case"'":return"&apos;";case'"':return"&quot;"}return""})},serialize(e){if(this.isTextNode(e))return this.encodeValue(e.textContent||"");let t="";if(e.attributes){const r=Object.keys(e.attributes);r.length&&(t=" "+r.map(t=>`${t}="${e.attributes[t]}"`).join(" "))}const r=(e.childNodes||[]).length>0,n=r?"":"/",i=`<${e.nodeName}${t}${n}>`;let o;if(r){o=i+e.childNodes.map(e=>this.serialize(e)).join("")+`</${e.nodeName}>`}else o=i;return o},fromDomNode(e){let t;if(e.nodeType===e.TEXT_NODE)t=this.createTextNode(e.textContent);else if(t=this.createGeneralNode(e.nodeName),e.nodeType===e.ELEMENT_NODE){const r=e.attributes;if(r){t.attributes={};for(let e=0;e<r.length;e++){const n=r.item(e);t.attributes[n.name]=n.value}}}if(e.childNodes){let r;t.childNodes=[];for(let n=0;n<e.childNodes.length;n++){const i=e.childNodes.item(n),o=this.fromDomNode(i);t.childNodes.push(o),o.parentNode=t,r&&(r.nextSibling=o),r=o}}return t},isTextNode(e){if(e.nodeType===o.Text||"#text"===e.nodeName){if(e.nodeType!==o.Text||"#text"!==e.nodeName)throw new Error(`Invalid text node. Type: '${e.nodeType}', Name: '${e.nodeName}'.`);return!0}return!1},cloneNode(e,t){if(!e)throw new n.MissingArgumentError("node");if(t){const t=function e(t){const r={};r.nodeType=t.nodeType;r.nodeName=t.nodeName;if(s.isTextNode(t))r.textContent=t.textContent;else{const e=t.attributes;e&&(r.attributes=Object.assign({},e))}if(t.childNodes){let n;r.childNodes=[];for(const i of t.childNodes){const t=e(i);r.childNodes.push(t),t.parentNode=r,n&&(n.nextSibling=t),n=t}}return r}(e);return t.parentNode=null,t}{const t=Object.assign({},e);return t.parentNode=null,t.childNodes=e.childNodes?[]:null,t.nextSibling=null,t}},insertBefore(e,t){if(!e)throw new n.MissingArgumentError("newNode");if(!t)throw new n.MissingArgumentError("referenceNode");if(!t.parentNode)throw new Error("'referenceNode' has no parent");const r=t.parentNode.childNodes.indexOf(t);s.insertChild(t.parentNode,e,r)},insertAfter(e,t){if(!e)throw new n.MissingArgumentError("newNode");if(!t)throw new n.MissingArgumentError("referenceNode");if(!t.parentNode)throw new Error("'referenceNode' has no parent");const r=t.parentNode.childNodes.indexOf(t);s.insertChild(t.parentNode,e,r+1)},insertChild(e,t,r){if(!e)throw new n.MissingArgumentError("parent");if(s.isTextNode(e))throw new Error("Appending children to text nodes is forbidden");if(!t)throw new n.MissingArgumentError("child");if(e.childNodes||(e.childNodes=[]),r===e.childNodes.length)return void s.appendChild(e,t);if(r>e.childNodes.length)throw new RangeError(`Child index ${r} is out of range. Parent has only ${e.childNodes.length} child nodes.`);t.parentNode=e;const i=e.childNodes[r];if(t.nextSibling=i,r>0){e.childNodes[r-1].nextSibling=t}e.childNodes.splice(r,0,t)},appendChild(e,t){if(!e)throw new n.MissingArgumentError("parent");if(s.isTextNode(e))throw new Error("Appending children to text nodes is forbidden");if(!t)throw new n.MissingArgumentError("child");if(e.childNodes||(e.childNodes=[]),e.childNodes.length){e.childNodes[e.childNodes.length-1].nextSibling=t}t.nextSibling=null,t.parentNode=e,e.childNodes.push(t)},remove(e){if(!e)throw new n.MissingArgumentError("node");if(!e.parentNode)throw new Error("Node has no parent");a(e.parentNode,e)},removeChild:a,lastTextChild(e){if(s.isTextNode(e))return e;if(e.childNodes){const t=e.childNodes.filter(e=>s.isTextNode(e));if(t.length){const e=(0,i.last)(t);return e.textContent||(e.textContent=""),e}}const t={nodeType:o.Text,nodeName:"#text",textContent:""};return s.appendChild(e,t),t},removeSiblings(e,t){if(e===t)return[];const r=[];let n;for(e=e.nextSibling;e!==t;){const t=e;e=e.nextSibling,s.remove(t),r.push(t),n&&(n.nextSibling=t),n=t}return r},splitByChild(e,t,r){const n=function(e,t){const r=[];let n=t;for(;n!==e;){const e=n.parentNode;if(!e)throw new Error("Argument descendant is not a descendant of root");const t=e.childNodes.indexOf(n);r.push(t),n=e}return r.reverse()}(e,t),i=s.cloneNode(e,!1),o=n[0]+1;for(;o<e.childNodes.length;){const t=e.childNodes[o];s.remove(t),s.appendChild(i,t)}return e.parentNode&&s.insertAfter(i,e),r&&e.childNodes.length&&s.removeChild(e,e.childNodes.length-1),[e,i]},findParent(e,t){if(!e)return null;for(;e.parentNode;){if(t(e))return e;e=e.parentNode}return null},findParentByName:(e,t)=>s.findParent(e,e=>e.nodeName===t),findChildByName:(e,t)=>e?(e.childNodes||[]).find(e=>e.nodeName===t):null,siblingsInRange(e,t){if(!e)throw new n.MissingArgumentError("firstNode");if(!t)throw new n.MissingArgumentError("lastNode");const r=[];let i=e;for(;i&&i!==t;)r.push(i),i=i.nextSibling;if(!i)throw new Error("Nodes are not siblings.");return r.push(t),r},removeEmptyTextNodes(e){!function e(t){if(!t.childNodes)return t;const r=t.childNodes;t.childNodes=[];for(const n of r){if(s.isTextNode(n)){n.textContent&&n.textContent.match(/\S/)&&t.childNodes.push(n);continue}const r=e(n);t.childNodes.push(r)}return t}(e)}};function a(e,t){if(!e)throw new n.MissingArgumentError("parent");if(null===t||void 0===t)throw new n.MissingArgumentError("childOrIndex");if(!e.childNodes||!e.childNodes.length)throw new Error("Parent node has node children");let r;if("number"==typeof t)r=t;else if(-1===(r=e.childNodes.indexOf(t)))throw new Error("Specified child node is not a child of the specified parent");if(r>=e.childNodes.length)throw new RangeError(`Child index ${r} is out of range. Parent has only ${e.childNodes.length} child nodes.`);const i=e.childNodes[r];if(r>0){e.childNodes[r-1].nextSibling=i.nextSibling}return i.parentNode=null,i.nextSibling=null,e.childNodes.splice(r,1)[0]}t.XmlNode=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImagePlugin=void 0;var n=r(4),i=r(0),o=r(3);let s=1;t.ImagePlugin=class extends o.TemplatePlugin{constructor(...e){var t,r,n;super(...e),n="image",(r="contentType")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n}async simpleTagReplacements(e,t,r){const o=this.utilities.docxParser.containingTextNode(e.xmlTextNode),a=t.getScopeData();if(!a||!a.source)return void i.XmlNode.remove(o);const l=await r.docx.mediaFiles.add(a.source,a.format),c=n.MimeTypeHelper.getOfficeRelType(a.format),d=await r.docx.rels.add(l,c);await r.docx.contentTypes.ensureContentType(a.format);const u=s++,f=this.createMarkup(u,d,a.width,a.height);i.XmlNode.insertAfter(f,o),i.XmlNode.remove(o)}createMarkup(e,t,r,n){const o=`Picture ${e}`,s=`\n <w:drawing>\n <wp:inline distT="0" distB="0" distL="0" distR="0">\n <wp:extent cx="${this.pixelsToEmu(r)}" cy="${this.pixelsToEmu(n)}"/>\n <wp:effectExtent l="0" t="0" r="0" b="0"/>\n <wp:docPr id="${e}" name="${o}"/>\n <wp:cNvGraphicFramePr>\n <a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/>\n </wp:cNvGraphicFramePr>\n <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">\n <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">\n ${this.pictureMarkup(o,t,r,n)}\n </a:graphicData>\n </a:graphic>\n </wp:inline>\n </w:drawing>\n `,a=this.utilities.xmlParser.parse(s);return i.XmlNode.removeEmptyTextNodes(a),a}pictureMarkup(e,t,r,n){return`\n <pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">\n <pic:nvPicPr>\n <pic:cNvPr id="0" name="${e}"/>\n <pic:cNvPicPr>\n <a:picLocks noChangeAspect="1" noChangeArrowheads="1"/>\n </pic:cNvPicPr>\n </pic:nvPicPr>\n <pic:blipFill>\n <a:blip r:embed="${t}">\n <a:extLst>\n <a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}">\n <a14:useLocalDpi xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" val="0"/>\n </a:ext>\n </a:extLst>\n </a:blip>\n <a:srcRect/>\n <a:stretch>\n <a:fillRect/>\n </a:stretch>\n </pic:blipFill>\n <pic:spPr bwMode="auto">\n <a:xfrm>\n <a:off x="0" y="0"/>\n <a:ext cx="${this.pixelsToEmu(r)}" cy="${this.pixelsToEmu(n)}"/>\n </a:xfrm>\n <a:prstGeom prst="rect">\n <a:avLst/>\n </a:prstGeom>\n <a:noFill/>\n <a:ln>\n <a:noFill/>\n </a:ln>\n </pic:spPr>\n </pic:pic>\n `}pixelsToEmu(e){return Math.round(9525*e)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LinkPlugin=void 0;var n=r(5),i=r(0),o=r(3);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class a extends o.TemplatePlugin{constructor(...e){super(...e),s(this,"contentType","link")}async simpleTagReplacements(e,t,r){const n=this.utilities.docxParser.containingTextNode(e.xmlTextNode),o=t.getScopeData();if(!o||!o.target)return void i.XmlNode.remove(n);const s=await r.docx.rels.add(o.target,a.linkRelType,{TargetMode:"External"}),l=this.utilities.docxParser.containingRunNode(n),c=this.generateMarkup(o,s,l);this.insertHyperlinkNode(c,l,n)}generateMarkup(e,t,r){const o=`\n <w:hyperlink r:id="${t}" w:history="1">\n <w:r>\n <w:t>${e.text||e.target}</w:t>\n </w:r>\n </w:hyperlink>\n `,s=this.utilities.xmlParser.parse(o);i.XmlNode.removeEmptyTextNodes(s);const a=r.childNodes.find(e=>e.nodeName===n.DocxParser.RUN_PROPERTIES_NODE);if(a){const e=i.XmlNode.cloneNode(a,!0);s.childNodes[0].childNodes.unshift(e)}return s}insertHyperlinkNode(e,t,r){let o=t.childNodes.filter(e=>e.nodeName===n.DocxParser.TEXT_NODE);if(o.length>1){const[s]=i.XmlNode.splitByChild(t,r,!0);o=s.childNodes.filter(e=>e.nodeName===n.DocxParser.TEXT_NODE),i.XmlNode.insertAfter(e,s),0===o.length&&i.XmlNode.remove(s)}else i.XmlNode.insertAfter(e,t),i.XmlNode.remove(t)}}t.LinkPlugin=a,s(a,"linkRelType","http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Docx=void 0;var n=r(1),i=r(49),o=r(50),s=r(51);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.Docx=class{get documentPath(){return this._documentPath||(this.zip.isFileExist("word/document.xml")?this._documentPath="word/document.xml":this.zip.isFileExist("word/document2.xml")&&(this._documentPath="word/document2.xml")),this._documentPath}constructor(e,t){if(this.zip=e,this.xmlParser=t,a(this,"rels",void 0),a(this,"mediaFiles",void 0),a(this,"contentTypes",void 0),a(this,"_documentPath",void 0),a(this,"_document",void 0),!this.documentPath)throw new n.MalformedFileError("docx");this.rels=new s.Rels(this.documentPath,e,t),this.mediaFiles=new o.MediaFiles(e),this.contentTypes=new i.ContentTypesFile(e,t)}async getDocument(){if(!this._document){const e=await this.zip.getFile(this.documentPath).getContentText();this._document=this.xmlParser.parse(e)}return this._document}async getDocumentText(){const e=await this.getDocument(),t=this.xmlParser.serialize(e);return this.xmlParser.domParse(t).documentElement.textContent}async export(e){return await this.saveChanges(),await this.zip.export(e)}async saveChanges(){const e=await this.getDocument(),t=this.xmlParser.serialize(e);this.zip.setFile(this.documentPath,t),await this.rels.save(),await this.contentTypes.save()}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopPlugin=t.LOOP_CONTENT_TYPE=void 0;var n=r(2),i=r(0),o=r(53),s=r(3);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const l="loop";t.LOOP_CONTENT_TYPE=l;t.LoopPlugin=class extends s.TemplatePlugin{constructor(...e){super(...e),a(this,"contentType",l),a(this,"loopStrategies",[new o.LoopTableStrategy,new o.LoopListStrategy,new o.LoopParagraphStrategy])}setUtilities(e){this.utilities=e,this.loopStrategies.forEach(t=>t.setUtilities(e))}async containerTagReplacements(e,t,r){let i=t.getScopeData();i&&Array.isArray(i)&&i.length||(i=[]);const o=e[0],s=(0,n.last)(e),a=this.loopStrategies.find(e=>e.isApplicable(o,s));if(!a)throw new Error(`No loop strategy found for tag '${o.rawText}'.`);const{firstNode:l,nodesToRepeat:c,lastNode:d}=a.splitBefore(o,s),u=this.repeat(c,i.length),f=await this.compile(u,t,r);a.mergeBack(f,l,d)}repeat(e,t){if(!e.length||!t)return[];const r=[];for(let n=0;n<t;n++){const t=e.map(e=>i.XmlNode.cloneNode(e,!0));r.push(t)}return r}async compile(e,t,r){const n=[];for(let o=0;o<e.length;o++){const s=e[o],a=i.XmlNode.createGeneralNode("dummyRootNode");s.forEach(e=>i.XmlNode.appendChild(a,e)),t.path.push(o),await this.utilities.compiler.compile(a,t,r),t.path.pop();const l=[];for(;a.childNodes&&a.childNodes.length;){const e=i.XmlNode.removeChild(a,0);l.push(e)}n.push(l)}return n}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RawXmlPlugin=void 0;var n=r(0),i=r(3);t.RawXmlPlugin=class extends i.TemplatePlugin{constructor(...e){var t,r,n;super(...e),n="rawXml",(r="contentType")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n}simpleTagReplacements(e,t){const r=this.utilities.docxParser.containingTextNode(e.xmlTextNode),i=t.getScopeData();if(i&&"string"==typeof i.xml){const e=this.utilities.xmlParser.parse(i.xml);n.XmlNode.insertBefore(e,r)}n.XmlNode.remove(r)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextPlugin=t.TEXT_CONTENT_TYPE=void 0;var n=r(5),i=r(0),o=r(3);const s="text";t.TEXT_CONTENT_TYPE=s;t.TextPlugin=class extends o.TemplatePlugin{constructor(...e){var t,r,n;super(...e),n=s,(r="contentType")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n}simpleTagReplacements(e,t){const r=t.getScopeData(),n=(null===r||void 0===r?"":r.toString()).split("\n");n.length<2?this.replaceSingleLine(e.xmlTextNode,n.length?n[0]:""):this.replaceMultiLine(e.xmlTextNode,n)}replaceSingleLine(e,t){e.textContent=t;const r=this.utilities.docxParser.containingTextNode(e);this.utilities.docxParser.setSpacePreserveAttribute(r)}replaceMultiLine(e,t){const r=this.utilities.docxParser.containingRunNode(e);e.textContent=t[0];for(let e=1;e<t.length;e++){const n=this.getLineBreak();i.XmlNode.appendChild(r,n);const o=this.createWordTextNode(t[e]);i.XmlNode.appendChild(r,o)}}getLineBreak(){return i.XmlNode.createGeneralNode("w:br")}createWordTextNode(e){const t=i.XmlNode.createGeneralNode(n.DocxParser.TEXT_NODE);return t.attributes={},this.utilities.docxParser.setSpacePreserveAttribute(t),t.childNodes=[i.XmlNode.createTextNode(e)],t}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(63);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(20);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JsZipHelper=void 0;var n=r(1),i=r(2);t.JsZipHelper=class{static toJsZipOutputType(e){if(!e)throw new n.MissingArgumentError("binaryOrType");let t;if(t="function"==typeof e?e:e.constructor,i.Binary.isBlobConstructor(t))return"blob";if(i.Binary.isArrayBufferConstructor(t))return"arraybuffer";if(i.Binary.isBufferConstructor(t))return"nodebuffer";throw new Error(`Binary type '${t.name}' is not supported.`)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ZipObject=void 0;var n=r(19);t.ZipObject=class{get name(){return this.zipObject.name}set name(e){this.zipObject.name=e}get isDirectory(){return this.zipObject.dir}constructor(e){this.zipObject=e}getContentText(){return this.zipObject.async("text")}getContentBase64(){return this.zipObject.async("binarystring")}getContentBinary(e){const t=n.JsZipHelper.toJsZipOutputType(e);return this.zipObject.async(t)}}},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.Delimiters=void 0;t.Delimiters=class{constructor(e){if(n(this,"tagStart","{"),n(this,"tagEnd","}"),n(this,"containerTagOpen","#"),n(this,"containerTagClose","/"),Object.assign(this,e),this.encodeAndValidate(),this.containerTagOpen===this.containerTagClose)throw new Error("containerTagOpen can not be equal to containerTagClose")}encodeAndValidate(){const e=["tagStart","tagEnd","containerTagOpen","containerTagClose"];for(const t of e){const e=this[t];if(!e)throw new Error(`${t} can not be empty.`);if(e!==e.trim())throw new Error(`${t} can not contain leading or trailing whitespace.`)}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateHandlerOptions=void 0;var n=r(21),i=r(7);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.TemplateHandlerOptions=class{constructor(e){if(o(this,"plugins",(0,i.createDefaultPlugins)()),o(this,"defaultContentType",i.TEXT_CONTENT_TYPE),o(this,"containerContentType",i.LOOP_CONTENT_TYPE),o(this,"delimiters",new n.Delimiters),o(this,"maxXmlDepth",20),Object.assign(this,e),e&&(this.delimiters=new n.Delimiters(e.delimiters)),!this.plugins.length)throw new Error("Plugins list can not be empty")}}},function(e,t,r){e.exports=r(24)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(8);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(1);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(5);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(7);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(2);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var l=r(0);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})});var c=r(18);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})});var d=r(21);Object.keys(d).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return d[e]}})});var u=r(4);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var f=r(65);Object.keys(f).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return f[e]}})});var p=r(66);Object.keys(p).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return p[e]}})});var h=r(22);Object.keys(h).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return h[e]}})})},function(e,t,r){"use strict"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DelimiterSearcher=void 0;var n=r(1),i=r(2),o=r(0);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class a{constructor(){s(this,"delimiterIndex",0),s(this,"openNodes",[]),s(this,"firstMatchIndex",-1)}reset(){this.delimiterIndex=0,this.openNodes=[],this.firstMatchIndex=-1}}t.DelimiterSearcher=class{constructor(e){if(this.docxParser=e,s(this,"maxXmlDepth",20),s(this,"startDelimiter","{"),s(this,"endDelimiter","}"),!e)throw new n.MissingArgumentError("docxParser")}findDelimiters(e){const t=[],r=new a,n=new o.XmlDepthTracker(this.maxXmlDepth);let s=!0;for(;e;){if(this.docxParser.isParagraphNode(e)&&r.reset(),!this.shouldSearchNode(e)){e=this.findNextNode(e,n);continue}r.openNodes.push(e);let o=0;for(;o<e.textContent.length;){const n=s?this.startDelimiter:this.endDelimiter;if(e.textContent[o]===n[r.delimiterIndex])if(-1===r.firstMatchIndex&&(r.firstMatchIndex=o),r.delimiterIndex===n.length-1){if(r.openNodes.length>1){const t=(0,i.first)(r.openNodes),n=(0,i.last)(r.openNodes);this.docxParser.joinTextNodesRange(t,n),o+=t.textContent.length-e.textContent.length,e=t}const n=this.createDelimiterMark(r,s);t.push(n),s=!s,r.reset(),o<e.textContent.length-1&&r.openNodes.push(e)}else r.delimiterIndex++;else-1!==r.firstMatchIndex&&(e=(0,i.first)(r.openNodes),o=r.firstMatchIndex),r.reset(),o<e.textContent.length-1&&r.openNodes.push(e);o++}e=this.findNextNode(e,n)}return t}shouldSearchNode(e){return!!(o.XmlNode.isTextNode(e)&&e.textContent&&e.parentNode&&this.docxParser.isTextNode(e.parentNode))}findNextNode(e,t){if(e.childNodes&&e.childNodes.length)return t.increment(),e.childNodes[0];if(e.nextSibling)return e.nextSibling;for(;e.parentNode;){if(e.parentNode.nextSibling)return t.decrement(),e.parentNode.nextSibling;t.decrement(),e=e.parentNode}return null}createDelimiterMark(e,t){return{index:e.firstMatchIndex,isOpen:t,xmlTextNode:e.openNodes[0]}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MalformedFileError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Malformed file detected. Make sure the file is a valid ${e} file.`),i=void 0,(r="expectedFileType")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.expectedFileType=e,Object.setPrototypeOf(this,n.prototype)}}t.MalformedFileError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MaxXmlDepthError=void 0;class n extends Error{constructor(e){var t,r,i;super(`XML maximum depth reached (max depth: ${e}).`),i=void 0,(r="maxDepth")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.maxDepth=e,Object.setPrototypeOf(this,n.prototype)}}t.MaxXmlDepthError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingArgumentError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Argument '${e}' is missing.`),i=void 0,(r="argName")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.argName=e,Object.setPrototypeOf(this,n.prototype)}}t.MissingArgumentError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingCloseDelimiterError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Close delimiter is missing from '${e}'.`),i=void 0,(r="openDelimiterText")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.openDelimiterText=e,Object.setPrototypeOf(this,n.prototype)}}t.MissingCloseDelimiterError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingStartDelimiterError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Open delimiter is missing from '${e}'.`),i=void 0,(r="closeDelimiterText")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.closeDelimiterText=e,Object.setPrototypeOf(this,n.prototype)}}t.MissingStartDelimiterError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnclosedTagError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Tag '${e}' is never closed.`),i=void 0,(r="tagName")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.tagName=e,Object.setPrototypeOf(this,n.prototype)}}t.UnclosedTagError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnidentifiedFileTypeError=void 0;class n extends Error{constructor(){super("The filetype for this file could not be identified, is this file corrupted?"),Object.setPrototypeOf(this,n.prototype)}}t.UnidentifiedFileTypeError=n},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.UnknownContentTypeError=void 0;class i extends Error{constructor(e,t,r){super(`Content type '${e}' does not have a registered plugin to handle it.`),n(this,"tagRawText",void 0),n(this,"contentType",void 0),n(this,"path",void 0),this.contentType=e,this.tagRawText=t,this.path=r,Object.setPrototypeOf(this,i.prototype)}}t.UnknownContentTypeError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnopenedTagError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Tag '${e}' is closed but was never opened.`),i=void 0,(r="tagName")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.tagName=e,Object.setPrototypeOf(this,n.prototype)}}t.UnopenedTagError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnsupportedFileTypeError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Filetype "${e}" is not supported.`),i=void 0,(r="fileType")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.fileType=e,Object.setPrototypeOf(this,n.prototype)}}t.UnsupportedFileTypeError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pushMany=function(e,t){Array.prototype.push.apply(e,t)},t.first=function(e){return e.length?e[0]:void 0},t.last=function(e){return e.length?e[e.length-1]:void 0},t.toDictionary=function(e,t,r){if(!e.length)return{};const n={};return e.forEach((e,i)=>{const o=t(e,i),s=r?r(e,i):e;if(n[o])throw new Error(`Key '${o}' already exists in the dictionary.`);n[o]=s}),n}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Binary=void 0;var n=r(9),i=r(10);const o={isBlob(e){return this.isBlobConstructor(e.constructor)},isArrayBuffer(e){return this.isArrayBufferConstructor(e.constructor)},isBuffer(e){return this.isBufferConstructor(e.constructor)},isBlobConstructor:e=>"undefined"!=typeof Blob&&(0,i.inheritsFrom)(e,Blob),isArrayBufferConstructor:e=>"undefined"!=typeof ArrayBuffer&&(0,i.inheritsFrom)(e,ArrayBuffer),isBufferConstructor:e=>"undefined"!=typeof Buffer&&(0,i.inheritsFrom)(e,Buffer),toBase64(e){if(this.isBlob(e))return new Promise(t=>{const r=new FileReader;r.onload=function(){const e=n.Base64.encode(this.result);t(e)},r.readAsBinaryString(e)});if(this.isBuffer(e))return Promise.resolve(e.toString("base64"));if(this.isArrayBuffer(e)){const t=new Uint8Array(e).reduce((e,t)=>e+String.fromCharCode(t),""),r=n.Base64.encode(t);return Promise.resolve(r)}throw new Error(`Binary type '${e.constructor.name}' is not supported.`)}};t.Binary=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Path=void 0;t.Path=class{static getFilename(e){const t=e.lastIndexOf("/");return e.substr(t+1)}static getDirectory(e){const t=e.lastIndexOf("/");return e.substring(0,t)}}},function(e,t,r){"use strict";function n(e,t){return e<<t|e>>>32-t}function i(e){let t="";for(let r=7;r>=0;r--){t+=(e>>>4*r&15).toString(16)}return t}Object.defineProperty(t,"__esModule",{value:!0}),t.sha1=function(e){const t=(e=function(e){e=e.replace(/\r\n/g,"\n");let t="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);n<128?t+=String.fromCharCode(n):n>127&&n<2048?(t+=String.fromCharCode(n>>6|192),t+=String.fromCharCode(63&n|128)):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t}(e)).length;let r,o;const s=[];for(r=0;r<t-3;r+=4)o=e.charCodeAt(r)<<24|e.charCodeAt(r+1)<<16|e.charCodeAt(r+2)<<8|e.charCodeAt(r+3),s.push(o);switch(t%4){case 0:r=2147483648;break;case 1:r=e.charCodeAt(t-1)<<24|8388608;break;case 2:r=e.charCodeAt(t-2)<<24|e.charCodeAt(t-1)<<16|32768;break;case 3:r=e.charCodeAt(t-3)<<24|e.charCodeAt(t-2)<<16|e.charCodeAt(t-1)<<8|128}s.push(r);for(;s.length%16!=14;)s.push(0);s.push(t>>>29),s.push(t<<3&4294967295);const a=new Array(80);let l,c,d,u,f,p,h=1732584193,m=4023233417,g=2562383102,b=271733878,y=3285377520;for(let e=0;e<s.length;e+=16){for(r=0;r<16;r++)a[r]=s[e+r];for(r=16;r<=79;r++)a[r]=n(a[r-3]^a[r-8]^a[r-14]^a[r-16],1);for(l=h,c=m,d=g,u=b,f=y,r=0;r<=19;r++)p=n(l,5)+(c&d|~c&u)+f+a[r]+1518500249&4294967295,f=u,u=d,d=n(c,30),c=l,l=p;for(r=20;r<=39;r++)p=n(l,5)+(c^d^u)+f+a[r]+1859775393&4294967295,f=u,u=d,d=n(c,30),c=l,l=p;for(r=40;r<=59;r++)p=n(l,5)+(c&d|c&u|d&u)+f+a[r]+2400959708&4294967295,f=u,u=d,d=n(c,30),c=l,l=p;for(r=60;r<=79;r++)p=n(l,5)+(c^d^u)+f+a[r]+3395469782&4294967295,f=u,u=d,d=n(c,30),c=l,l=p;h=h+l&4294967295,m=m+c&4294967295,g=g+d&4294967295,b=b+u&4294967295,y=y+f&4294967295}return(p=i(h)+i(m)+i(g)+i(b)+i(y)).toLowerCase()}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XmlDepthTracker=void 0;var n=r(1);t.XmlDepthTracker=class{constructor(e){var t,r,n;this.maxDepth=e,n=0,(r="depth")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n}increment(){if(this.depth++,this.depth>this.maxDepth)throw new n.MaxXmlDepthError(this.maxDepth)}decrement(){this.depth--}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XmlParser=void 0;var n=r(43),i=r(1),o=r(11);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class a{parse(e){const t=this.domParse(e);return o.XmlNode.fromDomNode(t.documentElement)}domParse(e){if(null===e||void 0===e)throw new i.MissingArgumentError("str");return a.parser.parseFromString(e,"text/xml")}serialize(e){return a.xmlHeader+o.XmlNode.serialize(e)}}t.XmlParser=a,s(a,"xmlHeader",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),s(a,"parser",new n.DOMParser)},function(e,t){e.exports=require("xmldom")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ScopeData=void 0;var n=r(2);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const o=r(45);t.ScopeData=class{constructor(e){i(this,"path",[]),i(this,"allData",void 0),this.allData=e}getScopeData(){const e=(0,n.last)(this.path);let t,r=this.path.slice();for(;void 0===t&&r.length;){const n=r.slice(0,r.length-1);t=o(this.allData,n.concat(e)),r=n}return t}}},function(e,t){e.exports=require("lodash.get")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TagParser=void 0;var n=r(1),i=r(6);t.TagParser=class{constructor(e,t){var r,i,o;if(this.docParser=e,this.delimiters=t,o=void 0,(i="tagRegex")in(r=this)?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o,!e)throw new n.MissingArgumentError("docParser");if(!t)throw new n.MissingArgumentError("delimiters");this.tagRegex=new RegExp(`^[${t.tagStart}](.*?)[${t.tagEnd}]`,"mi")}parse(e){const t=[];let r,i;for(let o=0;o<e.length;o++){const s=e[o];if(!r&&!s.isOpen){const e=s.xmlTextNode.textContent;throw new n.MissingStartDelimiterError(e)}if(r&&s.isOpen){const e=i.xmlTextNode.textContent;throw new n.MissingCloseDelimiterError(e)}!r&&s.isOpen&&(r={},i=s),r&&!s.isOpen&&(this.normalizeTagNodes(i,s,o,e),r.xmlTextNode=i.xmlTextNode,this.processTag(r),t.push(r),r=null,i=null)}return t}normalizeTagNodes(e,t,r,n){let i=e.xmlTextNode,o=t.xmlTextNode;const s=i===o;e.index>0&&(this.docParser.splitTextNode(i,e.index,!0),s&&(t.index-=e.index)),t.index<o.textContent.length-1&&(o=this.docParser.splitTextNode(o,t.index+1,!0),s&&(i=o)),s||(this.docParser.joinTextNodesRange(i,o),o=i);for(let i=r+1;i<n.length;i++){let r=!1;const o=n[i];if(o.xmlTextNode===e.xmlTextNode&&(o.index-=e.index,r=!0),o.xmlTextNode===t.xmlTextNode&&(o.index-=t.index+1,r=!0),!r)break}e.xmlTextNode=i,t.xmlTextNode=o}processTag(e){e.rawText=e.xmlTextNode.textContent;const t=(this.tagRegex.exec(e.rawText)[1]||"").trim();t&&t.length?t.startsWith(this.delimiters.containerTagOpen)?(e.disposition=i.TagDisposition.Open,e.name=t.slice(this.delimiters.containerTagOpen.length).trim()):t.startsWith(this.delimiters.containerTagClose)?(e.disposition=i.TagDisposition.Close,e.name=t.slice(this.delimiters.containerTagClose.length).trim()):(e.disposition=i.TagDisposition.SelfClosed,e.name=t):e.disposition=i.TagDisposition.SelfClosed}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateCompiler=void 0;var n=r(1),i=r(7),o=r(2),s=r(6);t.TemplateCompiler=class{constructor(e,t,r,n,i){var s,a,l;this.delimiterSearcher=e,this.tagParser=t,this.defaultContentType=n,this.containerContentType=i,l=void 0,(a="pluginsLookup")in(s=this)?Object.defineProperty(s,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):s[a]=l,this.pluginsLookup=(0,o.toDictionary)(r,e=>e.contentType)}async compile(e,t,r){const n=this.parseTags(e);await this.doTagReplacements(n,t,r)}parseTags(e){const t=this.delimiterSearcher.findDelimiters(e);return this.tagParser.parse(t)}async doTagReplacements(e,t,r){for(let i=0;i<e.length;i++){const a=e[i];t.path.push(a.name);const l=this.detectContentType(a,t),c=this.pluginsLookup[l];if(!c)throw new n.UnknownContentTypeError(l,a.rawText,t.path.join("."));if(a.disposition===s.TagDisposition.SelfClosed){const e=c.simpleTagReplacements(a,t,r);(0,o.isPromiseLike)(e)&&await e}else if(a.disposition===s.TagDisposition.Open){const n=this.findCloseTagIndex(i,a,e),s=e.slice(i,n+1);i=n;const l=c.containerTagReplacements(s,t,r);(0,o.isPromiseLike)(l)&&await l}t.path.pop()}}detectContentType(e,t){if(e.disposition===s.TagDisposition.Open||e.disposition===s.TagDisposition.Close)return this.containerContentType;const r=t.getScopeData();return i.PluginContent.isPluginContent(r)?r._type:this.defaultContentType}findCloseTagIndex(e,t,r){let i=e;for(;i<r.length;i++){const e=r[i];if(e.name===t.name&&e.disposition===s.TagDisposition.Close)break}if(i===r.length)throw new n.UnclosedTagError(t.name);return i}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createDefaultPlugins=function(){return[new o.LoopPlugin,new s.RawXmlPlugin,new n.ImagePlugin,new i.LinkPlugin,new a.TextPlugin]};var n=r(12),i=r(13),o=r(15),s=r(16),a=r(17)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContentTypesFile=void 0;var n=r(4),i=r(0);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class s{constructor(e,t){this.zip=e,this.xmlParser=t,o(this,"addedNew",!1),o(this,"root",void 0),o(this,"contentTypes",void 0)}async ensureContentType(e){if(await this.parseContentTypesFile(),this.contentTypes[e])return;const t=n.MimeTypeHelper.getDefaultExtension(e),r=i.XmlNode.createGeneralNode("Default");r.attributes={Extension:t,ContentType:e},this.root.childNodes.push(r),this.addedNew=!0,this.contentTypes[e]=!0}async count(){return await this.parseContentTypesFile(),this.root.childNodes.filter(e=>!i.XmlNode.isTextNode(e)).length}async save(){if(!this.addedNew)return;const e=this.xmlParser.serialize(this.root);this.zip.setFile(s.contentTypesFilePath,e)}async parseContentTypesFile(){if(this.root)return;const e=await this.zip.getFile(s.contentTypesFilePath).getContentText();this.root=this.xmlParser.parse(e),this.contentTypes={};for(const e of this.root.childNodes){if("Default"!==e.nodeName)continue;const t=e.attributes.ContentType;t&&this.contentTypes[t]}}}t.ContentTypesFile=s,o(s,"contentTypesFilePath","[Content_Types].xml")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediaFiles=void 0;var n=r(4),i=r(2);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class s{constructor(e){this.zip=e,o(this,"hashes",void 0),o(this,"files",new Map),o(this,"nextFileId",0)}async add(e,t){if(this.files.has(e))return this.files.get(e);await this.hashMediaFiles();const r=await i.Binary.toBase64(e),o=(0,i.sha1)(r);let a=Object.keys(this.hashes).find(e=>this.hashes[e]===o);if(a)return a;const l=n.MimeTypeHelper.getDefaultExtension(t);do{this.nextFileId++,a=`${s.mediaDir}/media${this.nextFileId}.${l}`}while(this.hashes[a]);return await this.zip.setFile(a,e),this.hashes[a]=o,this.files.set(e,a),a}async count(){return await this.hashMediaFiles(),Object.keys(this.hashes).length}async hashMediaFiles(){if(!this.hashes){this.hashes={};for(const e of this.zip.listFiles()){if(!e.startsWith(s.mediaDir))continue;const t=i.Path.getFilename(e);if(!t)continue;const r=await this.zip.getFile(e).getContentBase64(),n=(0,i.sha1)(r);this.hashes[t]=n}}}}t.MediaFiles=s,o(s,"mediaDir","word/media")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Rels=void 0;var n=r(2),i=r(0);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.Rels=class{constructor(e,t,r){this.zip=t,this.xmlParser=r,o(this,"root",void 0),o(this,"relIds",void 0),o(this,"relTargets",void 0),o(this,"nextRelId",0),o(this,"partDir",void 0),o(this,"relsFilePath",void 0),this.partDir=n.Path.getDirectory(e);const i=n.Path.getFilename(e);this.relsFilePath=`${this.partDir}/_rels/${i}.rels`}async add(e,t,r){e.startsWith(this.partDir)&&(e=e.substr(this.partDir.length+1)),await this.parseRelsFile();const n=this.getRelTargetKey(t,e);let o=this.relTargets[n];if(o)return o;o=this.getNextRelId();const s=i.XmlNode.createGeneralNode("Relationship");return s.attributes=Object.assign({Id:o,Type:t,Target:e},r),this.root.childNodes.push(s),this.relIds[o]=!0,this.relTargets[n]=o,o}async save(){if(!this.root)return;const e=this.xmlParser.serialize(this.root);this.zip.setFile(this.relsFilePath,e)}getNextRelId(){let e;do{this.nextRelId++,e="rId"+this.nextRelId}while(this.relIds[e]);return e}async parseRelsFile(){if(this.root)return;let e;const t=this.zip.getFile(this.relsFilePath);e=t?await t.getContentText():'<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n </Relationships>',this.root=this.xmlParser.parse(e),this.relIds={},this.relTargets={};for(const e of this.root.childNodes){const t=e.attributes;if(!t)continue;const r=t.Id;if(!r)continue;this.relIds[r]=!0;const n=t.Type,i=t.Target;if(n&&i){const e=this.getRelTargetKey(n,i);this.relTargets[e]=r}}}getRelTargetKey(e,t){return`${e} - ${t}`}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DocxParser=void 0;var n=r(0),i=r(14);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class s{constructor(e){this.xmlParser=e}load(e){return new i.Docx(e,this.xmlParser)}splitTextNode(e,t,r){let i,o;const s=this.containingTextNode(e),a=n.XmlNode.cloneNode(s,!0);if(this.setSpacePreserveAttribute(s),this.setSpacePreserveAttribute(a),r)n.XmlNode.insertBefore(a,s),i=n.XmlNode.lastTextChild(a),o=e;else{const t=s.parentNode.childNodes.indexOf(s);n.XmlNode.insertChild(s.parentNode,a,t+1),i=e,o=n.XmlNode.lastTextChild(a)}const l=i.textContent,c=o.textContent;return i.textContent=l.substring(0,t),o.textContent=c.substring(t),r?i:o}joinTextNodesRange(e,t){const r=this.containingRunNode(e),i=this.containingRunNode(t),o=r.parentNode;if(i.parentNode!==o)throw new Error("Can not join text nodes from separate paragraphs.");const a=this.containingTextNode(e),l=this.containingTextNode(t),c=[];let d=r;for(;d;){let e;for(e=d===r?a:this.firstTextNodeChild(d);e;){if(e.nodeName!==s.TEXT_NODE)continue;const t=n.XmlNode.lastTextChild(e);c.push(t.textContent);const r=e;e=e===l?null:e.nextSibling,r!==a&&n.XmlNode.remove(r)}const t=d;d=d===i?null:d.nextSibling,t.childNodes&&t.childNodes.length||n.XmlNode.remove(t)}n.XmlNode.lastTextChild(a).textContent=c.join("")}joinParagraphs(e,t){if(e===t)return;let r=0;for(;t.childNodes&&r<t.childNodes.length;){const i=t.childNodes[r];i.nodeName===s.RUN_NODE?(n.XmlNode.removeChild(t,r),n.XmlNode.appendChild(e,i)):r++}}setSpacePreserveAttribute(e){e.attributes||(e.attributes={}),e.attributes["xml:space"]||(e.attributes["xml:space"]="preserve")}isTextNode(e){return e.nodeName===s.TEXT_NODE}isTableCellNode(e){return e.nodeName===s.TABLE_CELL_NODE}isParagraphNode(e){return e.nodeName===s.PARAGRAPH_NODE}isListParagraph(e){const t=this.paragraphPropertiesNode(e);return!!n.XmlNode.findChildByName(t,s.NUMBER_PROPERTIES_NODE)}paragraphPropertiesNode(e){if(!this.isParagraphNode(e))throw new Error(`Expected paragraph node but received a '${e.nodeName}' node.`);return n.XmlNode.findChildByName(e,s.PARAGRAPH_PROPERTIES_NODE)}firstTextNodeChild(e){if(!e)return null;if(e.nodeName!==s.RUN_NODE)return null;if(!e.childNodes)return null;for(const t of e.childNodes)if(t.nodeName===s.TEXT_NODE)return t;return null}containingTextNode(e){if(!e)return null;if(!n.XmlNode.isTextNode(e))throw new Error("'Invalid argument node. Expected a XmlTextNode.");return n.XmlNode.findParentByName(e,s.TEXT_NODE)}containingRunNode(e){return n.XmlNode.findParentByName(e,s.RUN_NODE)}containingParagraphNode(e){return n.XmlNode.findParentByName(e,s.PARAGRAPH_NODE)}containingTableRowNode(e){return n.XmlNode.findParentByName(e,s.TABLE_ROW_NODE)}}t.DocxParser=s,o(s,"PARAGRAPH_NODE","w:p"),o(s,"PARAGRAPH_PROPERTIES_NODE","w:pPr"),o(s,"RUN_NODE","w:r"),o(s,"RUN_PROPERTIES_NODE","w:rPr"),o(s,"TEXT_NODE","w:t"),o(s,"TABLE_ROW_NODE","w:tr"),o(s,"TABLE_CELL_NODE","w:tc"),o(s,"NUMBER_PROPERTIES_NODE","w:numPr")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(54);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(55);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(56);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(57);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})})},function(e,t,r){"use strict"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopListStrategy=void 0;var n=r(0);t.LoopListStrategy=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}isApplicable(e,t){const r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode);return this.utilities.docxParser.isListParagraph(r)}splitBefore(e,t){const r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode),i=this.utilities.docxParser.containingParagraphNode(t.xmlTextNode),o=n.XmlNode.siblingsInRange(r,i);return n.XmlNode.remove(e.xmlTextNode),n.XmlNode.remove(t.xmlTextNode),{firstNode:r,nodesToRepeat:o,lastNode:i}}mergeBack(e,t,r){for(const t of e)for(const e of t)n.XmlNode.insertBefore(e,r);n.XmlNode.remove(t),t!==r&&n.XmlNode.remove(r)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopParagraphStrategy=void 0;var n=r(0);t.LoopParagraphStrategy=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}isApplicable(e,t){return!0}splitBefore(e,t){let r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode),i=this.utilities.docxParser.containingParagraphNode(t.xmlTextNode);const o=r===i,s=r.parentNode,a=s.childNodes.indexOf(r),l=o?a:s.childNodes.indexOf(i);let c=n.XmlNode.splitByChild(r,e.xmlTextNode,!0);r=c[0];const d=c[1];o&&(i=d);const u=(c=n.XmlNode.splitByChild(i,t.xmlTextNode,!0))[0];let f;if(i=c[1],n.XmlNode.removeChild(s,a+1),o||n.XmlNode.removeChild(s,l),d.parentNode=null,u.parentNode=null,o)this.utilities.docxParser.joinParagraphs(d,u),f=[d];else{const e=n.XmlNode.removeSiblings(r,i);f=[d].concat(e).concat(u)}return{firstNode:r,nodesToRepeat:f,lastNode:i}}mergeBack(e,t,r){let i=t;for(const t of e){this.utilities.docxParser.joinParagraphs(i,t[0]);for(let e=1;e<t.length;e++)n.XmlNode.insertBefore(t[e],r),i=t[e]}this.utilities.docxParser.joinParagraphs(i,r),n.XmlNode.remove(r)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopTableStrategy=void 0;var n=r(0);t.LoopTableStrategy=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}isApplicable(e,t){const r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode);return!!r.parentNode&&this.utilities.docxParser.isTableCellNode(r.parentNode)}splitBefore(e,t){const r=this.utilities.docxParser.containingTableRowNode(e.xmlTextNode),i=this.utilities.docxParser.containingTableRowNode(t.xmlTextNode),o=n.XmlNode.siblingsInRange(r,i);return n.XmlNode.remove(e.xmlTextNode),n.XmlNode.remove(t.xmlTextNode),{firstNode:r,nodesToRepeat:o,lastNode:i}}mergeBack(e,t,r){for(const t of e)for(const e of t)n.XmlNode.insertBefore(e,r);n.XmlNode.remove(t),t!==r&&n.XmlNode.remove(r)}}},function(e,t,r){"use strict"},function(e,t,r){"use strict"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PluginContent=void 0;const n={isPluginContent:e=>!!e&&"string"==typeof e._type};t.PluginContent=n},function(e,t,r){"use strict"},function(e,t,r){"use strict"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Zip=void 0;var n=r(64),i=r(19),o=r(20);class s{static async load(e){const t=await n.loadAsync(e);return new s(t)}constructor(e){this.zip=e}getFile(e){return new o.ZipObject(this.zip.files[e])}setFile(e,t){this.zip.file(e,t)}isFileExist(e){return!!this.zip.files[e]}listFiles(){return Object.keys(this.zip.files)}async export(e){const t=i.JsZipHelper.toJsZipOutputType(e);return await this.zip.generateAsync({type:t,compression:"DEFLATE",compressionOptions:{level:6}})}}t.Zip=s},function(e,t){e.exports=require("jszip")},function(e,t,r){"use strict"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateHandler=void 0;var n=r(8),i=r(1),o=r(5),s=r(22),a=r(0),l=r(18);function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.TemplateHandler=class{constructor(e){c(this,"version","0.8.0"),c(this,"xmlParser",new a.XmlParser),c(this,"docxParser",void 0),c(this,"compiler",void 0),c(this,"options",void 0),this.options=new s.TemplateHandlerOptions(e),this.docxParser=new o.DocxParser(this.xmlParser);const t=new n.DelimiterSearcher(this.docxParser);t.startDelimiter=this.options.delimiters.tagStart,t.endDelimiter=this.options.delimiters.tagEnd,t.maxXmlDepth=this.options.maxXmlDepth;const r=new n.TagParser(this.docxParser,this.options.delimiters);this.compiler=new n.TemplateCompiler(t,r,this.options.plugins,this.options.defaultContentType,this.options.containerContentType),this.options.plugins.forEach(e=>{e.setUtilities({xmlParser:this.xmlParser,docxParser:this.docxParser,compiler:this.compiler})})}async process(e,t){const r=await this.loadDocx(e),i=await r.getDocument(),o=new n.ScopeData(t),s={docx:r};return await this.compiler.compile(i,o,s),r.export(e.constructor)}async parseTags(e){const t=await this.loadDocx(e),r=await t.getDocument();return this.compiler.parseTags(r)}async getText(e){const t=await this.loadDocx(e);return await t.getDocumentText()}async getXml(e){const t=await this.loadDocx(e);return await t.getDocument()}async loadDocx(e){let t;try{t=await l.Zip.load(e)}catch(e){throw new i.MalformedFileError("docx")}return this.docxParser.load(t)}}}])});
import { Delimiters } from './compliation';
import { Binary } from './misc';
import { ImageContent, LinkContent, LOOP_CONTENT_TYPE, RawXmlContent, TemplatePlugin, TEXT_CONTENT_TYPE } from './plugins';
import { Tag } from './tag';
import { XmlNode } from './xml';
import { ImageContent, RawXmlContent, TemplatePlugin , LinkContent} from './plugins';

@@ -45,7 +45,7 @@ export class TemplateHandler {

defaultContentType = TEXT_CONTENT_TYPE;
defaultContentType?= TEXT_CONTENT_TYPE;
containerContentType = LOOP_CONTENT_TYPE;
containerContentType?= LOOP_CONTENT_TYPE;
delimiters?: Delimiters;
delimiters?: Partial<Delimiters>;

@@ -52,0 +52,0 @@ maxXmlDepth?= 20;

@@ -0,1 +1,3 @@

import { Binary } from './misc';
export class Zip {

@@ -2,0 +4,0 @@

{
"name": "easy-template-x",
"version": "0.7.3",
"version": "0.8.0",
"description": "Generate docx documents from templates, in Node or in the browser.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -145,9 +145,9 @@ import { Delimiters } from '../delimiters';

if (tagContent[0] === this.delimiters.containerTagOpen) {
if (tagContent.startsWith(this.delimiters.containerTagOpen)) {
tag.disposition = TagDisposition.Open;
tag.name = tagContent.slice(1);
tag.name = tagContent.slice(this.delimiters.containerTagOpen.length).trim();
} else if (tagContent[0] === this.delimiters.containerTagClose) {
} else if (tagContent.startsWith(this.delimiters.containerTagClose)) {
tag.disposition = TagDisposition.Close;
tag.name = tagContent.slice(1);
tag.name = tagContent.slice(this.delimiters.containerTagClose.length).trim();

@@ -154,0 +154,0 @@ } else {

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

import { XmlNode } from "./xml";

@@ -22,10 +21,11 @@ export class Delimiters {

for (const key of keys) {
const value = this[key];
if (!value)
throw new Error(`${key} must be specified.`);
throw new Error(`${key} can not be empty.`);
this[key] = XmlNode.encodeValue(value);
if (value !== value.trim())
throw new Error(`${key} can not contain leading or trailing whitespace.`);
}
}
}

@@ -7,2 +7,3 @@ export * from './compilation';

export * from './xml';
export * from './zip';
export * from './delimiters';

@@ -9,0 +10,0 @@ export * from './mimeType';

import { DelimiterSearcher, ScopeData, Tag, TagParser, TemplateCompiler, TemplateContext } from './compilation';
import { Delimiters } from './delimiters';
import { MalformedFileError } from './errors';

@@ -36,3 +37,3 @@ import { Docx, DocxParser } from './office';

const tagParser = new TagParser(this.docxParser, this.options.delimiters);
const tagParser = new TagParser(this.docxParser, this.options.delimiters as Delimiters);

@@ -39,0 +40,0 @@ this.compiler = new TemplateCompiler(

@@ -8,9 +8,9 @@ import { Delimiters } from './delimiters';

public defaultContentType = TEXT_CONTENT_TYPE;
public defaultContentType?= TEXT_CONTENT_TYPE;
public containerContentType = LOOP_CONTENT_TYPE;
public containerContentType?= LOOP_CONTENT_TYPE;
public delimiters?= new Delimiters();
public delimiters?: Partial<Delimiters> = new Delimiters();
public maxXmlDepth? = 20;
public maxXmlDepth?= 20;

@@ -17,0 +17,0 @@ constructor(initial?: Partial<TemplateHandlerOptions>) {

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc