-
Notifications
You must be signed in to change notification settings - Fork 0
/
docxtemplater.min.js
1 lines (1 loc) · 86 KB
/
docxtemplater.min.js
1
!function(){var e={673:function(e){e.exports={XMLSerializer:window.XMLSerializer,DOMParser:window.DOMParser,XMLDocument:window.XMLDocument}},891:function(e){e.exports=function(e,t,r){for(var n={},o=0,i=e.length;o<i;o++){var a=e[o],s=a.getAttribute("ContentType"),l=a.getAttribute("PartName").substr(1);n[l]=s}for(var u=function(){var e=t[c],o=e.getAttribute("ContentType"),i=e.getAttribute("Extension");r.file(/./).map((function(e){var t=e.name;t.slice(t.length-i.length)!==i||n[t]||"[Content_Types].xml"===t||(n[t]=o)}))},c=0,p=t.length;c<p;c++)u();return n}},356:function(e){e.exports={settingsContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml",coreContentType:"application/vnd.openxmlformats-package.core-properties+xml",appContentType:"application/vnd.openxmlformats-officedocument.extended-properties+xml",customContentType:"application/vnd.openxmlformats-officedocument.custom-properties+xml",diagramDataContentType:"application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml",diagramDrawingContentType:"application/vnd.ms-office.drawingml.diagramDrawing+xml"}},207:function(e,t,r){function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var o=r(673),i=o.DOMParser,a=o.XMLSerializer,s=r(946).throwXmlTagNotFound,l=r(320),u=l.last,c=l.first;function p(e){return{get:function(t){return"."===e?t:t?t[e]:t}}}var f={},h=[["&","&"],["<","<"],[">",">"],['"',"""],["'","'"]],d=h.map((function(e){var t,r,o=(r=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],l=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}(t,r)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[0],a=o[1];return{rstart:new RegExp(a,"g"),rend:new RegExp(i,"g"),start:a,end:i}})),v=new RegExp(String.fromCharCode(160),"g");function g(e,t){return e==="</"+t+">"}function y(e,t){return 0===e.indexOf("<"+t)&&-1!==[">"," ","/"].indexOf(e[t.length+1])}function m(e,t,r){"string"==typeof t&&(t=[t]);for(var n=1,o=r,i=e.length;o<i;o++)for(var a=e[o],s=0,l=t.length;s<l;s++){var u=t[s];if(g(a.value,u)&&n--,y(a.value,u)&&n++,0===n)return o}return null}function b(e,t,r){"string"==typeof t&&(t=[t]);for(var n=1,o=r;o>=0;o--)for(var i=e[o],a=0,s=t.length;a<s;a++){var l=t[a];if(y(i.value,l)&&n--,g(i.value,l)&&n++,0===n)return o}return null}var w=/[\x00-\x08\x0B\x0C\x0E-\x1F]/;e.exports={endsWith:function(e,t){return-1!==e.indexOf(t,e.length-t.length)},startsWith:function(e,t){return e.substring(0,t.length)===t},isContent:function(e){var t=e.type,r=e.position;return"placeholder"===t||"content"===t&&"insidetag"===r},isParagraphStart:function(e){var t=e.type,r=e.tag,n=e.position;return-1!==["w:p","a:p"].indexOf(r)&&"tag"===t&&"start"===n},isParagraphEnd:function(e){var t=e.type,r=e.tag,n=e.position;return-1!==["w:p","a:p"].indexOf(r)&&"tag"===t&&"end"===n},isTagStart:function(e,t){var r=t.type,n=t.tag,o=t.position;return"tag"===r&&n===e&&("start"===o||"selfclosing"===o)},isTagEnd:function(e,t){var r=t.type,n=t.tag,o=t.position;return"tag"===r&&n===e&&"end"===o},isTextStart:function(e){var t=e.type,r=e.position;return e.text&&"tag"===t&&"start"===r},isTextEnd:function(e){var t=e.type,r=e.position;return e.text&&"tag"===t&&"end"===r},isStarting:y,isEnding:g,isModule:function(e,t){var r=e.module,n=e.type;return t instanceof Array||(t=[t]),"placeholder"===n&&-1!==t.indexOf(r)},uniq:function(e){for(var t={},r=[],n=0,o=e.length;n<o;++n)t[e[n]]||(t[e[n]]=!0,r.push(e[n]));return r},getDuplicates:function(e){for(var t=[],r={},n=[],o=0,i=e.length;o<i;++o)r[e[o]]?t.push(e[o]):(r[e[o]]=!0,n.push(e[o]));return t},chunkBy:function(e,t){for(var r=[[]],n=0;n<e.length;n++){var o=e[n],i=r[r.length-1],a=t(o);"start"===a?r.push([o]):"end"===a?(i.push(o),r.push([])):i.push(o)}for(var s=[],l=0;l<r.length;l++){var u=r[l];u.length>0&&s.push(u)}return s},last:u,first:c,xml2str:function(e){return(new a).serializeToString(e).replace(/xmlns(:[a-z0-9]+)?="" ?/g,"")},str2xml:function(e){return 65279===e.charCodeAt(0)&&(e=e.substr(1)),(new i).parseFromString(e,"text/xml")},getRightOrNull:m,getRight:function(e,t,r){var n=m(e,t,r);if(null!==n)return n;s({position:"right",element:t,parsed:e,index:r})},getLeftOrNull:b,getLeft:function(e,t,r){var n=b(e,t,r);if(null!==n)return n;s({position:"left",element:t,parsed:e,index:r})},pregMatchAll:function(e,t){for(var r,n=[];null!=(r=e.exec(t));)n.push({array:r,offset:r.index});return n},convertSpaces:function(e){return e.replace(v," ")},charMapRegexes:d,hasCorruptCharacters:function(e){return w.test(e)},getDefaults:function(){return{errorLogging:"json",paragraphLoop:!1,nullGetter:function(e){return e.module?"":"undefined"},xmlFileNames:["[Content_Types].xml"],parser:p,linebreaks:!1,fileTypeConfig:null,delimiters:{start:"{",end:"}"},syntax:{changeDelimiterPrefix:"="}}},wordToUtf8:function(e){for(var t,r=d.length-1;r>=0;r--)t=d[r],e=e.replace(t.rstart,t.end);return e},utf8ToWord:function(e){var t;e=e.toString();for(var r=0,n=d.length;r<n;r++)t=d[r],e=e.replace(t.rend,t.start);return e},concatArrays:function(e){for(var t=[],r=0;r<e.length;r++)for(var n=e[r],o=0,i=n.length;o<i;o++)t.push(n[o]);return t},pushArray:function(e,t){if(!t)return e;for(var r=0,n=t.length;r<n;r++)e.push(t[r]);return e},invertMap:function(e){var t={};for(var r in e){var n=e[r];t[n]||(t[n]=[]),t[n].push(r)}return t},charMap:h,getSingleAttribute:function(e,t){var r=e.indexOf(" ".concat(t,'="'));if(-1===r)return null;var n=e.substr(r).search(/["']/)+r,o=e.substr(n+1).search(/["']/)+n;return e.substr(n+1,o-n)},setSingleAttribute:function(e,t,r){var n;if(f[t]?n=f[t]:(n=new RegExp("(<.* ".concat(t,'=")([^"]*)(".*)$')),f[t]=n),n.test(e))return e.replace(n,"$1".concat(r,"$3"));var o=e.lastIndexOf("/>");return-1===o&&(o=e.lastIndexOf(">")),e.substr(0,o)+" ".concat(t,'="').concat(r,'"')+e.substr(o)},isWhiteSpace:function(e){return/^[ \n\r\t]+$/.test(e)},stableSort:function(e,t){return e.map((function(e,t){return{item:e,index:t}})).sort((function(e,r){return t(e.item,r.item)||e.index-r.index})).map((function(e){return e.item}))}}},807:function(e,t,r){var n=["modules"];function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],l=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,l(n.key),n)}}function l(e){var t=function(e,t){if("object"!=a(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}var u=r(207);u.traits=r(536),u.moduleWrapper=r(899);var c=r(779),p=r(263),f=r(438);function h(e,t){!0!==e.hideDeprecations&&console.warn(t)}function d(e,t){if(!0!==e.hideDeprecations)return h(e,'Deprecated method ".'.concat(t,'", view upgrade guide : https://docxtemplater.com/docs/api/#upgrade-guide, stack : ').concat((new Error).stack))}var v=r(946),g=v.throwMultiError,y=v.throwResolveBeforeCompile,m=v.throwRenderInvalidTemplate,b=v.throwRenderTwice,w=v.XTInternalError,x=v.throwFileTypeNotIdentified,T=v.throwFileTypeNotHandled,P=v.throwApiVersionError,O=r(460),S=r(891),j=u.getDefaults,E=u.str2xml,C=u.xml2str,k=u.moduleWrapper,I=u.concatArrays,A=u.uniq,M=u.getDuplicates,D=u.stableSort,L=u.pushArray,_=[3,42,0];function R(e){e.modules=e.modules.filter((function(t){if(!t.supportedFileTypes)return!0;if(!Array.isArray(t.supportedFileTypes))throw new Error("The supportedFileTypes field of the module must be an array");var r=t.supportedFileTypes.includes(e.fileType);return r||t.on("detached"),r}))}function F(e){var t=e.compiled;e.errors=I(Object.keys(t).map((function(e){return t[e].allErrors}))),0!==e.errors.length&&(e.options.errorLogging&&O(e.errors,e.options.errorLogging),g(e.errors))}var X=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.modules,i=void 0===o?[]:o,a=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(r,n);if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.targets=[],this.rendered=!1,this.scopeManagers={},this.compiled={},this.modules=[f()],this.xmlDocuments={},0===arguments.length)h(this,"Deprecated docxtemplater constructor with no arguments, view upgrade guide : https://docxtemplater.com/docs/api/#upgrade-guide, stack : ".concat((new Error).stack)),this.hideDeprecations=!0,this.setOptions(a);else{if(this.hideDeprecations=!0,this.setOptions(a),!t||!t.files||"function"!=typeof t.file)throw new Error("The first argument of docxtemplater's constructor must be a valid zip file (jszip v2 or pizzip v3)");if(!Array.isArray(i))throw new Error("The modules argument of docxtemplater's constructor must be an array");for(var s=0;s<i.length;s++){var l=i[s];this.attachModule(l)}this.loadZip(t),this.compile(),this.v4Constructor=!0}this.hideDeprecations=!1}return t=e,r=[{key:"verifyApiVersion",value:function(e){return 3!==(e=e.split(".").map((function(e){return parseInt(e,10)}))).length&&P("neededVersion is not a valid version",{neededVersion:e,explanation:"the neededVersion must be an array of length 3"}),e[0]!==_[0]&&P("The major api version do not match, you probably have to update docxtemplater with npm install --save docxtemplater",{neededVersion:e,currentModuleApiVersion:_,explanation:"moduleAPIVersionMismatch : needed=".concat(e.join("."),", current=").concat(_.join("."))}),e[1]>_[1]&&P("The minor api version is not uptodate, you probably have to update docxtemplater with npm install --save docxtemplater",{neededVersion:e,currentModuleApiVersion:_,explanation:"moduleAPIVersionMismatch : needed=".concat(e.join("."),", current=").concat(_.join("."))}),e[1]===_[1]&&e[2]>_[2]&&P("The patch api version is not uptodate, you probably have to update docxtemplater with npm install --save docxtemplater",{neededVersion:e,currentModuleApiVersion:_,explanation:"moduleAPIVersionMismatch : needed=".concat(e.join("."),", current=").concat(_.join("."))}),!0}},{key:"setModules",value:function(e){for(var t=0,r=this.modules;t<r.length;t++)r[t].set(e)}},{key:"sendEvent",value:function(e){for(var t=0,r=this.modules;t<r.length;t++)r[t].on(e)}},{key:"attachModule",value:function(e){if(this.v4Constructor)throw new w("attachModule() should not be called manually when using the v4 constructor");d(this,"attachModule");var t=a(e);if("function"===t)throw new w("Cannot attach a class/function as a module. Most probably you forgot to instantiate the module by using `new` on the module.");if(!e||"object"!==t)throw new w("Cannot attachModule with a falsy value");if(e.requiredAPIVersion&&this.verifyApiVersion(e.requiredAPIVersion),!0===e.attached){if("function"!=typeof e.clone)throw new Error('Cannot attach a module that was already attached : "'.concat(e.name,'". The most likely cause is that you are instantiating the module at the root level, and using it for multiple instances of Docxtemplater'));e=e.clone()}e.attached=!0;var r=k(e);return this.modules.push(r),r.on("attached"),this.fileType&&R(this),this}},{key:"setOptions",value:function(e){if(this.v4Constructor)throw new Error("setOptions() should not be called manually when using the v4 constructor");if(d(this,"setOptions"),!e)throw new Error("setOptions should be called with an object as first parameter");this.options={};var t=j();for(var r in t){var n=t[r];this.options[r]=null!=e[r]?e[r]:this[r]||n,this[r]=this.options[r]}return this.delimiters.start=u.utf8ToWord(this.delimiters.start),this.delimiters.end=u.utf8ToWord(this.delimiters.end),this}},{key:"loadZip",value:function(e){if(this.v4Constructor)throw new Error("loadZip() should not be called manually when using the v4 constructor");if(d(this,"loadZip"),e.loadAsync)throw new w("Docxtemplater doesn't handle JSZip version >=3, please use pizzip");this.zip=e,this.updateFileTypeConfig(),this.modules=I([this.fileTypeConfig.baseModules.map((function(e){return e()})),this.modules]);for(var t=0,r=this.modules;t<r.length;t++){var n=r[t];n.zip=this.zip,n.docxtemplater=this}return R(this),this}},{key:"precompileFile",value:function(e){var t=this.createTemplateClass(e);t.preparse(),this.compiled[e]=t}},{key:"compileFile",value:function(e){this.compiled[e].parse()}},{key:"getScopeManager",value:function(e,t,r){var n;return(n=this.scopeManagers)[e]||(n[e]=c({tags:r,parser:this.parser,cachedParsers:t.cachedParsers})),this.scopeManagers[e]}},{key:"resolveData",value:function(e){var t=this;d(this,"resolveData");var r=[];return Object.keys(this.compiled).length||y(),Promise.resolve(e).then((function(e){return t.data=e,t.setModules({data:t.data,Lexer:p}),t.mapper=t.modules.reduce((function(e,t){return t.getRenderedMap(e)}),{}),Promise.all(Object.keys(t.mapper).map((function(e){var n=t.mapper[e],o=n.from,i=n.data;return Promise.resolve(i).then((function(n){var i=t.compiled[o];return i.filePath=e,i.scopeManager=t.getScopeManager(e,i,n),i.resolveTags(n).then((function(e){return i.scopeManager.finishedResolving=!0,e}),(function(e){Array.prototype.push.apply(r,e)}))}))}))).then((function(e){return 0!==r.length&&(t.options.errorLogging&&O(r,t.options.errorLogging),g(r)),I(e)}))}))}},{key:"reorderModules",value:function(){this.modules=D(this.modules,(function(e,t){return(t.priority||0)-(e.priority||0)}))}},{key:"throwIfDuplicateModules",value:function(){var e=M(this.modules.map((function(e){return e.name})));if(e.length>0)throw new w('Detected duplicate module "'.concat(e[0],'"'))}},{key:"compile",value:function(){var e=this;if(d(this,"compile"),this.updateFileTypeConfig(),this.throwIfDuplicateModules(),this.reorderModules(),Object.keys(this.compiled).length)return this;this.options=this.modules.reduce((function(t,r){return r.optionsTransformer(t,e)}),this.options),this.options.xmlFileNames=A(this.options.xmlFileNames);for(var t=0,r=this.options.xmlFileNames;t<r.length;t++){var n=r[t],o=this.zip.files[n].asText();this.xmlDocuments[n]=E(o)}this.setModules({zip:this.zip,xmlDocuments:this.xmlDocuments}),this.getTemplatedFiles();for(var i=0,a=this.templatedFiles;i<a.length;i++){var s=a[i];null!=this.zip.files[s]&&this.precompileFile(s)}for(var l=0,u=this.templatedFiles;l<u.length;l++){var c=u[l];null!=this.zip.files[c]&&this.compileFile(c)}return this.setModules({compiled:this.compiled}),F(this),this}},{key:"getRelsTypes",value:function(){for(var e=this.zip.files["_rels/.rels"],t=e?E(e.asText()):null,r=t?t.getElementsByTagName("Relationship"):[],n={},o=0,i=r.length;o<i;o++){var a=r[o];n[a.getAttribute("Target")]=a.getAttribute("Type")}return n}},{key:"getContentTypes",value:function(){var e=this.zip.files["[Content_Types].xml"],t=e?E(e.asText()):null;return{overrides:t?t.getElementsByTagName("Override"):null,defaults:t?t.getElementsByTagName("Default"):null,contentTypes:e,contentTypeXml:t}}},{key:"updateFileTypeConfig",value:function(){var t;this.zip.files.mimetype&&(t="odt"),this.relsTypes=this.getRelsTypes();var r=this.getContentTypes(),n=r.overrides,o=r.defaults,i=r.contentTypes,a=r.contentTypeXml;a&&(this.filesContentTypes=S(n,o,this.zip),this.invertedContentTypes=u.invertMap(this.filesContentTypes),this.setModules({contentTypes:this.contentTypes,invertedContentTypes:this.invertedContentTypes}));for(var s=0,l=this.modules;s<l.length;s++)t=l[s].getFileType({zip:this.zip,contentTypes:i,contentTypeXml:a,overrides:n,defaults:o,doc:this})||t;"odt"===t&&T(t),t||x(this.zip);for(var c=0,p=this.modules;c<p.length;c++)for(var f=0,h=p[c].xmlContentTypes||[];f<h.length;f++){var d=h[f];L(this.options.xmlFileNames,this.invertedContentTypes[d]||[])}return this.fileType=t,R(this),this.fileTypeConfig=this.options.fileTypeConfig||this.fileTypeConfig||e.FileTypeConfig[this.fileType](),this}},{key:"renderAsync",value:function(e){var t=this;this.hideDeprecations=!0;var r=this.resolveData(e);return this.hideDeprecations=!1,r.then((function(){return t.render()}))}},{key:"render",value:function(e){this.rendered&&b(),this.rendered=!0,0===Object.keys(this.compiled).length&&this.compile(),this.errors.length>0&&m(),e&&(this.data=e),this.setModules({data:this.data,Lexer:p}),this.mapper||(this.mapper=this.modules.reduce((function(e,t){return t.getRenderedMap(e)}),{}));var t=[];for(var r in this.mapper){var n=this.mapper[r],i=n.from,a=n.data,s=this.compiled[i];s.scopeManager=this.getScopeManager(r,s,a),s.render(r),t.push([r,s.content,s]),delete s.content}for(var l=0;l<t.length;l++)for(var u=t[l],c=o(u,3),f=c[1],h=c[2],d=0,v=this.modules;d<v.length;d++){var g=v[d];if(g.preZip){var y=g.preZip(f,h);"string"==typeof y&&(u[1]=y)}}for(var w=0;w<t.length;w++){var x=o(t[w],2),T=x[0],P=x[1];this.zip.file(T,P,{createFolders:!0})}return F(this),this.sendEvent("syncing-zip"),this.syncZip(),this.sendEvent("synced-zip"),this}},{key:"syncZip",value:function(){for(var e in this.xmlDocuments){this.zip.remove(e);var t=C(this.xmlDocuments[e]);this.zip.file(e,t,{createFolders:!0})}}},{key:"setData",value:function(e){return d(this,"setData"),this.data=e,this}},{key:"getZip",value:function(){return this.zip}},{key:"createTemplateClass",value:function(e){var t=this.zip.files[e].asText();return this.createTemplateClassFromContent(t,e)}},{key:"createTemplateClassFromContent",value:function(t,r){for(var n={filePath:r,contentType:this.filesContentTypes[r],relsType:this.relsTypes[r]},o=j(),i=L(Object.keys(o),["filesContentTypes","fileTypeConfig","fileType","modules"]),a=0;a<i.length;a++){var s=i[a];n[s]=this[s]}return new e.XmlTemplater(t,n)}},{key:"getFullText",value:function(e){return this.createTemplateClass(e||this.fileTypeConfig.textPath(this)).getFullText()}},{key:"getTemplatedFiles",value:function(){return this.templatedFiles=this.fileTypeConfig.getTemplatedFiles(this.zip),L(this.templatedFiles,this.targets),this.templatedFiles=A(this.templatedFiles),this.templatedFiles}}],r&&s(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();X.DocUtils=u,X.Errors=r(946),X.XmlTemplater=r(245),X.FileTypeConfig=r(271),X.XmlMatcher=r(367),e.exports=X,e.exports.default=X},460:function(e,t,r){var n=r(207).pushArray;function o(e,t){return t instanceof Error?n(Object.getOwnPropertyNames(t),["stack"]).reduce((function(e,r){return e[r]=t[r],"stack"===r&&(e[r]=t[r].toString()),e}),{}):t}e.exports=function(e,t){if(console.log(JSON.stringify({error:e},o,"json"===t?2:null)),e.properties&&e.properties.errors instanceof Array){var r=e.properties.errors.map((function(e){return e.properties.explanation})).join("\n");console.log("errorMessages",r)}}},946:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=r(320),s=a.last,l=a.first;function u(e){this.name="GenericError",this.message=e,this.stack=new Error(e).stack}function c(e){this.name="TemplateError",this.message=e,this.stack=new Error(e).stack}function p(e){this.name="RenderingError",this.message=e,this.stack=new Error(e).stack}function f(e){this.name="ScopeParserError",this.message=e,this.stack=new Error(e).stack}function h(e){this.name="InternalError",this.properties={explanation:"InternalError"},this.message=e,this.stack=new Error(e).stack}function d(e){this.name="APIVersionError",this.properties={explanation:"APIVersionError"},this.message=e,this.stack=new Error(e).stack}u.prototype=Error.prototype,c.prototype=new u,p.prototype=new u,f.prototype=new u,h.prototype=new u,d.prototype=new u,e.exports={XTError:u,XTTemplateError:c,XTInternalError:h,XTScopeParserError:f,XTAPIVersionError:d,RenderingError:p,XTRenderingError:p,getClosingTagNotMatchOpeningTag:function(e){var t=e.tags,r=new c("Closing tag does not match opening tag");return r.properties={id:"closing_tag_does_not_match_opening_tag",explanation:'The tag "'.concat(t[0].value,'" is closed by the tag "').concat(t[1].value,'"'),openingtag:l(t).value,offset:[l(t).offset,s(t).offset],closingtag:s(t).value},r},getLoopPositionProducesInvalidXMLError:function(e){var t=e.tag,r=e.offset,n=new c('The position of the loop tags "'.concat(t,'" would produce invalid XML'));return n.properties={xtag:t,id:"loop_position_invalid",explanation:'The tags "'.concat(t,'" are misplaced in the document, for example one of them is in a table and the other one outside the table'),offset:r},n},getScopeCompilationError:function(e){var t=e.tag,r=e.rootError,n=e.offset,o=new f("Scope parser compilation failed");return o.properties={id:"scopeparser_compilation_failed",offset:n,xtag:t,explanation:'The scope parser for the tag "'.concat(t,'" failed to compile'),rootError:r},o},getScopeParserExecutionError:function(e){var t=e.tag,r=e.scope,n=e.error,o=e.offset,i=new f("Scope parser execution failed");return i.properties={id:"scopeparser_execution_failed",explanation:"The scope parser for the tag ".concat(t," failed to execute"),scope:r,offset:o,xtag:t,rootError:n},i},getUnclosedTagException:function(e){var t=new c("Unclosed tag");return t.properties={xtag:l(e.xtag.split(" ")).substr(1),id:"unclosed_tag",context:e.xtag,offset:e.offset,lIndex:e.lIndex,explanation:'The tag beginning with "'.concat(e.xtag.substr(0,10),'" is unclosed')},t},getUnopenedTagException:function(e){var t=new c("Unopened tag");return t.properties={xtag:s(e.xtag.split(" ")),id:"unopened_tag",context:e.xtag,offset:e.offset,lIndex:e.lIndex,explanation:'The tag beginning with "'.concat(e.xtag.substr(0,10),'" is unopened')},t},getUnmatchedLoopException:function(e){var t=e.location,r=e.offset,n=e.square,o="start"===t?"unclosed":"unopened",i=new c("".concat("start"===t?"Unclosed":"Unopened"," loop")),a=e.value;return i.properties={id:"".concat(o,"_loop"),explanation:'The loop with tag "'.concat(a,'" is ').concat(o),xtag:a,offset:r},n&&(i.properties.square=n),i},getDuplicateCloseTagException:function(e){var t=new c("Duplicate close tag, expected one close tag");return t.properties={xtag:l(e.xtag.split(" ")),id:"duplicate_close_tag",context:e.xtag,offset:e.offset,lIndex:e.lIndex,explanation:'The tag ending with "'.concat(e.xtag.substr(0,10),'" has duplicate close tags')},t},getDuplicateOpenTagException:function(e){var t=new c("Duplicate open tag, expected one open tag");return t.properties={xtag:l(e.xtag.split(" ")),id:"duplicate_open_tag",context:e.xtag,offset:e.offset,lIndex:e.lIndex,explanation:'The tag beginning with "'.concat(e.xtag.substr(0,10),'" has duplicate open tags')},t},getCorruptCharactersException:function(e){var t=e.tag,r=e.value,n=e.offset,o=new p("There are some XML corrupt characters");return o.properties={id:"invalid_xml_characters",xtag:t,value:r,offset:n,explanation:"There are some corrupt characters for the field ".concat(t)},o},getInvalidRawXMLValueException:function(e){var t=e.tag,r=e.value,n=e.offset,o=new p("Non string values are not allowed for rawXML tags");return o.properties={id:"invalid_raw_xml_value",xtag:t,value:r,offset:n,explanation:"The value of the raw tag : '".concat(t,"' is not a string")},o},getUnbalancedLoopException:function(e,t){var r=new c("Unbalanced loop tag"),n=t[0].part.value,o=t[1].part.value,i=e[0].part.value,a=e[1].part.value;return r.properties={id:"unbalanced_loop_tags",explanation:"Unbalanced loop tags {#".concat(n,"}{/").concat(o,"}{#").concat(i,"}{/").concat(a,"}"),offset:[t[0].part.offset,e[1].part.offset],lastPair:{left:t[0].part.value,right:t[1].part.value},pair:{left:e[0].part.value,right:e[1].part.value}},r},throwApiVersionError:function(e,t){var r=new d(e);throw r.properties=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({id:"api_version_error"},t),r},throwFileTypeNotHandled:function(e){var t=new h('The filetype "'.concat(e,'" is not handled by docxtemplater'));throw t.properties={id:"filetype_not_handled",explanation:'The file you are trying to generate is of type "'.concat(e,'", but only docx and pptx formats are handled'),fileType:e},t},throwFileTypeNotIdentified:function(e){var t,r=Object.keys(e.files).slice(0,10);t=0===r.length?"Empty zip file":"Zip file contains : ".concat(r.join(","));var n=new h("The filetype for this file could not be identified, is this file corrupted ? ".concat(t));throw n.properties={id:"filetype_not_identified",explanation:"The filetype for this file could not be identified, is this file corrupted ? ".concat(t)},n},throwMalformedXml:function(){var e=new h("Malformed xml");throw e.properties={explanation:"The template contains malformed xml",id:"malformed_xml"},e},throwMultiError:function(e){var t=new c("Multi error");throw t.properties={errors:e,id:"multi_error",explanation:"The template has multiple errors"},t},throwExpandNotFound:function(e){var t=e.part,r=t.value,n=t.offset,o=e.id,i=void 0===o?"raw_tag_outerxml_invalid":o,a=e.message,s=void 0===a?"Raw tag not in paragraph":a,l=e.part,u=e.explanation,p=void 0===u?'The tag "'.concat(r,'" is not inside a paragraph'):u;"function"==typeof p&&(p=p(l));var f=new c(s);throw f.properties={id:i,explanation:p,rootError:e.rootError,xtag:r,offset:n,postparsed:e.postparsed,expandTo:e.expandTo,index:e.index},f},throwRawTagShouldBeOnlyTextInParagraph:function(e){var t=new c("Raw tag should be the only text in paragraph"),r=e.part.value;throw t.properties={id:"raw_xml_tag_should_be_only_text_in_paragraph",explanation:'The raw tag "'.concat(r,'" should be the only text in this paragraph. This means that this tag should not be surrounded by any text or spaces.'),xtag:r,offset:e.part.offset,paragraphParts:e.paragraphParts},t},throwUnimplementedTagType:function(e,t){var r='Unimplemented tag type "'.concat(e.type,'"');e.module&&(r+=' "'.concat(e.module,'"'));var n=new c(r);throw n.properties={part:e,index:t,id:"unimplemented_tag_type"},n},throwXmlTagNotFound:function(e){var t=new c('No tag "'.concat(e.element,'" was found at the ').concat(e.position)),r=e.parsed[e.index];throw t.properties={id:"no_xml_tag_found_at_".concat(e.position),explanation:'No tag "'.concat(e.element,'" was found at the ').concat(e.position),offset:r.offset,part:r,parsed:e.parsed,index:e.index,element:e.element},t},throwXmlInvalid:function(e,t){var r=new c("An XML file has invalid xml");throw r.properties={id:"file_has_invalid_xml",content:e,offset:t,explanation:"The docx contains invalid XML, it is most likely corrupt"},r},throwResolveBeforeCompile:function(){var e=new h("You must run `.compile()` before running `.resolveData()`");throw e.properties={id:"resolve_before_compile",explanation:"You must run `.compile()` before running `.resolveData()`"},e},throwRenderInvalidTemplate:function(){var e=new h("You should not call .render on a document that had compilation errors");throw e.properties={id:"render_on_invalid_template",explanation:"You should not call .render on a document that had compilation errors"},e},throwRenderTwice:function(){var e=new h("You should not call .render twice on the same docxtemplater instance");throw e.properties={id:"render_twice",explanation:"You should not call .render twice on the same docxtemplater instance"},e}}},271:function(e,t,r){var n=r(885),o=r(522),i=r(60),a=r(201),s=r(307);e.exports={docx:function(){return{getTemplatedFiles:function(){return[]},textPath:function(e){return e.textTarget},tagsXmlTextArray:["Company","HyperlinkBase","Manager","cp:category","cp:keywords","dc:creator","dc:description","dc:subject","dc:title","cp:contentStatus","w:t","a:t","m:t","vt:lpstr","vt:lpwstr"],tagsXmlLexedArray:["w:proofState","w:tc","w:tr","w:tbl","w:body","w:document","w:p","w:r","w:br","w:rPr","w:pPr","w:spacing","w:sdtContent","w:sdt","w:drawing","w:sectPr","w:type","w:headerReference","w:footerReference","w:bookmarkStart","w:bookmarkEnd","w:commentRangeStart","w:commentRangeEnd","w:commentReference"],droppedTagsInsidePlaceholder:["w:p","w:br","w:bookmarkStart","w:bookmarkEnd"],expandTags:[{contains:"w:tc",expand:"w:tr"}],onParagraphLoop:[{contains:"w:p",expand:"w:p",onlyTextInTag:!0}],tagRawXml:"w:p",baseModules:[n,o,a,i,s],tagShouldContain:[{tag:"w:sdtContent",shouldContain:["w:p","w:r","w:commentRangeStart","w:sdt"],value:"<w:p></w:p>"},{tag:"w:tc",shouldContain:["w:p"],value:"<w:p></w:p>"},{tag:"w:tr",shouldContain:["w:tc"],drop:!0},{tag:"w:tbl",shouldContain:["w:tr"],drop:!0}]}},pptx:function(){return{getTemplatedFiles:function(){return[]},textPath:function(e){return e.textTarget},tagsXmlTextArray:["Company","HyperlinkBase","Manager","cp:category","cp:keywords","dc:creator","dc:description","dc:subject","dc:title","a:t","m:t","vt:lpstr","vt:lpwstr"],tagsXmlLexedArray:["p:sp","a:tc","a:tr","a:tbl","a:graphicData","a:p","a:r","a:rPr","p:txBody","a:txBody","a:off","a:ext","p:graphicFrame","p:xfrm","a16:rowId","a:endParaRPr"],droppedTagsInsidePlaceholder:["a:p","a:endParaRPr"],expandTags:[{contains:"a:tc",expand:"a:tr"}],onParagraphLoop:[{contains:"a:p",expand:"a:p",onlyTextInTag:!0}],tagRawXml:"p:sp",baseModules:[n,a,i,s],tagShouldContain:[{tag:"a:tbl",shouldContain:["a:tr"],dropParent:"p:graphicFrame"},{tag:"p:txBody",shouldContain:["a:p"],value:"<a:p></a:p>"},{tag:"a:txBody",shouldContain:["a:p"],value:"<a:p></a:p>"}]}}}},322:function(e){var t=["application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","application/vnd.ms-word.document.macroEnabled.main+xml","application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml","application/vnd.ms-word.template.macroEnabledTemplate.main+xml"],r={main:t,docx:["application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml"].concat(t,["application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml","application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"]),pptx:["application/vnd.openxmlformats-officedocument.presentationml.slide+xml","application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml","application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml","application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"]};e.exports=r},830:function(e){e.exports=function(e,t){if(null==e.lIndex)return null;var r=t.scopeManager.scopePathItem;return e.parentPart&&(r=r.slice(0,r.length-1)),t.filePath+"@"+e.lIndex.toString()+"-"+r.join("-")}},208:function(e,t,r){var n=r(207),o=n.startsWith,i=n.endsWith,a=n.isStarting,s=n.isEnding,l=n.isWhiteSpace,u=r(322);e.exports=function(e,t){var r=t.fileTypeConfig.tagShouldContain||[],n="",c=-1;-1!==u.docx.indexOf(t.contentType)&&(e=function(e){for(var t="",r=0,n=e.length;r<n;r++){var a=e[r];l(a)||(i(t,"</w:tbl>")&&(o(a,"<w:p")||o(a,"<w:tbl")||o(a,"<w:sectPr")||(a="<w:p/>".concat(a))),t=a,e[r]=a)}return e}(e));for(var p=-1,f=0,h=r.length;f<h;f++)for(var d=r[f],v=d.tag,g=d.shouldContain,y=d.value,m=d.drop,b=d.dropParent,w=0,x=e.length;w<x;w++){var T=e[w];if(c===f){if(s(T,v))if(c=-1,b){for(var P=-1,O=p;O>0;O--)if(a(e[O],b)){P=O;break}for(var S=P;S<=e.length;S++){if(s(e[S],b)){e[S]="";break}e[S]=""}}else{for(var j=p;j<=w;j++)e[j]="";m||(e[w]=n+y+T)}n+=T;for(var E=0,C=g.length;E<C;E++){var k=g[E];if(a(T,k)){c=-1;break}}}-1===c&&a(T,v)&&-1===T.substr(1).indexOf("<")&&("/"===T[T.length-2]?e[w]="":(p=w,c=f,n=T))}return e}},263:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],l=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){l(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var u=r(946),c=u.getUnclosedTagException,p=u.getUnopenedTagException,f=u.getDuplicateOpenTagException,h=u.getDuplicateCloseTagException,d=u.throwMalformedXml,v=u.throwXmlInvalid,g=u.XTTemplateError,y=r(207),m=y.isTextStart,b=y.isTextEnd,w=y.wordToUtf8,x=0,T=1,P=2,O=3;function S(e,t){return e[0]<=t.offset&&t.offset<e[1]}function j(e,t){return m(e)?(t&&d(),!0):b(e)?(t||d(),!1):t}function E(e){var t="",r=1,n=e.indexOf(" ");return"/"===e[e.length-2]?(t="selfclosing",-1===n&&(n=e.length-2)):"/"===e[1]?(r=2,t="end",-1===n&&(n=e.length-1)):(t="start",-1===n&&(n=e.length-1)),{tag:e.slice(r,n),position:t}}function C(e,t){return-1===e&&-1===t?x:e===t?T:-1===e||-1===t?t<e?P:O:e<t?P:O}function k(e){var t=e.split(" ");if(2!==t.length){var r=new g("New Delimiters cannot be parsed");throw r.properties={id:"change_delimiters_invalid",explanation:"Cannot parser delimiters"},r}var n=o(t,2),i=n[0],a=n[1];if(0===i.length||0===a.length){var s=new g("New Delimiters cannot be parsed");throw s.properties={id:"change_delimiters_invalid",explanation:"Cannot parser delimiters"},s}return[i,a]}function I(e,t,r){var n=e.map((function(e){return e.value})).join(""),i=function(e,t,r){for(var n=[],i=t.start,a=t.end,s=-1,l=!1;;){var u=e.indexOf(i,s+1),c=e.indexOf(a,s+1),p=null,f=void 0,h=C(u,c);switch(h===T&&(h=l?O:P),h){case x:return n;case O:l=!1,s=c,p="end",f=a.length;break;case P:l=!0,s=u,p="start",f=i.length}if(r.changeDelimiterPrefix&&h===P&&e[s+i.length]===r.changeDelimiterPrefix){n.push({offset:u,position:"start",length:i.length,changedelimiter:!0});var d=e.indexOf(r.changeDelimiterPrefix,s+i.length+1),v=e.indexOf(a,d+1);n.push({offset:v,position:"end",length:a.length,changedelimiter:!0});var g=o(k(e.substr(s+i.length+1,d-s-i.length-1)),2);i=g[0],a=g[1],s=v}else n.push({offset:s,position:p,length:f})}}(n,t,r),a=0,l=e.map((function(e){return{offset:(a+=e.value.length)-e.value.length,lIndex:e.lIndex}})),u=function(e,t,r){var n,o=[],i=!1,a={offset:0},l=e.reduce((function(e,l){var u=l.position,d=l.offset,v=a.offset,g=a.length;if(n=t.substr(v,d-v),i&&"start"===u){if(v+g===d&&(n=t.substr(v,d-v+g+4),!r.allowUnclosedTag))return o.push(f({xtag:n,offset:v})),a=l,e.push(s(s({},l),{},{error:!0})),e;if(!r.allowUnclosedTag)return o.push(c({xtag:w(n),offset:v})),a=l,e.push(s(s({},l),{},{error:!0})),e;e.pop()}return i||"end"!==u?(i="start"===u,a=l,e.push(l),e):r.allowUnopenedTag?e:v+g===d?(n=t.substr(v-4,d-v+g+4),o.push(h({xtag:n,offset:v})),a=l,e.push(s(s({},l),{},{error:!0})),e):(o.push(p({xtag:n,offset:d})),a=l,e.push(s(s({},l),{},{error:!0})),e)}),[]);if(i){var u=a.offset;n=t.substr(u,t.length-u),r.allowUnclosedTag?l.pop():o.push(c({xtag:w(n),offset:u}))}return{delimiterWithErrors:l,errors:o}}(i,n,r),d=u.delimiterWithErrors,v=u.errors,g=0,y=0,m=l.map((function(t,r){for(var n=t.offset,o=[n,n+e[r].value.length],i=e[r].value,a=[];y<d.length&&S(o,d[y]);)a.push(d[y]),y++;var s=[],l=0;g>0&&(l=g,g=0);for(var u=0;u<a.length;u++){var c=a[u],p=i.substr(l,c.offset-n-l);if(c.changedelimiter)"start"===c.position?p.length>0&&s.push({type:"content",value:p}):l=c.offset-n+c.length;else{p.length>0&&(s.push({type:"content",value:p}),l+=p.length);var f={type:"delimiter",position:c.position,offset:l+n};s.push(f),l=c.offset-n+c.length}}g=l-i.length;var h=i.substr(l);return h.length>0&&s.push({type:"content",value:h}),s}),this);return{parsed:m,errors:v}}function A(e){return"content"===e.type&&"insidetag"===e.position}e.exports={parseDelimiters:I,parse:function(e,t,r,n){!function(e,t){for(var r=!1,n=0;n<e.length;n++){var o=e[n];r=j(o,r),"content"===o.type&&(o.position=r?"insidetag":"outsidetag"),"text"!==t&&A(o)&&(o.value=o.value.replace(/>/g,">"))}}(e,n);for(var o=I(e.filter(A),t,r),i=o.parsed,a=o.errors,s=[],l=0,u=0,c=0;c<e.length;c++){var p=e[c];if(A(p)){for(var f=0,h=i[l];f<h.length;f++){var d=h[f];"content"===d.type&&(d.position="insidetag"),d.lIndex=u++}Array.prototype.push.apply(s,i[l]),l++}else p.lIndex=u++,s.push(p)}return{errors:a,lexed:s}},xmlparse:function(e,t){var r=function(e,t,r){for(var n=0,o=e.length,i={},a=0,s=t.length;a<s;a++)i[t[a]]=!0;for(var l=0,u=r.length;l<u;l++)i[r[l]]=!1;for(var c=[];n<o&&-1!==(n=e.indexOf("<",n));){var p=n,f=e.indexOf("<",n+1);(-1===(n=e.indexOf(">",n))||-1!==f&&n>f)&&v(e,p);var h=e.slice(p,n+1),d=E(h),g=d.tag,y=d.position,m=i[g];null!=m&&c.push({type:"tag",position:y,text:m,offset:p,value:h,tag:g})}return c}(e,t.text,t.other),n=0,o=r.reduce((function(t,r){return e.length>n&&r.offset-n>0&&t.push({type:"content",value:e.substr(n,r.offset-n)}),n=r.offset+r.value.length,delete r.offset,t.push(r),t}),[]);return e.length>n&&o.push({type:"content",value:e.substr(n)}),o}}},798:function(e){function t(e,t){for(var r=-1,n=0,o=e.length;n<o;n++)t[n]>=e[n].length||(-1===r||e[n][t[n]].offset<e[r][t[r]].offset)&&(r=n);return r}e.exports=function(e){var r=e.reduce((function(e,t){return e+t.length}),0);e=e.filter((function(e){return e.length>0}));for(var n=new Array(r),o=e.map((function(){return 0})),i=0;i<r;i++){var a=t(e,o);n[i]=e[a][o[a]],o[a]++}return n}},899:function(e,t,r){var n=r(946).XTInternalError;function o(){}function i(e){return e}e.exports=function(e){var t={set:o,matchers:function(){return[]},parse:o,render:o,getTraits:o,getFileType:o,nullGetter:o,optionsTransformer:i,postrender:i,errorsTransformer:i,getRenderedMap:i,preparse:i,postparse:i,on:o,resolve:o,preResolve:o};if(Object.keys(t).every((function(t){return!e[t]}))){var r=new n("This module cannot be wrapped, because it doesn't define any of the necessary functions");throw r.properties={id:"module_cannot_be_wrapped",explanation:"This module cannot be wrapped, because it doesn't define any of the necessary functions"},r}for(var a in t)e[a]||(e[a]=t[a]);return e}},438:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}var a=r(899),s=r(322),l=r(356),u=[l.settingsContentType,l.coreContentType,l.appContentType,l.customContentType,l.diagramDataContentType,l.diagramDrawingContentType],c=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name="Common"},(t=[{key:"getFileType",value:function(e){var t=e.doc,r=t.invertedContentTypes;if(r){for(var n=0,o=u.length;n<o;n++){var i=u[n];r[i]&&Array.prototype.push.apply(t.targets,r[i])}for(var a,l=["docx","pptx"],c=0,p=l.length;c<p;c++){for(var f=s[l[c]],h=0,d=f.length;h<d;h++){var v=f[h];if(r[v])for(var g=0,y=r[v].length;g<y;g++){var m=r[v][g];t.relsTypes[m]&&-1===["http://purl.oclc.org/ooxml/officeDocument/relationships/officeDocument","http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"].indexOf(t.relsTypes[m])||(a=l[c],-1===s.main.indexOf(v)&&v!==s.pptx[0]||t.textTarget||(t.textTarget=m),t.targets.push(m))}}if(a)return a}return a}}}])&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();e.exports=function(){return a(new c)}},201:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}var a=r(798),s=r(207),l=s.getLeft,u=s.getRight,c=s.pushArray,p=r(899),f=r(536).getExpandToDefault,h=r(946),d=h.getUnmatchedLoopException,v=h.getClosingTagNotMatchOpeningTag,g=h.getUnbalancedLoopException;function y(e){switch(e.location){case"start":return 1;case"end":return-1}}function m(e,t){return null!=e&&null!=t&&("start"===e.part.location&&"end"===t.part.location&&e.part.value===t.part.value||""===t.part.value)}function b(e){for(var t=0,r=[];t<e.length;){var n=e[t].part;if("end"===n.location){if(0===t)return e.splice(0,1),r.push(d(n)),{traits:e,errors:r};var o=t,i=t-1,a=1;if(m(e[i],e[o]))return e.splice(o,1),e.splice(i,1),{errors:r,traits:e};for(;a<50;){var s=e[i-a],l=e[o+a];if(m(s,e[o]))return e.splice(o,1),e.splice(i-a,1),{errors:r,traits:e};if(m(e[i],l))return e.splice(o+a,1),e.splice(i,1),{errors:r,traits:e};a++}return r.push(v({tags:[e[i].part,e[o].part]})),e.splice(o,1),e.splice(i,1),{traits:e,errors:r}}t++}for(var u=0;u<e.length;u++){var c=e[u].part;r.push(d(c))}return{traits:[],errors:r}}var w=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name="ExpandPairTrait"},t=[{key:"optionsTransformer",value:function(e,t){return t.options.paragraphLoop&&c(t.fileTypeConfig.expandTags,t.fileTypeConfig.onParagraphLoop),this.expandTags=t.fileTypeConfig.expandTags,e}},{key:"postparse",value:function(e,t){var r=this,n=t.getTraits,o=t.postparse,i=t.fileType,s=n("expandPair",e);s=s.map((function(e){return e||[]}));var p=function(e){for(var t={},r=[],n=[],o=[],i=0;i<e.length;i++)o.push(e[i]);for(;o.length>0;){var a=b(o);c(r,a.errors),o=a.traits}if(r.length>0)return{pairs:n,errors:r};for(var s=0,l=0;l<e.length;l++){var u=e[l],p=y(u.part);if(s+=p,1===p)t[s]=u;else{var f=t[s+1];0===s&&n.push([f,u])}s=s>=0?s:0}return{pairs:n,errors:r}}(s=a(s)),h=p.pairs,d=p.errors,v=0,m=null,w=h.map((function(t){var n,o,a=t[0].part.expandTo;if("auto"===a&&"text"!==i){var s=f(e,t,r.expandTags);s.error&&d.push(s.error),a=s.value}if(!a||"text"===i){var c=t[0].offset,p=t[1].offset;return c<v&&d.push(g(t,m)),m=t,v=p,[c,p]}try{n=l(e,a,t[0].offset)}catch(e){d.push(e)}try{o=u(e,a,t[1].offset)}catch(e){d.push(e)}return n<v&&d.push(g(t,m)),v=o,m=t,[n,o]}));if(d.length>0)return{postparsed:e,errors:d};var x,T=0;return{postparsed:e.reduce((function(t,r,n){var i=T<h.length&&w[T][0]<=n&&n<=w[T][1],a=h[T],s=w[T];if(!i)return t.push(r),t;if(s[0]===n&&(x=[]),a[0].offset!==n&&a[1].offset!==n&&x.push(r),s[1]===n){var l=e[a[0].offset];l.subparsed=o(x,{basePart:l}),l.endLindex=a[1].part.lIndex,delete l.location,delete l.expandTo,t.push(l),T++}return t}),[]),errors:d}}}],t&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();e.exports=function(){return p(new w)}},885:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t,r){return(t=c(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){if(e){if("string"==typeof e)return l(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}}function c(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}var p=r(207),f=p.chunkBy,h=p.last,d=p.isParagraphStart,v=p.isModule,g=p.pushArray,y=p.isParagraphEnd,m=p.isContent,b=p.startsWith,w=p.isTagEnd,x=p.isTagStart,T=p.getSingleAttribute,P=p.setSingleAttribute,O=r(322),S=r(899),j="loop";function E(e){var t=function(e){for(var t=0,r=e.length;t<r;t++)if("content"!==e[t].type)return e[t];return null}(e.subparsed);return null!=t&&"w:t"!==t.tag}function C(e){return e.hasPageBreak&&E(e)?'<w:p><w:r><w:br w:type="page"/></w:r></w:p>':""}function k(e){return e.some((function(e){return m(e)}))?0:e.length}function I(e){var t=e.parts.length-1;"</w:p>"===e.parts[t]?e.parts.splice(t,0,'<w:r><w:br w:type="page"/></w:r>'):e.parts.push('<w:p><w:r><w:br w:type="page"/></w:r></w:p>')}function A(e){return e.some((function(e){return"w:br"===e.tag&&-1!==e.value.indexOf('w:type="page"')}))}function M(e){return e.some((function(e){return"w:drawing"===e.tag}))}var D=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name="LoopModule",this.inXfrm=!1,this.totalSectPr=0,this.prefix={start:"#",end:"/",dash:/^-([^\s]+)\s(.+)/,inverted:"^"}},t=[{key:"optionsTransformer",value:function(e,t){return this.docxtemplater=t,e}},{key:"preparse",value:function(e,t){var r=t.contentType;-1!==O.main.indexOf(r)&&(this.sects=function(e){for(var t=!1,r=[],n=0;n<e.length;n++){var o=e[n];x("w:sectPr",o)&&(r.push([]),t=!0),t&&r[r.length-1].push(o),w("w:sectPr",o)&&(t=!1)}return r}(e))}},{key:"matchers",value:function(){var e=j;return[[this.prefix.start,e,{expandTo:"auto",location:"start",inverted:!1}],[this.prefix.inverted,e,{expandTo:"auto",location:"start",inverted:!0}],[this.prefix.end,e,{location:"end"}],[this.prefix.dash,e,function(e){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],l=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}(e,t)||s(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e,3);return{location:"start",inverted:!1,expandTo:t[1],value:t[2]}}]]}},{key:"getTraits",value:function(e,t){if("expandPair"===e)return t.reduce((function(e,t,r){return v(t,j)&&null==t.subparsed&&e.push({part:t,offset:r}),e}),[])}},{key:"postparse",value:function(e,t){var r=t.basePart;if(r&&"docx"===this.docxtemplater.fileType&&e.length>0){r.sectPrCount=function(e){for(var t=!1,r=0,n=0;n<e.length;n++){var o=e[n];x("w:sectPr",o)&&(t=!0),t&&("w:headerReference"!==o.tag&&"w:footerReference"!==o.tag||(r++,t=!1)),w("w:sectPr",o)&&(t=!1)}return r}(e),this.totalSectPr+=r.sectPrCount;var n=this.sects;n.some((function(t,o){return r.lIndex<t[0].lIndex?(o+1<n.length&&n[o+1].some((function(e){return x("w:type",e)&&-1!==e.value.indexOf("continuous")}))&&(r.addContinuousType=!0),!0):e[0].lIndex<t[0].lIndex&&t[0].lIndex<r.lIndex?(n[o].some((function(e){return x("w:type",e)&&-1!==e.value.indexOf('w:val="nextPage"')}))&&(r.addNextPage={index:o}),!0):void 0})),r.lastParagrapSectPr=function(e){for(var t=[],r=!1,n=e.length-1;n>=0;n--){var o=e[n];if(w("w:sectPr",o)&&(r=!0),x("w:sectPr",o)&&(t.unshift(o.value),r=!1),r&&t.unshift(o.value),d(o)){if(t.length>0)return t.join("");break}}return""}(e)}if(!r||"auto"!==r.expandTo||r.module!==j||!function(e){return e.length&&d(e[0])&&y(h(e))}(e))return e;r.paragraphLoop=!0;var o=0,i=f(e,(function(e){return d(e)&&1==++o?"start":y(e)&&0==--o?"end":null})),a=i[0],s=h(i),l=k(a),u=k(s);return r.hasPageBreakBeginning=A(a),r.hasPageBreak=A(s),M(a)&&(l=0),M(s)&&(u=0),e.slice(l,e.length-u)}},{key:"resolve",value:function(e,t){if(!v(e,j))return null;var r=t.scopeManager,n=r.getValueAsync(e.value,{part:e}),o=[];function a(n,a,s){var l=r.createSubScopeManager(n,e.value,a,e,s);o.push(t.resolve(i(i({},t),{},{compiled:e.subparsed,tags:{},scopeManager:l})))}var u=[];return n.then((function(t){return new Promise((function(e){t instanceof Array?Promise.all(t).then(e):e(t)})).then((function(t){return r.loopOverValue(t,a,e.inverted),Promise.all(o).then((function(e){return e.map((function(e){var t=e.resolved,r=e.errors;return u.push.apply(u,function(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||s(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r)),t}))})).then((function(e){if(u.length>0)throw u;return e}))}))}))}},{key:"render",value:function(e,t){if("p:xfrm"===e.tag&&(this.inXfrm="start"===e.position),"a:ext"===e.tag&&this.inXfrm)return this.lastExt=e,e;if(!v(e,j))return null;var r=[],n=[],o=0,a=this,s=e.subparsed[0],l=0;"a:tr"===(null==s?void 0:s.tag)&&(l=+T(s.value,"h")),o-=l;var u=0,c=E(e);if(!1===t.scopeManager.loopOver(e.value,(function(s,p,f){o+=l;for(var h=t.scopeManager.createSubScopeManager(s,e.value,p,e,f),d=0,v=e.subparsed;d<v.length;d++){var y=v[d];if(x("a16:rowId",y)){var m=+T(y.value,"val")+u;u=1,y.value=P(y.value,"val",m)}}var w,O,S,j=t.render(i(i({},t),{},{compiled:e.subparsed,tags:{},scopeManager:h}));e.hasPageBreak&&p===f-1&&c&&I(j),h.scopePathItem.some((function(e){return 0!==e}))?(1===e.sectPrCount&&(j.parts=j.parts.filter((function(e){return!b(e,"<w:headerReference")&&!b(e,"<w:footerReference")}))),e.addContinuousType&&(j.parts=(w=j.parts,O=!1,S=!1,w.reduce((function(e,t){return!1===O&&b(t,"<w:sectPr")&&(S=!0),S&&(b(t,"<w:type")&&(O=!0),!1===O&&b(t,"</w:sectPr")&&e.push('<w:type w:val="continuous"/>')),e.push(t),e}),[])))):e.addNextPage&&(j.parts=function(e,t){return g(["<w:p><w:pPr>".concat(t.map((function(e){return e.value})).join(""),"</w:pPr></w:p>")],e)}(j.parts,a.sects[e.addNextPage.index])),e.addNextPage&&I(j),e.hasPageBreakBeginning&&c&&function(e){e.parts.unshift('<w:p><w:r><w:br w:type="page"/></w:r></w:p>')}(j);for(var E=0,C=j.parts.length;E<C;E++)r.push(j.parts[E]);Array.prototype.push.apply(n,j.errors)}),e.inverted,{part:e}))return e.lastParagrapSectPr?e.paragraphLoop?{value:"<w:p><w:pPr>".concat(e.lastParagrapSectPr,"</w:pPr></w:p>")}:{value:"</w:t></w:r></w:p><w:p><w:pPr>".concat(e.lastParagrapSectPr,"</w:pPr><w:r><w:t>")}:{value:C(e)||"",errors:n};if(0!==o){var p=+T(this.lastExt.value,"cy");this.lastExt.value=P(this.lastExt.value,"cy",p+o)}return{value:t.joinUncorrupt(r,i(i({},t),{},{basePart:e})),errors:n}}}],t&&u(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();e.exports=function(){return S(new D)}},60:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}var a=r(536),s=r(207).isContent,l=r(946),u=l.throwRawTagShouldBeOnlyTextInParagraph,c=l.getInvalidRawXMLValueException,p="rawxml",f=r(899);function h(e){for(var t=e.part,r=e.left,n=e.right,o=e.postparsed,i=e.index,a=o.slice(r+1,n),l=0,c=a.length;l<c;l++)if(l!==i-r-1){var p=a[l];s(p)&&u({paragraphParts:a,part:t})}return t}var d=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name="RawXmlModule",this.prefix="@"},t=[{key:"optionsTransformer",value:function(e,t){return this.fileTypeConfig=t.fileTypeConfig,e}},{key:"matchers",value:function(){return[[this.prefix,p]]}},{key:"postparse",value:function(e){return a.expandToOne(e,{moduleName:p,getInner:h,expandTo:this.fileTypeConfig.tagRawXml,error:{message:"Raw tag not in paragraph",id:"raw_tag_outerxml_invalid",explanation:function(e){return'The tag "'.concat(e.value,'" is not inside a paragraph, putting raw tags inside an inline loop is disallowed.')}}})}},{key:"render",value:function(e,t){if(e.module!==p)return null;var r,n=[];try{var o;null!==(o=r=t.scopeManager.getValue(e.value,{part:e}))&&void 0!==o||(r=t.nullGetter(e))}catch(e){return n.push(e),{errors:n}}return"string"==typeof(r=r||"")?{value:r}:{errors:[c({tag:e.value,value:r,offset:e.offset})]}}}],t&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();e.exports=function(){return f(new d)}},307:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}var a=r(899),s=r(946).getScopeCompilationError,l=r(207),u=l.utf8ToWord,c=l.hasCorruptCharacters,p=r(946).getCorruptCharactersException,f=r(356),h=f.settingsContentType,d=f.coreContentType,v=f.appContentType,g=f.customContentType,y={docx:"w",pptx:"a"},m=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name="Render",this.recordRun=!1,this.recordedRun=[]},t=[{key:"optionsTransformer",value:function(e,t){return this.parser=t.parser,this.fileType=t.fileType,e}},{key:"set",value:function(e){e.compiled&&(this.compiled=e.compiled),null!=e.data&&(this.data=e.data)}},{key:"getRenderedMap",value:function(e){var t=this;return Object.keys(this.compiled).reduce((function(e,r){return e[r]={from:r,data:t.data},e}),e)}},{key:"postparse",value:function(e,t){for(var r=[],n=0;n<e.length;n++){var o=e[n];if("placeholder"===o.type){var i=o.value;try{t.cachedParsers[o.lIndex]=this.parser(i,{tag:o})}catch(e){r.push(s({tag:i,rootError:e,offset:o.offset}))}}}return{postparsed:e,errors:r}}},{key:"render",value:function(e,t){var r,n=t.contentType,o=t.scopeManager,i=t.linebreaks,a=t.nullGetter,s=t.fileType;if(i&&-1!==[h,d,v,g].indexOf(n)&&(i=!1),i&&this.recordRuns(e),"placeholder"===e.type&&!e.module){var l;try{l=o.getValue(e.value,{part:e})}catch(e){return{errors:[e]}}return null!==(r=l)&&void 0!==r||(l=a(e)),c(l)?{errors:[p({tag:e.value,value:l,offset:e.offset})]}:"text"===s?{value:l}:{value:i&&"string"==typeof l?this.renderLineBreaks(l):u(l)}}}},{key:"recordRuns",value:function(e){e.tag==="".concat(y[this.fileType],":r")?this.recordedRun=[]:e.tag==="".concat(y[this.fileType],":rPr")?("start"===e.position&&(this.recordRun=!0,this.recordedRun=[e.value]),"end"!==e.position&&"selfclosing"!==e.position||(this.recordedRun.push(e.value),this.recordRun=!1)):this.recordRun&&this.recordedRun.push(e.value)}},{key:"renderLineBreaks",value:function(e){var t=this,r=y[this.fileType],n="docx"===this.fileType?"<w:r><w:br/></w:r>":"<a:br/>",o=e.split("\n"),i=this.recordedRun.join("");return o.map((function(e){return u(e)})).reduce((function(e,a,s){return e.push(a),s<o.length-1&&e.push("</".concat(r,":t></").concat(r,":r>").concat(n,"<").concat(r,":r>").concat(i,"<").concat(r,":t").concat("docx"===t.fileType?' xml:space="preserve"':"",">")),e}),[])}}],t&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();e.exports=function(){return a(new m)}},522:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}var a=r(899),s=r(207),l=s.isTextStart,u=s.isTextEnd,c=s.endsWith,p=s.startsWith;function f(e,t){var r=e[t].value;return"</w:t>"===e[t+1].value||-1!==r.indexOf('xml:space="preserve"')?r:r.substr(0,r.length-1)+' xml:space="preserve">'}var h=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name="SpacePreserveModule"},(t=[{key:"postparse",value:function(e,t){var r=[],n=!1,o=0,i=0,a=e.reduce((function(e,a){return function(e){return l(e)&&"w:t"===e.tag}(a)&&(n=!0,i=r.length),n?(r.push(a),function(e,t){return e&&e.basePart&&t.length>1}(t,r)&&(o=t.basePart.endLindex,r[0].value=f(r,0)),function(e,t){return"placeholder"===e.type&&t.length>1}(a,r)&&(r[i].value=f(r,i),o=a.endLindex),u(a)&&a.lIndex>o&&(0!==o&&(r[i].value=f(r,i)),Array.prototype.push.apply(e,r),r=[],n=!1,o=0,i=0),e):(e.push(a),e)}),[]);return Array.prototype.push.apply(a,r),a}},{key:"postrender",value:function(e){for(var t="",r=0,n=0,o=e.length;n<o;n++){var i=n,a=e[n];""!==a&&(c(t,'<w:t xml:space="preserve">')&&p(a,"</w:t>")&&(e[r]=t.substr(0,t.length-26)+"<w:t/>",a=a.substr(6)),t=a,r=i,e[n]=a)}return e}}])&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();e.exports=function(){return a(new h)}},690:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],l=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){if(e){if("string"==typeof e)return u(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var c=r(207).wordToUtf8,p=r(650),f=p.match,h=p.getValue,d=p.getValues;var v={preparse:function(e,t,r){return{preparsed:function(e,r){for(var n=0;n<t.length;n++)t[n].preparse(e,r)}(e,r)}},parse:function(e,t,r){var n,o=!1,a="",p=[],v=r.fileTypeConfig.droppedTagsInsidePlaceholder||[];return e.reduce((function(e,g){return"delimiter"===g.type?(o="start"===g.position,"end"===g.position&&(r.parse=function(e){return function(e,t){var r,n=t.modules,o=t.startOffset,a=t.lIndex;t.offset=o,t.match=f,t.getValue=h,t.getValues=d;var c=function(e,t){for(var r=[],n=0,o=e.length;n<o;n++){var i=e[n];if(i.matchers){var a=i.matchers(t);if(!(a instanceof Array))throw new Error("module matcher returns a non array");r.push.apply(r,function(e){if(Array.isArray(e))return u(e)}(s=a)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(s)||l(s)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}}var s;return r}(n,t),p=function(e,t,r){for(var n=[],o=0,a=e.length;o<a;o++){var l=e[o],u=s(l,2),c=u[0],p=u[1],f=l[2]||{};if(r.match(c,t)){var h=r.getValues(c,t);if("function"==typeof f&&(f=f(h)),!f.value){var d=s(h,2);f.value=d[1]}n.push(i({type:"placeholder",prefix:c,module:p,onMatch:f.onMatch,priority:f.priority},f))}}return n}(c,e,t);if(p.length>0){for(var v=null,g=0;g<p.length;g++){var y=p[g];y.priority||(y.priority=-y.value.length),(!v||y.priority>v.priority)&&(v=y)}return v.offset=o,delete v.priority,v.endLindex=a,v.lIndex=a,v.raw=e,v.onMatch&&v.onMatch(v),delete v.onMatch,delete v.prefix,v}for(var m=0,b=n.length;m<b;m++)if(r=n[m].parse(e,t))return r.offset=o,r.endLindex=a,r.lIndex=a,r.raw=e,r;return{type:"placeholder",value:e,offset:o,endLindex:a,lIndex:a}}(e,i(i(i({},r),g),{},{startOffset:n,modules:t}))},e.push(r.parse(c(a))),Array.prototype.push.apply(e,p),p=[]),"start"===g.position&&(p=[],n=g.offset),a="",e):o?"content"!==g.type||"insidetag"!==g.position?(-1!==v.indexOf(g.tag)||p.push(g),e):(a+=g.value,e):(e.push(g),e)}),[])},postparse:function(e,t,r){function n(e,r){return t.map((function(t){return t.getTraits(e,r)}))}var o=[];return{postparsed:function e(r,a){return t.reduce((function(t,r){var s=r.postparse(t,i(i({},a),{},{postparse:function(t,r){return e(t,i(i({},a),r))},getTraits:n}));return null==s?t:s.errors?(Array.prototype.push.apply(o,s.errors),s.postparsed):s}),r)}(e,r),errors:o}}};e.exports=v},183:function(e){function t(e){var t,r,n,o,i=0,a=e.length;for(n=0;n<a;n++)55296==(64512&(t=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=e.charCodeAt(n+1)))&&(t=65536+(t-55296<<10)+(r-56320),n++),i+=t<128?1:t<2048?2:t<65536?3:4;var s=new Uint8Array(i);for(o=0,n=0;o<i;n++)55296==(64512&(t=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=e.charCodeAt(n+1)))&&(t=65536+(t-55296<<10)+(r-56320),n++),t<128?s[o++]=t:t<2048?(s[o++]=192|t>>>6,s[o++]=128|63&t):t<65536?(s[o++]=224|t>>>12,s[o++]=128|t>>>6&63,s[o++]=128|63&t):(s[o++]=240|t>>>18,s[o++]=128|t>>>12&63,s[o++]=128|t>>>6&63,s[o++]=128|63&t);return s}e.exports=function(e,r){for(var n=0,o=r.modules.length;n<o;n++)e=r.modules[n].postrender(e,r);for(var i=0,a=r.joinUncorrupt(e,r),s="",l=0,u=[],c=0,p=a.length;c<p;c++){var f=a[c];if(f.length+l>65536){var h=t(s);i+=h.length,u.push(h),s=""}s+=f,l+=f.length,delete a[c]}var d=t(s);i+=d.length,u.push(d);for(var v=new Uint8Array(i),g=0,y=0;y<u.length;y++){for(var m=u[y],b=0;b<m.length;++b)v[b+g]=m[b];g+=m.length}return v}},650:function(e){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}var r=new RegExp(String.fromCharCode(160),"g");function n(e){return e.replace(r," ")}e.exports={match:function(e,r){var o=t(e);return"string"===o?n(r.substr(0,e.length))===e:e instanceof RegExp?e.test(n(r)):"function"===o?!!e(r):void 0},getValue:function(e,r){var o=t(e);return"string"===o?n(r).substr(e.length):e instanceof RegExp?n(r).match(e)[1]:"function"===o?e(r):void 0},getValues:function(e,r){var o=t(e);return"string"===o?[r,n(r).substr(e.length)]:e instanceof RegExp?n(r).match(e):"function"===o?[r,e(r)]:void 0}}},789:function(e,t,r){var n=r(946),o=n.throwUnimplementedTagType,i=n.XTScopeParserError,a=r(207).pushArray,s=r(830);e.exports=function(e){var t=e.baseNullGetter,r=e.compiled,n=e.scopeManager;e.nullGetter=function(e,r){return t(e,r||n)};var l=[],u=r.map((function(t,r){var n;e.index=r,e.resolvedId=s(t,e);try{n=function(e,t){for(var r,n=0,o=t.modules.length;n<o;n++)if(r=t.modules[n].render(e,t))return r;return!1}(t,e)}catch(e){if(e instanceof i)return l.push(e),t;throw e}return n?(n.errors&&Array.prototype.push.apply(l,n.errors),n):"content"===t.type||"tag"===t.type?t:void o(t,r)})).reduce((function(e,t){var r=t.value;return r instanceof Array?a(e,r):r&&e.push(r),e}),[]);return{errors:l,parts:u}}},945:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var l=r(830);e.exports=function(e){var t=[],r=e.baseNullGetter,n=e.compiled,i=e.scopeManager;e.nullGetter=function(e,t){return r(e,t||i)},e.resolved=t;var s=[];return Promise.all(n.filter((function(e){return-1===["content","tag"].indexOf(e.type)})).reduce((function(r,n){var u,c=function(e,t){for(var r,n=0,o=t.modules.length;n<o;n++)if(r=t.modules[n].resolve(e,t))return r;return!1}(n,a(a({},e),{},{resolvedId:l(n,e)}));if(c)u=c.then((function(e){t.push({tag:n.value,lIndex:n.lIndex,value:e})}));else{if("placeholder"!==n.type)return;u=i.getValueAsync(n.value,{part:n}).then((function(t){return null==t?e.nullGetter(n):t})).then((function(e){return t.push({tag:n.value,lIndex:n.lIndex,value:e}),e}))}return r.push(u.catch((function(e){var t;e instanceof Array?s.push.apply(s,function(e){if(Array.isArray(e))return o(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):s.push(e)}))),r}),[])).then((function(){return{errors:s,resolved:t}}))}},779:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}var a=r(946).getScopeParserExecutionError,s=r(320).last,l=r(207).concatArrays;function u(e,t){for(var r,n=e.length>>>0,o=0;o<n;o++)if(r=e[o],t.call(this,r,o,e))return r}function c(e,t,r){var n,o,i=this,s=this.scopeList[r];if(this.root.finishedResolving){for(var l=this.resolved,p=function(){var e=i.scopeLindex[f];l=(l=u(l,(function(t){return t.lIndex===e}))).value[i.scopePathItem[f]]},f=this.resolveOffset,h=this.scopePath.length;f<h;f++)p();return u(l,(function(e){return t.part.lIndex===e.lIndex})).value}o=this.cachedParsers&&t.part?this.cachedParsers[t.part.lIndex]?this.cachedParsers[t.part.lIndex]:this.cachedParsers[t.part.lIndex]=this.parser(e,{tag:t.part,scopePath:this.scopePath}):this.parser(e,{tag:t.part,scopePath:this.scopePath});try{n=o.get(s,this.getContext(t,r))}catch(r){throw a({tag:e,scope:s,error:r,offset:t.part.offset})}return null==n&&r>0?c.call(this,e,t,r-1):n}function p(e,t,r){var n,o=this,i=this.scopeList[r];return n=this.cachedParsers&&t.part?this.cachedParsers[t.part.lIndex]?this.cachedParsers[t.part.lIndex]:this.cachedParsers[t.part.lIndex]=this.parser(e,{tag:t.part,scopePath:this.scopePath}):this.parser(e,{tag:t.part,scopePath:this.scopePath}),Promise.resolve().then((function(){return n.get(i,o.getContext(t,r))})).catch((function(r){throw a({tag:e,scope:i,error:r,offset:t.part.offset})})).then((function(n){return null==n&&r>0?p.call(o,e,t,r-1):n}))}var f=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.root=t.root||this,this.resolveOffset=t.resolveOffset||0,this.scopePath=t.scopePath,this.scopePathItem=t.scopePathItem,this.scopePathLength=t.scopePathLength,this.scopeList=t.scopeList,this.scopeType="",this.scopeTypes=t.scopeTypes,this.scopeLindex=t.scopeLindex,this.parser=t.parser,this.resolved=t.resolved,this.cachedParsers=t.cachedParsers}return t=e,(r=[{key:"loopOver",value:function(e,t,r,n){return this.loopOverValue(this.getValue(e,n),t,r)}},{key:"functorIfInverted",value:function(e,t,r,n,o){return e&&t(r,n,o),e}},{key:"isValueFalsy",value:function(e,t){return null==e||!e||"[object Array]"===t&&0===e.length}},{key:"loopOverValue",value:function(e,t,r){this.root.finishedResolving&&(r=!1);var n=Object.prototype.toString.call(e);if(this.isValueFalsy(e,n))return this.scopeType=!1,this.functorIfInverted(r,t,s(this.scopeList),0,1);if("[object Array]"===n){this.scopeType="array";for(var o=0;o<e.length;o++)this.functorIfInverted(!r,t,e[o],o,e.length);return!0}return"[object Object]"===n?(this.scopeType="object",this.functorIfInverted(!r,t,e,0,1)):this.functorIfInverted(!r,t,s(this.scopeList),0,1)}},{key:"getValue",value:function(e,t){var r=c.call(this,e,t,this.scopeList.length-1);return"function"==typeof r?r(this.scopeList[this.scopeList.length-1],this):r}},{key:"getValueAsync",value:function(e,t){var r=this;return p.call(this,e,t,this.scopeList.length-1).then((function(e){return"function"==typeof e?e(r.scopeList[r.scopeList.length-1],r):e}))}},{key:"getContext",value:function(e,t){return{num:t,meta:e,scopeList:this.scopeList,resolved:this.resolved,scopePath:this.scopePath,scopeTypes:this.scopeTypes,scopePathItem:this.scopePathItem,scopePathLength:this.scopePathLength}}},{key:"createSubScopeManager",value:function(t,r,n,o,i){return new e({root:this.root,resolveOffset:this.resolveOffset,resolved:this.resolved,parser:this.parser,cachedParsers:this.cachedParsers,scopeTypes:l([this.scopeTypes,[this.scopeType]]),scopeList:l([this.scopeList,[t]]),scopePath:l([this.scopePath,[r]]),scopePathItem:l([this.scopePathItem,[n]]),scopePathLength:l([this.scopePathLength,[i]]),scopeLindex:l([this.scopeLindex,[o.lIndex]])})}}])&&o(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();e.exports=function(e){return e.scopePath=[],e.scopePathItem=[],e.scopePathLength=[],e.scopeTypes=[],e.scopeLindex=[],e.scopeList=[e.tags],new f(e)}},536:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],l=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){if(e){if("string"==typeof e)return a(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var u=r(207),c=u.getRightOrNull,p=u.getRight,f=u.getLeft,h=u.getLeftOrNull,d=u.chunkBy,v=u.isTagStart,g=u.isTagEnd,y=u.isContent,m=u.last,b=u.first,w=r(946),x=w.XTTemplateError,T=w.throwExpandNotFound,P=w.getLoopPositionProducesInvalidXMLError;function O(e,t){return 0!==e.length&&0===m(e).substr(1).indexOf(t)}function S(e,t,r,n){var o=e.expandTo||n.expandTo;if(o){var i,a;try{a=f(r,o,t),i=p(r,o,t)}catch(i){throw i instanceof x&&T(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){l(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({part:e,rootError:i,postparsed:r,expandTo:o,index:t},n.error)),i}return[a,i]}}function j(e,t,r,n){var i=o(e,2),a=i[0],s=i[1],l=r.indexOf(t),u=r.slice(a,l),c=r.slice(l+1,s+1),p=n.getInner({postparse:n.postparse,index:l,part:t,leftParts:u,rightParts:c,left:a,right:s,postparsed:r});return p.length||(p.expanded=[u,c],p=[p]),{left:a,right:s,inner:p}}e.exports={expandToOne:function(e,t){var r,n=[];e.errors&&(n=e.errors,e=e.postparsed);for(var s=[],l=0,u=e.length;l<u;l++){var c=e[l];if("placeholder"===c.type&&c.module===t.moduleName&&!c.subparsed&&!c.expanded)try{var p=S(c,l,e,t);if(!p)continue;var f=o(p,2),h=f[0],d=f[1];s.push({left:h,right:d,part:c,i:l,leftPart:e[h],rightPart:e[d]})}catch(e){if(!(e instanceof x))throw e;n.push(e)}}s.sort((function(e,t){return e.left===t.left?t.part.lIndex<e.part.lIndex?1:-1:t.left<e.left?1:-1}));for(var v=-1,g=0,y=0,m=s.length;y<m;y++){var b,w=s[y];if(v=Math.max(v,y>0?s[y-1].right:0),!(w.left<v)){var T=void 0;try{T=j([w.left+g,w.right+g],w.part,e,t)}catch(e){if(!(e instanceof x))throw e;n.push(e)}T&&(g+=T.inner.length-(T.right+1-T.left),(b=e).splice.apply(b,[T.left,T.right+1-T.left].concat(function(e){if(Array.isArray(e))return a(e)}(r=T.inner)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||i(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())))}}return{postparsed:e,errors:n}},getExpandToDefault:function(e,t,r){var n=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r],o=n.position,i=n.value,a=n.tag;a&&("end"===o?O(t,a)?t.pop():t.push(i):"start"===o&&t.push(i))}return t}(e.slice(t[0].offset,t[1].offset));if(n.filter((function(e){return"/"===e[1]})).length!==n.filter((function(e){return"/"!==e[1]&&"/"!==e[e.length-2]})).length)return{error:P({tag:b(t).part.value,offset:[b(t).part.offset,m(t).part.offset]})};for(var o,i=function(){var o=r[a],i=o.contains,s=o.expand,l=o.onlyTextInTag;if(function(e,t){for(var r=0;r<t.length;r++)if(0===t[r].indexOf("<".concat(e)))return!0;return!1}(i,n)){if(l){var u=h(e,i,t[0].offset),p=c(e,i,t[1].offset);if(null===u||null===p)return 0;var f=d(e.slice(u,p),(function(e){return v(i,e)?"start":g(i,e)?"end":null})),w=b(f),x=m(f),T=w.filter(y),P=x.filter(y);if(1!==T.length||1!==P.length)return 0}return{v:{value:s}}}},a=0,s=r.length;a<s;a++)if(0!==(o=i())&&o)return o.v;return{}}}},320:function(e){e.exports={last:function(e){return e[e.length-1]},first:function(e){return e[0]}}},367:function(e,t,r){var n=r(207).pregMatchAll;e.exports=function(e,t){var r={content:e},o=t.join("|"),i=new RegExp("(?:(<(?:".concat(o,")[^>]*>)([^<>]*)</(?:").concat(o,")>)|(<(?:").concat(o,")[^>]*/>)"),"g");return r.matches=n(i,r.content),r}},245:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}var a=r(207),s=a.pushArray,l=a.wordToUtf8,u=a.convertSpaces,c=r(367),p=r(263),f=r(690),h=r(789),d=r(183),v=r(945),g=r(208);e.exports=function(){return e=function e(t,r){for(var n in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.cachedParsers={},this.content=t,r)this[n]=r[n];this.setModules({inspect:{filePath:r.filePath}})},t=[{key:"resolveTags",value:function(e){var t=this;this.tags=e;var r=this.getOptions(),n=this.filePath;r.scopeManager=this.scopeManager,r.resolve=v;var o=[];return Promise.all(this.modules.map((function(e){return Promise.resolve(e.preResolve(r)).catch((function(e){o.push(e)}))}))).then((function(){if(0!==o.length)throw o;return v(r).then((function(e){var o=e.resolved,i=e.errors;if(0!==(i=i.map((function(e){var t;return e instanceof Error||(e=new Error(e)),(t=e).properties||(t.properties={}),e.properties.file=n,e}))).length)throw i;return Promise.all(o).then((function(e){return r.scopeManager.root.finishedResolving=!0,r.scopeManager.resolved=e,t.setModules({inspect:{resolved:e,filePath:n}}),e}))})).catch((function(e){throw t.errorChecker(e),e}))}))}},{key:"getFullText",value:function(){return e=this.content,t=this.fileTypeConfig.tagsXmlTextArray,r=c(e,t).matches.map((function(e){return e.array[2]})),l(u(r.join("")));var e,t,r}},{key:"setModules",value:function(e){for(var t=0,r=this.modules;t<r.length;t++)r[t].set(e)}},{key:"preparse",value:function(){this.allErrors=[],this.xmllexed=p.xmlparse(this.content,{text:this.fileTypeConfig.tagsXmlTextArray,other:this.fileTypeConfig.tagsXmlLexedArray}),this.setModules({inspect:{filePath:this.filePath,xmllexed:this.xmllexed}});var e=p.parse(this.xmllexed,this.delimiters,this.syntax,this.fileType),t=e.lexed,r=e.errors;s(this.allErrors,r),this.lexed=t,this.setModules({inspect:{filePath:this.filePath,lexed:this.lexed}});var n=this.getOptions();f.preparse(this.lexed,this.modules,n)}},{key:"parse",value:function(){this.setModules({inspect:{filePath:this.filePath}});var e=this.getOptions();this.parsed=f.parse(this.lexed,this.modules,e),this.setModules({inspect:{filePath:this.filePath,parsed:this.parsed}});var t=f.postparse(this.parsed,this.modules,e),r=t.postparsed,n=t.errors;return this.postparsed=r,this.setModules({inspect:{filePath:this.filePath,postparsed:this.postparsed}}),s(this.allErrors,n),this.errorChecker(this.allErrors),this}},{key:"errorChecker",value:function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];n.properties||(n.properties={}),n.properties.file=this.filePath}for(var o=0,i=this.modules;o<i.length;o++)e=i[o].errorsTransformer(e)}},{key:"baseNullGetter",value:function(e,t){var r=this,n=this.modules.reduce((function(n,o){return null!=n?n:o.nullGetter(e,t,r)}),null);return null!=n?n:this.nullGetter(e,t)}},{key:"getOptions",value:function(){return{compiled:this.postparsed,cachedParsers:this.cachedParsers,tags:this.tags,modules:this.modules,parser:this.parser,contentType:this.contentType,relsType:this.relsType,baseNullGetter:this.baseNullGetter.bind(this),filePath:this.filePath,fileTypeConfig:this.fileTypeConfig,fileType:this.fileType,linebreaks:this.linebreaks}}},{key:"render",value:function(e){this.filePath=e;var t=this.getOptions();t.resolved=this.scopeManager.resolved,t.scopeManager=this.scopeManager,t.render=h,t.joinUncorrupt=g;var r=h(t),n=r.errors,o=r.parts;return n.length>0?(this.allErrors=n,this.errorChecker(n),this):(this.content=d(o,t),this.setModules({inspect:{filePath:this.filePath,content:this.content}}),this)}}],t&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()}},t={},r=function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}(807);window.docxtemplater=r}();