}returnres};exports.findCompression=function(compressionMethod){for(varmethodincompressions){if(!compressions.hasOwnProperty(method)){continue}if(compressions[method].magic===compressionMethod){returncompressions[method]}}returnnull};exports.isRegExp=function(object){returnObject.prototype.toString.call(object)==="[object RegExp]"}},{"./compressions":3,"./nodeBuffer":11,"./support":17}],22:[function(_dereq_,module,exports){"use strict";varStringReader=_dereq_("./stringReader");varNodeBufferReader=_dereq_("./nodeBufferReader");varUint8ArrayReader=_dereq_("./uint8ArrayReader");varutils=_dereq_("./utils");varsig=_dereq_("./signature");varZipEntry=_dereq_("./zipEntry");varsupport=_dereq_("./support");varjszipProto=_dereq_("./object");functionZipEntries(data,loadOptions){this.files=[];this.loadOptions=loadOptions;if(data){this.load(data)}}ZipEntries.prototype={checkSignature:function(expectedSignature){varsignature=this.reader.readString(4);if(signature!==expectedSignature){thrownewError("Corrupted zip or bug : unexpected signature "+"("+utils.pretty(signature)+", expected "+utils.pretty(expectedSignature)+")")}},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2);this.diskWithCentralDirStart=this.reader.readInt(2);this.centralDirRecordsOnThisDisk=this.reader.readInt(2);this.centralDirRecords=this.reader.readInt(2);this.centralDirSize=this.reader.readInt(4);this.centralDirOffset=this.reader.readInt(4);this.zipCommentLength=this.reader.readInt(2);this.zipComment=this.reader.readString(this.zipCommentLength);this.zipComment=jszipProto.utf8decode(this.zipComment)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8);this.versionMadeBy=this.reader.readString(2);this.versionNeeded=this.reader.readInt(2);this.diskNumber=this.reader.readInt(4);this.diskWithCentralDirStart=this.reader.readInt(4);this.centralDirRecordsOnThisDisk=this.reader.readInt(8);this.centralDirRecords=this.reader.readInt(8);this.centralDirSize=this.reader.readInt(8);this.centralDirOffset=this.reader.readInt(8);this.zip64ExtensibleData={};varextraDataSize=this.zip64EndOfCentralSize-44,index=0,extraFieldId,extraFieldLength,extraFieldValue;while(index<extraDataSize){extraFieldId=this.reader.readInt(2);extraFieldLength=this.reader.readInt(4);extraFieldValue=this.reader.readString(extraFieldLength);this.zip64ExtensibleData[extraFieldId]={id:extraFieldId,length:extraFieldLength,value:extraFieldValue}}},readBlockZip64EndOfCentralLocator:function(){this.diskWithZip64CentralDirStart=this.reader.readInt(4);this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8);this.disksCount=this.reader.readInt(4);if(this.disksCount>1){thrownewError("Multi-volumes zip are not supported")}},readLocalFiles:function(){vari,file;for(i=0;i<this.files.length;i++){file=this.files[i];this.reader.setIndex(file.localHeaderOffset);this.checkSignature(sig.LOCAL_FILE_HEADER);file.readLocalPart(this.reader);file.handleUTF8()}},readCentralDir:function(){varfile;this.reader.setIndex(this.centralDirOffset);while(this.reader.readString(4)===sig.CENTRAL_FILE_HEADER){file=newZipEntry({zip64:this.zip64},this.loadOptions);file.readCentralPart(this.reader);this.files.push(file)}},readEndOfCentral:function(){varoffset=this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);if(offset===-1){thrownewError("Corrupted zip : can't find end of central directory")}this.reader.setIndex(offset);this.checkSignature(sig.CENTRAL_DIRECTORY_END);this.readBlockEndOfCentral();if(this.diskNumber===utils.MAX_VALUE_16BITS||this.diskWithCentralDirStart===utils.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===utils.MAX_VALUE_16BITS||this.centralDirRecords===utils.MAX_VALUE_16BITS||this.centralDirSize===utils.MAX_VALUE_32BITS||this.centralDirOffset===utils.MAX_VALUE_32BITS){this.zip64=true;offset=this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);if(offset===-1){thrownewError("Corrupted zip : can't find the ZIP64 end of central directory locator")}this.reader.setIndex(offset);this.checkSignature(sig.ZIP64_CENTRAL_D
for(C=1;C<=(lines[R].length-start)/10+1;++C)set_text_arr(lines[R].slice(start+(C-1)*10,start+C*10).trim(),arr,R,C,o)}returnarr}functiondsv_to_sheet_str(str,opts){varo=opts||{};varsep="";if(DENSE!=null&&o.dense==null)o.dense=DENSE;varws=o.dense?[]:{};varrange={s:{c:0,r:0},e:{c:0,r:0}};if(str.substr(0,4)=="sep="&&str.charCodeAt(5)==10){sep=str.charAt(4);str=str.substr(6)}elseif(str.substr(0,1024).indexOf("\t")==-1)sep=",";elsesep="\t";varR=0,C=0,v=0;varstart=0,end=0,sepcc=sep.charCodeAt(0),instr=false,cc=0;str=str.replace(/\r\n/gm,"\n");var_re=o.dateNF!=null?dateNF_regex(o.dateNF):null;functionfinish_cell(){vars=str.slice(start,end);varcell={};if(o.raw){cell.t="s";cell.v=s}elseif(s.charCodeAt(0)==61){cell.t="n";cell.f=s.substr(1)}elseif(s=="TRUE"){cell.t="b";cell.v=true}elseif(s=="FALSE"){cell.t="b";cell.v=false}elseif(!isNaN(v=+s)){cell.t="n";cell.w=s;cell.v=v}elseif(!isNaN(fuzzydate(s).getDate())||_re&&s.match(_re)){cell.z=o.dateNF||SSF._table[14];vark=0;if(_re&&s.match(_re)){s=dateNF_fix(s,o.dateNF,s.match(_re)||[]);k=1}if(o.cellDates){cell.t="d";cell.v=parseDate(s,k)}else{cell.t="n";cell.v=datenum(parseDate(s,k))}cell.w=SSF.format(cell.z,cell.vinstanceofDate?datenum(cell.v):cell.v)}else{cell.t="s";if(s.charAt(0)=='"'&&s.charAt(s.length-1)=='"')s=s.slice(1,-1).replace(/""/g,'"');cell.v=s}if(o.dense){if(!ws[R])ws[R]=[];ws[R][C]=cell}elsews[encode_cell({c:C,r:R})]=cell;start=end+1;if(range.e.c<C)range.e.c=C;if(range.e.r<R)range.e.r=R;if(cc==sepcc)++C;else{C=0;++R}}for(;end<str.length;++end)switch(cc=str.charCodeAt(end)){case34:instr=!instr;break;casesepcc:;case10:;case13:if(!instr)finish_cell();break;default:break;}if(end-start>0)finish_cell();ws["!ref"]=encode_range(range);returnws}functionprn_to_sheet_str(str,opts){if(str.substr(0,4)=="sep=")returndsv_to_sheet_str(str,opts);if(str.indexOf("\t")>=0||str.indexOf(",")>=0)returndsv_to_sheet_str(str,opts);returnaoa_to_sheet(prn_to_aoa_str(str,opts),opts)}functionprn_to_sheet(d,opts){varstr="",bytes=firstbyte(d,opts);switch(opts.type){case"base64":str=Base64.decode(d);break;case"binary":str=d;break;case"buffer":str=d.toString("binary");break;case"array":str=cc2str(d);break;default:thrownewError("Unrecognized type "+opts.type);}if(bytes[0]==239&&bytes[1]==187&&bytes[2]==191)str=utf8read(str);returnprn_to_sheet_str(str,opts)}functionprn_to_workbook(d,opts){returnsheet_to_workbook(prn_to_sheet(d,opts),opts)}functionsheet_to_prn(ws,opts){varo=[];varr=decode_range(ws["!ref"]),cell;vardense=Array.isArray(ws);for(varR=r.s.r;R<=r.e.r;++R){varoo=[];for(varC=r.s.c;C<=r.e.c;++C){varcoord=encode_cell({r:R,c:C});cell=dense?(ws[R]||[])[C]:ws[coord];if(!cell||cell.v==null){oo.push(" ");continue}varw=(cell.w||(format_cell(cell),cell.w)||"").substr(0,10);while(w.length<10)w+=" ";oo.push(w+(C==0?" ":""))}o.push(oo.join(""))}returno.join("\n")}return{to_workbook:prn_to_workbook,to_sheet:prn_to_sheet,from_sheet:sheet_to_prn}}();functionread_wb_ID(d,opts){varo=opts||{},OLD_WTF=!!o.WTF;o.WTF=true;try{varout=SYLK.to_workbook(d,o);o.WTF=OLD_WTF;returnout}catch(e){o.WTF=OLD_WTF;if(!e.message.match(/SYLK bad record ID/)&&OLD_WTF)throwe;returnPRN.to_workbook(d,opts)}}varWK_=function(){functionlotushopper(data,cb,opts){if(!data)return;prep_blob(data,data.l||0);varEnum=opts.Enum||WK1Enum;while(data.l<data.length){varRT=data.read_shift(2);varR=Enum[RT]||Enum[255];varlength=data.read_shift(2);vartgt=data.l+length;vard=R.f(data,length,opts);data.l=tgt;if(cb(d,R.n,RT))return}}functionlotus_to_workbook(d,opts){switch(opts.type){case"base64":returnlotus_to_workbook_buf(s2a(Base64.decode(d)),opts);case"binary":returnlotus_to_workbook_buf(s2a(d),opts);case"buffer":;case"array":returnlotus_to_workbook_buf(d,opts);}throw"Unsupported type "+opts.type}functionlotus_to_workbook_buf(d,opts){if(!d)returnd;varo=opts||{};if(DENSE!=null&&o.dense==null)o.dense=DENSE;vars=o.dense?[]:{},n="Sheet1",sidx=0;varsheets={},snames=[n];varrefguess={s:{r:0,c:0},e:{r:0,c:0}};if(d[2]==2)o.Enum=WK1Enum;elseif(d[2]==26)o.Enum=WK3Enum;elseif(d[2]==14){o.E
if(!c.t)c.t="";deletec.rfx;out.push(c);break;case35:pass=true;break;case36:pass=false;break;case37:break;case38:break;default:if((R_n||"").indexOf("Begin")>0){}elseif((R_n||"").indexOf("End")>0){}elseif(!pass||opts.WTF)thrownewError("Unexpected record "+RT+" "+R_n);}});returnout}functionwrite_comments_bin(data,opts){varba=buf_array();variauthor=[];write_record(ba,"BrtBeginComments");{write_record(ba,"BrtBeginCommentAuthors");data.forEach(function(comment){comment[1].forEach(function(c){if(iauthor.indexOf(c.a)>-1)return;iauthor.push(c.a.substr(0,54));write_record(ba,"BrtCommentAuthor",write_BrtCommentAuthor(c.a))})});write_record(ba,"BrtEndCommentAuthors")}{write_record(ba,"BrtBeginCommentList");data.forEach(function(comment){comment[1].forEach(function(c){c.iauthor=iauthor.indexOf(c.a);varrange={s:decode_cell(comment[0]),e:decode_cell(comment[0])};write_record(ba,"BrtBeginComment",write_BrtBeginComment([range,c]));if(c.t&&c.t.length>0)write_record(ba,"BrtCommentText",write_BrtCommentText(c));write_record(ba,"BrtEndComment");deletec.iauthor})});write_record(ba,"BrtEndCommentList")}write_record(ba,"BrtEndComments");returnba.end()}RELS.DS="http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet";RELS.MS="http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet";functionparse_ds_bin(data,opts,rels,wb,themes,styles){return{"!type":"dialog"}}functionparse_ds_xml(data,opts,rels,wb,themes,styles){return{"!type":"dialog"}}functionparse_ms_bin(data,opts,rels,wb,themes,styles){return{"!type":"macro"}}functionparse_ms_xml(data,opts,rels,wb,themes,styles){return{"!type":"macro"}}varrc_to_a1=function(){varrcregex=/(^|[^A-Za-z])R(\[?)(-?\d+|)\]?C(\[?)(-?\d+|)\]?/g;varrcbase={r:0,c:0};functionrcfunc($$,$1,$2,$3,$4,$5){varR=$3.length>0?parseInt($3,10)|0:0,C=$5.length>0?parseInt($5,10)|0:0;if(C<0&&$4.length===0)C=0;varcRel=false,rRel=false;if($4.length>0||$5.length==0)cRel=true;if(cRel)C+=rcbase.c;else--C;if($2.length>0||$3.length==0)rRel=true;if(rRel)R+=rcbase.r;else--R;return$1+(cRel?"":"$")+encode_col(C)+(rRel?"":"$")+encode_row(R)}returnfunctionrc_to_a1(fstr,base){rcbase=base;returnfstr.replace(rcregex,rcfunc)}}();varcrefregex=/(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)([1-9]\d{0,5}|10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6])(?![_.\(A-Za-z0-9])/g;vara1_to_rc=function(){returnfunctiona1_to_rc(fstr,base){returnfstr.replace(crefregex,function($0,$1,$2,$3,$4,$5,off,str){varc=decode_col($3)-base.c;varr=decode_row($5)-base.r;return$1+"R"+(r==0?"":"["+r+"]")+"C"+(c==0?"":"["+c+"]")})}}();functionshift_formula_str(f,delta){returnf.replace(crefregex,function($0,$1,$2,$3,$4,$5,off,str){return$1+($2=="$"?$2+$3:encode_col(decode_col($3)+delta.c))+($4=="$"?$4+$5:encode_row(decode_row($5)+delta.r))})}functionshift_formula_xlsx(f,range,cell){varr=decode_range(range),s=r.s,c=decode_cell(cell);vardelta={r:c.r-s.r,c:c.c-s.c};returnshift_formula_str(f,delta)}functionparseread(l){returnfunction(blob,length){blob.l+=l;return}}functionparseread1(blob){blob.l+=1;return}functionparse_ColRelU(blob,length){varc=blob.read_shift(length==1?1:2);return[c&16383,c>>14&1,c>>15&1]}functionparse_RgceArea(blob,length,opts){varw=2;if(opts){if(opts.biff>=2&&opts.biff<=5)returnparse_RgceArea_BIFF2(blob,length,opts);elseif(opts.biff==12)w=4}varr=blob.read_shift(w),R=blob.read_shift(w);varc=parse_ColRelU(blob,2);varC=parse_ColRelU(blob,2);return{s:{r:r,c:c[0],cRel:c[1],rRel:c[2]},e:{r:R,c:C[0],cRel:C[1],rRel:C[2]}}}functionparse_RgceArea_BIFF2(blob){varr=parse_ColRelU(blob,2),R=parse_ColRelU(blob,2);varc=blob.read_shift(1);varC=blob.read_shift(1);return{s:{r:r[0],c:c,cRel:r[1],rRel:r[2]},e:{r:R[0],c:C,cRel:R[1],rRel:R[2]}}}functionparse_RgceAreaRel(blob,length){varr=blob.read_shift(length==12?4:2),R=blob.read_shift(length==12?4:2);varc=parse_ColRelU(blob,2);varC=parse_ColRelU(blob,2);return{s:{r:r,c:c[0],cRel:c[1],rRel:c[2]},e:{r:R,c:C[0],cRel:C[1],rRel:C[2]}}}functionparse_RgceLoc(blob,length,opts){if(opts&&opts.biff>=2
if(cell.v!==cell.v)cell.v=unescapexml(xml);elseif(cell.v<60)cell.v=cell.v-1;if(!nf||nf=="General")nf="yyyy-mm-dd";case"Number":if(cell.v===undefined)cell.v=+xml;if(!cell.t)cell.t="n";break;case"Error":cell.t="e";cell.v=RBErr[xml];if(o.cellText!==false)cell.w=xml;break;default:cell.t="s";cell.v=xlml_fixstr(ss||xml);break;}safe_format_xlml(cell,nf,o);if(o.cellFormula!==false){if(cell.Formula){varfstr=unescapexml(cell.Formula);if(fstr.charCodeAt(0)==61)fstr=fstr.substr(1);cell.f=rc_to_a1(fstr,base);deletecell.Formula;if(cell.ArrayRange=="RC")cell.F=rc_to_a1("RC:RC",base);elseif(cell.ArrayRange){cell.F=rc_to_a1(cell.ArrayRange,base);arrayf.push([safe_decode_range(cell.F),cell.F])}}else{for(i=0;i<arrayf.length;++i)if(base.r>=arrayf[i][0].s.r&&base.r<=arrayf[i][0].e.r)if(base.c>=arrayf[i][0].s.c&&base.c<=arrayf[i][0].e.c)cell.F=arrayf[i][1]}}if(o.cellStyles){interiors.forEach(function(x){if(!S.patternType&&x.patternType)S.patternType=x.patternType});cell.s=S}cell.ixfe=cell.StyleID!==undefined?cell.StyleID:"Default"}functionxlml_clean_comment(comment){comment.t=comment.v||"";comment.t=comment.t.replace(/\r\n/g,"\n").replace(/\r/g,"\n");comment.v=comment.w=comment.ixfe=undefined}functionxlml_normalize(d){if(has_buf&&Buffer.isBuffer(d))returnd.toString("utf8");if(typeofd==="string")returnd;thrownewError("Bad input format: expected Buffer or string")}varxlmlregex=/<(\/?)([^\s?>!\/:]*:|)([^\s?>]*[^\s?>\/])[^>]*>/gm;functionparse_xlml_xml(d,_opts){varopts=_opts||{};make_ssf(SSF);varstr=debom(xlml_normalize(d));if(opts&&opts.type=="binary"&&typeofcptable!=="undefined")str=cptable.utils.decode(65001,char_codes(str));varopening=str.slice(0,1024).toLowerCase(),ishtml=false;if(opening.indexOf("<?xml")==-1)["html","table","head","meta","script","style","div"].forEach(function(tag){if(opening.indexOf("<"+tag)>=0)ishtml=true});if(ishtml)returnHTML_.to_workbook(str,opts);varRn;varstate=[],tmp;if(DENSE!=null&&opts.dense==null)opts.dense=DENSE;varsheets={},sheetnames=[],cursheet=opts.dense?[]:{},sheetname="";vartable={},cell={},row={};vardtag=xlml_parsexmltag('<Data ss:Type="String">'),didx=0;varc=0,r=0;varrefguess={s:{r:2e6,c:2e6},e:{r:0,c:0}};varstyles={},stag={};varss="",fidx=0;varmergecells=[];varProps={},Custprops={},pidx=0,cp={};varcomments=[],comment={};varcstys=[],csty,seencol=false;vararrayf=[];varrowinfo=[],rowobj={};varWorkbook={Sheets:[],WBProps:{date1904:false}},wsprops={};xlmlregex.lastIndex=0;str=str.replace(/<!--([\s\S]*?)-->/gm,"");while(Rn=xlmlregex.exec(str))switch(Rn[3]){case"Data":if(state[state.length-1][1])break;if(Rn[1]==="/")parse_xlml_data(str.slice(didx,Rn.index),ss,dtag,state[state.length-1][0]=="Comment"?comment:cell,{c:c,r:r},styles,cstys[c],row,arrayf,opts);else{ss="";dtag=xlml_parsexmltag(Rn[0]);didx=Rn.index+Rn[0].length}break;case"Cell":if(Rn[1]==="/"){if(comments.length>0)cell.c=comments;if((!opts.sheetRows||opts.sheetRows>r)&&cell.v!==undefined){if(opts.dense){if(!cursheet[r])cursheet[r]=[];cursheet[r][c]=cell}elsecursheet[encode_col(c)+encode_row(r)]=cell}if(cell.HRef){cell.l={Target:cell.HRef,Tooltip:cell.HRefScreenTip};deletecell.HRef;deletecell.HRefScreenTip}if(cell.MergeAcross||cell.MergeDown){varcc=c+(parseInt(cell.MergeAcross,10)|0);varrr=r+(parseInt(cell.MergeDown,10)|0);mergecells.push({s:{c:c,r:r},e:{c:cc,r:rr}})}if(!opts.sheetStubs){if(cell.MergeAcross)c=cc+1;else++c}elseif(cell.MergeAcross||cell.MergeDown){for(varcma=c;cma<=cc;++cma){for(varcmd=r;cmd<=rr;++cmd){if(cma>c||cmd>r){if(opts.dense){if(!cursheet[cmd])cursheet[cmd]=[];cursheet[cmd][cma]={t:"z"}}elsecursheet[encode_col(cma)+encode_row(cmd)]={t:"z"}}}}c=cc+1}else++c}else{cell=xlml_parsexmltagobj(Rn[0]);if(cell.Index)c=+cell.Index-1;if(c<refguess.s.c)refguess.s.c=c;if(c>refguess.e.c)refguess.e.c=c;if(Rn[0].slice(-2)==="/>")++c;comments=[]}break;case"Row":if(Rn[1]==="/"||Rn[0].slice(-2)==="/>"){if(r<refguess.s.r)refguess.s.r=r;if(r>refguess.e.r)refguess.e.r=r;if(Rn[0].slice(-2)==="/>"){row=xlml_parsexmltag(Rn[0]);if(row.Index)r=+row.Index-1}c=0;++r}else{row=xlml_parsexmltag(Rn[0]);if(row.Index)r=+r
name:""}).name;if(val.dt==32)out["!type"]="chart";mergecells=[];objects=[];array_formulae=[];opts.arrayf=array_formulae;colinfo=[];rowinfo=[];defwidth=defheight=0;seencol=false;wsprops={Hidden:(Directory[s]||{hs:0}).hs,name:cur_sheet}}break;case"Number":;case"BIFF2NUM":;case"BIFF2INT":{if(out["!type"]=="chart")if(options.dense?(out[val.r]||[])[val.c]:out[encode_cell({c:val.c,r:val.r})])++val.c;temp_val={ixfe:val.ixfe,XF:XFs[val.ixfe]||{},v:val.val,t:"n"};if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options)}break;case"BoolErr":{temp_val={ixfe:val.ixfe,XF:XFs[val.ixfe],v:val.val,t:val.t};if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options)}break;case"RK":{temp_val={ixfe:val.ixfe,XF:XFs[val.ixfe],v:val.rknum,t:"n"};if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options)}break;case"MulRk":{for(varj=val.c;j<=val.C;++j){varixfe=val.rkrec[j-val.c][0];temp_val={ixfe:ixfe,XF:XFs[ixfe],v:val.rkrec[j-val.c][1],t:"n"};if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:j,r:val.r},temp_val,options)}}break;case"Formula":{if(val.val=="String"){last_formula=val;break}temp_val=make_cell(val.val,val.cell.ixfe,val.tt);temp_val.XF=XFs[temp_val.ixfe];if(options.cellFormula){var_f=val.formula;if(_f&&_f[0]&&_f[0][0]&&_f[0][0][0]=="PtgExp"){var_fr=_f[0][0][1][0],_fc=_f[0][0][1][1];var_fe=encode_cell({r:_fr,c:_fc});if(shared_formulae[_fe])temp_val.f=""+stringify_formula(val.formula,range,val.cell,supbooks,opts);elsetemp_val.F=((options.dense?(out[_fr]||[])[_fc]:out[_fe])||{}).F}elsetemp_val.f=""+stringify_formula(val.formula,range,val.cell,supbooks,opts)}if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell(val.cell,temp_val,options);last_formula=val}break;case"String":{if(last_formula){last_formula.val=val;temp_val=make_cell(val,last_formula.cell.ixfe,"s");temp_val.XF=XFs[temp_val.ixfe];if(options.cellFormula){temp_val.f=""+stringify_formula(last_formula.formula,range,last_formula.cell,supbooks,opts)}if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell(last_formula.cell,temp_val,options);last_formula=null}elsethrownewError("String record expects Formula")}break;case"Array":{array_formulae.push(val);var_arraystart=encode_cell(val[0].s);cc=options.dense?(out[val[0].s.r]||[])[val[0].s.c]:out[_arraystart];if(options.cellFormula&&cc){if(!last_formula)break;if(!_arraystart||!cc)break;cc.f=""+stringify_formula(val[1],range,val[0],supbooks,opts);cc.F=encode_range(val[0])}}break;case"ShrFmla":{if(!cell_valid)break;if(!options.cellFormula)break;if(last_cell){if(!last_formula)break;shared_formulae[encode_cell(last_formula.cell)]=val[0];cc=options.dense?(out[last_formula.cell.r]||[])[last_formula.cell.c]:out[encode_cell(last_formula.cell)];(cc||{}).f=""+stringify_formula(val[0],range,lastcell,supbooks,opts)}}break;case"LabelSst":temp_val=make_cell(sst[val.isst].t,val.ixfe,"s");temp_val.XF=XFs[temp_val.ixfe];if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options);break;case"Blank":if(options.sheetStubs){temp_val={ixfe:val.ixfe,XF:XFs[val.ixfe],t:"z"};if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options)}break;case"MulBlank":if(options.sheetStubs){for(var_j=val.c;_j<=val.C;++_j){var_ixfe=val.ixfe[_j-val.c];temp_val={ixfe:_ixfe,XF:XFs[_ixfe],t:"z"};if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:_j,r:val.r},temp_val,options)}}break;case"RString":;case"Label":;case"BIFF2STR":temp_val=make_cel
returnparse_xlml(data.slice(i),o);default:breakmain;}returnPRN.to_workbook(data,o)}functionread_plaintext_raw(data,o){varstr="",bytes=firstbyte(data,o);switch(o.type){case"base64":str=Base64.decode(data);break;case"binary":str=data;break;case"buffer":str=data.toString("binary");break;case"array":str=cc2str(data);break;default:thrownewError("Unrecognized type "+o.type);}if(bytes[0]==239&&bytes[1]==187&&bytes[2]==191)str=utf8read(str);returnread_plaintext(str,o)}functionread_utf16(data,o){vard=data;if(o.type=="base64")d=Base64.decode(d);d=cptable.utils.decode(1200,d.slice(2),"str");o.type="binary";returnread_plaintext(d,o)}functionreadSync(data,opts){varzip,d=data,n=[0];varo=opts||{};_ssfopts={};if(o.dateNF)_ssfopts.dateNF=o.dateNF;if(!o.type)o.type=has_buf&&Buffer.isBuffer(data)?"buffer":"base64";if(o.type=="file"){o.type="buffer";d=_fs.readFileSync(data)}switch((n=firstbyte(d,o))[0]){case208:returnread_cfb(CFB.read(d,o),o);case9:returnparse_xlscfb(s2a(o.type==="base64"?Base64.decode(d):d),o);case60:returnparse_xlml(d,o);case73:if(n[1]==68)returnread_wb_ID(d,o);break;case84:if(n[1]==65&&n[2]==66&&n[3]==76)returnDIF.to_workbook(d,o);break;case80:if(n[1]==75&&n[2]<32&&n[3]<32)returnread_zip(d,o);break;case239:returnn[3]==60?parse_xlml(d,o):PRN.to_workbook(d,o);case255:if(n[1]==254){returnread_utf16(d,o)}break;case0:if(n[1]==0&&n[2]>=2&&n[3]==0)returnWK_.to_workbook(d,o);break;case3:;case131:;case139:returnDBF.to_workbook(d,o);case123:if(n[1]==92&&n[2]==114&&n[3]==116)thrownewError("Unsupported RTF");break;case10:;case13:;case32:returnread_plaintext_raw(d,o);}if(n[2]<=12&&n[3]<=31)returnDBF.to_workbook(d,o);if(32>n[0]||n[0]>127)thrownewError("Unsupported file "+n.join("|"));returnPRN.to_workbook(d,o)}functionreadFileSync(filename,opts){varo=opts||{};o.type="file";returnreadSync(filename,o)}functionwrite_zip_type(wb,opts){varo=opts||{};varz=write_zip(wb,o);varoopts={};if(o.compression)oopts.compression="DEFLATE";switch(o.type){case"base64":oopts.type="base64";break;case"binary":oopts.type="string";break;case"buffer":;case"file":oopts.type="nodebuffer";break;default:thrownewError("Unrecognized type "+o.type);}if(o.type==="file")return_fs.writeFileSync(o.file,z.generate(oopts));returnz.generate(oopts)}functionwrite_bstr_type(out,opts){switch(opts.type){case"base64":returnBase64.encode(out);case"binary":returnout;case"file":return_fs.writeFileSync(opts.file,out,"binary");case"buffer":{if(has_buf)returnnewBuffer(out,"binary");elsereturnout.split("").map(function(c){returnc.charCodeAt(0)})};}thrownewError("Unrecognized type "+opts.type)}functionwrite_string_type(out,opts){switch(opts.type){case"base64":returnBase64.encode(out);case"binary":returnout;case"file":return_fs.writeFileSync(opts.file,out,"utf8");case"buffer":{if(has_buf)returnnewBuffer(out,"utf8");elsereturnout.split("").map(function(c){returnc.charCodeAt(0)})};}thrownewError("Unrecognized type "+opts.type)}functionwrite_binary_type(out,opts){switch(opts.type){case"base64":;case"binary":varbstr="";for(vari=0;i<out.length;++i)bstr+=String.fromCharCode(out[i]);returnopts.type=="base64"?Base64.encode(bstr):bstr;case"file":return_fs.writeFileSync(opts.file,out);case"buffer":returnout;default:thrownewError("Unrecognized type "+opts.type);}}functionwriteSync(wb,opts){check_wb(wb);varo=opts||{};switch(o.bookType||"xlsb"){case"xml":;case"xlml":returnwrite_string_type(write_xlml(wb,o),o);case"slk":;case"sylk":returnwrite_string_type(write_slk_str(wb,o),o);case"html":returnwrite_string_type(write_htm_str(wb,o),o);case"txt":returnwrite_bstr_type(write_txt_str(wb,o),o);case"csv":returnwrite_string_type(write_csv_str(wb,o),o);case"dif":returnwrite_string_type(write_dif_str(wb,o),o);case"prn":returnwrite_string_type(write_prn_str(wb,o),o);case"fods":returnwrite_string_type(write_ods(wb,o),o);case"biff2":returnwrite_binary_type(write_biff_buf(wb,o),o);case"xlsx":;case"xlsm":;case"xlsb":;case"ods":returnwrite_zip_type(wb,o);default:thrownewError("Unrecognized bookType |"+o.bookType+"|"