}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
varo=v.toFixed(11).replace(gnr1,".$1");if(o.length>(v<0?12:11))o=v.toPrecision(6);returno}functiongfn4(o){for(vari=0;i!=o.length;++i)if((o.charCodeAt(i)|32)===101)returno.replace(gnr4,".$1").replace(gnr5,"E").replace("e","E").replace(gnr6,"$10$2");returno}functiongfn5(o){returno.indexOf(".")>-1?o.replace(gnr2,"").replace(gnr1,".$1"):o}returnfunctiongeneral_fmt_num(v){varV=Math.floor(Math.log(Math.abs(v))*Math.LOG10E),o;if(V>=-4&&V<=-1)o=v.toPrecision(10+V);elseif(Math.abs(V)<=9)o=gfn2(v);elseif(V===10)o=v.toFixed(10).substr(0,12);elseo=gfn3(v);returngfn5(gfn4(o))}}();SSF._general_num=general_fmt_num;functiongeneral_fmt(v){switch(typeofv){case"string":returnv;case"boolean":returnv?"TRUE":"FALSE";case"number":return(v|0)===v?general_fmt_int(v):general_fmt_num(v);case"undefined":return"";case"object":if(v==null)return"";}thrownewError("unsupported value in General format: "+v)}SSF._general=general_fmt;functionfix_hijri(){return0}functionparse_date_code(v,opts,b2){if(v>2958465||v<0)returnnull;vardate=v|0,time=Math.floor(86400*(v-date)),dow=0;vardout=[];varout={D:date,T:time,u:86400*(v-date)-time,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(out.u)<1e-6)out.u=0;fixopts(opts!=null?opts:opts=[]);if(opts.date1904)date+=1462;if(out.u>.9999){out.u=0;if(++time==86400){out.T=time=0;++date;++out.D}}if(date===60){dout=b2?[1317,10,29]:[1900,2,29];dow=3}elseif(date===0){dout=b2?[1317,8,29]:[1900,1,0];dow=6}else{if(date>60)--date;vard=newDate(1900,0,1);d.setDate(d.getDate()+date-1);dout=[d.getFullYear(),d.getMonth()+1,d.getDate()];dow=d.getDay();if(date<60)dow=(dow+6)%7;if(b2)dow=fix_hijri(d,dout)}out.y=dout[0];out.m=dout[1];out.d=dout[2];out.S=time%60;time=Math.floor(time/60);out.M=time%60;time=Math.floor(time/60);out.H=time;out.q=dow;returnout}SSF.parse_date_code=parse_date_code;functionwrite_date(type,fmt,val,ss0){varo="",ss=0,tt=0,y=val.y,out,outl=0;switch(type){case98:y=val.y+543;case121:switch(fmt.length){case1:;case2:out=y%100;outl=2;break;default:out=y%1e4;outl=4;break;}break;case109:switch(fmt.length){case1:;case2:out=val.m;outl=fmt.length;break;case3:returnmonths[val.m-1][1];case5:returnmonths[val.m-1][0];default:returnmonths[val.m-1][2];}break;case100:switch(fmt.length){case1:;case2:out=val.d;outl=fmt.length;break;case3:returndays[val.q][0];default:returndays[val.q][1];}break;case104:switch(fmt.length){case1:;case2:out=1+(val.H+11)%12;outl=fmt.length;break;default:throw"bad hour format: "+fmt;}break;case72:switch(fmt.length){case1:;case2:out=val.H;outl=fmt.length;break;default:throw"bad hour format: "+fmt;}break;case77:switch(fmt.length){case1:;case2:out=val.M;outl=fmt.length;break;default:throw"bad minute format: "+fmt;}break;case115:if(val.u===0)switch(fmt){case"s":;case"ss":returnpad0(val.S,fmt.length);case".0":;case".00":;case".000":;}switch(fmt){case"s":;case"ss":;case".0":;case".00":;case".000":if(ss0>=2)tt=ss0===3?1e3:100;elsett=ss0===1?10:1;ss=Math.round(tt*(val.S+val.u));if(ss>=60*tt)ss=0;if(fmt==="s")returnss===0?"0":""+ss/tt;o=pad0(ss,2+ss0);if(fmt==="ss")returno.substr(0,2);return"."+o.substr(2,fmt.length-1);default:throw"bad second format: "+fmt;};case90:switch(fmt){case"[h]":;case"[hh]":out=val.D*24+val.H;break;case"[m]":;case"[mm]":out=(val.D*24+val.H)*60+val.M;break;case"[s]":;case"[ss]":out=((val.D*24+val.H)*60+val.M)*60+Math.round(val.S+val.u);break;default:throw"bad abstime format: "+fmt;}outl=fmt.length===3?1:2;break;case101:out=y;outl=1;}if(outl>0)returnpad0(out,outl);elsereturn""}functioncommaify(s){if(s.length<=3)returns;varj=s.length%3,o=s.substr(0,j);for(;j!=s.length;j+=3)o+=(o.length>0?",":"")+s.substr(j,3);returno}varwrite_num=functionmake_write_num(){varpct1=/%/g;functionwrite_num_pct(type,fmt,val){varsfmt=fmt.replace(pct1,""),mul=fmt.length-sfmt.length;returnwrite_num(type,sfmt,val*Math.pow(10,2*mul))+fill("%",mul)}functionwrite_num_cm(type,fmt,val){varidx=fmt.length-1;while(fmt.charCodeAt(idx-1)===44)--idx;returnwrite_num(type,fmt.substr(0,idx),val/Math.pow(10,3*(fmt.length-idx)))}functionwrite_num_exp(fmt,val){varo;v
if(fs===undefined)fs=require("fs");returnparse(fs.readFileSync(filename),options)}functionreadSync(blob,options){switch(options!==undefined&&options.type!==undefined?options.type:"base64"){case"file":returnreadFileSync(blob,options);case"base64":returnparse(s2a(Base64.decode(blob)),options);case"binary":returnparse(s2a(blob),options);}returnparse(blob)}varMSSZ=64;varENDOFCHAIN=-2;varHEADER_SIGNATURE="d0cf11e0a1b11ae1";varHEADER_CLSID="00000000000000000000000000000000";varconsts={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,ENDOFCHAIN:ENDOFCHAIN,FREESECT:-1,HEADER_SIGNATURE:HEADER_SIGNATURE,HEADER_MINOR_VERSION:"3e00",MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:HEADER_CLSID,EntryTypes:["unknown","storage","stream","lockbytes","property","root"]};exports.read=readSync;exports.parse=parse;exports.utils={ReadShift:ReadShift,CheckField:CheckField,prep_blob:prep_blob,bconcat:bconcat,consts:consts};returnexports}();if(typeofrequire!=="undefined"&&typeofmodule!=="undefined"&&typeofDO_NOT_EXPORT_CFB==="undefined"){module.exports=CFB}functionisval(x){returnx!==undefined&&x!==null}functionkeys(o){returnObject.keys(o)}functionevert_key(obj,key){varo=[],K=keys(obj);for(vari=0;i!==K.length;++i)o[obj[K[i]][key]]=K[i];returno}functionevert(obj){varo=[],K=keys(obj);for(vari=0;i!==K.length;++i)o[obj[K[i]]]=K[i];returno}functionevert_num(obj){varo=[],K=keys(obj);for(vari=0;i!==K.length;++i)o[obj[K[i]]]=parseInt(K[i],10);returno}functionevert_arr(obj){varo=[],K=keys(obj);for(vari=0;i!==K.length;++i){if(o[obj[K[i]]]==null)o[obj[K[i]]]=[];o[obj[K[i]]].push(K[i])}returno}functiondatenum(v,date1904){varepoch=v.getTime();if(date1904)epoch+=1462*24*60*60*1e3;return(epoch+22091616e5)/(24*60*60*1e3)}functionnumdate(v){vardate=SSF.parse_date_code(v);varval=newDate;if(date==null)thrownewError("Bad Date Code: "+v);val.setUTCDate(date.d);val.setUTCMonth(date.m-1);val.setUTCFullYear(date.y);val.setUTCHours(date.H);val.setUTCMinutes(date.M);val.setUTCSeconds(date.S);returnval}functionparse_isodur(s){varsec=0,mt=0,time=false;varm=s.match(/P([0-9\.]+Y)?([0-9\.]+M)?([0-9\.]+D)?T([0-9\.]+H)?([0-9\.]+M)?([0-9\.]+S)?/);if(!m)thrownewError("|"+s+"| is not an ISO8601 Duration");for(vari=1;i!=m.length;++i){if(!m[i])continue;mt=1;if(i>3)time=true;switch(m[i].substr(m[i].length-1)){case"Y":thrownewError("Unsupported ISO Duration Field: "+m[i].substr(m[i].length-1));case"D":mt*=24;case"H":mt*=60;case"M":if(!time)thrownewError("Unsupported ISO Duration Field: M");elsemt*=60;case"S":break;}sec+=mt*parseInt(m[i],10)}returnsec}vargood_pd_date=newDate("2017-02-19T19:06:09.000Z");if(isNaN(good_pd_date.getFullYear()))good_pd_date=newDate("2/19/17");vargood_pd=good_pd_date.getFullYear()==2017;functionparseDate(str){vard=newDate(str);if(good_pd)returnd;if(strinstanceofDate)returnstr;if(good_pd_date.getFullYear()==1917&&!isNaN(d.getFullYear())){vars=d.getFullYear();if(str.indexOf(""+s)>-1)returnd;d.setFullYear(d.getFullYear()+100);returnd}varn=str.match(/\d+/g)||["2017","2","19","0","0","0"];returnnewDate(Date.UTC(+n[0],+n[1]-1,+n[2],+n[3]||0,+n[4]||0,+n[5]||0))}functioncc2str(arr){varo="";for(vari=0;i!=arr.length;++i)o+=String.fromCharCode(arr[i]);returno}functionstr2cc(str){varo=[];for(vari=0;i!=str.length;++i)o.push(str.charCodeAt(i));returno}functiondup(o){if(typeofJSON!="undefined"&&!Array.isArray(o))returnJSON.parse(JSON.stringify(o));if(typeofo!="object"||o==null)returno;varout={};for(varkino)if(o.hasOwnProperty(k))out[k]=dup(o[k]);returnout}functionfill(c,l){varo="";while(o.length<l)o+=c;returno}functionfuzzydate(s){varo=newDate(s),n=newDate(NaN);vary=o.getYear(),m=o.getMonth(),d=o.getDate();if(isNaN(d))returnn;if(y<0||y>8099)returnn;if((m>0||d>1)&&y!=101)returno;if(s.toLowerCase().match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/))returno;if(!s.match(/[a-zA-Z]/))returno;returnn}functiongetdatastr(data){if(!data)returnnull;if(data.data)returndebom(data.data);if(data.asNodeBuffer&&has_buf)returndebom(data.asNodeBuffer().toString("binary"));if(data.asBinary)returndebom(
;case"Y":out[R][C]=dd.read(4,"i")/1e4;break;case"0":if(fields[C].name==="_NullFlags")break;default:thrownewError("DBF Unsupported data type "+fields[C].type);}}}if(ft!=2)if(d.l<d.length&&d[d.l++]!=26)thrownewError("DBF EOF Marker missing "+(d.l-1)+" of "+d.length+" "+d[d.l-1].toString(16));returnout}functiondbf_to_sheet(buf,opts){varo=opts||{};if(!o.dateNF)o.dateNF="yyyymmdd";returnaoa_to_sheet(dbf_to_aoa(buf,o),o)}functiondbf_to_workbook(buf,opts){try{returnsheet_to_workbook(dbf_to_sheet(buf,opts),opts)}catch(e){if(opts&&opts.WTF)throwe}return{SheetNames:[],Sheets:{}}}return{to_workbook:dbf_to_workbook,to_sheet:dbf_to_sheet}}();varSYLK=function(){functionsylk_to_aoa(d,opts){switch(opts.type){case"base64":returnsylk_to_aoa_str(Base64.decode(d),opts);case"binary":returnsylk_to_aoa_str(d,opts);case"buffer":returnsylk_to_aoa_str(d.toString("binary"),opts);case"array":returnsylk_to_aoa_str(cc2str(d),opts);}thrownewError("Unrecognized type "+opts.type)}functionsylk_to_aoa_str(str,opts){varrecords=str.split(/[\n\r]+/),R=-1,C=-1,ri=0,rj=0,arr=[];varformats=[];varnext_cell_format=null;varsht={},rowinfo=[],colinfo=[],cw=[];varMval=0,j;for(;ri!==records.length;++ri){Mval=0;varrstr=records[ri].trim();varrecord=rstr.replace(/;;/g,"").split(";").map(function(x){returnx.replace(/\u0001/g,";")});varRT=record[0],val;if(rstr.length>0)switch(RT){case"ID":break;case"E":break;case"B":break;case"O":break;case"P":if(record[1].charAt(0)=="P")formats.push(rstr.substr(3).replace(/;;/g,";"));break;case"C":for(rj=1;rj<record.length;++rj)switch(record[rj].charAt(0)){case"X":C=parseInt(record[rj].substr(1))-1;break;case"Y":R=parseInt(record[rj].substr(1))-1;C=0;for(j=arr.length;j<=R;++j)arr[j]=[];break;case"K":val=record[rj].substr(1);if(val.charAt(0)==='"')val=val.substr(1,val.length-2);elseif(val==="TRUE")val=true;elseif(val==="FALSE")val=false;elseif(+val===+val){val=+val;if(next_cell_format!==null&&SSF.is_date(next_cell_format))val=numdate(val)}elseif(!isNaN(fuzzydate(val).getDate())){val=parseDate(val)}arr[R][C]=val;next_cell_format=null;break;case"E":varformula=rc_to_a1(record[rj].substr(1),{r:R,c:C});arr[R][C]=[arr[R][C],formula];break;default:if(opts&&opts.WTF)thrownewError("SYLK bad record "+rstr);}break;case"F":varF_seen=0;for(rj=1;rj<record.length;++rj)switch(record[rj].charAt(0)){case"X":C=parseInt(record[rj].substr(1))-1;++F_seen;break;case"Y":R=parseInt(record[rj].substr(1))-1;for(j=arr.length;j<=R;++j)arr[j]=[];break;case"M":Mval=parseInt(record[rj].substr(1))/20;break;case"F":break;case"P":next_cell_format=formats[parseInt(record[rj].substr(1))];break;case"S":break;case"D":break;case"N":break;case"W":cw=record[rj].substr(1).split(" ");for(j=parseInt(cw[0],10);j<=parseInt(cw[1],10);++j){Mval=parseInt(cw[2],10);colinfo[j-1]=Mval==0?{hidden:true}:{wch:Mval};process_col(colinfo[j-1])}break;case"C":C=parseInt(record[rj].substr(1))-1;if(!colinfo[C])colinfo[C]={};break;case"R":R=parseInt(record[rj].substr(1))-1;if(!rowinfo[R])rowinfo[R]={};if(Mval>0){rowinfo[R].hpt=Mval;rowinfo[R].hpx=pt2px(Mval)}elseif(Mval==0)rowinfo[R].hidden=true;break;default:if(opts&&opts.WTF)thrownewError("SYLK bad record "+rstr);}if(F_seen<1)next_cell_format=null;break;default:if(opts&&opts.WTF)thrownewError("SYLK bad record "+rstr);}}if(rowinfo.length>0)sht["!rows"]=rowinfo;if(colinfo.length>0)sht["!cols"]=colinfo;return[arr,sht]}functionsylk_to_sheet(str,opts){varaoasht=sylk_to_aoa(str,opts);varaoa=aoasht[0],ws=aoasht[1];varo=aoa_to_sheet(aoa,opts);keys(ws).forEach(function(k){o[k]=ws[k]});returno}functionsylk_to_workbook(str,opts){returnsheet_to_workbook(sylk_to_sheet(str,opts),opts)}functionwrite_ws_cell_sylk(cell,ws,R,C,opts){varo="C;Y"+(R+1)+";X"+(C+1)+";K";switch(cell.t){case"n":o+=cell.v||0;if(cell.f&&!cell.F)o+=";E"+a1_to_rc(cell.f,{r:R,c:C});break;case"b":o+=cell.v?"TRUE":"FALSE";break;case"e":o+=cell.w||cell.v;break;case"d":o+='"'+(cell.w||cell.v)+'"';break;case"s":o+='"'+cell.v.replace(/"/g,"")+'"';break;}returno}functionwrite_ws_cols_sylk(out,cols){cols.forEach(function(col,i){varrec="F;W"+(i+1)+"
returno}functionhex2RGB(h){varo=h.substr(h[0]==="#"?1:0,6);return[parseInt(o.substr(0,2),16),parseInt(o.substr(2,2),16),parseInt(o.substr(4,2),16)]}functionrgb2Hex(rgb){for(vari=0,o=1;i!=3;++i)o=o*256+(rgb[i]>255?255:rgb[i]<0?0:rgb[i]);returno.toString(16).toUpperCase().substr(1)}functionrgb2HSL(rgb){varR=rgb[0]/255,G=rgb[1]/255,B=rgb[2]/255;varM=Math.max(R,G,B),m=Math.min(R,G,B),C=M-m;if(C===0)return[0,0,R];varH6=0,S=0,L2=M+m;S=C/(L2>1?2-L2:L2);switch(M){caseR:H6=((G-B)/C+6)%6;break;caseG:H6=(B-R)/C+2;break;caseB:H6=(R-G)/C+4;break;}return[H6/6,S,L2/2]}functionhsl2RGB(hsl){varH=hsl[0],S=hsl[1],L=hsl[2];varC=S*2*(L<.5?L:1-L),m=L-C/2;varrgb=[m,m,m],h6=6*H;varX;if(S!==0)switch(h6|0){case0:;case6:X=C*h6;rgb[0]+=C;rgb[1]+=X;break;case1:X=C*(2-h6);rgb[0]+=X;rgb[1]+=C;break;case2:X=C*(h6-2);rgb[1]+=C;rgb[2]+=X;break;case3:X=C*(4-h6);rgb[1]+=X;rgb[2]+=C;break;case4:X=C*(h6-4);rgb[2]+=C;rgb[0]+=X;break;case5:X=C*(6-h6);rgb[2]+=X;rgb[0]+=C;break;}for(vari=0;i!=3;++i)rgb[i]=Math.round(rgb[i]*255);returnrgb}functionrgb_tint(hex,tint){if(tint===0)returnhex;varhsl=rgb2HSL(hex2RGB(hex));if(tint<0)hsl[2]=hsl[2]*(1+tint);elsehsl[2]=1-(1-hsl[2])*(1-tint);returnrgb2Hex(hsl2RGB(hsl))}varDEF_MDW=6,MAX_MDW=15,MIN_MDW=1,MDW=DEF_MDW;functionwidth2px(width){returnMath.floor((width+Math.round(128/MDW)/256)*MDW)}functionpx2char(px){returnMath.floor((px-5)/MDW*100+.5)/100}functionchar2width(chr){returnMath.round((chr*MDW+5)/MDW*256)/256}functionpx2char_(px){return((px-5)/MDW*100+.5)/100}functionchar2width_(chr){return(chr*MDW+5)/MDW*256/256}functioncycle_width(collw){returnchar2width(px2char(width2px(collw)))}functionfind_mdw_colw(collw){vardelta=Infinity,_MDW=MIN_MDW;for(MDW=MIN_MDW;MDW<MAX_MDW;++MDW)if(Math.abs(collw-cycle_width(collw))<=delta){delta=Math.abs(collw-cycle_width(collw));_MDW=MDW}MDW=_MDW}functionfind_mdw_wpx(wpx){vardelta=Infinity,guess=0,_MDW=MIN_MDW;for(MDW=MIN_MDW;MDW<MAX_MDW;++MDW){guess=char2width_(px2char_(wpx))*256;guess=guess%1;if(guess>.5)guess--;if(Math.abs(guess)<delta){delta=Math.abs(guess);_MDW=MDW}}MDW=_MDW}functionprocess_col(coll){if(coll.width){coll.wpx=width2px(coll.width);coll.wch=px2char(coll.wpx);coll.MDW=MDW}elseif(coll.wpx){coll.wch=px2char(coll.wpx);coll.width=char2width(coll.wch);coll.MDW=MDW}elseif(typeofcoll.wch=="number"){coll.width=char2width(coll.wch);coll.wpx=width2px(coll.width);coll.MDW=MDW}if(coll.customWidth)deletecoll.customWidth}varDEF_PPI=96,PPI=DEF_PPI;functionpx2pt(px){returnpx*96/PPI}functionpt2px(pt){returnpt*PPI/96}varXLMLPatternTypeMap={None:"none",Solid:"solid",Gray50:"mediumGray",Gray75:"darkGray",Gray25:"lightGray",HorzStripe:"darkHorizontal",VertStripe:"darkVertical",ReverseDiagStripe:"darkDown",DiagStripe:"darkUp",DiagCross:"darkGrid",ThickDiagCross:"darkTrellis",ThinHorzStripe:"lightHorizontal",ThinVertStripe:"lightVertical",ThinReverseDiagStripe:"lightDown",ThinHorzCross:"lightGrid"};functionparse_borders(t,styles,themes,opts){styles.Borders=[];varborder={},sub_border={};t[0].match(tagregex).forEach(function(x){vary=parsexmltag(x);switch(y[0]){case"<borders":;case"<borders>":;case"</borders>":break;case"<border":;case"<border>":border={};if(y.diagonalUp){border.diagonalUp=y.diagonalUp}if(y.diagonalDown){border.diagonalDown=y.diagonalDown}styles.Borders.push(border);break;case"</border>":break;case"<left":;case"<left/>":break;case"</left>":break;case"<right":;case"<right/>":break;case"</right>":break;case"<top":;case"<top/>":break;case"</top>":break;case"<bottom":;case"<bottom/>":break;case"</bottom>":break;case"<diagonal":;case"<diagonal/>":break;case"</diagonal>":break;case"<horizontal":;case"<horizontal/>":break;case"</horizontal>":break;case"<vertical":;case"<vertical/>":break;case"</vertical>":break;case"<start":;case"<start/>":break;case"</start>":break;case"<end":;case"<end/>":break;case"</end>":break;case"<color":;case"<color/>":break;case"</color>":break;default:if(opts&&opts.WTF)thrownewError("unrecognized "+y[0]+" in borders");}})}functionparse_fills(t,styles,themes,opts){styles.Fills=[];varfill={};t[0].ma
;}returno}functionparse_XFExt(blob,length){varend=blob.l+length;blob.l+=2;varixfe=blob.read_shift(2);blob.l+=2;varcexts=blob.read_shift(2);varext=[];while(cexts-->0)ext.push(parse_ExtProp(blob,end-blob.l));return{ixfe:ixfe,ext:ext}}functionupdate_xfext(xf,xfext){xfext.forEach(function(xfe){switch(xfe[0]){case4:break;case5:break;case6:break;case7:break;case8:break;case9:break;case10:break;case11:break;case13:break;case14:break;case15:break;}})}functionparse_cc_xml(data,opts){vard=[];if(!data)returnd;varl=0,i=1;(data.match(tagregex)||[]).forEach(function(x){vary=parsexmltag(x);switch(y[0]){case"<?xml":break;case"<calcChain":;case"<calcChain>":;case"</calcChain>":break;case"<c":deletey[0];if(y.i)i=y.i;elsey.i=i;d.push(y);break;}});returnd}functionwrite_cc_xml(data,opts){}functionparse_BrtCalcChainItem$(data,length){varout={};out.i=data.read_shift(4);varcell={};cell.r=data.read_shift(4);cell.c=data.read_shift(4);out.r=encode_cell(cell);varflags=data.read_shift(1);if(flags&2)out.l="1";if(flags&8)out.a="1";returnout}functionparse_cc_bin(data,opts){varout=[];varpass=false;recordhopper(data,functionhopper_cc(val,R_n,RT){switch(RT){case63:out.push(val);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_cc_bin(data,opts){}RELS.IMG="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";RELS.DRAW="http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing";functionparse_drawing(data,rels){if(!data)return"??";varid=(data.match(/<c:chart [^>]*r:id="([^"]*)"/)||["",""])[1];returnrels["!id"][id].Target}var_shapeid=1024;functionwrite_comments_vml(rId,comments){varcsize=[21600,21600];varbbox=["m0,0l0",csize[1],csize[0],csize[1],csize[0],"0xe"].join(",");varo=[writextag("xml",null,{"xmlns:v":XLMLNS.v,"xmlns:o":XLMLNS.o,"xmlns:x":XLMLNS.x,"xmlns:mv":XLMLNS.mv}).replace(/\/>/,">"),writextag("o:shapelayout",writextag("o:idmap",null,{"v:ext":"edit",data:rId}),{"v:ext":"edit"}),writextag("v:shapetype",[writextag("v:stroke",null,{joinstyle:"miter"}),writextag("v:path",null,{gradientshapeok:"t","o:connecttype":"rect"})].join(""),{id:"_x0000_t202","o:spt":202,coordsize:csize.join(","),path:bbox})];while(_shapeid<rId*1e3)_shapeid+=1e3;comments.map(function(x){returndecode_cell(x[0])}).forEach(function(c,i){o=o.concat(["<v:shape"+wxt_helper({id:"_x0000_s"+++_shapeid,type:"#_x0000_t202",style:"position:absolute; margin-left:80pt;margin-top:5pt;width:104pt;height:64pt;z-index:10;visibility:hidden",fillcolor:"#ECFAD4",strokecolor:"#edeaa1"})+">",writextag("v:fill",writextag("o:fill",null,{type:"gradientUnscaled","v:ext":"view"}),{color2:"#BEFF82",angle:"-180",type:"gradient"}),writextag("v:shadow",null,{on:"t",obscured:"t"}),writextag("v:path",null,{"o:connecttype":"none"}),'<v:textbox><div style="text-align:left"></div></v:textbox>','<x:ClientData ObjectType="Note">',"<x:MoveWithCells/>","<x:SizeWithCells/>",writetag("x:Anchor",[c.c,0,c.r,0,c.c+3,100,c.r+5,100].join(",")),writetag("x:AutoFill","False"),writetag("x:Row",String(c.r)),writetag("x:Column",String(c.c)),"<x:Visible/>","</x:ClientData>","</v:shape>"])});o.push("</xml>");returno.join("")}RELS.CMNT="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments";functionparse_comments(zip,dirComments,sheets,sheetRels,opts){for(vari=0;i!=dirComments.length;++i){varcanonicalpath=dirComments[i];varcomments=parse_cmnt(getzipdata(zip,canonicalpath.replace(/^\//,""),true),canonicalpath,opts);if(!comments||!comments.length)continue;varsheetNames=keys(sheets);for(varj=0;j!=sheetNames.length;++j){varsheetName=sheetNames[j];varrels=sheetRels[sheetName];if(rels){varrel=rels[canonicalpath];if(rel)insertCommentsIntoSheet(sheetName,sheets[sheetName],comments)}}}}functioninsertCommentsIntoSheet(sheetName,sheet,comments){vardense=Array.isArray(sheet);varcell,r;comments.forEach(function(comment){if(dense){r=decode_cell(comment.ref);if(!sheet[r.r])sheet[r.r]=[];cel
varsupbooks=[];supbooks.SheetNames=opts.snames;supbooks.sharedf=opts.sharedf;supbooks.arrayf=opts.arrayf;supbooks.names=[];supbooks.XTI=[];varlast_Rn="";varfile_depth=0;varBIFF2Fmt=0;varBIFF2FmtTable=[];varFilterDatabases=[];varlast_lbl;opts.codepage=1200;set_cp(1200);while(blob.l<blob.length-1){vars=blob.l;varRecordType=blob.read_shift(2);if(RecordType===0&&last_Rn==="EOF")break;varlength=blob.l===blob.length?0:blob.read_shift(2),y;varR=XLSRecordEnum[RecordType];if(R&&R.f){if(options.bookSheets){if(last_Rn==="BoundSheet8"&&R.n!=="BoundSheet8")break}last_Rn=R.n;if(R.r===2||R.r==12){varrt=blob.read_shift(2);length-=2;if(!opts.enc&&rt!==RecordType)throw"rt mismatch";if(R.r==12){blob.l+=10;length-=10}}varval;if(R.n==="EOF")val=R.f(blob,length,opts);elseval=slurp(R,blob,length,opts);varRn=R.n;switch(Rn){case"Date1904":wb.opts.Date1904=val;break;case"WriteProtect":wb.opts.WriteProtect=true;break;case"FilePass":if(!opts.enc)blob.l=0;opts.enc=val;if(opts.WTF)console.error(val);if(!options.password)thrownewError("File is password-protected");if(val.valid==null)thrownewError("Encryption scheme unsupported");if(!val.valid)thrownewError("Password is incorrect");break;case"WriteAccess":opts.lastuser=val;break;case"FileSharing":break;case"CodePage":if(val===21010)val=1200;elseif(val===32769)val=1252;opts.codepage=val;set_cp(val);break;case"RRTabId":opts.rrtabid=val;break;case"WinProtect":opts.winlocked=val;break;case"Template":break;case"RefreshAll":wb.opts.RefreshAll=val;break;case"BookBool":break;case"UsesELFs":break;case"MTRSettings":break;case"CalcCount":wb.opts.CalcCount=val;break;case"CalcDelta":wb.opts.CalcDelta=val;break;case"CalcIter":wb.opts.CalcIter=val;break;case"CalcMode":wb.opts.CalcMode=val;break;case"CalcPrecision":wb.opts.CalcPrecision=val;break;case"CalcSaveRecalc":wb.opts.CalcSaveRecalc=val;break;case"CalcRefMode":opts.CalcRefMode=val;break;case"Uncalced":break;case"ForceFullCalculation":wb.opts.FullCalc=val;break;case"WsBool":break;case"XF":XFs.push(val);break;case"ExtSST":break;case"BookExt":break;case"RichTextStream":break;case"BkHim":break;case"SupBook":supbooks.push([val]);supbooks[supbooks.length-1].XTI=[];break;case"ExternName":supbooks[supbooks.length-1].push(val);break;case"Index":break;case"Lbl":last_lbl={Name:val.Name,Ref:stringify_formula(val.rgce,range,null,supbooks,opts)};if(val.itab>0)last_lbl.Sheet=val.itab-1;supbooks.names.push(last_lbl);if(!supbooks[0])supbooks[0]=[];supbooks[supbooks.length-1].push(val);if(val.Name=="\r"&&val.itab>0)if(val.rgce&&val.rgce[0]&&val.rgce[0][0]&&val.rgce[0][0][0]=="PtgArea3d")FilterDatabases[val.itab-1]={ref:encode_range(val.rgce[0][0][1][2])};break;case"ExternSheet":if(supbooks.length==0){supbooks[0]=[];supbooks[0].XTI=[]}supbooks[supbooks.length-1].XTI=supbooks[supbooks.length-1].XTI.concat(val);supbooks.XTI=supbooks.XTI.concat(val);break;case"NameCmt":if(opts.biff<8)break;if(last_lbl!=null)last_lbl.Comment=val[1];break;case"Protect":out["!protect"]=val;break;case"Password":if(val!==0&&opts.WTF)console.error("Password verifier: "+val);break;case"Prot4Rev":;case"Prot4RevPass":break;case"BoundSheet8":{Directory[val.pos]=val;opts.snames.push(val.name)}break;case"EOF":{if(--file_depth)break;if(range.e){if(range.e.r>0&&range.e.c>0){range.e.r--;range.e.c--;out["!ref"]=encode_range(range);range.e.r++;range.e.c++}if(mergecells.length>0)out["!merges"]=mergecells;if(objects.length>0)out["!objects"]=objects;if(colinfo.length>0)out["!cols"]=colinfo;if(rowinfo.length>0)out["!rows"]=rowinfo;Workbook.Sheets.push(wsprops)}if(cur_sheet==="")Preamble=out;elseSheets[cur_sheet]=out;out=options.dense?[]:{}}break;case"BOF":{if(opts.biff!==8){}elseif(RecordType===9)opts.biff=2;elseif(RecordType===521)opts.biff=3;elseif(RecordType===1033)opts.biff=4;elseif(val.BIFFVer===1280)opts.biff=5;elseif(val.BIFFVer===1536)opts.biff=8;elseif(val.BIFFVer===2)opts.biff=2;elseif(val.BIFFVer===7)opts.biff=2;if(file_depth++)break;cell_valid=true;out=options.dense?[]:{};if(opts.biff<5){if(cur_sheet==="")cur_sheet="Sheet1";range={s:{r:0,c:0},e:{r:0,c:0}};varfakebs8={pos:blob.
f="docProps/app.xml";if(wb.Props&&wb.Props.SheetNames){}elseif(!wb.Workbook||!wb.Workbook.Sheets)wb.Props.SheetNames=wb.SheetNames;elsewb.Props.SheetNames=wb.SheetNames.map(function(x,i){return[(wb.Workbook.Sheets[i]||{}).Hidden!=2,x]}).filter(function(x){returnx[0]}).map(function(x){returnx[1]});wb.Props.Worksheets=wb.Props.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){varwsrels={"!id":{}};varws=wb.Sheets[wb.SheetNames[rId-1]];var_type=(ws||{})["!type"]||"sheet";switch(_type){case"chart":;default:f="xl/worksheets/sheet"+rId+"."+wbext;zip.file(f,write_ws(rId-1,f,opts,wb,wsrels));ct.sheets.push(f);add_rels(opts.wbrels,-1,"worksheets/sheet"+rId+"."+wbext,RELS.WS[0]);}if(ws){varcomments=ws["!comments"];if(comments&&comments.length>0){varcf="xl/comments"+rId+"."+wbext;zip.file(cf,write_cmnt(comments,cf,opts));ct.comments.push(cf);add_rels(wsrels,-1,"../comments"+rId+"."+wbext,RELS.CMNT)}if(ws["!legacy"]){zip.file("xl/drawings/vmlDrawing"+rId+".vml",write_comments_vml(rId,ws["!comments"]))}deletews["!comments"];deletews["!legacy"]}if(wsrels["!id"].rId1)zip.file(get_rels_path(f),write_rels(wsrels))}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,-1,"sharedStrings."+wbext,RELS.SST)}f="xl/theme/theme1.xml";zip.file(f,write_theme(wb.Themes,opts));ct.themes.push(f);add_rels(opts.wbrels,-1,"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,-1,"styles."+wbext,RELS.STY);if(wb.vbaraw&&vbafmt){f="xl/vbaProject.bin";zip.file(f,wb.vbaraw);ct.vba.push(f);add_rels(opts.wbrels,-1,"vbaProject.bin",RELS.VBA)}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));deleteopts.revssf;deleteopts.ssf;returnzip}functionfirstbyte(f,o){varx="";switch((o||{}).type||"base64"){case"buffer":return[f[0],f[1],f[2],f[3]];case"base64":x=Base64.decode(f.substr(0,24));break;case"binary":x=f;break;case"array":return[f[0],f[1],f[2],f[3]];default:thrownewError("Unrecognized type "+(o?o.type:"undefined"));}return[x.charCodeAt(0),x.charCodeAt(1),x.charCodeAt(2),x.charCodeAt(3)]}functionread_cfb(cfb,opts){if(cfb.find("EncryptedPackage"))returnparse_xlsxcfb(cfb,opts);returnparse_xlscfb(cfb,opts)}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)}functionread_utf16(data,o){vard=data;if(o.type=="base64")d=Base64.decode(d);d=cptable.utils.decode(1200,d.slice(2));o.type="binary";if(d.charCodeAt(0)==60)returnparse_xlml(d,o);returnPRN.to_workbook(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_utf