sheetjs/xlsx.core.min.js

19 lines
530 KiB
JavaScript
Raw Normal View History

2016-12-31 08:11:36 +00:00
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
2017-03-28 22:07:46 +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,2
}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
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-05-09 18:11:15 +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
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."+r[1]).replace(/\.$/,"."+r[1]);o=o.replace(/\.(\d*)$/,function($$,$1){return"."+$1+fill("0",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.slice(-3)==".00")return write_num_int(type,fmt.slice(0,-3),val)+".00";if(fmt.slice(-2)==".0")return write_num_int(type,fmt.slice(0,-2),val)+".0"}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,cc;for(var i=0,j=0;i<fmt.length;++i)switch(cc=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 |"+fmt+"| unterminated string ");return out}SSF._split=split_fmt;var abstime=/\[[HhMmSs]*\]/;function fmt_is_date(fmt){var i=0,cc=0,c="",o="";while(i<fmt.length){switch(c=fmt.charAt(i)){case"G":if(isgeneral(fmt,i))i+=6;i++;break;case'"':for(;(cc=fmt.charCodeAt(++i))!==34&&i<fmt.length;)++i;++i;break;case"\\":i+=2;break;case"_":i+=2;break;case"@":++i;break;case"B":case"b":if(fmt.charAt(i+1)==="1"||fmt.charAt(i+1)==="2")return true;case"M":case"D":case"Y":case"H":case"S":case"E":case"m":case"d":case"y":case"h":case"s":case"e
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=__readUInt32LE(b,i);return len>0?__utf16le(b,i+4,i+4+len):""};var __8lpp4,___8lpp4;__8lpp4=___8lpp4=function lpp4_8(b,i){var len=__readUInt32LE(b,i);return len>0?__utf8(b,i+4,i+4+len):""};var __double,___double;__double=___double=function(b,idx){return read_double_le(b,idx)};var is_buf=function is_buf_a(a){return Array.isArray(a)};if(has_buf){__utf16le=function utf16le_b(b,s,e){if(!Buffer.isBuffer(b))return ___utf16le(b,s,e);return b.toString("utf16le",s,e)};__hexlify=function(b,s,l){return Buffer.isBuffer(b)?b.toString("hex",s,s+l):___hexlify(b,s,l)};__lpstr=function lpstr_b(b,i){if(!Buffer.isBuffer(b))return ___lpstr(b,i);var len=b.readUInt32LE(i);return len>0?b.toString("utf8",i+4,i+4+len-1):""};__lpwstr=function lpwstr_b(b,i){if(!Buffer.isBuffer(b))return ___lpwstr(b,i);var len=2*b.readUInt32LE(i);return b.toString("utf16le",i+4,i+4+len-1)};__lpp4=function lpp4_b(b,i){if(!Buffer.isBuffer(b))return ___lpp4(b,i);var len=b.readUInt32LE(i);return b.toString("utf16le",i+4,i+4+len)};__8lpp4=function lpp4_8b(b,i){if(!Buffer.isBuffer(b))return ___8lpp4(b,i);var len=b.readUInt32LE(i);return b.toString("utf8",i+4,i+4+len)};__utf8=function utf8_b(b,s,e){return b.toString("utf8",s,e)};__toBuffer=function(bufs){return bufs[0].length>0&&Buffer.isBuffer(bufs[0][0])?Buffer.concat(bufs[0]):___toBuffer(bufs)};bconcat=function(bufs){return Buffer.isBuffer(bufs[0])?Buffer.concat(bufs):[].concat.apply([],bufs)};__double=function double_(b,i){if(Buffer.isBuffer(b))return b.readDoubleLE(i);return ___double(b,i)};is_buf=function is_buf_b(a){return Buffer.isBuffer(a)||Array.isArray(a)}}if(typeof cptable!=="undefined"){__utf16le=function(b,s,e){return cptable.utils.decode(1200,b.slice(s,e))};__utf8=function(b,s,e){return cptable.utils.decode(65001,b.slice(s,e))};__lpstr=function(b,i){var len=__readUInt32LE(b,i);return len>0?cptable.utils.decode(current_codepage,b.slice(i+4,i+4+len-1)):""};__lpwstr=function(b,i){var len=2*__readUInt32LE(b,i);return len>0?cptable.utils.decode(1200,b.slice(i+4,i+4+len-1)):""};__lpp4=function(b,i){var len=__readUInt32LE(b,i);return len>0?cptable.utils.decode(1200,b.slice(i+4,i+4+len)):""};__8lpp4=function(b,i){var len=__readUInt32LE(b,i);return len>0?cptable.utils.decode(65001,b.slice(i+4,i+4+len)):""}}var __readUInt8=function(b,idx){return b[idx]};var __readUInt16LE=function(b,idx){return b[idx+1]*(1<<8)+b[idx]};var __readInt16LE=function(b,idx){
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_manifest(d,opts){var str=xlml_normalize(d);var Rn;var FEtag;while(Rn=xlmlregex.exec(str))switch(Rn[3]){case"manifest":break;case"file-entry":FEtag=parsexmltag(Rn[0],false);if(FEtag.path=="/"&&FEtag.type!==CT_ODS)throw new Error("This OpenDocument is not a spreadsheet");break;case"encryption-data":case"algorithm":case"start-key-generation":case"key-derivation":throw new Error("Unsupported ODS Encryption");default:if(opts&&opts.WTF)throw Rn}}function write_manifest(manifest,opts){var o=[XML_HEADER];o.push('<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2">\n');o.push(' <manifest:file-entry manifest:full-path="/" manifest:version="1.2" manifest:media-type="application/vnd.oasis.opendocument.spreadsheet"/>\n');for(var i=0;i<manifest.length;++i)o.push(' <manifest:file-entry manifest:full-path="'+manifest[i][0]+'" manifest:media-type="'+manifest[i][1]+'"/>\n');o.push("</manifest:manifest>");return o.join("")}function write_rdf_type(file,res,tag){return[' <rdf:Description rdf:about="'+file+'">\n',' <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/'+(tag||"odf")+"#"+res+'"/>\n'," </rdf:Description>\n"].join("")}function write_rdf_has(base,file){return[' <rdf:Description rdf:about="'+base+'">\n',' <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="'+file+'"/>\n'," </rdf:Description>\n"].join("")}function write_rdf(rdf,opts){var o=[XML_HEADER];o.push('<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">\n');for(var i=0;i!=rdf.length;++i){o.push(write_rdf_type(rdf[i][0],rdf[i][1]));o.push(write_rdf_has("",rdf[i][0]))}o.push(write_rdf_type("","Document","pkg"));o.push("</rdf:RDF>");return o.join("")}var CORE_PROPS=[["cp:category","Category"],["cp:contentStatus","ContentStatus"],["cp:keywords","Keywords"],["cp:lastModifiedBy","LastAuthor"],["cp:lastPrinted","LastPrinted"],["cp:revision","RevNumber"],["cp:version","Version"],["dc:creator","Author"],["dc:description","Comments"],["dc:identifier","Identifier"],["dc:language","Language"],["dc:subject","Subject"],["dc:title","Title"],["dcterms:created","CreatedDate","date"],["dcterms:modified","ModifiedDate","date"]];XMLNS.CORE_PROPS="http://schemas.openxmlformats.org/package/2006/metadata/core-properties";RELS.CORE_PROPS="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";var CORE_PROPS_REGEX=function(){var r=new Array(CORE_PROPS.length);for(var i=0;i<CORE_PROPS.length
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}function parse_Lbl(blob,length,opts){var target=blob.l+length;var flags=blob.read_shift(2);var chKey=blob.read_shift(1);var cch=blob.read_shift(1);var cce=blob.read_shift(opts&&opts.biff==2?1:2);var itab=0;if(!opts||opts.biff>=5){blob.l+=2;itab=blob.read_shift(2);blob.l+=4}var name=parse_XLUnicodeStringNoCch(blob,cch,opts);var npflen=target-blob.l;if(opts&&opts.biff==2)--npflen;var rgce=target==blob.l||cce==0?[]:parse_NameParsedFormula(blob,npflen,opts,cce);return{chKey:chKey,Name:name,itab:itab,rgce:rgce}}function parse_ExternSheet(blob,length,opts){if(opts.biff<8)return parse_ShortXLUnicodeString(blob,length,opts);var o=[],target=blob.l+length,len=blob.read_shift(2);while(len--!==0)o.push(parse_XTI(blob,6));var oo=[];return o}function parse_NameCmt(blob,length,opts){if(opts.biff<8){blob.l+=length;return}var cchName=blob.read_shift(2);var cchComment=blob.read_shift(2);var name=parse_XLUnicodeStringNoCch(blob,cchName,opts);var comment=parse_XLUnicodeStringNoCch(blob,cchComment,opts);return[name,comment]}function parse_ShrFmla(blob,length,opts){var ref=parse_RefU(blob,6);blob.l++;var cUse=blob.read_shift(1);length-=8;return[parse_SharedParsedFormula(blob,length,opts),cUse]}function parse_Array(blob,length,opts){var ref=parse_Ref(blob,6);switch(opts.biff){case 2:blob.l++;length-=7;break;case 3:case 4:blob.l+=2;length-=8;break;default:blob.l+=6;length-=12}return[ref,parse_ArrayParsedFormula(blob,length,opts,ref)]}function parse_MTRSettings(blob,length){var fMTREnabled=blob.read_shift(4)!==0;var fUserSetThreadCount=blob.read_shift(4)!==0;var cUserThreadCount=blob.read_shift(4);return[fMTREnabled,fUserSetThreadCount,cUserThreadCount]}function parse_NoteSh(blob,length,opts){if(opts.biff<8)return;var row=blob.read_shift(2),col=blob.read_shift(2);var flags=blob.read_shift(2),idObj=blob.read_shift(2);var stAuthor=parse_XLUnicodeString2(blob,0,opts);if(opts.biff<8)blob.read_shift(1);return[{r:row,c:col},stAuthor,idObj,flags]}function parse_Note(blob,length,opts){return parse_NoteSh(blob,length,opts)}function parse_MergeCells(blob,length){var merges=[];var cmcs=blob.read_shift(2);while(cmcs--)merges.push(parse_Ref8U(blob,length));return merges}function parse_Obj(blob,length,opts){if(opts&&opts.biff<8)return parse_BIFF5Obj(blob,length,opts);var cmo=parse_FtCmo(blob,22);var fts=parse_FtArray(blob,length-22,cmo[1]);return{cmo:cmo,ft:fts}}var parse_BIFF5OT=[];parse_BIFF5OT[8]=function(blob,length,opts){var tgt=blob.l+length;blob.l+=10;var cf=blob.read_shift(2);blob.l+=4;var cbPictFmla=blob.read_shift(2);blob.l+=2;var grbit=blob.read_shift(2);blob.l+=4;var cchName=blob.read_shift(1);blob.l+=cchName;blob.l=tgt;return{fmt:cf}};function parse_BIFF5Obj(blob,length,opts){var cnt=blob.read_shift(4);var ot=blob.read_shift(2);var id=blob.read_shift(2);var grbit=blob.read_shift(2);var colL=blob.read_shift(2);var dxL=blob.read_shift(2);var rwT=blob.read_shift(2);var dyT=blob.read_shift(2);var colR=blob.read_shift(2);var dxR=blob.read_shift(2);var rwB=blob.read_shift(2);var dyB=blob.read_shift(2);var cbMacro=blob.read_shift(2);blob.l+=6;length-=36;var fts=[];fts.push((parse_BIFF5OT[ot]||parsenoop)(blob,length,opts));return{cmo:[id,ot,grbit],ft:fts}}function parse_TxO(blob,length,opts){var s=blob.l;var texts="";try{blob.l+=4;var ot=(opts.lastobj||{cmo:[0,0]}).cmo[1];var controlInfo;if([0,5,7,11,12,14].indexOf(ot)==-1)blob.l+=6;else controlInfo=parse_ControlInfo(blob,6,opts);var cchText=blob.read_shift(2);var cbRuns=blob.read_shift(2);var ifntEmpty=parse_FontIndex(blob,2);var len=blob.read_shift(2);blob.l+=len;for(var i=1;i<blob.lens.length-1;++i){if(blob.l-s!=blob.lens[i])throw new Error("TxO: bad continue record");var hdr=blob[blob.l];var t=parse_XLUnicodeStringNoCch(blob,blob.lens[i+1]-blob.lens[i]-1);texts+=t;if(texts.length>=(hdr?cchText:2*cchText))break}if(texts.length!==cchText&&texts.length!==cchText*2){throw new Error("cchText: "+cchText+" != "+texts.length)}blob.l=s+length;
var o=[{c:0,r:0},{t:"n",v:0},0];if(opts.qpro&&opts.vers!=20768){o[0].c=blob.read_shift(1);blob.l++;o[0].r=blob.read_shift(2);blob.l+=2}else{o[2]=blob.read_shift(1);o[0].c=blob.read_shift(2);o[0].r=blob.read_shift(2)}return o}function parse_LABEL(blob,length,opts){var tgt=blob.l+length;var o=parse_cell(blob,length,opts);o[1].t="s";if(opts.vers==20768){blob.l++;var len=blob.read_shift(1);o[1].v=blob.read_shift(len,"utf8");return o}if(opts.qpro)blob.l++;o[1].v=blob.read_shift(tgt-blob.l,"cstr");return o}function parse_INTEGER(blob,length,opts){var o=parse_cell(blob,length,opts);o[1].v=blob.read_shift(2,"i");return o}function parse_NUMBER(blob,length,opts){var o=parse_cell(blob,length,opts);o[1].v=blob.read_shift(8,"f");return o}function parse_FORMULA(blob,length,opts){var tgt=blob.l+length;var o=parse_cell(blob,length,opts);o[1].v=blob.read_shift(8,"f");if(opts.qpro)blob.l=tgt;else{var flen=blob.read_shift(2);blob.l+=flen}return o}function parse_cell_3(blob,length){var o=[{c:0,r:0},{t:"n",v:0},0];o[0].r=blob.read_shift(2);o[3]=blob[blob.l++];o[0].c=blob[blob.l++];return o}function parse_LABEL_16(blob,length){var o=parse_cell_3(blob,length);o[1].t="s";o[1].v=blob.read_shift(length-4,"cstr");return o}function parse_NUMBER_18(blob,length){var o=parse_cell_3(blob,length);o[1].v=blob.read_shift(2);var v=o[1].v>>1;if(o[1].v&1){switch(v&7){case 1:v=(v>>3)*500;break;case 2:v=(v>>3)/20;break;case 4:v=(v>>3)/2e3;break;case 6:v=(v>>3)/16;break;case 7:v=(v>>3)/64;break;default:throw"unknown NUMBER_18 encoding "+(v&7)}}o[1].v=v;return o}function parse_NUMBER_17(blob,length){var o=parse_cell_3(blob,length);var v1=blob.read_shift(4);var v2=blob.read_shift(4);var e=blob.read_shift(2);if(e==65535){o[1].v=0;return o}var s=e&32768;e=(e&32767)-16446;o[1].v=(e>0?v2<<e:v2>>>-e)+(e>-32?v1<<e+32:v1>>>-(e+32));return o}function parse_FORMULA_19(blob,length){var o=parse_NUMBER_17(blob,14);blob.l+=length-14;return o}function parse_NUMBER_25(blob,length){var o=parse_cell_3(blob,length);var v1=blob.read_shift(4);o[1].v=v1>>6;return o}function parse_NUMBER_27(blob,length){var o=parse_cell_3(blob,length);var v1=blob.read_shift(8,"f");o[1].v=v1;return o}function parse_FORMULA_28(blob,length){var o=parse_NUMBER_27(blob,14);blob.l+=length-10;return o}var WK1Enum={0:{n:"BOF",f:parseuint16},1:{n:"EOF",f:parsenoop},2:{n:"CALCMODE",f:parsenoop},3:{n:"CALCORDER",f:parsenoop},4:{n:"SPLIT",f:parsenoop},5:{n:"SYNC",f:parsenoop},6:{n:"RANGE",f:parse_RANGE},7:{n:"WINDOW1",f:parsenoop},8:{n:"COLW1",f:parsenoop},9:{n:"WINTWO",f:parsenoop},10:{n:"COLW2",f:parsenoop},11:{n:"NAME",f:parsenoop},12:{n:"BLANK",f:parsenoop},13:{n:"INTEGER",f:parse_INTEGER},14:{n:"NUMBER",f:parse_NUMBER},15:{n:"LABEL",f:parse_LABEL},16:{n:"FORMULA",f:parse_FORMULA},24:{n:"TABLE",f:parsenoop},25:{n:"ORANGE",f:parsenoop},26:{n:"PRANGE",f:parsenoop},27:{n:"SRANGE",f:parsenoop},28:{n:"FRANGE",f:parsenoop},29:{n:"KRANGE1",f:parsenoop},32:{n:"HRANGE",f:parsenoop},35:{n:"KRANGE2",f:parsenoop},36:{n:"PROTEC",f:parsenoop},37:{n:"FOOTER",f:parsenoop},38:{n:"HEADER",f:parsenoop},39:{n:"SETUP",f:parsenoop},40:{n:"MARGINS",f:parsenoop},41:{n:"LABELFMT",f:parsenoop},42:{n:"TITLES",f:parsenoop},43:{n:"SHEETJS",f:parsenoop},45:{n:"GRAPH",f:parsenoop},46:{n:"NGRAPH",f:parsenoop},47:{n:"CALCCOUNT",f:parsenoop},48:{n:"UNFORMATTED",f:parsenoop},49:{n:"CURSORW12",f:parsenoop},50:{n:"WINDOW",f:parsenoop},51:{n:"STRING",f:parse_LABEL},55:{n:"PASSWORD",f:parsenoop},56:{n:"LOCKED",f:parsenoop},60:{n:"QUERY",f:parsenoop},61:{n:"QUERYNAME",f:parsenoop},62:{n:"PRINT",f:parsenoop},63:{n:"PRINTNAME",f:parsenoop},64:{n:"GRAPH2",f:parsenoop},65:{n:"GRAPHNAME",f:parsenoop},66:{n:"ZOOM",f:parsenoop},67:{n:"SYMSPLIT",f:parsenoop},68:{n:"NSROWS",f:parsenoop},69:{n:"NSCOLS",f:parsenoop},70:{n:"RULER",f:parsenoop},71:{n:"NNAME",f:parsenoop},72:{n:"ACOMM",f:parsenoop},73:{n:"AMACRO",f:parsenoop},74:{n:"PARSE",f:parsenoop},255:{n:"",f:parsenoop}};var WK3Enum={0:{n:"BOF",f:parsenoop},1:{n:"EOF",f:parsenoop},3:{n:"??",f:parsenoop},4:{n:"??",f:parsenoop},5:{n:"??",f:parsenoop},6:{n:"??",f:parsenoop},7:{n:"??",f:parsenoop},9:{n:"??",f:
for(;j<12;++j)o.write_shift(4,0)}return o.length>o.l?o.slice(0,o.l):o}function parse_BrtXF(data,length){var ixfeParent=data.read_shift(2);var ifmt=data.read_shift(2);parsenoop(data,length-4);return{ixfe:ixfeParent,ifmt:ifmt}}function write_BrtXF(data,ixfeP,o){if(!o)o=new_buf(16);o.write_shift(2,ixfeP||0);o.write_shift(2,data.numFmtId||0);o.write_shift(2,0);o.write_shift(2,0);o.write_shift(2,0);o.write_shift(1,0);o.write_shift(1,0);o.write_shift(1,0);o.write_shift(1,0);o.write_shift(1,0);o.write_shift(1,0);return o}function write_Blxf(data,o){if(!o)o=new_buf(10);o.write_shift(1,0);o.write_shift(1,0);o.write_shift(4,0);o.write_shift(4,0);return o}function write_BrtBorder(border,o){if(!o)o=new_buf(51);o.write_shift(1,0);write_Blxf(null,o);write_Blxf(null,o);write_Blxf(null,o);write_Blxf(null,o);write_Blxf(null,o);return o.length>o.l?o.slice(0,o.l):o}function write_BrtStyle(style,o){if(!o)o=new_buf(12+4*10);o.write_shift(4,style.xfId);o.write_shift(2,1);o.write_shift(1,+style.builtinId);o.write_shift(1,0);write_XLNullableWideString(style.name||"",o);return o.length>o.l?o.slice(0,o.l):o}function write_BrtBeginTableStyles(cnt,defTableStyle,defPivotStyle){var o=new_buf(4+256*2*4);o.write_shift(4,cnt);write_XLNullableWideString(defTableStyle,o);write_XLNullableWideString(defPivotStyle,o);return o.length>o.l?o.slice(0,o.l):o}function parse_sty_bin(data,themes,opts){var styles={};styles.NumberFmt=[];for(var y in SSF._table)styles.NumberFmt[y]=SSF._table[y];styles.CellXf=[];styles.Fonts=[];var state=[];var pass=false;recordhopper(data,function hopper_sty(val,R_n,RT){switch(RT){case 44:styles.NumberFmt[val[0]]=val[1];SSF.load(val[1],val[0]);break;case 43:styles.Fonts.push(val);if(val.color.theme!=null&&themes&&themes.themeElements&&themes.themeElements.clrScheme){val.color.rgb=rgb_tint(themes.themeElements.clrScheme[val.color.theme].rgb,val.color.tint||0)}break;case 1025:break;case 45:break;case 46:break;case 47:if(state[state.length-1]=="BrtBeginCellXFs"){styles.CellXf.push(val)}break;case 48:case 507:case 572:case 475:break;case 1171:case 2102:case 1130:case 512:case 2095:break;case 35:pass=true;break;case 36:pass=false;break;case 37:state.push(R_n);break;case 38:state.pop();break;default:if((R_n||"").indexOf("Begin")>0)state.push(R_n);else if((R_n||"").indexOf("End")>0)state.pop();else if(!pass||opts.WTF)throw new Error("Unexpected record "+RT+" "+R_n)}});return styles}function write_FMTS_bin(ba,NF){if(!NF)return;var cnt=0;[[5,8],[23,26],[41,44],[57,392]].forEach(function(r){for(var i=r[0];i<=r[1];++i)if(NF[i]!=null)++cnt});if(cnt==0)return;write_record(ba,"BrtBeginFmts",write_UInt32LE(cnt));[[5,8],[23,26],[41,44],[57,392]].forEach(function(r){for(var i=r[0];i<=r[1];++i)if(NF[i]!=null)write_record(ba,"BrtFmt",write_BrtFmt(i,NF[i]))});write_record(ba,"BrtEndFmts")}function write_FONTS_bin(ba,data){var cnt=1;if(cnt==0)return;write_record(ba,"BrtBeginFonts",write_UInt32LE(cnt));write_record(ba,"BrtFont",write_BrtFont({sz:12,color:{theme:1},name:"Calibri",family:2,scheme:"minor"}));write_record(ba,"BrtEndFonts")}function write_FILLS_bin(ba,data){var cnt=2;if(cnt==0)return;write_record(ba,"BrtBeginFills",write_UInt32LE(cnt));write_record(ba,"BrtFill",write_BrtFill({patternType:"none"}));write_record(ba,"BrtFill",write_BrtFill({patternType:"gray125"}));write_record(ba,"BrtEndFills")}function write_BORDERS_bin(ba,data){var cnt=1;if(cnt==0)return;write_record(ba,"BrtBeginBorders",write_UInt32LE(cnt));write_record(ba,"BrtBorder",write_BrtBorder({}));write_record(ba,"BrtEndBorders")}function write_CELLSTYLEXFS_bin(ba,data){var cnt=1;write_record(ba,"BrtBeginCellStyleXFs",write_UInt32LE(cnt));write_record(ba,"BrtXF",write_BrtXF({numFmtId:0,fontId:0,fillId:0,borderId:0},65535));write_record(ba,"BrtEndCellStyleXFs")}function write_CELLXFS_bin(ba,data){write_record(ba,"BrtBeginCellXFs",write_UInt32LE(data.length));data.forEach(function(c){write_record(ba,"BrtXF",write_BrtXF(c,0))});write_record(ba,"BrtEndCellXFs")}function write_STYLES_bin(ba,data){var cnt=1;write_record(ba,"BrtBeginStyles",write_UInt32LE(1));write_record(ba,"BrtStyle",write_
blob.l+=2;return[bitIf,blob.read_shift(2)]}function parse_PtgAttrSemi(blob,length,opts){var bitSemi=blob[blob.l+1]&255?1:0;blob.l+=opts&&opts.biff==2?3:4;return[bitSemi]}function parse_PtgAttrSpaceType(blob,length){var type=blob.read_shift(1),cch=blob.read_shift(1);return[type,cch]}function parse_PtgAttrSpace(blob,length){blob.read_shift(2);return parse_PtgAttrSpaceType(blob,2)}function parse_PtgAttrSpaceSemi(blob,length){blob.read_shift(2);return parse_PtgAttrSpaceType(blob,2)}function parse_PtgRef(blob,length,opts){var ptg=blob[blob.l]&31;var type=(blob[blob.l]&96)>>5;blob.l+=1;var loc=parse_RgceLoc(blob,0,opts);return[type,loc]}function parse_PtgRefN(blob,length,opts){var type=(blob[blob.l]&96)>>5;blob.l+=1;var loc=parse_RgceLocRel(blob,0,opts);return[type,loc]}function parse_PtgRef3d(blob,length,opts){var type=(blob[blob.l]&96)>>5;blob.l+=1;var ixti=blob.read_shift(2);var loc=parse_RgceLoc(blob,0,opts);return[type,ixti,loc]}function parse_PtgFunc(blob,length,opts){var ptg=blob[blob.l]&31;var type=(blob[blob.l]&96)>>5;blob.l+=1;var iftab=blob.read_shift(opts&&opts.biff<=3?1:2);return[FtabArgc[iftab],Ftab[iftab],type]}function parse_PtgFuncVar(blob,length,opts){blob.l++;var cparams=blob.read_shift(1),tab=opts&&opts.biff<=3?[0,blob.read_shift(1)]:parsetab(blob);return[cparams,(tab[0]===0?Ftab:Cetab)[tab[1]]]}function parsetab(blob,length){return[blob[blob.l+1]>>7,blob.read_shift(2)&32767]}function parse_PtgAttrSum(blob,length,opts){blob.l+=opts&&opts.biff==2?3:4;return}var parse_PtgConcat=parseread1;function parse_PtgExp(blob,length,opts){blob.l++;if(opts&&opts.biff==12)return[blob.read_shift(4,"i"),0];var row=blob.read_shift(2);var col=blob.read_shift(opts&&opts.biff==2?1:2);return[row,col]}function parse_PtgErr(blob,length){blob.l++;return BErr[blob.read_shift(1)]}function parse_PtgInt(blob,length){blob.l++;return blob.read_shift(2)}function parse_PtgBool(blob,length){blob.l++;return blob.read_shift(1)!==0}function parse_PtgNum(blob,length){blob.l++;return parse_Xnum(blob,8)}function parse_PtgStr(blob,length,opts){blob.l++;return parse_ShortXLUnicodeString(blob,length-1,opts)}function parse_SerAr(blob,biff){var val=[blob.read_shift(1)];if(biff==12)switch(val[0]){case 2:val[0]=4;break;case 4:val[0]=16;break;case 0:val[0]=1;break;case 1:val[0]=2;break}switch(val[0]){case 4:val[1]=parsebool(blob,1)?"TRUE":"FALSE";blob.l+=7;break;case 16:val[1]=BErr[blob[blob.l]];blob.l+=8;break;case 0:blob.l+=8;break;case 1:val[1]=parse_Xnum(blob,8);break;case 2:val[1]=parse_XLUnicodeString2(blob,0,{biff:biff>0&&biff<8?2:biff});break}return val}function parse_PtgExtraMem(blob,cce){var count=blob.read_shift(2);var out=[];for(var i=0;i!=count;++i)out.push(parse_Ref8U(blob,8));return out}function parse_PtgExtraArray(blob,length,opts){var rows=0,cols=0;if(opts.biff==12){rows=blob.read_shift(4);cols=blob.read_shift(4)}else{cols=1+blob.read_shift(1);rows=1+blob.read_shift(2)}if(opts.biff>=2&&opts.biff<8){--rows;if(--cols==0)cols=256}for(var i=0,o=[];i!=rows&&(o[i]=[]);++i)for(var j=0;j!=cols;++j)o[i][j]=parse_SerAr(blob,opts.biff);return o}function parse_PtgName(blob,length,opts){var type=blob.read_shift(1)>>>5&3;var w=!opts||opts.biff>=8?4:2;var nameindex=blob.read_shift(w);switch(opts.biff){case 2:blob.l+=5;break;case 3:case 4:blob.l+=8;break;case 5:blob.l+=12;break}return[type,0,nameindex]}function parse_PtgNameX(blob,length,opts){if(opts.biff==5)return parse_PtgNameX_BIFF5(blob,length,opts);var type=blob.read_shift(1)>>>5&3;var ixti=blob.read_shift(2);var nameindex=blob.read_shift(4);return[type,ixti,nameindex]}function parse_PtgNameX_BIFF5(blob,length,opts){var type=blob.read_shift(1)>>>5&3;var ixti=blob.read_shift(2,"i");blob.l+=8;var nameindex=blob.read_shift(2);blob.l+=12;return[type,ixti,nameindex]}function parse_PtgMemArea(blob,length,opts){var type=blob.read_shift(1)>>>5&3;blob.l+=opts&&opts.biff==2?3:4;var cce=blob.read_shift(opts&&opts.biff==2?1:2);return[type,cce]}function parse_PtgMemFunc(blob,length,opts){var type=blob.read_shift(1)>>>5&3;var cce=blob.read_shift(opts&&opts.biff==2?1:2);return[type,cce]}function parse_PtgRefErr
"_xlfn.BETA.INV":"BETA.INV","_xlfn.BINOM.DIST":"BINOM.DIST","_xlfn.BINOM.DIST.RANGE":"BINOM.DIST.RANGE","_xlfn.BINOM.INV":"BINOM.INV","_xlfn.BITAND":"BITAND","_xlfn.BITLSHIFT":"BITLSHIFT","_xlfn.BITOR":"BITOR","_xlfn.BITRSHIFT":"BITRSHIFT","_xlfn.BITXOR":"BITXOR","_xlfn.CEILING.MATH":"CEILING.MATH","_xlfn.CEILING.PRECISE":"CEILING.PRECISE","_xlfn.CHISQ.DIST":"CHISQ.DIST","_xlfn.CHISQ.DIST.RT":"CHISQ.DIST.RT","_xlfn.CHISQ.INV":"CHISQ.INV","_xlfn.CHISQ.INV.RT":"CHISQ.INV.RT","_xlfn.CHISQ.TEST":"CHISQ.TEST","_xlfn.COMBINA":"COMBINA","_xlfn.CONFIDENCE.NORM":"CONFIDENCE.NORM","_xlfn.CONFIDENCE.T":"CONFIDENCE.T","_xlfn.COT":"COT","_xlfn.COTH":"COTH","_xlfn.COUNTIFS":"COUNTIFS","_xlfn.COVARIANCE.P":"COVARIANCE.P","_xlfn.COVARIANCE.S":"COVARIANCE.S","_xlfn.CSC":"CSC","_xlfn.CSCH":"CSCH","_xlfn.DAYS":"DAYS","_xlfn.DECIMAL":"DECIMAL","_xlfn.ECMA.CEILING":"ECMA.CEILING","_xlfn.ERF.PRECISE":"ERF.PRECISE","_xlfn.ERFC.PRECISE":"ERFC.PRECISE","_xlfn.EXPON.DIST":"EXPON.DIST","_xlfn.F.DIST":"F.DIST","_xlfn.F.DIST.RT":"F.DIST.RT","_xlfn.F.INV":"F.INV","_xlfn.F.INV.RT":"F.INV.RT","_xlfn.F.TEST":"F.TEST","_xlfn.FILTERXML":"FILTERXML","_xlfn.FLOOR.MATH":"FLOOR.MATH","_xlfn.FLOOR.PRECISE":"FLOOR.PRECISE","_xlfn.FORMULATEXT":"FORMULATEXT","_xlfn.GAMMA":"GAMMA","_xlfn.GAMMA.DIST":"GAMMA.DIST","_xlfn.GAMMA.INV":"GAMMA.INV","_xlfn.GAMMALN.PRECISE":"GAMMALN.PRECISE","_xlfn.GAUSS":"GAUSS","_xlfn.HYPGEOM.DIST":"HYPGEOM.DIST","_xlfn.IFNA":"IFNA","_xlfn.IFERROR":"IFERROR","_xlfn.IMCOSH":"IMCOSH","_xlfn.IMCOT":"IMCOT","_xlfn.IMCSC":"IMCSC","_xlfn.IMCSCH":"IMCSCH","_xlfn.IMSEC":"IMSEC","_xlfn.IMSECH":"IMSECH","_xlfn.IMSINH":"IMSINH","_xlfn.IMTAN":"IMTAN","_xlfn.ISFORMULA":"ISFORMULA","_xlfn.ISO.CEILING":"ISO.CEILING","_xlfn.ISOWEEKNUM":"ISOWEEKNUM","_xlfn.LOGNORM.DIST":"LOGNORM.DIST","_xlfn.LOGNORM.INV":"LOGNORM.INV","_xlfn.MODE.MULT":"MODE.MULT","_xlfn.MODE.SNGL":"MODE.SNGL","_xlfn.MUNIT":"MUNIT","_xlfn.NEGBINOM.DIST":"NEGBINOM.DIST","_xlfn.NETWORKDAYS.INTL":"NETWORKDAYS.INTL","_xlfn.NIGBINOM":"NIGBINOM","_xlfn.NORM.DIST":"NORM.DIST","_xlfn.NORM.INV":"NORM.INV","_xlfn.NORM.S.DIST":"NORM.S.DIST","_xlfn.NORM.S.INV":"NORM.S.INV","_xlfn.NUMBERVALUE":"NUMBERVALUE","_xlfn.PDURATION":"PDURATION","_xlfn.PERCENTILE.EXC":"PERCENTILE.EXC","_xlfn.PERCENTILE.INC":"PERCENTILE.INC","_xlfn.PERCENTRANK.EXC":"PERCENTRANK.EXC","_xlfn.PERCENTRANK.INC":"PERCENTRANK.INC","_xlfn.PERMUTATIONA":"PERMUTATIONA","_xlfn.PHI":"PHI","_xlfn.POISSON.DIST":"POISSON.DIST","_xlfn.QUARTILE.EXC":"QUARTILE.EXC","_xlfn.QUARTILE.INC":"QUARTILE.INC","_xlfn.QUERYSTRING":"QUERYSTRING","_xlfn.RANK.AVG":"RANK.AVG","_xlfn.RANK.EQ":"RANK.EQ","_xlfn.RRI":"RRI","_xlfn.SEC":"SEC","_xlfn.SECH":"SECH","_xlfn.SHEET":"SHEET","_xlfn.SHEETS":"SHEETS","_xlfn.SKEW.P":"SKEW.P","_xlfn.STDEV.P":"STDEV.P","_xlfn.STDEV.S":"STDEV.S","_xlfn.SUMIFS":"SUMIFS","_xlfn.T.DIST":"T.DIST","_xlfn.T.DIST.2T":"T.DIST.2T","_xlfn.T.DIST.RT":"T.DIST.RT","_xlfn.T.INV":"T.INV","_xlfn.T.INV.2T":"T.INV.2T","_xlfn.T.TEST":"T.TEST","_xlfn.UNICHAR":"UNICHAR","_xlfn.UNICODE":"UNICODE","_xlfn.VAR.P":"VAR.P","_xlfn.VAR.S":"VAR.S","_xlfn.WEBSERVICE":"WEBSERVICE","_xlfn.WEIBULL.DIST":"WEIBULL.DIST","_xlfn.WORKDAY.INTL":"WORKDAY.INTL","_xlfn.XOR":"XOR","_xlfn.Z.TEST":"Z.TEST"};function ods_to_csf_formula(f){if(f.substr(0,3)=="of:")f=f.substr(3);if(f.charCodeAt(0)==61){f=f.substr(1);if(f.charCodeAt(0)==61)f=f.substr(1)}f=f.replace(/COM\.MICROSOFT\./g,"");f=f.replace(/\[((?:\.[A-Z]+[0-9]+)(?::\.[A-Z]+[0-9]+)?)\]/g,function($$,$1){return $1.replace(/\./g,"")});f=f.replace(/\[.(#[A-Z]*[?!])\]/g,"$1");return f.replace(/[;~]/g,",").replace(/\|/g,";")}function csf_to_ods_formula(f){var o="of:="+f.replace(crefregex,"$1[.$2$3$4$5]").replace(/\]:\[/g,":");return o.replace(/;/g,"|").replace(/,/g,";")}function ods_to_csf_range_3D(r){var a=r.split(":");var s=a[0].split(".")[0];return[s,a[0].split(".")[1]+":"+a[1].split(".")[1]]}var strs={};var _ssfopts={};RELS.WS=["http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet","http://purl.oclc.org/ooxml/officeDocument/relationships/worksheet"];function get_sst_id(sst,str){for(var i=0,len=
if(colinfo.length>0)s["!cols"]=colinfo;if(rowinfo.length>0)s["!rows"]=rowinfo;return s}function write_ws_bin_cell(ba,cell,R,C,opts,ws){if(cell.v===undefined)return"";var vv="";var olddate=null;switch(cell.t){case"b":vv=cell.v?"1":"0";break;case"d":cell.z=cell.z||SSF._table[14];olddate=cell.v;cell.v=datenum(cell.v);cell.t="n";break;case"n":case"e":vv=""+cell.v;break;default:vv=cell.v;break}var o={r:R,c:C};o.s=get_cell_style(opts.cellXfs,cell,opts);if(cell.l)ws["!links"].push([encode_cell(o),cell.l]);if(cell.c)ws["!comments"].push([encode_cell(o),cell.c]);switch(cell.t){case"s":case"str":if(opts.bookSST){vv=get_sst_id(opts.Strings,cell.v);o.t="s";o.v=vv;write_record(ba,"BrtCellIsst",write_BrtCellIsst(cell,o))}else{o.t="str";write_record(ba,"BrtCellSt",write_BrtCellSt(cell,o))}return;case"n":if(cell.v==(cell.v|0)&&cell.v>-1e3&&cell.v<1e3)write_record(ba,"BrtCellRk",write_BrtCellRk(cell,o));else write_record(ba,"BrtCellReal",write_BrtCellReal(cell,o));if(olddate){cell.t="d";cell.v=olddate}return;case"b":o.t="b";write_record(ba,"BrtCellBool",write_BrtCellBool(cell,o));return;case"e":o.t="e";break}write_record(ba,"BrtCellBlank",write_BrtCellBlank(cell,o))}function write_CELLTABLE(ba,ws,idx,opts,wb){var range=safe_decode_range(ws["!ref"]||"A1"),ref,rr="",cols=[];write_record(ba,"BrtBeginSheetData");var dense=Array.isArray(ws);for(var R=range.s.r;R<=range.e.r;++R){rr=encode_row(R);write_row_header(ba,ws,range,R);for(var C=range.s.c;C<=range.e.c;++C){if(R===range.s.r)cols[C]=encode_col(C);ref=cols[C]+rr;var cell=dense?(ws[R]||[])[C]:ws[ref];if(!cell)continue;write_ws_bin_cell(ba,cell,R,C,opts,ws)}}write_record(ba,"BrtEndSheetData")}function write_MERGECELLS(ba,ws){if(!ws||!ws["!merges"])return;write_record(ba,"BrtBeginMergeCells",write_BrtBeginMergeCells(ws["!merges"].length));ws["!merges"].forEach(function(m){write_record(ba,"BrtMergeCell",write_BrtMergeCell(m))});write_record(ba,"BrtEndMergeCells")}function write_COLINFOS(ba,ws,idx,opts,wb){if(!ws||!ws["!cols"])return;write_record(ba,"BrtBeginColInfos");ws["!cols"].forEach(function(m,i){if(m)write_record(ba,"BrtColInfo",write_BrtColInfo(i,m))});write_record(ba,"BrtEndColInfos")}function write_HLINKS(ba,ws,rels){ws["!links"].forEach(function(l){if(!l[1].Target)return;var rId=add_rels(rels,-1,l[1].Target.replace(/#.*$/,""),RELS.HLINK);write_record(ba,"BrtHLink",write_BrtHLink(l,rId))});delete ws["!links"]}function write_LEGACYDRAWING(ba,ws,idx,rels){if(ws["!comments"].length>0){var rId=add_rels(rels,-1,"../drawings/vmlDrawing"+(idx+1)+".vml",RELS.VML);write_record(ba,"BrtLegacyDrawing",write_RelID("rId"+rId));ws["!legacy"]=rId}}function write_AUTOFILTER(ba,ws){if(!ws["!autofilter"])return;write_record(ba,"BrtBeginAFilter",write_UncheckedRfX(decode_range(ws["!autofilter"].ref)));write_record(ba,"BrtEndAFilter")}function write_WSVIEWS2(ba,ws){write_record(ba,"BrtBeginWsViews");{write_record(ba,"BrtBeginWsView",write_BrtBeginWsView(ws));write_record(ba,"BrtEndWsView")}write_record(ba,"BrtEndWsViews")}function write_WSFMTINFO(ba,ws){}function write_SHEETPROTECT(ba,ws){if(!ws["!protect"])return;write_record(ba,"BrtSheetProtection",write_BrtSheetProtection(ws["!protect"]))}function write_ws_bin(idx,opts,wb,rels){var ba=buf_array();var s=wb.SheetNames[idx],ws=wb.Sheets[s]||{};var r=safe_decode_range(ws["!ref"]||"A1");ws["!links"]=[];ws["!comments"]=[];write_record(ba,"BrtBeginSheet");write_record(ba,"BrtWsProp",write_BrtWsProp(s));write_record(ba,"BrtWsDim",write_BrtWsDim(r));write_WSVIEWS2(ba,ws);write_WSFMTINFO(ba,ws);write_COLINFOS(ba,ws,idx,opts,wb);write_CELLTABLE(ba,ws,idx,opts,wb);write_SHEETPROTECT(ba,ws);write_AUTOFILTER(ba,ws);write_MERGECELLS(ba,ws);write_HLINKS(ba,ws,rels);if(ws["!margins"])write_record(ba,"BrtMargins",write_BrtMargins(ws["!margins"]));write_LEGACYDRAWING(ba,ws,idx,rels);write_record(ba,"BrtEndSheet");return ba.end()}function parse_numCache(data){var col=[];(data.match(/<c:pt idx="(\d*)">(.*?)<\/c:pt>/gm)||[]).forEach(function(pt){var q=pt.match(/<c:pt idx="(.*?)"><c:v>(.*)<\/c:v><\/c:pt>/);if(!q)return;col[+q[1]]=+q[2]});var nf=unescapexml((data.match(/<c:
case"MaxChange":break;case"Path":break;case"Xct":break;case"Count":break;case"SelectedSheets":break;case"Calculation":break;case"Uncalced":break;case"StartupPrompt":break;case"Crn":break;case"ExternName":break;case"Formula":break;case"ColFirst":break;case"ColLast":break;case"WantAdvise":break;case"Boolean":break;case"Error":break;case"Text":break;case"OLE":break;case"NoAutoRecover":break;case"PublishObjects":break;case"DoNotCalculateBeforeSave":break;case"Number":break;case"RefModeR1C1":break;case"EmbedSaveSmartTags":break;default:seen=false}break;case"WorkbookOptions":switch(Rn[3]){case"OWCVersion":break;case"Height":break;case"Width":break;default:seen=false}break;case"WorksheetOptions":switch(Rn[3]){case"Visible":if(Rn[0].slice(-2)==="/>"){}else if(Rn[1]==="/")switch(str.slice(pidx,Rn.index)){case"SheetHidden":wsprops.Hidden=1;break;case"SheetVeryHidden":wsprops.Hidden=2;break}else pidx=Rn.index+Rn[0].length;break;case"Header":if(!cursheet["!margins"])default_margins(cursheet["!margins"]={},"xlml");cursheet["!margins"].header=parsexmltag(Rn[0]).Margin;break;case"Footer":if(!cursheet["!margins"])default_margins(cursheet["!margins"]={},"xlml");cursheet["!margins"].footer=parsexmltag(Rn[0]).Margin;break;case"PageMargins":var pagemargins=parsexmltag(Rn[0]);if(!cursheet["!margins"])default_margins(cursheet["!margins"]={},"xlml");if(pagemargins.Top)cursheet["!margins"].top=pagemargins.Top;if(pagemargins.Left)cursheet["!margins"].left=pagemargins.Left;if(pagemargins.Right)cursheet["!margins"].right=pagemargins.Right;if(pagemargins.Bottom)cursheet["!margins"].bottom=pagemargins.Bottom;break;case"Unsynced":break;case"Print":break;case"Panes":break;case"Scale":break;case"Pane":break;case"Number":break;case"Layout":break;case"PageSetup":break;case"Selected":break;case"ProtectObjects":break;case"EnableSelection":break;case"ProtectScenarios":break;case"ValidPrinterInfo":break;case"HorizontalResolution":break;case"VerticalResolution":break;case"NumberofCopies":break;case"ActiveRow":break;case"ActiveCol":break;case"ActivePane":break;case"TopRowVisible":break;case"TopRowBottomPane":break;case"LeftColumnVisible":break;case"LeftColumnRightPane":break;case"FitToPage":break;case"RangeSelection":break;case"PaperSizeIndex":break;case"PageLayoutZoom":break;case"PageBreakZoom":break;case"FilterOn":break;case"DoNotDisplayGridlines":break;case"SplitHorizontal":break;case"SplitVertical":break;case"FreezePanes":break;case"FrozenNoSplit":break;case"FitWidth":break;case"FitHeight":break;case"CommentsLayout":break;case"Zoom":break;case"LeftToRight":break;case"Gridlines":break;case"AllowSort":break;case"AllowFilter":break;case"AllowInsertRows":break;case"AllowDeleteRows":break;case"AllowInsertCols":break;case"AllowDeleteCols":break;case"AllowInsertHyperlinks":break;case"AllowFormatCells":break;case"AllowSizeCols":break;case"AllowSizeRows":break;case"NoSummaryRowsBelowDetail":break;case"TabColorIndex":break;case"DoNotDisplayHeadings":break;case"ShowPageLayoutZoom":break;case"NoSummaryColumnsRightDetail":break;case"BlackAndWhite":break;case"DoNotDisplayZeros":break;case"DisplayPageBreak":break;case"RowColHeadings":break;case"DoNotDisplayOutline":break;case"NoOrientation":break;case"AllowUsePivotTables":break;case"ZeroHeight":break;case"ViewableRange":break;case"Selection":break;case"ProtectContents":break;default:seen=false}break;case"PivotTable":case"PivotCache":switch(Rn[3]){case"ImmediateItemsOnDrop":break;case"ShowPageMultipleItemLabel":break;case"CompactRowIndent":break;case"Location":break;case"PivotField":break;case"Orientation":break;case"LayoutForm":break;case"LayoutSubtotalLocation":break;case"LayoutCompactRow":break;case"Position":break;case"PivotItem":break;case"DataType":break;case"DataField":break;case"SourceName":break;case"ParentField":break;case"PTLineItems":break;case"PTLineItem":break;case"CountOfSameItems":break;case"Item":break;case"ItemType":break;case"PTSource":break;case"CacheIndex":break;case"ConsolidationReference":break;case"FileName":break;case"Reference":break;case"NoColumnGrand":break;case"NoRowGrand":break;case"BlankLin
case"ContinueFrt12":break;case"FrtFontList":case"FrtWrapper":break;default:switch(R.n){case"ExternCount":break;case"TabIdConf":case"Radar":case"RadarArea":case"DropBar":case"Intl":case"CoordList":case"SerAuxErrBar":break;case"BIFF2FONTCLR":case"BIFF2FMTCNT":case"BIFF2FONTXTRA":break;case"BIFF2XF":case"BIFF3XF":case"BIFF4XF":break;case"BIFF4FMTCNT":case"BIFF2ROW":case"BIFF2WINDOW2":break;case"SCENARIO":case"DConBin":case"PicF":case"DataLabExt":case"Lel":case"BopPop":case"BopPopCustom":case"RealTimeData":case"Name":break;default:if(options.WTF)throw"Unrecognized Record "+R.n}}}}}else blob.l+=length}var sheetnamesraw=Object.keys(Directory).sort(function(a,b){return Number(a)-Number(b)}).map(function(x){return Directory[x].name});var sheetnames=sheetnamesraw.slice();wb.Directory=sheetnamesraw;wb.SheetNames=sheetnamesraw;if(!options.bookSheets)wb.Sheets=Sheets;if(wb.Sheets)FilterDatabases.forEach(function(r,i){wb.Sheets[wb.SheetNames[i]]["!autofilter"]=r});wb.Preamble=Preamble;wb.Strings=sst;wb.SSF=SSF.get_table();if(opts.enc)wb.Encryption=opts.enc;wb.Metadata={};if(country!==undefined)wb.Metadata.Country=country;if(supbooks.names.length>0)Workbook.Names=supbooks.names;wb.Workbook=Workbook;return wb}function parse_props(cfb){var DSI=cfb.find("!DocumentSummaryInformation");if(DSI)try{cfb.DocSummary=parse_PropertySetStream(DSI,DocSummaryPIDDSI)}catch(e){}var SI=cfb.find("!SummaryInformation");if(SI)try{cfb.Summary=parse_PropertySetStream(SI,SummaryPIDSI)}catch(e){}}function parse_xlscfb(cfb,options){if(!options)options={};fix_read_opts(options);reset_cp();var CompObj,Summary,Workbook;if(cfb.FullPaths){CompObj=cfb.find("!CompObj");Summary=cfb.find("!SummaryInformation");Workbook=cfb.find("/Workbook")}else{prep_blob(cfb,0);Workbook={content:cfb}}if(!Workbook)Workbook=cfb.find("/Book");var CompObjP,SummaryP,WorkbookP;if(CompObj)CompObjP=parse_compobj(CompObj);if(options.bookProps&&!options.bookSheets)WorkbookP={};else{if(Workbook)WorkbookP=parse_workbook(Workbook.content,options,!!Workbook.find);else if(cfb.find("PerfectOffice_MAIN"))WorkbookP=WK_.to_workbook(cfb.find("PerfectOffice_MAIN").content,options);else if(cfb.find("NativeContent_MAIN"))WorkbookP=WK_.to_workbook(cfb.find("NativeContent_MAIN").content,options);else throw new Error("Cannot find Workbook stream")}if(cfb.FullPaths)parse_props(cfb);var props={};for(var y in cfb.Summary)props[y]=cfb.Summary[y];for(y in cfb.DocSummary)props[y]=cfb.DocSummary[y];WorkbookP.Props=WorkbookP.Custprops=props;if(options.bookFiles)WorkbookP.cfb=cfb;return WorkbookP}var XLSBRecordEnum={0:{n:"BrtRowHdr",f:parse_BrtRowHdr},1:{n:"BrtCellBlank",f:parse_BrtCellBlank},2:{n:"BrtCellRk",f:parse_BrtCellRk},3:{n:"BrtCellError",f:parse_BrtCellError},4:{n:"BrtCellBool",f:parse_BrtCellBool},5:{n:"BrtCellReal",f:parse_BrtCellReal},6:{n:"BrtCellSt",f:parse_BrtCellSt},7:{n:"BrtCellIsst",f:parse_BrtCellIsst},8:{n:"BrtFmlaString",f:parse_BrtFmlaString},9:{n:"BrtFmlaNum",f:parse_BrtFmlaNum},10:{n:"BrtFmlaBool",f:parse_BrtFmlaBool},11:{n:"BrtFmlaError",f:parse_BrtFmlaError},16:{n:"BrtFRTArchID$",f:parse_BrtFRTArchID$},19:{n:"BrtSSTItem",f:parse_RichStr},20:{n:"BrtPCDIMissing",f:parsenoop},21:{n:"BrtPCDINumber",f:parsenoop},22:{n:"BrtPCDIBoolean",f:parsenoop},23:{n:"BrtPCDIError",f:parsenoop},24:{n:"BrtPCDIString",f:parsenoop},25:{n:"BrtPCDIDatetime",f:parsenoop},26:{n:"BrtPCDIIndex",f:parsenoop},27:{n:"BrtPCDIAMissing",f:parsenoop},28:{n:"BrtPCDIANumber",f:parsenoop},29:{n:"BrtPCDIABoolean",f:parsenoop},30:{n:"BrtPCDIAError",f:parsenoop},31:{n:"BrtPCDIAString",f:parsenoop},32:{n:"BrtPCDIADatetime",f:parsenoop},33:{n:"BrtPCRRecord",f:parsenoop},34:{n:"BrtPCRRecordDt",f:parsenoop},35:{n:"BrtFRTBegin",f:parsenoop},36:{n:"BrtFRTEnd",f:parsenoop},37:{n:"BrtACBegin",f:parsenoop},38:{n:"BrtACEnd",f:parsenoop},39:{n:"BrtName",f:parse_BrtName},40:{n:"BrtIndexRowBlock",f:parsenoop},42:{n:"BrtIndexBlock",f:parsenoop},43:{n:"BrtFont",f:parse_BrtFont},44:{n:"BrtFmt",f:parse_BrtFmt},45:{n:"BrtFill",f:parsenoop},46:{n:"BrtBorder",f:parsenoop},47:{n:"BrtXF",f:parse_BrtXF},48:{n:"BrtStyle",f:parsenoop},49:{n:"BrtCellMeta",f
f:parsenoop},2075:{n:"BrtTableSlicerCacheIDs",f:parsenoop},2076:{n:"BrtTableSlicerCacheID",f:parsenoop},2077:{n:"BrtBeginTableSlicerCache",f:parsenoop},2078:{n:"BrtEndTableSlicerCache",f:parsenoop},2079:{n:"BrtSxFilter15",f:parsenoop},2080:{n:"BrtBeginTimelineCachePivotCacheIDs",f:parsenoop},2081:{n:"BrtEndTimelineCachePivotCacheIDs",f:parsenoop},2082:{n:"BrtTimelineCachePivotCacheID",f:parsenoop},2083:{n:"BrtBeginTimelineCacheIDs",f:parsenoop},2084:{n:"BrtEndTimelineCacheIDs",f:parsenoop},2085:{n:"BrtBeginTimelineCacheID",f:parsenoop},2086:{n:"BrtEndTimelineCacheID",f:parsenoop},2087:{n:"BrtBeginTimelinesEx",f:parsenoop},2088:{n:"BrtEndTimelinesEx",f:parsenoop},2089:{n:"BrtBeginTimelineEx",f:parsenoop},2090:{n:"BrtEndTimelineEx",f:parsenoop},2091:{n:"BrtWorkBookPr15",f:parsenoop},2092:{n:"BrtPCDH15",f:parsenoop},2093:{n:"BrtBeginTimelineStyle",f:parsenoop},2094:{n:"BrtEndTimelineStyle",f:parsenoop},2095:{n:"BrtTimelineStyleElement",f:parsenoop},2096:{n:"BrtBeginTimelineStylesheetExt15",f:parsenoop},2097:{n:"BrtEndTimelineStylesheetExt15",f:parsenoop},2098:{n:"BrtBeginTimelineStyles",f:parsenoop},2099:{n:"BrtEndTimelineStyles",f:parsenoop},2100:{n:"BrtBeginTimelineStyleElements",f:parsenoop},2101:{n:"BrtEndTimelineStyleElements",f:parsenoop},2102:{n:"BrtDxf15",f:parsenoop},2103:{n:"BrtBeginDxfs15",f:parsenoop},2104:{n:"brtEndDxfs15",f:parsenoop},2105:{n:"BrtSlicerCacheHideItemsWithNoData",f:parsenoop},2106:{n:"BrtBeginItemUniqueNames",f:parsenoop},2107:{n:"BrtEndItemUniqueNames",f:parsenoop},2108:{n:"BrtItemUniqueName",f:parsenoop},2109:{n:"BrtBeginExtConn15",f:parsenoop},2110:{n:"BrtEndExtConn15",f:parsenoop},2111:{n:"BrtBeginOledbPr15",f:parsenoop},2112:{n:"BrtEndOledbPr15",f:parsenoop},2113:{n:"BrtBeginDataFeedPr15",f:parsenoop},2114:{n:"BrtEndDataFeedPr15",f:parsenoop},2115:{n:"BrtTextPr15",f:parsenoop},2116:{n:"BrtRangePr15",f:parsenoop},2117:{n:"BrtDbCommand15",f:parsenoop},2118:{n:"BrtBeginDbTables15",f:parsenoop},2119:{n:"BrtEndDbTables15",f:parsenoop},2120:{n:"BrtDbTable15",f:parsenoop},2121:{n:"BrtBeginDataModel",f:parsenoop},2122:{n:"BrtEndDataModel",f:parsenoop},2123:{n:"BrtBeginModelTables",f:parsenoop},2124:{n:"BrtEndModelTables",f:parsenoop},2125:{n:"BrtModelTable",f:parsenoop},2126:{n:"BrtBeginModelRelationships",f:parsenoop},2127:{n:"BrtEndModelRelationships",f:parsenoop},2128:{n:"BrtModelRelationship",f:parsenoop},2129:{n:"BrtBeginECTxtWiz15",f:parsenoop},2130:{n:"BrtEndECTxtWiz15",f:parsenoop},2131:{n:"BrtBeginECTWFldInfoLst15",f:parsenoop},2132:{n:"BrtEndECTWFldInfoLst15",f:parsenoop},2133:{n:"BrtBeginECTWFldInfo15",f:parsenoop},2134:{n:"BrtFieldListActiveItem",f:parsenoop},2135:{n:"BrtPivotCacheIdVersion",f:parsenoop},2136:{n:"BrtSXDI15",f:parsenoop},65535:{n:"",f:parsenoop}};var evert_RE=evert_key(XLSBRecordEnum,"n");var XLSRecordEnum={3:{n:"BIFF2NUM",f:parse_BIFF2NUM},4:{n:"BIFF2STR",f:parse_BIFF2STR},6:{n:"Formula",f:parse_Formula},9:{n:"BOF",f:parse_BOF},10:{n:"EOF",f:parse_EOF},12:{n:"CalcCount",f:parse_CalcCount},13:{n:"CalcMode",f:parse_CalcMode},14:{n:"CalcPrecision",f:parse_CalcPrecision},15:{n:"CalcRefMode",f:parse_CalcRefMode},16:{n:"CalcDelta",f:parse_CalcDelta},17:{n:"CalcIter",f:parse_CalcIter},18:{n:"Protect",f:parse_Protect},19:{n:"Password",f:parse_Password},20:{n:"Header",f:parse_Header},21:{n:"Footer",f:parse_Footer},23:{n:"ExternSheet",f:parse_ExternSheet},24:{n:"Lbl",f:parse_Lbl},25:{n:"WinProtect",f:parse_WinProtect},26:{n:"VerticalPageBreaks",f:parse_VerticalPageBreaks},27:{n:"HorizontalPageBreaks",f:parse_HorizontalPageBreaks},28:{n:"Note",f:parse_Note},29:{n:"Selection",f:parse_Selection},34:{n:"Date1904",f:parse_Date1904},35:{n:"ExternName",f:parse_ExternName},38:{n:"LeftMargin",f:parse_LeftMargin},39:{n:"RightMargin",f:parse_RightMargin},40:{n:"TopMargin",f:parse_TopMargin},41:{n:"BottomMargin",f:parse_BottomMargin},42:{n:"PrintRowCol",f:parse_PrintRowCol},43:{n:"PrintGrid",f:parse_PrintGrid},47:{n:"FilePass",f:parse_FilePass},49:{n:"Font",f:parse_Font},51:{n:"PrintSize",f:parse_PrintSize},60:{n:"Continue",f:parse_Continue},61:{n:"Window1",f:parse_Window1},64:{n:"Backup",f
case"page-number":break;case"page-count":break;case"time":break;case"data-pilot-table":case"source-cell-range":case"source-service":case"data-pilot-field":case"data-pilot-level":case"data-pilot-subtotals":case"data-pilot-subtotal":case"data-pilot-members":case"data-pilot-member":case"data-pilot-display-info":case"data-pilot-sort-info":case"data-pilot-layout-info":case"data-pilot-field-reference":case"data-pilot-groups":case"data-pilot-group":case"data-pilot-group-member":break;case"rect":break;case"dde-connection-decls":case"dde-connection-decl":case"dde-link":case"dde-source":break;case"properties":break;case"property":break;case"a":break;case"table-protection":break;case"data-pilot-grand-total":break;default:if(Rn[2]==="dc:")break;if(Rn[2]==="draw:")break;if(Rn[2]==="style:")break;if(Rn[2]==="calcext:")break;if(Rn[2]==="loext:")break;if(Rn[2]==="uof:")break;if(Rn[2]==="表:")break;if(Rn[2]==="字:")break;if(opts.WTF)throw new Error(Rn)}var out={Sheets:Sheets,SheetNames:SheetNames};return out}}();var write_content_xml=function(){var null_cell_xml=" <table:table-cell />\n";var covered_cell_xml=" <table:covered-table-cell/>\n";var write_ws=function(ws,wb,i,opts){var o=[];o.push(' <table:table table:name="'+escapexml(wb.SheetNames[i])+'">\n');var R=0,C=0,range=decode_range(ws["!ref"]);var marr=ws["!merges"]||[],mi=0;var dense=Array.isArray(ws);for(R=0;R<range.s.r;++R)o.push(" <table:table-row></table:table-row>\n");for(;R<=range.e.r;++R){o.push(" <table:table-row>\n");for(C=0;C<range.s.c;++C)o.push(null_cell_xml);for(;C<=range.e.c;++C){var skip=false,ct={},textp="";for(mi=0;mi!=marr.length;++mi){if(marr[mi].s.c>C)continue;if(marr[mi].s.r>R)continue;if(marr[mi].e.c<C)continue;if(marr[mi].e.r<R)continue;if(marr[mi].s.c!=C||marr[mi].s.r!=R)skip=true;ct["table:number-columns-spanned"]=marr[mi].e.c-marr[mi].s.c+1;ct["table:number-rows-spanned"]=marr[mi].e.r-marr[mi].s.r+1;break}if(skip){o.push(covered_cell_xml);continue}var ref=encode_cell({r:R,c:C}),cell=dense?(ws[R]||[])[C]:ws[ref];if(cell&&cell.f){ct["table:formula"]=escapexml(csf_to_ods_formula(cell.f));if(cell.F){if(cell.F.substr(0,ref.length)==ref){var _Fref=decode_range(cell.F);ct["table:number-matrix-columns-spanned"]=_Fref.e.c-_Fref.s.c+1;ct["table:number-matrix-rows-spanned"]=_Fref.e.r-_Fref.s.r+1}}}if(!cell){o.push(null_cell_xml);continue}switch(cell.t){case"b":textp=cell.v?"TRUE":"FALSE";ct["office:value-type"]="boolean";ct["office:boolean-value"]=cell.v?"true":"false";break;case"n":textp=cell.w||String(cell.v||0);ct["office:value-type"]="float";ct["office:value"]=cell.v||0;break;case"s":case"str":textp=escapexml(cell.v);ct["office:value-type"]="string";break;case"d":textp=cell.w||parseDate(cell.v).toISOString();ct["office:value-type"]="date";ct["office:date-value"]=parseDate(cell.v).toISOString();ct["table:style-name"]="ce1";break;default:o.push(null_cell_xml);continue}o.push(writextag("table:table-cell",writextag("text:p",textp,{}),ct))}o.push(" </table:table-row>\n")}o.push(" </table:table>\n");return o.join("")};var write_automatic_styles_ods=function(o){o.push(" <office:automatic-styles>\n");o.push(' <number:date-style style:name="N37" number:automatic-order="true">\n');o.push(' <number:month number:style="long"/>\n');o.push(" <number:text>/</number:text>\n");o.push(' <number:day number:style="long"/>\n');o.push(" <number:text>/</number:text>\n");o.push(" <number:year/>\n");o.push(" </number:date-style>\n");o.push(' <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>\n');o.push(" </office:automatic-styles>\n")};return function wcx(wb,opts){var o=[XML_HEADER];var attr=wxt_helper({"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:opendocu