}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
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.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"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_Ver
}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}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?"":"
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);push_defaults_array(wb.WBView,WBViewDef);push_defaults_array(wb.Sheets,SheetDef);_ssfopts.date1904=parsexmlbool(wb.WBProps.date1904,"date1904")}varwbnsregex=/<\w+:workbook/;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":
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":{if(val[0]&&val[1])throw"Unsupported threads: "+val}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)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={};if(opts.biff<5){if(cur_sheet==="")cur_sheet="Sheet1";range={s:{r:0,c:0},e:{r:0,c:0}};varfakebs8={pos:blob.l-length,name:cur_sheet};Directory[fakebs8.pos]=fakebs8;opts.snames.push(cur_sheet)}elsecur_sheet=(Directory[s]||{name:""}).name;mergecells=[];objects=[]}break;case"Number":case"BIFF2NUM":case"BIFF2INT":{temp_val={ixfe:val.ixfe,XF:XFs[val.ixfe],v:val.val,t:"n"};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};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.fo
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({r:R,c:C})]=q;while(--rept>0)ws[encode_cell({r:R,c:++C})]=dup(q);if(range.e.c<=C)range.e.c=C}}else{C+=rept;rept=0}q={};textp=""}break;case"document":case"document-content":case"电子表格文档":case"spreadsheet":case"主体":case"scripts":case"styles":case"font-face-decls":if(Rn[1]==="/"){if((tmp=state.pop())[0]!==Rn[3])throw"Bad state: "+tmp}elseif(Rn[0].charAt(Rn[0].length-2)!=="/")state.push([Rn[3],true]);break;case"meta":case"元数据":case"settings":case"config-item-set":case"config-item-map-indexed":case"config-item-map-entry":case"config-item-map-named":case"shapes":case"frame":case"text-box":case"image":case"data-pilot-tables":case"list-style":case"form":case"dde-links":case"annotation":case"event-listeners":if(Rn[1]==="/"){if((tmp=state.pop())[0]!==Rn[3])throw"Bad state: "+tmp}elseif(Rn[0].charAt(Rn[0].length-2)!=="/")state.push([Rn[3],false]);textp="";textpidx=0;break;case"scientific-number":break;case"currency-symbol":break;case"currency-style":break;case"number-style":case"percentage-style":case"date-style":case"time-style":if(Rn[1]==="/"){number_format_map[NFtag.name]=NF;if((tmp=state.pop())[0]!==Rn[3])throw"Bad state: "+tmp}elseif(Rn[0].charAt(Rn[0].length-2)!=="/"){NF="";NFtag=parsexmltag(Rn[0],false);state.push([Rn[3],true])}break;case"script":break;case"libraries":break;case"automatic-styles":break;case"master-styles":break;case"default-style":case"page-layout":break;case"style":break;case"map":break;case"font-face":break;case"paragraph-properties":break;case"table-properties":break;case"table-column-properties":break;case"table-row-properties":break;case"table-cell-properties":break;case"number":switch(state[state.length-1][0]){case"time-style":case"date-style":tag=parsexmltag(Rn[0],false);NF+=number_formats[Rn[3]][tag.style==="long"?1:0];break}break;case"fraction":break;case"day":case"mo