return(t-a)/(24*60*60*1e3)}varmr=newDate;varpr=hr.getTime()+(mr.getTimezoneOffset()-hr.getTimezoneOffset())*6e4;varvr=mr.getTimezoneOffset();functiongr(e){varr=newDate;r.setTime(e*24*60*60*1e3+pr);if(r.getTimezoneOffset()!==vr){r.setTime(r.getTime()+(r.getTimezoneOffset()-vr)*6e4)}returnr}functionbr(e){varr=0,t=0,a=false;varn=e.match(/P([0-9\.]+Y)?([0-9\.]+M)?([0-9\.]+D)?T([0-9\.]+H)?([0-9\.]+M)?([0-9\.]+S)?/);if(!n)thrownewError("|"+e+"| is not an ISO8601 Duration");for(vari=1;i!=n.length;++i){if(!n[i])continue;t=1;if(i>3)a=true;switch(n[i].slice(n[i].length-1)){case"Y":thrownewError("Unsupported ISO Duration Field: "+n[i].slice(n[i].length-1));case"D":t*=24;case"H":t*=60;case"M":if(!a)thrownewError("Unsupported ISO Duration Field: M");elset*=60;case"S":break;}r+=t*parseInt(n[i],10)}returnr}varwr=newDate("2017-02-19T19:06:09.000Z");varkr=isNaN(wr.getFullYear())?newDate("2/19/17"):wr;varyr=kr.getFullYear()==2017;functionxr(e,r){vart=newDate(e);if(yr){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(kr.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"];vari=newDate(+n[0],+n[1]-1,+n[2],+n[3]||0,+n[4]||0,+n[5]||0);if(e.indexOf("Z")>-1)i=newDate(i.getTime()-i.getTimezoneOffset()*60*1e3);returni}functionSr(e,r){if(C&&Buffer.isBuffer(e)){if(r&&A){if(e[0]==255&&e[1]==254)returnbt(e.slice(2).toString("utf16le"));if(e[1]==254&&e[2]==255)returnbt(d(e.slice(2).toString("binary")))}returne.toString("binary")}if(typeofTextDecoder!=="undefined")try{if(r){if(e[0]==255&&e[1]==254)returnbt(newTextDecoder("utf-16le").decode(e.slice(2)));if(e[0]==254&&e[1]==255)returnbt(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(vari=0;i!=e.length;++i)n.push(String.fromCharCode(e[i]));returnn.join("")}functionCr(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]=Cr(e[t]);returnr}function_r(e,r){vart="";while(t.length<r)t+=e;returnt}functionAr(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}varEr=/^(0?\d|1[0-2])(?:|:([0-5]?\d)(?:|(\.\d+)(?:|:([0-5]?\d))|:([0-5]?\d)(|\.\d+)))\s+([ap])m?$/;functionFr(e){if(!e[2])returnnewDate(1899,11,30,+e[1]%12+(e[7]=="p"?12:0),0,0,0);if(e[3]){if(e[4])returnnewDate(1899,11,30,+e[1]%12+(e[7]=="p"?12:0),+e[2],+e[4],parseFloat(e[3])*1e3);elsereturnnewDate(1899,11,30,e[7]=="p"?12:0,+e[1],+e[2],parseFloat(e[3])*1e3)}elseif(e[5])returnnewDate(1899,11,30,+e[1]%12+(e[7]=="p"?12:0),+e[2],+e[5],e[6]?parseFloat(e[6])*1e3:0);elsereturnnewDate(1899,11,30,+e[1]%12+(e[7]=="p"?12:0),+e[2],0,0)}varTr=["january","february","march","april","may","june","july","august","september","october","november","december"];functionDr(e){varr=e.toLowerCase();vart=r.replace(/\s+/g," ").trim();vara=t.match(Er);if(a)returnFr(a);varn=newDate(e),i=newDate(NaN);vars=n.getYear(),l=n.getMonth(),o=n.getDate();if(isNaN(o))returni;if(r.match(/jan|feb|mar|ap
break;default:if(i&&i.WTF)thrownewError("SYLK bad record "+x);}if(L<1)m=null;break;default:if(i&&i.WTF)thrownewError("SYLK bad record "+x);}}if(v.length>0)p["!rows"]=v;if(g.length>0)p["!cols"]=g;g.forEach(function(e){Ti(e)});if(i&&i.sheetRows)h=h.slice(0,i.sheetRows);return[h,p,y]}functionl(e,r){vart=i(e,r);vara=t[0],n=t[1],s=t[2];varl=Cr(r);l.date1904=(((s||{}).Workbook||{}).WBProps||{}).date1904;varo=Ya(a,l);lr(n).forEach(function(e){o[e]=n[e]});varc=Xa(o,r);lr(s).forEach(function(e){c[e]=s[e]});c.bookType="sylk";returnc}functionc(e,r,t,a){varn="C;Y"+(t+1)+";X"+(a+1)+";K";switch(e.t){case"n":n+=e.v||0;if(e.f&&!e.F)n+=";E"+Es(e.f,{r:t,c:a});break;case"b":n+=e.v?"TRUE":"FALSE";break;case"e":n+=e.w||e.v;break;case"d":n+='"'+(e.w||e.v)+'"';break;case"s":n+='"'+(e.v==null?"":String(e.v)).replace(/"/g,"").replace(/;/g,";;")+'"';break;}returnn}functionf(e,r){r.forEach(function(r,t){vara="F;W"+(t+1)+" "+(t+1)+" ";if(r.hidden)a+="0";else{if(typeofr.width=="number"&&!r.wpx)r.wpx=Ci(r.width);if(typeofr.wpx=="number"&&!r.wch)r.wch=_i(r.wpx);if(typeofr.wch=="number")a+=Math.round(r.wch)}if(a.charAt(a.length-1)!=" ")e.push(a)})}functionu(e,r){r.forEach(function(r,t){vara="F;";if(r.hidden)a+="M0;";elseif(r.hpt)a+="M"+20*r.hpt+";";elseif(r.hpx)a+="M"+20*Mi(r.hpx)+";";if(a.length>2)e.push(a+"R"+(t+1))})}functionh(e,r,t){vara=["ID;PSheetJS;N;E"],n=[];vari=ja(e["!ref"]),s;varl=e["!data"]!=null;varo="\r\n";varh=(((t||{}).Workbook||{}).WBProps||{}).date1904;a.push("P;PGeneral");a.push("F;P0;DG0G8;M255");if(e["!cols"])f(a,e["!cols"]);if(e["!rows"])u(a,e["!rows"]);a.push("B;Y"+(i.e.r-i.s.r+1)+";X"+(i.e.c-i.s.c+1)+";D"+[i.s.c,i.s.r,i.e.c,i.e.r].join(" "));a.push("O;L;D;B"+(h?";V4":"")+";K47;G100 0.001");for(vard=i.s.r;d<=i.e.r;++d){if(l&&!e["!data"][d])continue;varm=[];for(varp=i.s.c;p<=i.e.c;++p){s=l?e["!data"][d][p]:e[Na(p)+Ta(d)];if(!s||s.v==null&&(!s.f||s.F))continue;m.push(c(s,e,d,p,r))}n.push(m.join(o))}returna.join(o)+o+n.join(o)+o+"E"+o}return{to_workbook:l,from_sheet:h}}();varqn=function(){functione(e,t){switch(t.type){case"base64":returnr(S(e),t);case"binary":returnr(e,t);case"buffer":returnr(C&&Buffer.isBuffer(e)?e.toString("binary"):O(e),t);case"array":returnr(Sr(e),t);}thrownewError("Unrecognized type "+t.type)}functionr(e,r){vart=e.split("\n"),a=-1,n=-1,i=0,s=[];for(;i!==t.length;++i){if(t[i].trim()==="BOT"){s[++a]=[];n=0;continue}if(a<0)continue;varl=t[i].trim().split(",");varo=l[0],c=l[1];++i;varf=t[i]||"";while((f.match(/["]/g)||[]).length&1&&i<t.length-1)f+="\n"+t[++i];f=f.trim();switch(+o){case-1:if(f==="BOT"){s[++a]=[];n=0;continue}elseif(f!=="EOD")thrownewError("Unrecognized DIF special command "+f);break;case0:if(f==="TRUE")s[a][n]=true;elseif(f==="FALSE")s[a][n]=false;elseif(!isNaN(Ar(c)))s[a][n]=Ar(c);elseif(!isNaN(Dr(c).getDate()))s[a][n]=xr(c);elses[a][n]=c;++n;break;case1:f=f.slice(1,f.length-1);f=f.replace(/""/g,'"');if(w&&f&&f.match(/^=".*"$/))f=f.slice(2,-1);s[a][n++]=f!==""?f:null;break;}if(f==="EOD")break}if(r&&r.sheetRows)s=s.slice(0,r.sheetRows);returns}functiont(r,t){returnYa(e(r,t),t)}functiona(e,r){vara=Xa(t(e,r),r);a.bookType="dif";returna}functionn(e,r){return"0,"+String(e)+"\r\n"+r}functioni(e){return'1,0\r\n"'+e.replace(/"/g,'""')+'"'}functions(e){varr=w;vart=ja(e["!ref"]);vara=e["!data"]!=null;vars=['TABLE\r\n0,1\r\n"sheetjs"\r\n',"VECTORS\r\n0,"+(t.e.r-t.s.r+1)+'\r\n""\r\n',"TUPLES\r\n0,"+(t.e.c-t.s.c+1)+'\r\n""\r\n','DATA\r\n0,0\r\n""\r\n'];for(varl=t.s.r;l<=t.e.r;++l){varo=a?e["!data"][l]:[];varc="-1,0\r\nBOT\r\n";for(varf=t.s.c;f<=t.e.c;++f){varu=a?o&&o[f]:e[Ba({r:l,c:f})];if(u==null){c+='1,0\r\n""\r\n';continue}switch(u.t){case"n":if(r){if(u.w!=null)c+="0,"+u.w+"\r\nV";elseif(u.v!=null)c+=n(u.v,"V");elseif(u.f!=null&&!u.F)c+=i("="+u.f);elsec+='1,0\r\n""'}else{if(u.v==null)c+='1,0\r\n""';elsec+=n(u.v,"V")}break;case"b":c+=u.v?n(1,"TRUE"):n(0,"FALSE");break;case"s":c+=i(!r||isNaN(+u.v)?u.v:'="'+u.v+'"');break;case"d":if(!u.w)u.w=je(u.z||Z[14],dr(xr(u.v)));if(r)c+=n(u.w,"V");elsec+=i(u.w);break;default:c+='1,0\r\n""';}c+=
}functionpo(e,r){r=r||{};if(Ir(e,"META-INF/manifest.xml"))Dn(Lr(e,"META-INF/manifest.xml"),r);vart=Br(e,"styles.xml");vara=t&&ho(gt(t),r);varn=Br(e,"content.xml");if(!n)thrownewError("Missing content.xml in ODS / UOF file");vari=mo(gt(n),r,a);if(Ir(e,"meta.xml"))i.Props=Bn(Lr(e,"meta.xml"));i.bookType="ods";returni}functionvo(e,r){vart=mo(e,r);t.bookType="fods";returnt}vargo=function(){vare=["<office:master-styles>",'<style:master-page style:name="mp1" style:page-layout-name="mp1">',"<style:header/>",'<style:header-left style:display="false"/>',"<style:footer/>",'<style:footer-left style:display="false"/>',"</style:master-page>","</office:master-styles>"].join("");varr="<office:document-styles "+Et({"xmlns:office":"urn:oasis:names:tc:opendocument:xmlns:office:1.0","xmlns:table":"urn:oasis:names:tc:opendocument:xmlns:table:1.0","xmlns:style":"urn:oasis:names:tc:opendocument:xmlns:style:1.0","xmlns:text":"urn:oasis:names:tc:opendocument:xmlns:text:1.0","xmlns:draw":"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","xmlns:fo":"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:number":"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0","xmlns:svg":"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0","xmlns:of":"urn:oasis:names:tc:opendocument:xmlns:of:1.2","office:version":"1.2"})+">"+e+"</office:document-styles>";returnfunctiont(){returnVr+r}}();functionbo(e,r){vart="number",a="",n={"style:name":r},i="",s=0;e=e.replace(/"[$]"/g,"$");e:{if(e.indexOf(";")>-1){console.error("Unsupported ODS Style Map exported. Using first branch of "+e);e=e.slice(0,e.indexOf(";"))}if(e=="@"){t="text";a="<number:text-content/>";breake}if(e.indexOf(/\$/)>-1){t="currency"}if(e[s]=='"'){i="";while(e[++s]!='"'||e[++s]=='"')i+=e[s];--s;if(e[s+1]=="*"){s++;a+="<number:fill-character>"+it(i.replace(/""/g,'"'))+"</number:fill-character>"}else{a+="<number:text>"+it(i.replace(/""/g,'"'))+"</number:text>"}e=e.slice(s+1);s=0}varl=e.match(/# (\?+)\/(\?+)/);if(l){a+=Ft("number:fraction",null,{"number:min-integer-digits":0,"number:min-numerator-digits":l[1].length,"number:max-denominator-value":Math.max(+l[1].replace(/./g,"9"),+l[2].replace(/./g,"9"))});breake}if(l=e.match(/# (\?+)\/(\d+)/)){a+=Ft("number:fraction",null,{"number:min-integer-digits":0,"number:min-numerator-digits":l[1].length,"number:denominator-value":+l[2]});breake}if(l=e.match(/(\d+)(|\.\d+)%/)){t="percentage";a+=Ft("number:number",null,{"number:decimal-places":l[2]&&l.length-1||0,"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(;s<e.length;++s)switch(i=e[s].toLowerCase()){case"h":;case"s":o=true;--s;breakr;case"m":t:for(varc=s+1;c<e.length;++c)switch(e[c]){case"y":;case"d":breakt;case"h":;case"s":o=true;--s;breakr;};case"y":;case"d":while((e[++s]||"").toLowerCase()==i[0])i+=i[0];--s;switch(i){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="'+(i.length%2?"short":"long")+'" number:textual="'+(i.length>=3?"true":"false")+'"/>';break;case"d":;case"dd":a+='<number:day number:style="'+(i.length%2?"short":"long")+'"/>';break;case"ddd":;case"dddd":a+='<number:day-of-week number:style="'+(i.length%2?"short":"long")+'"/>';break;}break;case'"':while(e[++s]!='"'||e[++s]=='"')i+=e[s];--s;a+="<number:text>"+it(i.slice(1).replace(/""/g,'"'))+"</number:text>";break;case"/":a+="<number:text>"+it(i)+"</number:text>";break;default:console.error("unrecognized character "+i+" in ODF format "+e);}if(!o)breake;e=e.slice(s+1);s=0}if(e.match(/^\[?[hms]/)){if(t=="number")t="time";if(e.match(/\[/)){e=e.replace(/[\[\]]/g,"");n["number:truncate-on-overflow"]="false"}for(;s<e.length;++s)switch(i=e[s].toLowerCase()){case"h":;case"m"
;case137:if(i[1]===80&&i[2]===78&&i[3]===71)thrownewError("PNG Image File is not a spreadsheet");break;case8:if(i[1]===231)thrownewError("Unsupported Multiplan 1.x file!");break;case12:if(i[1]===236)thrownewError("Unsupported Multiplan 2.x file!");if(i[1]===237)thrownewError("Unsupported Multiplan 3.x file!");break;}if(Jn.indexOf(i[0])>-1&&i[2]<=12&&i[3]<=31)returnKn.to_workbook(n,t);return$o(e,n,t,s)}functionUo(e,r){vart=r||{};t.type="file";returnWo(e,t)}functionjo(e,r){switch(r.type){case"base64":;case"binary":break;case"buffer":;case"array":r.type="";break;case"file":returnir(r.file,rr.write(e,{type:C?"buffer":""}));case"string":thrownewError("'string' output type invalid for '"+r.bookType+"' files");default:thrownewError("Unrecognized type "+r.type);}returnrr.write(e,r)}functionHo(e,r){switch(r.bookType){case"ods":returnyo(e,r);case"numbers":returnwrite_numbers_iwa(e,r);case"xlsb":returnOo(e,r);default:returnMo(e,r);}}functionVo(e,r){vart=Cr(r||{});vara=Ho(e,t);returnGo(a,t)}functionXo(e,r){vart=Cr(r||{});vara=Mo(e,t);returnGo(a,t)}functionGo(e,r){vart={};vara=C?"nodebuffer":typeofUint8Array!=="undefined"?"array":"string";if(r.compression)t.compression="DEFLATE";if(r.password)t.type=a;elseswitch(r.type){case"base64":t.type="base64";break;case"binary":t.type="string";break;case"string":thrownewError("'string' output type invalid for '"+r.bookType+"' files");case"buffer":;case"file":t.type=a;break;default:thrownewError("Unrecognized type "+r.type);}varn=e.FullPaths?rr.write(e,{fileType:"zip",type:{nodebuffer:"buffer",string:"binary"}[t.type]||t.type,compression:!!r.compression}):e.generate(t);if(typeofDeno!=="undefined"){if(typeofn=="string"){if(r.type=="binary"||r.type=="base64")returnn;n=newUint8Array(D(n))}}if(r.password&&typeofencrypt_agile!=="undefined")returnjo(encrypt_agile(n,r.password),r);if(r.type==="file")returnir(r.file,n);returnr.type=="string"?gt(n):n}functionYo(e,r){vart=r||{};vara=write_xlscfb(e,t);returnjo(a,t)}functionJo(e,r,t){if(!t)t="";vara=t+e;switch(r.type){case"base64":returny(bt(a));case"binary":returnbt(a);case"string":returne;case"file":returnir(r.file,a,"utf8");case"buffer":{if(C)return_(a,"utf8");elseif(typeofTextEncoder!=="undefined")return(newTextEncoder).encode(a);elsereturnJo(a,{type:"binary"}).split("").map(function(e){returne.charCodeAt(0)})};}thrownewError("Unrecognized type "+r.type)}functionKo(e,r){switch(r.type){case"base64":returnx(e);case"binary":returne;case"string":returne;case"file":returnir(r.file,e,"binary");case"buffer":{if(C)return_(e,"binary");elsereturne.split("").map(function(e){returne.charCodeAt(0)})};}thrownewError("Unrecognized type "+r.type)}functionZo(e,r){switch(r.type){case"string":;case"base64":;case"binary":vart="";for(vara=0;a<e.length;++a)t+=String.fromCharCode(e[a]);returnr.type=="base64"?y(t):r.type=="string"?gt(t):t;case"file":returnir(r.file,e);case"buffer":returne;default:thrownewError("Unrecognized type "+r.type);}}functionqo(e,r){c();Bl(e);vart=Cr(r||{});if(t.cellStyles){t.cellNF=true;t.sheetStubs=true}if(t.type=="array"){t.type="binary";vara=qo(e,t);t.type="array";returnD(a)}returnXo(e,t)}functionQo(e,r){c();Bl(e);vart=Cr(r||{});if(t.cellStyles){t.cellNF=true;t.sheetStubs=true}if(t.type=="array"){t.type="binary";vara=Qo(e,t);t.type="array";returnD(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":returnJo(write_xlml(e,t),t);case"slk":;case"sylk":returnJo(Zn.from_sheet(e.Sheets[e.SheetNames[n]],t,e),t);case"htm":;case"html":returnJo(io(e.Sheets[e.SheetNames[n]],t),t);case"txt":returnKo(cc(e.Sheets[e.SheetNames[n]],t),t);case"csv":returnJo(oc(e.Sheets[e.SheetNames[n]],t),t,"\ufeff");case"dif":returnJo(qn.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"dbf":returnZo(Kn.from_sheet(e.Sheets[e.SheetNames[n]],t),t);case"prn":returnJo(ei.from_sheet(e.Sheets[e.SheetNames