};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_DIRECTORY_LO
functionwrite_sst_bin(sst,opts){varba=buf_array();write_record(ba,"BrtBeginSst",write_BrtBeginSst(sst));for(vari=0;i<sst.length;++i)write_record(ba,"BrtSSTItem",write_BrtSSTItem(sst[i]));write_record(ba,"BrtEndSst");returnba.end()}function_JS2ANSI(str){if(typeofcptable!=="undefined")returncptable.utils.encode(1252,str);varo=[],oo=str.split("");for(vari=0;i<oo.length;++i)o[i]=oo[i].charCodeAt(0);returno}functionparse_Version(blob,length){varo={};o.Major=blob.read_shift(2);o.Minor=blob.read_shift(2);returno}functionparse_EncryptionHeader(blob,length){varo={};o.Flags=blob.read_shift(4);vartmp=blob.read_shift(4);if(tmp!==0)throw"Unrecognized SizeExtra: "+tmp;o.AlgID=blob.read_shift(4);switch(o.AlgID){case0:case26625:case26126:case26127:case26128:break;default:throw"Unrecognized encryption algorithm: "+o.AlgID}parsenoop(blob,length-12);returno}functionparse_EncryptionVerifier(blob,length){returnparsenoop(blob,length)}functionparse_RC4CryptoHeader(blob,length){varo={};varvers=o.EncryptionVersionInfo=parse_Version(blob,4);length-=4;if(vers.Minor!=2)throw"unrecognized minor version code: "+vers.Minor;if(vers.Major>4||vers.Major<2)throw"unrecognized major version code: "+vers.Major;o.Flags=blob.read_shift(4);length-=4;varsz=blob.read_shift(4);length-=4;o.EncryptionHeader=parse_EncryptionHeader(blob,sz);length-=sz;o.EncryptionVerifier=parse_EncryptionVerifier(blob,length);returno}functionparse_RC4Header(blob,length){varo={};varvers=o.EncryptionVersionInfo=parse_Version(blob,4);length-=4;if(vers.Major!=1||vers.Minor!=1)throw"unrecognized version code "+vers.Major+" : "+vers.Minor;o.Salt=blob.read_shift(16);o.EncryptedVerifier=blob.read_shift(16);o.EncryptedVerifierHash=blob.read_shift(16);returno}functioncrypto_CreatePasswordVerifier_Method1(Password){varVerifier=0,PasswordArray;varPasswordDecoded=_JS2ANSI(Password);varlen=PasswordDecoded.length+1,i,PasswordByte;varIntermediate1,Intermediate2,Intermediate3;PasswordArray=new_raw_buf(len);PasswordArray[0]=PasswordDecoded.length;for(i=1;i!=len;++i)PasswordArray[i]=PasswordDecoded[i-1];for(i=len-1;i>=0;--i){PasswordByte=PasswordArray[i];Intermediate1=(Verifier&16384)===0?0:1;Intermediate2=Verifier<<1&32767;Intermediate3=Intermediate1|Intermediate2;Verifier=Intermediate3^PasswordByte}returnVerifier^52811}varcrypto_CreateXorArray_Method1=function(){varPadArray=[187,255,255,186,255,255,185,128,0,190,15,0,191,15,0];varInitialCode=[57840,7439,52380,33984,4364,3600,61902,12606,6258,57657,54287,34041,10252,43370,20163];varXorMatrix=[44796,19929,39858,10053,20106,40212,10761,31585,63170,64933,60267,50935,40399,11199,17763,35526,1453,2906,5812,11624,23248,885,1770,3540,7080,14160,28320,56640,55369,41139,20807,41614,21821,43642,17621,28485,56970,44341,19019,38038,14605,29210,60195,50791,40175,10751,21502,43004,24537,18387,36774,3949,7898,15796,31592,63184,47201,24803,49606,37805,14203,28406,56812,17824,35648,1697,3394,6788,13576,27152,43601,17539,35078,557,1114,2228,4456,30388,60776,51953,34243,7079,14158,28316,14128,28256,56512,43425,17251,34502,7597,13105,26210,52420,35241,883,1766,3532,4129,8258,16516,33032,4657,9314,18628];varRor=function(Byte){return(Byte/2|Byte*128)&255};varXorRor=function(byte1,byte2){returnRor(byte1^byte2)};varCreateXorKey_Method1=function(Password){varXorKey=InitialCode[Password.length-1];varCurrentElement=104;for(vari=Password.length-1;i>=0;--i){varChar=Password[i];for(varj=0;j!=7;++j){if(Char&64)XorKey^=XorMatrix[CurrentElement];Char*=2;--CurrentElement}}returnXorKey};returnfunction(password){varPassword=_JS2ANSI(password);varXorKey=CreateXorKey_Method1(Password);varIndex=Password.length;varObfuscationArray=new_raw_buf(16);for(vari=0;i!=16;++i)ObfuscationArray[i]=0;varTemp,PasswordLastChar,PadIndex;if((Index&1)===1){Temp=XorKey>>8;ObfuscationArray[Index]=XorRor(PadArray[0],Temp);--Index;Temp=XorKey&255;PasswordLastChar=Password[Password.length-1];ObfuscationArray[Index]=XorRor(PasswordLastChar,Temp)}while(Index>0){--Index;Temp=XorKey>>8;ObfuscationArray[Index]=XorRor(Password[Index],Temp);--Index;Temp=XorKey
}functionwrite_comments_xml(data,opts){}functionparse_BrtBeginComment(data,length){varout={};out.iauthor=data.read_shift(4);varrfx=parse_UncheckedRfX(data,16);out.rfx=rfx.s;out.ref=encode_cell(rfx.s);data.l+=16;returnout}varparse_BrtCommentAuthor=parse_XLWideString;varparse_BrtCommentText=parse_RichStr;functionparse_comments_bin(data,opts){varout=[];varauthors=[];varc={};varpass=false;recordhopper(data,functionhopper_cmnt(val,R,RT){switch(R.n){case"BrtCommentAuthor":authors.push(val);break;case"BrtBeginComment":c=val;break;case"BrtCommentText":c.t=val.t;c.h=val.h;c.r=val.r;break;case"BrtEndComment":c.author=authors[c.iauthor];deletec.iauthor;if(opts.sheetRows&&opts.sheetRows<=c.rfx.r)break;deletec.rfx;out.push(c);break;case"BrtBeginComments":break;case"BrtEndComments":break;case"BrtBeginCommentAuthors":break;case"BrtEndCommentAuthors":break;case"BrtBeginCommentList":break;case"BrtEndCommentList":break;default:if(!pass||opts.WTF)thrownewError("Unexpected record "+RT+" "+R.n)}});returnout}functionwrite_comments_bin(data,opts){}varrc_to_a1=function(){varrcregex=/(^|[^A-Za-z])R(\[?)(-?\d+|)\]?C(\[?)(-?\d+|)\]?/g;varrcbase;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)}}();functionshift_formula_str(f,delta){returnf.replace(/(^|[^A-Z0-9])([$]?)([A-Z]+)([$]?)(\d+)/g,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,length){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,length,opts){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(2),R=blob.read_shift(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&&opts.biff<=5)returnparse_RgceLoc_BIFF2(blob,length,opts);varr=blob.read_shift(opts&&opts.biff==12?4:2);varc=parse_ColRelU(blob,2);return{r:r,c:c[0],cRel:c[1],rRel:c[2]}}functionparse_RgceLoc_BIFF2(blob,length,opts){varr=parse_ColRelU(blob,2);varc=blob.read_shift(1);return{r:r[0],c:c,cRel:r[1],rRel:r[2]}}functionparse_RgceLocRel(blob,length,opts){varbiff=opts&&opts.biff?opts.biff:8;if(biff>=2&&biff<=5)returnparse_RgceLocRel_BIFF2(blob,length,opts);varr=blob.read_shift(biff>=12?4:2);varcl=blob.read_shift(2);varcRel=(cl&32768)>>15,rRel=(cl&16384)>>14;cl&=16383;if(rRel==1)while(r>524287)r-=1048576;if(cRel==1)while(cl>8191)cl=cl-16384;return{r:r,c:cl,cRel:cRel,rRel:rRel}}functionparse_RgceLocRel_BIFF2(blob,length){varrl=blob.read_shift(2);varc=blob.read_shift(1);varrRel=(rl&32768)>>15,cRel=(rl&16384)>>14;rl&=16383;if(rRel==1&&rl>=8192)rl=rl-16384;if(cRel==1&&c>=128)c=c-256;return{r:rl,c:c,cRel:cRel,rRel:rRel}}functionparse_PtgArea(blob,length,opts){vartype=(blob[blob.l++]&96)>>5;v
functionparse_wb_xml(data,opts){if(!data)thrownewError("Could not find file");varwb={AppVersion:{},WBProps:{},WBView:[],Sheets:[],CalcPr:{},xmlns:""};varpass=false,xmlns="xmlns";(data.match(tagregex)||[]).forEach(functionxml_wb(x){vary=parsexmltag(x);switch(strip_ns(y[0])){case"<?xml":break;case"<workbook":if(x.match(wbnsregex))xmlns="xmlns"+x.match(/<(\w+):/)[1];wb.xmlns=y[xmlns];break;case"</workbook>":break;case"<fileVersion":deletey[0];wb.AppVersion=y;break;case"<fileVersion/>":break;case"<fileSharing":case"<fileSharing/>":break;case"<workbookPr":deletey[0];wb.WBProps=y;break;case"<workbookPr/>":deletey[0];wb.WBProps=y;break;case"<workbookProtection":break;case"<workbookProtection/>":break;case"<bookViews>":case"</bookViews>":break;case"<workbookView":deletey[0];wb.WBView.push(y);break;case"<sheets>":case"</sheets>":break;case"<sheet":deletey[0];y.name=utf8read(y.name);wb.Sheets.push(y);break;case"<functionGroups":case"<functionGroups/>":break;case"<functionGroup":break;case"<externalReferences":case"</externalReferences>":case"<externalReferences>":break;case"<externalReference":break;case"<definedNames/>":break;case"<definedNames>":case"<definedNames":pass=true;break;case"</definedNames>":pass=false;break;case"<definedName":case"<definedName/>":case"</definedName>":break;case"<calcPr":deletey[0];wb.CalcPr=y;break;case"<calcPr/>":deletey[0];wb.CalcPr=y;break;case"<oleSize":break;case"<customWorkbookViews>":case"</customWorkbookViews>":case"<customWorkbookViews":break;case"<customWorkbookView":case"</customWorkbookView>":break;case"<pivotCaches>":case"</pivotCaches>":case"<pivotCaches":break;case"<pivotCache":break;case"<smartTagPr":case"<smartTagPr/>":break;case"<smartTagTypes":case"<smartTagTypes>":case"</smartTagTypes>":break;case"<smartTagType":break;case"<webPublishing":case"<webPublishing/>":break;case"<fileRecoveryPr":case"<fileRecoveryPr/>":break;case"<webPublishObjects>":case"<webPublishObjects":case"</webPublishObjects>":break;case"<webPublishObject":break;case"<extLst>":case"</extLst>":case"<extLst/>":break;case"<ext":pass=true;break;case"</ext>":pass=false;break;case"<ArchID":break;case"<AlternateContent":pass=true;break;case"</AlternateContent>":pass=false;break;default:if(!pass&&opts.WTF)throw"unrecognized "+y[0]+" in workbook"}});if(XMLNS.main.indexOf(wb.xmlns)===-1)thrownewError("Unknown Namespace: "+wb.xmlns);parse_wb_defaults(wb);returnwb}varWB_XML_ROOT=writextag("workbook",null,{xmlns:XMLNS.main[0],"xmlns:r":XMLNS.r});functionsafe1904(wb){try{returnparsexmlbool(wb.Workbook.WBProps.date1904)?"true":"false"}catch(e){return"false"}}functionwrite_wb_xml(wb,opts){varo=[XML_HEADER];o[o.length]=WB_XML_ROOT;o[o.length]=writextag("workbookPr",null,{date1904:safe1904(wb)});o[o.length]="<sheets>";for(vari=0;i!=wb.SheetNames.length;++i)o[o.length]=writextag("sheet",null,{name:wb.SheetNames[i].substr(0,31),sheetId:""+(i+1),"r:id":"rId"+(i+1)});o[o.length]="</sheets>";if(o.length>2){o[o.length]="</workbook>";o[1]=o[1].replace("/>",">")}returno.join("")}functionparse_BrtBundleSh(data,length){varz={};z.hsState=data.read_shift(4);z.iTabID=data.read_shift(4);z.strRelID=parse_RelID(data,length-8);z.name=parse_XLWideString(data);returnz}functionwrite_BrtBundleSh(data,o){if(!o)o=new_buf(127);o.write_shift(4,data.hsState);o.write_shift(4,data.iTabID);write_RelID(data.strRelID,o);write_XLWideString(data.name.substr(0,31),o);returno.length>o.l?o.slice(0,o.l):o}functionparse_BrtWbProp(data,length){data.read_shift(4);vardwThemeVersion=data.read_shift(4);varstrName=length>8?parse_XLWideString(data):"";return[dwThemeVersion,strName]}functionwrite_BrtWbProp(data,o){if(!o)o=new_buf(8);o.write_shift(4,0);o.write_shift(4,0);returno}functionparse_BrtFRTArchID$(data,length){varo={};data.read_shift(4);o.ArchID=data.read_shift(4);data.l+=length-8;returno}functionparse_BrtName(data,length,opts){varend=data.l+length;varflags=data.read_shift(4);varchKey=data.read_shift(1);varitab=data.read_shift(4);varname=parse_XLNameWideString(data);varformula=parse_XLSBNameParsedFormula(data,0,opts);varco
ixfe:val.ixfe,XF:XFs[val.ixfe],v:val.val,t:val.t};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"};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"};safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:j,r:val.r},temp_val,options)}}break;case"Formula":{switch(val.val){case"String":last_formula=val;break;case"Array Formula":throw"Array Formula unsupported";default:temp_val={v:val.val,ixfe:val.cell.ixfe,t: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=(out[_fe]||{}).F}elsetemp_val.f=stringify_formula(val.formula,range,val.cell,supbooks,opts)}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={v:last_formula.val,ixfe:last_formula.cell.ixfe,t:"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);safe_format_xf(temp_val,options,wb.opts.Date1904);addcell(last_formula.cell,temp_val,options);last_formula=null}}break;case"Array":{array_formulae.push(val);if(options.cellFormula&&out[last_cell]){out[last_cell].f=stringify_formula(last_formula.formula,range,last_formula.cell,supbooks,opts);out[last_cell].F=encode_range(val[0])}}break;case"ShrFmla":{if(!cell_valid)break;if(!options.cellFormula)break;if(last_cell){shared_formulae[encode_cell(last_formula.cell)]=val[0];(out[encode_cell(last_formula.cell)]||{}).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];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options);break;case"RString":case"Label":case"BIFF2STR":temp_val=make_cell(val.val,val.ixfe,"s");temp_val.XF=XFs[temp_val.ixfe];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options);break;case"Dimensions":{if(file_depth===1)range=val}break;case"SST":{sst=val}break;case"Format":{SSF.load(val[1],val[0])}break;case"BIFF2FORMAT":{SSF.load(val,BIFF2Fmt++)}break;case"MergeCells":mergecells=mergecells.concat(val);break;case"Obj":objects[val.cmo[0]]=opts.lastobj=val;break;case"TxO":opts.lastobj.TxO=val;break;case"HLink":{for(rngR=val[0].s.r;rngR<=val[0].e.r;++rngR)for(rngC=val[0].s.c;rngC<=val[0].e.c;++rngC)if(out[encode_cell({c:rngC,r:rngR})])out[encode_cell({c:rngC,r:rngR})].l=val[1]}break;case"HLinkTooltip":{for(rngR=val[0].s.r;rngR<=val[0].e.r;++rngR)for(rngC=val[0].s.c;rngC<=val[0].e.c;++rngC)if(out[encode_cell({c:rngC,r:rngR})])out[encode_cell({c:rngC,r:rngR})].l.tooltip=val[1]}break;case"Note":{if(opts.biff<=5&&opts.biff>=2)break;cc=out[encode_cell(val[0])];varnoteobj=objects[val[2]];if(!cc)break;if(!cc.c)cc.c=[];cmnt={a:val[1],t:noteobj.TxO.t};cc.c.push(cmnt)}break;default:switch(R.n){case"ClrtClient":break;case"XFExt":update_xfext(XFs[val.ixfe],val.ext);break;case"NameCmt":break;case"Header":break;case"Footer":break;case"HCenter":break;case"VCenter":break;case"Pls":break;case"Setup":break;case"DefColWidth":break;case"GCW":break;case"LHRecord":break;case"ColInfo":break;case"Row":break;case"DBCell":break;case"MulBlank":break;case"EntExU2":break;case"SxView":break;case"Sxvd":break;case"SXVI":break;case"SXVDEx":break;case"SxIvd":break;case"SXDI":break;case"SXLI":break;case"SXEx":break;case"QsiSXTag":break;case"Selection":break;case"Feat":break;case"FeatHdr":case"FeatHdr11":break;case"Feature11":case"Feature12":case"List12":break;case"Blank":break;case"Country":countr
safe_parse_ws(zip,path,relsPath,props.SheetNames[i],sheetRels,sheets,opts,wb)}if(dir.comments)parse_comments(zip,dir.comments,sheets,sheetRels,opts);out={Directory:dir,Workbook:wb,Props:props,Custprops:custprops,Deps:deps,Sheets:sheets,SheetNames:props.SheetNames,Strings:strs,Styles:styles,Themes:themes,SSF:SSF.get_table()};if(opts.bookFiles){out.keys=entries;out.files=zip.files}if(opts.bookVBA){if(dir.vba.length>0)out.vbaraw=getzipdata(zip,dir.vba[0],true);elseif(dir.defaults&&dir.defaults.bin==="application/vnd.ms-office.vbaProject")out.vbaraw=getzipdata(zip,"xl/vbaProject.bin",true)}returnout}functionadd_rels(rels,rId,f,type,relobj){if(!relobj)relobj={};if(!rels["!id"])rels["!id"]={};relobj.Id="rId"+rId;relobj.Type=type;relobj.Target=f;if(rels["!id"][relobj.Id])thrownewError("Cannot rewrite rId "+rId);rels["!id"][relobj.Id]=relobj;rels[("/"+relobj.Target).replace("//","/")]=relobj}functionwrite_zip(wb,opts){if(opts.bookType=="ods")returnwrite_ods(wb,opts);if(wb&&!wb.SSF){wb.SSF=SSF.get_table()}if(wb&&wb.SSF){make_ssf(SSF);SSF.load_table(wb.SSF);opts.revssf=evert_num(wb.SSF);opts.revssf[wb.SSF[65535]]=0}opts.rels={};opts.wbrels={};opts.Strings=[];opts.Strings.Count=0;opts.Strings.Unique=0;varwbext=opts.bookType=="xlsb"?"bin":"xml";varct={workbooks:[],sheets:[],calcchains:[],themes:[],styles:[],coreprops:[],extprops:[],custprops:[],strs:[],comments:[],vba:[],TODO:[],rels:[],xmlns:""};fix_write_opts(opts=opts||{});varzip=newjszip;varf="",rId=0;opts.cellXfs=[];get_cell_style(opts.cellXfs,{},{revssf:{General:0}});if(!wb.Props)wb.Props={};f="docProps/core.xml";zip.file(f,write_core_props(wb.Props,opts));ct.coreprops.push(f);add_rels(opts.rels,2,f,RELS.CORE_PROPS);f="docProps/app.xml";wb.Props.SheetNames=wb.SheetNames;wb.Props.Worksheets=wb.SheetNames.length;zip.file(f,write_ext_props(wb.Props,opts));ct.extprops.push(f);add_rels(opts.rels,3,f,RELS.EXT_PROPS);if(wb.Custprops!==wb.Props&&keys(wb.Custprops||{}).length>0){f="docProps/custom.xml";zip.file(f,write_cust_props(wb.Custprops,opts));ct.custprops.push(f);add_rels(opts.rels,4,f,RELS.CUST_PROPS)}f="xl/workbook."+wbext;zip.file(f,write_wb(wb,f,opts));ct.workbooks.push(f);add_rels(opts.rels,1,f,RELS.WB);for(rId=1;rId<=wb.SheetNames.length;++rId){f="xl/worksheets/sheet"+rId+"."+wbext;zip.file(f,write_ws(rId-1,f,opts,wb));ct.sheets.push(f);add_rels(opts.wbrels,rId,"worksheets/sheet"+rId+"."+wbext,RELS.WS)}if(opts.Strings!=null&&opts.Strings.length>0){f="xl/sharedStrings."+wbext;zip.file(f,write_sst(opts.Strings,f,opts));ct.strs.push(f);add_rels(opts.wbrels,++rId,"sharedStrings."+wbext,RELS.SST)}f="xl/theme/theme1.xml";zip.file(f,write_theme());ct.themes.push(f);add_rels(opts.wbrels,++rId,"theme/theme1.xml",RELS.THEME);f="xl/styles."+wbext;zip.file(f,write_sty(wb,f,opts));ct.styles.push(f);add_rels(opts.wbrels,++rId,"styles."+wbext,RELS.STY);zip.file("[Content_Types].xml",write_ct(ct,opts));zip.file("_rels/.rels",write_rels(opts.rels));zip.file("xl/_rels/workbook."+wbext+".rels",write_rels(opts.wbrels));returnzip}functionfirstbyte(f,o){switch((o||{}).type||"base64"){case"buffer":returnf[0];case"base64":returnBase64.decode(f.substr(0,12)).charCodeAt(0);case"binary":returnf.charCodeAt(0);case"array":returnf[0];default:thrownewError("Unrecognized type "+(o?o.type:"undefined"))}}functionread_zip(data,opts){varzip,d=data;varo=opts||{};if(!o.type)o.type=has_buf&&Buffer.isBuffer(data)?"buffer":"base64";switch(o.type){case"base64":zip=newjszip(d,{base64:true});break;case"binary":case"array":zip=newjszip(d,{base64:false});break;case"buffer":zip=newjszip(d);break;default:thrownewError("Unrecognized type "+o.type)}returnparse_zip(zip,o)}functionreadSync(data,opts){varzip,d=data,n=0;varo=opts||{};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)){case208:returnparse_xlscfb(CFB.read(d,o),o);case9:returnparse_xlscfb(s2a(o.type==="base64"?Base64.decode(d):d),o);case60:returnparse_xlml(d,o);case80:returnread_zip(d,o);default:thrownewError("Unsupported