2015-04-02 20:32:22 +00:00
/* xlsx.js (C) 2013-2015 SheetJS -- http://sheetjs.com */
2016-10-11 13:11:45 +00:00
! function ( e ) { if ( "object" == typeof exports && "undefined" != typeof module ) module . exports = e ( ) ; else if ( "function" == typeof define && define . amd ) define ( [ ] , e ) ; else { var f ; "undefined" != typeof window ? f = window : "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 , 225274430 , 2053790376 , 3826175755 , 2466906013 , 167816743 , 20
} ; 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 _DIRECTORY _LO
2015-12-05 21:45:13 +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-04-03 02:53:03 +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
} fmt = fmt . replace ( /^#+([0.])/ , "$1" ) ; if ( ( r = fmt . match ( /^(0*)\.(#*)$/ ) ) !== null ) { return sign + ( "" + aval ) . replace ( /\.(\d*[1-9])0*$/ , ".$1" ) . replace ( /^(-?\d*)$/ , "$1." ) . replace ( /^0\./ , r [ 1 ] . length ? "0." : "." ) } if ( ( r = fmt . match ( /^#,##0(\.?)$/ ) ) !== null ) return sign + commaify ( "" + aval ) ; if ( ( r = fmt . match ( /^#,##0\.([#0]*0)$/ ) ) !== null ) { return val < 0 ? "-" + write _num _int ( type , fmt , - val ) : commaify ( "" + val ) + "." + fill ( "0" , r [ 1 ] . length ) } if ( ( r = fmt . match ( /^#,#*,#0/ ) ) !== null ) return write _num _int ( type , fmt . replace ( /^#,#*,/ , "" ) , val ) ; if ( ( r = fmt . match ( /^([0#]+)(\\?-([0#]+))+$/ ) ) !== null ) { 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 [ ri ++ ] : x === "0" ? "0" : "" } ) ) } if ( fmt . match ( phone ) !== null ) { 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?]+)/ ) ) !== null ) { 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 [ 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?]+)/ ) ) !== null ) { 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?]+$/ ) ) !== null ) { 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]+)$/ ) ) !== null ) { 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)$/ ) ) !== null ) { 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 "#,###" : var x = commaify ( "" + aval ) ; return x !== "0" ? sign + x : "" ; default : } throw new Error ( "unsupported format |" + fmt + "|" ) } return function write _num ( type , fmt , val ) { return ( val | 0 ) === val ? write _num _int ( type , fmt , val ) : write _num _flt ( type , fmt , val ) } } ( ) ; function split _fmt ( fmt ) { var out = [ ] ; var in _str = false , cc ; for ( var i = 0 , j = 0 ; i < fmt . length ; ++ i ) switch ( cc = fmt . charCodeAt ( i ) ) { case 34 : in _str = ! in _str ; break ; case 95 : case 42 : case 92 : ++ i ; break ; case 59 : out [ out . length ] = fmt . substr ( j , i - j ) ; j = i + 1 } out [ out . length ] = fmt . substr ( j ) ; if ( in _str === true ) throw new Error ( "Format |" + fmt + "| unterminated string " ) ; return out } SSF . _split = split _fmt ; var abstime = /\[[HhMmSs]*\]/ ; function eval _fmt ( fmt , v , opts , flen ) { var out = [ ] , o = "" , i = 0 , c = "" , lst = "t" , q , dt , j , cc ; var hr = "H" ; while ( i < fmt . length ) { switch ( c = fmt [ i ] ) { case "G" : if ( ! isgeneral ( fmt , i ) ) throw new Error ( "unrecognized character " + c + " in " + fmt ) ; out [ out . length ] = { t : "G" , v : "General" } ; i += 7 ; break ; case '"' : for ( o = "" ; ( cc = fmt . charCodeAt ( ++ i ) ) !== 34 && i < fmt . length ; ) o += String . fromCharCode ( cc ) ; out [ out . length ] = { t : "t" , v : o } ; ++ i ; break ; case "\\" : var w = fmt [ ++ i ] , t = w === "(" || w === ")" ? w : "t" ; out [ out . length ] = { t : t , v : w } ; ++ i ; break ; case "_" : out [ out . length ] = { t : "t" , v : " " } ; i += 2 ; break ; case "@" : out [ out . length ] = { t : "T" , v : v } ; ++ i ; break ; case "B" : case "b" : if ( fmt [ i + 1 ] === "1" || fmt [ i + 1 ] === "2" ) { if ( dt == null ) { dt = parse _date _code ( v , opts , fmt [ i + 1 ] === "2" ) ; if ( dt == null ) return "" } out [ out . length ] = { t : "X" , v : fmt . substr ( i , 2 ) } ; lst = c ; i += 2 ; break } case "M" : case "D" : case "Y" : case "H" : case "S" : case "E" : c = c . toLowerCase ( ) ; case "m" : case "d" : case "y" : case "h" : case "s" : case "e" : case "g" : if ( v < 0 ) return "" ; if ( dt == null ) { dt = parse _date _code ( v , opts ) ; if ( dt == null ) return "" } o = c ; while ( ++ i < fmt . length && fmt [ i ] . toLowerCase ( ) === c ) o += c ; if ( c === "m" && lst . toLowerCase ( ) === "h" ) c = "M" ; if ( c === "h" ) c = hr ; out [ out . length ] = { t : c , v : o } ; lst = c ; break ; case "A" : q = { t : c , v : "A" } ; if ( dt == null ) dt = parse _date _code ( v , opts ) ; if ( fmt . substr ( i , 3 ) === "A/P" ) { if ( dt != null ) q . v = dt . H >= 12 ? "P" : "A" ; q . t = "T" ; hr = "h" ; i += 3 } else if ( fmt . substr ( i , 5 ) === "AM/PM" ) { if ( dt != null ) q . v = dt . H >= 12 ? "PM" : "AM" ; q . t = "T" ; i += 5 ; hr = "h" } else
} else switch ( t ) { case 1 : size = 1 ; this [ this . l ] = val & 255 ; break ; case 3 : size = 3 ; this [ this . l + 2 ] = val & 255 ; val >>>= 8 ; this [ this . l + 1 ] = val & 255 ; val >>>= 8 ; this [ this . l ] = val & 255 ; break ; case 4 : size = 4 ; this . writeUInt32LE ( val , this . l ) ; break ; case 8 : size = 8 ; if ( f === "f" ) { this . writeDoubleLE ( val , this . l ) ; break } case 16 : break ; case - 4 : size = 4 ; this . writeInt32LE ( val , this . l ) ; break } this . l += size ; return this } function CheckField ( hexstr , fld ) { var m = _ _hexlify ( this , this . l , hexstr . length >> 1 ) ; if ( m !== hexstr ) throw fld + "Expected " + hexstr + " saw " + m ; this . l += hexstr . length >> 1 } function prep _blob ( blob , pos ) { blob . l = pos ; blob . read _shift = ReadShift ; blob . chk = CheckField ; blob . write _shift = WriteShift } function parsenoop ( blob , length ) { blob . l += length } function writenoop ( blob , length ) { blob . l += length } function new _buf ( sz ) { var o = new _raw _buf ( sz ) ; prep _blob ( o , 0 ) ; return o } function recordhopper ( data , cb , opts ) { var tmpbyte , cntbyte , length ; prep _blob ( data , data . l || 0 ) ; while ( data . l < data . length ) { var RT = data . read _shift ( 1 ) ; if ( RT & 128 ) RT = ( RT & 127 ) + ( ( data . read _shift ( 1 ) & 127 ) << 7 ) ; var R = XLSBRecordEnum [ RT ] || XLSBRecordEnum [ 65535 ] ; tmpbyte = data . read _shift ( 1 ) ; length = tmpbyte & 127 ; for ( cntbyte = 1 ; cntbyte < 4 && tmpbyte & 128 ; ++ cntbyte ) length += ( ( tmpbyte = data . read _shift ( 1 ) ) & 127 ) << 7 * cntbyte ; var d = R . f ( data , length , opts ) ; if ( cb ( d , R , RT ) ) return } } function buf _array ( ) { var bufs = [ ] , blksz = 2048 ; var newblk = function ba _newblk ( sz ) { var o = new _buf ( sz ) ; prep _blob ( o , 0 ) ; return o } ; var curbuf = newblk ( blksz ) ; var endbuf = function ba _endbuf ( ) { curbuf . length = curbuf . l ; if ( curbuf . length > 0 ) bufs . push ( curbuf ) ; curbuf = null } ; var next = function ba _next ( sz ) { if ( sz < curbuf . length - curbuf . l ) return curbuf ; endbuf ( ) ; return curbuf = newblk ( Math . max ( sz + 1 , blksz ) ) } ; var end = function ba _end ( ) { endbuf ( ) ; return _ _toBuffer ( [ bufs ] ) } ; var push = function ba _push ( buf ) { endbuf ( ) ; curbuf = buf ; next ( blksz ) } ; return { next : next , push : push , end : end , _bufs : bufs } } function write _record ( ba , type , payload , length ) { var t = evert _RE [ type ] , l ; if ( ! length ) length = XLSBRecordEnum [ t ] . p || ( payload || [ ] ) . length || 0 ; l = 1 + ( t >= 128 ? 1 : 0 ) + 1 + length ; if ( length >= 128 ) ++ l ; if ( length >= 16384 ) ++ l ; if ( length >= 2097152 ) ++ l ; var o = ba . next ( l ) ; if ( t <= 127 ) o . write _shift ( 1 , t ) ; else { o . write _shift ( 1 , ( t & 127 ) + 128 ) ; o . write _shift ( 1 , t >> 7 ) } for ( var i = 0 ; i != 4 ; ++ i ) { if ( length >= 128 ) { o . write _shift ( 1 , ( length & 127 ) + 128 ) ; length >>= 7 } else { o . write _shift ( 1 , length ) ; break } } if ( length > 0 && is _buf ( payload ) ) ba . push ( payload ) } function shift _cell _xls ( cell , tgt ) { if ( tgt . s ) { if ( cell . cRel ) cell . c += tgt . s . c ; if ( cell . rRel ) cell . r += tgt . s . r } else { cell . c += tgt . c ; cell . r += tgt . r } cell . cRel = cell . rRel = 0 ; while ( cell . c >= 256 ) cell . c -= 256 ; while ( cell . r >= 65536 ) cell . r -= 65536 ; return cell } function shift _range _xls ( cell , range ) { cell . s = shift _cell _xls ( cell . s , range . s ) ; cell . e = shift _cell _xls ( cell . e , range . s ) ; return cell } var OFFCRYPTO = { } ; var make _offcrypto = function ( O , _crypto ) { var crypto ; if ( typeof _crypto !== "undefined" ) crypto = _crypto ; else if ( typeof require !== "undefined" ) { try { crypto = require ( "cry" + "pto" ) } catch ( e ) { crypto = null } } O . rc4 = function ( key , data ) { var S = new Array ( 256 ) ; var c = 0 , i = 0 , j = 0 , t = 0 ; for ( i = 0 ; i != 256 ; ++ i ) S [ i ] = i ; for ( i = 0 ; i != 256 ; ++ i ) { j = j + S [ i ] + key [ i % key . length ] . charCodeAt ( 0 ) & 255 ; t = S [ i ] ; S [ i ] = S [ j ] ; S [ j ] = t } i = j = 0 ; out = Buffer ( data . length ) ; for ( c = 0 ; c != data . length ; ++ c ) { i = i + 1 & 255 ; j = ( j + S [ i ] ) % 256 ; t = S [ i ] ; S [ i ] = S [ j ] ; S [ j ] = t ; out [ c ] = data [ c ] ^ S [ S [ i ] + S [ j ] & 255 ] } return out } ; if ( crypto ) { O . md5 = function ( hex ) { return crypto . createHash ( "md5" ) . update ( hex ) . digest ( "hex" ) } } else { O . md5 = function ( hex ) { throw "unimplemented" } } } ; make _offcrypto ( OFFCRYPTO , typeof crypto !== "undefined" ? crypto : undefined ) ; function parse _StrRun ( data , length ) { return { ich : data . read _shift ( 2 ) , ifnt : data . read _shift ( 2 ) } } function parse _RichStr ( data , length ) { var start = data . l ; var flags = data . read _shift ( 1 ) ; var str = parse _XLWideString ( data ) ; var rgsStrRun = [ ] ; var z = { t : str , h : str } ; if ( ( flags & 1 ) !== 0 ) { var dwSizeStrRun = data . read _shift ( 4 ) ; for ( var i = 0 ; i != dwSizeStrRun ; ++ i ) rgsStrRun . push ( parse _StrRun ( data ) ) ; z . r = rgsStrRun } else z . r = "<t>" + escapexml ( str ) + "</t>" ; if ( ( flags & 2 ) !== 0 ) { } data . l = start + length ; return z } function write _RichStr ( str , o ) { if ( o == null ) o = new _buf ( 5 + 2 * str . t . length ) ; o . write _shift ( 1 , 0 ) ; write _XLWideString ( str . t , o ) ; return o } function parse _XLSBCell ( data ) { var col = data . read _shift ( 4 ) ; var iStyleRef = data . read _shift ( 2 ) ; iStyleRef += data . read _shift ( 1 ) << 16 ; var fP
return arr } function parslurp2 ( blob , length , cb ) { var arr = [ ] , target = blob . l + length , len = blob . read _shift ( 2 ) ; while ( len -- !== 0 ) arr . push ( cb ( blob , target - blob . l ) ) ; if ( target !== blob . l ) throw new Error ( "Slurp error" ) ; return arr } function parsebool ( blob , length ) { return blob . read _shift ( length ) === 1 } function parseuint16 ( blob ) { return blob . read _shift ( 2 , "u" ) } function parseuint16a ( blob , length ) { return parslurp ( blob , length , parseuint16 ) } var parse _Boolean = parsebool ; function parse _Bes ( blob ) { var v = blob . read _shift ( 1 ) , t = blob . read _shift ( 1 ) ; return t === 1 ? v : v === 1 } function parse _ShortXLUnicodeString ( blob , length , opts ) { var cch = blob . read _shift ( 1 ) ; var width = 1 , encoding = "sbcs-cont" ; var cp = current _codepage ; if ( opts && opts . biff >= 8 ) current _codepage = 1200 ; if ( opts === undefined || opts . biff !== 5 ) { var fHighByte = blob . read _shift ( 1 ) ; if ( fHighByte ) { width = 2 ; encoding = "dbcs-cont" } } var o = cch ? blob . read _shift ( cch , encoding ) : "" ; current _codepage = cp ; return o } function parse _XLUnicodeRichExtendedString ( blob ) { var cp = current _codepage ; current _codepage = 1200 ; var cch = blob . read _shift ( 2 ) , flags = blob . read _shift ( 1 ) ; var fHighByte = flags & 1 , fExtSt = flags & 4 , fRichSt = flags & 8 ; var width = 1 + ( flags & 1 ) ; var cRun , cbExtRst ; var z = { } ; if ( fRichSt ) cRun = blob . read _shift ( 2 ) ; if ( fExtSt ) cbExtRst = blob . read _shift ( 4 ) ; var encoding = flags & 1 ? "dbcs-cont" : "sbcs-cont" ; var msg = cch === 0 ? "" : blob . read _shift ( cch , encoding ) ; if ( fRichSt ) blob . l += 4 * cRun ; if ( fExtSt ) blob . l += cbExtRst ; z . t = msg ; if ( ! fRichSt ) { z . raw = "<t>" + z . t + "</t>" ; z . r = z . t } current _codepage = cp ; return z } function parse _XLUnicodeStringNoCch ( blob , cch , opts ) { var retval ; var fHighByte = blob . read _shift ( 1 ) ; if ( fHighByte === 0 ) { retval = blob . read _shift ( cch , "sbcs-cont" ) } else { retval = blob . read _shift ( cch , "dbcs-cont" ) } return retval } function parse _XLUnicodeString ( blob , length , opts ) { var cch = blob . read _shift ( opts !== undefined && opts . biff > 0 && opts . biff < 8 ? 1 : 2 ) ; if ( cch === 0 ) { blob . l ++ ; return "" } return parse _XLUnicodeStringNoCch ( blob , cch , opts ) } function parse _XLUnicodeString2 ( blob , length , opts ) { if ( opts . biff !== 5 && opts . biff !== 2 ) return parse _XLUnicodeString ( blob , length , opts ) ; var cch = blob . read _shift ( 1 ) ; if ( cch === 0 ) { blob . l ++ ; return "" } return blob . read _shift ( cch , "sbcs-cont" ) } var parse _ControlInfo = parsenoop ; var parse _URLMoniker = function ( blob , length ) { var len = blob . read _shift ( 4 ) , start = blob . l ; var extra = false ; if ( len > 24 ) { blob . l += len - 24 ; if ( blob . read _shift ( 16 ) === "795881f43b1d7f48af2c825dc4852763" ) extra = true ; blob . l = start } var url = blob . read _shift ( ( extra ? len - 24 : len ) >> 1 , "utf16le" ) . replace ( chr0 , "" ) ; if ( extra ) blob . l += 24 ; return url } ; var parse _FileMoniker = function ( blob , length ) { var cAnti = blob . read _shift ( 2 ) ; var ansiLength = blob . read _shift ( 4 ) ; var ansiPath = blob . read _shift ( ansiLength , "cstr" ) ; var endServer = blob . read _shift ( 2 ) ; var versionNumber = blob . read _shift ( 2 ) ; var cbUnicodePathSize = blob . read _shift ( 4 ) ; if ( cbUnicodePathSize === 0 ) return ansiPath . replace ( /\\/g , "/" ) ; var cbUnicodePathBytes = blob . read _shift ( 4 ) ; var usKeyValue = blob . read _shift ( 2 ) ; var unicodePath = blob . read _shift ( cbUnicodePathBytes >> 1 , "utf16le" ) . replace ( chr0 , "" ) ; return unicodePath } ; var parse _HyperlinkMoniker = function ( blob , length ) { var clsid = blob . read _shift ( 16 ) ; length -= 16 ; switch ( clsid ) { case "e0c9ea79f9bace118c8200aa004ba90b" : return parse _URLMoniker ( blob , length ) ; case "0303000000000000c000000000000046" : return parse _FileMoniker ( blob , length ) ; default : throw "unsupported moniker " + clsid } } ; var parse _HyperlinkString = function ( blob , length ) { var len = blob . read _shift ( 4 ) ; var o = blob . read _shift ( len , "utf16le" ) . replace ( chr0 , "" ) ; return o } ; var parse _Hyperlink = function ( blob , length ) { var end = blob . l + length ; var sVer = blob . read _shift ( 4 ) ; if ( sVer !== 2 ) throw new Error ( "Unrecognized streamVersion: " + sVer ) ; var flags = blob . read _shift ( 2 ) ; blob . l += 2 ; var displayName , targetFrameName , moniker , oleMoniker , location , guid , fileTime ; if ( flags & 16 ) displayName = parse _HyperlinkString ( blob , end - blob . l ) ; if ( flags & 128 ) targetFrameName = parse _HyperlinkString ( blob , end - blob . l ) ; if ( ( flags & 257 ) === 257 ) moniker = parse _HyperlinkString ( blob , end - blob . l ) ; if ( ( flags & 257 ) === 1 ) oleMoniker = parse _HyperlinkMoniker ( blob , end - blob . l ) ; if ( flags & 8 ) location = parse _HyperlinkString ( blob , end - blob . l ) ; if ( flags & 32 ) guid = blob . read _shift ( 16 ) ; if ( flags & 64 ) fileTime = parse _FILETIME ( blob , 8 ) ; blob . l = end ; var target = targetFrameName ||
2016-10-11 13:11:45 +00:00
var Ror = function ( Byte ) { return ( Byte / 2 | Byte * 128 ) & 255 } ; var XorRor = function ( byte1 , byte2 ) { return Ror ( byte1 ^ byte2 ) } ; var CreateXorKey _Method1 = function ( Password ) { var XorKey = InitialCode [ Password . length - 1 ] ; var CurrentElement = 104 ; for ( var i = Password . length - 1 ; i >= 0 ; -- i ) { var Char = Password [ i ] ; for ( var j = 0 ; j != 7 ; ++ j ) { if ( Char & 64 ) XorKey ^= XorMatrix [ CurrentElement ] ; Char *= 2 ; -- CurrentElement } } return XorKey } ; return function ( password ) { var Password = _JS2ANSI ( password ) ; var XorKey = CreateXorKey _Method1 ( Password ) ; var Index = Password . length ; var ObfuscationArray = new _raw _buf ( 16 ) ; for ( var i = 0 ; i != 16 ; ++ i ) ObfuscationArray [ i ] = 0 ; var Temp , PasswordLastChar , PadIndex ; if ( ( Index & 1 ) === 1 ) { Temp = XorKey >> 8 ; ObfuscationArray [ Index ] = XorRor ( PadArray [ 0 ] , Temp ) ; -- Index ; Temp = XorKey & 255 ; PasswordLastChar = Password [ Password . length - 1 ] ; ObfuscationArray [ Index ] = XorRor ( PasswordLastChar , Temp ) } while ( Index > 0 ) { -- Index ; Temp = XorKey >> 8 ; ObfuscationArray [ Index ] = XorRor ( Password [ Index ] , Temp ) ; -- Index ; Temp = XorKey & 255 ; ObfuscationArray [ Index ] = XorRor ( Password [ Index ] , Temp ) } Index = 15 ; PadIndex = 15 - Password . length ; while ( PadIndex > 0 ) { Temp = XorKey >> 8 ; ObfuscationArray [ Index ] = XorRor ( PadArray [ PadIndex ] , Temp ) ; -- Index ; -- PadIndex ; Temp = XorKey & 255 ; ObfuscationArray [ Index ] = XorRor ( Password [ Index ] , Temp ) ; -- Index ; -- PadIndex } return ObfuscationArray } } ( ) ; var crypto _DecryptData _Method1 = function ( password , Data , XorArrayIndex , XorArray , O ) { if ( ! O ) O = Data ; if ( ! XorArray ) XorArray = crypto _CreateXorArray _Method1 ( password ) ; var Index , Value ; for ( Index = 0 ; Index != Data . length ; ++ Index ) { Value = Data [ Index ] ; Value ^= XorArray [ XorArrayIndex ] ; Value = ( Value >> 5 | Value << 3 ) & 255 ; O [ Index ] = Value ; ++ XorArrayIndex } return [ O , XorArrayIndex , XorArray ] } ; var crypto _MakeXorDecryptor = function ( password ) { var XorArrayIndex = 0 , XorArray = crypto _CreateXorArray _Method1 ( password ) ; return function ( Data ) { var O = crypto _DecryptData _Method1 ( null , Data , XorArrayIndex , XorArray ) ; XorArrayIndex = O [ 1 ] ; return O [ 0 ] } } ; function parse _XORObfuscation ( blob , length , opts , out ) { var o = { key : parseuint16 ( blob ) , verificationBytes : parseuint16 ( blob ) } ; if ( opts . password ) o . verifier = crypto _CreatePasswordVerifier _Method1 ( opts . password ) ; out . valid = o . verificationBytes === o . verifier ; if ( out . valid ) out . insitu _decrypt = crypto _MakeXorDecryptor ( opts . password ) ; return o } function parse _FilePassHeader ( blob , length , oo ) { var o = oo || { } ; o . Info = blob . read _shift ( 2 ) ; blob . l -= 2 ; if ( o . Info === 1 ) o . Data = parse _RC4Header ( blob , length ) ; else o . Data = parse _RC4CryptoHeader ( blob , length ) ; return o } function parse _FilePass ( blob , length , opts ) { var o = { Type : blob . read _shift ( 2 ) } ; if ( o . Type ) parse _FilePassHeader ( blob , length - 2 , o ) ; else parse _XORObfuscation ( blob , length - 2 , opts , o ) ; return o } function hex2RGB ( h ) { var o = h . substr ( h [ 0 ] === "#" ? 1 : 0 , 6 ) ; return [ parseInt ( o . substr ( 0 , 2 ) , 16 ) , parseInt ( o . substr ( 2 , 2 ) , 16 ) , parseInt ( o . substr ( 4 , 2 ) , 16 ) ] } function rgb2Hex ( rgb ) { for ( var i = 0 , o = 1 ; i != 3 ; ++ i ) o = o * 256 + ( rgb [ i ] > 255 ? 255 : rgb [ i ] < 0 ? 0 : rgb [ i ] ) ; return o . toString ( 16 ) . toUpperCase ( ) . substr ( 1 ) } function rgb2HSL ( rgb ) { var R = rgb [ 0 ] / 255 , G = rgb [ 1 ] / 255 , B = rgb [ 2 ] / 255 ; var M = Math . max ( R , G , B ) , m = Math . min ( R , G , B ) , C = M - m ; if ( C === 0 ) return [ 0 , 0 , R ] ; var H6 = 0 , S = 0 , L2 = M + m ; S = C / ( L2 > 1 ? 2 - L2 : L2 ) ; switch ( M ) { case R : H6 = ( ( G - B ) / C + 6 ) % 6 ; break ; case G : H6 = ( B - R ) / C + 2 ; break ; case B : H6 = ( R - G ) / C + 4 ; break } return [ H6 / 6 , S , L2 / 2 ] } function hsl2RGB ( hsl ) { var H = hsl [ 0 ] , S = hsl [ 1 ] , L = hsl [ 2 ] ; var C = S * 2 * ( L < . 5 ? L : 1 - L ) , m = L - C / 2 ; var rgb = [ m , m , m ] , h6 = 6 * H ; var X ; if ( S !== 0 ) switch ( h6 | 0 ) { case 0 : case 6 : X = C * h6 ; rgb [ 0 ] += C ; rgb [ 1 ] += X ; break ; case 1 : X = C * ( 2 - h6 ) ; rgb [ 0 ] += X ; rgb [ 1 ] += C ; break ; case 2 : X = C * ( h6 - 2 ) ; rgb [ 1 ] += C ; rgb [ 2 ] += X ; break ; case 3 : X = C * ( 4 - h6 ) ; rgb [ 1 ] += X ; rgb [ 2 ] += C ; break ; case 4 : X = C * ( h6 - 4 ) ; rgb [ 2 ] += C ; rgb [ 0 ] += X ; break ; case 5 : X = C * ( 6 - h6 ) ; rgb [ 2 ] += X ; rgb [ 0 ] += C ; break } for ( var i = 0 ; i != 3 ; ++ i ) rgb [ i ] = Math . round ( rgb [ i ] * 255 ) ; return rgb } function rgb _tint ( hex , tint ) { if ( tint == 0 ) return hex ; var hsl = rgb2HSL ( hex2RGB ( hex ) ) ; if ( tint < 0 ) hsl [ 2 ] = hsl [ 2 ] * ( 1 + tint ) ; else hsl [ 2 ] = 1 - ( 1 - hsl [ 2 ] ) * ( 1 - tint ) ; var rev = rgb2Hex ( hsl2RGB ( hsl ) ) ; return rev } var DEF _MDW = 7 , MAX _MDW = 15 , MIN _MDW = 1 , MDW = DEF _MDW ; function width2px ( width ) { return ( width + ( 128 / MDW | 0 ) / 256 ) * MDW | 0 } function px2char ( px ) { return ( ( px - 5 ) / MDW * 100 + . 5 | 0 ) / 100 } function char2width ( chr ) { return ( ( chr * MDW + 5 ) / MDW * 256 | 0 ) / 256 } function cycle _width ( collw ) { return char2width ( px2char ( width2px ( collw ) ) ) } function find _mdw ( collw , coll ) { i
2015-12-05 21:45:13 +00:00
var cRel = ( cl & 32768 ) >> 15 , rRel = ( cl & 16384 ) >> 14 ; cl &= 16383 ; if ( cRel !== 0 ) while ( cl >= 256 ) cl -= 256 ; return { r : r , c : cl , cRel : cRel , rRel : rRel } } function parse _PtgArea ( blob , length ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; var area = parse _RgceArea ( blob , 8 ) ; return [ type , area ] } function parse _PtgArea3d ( blob , length ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; var ixti = blob . read _shift ( 2 ) ; var area = parse _RgceArea ( blob , 8 ) ; return [ type , ixti , area ] } function parse _PtgAreaErr ( blob , length ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; blob . l += 8 ; return [ type ] } function parse _PtgAreaErr3d ( blob , length ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; var ixti = blob . read _shift ( 2 ) ; blob . l += 8 ; return [ type , ixti ] } function parse _PtgAreaN ( blob , length ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; var area = parse _RgceAreaRel ( blob , 8 ) ; return [ type , area ] } function parse _PtgArray ( blob , length ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; blob . l += 7 ; return [ type ] } function parse _PtgAttrBaxcel ( blob , length ) { var bitSemi = blob [ blob . l + 1 ] & 1 ; var bitBaxcel = 1 ; blob . l += 4 ; return [ bitSemi , bitBaxcel ] } function parse _PtgAttrChoose ( blob , length ) { blob . l += 2 ; var offset = blob . read _shift ( 2 ) ; var o = [ ] ; for ( var i = 0 ; i <= offset ; ++ i ) o . push ( blob . read _shift ( 2 ) ) ; return o } function parse _PtgAttrGoto ( blob , length ) { var bitGoto = blob [ blob . l + 1 ] & 255 ? 1 : 0 ; blob . l += 2 ; return [ bitGoto , blob . read _shift ( 2 ) ] } function parse _PtgAttrIf ( blob , length ) { var bitIf = blob [ blob . l + 1 ] & 255 ? 1 : 0 ; blob . l += 2 ; return [ bitIf , blob . read _shift ( 2 ) ] } function parse _PtgAttrSemi ( blob , length ) { var bitSemi = blob [ blob . l + 1 ] & 255 ? 1 : 0 ; blob . l += 4 ; return [ bitSemi ] } function parse _PtgAttrSpaceType ( blob , length ) { var type = blob . read _shift ( 1 ) , cch = blob . read _shift ( 1 ) ; return [ type , cch ] } function parse _PtgAttrSpace ( blob , length ) { blob . read _shift ( 2 ) ; return parse _PtgAttrSpaceType ( blob , 2 ) } function parse _PtgAttrSpaceSemi ( blob , length ) { blob . read _shift ( 2 ) ; return parse _PtgAttrSpaceType ( blob , 2 ) } function parse _PtgRef ( blob , length ) { var ptg = blob [ blob . l ] & 31 ; var type = ( blob [ blob . l ] & 96 ) >> 5 ; blob . l += 1 ; var loc = parse _RgceLoc ( blob , 4 ) ; return [ type , loc ] } function parse _PtgRefN ( blob , length ) { var ptg = blob [ blob . l ] & 31 ; var type = ( blob [ blob . l ] & 96 ) >> 5 ; blob . l += 1 ; var loc = parse _RgceLocRel ( blob , 4 ) ; return [ type , loc ] } function parse _PtgRef3d ( blob , length ) { var ptg = blob [ blob . l ] & 31 ; var type = ( blob [ blob . l ] & 96 ) >> 5 ; blob . l += 1 ; var ixti = blob . read _shift ( 2 ) ; var loc = parse _RgceLoc ( blob , 4 ) ; return [ type , ixti , loc ] } function parse _PtgFunc ( blob , length ) { var ptg = blob [ blob . l ] & 31 ; var type = ( blob [ blob . l ] & 96 ) >> 5 ; blob . l += 1 ; var iftab = blob . read _shift ( 2 ) ; return [ FtabArgc [ iftab ] , Ftab [ iftab ] ] } function parse _PtgFuncVar ( blob , length ) { blob . l ++ ; var cparams = blob . read _shift ( 1 ) , tab = parsetab ( blob ) ; return [ cparams , ( tab [ 0 ] === 0 ? Ftab : Cetab ) [ tab [ 1 ] ] ] } function parsetab ( blob , length ) { return [ blob [ blob . l + 1 ] >> 7 , blob . read _shift ( 2 ) & 32767 ] } var parse _PtgAttrSum = parseread ( 4 ) ; var parse _PtgConcat = parseread1 ; function parse _PtgExp ( blob , length ) { blob . l ++ ; var row = blob . read _shift ( 2 ) ; var col = blob . read _shift ( 2 ) ; return [ row , col ] } function parse _PtgErr ( blob , length ) { blob . l ++ ; return BErr [ blob . read _shift ( 1 ) ] } function parse _PtgInt ( blob , length ) { blob . l ++ ; return blob . read _shift ( 2 ) } function parse _PtgBool ( blob , length ) { blob . l ++ ; return blob . read _shift ( 1 ) !== 0 } function parse _PtgNum ( blob , length ) { blob . l ++ ; return parse _Xnum ( blob , 8 ) } function parse _PtgStr ( blob , length ) { blob . l ++ ; return parse _ShortXLUnicodeString ( blob ) } function parse _SerAr ( blob ) { var val = [ ] ; switch ( val [ 0 ] = blob . read _shift ( 1 ) ) { case 4 : val [ 1 ] = parsebool ( blob , 1 ) ? "TRUE" : "FALSE" ; blob . l += 7 ; break ; case 16 : val [ 1 ] = BErr [ blob [ blob . l ] ] ; blob . l += 8 ; break ; case 0 : blob . l += 8 ; break ; case 1 : val [ 1 ] = parse _Xnum ( blob , 8 ) ; break ; case 2 : val [ 1 ] = parse _XLUnicodeString ( blob ) ; break } return val } function parse _PtgExtraMem ( blob , cce ) { var count = blob . read _shift ( 2 ) ; var out = [ ] ; for ( var i = 0 ; i != count ; ++ i ) out . push ( parse _Ref8U ( blob , 8 ) ) ; return out } function parse _PtgExtraArray ( blob ) { var cols = 1 + blob . read _shift ( 1 ) ; var rows = 1 + blob . read _shift ( 2 ) ; for ( var i = 0 , o = [ ] ; i != rows && ( o [ i ] = [ ] ) ; ++ i ) for ( var j = 0 ; j != cols ; ++ j ) o [ i ] [ j ] = parse _SerAr ( blob ) ; return o } function parse _PtgName ( blob , length ) { var type = blob . read _shift ( 1 ) >>> 5 & 3 ; var nameindex = blob . read _shift ( 4 ) ; return [ type , 0 , nameindex ] } function parse _PtgNameX ( blob , length ) { var type = blob . read _shift ( 1 ) >>> 5 & 3 ; var ixti = blob . read _shift ( 2 ) ; var nameindex = blob . read _shift ( 4 ) ; return [ type
2017-04-03 04:43:05 +00:00
} if ( cellXf . applyAlignment == 1 ) { s . alignment = cellXf . alignment } return JSON . parse ( JSON . stringify ( s ) ) } return null } function safe _format ( p , fmtid , fillid , opts ) { try { if ( p . t === "e" ) p . w = p . w || BErr [ p . v ] ; else if ( fmtid === 0 ) { if ( p . t === "n" ) { if ( ( p . v | 0 ) === p . v ) p . w = SSF . _general _int ( p . v , _ssfopts ) ; else p . w = SSF . _general _num ( p . v , _ssfopts ) } else if ( p . t === "d" ) { var dd = datenum ( p . v ) ; if ( ( dd | 0 ) === dd ) p . w = SSF . _general _int ( dd , _ssfopts ) ; else p . w = SSF . _general _num ( dd , _ssfopts ) } else if ( p . v === undefined ) return "" ; else p . w = SSF . _general ( p . v , _ssfopts ) } else if ( p . t === "d" ) p . w = SSF . format ( fmtid , datenum ( p . v ) , _ssfopts ) ; else p . w = SSF . format ( fmtid , p . v , _ssfopts ) ; if ( opts . cellNF ) p . z = SSF . _table [ fmtid ] } catch ( e ) { if ( opts . WTF ) throw e } } function parse _ws _xml _dim ( ws , s ) { var d = safe _decode _range ( s ) ; if ( d . s . r <= d . e . r && d . s . c <= d . e . c && d . s . r >= 0 && d . s . c >= 0 ) ws [ "!ref" ] = encode _range ( d ) } var mergecregex = /<mergeCell ref="[A-Z0-9:]+"\s*\/>/g ; var sheetdataregex = /<(?:\w+:)?sheetData>([^\u2603]*)<\/(?:\w+:)?sheetData>/ ; var hlinkregex = /<hyperlink[^>]*\/>/g ; var dimregex = /"(\w*:\w*)"/ ; var colregex = /<col[^>]*\/>/g ; function parse _ws _xml ( data , opts , rels ) { if ( ! data ) return data ; var s = { } ; var ridx = data . indexOf ( "<dimension" ) ; if ( ridx > 0 ) { var ref = data . substr ( ridx , 50 ) . match ( dimregex ) ; if ( ref != null ) parse _ws _xml _dim ( s , ref [ 1 ] ) } var mergecells = [ ] ; if ( data . indexOf ( "</mergeCells>" ) !== - 1 ) { var merges = data . match ( mergecregex ) ; for ( ridx = 0 ; ridx != merges . length ; ++ ridx ) mergecells [ ridx ] = safe _decode _range ( merges [ ridx ] . substr ( merges [ ridx ] . indexOf ( '"' ) + 1 ) ) } var columns = [ ] ; if ( opts . cellStyles && data . indexOf ( "</cols>" ) !== - 1 ) { var cols = data . match ( colregex ) ; parse _ws _xml _cols ( columns , cols ) } var refguess = { s : { r : 1e6 , c : 1e6 } , e : { r : 0 , c : 0 } } ; var mtch = data . match ( sheetdataregex ) ; if ( mtch ) parse _ws _xml _data ( mtch [ 1 ] , s , opts , refguess ) ; if ( data . indexOf ( "</hyperlinks>" ) !== - 1 ) parse _ws _xml _hlinks ( s , data . match ( hlinkregex ) , rels ) ; if ( ! s [ "!ref" ] && refguess . e . c >= refguess . s . c && refguess . e . r >= refguess . s . r ) s [ "!ref" ] = encode _range ( refguess ) ; if ( opts . sheetRows > 0 && s [ "!ref" ] ) { var tmpref = safe _decode _range ( s [ "!ref" ] ) ; if ( opts . sheetRows < + tmpref . e . r ) { tmpref . e . r = opts . sheetRows - 1 ; if ( tmpref . e . r > refguess . e . r ) tmpref . e . r = refguess . e . r ; if ( tmpref . e . r < tmpref . s . r ) tmpref . s . r = tmpref . e . r ; if ( tmpref . e . c > refguess . e . c ) tmpref . e . c = refguess . e . c ; if ( tmpref . e . c < tmpref . s . c ) tmpref . s . c = tmpref . e . c ; s [ "!fullref" ] = s [ "!ref" ] ; s [ "!ref" ] = encode _range ( tmpref ) } } if ( mergecells . length > 0 ) s [ "!merges" ] = mergecells ; if ( columns . length > 0 ) s [ "!cols" ] = columns ; return s } function write _ws _xml _merges ( merges ) { if ( merges . length == 0 ) return "" ; var o = '<mergeCells count="' + merges . length + '">' ; for ( var i = 0 ; i != merges . length ; ++ i ) o += '<mergeCell ref="' + encode _range ( merges [ i ] ) + '"/>' ; return o + "</mergeCells>" } function write _ws _xml _pagesetup ( setup ) { var pageSetup = writextag ( "pageSetup" , null , { scale : setup . scale || "100" , orientation : setup . orientation || "portrait" , horizontalDpi : setup . horizontalDpi || "4294967292" , verticalDpi : setup . verticalDpi || "4294967292" } ) ; return pageSetup } function parse _ws _xml _hlinks ( s , data , rels ) { for ( var i = 0 ; i != data . length ; ++ i ) { var val = parsexmltag ( data [ i ] , true ) ; if ( ! val . ref ) return ; var rel = rels ? rels [ "!id" ] [ val . id ] : null ; if ( rel ) { val . Target = rel . Target ; if ( val . location ) val . Target += "#" + val . location ; val . Rel = rel } else { val . Target = val . location ; rel = { Target : val . location , TargetMode : "Internal" } ; val . Rel = rel } var rng = safe _decode _range ( val . ref ) ; for ( var R = rng . s . r ; R <= rng . e . r ; ++ R ) for ( var C = rng . s . c ; C <= rng . e . c ; ++ C ) { var addr = encode _cell ( { c : C , r : R } ) ; if ( ! s [ addr ] ) s [ addr ] = { t : "stub" , v : undefined } ; s [ addr ] . l = val } } } function parse _ws _xml _cols ( columns , cols ) { var seencol = false ; for ( var coli = 0 ; coli != cols . length ; ++ coli ) { var coll = parsexmltag ( cols [ coli ] , true ) ; var colm = parseInt ( coll . min , 10 ) - 1 , colM = parseInt ( coll . max , 10 ) - 1 ; delete coll . min ; delete coll . max ; if ( ! seencol && coll . width ) { seencol = true ; find _mdw ( + coll . width , coll ) } if ( coll . width ) { coll . wpx = width2px ( + coll . width ) ; coll . wch = px2char ( coll . wpx ) ; coll . MDW = MDW } while ( colm <= colM ) columns [ colm ++ ] = coll } } function write _ws _xml _cols ( ws , cols ) { var o = [ "<cols>" ] , col , width ; for ( var i = 0 ; i != cols . length ; ++ i ) { if ( ! ( col = cols [ i ] ) ) continue ; var p = { min : i + 1 , max : i + 1 } ; width = - 1 ; if ( col . wpx ) width = px2char ( col . wpx ) ; else if ( col . wch ) width = col . wch ; if ( width > - 1 ) { p . width = char2width ( width ) ; p . customWidth = 1 } o [ o . len
cell . v = parsexmlbool ( xml ) ; break ; case "String" : cell . t = "s" ; cell . r = xlml _fixstr ( unescapexml ( xml ) ) ; cell . v = xml . indexOf ( "<" ) > - 1 ? ss : cell . r ; break ; case "DateTime" : cell . v = ( Date . parse ( xml ) - new Date ( Date . UTC ( 1899 , 11 , 30 ) ) ) / ( 24 * 60 * 60 * 1e3 ) ; if ( cell . v !== cell . v ) cell . v = unescapexml ( xml ) ; else if ( cell . v >= 1 && cell . v < 60 ) cell . v = cell . v - 1 ; if ( ! nf || nf == "General" ) nf = "yyyy-mm-dd" ; case "Number" : if ( cell . v === undefined ) cell . v = + xml ; if ( ! cell . t ) cell . t = "n" ; break ; case "Error" : cell . t = "e" ; cell . v = RBErr [ xml ] ; cell . w = xml ; break ; default : cell . t = "s" ; cell . v = xlml _fixstr ( ss ) ; break } safe _format _xlml ( cell , nf , o ) ; if ( o . cellFormula != null && cell . Formula ) { cell . f = rc _to _a1 ( unescapexml ( cell . Formula ) , base ) ; cell . Formula = undefined } if ( o . cellStyles ) { interiors . forEach ( function ( x ) { if ( ! S . patternType && x . patternType ) S . patternType = x . patternType } ) ; cell . s = S } cell . ixfe = cell . StyleID !== undefined ? cell . StyleID : "Default" } function xlml _clean _comment ( comment ) { comment . t = comment . v ; comment . v = comment . w = comment . ixfe = undefined } function xlml _normalize ( d ) { if ( has _buf && Buffer . isBuffer ( d ) ) return d . toString ( "utf8" ) ; if ( typeof d === "string" ) return d ; throw "badf" } var xlmlregex = /<(\/?)([a-z0-9]*:|)(\w+)[^>]*>/gm ; function parse _xlml _xml ( d , opts ) { var str = xlml _normalize ( d ) ; var Rn ; var state = [ ] , tmp ; var sheets = { } , sheetnames = [ ] , cursheet = { } , sheetname = "" ; var table = { } , cell = { } , row = { } , dtag , didx ; var c = 0 , r = 0 ; var refguess = { s : { r : 1e6 , c : 1e6 } , e : { r : 0 , c : 0 } } ; var styles = { } , stag = { } ; var ss = "" , fidx = 0 ; var mergecells = [ ] ; var Props = { } , Custprops = { } , pidx = 0 , cp = { } ; var comments = [ ] , comment = { } ; var cstys = [ ] , csty ; xlmlregex . lastIndex = 0 ; while ( Rn = xlmlregex . exec ( str ) ) switch ( Rn [ 3 ] ) { case "Data" : if ( state [ state . length - 1 ] [ 1 ] ) break ; if ( Rn [ 1 ] === "/" ) parse _xlml _data ( str . slice ( didx , Rn . index ) , ss , dtag , state [ state . length - 1 ] [ 0 ] == "Comment" ? comment : cell , { c : c , r : r } , styles , cstys [ c ] , row , opts ) ; else { ss = "" ; dtag = xlml _parsexmltag ( Rn [ 0 ] ) ; didx = Rn . index + Rn [ 0 ] . length } break ; case "Cell" : if ( Rn [ 1 ] === "/" ) { if ( comments . length > 0 ) cell . c = comments ; if ( ( ! opts . sheetRows || opts . sheetRows > r ) && cell . v !== undefined ) cursheet [ encode _col ( c ) + encode _row ( r ) ] = cell ; if ( cell . HRef ) { cell . l = { Target : cell . HRef , tooltip : cell . HRefScreenTip } ; cell . HRef = cell . HRefScreenTip = undefined } 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 } } ) } ++ c ; if ( cell . MergeAcross ) c += + cell . MergeAcross } 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 ] . substr ( - 2 ) === "/>" ) ++ c ; comments = [ ] } break ; case "Row" : if ( Rn [ 1 ] === "/" || Rn [ 0 ] . substr ( - 2 ) === "/>" ) { if ( r < refguess . s . r ) refguess . s . r = r ; if ( r > refguess . e . r ) refguess . e . r = r ; if ( Rn [ 0 ] . substr ( - 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 } break ; case "Worksheet" : if ( Rn [ 1 ] === "/" ) { if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw "Bad state: " + tmp ; 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 ; sheets [ sheetname ] = cursheet } else { refguess = { s : { r : 1e6 , c : 1e6 } , e : { r : 0 , c : 0 } } ; r = c = 0 ; state . push ( [ Rn [ 3 ] , false ] ) ; tmp = xlml _parsexmltag ( Rn [ 0 ] ) ; sheetname = tmp . Name ; cursheet = { } ; mergecells = [ ] } break ; case "Table" : if ( Rn [ 1 ] === "/" ) { if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw "Bad state: " + tmp } else if ( Rn [ 0 ] . slice ( - 2 ) == "/>" ) break ; else { table = xlml _parsexmltag ( Rn [ 0 ] ) ; state . push ( [ Rn [ 3 ] , false ] ) ; cstys = [ ] } break ; case "Style" : if ( Rn [ 1 ] === "/" ) process _style _xlml ( styles , stag , opts ) ; else stag = xlml _parsexmltag ( Rn [ 0 ] ) ; break ; case "NumberFormat" : stag . nf = xlml _parsexmltag ( Rn [ 0 ] ) . Format || "General" ; break ; case "Column" : if ( state [ state . length - 1 ] [ 0 ] !== "Table" ) break ; csty = xlml _parsexmltag ( Rn [ 0 ] ) ; cstys [ csty . Index - 1 || cstys . length ] = csty ; for ( var i = 0 ; i < + csty . Span ; ++ i ) cstys [ cstys . length ] = csty ; break ; case "NamedRange" : 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 ] . substr ( - 2 ) === "/>" ) break ; else if ( Rn [ 1 ] === "/" ) ss += str . slice ( fidx , Rn . index ) ; else fidx = Rn . index + Rn [ 0 ] .
143 : { n : "BrtBeginBundleShs" , f : parsenoop } , 144 : { n : "BrtEndBundleShs" , f : parsenoop } , 145 : { n : "BrtBeginSheetData" , f : parsenoop } , 146 : { n : "BrtEndSheetData" , f : parsenoop } , 147 : { n : "BrtWsProp" , f : parse _BrtWsProp } , 148 : { n : "BrtWsDim" , f : parse _BrtWsDim , p : 16 } , 151 : { n : "BrtPane" , f : parsenoop } , 152 : { n : "BrtSel" , f : parsenoop } , 153 : { n : "BrtWbProp" , f : parse _BrtWbProp } , 154 : { n : "BrtWbFactoid" , f : parsenoop } , 155 : { n : "BrtFileRecover" , f : parsenoop } , 156 : { n : "BrtBundleSh" , f : parse _BrtBundleSh } , 157 : { n : "BrtCalcProp" , f : parsenoop } , 158 : { n : "BrtBookView" , f : parsenoop } , 159 : { n : "BrtBeginSst" , f : parse _BrtBeginSst } , 160 : { n : "BrtEndSst" , f : parsenoop } , 161 : { n : "BrtBeginAFilter" , f : parsenoop } , 162 : { n : "BrtEndAFilter" , f : parsenoop } , 163 : { n : "BrtBeginFilterColumn" , f : parsenoop } , 164 : { n : "BrtEndFilterColumn" , f : parsenoop } , 165 : { n : "BrtBeginFilters" , f : parsenoop } , 166 : { n : "BrtEndFilters" , f : parsenoop } , 167 : { n : "BrtFilter" , f : parsenoop } , 168 : { n : "BrtColorFilter" , f : parsenoop } , 169 : { n : "BrtIconFilter" , f : parsenoop } , 170 : { n : "BrtTop10Filter" , f : parsenoop } , 171 : { n : "BrtDynamicFilter" , f : parsenoop } , 172 : { n : "BrtBeginCustomFilters" , f : parsenoop } , 173 : { n : "BrtEndCustomFilters" , f : parsenoop } , 174 : { n : "BrtCustomFilter" , f : parsenoop } , 175 : { n : "BrtAFilterDateGroupItem" , f : parsenoop } , 176 : { n : "BrtMergeCell" , f : parse _BrtMergeCell } , 177 : { n : "BrtBeginMergeCells" , f : parsenoop } , 178 : { n : "BrtEndMergeCells" , f : parsenoop } , 179 : { n : "BrtBeginPivotCacheDef" , f : parsenoop } , 180 : { n : "BrtEndPivotCacheDef" , f : parsenoop } , 181 : { n : "BrtBeginPCDFields" , f : parsenoop } , 182 : { n : "BrtEndPCDFields" , f : parsenoop } , 183 : { n : "BrtBeginPCDField" , f : parsenoop } , 184 : { n : "BrtEndPCDField" , f : parsenoop } , 185 : { n : "BrtBeginPCDSource" , f : parsenoop } , 186 : { n : "BrtEndPCDSource" , f : parsenoop } , 187 : { n : "BrtBeginPCDSRange" , f : parsenoop } , 188 : { n : "BrtEndPCDSRange" , f : parsenoop } , 189 : { n : "BrtBeginPCDFAtbl" , f : parsenoop } , 190 : { n : "BrtEndPCDFAtbl" , f : parsenoop } , 191 : { n : "BrtBeginPCDIRun" , f : parsenoop } , 192 : { n : "BrtEndPCDIRun" , f : parsenoop } , 193 : { n : "BrtBeginPivotCacheRecords" , f : parsenoop } , 194 : { n : "BrtEndPivotCacheRecords" , f : parsenoop } , 195 : { n : "BrtBeginPCDHierarchies" , f : parsenoop } , 196 : { n : "BrtEndPCDHierarchies" , f : parsenoop } , 197 : { n : "BrtBeginPCDHierarchy" , f : parsenoop } , 198 : { n : "BrtEndPCDHierarchy" , f : parsenoop } , 199 : { n : "BrtBeginPCDHFieldsUsage" , f : parsenoop } , 200 : { n : "BrtEndPCDHFieldsUsage" , f : parsenoop } , 201 : { n : "BrtBeginExtConnection" , f : parsenoop } , 202 : { n : "BrtEndExtConnection" , f : parsenoop } , 203 : { n : "BrtBeginECDbProps" , f : parsenoop } , 204 : { n : "BrtEndECDbProps" , f : parsenoop } , 205 : { n : "BrtBeginECOlapProps" , f : parsenoop } , 206 : { n : "BrtEndECOlapProps" , f : parsenoop } , 207 : { n : "BrtBeginPCDSConsol" , f : parsenoop } , 208 : { n : "BrtEndPCDSConsol" , f : parsenoop } , 209 : { n : "BrtBeginPCDSCPages" , f : parsenoop } , 210 : { n : "BrtEndPCDSCPages" , f : parsenoop } , 211 : { n : "BrtBeginPCDSCPage" , f : parsenoop } , 212 : { n : "BrtEndPCDSCPage" , f : parsenoop } , 213 : { n : "BrtBeginPCDSCPItem" , f : parsenoop } , 214 : { n : "BrtEndPCDSCPItem" , f : parsenoop } , 215 : { n : "BrtBeginPCDSCSets" , f : parsenoop } , 216 : { n : "BrtEndPCDSCSets" , f : parsenoop } , 217 : { n : "BrtBeginPCDSCSet" , f : parsenoop } , 218 : { n : "BrtEndPCDSCSet" , f : parsenoop } , 219 : { n : "BrtBeginPCDFGroup" , f : parsenoop } , 220 : { n : "BrtEndPCDFGroup" , f : parsenoop } , 221 : { n : "BrtBeginPCDFGItems" , f : parsenoop } , 222 : { n : "BrtEndPCDFGItems" , f : parsenoop } , 223 : { n : "BrtBeginPCDFGRange" , f : parsenoop } , 224 : { n : "BrtEndPCDFGRange" , f : parsenoop } , 225 : { n : "BrtBeginPCDFGDiscrete" , f : parsenoop } , 226 : { n : "BrtEndPCDFGDiscrete" , f : parsenoop } , 227 : { n : "BrtBeginPCDSDTupleCache" , f : parsenoop } , 228 : { n : "BrtEndPCDSDTupleCache" , f : parsenoop } , 229 : { n : "BrtBeginPCDSDTCEntries" , f : parsenoop } , 230 : { n : "BrtEndPCDSDTCEntries" , f : parsenoop } , 231 : { n : "BrtBeginPCDSDTCEMembers" , f : parsenoop } , 232 : { n : "BrtEndPCDSDTCEMembers" , f : parsenoop } , 233 : { n : "BrtBeginPCDSDTCEMember" , f : parsenoop } , 234 : { n : "BrtEndPCDSDTCEMember" , f : parsenoop } , 235 : { n : "BrtBeginPCDSDTCQueries" , f : parsenoop } , 236 : { n : "BrtEndPCDSDTCQueries" , f : parsenoop } , 237 : { n : "BrtBeginPCDSDTCQuery" , f : parsenoop } , 238 : { n : "BrtEndPCDSDTCQuery" , f : parsenoop } , 239 : { n : "BrtBeginPCDSDTCSets" , f : parsenoop } , 240 : { n : "BrtEndPCDSDTCSets" , f : parsenoop } , 241 : { n : "BrtBeginPCDSDTCSet" , f : parsenoop } , 242 : { n : "BrtEndPCDSDTCSet" , f : parsenoop } , 243 : { n : "BrtBeginPCDCalcItems" , f : parsenoop } , 244 : { n : "BrtEndPCDCalcItems" , f : parsenoop } , 245 : { n : "BrtBeginPCDCalcItem" , f : parsenoop } , 246 : { n : "BrtEndPCDCalcItem" , f : parsenoop } ,
f : parse _AutoFilter } , 160 : { n : "Scl" , f : parse _Scl } , 161 : { n : "Setup" , f : parse _Setup } , 174 : { n : "ScenMan" , f : parse _ScenMan } , 175 : { n : "SCENARIO" , f : parse _SCENARIO } , 176 : { n : "SxView" , f : parse _SxView } , 177 : { n : "Sxvd" , f : parse _Sxvd } , 178 : { n : "SXVI" , f : parse _SXVI } , 180 : { n : "SxIvd" , f : parse _SxIvd } , 181 : { n : "SXLI" , f : parse _SXLI } , 182 : { n : "SXPI" , f : parse _SXPI } , 184 : { n : "DocRoute" , f : parse _DocRoute } , 185 : { n : "RecipName" , f : parse _RecipName } , 189 : { n : "MulRk" , f : parse _MulRk } , 190 : { n : "MulBlank" , f : parse _MulBlank } , 193 : { n : "Mms" , f : parse _Mms } , 197 : { n : "SXDI" , f : parse _SXDI } , 198 : { n : "SXDB" , f : parse _SXDB } , 199 : { n : "SXFDB" , f : parse _SXFDB } , 200 : { n : "SXDBB" , f : parse _SXDBB } , 201 : { n : "SXNum" , f : parse _SXNum } , 202 : { n : "SxBool" , f : parse _SxBool } , 203 : { n : "SxErr" , f : parse _SxErr } , 204 : { n : "SXInt" , f : parse _SXInt } , 205 : { n : "SXString" , f : parse _SXString } , 206 : { n : "SXDtr" , f : parse _SXDtr } , 207 : { n : "SxNil" , f : parse _SxNil } , 208 : { n : "SXTbl" , f : parse _SXTbl } , 209 : { n : "SXTBRGIITM" , f : parse _SXTBRGIITM } , 210 : { n : "SxTbpg" , f : parse _SxTbpg } , 211 : { n : "ObProj" , f : parse _ObProj } , 213 : { n : "SXStreamID" , f : parse _SXStreamID } , 215 : { n : "DBCell" , f : parse _DBCell } , 216 : { n : "SXRng" , f : parse _SXRng } , 217 : { n : "SxIsxoper" , f : parse _SxIsxoper } , 218 : { n : "BookBool" , f : parse _BookBool } , 220 : { n : "DbOrParamQry" , f : parse _DbOrParamQry } , 221 : { n : "ScenarioProtect" , f : parse _ScenarioProtect } , 222 : { n : "OleObjectSize" , f : parse _OleObjectSize } , 224 : { n : "XF" , f : parse _XF } , 225 : { n : "InterfaceHdr" , f : parse _InterfaceHdr } , 226 : { n : "InterfaceEnd" , f : parse _InterfaceEnd } , 227 : { n : "SXVS" , f : parse _SXVS } , 229 : { n : "MergeCells" , f : parse _MergeCells } , 233 : { n : "BkHim" , f : parse _BkHim } , 235 : { n : "MsoDrawingGroup" , f : parse _MsoDrawingGroup } , 236 : { n : "MsoDrawing" , f : parse _MsoDrawing } , 237 : { n : "MsoDrawingSelection" , f : parse _MsoDrawingSelection } , 239 : { n : "PhoneticInfo" , f : parse _PhoneticInfo } , 240 : { n : "SxRule" , f : parse _SxRule } , 241 : { n : "SXEx" , f : parse _SXEx } , 242 : { n : "SxFilt" , f : parse _SxFilt } , 244 : { n : "SxDXF" , f : parse _SxDXF } , 245 : { n : "SxItm" , f : parse _SxItm } , 246 : { n : "SxName" , f : parse _SxName } , 247 : { n : "SxSelect" , f : parse _SxSelect } , 248 : { n : "SXPair" , f : parse _SXPair } , 249 : { n : "SxFmla" , f : parse _SxFmla } , 251 : { n : "SxFormat" , f : parse _SxFormat } , 252 : { n : "SST" , f : parse _SST } , 253 : { n : "LabelSst" , f : parse _LabelSst } , 255 : { n : "ExtSST" , f : parse _ExtSST } , 256 : { n : "SXVDEx" , f : parse _SXVDEx } , 259 : { n : "SXFormula" , f : parse _SXFormula } , 290 : { n : "SXDBEx" , f : parse _SXDBEx } , 311 : { n : "RRDInsDel" , f : parse _RRDInsDel } , 312 : { n : "RRDHead" , f : parse _RRDHead } , 315 : { n : "RRDChgCell" , f : parse _RRDChgCell } , 317 : { n : "RRTabId" , f : parse _RRTabId } , 318 : { n : "RRDRenSheet" , f : parse _RRDRenSheet } , 319 : { n : "RRSort" , f : parse _RRSort } , 320 : { n : "RRDMove" , f : parse _RRDMove } , 330 : { n : "RRFormat" , f : parse _RRFormat } , 331 : { n : "RRAutoFmt" , f : parse _RRAutoFmt } , 333 : { n : "RRInsertSh" , f : parse _RRInsertSh } , 334 : { n : "RRDMoveBegin" , f : parse _RRDMoveBegin } , 335 : { n : "RRDMoveEnd" , f : parse _RRDMoveEnd } , 336 : { n : "RRDInsDelBegin" , f : parse _RRDInsDelBegin } , 337 : { n : "RRDInsDelEnd" , f : parse _RRDInsDelEnd } , 338 : { n : "RRDConflict" , f : parse _RRDConflict } , 339 : { n : "RRDDefName" , f : parse _RRDDefName } , 340 : { n : "RRDRstEtxp" , f : parse _RRDRstEtxp } , 351 : { n : "LRng" , f : parse _LRng } , 352 : { n : "UsesELFs" , f : parse _UsesELFs } , 353 : { n : "DSF" , f : parse _DSF } , 401 : { n : "CUsr" , f : parse _CUsr } , 402 : { n : "CbUsr" , f : parse _CbUsr } , 403 : { n : "UsrInfo" , f : parse _UsrInfo } , 404 : { n : "UsrExcl" , f : parse _UsrExcl } , 405 : { n : "FileLock" , f : parse _FileLock } , 406 : { n : "RRDInfo" , f : parse _RRDInfo } , 407 : { n : "BCUsrs" , f : parse _BCUsrs } , 408 : { n : "UsrChk" , f : parse _UsrChk } , 425 : { n : "UserBView" , f : parse _UserBView } , 426 : { n : "UserSViewBegin" , f : parse _UserSViewBegin } , 427 : { n : "UserSViewEnd" , f : parse _UserSViewEnd } , 428 : { n : "RRDUserView" , f : parse _RRDUserView } , 429 : { n : "Qsi" , f : parse _Qsi } , 430 : { n : "SupBook" , f : parse _SupBook } , 431 : { n : "Prot4Rev" , f : parse _Prot4Rev } , 432 : { n : "CondFmt" , f : parse _CondFmt } , 433 : { n : "CF" , f : parse _CF } , 434 : { n : "DVal" , f : parse _DVal } , 437 : { n : "DConBin" , f : parse _DConBin } , 438 : { n : "TxO" , f : parse _TxO } , 439 : { n : "RefreshAll" , f : parse _RefreshAll } , 440 : { n : "HLink" , f : parse _HLink } , 441 : { n : "Lel" , f : parse _Lel } , 442 : { n : "CodeName" , f : parse _XLSCodeName } , 443 : { n : "SXFDBType" , f : parse _SXFDBType } , 444 : { n : "Prot4RevPass" , f : parse _Prot4RevPass } , 445 : { n : "ObNoMacros" , f : parse _ObNoMacros } , 446 : { n : "Dv" , f : parse _Dv } , 448 : { n : "Excel9File" , f : parse _Excel9File } , 449 : { n : "RecalcId" , f : parse _RecalcId , r : 2 } , 450 : { n : "EntExU2" , f : parse _EntExU2 } , 512 : { n : "Dimensions" , f : parse _Dimensions } , 513 : { n : "Blank" , f : parse _Blank } , 515 : { n : " Numb
$alignment . attr ( "indent" , attributes . alignment . indent ) } if ( attributes . alignment . readingOrder ) { $alignment . attr ( "readingOrder" , attributes . alignment . readingOrder ) } if ( attributes . alignment . wrapText ) { $alignment . attr ( "wrapText" , attributes . alignment . wrapText ) } if ( attributes . alignment . textRotation != undefined ) { $alignment . attr ( "textRotation" , attributes . alignment . textRotation ) } $xf . append ( $alignment ) . attr ( "applyAlignment" , 1 ) } this . $cellXfs . append ( $xf ) ; var count = + this . $cellXfs . children ( ) . length ; this . $cellXfs . attr ( "count" , count ) ; return count - 1 } , _addFont : function ( attributes ) { if ( ! attributes ) { return 0 } var $font = XmlNode ( "font" ) . append ( XmlNode ( "sz" ) . attr ( "val" , attributes . sz || this . defaultStyle . font . sz ) ) . append ( XmlNode ( "name" ) . attr ( "val" , attributes . name || this . defaultStyle . font . name ) ) ; if ( attributes . bold ) $font . append ( XmlNode ( "b" ) ) ; if ( attributes . underline ) $font . append ( XmlNode ( "u" ) ) ; if ( attributes . italic ) $font . append ( XmlNode ( "i" ) ) ; if ( attributes . strike ) $font . append ( XmlNode ( "strike" ) ) ; if ( attributes . outline ) $font . append ( XmlNode ( "outline" ) ) ; if ( attributes . shadow ) $font . append ( XmlNode ( "shadow" ) ) ; if ( attributes . vertAlign ) { $font . append ( XmlNode ( "vertAlign" ) . attr ( "val" , attributes . vertAlign ) ) } if ( attributes . color ) { if ( attributes . color . theme ) { $font . append ( XmlNode ( "color" ) . attr ( "theme" , attributes . color . theme ) ) ; if ( attributes . color . tint ) { $font . append ( XmlNode ( "tint" ) . attr ( "theme" , attributes . color . tint ) ) } } else if ( attributes . color . rgb ) { $font . append ( XmlNode ( "color" ) . attr ( "rgb" , attributes . color . rgb ) ) } } this . $fonts . append ( $font ) ; var count = this . $fonts . children ( ) . length ; this . $fonts . attr ( "count" , count ) ; return count - 1 } , _addNumFmt : function ( numFmt ) { if ( ! numFmt ) { return 0 } if ( typeof numFmt == "string" ) { var numFmtIdx = fmt _table [ numFmt ] ; if ( numFmtIdx >= 0 ) { return numFmtIdx } } if ( /^[0-9]+$/ . exec ( numFmt ) ) { return numFmt } numFmt = numFmt . replace ( /&/g , "&" ) . replace ( /</g , "<" ) . replace ( />/g , ">" ) . replace ( /"/g , """ ) . replace ( /'/g , "'" ) ; var $numFmt = XmlNode ( "numFmt" ) . attr ( "numFmtId" , ++ customNumFmtId ) . attr ( "formatCode" , numFmt ) ; this . $numFmts . append ( $numFmt ) ; var count = this . $numFmts . children ( ) . length ; this . $numFmts . attr ( "count" , count ) ; return customNumFmtId } , _addFill : function ( attributes ) { if ( ! attributes ) { return 0 } var $patternFill = XmlNode ( "patternFill" ) . attr ( "patternType" , attributes . patternType || "solid" ) ; if ( attributes . fgColor ) { var $fgColor = XmlNode ( "fgColor" ) ; if ( attributes . fgColor . rgb ) { if ( attributes . fgColor . rgb . length == 6 ) { attributes . fgColor . rgb = "FF" + attributes . fgColor . rgb } $fgColor . attr ( "rgb" , attributes . fgColor . rgb ) ; $patternFill . append ( $fgColor ) } else if ( attributes . fgColor . theme ) { $fgColor . attr ( "theme" , attributes . fgColor . theme ) ; if ( attributes . fgColor . tint ) { $fgColor . attr ( "tint" , attributes . fgColor . tint ) } $patternFill . append ( $fgColor ) } if ( ! attributes . bgColor ) { attributes . bgColor = { indexed : "64" } } } if ( attributes . bgColor ) { var $bgColor = XmlNode ( "bgColor" ) . attr ( attributes . bgColor ) ; $patternFill . append ( $bgColor ) } var $fill = XmlNode ( "fill" ) . append ( $patternFill ) ; this . $fills . append ( $fill ) ; var count = this . $fills . children ( ) . length ; this . $fills . attr ( "count" , count ) ; return count - 1 } , _getSubBorder : function ( direction , spec ) { var $direction = XmlNode ( direction ) ; if ( spec ) { if ( spec . style ) $direction . attr ( "style" , spec . style ) ; if ( spec . color ) { var $color = XmlNode ( "color" ) ; if ( spec . color . auto ) { $color . attr ( "auto" , spec . color . auto ) } else if ( spec . color . rgb ) { $color . attr ( "rgb" , spec . color . rgb ) } else if ( spec . color . theme || spec . color . tint ) { $color . attr ( "theme" , spec . color . theme || "1" ) ; $color . attr ( "tint" , spec . color . tint || "0" ) } $direction . append ( $color ) } } return $direction } , _addBorder : function ( attributes ) { if ( ! attributes ) { return 0 } var self = this ; var $border = XmlNode ( "border" ) . attr ( "diagonalUp" , attributes . diagonalUp ) . attr ( "diagonalDown" , attributes . diagonalDown ) ; var directions = [ "left" , "right" , "top" , "bottom" , "diagonal" ] ; directions . forEach ( function ( direction ) { $border . append ( self . _getSubBorder ( direction , attributes [ direction ] ) ) } ) ; this . $borders . append ( $border ) ; var count = this . $borders . children ( ) . length ; this . $borders . attr ( "count" , count ) ; return count - 1 } , toXml : function ( ) { return this . $styles . toXml ( ) } } . initialize ( options || { } ) } ; XLSX . parse _xlscfb = parse _xlscfb ; XLSX . parse _zip = parse _zip ; XLSX . re