varJSZip=function(data,options){this.files={};this.root="";if(data){this.load(data,options)}};JSZip.signature={LOCAL_FILE_HEADER:"PK",CENTRAL_FILE_HEADER:"PK",CENTRAL_DIRECTORY_END:"PK",ZIP64_CENTRAL_DIRECTORY_LOCATOR:"PK",ZIP64_CENTRAL_DIRECTORY_END:"PK",DATA_DESCRIPTOR:"PK\b"};JSZip.defaults={base64:false,binary:false,dir:false,date:null,compression:null};JSZip.support={arraybuffer:function(){returntypeofArrayBuffer!=="undefined"&&typeofUint8Array!=="undefined"}(),nodebuffer:function(){returntypeofBuffer!=="undefined"}(),uint8array:function(){returntypeofUint8Array!=="undefined"}(),blob:function(){if(typeofArrayBuffer==="undefined"){returnfalse}varbuffer=newArrayBuffer(0);try{returnnewBlob([buffer],{type:"application/zip"}).size===0}catch(e){}try{varBlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;varbuilder=newBlobBuilder;builder.append(buffer);returnbuilder.getBlob("application/zip").size===0}catch(e){}returnfalse}()};JSZip.prototype=function(){vartextEncoder,textDecoder;if(JSZip.support.uint8array&&typeofTextEncoder==="function"&&typeofTextDecoder==="function"){textEncoder=newTextEncoder("utf-8");textDecoder=newTextDecoder("utf-8")}vargetRawData=function(file){if(file._datainstanceofJSZip.CompressedObject){file._data=file._data.getContent();file.options.binary=true;file.options.base64=false;if(JSZip.utils.getTypeOf(file._data)==="uint8array"){varcopy=file._data;file._data=newUint8Array(copy.length);if(copy.length!==0){file._data.set(copy,0)}}}returnfile._data};vargetBinaryData=function(file){varresult=getRawData(file),type=JSZip.utils.getTypeOf(result);if(type==="string"){if(!file.options.binary){if(textEncoder){returntextEncoder.encode(result)}if(JSZip.support.nodebuffer){returnnewBuffer(result,"utf-8")}}returnfile.asBinary()}returnresult};vardataToString=function(asUTF8){varresult=getRawData(this);if(result===null||typeofresult==="undefined"){return""}if(this.options.base64){result=JSZip.base64.decode(result)}if(asUTF8&&this.options.binary){result=JSZip.prototype.utf8decode(result)}else{result=JSZip.utils.transformTo("string",result)}if(!asUTF8&&!this.options.binary){result=JSZip.prototype.utf8encode(result)}returnresult};varZipObject=function(name,data,options){this.name=name;this._data=data;this.options=options};ZipObject.prototype={asText:function(){returndataToString.call(this,true)},asBinary:function(){returndataToString.call(this,false)},asNodeBuffer:function(){varresult=getBinaryData(this);returnJSZip.utils.transformTo("nodebuffer",result)},asUint8Array:function(){varresult=getBinaryData(this);returnJSZip.utils.transformTo("uint8array",result)},asArrayBuffer:function(){returnthis.asUint8Array().buffer}};vardecToHex=function(dec,bytes){varhex="",i;for(i=0;i<bytes;i++){hex+=String.fromCharCode(dec&255);dec=dec>>>8}returnhex};varextend=function(){varresult={},i,attr;for(i=0;i<arguments.length;i++){for(attrinarguments[i]){if(arguments[i].hasOwnProperty(attr)&&typeofresult[attr]==="undefined"){result[attr]=arguments[i][attr]}}}returnresult};varprepareFileAttrs=function(o){o=o||{};if(o.base64===true&&o.binary==null){o.binary=true}o=extend(o,JSZip.defaults);o.date=o.date||newDate;if(o.compression!==null)o.compression=o.compression.toUpperCase();returno};varfileAdd=function(name,data,o){varparent=parentFolder(name),dataType=JSZip.utils.getTypeOf(data);if(parent){folderAdd.call(this,parent)}o=prepareFileAttrs(o);if(o.dir||data===null||typeofdata==="undefined"){o.base64=false;o.binary=false;data=null}elseif(dataType==="string"){if(o.binary&&!o.base64){if(o.optimizedBinaryString!==true){data=JSZip.utils.string2binary(data)}}}else{o.base64=false;o.binary=true;if(!dataType&&!(datainstanceofJSZip.CompressedObject)){thrownewError("The data of '"+name+"' is in an unsupported format !")}if(dataType==="arraybuffer"){data=JSZip.utils.transformTo("uint8array",data)}}varobject=newZipObject(name,data,o);this.files[name]=object;returnobject};varparentFolder=function(path){if(path.slice(-1)=="/"
++dt.M}if(dt.M>=60){dt.M=0;++dt.H}break;case2:if(dt.u>=.5){dt.u=0;++dt.S}if(dt.S>=60){dt.S=0;++dt.M}break}for(i=0;i<out.length;++i){switch(out[i].t){case"t":case"T":case" ":case"D":break;case"X":deleteout[i];break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":out[i].v=write_date(out[i].t,out[i].v,dt);out[i].t="t";break;case"n":case"(":case"?":varjj=i+1;while(out[jj]&&("?D".indexOf(out[jj].t)>-1||" t".indexOf(out[jj].t)>-1&&"?t".indexOf((out[jj+1]||{}).t)>-1&&(out[jj+1].t=="?"||out[jj+1].v=="/")||out[i].t=="("&&")n ".indexOf(out[jj].t)>-1||out[jj].t=="t"&&(out[jj].v=="/"||"$€".indexOf(out[jj].v)>-1||out[jj].v==" "&&(out[jj+1]||{}).t=="?"))){out[i].v+=out[jj].v;deleteout[jj];++jj}out[i].v=write_num(out[i].t,out[i].v,flen>1&&v<0&&i>0&&out[i-1].v=="-"?-v:v);out[i].t="t";i=jj-1;break;case"G":out[i].t="t";out[i].v=general_fmt(v,opts);break}}returnout.map(function(x){returnx.v}).join("")}SSF._eval=eval_fmt;functionchoose_fmt(fmt,v,o){if(typeoffmt==="number")fmt=(o&&o.table?o.table:table_fmt)[fmt];if(typeoffmt==="string")fmt=split_fmt(fmt);varl=fmt.length;if(l<4&&fmt[l-1].indexOf("@")>-1)--l;switch(fmt.length){case1:fmt=fmt[0].indexOf("@")>-1?["General","General","General",fmt[0]]:[fmt[0],fmt[0],fmt[0],"@"];break;case2:fmt=fmt[1].indexOf("@")>-1?[fmt[0],fmt[0],fmt[0],fmt[1]]:[fmt[0],fmt[1],fmt[0],"@"];break;case3:fmt=fmt[2].indexOf("@")>-1?[fmt[0],fmt[1],fmt[0],fmt[2]]:[fmt[0],fmt[1],fmt[2],"@"];break;case4:break;default:throw"cannot find right format for |"+fmt+"|"}if(typeofv!=="number")return[fmt.length,fmt[3]];varff=v>0?fmt[0]:v<0?fmt[1]:fmt[2];if(fmt[0].match(/\[[=<>]/)||fmt[1].match(/\[[=<>]/)){varchk=function(v,rr,out){if(!rr)returnnull;varfound=false;varthresh=Number(rr[2]);switch(rr[1]){case"=":if(v==thresh)found=true;break;case">":if(v>thresh)found=true;break;case"<":if(v<thresh)found=true;break;case"<>":if(v!=thresh)found=true;break;case">=":if(v>=thresh)found=true;break;case"<=":if(v<=thresh)found=true;break}returnfound?out:null};varm1=fmt[0].match(/\[([=<>]*)([-]?\d+)\]/);varm2=fmt[1].match(/\[([=<>]*)([-]?\d+)\]/);returnchk(v,m1,[l,fmt[0]])||chk(v,m2,[l,fmt[1]])||[l,fmt[m1&&m2?2:1]]}return[l,ff]}varformat=functionformat(fmt,v,o){fixopts(o=o||{});if(typeoffmt==="string"&&fmt.toLowerCase()==="general")returngeneral_fmt(v,o);if(typeoffmt==="number")fmt=(o.table||table_fmt)[fmt];varf=choose_fmt(fmt,v,o);if(f[1].toLowerCase()==="general")returngeneral_fmt(v,o);if(v===true)v="TRUE";if(v===false)v="FALSE";if(v===""||typeofv==="undefined")return"";returneval_fmt(f[1],v,o,f[0])};SSF._choose=choose_fmt;SSF._table=table_fmt;SSF.load=function(fmt,idx){table_fmt[idx]=fmt};SSF.format=format;SSF.get_table=function(){returntable_fmt};SSF.load_table=function(tbl){for(vari=0;i!=392;++i)if(tbl[i])SSF.load(tbl[i],i)}};make_ssf(SSF);functionisval(x){returntypeofx!=="undefined"&&x!==null}functionkeys(o){returnObject.keys(o).filter(function(x){returno.hasOwnProperty(x)})}functionevert(obj,arr){varo={};keys(obj).forEach(function(k){if(!obj.hasOwnProperty(k))return;if(!arr)o[obj[k]]=k;else(o[obj[k]]=o[obj[k]]||[]).push(k)});returno}functiongetdata(data){if(!data)returnnull;if(data.data)returndata.name.substr(-4)!==".bin"?data.data:data.data.split("").map(function(x){returnx.charCodeAt(0)});if(data.asNodeBuffer&&typeofBuffer!=="undefined"&&data.name.substr(-4)===".bin")returndata.asNodeBuffer();if(data.asBinary&&data.name.substr(-4)!==".bin")returndata.asBinary();if(data._data&&data._data.getContent){if(data.name.substr(-4)===".bin")returnArray.prototype.slice.call(data._data.getContent());returnArray.prototype.slice.call(data._data.getContent(),0).map(function(x){returnString.fromCharCode(x)}).join("")}returnnull}functiongetzipfile(zip,file){varf=file;if(zip.files[f])returnzip.files[f];f=file.toLowerCase();if(zip.files[f])returnzip.files[f];f=f.replace(/\//g,"\\");if(zip.files[f])returnzip.files[f];thrownewError("Cannot find file "+file+" in zip")}functiongetzipdata(zip,file,safe){if(!safe)returngetdata(getzipfile(zip,file));if(!file)return
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"<mx:ArchID":break;case"<mc:AlternateContent":pass=true;break;case"</mc:AlternateContent>":pass=false;break}});if(XMLNS.main.indexOf(wb.xmlns)===-1)thrownewError("Unknown Namespace: "+wb.xmlns);varz;for(zinWBPropsDef)if(typeofwb.WBProps[z]==="undefined")wb.WBProps[z]=WBPropsDef[z];for(zinCalcPrDef)if(typeofwb.CalcPr[z]==="undefined")wb.CalcPr[z]=CalcPrDef[z];wb.WBView.forEach(function(w){for(varzinWBViewDef)if(typeofw[z]==="undefined")w[z]=WBViewDef[z]});wb.Sheets.forEach(function(w){for(varzinSheetDef)if(typeofw[z]==="undefined")w[z]=SheetDef[z]});_ssfopts.date1904=parsexmlbool(wb.WBProps.date1904,"date1904");returnwb}varWB_XML_ROOT=writextag("workbook",null,{xmlns:XMLNS.main[0],"xmlns:r":XMLNS.r});varwrite_wb_xml=function(wb,opts){varo=[];o.push(XML_HEADER);o.push(WB_XML_ROOT);vardate1904="false";try{date1904=parsexmlbool(wb.Workbook.WBProps.date1904)?"true":"false"}catch(e){date1904="false"}o.push(writextag("workbookPr",null,{date1904:date1904}));o.push("<sheets>");vari=1;wb.SheetNames.forEach(function(s){o.push(writextag("sheet",null,{name:s,sheetId:String(i),"r:id":"rId"+i}));++i});o.push("</sheets>");if(o.length>2){o.push("</workbook>");o[1]=o[1].replace("/>",">")}returno.join("")};varparse_BrtBundleSh=function(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};varparse_wb_bin=function(data,opts){varwb={AppVersion:{},WBProps:{},WBView:[],Sheets:[],CalcPr:{},xmlns:""};varpass=false,z;recordhopper(data,function(val,R){switch(R.n){case"BrtBundleSh":wb.Sheets.push(val);break;case"BrtBeginBook":break;case"BrtFileVersion":break;case"BrtWbProp":break;case"BrtACBegin":break;case"BrtAbsPath15":break;case"BrtACEnd":break;case"BrtBookProtection":break;case"BrtBeginBookViews":break;case"BrtBookView":break;case"BrtEndBookViews":break;case"BrtBeginBundleShs":break;case"BrtEndBundleShs":break;case"BrtBeginFnGroup":break;case"BrtEndFnGroup":break;case"BrtBeginExternals":break;case"BrtSupSelf":break;case"BrtSupBookSrc":break;case"BrtExternSheet":break;case"BrtEndExternals":break;case"BrtName":break;case"BrtCalcProp":break;case"BrtUserBookView":break;case"BrtBeginPivotCacheIDs":break;case"BrtBeginPivotCacheID":break;case"BrtEndPivotCacheID":break;case"BrtEndPivotCacheIDs":break;case"BrtWebOpt":break;case"BrtFileRecover":break;case"BrtFileSharing":break;case"BrtFRTBegin":pass=true;break;case"BrtFRTEnd":pass=false;break;case"BrtEndBook":break;default:if(!pass)thrownewError("Unexpected record "+R.n)}});for(zinWBPropsDef)if(typeofwb.WBProps[z]==="undefined")wb.WBProps[z]=WBPropsDef[z];for(zinCalcPrDef)if(typeofwb.CalcPr[z]==="undefined")wb.CalcPr[z]=CalcPrDef[z];wb.WBView.forEach(function(w){for(varzinWBViewDef)if(typeofw[z]==="undefined")w[z]=WBViewDef[z]});wb.Sheets.forEach(function(w){for(varzinSheetDef)if(typeofw[z]==="undefined")w[z]=SheetDef[z]});_ssfopts.date1904=parsexmlbool(wb.WBProps.date1904,"date1904");returnwb};varwrite_wb_bin=function(wb,opts){};functionparse_wb(data,name,opts){return(name.substr(-4)===".bin"?parse_wb_bin:parse_wb_xml)(data,opts)}functionparse_ws(data,name,opts,rels){return(name.substr(-4)===".bin"?parse_ws_bin:parse_ws_xml)(data,opts,rels)}functionparse_sty(data,name,opts){return(name.substr(-4)===".bin"?parse_sty_bin:parse_sty_xml)(data,opts)}functionparse_sst(data,name,opts){return(name.substr(-4)===".bin"?parse_sst_bin:parse_sst_xml)(data,opts)}functionparse_cmnt(data,name,opts){return(name.substr(-4)===".bin"?parse_comments_bin:parse_comments_xml)(data,opts)}functionparse_cc(data,
functionfix_opts(defaults){returnfunction(opts){defaults.forEach(function(d){if(typeofopts[d[0]]==="undefined")opts[d[0]]=d[1];if(d[2]==="n")opts[d[0]]=Number(opts[d[0]])})}}varfix_read_opts=fix_opts([["cellNF",false],["cellHTML",true],["cellFormula",true],["sheetStubs",false],["sheetRows",0,"n"],["bookDeps",false],["bookSheets",false],["bookProps",false],["bookFiles",false],["bookVBA",false],["WTF",false]]);varfix_write_opts=fix_opts([["bookSST",false],["bookType","xlsx"],["WTF",false]]);functionparse_zip(zip,opts){make_ssf(SSF);opts=opts||{};fix_read_opts(opts);reset_cp();varentries=keys(zip.files).filter(function(x){returnx.substr(-1)!="/"}).sort();vardir=parse_ct(getzipdata(zip,"[Content_Types].xml"),opts);varxlsb=false;varsheets,binname;if(dir.workbooks.length===0){binname="xl/workbook.xml";if(getzipdata(zip,binname,true))dir.workbooks.push(binname)}if(dir.workbooks.length===0){binname="xl/workbook.bin";if(!getzipfile(zip,binname,true))thrownewError("Could not find workbook");dir.workbooks.push(binname);xlsb=true}if(!opts.bookSheets&&!opts.bookProps){strs=[];if(dir.sst)strs=parse_sst(getzipdata(zip,dir.sst.replace(/^\//,"")),dir.sst,opts);styles={};if(dir.style)styles=parse_sty(getzipdata(zip,dir.style.replace(/^\//,"")),dir.style,opts)}varwb=parse_wb(getzipdata(zip,dir.workbooks[0].replace(/^\//,"")),dir.workbooks[0],opts);varprops={},propdata="";if(dir.coreprops.length!==0){propdata=getzipdata(zip,dir.coreprops[0].replace(/^\//,""),true);if(propdata)props=parse_core_props(propdata);if(dir.extprops.length!==0){propdata=getzipdata(zip,dir.extprops[0].replace(/^\//,""),true);if(propdata)parse_ext_props(propdata,props)}}varcustprops={};if(!opts.bookSheets||opts.bookProps){if(dir.custprops.length!==0){propdata=getzipdata(zip,dir.custprops[0].replace(/^\//,""),true);if(propdata)custprops=parse_cust_props(propdata,opts)}}varout={};if(opts.bookSheets||opts.bookProps){if(props.Worksheets&&props.SheetNames.length>0)sheets=props.SheetNames;elseif(wb.Sheets)sheets=wb.Sheets.map(function(x){returnx.name});if(opts.bookProps){out.Props=props;out.Custprops=custprops}if(typeofsheets!=="undefined")out.SheetNames=sheets;if(opts.bookSheets?out.SheetNames:opts.bookProps)returnout}sheets={};vardeps={};if(opts.bookDeps&&dir.calcchain)deps=parse_cc(getzipdata(zip,dir.calcchain.replace(/^\//,"")),dir.calcchain,opts);vari=0;varsheetRels={};varpath,relsPath;if(!props.Worksheets){varwbsheets=wb.Sheets;props.Worksheets=wbsheets.length;props.SheetNames=[];for(varj=0;j!=wbsheets.length;++j){props.SheetNames[j]=wbsheets[j].name}}varnmode=getzipdata(zip,"xl/worksheets/sheet.xml",true)?1:0;for(i=0;i!=props.Worksheets;++i){try{path="xl/worksheets/sheet"+(i+1-nmode)+(xlsb?".bin":".xml");path=path.replace(/sheet0\./,"sheet.");relsPath=path.replace(/^(.*)(\/)([^\/]*)$/,"$1/_rels/$3.rels");sheetRels[props.SheetNames[i]]=parse_rels(getzipdata(zip,relsPath,true),path);sheets[props.SheetNames[i]]=parse_ws(getzipdata(zip,path),path,opts,sheetRels[props.SheetNames[i]])}catch(e){if(opts.WTF)throwe}}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,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.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(wb&&wb.SSF){make_ssf(SSF);SSF.load_table(wb.SSF);opts.revssf=evert(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"?