}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
blob.l+=o.Size;returno}functionparse_VtVector(blob,cb){}functionparse_TypedPropertyValue(blob,type,_opts){vart=blob.read_shift(2),ret,opts=_opts||{};blob.l+=2;if(type!==VT_VARIANT)if(t!==type&&VT_CUSTOM.indexOf(type)===-1)thrownewError("Expected type "+type+" saw "+t);switch(type===VT_VARIANT?t:type){case2:ret=blob.read_shift(2,"i");if(!opts.raw)blob.l+=2;returnret;case3:ret=blob.read_shift(4,"i");returnret;case11:returnblob.read_shift(4)!==0;case19:ret=blob.read_shift(4);returnret;case30:returnparse_lpstr(blob,t,4).replace(chr0,"");case31:returnparse_lpwstr(blob);case64:returnparse_FILETIME(blob);case65:returnparse_BLOB(blob);case71:returnparse_ClipboardData(blob);case80:returnparse_VtString(blob,t,!opts.raw&&4).replace(chr0,"");case81:returnparse_VtUnalignedString(blob,t,4).replace(chr0,"");case4108:returnparse_VtVecHeadingPair(blob);case4126:returnparse_VtVecUnalignedLpstr(blob);default:thrownewError("TypedPropertyValue unrecognized type "+type+" "+t)}}functionparse_PropertySet(blob,PIDSI){varstart_addr=blob.l;varsize=blob.read_shift(4);varNumProps=blob.read_shift(4);varProps=[],i=0;varCodePage=0;varDictionary=-1,DictObj={};for(i=0;i!=NumProps;++i){varPropID=blob.read_shift(4);varOffset=blob.read_shift(4);Props[i]=[PropID,Offset+start_addr]}varPropH={};for(i=0;i!=NumProps;++i){if(blob.l!==Props[i][1]){varfail=true;if(i>0&&PIDSI)switch(PIDSI[Props[i-1][0]].t){case2:if(blob.l+2===Props[i][1]){blob.l+=2;fail=false}break;case80:if(blob.l<=Props[i][1]){blob.l=Props[i][1];fail=false}break;case4108:if(blob.l<=Props[i][1]){blob.l=Props[i][1];fail=false}break}if(!PIDSI&&blob.l<=Props[i][1]){fail=false;blob.l=Props[i][1]}if(fail)thrownewError("Read Error: Expected address "+Props[i][1]+" at "+blob.l+" :"+i)}if(PIDSI){varpiddsi=PIDSI[Props[i][0]];PropH[piddsi.n]=parse_TypedPropertyValue(blob,piddsi.t,{raw:true});if(piddsi.p==="version")PropH[piddsi.n]=String(PropH[piddsi.n]>>16)+"."+String(PropH[piddsi.n]&65535);if(piddsi.n=="CodePage")switch(PropH[piddsi.n]){case0:PropH[piddsi.n]=1252;case1e4:case1252:case874:case1250:case1251:case1253:case1254:case1255:case1256:case1257:case1258:case932:case936:case949:case950:case1200:case1201:case65e3:case-536:case65001:case-535:set_cp(CodePage=PropH[piddsi.n]);break;default:thrownewError("Unsupported CodePage: "+PropH[piddsi.n])}}else{if(Props[i][0]===1){CodePage=PropH.CodePage=parse_TypedPropertyValue(blob,VT_I2);set_cp(CodePage);if(Dictionary!==-1){varoldpos=blob.l;blob.l=Props[Dictionary][1];DictObj=parse_dictionary(blob,CodePage);blob.l=oldpos}}elseif(Props[i][0]===0){if(CodePage===0){Dictionary=i;blob.l=Props[i+1][1];continue}DictObj=parse_dictionary(blob,CodePage)}else{varname=DictObj[Props[i][0]];varval;switch(blob[blob.l]){case65:blob.l+=4;val=parse_BLOB(blob);break;case30:blob.l+=4;val=parse_VtString(blob,blob[blob.l-4]);break;case31:blob.l+=4;val=parse_VtString(blob,blob[blob.l-4]);break;case3:blob.l+=4;val=blob.read_shift(4,"i");break;case19:blob.l+=4;val=blob.read_shift(4);break;case5:blob.l+=4;val=blob.read_shift(8,"f");break;case11:blob.l+=4;val=parsebool(blob,4);break;case64:blob.l+=4;val=newDate(parse_FILETIME(blob));break;default:thrownewError("unparsed value: "+blob[blob.l])}PropH[name]=val}}}blob.l=start_addr+size;returnPropH}functionparse_PropertySetStream(file,PIDSI){varblob=file.content;prep_blob(blob,0);varNumSets,FMTID0,FMTID1,Offset0,Offset1=0;blob.chk("feff","Byte Order: ");varvers=blob.read_shift(2);varSystemIdentifier=blob.read_shift(4);blob.chk(CFB.utils.consts.HEADER_CLSID,"CLSID: ");NumSets=blob.read_shift(4);if(NumSets!==1&&NumSets!==2)throw"Unrecognized #Sets: "+NumSets;FMTID0=blob.read_shift(16);Offset0=blob.read_shift(4);if(NumSets===1&&Offset0!==blob.l)throw"Length mismatch";elseif(NumSets===2){FMTID1=blob.read_shift(16);Offset1=blob.read_shift(4)}varPSet0=parse_PropertySet(blob,PIDSI);varrval={SystemIdentifier:SystemIdentifier};for(varyinPSet0)rval[y]=PSet0[y];rval.FMTID=FMTID0;if(NumSets===1)returnrval;if(blob.l!==Offset1)thrownewError("Lengthmismatc
break;case"</i>":break;case"<color":if(y.rgb)font.color=y.rgb.substr(2,6);break;case"<family":font.family=y.val;break;case"<vertAlign":break;case"<scheme":break;default:if(y[0].charCodeAt(1)!==47)throw"Unrecognized rich format "+y[0]}}varstyle=[];if(font.b)style.push("font-weight: bold;");if(font.i)style.push("font-style: italic;");intro.push('<span style="'+style.join("")+'">');outro.push("</span>");returncp};functionparse_r(r){varterms=[[],"",[]];vart=r.match(tregex),cp=65001;if(!isval(t))return"";terms[1]=t[1];varrpr=r.match(rpregex);if(isval(rpr))cp=parse_rpr(rpr[1],terms[0],terms[2]);returnterms[0].join("")+terms[1].replace(nlregex,"<br/>")+terms[2].join("")}returnfunctionparse_rs(rs){returnrs.replace(rregex,"").split(rend).map(parse_r).join("")}}();varsitregex=/<(?:\w+:)?t[^>]*>([^<]*)<\/(?:\w+:)?t>/g,sirregex=/<(?:\w+:)?r>/;functionparse_si(x,opts){varhtml=opts?opts.cellHTML:true;varz={};if(!x)returnnull;vary;if(x.match(/^\s*<(?:\w+:)?t[^>]*>/)){z.t=utf8read(unescapexml(x.substr(x.indexOf(">")+1).split(/<\/(?:\w+:)?t>/)[0]));z.r=utf8read(x);if(html)z.h=z.t}elseif(y=x.match(sirregex)){z.r=utf8read(x);z.t=utf8read(unescapexml((x.replace(/<rPh.*?>(.*?)<\/rPh>/g,"").match(sitregex)||[]).join("").replace(tagregex,"")));if(html)z.h=parse_rs(z.r)}returnz}varsstr0=/<(?:\w+:)?sst([^>]*)>([\s\S]*)<\/(?:\w+:)?sst>/;varsstr1=/<(?:\w+:)?(?:si|sstItem)>/g;varsstr2=/<\/(?:\w+:)?(?:si|sstItem)>/;functionparse_sst_xml(data,opts){vars=[],ss="";if(!data)returns;varsst=data.match(sstr0);if(isval(sst)){ss=sst[2].replace(sstr1,"").split(sstr2);for(vari=0;i!=ss.length;++i){varo=parse_si(ss[i].trim(),opts);if(o!=null)s[s.length]=o}sst=parsexmltag(sst[1]);s.Count=sst.count;s.Unique=sst.uniqueCount}returns}RELS.SST="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings";varstraywsregex=/^\s|\s$|[\t\n\r]/;functionwrite_sst_xml(sst,opts){if(!opts.bookSST)return"";varo=[XML_HEADER];o[o.length]=writextag("sst",null,{xmlns:XMLNS.main[0],count:sst.Count,uniqueCount:sst.Unique});for(vari=0;i!=sst.length;++i){if(sst[i]==null)continue;vars=sst[i];varsitag="<si>";if(s.r)sitag+=s.r;else{sitag+="<t";if(s.t.match(straywsregex))sitag+=' xml:space="preserve"';sitag+=">"+escapexml(s.t)+"</t>"}sitag+="</si>";o[o.length]=sitag}if(o.length>2){o[o.length]="</sst>";o[1]=o[1].replace("/>",">")}returno.join("")}functionparse_BrtBeginSst(data,length){return[data.read_shift(4),data.read_shift(4)]}functionparse_sst_bin(data,opts){vars=[];varpass=false;recordhopper(data,functionhopper_sst(val,R,RT){switch(R.n){case"BrtBeginSst":s.Count=val[0];s.Unique=val[1];break;case"BrtSSTItem":s.push(val);break;case"BrtEndSst":returntrue;case"BrtFRTBegin":pass=true;break;case"BrtFRTEnd":pass=false;break;default:if(!pass||opts.WTF)thrownewError("Unexpected record "+RT+" "+R.n)}});returns}functionwrite_BrtBeginSst(sst,o){if(!o)o=new_buf(8);o.write_shift(4,sst.Count);o.write_shift(4,sst.Unique);returno}varwrite_BrtSSTItem=write_RichStr;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"u
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,RT){switch(R.n){case"BrtCalcChainItem$":out.push(val);break;case"BrtBeginCalcChain$":break;case"BrtEndCalcChain$":break;default:if(!pass||opts.WTF)thrownewError("Unexpected record "+RT+" "+R.n)}});returnout}functionwrite_cc_bin(data,opts){}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){comments.forEach(function(comment){varcell=sheet[comment.ref];if(!cell){cell={};sheet[comment.ref]=cell;varrange=safe_decode_range(sheet["!ref"]||"BDWGO1000001:A1");varthisCell=decode_cell(comment.ref);if(range.s.r>thisCell.r)range.s.r=thisCell.r;if(range.e.r<thisCell.r)range.e.r=thisCell.r;if(range.s.c>thisCell.c)range.s.c=thisCell.c;if(range.e.c<thisCell.c)range.e.c=thisCell.c;varencoded=encode_range(range);if(encoded!==sheet["!ref"])sheet["!ref"]=encoded}if(!cell.c)cell.c=[];varo={a:comment.author,t:comment.t,r:comment.r};if(comment.h)o.h=comment.h;cell.c.push(o)})}functionparse_comments_xml(data,opts){if(data.match(/<(?:\w+:)?comments *\/>/))return[];varauthors=[];varcommentList=[];varauthtag=data.match(/<(?:\w+:)?authors>([^\u2603]*)<\/(?:\w+:)?authors>/);if(authtag&&authtag[1])authtag[1].split(/<\/\w*:?author>/).forEach(function(x){if(x===""||x.trim()==="")return;vara=x.match(/<(?:\w+:)?author[^>]*>(.*)/);if(a)authors.push(a[1])});varcmnttag=data.match(/<(?:\w+:)?commentList>([^\u2603]*)<\/(?:\w+:)?commentList>/);if(cmnttag&&cmnttag[1])cmnttag[1].split(/<\/\w*:?comment>/).forEach(function(x,index){if(x===""||x.trim()==="")return;varcm=x.match(/<(?:\w+:)?comment[^>]*>/);if(!cm)return;vary=parsexmltag(cm[0]);varcomment={author:y.authorId&&authors[y.authorId]?authors[y.authorId]:undefined,ref:y.ref,guid:y.guid};varcell=decode_cell(y.ref);if(opts.sheetRows&&opts.sheetRows<=cell.r)return;vartextMatch=x.match(/<(?:\w+:)?text>([^\u2603]*)<\/(?:\w+:)?text>/);if(!textMatch||!textMatch[1])return;varrt=parse_si(textMatch[1]);if(!rt)return;comment.r=rt.r;comment.t=rt.t;if(opts.cellHTML)comment.h=rt.h;commentList.push(comment)});returncommentList}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}function
break;case"BrtCellIgnoreEC":break;case"BrtEndCellIgnoreECs":break;default:if(!pass||opts.WTF)thrownewError("Unexpected record "+Record.n)}},opts);deleteopts.supbooks;deleteopts["!row"];if(!s["!ref"]&&(refguess.s.r<2e6||ref&&(ref.e.r>0||ref.e.c>0||ref.s.r>0||ref.s.c>0)))s["!ref"]=encode_range(ref||refguess);if(opts.sheetRows&&s["!ref"]){vartmpref=safe_decode_range(s["!ref"]);if(opts.sheetRows<+tmpref.e.r){tmpref.e.r=opts.sheetRows-1;if(tmpref.e.r>refguess.e.r)tmpref.e.r=refguess.e.r;if(tmpref.e.r<tmpref.s.r)tmpref.s.r=tmpref.e.r;if(tmpref.e.c>refguess.e.c)tmpref.e.c=refguess.e.c;if(tmpref.e.c<tmpref.s.c)tmpref.s.c=tmpref.e.c;s["!fullref"]=s["!ref"];s["!ref"]=encode_range(tmpref)}}if(mergecells.length>0)s["!merges"]=mergecells;returns}functionwrite_ws_bin_cell(ba,cell,R,C,opts){if(cell.v===undefined)return"";varvv="";switch(cell.t){case"b":vv=cell.v?"1":"0";break;case"n":case"e":vv=""+cell.v;break;default:vv=cell.v;break}varo={r:R,c:C};switch(cell.t){case"s":case"str":if(opts.bookSST){vv=get_sst_id(opts.Strings,cell.v);o.t="s";o.v=vv;write_record(ba,"BrtCellIsst",write_BrtCellIsst(cell,o))}else{o.t="str";write_record(ba,"BrtCellSt",write_BrtCellSt(cell,o))}return;case"n":if(cell.v==(cell.v|0)&&cell.v>-1e3&&cell.v<1e3)write_record(ba,"BrtCellRk",write_BrtCellRk(cell,o));elsewrite_record(ba,"BrtCellReal",write_BrtCellReal(cell,o));return;case"b":o.t="b";write_record(ba,"BrtCellBool",write_BrtCellBool(cell,o));return;case"e":o.t="e";break}write_record(ba,"BrtCellBlank",write_BrtCellBlank(cell,o))}functionwrite_CELLTABLE(ba,ws,idx,opts,wb){varrange=safe_decode_range(ws["!ref"]||"A1"),ref,rr="",cols=[];write_record(ba,"BrtBeginSheetData");for(varR=range.s.r;R<=range.e.r;++R){rr=encode_row(R);write_row_header(ba,ws,range,R);for(varC=range.s.c;C<=range.e.c;++C){if(R===range.s.r)cols[C]=encode_col(C);ref=cols[C]+rr;if(!ws[ref])continue;write_ws_bin_cell(ba,ws[ref],R,C,opts)}}write_record(ba,"BrtEndSheetData")}functionwrite_ws_bin(idx,opts,wb){varba=buf_array();vars=wb.SheetNames[idx],ws=wb.Sheets[s]||{};varr=safe_decode_range(ws["!ref"]||"A1");write_record(ba,"BrtBeginSheet");write_record(ba,"BrtWsDim",write_BrtWsDim(r));write_CELLTABLE(ba,ws,idx,opts,wb);write_record(ba,"BrtEndSheet");returnba.end()}varWBPropsDef=[["allowRefreshQuery","0"],["autoCompressPictures","1"],["backupFile","0"],["checkCompatibility","0"],["codeName",""],["date1904","0"],["dateCompatibility","1"],["filterPrivacy","0"],["hidePivotFieldList","0"],["promptedSolutions","0"],["publishItems","0"],["refreshAllConnections",false],["saveExternalLinkValues","1"],["showBorderUnselectedTables","1"],["showInkAnnotation","1"],["showObjects","all"],["showPivotChartFilter","0"]];varWBViewDef=[["activeTab","0"],["autoFilterDateGrouping","1"],["firstSheet","0"],["minimized","0"],["showHorizontalScroll","1"],["showSheetTabs","1"],["showVerticalScroll","1"],["tabRatio","600"],["visibility","visible"]];varSheetDef=[["state","visible"]];varCalcPrDef=[["calcCompleted","true"],["calcMode","auto"],["calcOnSave","true"],["concurrentCalc","true"],["fullCalcOnLoad","false"],["fullPrecision","true"],["iterate","false"],["iterateCount","100"],["iterateDelta","0.001"],["refMode","A1"]];varCustomWBViewDef=[["autoUpdate","false"],["changesSavedWin","false"],["includeHiddenRowCol","true"],["includePrintSettings","true"],["maximized","false"],["minimized","false"],["onlySync","false"],["personalView","false"],["showComments","commIndicator"],["showFormulaBar","true"],["showHorizontalScroll","true"],["showObjects","all"],["showSheetTabs","true"],["showStatusbar","true"],["showVerticalScroll","true"],["tabRatio","600"],["xWindow","0"],["yWindow","0"]];functionpush_defaults_array(target,defaults){for(varj=0;j!=target.length;++j){varw=target[j];for(vari=0;i!=defaults.length;++i){varz=defaults[i];if(w[z[0]]==null)w[z[0]]=z[1]}}}functionpush_defaults(target,defaults){for(vari=0;i!=defaults.length;++i){varz=defaults[i];if(target[z[0]]==null)target[z[0]]=z[1]}}functionparse_wb_defaults(wb){push_defaults(wb.WBProps,WBPropsDef);push_defaults(wb.CalcPr,CalcPrDef);pus
vararray_formulae=[];vartemp_val;varcountry;varcell_valid=true;varXFs=[];varpalette=[];varget_rgb=functiongetrgb(icv){if(icv<8)returnXLSIcv[icv];if(icv<64)returnpalette[icv-8]||XLSIcv[icv];returnXLSIcv[icv]};varprocess_cell_style=functionpcs(cell,line){varxfd=line.XF.data;if(!xfd||!xfd.patternType)return;line.s={};line.s.patternType=xfd.patternType;vart;if(t=rgb2Hex(get_rgb(xfd.icvFore))){line.s.fgColor={rgb:t}}if(t=rgb2Hex(get_rgb(xfd.icvBack))){line.s.bgColor={rgb:t}}};varaddcell=functionaddcell(cell,line,options){if(!cell_valid)return;if(options.cellStyles&&line.XF&&line.XF.data)process_cell_style(cell,line);lastcell=cell;last_cell=encode_cell(cell);if(range.s){if(cell.r<range.s.r)range.s.r=cell.r;if(cell.c<range.s.c)range.s.c=cell.c}if(range.e){if(cell.r+1>range.e.r)range.e.r=cell.r+1;if(cell.c+1>range.e.c)range.e.c=cell.c+1}if(options.sheetRows&&lastcell.r>=options.sheetRows)cell_valid=false;elseout[last_cell]=line};varopts={enc:false,sbcch:0,snames:[],sharedf:shared_formulae,arrayf:array_formulae,rrtabid:[],lastuser:"",biff:8,codepage:0,winlocked:0,wtf:false};if(options.password)opts.password=options.password;varmergecells=[];varobjects=[];varsupbooks=[[]];varsbc=0,sbci=0,sbcli=0;supbooks.SheetNames=opts.snames;supbooks.sharedf=opts.sharedf;supbooks.arrayf=opts.arrayf;varlast_Rn="";varfile_depth=0;varBIFF2Fmt=0;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.Type!==0)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[++sbc]=[val];sbci=0;break;case"ExternName":supbooks[sbc][++sbci]=val;break;case"Index":break;case"Lbl":supbooks[0][++sbcli]=val;break;case"ExternSheet":supbooks[sbc]=supbooks[sbc].concat(val);sbci+=val.length;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){out["!range"]=range;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(cur_sheet==="")Preamble=out;elseSheets[cur_sheet]=out;out={}}break;case"BOF":{if(opts.biff!==8){}elseif(RecordType===9)op
varrows=str.slice(i,j).split(/<tr[^>]*>/);varR=0,C=0;varrange={s:{r:1e7,c:1e7},e:{r:0,c:0}};for(i=0;i<rows.length;++i){if(rows[i].substr(0,3)!="<td")continue;varcells=rows[i].split("</td>");for(j=0;j<cells.length;++j){if(cells[j].substr(0,3)!="<td")continue;++C;varm=cells[j],cc=0;while(m.charAt(0)=="<"&&(cc=m.indexOf(">"))>-1)m=m.slice(cc+1);while(m.indexOf(">")>-1)m=m.slice(0,m.lastIndexOf("<"));if(!m.length)continue;if(range.s.r>R)range.s.r=R;if(range.e.r<R)range.e.r=R;if(range.s.c>C)range.s.c=C;if(range.e.c<C)range.e.c=C;varcoord=encode_cell({r:R,c:C});if(m==+m)ws[coord]={t:"n",v:+m};elsews[coord]={t:"s",v:m}}++R;C=0}ws["!ref"]=encode_range(range);returno}varparse_content_xml=function(){varparse_text_p=function(text,tag){returnunescapexml(text.replace(/<text:s\/>/g," ").replace(/<[^>]*>/g,""))};varnumber_formats={day:["d","dd"],month:["m","mm"],year:["y","yy"],hours:["h","hh"],minutes:["m","mm"],seconds:["s","ss"],"am-pm":["A/P","AM/PM"],"day-of-week":["ddd","dddd"]};returnfunctionpcx(d,_opts){varopts=_opts||{};varstr=xlml_normalize(d);varstate=[],tmp;vartag;varNFtag={name:""},NF="",pidx=0;varsheetag;varrowtag;varSheets={},SheetNames=[],ws={};varRn,q;varctag={value:""};vartextp="",textpidx=0,textptag;varR=-1,C=-1,range={s:{r:1e6,c:1e7},e:{r:0,c:0}};varnumber_format_map={};varmerges=[],mrange={},mR=0,mC=0;vararrayf=[];varrept=1,isstub=false;vari=0;xlmlregex.lastIndex=0;while(Rn=xlmlregex.exec(str))switch(Rn[3]=Rn[3].replace(/_.*$/,"")){case"table":case"工作表":if(Rn[1]==="/"){if(range.e.c>=range.s.c&&range.e.r>=range.s.r)ws["!ref"]=encode_range(range);if(merges.length)ws["!merges"]=merges;sheetag.name=utf8read(sheetag["名称"]||sheetag.name);SheetNames.push(sheetag.name);Sheets[sheetag.name]=ws}elseif(Rn[0].charAt(Rn[0].length-2)!=="/"){sheetag=parsexmltag(Rn[0],false);R=C=-1;range.s.r=range.s.c=1e7;range.e.r=range.e.c=0;ws={};merges=[]}break;case"table-row":case"行":if(Rn[1]==="/")break;rowtag=parsexmltag(Rn[0],false);if(rowtag["行号"])R=rowtag["行号"]-1;else++R;C=-1;break;case"covered-table-cell":++C;break;case"table-cell":case"数据":if(Rn[0].charAt(Rn[0].length-2)==="/"){ctag=parsexmltag(Rn[0],false);if(ctag["number-columns-repeated"])C+=parseInt(ctag["number-columns-repeated"],10);else++C}elseif(Rn[1]!=="/"){++C;rept=1;if(C>range.e.c)range.e.c=C;if(R>range.e.r)range.e.r=R;if(C<range.s.c)range.s.c=C;if(R<range.s.r)range.s.r=R;ctag=parsexmltag(Rn[0],false);q={t:ctag["数据类型"]||ctag["value-type"],v:null};if(opts.cellFormula){if(ctag["number-matrix-columns-spanned"]&&ctag["number-matrix-rows-spanned"]){mR=parseInt(ctag["number-matrix-rows-spanned"],10)||0;mC=parseInt(ctag["number-matrix-columns-spanned"],10)||0;mrange={s:{r:R,c:C},e:{r:R+mR-1,c:C+mC-1}};q.F=encode_range(mrange);arrayf.push([mrange,q.F])}if(ctag.formula)q.f=ods_to_csf_formula(ctag.formula);elsefor(i=0;i<arrayf.length;++i)if(R>=arrayf[i][0].s.r&&R<=arrayf[i][0].e.r)if(C>=arrayf[i][0].s.c&&C<=arrayf[i][0].e.c)q.F=arrayf[i][1]}if(ctag["number-columns-spanned"]||ctag["number-rows-spanned"]){mR=parseInt(ctag["number-rows-spanned"],10)||0;mC=parseInt(ctag["number-columns-spanned"],10)||0;mrange={s:{r:R,c:C},e:{r:R+mR-1,c:C+mC-1}};merges.push(mrange)}if(ctag["number-columns-repeated"])rept=parseInt(ctag["number-columns-repeated"],10);switch(q.t){case"boolean":q.t="b";q.v=parsexmlbool(ctag["boolean-value"]);break;case"float":q.t="n";q.v=parseFloat(ctag.value);break;case"percentage":q.t="n";q.v=parseFloat(ctag.value);break;case"currency":q.t="n";q.v=parseFloat(ctag.value);break;case"date":q.t="n";q.v=datenum(newDate(ctag["date-value"]));q.z="m/d/yy";break;case"time":q.t="n";q.v=parse_isodur(ctag["time-value"])/86400;break;case"number":q.t="n";q.v=parseFloat(ctag["数据数值"]);break;default:if(q.t==="string"||q.t==="text"||!q.t){q.t="s";if(ctag["string-value"]!=null)textp=ctag["string-value"]}elsethrownewError("Unsupported value type "+q.t)}}else{isstub=false;if(q.t==="s"){q.v=textp||"";isstub=textpidx==0}if(textp)q.w=textp;if(!isstub||opts.cellStubs){if(!(opts.sheetRows&&opts.sheetRows<R)){ws[encode_cell