New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

easy-template-x

Package Overview
Dependencies
Maintainers
1
Versions
51
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.3.4 to 0.4.0

6

CHANGELOG.md

@@ -5,2 +5,8 @@ # Change Log

## [0.4.0 - 2018-13-12](https://github.com/alonrbar/easy-template-x/tree/v0.3.5)
### Added
- Easily find out what tags are present in a given template (TemplateHandler.parseTags).
## [0.3.4 - 2018-09-12](https://github.com/alonrbar/easy-template-x/tree/v0.3.4)

@@ -7,0 +13,0 @@

4

dist/easy-template-x.min.js

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("easy-template-x",[],e):"object"==typeof exports?exports["easy-template-x"]=e():t["easy-template-x"]=e()}(this,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=11)}([function(t,e,r){"use strict";var n,o=(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=function(t){function e(r){var n=t.call(this,"XML maximum depth reached (max depth: "+r+").")||this;return n.maxDepth=r,Object.setPrototypeOf(n,e.prototype),n}return o(e,t),e}(Error),s=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),u=function(t){function e(r){var n=t.call(this,"Argument '"+r+"' is missing.")||this;return Object.setPrototypeOf(n,e.prototype),n}return s(e,t),e}(Error),a=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),f=function(t){function e(r){var n=t.call(this,"Close delimiter is missing from '"+r+"'.")||this;return n.openDelimiterText=r,Object.setPrototypeOf(n,e.prototype),n}return a(e,t),e}(Error),c=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),l=function(t){function e(r){var n=t.call(this,"Open delimiter is missing from '"+r+"'.")||this;return n.closeDelimiterText=r,Object.setPrototypeOf(n,e.prototype),n}return c(e,t),e}(Error),h=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),p=function(t){function e(r){var n=t.call(this,"Tag '"+r+"' is never closed.")||this;return n.tagName=r,Object.setPrototypeOf(n,e.prototype),n}return h(e,t),e}(Error),d=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),g=function(t){function e(){var r=t.call(this,"The filetype for this file could not be identified, is this file corrupted?")||this;return Object.setPrototypeOf(r,e.prototype),r}return d(e,t),e}(Error),y=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),m=function(t){function e(r){var n=t.call(this,"Tag '"+r+"' does not match any of the known prefixes.")||this;return n.tagRawText=r,Object.setPrototypeOf(n,e.prototype),n}return y(e,t),e}(Error),v=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),w=function(t){function e(r){var n=t.call(this,"Tag '"+r+"' is closed but was never opened.")||this;return n.tagName=r,Object.setPrototypeOf(n,e.prototype),n}return v(e,t),e}(Error),x=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),b=function(t){function e(r){var n=t.call(this,'Filetype "'+r+'" is not supported.')||this;return Object.setPrototypeOf(n,e.prototype),n}return x(e,t),e}(Error);r.d(e,"a",function(){return i}),r.d(e,"b",function(){return u}),r.d(e,"c",function(){return f}),r.d(e,"d",function(){return l}),r.d(e,"e",function(){return p}),r.d(e,"f",function(){return g}),r.d(e,"g",function(){return m}),r.d(e,"h",function(){return w}),r.d(e,"i",function(){return b})},function(t,e,r){"use strict";(function(t){r.d(e,"a",function(){return n});var n,o=r(0);!function(e){e.toJsZipOutputType=function(e){if(!e)throw new o.b("binary");if("undefined"!=typeof Blob&&e instanceof Blob)return"blob";if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer)return"arraybuffer";if(void 0!==t&&e instanceof t)return"nodebuffer";throw new Error("Binary type '"+e.constructor.name+"' is not supported.")}}(n||(n={}))}).call(this,r(10).Buffer)},function(t,e){t.exports=require("xmldom")},function(t,e){t.exports=require("jszip")},function(t,e,r){"use strict";r.r(e);var n=function(){return function(t){Object.assign(this,t)}}(),o=r(0);function i(t){if(t.length)return t[t.length-1]}var s,u=r(1);!function(t){t.Text="Text",t.General="General"}(s||(s={}));var a;!function(t){function e(e){return{nodeType:s.Text,nodeName:t.TEXT_NODE_NAME,textContent:e}}function r(t){return{nodeType:s.General,nodeName:t}}function n(t){if(null===t||void 0===t)throw new o.b("str");if("string"!=typeof t)throw new TypeError("Expected a string, got '"+t.constructor.name+"'.");return t.replace(/[<>&'"]/g,function(t){switch(t){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case"'":return"&apos;";case'"':return"&quot;"}return""})}function u(e){if(e.nodeType===s.Text||e.nodeName===t.TEXT_NODE_NAME){if(e.nodeType!==s.Text||e.nodeName!==t.TEXT_NODE_NAME)throw new Error("Invalid text node. Type: '"+e.nodeType+"', Name: '"+e.nodeName+"'.");return!0}return!1}function a(t,e){if(!t)throw new o.b(nameof(t));if(u(t))throw new Error("Appending children to text nodes is forbidden");if(!e)throw new o.b(nameof(e));(t.childNodes||(t.childNodes=[]),t.childNodes.length)&&(t.childNodes[t.childNodes.length-1].nextSibling=e);e.nextSibling=null,e.parentNode=t,t.childNodes.push(e)}function f(t,e){if(!t)throw new o.b(nameof(t));if(null===e||void 0===e)throw new o.b(nameof(e));if(!t.childNodes||!t.childNodes.length)throw new Error("Parent node has node children");var r;if("number"==typeof e)r=e;else if(-1===(r=t.childNodes.indexOf(e)))throw new Error("Specified child node is not a child of the specified parent");if(r>=t.childNodes.length)throw new RangeError("Child index "+r+" is out of range. Parent has only "+t.childNodes.length+" child nodes.");var n=t.childNodes[r];r>0&&(t.childNodes[r-1].nextSibling=n.nextSibling);return n.parentNode=null,n.nextSibling=null,t.childNodes.splice(r,1)[0]}t.TEXT_NODE_NAME="#text",t.createTextNode=e,t.createGeneralNode=r,t.encodeValue=n,t.serialize=function t(e){if(u(e))return n(e.textContent||"");var r="";e.attributes&&e.attributes.length&&(r=" "+e.attributes.map(function(t){return t.name+'="'+t.value+'"'}).join(" "));var o,i=(e.childNodes||[]).length>0,s=i?"":"/",a="<"+e.nodeName+r+s+">";o=i?a+e.childNodes.map(function(e){return t(e)}).join("")+"</"+e.nodeName+">":a;return o},t.fromDomNode=function t(n){var o;if(n.nodeType===n.TEXT_NODE)o=e(n.textContent);else if(o=r(n.nodeName),n.nodeType===n.ELEMENT_NODE){var i=n.attributes;if(i){o.attributes=[];for(var s=0;s<i.length;s++){var u=i.item(s);o.attributes.push({name:u.name,value:u.value})}}}if(n.childNodes){o.childNodes=[];var a=void 0;for(s=0;s<n.childNodes.length;s++){var f=t(n.childNodes.item(s));o.childNodes.push(f),f.parentNode=o,a&&(a.nextSibling=f),a=f}}return o},t.isTextNode=u,t.cloneNode=function(t,e){if(!t)throw new o.b(nameof(t));var r;return e?((r=function t(e){var r={};if(r.nodeType=e.nodeType,r.nodeName=e.nodeName,u(e))r.textContent=e.textContent;else{var n=e.attributes;n&&(r.attributes=n.map(function(t){return{name:t.name,value:t.value}}))}if(e.childNodes){r.childNodes=[];for(var o=void 0,i=0,s=e.childNodes;i<s.length;i++){var a=s[i],f=t(a);r.childNodes.push(f),f.parentNode=r,o&&(o.nextSibling=f),o=f}}return r}(t)).parentNode=null,r):((r=Object.assign({},t)).parentNode=null,r.childNodes=t.childNodes?[]:null,r.nextSibling=null,r)},t.insertBefore=function(e,r){if(!e)throw new o.b(nameof(e));if(!r)throw new o.b(nameof(r));if(!r.parentNode)throw new Error("'"+nameof(r)+"' has no parent");var n=r.parentNode.childNodes.indexOf(r);t.insertChild(r.parentNode,e,n)},t.insertAfter=function(e,r){if(!e)throw new o.b(nameof(e));if(!r)throw new o.b(nameof(r));if(!r.parentNode)throw new Error("'"+nameof(r)+"' has no parent");var n=r.parentNode.childNodes.indexOf(r);t.insertChild(r.parentNode,e,n+1)},t.insertChild=function(e,r,n){if(!e)throw new o.b(nameof(e));if(u(e))throw new Error("Appending children to text nodes is forbidden");if(!r)throw new o.b(nameof(r));if(e.childNodes||(e.childNodes=[]),n!==e.childNodes.length){if(n>e.childNodes.length)throw new RangeError("Child index "+n+" is out of range. Parent has only "+e.childNodes.length+" child nodes.");r.parentNode=e;var i=e.childNodes[n];r.nextSibling=i,n>0&&(e.childNodes[n-1].nextSibling=r),e.childNodes.splice(n,0,r)}else t.appendChild(e,r)},t.appendChild=a,t.remove=function(t){if(!t)throw new o.b(nameof(t));if(!t.parentNode)throw new Error("Node has no parent");f(t.parentNode,t)},t.removeChild=f,t.lastTextChild=function(e){if(u(e))return e;if(e.childNodes){var r=e.childNodes.filter(function(t){return u(t)});if(r.length){var n=i(r);return n.textContent||(n.textContent=""),n}}var o={nodeType:s.Text,nodeName:t.TEXT_NODE_NAME,textContent:""};return a(e,o),o},t.removeSiblings=function(e,r){if(e===r)return[];var n,o=[];for(e=e.nextSibling;e!==r;){var i=e;e=e.nextSibling,t.remove(i),o.push(i),n&&(n.nextSibling=i),n=i}return o},t.splitByChild=function(e,r,n){for(var o=function(t,e){for(var r=[],n=e;n!==t;){var o=n.parentNode;if(!o)throw new Error("Argument "+nameof(e)+" is not a descendant of "+nameof(t));var i=o.childNodes.indexOf(n);r.push(i),n=o}return r.reverse()}(e,r),i=t.cloneNode(e,!1),s=o[0]+1;s<e.childNodes.length;){var u=e.childNodes[s];t.remove(u),t.appendChild(i,u)}return e.parentNode&&t.insertAfter(i,e),n&&e.childNodes.length&&t.removeChild(e,e.childNodes.length-1),[e,i]}}(a||(a={}));var f,c=function(){function t(){this.maxXmlDepth=20,this.startDelimiter="{",this.endDelimiter="}"}return t.prototype.findDelimiters=function(t){var e=[];return this.findRecurse(t,e,0),e},t.prototype.findRecurse=function(t,e,r){if(r>this.maxXmlDepth)throw new o.a(this.maxXmlDepth);if(t)if(a.isTextNode(t)){var n=this.findInNode(t);n.length&&(i=e,s=n,Array.prototype.push.apply(i,s))}else for(var i,s,u=t.childNodes?t.childNodes.length:0,f=0;f<u;f++){var c=t.childNodes[f];this.findRecurse(c,e,r+1)}},t.prototype.findInNode=function(t){if(!t.textContent)return[];for(var e=[],r=0;r<t.textContent.length;r++)t.textContent[r]===this.startDelimiter?e.push({index:r,isOpen:!0,xmlTextNode:t}):t.textContent[r]===this.endDelimiter&&e.push({index:r,isOpen:!1,xmlTextNode:t});return e},t}(),l=r(5),h=function(){function t(t){this.path=[],this.allData=t}return t.prototype.getScopeData=function(){for(var t,e=i(this.path),r=this.path.slice();void 0===t&&r.length;){var n=r.slice(0,r.length-1);t=l(this.allData,n.concat(e)),r=n}return t},t}();!function(t){t.Open="Open",t.Close="Close",t.SelfClosed="SelfClosed"}(f||(f={}));var p,d=function(){return function(t){Object.assign(this,t)}}(),g=function(){function t(t,e){if(this.tagPrefixes=t,this.docParser=e,this.startDelimiter="{",this.endDelimiter="}",!t||!t.length)throw new o.b("tagPrefixes");if(!e)throw new o.b("docParser")}return t.prototype.parse=function(t){for(var e,r,n,i,s=[],u=0,a=t;u<a.length;u++){var f=a[u];if(!e&&!f.isOpen){var c=f.xmlTextNode.textContent;throw new o.d(c)}if(e&&f.isOpen){var l=r.xmlTextNode.textContent;throw new o.c(l)}!e&&f.isOpen&&(e=new d,r=f),e&&!f.isOpen&&(n===r.xmlTextNode&&(r.index-=i),n===f.xmlTextNode&&(f.index-=i),n=f.xmlTextNode,i=this.normalizeTagNodes(r,f),e.xmlTextNode=r.xmlTextNode,this.processTag(e),s.push(e),e=null,r=null)}return s},t.prototype.normalizeTagNodes=function(t,e){var r=0,n=t.xmlTextNode,o=e.xmlTextNode,i=n===o;return t.index>0&&(r+=t.index,this.docParser.splitTextNode(n,t.index,!0)),e.index<o.textContent.length-1&&(r+=e.index+1,o=this.docParser.splitTextNode(o,e.index+1,!0),i&&(n=o)),i||(this.docParser.joinTextNodesRange(n,o),o=n),t.xmlTextNode=n,e.xmlTextNode=o,r},t.prototype.processTag=function(t){t.rawText=t.xmlTextNode.textContent;for(var e=0,r=this.tagPrefixes;e<r.length;e++){var n=r[e],i="^["+this.startDelimiter+"](\\s*?)"+n.prefix+"(.*?)["+this.endDelimiter+"]",s=new RegExp(i,"gmi").exec(t.rawText);if(s&&s.length){t.name=s[2],t.type=n.tagType,t.disposition=n.tagDisposition;break}}if(!t.name)throw new o.g(t.rawText)},t}(),y=function(){function t(t,e,r){this.delimiterSearcher=t,this.tagParser=e,this.plugins=r}return t.prototype.compile=function(t,e,r){var n=this.delimiterSearcher.findDelimiters(t),o=this.tagParser.parse(n);this.doTagReplacements(o,e,r)},t.prototype.doTagReplacements=function(t,e,r){for(var n,o=function(o){var s=t[o];if(e.path.push(s.name),s.disposition===f.SelfClosed)for(var u=0,a=i.plugins;u<a.length;u++){if((d=a[u]).prefixes.some(function(t){return t.tagType===s.type})){d.simpleTagReplacements(s,e,r);break}}else if(s.disposition===f.Open){var c=i.findCloseTagIndex(o,s,t),l=t.slice(o,c+1);o=c;for(var h=0,p=i.plugins;h<p.length;h++){var d;if((d=p[h]).prefixes.some(function(t){return t.tagType===s.type})){d.containerTagReplacements(l,e,r);break}}}e.path.pop(),n=o},i=this,s=0;s<t.length;s++)o(s),s=n},t.prototype.findCloseTagIndex=function(t,e,r){for(var n=t;n<r.length;n++){var i=r[n];if(i.name===e.name&&i.type===e.type&&i.disposition===f.Close)break}if(n===r.length)throw new o.e(e.name);return n},t}(),m=function(){function t(){}return t.prototype.setUtilities=function(t){this.utilities=t},t.prototype.simpleTagReplacements=function(t,e,r){},t.prototype.containerTagReplacements=function(t,e,r){},t}(),v=(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),w=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.prefixes=[{prefix:"#",tagType:"loop",tagDisposition:f.Open},{prefix:"/",tagType:"loop",tagDisposition:f.Close}],e}return v(e,t),e.prototype.containerTagReplacements=function(t,e,r){var n=e.getScopeData();n&&Array.isArray(n)&&n.length||(n=[]);var o,s=t[0],u=i(t),a=this.utilities.docxParser.containingParagraphNode(s.xmlTextNode),f=this.utilities.docxParser.containingParagraphNode(u.xmlTextNode),c=a===f,l=this.splitParagraphs(s.xmlTextNode,u.xmlTextNode);a=l.firstParagraph,f=l.lastParagraph,o=l.middleParagraphs;var h=this.repeat(o,n.length),p=this.compile(h,e,r);this.mergeBack(p,a,f,c)},e.prototype.splitParagraphs=function(t,e){var r=this.utilities.docxParser.containingParagraphNode(t),n=this.utilities.docxParser.containingParagraphNode(e),o=r===n,i=r.parentNode,s=i.childNodes.indexOf(r),u=o?s:i.childNodes.indexOf(n),f=a.splitByChild(r,t,!0);r=f[0];var c=f[1];o&&(n=c);var l,h=(f=a.splitByChild(n,e,!0))[0];if(n=f[1],a.removeChild(i,s+1),o||a.removeChild(i,u),c.parentNode=null,h.parentNode=null,o)this.utilities.docxParser.joinParagraphs(c,h),l=[c];else{var p=a.removeSiblings(r,n);l=[c].concat(p).concat(h)}return{firstParagraph:r,middleParagraphs:l,lastParagraph:n}},e.prototype.repeat=function(t,e){if(!t.length||!e)return[];for(var r=[],n=0;n<e;n++){var o=t.map(function(t){return a.cloneNode(t,!0)});r.push(o)}return r},e.prototype.compile=function(t,e,r){for(var n=[],o=function(o){var s=t[o],u=a.createGeneralNode("dummyRootNode");s.forEach(function(t){return a.appendChild(u,t)}),e.path.push(o),i.utilities.compiler.compile(u,e,r),e.path.pop();for(var f=[];u.childNodes&&u.childNodes.length;){var c=a.removeChild(u,0);f.push(c)}n.push(f)},i=this,s=0;s<t.length;s++)o(s);return n},e.prototype.mergeBack=function(t,e,r,n){for(var o=e,i=0,s=t;i<s.length;i++){var u=s[i];this.utilities.docxParser.joinParagraphs(o,u[0]);for(var f=1;f<u.length;f++)a.insertBefore(u[f],r),o=u[f]}this.utilities.docxParser.joinParagraphs(o,r),a.remove(r)},e}(m),x=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),b=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.prefixes=[{prefix:"@",tagType:"rawXml",tagDisposition:f.SelfClosed}],e}return x(e,t),e.prototype.simpleTagReplacements=function(t,e){var r=this.utilities.docxParser.containingTextNode(t.xmlTextNode),n=e.getScopeData();if("string"==typeof n){var o=this.utilities.xmlParser.parse(n);a.insertBefore(o,r)}a.remove(r)},e}(m),N=function(){function t(){}return t.prototype.contentFilePaths=function(t){return["word/document.xml","word/document2.xml"]},t.prototype.mainFilePath=function(t){return t.files["word/document.xml"]?"word/document.xml":t.files["word/document2.xml"]?"word/document2.xml":void 0},t.prototype.splitTextNode=function(t,e,r){var n,o,i=this.containingTextNode(t),s=a.cloneNode(i,!0);if(r)a.insertBefore(s,i),n=a.lastTextChild(s),o=t;else{var u=i.parentNode.childNodes.indexOf(i);a.insertChild(i.parentNode,s,u+1),n=t,o=a.lastTextChild(s)}var f=n.textContent,c=o.textContent;return n.textContent=f.substring(0,e),o.textContent=c.substring(e),r?n:o},t.prototype.joinTextNodesRange=function(e,r){var n=this.containingRunNode(e),o=this.containingRunNode(r),i=n.parentNode;if(o.parentNode!==i)throw new Error("Can not join text nodes from separate paragraphs.");for(var s=this.containingTextNode(e),u=this.containingTextNode(r),f=[],c=n;c;){var l=void 0;for(l=c===n?s:this.firstTextNodeChild(c);l;)if(l.nodeName===t.TEXT_NODE){var h=a.lastTextChild(l);f.push(h.textContent);var p=l;l=l===u?null:l.nextSibling,p!==s&&a.remove(p)}var d=c;c=c===o?null:c.nextSibling,d.childNodes&&d.childNodes.length||a.remove(d)}a.lastTextChild(s).textContent=f.join("")},t.prototype.joinParagraphs=function(e,r){if(e!==r)for(var n=0;r.childNodes&&n<r.childNodes.length;){var o=r.childNodes[n];o.nodeName===t.RUN_NODE?(a.removeChild(r,n),a.appendChild(e,o)):n++}},t.prototype.firstTextNodeChild=function(e){if(!e)return null;if(e.nodeName!==t.RUN_NODE)return null;if(!e.childNodes)return null;for(var r=0,n=e.childNodes;r<n.length;r++){var o=n[r];if(o.nodeName===t.TEXT_NODE)return o}return null},t.prototype.containingTextNode=function(e){if(!e)return null;if(!a.isTextNode(e))throw new Error("'Invalid argument node. Expected a XmlTextNode.");for(var r=e;r.parentNode;){if(r.nodeName===t.TEXT_NODE)return r;r=r.parentNode}return null},t.prototype.containingRunNode=function(e){return e?e.nodeName===t.RUN_NODE?e:this.containingRunNode(e.parentNode):null},t.prototype.containingParagraphNode=function(e){return e?e.nodeName===t.PARAGRAPH_NODE?e:this.containingParagraphNode(e.parentNode):null},t.PARAGRAPH_NODE="w:p",t.RUN_NODE="w:r",t.TEXT_NODE="w:t",t}(),_=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),T=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.prefixes=[{prefix:"",tagType:"text",tagDisposition:f.SelfClosed}],e}return _(e,t),e.prototype.simpleTagReplacements=function(t,e){var r=(e.getScopeData()||"").split("\n");r.length<2?this.replaceSingleLine(t.xmlTextNode,r.length?r[0]:""):this.replaceMultiLine(t.xmlTextNode,r)},e.prototype.replaceSingleLine=function(t,e){t.textContent=e;var r=this.utilities.docxParser.containingTextNode(t);r.attributes||(r.attributes=[]),r.attributes.find(function(t){return"xml:space"===t.name})||r.attributes.push(this.getSpacePreserveAttribute())},e.prototype.replaceMultiLine=function(t,e){var r=this.utilities.docxParser.containingRunNode(t);t.textContent=e[0];for(var n=1;n<e.length;n++){var o=this.getLineBreak();a.appendChild(r,o);var i=this.createWordTextNode(e[n]);a.appendChild(r,i)}},e.prototype.getSpacePreserveAttribute=function(){return{name:"xml:space",value:"preserve"}},e.prototype.getLineBreak=function(){return{nodeType:s.General,nodeName:"w:br"}},e.prototype.createWordTextNode=function(t){var e=a.createGeneralNode(N.TEXT_NODE);return e.attributes=[this.getSpacePreserveAttribute()],e.childNodes=[a.createTextNode(t)],e},e}(m);function P(){return[new w,new b,new T]}var E,O,A=function(){return function(t){if(this.start="{",this.end="}",t&&(t.start&&(this.start=a.encodeValue(t.start)),t.end&&(this.end=a.encodeValue(t.end))),!this.start||!this.end)throw new Error("Both delimiters must be specified.");if(this.start===this.end)throw new Error("Start and end delimiters can not be the same.");if(this.start.length>1||this.end.length>1)throw new Error("Only single character delimiters supported (start: '"+this.start+"', end: '"+this.end+"').")}}(),R=r(3);(O=E||(E={})).Docx="docx",O.Pptx="pptx",O.Odt="odt",function(t){function e(t){return!(!t.files["word/document.xml"]&&!t.files["word/document2.xml"])}function r(t){return!!t.files["ppt/presentation.xml"]}function n(t){return!!t.files.mimetype}t.getFileType=function(i){if(e(i))return t.Docx;if(r(i))return t.Pptx;if(n(i))return t.Odt;throw new o.f},t.isDocx=e,t.isPptx=r,t.isOdt=n}(E||(E={}));var D=function(){return function(t){if(this.plugins=P(),this.delimiters=new A,this.maxXmlDepth=20,Object.assign(this,t),t&&(this.delimiters=new A(t.delimiters)),!this.plugins.length)throw new Error("Plugins list can not be empty")}}(),S=r(2),C=function(){function t(){}return t.prototype.parse=function(t){var e=this.domParse(t);return a.fromDomNode(e.documentElement)},t.prototype.domParse=function(e){if(null===e||void 0===e)throw new o.b("str");return t.parser.parseFromString(e,"text/xml")},t.prototype.serialize=function(e){return t.xmlHeader+a.serialize(e)},t.xmlHeader='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',t.parser=new S.DOMParser,t}(),B=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{a(n.next(t))}catch(t){i(t)}}function u(t){try{a(n.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,u)}a((n=n.apply(t,e||[])).next())})},U=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=n[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},j=function(){function t(t){var e=this;this.docxParser=new N,this.xmlParser=new C,this.options=new D(t);var r=new c;r.startDelimiter=this.options.delimiters.start,r.endDelimiter=this.options.delimiters.end,r.maxXmlDepth=this.options.maxXmlDepth;var n=this.options.plugins.map(function(t){return t.prefixes}).reduce(function(t,e){return t.concat(e)},[]),o=new g(n,this.docxParser);o.startDelimiter=this.options.delimiters.start,o.endDelimiter=this.options.delimiters.end,this.compiler=new y(r,o,this.options.plugins),this.options.plugins.forEach(function(t){t.setUtilities({xmlParser:e.xmlParser,docxParser:e.docxParser,compiler:e.compiler})})}return t.prototype.process=function(t,e){return B(this,void 0,void 0,function(){var r,n,o,i,s,a,f,c,l,p,d,g;return U(this,function(y){switch(y.label){case 0:return[4,this.loadDocx(t)];case 1:return r=y.sent(),[4,this.parseContentDocuments(r)];case 2:for(n=y.sent(),o=new h(e),i={zipFile:r,currentFilePath:null},s=0,a=Object.keys(n);s<a.length;s++)l=a[s],i.currentFilePath=l,this.compiler.compile(n[l],o,i);for(f=0,c=Object.keys(n);f<c.length;f++)l=c[f],p=n[l],d=this.xmlParser.serialize(p),r.file(l,d,{createFolders:!0});return g=u.a.toJsZipOutputType(t),[2,r.generateAsync({type:g})]}})})},t.prototype.getText=function(t){return B(this,void 0,void 0,function(){var e,r,n;return U(this,function(o){switch(o.label){case 0:return[4,this.loadDocx(t)];case 1:return e=o.sent(),r=this.docxParser.mainFilePath(e),[4,e.files[r].async("text")];case 2:return n=o.sent(),[2,this.xmlParser.domParse(n).documentElement.textContent]}})})},t.prototype.loadDocx=function(t){return B(this,void 0,void 0,function(){var e,r;return U(this,function(n){switch(n.label){case 0:return[4,R.loadAsync(t)];case 1:if(e=n.sent(),(r=E.getFileType(e))!==E.Docx)throw new o.i(r);return[2,e]}})})},t.prototype.parseContentDocuments=function(t){return B(this,void 0,void 0,function(){var e,r,n,o,i,s,u;return U(this,function(a){switch(a.label){case 0:e=this.docxParser.contentFilePaths(t),r=e.filter(function(e){return t.files[e]}),n={},o=0,i=r,a.label=1;case 1:return o<i.length?(s=i[o],[4,t.files[s].async("text")]):[3,4];case 2:u=a.sent(),n[s]=this.xmlParser.parse(u),a.label=3;case 3:return o++,[3,1];case 4:return[2,n]}})})},t}();r.d(e,"DelimiterMark",function(){return n}),r.d(e,"DelimiterSearcher",function(){return c}),r.d(e,"ScopeData",function(){return h}),r.d(e,"TagDisposition",function(){return f}),r.d(e,"Tag",function(){return d}),r.d(e,"TagParser",function(){return g}),r.d(e,"TemplateCompiler",function(){return y}),r.d(e,"MaxXmlDepthError",function(){return o.a}),r.d(e,"MissingArgumentError",function(){return o.b}),r.d(e,"MissingCloseDelimiterError",function(){return o.c}),r.d(e,"MissingStartDelimiterError",function(){return o.d}),r.d(e,"UnclosedTagError",function(){return o.e}),r.d(e,"UnidentifiedFileTypeError",function(){return o.f}),r.d(e,"UnknownPrefixError",function(){return o.g}),r.d(e,"UnopenedTagError",function(){return o.h}),r.d(e,"UnsupportedFileTypeError",function(){return o.i}),r.d(e,"createDefaultPlugins",function(){return P}),r.d(e,"LoopPlugin",function(){return w}),r.d(e,"RawXmlPlugin",function(){return b}),r.d(e,"TemplatePlugin",function(){return m}),r.d(e,"TextPlugin",function(){return T}),r.d(e,"Delimiters",function(){return A}),r.d(e,"DocxParser",function(){return N}),r.d(e,"TemplateHandler",function(){return j}),r.d(e,"TemplateHandlerOptions",function(){return D}),r.d(e,"Binary",function(){return u.a}),r.d(e,"XmlNodeType",function(){return s}),r.d(e,"TEXT_NODE_NAME_VALUE",function(){return"#text"}),r.d(e,"XmlNode",function(){return a}),r.d(e,"XmlParser",function(){return C})},function(t,e){t.exports=require("lodash.get")},function(t,e){t.exports=require("isarray")},function(t,e){t.exports=require("ieee754")},function(t,e){t.exports=require("base64-js")},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";(function(t){
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("easy-template-x",[],e):"object"==typeof exports?exports["easy-template-x"]=e():t["easy-template-x"]=e()}(this,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=11)}([function(t,e,r){"use strict";var n,o=(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=function(t){function e(r){var n=t.call(this,"XML maximum depth reached (max depth: "+r+").")||this;return n.maxDepth=r,Object.setPrototypeOf(n,e.prototype),n}return o(e,t),e}(Error),s=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),u=function(t){function e(r){var n=t.call(this,"Argument '"+r+"' is missing.")||this;return Object.setPrototypeOf(n,e.prototype),n}return s(e,t),e}(Error),a=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),f=function(t){function e(r){var n=t.call(this,"Close delimiter is missing from '"+r+"'.")||this;return n.openDelimiterText=r,Object.setPrototypeOf(n,e.prototype),n}return a(e,t),e}(Error),c=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),l=function(t){function e(r){var n=t.call(this,"Open delimiter is missing from '"+r+"'.")||this;return n.closeDelimiterText=r,Object.setPrototypeOf(n,e.prototype),n}return c(e,t),e}(Error),h=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),p=function(t){function e(r){var n=t.call(this,"Tag '"+r+"' is never closed.")||this;return n.tagName=r,Object.setPrototypeOf(n,e.prototype),n}return h(e,t),e}(Error),d=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),g=function(t){function e(){var r=t.call(this,"The filetype for this file could not be identified, is this file corrupted?")||this;return Object.setPrototypeOf(r,e.prototype),r}return d(e,t),e}(Error),y=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),m=function(t){function e(r){var n=t.call(this,"Tag '"+r+"' does not match any of the known prefixes.")||this;return n.tagRawText=r,Object.setPrototypeOf(n,e.prototype),n}return y(e,t),e}(Error),v=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),w=function(t){function e(r){var n=t.call(this,"Tag '"+r+"' is closed but was never opened.")||this;return n.tagName=r,Object.setPrototypeOf(n,e.prototype),n}return v(e,t),e}(Error),x=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),b=function(t){function e(r){var n=t.call(this,'Filetype "'+r+'" is not supported.')||this;return Object.setPrototypeOf(n,e.prototype),n}return x(e,t),e}(Error);r.d(e,"a",function(){return i}),r.d(e,"b",function(){return u}),r.d(e,"c",function(){return f}),r.d(e,"d",function(){return l}),r.d(e,"e",function(){return p}),r.d(e,"f",function(){return g}),r.d(e,"g",function(){return m}),r.d(e,"h",function(){return w}),r.d(e,"i",function(){return b})},function(t,e,r){"use strict";(function(t){r.d(e,"a",function(){return n});var n,o=r(0);!function(e){e.toJsZipOutputType=function(e){if(!e)throw new o.b("binary");if("undefined"!=typeof Blob&&e instanceof Blob)return"blob";if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer)return"arraybuffer";if(void 0!==t&&e instanceof t)return"nodebuffer";throw new Error("Binary type '"+e.constructor.name+"' is not supported.")}}(n||(n={}))}).call(this,r(10).Buffer)},function(t,e){t.exports=require("xmldom")},function(t,e){t.exports=require("jszip")},function(t,e,r){"use strict";r.r(e);var n=function(){return function(t){Object.assign(this,t)}}(),o=r(0);function i(t,e){Array.prototype.push.apply(t,e)}function s(t){if(t.length)return t[t.length-1]}var u,a=r(1);!function(t){t.Text="Text",t.General="General"}(u||(u={}));var f;!function(t){function e(e){return{nodeType:u.Text,nodeName:t.TEXT_NODE_NAME,textContent:e}}function r(t){return{nodeType:u.General,nodeName:t}}function n(t){if(null===t||void 0===t)throw new o.b("str");if("string"!=typeof t)throw new TypeError("Expected a string, got '"+t.constructor.name+"'.");return t.replace(/[<>&'"]/g,function(t){switch(t){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case"'":return"&apos;";case'"':return"&quot;"}return""})}function i(e){if(e.nodeType===u.Text||e.nodeName===t.TEXT_NODE_NAME){if(e.nodeType!==u.Text||e.nodeName!==t.TEXT_NODE_NAME)throw new Error("Invalid text node. Type: '"+e.nodeType+"', Name: '"+e.nodeName+"'.");return!0}return!1}function a(t,e){if(!t)throw new o.b(nameof(t));if(i(t))throw new Error("Appending children to text nodes is forbidden");if(!e)throw new o.b(nameof(e));(t.childNodes||(t.childNodes=[]),t.childNodes.length)&&(t.childNodes[t.childNodes.length-1].nextSibling=e);e.nextSibling=null,e.parentNode=t,t.childNodes.push(e)}function f(t,e){if(!t)throw new o.b(nameof(t));if(null===e||void 0===e)throw new o.b(nameof(e));if(!t.childNodes||!t.childNodes.length)throw new Error("Parent node has node children");var r;if("number"==typeof e)r=e;else if(-1===(r=t.childNodes.indexOf(e)))throw new Error("Specified child node is not a child of the specified parent");if(r>=t.childNodes.length)throw new RangeError("Child index "+r+" is out of range. Parent has only "+t.childNodes.length+" child nodes.");var n=t.childNodes[r];r>0&&(t.childNodes[r-1].nextSibling=n.nextSibling);return n.parentNode=null,n.nextSibling=null,t.childNodes.splice(r,1)[0]}t.TEXT_NODE_NAME="#text",t.createTextNode=e,t.createGeneralNode=r,t.encodeValue=n,t.serialize=function t(e){if(i(e))return n(e.textContent||"");var r="";e.attributes&&e.attributes.length&&(r=" "+e.attributes.map(function(t){return t.name+'="'+t.value+'"'}).join(" "));var o,s=(e.childNodes||[]).length>0,u=s?"":"/",a="<"+e.nodeName+r+u+">";o=s?a+e.childNodes.map(function(e){return t(e)}).join("")+"</"+e.nodeName+">":a;return o},t.fromDomNode=function t(n){var o;if(n.nodeType===n.TEXT_NODE)o=e(n.textContent);else if(o=r(n.nodeName),n.nodeType===n.ELEMENT_NODE){var i=n.attributes;if(i){o.attributes=[];for(var s=0;s<i.length;s++){var u=i.item(s);o.attributes.push({name:u.name,value:u.value})}}}if(n.childNodes){o.childNodes=[];var a=void 0;for(s=0;s<n.childNodes.length;s++){var f=t(n.childNodes.item(s));o.childNodes.push(f),f.parentNode=o,a&&(a.nextSibling=f),a=f}}return o},t.isTextNode=i,t.cloneNode=function(t,e){if(!t)throw new o.b(nameof(t));var r;return e?((r=function t(e){var r={};if(r.nodeType=e.nodeType,r.nodeName=e.nodeName,i(e))r.textContent=e.textContent;else{var n=e.attributes;n&&(r.attributes=n.map(function(t){return{name:t.name,value:t.value}}))}if(e.childNodes){r.childNodes=[];for(var o=void 0,s=0,u=e.childNodes;s<u.length;s++){var a=u[s],f=t(a);r.childNodes.push(f),f.parentNode=r,o&&(o.nextSibling=f),o=f}}return r}(t)).parentNode=null,r):((r=Object.assign({},t)).parentNode=null,r.childNodes=t.childNodes?[]:null,r.nextSibling=null,r)},t.insertBefore=function(e,r){if(!e)throw new o.b(nameof(e));if(!r)throw new o.b(nameof(r));if(!r.parentNode)throw new Error("'"+nameof(r)+"' has no parent");var n=r.parentNode.childNodes.indexOf(r);t.insertChild(r.parentNode,e,n)},t.insertAfter=function(e,r){if(!e)throw new o.b(nameof(e));if(!r)throw new o.b(nameof(r));if(!r.parentNode)throw new Error("'"+nameof(r)+"' has no parent");var n=r.parentNode.childNodes.indexOf(r);t.insertChild(r.parentNode,e,n+1)},t.insertChild=function(e,r,n){if(!e)throw new o.b(nameof(e));if(i(e))throw new Error("Appending children to text nodes is forbidden");if(!r)throw new o.b(nameof(r));if(e.childNodes||(e.childNodes=[]),n!==e.childNodes.length){if(n>e.childNodes.length)throw new RangeError("Child index "+n+" is out of range. Parent has only "+e.childNodes.length+" child nodes.");r.parentNode=e;var s=e.childNodes[n];r.nextSibling=s,n>0&&(e.childNodes[n-1].nextSibling=r),e.childNodes.splice(n,0,r)}else t.appendChild(e,r)},t.appendChild=a,t.remove=function(t){if(!t)throw new o.b(nameof(t));if(!t.parentNode)throw new Error("Node has no parent");f(t.parentNode,t)},t.removeChild=f,t.lastTextChild=function(e){if(i(e))return e;if(e.childNodes){var r=e.childNodes.filter(function(t){return i(t)});if(r.length){var n=s(r);return n.textContent||(n.textContent=""),n}}var o={nodeType:u.Text,nodeName:t.TEXT_NODE_NAME,textContent:""};return a(e,o),o},t.removeSiblings=function(e,r){if(e===r)return[];var n,o=[];for(e=e.nextSibling;e!==r;){var i=e;e=e.nextSibling,t.remove(i),o.push(i),n&&(n.nextSibling=i),n=i}return o},t.splitByChild=function(e,r,n){for(var o=function(t,e){for(var r=[],n=e;n!==t;){var o=n.parentNode;if(!o)throw new Error("Argument "+nameof(e)+" is not a descendant of "+nameof(t));var i=o.childNodes.indexOf(n);r.push(i),n=o}return r.reverse()}(e,r),i=t.cloneNode(e,!1),s=o[0]+1;s<e.childNodes.length;){var u=e.childNodes[s];t.remove(u),t.appendChild(i,u)}return e.parentNode&&t.insertAfter(i,e),n&&e.childNodes.length&&t.removeChild(e,e.childNodes.length-1),[e,i]}}(f||(f={}));var c,l=function(){function t(){this.maxXmlDepth=20,this.startDelimiter="{",this.endDelimiter="}"}return t.prototype.findDelimiters=function(t){var e=[];return this.findRecurse(t,e,0),e},t.prototype.findRecurse=function(t,e,r){if(r>this.maxXmlDepth)throw new o.a(this.maxXmlDepth);if(t)if(f.isTextNode(t)){var n=this.findInNode(t);n.length&&i(e,n)}else for(var s=t.childNodes?t.childNodes.length:0,u=0;u<s;u++){var a=t.childNodes[u];this.findRecurse(a,e,r+1)}},t.prototype.findInNode=function(t){if(!t.textContent)return[];for(var e=[],r=0;r<t.textContent.length;r++)t.textContent[r]===this.startDelimiter?e.push({index:r,isOpen:!0,xmlTextNode:t}):t.textContent[r]===this.endDelimiter&&e.push({index:r,isOpen:!1,xmlTextNode:t});return e},t}(),h=r(5),p=function(){function t(t){this.path=[],this.allData=t}return t.prototype.getScopeData=function(){for(var t,e=s(this.path),r=this.path.slice();void 0===t&&r.length;){var n=r.slice(0,r.length-1);t=h(this.allData,n.concat(e)),r=n}return t},t}();!function(t){t.Open="Open",t.Close="Close",t.SelfClosed="SelfClosed"}(c||(c={}));var d,g=function(){return function(t){Object.assign(this,t)}}(),y=function(){function t(t,e){if(this.tagPrefixes=t,this.docParser=e,this.startDelimiter="{",this.endDelimiter="}",!t||!t.length)throw new o.b("tagPrefixes");if(!e)throw new o.b("docParser")}return t.prototype.parse=function(t){for(var e,r,n,i,s=[],u=0,a=t;u<a.length;u++){var f=a[u];if(!e&&!f.isOpen){var c=f.xmlTextNode.textContent;throw new o.d(c)}if(e&&f.isOpen){var l=r.xmlTextNode.textContent;throw new o.c(l)}!e&&f.isOpen&&(e=new g,r=f),e&&!f.isOpen&&(n===r.xmlTextNode&&(r.index-=i),n===f.xmlTextNode&&(f.index-=i),n=f.xmlTextNode,i=this.normalizeTagNodes(r,f),e.xmlTextNode=r.xmlTextNode,this.processTag(e),s.push(e),e=null,r=null)}return s},t.prototype.normalizeTagNodes=function(t,e){var r=0,n=t.xmlTextNode,o=e.xmlTextNode,i=n===o;return t.index>0&&(r+=t.index,this.docParser.splitTextNode(n,t.index,!0)),e.index<o.textContent.length-1&&(r+=e.index+1,o=this.docParser.splitTextNode(o,e.index+1,!0),i&&(n=o)),i||(this.docParser.joinTextNodesRange(n,o),o=n),t.xmlTextNode=n,e.xmlTextNode=o,r},t.prototype.processTag=function(t){t.rawText=t.xmlTextNode.textContent;for(var e=0,r=this.tagPrefixes;e<r.length;e++){var n=r[e],i="^["+this.startDelimiter+"](\\s*?)"+n.prefix+"(.*?)["+this.endDelimiter+"]",s=new RegExp(i,"gmi").exec(t.rawText);if(s&&s.length){t.name=s[2],t.type=n.tagType,t.disposition=n.tagDisposition;break}}if(!t.name)throw new o.g(t.rawText)},t}(),m=function(){function t(t,e,r){this.delimiterSearcher=t,this.tagParser=e,this.plugins=r}return t.prototype.compile=function(t,e,r){var n=this.parseTags(t);this.doTagReplacements(n,e,r)},t.prototype.parseTags=function(t){var e=this.delimiterSearcher.findDelimiters(t);return this.tagParser.parse(e)},t.prototype.doTagReplacements=function(t,e,r){for(var n,o=function(o){var s=t[o];if(e.path.push(s.name),s.disposition===c.SelfClosed)for(var u=0,a=i.plugins;u<a.length;u++){if((d=a[u]).prefixes.some(function(t){return t.tagType===s.type})){d.simpleTagReplacements(s,e,r);break}}else if(s.disposition===c.Open){var f=i.findCloseTagIndex(o,s,t),l=t.slice(o,f+1);o=f;for(var h=0,p=i.plugins;h<p.length;h++){var d;if((d=p[h]).prefixes.some(function(t){return t.tagType===s.type})){d.containerTagReplacements(l,e,r);break}}}e.path.pop(),n=o},i=this,s=0;s<t.length;s++)o(s),s=n},t.prototype.findCloseTagIndex=function(t,e,r){for(var n=t;n<r.length;n++){var i=r[n];if(i.name===e.name&&i.type===e.type&&i.disposition===c.Close)break}if(n===r.length)throw new o.e(e.name);return n},t}(),v=function(){function t(){}return t.prototype.setUtilities=function(t){this.utilities=t},t.prototype.simpleTagReplacements=function(t,e,r){},t.prototype.containerTagReplacements=function(t,e,r){},t}(),w=(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),x=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.prefixes=[{prefix:"#",tagType:"loop",tagDisposition:c.Open},{prefix:"/",tagType:"loop",tagDisposition:c.Close}],e}return w(e,t),e.prototype.containerTagReplacements=function(t,e,r){var n=e.getScopeData();n&&Array.isArray(n)&&n.length||(n=[]);var o,i=t[0],u=s(t),a=this.utilities.docxParser.containingParagraphNode(i.xmlTextNode),f=this.utilities.docxParser.containingParagraphNode(u.xmlTextNode),c=a===f,l=this.splitParagraphs(i.xmlTextNode,u.xmlTextNode);a=l.firstParagraph,f=l.lastParagraph,o=l.middleParagraphs;var h=this.repeat(o,n.length),p=this.compile(h,e,r);this.mergeBack(p,a,f,c)},e.prototype.splitParagraphs=function(t,e){var r=this.utilities.docxParser.containingParagraphNode(t),n=this.utilities.docxParser.containingParagraphNode(e),o=r===n,i=r.parentNode,s=i.childNodes.indexOf(r),u=o?s:i.childNodes.indexOf(n),a=f.splitByChild(r,t,!0);r=a[0];var c=a[1];o&&(n=c);var l,h=(a=f.splitByChild(n,e,!0))[0];if(n=a[1],f.removeChild(i,s+1),o||f.removeChild(i,u),c.parentNode=null,h.parentNode=null,o)this.utilities.docxParser.joinParagraphs(c,h),l=[c];else{var p=f.removeSiblings(r,n);l=[c].concat(p).concat(h)}return{firstParagraph:r,middleParagraphs:l,lastParagraph:n}},e.prototype.repeat=function(t,e){if(!t.length||!e)return[];for(var r=[],n=0;n<e;n++){var o=t.map(function(t){return f.cloneNode(t,!0)});r.push(o)}return r},e.prototype.compile=function(t,e,r){for(var n=[],o=function(o){var s=t[o],u=f.createGeneralNode("dummyRootNode");s.forEach(function(t){return f.appendChild(u,t)}),e.path.push(o),i.utilities.compiler.compile(u,e,r),e.path.pop();for(var a=[];u.childNodes&&u.childNodes.length;){var c=f.removeChild(u,0);a.push(c)}n.push(a)},i=this,s=0;s<t.length;s++)o(s);return n},e.prototype.mergeBack=function(t,e,r,n){for(var o=e,i=0,s=t;i<s.length;i++){var u=s[i];this.utilities.docxParser.joinParagraphs(o,u[0]);for(var a=1;a<u.length;a++)f.insertBefore(u[a],r),o=u[a]}this.utilities.docxParser.joinParagraphs(o,r),f.remove(r)},e}(v),b=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),N=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.prefixes=[{prefix:"@",tagType:"rawXml",tagDisposition:c.SelfClosed}],e}return b(e,t),e.prototype.simpleTagReplacements=function(t,e){var r=this.utilities.docxParser.containingTextNode(t.xmlTextNode),n=e.getScopeData();if("string"==typeof n){var o=this.utilities.xmlParser.parse(n);f.insertBefore(o,r)}f.remove(r)},e}(v),T=function(){function t(){}return t.prototype.contentFilePaths=function(t){return["word/document.xml","word/document2.xml"]},t.prototype.mainFilePath=function(t){return t.files["word/document.xml"]?"word/document.xml":t.files["word/document2.xml"]?"word/document2.xml":void 0},t.prototype.splitTextNode=function(t,e,r){var n,o,i=this.containingTextNode(t),s=f.cloneNode(i,!0);if(r)f.insertBefore(s,i),n=f.lastTextChild(s),o=t;else{var u=i.parentNode.childNodes.indexOf(i);f.insertChild(i.parentNode,s,u+1),n=t,o=f.lastTextChild(s)}var a=n.textContent,c=o.textContent;return n.textContent=a.substring(0,e),o.textContent=c.substring(e),r?n:o},t.prototype.joinTextNodesRange=function(e,r){var n=this.containingRunNode(e),o=this.containingRunNode(r),i=n.parentNode;if(o.parentNode!==i)throw new Error("Can not join text nodes from separate paragraphs.");for(var s=this.containingTextNode(e),u=this.containingTextNode(r),a=[],c=n;c;){var l=void 0;for(l=c===n?s:this.firstTextNodeChild(c);l;)if(l.nodeName===t.TEXT_NODE){var h=f.lastTextChild(l);a.push(h.textContent);var p=l;l=l===u?null:l.nextSibling,p!==s&&f.remove(p)}var d=c;c=c===o?null:c.nextSibling,d.childNodes&&d.childNodes.length||f.remove(d)}f.lastTextChild(s).textContent=a.join("")},t.prototype.joinParagraphs=function(e,r){if(e!==r)for(var n=0;r.childNodes&&n<r.childNodes.length;){var o=r.childNodes[n];o.nodeName===t.RUN_NODE?(f.removeChild(r,n),f.appendChild(e,o)):n++}},t.prototype.firstTextNodeChild=function(e){if(!e)return null;if(e.nodeName!==t.RUN_NODE)return null;if(!e.childNodes)return null;for(var r=0,n=e.childNodes;r<n.length;r++){var o=n[r];if(o.nodeName===t.TEXT_NODE)return o}return null},t.prototype.containingTextNode=function(e){if(!e)return null;if(!f.isTextNode(e))throw new Error("'Invalid argument node. Expected a XmlTextNode.");for(var r=e;r.parentNode;){if(r.nodeName===t.TEXT_NODE)return r;r=r.parentNode}return null},t.prototype.containingRunNode=function(e){return e?e.nodeName===t.RUN_NODE?e:this.containingRunNode(e.parentNode):null},t.prototype.containingParagraphNode=function(e){return e?e.nodeName===t.PARAGRAPH_NODE?e:this.containingParagraphNode(e.parentNode):null},t.PARAGRAPH_NODE="w:p",t.RUN_NODE="w:r",t.TEXT_NODE="w:t",t}(),_=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),P=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.prefixes=[{prefix:"",tagType:"text",tagDisposition:c.SelfClosed}],e}return _(e,t),e.prototype.simpleTagReplacements=function(t,e){var r=(e.getScopeData()||"").split("\n");r.length<2?this.replaceSingleLine(t.xmlTextNode,r.length?r[0]:""):this.replaceMultiLine(t.xmlTextNode,r)},e.prototype.replaceSingleLine=function(t,e){t.textContent=e;var r=this.utilities.docxParser.containingTextNode(t);r.attributes||(r.attributes=[]),r.attributes.find(function(t){return"xml:space"===t.name})||r.attributes.push(this.getSpacePreserveAttribute())},e.prototype.replaceMultiLine=function(t,e){var r=this.utilities.docxParser.containingRunNode(t);t.textContent=e[0];for(var n=1;n<e.length;n++){var o=this.getLineBreak();f.appendChild(r,o);var i=this.createWordTextNode(e[n]);f.appendChild(r,i)}},e.prototype.getSpacePreserveAttribute=function(){return{name:"xml:space",value:"preserve"}},e.prototype.getLineBreak=function(){return{nodeType:u.General,nodeName:"w:br"}},e.prototype.createWordTextNode=function(t){var e=f.createGeneralNode(T.TEXT_NODE);return e.attributes=[this.getSpacePreserveAttribute()],e.childNodes=[f.createTextNode(t)],e},e}(v);function E(){return[new x,new N,new P]}var O,A,R=function(){return function(t){if(this.start="{",this.end="}",t&&(t.start&&(this.start=f.encodeValue(t.start)),t.end&&(this.end=f.encodeValue(t.end))),!this.start||!this.end)throw new Error("Both delimiters must be specified.");if(this.start===this.end)throw new Error("Start and end delimiters can not be the same.");if(this.start.length>1||this.end.length>1)throw new Error("Only single character delimiters supported (start: '"+this.start+"', end: '"+this.end+"').")}}(),D=r(3);(A=O||(O={})).Docx="docx",A.Pptx="pptx",A.Odt="odt",function(t){function e(t){return!(!t.files["word/document.xml"]&&!t.files["word/document2.xml"])}function r(t){return!!t.files["ppt/presentation.xml"]}function n(t){return!!t.files.mimetype}t.getFileType=function(i){if(e(i))return t.Docx;if(r(i))return t.Pptx;if(n(i))return t.Odt;throw new o.f},t.isDocx=e,t.isPptx=r,t.isOdt=n}(O||(O={}));var S=function(){return function(t){if(this.plugins=E(),this.delimiters=new R,this.maxXmlDepth=20,Object.assign(this,t),t&&(this.delimiters=new R(t.delimiters)),!this.plugins.length)throw new Error("Plugins list can not be empty")}}(),C=r(2),B=function(){function t(){}return t.prototype.parse=function(t){var e=this.domParse(t);return f.fromDomNode(e.documentElement)},t.prototype.domParse=function(e){if(null===e||void 0===e)throw new o.b("str");return t.parser.parseFromString(e,"text/xml")},t.prototype.serialize=function(e){return t.xmlHeader+f.serialize(e)},t.xmlHeader='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',t.parser=new C.DOMParser,t}(),U=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{a(n.next(t))}catch(t){i(t)}}function u(t){try{a(n.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,u)}a((n=n.apply(t,e||[])).next())})},j=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=n[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},I=function(){function t(t){var e=this;this.docxParser=new T,this.xmlParser=new B,this.options=new S(t);var r=new l;r.startDelimiter=this.options.delimiters.start,r.endDelimiter=this.options.delimiters.end,r.maxXmlDepth=this.options.maxXmlDepth;var n=this.options.plugins.map(function(t){return t.prefixes}).reduce(function(t,e){return t.concat(e)},[]),o=new y(n,this.docxParser);o.startDelimiter=this.options.delimiters.start,o.endDelimiter=this.options.delimiters.end,this.compiler=new m(r,o,this.options.plugins),this.options.plugins.forEach(function(t){t.setUtilities({xmlParser:e.xmlParser,docxParser:e.docxParser,compiler:e.compiler})})}return t.prototype.process=function(t,e){return U(this,void 0,void 0,function(){var r,n,o,i,s,u,f,c,l,h,d,g;return j(this,function(y){switch(y.label){case 0:return[4,this.loadDocx(t)];case 1:return r=y.sent(),[4,this.parseContentDocuments(r)];case 2:for(n=y.sent(),o=new p(e),i={zipFile:r,currentFilePath:null},s=0,u=Object.keys(n);s<u.length;s++)l=u[s],i.currentFilePath=l,this.compiler.compile(n[l],o,i);for(f=0,c=Object.keys(n);f<c.length;f++)l=c[f],h=n[l],d=this.xmlParser.serialize(h),r.file(l,d,{createFolders:!0});return g=a.a.toJsZipOutputType(t),[2,r.generateAsync({type:g})]}})})},t.prototype.parseTags=function(t){return U(this,void 0,void 0,function(){var e,r,n,o,s,u,a;return j(this,function(f){switch(f.label){case 0:return[4,this.loadDocx(t)];case 1:return e=f.sent(),[4,this.parseContentDocuments(e)];case 2:for(r=f.sent(),n=[],o=0,s=Object.keys(r);o<s.length;o++)u=s[o],a=this.compiler.parseTags(r[u]),i(n,a);return[2,n]}})})},t.prototype.getText=function(t){return U(this,void 0,void 0,function(){var e,r,n;return j(this,function(o){switch(o.label){case 0:return[4,this.loadDocx(t)];case 1:return e=o.sent(),r=this.docxParser.mainFilePath(e),[4,e.files[r].async("text")];case 2:return n=o.sent(),[2,this.xmlParser.domParse(n).documentElement.textContent]}})})},t.prototype.loadDocx=function(t){return U(this,void 0,void 0,function(){var e,r;return j(this,function(n){switch(n.label){case 0:return[4,D.loadAsync(t)];case 1:if(e=n.sent(),(r=O.getFileType(e))!==O.Docx)throw new o.i(r);return[2,e]}})})},t.prototype.parseContentDocuments=function(t){return U(this,void 0,void 0,function(){var e,r,n,o,i,s,u;return j(this,function(a){switch(a.label){case 0:e=this.docxParser.contentFilePaths(t),r=e.filter(function(e){return t.files[e]}),n={},o=0,i=r,a.label=1;case 1:return o<i.length?(s=i[o],[4,t.files[s].async("text")]):[3,4];case 2:u=a.sent(),n[s]=this.xmlParser.parse(u),a.label=3;case 3:return o++,[3,1];case 4:return[2,n]}})})},t}();r.d(e,"DelimiterMark",function(){return n}),r.d(e,"DelimiterSearcher",function(){return l}),r.d(e,"ScopeData",function(){return p}),r.d(e,"TagDisposition",function(){return c}),r.d(e,"Tag",function(){return g}),r.d(e,"TagParser",function(){return y}),r.d(e,"TemplateCompiler",function(){return m}),r.d(e,"MaxXmlDepthError",function(){return o.a}),r.d(e,"MissingArgumentError",function(){return o.b}),r.d(e,"MissingCloseDelimiterError",function(){return o.c}),r.d(e,"MissingStartDelimiterError",function(){return o.d}),r.d(e,"UnclosedTagError",function(){return o.e}),r.d(e,"UnidentifiedFileTypeError",function(){return o.f}),r.d(e,"UnknownPrefixError",function(){return o.g}),r.d(e,"UnopenedTagError",function(){return o.h}),r.d(e,"UnsupportedFileTypeError",function(){return o.i}),r.d(e,"createDefaultPlugins",function(){return E}),r.d(e,"LoopPlugin",function(){return x}),r.d(e,"RawXmlPlugin",function(){return N}),r.d(e,"TemplatePlugin",function(){return v}),r.d(e,"TextPlugin",function(){return P}),r.d(e,"Delimiters",function(){return R}),r.d(e,"DocxParser",function(){return T}),r.d(e,"TemplateHandler",function(){return I}),r.d(e,"TemplateHandlerOptions",function(){return S}),r.d(e,"Binary",function(){return a.a}),r.d(e,"XmlNodeType",function(){return u}),r.d(e,"TEXT_NODE_NAME_VALUE",function(){return"#text"}),r.d(e,"XmlNode",function(){return f}),r.d(e,"XmlParser",function(){return B})},function(t,e){t.exports=require("lodash.get")},function(t,e){t.exports=require("isarray")},function(t,e){t.exports=require("ieee754")},function(t,e){t.exports=require("base64-js")},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";(function(t){
/*!

@@ -8,2 +8,2 @@ * The buffer module from node.js, for the browser.

*/
var n=r(8),o=r(7),i=r(6);function s(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=a.prototype:(null===t&&(t=new a(e)),t.length=e),t}function a(t,e,r){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return f(this,t,e,r)}function f(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);a.TYPED_ARRAY_SUPPORT?(t=e).__proto__=a.prototype:t=h(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!a.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),o=(t=u(t,n)).write(e,r);o!==n&&(t=t.slice(0,o));return t}(t,e,r):function(t,e){if(a.isBuffer(e)){var r=0|p(e.length);return 0===(t=u(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?u(t,0):h(t,e);if("Buffer"===e.type&&i(e.data))return h(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(c(e),t=u(t,e<0?0:0|p(e)),!a.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function h(t,e){var r=e.length<0?0:0|p(e.length);t=u(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function p(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(a.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(t).length;default:if(n)return k(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,o);if("number"==typeof e)return e&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,o){var i,s=1,u=t.length,a=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,u/=2,a/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var c=-1;for(i=r;i<u;i++)if(f(t,i)===f(e,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===a)return c*s}else-1!==c&&(i-=i-c),c=-1}else for(r+a>u&&(r=u-a),i=r;i>=0;i--){for(var l=!0,h=0;h<a;h++)if(f(t,i+h)!==f(e,h)){l=!1;break}if(l)return i}return-1}function v(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s<n;++s){var u=parseInt(e.substr(2*s,2),16);if(isNaN(u))return s;t[r+s]=u}return s}function w(t,e,r,n){return F(k(e,t.length-r),t,r,n)}function x(t,e,r,n){return F(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function b(t,e,r,n){return x(t,e,r,n)}function N(t,e,r,n){return F(X(e),t,r,n)}function _(t,e,r,n){return F(function(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function P(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,u,a,f=t[o],c=null,l=f>239?4:f>223?3:f>191?2:1;if(o+l<=r)switch(l){case 1:f<128&&(c=f);break;case 2:128==(192&(i=t[o+1]))&&(a=(31&f)<<6|63&i)>127&&(c=a);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(a=(15&f)<<12|(63&i)<<6|63&s)>2047&&(a<55296||a>57343)&&(c=a);break;case 4:i=t[o+1],s=t[o+2],u=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&u)&&(a=(15&f)<<18|(63&i)<<12|(63&s)<<6|63&u)>65535&&a<1114112&&(c=a)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=l}return function(t){var e=t.length;if(e<=E)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=E));return r}(n)}e.Buffer=a,e.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},e.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),a.poolSize=8192,a._augment=function(t){return t.__proto__=a.prototype,t},a.from=function(t,e,r){return f(null,t,e,r)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(t,e,r){return function(t,e,r,n){return c(e),e<=0?u(t,e):void 0!==r?"string"==typeof n?u(t,e).fill(r,n):u(t,e).fill(r):u(t,e)}(null,t,e,r)},a.allocUnsafe=function(t){return l(null,t)},a.allocUnsafeSlow=function(t){return l(null,t)},a.isBuffer=function(t){return!(null==t||!t._isBuffer)},a.compare=function(t,e){if(!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=a.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(!a.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,o),o+=s.length}return n},a.byteLength=d,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},a.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?P(this,0,t):function(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return P(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return A(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},a.prototype.compare=function(t,e,r,n,o){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,s=r-e,u=Math.min(i,s),f=this.slice(n,o),c=t.slice(e,r),l=0;l<u;++l)if(f[l]!==c[l]){i=f[l],s=c[l];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},a.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return x(this,t,e,r);case"latin1":case"binary":return b(this,t,e,r);case"base64":return N(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var E=4096;function O(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function A(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function R(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=M(t[i]);return o}function D(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function S(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function C(t,e,r,n,o,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function B(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;++o)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function U(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;++o)t[r+o]=e>>>8*(n?o:3-o)&255}function j(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(t,e,r,n,i){return i||j(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function Y(t,e,r,n,i){return i||j(t,0,r,8),o.write(t,e,r,n,52,8),r+8}a.prototype.slice=function(t,e){var r,n=this.length;if(t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),a.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=a.prototype;else{var o=e-t;r=new a(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+t]}return r},a.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||S(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},a.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||S(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},a.prototype.readUInt8=function(t,e){return e||S(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return e||S(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return e||S(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||S(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||S(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){e||S(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){e||S(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return e||S(t,4,this.length),o.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return e||S(t,4,this.length),o.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return e||S(t,8,this.length),o.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return e||S(t,8,this.length),o.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},a.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},a.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):U(this,t,e,!0),e+4},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);C(this,t,e,r,o-1,-o)}var i=0,s=1,u=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===u&&0!==this[e+i-1]&&(u=1),this[e+i]=(t/s>>0)-u&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);C(this,t,e,r,o-1,-o)}var i=r-1,s=1,u=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/s>>0)-u&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):U(this,t,e,!0),e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},a.prototype.writeFloatLE=function(t,e,r){return I(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return I(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return Y(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return Y(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o,i=n-r;if(this===t&&r<e&&e<n)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},a.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var s=a.isBuffer(t)?t:k(new a(t,n).toString()),u=s.length;for(i=0;i<r-e;++i)this[i+e]=s[i%u]}return this};var L=/[^+\/0-9A-Za-z-_]/g;function M(t){return t<16?"0"+t.toString(16):t.toString(16)}function k(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function X(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}}).call(this,r(9))},function(t,e,r){t.exports=r(4)}])});
var n=r(8),o=r(7),i=r(6);function s(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=a.prototype:(null===t&&(t=new a(e)),t.length=e),t}function a(t,e,r){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return f(this,t,e,r)}function f(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);a.TYPED_ARRAY_SUPPORT?(t=e).__proto__=a.prototype:t=h(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!a.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),o=(t=u(t,n)).write(e,r);o!==n&&(t=t.slice(0,o));return t}(t,e,r):function(t,e){if(a.isBuffer(e)){var r=0|p(e.length);return 0===(t=u(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?u(t,0):h(t,e);if("Buffer"===e.type&&i(e.data))return h(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(c(e),t=u(t,e<0?0:0|p(e)),!a.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function h(t,e){var r=e.length<0?0:0|p(e.length);t=u(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function p(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(a.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(t).length;default:if(n)return k(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,o);if("number"==typeof e)return e&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,o){var i,s=1,u=t.length,a=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,u/=2,a/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var c=-1;for(i=r;i<u;i++)if(f(t,i)===f(e,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===a)return c*s}else-1!==c&&(i-=i-c),c=-1}else for(r+a>u&&(r=u-a),i=r;i>=0;i--){for(var l=!0,h=0;h<a;h++)if(f(t,i+h)!==f(e,h)){l=!1;break}if(l)return i}return-1}function v(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s<n;++s){var u=parseInt(e.substr(2*s,2),16);if(isNaN(u))return s;t[r+s]=u}return s}function w(t,e,r,n){return F(k(e,t.length-r),t,r,n)}function x(t,e,r,n){return F(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function b(t,e,r,n){return x(t,e,r,n)}function N(t,e,r,n){return F(X(e),t,r,n)}function T(t,e,r,n){return F(function(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function _(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function P(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,u,a,f=t[o],c=null,l=f>239?4:f>223?3:f>191?2:1;if(o+l<=r)switch(l){case 1:f<128&&(c=f);break;case 2:128==(192&(i=t[o+1]))&&(a=(31&f)<<6|63&i)>127&&(c=a);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(a=(15&f)<<12|(63&i)<<6|63&s)>2047&&(a<55296||a>57343)&&(c=a);break;case 4:i=t[o+1],s=t[o+2],u=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&u)&&(a=(15&f)<<18|(63&i)<<12|(63&s)<<6|63&u)>65535&&a<1114112&&(c=a)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=l}return function(t){var e=t.length;if(e<=E)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=E));return r}(n)}e.Buffer=a,e.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},e.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),a.poolSize=8192,a._augment=function(t){return t.__proto__=a.prototype,t},a.from=function(t,e,r){return f(null,t,e,r)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(t,e,r){return function(t,e,r,n){return c(e),e<=0?u(t,e):void 0!==r?"string"==typeof n?u(t,e).fill(r,n):u(t,e).fill(r):u(t,e)}(null,t,e,r)},a.allocUnsafe=function(t){return l(null,t)},a.allocUnsafeSlow=function(t){return l(null,t)},a.isBuffer=function(t){return!(null==t||!t._isBuffer)},a.compare=function(t,e){if(!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=a.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(!a.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,o),o+=s.length}return n},a.byteLength=d,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},a.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?P(this,0,t):function(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return P(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return A(this,e,r);case"base64":return _(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},a.prototype.compare=function(t,e,r,n,o){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,s=r-e,u=Math.min(i,s),f=this.slice(n,o),c=t.slice(e,r),l=0;l<u;++l)if(f[l]!==c[l]){i=f[l],s=c[l];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},a.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return x(this,t,e,r);case"latin1":case"binary":return b(this,t,e,r);case"base64":return N(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var E=4096;function O(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function A(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function R(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=M(t[i]);return o}function D(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function S(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function C(t,e,r,n,o,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function B(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;++o)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function U(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;++o)t[r+o]=e>>>8*(n?o:3-o)&255}function j(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(t,e,r,n,i){return i||j(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function Y(t,e,r,n,i){return i||j(t,0,r,8),o.write(t,e,r,n,52,8),r+8}a.prototype.slice=function(t,e){var r,n=this.length;if(t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),a.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=a.prototype;else{var o=e-t;r=new a(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+t]}return r},a.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||S(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},a.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||S(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},a.prototype.readUInt8=function(t,e){return e||S(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return e||S(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return e||S(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||S(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||S(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){e||S(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){e||S(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return e||S(t,4,this.length),o.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return e||S(t,4,this.length),o.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return e||S(t,8,this.length),o.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return e||S(t,8,this.length),o.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},a.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},a.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):U(this,t,e,!0),e+4},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);C(this,t,e,r,o-1,-o)}var i=0,s=1,u=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===u&&0!==this[e+i-1]&&(u=1),this[e+i]=(t/s>>0)-u&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);C(this,t,e,r,o-1,-o)}var i=r-1,s=1,u=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/s>>0)-u&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):U(this,t,e,!0),e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},a.prototype.writeFloatLE=function(t,e,r){return I(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return I(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return Y(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return Y(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o,i=n-r;if(this===t&&r<e&&e<n)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},a.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var s=a.isBuffer(t)?t:k(new a(t,n).toString()),u=s.length;for(i=0;i<r-e;++i)this[i+e]=s[i%u]}return this};var L=/[^+\/0-9A-Za-z-_]/g;function M(t){return t<16?"0"+t.toString(16):t.toString(16)}function k(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function X(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}}).call(this,r(9))},function(t,e,r){t.exports=r(4)}])});

@@ -11,2 +11,4 @@

process<T extends Binary>(templateFile: T, data: any): Promise<T>;
parseTags(templateFile: Binary): Promise<Tag[]>;

@@ -217,2 +219,4 @@ getText(docxFile: Binary): Promise<string>;

compile(node: XmlNode, data: ScopeData, context: TemplateContext): void;
parseTags(node: XmlNode): Tag[];
}

@@ -219,0 +223,0 @@

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

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

@@ -33,5 +33,10 @@ import { UnclosedTagError } from '../errors';

public compile(node: XmlNode, data: ScopeData, context: TemplateContext): void {
const tags = this.parseTags(node);
this.doTagReplacements(tags, data, context);
}
public parseTags(node: XmlNode): Tag[] {
const delimiters = this.delimiterSearcher.findDelimiters(node);
const tags = this.tagParser.parse(delimiters);
this.doTagReplacements(tags, data, context);
return tags;
}

@@ -38,0 +43,0 @@

import * as JSZip from 'jszip';
import { DelimiterSearcher, ScopeData, TagParser, TemplateCompiler, TemplateContext } from './compilation';
import { DelimiterSearcher, ScopeData, Tag, TagParser, TemplateCompiler, TemplateContext } from './compilation';
import { DocxParser } from './docxParser';

@@ -7,3 +7,3 @@ import { UnsupportedFileTypeError } from './errors';

import { TemplateHandlerOptions } from './templateHandlerOptions';
import { Binary, IMap } from './utils';
import { Binary, IMap, pushMany } from './utils';
import { XmlNode } from './xmlNode';

@@ -86,2 +86,20 @@ import { XmlParser } from './xmlParser';

public async parseTags(templateFile: Binary): Promise<Tag[]> {
// load the docx (zip) file
const docFile = await this.loadDocx(templateFile);
// extract content as xml documents
const contentDocuments = await this.parseContentDocuments(docFile);
// parse tags
const tags: Tag[] = [];
for (const file of Object.keys(contentDocuments)) {
const docTags = this.compiler.parseTags(contentDocuments[file]);
pushMany(tags, docTags);
}
return tags;
}
public async getText(docxFile: Binary): Promise<string> {

@@ -88,0 +106,0 @@ const zipFile = await this.loadDocx(docxFile);

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