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