2016-12-31 08:20:45 +00:00
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
2017-05-17 04:23:36 +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:03:03 +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:23:36 +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-06-24 06:51:37 +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 . 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 |" + fmt + "| unterminated string " ) ; return out } SSF . _split = split _fmt ; var abstime = /\[[HhMmSs]*\]/ ; function fmt _is _date ( fmt ) { var i = 0 , c
var vtvregex = /<\/?(?:vt:)?variant>/g , vtmregex = /<(?:vt:)([^>]*)>(.*)</ ; 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 = _ _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 ; _ _d
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 _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 ] , fa
} } 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 . ifmt = 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 = blob . read _shift ( end - blob . l ) ; 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 ( 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 ) ; if ( flags & 32 ) name = XLSLblBuiltIn [ name . charCodeAt ( 0 ) ] ; 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 (
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 ( str , opts ) { return sheet _to _workbook ( prn _to _sheet ( str , 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 . Enum = WK3Enum ; o . qpro = true ; d . l = 0 } else throw new Error ( "Unrecognized LOTUS BOF " + d [ 2 ] ) ; lotushopper ( d , function ( val , Rn , RT ) { if ( d [ 2 ] == 2 ) switch ( RT ) { case 0 : o . vers = val ; if ( val >= 4096 ) o . qpro = true ; break ; case 6 : refguess = val ; break ; case 15 : if ( ! o . qpro ) val [ 1 ] . v = val [ 1 ] . v . substr ( 1 ) ; case 13 : ; case 14 : ; case 16 : ; case 51 : if ( RT == 14 && ( val [ 2 ] & 112 ) == 112 && ( val [ 2 ] & 15 ) > 1 && ( val [ 2 ] & 15 ) < 15 ) { val [ 1 ] . z = o . dateNF || SSF . _table [ 14 ] ; if ( o . cellDates ) { val [ 1 ] . t = "d" ; val [ 1 ] . v = numdate ( val [ 1 ] . v ) } } if ( o . dense ) { if ( ! s [ val [ 0 ] . r ] ) s [ val [ 0 ] . r ] = [ ] ; s [ val [ 0 ] . r ] [ val [ 0 ] . c ] = val [ 1 ] } else s [ encode _cell ( val [ 0 ] ) ] = val [ 1 ] ; break ; } else switch ( RT ) { case 22 : val [ 1 ] . v = val [ 1 ] . v . substr ( 1 ) ; case 23 : ; case 24 : ; case 25 : ; case 37 : ; case 39 : ; case 40 : if ( val [ 3 ] > sidx ) { s [ "!ref" ] = encode _range ( refguess ) ; sheets [ n ] = s ; s = o . dense ? [ ] : { } ; refguess = { s : { r : 0 , c : 0 } , e : { r : 0 , c : 0 } } ; sidx = val [ 3 ] ; n = "Sheet" + ( sidx + 1 ) ; s
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([^>]*)>.*<\/numFmts>/ ; var cellXfRegex = /<cellXfs([^>]*)>.*<\/cellXfs>/ ; var fillsRegex = /<fills([^>]*)>.*<\/fills>/ ; var fontsRegex = /<fonts([^>]*)>.*<\/fonts>/ ; var bordersRegex = /<borders([^>]*)>.*<\/borders>/ ; return function parse _sty _xml ( data , themes , opts ) { var styles = { } ; if ( ! data ) return styles ; 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="PivotStyleMedium4"/>' ; if ( o . length > 2 ) { o [ o . length ] = "</styleSheet>" ; o [ 1 ] = o [ 1 ] . replace ( "/>" , ">" ) } return o . join ( "" ) } function parse _BrtFmt ( data , length ) { var ifmt = data . read _shift ( 2 ) ; var stFmtCode = parse _XLWideString ( data , length - 2 ) ; return [ ifmt , stFmtCode ] } function write _BrtFmt ( i , f , o ) { if ( ! o ) o = new _buf ( 6 + 4 * f . length ) ; o . write _shift ( 2 , i ) ; write _XLWideString ( f , o ) ; return o . length > o . l ? o . slice ( 0 , o . l ) : o } function parse _BrtFont ( data , length , opts ) { var out = { } ; out . sz = data . read _shift ( 2 ) / 20 ; var grbit = parse _FontFlags ( data , 2 , opts ) ; if ( grbit . fCondense ) out . condense = 1 ; if ( grbit . fExtend ) out . extend = 1 ; if ( grbit . fShadow ) out . shadow = 1 ; if ( grbit . fOutline ) out . outline = 1 ; if ( grbit . fStrikeout ) out . strike = 1 ; if ( grbit . fItalic ) out . italic = 1 ; var bls = data . read _shift ( 2 ) ; if ( bls === 700 ) out . bold = 1 ; switch ( data . read _shift ( 2 ) ) { case 1 : out . vertAlign = "superscript" ; break ; case 2 : out . vertAlign = "subscript" ; break ; } var underline = data . read _shift ( 1 ) ; if ( underline != 0 ) out . underline = underline ; var family = data . read _shift ( 1 ) ; if ( family > 0 ) out . family = family ; var bCharSet = data . read _shift ( 1 ) ; if ( bCharSet > 0 ) out . charset = bCharSet ; data . l ++ ; out . color = parse _BrtColor ( data , 8 ) ; switch ( data . read _shift ( 1 ) ) { case 1 : out . scheme = "major" ; break ; case 2 : out . scheme = "minor" ; break ; } out . name = parse _XLWideString ( data , length - 21 ) ; return out } function write _BrtFont ( font , o ) { if ( ! o ) o = new _buf ( 25 + 4 * 32 ) ; o . write _shift ( 2 , font . sz * 20 ) ; write _FontFlags ( font , o ) ; o . write _shift ( 2 , font . bold ? 700 : 400 ) ; var sss = 0 ; if ( font . vertAlign == "superscript" ) sss = 1 ; else if ( font . vertAlign == "subscript" ) sss = 2 ; o . w
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 && opts . biff <= 5 ) return parse _RgceLoc _BIFF2 ( blob , length , opts ) ; var r = blob . read _shift ( opts && opts . biff == 12 ? 4 : 2 ) ; var c = parse _ColRelU ( blob , 2 ) ; return { r : r , c : c [ 0 ] , cRel : c [ 1 ] , rRel : c [ 2 ] } } function parse _RgceLoc _BIFF2 ( blob , length , opts ) { var r = parse _ColRelU ( blob , 2 ) ; var c = blob . read _shift ( 1 ) ; return { r : r [ 0 ] , c : c , cRel : r [ 1 ] , rRel : r [ 2 ] } } function parse _RgceLocRel ( blob , length , opts ) { var biff = opts && opts . biff ? opts . biff : 8 ; if ( biff >= 2 && biff <= 5 ) return parse _RgceLocRel _BIFF2 ( blob , length , opts ) ; var r = blob . read _shift ( biff >= 12 ? 4 : 2 ) ; var cl = blob . read _shift ( 2 ) ; var cRel = ( cl & 32768 ) >> 15 , rRel = ( cl & 16384 ) >> 14 ; cl &= 16383 ; if ( rRel == 1 ) while ( r > 524287 ) r -= 1048576 ; if ( cRel == 1 ) while ( cl > 8191 ) cl = cl - 16384 ; return { r : r , c : cl , cRel : cRel , rRel : rRel } } function parse _RgceLocRel _BIFF2 ( blob , length ) { var rl = blob . read _shift ( 2 ) ; var c = blob . read _shift ( 1 ) ; var rRel = ( rl & 32768 ) >> 15 , cRel = ( rl & 16384 ) >> 14 ; rl &= 16383 ; if ( rRel == 1 && rl >= 8192 ) rl = rl - 16384 ; if ( cRel == 1 && c >= 128 ) c = c - 256 ; return { r : rl , c : c , cRel : cRel , rRel : rRel } } function parse _PtgArea ( blob , length , opts ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; var area = parse _RgceArea ( blob , opts . biff >= 2 && opts . biff <= 5 ? 6 : 8 , opts ) ; return [ type , area ] } function parse _PtgArea3d ( blob , length , opts ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; var ixti = blob . read _shift ( 2 , "i" ) ; var w = 8 ; if ( opts ) switch ( opts . biff ) { case 5 : blob . l += 12 ; w = 6 ; break ; case 12 : w = 12 ; break ; } var area = parse _RgceArea ( blob , w , opts ) ; return [ type , ixti , area ] } function parse _PtgAreaErr ( blob , length , opts ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; blob . l += opts && opts . biff > 8 ? 12 : 8 ; return [ type ] } function parse _PtgAreaErr3d ( blob , length , opts ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; var ixti = blob . read _shift ( 2 ) ; var w = 8 ; if ( opts ) switch ( opts . biff ) { case 5 : blob . l += 12 ; w = 6 ; break ; case 12 : w = 12 ; break ; } blob . l += w ; return [ type ,
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 : "IMAGINARY" , 410 : "IMREAL" , 411 : "COMPLEX" , 412 : "IMSUM" , 413 : "IMPRODUCT" , 414 : "SERIESSUM" , 415 : "FACTDOUBLE" , 416 : "SQRTPI" , 417 : "QUOTIENT" , 418 : "DELTA" , 419 : "GESTEP" , 420 : "ISEVEN" , 421 : "ISODD" , 422 : "MROUND" , 423 : "ERF" , 424 : "ERFC" , 425 : "BESSELJ" , 426 : "BESSELK" , 427 : "BESSELY" , 428 : "BESSELI" , 429 : "XIRR" , 430 : "XNPV" , 431 : "PRICEMAT" , 432 : "YIELDMAT" , 433 : "INTRATE" , 434 : "RECEIVED" , 435 : "DISC" , 436 : "PRICEDISC" , 437 : "YIELDDISC" , 438 : "TBILLEQ" , 439 : "TBILLPRICE" , 440 : "TBILLYIELD" , 441 : "PRICE" , 442 : "YIELD" , 443 : "DOLLARDE" , 444 : "DOLLARFR" , 445 : "NOMINAL" , 446 : "EFFECT" , 447 : "CUMPRINC" , 448 : "CUMIPMT" , 449 : "EDATE" , 450 : "EOMONTH" , 451 : "YEARFRAC" , 452 : "COUPDAYBS" , 453 : "COUPDAYS" , 454 : "COUPDAYSNC" , 455 : "COUPNCD" , 456 : "COUPNUM" , 457 : "COUPPCD" , 458 : "DURATION" , 459 : "MDURATION" , 460 : "ODDLPRICE" , 461 : "ODDLYIELD" , 462 : "ODDFPRICE" , 463 : "ODDFYIELD" , 464 : "RANDBETWEEN" , 465 : "WEEKNUM" , 466 : "AMORDEGRC" , 467 : "AMORLINC" , 468 : "CONVERT" , 724 : "SHEETJS" , 469 : "ACCRINT" , 470 : "ACCRINTM" , 471 : "WORKDAY" , 472 : "NETWORKDAYS" , 473 : "GCD" , 474 : "MULTINOMIAL" , 475 : "LCM" , 476 : "FVSCHEDULE" , 477 : "CUBEKPIMEMBER" , 478 : "CUBESET" , 479 : "CUBESETCOUNT" , 480 : "IFERROR" , 481 : "COUNTIFS" , 482 : "SUMIFS" , 483 : "AVERAGEIF" , 484 : "AVERAGEIFS" } ; var FtabArgc = { 2 : 1 , 3 : 1 , 15 : 1 , 16 : 1 , 17 : 1 , 18 : 1 , 19 : 0 , 20 : 1 , 21 : 1 , 22 : 1 , 23 : 1 , 24 : 1 , 25 : 1 , 26 : 1 , 27 : 2 , 30 : 2 , 31 : 3 , 32 : 1 , 33 : 1 , 38 : 1 , 39 : 2 , 40 : 3 , 41 : 3 , 42 : 3 , 43 : 3 , 44 : 3 , 45 : 3 , 47 : 3 , 48 : 2 , 53 : 1 , 61 : 3 , 65 : 3 , 66 : 3 , 67 : 1 , 68 : 1 , 69 : 1 , 70 : 1 , 71 : 1 , 72 : 1 , 73 : 1 , 75 : 1 , 76 : 1 , 77 : 1 , 79 : 2 , 80 : 2 , 83 : 1 , 85 : 0 , 86 : 1 , 90 : 1 , 97 : 2 , 98 : 1 , 99 : 1 , 101 : 3 , 102 : 3 , 105 : 1 , 111 : 1 , 112 : 1 , 113 : 1 , 114 : 1 , 117 : 2 , 118 : 1 , 119 : 4 , 121 : 1 , 126 : 1 , 127 : 1 , 128 : 1 , 129 : 1 , 130 : 1 , 131 : 1 , 133 : 1 , 134 : 1 , 135 : 1 , 136 : 2 , 137 : 2 , 138 : 2 , 140 : 1 , 141 : 1 , 142 : 3 , 143 : 4 , 144 : 4 , 162 : 1 , 163 : 1 , 164 : 1 , 165 : 2 , 172 : 1 , 175 : 2 , 176 : 2 , 177 : 3 , 178 : 2 , 179 : 1 , 184 : 1 , 189 : 3 , 190 : 1 , 195 : 3 , 196 : 3 , 197 : 1 , 198 : 1 , 199 : 3 , 201 : 1 , 207 : 4 , 210 : 3 , 211 : 1 , 212 : 2 , 213 : 2 , 214 : 1 , 215 : 1 , 229 : 1 , 230 : 1 , 231 : 1 , 232 : 1 , 233 : 1 , 234 : 1 , 2
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 ) { 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 . ifmt , null , opts , themes , styles ) ; C = val [ 0 ] . c ; if ( opts . dense ) { if ( ! s [ R ] ) s [ R ] = [ ] ; s [ R ] [ C ] = p } else s [ encode _col ( C ) + rr ] = p ; if ( opts . cellFormula ) { af = false ; for ( ai = 0 ; ai < array _formulae . length ; ++ ai ) { var aii = array _formulae [ ai ] ; if ( row . r >= aii [ 0 ] . s . r && row . r <= aii [ 0 ] . e . r ) if ( C >= aii [ 0 ] . s . c && C <= aii [ 0 ] . e . c ) { p . F = encode _range ( aii [ 0 ] ) ; af = true } } if ( ! af && val . length > 3 ) p . f = val [ 3 ] } if ( refguess . s . r > row . r ) refguess . s . r = row . r ; if ( refguess . s . c > C ) refguess . s . c = C ; if ( refguess . e . r < row . r ) refguess . e . r = row . r ; if ( refguess . e . c < C ) refguess . e . c = C ; if ( opts . cellDates && cf && p . t == "n" && SSF . is _date ( SSF . _table [ cf . ifmt ] ) ) { var _d = SSF . parse _date _code ( p . v ) ; if ( _d ) { p . t = "d" ; p . v = new Date ( _d . y , _d . m - 1 , _d . d , _d . H , _d . M , _d . S , _d . u ) } } break ; case 1 : if ( ! opts . sheetStubs ) break ; p = { t : "z" , v : undefined } ; C = val [ 0 ] . c ; if ( opts . dense ) { if ( ! s [ R ] ) s [ R ] = [ ] ; s [ R ] [ C ] = p } else s [ encode _col ( C ) + rr ] = p ; if ( refguess . s . r > row . r ) refguess . s . r = row . r ; if ( refguess . s . c > C ) refguess . s . c = C ; if ( refguess . e . r < row . r ) refguess . e . r = row . r ; if ( refguess . e . c < C ) refguess . e . c = C ; break ; case 176 : mergecells . push ( val ) ; break ; case 494 : var rel = rels [ "!id" ] [ val . relId ] ; if ( rel ) { val . Target = rel . Target ; if ( val . loc ) val . Target += "#" + val . loc ; val . Rel = rel } for ( R = val . rfx . s . r ; R <= val . rfx . e . r ; ++ R ) for ( C = val . rfx . s . c ; C <= val . rfx . e . c ; ++ C ) { if ( opts . dense ) { if ( ! s [ R ] ) s [ R ] = [ ] ; if ( ! s [ R ] [ C ] ) s [ R ] [ C ] = { t : "z" , v : undefined } ; s [ R ] [ C ] . l = val } else { addr = encode _cell ( { c : C , r : R } ) ; if ( ! s [ addr ] ) s [ addr ] = { t : "z" , v : undefined } ; s [ addr ] . l = val } } break ; case 426 : if ( ! opts . cellFormula ) break ; array _formulae . push ( val ) ; cell = opts . dense ? s [ R ] [ C ] : s [ encode _col ( C ) + rr ] ; cell . f = stringify _formula ( val [ 1 ] , refguess , { r : row . r , c : C } , supbooks , opts ) ; cell . F = encode _range ( val [ 0 ] ) ; break ; case 427 : if ( ! opts . cellFormula ) break ; shared _formulae [ encode _cell ( val [ 0 ] . s ) ] = val [ 1 ] ; cell = opts . dense ? s [ R ] [ C ] : s [ encode _col ( C ) + rr ] ; cell . f = stringify _formula ( val [ 1 ] , refguess , { r : row . r , c : C } , supbooks , opts ) ; break ; case 60 : if ( ! opts . cellStyles ) break ; while ( val . e >= val . s ) { colinfo [ val . e -- ] = { width : val . w / 256 , hidden : ! ! ( val . flags & 1 ) } ; if ( ! seencol ) { seencol = true ; find _mdw _colw ( val . w / 256 ) } process _col ( colinfo [ val . e + 1 ] ) } break ; case 161 : s [ "!autofilter" ] = { ref : encode _range ( val ) } ; break ; case 476 : s [ "!margins" ] = val ; break ; case 175 : ; case 644 : ; case 625 : ; case 562 : ; case 396 : ; case 1112 : ; case 1146 : ; case 471 : ; case 1050 : ; case 649 : ; case 1105 : ; case 49 : ; case 589 : ; case 607 : ; case 564 : ; case 1055 : ; case 168 : ; case 174 : ; case 1180 : ; case 499 : ; case 64 : ; case 1053 : ; case 550 : ; case 171 : ; case 167 : ; case 1177 : ; case 169 : ; case 1181 : ; case 551 : ; case 552 : ; case 661 : ; case 639 : ; case 478 : ; case 151 : ; case 537 : ; case 477 : ; case 536 : ; case 1103 : ; case 680 : ; case 1104 : ; case 1024 : ; case 152 : ; case 663 : ; case 535 : ; case 678 : ; case 504 : ; case 1043 : ; case 428 : ; case 170 : ; case 50 : ; c
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 = + row . Index - 1 ; rowobj = { } ; if ( row . AutoFitHeight == "0" || row . Height ) { rowobj . hpx = parseInt ( row . Height , 10 ) ; rowobj . hpt = px2pt ( rowobj . hpx ) ; rowinfo [ r ] = rowobj } if ( row . Hidden == "1" ) { rowobj . hidden = true ; rowinfo [ r ] = rowobj } } break ; case "Worksheet" : if ( Rn [ 1 ] === "/" ) { if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw new Error ( "Bad state: " + tmp . join ( "|" ) ) ; sheetnames . push ( sheetname ) ; if ( refguess . s . r <= refguess . e . r && refguess . s . c <= refguess . e . c ) cursheet [ "!ref" ] = encode _range ( refguess ) ; if ( mergecells . length ) cursheet [ "!merges" ] = mergecells ; if ( cstys . length > 0 ) cursheet [ "!cols" ] = cstys ; if ( rowinfo . length > 0 ) cursheet [ "!rows" ] = rowinfo ; sheets [ sheetname ] = cursheet } else { refguess = { s : { r : 2e6 , c : 2e6 } , e : { r : 0 , c : 0 } } ; r = c = 0 ; state . push ( [ Rn [ 3 ] , false ] ) ; tmp = xlml _parsexmltag ( Rn [ 0 ] ) ; sheetname = unescapexml ( tmp . Name ) ; cursheet = opts . dense ? [ ] : { } ; mergecells = [ ] ; arrayf = [ ] ; rowinfo = [ ] ; wsprops = { name : sheetname , Hidden : 0 } ; Workbook . Sheets . push ( wsprops ) } break ; case "Table" : if ( Rn [ 1 ] === "/" ) { if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw new Error ( "Bad state: " + tmp . join ( "|" ) ) } else if ( Rn [ 0 ] . slice ( - 2 ) == "/>" ) break ; else { table = xlml _parsexmltag ( Rn [ 0 ] ) ; state . push ( [ Rn [ 3 ] , false ] ) ; cstys = [ ] ; seencol = false } break ; case "Style" : if ( Rn [ 1 ] === "/" ) process _style _xlml ( styles , stag , opts ) ; else stag = xlml _parsexmltag ( Rn [ 0 ] ) ; break ; case "NumberFormat" : stag . nf = unescapexml ( xlml _parsexmltag ( Rn [ 0 ] ) . Format || "General" ) ; if ( XLMLFormatMap [ stag . nf ] ) stag . nf = XLMLFormatMap [ stag . nf ] ; for ( var ssfidx = 0 ; ssfidx != 392 ; ++ ssfidx ) if ( SSF . _table [ ssfidx ] == stag . nf ) break ; if ( ssfidx == 392 ) for ( ssfidx = 57 ; ssfidx != 392 ; ++ ssfidx ) if ( SSF . _table [ ssfidx ] == null ) { SSF . load ( stag . nf , ssfidx ) ; break } break ; case "Column" : if ( state [ state . length - 1 ] [ 0 ] !== "Table" ) break ; csty = xlml _parsexmltag ( Rn [ 0 ] ) ; if ( csty . Hidden ) { csty . hidden = true ; delete csty . Hidden } if ( csty . Width ) csty . wpx = parseInt ( csty . Width , 10 ) ; if ( ! seencol && csty . wpx > 10 ) { seencol = true ; MDW = DEF _MDW ; for ( var _col = 0 ; _col < cstys . length ; ++ _col ) if ( cstys [ _col ] ) process _col ( cstys [ _col ] ) } if ( seencol ) process _col ( csty ) ; cstys [ csty . Index - 1 || cstys . length ] = csty ; for ( var i = 0 ; i < + csty . Span ; ++ i ) cstys [ cstys . length ] = dup ( csty ) ; break ; case "NamedRange" : if ( ! Workbook . Names ) Workbook . Names = [ ] ; var _NamedRange = parsexmltag ( Rn [ 0 ] ) ; var _DefinedName = { Name : _NamedRange . Name , Ref : rc _to _a1 ( _NamedRange . RefersTo . substr ( 1 ) ) } ; if ( Workbook . Sheets . length > 0 ) _DefinedName . Sheet = Workbook . Sheets . length - 1 ; Workbook . Names . push ( _DefinedName ) ; break ; case "NamedCell" : break ; case "B" : break ; case "I" : break ; case "U" : break ; case "S" : break ; case "Sub" : break ; case "Sup" : break ; case "Span" : break ; case "Border" : break ; case "Alignment" : break ; case "Borders" : break ; case "Font" : if ( Rn [ 0 ] . slice ( - 2 ) === "/>" ) break ; else if ( Rn [ 1 ] === "/" ) ss += str . slice ( fidx , Rn . index ) ; else fidx = Rn . index + Rn [ 0 ] . length ; break ; case "Interior" : if ( ! opts . cellStyles ) break ; stag . Interior = xlml _parsexmltag ( Rn [ 0 ] ) ; break ; case "Protection" : break ; case "Author" : ; case "Title" : ; case "Description" : ; case "Created" : ; case "Keywords" : ; case "Subject" : ; case "Category" : ; case "Company" : ; case "LastAuthor" : ; case "LastSaved" : ; case "LastPrinted" : ; case " Ve
( 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 _cell ( val . val , 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 "Dimensions" : { if ( file _depth === 1 ) range = val } break ; case "SST" : { sst = val } break ; case "Format" : { SSF . load ( val [ 1 ] , val [ 0 ] ) } break ; case "BIFF2FORMAT" : { BIFF2FmtTable [ BIFF2Fmt ++ ] = val ; for ( var b2idx = 0 ; b2idx < BIFF2Fmt + 163 ; ++ b2idx ) if ( SSF . _table [ b2idx ] == val ) break ; if ( b2idx >= 163 ) SSF . load ( val , BIFF2Fmt + 163 ) } break ; case "MergeCells" : mergecells = mergecells . concat ( val ) ; break ; case "Obj" : objects [ val . cmo [ 0 ] ] = opts . lastobj = val ; break ; case "TxO" : opts . lastobj . TxO = val ; break ; case "ImData" : opts . lastobj . ImData = val ; break ; case "HLink" : { for ( rngR = val [ 0 ] . s . r ; rngR <= val [ 0 ] . e . r ; ++ rngR ) for ( rngC = val [ 0 ] . s . c ; rngC <= val [ 0 ] . e . c ; ++ rngC ) { cc = options . dense ? ( out [ rngR ] || [ ] ) [ rngC ] : out [ encode _cell ( { c : rngC , r : rngR } ) ] ; if ( cc ) cc . l = val [ 1 ] } } break ; case "HLinkTooltip" : { for ( rngR = val [ 0 ] . s . r ; rngR <= val [ 0 ] . e . r ; ++ rngR ) for ( rngC = val [ 0 ] . s . c ; rngC <= val [ 0 ] . e . c ; ++ rngC ) { cc = options . dense ? ( out [ rngR ] || [ ] ) [ rngC ] : out [ encode _cell ( { c : rngC , r : rngR } ) ] ; if ( cc ) cc . l . Tooltip = val [ 1 ] } } break ; case "Note" : { if ( opts . biff <= 5 && opts . biff >= 2 ) break ; cc = options . dense ? ( out [ val [ 0 ] . r ] || [ ] ) [ val [ 0 ] . c ] : out [ encode _cell ( val [ 0 ] ) ] ; var noteobj = objects [ val [ 2 ] ] ; if ( ! cc ) break ; if ( ! cc . c ) cc . c = [ ] ; cmnt = { a : val [ 1 ] , t : noteobj . TxO . t } ; cc . c . push ( cmnt ) } break ; default : switch ( R . n ) { case "ClrtClient" : break ; case "XFExt" : update _xfext ( XFs [ val . ixfe ] , val . ext ) ; break ; case "DefColWidth" : defwidth = val ; break ; case "DefaultRowHeight" : defheight = val [ 1 ] ; break ; case "ColInfo" : { if ( ! opts . cellStyles ) break ; while ( val . e >= val . s ) { colinfo [ val . e -- ] = { width : val . w / 256 } ; if ( ! seencol ) { seencol = true ; find _mdw _colw ( val . w / 256 ) } process _col ( colinfo [ val . e + 1 ] ) } } break ; case "Row" : { var rowobj = { } ; if ( val . hidden ) { rowinfo [ val . r ] = rowobj ; rowobj . hidden = true } if ( val . hpt ) { rowinfo [ val . r ] = rowobj ; rowobj . hpt = val . hpt ; rowobj . hpx = pt2px ( val . hpt ) } } break ; case "LeftMargin" : ; case "RightMargin" : ; case "TopMargin" : ; case "BottomMargin" : if ( ! out [ "!margins" ] ) default _margins ( out [ "!margins" ] = { } ) ; out [ "!margins" ] [ Rn . slice ( 0 , - 6 ) . toLowerCase ( ) ] = val ; break ; case "Setup" : if ( ! out [ "!margins" ] ) default _margins ( out [ "!margins" ] = { } ) ; out [ "!margins" ] . header = val . header ; out [ "!margins" ] . footer = val . footer ; break ; case "Header" : break ; case "Footer" : break ; case "HCenter" : break ; case "VCenter" : break ; case "Pls" : break ; case "GCW" : break ; case "LHRecord" : break ; case "DBCell" : break ; case "EntExU2" : break ; case "SxView" : break ; case "Sxvd" : break ; case "SXVI" : break ; case "SXVDEx" : break ; case "SxIvd" : break ; case "SXDI" : break ; case "SXLI" : break ; case "SXEx" : break ; case "QsiSXTag" : break ; case "Selection" : break ; case "Feat" : break ; case "FeatHdr" : ; case "FeatHdr11" : break ; case "Feature11" : ; case "Feature12" : ; case "List12" : break ; case "Country" : country = val ; break ; case "RecalcId" : break ; case "DxGCol" : break ; case "Fbi" : ; case "Fbi2" : ; case "GelFrame" : break ; case "Font" : break ; case "XFCRC" : break ; case "Style" : break ; case "StyleExt" : break ; case "Palette" : palette = val ; break ; case "Theme" : break ; case "ScenarioProtect" : break ; case "ObjProtect" : break ; case "CondFmt12" : break ; case "Table" : break ; case "TableStyles" : break ; case "TableStyle" : break ; case "TableStyleElement" : break ; case "SXStreamID" : break ; case "SXVS" : break ; case "DConRef" : break ; case "SXAddl" : break ; case " DConBi
} , 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 : parsenoop } , 1036 : { n : "BrtNameExt" , f : parsenoop } , 1037 : { n : "BrtPCDH14" , f : parsenoop } , 1038 : { n : "BrtBeginPCDCalcMem14" , f : parsenoop } , 1039 : { n : "BrtEndPCDCalcMem14" , f : parsenoop } , 1040 : { n : "BrtSXTH14" , f : parsenoop } , 1041 : { n : "BrtBeginSparklineGroup" , f : parsenoop } , 1042 : { n : "BrtEndSparklineGroup" , f : parsenoop } , 1043 : { n : "BrtSparkline" , f : parsenoop } , 1044 : { n : "BrtSXDI14" , f : parsenoop } , 1045 : { n : "BrtWsFmtInfoEx14" , f : parsenoop } , 1046 : { n : "BrtBeginConditionalFormatting14" , f : parsenoop } , 1047 : { n : "BrtEndConditionalFormatting14" , f : parsenoop } , 1048 : { n : "BrtBeginCFRule14" , f : parsenoop } , 1049 : { n : "BrtEndCFRule14" , f : parsenoop } , 1050 : { n : "BrtCFVO14" , f : parsenoop } , 1051 : { n : "BrtBeginDatabar14" , f : parsenoop } , 1052 : { n : "BrtBeginIconSet14" , f : parsenoop } , 1053 : { n : "BrtDVal14" , f : parsenoop } , 1054 : { n : "BrtBeginDVals14" , f : parsenoop } , 1055 : { n : "BrtColor14" , f : parsenoop } , 1056 : { n : "BrtBeginSparklines" , f : parsenoop } , 1057 : { n : "BrtEndSparklines" , f : parsenoop } , 1058 : { n : "BrtBeginSparklineGroups" , f : parsenoop } , 1059 : { n : "BrtEndSparklineGroups" , f : parsenoop } , 1061 : { n : "BrtSXVD14" , f : parsenoop } , 1062 : { n : "BrtBeginSxview14" , f : parsenoop } , 1063 : { n : "BrtEndSxview14" , f : parsenoop } , 1066 : { n : "BrtBeginPCD14" , f : parsenoop } , 1067 : { n : "BrtEndPCD14" , f : parsenoop } , 1068 : { n : "BrtBeginExtConn14" , f : parsenoop } , 1069 : { n : "BrtEndExtConn14" , f : parsenoop } , 1070 : { n : "BrtBeginSlicerCacheIDs" , f : parsenoop } , 1071 : { n : "BrtEndSlicerCacheIDs" , f : parsenoop } , 1072 : { n : "BrtBeginSlicerCacheID" , f : parsenoop } , 1073 : { n : "BrtEndSlicerCacheID" , f : parsenoop } , 1075 : { n : "BrtBeginSlicerCache" , f : parsenoop } , 1076 : { n : "BrtEndSlicerCache" , f : parsenoop } , 1077 : { n : "BrtBeginSlicerCacheDef" , f : parsenoop } , 1078 : { n : "BrtEndSlicerCacheDef" , f : parsenoop } , 1079 : { n : "BrtBeginSlicersEx" , f : parsenoop } , 1080 : { n : "BrtEndSlicersEx" , f : parsenoop } , 1081 : { n : "BrtBeginSlicerEx" , f : parsenoop } , 1082 : { n : "BrtEndSlicerEx" , f : parsenoop } , 1083 : { n : "BrtBeginSlicer" , f : parsenoop } , 1084 : { n : "BrtEndSlicer" , f : parsenoop } , 1085 : { n : "BrtSlicerCachePivotTables" , f : parsenoop } , 1086 : { n : "BrtBeginSlicerCacheOlapImpl" , f : parsenoop } , 1087 : { n : "BrtEndSlicerCacheOlapImpl" , f : parsenoop } , 1088 : { n : "BrtBeginSlicerCacheLevelsData" , f : parsenoop } , 1089 : { n : "BrtEndSlicerCacheLevelsData" , f : parsenoop } , 1090 : { n : "BrtBeginSlicerCacheLevelData" , f : parsenoop } , 1091 : { n : "BrtEndSlicerCacheLevelData" , f : parsenoop } , 1092 : { n : "BrtBeginSlicerCacheSiRanges" , f : parsenoop } , 1093 : { n : "BrtEndSlicerCacheSiRanges" , f : parsenoop } , 1094 : { n : "BrtBeginSlicerCacheSiRange" , f : parsenoop } , 1095 : { n : "BrtEndSlicerCacheSiRange" , f : parsenoop } , 1096 : { n : "BrtSlicerCacheOlapItem" , f : parsenoop } , 1097 : { n : "BrtBeginSlicerCacheSelections" , f : parsenoop } , 1098 : { n : "BrtSlicerCacheSelection" , f : parsenoop } , 1099 : { n : "BrtEndSlicerCacheSelections" , f : parsenoop } , 1100 : { n : "BrtBeginSlicerCacheNative" , f : parsenoop } , 1101 : { n : "BrtEndSlicerCacheNative" , f : parsenoop } , 1102 : { n : "BrtSlicerCacheNativeItem" , f : parsenoop } , 1103 : { n : "BrtRangeProtection14" , f : parsenoop } , 1104 : { n : "BrtRangeProtectionIso14" , f : parsenoop } , 1105 : { n : "BrtCellIgnoreEC14" , f : parsenoop } , 1111 : { n : "BrtList14" , f : parsenoop } , 1112 : { n : "BrtCFIcon" , f : parsenoop } , 1113 : { n : "BrtBeginSlicerCachesPivotCacheIDs" , f : parsenoop } , 1114 : { n : "BrtEndSlicerCachesPivotCacheIDs" , f : parsenoop } , 1115 : { n : "BrtBeginSlicers" , f : parsenoop } , 1116 : { n : "BrtEndSlicers" , f : parsenoop } , 1117 : { n : "BrtWbProp14" , f : parsenoop } , 1118 : { n : "BrtBeginSXEdit" , f : parsenoop } , 1119 : { n : "BrtEndSXEdit" , f : parsenoop } , 1120 : { n : "BrtBeginSXEdits" , f : parsenoop } , 1121 : { n : "BrtEndSXEdits" , f : parsenoop } , 1122 : { n : "BrtBeginSXChange" , f : parsenoop } , 1123 : { n : "BrtEndSXChange" , f : parsenoop } , 1124 : { n : "BrtBeginSXChanges" , f : parsenoop } , 1125 : { n : "BrtEndSXChanges" , f : parsenoop } , 1126 : { n : " B
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 = range . e . c = 0 ; ws = opts . dense ? [ ] : { } ; merges = [ ] } break ; case "table-row" : ; case "行" : if ( Rn [ 1 ] === "/" ) break ; rowtag = parsexmltag ( Rn [ 0 ] , false ) ; if ( rowtag [ "行号" ] ) R = rowtag [ "行号" ] - 1 ; else ++ R ; C = - 1 ; break ; case "covered-table-cell" : ++ C ; if ( opts . sheetStubs ) { if ( opts . dense ) { if ( ! ws [ R ] ) ws [ R ] = [ ] ; ws [ R ] [ C ] = { t : "z" } } else ws [ encode _cell ( { r : R , c : C } ) ] = { t : "z" } } break ; case "table-cell" : ; case "数据" : if ( Rn [ 0 ] . charAt ( Rn [ 0 ] . length - 2 ) === "/" ) { ctag = parsexmltag ( Rn [ 0 ] , false ) ; if ( ctag [ "number-columns-repeated" ] ) C += parseInt ( ctag [ "number-columns-repeated" ] , 10 ) ; else ++ C } else if ( Rn [ 1 ] !== "/" ) { ++ C ; rept = 1 ; if ( C > range . e . c ) range . e . c = C ; if ( R > range . e . r ) range . e . r = R ; if ( C < range . s . c ) range . s . c = C ; if ( R < range . s . r ) range . s . r = R ; ctag = parsexmltag ( Rn [ 0 ] , false ) ; comments = [ ] ; comment = { } ; q = { t : ctag [ "数据类型" ] || ctag [ "value-type" ] , v : null } ; if ( opts . cellFormula ) { if ( ctag . formula ) ctag . formula = unescapexml ( ctag . formula ) ; if ( ctag [ "number-matrix-columns-spanned" ] && ctag [ "number-matrix-rows-spanned" ] ) { mR = parseInt ( ctag [ "number-matrix-rows-spanned" ] , 10 ) || 0 ; mC = parseInt ( ctag [ "number-matrix-columns-spanned" ] , 10 ) || 0 ; mrange = { s : { r : R , c : C } , e : { r : R + mR - 1 , c : C + mC - 1 } } ; q . F = encode _range ( mrange ) ; arrayf . push ( [ mrange , q . F ] ) } if ( ctag . formula ) q . f = ods _to _csf _formula ( ctag . formula ) ; else for ( i = 0 ; i < arrayf . length ; ++ i ) if ( R >= arrayf [ i ] [ 0 ] . s . r && R <= arrayf [ i ] [ 0 ] . e . r ) if ( C >= arrayf [ i ] [ 0 ] . s . c && C <= arrayf [ i ] [ 0 ] . e . c ) q . F = arrayf [ i ] [ 1 ] } if ( ctag [ "number-columns-spanned" ] || ctag [ "number-rows-spanned" ] ) { mR = parseInt ( ctag [ "number-rows-spanned" ] , 10 ) || 0 ; mC = parseInt ( ctag [ "number-columns-spanned" ] , 10 ) || 0 ; mrange = { s : { r : R , c : C } , e : { r : R + mR - 1 , c : C + mC - 1 } } ; merges . push ( mrange ) } if ( ctag [ "number-columns-repeated" ] ) rept = parseInt ( ctag [ "number-columns-repeated" ] , 10 ) ; switch ( q . t ) { case "boolean" : q . t = "b" ; q . v = parsexmlbool ( ctag [ "boolean-value" ] ) ; break ; case "float" : q . t = "n" ; q . v = parseFloat ( ctag . value ) ; break ; case "percentage" : q . t = "n" ; q . v = parseFloat ( ctag . value ) ; break ; case "currency" : q . t = "n" ; q . v = parseFloat ( ctag . value ) ; break ; case "date" : q . t = "d" ; q . v = parseDate ( ctag [ "date-value" ] ) ; if ( ! opts . cellDates ) { q . t = "n" ; q . v = datenum ( q . v ) } q . z = "m/d/yy" ; break ; case "time" : q . t = "n" ; q . v = parse _isodur ( ctag [ "time-value" ] ) / 86400 ; break ; case "number" : q . t = "n" ; q . v = parseFloat ( ctag [ "数据数值" ] ) ; break ; default : if ( q . t === "string" || q . t === "text" || ! q . t ) { q . t = "s" ; if ( ctag [ "string-value" ] != null ) textp = unescapexml ( ctag [ "string-value" ] ) } else throw new Error ( "Unsupported value type " + q . t ) ; } } else { isstub = false ; if ( q . t === "s" ) { q . v = textp || "" ; isstub = textpidx == 0 } if ( comments . length > 0 ) { q . c = comments ; comments = [ ] } if ( textp && opts . cellText !== false ) q . w = textp ; if ( ! isstub || opts . sheetStubs ) { if ( ! ( opts . sheetRows && opts . sheetRows < R ) ) { if ( opts . dense ) { if ( ! ws [ R ] ) ws [ R ] = [ ] ; ws [ R ] [ C ] = q ; while ( -- rept > 0 ) ws [ R ] [ ++ C ] = dup ( q ) } else { ws [ encode _cell ( { r : R , c : C } ) ] = q ; while ( -- rept > 0 ) ws [ encode _cell ( { r : R , c : ++ C } ) ] = dup ( q ) } if ( range . e . c <= C ) range . e . c = C } } else { C += rept ; rept = 0 } q = { } ; textp = "" } break ; case "document" : ; case "document-content" : ; case "电子表格文档" : ; case "spreadsheet" : ; case "主体" : ; case "scripts" : ; case "styles" : ; case "font-face-decls" : if ( Rn [ 1 ] === "/" ) { if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw "Bad state: " + tmp } else if ( Rn [ 0 ] . charAt ( Rn [ 0 ] . length - 2 ) !== "/" ) state . push ( [ Rn [ 3 ] , true ] ) ; break ; case "annotation" : if ( Rn [ 1 ] === "/" ) { if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw "Bad state: " + tmp ; comment . t = textp ; comment . a = creator ; comments . push ( comment ) } else if ( Rn [ 0 ] . charAt ( Rn [ 0 ] . length - 2 ) !== "/" ) { state . push ( [ Rn [ 3 ] , false ] ) } creator = "" ; creatoridx = 0 ; textp = "" ; textpidx = 0 ; break ; case "creator" : if ( Rn [ 1 ] === "/" ) { creator = str . slice ( creatoridx , Rn . index ) } else creatoridx = Rn . index + Rn [ 0 ] . length ; break ; case "meta" : ; case "元数据" : ; case "settings" : ; case "config-item-set" : ; case " config - item - map - in
; case ".ods" : o . bookType = "ods" ; break ; case ".csv" : o . bookType = "csv" ; break ; case ".txt" : o . bookType = "txt" ; break ; case ".dif" : o . bookType = "dif" ; break ; case ".prn" : o . bookType = "prn" ; break ; case ".slk" : o . bookType = "sylk" ; break ; case ".htm" : o . bookType = "html" ; break ; } } function writeFileSync ( wb , filename , opts ) { var o = opts || { } ; o . type = "file" ; o . file = filename ; resolve _book _type ( o ) ; return writeSync ( wb , o ) } function writeFileAsync ( filename , wb , opts , cb ) { var o = opts || { } ; o . type = "file" ; o . file = filename ; resolve _book _type ( o ) ; o . type = "buffer" ; var _cb = cb ; if ( ! ( _cb instanceof Function ) ) _cb = opts ; return _fs . writeFile ( filename , writeSync ( wb , o ) , _cb ) } function sheet _to _json ( sheet , opts ) { if ( sheet == null || sheet [ "!ref" ] == null ) return [ ] ; var val = { t : "n" , v : 0 } , header = 0 , offset = 1 , hdr = [ ] , isempty = true , v = 0 , vv = "" ; var r = { s : { r : 0 , c : 0 } , e : { r : 0 , c : 0 } } ; var o = opts != null ? opts : { } ; var raw = o . raw ; var defval = o . defval ; var range = o . range != null ? o . range : sheet [ "!ref" ] ; if ( o . header === 1 ) header = 1 ; else if ( o . header === "A" ) header = 2 ; else if ( Array . isArray ( o . header ) ) header = 3 ; switch ( typeof range ) { case "string" : r = safe _decode _range ( range ) ; break ; case "number" : r = safe _decode _range ( sheet [ "!ref" ] ) ; r . s . r = range ; break ; default : r = range ; } if ( header > 0 ) offset = 0 ; var rr = encode _row ( r . s . r ) ; var cols = new Array ( r . e . c - r . s . c + 1 ) ; var out = new Array ( r . e . r - r . s . r - offset + 1 ) ; var outi = 0 , counter = 0 ; var dense = Array . isArray ( sheet ) ; var R = r . s . r , C = 0 , CC = 0 ; if ( dense && ! sheet [ R ] ) sheet [ R ] = [ ] ; for ( C = r . s . c ; C <= r . e . c ; ++ C ) { cols [ C ] = encode _col ( C ) ; val = dense ? sheet [ R ] [ C ] : sheet [ cols [ C ] + rr ] ; switch ( header ) { case 1 : hdr [ C ] = C - r . s . c ; break ; case 2 : hdr [ C ] = cols [ C ] ; break ; case 3 : hdr [ C ] = o . header [ C - r . s . c ] ; break ; default : if ( val == null ) continue ; vv = v = format _cell ( val , null , o ) ; counter = 0 ; for ( CC = 0 ; CC < hdr . length ; ++ CC ) if ( hdr [ CC ] == vv ) vv = v + "_" + ++ counter ; hdr [ C ] = vv ; } } var row = header === 1 ? [ ] : { } ; for ( R = r . s . r + offset ; R <= r . e . r ; ++ R ) { rr = encode _row ( R ) ; isempty = true ; if ( header === 1 ) row = [ ] ; else { row = { } ; if ( Object . defineProperty ) try { Object . defineProperty ( row , "__rowNum__" , { value : R , enumerable : false } ) } catch ( e ) { row . _ _rowNum _ _ = R } else row . _ _rowNum _ _ = R } if ( ! dense || sheet [ R ] ) for ( C = r . s . c ; C <= r . e . c ; ++ C ) { val = dense ? sheet [ R ] [ C ] : sheet [ cols [ C ] + rr ] ; if ( val === undefined || val . t === undefined ) { if ( defval === undefined ) continue ; if ( hdr [ C ] != null ) { row [ hdr [ C ] ] = defval ; isempty = false } continue } v = val . v ; switch ( val . t ) { case "z" : if ( v == null ) break ; continue ; case "e" : continue ; case "s" : ; case "d" : ; case "b" : ; case "n" : break ; default : throw new Error ( "unrecognized type " + val . t ) ; } if ( hdr [ C ] != null ) { if ( v == null ) { if ( defval !== undefined ) row [ hdr [ C ] ] = defval ; else if ( raw && v === null ) row [ hdr [ C ] ] = null ; else continue } else { row [ hdr [ C ] ] = raw ? v : format _cell ( val , v , o ) } isempty = false } } if ( isempty === false || ( header === 1 ? o . blankrows !== false : ! ! o . blankrows ) ) out [ outi ++ ] = row } out . length = outi ; return out } var qreg = /"/g ; function make _csv _row ( sheet , r , R , cols , fs , rs , FS , o ) { var isempty = true ; var row = "" , txt = "" , rr = encode _row ( R ) ; for ( var C = r . s . c ; C <= r . e . c ; ++ C ) { var val = o . dense ? ( sheet [ R ] || [ ] ) [ C ] : sheet [ cols [ C ] + rr ] ; if ( val == null ) txt = "" ; else if ( val . v != null ) { isempty = false ; txt = "" + format _cell ( val , null , o ) ; for ( var i = 0 , cc = 0 ; i !== txt . length ; ++ i ) if ( ( cc = txt . charCodeAt ( i ) ) === fs || cc === rs || cc === 34 ) { txt = '"' + txt . replace ( qreg , '""' ) + '"' ; break } if ( txt == "ID" ) txt = '"ID"' } else if ( val . f != null && ! val . F ) { isempty = false ; txt = "=" + val . f ; if ( txt . indexOf ( "," ) >= 0 ) txt = '"' + txt . replace ( qreg , '""' ) + '"' } else txt = "" ; row += ( C === r . s . c ? "" : FS ) + txt } if ( o . blankrows === false && isempty ) return null ; return row } function sheet _to _csv ( sheet , opts ) { var out = [ ] ; var o = opts == null ? { } : opts ; if ( sheet == null || sheet [ "!ref" ] == null ) return "" ; var r = safe _decode _range ( sheet [ "!ref" ] ) ; var FS = o . FS !== undefined ? o . FS : "," , fs = FS . charCodeAt ( 0 ) ; var RS = o . RS !== undefined ? o . RS : "\n" , rs = RS . charCodeAt ( 0 ) ; var endregex = new RegExp ( ( FS == "|" ? "\\|" : FS ) + "+$" ) ; var row = "" , cols = [ ] ; o . dense = Array . isArray ( sheet ) ; for ( var C = r . s . c ; C <= r . e . c ; ++ C ) cols [ C ] = encode _col ( C ) ; for ( var R = r . s . r ; R <= r . e . r ; ++ R ) { row = make _csv _row ( sheet , r , R , cols , fs , rs , FS , o ) ; if ( row == null ) { continue } if ( o . strip ) row = row . replace ( endregex , "" ) ; out . push ( row + RS ) } delete o . dense ; return out . join ( "" ) } function sheet _to _txt ( sheet , opts ) { if ( ! opts ) opts = { } ; opts . FS = "\t" ; opts . RS = "\n" ; var s = sheet _to _csv ( sheet , opts ) ; if ( typeof cptable == "undefined" ) return s ; var o = cptable . utils . encode ( 1200 , s ) ; return "ÿþ" + o } function sheet _to