UNPKG

@protobi/exceljs

Version:

Excel Workbook Manager - Temporary fork with pivot table enhancements and bug fixes pending upstream merge

3 lines (2 loc) 1.38 MB
/*! ExcelJS 10-11-2025 */ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).ExcelJS=t()}}((function(){var define,module,exports;return function t(e,r,n){function o(a,s){if(!r[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var c=r[a]={exports:{}};e[a][0].call(c.exports,(function(t){return o(e[a][1][t]||t)}),c,c.exports,t,e,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){var t=c(),e=t.m(o),r=(Object.getPrototypeOf?Object.getPrototypeOf(e):e.__proto__).constructor;function n(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===r||"GeneratorFunction"===(e.displayName||e.name))}var l={throw:1,return:2,break:3,continue:3};function d(t){var e,r;return function(n){e||(e={stop:function(){return r(n.a,2)},catch:function(){return n.v},abrupt:function(t,e){return r(n.a,l[t],e)},delegateYield:function(t,o,a){return e.resultName=o,r(n.d,i(t),a)},finish:function(t){return r(n.f,t)}},r=function(t,r,o){n.p=e.prev,n.n=e.next;try{return t(r,o)}finally{e.next=n.n}}),e.resultName&&(e[e.resultName]=n.v,e.resultName=void 0),e.sent=n.v,e.next=n.n;try{return t.call(this,e)}finally{n.p=e.prev,n.n=e.next}}}return(o=function(){return{wrap:function(e,r,n,o){return t.w(d(e),r,n,o&&o.reverse())},isGeneratorFunction:n,mark:t.m,awrap:function(t,e){return new h(t,e)},AsyncIterator:f,async:function(t,e,r,o,i){return(n(e)?u:s)(d(t),e,r,o,i)},keys:a,values:i}})()}function i(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}throw new TypeError(n(t)+" is not iterable")}function a(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}}function s(t,e,r,n,o){var i=u(t,e,r,n,o);return i.next().then((function(t){return t.done?t.value:i.next()}))}function u(t,e,r,n,o){return new f(c().w(t,e,r,n),o||Promise)}function f(t,e){function r(n,o,i,a){try{var s=t[n](o),u=s.value;return u instanceof h?e.resolve(u.v).then((function(t){r("next",t,i,a)}),(function(t){r("throw",t,i,a)})):e.resolve(u).then((function(t){s.value=t,i(s)}),(function(t){return r("throw",t,i,a)}))}catch(t){a(t)}}var n;this.next||(l(f.prototype),l(f.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",(function(){return this}))),l(this,"_invoke",(function(t,o,i){function a(){return new e((function(e,n){r(t,i,e,n)}))}return n=n?n.then(a,a):a()}),!0)}function c(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var u=n&&n.prototype instanceof s?n:s,f=Object.create(u.prototype);return l(f,"_invoke",function(r,n,o){var i,s,u,f=0,c=o||[],l=!1,h={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return i=e,s=0,u=t,h.n=r,a}};function d(r,n){for(s=r,u=n,e=0;!l&&f&&!o&&e<c.length;e++){var o,i=c[e],d=h.p,p=i[2];r>3?(o=p===n)&&(u=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=r<2&&d<i[1])?(s=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,s=0))}if(o||r>1)return a;throw l=!0,n}return function(o,c,p){if(f>1)throw TypeError("Generator is already running");for(l&&1===c&&d(c,p),s=c,u=p;(e=s<2?t:u)||!l;){i||(s?s<3?(s>1&&(h.n=-1),d(s,u)):h.n=u:h.v=u);try{if(f=2,i){if(s||(o="next"),e=i[o]){if(!(e=e.call(i,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,s<2&&(s=0)}else 1===s&&(e=i.return)&&e.call(i),s<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=t}else if((e=(l=h.n<0)?u:r.call(n,h))!==a)break}catch(e){i=t,s=1,u=e}finally{f=1}}return{value:e,done:l}}}(r,o,i),!0),f}var a={};function s(){}function u(){}function f(){}e=Object.getPrototypeOf;var h=[][n]?e(e([][n]())):(l(e={},n,(function(){return this})),e),d=f.prototype=s.prototype=Object.create(h);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,l(t,o,"GeneratorFunction")),t.prototype=Object.create(d),t}return u.prototype=f,l(d,"constructor",f),l(f,"constructor",u),u.displayName="GeneratorFunction",l(f,o,"GeneratorFunction"),l(d),l(d,o,"Generator"),l(d,n,(function(){return this})),l(d,"toString",(function(){return"[object Generator]"})),(c=function(){return{w:i,m:p}})()}function l(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}(l=function(t,e,r,n){function i(e,r){l(t,e,(function(t){return this._invoke(e,r,t)}))}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))})(t,e,r,n)}function h(t,e){this.v=t,this.k=e}function d(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function p(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){d(i,n,o,a,s,"next",t)}function s(t){d(i,n,o,a,s,"throw",t)}a(void 0)}))}}function y(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,m(n.key),n)}}function m(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}var b=t("fs"),v=t("fast-csv"),g=t("dayjs/plugin/customParseFormat"),w=t("dayjs/plugin/utc"),_=t("dayjs").extend(g).extend(w),S=t("../utils/stream-buf"),k=t("../utils/utils").fs.exists,x={true:!0,false:!1,"#N/A":{error:"#N/A"},"#REF!":{error:"#REF!"},"#NAME?":{error:"#NAME?"},"#DIV/0!":{error:"#DIV/0!"},"#NULL!":{error:"#NULL!"},"#VALUE!":{error:"#VALUE!"},"#NUM!":{error:"#NUM!"}},O=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.workbook=e,this.worksheet=null}var e,r,i,a,s;return e=t,(r=[{key:"readFile",value:(s=p(o().mark((function t(e,r){var n,i;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=r||{},t.next=3,k(e);case 3:if(t.sent){t.next=5;break}throw new Error("File not found: ".concat(e));case 5:return n=b.createReadStream(e),t.next=8,this.read(n,r);case 8:return i=t.sent,n.close(),t.abrupt("return",i);case 11:case"end":return t.stop()}}),t,this)}))),function(t,e){return s.apply(this,arguments)})},{key:"read",value:function(t,e){var r=this;return e=e||{},new Promise((function(n,o){var i=r.workbook.addWorksheet(e.sheetName),a=e.dateFormats||["YYYY-MM-DD[T]HH:mm:ssZ","YYYY-MM-DD[T]HH:mm:ss","MM-DD-YYYY","YYYY-MM-DD"],s=e.map||function(t){if(""===t)return null;var e=Number(t);if(!Number.isNaN(e)&&e!==1/0)return e;var r=a.reduce((function(e,r){if(e)return e;var n=_(t,r,!0);return n.isValid()?n:null}),null);if(r)return new Date(r.valueOf());var n=x[t];return void 0!==n?n:t},u=v.parse(e.parserOptions).on("data",(function(t){i.addRow(t.map(s))})).on("end",(function(){u.emit("worksheet",i)}));u.on("worksheet",n).on("error",o),t.pipe(u)}))}},{key:"createInputStream",value:function(){throw new Error("`CSV#createInputStream` is deprecated. You should use `CSV#read` instead. This method will be removed in version 5.0. Please follow upgrade instruction: https://github.com/exceljs/exceljs/blob/master/UPGRADE-4.0.md")}},{key:"write",value:function(t,e){var r=this;return new Promise((function(o,i){e=e||{};var a=r.workbook.getWorksheet(e.sheetName||e.sheetId),s=v.format(e.formatterOptions);t.on("finish",(function(){o()})),s.on("error",i),s.pipe(t);var u=e,f=u.dateFormat,c=u.dateUTC,l=e.map||function(t){if(t){if(t.text||t.hyperlink)return t.hyperlink||t.text||"";if(t.formula||t.result)return t.result||"";if(t instanceof Date)return f?c?_.utc(t).format(f):_(t).format(f):c?_.utc(t).format():_(t).format();if(t.error)return t.error;if("object"===n(t))return JSON.stringify(t)}return t},h=void 0===e.includeEmptyRows||e.includeEmptyRows,d=1;a&&a.eachRow((function(t,e){if(h)for(;d++<e-1;)s.write([]);var r=t.values;r.shift(),s.write(r.map(l)),d=e})),s.end()}))}},{key:"writeFile",value:function(t,e){var r={encoding:(e=e||{}).encoding||"utf8"},n=b.createWriteStream(t,r);return this.write(n,e)}},{key:"writeBuffer",value:(a=p(o().mark((function t(e){var r;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new S,t.next=3,this.write(r,e);case 3:return t.abrupt("return",r.read());case 4:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})}])&&y(e.prototype,r),i&&y(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.exports=O},{"../utils/stream-buf":25,"../utils/utils":28,dayjs:258,"dayjs/plugin/customParseFormat":259,"dayjs/plugin/utc":260,"fast-csv":302,fs:236}],2:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,a(n.key),n)}}function a(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}var s=t("../utils/col-cache"),u=function(){function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(o(this,t),this.worksheet=e,r)if("string"==typeof r){var i=s.decodeAddress(r);this.nativeCol=i.col+n,this.nativeColOff=0,this.nativeRow=i.row+n,this.nativeRowOff=0}else void 0!==r.nativeCol?(this.nativeCol=r.nativeCol||0,this.nativeColOff=r.nativeColOff||0,this.nativeRow=r.nativeRow||0,this.nativeRowOff=r.nativeRowOff||0):void 0!==r.col?(this.col=r.col+n,this.row=r.row+n):(this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0);else this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0}var e,r,n;return e=t,n=[{key:"asInstance",value:function(e){return e instanceof t||null==e?e:new t(e)}}],(r=[{key:"col",get:function(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth},set:function(t){this.nativeCol=Math.floor(t),this.nativeColOff=Math.floor((t-this.nativeCol)*this.colWidth)}},{key:"row",get:function(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight},set:function(t){this.nativeRow=Math.floor(t),this.nativeRowOff=Math.floor((t-this.nativeRow)*this.rowHeight)}},{key:"colWidth",get:function(){return this.worksheet&&this.worksheet.getColumn(this.nativeCol+1)&&this.worksheet.getColumn(this.nativeCol+1).isCustomWidth?Math.floor(1e4*this.worksheet.getColumn(this.nativeCol+1).width):64e4}},{key:"rowHeight",get:function(){return this.worksheet&&this.worksheet.getRow(this.nativeRow+1)&&this.worksheet.getRow(this.nativeRow+1).height?Math.floor(1e4*this.worksheet.getRow(this.nativeRow+1).height):18e4}},{key:"model",get:function(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}},set:function(t){this.nativeCol=t.nativeCol,this.nativeColOff=t.nativeColOff,this.nativeRow=t.nativeRow,this.nativeRowOff=t.nativeRowOff}}])&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.exports=u},{"../utils/col-cache":20}],3:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,s(n.key),n)}}function a(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}var u=t("../utils/col-cache"),f=t("../utils/under-dash"),c=t("./enums"),l=t("../utils/shared-formula").slideFormula,h=t("./note"),d=function(){function t(e,r,n){if(o(this,t),!e||!r)throw new Error("A Cell needs a Row");this._row=e,this._column=r,u.validateAddress(n),this._address=n,this._value=j.create(t.Types.Null,this),this.style=this._mergeStyle(e.style,r.style,{}),this._mergeCount=0}return a(t,[{key:"worksheet",get:function(){return this._row.worksheet}},{key:"workbook",get:function(){return this._row.worksheet.workbook}},{key:"destroy",value:function(){delete this.style,delete this._value,delete this._row,delete this._column,delete this._address}},{key:"numFmt",get:function(){return this.style.numFmt},set:function(t){this.style.numFmt=t}},{key:"font",get:function(){return this.style.font},set:function(t){this.style.font=t}},{key:"alignment",get:function(){return this.style.alignment},set:function(t){this.style.alignment=t}},{key:"border",get:function(){return this.style.border},set:function(t){this.style.border=t}},{key:"fill",get:function(){return this.style.fill},set:function(t){this.style.fill=t}},{key:"protection",get:function(){return this.style.protection},set:function(t){this.style.protection=t}},{key:"_mergeStyle",value:function(t,e,r){var n=t&&t.numFmt||e&&e.numFmt;n&&(r.numFmt=n);var o=t&&t.font||e&&e.font;o&&(r.font=o);var i=t&&t.alignment||e&&e.alignment;i&&(r.alignment=i);var a=t&&t.border||e&&e.border;a&&(r.border=a);var s=t&&t.fill||e&&e.fill;s&&(r.fill=s);var u=t&&t.protection||e&&e.protection;return u&&(r.protection=u),r}},{key:"address",get:function(){return this._address}},{key:"row",get:function(){return this._row.number}},{key:"col",get:function(){return this._column.number}},{key:"$col$row",get:function(){return"$".concat(this._column.letter,"$").concat(this.row)}},{key:"type",get:function(){return this._value.type}},{key:"effectiveType",get:function(){return this._value.effectiveType}},{key:"toCsvString",value:function(){return this._value.toCsvString()}},{key:"addMergeRef",value:function(){this._mergeCount++}},{key:"releaseMergeRef",value:function(){this._mergeCount--}},{key:"isMerged",get:function(){return this._mergeCount>0||this.type===t.Types.Merge}},{key:"merge",value:function(e,r){this._value.release(),this._value=j.create(t.Types.Merge,this,e),r||(this.style=e.style)}},{key:"unmerge",value:function(){this.type===t.Types.Merge&&(this._value.release(),this._value=j.create(t.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{}))}},{key:"isMergedTo",value:function(e){return this._value.type===t.Types.Merge&&this._value.isMergedTo(e)}},{key:"master",get:function(){return this.type===t.Types.Merge?this._value.master:this}},{key:"isHyperlink",get:function(){return this._value.type===t.Types.Hyperlink}},{key:"hyperlink",get:function(){return this._value.hyperlink}},{key:"value",get:function(){return this._value.value},set:function(e){this.type!==t.Types.Merge?(this._value.release(),this._value=j.create(j.getType(e),this,e)):this._value.master.value=e}},{key:"note",get:function(){return this._comment&&this._comment.note},set:function(t){this._comment=new h(t)}},{key:"text",get:function(){return this._value.toString()}},{key:"html",get:function(){return f.escapeHtml(this.text)}},{key:"toString",value:function(){return this.text}},{key:"_upgradeToHyperlink",value:function(e){this.type===t.Types.String&&(this._value=j.create(t.Types.Hyperlink,this,{text:this._value.value,hyperlink:e}))}},{key:"formula",get:function(){return this._value.formula}},{key:"result",get:function(){return this._value.result}},{key:"formulaType",get:function(){return this._value.formulaType}},{key:"fullAddress",get:function(){return{sheetName:this._row.worksheet.name,address:this.address,row:this.row,col:this.col}}},{key:"name",get:function(){return this.names[0]},set:function(t){this.names=[t]}},{key:"names",get:function(){return this.workbook.definedNames.getNamesEx(this.fullAddress)},set:function(t){var e=this,r=this.workbook.definedNames;r.removeAllNames(this.fullAddress),t.forEach((function(t){r.addEx(e.fullAddress,t)}))}},{key:"addName",value:function(t){this.workbook.definedNames.addEx(this.fullAddress,t)}},{key:"removeName",value:function(t){this.workbook.definedNames.removeEx(this.fullAddress,t)}},{key:"removeAllNames",value:function(){this.workbook.definedNames.removeAllNames(this.fullAddress)}},{key:"_dataValidations",get:function(){return this.worksheet.dataValidations}},{key:"dataValidation",get:function(){return this._dataValidations.find(this.address)},set:function(t){this._dataValidations.add(this.address,t)}},{key:"model",get:function(){var t=this._value.model;return t.style=this.style,this._comment&&(t.comment=this._comment.model),t},set:function(t){if(this._value.release(),this._value=j.create(t.type,this),this._value.model=t,t.comment)switch(t.comment.type){case"note":this._comment=h.fromModel(t.comment)}t.style?this.style=t.style:this.style={}}}]),t}();d.Types=c.ValueType;var p=function(){function t(e){o(this,t),this.model={address:e.address,type:d.Types.Null}}return a(t,[{key:"value",get:function(){return null},set:function(t){}},{key:"type",get:function(){return d.Types.Null}},{key:"effectiveType",get:function(){return d.Types.Null}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return""}},{key:"release",value:function(){}},{key:"toString",value:function(){return""}}]),t}(),y=function(){function t(e,r){o(this,t),this.model={address:e.address,type:d.Types.Number,value:r}}return a(t,[{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return d.Types.Number}},{key:"effectiveType",get:function(){return d.Types.Number}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return this.model.value.toString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}}]),t}(),m=function(){function t(e,r){o(this,t),this.model={address:e.address,type:d.Types.String,value:r}}return a(t,[{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return d.Types.String}},{key:"effectiveType",get:function(){return d.Types.String}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return'"'.concat(this.model.value.replace(/"/g,'""'),'"')}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value}}]),t}(),b=function(){function t(e,r){o(this,t),this.model={address:e.address,type:d.Types.String,value:r}}return a(t,[{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"toString",value:function(){return this.model.value.richText.map((function(t){return t.text})).join("")}},{key:"type",get:function(){return d.Types.RichText}},{key:"effectiveType",get:function(){return d.Types.RichText}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return'"'.concat(this.text.replace(/"/g,'""'),'"')}},{key:"release",value:function(){}}]),t}(),v=function(){function t(e,r){o(this,t),this.model={address:e.address,type:d.Types.Date,value:r}}return a(t,[{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return d.Types.Date}},{key:"effectiveType",get:function(){return d.Types.Date}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return this.model.value.toISOString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}}]),t}(),g=function(){function t(e,r){o(this,t),this.model={address:e.address,type:d.Types.Hyperlink,text:r?r.text:void 0,hyperlink:r?r.hyperlink:void 0},r&&r.tooltip&&(this.model.tooltip=r.tooltip)}return a(t,[{key:"value",get:function(){var t={text:this.model.text,hyperlink:this.model.hyperlink};return this.model.tooltip&&(t.tooltip=this.model.tooltip),t},set:function(t){this.model={text:t.text,hyperlink:t.hyperlink},t.tooltip&&(this.model.tooltip=t.tooltip)}},{key:"text",get:function(){return this.model.text},set:function(t){this.model.text=t}},{key:"hyperlink",get:function(){return this.model.hyperlink},set:function(t){this.model.hyperlink=t}},{key:"type",get:function(){return d.Types.Hyperlink}},{key:"effectiveType",get:function(){return d.Types.Hyperlink}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return this.model.hyperlink}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.text}}]),t}(),w=function(){function t(e,r){o(this,t),this.model={address:e.address,type:d.Types.Merge,master:r?r.address:void 0},this._master=r,r&&r.addMergeRef()}return a(t,[{key:"value",get:function(){return this._master.value},set:function(t){t instanceof d?(this._master&&this._master.releaseMergeRef(),t.addMergeRef(),this._master=t):this._master.value=t}},{key:"isMergedTo",value:function(t){return t===this._master}},{key:"master",get:function(){return this._master}},{key:"type",get:function(){return d.Types.Merge}},{key:"effectiveType",get:function(){return this._master.effectiveType}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return""}},{key:"release",value:function(){this._master.releaseMergeRef()}},{key:"toString",value:function(){return this.value.toString()}}]),t}(),_=function(){function t(e,r){o(this,t),this.cell=e,this.model={address:e.address,type:d.Types.Formula,shareType:r?r.shareType:void 0,ref:r?r.ref:void 0,formula:r?r.formula:void 0,sharedFormula:r?r.sharedFormula:void 0,result:r?r.result:void 0}}return a(t,[{key:"_copyModel",value:function(t){var e={},r=function(r){var n=t[r];n&&(e[r]=n)};return r("formula"),r("result"),r("ref"),r("shareType"),r("sharedFormula"),e}},{key:"value",get:function(){return this._copyModel(this.model)},set:function(t){this.model=this._copyModel(t)}},{key:"validate",value:function(t){switch(j.getType(t)){case d.Types.Null:case d.Types.String:case d.Types.Number:case d.Types.Date:break;case d.Types.Hyperlink:case d.Types.Formula:default:throw new Error("Cannot process that type of result value")}}},{key:"dependencies",get:function(){return{ranges:this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g),cells:this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g,"").match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g)}}},{key:"formula",get:function(){return this.model.formula||this._getTranslatedFormula()},set:function(t){this.model.formula=t}},{key:"formulaType",get:function(){return this.model.formula?c.FormulaType.Master:this.model.sharedFormula?c.FormulaType.Shared:c.FormulaType.None}},{key:"result",get:function(){return this.model.result},set:function(t){this.model.result=t}},{key:"type",get:function(){return d.Types.Formula}},{key:"effectiveType",get:function(){var t=this.model.result;return null==t?c.ValueType.Null:t instanceof String||"string"==typeof t?c.ValueType.String:"number"==typeof t?c.ValueType.Number:t instanceof Date?c.ValueType.Date:t.text&&t.hyperlink?c.ValueType.Hyperlink:t.formula?c.ValueType.Formula:c.ValueType.Null}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"_getTranslatedFormula",value:function(){if(!this._translatedFormula&&this.model.sharedFormula){var t=this.cell.worksheet.findCell(this.model.sharedFormula);this._translatedFormula=t&&l(t.formula,t.address,this.model.address)}return this._translatedFormula}},{key:"toCsvString",value:function(){return"".concat(this.model.result||"")}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.result?this.model.result.toString():""}}]),t}(),S=function(){function t(e,r){o(this,t),this.model={address:e.address,type:d.Types.SharedString,value:r}}return a(t,[{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return d.Types.SharedString}},{key:"effectiveType",get:function(){return d.Types.SharedString}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return this.model.value.toString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}}]),t}(),k=function(){function t(e,r){o(this,t),this.model={address:e.address,type:d.Types.Boolean,value:r}}return a(t,[{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return d.Types.Boolean}},{key:"effectiveType",get:function(){return d.Types.Boolean}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return this.model.value?1:0}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}}]),t}(),x=function(){function t(e,r){o(this,t),this.model={address:e.address,type:d.Types.Error,value:r}}return a(t,[{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return d.Types.Error}},{key:"effectiveType",get:function(){return d.Types.Error}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return this.toString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.error.toString()}}]),t}(),O=function(){function t(e,r){o(this,t),this.model={address:e.address,type:d.Types.String,value:JSON.stringify(r),rawValue:r}}return a(t,[{key:"value",get:function(){return this.model.rawValue},set:function(t){this.model.rawValue=t,this.model.value=JSON.stringify(t)}},{key:"type",get:function(){return d.Types.String}},{key:"effectiveType",get:function(){return d.Types.String}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return this.model.value}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value}}]),t}(),j={getType:function(t){return null==t?d.Types.Null:t instanceof String||"string"==typeof t?d.Types.String:"number"==typeof t?d.Types.Number:"boolean"==typeof t?d.Types.Boolean:t instanceof Date?d.Types.Date:t.text&&t.hyperlink?d.Types.Hyperlink:t.formula||t.sharedFormula?d.Types.Formula:t.richText?d.Types.RichText:t.sharedString?d.Types.SharedString:t.error?d.Types.Error:d.Types.JSON},types:[{t:d.Types.Null,f:p},{t:d.Types.Number,f:y},{t:d.Types.String,f:m},{t:d.Types.Date,f:v},{t:d.Types.Hyperlink,f:g},{t:d.Types.Formula,f:_},{t:d.Types.Merge,f:w},{t:d.Types.JSON,f:O},{t:d.Types.SharedString,f:S},{t:d.Types.RichText,f:b},{t:d.Types.Boolean,f:k},{t:d.Types.Error,f:x}].reduce((function(t,e){return t[e.t]=e.f,t}),[]),create:function(t,e,r){var n=this.types[t];if(!n)throw new Error("Could not create Value of type ".concat(t));return new n(e,r)}};e.exports=d},{"../utils/col-cache":20,"../utils/shared-formula":24,"../utils/under-dash":27,"./enums":7,"./note":9}],4:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}var a=t("../utils/under-dash"),s=t("./enums"),u=t("../utils/col-cache"),f=function(){function t(e,r,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._worksheet=e,this._number=r,!1!==n&&(this.defn=n)}var e,r,n;return e=t,n=[{key:"toModel",value:function(t){var e=[],r=null;return t&&t.forEach((function(t,n){t.isDefault?r&&(r=null):r&&t.equivalentTo(r)?r.max=n+1:(r={min:n+1,max:n+1,width:void 0!==t.width?t.width:9,style:t.style,isCustomWidth:t.isCustomWidth,hidden:t.hidden,outlineLevel:t.outlineLevel,collapsed:t.collapsed},e.push(r))})),e.length?e:void 0}},{key:"fromModel",value:function(e,r){var n=[],o=1,i=0;for(r=(r=r||[]).sort((function(t,e){return t.min-e.min}));i<r.length;){for(var a=r[i++];o<a.min;)n.push(new t(e,o++));for(;o<=a.max;)n.push(new t(e,o++,a))}return n.length?n:null}}],(r=[{key:"number",get:function(){return this._number}},{key:"worksheet",get:function(){return this._worksheet}},{key:"letter",get:function(){return u.n2l(this._number)}},{key:"isCustomWidth",get:function(){return void 0!==this.width&&9!==this.width}},{key:"defn",get:function(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel}},set:function(t){t?(this.key=t.key,this.width=void 0!==t.width?t.width:9,this.outlineLevel=t.outlineLevel,t.style?this.style=t.style:this.style={},this.header=t.header,this._hidden=!!t.hidden):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0)}},{key:"headers",get:function(){return this._header&&this._header instanceof Array?this._header:[this._header]}},{key:"header",get:function(){return this._header},set:function(t){var e=this;void 0!==t?(this._header=t,this.headers.forEach((function(t,r){e._worksheet.getCell(r+1,e.number).value=t}))):this._header=void 0}},{key:"key",get:function(){return this._key},set:function(t){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=t,t&&this._worksheet.setColumnKey(this._key,this)}},{key:"hidden",get:function(){return!!this._hidden},set:function(t){this._hidden=t}},{key:"outlineLevel",get:function(){return this._outlineLevel||0},set:function(t){this._outlineLevel=t}},{key:"collapsed",get:function(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelCol)}},{key:"toString",value:function(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})}},{key:"equivalentTo",value:function(t){return this.width===t.width&&this.hidden===t.hidden&&this.outlineLevel===t.outlineLevel&&a.isEqual(this.style,t.style)}},{key:"isDefault",get:function(){if(this.isCustomWidth)return!1;if(this.hidden)return!1;if(this.outlineLevel)return!1;var t=this.style;return!t||!(t.font||t.numFmt||t.alignment||t.border||t.fill||t.protection)}},{key:"headerCount",get:function(){return this.headers.length}},{key:"eachCell",value:function(t,e){var r=this.number;e||(e=t,t=null),this._worksheet.eachRow(t,(function(t,n){e(t.getCell(r),n)}))}},{key:"values",get:function(){var t=[];return this.eachCell((function(e,r){e&&e.type!==s.ValueType.Null&&(t[r]=e.value)})),t},set:function(t){var e=this;if(t){var r=this.number,n=0;t.hasOwnProperty("0")&&(n=1),t.forEach((function(t,o){e._worksheet.getCell(o+n,r).value=t}))}}},{key:"_applyStyle",value:function(t,e){return this.style[t]=e,this.eachCell((function(r){r[t]=e})),e}},{key:"numFmt",get:function(){return this.style.numFmt},set:function(t){this._applyStyle("numFmt",t)}},{key:"font",get:function(){return this.style.font},set:function(t){this._applyStyle("font",t)}},{key:"alignment",get:function(){return this.style.alignment},set:function(t){this._applyStyle("alignment",t)}},{key:"protection",get:function(){return this.style.protection},set:function(t){this._applyStyle("protection",t)}},{key:"border",get:function(){return this.style.border},set:function(t){this._applyStyle("border",t)}},{key:"fill",get:function(){return this.style.fill},set:function(t){this._applyStyle("fill",t)}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.exports=f},{"../utils/col-cache":20,"../utils/under-dash":27,"./enums":7}],5:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}var a=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.model=e||{}}var e,r,n;return e=t,(r=[{key:"add",value:function(t,e){return this.model[t]=e}},{key:"find",value:function(t){return this.model[t]}},{key:"remove",value:function(t){this.model[t]=void 0}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.exports=a},{}],6:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}var a=t("../utils/under-dash"),s=t("../utils/col-cache"),u=t("../utils/cell-matrix"),f=t("./range"),c=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/,l=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.matrixMap={}}var e,r,n;return e=t,(r=[{key:"getMatrix",value:function(t){return this.matrixMap[t]||(this.matrixMap[t]=new u)}},{key:"add",value:function(t,e){var r=s.decodeEx(t);this.addEx(r,e)}},{key:"addEx",value:function(t,e){var r=this.getMatrix(e);if(t.top)for(var n=t.left;n<=t.right;n++)for(var o=t.top;o<=t.bottom;o++){var i={sheetName:t.sheetName,address:s.n2l(n)+o,row:o,col:n};r.addCellEx(i)}else r.addCellEx(t)}},{key:"remove",value:function(t,e){var r=s.decodeEx(t);this.removeEx(r,e)}},{key:"removeEx",value:function(t,e){this.getMatrix(e).removeCellEx(t)}},{key:"removeAllNames",value:function(t){a.each(this.matrixMap,(function(e){e.removeCellEx(t)}))}},{key:"forEach",value:function(t){a.each(this.matrixMap,(function(e,r){e.forEach((function(e){t(r,e)}))}))}},{key:"getNames",value:function(t){return this.getNamesEx(s.decodeEx(t))}},{key:"getNamesEx",value:function(t){return a.map(this.matrixMap,(function(e,r){return e.findCellEx(t)&&r})).filter(Boolean)}},{key:"_explore",value:function(t,e){e.mark=!1;var r,n,o=e.sheetName,i=new f(e.row,e.col,e.row,e.col,o);function a(r,n){var a=t.findCellAt(o,r,e.col);return!(!a||!a.mark||(i[n]=r,a.mark=!1,0))}for(n=e.row-1;a(n,"top");n--);for(n=e.row+1;a(n,"bottom");n++);function s(e,r){var a=[];for(n=i.top;n<=i.bottom;n++){var s=t.findCellAt(o,n,e);if(!s||!s.mark)return!1;a.push(s)}i[r]=e;for(var u=0;u<a.length;u++)a[u].mark=!1;return!0}for(r=e.col-1;s(r,"left");r--);for(r=e.col+1;s(r,"right");r++);return i}},{key:"getRanges",value:function(t,e){var r=this;return(e=e||this.matrixMap[t])?(e.forEach((function(t){t.mark=!0})),{name:t,ranges:e.map((function(t){return t.mark&&r._explore(e,t)})).filter(Boolean).map((function(t){return t.$shortRange}))}):{name:t,ranges:[]}}},{key:"normaliseMatrix",value:function(t,e){t.forEachInSheet(e,(function(t,e,r){t&&(t.row===e&&t.col===r||(t.row=e,t.col=r,t.address=s.n2l(r)+e))}))}},{key:"spliceRows",value:function(t,e,r,n){var o=this;a.each(this.matrixMap,(function(i){i.spliceRows(t,e,r,n),o.normaliseMatrix(i,t)}))}},{key:"spliceColumns",value:function(t,e,r,n){var o=this;a.each(this.matrixMap,(function(i){i.spliceColumns(t,e,r,n),o.normaliseMatrix(i,t)}))}},{key:"model",get:function(){var t=this;return a.map(this.matrixMap,(function(e,r){return t.getRanges(r,e)})).filter((function(t){return t.ranges.length}))},set:function(t){var e=this.matrixMap={};t.forEach((function(t){var r=e[t.name]=new u;t.ranges.forEach((function(t){c.test(t.split("!").pop()||"")&&r.addCell(t)}))}))}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.exports=l},{"../utils/cell-matrix":19,"../utils/col-cache":20,"../utils/under-dash":27,"./range":11}],7:[function(t,e,r){"use strict";e.exports={ValueType:{Null:0,Merge:1,Number:2,String:3,Date:4,Hyperlink:5,Formula:6,SharedString:7,RichText:8,Boolean:9,Error:10},FormulaType:{None:0,Master:1,Shared:2},RelationshipType:{None:0,OfficeDocument:1,Worksheet:2,CalcChain:3,SharedStrings:4,Styles:5,Theme:6,Hyperlink:7},DocumentType:{Xlsx:1},ReadingOrder:{LeftToRight:1,RightToLeft:2},ErrorValue:{NotApplicable:"#N/A",Ref:"#REF!",Name:"#NAME?",DivZero:"#DIV/0!",Null:"#NULL!",Value:"#VALUE!",Num:"#NUM!"}}},{}],8:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}var a=t("../utils/col-cache"),s=t("./anchor"),u=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.worksheet=e,this.model=r}var e,r,n;return e=t,(r=[{key:"model",get:function(){switch(this.type){case"background":return{type:this.type,imageId:this.imageId};case"image":return{type:this.type,imageId:this.imageId,hyperlinks:this.range.hyperlinks,range:{tl:this.range.tl.model,br:this.range.br&&this.range.br.model,ext:this.range.ext,editAs:this.range.editAs}};default:throw new Error("Invalid Image Type")}},set:function(t){var e=t.type,r=t.imageId,n=t.range,o=t.hyperlinks;if(this.type=e,this.imageId=r,"image"===e)if("string"==typeof n){var i=a.decode(n);this.range={tl:new s(this.worksheet,{col:i.left,row:i.top},-1),br:new s(this.worksheet,{col:i.right,row:i.bottom},0),editAs:"oneCell"}}else this.range={tl:new s(this.worksheet,n.tl,0),br:n.br&&new s(this.worksheet,n.br,0),ext:n.ext,editAs:n.editAs,hyperlinks:o||n.hyperlinks}}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.exports=u},{"../utils/col-cache":20,"./anchor":2}],9:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}var a=t("../utils/under-dash"),s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.note=e}var e,r,i;return e=t,i=[{key:"fromModel",value:function(e){var r=new t;return r.model=e,r}}],(r=[{key:"model",get:function(){var e=null;switch(n(this.note)){case"string":e={type:"note",note:{texts:[{text:this.note}]}};break;default:e={type:"note",note:this.note}}return a.deepMerge({},t.DEFAULT_CONFIGS,e)},set:function(t){var e=t.note,r=e.texts;1===r.length&&1===Object.keys(r[0]).length?this.note=r[0].text:this.note=e}}])&&o(e.prototype,r),i&&o(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();s.DEFAULT_CONFIGS={note:{margins:{insetmode:"auto",inset:[.13,.13,.25,.25]},protection:{locked:"True",lockText:"True"},editAs:"absolute"}},e.exports=s},{"../utils/under-dash":27}],10:[function(t,e,r){"use strict";function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=i(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw a}}}}function o(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(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.")}()}function i(t,e){if(t){if("string"==typeof t)return a(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var s=t("../utils/utils"),u=s.objectFromProps,f=s.range,c=s.toSortedArray;e.exports={makePivotTable:function(t,e){!function(t,e){if(e.metric&&"sum"!==e.metric&&"count"!==e.metric)throw new Error('Only the "sum" and "count" metric is supported at this time.');for(var r=e.sourceSheet.getRow(1).values.slice(1),n=u(r,!0),i=0,a=[].concat(o(e.rows),o(e.columns),o(e.values));i<a.length;i++){var s=a[i];if(!n[s])throw new Error('The header name "'.concat(s,'" was not found in ').concat(e.sourceSheet.name,"."))}if(!e.rows.length)throw new Error("No pivot table rows specified.");if(!e.columns.length)throw new Error("No pivot table columns specified.");if(1!==e.values.length)throw new Error("Exactly 1 value needs to be specified at this time.")}(0,e);var r=e.sourceSheet,i=e.rows,a=e.columns,s=e.values,l=e.metric,h=r.getRow(1).values.slice(1),d=function(t,e){var r,o=t.getRow(1).values,i=u(e,!0),a=function(e){var r,o=t.getColumn(e).values.slice(2),i=new Map,a=[],s=n(o);try{for(s.s();!(r=s.n()).done;){var u=r.value;if(null!=u){var f="string"==typeof u?u.toLowerCase():u;i.has(f)||(i.set(f,u),a.push(u))}}}catch(t){s.e(t)}finally{s.f()}return c(a)},s=[],l=n(f(1,o.length));try{for(l.s();!(r=l.n()).done;){var h=r.value,d=o[h],p=i[d]?a(h):null;s.push({name:d,sharedItems:p})}}catch(t){l.e(t)}finally{l.f()}return s}(r,h),p=d.reduce((function(t,e,r){return t[e.name]=r,t}),{});return{sourceSheet:r,rows:i=i.map((function(t){return p[t]})),columns:a=a.map((function(t){return p[t]})),values:s=s.map((function(t){return p[t]})),metric:l,cacheFields:d,cacheId:String(10+t.workbook.pivotTables.length),applyWidthHeightFormats:void 0!==e.applyWidthHeightFormats?e.applyWidthHeightFormats:"1"}}}},{"../utils/utils":28}],11:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,a(n.key),n)}}function a(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}var s=t("../utils/col-cache"),u=function(){function t(){o(this,t),this.decode(arguments)}return function(t,e,r){e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1})}(t,[{key:"setTLBR",value:function(t,e,r,n,o){if(arguments.length<4){var i=s.decodeAddress(t),a=s.decodeAddress(e);this.model={top:Math.min(i.row,a.row),left:Math.min(i.col,a.col),bottom:Math.max(i.row,a.row),right:Math.max(i.col,a.col),sheetName:r},this.setTLBR(i.row,i.col,a.row,a.col,o)}else this.model={top:Math.min(t,r),left:Math.min(e,n),bottom:Math.max(t,r),right:Math.max(e,n),sheetName:o}}},{key:"decode",value:function(e){switch(e.length){case 5:this.setTLBR(e[0],e[1],e[2],e[3],e[4]);break;case 4:this.setTLBR(e[0],e[1],e[2],e[3]);break;case 3:this.setTLBR(e[0],e[1],e[2]);break;case 2:this.setTLBR(e[0],e[1]);break;case 1:var r=e[0];if(r instanceof t)this.model={top:r.model.top,left:r.model.left,bottom:r.model.bottom,right:r.model.right,sheetName:r.sheetName};else if(r instanceof Array)this.decode(r);else if(r.top&&r.left&&r.bottom&&r.right)this.model={top:r.top,left:r.left,bottom:r.bottom,right:r.right,sheetName:r.sheetName};else{var n=s.decodeEx(r);n.top?this.model={top:n.top,left:n.left,bottom:n.bottom,right:n.right,sheetName:n.sheetName}:this.model={top:n.row,left:n.col,bottom:n.row,right:n.col,sheetName:n.sheetName}}break;case 0:this.model={top:0,left:0,bottom:0,right:0};break;default:throw new Error("Invalid number of arguments to _getDimensions() - ".concat(e.length))}}},{key:"top",get:function(){return this.model.top||1},set:function(t){this.model.top=t}},{key:"left",get:function(){return this.model.left||1},set:function(t){this.model.left=t}},{key:"bottom",get:function(){return this.model.bottom||1},set:function(t){this.model.bottom=t}},{key:"right",get:function(){return this.model.right||1},set:function(t){this.model.right=t}},{key:"sheetName",get:function(){return this.model.sheetName},set:function(t){this.model.sheetName=t}},{key:"_serialisedSheetName",get:function(){var t=this.model.sheetName;return t?/^[a-zA-Z0-9]*$/.test(t)?"".concat(t,"!"):"'".concat(t,"'!"):""}},{key:"expand",value:function(t,e,r,n){(!this.model.top||t<this.top)&&(this.top=t),(!this.model.left||e<this.left)&&(this.left=e),(!this.model.bottom||r>this.bottom)&&(this.bottom=r),(!this.model.right||n>this.right)&&(this.right=n)}},{key:"expandRow",value:function(t){if(t){var e=t.dimensions,r=t.number;e&&this.expand(r,e.min,r,e.max)}}},{key:"expandToAddress",value:function(t){var e=s.decodeEx(t);this.expand(e.row,e.col,e.row,e.col)}},{key:"tl",get:function(){return s.n2l(this.left)+this.top}},{key:"$t$l",get:function(){return"$".concat(s.n2l(this.left),"$").concat(this.top)}},{key:"br",get:function(){return s.n2l(this.right)+this.bottom}},{key:"$b$r",get:function(){return"$".concat(s.n2l(this.right),"$").concat(this.bottom)}},{key:"range",get:function(){return"".concat(this._serialisedSheetName+this.tl,":").concat(this.br)}},{key:"$range",get:function(){return"".concat(this._serialisedSheetName+this.$t$l,":").concat(this.$b$r)}},{key:"shortRange",get:function(){return this.count