sheetjs/xlsx.core.min.js

20 lines
546 KiB
JavaScript
Raw Normal View History

2016-12-31 08:11:36 +00:00
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
2017-05-17 04:27:55 +00:00
(function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd){JSZip=e();define([],e)}else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof $&&$.global?f=$.global:"undefined"!=typeof self&&(f=self),f.JSZip=e()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module,exports){"use strict";var _keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";exports.encode=function(input,utf8){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=(chr1&3)<<4|chr2>>4;enc3=(chr2&15)<<2|chr3>>6;enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64}else if(isNaN(chr3)){enc4=64}output=output+_keyStr.charAt(enc1)+_keyStr.charAt(enc2)+_keyStr.charAt(enc3)+_keyStr.charAt(enc4)}return output};exports.decode=function(input,utf8){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i<input.length){enc1=_keyStr.indexOf(input.charAt(i++));enc2=_keyStr.indexOf(input.charAt(i++));enc3=_keyStr.indexOf(input.charAt(i++));enc4=_keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2)}if(enc4!=64){output=output+String.fromCharCode(chr3)}}return output}},{}],2:[function(_dereq_,module,exports){"use strict";function CompressedObject(){this.compressedSize=0;this.uncompressedSize=0;this.crc32=0;this.compressionMethod=null;this.compressedContent=null}CompressedObject.prototype={getContent:function(){return null},getCompressedContent:function(){return null}};module.exports=CompressedObject},{}],3:[function(_dereq_,module,exports){"use strict";exports.STORE={magic:"\0\0",compress:function(content){return content},uncompress:function(content){return content},compressInputType:null,uncompressInputType:null};exports.DEFLATE=_dereq_("./flate")},{"./flate":8}],4:[function(_dereq_,module,exports){"use strict";var utils=_dereq_("./utils");var table=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,
2017-03-28 22:07:46 +00:00
}return res};exports.findCompression=function(compressionMethod){for(var method in compressions){if(!compressions.hasOwnProperty(method)){continue}if(compressions[method].magic===compressionMethod){return compressions[method]}}return null};exports.isRegExp=function(object){return Object.prototype.toString.call(object)==="[object RegExp]"}},{"./compressions":3,"./nodeBuffer":11,"./support":17}],22:[function(_dereq_,module,exports){"use strict";var StringReader=_dereq_("./stringReader");var NodeBufferReader=_dereq_("./nodeBufferReader");var Uint8ArrayReader=_dereq_("./uint8ArrayReader");var utils=_dereq_("./utils");var sig=_dereq_("./signature");var ZipEntry=_dereq_("./zipEntry");var support=_dereq_("./support");var jszipProto=_dereq_("./object");function ZipEntries(data,loadOptions){this.files=[];this.loadOptions=loadOptions;if(data){this.load(data)}}ZipEntries.prototype={checkSignature:function(expectedSignature){var signature=this.reader.readString(4);if(signature!==expectedSignature){throw new Error("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={};var extraDataSize=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){throw new Error("Multi-volumes zip are not supported")}},readLocalFiles:function(){var i,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(){var file;this.reader.setIndex(this.centralDirOffset);while(this.reader.readString(4)===sig.CENTRAL_FILE_HEADER){file=new ZipEntry({zip64:this.zip64},this.loadOptions);file.readCentralPart(this.reader);this.files.push(file)}},readEndOfCentral:function(){var offset=this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);if(offset===-1){throw new Error("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){throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator")}this.reader.setIndex(offset);this.checkSignature(sig.ZIP64_CENTRAL_D
2017-05-17 04:27:55 +00:00
var bflush;for(;;){if(s.lookahead===0){fill_window(s);if(s.lookahead===0){if(flush===Z_NO_FLUSH){return BS_NEED_MORE}break}}s.match_length=0;bflush=trees._tr_tally(s,0,s.window[s.strstart]);s.lookahead--;s.strstart++;if(bflush){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}}s.insert=0;if(flush===Z_FINISH){flush_block_only(s,true);if(s.strm.avail_out===0){return BS_FINISH_STARTED}return BS_FINISH_DONE}if(s.last_lit){flush_block_only(s,false);if(s.strm.avail_out===0){return BS_NEED_MORE}}return BS_BLOCK_DONE}var Config=function(good_length,max_lazy,nice_length,max_chain,func){this.good_length=good_length;this.max_lazy=max_lazy;this.nice_length=nice_length;this.max_chain=max_chain;this.func=func};var configuration_table;configuration_table=[new Config(0,0,0,0,deflate_stored),new Config(4,4,8,4,deflate_fast),new Config(4,5,16,8,deflate_fast),new Config(4,6,32,32,deflate_fast),new Config(4,4,16,16,deflate_slow),new Config(8,16,32,32,deflate_slow),new Config(8,16,128,128,deflate_slow),new Config(8,32,128,256,deflate_slow),new Config(32,128,258,1024,deflate_slow),new Config(32,258,258,4096,deflate_slow)];function lm_init(s){s.window_size=2*s.w_size;zero(s.head);s.max_lazy_match=configuration_table[s.level].max_lazy;s.good_match=configuration_table[s.level].good_length;s.nice_match=configuration_table[s.level].nice_length;s.max_chain_length=configuration_table[s.level].max_chain;s.strstart=0;s.block_start=0;s.lookahead=0;s.insert=0;s.match_length=s.prev_length=MIN_MATCH-1;s.match_available=0;s.ins_h=0}function DeflateState(){this.strm=null;this.status=0;this.pending_buf=null;this.pending_buf_size=0;this.pending_out=0;this.pending=0;this.wrap=0;this.gzhead=null;this.gzindex=0;this.method=Z_DEFLATED;this.last_flush=-1;this.w_size=0;this.w_bits=0;this.w_mask=0;this.window=null;this.window_size=0;this.prev=null;this.head=null;this.ins_h=0;this.hash_size=0;this.hash_bits=0;this.hash_mask=0;this.hash_shift=0;this.block_start=0;this.match_length=0;this.prev_match=0;this.match_available=0;this.strstart=0;this.match_start=0;this.lookahead=0;this.prev_length=0;this.max_chain_length=0;this.max_lazy_match=0;this.level=0;this.strategy=0;this.good_match=0;this.nice_match=0;this.dyn_ltree=new utils.Buf16(HEAP_SIZE*2);this.dyn_dtree=new utils.Buf16((2*D_CODES+1)*2);this.bl_tree=new utils.Buf16((2*BL_CODES+1)*2);zero(this.dyn_ltree);zero(this.dyn_dtree);zero(this.bl_tree);this.l_desc=null;this.d_desc=null;this.bl_desc=null;this.bl_count=new utils.Buf16(MAX_BITS+1);this.heap=new utils.Buf16(2*L_CODES+1);zero(this.heap);this.heap_len=0;this.heap_max=0;this.depth=new utils.Buf16(2*L_CODES+1);zero(this.depth);this.l_buf=0;this.lit_bufsize=0;this.last_lit=0;this.d_buf=0;this.opt_len=0;this.static_len=0;this.matches=0;this.insert=0;this.bi_buf=0;this.bi_valid=0}function deflateResetKeep(strm){var s;if(!strm||!strm.state){return err(strm,Z_STREAM_ERROR)}strm.total_in=strm.total_out=0;strm.data_type=Z_UNKNOWN;s=strm.state;s.pending=0;s.pending_out=0;if(s.wrap<0){s.wrap=-s.wrap}s.status=s.wrap?INIT_STATE:BUSY_STATE;strm.adler=s.wrap===2?0:1;s.last_flush=Z_NO_FLUSH;trees._tr_init(s);return Z_OK}function deflateReset(strm){var ret=deflateResetKeep(strm);if(ret===Z_OK){lm_init(strm.state)}return ret}function deflateSetHeader(strm,head){if(!strm||!strm.state){return Z_STREAM_ERROR}if(strm.state.wrap!==2){return Z_STREAM_ERROR}strm.state.gzhead=head;return Z_OK}function deflateInit2(strm,level,method,windowBits,memLevel,strategy){if(!strm){return Z_STREAM_ERROR}var wrap=1;if(level===Z_DEFAULT_COMPRESSION){level=6}if(windowBits<0){wrap=0;windowBits=-windowBits}else if(windowBits>15){wrap=2;windowBits-=16}if(memLevel<1||memLevel>MAX_MEM_LEVEL||method!==Z_DEFLATED||windowBits<8||windowBits>15||level<0||level>9||strategy<0||strategy>Z_FIXED){return err(strm,Z_STREAM_ERROR)}if(windowBits===8){windowBits=9}var s=new DeflateState;strm.state=s;s.strm=strm;s.wrap=wrap;s.gzhead=null;s.w_bits=windowBits;s.w_size=1<<s.w_bits;s.w_mask=s.w_size-1;s.hash_bits=memLevel+7;s.hash_size=1<<s.hash_bits;s.hash_mask=s.hash_size-1;s.hash_shift=~~((s.hash_b
2017-07-28 23:54:51 +00:00
exports.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":27,"./adler32":29,"./crc32":31,"./inffast":34,"./inftrees":36}],36:[function(_dereq_,module,exports){"use strict";var utils=_dereq_("../utils/common");var MAXBITS=15;var ENOUGH_LENS=852;var ENOUGH_DISTS=592;var CODES=0;var LENS=1;var DISTS=2;var lbase=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var lext=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78];var dbase=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var dext=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];module.exports=function inflate_table(type,lens,lens_index,codes,table,table_index,work,opts){var bits=opts.bits;var len=0;var sym=0;var min=0,max=0;var root=0;var curr=0;var drop=0;var left=0;var used=0;var huff=0;var incr;var fill;var low;var mask;var next;var base=null;var base_index=0;var end;var count=new utils.Buf16(MAXBITS+1);var offs=new utils.Buf16(MAXBITS+1);var extra=null;var extra_index=0;var here_bits,here_op,here_val;for(len=0;len<=MAXBITS;len++){count[len]=0}for(sym=0;sym<codes;sym++){count[lens[lens_index+sym]]++}root=bits;for(max=MAXBITS;max>=1;max--){if(count[max]!==0){break}}if(root>max){root=max}if(max===0){table[table_index++]=1<<24|64<<16|0;table[table_index++]=1<<24|64<<16|0;opts.bits=1;return 0}for(min=1;min<max;min++){if(count[min]!==0){break}}if(root<min){root=min}left=1;for(len=1;len<=MAXBITS;len++){left<<=1;left-=count[len];if(left<0){return-1}}if(left>0&&(type===CODES||max!==1)){return-1}offs[1]=0;for(len=1;len<MAXBITS;len++){offs[len+1]=offs[len]+count[len]}for(sym=0;sym<codes;sym++){if(lens[lens_index+sym]!==0){work[offs[lens[lens_index+sym]]++]=sym}}if(type===CODES){base=extra=work;end=19}else if(type===LENS){base=lbase;base_index-=257;extra=lext;extra_index-=257;end=256}else{base=dbase;extra=dext;end=-1}huff=0;sym=0;len=min;next=table_index;curr=root;drop=0;low=-1;used=1<<root;mask=used-1;if(type===LENS&&used>ENOUGH_LENS||type===DISTS&&used>ENOUGH_DISTS){return 1}var i=0;for(;;){i++;here_bits=len-drop;if(work[sym]<end){here_op=0;here_val=work[sym]}else if(work[sym]>end){here_op=extra[extra_index+work[sym]];here_val=base[base_index+work[sym]]}else{here_op=32+64;here_val=0}incr=1<<len-drop;fill=1<<curr;min=fill;do{fill-=incr;table[next+(huff>>drop)+fill]=here_bits<<24|here_op<<16|here_val|0}while(fill!==0);incr=1<<len-1;while(huff&incr){incr>>=1}if(incr!==0){huff&=incr-1;huff+=incr}else{huff=0}sym++;if(--count[len]===0){if(len===max){break}len=lens[lens_index+work[sym]]}if(len>root&&(huff&mask)!==low){if(drop===0){drop=root}next+=min;curr=len-drop;left=1<<curr;while(curr+drop<max){left-=count[curr+drop];if(left<=0){break}curr++;left<<=1}used+=1<<curr;if(type===LENS&&used>ENOUGH_LENS||type===DISTS&&used>ENOUGH_DISTS){return 1}low=huff&mask;table[low]=root<<24|curr<<16|next-table_index|0}}if(huff!==0){table[next+huff]=len-drop<<24|64<<16|0}opts.bits=root;return 0}},{"../utils/common":27}],37:[function(_dereq_,module,exports){"use strict";module.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],38:[function(_dereq_,module,exports){"use strict";var utils=_dereq_("../utils/common");var Z_FIXED=4;var Z_BINARY=0;var Z_TEXT=1;var Z_UNKNOWN=2;function zero(buf){var len=buf.length;while(--len>=0){buf[len]=0}}var STORED_BLOCK=0;var STATIC_TREES=1;var DYN_TREES=2;var MIN_MATCH=3;var MAX_MATCH=258;var LENGTH_CODES=29;var LITERALS=256;var L_CODES=LITERALS+1+LENGTH_CODES;var D_CODES=30;var BL_CODES=19;var HEAP_SIZE=2*L_CODES+1;var MAX_BITS=15;var Buf_size=16;var MAX_BL_BITS=7;var END_BLOCK=256;var REP_3_6=16;var REPZ_3_10=17;var REPZ_11_138=18;var extra_lbits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];var extra_dbits=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];var extra_blbits=[0,0,0
})}else o=val.toExponential(idx);if(fmt.match(/E\+00$/)&&o.match(/e[+-]\d$/))o=o.substr(0,o.length-1)+"0"+o.charAt(o.length-1);if(fmt.match(/E\-/)&&o.match(/e\+/))o=o.replace(/e\+/,"e");return o.replace("e","E")}function write_num_int(type,fmt,val){if(type.charCodeAt(0)===40&&!fmt.match(closeparen)){var ffmt=fmt.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");if(val>=0)return write_num_int("n",ffmt,val);return"("+write_num_int("n",ffmt,-val)+")"}if(fmt.charCodeAt(fmt.length-1)===44)return write_num_cm2(type,fmt,val);if(fmt.indexOf("%")!==-1)return write_num_pct2(type,fmt,val);if(fmt.indexOf("E")!==-1)return write_num_exp2(fmt,val);if(fmt.charCodeAt(0)===36)return"$"+write_num_int(type,fmt.substr(fmt.charAt(1)==" "?2:1),val);var o;var r,ri,ff,aval=Math.abs(val),sign=val<0?"-":"";if(fmt.match(/^00+$/))return sign+pad0(aval,fmt.length);if(fmt.match(/^[#?]+$/)){o=""+val;if(val===0)o="";return o.length>fmt.length?o:hashq(fmt.substr(0,fmt.length-o.length))+o}if(r=fmt.match(frac1))return write_num_f2(r,aval,sign);if(fmt.match(/^#+0+$/))return sign+pad0(aval,fmt.length-fmt.indexOf("0"));if(r=fmt.match(dec1)){o=(""+val).replace(/^([^\.]+)$/,"$1."+hashq(r[1])).replace(/\.$/,"."+hashq(r[1]));o=o.replace(/\.(\d*)$/,function($$,$1){return"."+$1+fill("0",hashq(r[1]).length-$1.length)});return fmt.indexOf("0.")!==-1?o:o.replace(/^0\./,".")}fmt=fmt.replace(/^#+([0.])/,"$1");if(r=fmt.match(/^(0*)\.(#*)$/)){return sign+(""+aval).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,r[1].length?"0.":".")}if(r=fmt.match(/^#{1,3},##0(\.?)$/))return sign+commaify(""+aval);if(r=fmt.match(/^#,##0\.([#0]*0)$/)){return val<0?"-"+write_num_int(type,fmt,-val):commaify(""+val)+"."+fill("0",r[1].length)}if(r=fmt.match(/^#,#*,#0/))return write_num_int(type,fmt.replace(/^#,#*,/,""),val);if(r=fmt.match(/^([0#]+)(\\?-([0#]+))+$/)){o=_strrev(write_num_int(type,fmt.replace(/[\\-]/g,""),val));ri=0;return _strrev(_strrev(fmt.replace(/\\/g,"")).replace(/[0#]/g,function(x){return ri<o.length?o.charAt(ri++):x==="0"?"0":""}))}if(fmt.match(phone)){o=write_num_int(type,"##########",val);return"("+o.substr(0,3)+") "+o.substr(3,3)+"-"+o.substr(6)}var oa="";if(r=fmt.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/)){ri=Math.min(r[4].length,7);ff=frac(aval,Math.pow(10,ri)-1,false);o=""+sign;oa=write_num("n",r[1],ff[1]);if(oa.charAt(oa.length-1)==" ")oa=oa.substr(0,oa.length-1)+"0";o+=oa+r[2]+"/"+r[3];oa=rpad_(ff[2],ri);if(oa.length<r[4].length)oa=hashq(r[4].substr(r[4].length-oa.length))+oa;o+=oa;return o}if(r=fmt.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/)){ri=Math.min(Math.max(r[1].length,r[4].length),7);ff=frac(aval,Math.pow(10,ri)-1,true);return sign+(ff[0]||(ff[1]?"":"0"))+" "+(ff[1]?pad_(ff[1],ri)+r[2]+"/"+r[3]+rpad_(ff[2],ri):fill(" ",2*ri+1+r[2].length+r[3].length))}if(r=fmt.match(/^[#0?]+$/)){o=""+val;if(fmt.length<=o.length)return o;return hashq(fmt.substr(0,fmt.length-o.length))+o}if(r=fmt.match(/^([#0]+)\.([#0]+)$/)){o=""+val.toFixed(Math.min(r[2].length,10)).replace(/([^0])0+$/,"$1");ri=o.indexOf(".");var lres=fmt.indexOf(".")-ri,rres=fmt.length-o.length-lres;return hashq(fmt.substr(0,lres)+o+fmt.substr(fmt.length-rres))}if(r=fmt.match(/^00,000\.([#0]*0)$/)){return val<0?"-"+write_num_int(type,fmt,-val):commaify(""+val).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function($$){return"00,"+($$.length<3?pad0(0,3-$$.length):"")+$$})+"."+pad0(0,r[1].length)}switch(fmt){case"###,###":;case"##,###":;case"#,###":var x=commaify(""+aval);return x!=="0"?sign+x:"";default:if(fmt.match(/\.[0#?]*$/))return write_num_int(type,fmt.slice(0,fmt.lastIndexOf(".")),val)+hashq(fmt.slice(fmt.lastIndexOf(".")));}throw new Error("unsupported format |"+fmt+"|")}return function write_num(type,fmt,val){return(val|0)===val?write_num_int(type,fmt,val):write_num_flt(type,fmt,val)}}();function split_fmt(fmt){var out=[];var in_str=false;for(var i=0,j=0;i<fmt.length;++i)switch(fmt.charCodeAt(i)){case 34:in_str=!in_str;break;case 95:;case 42:;case 92:++i;break;case 59:out[out.length]=fmt.substr(j,i-j);j=i+1;}out[out.length]=fmt.substr(j);if(in_str===true)throw new Error("Format |
}}();var vtregex=function(){var vt_cache={};return function vt_regex(bt){if(vt_cache[bt]!==undefined)return vt_cache[bt];return vt_cache[bt]=new RegExp("<(?:vt:)?"+bt+">([\\s\\S]*?)</(?:vt:)?"+bt+">","g")}}();var vtvregex=/<\/?(?:vt:)?variant>/g,vtmregex=/<(?:vt:)([^>]*)>([\s\S]*)</;function parseVector(data){var h=parsexmltag(data);var matches=data.match(vtregex(h.baseType))||[];if(matches.length!=h.size)throw new Error("unexpected vector length "+matches.length+" != "+h.size);var res=[];matches.forEach(function(x){var v=x.replace(vtvregex,"").match(vtmregex);res.push({v:utf8read(v[2]),t:v[1]})});return res}var wtregex=/(^\s|\s$|\n)/;function writetag(f,g){return"<"+f+(g.match(wtregex)?' xml:space="preserve"':"")+">"+g+"</"+f+">"}function wxt_helper(h){return keys(h).map(function(k){return" "+k+'="'+h[k]+'"'}).join("")}function writextag(f,g,h){return"<"+f+(isval(h)?wxt_helper(h):"")+(isval(g)?(g.match(wtregex)?' xml:space="preserve"':"")+">"+g+"</"+f:"/")+">"}function write_w3cdtf(d,t){try{return d.toISOString().replace(/\.\d*/,"")}catch(e){if(t)throw e}return""}function write_vt(s){switch(typeof s){case"string":return writextag("vt:lpwstr",s);case"number":return writextag((s|0)==s?"vt:i4":"vt:r8",String(s));case"boolean":return writextag("vt:bool",s?"true":"false");}if(s instanceof Date)return writextag("vt:filetime",write_w3cdtf(s));throw new Error("Unable to serialize "+s)}var XML_HEADER='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n';var XMLNS={dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",mx:"http://schemas.microsoft.com/office/mac/excel/2008/main",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",sjs:"http://schemas.openxmlformats.org/package/2006/sheetjs/core-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",xsi:"http://www.w3.org/2001/XMLSchema-instance",xsd:"http://www.w3.org/2001/XMLSchema"};XMLNS.main=["http://schemas.openxmlformats.org/spreadsheetml/2006/main","http://purl.oclc.org/ooxml/spreadsheetml/main","http://schemas.microsoft.com/office/excel/2006/main","http://schemas.microsoft.com/office/excel/2006/2"];var XLMLNS={o:"urn:schemas-microsoft-com:office:office",x:"urn:schemas-microsoft-com:office:excel",ss:"urn:schemas-microsoft-com:office:spreadsheet",dt:"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882",mv:"http://macVmlSchemaUri",v:"urn:schemas-microsoft-com:vml",html:"http://www.w3.org/TR/REC-html40"};function read_double_le(b,idx){var s=1-2*(b[idx+7]>>>7);var e=((b[idx+7]&127)<<4)+(b[idx+6]>>>4&15);var m=b[idx+6]&15;for(var i=5;i>=0;--i)m=m*256+b[idx+i];if(e==2047)return m==0?s*Infinity:NaN;if(e==0)e=-1022;else{e-=1023;m+=Math.pow(2,52)}return s*Math.pow(2,e-52)*m}function write_double_le(b,v,idx){var bs=(v<0||1/v==-Infinity?1:0)<<7,e=0,m=0;var av=bs?-v:v;if(!isFinite(av)){e=2047;m=isNaN(v)?26985:0}else{e=Math.floor(Math.log(av)*Math.LOG2E);m=v*Math.pow(2,52-e);if(e<=-1023&&(!isFinite(m)||m<Math.pow(2,52))){e=-1022}else{m-=Math.pow(2,52);e+=1023}}for(var i=0;i<=5;++i,m/=256)b[idx+i]=m&255;b[idx+6]=(e&15)<<4|m&15;b[idx+7]=e>>4|bs}var __toBuffer,___toBuffer;__toBuffer=___toBuffer=function toBuffer_(bufs){var x=[];for(var i=0;i<bufs[0].length;++i){x.push.apply(x,bufs[0][i])}return x};var __utf16le,___utf16le;__utf16le=___utf16le=function utf16le_(b,s,e){var ss=[];for(var i=s;i<e;i+=2)ss.push(String.fromCharCode(__readUInt16LE(b,i)));return ss.join("")};var __hexlify,___hexlify;__hexlify=___hexlify=function hexlify_(b,s,l){return b.slice(s,s+l).map(function(x){return(x<16?"0":"")+x.toString(16)}).join("")};var __utf8,___utf8;__utf8=___utf8=function(b,s,e){var ss=[];for(var i=s;i<e;i++)ss.push(String.fromCharCode(__readUInt8(b,i)));return ss.join("")};var __lpstr,___lpstr;__lpstr=___lpstr=function lpstr_(b,i){var len=__readUInt32LE(b,i);return len>0?__utf8(b,i+4,i+4+len-1):""};var __lpwstr,___lpwstr;__lpwstr=___lpwstr=function lpwstr_(b,i){var len=2*__readUInt32LE(b,i);return len>0?__utf8(b,i+4,i+4+len-1):""};var __lpp4,___lpp4;__lpp4=___lpp4=function lpp4_(b,i){var len=
var ct=new_ct();if(!data||!data.match)return ct;var ctext={};(data.match(tagregex)||[]).forEach(function(x){var y=parsexmltag(x);switch(y[0].replace(nsregex,"<")){case"<?xml":break;case"<Types":ct.xmlns=y["xmlns"+(y[0].match(/<(\w+):/)||["",""])[1]];break;case"<Default":ctext[y.Extension]=y.ContentType;break;case"<Override":if(ct[ct2type[y.ContentType]]!==undefined)ct[ct2type[y.ContentType]].push(y.PartName);break;}});if(ct.xmlns!==XMLNS.CT)throw new Error("Unknown Namespace: "+ct.xmlns);ct.calcchain=ct.calcchains.length>0?ct.calcchains[0]:"";ct.sst=ct.strs.length>0?ct.strs[0]:"";ct.style=ct.styles.length>0?ct.styles[0]:"";ct.defaults=ctext;delete ct.calcchains;return ct}var CTYPE_XML_ROOT=writextag("Types",null,{xmlns:XMLNS.CT,"xmlns:xsd":XMLNS.xsd,"xmlns:xsi":XMLNS.xsi});var CTYPE_DEFAULTS=[["xml","application/xml"],["bin","application/vnd.ms-excel.sheet.binary.macroEnabled.main"],["vml","application/vnd.openxmlformats-officedocument.vmlDrawing"],["bmp","image/bmp"],["png","image/png"],["gif","image/gif"],["emf","image/x-emf"],["wmf","image/x-wmf"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["tif","image/tiff"],["tiff","image/tiff"],["pdf","application/pdf"],["rels",type2ct.rels[0]]].map(function(x){return writextag("Default",null,{Extension:x[0],ContentType:x[1]})});function write_ct(ct,opts){var o=[],v;o[o.length]=XML_HEADER;o[o.length]=CTYPE_XML_ROOT;o=o.concat(CTYPE_DEFAULTS);var f1=function(w){if(ct[w]&&ct[w].length>0){v=ct[w][0];o[o.length]=writextag("Override",null,{PartName:(v[0]=="/"?"":"/")+v,ContentType:CT_LIST[w][opts.bookType||"xlsx"]})}};var f2=function(w){(ct[w]||[]).forEach(function(v){o[o.length]=writextag("Override",null,{PartName:(v[0]=="/"?"":"/")+v,ContentType:CT_LIST[w][opts.bookType||"xlsx"]})})};var f3=function(t){(ct[t]||[]).forEach(function(v){o[o.length]=writextag("Override",null,{PartName:(v[0]=="/"?"":"/")+v,ContentType:type2ct[t][0]})})};f1("workbooks");f2("sheets");f2("charts");f3("themes");["strs","styles"].forEach(f1);["coreprops","extprops","custprops"].forEach(f3);f3("vba");f3("comments");f3("drawings");if(o.length>2){o[o.length]="</Types>";o[1]=o[1].replace("/>",">")}return o.join("")}var RELS={WB:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",SHEET:"http://sheetjs.openxmlformats.org/officeDocument/2006/relationships/officeDocument",HLINK:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",VML:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",VBA:"http://schemas.microsoft.com/office/2006/relationships/vbaProject"};function get_rels_path(file){var n=file.lastIndexOf("/");return file.substr(0,n+1)+"_rels/"+file.substr(n+1)+".rels"}function parse_rels(data,currentFilePath){if(!data)return data;if(currentFilePath.charAt(0)!=="/"){currentFilePath="/"+currentFilePath}var rels={};var hash={};(data.match(tagregex)||[]).forEach(function(x){var y=parsexmltag(x);if(y[0]==="<Relationship"){var rel={};rel.Type=y.Type;rel.Target=y.Target;rel.Id=y.Id;rel.TargetMode=y.TargetMode;var canonictarget=y.TargetMode==="External"?y.Target:resolve_path(y.Target,currentFilePath);rels[canonictarget]=rel;hash[y.Id]=rel}});rels["!id"]=hash;return rels}XMLNS.RELS="http://schemas.openxmlformats.org/package/2006/relationships";var RELS_ROOT=writextag("Relationships",null,{xmlns:XMLNS.RELS});function write_rels(rels){var o=[XML_HEADER,RELS_ROOT];keys(rels["!id"]).forEach(function(rid){o[o.length]=writextag("Relationship",null,rels["!id"][rid])});if(o.length>2){o[o.length]="</Relationships>";o[1]=o[1].replace("/>",">")}return o.join("")}function add_rels(rels,rId,f,type,relobj){if(!relobj)relobj={};if(!rels["!id"])rels["!id"]={};if(rId<0)for(rId=1;rels["!id"]["rId"+rId];++rId){}relobj.Id="rId"+rId;relobj.Type=type;relobj.Target=f;if(relobj.Type==RELS.HLINK)relobj.TargetMode="External";if(rels["!id"][relobj.Id])throw new Error("Cannot rewrite rId "+rId);rels["!id"][relobj.Id]=relobj;rels[("/"+relobj.Target).replace("//","/")]=relobj;return rId}var CT_ODS="application/vnd.oasis.opendocument.spreadsheet";function parse_mani
return[numFmtId,fmtstr]}var parse_BIFF2Format=parse_XLUnicodeString2;function parse_Dimensions(blob,length,opts){var end=blob.l+length;var w=opts.biff==8||!opts.biff?4:2;var r=blob.read_shift(w),R=blob.read_shift(w);var c=blob.read_shift(2),C=blob.read_shift(2);blob.l=end;return{s:{r:r,c:c},e:{r:R,c:C}}}function parse_RK(blob,length){var rw=blob.read_shift(2),col=blob.read_shift(2);var rkrec=parse_RkRec(blob);return{r:rw,c:col,ixfe:rkrec[0],rknum:rkrec[1]}}function parse_MulRk(blob,length){var target=blob.l+length-2;var rw=blob.read_shift(2),col=blob.read_shift(2);var rkrecs=[];while(blob.l<target)rkrecs.push(parse_RkRec(blob));if(blob.l!==target)throw new Error("MulRK read error");var lastcol=blob.read_shift(2);if(rkrecs.length!=lastcol-col+1)throw new Error("MulRK length mismatch");return{r:rw,c:col,C:lastcol,rkrec:rkrecs}}function parse_MulBlank(blob,length){var target=blob.l+length-2;var rw=blob.read_shift(2),col=blob.read_shift(2);var ixfes=[];while(blob.l<target)ixfes.push(blob.read_shift(2));if(blob.l!==target)throw new Error("MulBlank read error");var lastcol=blob.read_shift(2);if(ixfes.length!=lastcol-col+1)throw new Error("MulBlank length mismatch");return{r:rw,c:col,C:lastcol,ixfe:ixfes}}function parse_CellStyleXF(blob,length,style,opts){var o={};var a=blob.read_shift(4),b=blob.read_shift(4);var c=blob.read_shift(4),d=blob.read_shift(2);o.patternType=XLSFillPattern[c>>26];if(!opts.cellStyles)return o;o.alc=a&7;o.fWrap=a>>3&1;o.alcV=a>>4&7;o.fJustLast=a>>7&1;o.trot=a>>8&255;o.cIndent=a>>16&15;o.fShrinkToFit=a>>20&1;o.iReadOrder=a>>22&2;o.fAtrNum=a>>26&1;o.fAtrFnt=a>>27&1;o.fAtrAlc=a>>28&1;o.fAtrBdr=a>>29&1;o.fAtrPat=a>>30&1;o.fAtrProt=a>>31&1;o.dgLeft=b&15;o.dgRight=b>>4&15;o.dgTop=b>>8&15;o.dgBottom=b>>12&15;o.icvLeft=b>>16&127;o.icvRight=b>>23&127;o.grbitDiag=b>>30&3;o.icvTop=c&127;o.icvBottom=c>>7&127;o.icvDiag=c>>14&127;o.dgDiag=c>>21&15;o.icvFore=d&127;o.icvBack=d>>7&127;o.fsxButton=d>>14&1;return o}function parse_CellXF(blob,length,opts){return parse_CellStyleXF(blob,length,0,opts)}function parse_StyleXF(blob,length,opts){return parse_CellStyleXF(blob,length,1,opts)}function parse_XF(blob,length,opts){var o={};o.ifnt=blob.read_shift(2);o.numFmtId=blob.read_shift(2);o.flags=blob.read_shift(2);o.fStyle=o.flags>>2&1;length-=6;o.data=parse_CellStyleXF(blob,length,o.fStyle,opts);return o}function parse_Guts(blob,length){blob.l+=4;var out=[blob.read_shift(2),blob.read_shift(2)];if(out[0]!==0)out[0]--;if(out[1]!==0)out[1]--;if(out[0]>7||out[1]>7)throw new Error("Bad Gutters: "+out.join("|"));return out}function parse_BoolErr(blob,length,opts){var cell=parse_XLSCell(blob,6);if(opts.biff==2)++blob.l;var val=parse_Bes(blob,2);cell.val=val;cell.t=val===true||val===false?"b":"e";return cell}function parse_Number(blob,length){var cell=parse_XLSCell(blob,6);var xnum=parse_Xnum(blob,8);cell.val=xnum;return cell}var parse_XLHeaderFooter=parse_OptXLUnicodeString;function parse_SupBook(blob,length,opts){var end=blob.l+length;var ctab=blob.read_shift(2);var cch=blob.read_shift(2);opts.sbcch=cch;if(cch==1025||cch==14849)return[cch,ctab];if(cch<1||cch>255)throw new Error("Unexpected SupBook type: "+cch);var virtPath=parse_XLUnicodeStringNoCch(blob,cch);var rgst=[];while(end>blob.l)rgst.push(parse_XLUnicodeString(blob));return[cch,ctab,virtPath,rgst]}function parse_ExternName(blob,length,opts){var flags=blob.read_shift(2);var body;var o={fBuiltIn:flags&1,fWantAdvise:flags>>>1&1,fWantPict:flags>>>2&1,fOle:flags>>>3&1,fOleLink:flags>>>4&1,cf:flags>>>5&1023,fIcon:flags>>>15&1};if(opts.sbcch===14849)body=parse_AddinUdf(blob,length-2,opts);o.body=body||blob.read_shift(length-2);if(typeof body==="string")o.Name=body;return o}var XLSLblBuiltIn=["_xlnm.Consolidate_Area","_xlnm.Auto_Open","_xlnm.Auto_Close","_xlnm.Extract","_xlnm.Database","_xlnm.Criteria","_xlnm.Print_Area","_xlnm.Print_Titles","_xlnm.Recorder","_xlnm.Data_Form","_xlnm.Auto_Activate","_xlnm.Auto_Deactivate","_xlnm.Sheet_Title","_xlnm._FilterDatabase"];function parse_Lbl(blob,length,opts){var target=blob.l+length;var flags=blob.read_shift(2);var chKey=blob.read_shift(
for(C=1;C<=(lines[R].length-start)/10+1;++C)set_text_arr(lines[R].slice(start+(C-1)*10,start+C*10).trim(),arr,R,C,o)}return arr}function dsv_to_sheet_str(str,opts){var o=opts||{};var sep="";if(DENSE!=null&&o.dense==null)o.dense=DENSE;var ws=o.dense?[]:{};var range={s:{c:0,r:0},e:{c:0,r:0}};if(str.substr(0,4)=="sep="&&str.charCodeAt(5)==10){sep=str.charAt(4);str=str.substr(6)}else if(str.substr(0,1024).indexOf("\t")==-1)sep=",";else sep="\t";var R=0,C=0,v=0;var start=0,end=0,sepcc=sep.charCodeAt(0),instr=false,cc=0;str=str.replace(/\r\n/gm,"\n");var _re=o.dateNF!=null?dateNF_regex(o.dateNF):null;function finish_cell(){var s=str.slice(start,end);var cell={};if(o.raw){cell.t="s";cell.v=s}else if(s.charCodeAt(0)==61){cell.t="n";cell.f=s.substr(1)}else if(s=="TRUE"){cell.t="b";cell.v=true}else if(s=="FALSE"){cell.t="b";cell.v=false}else if(!isNaN(v=+s)){cell.t="n";cell.w=s;cell.v=v}else if(!isNaN(fuzzydate(s).getDate())||_re&&s.match(_re)){cell.z=o.dateNF||SSF._table[14];var k=0;if(_re&&s.match(_re)){s=dateNF_fix(s,o.dateNF,s.match(_re)||[]);k=1}if(o.cellDates){cell.t="d";cell.v=parseDate(s,k)}else{cell.t="n";cell.v=datenum(parseDate(s,k))}cell.w=SSF.format(cell.z,cell.v instanceof Date?datenum(cell.v):cell.v)}else{cell.t="s";if(s.charAt(0)=='"'&&s.charAt(s.length-1)=='"')s=s.slice(1,-1).replace(/""/g,'"');cell.v=s}if(o.dense){if(!ws[R])ws[R]=[];ws[R][C]=cell}else ws[encode_cell({c:C,r:R})]=cell;start=end+1;if(range.e.c<C)range.e.c=C;if(range.e.r<R)range.e.r=R;if(cc==sepcc)++C;else{C=0;++R}}for(;end<str.length;++end)switch(cc=str.charCodeAt(end)){case 34:instr=!instr;break;case sepcc:;case 10:;case 13:if(!instr)finish_cell();break;default:break;}if(end-start>0)finish_cell();ws["!ref"]=encode_range(range);return ws}function prn_to_sheet_str(str,opts){if(str.substr(0,4)=="sep=")return dsv_to_sheet_str(str,opts);if(str.indexOf("\t")>=0||str.indexOf(",")>=0)return dsv_to_sheet_str(str,opts);return aoa_to_sheet(prn_to_aoa_str(str,opts),opts)}function prn_to_sheet(d,opts){var str="",bytes=firstbyte(d,opts);switch(opts.type){case"base64":str=Base64.decode(d);break;case"binary":str=d;break;case"buffer":str=d.toString("binary");break;case"array":str=cc2str(d);break;default:throw new Error("Unrecognized type "+opts.type);}if(bytes[0]==239&&bytes[1]==187&&bytes[2]==191)str=utf8read(str);return prn_to_sheet_str(str,opts)}function prn_to_workbook(d,opts){return sheet_to_workbook(prn_to_sheet(d,opts),opts)}function sheet_to_prn(ws,opts){var o=[];var r=decode_range(ws["!ref"]),cell;var dense=Array.isArray(ws);for(var R=r.s.r;R<=r.e.r;++R){var oo=[];for(var C=r.s.c;C<=r.e.c;++C){var coord=encode_cell({r:R,c:C});cell=dense?(ws[R]||[])[C]:ws[coord];if(!cell||cell.v==null){oo.push(" ");continue}var w=(cell.w||(format_cell(cell),cell.w)||"").substr(0,10);while(w.length<10)w+=" ";oo.push(w+(C==0?" ":""))}o.push(oo.join(""))}return o.join("\n")}return{to_workbook:prn_to_workbook,to_sheet:prn_to_sheet,from_sheet:sheet_to_prn}}();function read_wb_ID(d,opts){var o=opts||{},OLD_WTF=!!o.WTF;o.WTF=true;try{var out=SYLK.to_workbook(d,o);o.WTF=OLD_WTF;return out}catch(e){o.WTF=OLD_WTF;if(!e.message.match(/SYLK bad record ID/)&&OLD_WTF)throw e;return PRN.to_workbook(d,opts)}}var WK_=function(){function lotushopper(data,cb,opts){if(!data)return;prep_blob(data,data.l||0);var Enum=opts.Enum||WK1Enum;while(data.l<data.length){var RT=data.read_shift(2);var R=Enum[RT]||Enum[255];var length=data.read_shift(2);var tgt=data.l+length;var d=R.f(data,length,opts);data.l=tgt;if(cb(d,R.n,RT))return}}function lotus_to_workbook(d,opts){switch(opts.type){case"base64":return lotus_to_workbook_buf(s2a(Base64.decode(d)),opts);case"binary":return lotus_to_workbook_buf(s2a(d),opts);case"buffer":;case"array":return lotus_to_workbook_buf(d,opts);}throw"Unsupported type "+opts.type}function lotus_to_workbook_buf(d,opts){if(!d)return d;var o=opts||{};if(DENSE!=null&&o.dense==null)o.dense=DENSE;var s=o.dense?[]:{},n="Sheet1",sidx=0;var sheets={},snames=[n];var refguess={s:{r:0,c:0},e:{r:0,c:0}};if(d[2]==2)o.Enum=WK1Enum;else if(d[2]==26)o.Enum=WK3Enum;else if(d[2]==14){o.E
if(j>392){for(j=392;j>60;--j)if(styles.NumberFmt[j]==null)break;styles.NumberFmt[j]=f}SSF.load(f,j)}}break;case"</numFmt>":break;default:if(opts.WTF)throw new Error("unrecognized "+y[0]+" in numFmts");}}}function write_numFmts(NF,opts){var o=["<numFmts>"];[[5,8],[23,26],[41,44],[50,392]].forEach(function(r){for(var i=r[0];i<=r[1];++i)if(NF[i]!=null)o[o.length]=writextag("numFmt",null,{numFmtId:i,formatCode:escapexml(NF[i])})});if(o.length===1)return"";o[o.length]="</numFmts>";o[0]=writextag("numFmts",null,{count:o.length-2}).replace("/>",">");return o.join("")}var cellXF_uint=["numFmtId","fillId","fontId","borderId","xfId"];var cellXF_bool=["applyAlignment","applyBorder","applyFill","applyFont","applyNumberFormat","applyProtection","pivotButton","quotePrefix"];function parse_cellXfs(t,styles,opts){styles.CellXf=[];var xf;t[0].match(tagregex).forEach(function(x){var y=parsexmltag(x),i=0;switch(y[0]){case"<cellXfs":;case"<cellXfs>":;case"<cellXfs/>":;case"</cellXfs>":break;case"<xf":;case"<xf/>":xf=y;delete xf[0];for(i=0;i<cellXF_uint.length;++i)if(xf[cellXF_uint[i]])xf[cellXF_uint[i]]=parseInt(xf[cellXF_uint[i]],10);for(i=0;i<cellXF_bool.length;++i)if(xf[cellXF_bool[i]])xf[cellXF_bool[i]]=parsexmlbool(xf[cellXF_bool[i]],"");if(xf.numFmtId>392){for(i=392;i>60;--i)if(styles.NumberFmt[xf.numFmtId]==styles.NumberFmt[i]){xf.numFmtId=i;break}}styles.CellXf.push(xf);break;case"</xf>":break;case"<alignment":;case"<alignment/>":var alignment={};if(y.vertical)alignment.vertical=y.vertical;if(y.horizontal)alignment.horizontal=y.horizontal;if(y.textRotation!=null)alignment.textRotation=y.textRotation;if(y.indent)alignment.indent=y.indent;if(y.wrapText)alignment.wrapText=y.wrapText;xf.alignment=alignment;break;case"</alignment>":break;case"<protection":;case"</protection>":;case"<protection/>":break;case"<extLst":;case"</extLst>":break;case"<ext":break;default:if(opts.WTF)throw new Error("unrecognized "+y[0]+" in cellXfs");}})}function write_cellXfs(cellXfs){var o=[];o[o.length]=writextag("cellXfs",null);cellXfs.forEach(function(c){o[o.length]=writextag("xf",null,c)});o[o.length]="</cellXfs>";if(o.length===2)return"";o[0]=writextag("cellXfs",null,{count:o.length-2}).replace("/>",">");return o.join("")}var parse_sty_xml=function make_pstyx(){var numFmtRegex=/<numFmts([^>]*)>[\S\s]*?<\/numFmts>/;var cellXfRegex=/<cellXfs([^>]*)>[\S\s]*?<\/cellXfs>/;var fillsRegex=/<fills([^>]*)>[\S\s]*?<\/fills>/;var fontsRegex=/<fonts([^>]*)>[\S\s]*?<\/fonts>/;var bordersRegex=/<borders([^>]*)>[\S\s]*?<\/borders>/;return function parse_sty_xml(data,themes,opts){var styles={};if(!data)return styles;data=data.replace(/<!--([\s\S]*?)-->/gm,"").replace(/<!DOCTYPE[^\[]*\[[^\]]*\]>/gm,"");var t;if(t=data.match(numFmtRegex))parse_numFmts(t,styles,opts);if(t=data.match(fontsRegex))parse_fonts(t,styles,themes,opts);if(t=data.match(fillsRegex))parse_fills(t,styles,themes,opts);if(t=data.match(bordersRegex))parse_borders(t,styles,themes,opts);if(t=data.match(cellXfRegex))parse_cellXfs(t,styles,opts);return styles}}();var STYLES_XML_ROOT=writextag("styleSheet",null,{xmlns:XMLNS.main[0],"xmlns:vt":XMLNS.vt});RELS.STY="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles";function write_sty_xml(wb,opts){var o=[XML_HEADER,STYLES_XML_ROOT],w;if(wb.SSF&&(w=write_numFmts(wb.SSF))!=null)o[o.length]=w;o[o.length]='<fonts count="1"><font><sz val="12"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts>';o[o.length]='<fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills>';o[o.length]='<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>';o[o.length]='<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>';if(w=write_cellXfs(opts.cellXfs))o[o.length]=w;o[o.length]='<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>';o[o.length]='<dxfs count="0"/>';o[o.length]='<tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="Piv
if(!c.t)c.t="";delete c.rfx;out.push(c);break;case 35:pass=true;break;case 36:pass=false;break;case 37:break;case 38:break;default:if((R_n||"").indexOf("Begin")>0){}else if((R_n||"").indexOf("End")>0){}else if(!pass||opts.WTF)throw new Error("Unexpected record "+RT+" "+R_n);}});return out}function write_comments_bin(data,opts){var ba=buf_array();var iauthor=[];write_record(ba,"BrtBeginComments");{write_record(ba,"BrtBeginCommentAuthors");data.forEach(function(comment){comment[1].forEach(function(c){if(iauthor.indexOf(c.a)>-1)return;iauthor.push(c.a.substr(0,54));write_record(ba,"BrtCommentAuthor",write_BrtCommentAuthor(c.a))})});write_record(ba,"BrtEndCommentAuthors")}{write_record(ba,"BrtBeginCommentList");data.forEach(function(comment){comment[1].forEach(function(c){c.iauthor=iauthor.indexOf(c.a);var range={s:decode_cell(comment[0]),e:decode_cell(comment[0])};write_record(ba,"BrtBeginComment",write_BrtBeginComment([range,c]));if(c.t&&c.t.length>0)write_record(ba,"BrtCommentText",write_BrtCommentText(c));write_record(ba,"BrtEndComment");delete c.iauthor})});write_record(ba,"BrtEndCommentList")}write_record(ba,"BrtEndComments");return ba.end()}RELS.DS="http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet";RELS.MS="http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet";function parse_ds_bin(data,opts,rels,wb,themes,styles){return{"!type":"dialog"}}function parse_ds_xml(data,opts,rels,wb,themes,styles){return{"!type":"dialog"}}function parse_ms_bin(data,opts,rels,wb,themes,styles){return{"!type":"macro"}}function parse_ms_xml(data,opts,rels,wb,themes,styles){return{"!type":"macro"}}var rc_to_a1=function(){var rcregex=/(^|[^A-Za-z])R(\[?)(-?\d+|)\]?C(\[?)(-?\d+|)\]?/g;var rcbase={r:0,c:0};function rcfunc($$,$1,$2,$3,$4,$5){var R=$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;var cRel=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?"":"$")+encode_row(R)}return function rc_to_a1(fstr,base){rcbase=base;return fstr.replace(rcregex,rcfunc)}}();var crefregex=/(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)([1-9]\d{0,5}|10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6])(?![_.\(A-Za-z0-9])/g;var a1_to_rc=function(){return function a1_to_rc(fstr,base){return fstr.replace(crefregex,function($0,$1,$2,$3,$4,$5,off,str){var c=decode_col($3)-base.c;var r=decode_row($5)-base.r;return $1+"R"+(r==0?"":"["+r+"]")+"C"+(c==0?"":"["+c+"]")})}}();function shift_formula_str(f,delta){return f.replace(crefregex,function($0,$1,$2,$3,$4,$5,off,str){return $1+($2=="$"?$2+$3:encode_col(decode_col($3)+delta.c))+($4=="$"?$4+$5:encode_row(decode_row($5)+delta.r))})}function shift_formula_xlsx(f,range,cell){var r=decode_range(range),s=r.s,c=decode_cell(cell);var delta={r:c.r-s.r,c:c.c-s.c};return shift_formula_str(f,delta)}function parseread(l){return function(blob,length){blob.l+=l;return}}function parseread1(blob){blob.l+=1;return}function parse_ColRelU(blob,length){var c=blob.read_shift(length==1?1:2);return[c&16383,c>>14&1,c>>15&1]}function parse_RgceArea(blob,length,opts){var w=2;if(opts){if(opts.biff>=2&&opts.biff<=5)return parse_RgceArea_BIFF2(blob,length,opts);else if(opts.biff==12)w=4}var r=blob.read_shift(w),R=blob.read_shift(w);var c=parse_ColRelU(blob,2);var C=parse_ColRelU(blob,2);return{s:{r:r,c:c[0],cRel:c[1],rRel:c[2]},e:{r:R,c:C[0],cRel:C[1],rRel:C[2]}}}function parse_RgceArea_BIFF2(blob){var r=parse_ColRelU(blob,2),R=parse_ColRelU(blob,2);var c=blob.read_shift(1);var C=blob.read_shift(1);return{s:{r:r[0],c:c,cRel:r[1],rRel:r[2]},e:{r:R[0],c:C,cRel:R[1],rRel:R[2]}}}function parse_RgceAreaRel(blob,length){var r=blob.read_shift(length==12?4:2),R=blob.read_shift(length==12?4:2);var c=parse_ColRelU(blob,2);var C=parse_ColRelU(blob,2);return{s:{r:r,c:c[0],cRel:c[1],rRel:c[2]},e:{r:R,c:C[0],cRel:C[1],rRel:C[2]}}}function parse_RgceLoc(blob,length,opts){if(opts&&opts.biff>=2
121:"CODE",122:"NAMES",123:"DIRECTORY",124:"FIND",125:"CELL",126:"ISERR",127:"ISTEXT",128:"ISNUMBER",129:"ISBLANK",130:"T",131:"N",132:"FOPEN",133:"FCLOSE",134:"FSIZE",135:"FREADLN",136:"FREAD",137:"FWRITELN",138:"FWRITE",139:"FPOS",140:"DATEVALUE",141:"TIMEVALUE",142:"SLN",143:"SYD",144:"DDB",145:"GET.DEF",146:"REFTEXT",147:"TEXTREF",148:"INDIRECT",149:"REGISTER",150:"CALL",151:"ADD.BAR",152:"ADD.MENU",153:"ADD.COMMAND",154:"ENABLE.COMMAND",155:"CHECK.COMMAND",156:"RENAME.COMMAND",157:"SHOW.BAR",158:"DELETE.MENU",159:"DELETE.COMMAND",160:"GET.CHART.ITEM",161:"DIALOG.BOX",162:"CLEAN",163:"MDETERM",164:"MINVERSE",165:"MMULT",166:"FILES",167:"IPMT",168:"PPMT",169:"COUNTA",170:"CANCEL.KEY",171:"FOR",172:"WHILE",173:"BREAK",174:"NEXT",175:"INITIATE",176:"REQUEST",177:"POKE",178:"EXECUTE",179:"TERMINATE",180:"RESTART",181:"HELP",182:"GET.BAR",183:"PRODUCT",184:"FACT",185:"GET.CELL",186:"GET.WORKSPACE",187:"GET.WINDOW",188:"GET.DOCUMENT",189:"DPRODUCT",190:"ISNONTEXT",191:"GET.NOTE",192:"NOTE",193:"STDEVP",194:"VARP",195:"DSTDEVP",196:"DVARP",197:"TRUNC",198:"ISLOGICAL",199:"DCOUNTA",200:"DELETE.BAR",201:"UNREGISTER",204:"USDOLLAR",205:"FINDB",206:"SEARCHB",207:"REPLACEB",208:"LEFTB",209:"RIGHTB",210:"MIDB",211:"LENB",212:"ROUNDUP",213:"ROUNDDOWN",214:"ASC",215:"DBCS",216:"RANK",219:"ADDRESS",220:"DAYS360",221:"TODAY",222:"VDB",223:"ELSE",224:"ELSE.IF",225:"END.IF",226:"FOR.CELL",227:"MEDIAN",228:"SUMPRODUCT",229:"SINH",230:"COSH",231:"TANH",232:"ASINH",233:"ACOSH",234:"ATANH",235:"DGET",236:"CREATE.OBJECT",237:"VOLATILE",238:"LAST.ERROR",239:"CUSTOM.UNDO",240:"CUSTOM.REPEAT",241:"FORMULA.CONVERT",242:"GET.LINK.INFO",243:"TEXT.BOX",244:"INFO",245:"GROUP",246:"GET.OBJECT",247:"DB",248:"PAUSE",251:"RESUME",252:"FREQUENCY",253:"ADD.TOOLBAR",254:"DELETE.TOOLBAR",255:"User",256:"RESET.TOOLBAR",257:"EVALUATE",258:"GET.TOOLBAR",259:"GET.TOOL",260:"SPELLING.CHECK",261:"ERROR.TYPE",262:"APP.TITLE",263:"WINDOW.TITLE",264:"SAVE.TOOLBAR",265:"ENABLE.TOOL",266:"PRESS.TOOL",267:"REGISTER.ID",268:"GET.WORKBOOK",269:"AVEDEV",270:"BETADIST",271:"GAMMALN",272:"BETAINV",273:"BINOMDIST",274:"CHIDIST",275:"CHIINV",276:"COMBIN",277:"CONFIDENCE",278:"CRITBINOM",279:"EVEN",280:"EXPONDIST",281:"FDIST",282:"FINV",283:"FISHER",284:"FISHERINV",285:"FLOOR",286:"GAMMADIST",287:"GAMMAINV",288:"CEILING",289:"HYPGEOMDIST",290:"LOGNORMDIST",291:"LOGINV",292:"NEGBINOMDIST",293:"NORMDIST",294:"NORMSDIST",295:"NORMINV",296:"NORMSINV",297:"STANDARDIZE",298:"ODD",299:"PERMUT",300:"POISSON",301:"TDIST",302:"WEIBULL",303:"SUMXMY2",304:"SUMX2MY2",305:"SUMX2PY2",306:"CHITEST",307:"CORREL",308:"COVAR",309:"FORECAST",310:"FTEST",311:"INTERCEPT",312:"PEARSON",313:"RSQ",314:"STEYX",315:"SLOPE",316:"TTEST",317:"PROB",318:"DEVSQ",319:"GEOMEAN",320:"HARMEAN",321:"SUMSQ",322:"KURT",323:"SKEW",324:"ZTEST",325:"LARGE",326:"SMALL",327:"QUARTILE",328:"PERCENTILE",329:"PERCENTRANK",330:"MODE",331:"TRIMMEAN",332:"TINV",334:"MOVIE.COMMAND",335:"GET.MOVIE",336:"CONCATENATE",337:"POWER",338:"PIVOT.ADD.DATA",339:"GET.PIVOT.TABLE",340:"GET.PIVOT.FIELD",341:"GET.PIVOT.ITEM",342:"RADIANS",343:"DEGREES",344:"SUBTOTAL",345:"SUMIF",346:"COUNTIF",347:"COUNTBLANK",348:"SCENARIO.GET",349:"OPTIONS.LISTS.GET",350:"ISPMT",351:"DATEDIF",352:"DATESTRING",353:"NUMBERSTRING",354:"ROMAN",355:"OPEN.DIALOG",356:"SAVE.DIALOG",357:"VIEW.GET",358:"GETPIVOTDATA",359:"HYPERLINK",360:"PHONETIC",361:"AVERAGEA",362:"MAXA",363:"MINA",364:"STDEVPA",365:"VARPA",366:"STDEVA",367:"VARA",368:"BAHTTEXT",369:"THAIDAYOFWEEK",370:"THAIDIGIT",371:"THAIMONTHOFYEAR",372:"THAINUMSOUND",373:"THAINUMSTRING",374:"THAISTRINGLENGTH",375:"ISTHAIDIGIT",376:"ROUNDBAHTDOWN",377:"ROUNDBAHTUP",378:"THAIYEAR",379:"RTD",380:"CUBEVALUE",381:"CUBEMEMBER",382:"CUBEMEMBERPROPERTY",383:"CUBERANKEDMEMBER",384:"HEX2BIN",385:"HEX2DEC",386:"HEX2OCT",387:"DEC2BIN",388:"DEC2HEX",389:"DEC2OCT",390:"OCT2BIN",391:"OCT2HEX",392:"OCT2DEC",393:"BIN2DEC",394:"BIN2OCT",395:"BIN2HEX",396:"IMSUB",397:"IMDIV",398:"IMPOWER",399:"IMABS",400:"IMSQRT",401:"IMLN",402:"IMLOG2",403:"IMLOG10",404:"IMSIN",405:"IMCOS",406:"IMEXP",407:"IMARGUMENT",408:"IMCONJUGATE",409:"
display:display}}function write_BrtHLink(l,rId,o){if(o==null)o=new_buf(50+4*l[1].Target.length);write_UncheckedRfX({s:decode_cell(l[0]),e:decode_cell(l[0])},o);write_RelID("rId"+rId,o);var locidx=l[1].Target.indexOf("#");var loc=locidx==-1?"":l[1].Target.substr(locidx+1);write_XLWideString(loc||"",o);write_XLWideString(l[1].Tooltip||"",o);write_XLWideString("",o);return o.slice(0,o.l)}function parse_BrtArrFmla(data,length,opts){var end=data.l+length;var rfx=parse_RfX(data,16);var fAlwaysCalc=data.read_shift(1);var o=[rfx];o[2]=fAlwaysCalc;if(opts.cellFormula){var formula=parse_XLSBArrayParsedFormula(data,end-data.l,opts);o[1]=formula}else data.l=end;return o}function parse_BrtShrFmla(data,length,opts){var end=data.l+length;var rfx=parse_UncheckedRfX(data,16);var o=[rfx];if(opts.cellFormula){var formula=parse_XLSBSharedParsedFormula(data,end-data.l,opts);o[1]=formula;data.l=end}else data.l=end;return o}function write_BrtColInfo(C,col,o){if(o==null)o=new_buf(18);var p=col_obj_w(C,col);o.write_shift(-4,C);o.write_shift(-4,C);o.write_shift(4,(p.width||10)*256);o.write_shift(4,0);var flags=0;if(col.hidden)flags|=1;if(typeof p.width=="number")flags|=2;o.write_shift(1,flags);o.write_shift(1,0);return o}function parse_BrtMargins(data,length,opts){return{left:parse_Xnum(data,8),right:parse_Xnum(data,8),top:parse_Xnum(data,8),bottom:parse_Xnum(data,8),header:parse_Xnum(data,8),footer:parse_Xnum(data,8)}}function write_BrtMargins(margins,o){if(o==null)o=new_buf(6*8);default_margins(margins);write_Xnum(margins.left,o);write_Xnum(margins.right,o);write_Xnum(margins.top,o);write_Xnum(margins.bottom,o);write_Xnum(margins.header,o);write_Xnum(margins.footer,o);return o}function write_BrtBeginWsView(ws,o){if(o==null)o=new_buf(30);o.write_shift(2,924);o.write_shift(4,0);o.write_shift(4,0);o.write_shift(4,0);o.write_shift(1,0);o.write_shift(1,0);o.write_shift(2,0);o.write_shift(2,100);o.write_shift(2,0);o.write_shift(2,0);o.write_shift(2,0);o.write_shift(4,0);return o}function write_BrtSheetProtection(sp,o){if(o==null)o=new_buf(16*4+2);o.write_shift(2,sp.password?crypto_CreatePasswordVerifier_Method1(sp.password):0);o.write_shift(4,1);[["objects",false],["scenarios",false],["formatCells",true],["formatColumns",true],["formatRows",true],["insertColumns",true],["insertRows",true],["insertHyperlinks",true],["deleteColumns",true],["deleteRows",true],["selectLockedCells",false],["sort",true],["autoFilter",true],["pivotTables",true],["selectUnlockedCells",false]].forEach(function(n){if(n[1])o.write_shift(4,sp[n[0]]!=null&&!sp[n[0]]?1:0);else o.write_shift(4,sp[n[0]]!=null&&sp[n[0]]?0:1)});return o}function parse_ws_bin(data,_opts,rels,wb,themes,styles){if(!data)return data;var opts=_opts||{};if(!rels)rels={"!id":{}};if(DENSE!=null&&opts.dense==null)opts.dense=DENSE;var s=opts.dense?[]:{};var ref;var refguess={s:{r:2e6,c:2e6},e:{r:0,c:0}};var pass=false,end=false;var row,p,cf,R,C,addr,sstr,rr,cell;var mergecells=[];opts.biff=12;opts["!row"]=0;var ai=0,af=false;var array_formulae=[];var shared_formulae={};var supbooks=[[]];supbooks.sharedf=shared_formulae;supbooks.arrayf=array_formulae;supbooks.SheetNames=wb.SheetNames||wb.Sheets.map(function(x){return x.name});opts.supbooks=supbooks;for(var i=0;i<wb.Names.length;++i)supbooks[0][i+1]=wb.Names[i];var colinfo=[],rowinfo=[];var defwidth=0,defheight=0;var seencol=false;recordhopper(data,function ws_parse(val,R_n,RT){if(end)return;switch(RT){case 148:ref=val;break;case 0:row=val;if(opts.sheetRows&&opts.sheetRows<=row.r)end=true;rr=encode_row(R=row.r);opts["!row"]=row.r;if(val.hidden||val.hpt||val.level!=null){if(val.hpt)val.hpx=pt2px(val.hpt);rowinfo[val.r]=val}break;case 2:;case 3:;case 4:;case 5:;case 6:;case 7:;case 8:;case 9:;case 10:;case 11:p={t:val[2]};switch(val[2]){case"n":p.v=val[1];break;case"s":sstr=strs[val[1]];p.v=sstr.t;p.r=sstr.r;break;case"b":p.v=val[1]?true:false;break;case"e":p.v=val[1];if(opts.cellText!==false)p.w=BErr[p.v];break;case"str":p.t="s";p.v=utf8read(val[1]);break;}if(cf=styles.CellXf[val[0].iStyleRef])safe_format(p,cf.numFmtId,null,opts,themes,styles);C=val[0].c;if(opts.
if(cell.v!==cell.v)cell.v=unescapexml(xml);else if(cell.v<60)cell.v=cell.v-1;if(!nf||nf=="General")nf="yyyy-mm-dd";case"Number":if(cell.v===undefined)cell.v=+xml;if(!cell.t)cell.t="n";break;case"Error":cell.t="e";cell.v=RBErr[xml];if(o.cellText!==false)cell.w=xml;break;default:cell.t="s";cell.v=xlml_fixstr(ss||xml);break;}safe_format_xlml(cell,nf,o);if(o.cellFormula!==false){if(cell.Formula){var fstr=unescapexml(cell.Formula);if(fstr.charCodeAt(0)==61)fstr=fstr.substr(1);cell.f=rc_to_a1(fstr,base);delete cell.Formula;if(cell.ArrayRange=="RC")cell.F=rc_to_a1("RC:RC",base);else if(cell.ArrayRange){cell.F=rc_to_a1(cell.ArrayRange,base);arrayf.push([safe_decode_range(cell.F),cell.F])}}else{for(i=0;i<arrayf.length;++i)if(base.r>=arrayf[i][0].s.r&&base.r<=arrayf[i][0].e.r)if(base.c>=arrayf[i][0].s.c&&base.c<=arrayf[i][0].e.c)cell.F=arrayf[i][1]}}if(o.cellStyles){interiors.forEach(function(x){if(!S.patternType&&x.patternType)S.patternType=x.patternType});cell.s=S}cell.ixfe=cell.StyleID!==undefined?cell.StyleID:"Default"}function xlml_clean_comment(comment){comment.t=comment.v||"";comment.t=comment.t.replace(/\r\n/g,"\n").replace(/\r/g,"\n");comment.v=comment.w=comment.ixfe=undefined}function xlml_normalize(d){if(has_buf&&Buffer.isBuffer(d))return d.toString("utf8");if(typeof d==="string")return d;throw new Error("Bad input format: expected Buffer or string")}var xlmlregex=/<(\/?)([^\s?>!\/:]*:|)([^\s?>]*[^\s?>\/])[^>]*>/gm;function parse_xlml_xml(d,_opts){var opts=_opts||{};make_ssf(SSF);var str=debom(xlml_normalize(d));if(opts&&opts.type=="binary"&&typeof cptable!=="undefined")str=cptable.utils.decode(65001,char_codes(str));var opening=str.slice(0,1024).toLowerCase(),ishtml=false;if(opening.indexOf("<?xml")==-1)["html","table","head","meta","script","style","div"].forEach(function(tag){if(opening.indexOf("<"+tag)>=0)ishtml=true});if(ishtml)return HTML_.to_workbook(str,opts);var Rn;var state=[],tmp;if(DENSE!=null&&opts.dense==null)opts.dense=DENSE;var sheets={},sheetnames=[],cursheet=opts.dense?[]:{},sheetname="";var table={},cell={},row={};var dtag=xlml_parsexmltag('<Data ss:Type="String">'),didx=0;var c=0,r=0;var refguess={s:{r:2e6,c:2e6},e:{r:0,c:0}};var styles={},stag={};var ss="",fidx=0;var mergecells=[];var Props={},Custprops={},pidx=0,cp={};var comments=[],comment={};var cstys=[],csty,seencol=false;var arrayf=[];var rowinfo=[],rowobj={};var Workbook={Sheets:[],WBProps:{date1904:false}},wsprops={};xlmlregex.lastIndex=0;str=str.replace(/<!--([\s\S]*?)-->/gm,"");while(Rn=xlmlregex.exec(str))switch(Rn[3]){case"Data":if(state[state.length-1][1])break;if(Rn[1]==="/")parse_xlml_data(str.slice(didx,Rn.index),ss,dtag,state[state.length-1][0]=="Comment"?comment:cell,{c:c,r:r},styles,cstys[c],row,arrayf,opts);else{ss="";dtag=xlml_parsexmltag(Rn[0]);didx=Rn.index+Rn[0].length}break;case"Cell":if(Rn[1]==="/"){if(comments.length>0)cell.c=comments;if((!opts.sheetRows||opts.sheetRows>r)&&cell.v!==undefined){if(opts.dense){if(!cursheet[r])cursheet[r]=[];cursheet[r][c]=cell}else cursheet[encode_col(c)+encode_row(r)]=cell}if(cell.HRef){cell.l={Target:cell.HRef,Tooltip:cell.HRefScreenTip};delete cell.HRef;delete cell.HRefScreenTip}if(cell.MergeAcross||cell.MergeDown){var cc=c+(parseInt(cell.MergeAcross,10)|0);var rr=r+(parseInt(cell.MergeDown,10)|0);mergecells.push({s:{c:c,r:r},e:{c:cc,r:rr}})}if(!opts.sheetStubs){if(cell.MergeAcross)c=cc+1;else++c}else if(cell.MergeAcross||cell.MergeDown){for(var cma=c;cma<=cc;++cma){for(var cmd=r;cmd<=rr;++cmd){if(cma>c||cmd>r){if(opts.dense){if(!cursheet[cmd])cursheet[cmd]=[];cursheet[cmd][cma]={t:"z"}}else cursheet[encode_col(cma)+encode_row(cmd)]={t:"z"}}}}c=cc+1}else++c}else{cell=xlml_parsexmltagobj(Rn[0]);if(cell.Index)c=+cell.Index-1;if(c<refguess.s.c)refguess.s.c=c;if(c>refguess.e.c)refguess.e.c=c;if(Rn[0].slice(-2)==="/>")++c;comments=[]}break;case"Row":if(Rn[1]==="/"||Rn[0].slice(-2)==="/>"){if(r<refguess.s.r)refguess.s.r=r;if(r>refguess.e.r)refguess.e.r=r;if(Rn[0].slice(-2)==="/>"){row=xlml_parsexmltag(Rn[0]);if(row.Index)r=+row.Index-1}c=0;++r}else{row=xlml_parsexmltag(Rn[0]);if(row.Index)r=+r
name:""}).name;if(val.dt==32)out["!type"]="chart";mergecells=[];objects=[];array_formulae=[];opts.arrayf=array_formulae;colinfo=[];rowinfo=[];defwidth=defheight=0;seencol=false;wsprops={Hidden:(Directory[s]||{hs:0}).hs,name:cur_sheet}}break;case"Number":;case"BIFF2NUM":;case"BIFF2INT":{if(out["!type"]=="chart")if(options.dense?(out[val.r]||[])[val.c]:out[encode_cell({c:val.c,r:val.r})])++val.c;temp_val={ixfe:val.ixfe,XF:XFs[val.ixfe]||{},v:val.val,t:"n"};if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];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};if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];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"};if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options)}break;case"MulRk":{for(var j=val.c;j<=val.C;++j){var ixfe=val.rkrec[j-val.c][0];temp_val={ixfe:ixfe,XF:XFs[ixfe],v:val.rkrec[j-val.c][1],t:"n"};if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:j,r:val.r},temp_val,options)}}break;case"Formula":{if(val.val=="String"){last_formula=val;break}temp_val=make_cell(val.val,val.cell.ixfe,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);else temp_val.F=((options.dense?(out[_fr]||[])[_fc]:out[_fe])||{}).F}else temp_val.f=""+stringify_formula(val.formula,range,val.cell,supbooks,opts)}if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell(val.cell,temp_val,options);last_formula=val}break;case"String":{if(last_formula){last_formula.val=val;temp_val=make_cell(val,last_formula.cell.ixfe,"s");temp_val.XF=XFs[temp_val.ixfe];if(options.cellFormula){temp_val.f=""+stringify_formula(last_formula.formula,range,last_formula.cell,supbooks,opts)}if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell(last_formula.cell,temp_val,options);last_formula=null}else throw new Error("String record expects Formula")}break;case"Array":{array_formulae.push(val);var _arraystart=encode_cell(val[0].s);cc=options.dense?(out[val[0].s.r]||[])[val[0].s.c]:out[_arraystart];if(options.cellFormula&&cc){if(!last_formula)break;if(!_arraystart||!cc)break;cc.f=""+stringify_formula(val[1],range,val[0],supbooks,opts);cc.F=encode_range(val[0])}}break;case"ShrFmla":{if(!cell_valid)break;if(!options.cellFormula)break;if(last_cell){if(!last_formula)break;shared_formulae[encode_cell(last_formula.cell)]=val[0];cc=options.dense?(out[last_formula.cell.r]||[])[last_formula.cell.c]:out[encode_cell(last_formula.cell)];(cc||{}).f=""+stringify_formula(val[0],range,lastcell,supbooks,opts)}}break;case"LabelSst":temp_val=make_cell(sst[val.isst].t,val.ixfe,"s");temp_val.XF=XFs[temp_val.ixfe];if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options);break;case"Blank":if(options.sheetStubs){temp_val={ixfe:val.ixfe,XF:XFs[val.ixfe],t:"z"};if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:val.c,r:val.r},temp_val,options)}break;case"MulBlank":if(options.sheetStubs){for(var _j=val.c;_j<=val.C;++_j){var _ixfe=val.ixfe[_j-val.c];temp_val={ixfe:_ixfe,XF:XFs[_ixfe],t:"z"};if(BIFF2Fmt>0)temp_val.z=BIFF2FmtTable[temp_val.ixfe>>8&31];safe_format_xf(temp_val,options,wb.opts.Date1904);addcell({c:_j,r:val.r},temp_val,options)}}break;case"RString":;case"Label":;case"BIFF2STR":temp_val=make_cel
f:parsenoop},584:{n:"BrtSupNameBool",f:parsenoop},585:{n:"BrtSupNameFmla",f:parsenoop},586:{n:"BrtSupNameBits",f:parsenoop},587:{n:"BrtSupNameEnd",f:parsenoop},588:{n:"BrtEndSupBook",f:parsenoop},589:{n:"BrtCellSmartTagProperty",f:parsenoop},590:{n:"BrtBeginCellSmartTag",f:parsenoop},591:{n:"BrtEndCellSmartTag",f:parsenoop},592:{n:"BrtBeginCellSmartTags",f:parsenoop},593:{n:"BrtEndCellSmartTags",f:parsenoop},594:{n:"BrtBeginSmartTags",f:parsenoop},595:{n:"BrtEndSmartTags",f:parsenoop},596:{n:"BrtSmartTagType",f:parsenoop},597:{n:"BrtBeginSmartTagTypes",f:parsenoop},598:{n:"BrtEndSmartTagTypes",f:parsenoop},599:{n:"BrtBeginSXFilters",f:parsenoop},600:{n:"BrtEndSXFilters",f:parsenoop},601:{n:"BrtBeginSXFILTER",f:parsenoop},602:{n:"BrtEndSXFilter",f:parsenoop},603:{n:"BrtBeginFills",f:parsenoop},604:{n:"BrtEndFills",f:parsenoop},605:{n:"BrtBeginCellWatches",f:parsenoop},606:{n:"BrtEndCellWatches",f:parsenoop},607:{n:"BrtCellWatch",f:parsenoop},608:{n:"BrtBeginCRErrs",f:parsenoop},609:{n:"BrtEndCRErrs",f:parsenoop},610:{n:"BrtCrashRecErr",f:parsenoop},611:{n:"BrtBeginFonts",f:parsenoop},612:{n:"BrtEndFonts",f:parsenoop},613:{n:"BrtBeginBorders",f:parsenoop},614:{n:"BrtEndBorders",f:parsenoop},615:{n:"BrtBeginFmts",f:parsenoop},616:{n:"BrtEndFmts",f:parsenoop},617:{n:"BrtBeginCellXFs",f:parsenoop},618:{n:"BrtEndCellXFs",f:parsenoop},619:{n:"BrtBeginStyles",f:parsenoop},620:{n:"BrtEndStyles",f:parsenoop},625:{n:"BrtBigName",f:parsenoop},626:{n:"BrtBeginCellStyleXFs",f:parsenoop},627:{n:"BrtEndCellStyleXFs",f:parsenoop},628:{n:"BrtBeginComments",f:parsenoop},629:{n:"BrtEndComments",f:parsenoop},630:{n:"BrtBeginCommentAuthors",f:parsenoop},631:{n:"BrtEndCommentAuthors",f:parsenoop},632:{n:"BrtCommentAuthor",f:parse_BrtCommentAuthor},633:{n:"BrtBeginCommentList",f:parsenoop},634:{n:"BrtEndCommentList",f:parsenoop},635:{n:"BrtBeginComment",f:parse_BrtBeginComment},636:{n:"BrtEndComment",f:parsenoop},637:{n:"BrtCommentText",f:parse_BrtCommentText},638:{n:"BrtBeginOleObjects",f:parsenoop},639:{n:"BrtOleObject",f:parsenoop},640:{n:"BrtEndOleObjects",f:parsenoop},641:{n:"BrtBeginSxrules",f:parsenoop},642:{n:"BrtEndSxRules",f:parsenoop},643:{n:"BrtBeginActiveXControls",f:parsenoop},644:{n:"BrtActiveX",f:parsenoop},645:{n:"BrtEndActiveXControls",f:parsenoop},646:{n:"BrtBeginPCDSDTCEMembersSortBy",f:parsenoop},648:{n:"BrtBeginCellIgnoreECs",f:parsenoop},649:{n:"BrtCellIgnoreEC",f:parsenoop},650:{n:"BrtEndCellIgnoreECs",f:parsenoop},651:{n:"BrtCsProp",f:parsenoop},652:{n:"BrtCsPageSetup",f:parsenoop},653:{n:"BrtBeginUserCsViews",f:parsenoop},654:{n:"BrtEndUserCsViews",f:parsenoop},655:{n:"BrtBeginUserCsView",f:parsenoop},656:{n:"BrtEndUserCsView",f:parsenoop},657:{n:"BrtBeginPcdSFCIEntries",f:parsenoop},658:{n:"BrtEndPCDSFCIEntries",f:parsenoop},659:{n:"BrtPCDSFCIEntry",f:parsenoop},660:{n:"BrtBeginListParts",f:parsenoop},661:{n:"BrtListPart",f:parsenoop},662:{n:"BrtEndListParts",f:parsenoop},663:{n:"BrtSheetCalcProp",f:parsenoop},664:{n:"BrtBeginFnGroup",f:parsenoop},665:{n:"BrtFnGroup",f:parsenoop},666:{n:"BrtEndFnGroup",f:parsenoop},667:{n:"BrtSupAddin",f:parsenoop},668:{n:"BrtSXTDMPOrder",f:parsenoop},669:{n:"BrtCsProtection",f:parsenoop},671:{n:"BrtBeginWsSortMap",f:parsenoop},672:{n:"BrtEndWsSortMap",f:parsenoop},673:{n:"BrtBeginRRSort",f:parsenoop},674:{n:"BrtEndRRSort",f:parsenoop},675:{n:"BrtRRSortItem",f:parsenoop},676:{n:"BrtFileSharingIso",f:parsenoop},677:{n:"BrtBookProtectionIso",f:parsenoop},678:{n:"BrtSheetProtectionIso",f:parsenoop},679:{n:"BrtCsProtectionIso",f:parsenoop},680:{n:"BrtRangeProtectionIso",f:parsenoop},1024:{n:"BrtRwDescent",f:parsenoop},1025:{n:"BrtKnownFonts",f:parsenoop},1026:{n:"BrtBeginSXTupleSet",f:parsenoop},1027:{n:"BrtEndSXTupleSet",f:parsenoop},1028:{n:"BrtBeginSXTupleSetHeader",f:parsenoop},1029:{n:"BrtEndSXTupleSetHeader",f:parsenoop},1030:{n:"BrtSXTupleSetHeaderItem",f:parsenoop},1031:{n:"BrtBeginSXTupleSetData",f:parsenoop},1032:{n:"BrtEndSXTupleSetData",f:parsenoop},1033:{n:"BrtBeginSXTupleSetRow",f:parsenoop},1034:{n:"BrtEndSXTupleSetRow",f:parsenoop},1035:{n:"BrtSXTupleSetRowItem",f:parseno
return sheet_to_workbook(html_to_sheet(str,opts),opts)}function make_html_row(ws,r,R,o){var M=ws["!merges"]||[];var oo=[];var nullcell="<td"+(o.editable?' contenteditable="true"':"")+"></td>";for(var C=r.s.c;C<=r.e.c;++C){var RS=0,CS=0;for(var j=0;j<M.length;++j){if(M[j].s.r>R||M[j].s.c>C)continue;if(M[j].e.r<R||M[j].e.c<C)continue;if(M[j].s.r<R||M[j].s.c<C){RS=-1;break}RS=M[j].e.r-M[j].s.r+1;CS=M[j].e.c-M[j].s.c+1;break}if(RS<0)continue;var coord=encode_cell({r:R,c:C});var cell=o.dense?(ws[R]||[])[C]:ws[coord];if(!cell||cell.v==null){oo.push(nullcell);continue}var w=cell.h||escapexml(cell.w||(format_cell(cell),cell.w)||"");var sp={};if(RS>1)sp.rowspan=RS;if(CS>1)sp.colspan=CS;if(o.editable)sp.contenteditable="true";sp.id="sjs-"+coord;oo.push(writextag("td",w,sp))}var preamble="<tr>";return preamble+oo.join("")+"</tr>"}function make_html_preamble(ws,R,o){var out=[];return out.join("")+"<table>"}var _BEGIN='<html><head><meta charset="utf-8"/><title>SheetJS Table Export</title></head><body>';var _END="</body></html>";function sheet_to_html(ws,opts,wb){var o=opts||{};var header=o.header!=null?o.header:_BEGIN;var footer=o.footer!=null?o.footer:_END;var out=[header];var r=decode_range(ws["!ref"]);o.dense=Array.isArray(ws);out.push(make_html_preamble(ws,r,o));for(var R=r.s.r;R<=r.e.r;++R)out.push(make_html_row(ws,r,R,o));out.push("</table>"+footer);return out.join("")}return{to_workbook:html_to_book,to_sheet:html_to_sheet,_row:make_html_row,BEGIN:_BEGIN,END:_END,_preamble:make_html_preamble,from_sheet:sheet_to_html}}();function parse_dom_table(table,_opts){var opts=_opts||{};if(DENSE!=null)opts.dense=DENSE;var ws=opts.dense?[]:{};var rows=table.getElementsByTagName("tr");var range={s:{r:0,c:0},e:{r:rows.length-1,c:0}};var merges=[],midx=0;var R=0,_C=0,C=0,RS=0,CS=0;for(;R<rows.length;++R){var row=rows[R];var elts=row.children;for(_C=C=0;_C<elts.length;++_C){var elt=elts[_C],v=elts[_C].innerText||elts[_C].textContent;for(midx=0;midx<merges.length;++midx){var m=merges[midx];if(m.s.c==C&&m.s.r<=R&&R<=m.e.r){C=m.e.c+1;midx=-1}}CS=+elt.getAttribute("colspan")||1;if((RS=+elt.getAttribute("rowspan"))>0||CS>1)merges.push({s:{r:R,c:C},e:{r:R+(RS||1)-1,c:C+CS-1}});var o={t:"s",v:v};if(v!=null&&v.length){if(!isNaN(Number(v)))o={t:"n",v:Number(v)};else if(!isNaN(fuzzydate(v).getDate())){o={t:"d",v:parseDate(v)};if(!opts.cellDates)o={t:"n",v:datenum(o.v)};o.z=opts.dateNF||SSF._table[14]}}if(opts.dense){if(!ws[R])ws[R]=[];ws[R][C]=o}else ws[encode_cell({c:C,r:R})]=o;if(range.e.c<C)range.e.c=C;C+=CS}}ws["!merges"]=merges;ws["!ref"]=encode_range(range);return ws}function table_to_book(table,opts){return sheet_to_workbook(parse_dom_table(table,opts),opts)}var parse_content_xml=function(){var parse_text_p=function(text,tag){return unescapexml(text.replace(/<text:s\/>/g," ").replace(/<[^>]*>/g,""))};var number_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"]};return function pcx(d,_opts){var opts=_opts||{};if(DENSE!=null&&opts.dense==null)opts.dense=DENSE;var str=xlml_normalize(d);var state=[],tmp;var tag;var NFtag={name:""},NF="",pidx=0;var sheetag;var rowtag;var Sheets={},SheetNames=[];var ws=opts.dense?[]:{};var Rn,q;var ctag={value:""};var textp="",textpidx=0,textptag;var R=-1,C=-1,range={s:{r:1e6,c:1e7},e:{r:0,c:0}};var number_format_map={};var merges=[],mrange={},mR=0,mC=0;var arrayf=[];var comments=[],comment={};var creator="",creatoridx=0;var rept=1,isstub=false;var i=0;xlmlregex.lastIndex=0;str=str.replace(/<!--([\s\S]*?)-->/gm,"").replace(/<!DOCTYPE[^\[]*\[[^\]]*\]>/gm,"");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}else if(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=r
return parse_xlml(data.slice(i),o);default:break main;}return PRN.to_workbook(data,o)}function read_plaintext_raw(data,o){var str="",bytes=firstbyte(data,o);switch(o.type){case"base64":str=Base64.decode(data);break;case"binary":str=data;break;case"buffer":str=data.toString("binary");break;case"array":str=cc2str(data);break;default:throw new Error("Unrecognized type "+o.type);}if(bytes[0]==239&&bytes[1]==187&&bytes[2]==191)str=utf8read(str);return read_plaintext(str,o)}function read_utf16(data,o){var d=data;if(o.type=="base64")d=Base64.decode(d);d=cptable.utils.decode(1200,d.slice(2),"str");o.type="binary";return read_plaintext(d,o)}function readSync(data,opts){var zip,d=data,n=[0];var o=opts||{};_ssfopts={};if(o.dateNF)_ssfopts.dateNF=o.dateNF;if(!o.type)o.type=has_buf&&Buffer.isBuffer(data)?"buffer":"base64";if(o.type=="file"){o.type="buffer";d=_fs.readFileSync(data)}switch((n=firstbyte(d,o))[0]){case 208:return read_cfb(CFB.read(d,o),o);case 9:return parse_xlscfb(s2a(o.type==="base64"?Base64.decode(d):d),o);case 60:return parse_xlml(d,o);case 73:if(n[1]==68)return read_wb_ID(d,o);break;case 84:if(n[1]==65&&n[2]==66&&n[3]==76)return DIF.to_workbook(d,o);break;case 80:if(n[1]==75&&n[2]<32&&n[3]<32)return read_zip(d,o);break;case 239:return n[3]==60?parse_xlml(d,o):PRN.to_workbook(d,o);case 255:if(n[1]==254){return read_utf16(d,o)}break;case 0:if(n[1]==0&&n[2]>=2&&n[3]==0)return WK_.to_workbook(d,o);break;case 3:;case 131:;case 139:return DBF.to_workbook(d,o);case 123:if(n[1]==92&&n[2]==114&&n[3]==116)throw new Error("Unsupported RTF");break;case 10:;case 13:;case 32:return read_plaintext_raw(d,o);}if(n[2]<=12&&n[3]<=31)return DBF.to_workbook(d,o);if(32>n[0]||n[0]>127)throw new Error("Unsupported file "+n.join("|"));return PRN.to_workbook(d,o)}function readFileSync(filename,opts){var o=opts||{};o.type="file";return readSync(filename,o)}function write_zip_type(wb,opts){var o=opts||{};var z=write_zip(wb,o);var oopts={};if(o.compression)oopts.compression="DEFLATE";switch(o.type){case"base64":oopts.type="base64";break;case"binary":oopts.type="string";break;case"buffer":;case"file":oopts.type="nodebuffer";break;default:throw new Error("Unrecognized type "+o.type);}if(o.type==="file")return _fs.writeFileSync(o.file,z.generate(oopts));return z.generate(oopts)}function write_bstr_type(out,opts){switch(opts.type){case"base64":return Base64.encode(out);case"binary":return out;case"file":return _fs.writeFileSync(opts.file,out,"binary");case"buffer":{if(has_buf)return new Buffer(out,"binary");else return out.split("").map(function(c){return c.charCodeAt(0)})};}throw new Error("Unrecognized type "+opts.type)}function write_string_type(out,opts){switch(opts.type){case"base64":return Base64.encode(out);case"binary":return out;case"file":return _fs.writeFileSync(opts.file,out,"utf8");case"buffer":{if(has_buf)return new Buffer(out,"utf8");else return out.split("").map(function(c){return c.charCodeAt(0)})};}throw new Error("Unrecognized type "+opts.type)}function write_binary_type(out,opts){switch(opts.type){case"base64":;case"binary":var bstr="";for(var i=0;i<out.length;++i)bstr+=String.fromCharCode(out[i]);return opts.type=="base64"?Base64.encode(bstr):bstr;case"file":return _fs.writeFileSync(opts.file,out);case"buffer":return out;default:throw new Error("Unrecognized type "+opts.type);}}function writeSync(wb,opts){check_wb(wb);var o=opts||{};switch(o.bookType||"xlsb"){case"xml":;case"xlml":return write_string_type(write_xlml(wb,o),o);case"slk":;case"sylk":return write_string_type(write_slk_str(wb,o),o);case"html":return write_string_type(write_htm_str(wb,o),o);case"txt":return write_bstr_type(write_txt_str(wb,o),o);case"csv":return write_string_type(write_csv_str(wb,o),o);case"dif":return write_string_type(write_dif_str(wb,o),o);case"prn":return write_string_type(write_prn_str(wb,o),o);case"fods":return write_string_type(write_ods(wb,o),o);case"biff2":return write_binary_type(write_biff_buf(wb,o),o);case"xlsx":;case"xlsm":;case"xlsb":;case"ods":return write_zip_type(wb,o);default:throw new Error("Unrecognized bookType |"+o.bookType+"|"