@mescius/activereportsjs
Version:
ActiveReportsJS
8 lines • 1.6 MB
JavaScript
/*!
* @mescius/activereportsjs 6.1.0
* Description: ActiveReportsJS
* https://www.npmjs.com/package/@mescius/activereportsjs
* Copyright ©️ MESCIUS inc. All rights reserved.
* Licensed under the Commercial license
*/
(function(_r,vi){typeof exports=="object"&&typeof module<"u"?vi(exports):typeof define=="function"&&define.amd?define(["exports"],vi):(_r=typeof globalThis<"u"?globalThis:_r||self,vi((_r.MESCIUS=_r.MESCIUS||{},_r.MESCIUS.ActiveReportsJS=_r.MESCIUS.ActiveReportsJS||{},_r.MESCIUS.ActiveReportsJS.XlsxExport={})))})(this,(function(_r){"use strict";function vi(T,g){for(var n=0;n<g.length;n++){const l=g[n];if(typeof l!="string"&&!Array.isArray(l)){for(const y in l)if(y!=="default"&&!(y in T)){const i=Object.getOwnPropertyDescriptor(l,y);i&&Object.defineProperty(T,y,i.get?i:{enumerable:!0,get:()=>l[y]})}}}return Object.freeze(Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}))}function ii(T){return T&&T.__esModule&&Object.prototype.hasOwnProperty.call(T,"default")?T.default:T}function eh(T){if(Object.prototype.hasOwnProperty.call(T,"__esModule"))return T;var g=T.default;if(typeof g=="function"){var n=function l(){return this instanceof l?Reflect.construct(g,arguments,this.constructor):g.apply(this,arguments)};n.prototype=g.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(T).forEach(function(l){var y=Object.getOwnPropertyDescriptor(T,l);Object.defineProperty(n,l,y.get?y:{enumerable:!0,get:function(){return T[l]}})}),n}var kn={exports:{}},th;function Rp(){return th||(th=1,(function(T){var g=(function(n){var l=Object.prototype,y=l.hasOwnProperty,i=Object.defineProperty||function(S,E,C){S[E]=C.value},o,s=typeof Symbol=="function"?Symbol:{},r=s.iterator||"@@iterator",t=s.asyncIterator||"@@asyncIterator",e=s.toStringTag||"@@toStringTag";function h(S,E,C){return Object.defineProperty(S,E,{value:C,enumerable:!0,configurable:!0,writable:!0}),S[E]}try{h({},"")}catch{h=function(E,C,k){return E[C]=k}}function a(S,E,C,k){var P=E&&E.prototype instanceof A?E:A,$=Object.create(P.prototype),Q=new b(k||[]);return i($,"_invoke",{value:B(S,C,Q)}),$}n.wrap=a;function f(S,E,C){try{return{type:"normal",arg:S.call(E,C)}}catch(k){return{type:"throw",arg:k}}}var c="suspendedStart",m="suspendedYield",p="executing",w="completed",x={};function A(){}function R(){}function N(){}var F={};h(F,r,function(){return this});var z=Object.getPrototypeOf,j=z&&z(z(u([])));j&&j!==l&&y.call(j,r)&&(F=j);var q=N.prototype=A.prototype=Object.create(F);R.prototype=N,i(q,"constructor",{value:N,configurable:!0}),i(N,"constructor",{value:R,configurable:!0}),R.displayName=h(N,e,"GeneratorFunction");function H(S){["next","throw","return"].forEach(function(E){h(S,E,function(C){return this._invoke(E,C)})})}n.isGeneratorFunction=function(S){var E=typeof S=="function"&&S.constructor;return E?E===R||(E.displayName||E.name)==="GeneratorFunction":!1},n.mark=function(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,N):(S.__proto__=N,h(S,e,"GeneratorFunction")),S.prototype=Object.create(q),S},n.awrap=function(S){return{__await:S}};function U(S,E){function C($,Q,L,D){var I=f(S[$],S,Q);if(I.type==="throw")D(I.arg);else{var O=I.arg,V=O.value;return V&&typeof V=="object"&&y.call(V,"__await")?E.resolve(V.__await).then(function(W){C("next",W,L,D)},function(W){C("throw",W,L,D)}):E.resolve(V).then(function(W){O.value=W,L(O)},function(W){return C("throw",W,L,D)})}}var k;function P($,Q){function L(){return new E(function(D,I){C($,Q,D,I)})}return k=k?k.then(L,L):L()}i(this,"_invoke",{value:P})}H(U.prototype),h(U.prototype,t,function(){return this}),n.AsyncIterator=U,n.async=function(S,E,C,k,P){P===void 0&&(P=Promise);var $=new U(a(S,E,C,k),P);return n.isGeneratorFunction(E)?$:$.next().then(function(Q){return Q.done?Q.value:$.next()})};function B(S,E,C){var k=c;return function($,Q){if(k===p)throw new Error("Generator is already running");if(k===w){if($==="throw")throw Q;return _()}for(C.method=$,C.arg=Q;;){var L=C.delegate;if(L){var D=M(L,C);if(D){if(D===x)continue;return D}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(k===c)throw k=w,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);k=p;var I=f(S,E,C);if(I.type==="normal"){if(k=C.done?w:m,I.arg===x)continue;return{value:I.arg,done:C.done}}else I.type==="throw"&&(k=w,C.method="throw",C.arg=I.arg)}}}function M(S,E){var C=E.method,k=S.iterator[C];if(k===o)return E.delegate=null,C==="throw"&&S.iterator.return&&(E.method="return",E.arg=o,M(S,E),E.method==="throw")||C!=="return"&&(E.method="throw",E.arg=new TypeError("The iterator does not provide a '"+C+"' method")),x;var P=f(k,S.iterator,E.arg);if(P.type==="throw")return E.method="throw",E.arg=P.arg,E.delegate=null,x;var $=P.arg;if(!$)return E.method="throw",E.arg=new TypeError("iterator result is not an object"),E.delegate=null,x;if($.done)E[S.resultName]=$.value,E.next=S.nextLoc,E.method!=="return"&&(E.method="next",E.arg=o);else return $;return E.delegate=null,x}H(q),h(q,e,"Generator"),h(q,r,function(){return this}),h(q,"toString",function(){return"[object Generator]"});function d(S){var E={tryLoc:S[0]};1 in S&&(E.catchLoc=S[1]),2 in S&&(E.finallyLoc=S[2],E.afterLoc=S[3]),this.tryEntries.push(E)}function v(S){var E=S.completion||{};E.type="normal",delete E.arg,S.completion=E}function b(S){this.tryEntries=[{tryLoc:"root"}],S.forEach(d,this),this.reset(!0)}n.keys=function(S){var E=Object(S),C=[];for(var k in E)C.push(k);return C.reverse(),function P(){for(;C.length;){var $=C.pop();if($ in E)return P.value=$,P.done=!1,P}return P.done=!0,P}};function u(S){if(S){var E=S[r];if(E)return E.call(S);if(typeof S.next=="function")return S;if(!isNaN(S.length)){var C=-1,k=function P(){for(;++C<S.length;)if(y.call(S,C))return P.value=S[C],P.done=!1,P;return P.value=o,P.done=!0,P};return k.next=k}}return{next:_}}n.values=u;function _(){return{value:o,done:!0}}return b.prototype={constructor:b,reset:function(S){if(this.prev=0,this.next=0,this.sent=this._sent=o,this.done=!1,this.delegate=null,this.method="next",this.arg=o,this.tryEntries.forEach(v),!S)for(var E in this)E.charAt(0)==="t"&&y.call(this,E)&&!isNaN(+E.slice(1))&&(this[E]=o)},stop:function(){this.done=!0;var S=this.tryEntries[0],E=S.completion;if(E.type==="throw")throw E.arg;return this.rval},dispatchException:function(S){if(this.done)throw S;var E=this;function C(D,I){return $.type="throw",$.arg=S,E.next=D,I&&(E.method="next",E.arg=o),!!I}for(var k=this.tryEntries.length-1;k>=0;--k){var P=this.tryEntries[k],$=P.completion;if(P.tryLoc==="root")return C("end");if(P.tryLoc<=this.prev){var Q=y.call(P,"catchLoc"),L=y.call(P,"finallyLoc");if(Q&&L){if(this.prev<P.catchLoc)return C(P.catchLoc,!0);if(this.prev<P.finallyLoc)return C(P.finallyLoc)}else if(Q){if(this.prev<P.catchLoc)return C(P.catchLoc,!0)}else if(L){if(this.prev<P.finallyLoc)return C(P.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(S,E){for(var C=this.tryEntries.length-1;C>=0;--C){var k=this.tryEntries[C];if(k.tryLoc<=this.prev&&y.call(k,"finallyLoc")&&this.prev<k.finallyLoc){var P=k;break}}P&&(S==="break"||S==="continue")&&P.tryLoc<=E&&E<=P.finallyLoc&&(P=null);var $=P?P.completion:{};return $.type=S,$.arg=E,P?(this.method="next",this.next=P.finallyLoc,x):this.complete($)},complete:function(S,E){if(S.type==="throw")throw S.arg;return S.type==="break"||S.type==="continue"?this.next=S.arg:S.type==="return"?(this.rval=this.arg=S.arg,this.method="return",this.next="end"):S.type==="normal"&&E&&(this.next=E),x},finish:function(S){for(var E=this.tryEntries.length-1;E>=0;--E){var C=this.tryEntries[E];if(C.finallyLoc===S)return this.complete(C.completion,C.afterLoc),v(C),x}},catch:function(S){for(var E=this.tryEntries.length-1;E>=0;--E){var C=this.tryEntries[E];if(C.tryLoc===S){var k=C.completion;if(k.type==="throw"){var P=k.arg;v(C)}return P}}throw new Error("illegal catch attempt")},delegateYield:function(S,E,C){return this.delegate={iterator:u(S),resultName:E,nextLoc:C},this.method==="next"&&(this.arg=o),x}},n})(T.exports);try{regeneratorRuntime=g}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=g:Function("r","regeneratorRuntime = r")(g)}})(kn)),kn.exports}var Bp=Rp();const Ip=ii(Bp);function yi(T){throw new Error('Could not dynamically require "'+T+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var An={exports:{}};var rh;function Np(){return rh||(rh=1,(function(T,g){(function(n){T.exports=n()})((function(){return(function n(l,y,i){function o(t,e){if(!y[t]){if(!l[t]){var h=typeof yi=="function"&&yi;if(!e&&h)return h(t,!0);if(s)return s(t,!0);var a=new Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}var f=y[t]={exports:{}};l[t][0].call(f.exports,(function(c){return o(l[t][1][c]||c)}),f,f.exports,n,l,y,i)}return y[t].exports}for(var s=typeof yi=="function"&&yi,r=0;r<i.length;r++)o(i[r]);return o})({1:[function(n,l,y){const i=n("fs"),o=n("fast-csv"),s=n("dayjs/plugin/customParseFormat"),r=n("dayjs/plugin/utc"),t=n("dayjs").extend(s).extend(r),e=n("../utils/stream-buf"),{fs:{exists:h}}=n("../utils/utils"),a={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!"}};l.exports=class{constructor(f){this.workbook=f,this.worksheet=null}async readFile(f,c){if(c=c||{},!await h(f))throw new Error("File not found: "+f);const m=i.createReadStream(f),p=await this.read(m,c);return m.close(),p}read(f,c){return c=c||{},new Promise((m,p)=>{const w=this.workbook.addWorksheet(c.sheetName),x=c.dateFormats||["YYYY-MM-DD[T]HH:mm:ssZ","YYYY-MM-DD[T]HH:mm:ss","MM-DD-YYYY","YYYY-MM-DD"],A=c.map||function(N){if(N==="")return null;const F=Number(N);if(!Number.isNaN(F)&&F!==1/0)return F;const z=x.reduce((q,H)=>{if(q)return q;const U=t(N,H,!0);return U.isValid()?U:null},null);if(z)return new Date(z.valueOf());const j=a[N];return j!==void 0?j:N},R=o.parse(c.parserOptions).on("data",N=>{w.addRow(N.map(A))}).on("end",()=>{R.emit("worksheet",w)});R.on("worksheet",m).on("error",p),f.pipe(R)})}createInputStream(){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")}write(f,c){return new Promise((m,p)=>{c=c||{};const w=this.workbook.getWorksheet(c.sheetName||c.sheetId),x=o.format(c.formatterOptions);f.on("finish",()=>{m()}),x.on("error",p),x.pipe(f);const{dateFormat:A,dateUTC:R}=c,N=c.map||(j=>{if(j){if(j.text||j.hyperlink)return j.hyperlink||j.text||"";if(j.formula||j.result)return j.result||"";if(j instanceof Date)return A?R?t.utc(j).format(A):t(j).format(A):R?t.utc(j).format():t(j).format();if(j.error)return j.error;if(typeof j=="object")return JSON.stringify(j)}return j}),F=c.includeEmptyRows===void 0||c.includeEmptyRows;let z=1;w&&w.eachRow((j,q)=>{if(F)for(;z++<q-1;)x.write([]);const{values:H}=j;H.shift(),x.write(H.map(N)),z=q}),x.end()})}writeFile(f,c){const m={encoding:(c=c||{}).encoding||"utf8"},p=i.createWriteStream(f,m);return this.write(p,c)}async writeBuffer(f){const c=new e;return await this.write(c,f),c.read()}}},{"../utils/stream-buf":24,"../utils/utils":27,dayjs:230,"dayjs/plugin/customParseFormat":231,"dayjs/plugin/utc":232,"fast-csv":263,fs:216}],2:[function(n,l,y){const i=n("../utils/col-cache");class o{constructor(r,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(this.worksheet=r,t)if(typeof t=="string"){const h=i.decodeAddress(t);this.nativeCol=h.col+e,this.nativeColOff=0,this.nativeRow=h.row+e,this.nativeRowOff=0}else t.nativeCol!==void 0?(this.nativeCol=t.nativeCol||0,this.nativeColOff=t.nativeColOff||0,this.nativeRow=t.nativeRow||0,this.nativeRowOff=t.nativeRowOff||0):t.col!==void 0?(this.col=t.col+e,this.row=t.row+e):(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}static asInstance(r){return r instanceof o||r==null?r:new o(r)}get col(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth}set col(r){this.nativeCol=Math.floor(r),this.nativeColOff=Math.floor((r-this.nativeCol)*this.colWidth)}get row(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight}set row(r){this.nativeRow=Math.floor(r),this.nativeRowOff=Math.floor((r-this.nativeRow)*this.rowHeight)}get colWidth(){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}get rowHeight(){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}get model(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}}set model(r){this.nativeCol=r.nativeCol,this.nativeColOff=r.nativeColOff,this.nativeRow=r.nativeRow,this.nativeRowOff=r.nativeRowOff}}l.exports=o},{"../utils/col-cache":19}],3:[function(n,l,y){const i=n("../utils/col-cache"),o=n("../utils/under-dash"),s=n("./enums"),{slideFormula:r}=n("../utils/shared-formula"),t=n("./note");class e{constructor(f,c,m){if(!f||!c)throw new Error("A Cell needs a Row");this._row=f,this._column=c,i.validateAddress(m),this._address=m,this._value=h.create(e.Types.Null,this),this.style=this._mergeStyle(f.style,c.style,{}),this._mergeCount=0}get worksheet(){return this._row.worksheet}get workbook(){return this._row.worksheet.workbook}destroy(){delete this.style,delete this._value,delete this._row,delete this._column,delete this._address}get numFmt(){return this.style.numFmt}set numFmt(f){this.style.numFmt=f}get font(){return this.style.font}set font(f){this.style.font=f}get alignment(){return this.style.alignment}set alignment(f){this.style.alignment=f}get border(){return this.style.border}set border(f){this.style.border=f}get fill(){return this.style.fill}set fill(f){this.style.fill=f}get protection(){return this.style.protection}set protection(f){this.style.protection=f}_mergeStyle(f,c,m){const p=f&&f.numFmt||c&&c.numFmt;p&&(m.numFmt=p);const w=f&&f.font||c&&c.font;w&&(m.font=w);const x=f&&f.alignment||c&&c.alignment;x&&(m.alignment=x);const A=f&&f.border||c&&c.border;A&&(m.border=A);const R=f&&f.fill||c&&c.fill;R&&(m.fill=R);const N=f&&f.protection||c&&c.protection;return N&&(m.protection=N),m}get address(){return this._address}get row(){return this._row.number}get col(){return this._column.number}get $col$row(){return`$${this._column.letter}$${this.row}`}get type(){return this._value.type}get effectiveType(){return this._value.effectiveType}toCsvString(){return this._value.toCsvString()}addMergeRef(){this._mergeCount++}releaseMergeRef(){this._mergeCount--}get isMerged(){return this._mergeCount>0||this.type===e.Types.Merge}merge(f,c){this._value.release(),this._value=h.create(e.Types.Merge,this,f),c||(this.style=f.style)}unmerge(){this.type===e.Types.Merge&&(this._value.release(),this._value=h.create(e.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{}))}isMergedTo(f){return this._value.type===e.Types.Merge&&this._value.isMergedTo(f)}get master(){return this.type===e.Types.Merge?this._value.master:this}get isHyperlink(){return this._value.type===e.Types.Hyperlink}get hyperlink(){return this._value.hyperlink}get value(){return this._value.value}set value(f){this.type!==e.Types.Merge?(this._value.release(),this._value=h.create(h.getType(f),this,f)):this._value.master.value=f}get note(){return this._comment&&this._comment.note}set note(f){this._comment=new t(f)}get text(){return this._value.toString()}get html(){return o.escapeHtml(this.text)}toString(){return this.text}_upgradeToHyperlink(f){this.type===e.Types.String&&(this._value=h.create(e.Types.Hyperlink,this,{text:this._value.value,hyperlink:f}))}get formula(){return this._value.formula}get result(){return this._value.result}get formulaType(){return this._value.formulaType}get fullAddress(){const{worksheet:f}=this._row;return{sheetName:f.name,address:this.address,row:this.row,col:this.col}}get name(){return this.names[0]}set name(f){this.names=[f]}get names(){return this.workbook.definedNames.getNamesEx(this.fullAddress)}set names(f){const{definedNames:c}=this.workbook;c.removeAllNames(this.fullAddress),f.forEach(m=>{c.addEx(this.fullAddress,m)})}addName(f){this.workbook.definedNames.addEx(this.fullAddress,f)}removeName(f){this.workbook.definedNames.removeEx(this.fullAddress,f)}removeAllNames(){this.workbook.definedNames.removeAllNames(this.fullAddress)}get _dataValidations(){return this.worksheet.dataValidations}get dataValidation(){return this._dataValidations.find(this.address)}set dataValidation(f){this._dataValidations.add(this.address,f)}get model(){const{model:f}=this._value;return f.style=this.style,this._comment&&(f.comment=this._comment.model),f}set model(f){if(this._value.release(),this._value=h.create(f.type,this),this._value.model=f,f.comment)switch(f.comment.type){case"note":this._comment=t.fromModel(f.comment)}f.style?this.style=f.style:this.style={}}}e.Types=s.ValueType;const h={getType:a=>a==null?e.Types.Null:a instanceof String||typeof a=="string"?e.Types.String:typeof a=="number"?e.Types.Number:typeof a=="boolean"?e.Types.Boolean:a instanceof Date?e.Types.Date:a.text&&a.hyperlink?e.Types.Hyperlink:a.formula||a.sharedFormula?e.Types.Formula:a.richText?e.Types.RichText:a.sharedString?e.Types.SharedString:a.error?e.Types.Error:e.Types.JSON,types:[{t:e.Types.Null,f:class{constructor(a){this.model={address:a.address,type:e.Types.Null}}get value(){return null}set value(a){}get type(){return e.Types.Null}get effectiveType(){return e.Types.Null}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return""}release(){}toString(){return""}}},{t:e.Types.Number,f:class{constructor(a,f){this.model={address:a.address,type:e.Types.Number,value:f}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return e.Types.Number}get effectiveType(){return e.Types.Number}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}}},{t:e.Types.String,f:class{constructor(a,f){this.model={address:a.address,type:e.Types.String,value:f}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return e.Types.String}get effectiveType(){return e.Types.String}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return`"${this.model.value.replace(/"/g,'""')}"`}release(){}toString(){return this.model.value}}},{t:e.Types.Date,f:class{constructor(a,f){this.model={address:a.address,type:e.Types.Date,value:f}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return e.Types.Date}get effectiveType(){return e.Types.Date}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.value.toISOString()}release(){}toString(){return this.model.value.toString()}}},{t:e.Types.Hyperlink,f:class{constructor(a,f){this.model={address:a.address,type:e.Types.Hyperlink,text:f?f.text:void 0,hyperlink:f?f.hyperlink:void 0},f&&f.tooltip&&(this.model.tooltip=f.tooltip)}get value(){const a={text:this.model.text,hyperlink:this.model.hyperlink};return this.model.tooltip&&(a.tooltip=this.model.tooltip),a}set value(a){this.model={text:a.text,hyperlink:a.hyperlink},a.tooltip&&(this.model.tooltip=a.tooltip)}get text(){return this.model.text}set text(a){this.model.text=a}get hyperlink(){return this.model.hyperlink}set hyperlink(a){this.model.hyperlink=a}get type(){return e.Types.Hyperlink}get effectiveType(){return e.Types.Hyperlink}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.hyperlink}release(){}toString(){return this.model.text}}},{t:e.Types.Formula,f:class{constructor(a,f){this.cell=a,this.model={address:a.address,type:e.Types.Formula,shareType:f?f.shareType:void 0,ref:f?f.ref:void 0,formula:f?f.formula:void 0,sharedFormula:f?f.sharedFormula:void 0,result:f?f.result:void 0}}_copyModel(a){const f={},c=m=>{const p=a[m];p&&(f[m]=p)};return c("formula"),c("result"),c("ref"),c("shareType"),c("sharedFormula"),f}get value(){return this._copyModel(this.model)}set value(a){this.model=this._copyModel(a)}validate(a){switch(h.getType(a)){case e.Types.Null:case e.Types.String:case e.Types.Number:case e.Types.Date:break;case e.Types.Hyperlink:case e.Types.Formula:default:throw new Error("Cannot process that type of result value")}}get dependencies(){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)}}get formula(){return this.model.formula||this._getTranslatedFormula()}set formula(a){this.model.formula=a}get formulaType(){return this.model.formula?s.FormulaType.Master:this.model.sharedFormula?s.FormulaType.Shared:s.FormulaType.None}get result(){return this.model.result}set result(a){this.model.result=a}get type(){return e.Types.Formula}get effectiveType(){const a=this.model.result;return a==null?s.ValueType.Null:a instanceof String||typeof a=="string"?s.ValueType.String:typeof a=="number"?s.ValueType.Number:a instanceof Date?s.ValueType.Date:a.text&&a.hyperlink?s.ValueType.Hyperlink:a.formula?s.ValueType.Formula:s.ValueType.Null}get address(){return this.model.address}set address(a){this.model.address=a}_getTranslatedFormula(){if(!this._translatedFormula&&this.model.sharedFormula){const{worksheet:a}=this.cell,f=a.findCell(this.model.sharedFormula);this._translatedFormula=f&&r(f.formula,f.address,this.model.address)}return this._translatedFormula}toCsvString(){return""+(this.model.result||"")}release(){}toString(){return this.model.result?this.model.result.toString():""}}},{t:e.Types.Merge,f:class{constructor(a,f){this.model={address:a.address,type:e.Types.Merge,master:f?f.address:void 0},this._master=f,f&&f.addMergeRef()}get value(){return this._master.value}set value(a){a instanceof e?(this._master&&this._master.releaseMergeRef(),a.addMergeRef(),this._master=a):this._master.value=a}isMergedTo(a){return a===this._master}get master(){return this._master}get type(){return e.Types.Merge}get effectiveType(){return this._master.effectiveType}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return""}release(){this._master.releaseMergeRef()}toString(){return this.value.toString()}}},{t:e.Types.JSON,f:class{constructor(a,f){this.model={address:a.address,type:e.Types.String,value:JSON.stringify(f),rawValue:f}}get value(){return this.model.rawValue}set value(a){this.model.rawValue=a,this.model.value=JSON.stringify(a)}get type(){return e.Types.String}get effectiveType(){return e.Types.String}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.value}release(){}toString(){return this.model.value}}},{t:e.Types.SharedString,f:class{constructor(a,f){this.model={address:a.address,type:e.Types.SharedString,value:f}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return e.Types.SharedString}get effectiveType(){return e.Types.SharedString}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}}},{t:e.Types.RichText,f:class{constructor(a,f){this.model={address:a.address,type:e.Types.String,value:f}}get value(){return this.model.value}set value(a){this.model.value=a}toString(){return this.model.value.richText.map(a=>a.text).join("")}get type(){return e.Types.RichText}get effectiveType(){return e.Types.RichText}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return`"${this.text.replace(/"/g,'""')}"`}release(){}}},{t:e.Types.Boolean,f:class{constructor(a,f){this.model={address:a.address,type:e.Types.Boolean,value:f}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return e.Types.Boolean}get effectiveType(){return e.Types.Boolean}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.value?1:0}release(){}toString(){return this.model.value.toString()}}},{t:e.Types.Error,f:class{constructor(a,f){this.model={address:a.address,type:e.Types.Error,value:f}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return e.Types.Error}get effectiveType(){return e.Types.Error}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.toString()}release(){}toString(){return this.model.value.error.toString()}}}].reduce((a,f)=>(a[f.t]=f.f,a),[]),create(a,f,c){const m=this.types[a];if(!m)throw new Error("Could not create Value of type "+a);return new m(f,c)}};l.exports=e},{"../utils/col-cache":19,"../utils/shared-formula":23,"../utils/under-dash":26,"./enums":7,"./note":9}],4:[function(n,l,y){const i=n("../utils/under-dash"),o=n("./enums"),s=n("../utils/col-cache");class r{constructor(e,h,a){this._worksheet=e,this._number=h,a!==!1&&(this.defn=a)}get number(){return this._number}get worksheet(){return this._worksheet}get letter(){return s.n2l(this._number)}get isCustomWidth(){return this.width!==void 0&&this.width!==9}get defn(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel}}set defn(e){e?(this.key=e.key,this.width=e.width!==void 0?e.width:9,this.outlineLevel=e.outlineLevel,e.style?this.style=e.style:this.style={},this.header=e.header,this._hidden=!!e.hidden):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0)}get headers(){return this._header&&this._header instanceof Array?this._header:[this._header]}get header(){return this._header}set header(e){e!==void 0?(this._header=e,this.headers.forEach((h,a)=>{this._worksheet.getCell(a+1,this.number).value=h})):this._header=void 0}get key(){return this._key}set key(e){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=e,e&&this._worksheet.setColumnKey(this._key,this)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelCol)}toString(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})}equivalentTo(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&i.isEqual(this.style,e.style)}get isDefault(){if(this.isCustomWidth||this.hidden||this.outlineLevel)return!1;const e=this.style;return!e||!(e.font||e.numFmt||e.alignment||e.border||e.fill||e.protection)}get headerCount(){return this.headers.length}eachCell(e,h){const a=this.number;h||(h=e,e=null),this._worksheet.eachRow(e,(f,c)=>{h(f.getCell(a),c)})}get values(){const e=[];return this.eachCell((h,a)=>{h&&h.type!==o.ValueType.Null&&(e[a]=h.value)}),e}set values(e){if(!e)return;const h=this.number;let a=0;e.hasOwnProperty("0")&&(a=1),e.forEach((f,c)=>{this._worksheet.getCell(c+a,h).value=f})}_applyStyle(e,h){return this.style[e]=h,this.eachCell(a=>{a[e]=h}),h}get numFmt(){return this.style.numFmt}set numFmt(e){this._applyStyle("numFmt",e)}get font(){return this.style.font}set font(e){this._applyStyle("font",e)}get alignment(){return this.style.alignment}set alignment(e){this._applyStyle("alignment",e)}get protection(){return this.style.protection}set protection(e){this._applyStyle("protection",e)}get border(){return this.style.border}set border(e){this._applyStyle("border",e)}get fill(){return this.style.fill}set fill(e){this._applyStyle("fill",e)}static toModel(e){const h=[];let a=null;return e&&e.forEach((f,c)=>{f.isDefault?a&&(a=null):a&&f.equivalentTo(a)?a.max=c+1:(a={min:c+1,max:c+1,width:f.width!==void 0?f.width:9,style:f.style,isCustomWidth:f.isCustomWidth,hidden:f.hidden,outlineLevel:f.outlineLevel,collapsed:f.collapsed},h.push(a))}),h.length?h:void 0}static fromModel(e,h){const a=[];let f=1,c=0;for(h=(h=h||[]).sort((function(m,p){return m.min-p.min}));c<h.length;){const m=h[c++];for(;f<m.min;)a.push(new r(e,f++));for(;f<=m.max;)a.push(new r(e,f++,m))}return a.length?a:null}}l.exports=r},{"../utils/col-cache":19,"../utils/under-dash":26,"./enums":7}],5:[function(n,l,y){l.exports=class{constructor(i){this.model=i||{}}add(i,o){return this.model[i]=o}find(i){return this.model[i]}remove(i){this.model[i]=void 0}}},{}],6:[function(n,l,y){const i=n("../utils/under-dash"),o=n("../utils/col-cache"),s=n("../utils/cell-matrix"),r=n("./range"),t=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;l.exports=class{constructor(){this.matrixMap={}}getMatrix(e){return this.matrixMap[e]||(this.matrixMap[e]=new s)}add(e,h){const a=o.decodeEx(e);this.addEx(a,h)}addEx(e,h){const a=this.getMatrix(h);if(e.top)for(let f=e.left;f<=e.right;f++)for(let c=e.top;c<=e.bottom;c++){const m={sheetName:e.sheetName,address:o.n2l(f)+c,row:c,col:f};a.addCellEx(m)}else a.addCellEx(e)}remove(e,h){const a=o.decodeEx(e);this.removeEx(a,h)}removeEx(e,h){this.getMatrix(h).removeCellEx(e)}removeAllNames(e){i.each(this.matrixMap,h=>{h.removeCellEx(e)})}forEach(e){i.each(this.matrixMap,(h,a)=>{h.forEach(f=>{e(a,f)})})}getNames(e){return this.getNamesEx(o.decodeEx(e))}getNamesEx(e){return i.map(this.matrixMap,(h,a)=>h.findCellEx(e)&&a).filter(Boolean)}_explore(e,h){h.mark=!1;const{sheetName:a}=h,f=new r(h.row,h.col,h.row,h.col,a);let c,m;function p(x,A){const R=e.findCellAt(a,x,h.col);return!(!R||!R.mark)&&(f[A]=x,R.mark=!1,!0)}for(m=h.row-1;p(m,"top");m--);for(m=h.row+1;p(m,"bottom");m++);function w(x,A){const R=[];for(m=f.top;m<=f.bottom;m++){const N=e.findCellAt(a,m,x);if(!N||!N.mark)return!1;R.push(N)}f[A]=x;for(let N=0;N<R.length;N++)R[N].mark=!1;return!0}for(c=h.col-1;w(c,"left");c--);for(c=h.col+1;w(c,"right");c++);return f}getRanges(e,h){return(h=h||this.matrixMap[e])?(h.forEach(a=>{a.mark=!0}),{name:e,ranges:h.map(a=>a.mark&&this._explore(h,a)).filter(Boolean).map(a=>a.$shortRange)}):{name:e,ranges:[]}}normaliseMatrix(e,h){e.forEachInSheet(h,(a,f,c)=>{a&&(a.row===f&&a.col===c||(a.row=f,a.col=c,a.address=o.n2l(c)+f))})}spliceRows(e,h,a,f){i.each(this.matrixMap,c=>{c.spliceRows(e,h,a,f),this.normaliseMatrix(c,e)})}spliceColumns(e,h,a,f){i.each(this.matrixMap,c=>{c.spliceColumns(e,h,a,f),this.normaliseMatrix(c,e)})}get model(){return i.map(this.matrixMap,(e,h)=>this.getRanges(h,e)).filter(e=>e.ranges.length)}set model(e){const h=this.matrixMap={};e.forEach(a=>{const f=h[a.name]=new s;a.ranges.forEach(c=>{t.test(c.split("!").pop()||"")&&f.addCell(c)})})}}},{"../utils/cell-matrix":18,"../utils/col-cache":19,"../utils/under-dash":26,"./range":10}],7:[function(n,l,y){l.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(n,l,y){const i=n("../utils/col-cache"),o=n("./anchor");l.exports=class{constructor(s,r){this.worksheet=s,this.model=r}get model(){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 model(s){let{type:r,imageId:t,range:e,hyperlinks:h}=s;if(this.type=r,this.imageId=t,r==="image")if(typeof e=="string"){const a=i.decode(e);this.range={tl:new o(this.worksheet,{col:a.left,row:a.top},-1),br:new o(this.worksheet,{col:a.right,row:a.bottom},0),editAs:"oneCell"}}else this.range={tl:new o(this.worksheet,e.tl,0),br:e.br&&new o(this.worksheet,e.br,0),ext:e.ext,editAs:e.editAs,hyperlinks:h||e.hyperlinks}}}},{"../utils/col-cache":19,"./anchor":2}],9:[function(n,l,y){const i=n("../utils/under-dash");class o{constructor(r){this.note=r}get model(){let r=null;switch(typeof this.note){case"string":r={type:"note",note:{texts:[{text:this.note}]}};break;default:r={type:"note",note:this.note}}return i.deepMerge({},o.DEFAULT_CONFIGS,r)}set model(r){const{note:t}=r,{texts:e}=t;e.length===1&&Object.keys(e[0]).length===1?this.note=e[0].text:this.note=t}static fromModel(r){const t=new o;return t.model=r,t}}o.DEFAULT_CONFIGS={note:{margins:{insetmode:"auto",inset:[.13,.13,.25,.25]},protection:{locked:"True",lockText:"True"},editAs:"absolute"}},l.exports=o},{"../utils/under-dash":26}],10:[function(n,l,y){const i=n("../utils/col-cache");class o{constructor(){this.decode(arguments)}setTLBR(r,t,e,h,a){if(arguments.length<4){const f=i.decodeAddress(r),c=i.decodeAddress(t);this.model={top:Math.min(f.row,c.row),left:Math.min(f.col,c.col),bottom:Math.max(f.row,c.row),right:Math.max(f.col,c.col),sheetName:e},this.setTLBR(f.row,f.col,c.row,c.col,a)}else this.model={top:Math.min(r,e),left:Math.min(t,h),bottom:Math.max(r,e),right:Math.max(t,h),sheetName:a}}decode(r){switch(r.length){case 5:this.setTLBR(r[0],r[1],r[2],r[3],r[4]);break;case 4:this.setTLBR(r[0],r[1],r[2],r[3]);break;case 3:this.setTLBR(r[0],r[1],r[2]);break;case 2:this.setTLBR(r[0],r[1]);break;case 1:{const t=r[0];if(t instanceof o)this.model={top:t.model.top,left:t.model.left,bottom:t.model.bottom,right:t.model.right,sheetName:t.sheetName};else if(t instanceof Array)this.decode(t);else if(t.top&&t.left&&t.bottom&&t.right)this.model={top:t.top,left:t.left,bottom:t.bottom,right:t.right,sheetName:t.sheetName};else{const e=i.decodeEx(t);e.top?this.model={top:e.top,left:e.left,bottom:e.bottom,right:e.right,sheetName:e.sheetName}:this.model={top:e.row,left:e.col,bottom:e.row,right:e.col,sheetName:e.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() - "+r.length)}}get top(){return this.model.top||1}set top(r){this.model.top=r}get left(){return this.model.left||1}set left(r){this.model.left=r}get bottom(){return this.model.bottom||1}set bottom(r){this.model.bottom=r}get right(){return this.model.right||1}set right(r){this.model.right=r}get sheetName(){return this.model.sheetName}set sheetName(r){this.model.sheetName=r}get _serialisedSheetName(){const{sheetName:r}=this.model;return r?/^[a-zA-Z0-9]*$/.test(r)?r+"!":`'${r}'!`:""}expand(r,t,e,h){(!this.model.top||r<this.top)&&(this.top=r),(!this.model.left||t<this.left)&&(this.left=t),(!this.model.bottom||e>this.bottom)&&(this.bottom=e),(!this.model.right||h>this.right)&&(this.right=h)}expandRow(r){if(r){const{dimensions:t,number:e}=r;t&&this.expand(e,t.min,e,t.max)}}expandToAddress(r){const t=i.decodeEx(r);this.expand(t.row,t.col,t.row,t.col)}get tl(){return i.n2l(this.left)+this.top}get $t$l(){return`$${i.n2l(this.left)}$${this.top}`}get br(){return i.n2l(this.right)+this.bottom}get $b$r(){return`$${i.n2l(this.right)}$${this.bottom}`}get range(){return`${this._serialisedSheetName+this.tl}:${this.br}`}get $range(){return`${this._serialisedSheetName+this.$t$l}:${this.$b$r}`}get shortRange(){return this.count>1?this.range:this._serialisedSheetName+this.tl}get $shortRange(){return this.count>1?this.$range:this._serialisedSheetName+this.$t$l}get count(){return(1+this.bottom-this.top)*(1+this.right-this.left)}toString(){return this.range}intersects(r){return(!r.sheetName||!this.sheetName||r.sheetName===this.sheetName)&&!(r.bottom<this.top)&&!(r.top>this.bottom)&&!(r.right<this.left)&&!(r.left>this.right)}contains(r){const t=i.decodeEx(r);return this.containsEx(t)}containsEx(r){return(!r.sheetName||!this.sheetName||r.sheetName===this.sheetName)&&r.row>=this.top&&r.row<=this.bottom&&r.col>=this.left&&r.col<=this.right}forEachAddress(r){for(let t=this.left;t<=this.right;t++)for(let e=this.top;e<=this.bottom;e++)r(i.encodeAddress(e,t),e,t)}}l.exports=o},{"../utils/col-cache":19}],11:[function(n,l,y){const i=n("../utils/under-dash"),o=n("./enums"),s=n("../utils/col-cache"),r=n("./cell");l.exports=class{constructor(t,e){this._worksheet=t,this._number=e,this._cells=[],this.style={},this.outlineLevel=0}get number(){return this._number}get worksheet(){return this._worksheet}commit(){this._worksheet._commitRow(this)}destroy(){delete this._worksheet,delete this._cells,delete this.style}findCell(t){return this._cells[t-1]}getCellEx(t){let e=this._cells[t.col-1];if(!e){const h=this._worksheet.getColumn(t.col);e=new r(this,h,t.address),this._cells[t.col-1]=e}return e}getCell(t){if(typeof t=="string"){const e=this._worksheet.getColumnKey(t);t=e?e.number:s.l2n(t)}return this._cells[t-1]||this.getCellEx({address:s.encodeAddress(this._number,t),row:this._number,col:t})}splice(t,e){const h=t+e;for(var a=arguments.length,f=new Array(a>2?a-2:0),c=2;c<a;c++)f[c-2]=arguments[c];const m=f.length-e,p=this._cells.length;let w,x,A;if(m<0)for(w=t+f.length;w<=p;w++)A=this._cells[w-1],x=this._cells[w-m-1],x?(A=this.getCell(w),A.value=x.value,A.style=x.style,A._comment=x._comment):A&&(A.value=null,A.style={},A._comment=void 0);else if(m>0)for(w=p;w>=h;w--)x=this._cells[w-1],x?(A=this.getCell(w+m),A.value=x.value,A.style=x.style,A._comment=x._comment):this._cells[w+m-1]=void 0;for(w=0;w<f.length;w++)A=this.getCell(t+w),A.value=f[w],A.style={},A._comment=void 0}eachCell(t,e){if(e||(e=t,t=null),t&&t.includeEmpty){const h=this._cells.length;for(let a=1;a<=h;a++)e(this.getCell(a),a)}else this._cells.forEach((h,a)=>{h&&h.type!==o.ValueType.Null&&e(h,a+1)})}addPageBreak(t,e){const h=this._worksheet,a=Math.max(0,t-1)||0,f=Math.max(0,e-1)||16838,c={id:this._number,max:f,man:1};a&&(c.min=a),h.rowBreaks.push(c)}get values(){const t=[];return this._cells.forEach(e=>{e&&e.type!==o.ValueType.Null&&(t[e.col]=e.value)}),t}set values(t){if(this._cells=[],t)if(t instanceof Array){let e=0;t.hasOwnProperty("0")&&(e=1),t.forEach((h,a)=>{h!==void 0&&(this.getCellEx({address:s.encodeAddress(this._number,a+e),row:this._number,col:a+e}).value=h)})}else this._worksheet.eachColumnKey((e,h)=>{t[h]!==void 0&&(this.getCellEx({address:s.encodeAddress(this._number,e.number),row:this._number,col:e.number}).value=t[h])})}get hasValues(){return i.some(this._cells,t=>t&&t.type!==o.ValueType.Null)}get cellCount(){return this._cells.length}get actualCellCount(){let t=0;return this.eachCell(()=>{t++}),t}get dimensions(){let t=0,e=0;return this._cells.forEach(h=>{h&&h.type!==o.ValueType.Null&&((!t||t>h.col)&&(t=h.col),e<h.col&&(e=h.col))}),t>0?{min:t,max:e}:null}_applyStyle(t,e){return this.style[t]=e,this._cells.forEach(h=>{h&&(h[t]=e)}),e}get numFmt(){return this.style.numFmt}set numFmt(t){this._applyStyle("numFmt",t)}get font(){return this.style.font}set font(t){this._applyStyle("font",t)}get alignment(){return this.style.alignment}set alignment(t){this._applyStyle("alignment",t)}get protection(){return this.style.protection}set protection(t){this._applyStyle("protection",t)}get border(){return this.style.border}set border(t){this._applyStyle("border",t)}get fill(){return this.style.fill}set fill(t){this._applyStyle("fill",t)}get hidden(){return!!this._hidden}set hidden(t){this._hidden=t}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(t){this._outlineLevel=t}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelRow)}get model(){const t=[];let e=0,h=0;return this._cells.forEach(a=>{if(a){const f=a.model;f&&((!e||e>a.col)&&(e=a.col),h<a.col&&(h=a.col),t.push(f))}}),this.height||t.length?{cells:t,number:this.number,min:e,max:h,height:this.height,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed}:null}set model(t){if(t.number!==this._number)throw new Error("Invalid row number in model");let e;this._cells=[],t.cells.forEach(h=>{switch(h.type){case r.Types.Merge:break;default:{let a;if(h.address)a=s.decodeAddress(h.address);else if(e){const{row:f}=e,c=e.col+1;a={row:f,col:c,address:s.encodeAddress(f,c),$col$row:`$${s.n2l(c)}$${f}`}}e=a,this.getCellEx(a).model=h;break}}}),t.height?this.height=t.height:delete this.height,this.hidden=t.hidden,this.outlineLevel=t.outlineLevel||0,this.style=t.style&&JSON.parse(JSON.stringify(t.style))||{}}}},{"../utils/col-cache":19,"../utils/under-dash":26,"./cell":3,"./enums":7}],12:[function(n,l,y){const i=n("../utils/col-cache");class o{constructor(r,t,e){this.table=r,this.column=t,this.index=e}_set(r,t){this.table.cacheState(),this.column[r]=t}get name(){return this.column.name}set name(r){this._set("name",r)}get filterButton(){return this.column.filterButton}set filterButton(r){this.column.filterButton=r}get style(){return this.column.style}set style(r){this.column.style=r}get totalsRowLabel(){return this.column.totalsRowLabel}set totalsRowLabel(r){this._set("totalsRowLabel",r)}get totalsRowFunction(){return this.column.totalsRowFunction}set totalsRowFunction(r){this._set("totalsRowFunction",r)}get totalsRowResult(){return this.column.totalsRowResult}set totalsRowResult(r){this._set("totalsRowResult",r)}get totalsRowFormula(){return this.column.totalsRowFormula}set totalsRowFormula(r){this._set("totalsRowFormula",r)}}l.exports=class{constructor(s,r){this.worksheet=s,r&&(this.table=r,this.validate(),this.store())}getFormula(s){switch(s.totalsRowFunction){case"none":return null;case"average":return`SUBTOTAL(101,${this.table.name}[${s.name}])`;case"countNums":return`SUBTOTAL(102,${this.table.name}[${s.name}])`;case"count":return`SUBTOTAL(103,${this.table.name}[${s.name}])`;case"max":return`SUBTOTAL(104,${this.table.name}[${s.name}])`;case"min":return`SUBTOTAL(105,${this.table.name}[${s.name}])`;case"stdDev":return`SUBTOTAL(106,${this.table.name}[${s.name}])`;case"var":return`SUBTOTAL(107,${this.table.name}[${s.name}])`;case"sum":return`SUBTOTAL(109,${this.table.name}[${s.name}])`;case"custom":return s.totalsRowFormula;default:throw new Error("Invalid Totals Row Function: "+s.totalsRowFunction)}}get width(){return this.table.columns.length}get height(){return this.table.rows.length}get filterHeight(){return this.height+(this.table.headerRow?1:0)}get tableHeight(){return this.filterHeight+(this.table.totalsRow?1:0)}validate(){const{table:s}=this,r=(m,p,w)=>{m[p]===void 0&&(m[p]=w)};r(s,"headerRow",!0),r(s,"totalsRow",!1),r(s,"style",{}),r(s.style,"theme","TableStyleMedium2"),r(s.style,"showFirstColumn",!1),r(s.style,"showLastColumn",!1),r(s.style,"showRowStripes",!1),r(s.style,"showColumnStripes",!1);const t=(m,p)=>{if(!m)throw new Error(p)};t(s.ref,"Table must have ref"),t(s.columns,"Table must have column definitions"),t(s.rows,"Table must have row definitions"),s.tl=i.decodeAddress(s.ref);const{row:e,col:h}=s.tl;t(e>0,"Table must be on valid row"),t(h>0,"Table must be on valid col");const{width:a,filterHeight:f,tableHeight:c}=this;s.autoFilterRef=i.encode(e,h,e+f-1,h+a-1),s.tableRef=i.encode(e,h,e+c-1,h+a-1),s.columns.forEach((m,p)=>{t(m.name,`Column ${p} must have a name`),p===0?r(m,"totalsRowLabel","Total"):(r(m,"totalsRowFunction","none"),m.totalsRowFormula=this.getFormula(m))})}store(){const s=(f,c)=>{c&&Object.keys(c).forEach(m=>{f[m]=c[m]})},{worksheet:r,table:t}=this,{row:e,col:h}=t.tl;let a=0;if(t.headerRow){const f=r.getRow(e+a++);t.columns.forEach((c,m)=>{const{style:p,name:w}=c,x=f.getCell(h+m);x.value=w,s(x,p)})}if(t.rows.forEach(f=>{const c=r.getRow(e+a++);f.forEach((m,p)=>{const w=c.getCell(h+p);w.value=m,s(w,t.columns[p].style)})}),t.totalsRow){const f=r.getRow(e+a++);t.columns.forEach((c,m)=>{const p=f.getCell(h+m);if(m===0)p.value=c.totalsRowLabel;else{const w=this.getFormula(c);p.value=w?{formula:c.totalsRowFormula,result:c.totalsRowResult}:null}s(p,c.style)})}}load(s){const{table:r}=this,{row:t,col:e}=r.tl;let h=0;if(r.headerRow){const a=s.getRow(t+h++);r.columns.forEach((f,c)=>{a.getCell(e+c).value=f.name})}if(r.rows.forEach(a=>{const f=s.getRow(t+h++);a.forEach((c,m)=>{f.getCell(e+m).value=c})}),r.totalsRow){const a=s.getRow(t+h++);r.columns.forEach((f,c)=>{const m=a.getCell(e+c);c===0?m.value=f.totalsRowLabel:this.getFormula(f)&&(m.value={formula:f.totalsRowFormula,result:f.totalsRowResult})})}}get model(){return this.table}set model(s){this.table=s}cacheState(){this._cache||(this._cache={ref:this.ref,width:this.width,tableHeight:this.tableHeight})}commit(){if(!this._cache)return;this.validate();const s=i.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(let r=0;r<this._cache.tableHeight;r++){const t=this.worksheet.getRow(s.row+r);for(let e=0;e<this._cache.width;e++)t.getCell(s.col+e).value=null}else{for(let r=this.tableHeight;r<this._cache.tableHeight;r++){const t=this.worksheet.getRow(s.row+r);for(let e=0;e<this._cache.width;e++)t.getCell(s.col+e).value=null}for(let r=0;r<this.tableHeight;r++){const t=this.worksheet.getRow(s.row+r);for(let e=this.width;e<this._cache.width;e++)t.getCell(s.col+e).value=null}}this.store()}addRow(s,r){this.cacheState(),r===void 0?this.table.rows.push(s):this.table.rows.splice(r,0,s)}removeRows(s){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;this.cacheState(),this.table.rows.splice(s,r)}getColumn(s){const r=this.table.columns[s];return new o(this,r,s)}addColumn(s,r,t){this.cacheState(),t===void 0?(this.table.columns.push(s),this.table.rows.forEach((e,h)=>{e.push(r[h])})):(this.table.columns.splice(t,0,s),this.table.rows.forEach((e,h)=>{e.splice(t,0,r[h])}))}removeColumns(s){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;this.cacheState(),this.table.columns.splice(s,r),this.table.rows.forEach(t=>{t.splice(s,r)})}_assign(s,r,t){this.cacheState(),s[r]=t}get ref(){return this.table.ref}set ref(s){this._assign(this.table,"ref",s)}get name(){return this.table.name}set name(s){this.table.name=s}get displayName(){return this.table.displyName||this.table.name}set displayNamename(s){this.table.displayName=s}get headerRow(){return this.table.headerRow}set headerRow(s){this._assign(this.table,"headerRow",s)}get totalsRow(){return this.table.totalsRow}set totalsRow(s){this._assign(this.table,"totalsRow",s)}get theme(){return this.table.style.name}set theme(s){this.table.style.name=s}get showFirstColumn(){return this.table.style.showFirstColumn}set showFirstColumn(s){this.table.style.showFirstColumn=s}get showLastColumn(){return this.table.style.showLastColumn}set showLastColumn(s){this.table.style.showLastColumn=s}get showRowStripes(){return this.table.style.showRowStripes}set showRowStripes(s){this.table.style.showRowStripes=s}get showColumnStripes(){return this.table.style.showColumnStripes}set showColumnStripes(s){this.table.style.showColumnStripes=s}}},{"../utils/col-cache":19}],13:[function(n,l,y){const i=n("./worksheet"),o=n("./defined-names"),s=n("../xlsx/xlsx"),r=n("../csv/csv");l.exports=class{constructor(){this.category="",this.company="",this.created=new Date,this.description="",this.keywords="",this.manager="",this.modified=this.created,this.properties={},this.calcProperties={},this._worksheets=[],this.subject="",this.title="",this.views=[],this.media=[],this._definedNames=new o}get xlsx(){return this._xlsx||(this._xlsx=new s(this)),this._xlsx}get csv(){return this._csv||(this._csv=new r(this)),this._csv}get nextId(){for(let t=1;t<this._worksheets.length;t++)if(!this._worksheets[t])return t;return this._worksheets.length||1}addWorksheet(t,e){const h=this.nextId;e&&(typeof e=="string"?(console.trace('tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { argb: "rbg value" } }'),e={properties:{tabColor:{argb:e}}}):(e.argb||e.theme||e.indexed)&&(console.trace("tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { ... } }"),e={properties:{tabColor:e}}));const a=this._worksheets.reduce((m,p)=>(p&&p.orderNo)>m?p.orderNo:m,0),f=Object.assign({},e,{id:h,name:t,orderNo:a+1,workbook:this}),c=new i(f);return this._worksheets[h]=c,c}removeWorksheetEx(t){delete this._worksheets[t.id]}removeWorksheet(t){const e=this.getWorksheet(t);e&&e.destroy()}getWorksheet(t){return t===void 0?this._worksheets.find(Boolean):typeof t=="number"?this._worksheets[t]:typeof t=="string"?this._worksheets.find(e=>e&&e.name===t):void 0}get worksheets(){return this._worksheets.slice(1).sort((t,e)=>t.orderNo-e.orderNo).filter(Boolean)}eachSheet(t){this.worksheets.forEach(e=>{t(e,e.id)})}get definedNames(){return this._definedNames}clearThemes(){this._themes=void 0}addImage(t){const e=this.media.length;return this.media.push(Object.assign({},t,{type:"image"})),e}getImage(t){return this.media[t]}get model(){return{creator:this.creator||"Unknown",lastModifiedBy:this.lastModifiedBy||"Unknown",lastPrinted:this.lastPrinted,created:this.created,modified:this.modified,properties:this.properties,worksheets:this.worksheets.map(t=>t.model),sheets:this.worksheets.map(t=>t.model).filter(Boolean),definedNames:this._definedNames.model,views:this.views,company:this.company,manager:this.manager,title:this.title,subject:this.subject,keywords:this.keywords,category:this.category,description:this.description,language:this.language,revision:this.revision,contentStatus:this.contentStatus,themes:this._themes,media:this.media,calcProperties:this.calcProperties}}set model(t){t