docxtemplater
Version:
docx and pptx generator working with templates and data (like Mustache, for Word and Powerpoint documents)
1 lines • 65 kB
JavaScript
!function(){var e={760:function(e){e.exports={XMLSerializer:window.XMLSerializer,DOMParser:window.DOMParser,XMLDocument:window.XMLDocument}},712:function(e){e.exports=function(e,t,r){for(var n={},o=0,a=e.length;o<a;o++){var i=e[o],s=i.getAttribute("ContentType"),u=i.getAttribute("PartName").substr(1);n[u]=s}for(var l=function(e,o){var a=t[e],i=a.getAttribute("ContentType"),s=a.getAttribute("Extension");r.file(/./).map((function(e){var t=e.name;".xml"!==t.slice(t.length-s.length-1)||n[t]||"[Content_Types].xml"===t||(n[t]=i)}))},c=0,p=t.length;c<p;c++)l(c);return n}},557:function(e,t,r){function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var o=r(760),a=o.DOMParser,i=o.XMLSerializer,s=r(257).throwXmlTagNotFound,u=r(287),l=u.last,c=u.first,p=[["&","&"],["<","<"],[">",">"],['"',"""],["'","'"]];function f(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var h=p.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,a=[],i=!0,s=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){s=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(s)throw o}}return a}}(t,r)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.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.")}()),a=o[0],i=o[1];return{rstart:new RegExp(f(i),"g"),rend:new RegExp(f(a),"g"),start:i,end:a}})),d=new RegExp(String.fromCharCode(160),"g");function g(e,t){return e==="</"+t+">"}function v(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,a=e.length;o<a;o++)for(var i=e[o],s=0,u=t.length;s<u;s++){var l=t[s];if(g(i.value,l)&&n--,v(i.value,l)&&n++,0===n)return o}return null}function y(e,t,r){"string"==typeof t&&(t=[t]);for(var n=1,o=r;o>=0;o--)for(var a=e[o],i=0,s=t.length;i<s;i++){var u=t[i];if(v(a.value,u)&&n--,g(a.value,u)&&n++,0===n)return o}return null}function x(e,t){var r=t.type,n=t.tag,o=t.position;return"tag"===r&&n===e&&"start"===o}function w(e,t){var r=t.type,n=t.tag,o=t.position;return"tag"===r&&n===e&&"end"===o}var b=/[\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){return"placeholder"===e.type||"content"===e.type&&"insidetag"===e.position},isParagraphStart:function(e){return x("w:p",e)||x("a:p",e)},isParagraphEnd:function(e){return w("w:p",e)||w("a:p",e)},isTagStart:x,isTagEnd:w,isTextStart:function(e){return"tag"===e.type&&"start"===e.position&&e.text},isTextEnd:function(e){return"tag"===e.type&&"end"===e.position&&e.text},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},chunkBy:function(e,t){return e.reduce((function(e,r){var n=l(e),o=t(r);return"start"===o?e.push([r]):"end"===o?(n.push(r),e.push([])):n.push(r),e}),[[]]).filter((function(e){return e.length>0}))},last:l,first:c,mergeObjects:function(){for(var e,t,r={},n=0;n<arguments.length;n+=1){e=arguments[n],t=Object.keys(e);for(var o=0;o<t.length;o+=1)r[t[o]]=e[t[o]]}return r},xml2str:function(e){return(new i).serializeToString(e).replace(/xmlns(:[a-z0-9]+)?="" ?/g,"")},str2xml:function(e){return 65279===e.charCodeAt(0)&&(e=e.substr(1)),(new a).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:y,getLeft:function(e,t,r){var n=y(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(d," ")},escapeRegExp:f,charMapRegexes:h,hasCorruptCharacters:function(e){return b.test(e)},defaults:{errorLogging:!0,paragraphLoop:!1,nullGetter:function(e){return e.module?"":"undefined"},xmlFileNames:[],parser:function(e){return{get:function(t){return"."===e?t:t[e]}}},linebreaks:!1,fileTypeConfig:null,delimiters:{start:"{",end:"}"}},wordToUtf8:function(e){for(var t,r=h.length-1;r>=0;r--)t=h[r],e=e.replace(t.rstart,t.end);return e},utf8ToWord:function(e){var t;"string"!=typeof e&&(e=e.toString());for(var r=0,n=h.length;r<n;r++)t=h[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,a=n.length;o<a;o++)t.push(n[o]);return t},invertMap:function(e){return Object.keys(e).reduce((function(t,r){var n=e[r];return t[n]=t[n]||[],t[n].push(r),t}),{})},charMap:p,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=new RegExp("(<.* ".concat(t,'=")([^"]+)(".*)$'));if(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)}}},380:function(e,t,r){var n=["modules"];function o(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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,n.key,n)}}var s=r(557);s.traits=r(505),s.moduleWrapper=r(223);var u=r(919),l=r(257),c=l.throwMultiError,p=l.throwResolveBeforeCompile,f=l.throwRenderInvalidTemplate,h=r(567),d=r(712),g=r(107),v=r(303),m=s.defaults,y=s.str2xml,x=s.xml2str,w=s.moduleWrapper,b=s.concatArrays,T=s.uniq,P=r(257),O=P.XTInternalError,E=P.throwFileTypeNotIdentified,k=P.throwFileTypeNotHandled,j=P.throwApiVersionError,C=[3,27,0],M=function(){function e(t){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=i.modules,u=void 0===s?[]:s,l=o(i,n);if(a(this,e),!Array.isArray(u))throw new Error("The modules argument of docxtemplater's constructor must be an array");if(this.scopeManagers={},this.compiled={},this.modules=[g()],this.setOptions(l),u.forEach((function(e){r.attachModule(e)})),arguments.length>0){if(!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)");this.loadZip(t),this.modules=this.modules.filter((function(e){if(e.supportedFileTypes){if(!Array.isArray(e.supportedFileTypes))throw new Error("The supportedFileTypes field of the module must be an array");var t=-1!==e.supportedFileTypes.indexOf(r.fileType);return t||e.on("detached"),t}return!0})),this.compile(),this.v4Constructor=!0}}var t,r;return t=e,r=[{key:"verifyApiVersion",value:function(e){return 3!==(e=e.split(".").map((function(e){return parseInt(e,10)}))).length&&j("neededVersion is not a valid version",{neededVersion:e,explanation:"the neededVersion must be an array of length 3"}),e[0]!==C[0]&&j("The major api version do not match, you probably have to update docxtemplater with npm install --save docxtemplater",{neededVersion:e,currentModuleApiVersion:C,explanation:"moduleAPIVersionMismatch : needed=".concat(e.join("."),", current=").concat(C.join("."))}),e[1]>C[1]&&j("The minor api version is not uptodate, you probably have to update docxtemplater with npm install --save docxtemplater",{neededVersion:e,currentModuleApiVersion:C,explanation:"moduleAPIVersionMismatch : needed=".concat(e.join("."),", current=").concat(C.join("."))}),e[1]===C[1]&&e[2]>C[2]&&j("The patch api version is not uptodate, you probably have to update docxtemplater with npm install --save docxtemplater",{neededVersion:e,currentModuleApiVersion:C,explanation:"moduleAPIVersionMismatch : needed=".concat(e.join("."),", current=").concat(C.join("."))}),!0}},{key:"setModules",value:function(e){this.modules.forEach((function(t){t.set(e)}))}},{key:"sendEvent",value:function(e){this.modules.forEach((function(t){t.on(e)}))}},{key:"attachModule",value:function(e){if(this.v4Constructor)throw new Error("attachModule() should not be called manually when using the v4 constructor");if(e.requiredAPIVersion&&this.verifyApiVersion(e.requiredAPIVersion),!0===e.attached)throw new Error('Cannot attach a module that was already attached : "'.concat(e.name,'". Maybe you are instantiating the module at the root level, and using it for multiple instances of Docxtemplater'));if(e.attached=!0,"function"==typeof e)throw new Error("Cannot attach a class/function as a module. Most probably you forgot to instantiate the module by using `new` on the module.");var t=w(e);return this.modules.push(t),t.on("attached"),this}},{key:"setOptions",value:function(e){var t=this;if(this.v4Constructor)throw new Error("setOptions() should not be called manually when using the v4 constructor");if(!e)throw new Error("setOptions should be called with an object as first parameter");return this.options={},Object.keys(m).forEach((function(r){var n=m[r];t.options[r]=null!=e[r]?e[r]:n,t[r]=t.options[r]})),this.zip&&this.updateFileTypeConfig(),this}},{key:"loadZip",value:function(e){if(this.v4Constructor)throw new Error("loadZip() should not be called manually when using the v4 constructor");if(e.loadAsync)throw new O("Docxtemplater doesn't handle JSZip version >=3, please use pizzip");return this.zip=e,this.updateFileTypeConfig(),this.modules=b([this.fileTypeConfig.baseModules.map((function(e){return e()})),this.modules]),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){return this.scopeManagers[e]||(this.scopeManagers[e]=u({tags:r||{},parser:this.parser,cachedParsers:t.cachedParsers})),this.scopeManagers[e]}},{key:"resolveData",value:function(e){var t=this,r=[];return Object.keys(this.compiled).length||p(),Promise.resolve(e).then((function(e){return t.setData(e),t.setModules({data:t.data,Lexer:v}),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,a=n.data;return Promise.resolve(a).then((function(n){var a=t.compiled[o];return a.filePath=e,a.scopeManager=t.getScopeManager(e,a,n),a.resolveTags(n).then((function(e){return a.scopeManager.finishedResolving=!0,e}),(function(e){r=r.concat(e)}))}))}))).then((function(e){return 0!==r.length&&(t.options.errorLogging&&h(r),c(r)),b(e)}))}))}},{key:"compile",value:function(){var e=this;return Object.keys(this.compiled).length||(this.options=this.modules.reduce((function(t,r){return r.optionsTransformer(t,e)}),this.options),this.options.xmlFileNames=T(this.options.xmlFileNames),this.xmlDocuments=this.options.xmlFileNames.reduce((function(t,r){var n=e.zip.files[r].asText();return t[r]=y(n),t}),{}),this.setModules({zip:this.zip,xmlDocuments:this.xmlDocuments}),this.getTemplatedFiles(),this.templatedFiles.forEach((function(t){null!=e.zip.files[t]&&e.precompileFile(t)})),this.templatedFiles.forEach((function(t){null!=e.zip.files[t]&&e.compileFile(t)})),this.setModules({compiled:this.compiled}),I(this)),this}},{key:"updateFileTypeConfig",value:function(){var t,r=this;this.zip.files.mimetype&&(t="odt");var n=this.zip.files["[Content_Types].xml"];this.targets=[];var o=n?y(n.asText()):null,a=o?o.getElementsByTagName("Override"):null,i=o?o.getElementsByTagName("Default"):null;return o&&(this.filesContentTypes=d(a,i,this.zip),this.invertedContentTypes=s.invertMap(this.filesContentTypes),this.setModules({contentTypes:this.contentTypes,invertedContentTypes:this.invertedContentTypes})),this.modules.forEach((function(e){t=e.getFileType({zip:r.zip,contentTypes:n,contentTypeXml:o,overrides:a,defaults:i,doc:r})||t})),"odt"===t&&k(t),t||E(),this.fileType=t,this.fileTypeConfig=this.options.fileTypeConfig||this.fileTypeConfig||e.FileTypeConfig[this.fileType](),this}},{key:"renderAsync",value:function(e){var t=this;return this.resolveData(e).then((function(){return t.render()}))}},{key:"render",value:function(e){var t=this;return this.compile(),this.errors.length>0&&f(),e&&this.setData(e),this.setModules({data:this.data,Lexer:v}),this.mapper=this.mapper||this.modules.reduce((function(e,t){return t.getRenderedMap(e)}),{}),Object.keys(this.mapper).forEach((function(e){var r=t.mapper[e],n=r.from,o=r.data,a=t.compiled[n];a.scopeManager=t.getScopeManager(e,a,o),a.render(e),t.zip.file(e,a.content,{createFolders:!0})})),I(this),this.sendEvent("syncing-zip"),this.syncZip(),this}},{key:"syncZip",value:function(){var e=this;Object.keys(this.xmlDocuments).forEach((function(t){e.zip.remove(t);var r=x(e.xmlDocuments[t]);return e.zip.file(t,r,{createFolders:!0})}))}},{key:"setData",value:function(e){return 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){var n=this,o={filePath:r,contentType:this.filesContentTypes[r]};return Object.keys(m).concat(["filesContentTypes","fileTypeConfig","modules"]).forEach((function(e){o[e]=n[e]})),new e.XmlTemplater(t,o)}},{key:"getFullText",value:function(e){return this.createTemplateClass(e||this.fileTypeConfig.textPath(this)).getFullText()}},{key:"getTemplatedFiles",value:function(){var e=this;return this.templatedFiles=this.fileTypeConfig.getTemplatedFiles(this.zip),this.targets.forEach((function(t){e.templatedFiles.push(t)})),this.templatedFiles}}],r&&i(t.prototype,r),e}();function I(e){var t=e.compiled,r=[];Object.keys(t).forEach((function(e){var n=t[e];r=b([r,n.allErrors])})),e.errors=r,0!==r.length&&(e.options.errorLogging&&h(r),c(r))}M.DocUtils=s,M.Errors=r(257),M.XmlTemplater=r(827),M.FileTypeConfig=r(952),M.XmlMatcher=r(465),e.exports=M},567:function(e){function t(e,t){return t instanceof Error?Object.getOwnPropertyNames(t).concat("stack").reduce((function(e,r){return e[r]=t[r],"stack"===r&&(e[r]=t[r].toString()),e}),{}):t}e.exports=function(e){if(console.log(JSON.stringify({error:e},t)),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)}}},257:function(e,t,r){function n(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 o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=r(287),i=a.last,s=a.first;function u(e){this.name="GenericError",this.message=e,this.stack=new Error(e).stack}function l(e){this.name="TemplateError",this.message=e,this.stack=new Error(e).stack}function c(e){this.name="RenderingError",this.message=e,this.stack=new Error(e).stack}function p(e){this.name="ScopeParserError",this.message=e,this.stack=new Error(e).stack}function f(e){this.name="InternalError",this.properties={explanation:"InternalError"},this.message=e,this.stack=new Error(e).stack}function h(e){this.name="APIVersionError",this.properties={explanation:"APIVersionError"},this.message=e,this.stack=new Error(e).stack}u.prototype=Error.prototype,l.prototype=new u,c.prototype=new u,p.prototype=new u,f.prototype=new u,h.prototype=new u,e.exports={XTError:u,XTTemplateError:l,XTInternalError:f,XTScopeParserError:p,XTAPIVersionError:h,RenderingError:c,XTRenderingError:c,getClosingTagNotMatchOpeningTag:function(e){var t=e.tags,r=new l("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:s(t).value,offset:[s(t).offset,i(t).offset],closingtag:i(t).value},r},getLoopPositionProducesInvalidXMLError:function(e){var t=e.tag,r=e.offset,n=new l('The position of the loop tags "'.concat(t,'" would produce invalid XML'));return n.properties={tag: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 p("Scope parser compilation failed");return o.properties={id:"scopeparser_compilation_failed",offset:n,tag: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,a=new p("Scope parser execution failed");return a.properties={id:"scopeparser_execution_failed",explanation:"The scope parser for the tag ".concat(t," failed to execute"),scope:r,offset:o,tag:t,rootError:n},a},getUnclosedTagException:function(e){var t=new l("Unclosed tag");return t.properties={xtag:s(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 l("Unopened tag");return t.properties={xtag:i(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="start"===t?"unclosed":"unopened",o=new l("".concat("start"===t?"Unclosed":"Unopened"," loop")),a=e.value;return o.properties={id:"".concat(n,"_loop"),explanation:'The loop with tag "'.concat(a,'" is ').concat(n),xtag:a,offset:r},o},getDuplicateCloseTagException:function(e){var t=new l("Duplicate close tag, expected one close tag");return t.properties={xtag:s(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 l("Duplicate open tag, expected one open tag");return t.properties={xtag:s(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 c("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 ${tag}"},o},getUnbalancedLoopException:function(e,t){var r=new l("Unbalanced loop tag"),n=t[0].part.value,o=t[1].part.value,a=e[0].part.value,i=e[1].part.value;return r.properties={id:"unbalanced_loop_tags",explanation:"Unbalanced loop tags {#".concat(n,"}{/").concat(o,"}{#").concat(a,"}{/").concat(i,"}"),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 h(e);throw r.properties=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(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 f('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(){var e=new f("The filetype for this file could not be identified, is this file corrupted ?");throw e.properties={id:"filetype_not_identified",explanation:"The filetype for this file could not be identified, is this file corrupted ?"},e},throwMalformedXml:function(e){var t=new f("Malformed xml");throw t.properties={part:e,id:"malformed_xml"},t},throwMultiError:function(e){var t=new l("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,a=void 0===o?"raw_tag_outerxml_invalid":o,i=e.message,s=void 0===i?"Raw tag not in paragraph":i,u=e.part,c=e.explanation,p=void 0===c?'The tag "'.concat(r,'" is not inside a paragraph'):c;"function"==typeof p&&(p=p(u));var f=new l(s);throw f.properties={id:a,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 l("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 l(r);throw n.properties={part:e,index:t,id:"unimplemented_tag_type"},n},throwXmlTagNotFound:function(e){var t=new l('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 l("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 f("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 f("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}}},952:function(e,t,r){var n=r(19),o=r(95),a=r(182),i=r(999),s=r(163);e.exports={docx:function(){return{getTemplatedFiles:function(e){return e.file(/word\/(header|footer)\d+\.xml/).map((function(e){return e.name})).concat(["docProps/core.xml","docProps/app.xml","word/settings.xml"])},textPath:function(e){return e.targets[0]},tagsXmlTextArray:["Company","HyperlinkBase","Manager","cp:category","cp:keywords","dc:creator","dc:description","dc:subject","dc:title","w:t","m:t","vt:lpstr"],tagsXmlLexedArray:["w:proofState","w:tc","w:tr","w:table","w:p","w:r","w:br","w:rPr","w:pPr","w:spacing","w:sdtContent","w:drawing","w:sectPr","w:type","w:headerReference","w:footerReference"],expandTags:[{contains:"w:tc",expand:"w:tr"}],onParagraphLoop:[{contains:"w:p",expand:"w:p",onlyTextInTag:!0}],tagRawXml:"w:p",baseModules:[n,o,i,a,s],tagShouldContain:[{tag:"w:tc",shouldContain:["w:p"],value:"<w:p></w:p>"},{tag:"w:sdtContent",shouldContain:["w:p","w:r"],value:"<w:p></w:p>"}]}},pptx:function(){return{getTemplatedFiles:function(e){return e.file(/ppt\/(slideMasters)\/(slideMaster)\d+\.xml/).map((function(e){return e.name})).concat(["ppt/presentation.xml","docProps/app.xml","docProps/core.xml"])},textPath:function(){return"ppt/slides/slide1.xml"},tagsXmlTextArray:["Company","HyperlinkBase","Manager","cp:category","cp:keywords","dc:creator","dc:description","dc:subject","dc:title","a:t","m:t","vt:lpstr"],tagsXmlLexedArray:["p:sp","a:tc","a:tr","a:table","a:p","a:r","a:rPr","p:txBody","a:txBody","a:off","a:ext","p:graphicFrame","p:xfrm","a16:rowId"],expandTags:[{contains:"a:tc",expand:"a:tr"}],onParagraphLoop:[{contains:"a:p",expand:"a:p",onlyTextInTag:!0}],tagRawXml:"p:sp",baseModules:[n,i,a,s],tagShouldContain:[{tag:"p:txBody",shouldContain:["a:p"],value:"<a:p></a:p>"},{tag:"a:txBody",shouldContain:["a:p"],value:"<a:p></a:p>"}]}}}},330:function(e){e.exports={docx:["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"],pptx:["application/vnd.openxmlformats-officedocument.presentationml.slide+xml"]}},127:function(e,t,r){var n=r(557),o=n.endsWith,a=n.startsWith,i=r(330);e.exports=function(e,t){var r=t.fileTypeConfig.tagShouldContain||[],n="",s=-1;return t.basePart||-1===i.docx.indexOf(t.contentType)||(e=function(e){for(var t=!1,r=e.length-1;r>=0;r--){var n=e[r];if(a(n,"<w:sectPr")&&(t=!0),t){var i=n.trim();if(o(i,"</w:tbl>"))return e.splice(r+1,0,"<w:p><w:r><w:t></w:t></w:r></w:p>"),e;if(o(i,"</w:p>"))return e}}return e}(e)),e.reduce((function(e,t){for(var o=0,a=r.length;o<a;o++){var i=r[o],u=i.tag,l=i.shouldContain,c=i.value,p=new RegExp("^(<(".concat(u,")[^>]*>)$"),"g");if(s===o){if(t==="</".concat(u,">"))return s=-1,e+n+c+t;n+=t;for(var f=0,h=l.length;f<h;f++){var d=l[f];if(-1!==t.indexOf("<".concat(d," "))||-1!==t.indexOf("<".concat(d,">")))return s=-1,e+n}return e}if(-1===s&&p.test(t))return"/"===t[t.length-2]||(s=o,n=t),e}return e+t}),"")}},303:function(e,t,r){function n(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,a=[],i=!0,s=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){s=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(s)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.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}}(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 o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var a=r(257),i=a.getUnclosedTagException,s=a.getUnopenedTagException,u=a.getDuplicateOpenTagException,l=a.getDuplicateCloseTagException,c=a.throwMalformedXml,p=a.throwXmlInvalid,f=a.XTTemplateError,h=r(557),d=h.wordToUtf8,g=h.concatArrays,v=h.isTextStart,m=h.isTextEnd;function y(e,t){return e[0]<=t.offset&&t.offset<e[1]}function x(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 w(e,t){return-1===e&&-1===t?-2:e===t?0:-1===e||-1===t?t<e?-1:1:e<t?-1:1}function b(e){var t=e.split(" ");if(2!==t.length){var r=new f("New Delimiters cannot be parsed");throw r.properties={id:"change_delimiters_invalid",explanation:"Cannot parser delimiters"},r}var o=n(t,2),a=o[0],i=o[1];if(0===a.length||0===i.length){var s=new f("New Delimiters cannot be parsed");throw s.properties={id:"change_delimiters_invalid",explanation:"Cannot parser delimiters"},s}return[a,i]}function T(e,t){var r=e.map((function(e){return e.value})).join(""),o=function(e,t){for(var r=[],o=t.start,a=t.end,i=-1,s=!1;;){var u=e.indexOf(o,i+1),l=e.indexOf(a,i+1),c=null,p=void 0,f=w(u,l);if(-2===f)return r;if(0===f&&(f=s?1:-1),1===f&&(s=!1,i=l,c="end",p=a.length),-1===f&&(s=!0,i=u,c="start",p=o.length),"start"!==c||"="!==e[i+o.length])r.push({offset:i,position:c,length:p});else{r.push({offset:u,position:"start",length:o.length,changedelimiter:!0});var h=e.indexOf("=",i+o.length+1),d=e.indexOf(a,h+1);r.push({offset:d,position:"end",length:a.length,changedelimiter:!0});var g=n(b(e.substr(i+o.length+1,h-i-o.length-1)),2);o=g[0],a=g[1],i=d}}}(r,t),a=0,c=e.map((function(e){return{offset:(a+=e.value.length)-e.value.length,lIndex:e.lIndex}})),p=function(e,t){var r,n=[],o=!1,a={offset:0};e.forEach((function(e){r=t.substr(a.offset,e.offset-a.offset),"start"===e.position&&o||"end"===e.position&&!o?"start"===e.position?(a.offset+a.length===e.offset?(r=t.substr(a.offset,e.offset-a.offset+a.length+4),n.push(u({xtag:r,offset:a.offset}))):n.push(i({xtag:r,offset:a.offset})),e.error=!0):(a.offset+a.length===e.offset?(r=t.substr(a.offset-4,e.offset-a.offset+4+a.length),n.push(l({xtag:r,offset:a.offset}))):n.push(s({xtag:r,offset:e.offset})),e.error=!0):o=!o,a=e}));var c={offset:t.length};return r=t.substr(a.offset,c.offset-a.offset),o&&(n.push(i({xtag:r,offset:a.offset})),c.error=!0),n}(o,r),f=0,h=0,d=c.map((function(t,r){for(var n=t.offset,a=[n,n+e[r].value.length],i=e[r].value,s=[];h<o.length&&y(a,o[h]);)s.push(o[h]),h++;var u,l=[],c=0;f>0&&(c=f,f=0),s.forEach((function(e){var t=i.substr(c,e.offset-n-c);if(t.length>0){if(u)return void(e.changedelimiter&&(c=e.offset-n+e.length,u="start"===e.position));l.push({type:"content",value:t}),c+=t.length}var r={type:"delimiter",position:e.position,offset:c+n};if(e.changedelimiter)return u="start"===e.position,void(c=e.offset-n+e.length);l.push(r),c=e.offset-n+e.length})),f=c-i.length;var p=i.substr(c);return p.length>0&&l.push({type:"content",value:p}),l}),this);return{parsed:d,errors:p}}e.exports={parseDelimiters:T,parse:function(e,t){!function(e){var t=!1;e.forEach((function(e){t=function(e,t){return v(e)?(t&&c(e),!0):m(e)?(t||c(e),!1):t}(e,t),"content"===e.type&&(e.position=t?"insidetag":"outsidetag"),t&&"content"===e.type&&(e.value=d(e.value))}))}(e);var r=T(function(e){return e.filter((function(e){return"content"===e.type&&"insidetag"===e.position}))}(e),t),n=r.parsed,o=r.errors,a=[],i=0;return e.forEach((function(e){"content"===e.type&&"insidetag"===e.position?(Array.prototype.push.apply(a,n[i].map((function(e){return"content"===e.type&&(e.position="insidetag"),e}))),i++):a.push(e)})),a.forEach((function(e,t){e.lIndex=t})),{errors:o,lexed:a}},xmlparse:function(e,t){var r=function(e,t,r){for(var n=0,o=e.length,a=g([t.map((function(e){return{tag:e,text:!0}})),r.map((function(e){return{tag:e,text:!1}}))]).reduce((function(e,t){return e[t.tag]=t.text,e}),{}),i=[];n<o&&-1!==(n=e.indexOf("<",n));){var s=n,u=e.indexOf("<",n+1);(-1===(n=e.indexOf(">",n))||-1!==u&&n>u)&&p(e,s);var l=e.slice(s,n+1),c=x(l),f=c.tag,h=c.position,d=a[f];null!=d&&i.push({type:"tag",position:h,text:d,offset:s,value:l,tag:f})}return i}(e,t.text,t.other),n=0,o=r.reduce((function(t,r){var o=e.substr(n,r.offset-n);return o.length>0&&t.push({type:"content",value:o}),n=r.offset+r.value.length,delete r.offset,t.push(r),t}),[]),a=e.substr(n);return a.length>0&&o.push({type:"content",value:a}),o}}},63: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})),a=0;a<=r-1;){var i=t(e,o);n[a]=e[i][o[i]],o[i]++,a++}return n}},223:function(e,t,r){var n=r(257).XTInternalError;function o(){}function a(e){return e}e.exports=function(e){var t={set:o,parse:o,render:o,getTraits:o,getFileType:o,nullGetter:o,optionsTransformer:a,postrender:a,errorsTransformer:a,getRenderedMap:a,preparse:a,postparse:a,on:o,resolve: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}return Object.keys(t).forEach((function(r){e[r]=e[r]||t[r]})),e}},107:function(e,t,r){function n(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,n.key,n)}}var o=r(223),a=r(557).concatArrays,i=r(330),s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name="Common"}var t,r;return t=e,(r=[{key:"getFileType",value:function(e){var t=e.doc,r=t.invertedContentTypes;if(r)for(var n=Object.keys(i),o=0,s=n.length;o<s;o++)for(var u=n[o],l=i[u],c=0,p=l.length;c<p;c++){var f=l[c];if(r[f])return t.targets=a([t.targets,r[f]]),u}}}])&&n(t.prototype,r),e}();e.exports=function(){return o(new s)}},999:function(e,t,r){var n=r(63),o=r(557),a=o.getLeft,i=o.getRight,s=r(223),u=r(505).getExpandToDefault,l=r(257),c=l.getUnmatchedLoopException,p=l.getClosingTagNotMatchOpeningTag,f=l.getUnbalancedLoopException;function h(e){switch(e.location){case"start":return 1;case"end":return-1}}function d(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 g(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(c(n)),{traits:e,errors:r};var o=t,a=t-1,i=1;if(d(e[a],e[o]))return e.splice(o,1),e.splice(a,1),{errors:r,traits:e};for(;i<50;){var s=e[a-i],u=e[o+i];if(d(s,e[o]))return e.splice(o,1),e.splice(a-i,1),{errors:r,traits:e};if(d(e[a],u))return e.splice(o+i,1),e.splice(a,1),{errors:r,traits:e};i++}return r.push(p({tags:[e[a].part,e[o].part]})),e.splice(o,1),e.splice(a,1),{traits:e,errors:r}}t++}return e.forEach((function(e){var t=e.part;r.push(c(t))})),{traits:[],errors:r}}var v={name:"ExpandPairTrait",optionsTransformer:function(e,t){return this.expandTags=t.fileTypeConfig.expandTags.concat(t.options.paragraphLoop?t.fileTypeConfig.onParagraphLoop:[]),e},postparse:function(e,t){var r=this,o=t.getTraits,s=t.postparse,l=o("expandPair",e);l=l.map((function(e){return e||[]}));var c=function(e){for(var t={},r=[],n=[],o=0,a=[],i=0;i<e.length;i++){var s=e[i],u=s.part,l=h(s.part);o+=l;var c;c=1===l?o-1:o,a.push({level:c,part:u})}for(;a.length>0;){var p=g(a);r=r.concat(p.errors),a=p.traits}if(r.length>0)return{pairs:n,errors:r};o=0;for(var f=0;f<e.length;f++){var d=e[f],v=h(d.part);if(o+=v,1===v)t[o]=d;else{var m=t[o+1];0===o&&(n=n.concat([[m,d]]))}o=o>=0?o:0}return{pairs:n,errors:r}}(l=n(l)),p=c.pairs,d=c.errors,v=0,m=null,y=p.map((function(t){var n,o,s=t[0].part.expandTo;if("auto"===s){var l=u(e,t,r.expandTags);l.error&&d.push(l.error),s=l.value}if(!s){var c=t[0].offset,p=t[1].offset;return c<v&&d.push(f(t,m)),m=t,v=p,[c,p]}try{n=a(e,s,t[0].offset)}catch(e){d.push(e)}try{o=i(e,s,t[1].offset)}catch(e){d.push(e)}return n<v&&d.push(f(t,m)),v=o,m=t,[n,o]}));if(d.length>0)return{postparsed:e,errors:d};var x,w=0;return{postparsed:e.reduce((function(t,r,n){var o=w<p.length&&y[w][0]<=n&&n<=y[w][1],a=p[w],i=y[w];if(!o)return t.push(r),t;if(i[0]===n&&(x=[]),a[0].offset!==n&&a[1].offset!==n&&x.push(r),i[1]===n){var u=e[a[0].offset];u.subparsed=s(x,{basePart:u}),delete u.location,delete u.expandTo,t.push(u),w++}return t}),[]),errors:d}}};e.exports=function(){return s(v)}},19:function(e,t,r){function n(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 o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.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)?s(e,t):void 0}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new 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,n.key,n)}}var l=r(557),c=l.mergeObjects,p=l.chunkBy,f=l.last,h=l.isParagraphStart,d=l.isParagraphEnd,g=l.isContent,v=l.startsWith,m=l.isTagEnd,y=l.isTagStart,x=l.getSingleAttribute,w=l.setSingleAttribute,b=r(223),T="loop";function P(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 O(e){return e.hasPageBreak&&P(e)?'<w:p><w:r><w:br w:type="page"/></w:r></w:p>':""}function E(e){return e.some((function(e){return g(e)}))?0:e.length}function k(e){return e.some((function(e){return"w:br"===e.tag&&-1!==e.value.indexOf('w:type="page"')}))}function j(e){return e.some((function(e){return"w:drawing"===e.tag}))}var C=function(){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:"^"}}var t,r;return t=e,r=[{key:"parse",value:function(e,t){var r,n,o=t.match,a=t.getValue,s=t.getValues,u=T,l="placeholder",c=this.prefix,p=c.start,f=c.inverted,h=c.dash,d=c.end;if(o(p,e))return{type:l,value:a(p,e),expandTo:"auto",module:u,location:"start",inverted:!1};if(o(f,e))return{type:l,value:a(f,e),expandTo:"auto",module:u,location:"start",inverted:!0};if(o(d,e))return{type:l,value:a(d,e),module:u,location:"end"};if(o(h,e)){var g=(r=s(h,e),n=3,function(e){if(Array.isArray(e))return e}(r)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,s=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){s=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(s)throw o}}return a}}(r,n)||i(r,n)||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.")}()),v=g[1];return{type:l,value:g[2],expandTo:v,module:u,location:"start",inverted:!1}}return null}},{key:"getTraits",value:function(e,t){if("expandPair"===e)return t.reduce((function(e,t,r){return"placeholder"===t.type&&t.module===T&&null==t.subparsed&&e.push({part:t,offset:r}),e}),[])}},{key:"preparse",value:function(e){var t,r;this.sects=(t=!1,r=[],e.forEach((function(e){y("w:sectPr",e)&&(r.push([]),t=!0),t&&r[r.length-1].push(e),m("w:sectPr",e)&&(t=!1)})),r)}},{key:"postparse",value:function(e,t){var r=t.basePart;if(r){r.sectPrCount=function(e){var t=!1,r=0;return e.forEach((function(e){y("w:sectPr",e)&&(t=!0),t&&("w:headerReference"!==e.tag&&"w:footerReference"!==e.tag||(r++,t=!1)),m("w:sectPr",e)&&(t=!1)})),r}(e),this.totalSectPr+=r.sectPrCount;var n=this.sects;n.some((function(e,t){if(e[0].lIndex>r.lIndex)return t+1<n.length&&n[t+1].some((function(e){return"tag"===e.type&&"w:type"===e.tag&&-1!==e.value.indexOf("continuous")}))&&(r.addContinuousType=!0),!0})),r.lastParagrapSectPr=function(e){for(var t=[],r=!1,n=e.length-1;n>=0;n--){var o=e[n];if(m("w:sectPr",o)&&(r=!0),y("w:sectPr",o)&&(t.unshift(o),r=!1),r&&t.unshift(o),h(o)){if(t.length>0)return t.map((function(e){return e.value})).join("");break}}return""}(e)}if(!r||"auto"!==r.expandTo||r.module!==T||!function(e){return e.length&&h(e[0])&&d(f(e))}(e))return e;r.paragraphLoop=!0;var o=0,a=p(e,(function(e){return h(e)&&1==++o?"start":d(e)&&0==--o?"end":null})),i=a[0],s=f(a),u=E(i),l=E(s);return r.hasPageBreakBeginning=k(i),r.hasPageBreak=k(s),0===u||0===l?e:(j(i)&&(u=0),j(s)&&(l=0),e.slice(u,e.length-l))}},{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("placeholder"!==e.type||e.module!==T)return null;var r=[],n=[],a=0,i=e.subparsed[0],s=0;"a:tr"===i.tag&&(s=+x(i.value,"h")),a-=s;var u,l=0;try{u=t.scopeManager.loopOver(e.value,(function(o,i,u){a+=s;var p=t.scopeManager.createSubScopeManager(o,e.value,i,e,u);e.subparsed.forEach((function(e){if("tag"===e.type&&"a16:rowId"===e.tag){var t=+x(e.value,"val")+l;l=1,e.value=w(e.value,"val",t)}}));var f=t.render(c({},t,{compiled:e.subparsed,tags:{},scopeManager:p}));e.hasPageBreak&&i===u-1&&P(e)&&function(e){for(var t=!1,r=e.parts.length-1,n=e.parts.length-1;r>=0;r--)if("</w:p>"===e.parts[n]&&!t){t=!0,e.parts.splice(n,0,'<w:r><w:br w:type="page"/></w:r>');break}t||e.parts.push('<w:p><w:r><w:br w:type="page"/></w:r></w:p>')}(f);var h,d,g,m=p.scopePathItem.some((function(e){return 0!==e}));m&&(1===e.sectPrCount&&(f.parts=f.parts.filter((function(e){return!v(e,"<w:headerReference")&&!v(e,"<w:footerReference")}))),e.addContinuousType&&(f.parts=(h=f.parts,d=!1,g=!1,h.reduce((function(e,t){return!1===d&&v(t,"<w:sectPr")&&(g=!0),g&&(v(t,"<w:type")&&(d=!0),!1===d&&v(t,"</w:sectPr")&&e.push('<w:type w:val="continuous"/>')),e.push(t),e}),[])))),e.hasPageBreakBeginning&&P(e)&&function(e){e.parts.unshift('<w:p><w:r><w:br w:type="page"/></w:r></w:p>')}(f),r=r.concat(f.parts),n=n.concat(f.errors||[])}),e.inverted,{part:e})}catch(e){return n.push(e),{errors:n}}if(!1===u)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:O(e)||"",errors:n};if(0!==a){var p=+x(this.lastExt.value,"cy");this.lastExt.value=w(this.lastExt.value,"cy",p+a)}return{value:t.joinUncorrupt(r,o(o({},t),{},{basePart:e})),errors:n}}},{key:"resolve",value:function(e,t){if("placeholder"!==e.type||e.module!==T)return null;var r=t.scopeManager,n=r.getValueAsync(e.value,{part:e}),o=[];function a(n,a,i){var s=r.createSubScopeManager(n,e.value,a,e,i);o.push(t.resolve({filePath:t.filePath,modules:t.modules,baseNullGetter:t.baseNullGetter,resolve:t.resolve,compiled:e.subparsed,tags:{},scopeManager:s}))}var u=[];return n.then((function(t){return r.loopOverValue(t,a,e.inverted),Promise.all(o).then((function(e){return e.map((function(e){var t,r=e.resolved,n=e.errors;return u.push.apply(u,function(e){if(Array.isArray(e))return s(e)}(t=n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||i(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.")}()),r}))})).then((function(e){if(u.length>0)throw u;return e}))}))}}],r&&u(t.prototype,r),e}();e.exports=function(){return b(new C)}},182:function(e,t,r){function n(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,n.key,n)}}var o=r(505),a=r(557).isContent,i=r(257).throwRawTagShouldBeOnlyTextInParagraph,s="rawxml",u=r(223);function l(e){var t=e.part,r=e.left,n=e.right,o=e.postparsed,s=e.index,u=o.slice(r+1,n);return u.forEach((function(e,n){n!==s-r-1&&a(e)&&i({paragraphParts:u,part:t})})),t}var c=function(){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="@"}var t,r;return t=e,(r=[{key:"optionsTransformer",value:function(e,t){return this.fileTypeConfig=t.fileTypeConfig,e}},{key:"parse",value:function(e,t){var r=t.match,n=t.getValue;return r(this.prefix,e)?{type:"placeholder",value:n(this.prefix,e),module:s}:null}},{key:"postparse",value:function(e){return o.expandToOne(e,{moduleName:s,getInner:l,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!==s)return null;var r,n=[];try{null==(r=t.scopeManager.getValue(e.value,{part:e}))&&(r=t.nullGetter(e))}catch(e){return n.push(e),{errors:n}}return r?{value:r}:{value:""}}}])&&n(t.prototype,r),e}();e.exports=function(){return u(new c)}},163:function(e,t,r){function n(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,n.key,n)}}var o=r(223),a=r(257).getScopeCompilationError,i=r(557),s=i.utf8ToWord,u=i.hasCorruptCharacters,l=r(257).getCorruptCharactersException,c={docx:"w",pptx:"a"},p=function(){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=[]}var t,r;return t=e,(r=[{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:"optionsTransformer",value:function(e,t){return this.parser=t.parser,this.fileType=t.fileType,e}},{key:"postparse",value:function(e,t){var r=this,n=[];return e.forEach((function(e){if("placeholder"===e.type){var o=e.value;try{t.cachedParsers[e.lIndex]=r.parser(o,{tag:e})}catch(t){n.push(a({tag:o,rootError:t,offset:e.offset}))}}})),{postparsed:e,errors:n}}},{key:"recordRuns",value:function(e){e.tag==="".concat(c[this.fileType],":r")?this.recordedRun=[]:e.tag==="".concat(c[this.fileType],":rPr")?("start"===e.position&&(this.recordRun=!0,this.recordedRun=[e.value]),"end"===e.position&&(this.recordedRun.push(e.value),this.recordRun=!1)):this.recordRun&&this.recordedRun.push(e.value)}},{key:"render",value:function(e,t){var r=t.scopeManager,n=t.linebreaks,o=t.nullGetter;if(n&&this.recordRuns(e),"placeholder"===e.type&&!e.module){var a;try{a=r.getValue(e.value,{part:e})}catch(e){return{errors:[e]}}return null==a&&(a=o(e)),u(a)?{errors:[l({tag:e.value,value:a,offset:e.offset})]}:{value:n&&"string"==typeof a?this.renderLineBreaks(a):s(a)}}}},{key:"renderLineBreaks",value:function(e){var t=c[this.fileType],r="docx"===this.fileType?"<w:r><w:br/></w:r>":"<a:br/>",n=e.split("\n"),o=this.recordedRun.join("");return n.map((function(e){return s(e)})).join("</".concat(t,":t></").concat(t,":r>").concat(r,"<").concat(t,":r>").concat(o,"<").concat(t,":t").concat("docx"===this.fileType?' xml:space="preserve"':"",">"))}}])&&n(t.prototype,r),e}();e.exports=function(){return o(new p)}},95:function(e,t,r){var n=r(223),o=r(557),a=o.isTextStart,i=o.isTextEnd,s=o.endsWith,u=o.startsWith,l='<w:t xml:space="preserve">',c=l.length,p="</w:t>",f=p.length;function h(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 d={name:"SpacePreserveModule",postparse:function(e,t){var r=[],n=!1,o=0,s=0,u=e.reduce((function(e,u){return function(e){return a(e)&&"w:t"===e.tag}(u)&&(n=!0,s=r.length),n?(r.push(u),function(e,t){return e&&e.basePart&&t.length>1}(t,r)&&(o=t.basePart.endLindex,r[0].value=h(r,0)),function(e,t){return"placeholder"===e.type&&(!e.module||"loop"===e.module)&&t.length>1}(u,r)&&(r[s].value=h(r,s),o=u.endLindex),i(u)&&u.lIndex>o&&(0!==o&&(r[s].value=h(r,s)),Array.prototype.push.apply(e,r),r=[],n=!1,o=0,s=0),e):(e.push(u),e)}),[]);return Array.prototype.push.apply(u,r),u},postrender:function(e){var t="",r=0;return e.reduce((function(e,n,o){return""===n?(e.push(n),e):(-1!==n.indexOf('<w:t xml:space="preserve"></w:t>')&&(n=n.replace(/<w:t xml:space="preserve"><\/w:t>/g,"<w:t/>")),s(t,l)&&u(n,p)&&(e[r]=t.substr(0,t.length-c)+"<w:t/>",n=n.substr(f)),t=n,r=o,e.push(n),e)}),[])}};e.exports=function(){return n(d)}},190:function(e,t,r){function n(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 o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i=r(557).concatArrays,s=r(3),u=s.match,l=s.getValue,c=s.getValues,p={preparse:function(e,t,r){return{preparsed:function(e,r){return t.forEach((function(t){t.preparse(e,r)}))}(e,r)}},postparse:function(e,t,r){function n(e,r){return t.map((function(t){return t.getTraits(e,r)}))}var a=[];return{postparsed:function e(r,s){return t.reduce((function(t,r){var u=r.