if(!a)thrownewError("Unsupported ISO Duration Field: M");elset*=60;case"S":break;}r+=t*parseInt(n[s],10)}returnr}varbr=newDate("2017-02-19T19:06:09.000Z");varwr=isNaN(br.getFullYear())?newDate("2/19/17"):br;varkr=wr.getFullYear()==2017;functionyr(e,r){vart=newDate(e);if(kr){if(r>0)t.setTime(t.getTime()+t.getTimezoneOffset()*60*1e3);elseif(r<0)t.setTime(t.getTime()-t.getTimezoneOffset()*60*1e3);returnt}if(einstanceofDate)returne;if(wr.getFullYear()==1917&&!isNaN(t.getFullYear())){vara=t.getFullYear();if(e.indexOf(""+a)>-1)returnt;t.setFullYear(t.getFullYear()+100);returnt}varn=e.match(/\d+/g)||["2017","2","19","0","0","0"];vars=newDate(+n[0],+n[1]-1,+n[2],+n[3]||0,+n[4]||0,+n[5]||0);if(e.indexOf("Z")>-1)s=newDate(s.getTime()-s.getTimezoneOffset()*60*1e3);returns}functionxr(e,r){if(S&&Buffer.isBuffer(e)){if(r&&_){if(e[0]==255&&e[1]==254)returngt(e.slice(2).toString("utf16le"));if(e[1]==254&&e[2]==255)returngt(h(e.slice(2).toString("binary")))}returne.toString("binary")}if(typeofTextDecoder!=="undefined")try{if(r){if(e[0]==255&&e[1]==254)returngt(newTextDecoder("utf-16le").decode(e.slice(2)));if(e[0]==254&&e[1]==255)returngt(newTextDecoder("utf-16be").decode(e.slice(2)))}vart={"€":"","‚":"","ƒ":"","„":"","…":"","†":"","‡":"","ˆ":"","‰":"","Š":"","‹":"","Œ":"","Ž":"","‘":"","’":"","“":"","”":"","•":"","–":"","—":"","˜":"","™":"","š":"","›":"","œ":"","ž":"","Ÿ":""};if(Array.isArray(e))e=newUint8Array(e);returnnewTextDecoder("latin1").decode(e).replace(/[€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ]/g,function(e){returnt[e]||e})}catch(a){}varn=[];for(vars=0;s!=e.length;++s)n.push(String.fromCharCode(e[s]));returnn.join("")}functionSr(e){if(typeofJSON!="undefined"&&!Array.isArray(e))returnJSON.parse(JSON.stringify(e));if(typeofe!="object"||e==null)returne;if(einstanceofDate)returnnewDate(e.getTime());varr={};for(vartine)if(Object.prototype.hasOwnProperty.call(e,t))r[t]=Sr(e[t]);returnr}functionCr(e,r){vart="";while(t.length<r)t+=e;returnt}function_r(e){varr=Number(e);if(!isNaN(r))returnisFinite(r)?r:NaN;if(!/\d/.test(e))returnr;vart=1;vara=e.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g,function(){t*=100;return""});if(!isNaN(r=Number(a)))returnr/t;a=a.replace(/[(](.*)[)]/,function(e,r){t=-t;returnr});if(!isNaN(r=Number(a)))returnr/t;returnr}varAr=/^(0?\d|1[0-2])(?:|:([0-5]?\d)(?:|(\.\d+)(?:|:([0-5]?\d))|:([0-5]?\d)(|\.\d+)))([ap])m?/;functionFr(e){if(!e[2])returnnewDate(1900,0,0,+e[1]%12+(e[7]=="p"?12:0),0,0,0);if(e[3]){if(e[4])returnnewDate(1900,0,0,+e[1]%12+(e[7]=="p"?12:0),+e[2],+e[4],parseFloat(e[3])*1e3);elsereturnnewDate(1900,0,0,e[7]=="p"?12:0,+e[1],+e[2],parseFloat(e[3])*1e3)}elseif(e[5])returnnewDate(1900,0,0,+e[1]%12+(e[7]=="p"?12:0),+e[2],+e[5],e[6]?parseFloat(e[6])*1e3:0);elsereturnnewDate(1900,0,0,+e[1]%12+(e[7]=="p"?12:0),+e[2],0,0)}varEr=["january","february","march","april","may","june","july","august","september","october","november","december"];functionTr(e){varr=e.toLowerCase();vart=r.replace(/\s+/g,"");vara=t.match(Ar);if(a)returnFr(a);varn=newDate(e),s=newDate(NaN);vari=n.getYear(),l=n.getMonth(),o=n.getDate();if(isNaN(o))returns;if(r.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)){r=r.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,"");if(r.length>3&&Er.indexOf(r)==-1)returns}elseif(r.replace(/[ap]m?/,"").match(/[a-z]/))returns;if(i<0||i>8099||e.match(/[^-0-9:,\/\\]/))returns;returnn}varDr=function(){vare="abacaba".split(/(:?b)/i).length==5;returnfunctionr(t,a,n){if(e||typeofa=="string")returnt.split(a);vars=t.split(a),i=[s[0]];for(varl=1;l<s.length;++l){i.push(n);i.push(s[l])}returni}}();functionOr(e){if(!e)returnnull;if(e.content&&e.type)returnxr(e.content,true);if(e.data)returnd(e.data);if(e.asNodeBuffer&&S)returnd(e.asNodeBuffer().toString("binary"));if(e.asBinary)returnd(e.asBinary());if(e._data&&e._data.getContent)returnd
};vars={"!type":"chart","!drawel":null,"!rel":""};vari;varl=e.match(qi);if(l)al(l[0],s,n,t);if(i=e.match(/drawing r:id="(.*?)"/))s["!rel"]=i[1];if(a["!id"][s["!rel"]])s["!drawel"]=a["!id"][s["!rel"]];returns}varAl=[["allowRefreshQuery",false,"bool"],["autoCompressPictures",true,"bool"],["backupFile",false,"bool"],["checkCompatibility",false,"bool"],["CodeName",""],["date1904",false,"bool"],["defaultThemeVersion",0,"int"],["filterPrivacy",false,"bool"],["hidePivotFieldList",false,"bool"],["promptedSolutions",false,"bool"],["publishItems",false,"bool"],["refreshAllConnections",false,"bool"],["saveExternalLinkValues",true,"bool"],["showBorderUnselectedTables",true,"bool"],["showInkAnnotation",true,"bool"],["showObjects","all"],["showPivotChartFilter",false,"bool"],["updateLinks","userSet"]];varFl=[["activeTab",0,"int"],["autoFilterDateGrouping",true,"bool"],["firstSheet",0,"int"],["minimized",false,"bool"],["showHorizontalScroll",true,"bool"],["showSheetTabs",true,"bool"],["showVerticalScroll",true,"bool"],["tabRatio",600,"int"],["visibility","visible"]];varEl=[];varTl=[["calcCompleted","true"],["calcMode","auto"],["calcOnSave","true"],["concurrentCalc","true"],["fullCalcOnLoad","false"],["fullPrecision","true"],["iterate","false"],["iterateCount","100"],["iterateDelta","0.001"],["refMode","A1"]];functionDl(e,r){for(vart=0;t!=e.length;++t){vara=e[t];for(varn=0;n!=r.length;++n){vars=r[n];if(a[s[0]]==null)a[s[0]]=s[1];elseswitch(s[2]){case"bool":if(typeofa[s[0]]=="string")a[s[0]]=ut(a[s[0]]);break;case"int":if(typeofa[s[0]]=="string")a[s[0]]=parseInt(a[s[0]],10);break;}}}}functionOl(e,r){for(vart=0;t!=r.length;++t){vara=r[t];if(e[a[0]]==null)e[a[0]]=a[1];elseswitch(a[2]){case"bool":if(typeofe[a[0]]=="string")e[a[0]]=ut(e[a[0]]);break;case"int":if(typeofe[a[0]]=="string")e[a[0]]=parseInt(e[a[0]],10);break;}}}functionMl(e){Ol(e.WBProps,Al);Ol(e.CalcPr,Tl);Dl(e.WBView,Fl);Dl(e.Sheets,El);Ri.date1904=ut(e.WBProps.date1904)}functionNl(e){if(!e.Workbook)return"false";if(!e.Workbook.WBProps)return"false";returnut(e.Workbook.WBProps.date1904)?"true":"false"}varPl=":][*?/\\".split("");functionIl(e,r){if(e.length>31){if(r)returnfalse;thrownewError("Sheet names cannot exceed 31 chars")}vart=true;Pl.forEach(function(a){if(e.indexOf(a)==-1)return;if(!r)thrownewError("Sheet name cannot contain : \\ / ? * [ ]");t=false});returnt}functionRl(e,r,t){e.forEach(function(a,n){Il(a);for(vars=0;s<n;++s)if(a==e[s])thrownewError("Duplicate Sheet Name: "+a);if(t){vari=r&&r[n]&&r[n].CodeName||a;if(i.charCodeAt(0)==95&&i.length>22)thrownewError("Bad Code Name: Worksheet"+i)}})}functionLl(e){if(!e||!e.SheetNames||!e.Sheets)thrownewError("Invalid Workbook");if(!e.SheetNames.length)thrownewError("Workbook is empty");varr=e.Workbook&&e.Workbook.Sheets||[];Rl(e.SheetNames,r,!!e.vbaraw);for(vart=0;t<e.SheetNames.length;++t)ji(e.Sheets[e.SheetNames[t]],e.SheetNames[t],t);e.SheetNames.forEach(function(r,t){vara=e.Sheets[r];if(!a||!a["!autofilter"])return;varn;if(!e.Workbook)e.Workbook={};if(!e.Workbook.Names)e.Workbook.Names=[];e.Workbook.Names.forEach(function(e){if(e.Name=="_xlnm._FilterDatabase"&&e.Sheet==t)n=e});vars=Wa(r)+"!"+$a(a["!autofilter"].ref);if(n)n.Ref=s;elsee.Workbook.Names.push({Name:"_xlnm._FilterDatabase",Sheet:t,Ref:s})})}varBl=/<\w+:workbook/;functionzl(e,r){if(!e)thrownewError("Could not find file");vart={AppVersion:{},WBProps:{},WBView:[],Sheets:[],CalcPr:{},Names:[],xmlns:""};vara=false,n="xmlns";vars={},i=0;e.replace(Yr,functionl(o,c){varf=Zr(o);switch(qr(f[0])){case"<?xml":break;case"<workbook":if(o.match(Bl))n="xmlns"+o.match(/<(\w+):/)[1];t.xmlns=f[n];break;case"</workbook>":break;case"<fileVersion":deletef[0];t.AppVersion=f;break;case"<fileVersion/>":;case"</fileVersion>":break;case"<fileSharing":break;case"<fileSharing/>":break;case"<workbookPr":;case"<workbookPr/>":Al.forEach(function(e){if(f[e[0]]==null)return;switch(e[2]){case"bool":t.WBProps[e[0]]=ut(f[e[0]]);break;case"int":t.WBProps[e[0]]=parseInt(f[e[0]],10);break;default:t.WBProps[e[0]]=f[e[0]];}});if(f.codeName)
"number:min-decimal-places":l[2]&&l.length-1||0,"number:min-integer-digits":l[1].length})+"<number:text>%</number:text>";breake}varo=false;if(["y","m","d"].indexOf(e[0])>-1){t="date";r:for(;i<e.length;++i)switch(s=e[i].toLowerCase()){case"h":;case"s":o=true;--i;breakr;case"m":t:for(varc=i+1;c<e.length;++c)switch(e[c]){case"y":;case"d":breakt;case"h":;case"s":o=true;--i;breakr;};case"y":;case"d":while((e[++i]||"").toLowerCase()==s[0])s+=s[0];--i;switch(s){case"y":;case"yy":a+="<number:year/>";break;case"yyy":;case"yyyy":a+='<number:year number:style="long"/>';break;case"mmmmm":console.error("ODS has no equivalent of format |mmmmm|");case"m":;case"mm":;case"mmm":;case"mmmm":a+='<number:month number:style="'+(s.length%2?"short":"long")+'" number:textual="'+(s.length>=3?"true":"false")+'"/>';break;case"d":;case"dd":a+='<number:day number:style="'+(s.length%2?"short":"long")+'"/>';break;case"ddd":;case"dddd":a+='<number:day-of-week number:style="'+(s.length%2?"short":"long")+'"/>';break;}break;case'"':while(e[++i]!='"'||e[++i]=='"')s+=e[i];--i;a+="<number:text>"+nt(s.slice(1).replace(/""/g,'"'))+"</number:text>";break;case"/":a+="<number:text>"+nt(s)+"</number:text>";break;default:console.error("unrecognized character "+s+" in ODF format "+e);}if(!o)breake;e=e.slice(i+1);i=0}if(e.match(/^\[?[hms]/)){if(t=="number")t="time";if(e.match(/\[/)){e=e.replace(/[\[\]]/g,"");n["number:truncate-on-overflow"]="false"}for(;i<e.length;++i)switch(s=e[i].toLowerCase()){case"h":;case"m":;case"s":while((e[++i]||"").toLowerCase()==s[0])s+=s[0];--i;switch(s){case"h":;case"hh":a+='<number:hours number:style="'+(s.length%2?"short":"long")+'"/>';break;case"m":;case"mm":a+='<number:minutes number:style="'+(s.length%2?"short":"long")+'"/>';break;case"s":;case"ss":if(e[i+1]==".")do{s+=e[i+1];++i}while(e[i+1]=="0");a+='<number:seconds number:style="'+(s.match("ss")?"long":"short")+'"'+(s.match(/\./)?' number:decimal-places="'+(s.match(/0+/)||[""])[0].length+'"':"")+"/>";break;}break;case'"':while(e[++i]!='"'||e[++i]=='"')s+=e[i];--i;a+="<number:text>"+nt(s.slice(1).replace(/""/g,'"'))+"</number:text>";break;case"/":a+="<number:text>"+nt(s)+"</number:text>";break;case"a":if(e.slice(i,i+3).toLowerCase()=="a/p"){a+="<number:am-pm/>";i+=2;break}if(e.slice(i,i+5).toLowerCase()=="am/pm"){a+="<number:am-pm/>";i+=4;break};default:console.error("unrecognized character "+s+" in ODF format "+e);}breake}if(e.indexOf(/\$/)>-1){t="currency"}if(e[0]=="$"){a+='<number:currency-symbol number:language="en" number:country="US">$</number:currency-symbol>';e=e.slice(1);i=0}i=0;if(e[i]=='"'){while(e[++i]!='"'||e[++i]=='"')s+=e[i];--i;if(e[i+1]=="*"){i++;a+="<number:fill-character>"+nt(s.replace(/""/g,'"'))+"</number:fill-character>"}else{a+="<number:text>"+nt(s.replace(/""/g,'"'))+"</number:text>"}e=e.slice(i+1);i=0}varf=e.match(/([#0][0#,]*)(\.[0#]*|)(E[+]?0*|)/i);if(!f||!f[0])console.error("Could not find numeric part of "+e);else{varu=f[1].replace(/,/g,"");a+="<number:"+(f[3]?"scientific-":"")+"number"+' number:min-integer-digits="'+(u.indexOf("0")==-1?"0":u.length-u.indexOf("0"))+'"'+(f[0].indexOf(",")>-1?' number:grouping="true"':"")+(f[2]&&' number:decimal-places="'+(f[2].length-1)+'"'||' number:decimal-places="0"')+(f[3]&&f[3].indexOf("+")>-1?' number:forced-exponent-sign="true"':"")+(f[3]?' number:min-exponent-digits="'+f[3].match(/0+/)[0].length+'"':"")+">"+"</number:"+(f[3]?"scientific-":"")+"number>";i=f.index+f[0].length}if(e[i]=='"'){s="";while(e[++i]!='"'||e[++i]=='"')s+=e[i];--i;a+="<number:text>"+nt(s.replace(/""/g,'"'))+"</number:text>"}}if(!a){console.error("Could not generate ODS number format for |"+e+"|");return""}returnFt("number:"+t+"-style",a,n)}functionbo(e,r,t){vara=e.filter(function(e){returne.Sheet==(t==-1?null:t)});if(!a.length)return"";return" <table:named-expressions>\n"+a.map(function(e){varr=Pi(e.Ref);return" "+Ft("table:named-range",null,{"table:name":e.Name,"table:cell-range-address":r,"table:base-cell-address":r.replace(/[\.]?[^\.]*$/,".$A$1")})}).join("\n")+"\n </table:named-expressions>\n"}varwo=functi
;case"file":returnnr(r.file,e);case"buffer":returne;default:thrownewError("Unrecognized type "+r.type);}}functionZo(e,r){c();Ll(e);vart=Sr(r||{});if(t.cellStyles){t.cellNF=true;t.sheetStubs=true}if(t.type=="array"){t.type="binary";vara=Zo(e,t);t.type="array";returnT(a)}returnVo(e,t)}functionqo(e,r){c();Ll(e);vart=Sr(r||{});if(t.cellStyles){t.cellNF=true;t.sheetStubs=true}if(t.type=="array"){t.type="binary";vara=qo(e,t);t.type="array";returnT(a)}varn=0;if(t.sheet){if(typeoft.sheet=="number")n=t.sheet;elsen=e.SheetNames.indexOf(t.sheet);if(!e.SheetNames[n])thrownewError("Sheet not found: "+t.sheet+" : "+typeoft.sheet)}switch(t.bookType||"xlsb"){case"xml":;case"xlml":returnYo(write_xlml(e,t),t);case"slk":;case"sylk":returnYo(Kn.from_sheet(e.Sheets[e.SheetNames[n]],t,e),t);case"htm":;case"html":returnYo(no(e.Sheets[e.SheetNames[n]],t),t);case"txt":returnJo(oc(e.Sheets[e.SheetNames[n]],t),t);case"csv":returnYo(lc(e.Sheets[e.SheetNames[n]],t),t,"\ufeff");case"dif":returnYo(Zn.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"dbf":returnKo(Jn.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"prn":returnYo(Qn.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"rtf":returnYo(sheet_to_rtf(e.Sheets[e.SheetNames[n]],t),t);case"eth":returnYo(qn.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"fods":returnYo(ko(e,t),t);case"wk1":returnKo(WK_.sheet_to_wk1(e.Sheets[e.SheetNames[n]],t),t);case"wk3":returnKo(WK_.book_to_wk3(e,t),t);case"biff2":if(!t.biff)t.biff=2;case"biff3":if(!t.biff)t.biff=3;case"biff4":if(!t.biff)t.biff=4;returnKo(write_biff_buf(e,t),t);case"biff5":if(!t.biff)t.biff=5;case"biff8":;case"xla":;case"xls":if(!t.biff)t.biff=8;returnGo(e,t);case"xlsx":;case"xlsm":;case"xlam":;case"xlsb":;case"numbers":;case"ods":returnHo(e,t);default:thrownewError("Unrecognized bookType |"+t.bookType+"|");}}functionQo(e){if(e.bookType)return;varr={xls:"biff8",htm:"html",slk:"sylk",socialcalc:"eth",Sh33tJS:"WTF"};vart=e.file.slice(e.file.lastIndexOf(".")).toLowerCase();if(t.match(/^\.[a-z]+$/))e.bookType=t.slice(1);e.bookType=r[e.bookType]||e.bookType}functionec(e,r,t){vara=t||{};a.type="file";a.file=r;Qo(a);returnqo(e,a)}functionrc(e,r,t){vara=t||{};a.type="file";a.file=r;Qo(a);returnZo(e,a)}functiontc(e,r,t,a){varn=t||{};n.type="file";n.file=e;Qo(n);n.type="buffer";vars=a;if(!(sinstanceofFunction))s=t;returnrr.writeFile(e,qo(r,n),s)}functionac(e,r,t,a,n,s,i,l){varo=Ea(t);varc=l.defval,f=l.raw||!Object.prototype.hasOwnProperty.call(l,"raw");varu=true;varh=n===1?[]:{};if(n!==1){if(Object.defineProperty)try{Object.defineProperty(h,"__rowNum__",{value:t,enumerable:false})}catch(d){h.__rowNum__=t}elseh.__rowNum__=t}if(!i||e[t])for(varm=r.s.c;m<=r.e.c;++m){varp=i?e[t][m]:e[a[m]+o];if(p===undefined||p.t===undefined){if(c===undefined)continue;if(s[m]!=null){h[s[m]]=c}continue}varv=p.v;switch(p.t){case"z":if(v==null)break;continue;case"e":v=v==0?null:void0;break;case"s":;case"d":;case"b":;case"n":break;default:thrownewError("unrecognized type "+p.t);}if(s[m]!=null){if(v==null){if(p.t=="e"&&v===null)h[s[m]]=null;elseif(c!==undefined)h[s[m]]=c;elseif(f&&v===null)h[s[m]]=null;elsecontinue}else{h[s[m]]=f&&(p.t!=="n"||p.t==="n"&&l.rawNumbers!==false)?v:Ha(p,v,l)}if(v!=null)u=false}}return{row:h,isempty:u}}functionnc(e,r){if(e==null||e["!ref"]==null)return[];vart={t:"n",v:0},a=0,n=1,s=[],i=0,l="";varo={s:{r:0,c:0},e:{r:0,c:0}};varc=r||{};varf=c.range!=null?c.range:e["!ref"];if(c.header===1)a=1;elseif(c.header==="A")a=2;elseif(Array.isArray(c.header))a=3;elseif(c.header==null)a=0;switch(typeoff){case"string":o=Ua(f);break;case"number":o=Ua(e["!ref"]);o.s.r=f;break;default:o=f;}if(a>0)n=0;varu=Ea(o.s.r);varh=[];vard=[];varm=0,p=0;varv=Array.isArray(e);varg=o.s.r,b=0;varw={};if(v&&!e[g])e[g]=[];vark=c.skipHidden&&e["!cols"]||[];vary=c.skipHidden&&e["!rows"]||[];for(b=o.s.c;b<=o.e.c;++b){if((k[b]||{}).hidden)continue;h[b]=Ma(b);t=v?e[g][b]:e[h[b]+u];switch(a){case1:s[b]=b-o.s.c;break;case2:s[b]=h[b];break;case3:s[b]=c.header[b-o.s.c];break;default:if(t==null)t={w:"__EMPTY",t:"s"}