2016-12-31 08:20:45 +00:00
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
2017-05-11 18:23:21 +00:00
var XLSX = { } ; ( function make _xlsx ( XLSX ) { XLSX . version = "0.10.1" ; var current _codepage = 1200 ; if ( typeof module !== "undefined" && typeof require !== "undefined" ) { if ( typeof cptable === "undefined" ) cptable = require ( "./dist/cpexcel.js" ) } function reset _cp ( ) { set _cp ( 1200 ) } var set _cp = function ( cp ) { current _codepage = cp } ; function char _codes ( data ) { var o = [ ] ; for ( var i = 0 , len = data . length ; i < len ; ++ i ) o [ i ] = data . charCodeAt ( i ) ; return o } var debom = function ( data ) { var c1 = data . charCodeAt ( 0 ) , c2 = data . charCodeAt ( 1 ) ; if ( c1 == 255 && c2 == 254 ) return data . substr ( 2 ) ; if ( c1 == 254 && c2 == 255 ) return data . substr ( 2 ) ; if ( c1 == 65279 ) return data . substr ( 1 ) ; return data } ; var _getchar = function _gc1 ( x ) { return String . fromCharCode ( x ) } ; if ( typeof cptable !== "undefined" ) { set _cp = function ( cp ) { current _codepage = cp } ; debom = function ( data ) { if ( data . charCodeAt ( 0 ) === 255 && data . charCodeAt ( 1 ) === 254 ) { return cptable . utils . decode ( 1200 , char _codes ( data . substr ( 2 ) ) ) } return data } ; _getchar = function _gc2 ( x ) { if ( current _codepage === 1200 ) return String . fromCharCode ( x ) ; return cptable . utils . decode ( current _codepage , [ x & 255 , x >> 8 ] ) [ 0 ] } } var DENSE = null ; var DIF _XL = true ; var Base64 = function make _b64 ( ) { var map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" ; return { encode : function ( input ) { var o = "" ; var c1 , c2 , c3 , e1 , e2 , e3 , e4 ; for ( var i = 0 ; i < input . length ; ) { c1 = input . charCodeAt ( i ++ ) ; c2 = input . charCodeAt ( i ++ ) ; c3 = input . charCodeAt ( i ++ ) ; e1 = c1 >> 2 ; e2 = ( c1 & 3 ) << 4 | c2 >> 4 ; e3 = ( c2 & 15 ) << 2 | c3 >> 6 ; e4 = c3 & 63 ; if ( isNaN ( c2 ) ) { e3 = e4 = 64 } else if ( isNaN ( c3 ) ) { e4 = 64 } o += map . charAt ( e1 ) + map . charAt ( e2 ) + map . charAt ( e3 ) + map . charAt ( e4 ) } return o } , decode : function b64 _decode ( input ) { var o = "" ; var c1 , c2 , c3 ; var e1 , e2 , e3 , e4 ; input = input . replace ( /[^A-Za-z0-9\+\/\=]/g , "" ) ; for ( var i = 0 ; i < input . length ; ) { e1 = map . indexOf ( input . charAt ( i ++ ) ) ; e2 = map . indexOf ( input . charAt ( i ++ ) ) ; e3 = map . indexOf ( input . charAt ( i ++ ) ) ; e4 = map . indexOf ( input . charAt ( i ++ ) ) ; c1 = e1 << 2 | e2 >> 4 ; c2 = ( e2 & 15 ) << 4 | e3 >> 2 ; c3 = ( e3 & 3 ) << 6 | e4 ; o += String . fromCharCode ( c1 ) ; if ( e3 != 64 ) { o += String . fromCharCode ( c2 ) } if ( e4 != 64 ) { o += String . fromCharCode ( c3 ) } } return o } } } ( ) ; var has _buf = typeof Buffer !== "undefined" && typeof process !== "undefined" && typeof process . versions !== "undefined" && process . versions . node ; function new _raw _buf ( len ) { return new ( has _buf ? Buffer : Array ) ( len ) } function s2a ( s ) { if ( has _buf ) return new Buffer ( s , "binary" ) ; return s . split ( "" ) . map ( function ( x ) { return x . charCodeAt ( 0 ) & 255 } ) } var bconcat = function ( bufs ) { return [ ] . concat . apply ( [ ] , bufs ) } ; var chr0 = /\u0000/g , chr1 = /[\u0001-\u0006]/ ; var SSF = { } ; var make _ssf = function make _ssf ( SSF ) { SSF . version = "0.9.2" ; function _strrev ( x ) { var o = "" , i = x . length - 1 ; while ( i >= 0 ) o += x . charAt ( i -- ) ; return o } function fill ( c , l ) { var o = "" ; while ( o . length < l ) o += c ; return o } function pad0 ( v , d ) { var t = "" + v ; return t . length >= d ? t : fill ( "0" , d - t . length ) + t } function pad _ ( v , d ) { var t = "" + v ; return t . length >= d ? t : fill ( " " , d - t . length ) + t } function rpad _ ( v , d ) { var t = "" + v ; return t . length >= d ? t : t + fill ( " " , d - t . length ) } function pad0r1 ( v , d ) { var t = "" + Math . round ( v ) ; return t . length >= d ? t : fill ( "0" , d - t . length ) + t } function pad0r2 ( v , d ) { var t = "" + v ; return t . length >= d ? t : fill ( "0" , d - t . length ) + t } var p2 _32 = Math . pow ( 2 , 32 ) ; function pad0r ( v , d ) { if ( v > p2 _32 || v < - p2 _32 ) return pad0r1 ( v , d ) ; var i = Math . round ( v ) ; return pad0r2 ( i , d ) } function isgeneral ( s , i ) { i = i || 0 ; return s . length >= 7 + i && ( s . charCodeAt ( i ) | 32 ) === 103 && ( s . charCodeAt ( i + 1 ) | 32 ) === 101 && ( s . charCodeAt ( i + 2 ) | 32 ) === 110 && ( s . charCodeAt ( i + 3 ) | 32 ) === 101 && ( s . charCodeAt ( i + 4 ) | 32 ) === 114 && ( s . charCodeAt ( i + 5 ) | 32 ) === 97 && ( s . charCodeAt ( i + 6 ) | 32 ) === 108 } var opts _fmt = [ [ "date1904" , 0 ] , [ "output" , "" ] , [ "WTF" , false ] ] ; function fixopts ( o ) { for ( var y = 0 ; y != opts _fmt . length ; ++ y ) if ( o [ opts _fmt [ y ] [ 0 ] ] === undefined ) o [ opts _fmt [ y ] [ 0 ] ] = opts _fmt [ y ] [ 1 ] } SSF . opts = opts _fmt ; var days = [ [ "Sun" , "Sunday" ] , [ "Mon" , "Monday" ] , [ "Tue" , "Tuesday" ] , [ "Wed" , "Wednesday" ] , [ "Thu" , "Thursday" ] , [ "Fri" , "Friday" ] , [ "Sat" , "Saturday" ] ] ; var months = [ [ "J" , "Jan" , "January" ] , [ "F" , "Feb" , "February" ] , [ "M" , "Mar" , "March" ] , [ "A" , "Apr" , "April" ] , [ "M" , "May" , "May" ] , [ "J" , "Jun" , "June" ] , [ "J" , "Jul" , "July" ] , [ "A" , "Aug" , "August" ] , [ "S" , "Sep" , "September" ] , [ "O" , "Oct" , "October" ] , [ "N" , "Nov" , "November" ] , [ "D" , "Dec" , "December" ] ] ; function init _table ( t ) { t [ 0 ] = "General" ; t [ 1 ] = "0" ; t [ 2 ] = "0.00" ; t [ 3 ] = "#,##0" ; t [ 4 ] = "#,##0.00" ; t [ 9 ] = "0%" ; t [ 10 ] = "0.00%" ; t [ 11 ] = " 0.00 E + 00
var shift = 9 ; blob . l += 2 ; switch ( shift = blob . read _shift ( 2 ) ) { case 9 : if ( mver != 3 ) throw new Error ( "Sector Shift: Expected 9 saw " + shift ) ; break ; case 12 : if ( mver != 4 ) throw new Error ( "Sector Shift: Expected 12 saw " + shift ) ; break ; default : throw new Error ( "Sector Shift: Expected 9 or 12 saw " + shift ) } blob . chk ( "0600" , "Mini Sector Shift: " ) ; blob . chk ( "000000000000" , "Reserved: " ) } function sectorify ( file , ssz ) { var nsectors = Math . ceil ( file . length / ssz ) - 1 ; var sectors = new Array ( nsectors ) ; for ( var i = 1 ; i < nsectors ; ++ i ) sectors [ i - 1 ] = file . slice ( i * ssz , ( i + 1 ) * ssz ) ; sectors [ nsectors - 1 ] = file . slice ( nsectors * ssz ) ; return sectors } function build _full _paths ( FI , FPD , FP , Paths ) { var i = 0 , L = 0 , R = 0 , C = 0 , j = 0 , pl = Paths . length ; var dad = new Array ( pl ) , q = new Array ( pl ) ; for ( ; i < pl ; ++ i ) { dad [ i ] = q [ i ] = i ; FP [ i ] = Paths [ i ] } for ( ; j < q . length ; ++ j ) { i = q [ j ] ; L = FI [ i ] . L ; R = FI [ i ] . R ; C = FI [ i ] . C ; if ( dad [ i ] === i ) { if ( L !== - 1 && dad [ L ] !== L ) dad [ i ] = dad [ L ] ; if ( R !== - 1 && dad [ R ] !== R ) dad [ i ] = dad [ R ] } if ( C !== - 1 ) dad [ C ] = i ; if ( L !== - 1 ) { dad [ L ] = dad [ i ] ; q . push ( L ) } if ( R !== - 1 ) { dad [ R ] = dad [ i ] ; q . push ( R ) } } for ( i = 1 ; i !== pl ; ++ i ) if ( dad [ i ] === i ) { if ( R !== - 1 && dad [ R ] !== R ) dad [ i ] = dad [ R ] ; else if ( L !== - 1 && dad [ L ] !== L ) dad [ i ] = dad [ L ] } for ( i = 1 ; i < pl ; ++ i ) { if ( FI [ i ] . type === 0 ) continue ; j = dad [ i ] ; if ( j === 0 ) FP [ i ] = FP [ 0 ] + "/" + FP [ i ] ; else while ( j !== 0 ) { FP [ i ] = FP [ j ] + "/" + FP [ i ] ; j = dad [ j ] } dad [ i ] = 0 } FP [ 0 ] += "/" ; for ( i = 1 ; i < pl ; ++ i ) { if ( FI [ i ] . type !== 2 ) FP [ i ] += "/" ; FPD [ FP [ i ] ] = FI [ i ] } } function make _find _path ( FullPaths , Paths , FileIndex , files , root _name ) { var UCFullPaths = new Array ( FullPaths . length ) ; var UCPaths = new Array ( Paths . length ) , i ; for ( i = 0 ; i < FullPaths . length ; ++ i ) UCFullPaths [ i ] = FullPaths [ i ] . toUpperCase ( ) . replace ( chr0 , "" ) . replace ( chr1 , "!" ) ; for ( i = 0 ; i < Paths . length ; ++ i ) UCPaths [ i ] = Paths [ i ] . toUpperCase ( ) . replace ( chr0 , "" ) . replace ( chr1 , "!" ) ; return function find _path ( path ) { var k ; if ( path . charCodeAt ( 0 ) === 47 ) { k = true ; path = root _name + path } else k = path . indexOf ( "/" ) !== - 1 ; var UCPath = path . toUpperCase ( ) . replace ( chr0 , "" ) . replace ( chr1 , "!" ) ; var w = k === true ? UCFullPaths . indexOf ( UCPath ) : UCPaths . indexOf ( UCPath ) ; if ( w === - 1 ) return null ; return k === true ? FileIndex [ w ] : files [ Paths [ w ] ] } } function sleuth _fat ( idx , cnt , sectors , ssz , fat _addrs ) { var q ; if ( idx === ENDOFCHAIN ) { if ( cnt !== 0 ) throw new Error ( "DIFAT chain shorter than expected" ) } else if ( idx !== - 1 ) { var sector = sectors [ idx ] , m = ( ssz >>> 2 ) - 1 ; if ( ! sector ) return ; for ( var i = 0 ; i < m ; ++ i ) { if ( ( q = _ _readInt32LE ( sector , i * 4 ) ) === ENDOFCHAIN ) break ; fat _addrs . push ( q ) } sleuth _fat ( _ _readInt32LE ( sector , ssz - 4 ) , cnt - 1 , sectors , ssz , fat _addrs ) } } function get _sector _list ( sectors , start , fat _addrs , ssz , chkd ) { var sl = sectors . length ; var buf , buf _chain ; if ( ! chkd ) chkd = new Array ( sl ) ; var modulus = ssz - 1 , j , jj ; buf = [ ] ; buf _chain = [ ] ; for ( j = start ; j >= 0 ; ) { chkd [ j ] = true ; buf [ buf . length ] = j ; buf _chain . push ( sectors [ j ] ) ; var addr = fat _addrs [ Math . floor ( j * 4 / ssz ) ] ; jj = j * 4 & modulus ; if ( ssz < 4 + jj ) throw new Error ( "FAT boundary crossed: " + j + " 4 " + ssz ) ; if ( ! sectors [ addr ] ) break ; j = _ _readInt32LE ( sectors [ addr ] , jj ) } return { nodes : buf , data : _ _toBuffer ( [ buf _chain ] ) } } function make _sector _list ( sectors , dir _start , fat _addrs , ssz ) { var sl = sectors . length , sector _list = new Array ( sl ) ; var chkd = new Array ( sl ) , buf , buf _chain ; var modulus = ssz - 1 , i , j , k , jj ; for ( i = 0 ; i < sl ; ++ i ) { buf = [ ] ; k = i + dir _start ; if ( k >= sl ) k -= sl ; if ( chkd [ k ] === true ) continue ; buf _chain = [ ] ; for ( j = k ; j >= 0 ; ) { chkd [ j ] = true ; buf [ buf . length ] = j ; buf _chain . push ( sectors [ j ] ) ; var addr = fat _addrs [ Math . floor ( j * 4 / ssz ) ] ; jj = j * 4 & modulus ; if ( ssz < 4 + jj ) throw new Error ( "FAT boundary crossed: " + j + " 4 " + ssz ) ; if ( ! sectors [ addr ] ) break ; j = _ _readInt32LE ( sectors [ addr ] , jj ) } sector _list [ k ] = { nodes : buf , data : _ _toBuffer ( [ buf _chain ] ) } } return sector _list } function read _directory ( dir _start , sector _list , sectors , Paths , nmfs , files , FileIndex ) { var blob ; var minifat _store = 0 , pl = Paths . length ? 2 : 0 ; var sector = sector _list [ dir _start ] . data ; var i = 0 , namelen = 0 , name , o , ctime , mtime ; for ( ; i < sector . length ; i += 128 ) { blob = sector . slice ( i , i + 128 ) ; prep _blob ( blob , 64 ) ; namelen = blob . read _shift ( 2 ) ; if ( namelen === 0 ) continue ; name = _ _utf16le ( blob , 0 , namelen - pl ) ; Paths . push ( name ) ; o = { name : name , type : blob . read _shift ( 1 ) , color : blob . read _shift ( 1 ) , L : blob . read _shift ( 4 , "i" ) , R : blob . read _shift ( 4 , "i" ) , C : blob . read _shift ( 4 , "i" ) , clsid : blob . read _shift ( 16 ) , state : blob . read _shift ( 4 , "i" ) } ; ctime = blob . read _shift ( 2 ) + blob . read _shift ( 2 ) + blob . read _shift ( 2 ) + blob . read _shift (
ws [ R ] [ C ] = cell } else { var cell _ref = encode _cell ( { c : C , r : R } ) ; ws [ cell _ref ] = cell } } } if ( range . s . c < 1e7 ) ws [ "!ref" ] = encode _range ( range ) ; return ws } function write _UInt32LE ( x , o ) { if ( ! o ) o = new _buf ( 4 ) ; o . write _shift ( 4 , x ) ; return o } function parse _XLWideString ( data ) { var cchCharacters = data . read _shift ( 4 ) ; return cchCharacters === 0 ? "" : data . read _shift ( cchCharacters , "dbcs" ) } function write _XLWideString ( data , o ) { var _null = false ; if ( o == null ) { _null = true ; o = new _buf ( 4 + 2 * data . length ) } o . write _shift ( 4 , data . length ) ; if ( data . length > 0 ) o . write _shift ( 0 , data , "dbcs" ) ; return _null ? o . slice ( 0 , o . l ) : o } function parse _StrRun ( data , length ) { return { ich : data . read _shift ( 2 ) , ifnt : data . read _shift ( 2 ) } } function write _StrRun ( run , o ) { if ( ! o ) o = new _buf ( 4 ) ; o . write _shift ( 2 , run . ich || 0 ) ; o . write _shift ( 2 , run . ifnt || 0 ) ; return o } 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 = [ { ich : 0 , ifnt : 0 } ] ; data . l = start + length ; return z } function write _RichStr ( str , o ) { var _null = false ; if ( o == null ) { _null = true ; o = new _buf ( 15 + 4 * str . t . length ) } o . write _shift ( 1 , 0 ) ; write _XLWideString ( str . t , o ) ; return _null ? o . slice ( 0 , o . l ) : o } var parse _BrtCommentText = parse _RichStr ; function write _BrtCommentText ( str , o ) { var _null = false ; if ( o == null ) { _null = true ; o = new _buf ( 23 + 4 * str . t . length ) } o . write _shift ( 1 , 1 ) ; write _XLWideString ( str . t , o ) ; o . write _shift ( 4 , 1 ) ; write _StrRun ( { ich : 0 , ifnt : 0 } , o ) ; return _null ? o . slice ( 0 , o . l ) : o } function parse _XLSBCell ( data ) { var col = data . read _shift ( 4 ) ; var iStyleRef = data . read _shift ( 2 ) ; iStyleRef += data . read _shift ( 1 ) << 16 ; var fPhShow = data . read _shift ( 1 ) ; return { c : col , iStyleRef : iStyleRef } } function write _XLSBCell ( cell , o ) { if ( o == null ) o = new _buf ( 8 ) ; o . write _shift ( - 4 , cell . c ) ; o . write _shift ( 3 , cell . iStyleRef || cell . s ) ; o . write _shift ( 1 , 0 ) ; return o } var parse _XLSBCodeName = parse _XLWideString ; var write _XLSBCodeName = write _XLWideString ; function parse _XLNullableWideString ( data ) { var cchCharacters = data . read _shift ( 4 ) ; return cchCharacters === 0 || cchCharacters === 4294967295 ? "" : data . read _shift ( cchCharacters , "dbcs" ) } function write _XLNullableWideString ( data , o ) { var _null = false ; if ( o == null ) { _null = true ; o = new _buf ( 127 ) } o . write _shift ( 4 , data . length > 0 ? data . length : 4294967295 ) ; if ( data . length > 0 ) o . write _shift ( 0 , data , "dbcs" ) ; return _null ? o . slice ( 0 , o . l ) : o } var parse _XLNameWideString = parse _XLWideString ; var write _XLNameWideString = write _XLWideString ; var parse _RelID = parse _XLNullableWideString ; var write _RelID = write _XLNullableWideString ; function parse _RkNumber ( data ) { var b = data . slice ( data . l , data . l + 4 ) ; var fX100 = b [ 0 ] & 1 , fInt = b [ 0 ] & 2 ; data . l += 4 ; b [ 0 ] &= 252 ; var RK = fInt === 0 ? _ _double ( [ 0 , 0 , 0 , 0 , b [ 0 ] , b [ 1 ] , b [ 2 ] , b [ 3 ] ] , 0 ) : _ _readInt32LE ( b , 0 ) >> 2 ; return fX100 ? RK / 100 : RK } function write _RkNumber ( data , o ) { if ( o == null ) o = new _buf ( 4 ) ; var fX100 = 0 , fInt = 0 , d100 = data * 100 ; if ( data == ( data | 0 ) && data >= - ( 1 << 29 ) && data < 1 << 29 ) { fInt = 1 } else if ( d100 == ( d100 | 0 ) && d100 >= - ( 1 << 29 ) && d100 < 1 << 29 ) { fInt = 1 ; fX100 = 1 } if ( fInt ) o . write _shift ( - 4 , ( ( fX100 ? d100 : data ) << 2 ) + ( fX100 + 2 ) ) ; else throw new Error ( "unsupported RkNumber " + data ) } function parse _RfX ( data ) { var cell = { s : { } , e : { } } ; cell . s . r = data . read _shift ( 4 ) ; cell . e . r = data . read _shift ( 4 ) ; cell . s . c = data . read _shift ( 4 ) ; cell . e . c = data . read _shift ( 4 ) ; return cell } function write _RfX ( r , o ) { if ( ! o ) o = new _buf ( 16 ) ; o . write _shift ( 4 , r . s . r ) ; o . write _shift ( 4 , r . e . r ) ; o . write _shift ( 4 , r . s . c ) ; o . write _shift ( 4 , r . e . c ) ; return o } var parse _UncheckedRfX = parse _RfX ; var write _UncheckedRfX = write _RfX ; function parse _Xnum ( data , length ) { return data . read _shift ( 8 , "f" ) } function write _Xnum ( data , o ) { return ( o || new _buf ( 8 ) ) . write _shift ( 8 , data , "f" ) } var BErr = { 0 : "#NULL!" , 7 : "#DIV/0!" , 15 : "#VALUE!" , 23 : "#REF!" , 29 : "#NAME?" , 36 : "#NUM!" , 42 : "#N/A" , 43 : "#GETTING_DATA" , 255 : "#WTF?" } ; var RBErr = evert _num ( BErr ) ; function parse _BrtColor ( data , length ) { var out = { } ; var d = data . read _shift ( 1 ) ; var fValidRGB = d & 1 ; var xColorType = d >>> 1 ; var index = data . read _shift ( 1 ) ; var nTS = data . read _shift ( 2 , "i" ) ; var bR = data . read _shift ( 1 ) ; var bG = data . read _shift ( 1 ) ; var bB = data . read _shift ( 1 ) ; var bAlpha = data . read _shift ( 1 ) ; switch ( xColorType ) { case 0 : out . auto = 1 ; break ; case 1 : out . index = index ; v
switch ( type === VT _VARIANT ? t : type ) { case 2 : ret = blob . read _shift ( 2 , "i" ) ; if ( ! opts . raw ) blob . l += 2 ; return ret ; case 3 : ret = blob . read _shift ( 4 , "i" ) ; return ret ; case 11 : return blob . read _shift ( 4 ) !== 0 ; case 19 : ret = blob . read _shift ( 4 ) ; return ret ; case 30 : return parse _lpstr ( blob , t , 4 ) . replace ( chr0 , "" ) ; case 31 : return parse _lpwstr ( blob ) ; case 64 : return parse _FILETIME ( blob ) ; case 65 : return parse _BLOB ( blob ) ; case 71 : return parse _ClipboardData ( blob ) ; case 80 : return parse _VtString ( blob , t , ! opts . raw && 4 ) . replace ( chr0 , "" ) ; case 81 : return parse _VtUnalignedString ( blob , t , 4 ) . replace ( chr0 , "" ) ; case 4108 : return parse _VtVecHeadingPair ( blob ) ; case 4126 : return parse _VtVecUnalignedLpstr ( blob ) ; default : throw new Error ( "TypedPropertyValue unrecognized type " + type + " " + t ) } } function parse _PropertySet ( blob , PIDSI ) { var start _addr = blob . l ; var size = blob . read _shift ( 4 ) ; var NumProps = blob . read _shift ( 4 ) ; var Props = [ ] , i = 0 ; var CodePage = 0 ; var Dictionary = - 1 , DictObj = { } ; for ( i = 0 ; i != NumProps ; ++ i ) { var PropID = blob . read _shift ( 4 ) ; var Offset = blob . read _shift ( 4 ) ; Props [ i ] = [ PropID , Offset + start _addr ] } var PropH = { } ; for ( i = 0 ; i != NumProps ; ++ i ) { if ( blob . l !== Props [ i ] [ 1 ] ) { var fail = true ; if ( i > 0 && PIDSI ) switch ( PIDSI [ Props [ i - 1 ] [ 0 ] ] . t ) { case 2 : if ( blob . l + 2 === Props [ i ] [ 1 ] ) { blob . l += 2 ; fail = false } break ; case 80 : if ( blob . l <= Props [ i ] [ 1 ] ) { blob . l = Props [ i ] [ 1 ] ; fail = false } break ; case 4108 : if ( blob . l <= Props [ i ] [ 1 ] ) { blob . l = Props [ i ] [ 1 ] ; fail = false } break } if ( ! PIDSI && blob . l <= Props [ i ] [ 1 ] ) { fail = false ; blob . l = Props [ i ] [ 1 ] } if ( fail ) throw new Error ( "Read Error: Expected address " + Props [ i ] [ 1 ] + " at " + blob . l + " :" + i ) } if ( PIDSI ) { var piddsi = PIDSI [ Props [ i ] [ 0 ] ] ; PropH [ piddsi . n ] = parse _TypedPropertyValue ( blob , piddsi . t , { raw : true } ) ; if ( piddsi . p === "version" ) PropH [ piddsi . n ] = String ( PropH [ piddsi . n ] >> 16 ) + "." + String ( PropH [ piddsi . n ] & 65535 ) ; if ( piddsi . n == "CodePage" ) switch ( PropH [ piddsi . n ] ) { case 0 : PropH [ piddsi . n ] = 1252 ; case 874 : case 932 : case 936 : case 949 : case 950 : case 1250 : case 1251 : case 1253 : case 1254 : case 1255 : case 1256 : case 1257 : case 1258 : case 1e4 : case 1200 : case 1201 : case 1252 : case 65e3 : case - 536 : case 65001 : case - 535 : set _cp ( CodePage = PropH [ piddsi . n ] ) ; break ; default : throw new Error ( "Unsupported CodePage: " + PropH [ piddsi . n ] ) } } else { if ( Props [ i ] [ 0 ] === 1 ) { CodePage = PropH . CodePage = parse _TypedPropertyValue ( blob , VT _I2 ) ; set _cp ( CodePage ) ; if ( Dictionary !== - 1 ) { var oldpos = blob . l ; blob . l = Props [ Dictionary ] [ 1 ] ; DictObj = parse _dictionary ( blob , CodePage ) ; blob . l = oldpos } } else if ( Props [ i ] [ 0 ] === 0 ) { if ( CodePage === 0 ) { Dictionary = i ; blob . l = Props [ i + 1 ] [ 1 ] ; continue } DictObj = parse _dictionary ( blob , CodePage ) } else { var name = DictObj [ Props [ i ] [ 0 ] ] ; var val ; switch ( blob [ blob . l ] ) { case 65 : blob . l += 4 ; val = parse _BLOB ( blob ) ; break ; case 30 : blob . l += 4 ; val = parse _VtString ( blob , blob [ blob . l - 4 ] ) ; break ; case 31 : blob . l += 4 ; val = parse _VtString ( blob , blob [ blob . l - 4 ] ) ; break ; case 3 : blob . l += 4 ; val = blob . read _shift ( 4 , "i" ) ; break ; case 19 : blob . l += 4 ; val = blob . read _shift ( 4 ) ; break ; case 5 : blob . l += 4 ; val = blob . read _shift ( 8 , "f" ) ; break ; case 11 : blob . l += 4 ; val = parsebool ( blob , 4 ) ; break ; case 64 : blob . l += 4 ; val = parseDate ( parse _FILETIME ( blob ) ) ; break ; default : throw new Error ( "unparsed value: " + blob [ blob . l ] ) } PropH [ name ] = val } } } blob . l = start _addr + size ; return PropH } function parse _PropertySetStream ( file , PIDSI ) { var blob = file . content ; prep _blob ( blob , 0 ) ; var NumSets , FMTID0 , FMTID1 , Offset0 , Offset1 = 0 ; blob . chk ( "feff" , "Byte Order: " ) ; var vers = blob . read _shift ( 2 ) ; var SystemIdentifier = blob . read _shift ( 4 ) ; blob . chk ( CFB . utils . consts . HEADER _CLSID , "CLSID: " ) ; NumSets = blob . read _shift ( 4 ) ; if ( NumSets !== 1 && NumSets !== 2 ) throw new Error ( "Unrecognized #Sets: " + NumSets ) ; FMTID0 = blob . read _shift ( 16 ) ; Offset0 = blob . read _shift ( 4 ) ; if ( NumSets === 1 && Offset0 !== blob . l ) throw new Error ( "Length mismatch: " + Offset0 + " !== " + blob . l ) ; else if ( NumSets === 2 ) { FMTID1 = blob . read _shift ( 16 ) ; Offset1 = blob . read _shift ( 4 ) } var PSet0 = parse _PropertySet ( blob , PIDSI ) ; var rval = { SystemIdentifier : SystemIdentifier } ; for ( var y in PSet0 ) rval [ y ] = PSet0 [ y ] ; rval . FMTID = FMTID0 ; if ( NumSets === 1 ) return rval ; if ( blob . l !== Offset1 ) throw new Error ( "Length mismatch 2: " + blob . l + " !== " + Offset1 ) ; var PSet1 ; try { PSet1 = parse _PropertySet ( blob , null ) } catch ( e ) { } for ( y in PSet1 ) rval [ y ] = PSet1 [ y ] ; rval . FMTID = [ FMTID0 , FMTID1 ] ; return rval } function parsenoop2 ( blob , length ) { blob . read _shift ( length ) ; return
var parse _Chart3DBarShape = parsenoop ; var parse _Fbi = parsenoop ; var parse _BopPop = parsenoop ; var parse _AxcExt = parsenoop ; var parse _Dat = parsenoop ; var parse _PlotGrowth = parsenoop ; var parse _SIIndex = parsenoop ; var parse _GelFrame = parsenoop ; var parse _BopPopCustom = parsenoop ; var parse _Fbi2 = parsenoop ; function parse _ImData ( blob , length , opts ) { var tgt = blob . l + length ; var cf = blob . read _shift ( 2 ) ; var env = blob . read _shift ( 2 ) ; var lcb = blob . read _shift ( 4 ) ; var o = { fmt : cf , env : env , len : lcb , data : blob . slice ( blob . l , blob . l + lcb ) } ; blob . l += lcb ; return o } function parse _BIFF5String ( blob ) { var len = blob . read _shift ( 1 ) ; return blob . read _shift ( len , "sbcs-cont" ) } function parse _BIFF2STR ( blob , length , opts ) { var cell = parse _XLSCell ( blob , 6 ) ; ++ blob . l ; var str = parse _XLUnicodeString2 ( blob , length - 7 , opts ) ; cell . t = "str" ; cell . val = str ; return cell } function parse _BIFF2NUM ( blob , length , opts ) { var cell = parse _XLSCell ( blob , 6 ) ; ++ blob . l ; var num = parse _Xnum ( blob , 8 ) ; cell . t = "n" ; cell . val = num ; return cell } function parse _BIFF2INT ( blob , length ) { var cell = parse _XLSCell ( blob , 6 ) ; ++ blob . l ; var num = blob . read _shift ( 2 ) ; cell . t = "n" ; cell . val = num ; return cell } function parse _BIFF2STRING ( blob , length ) { var cch = blob . read _shift ( 1 ) ; if ( cch === 0 ) { blob . l ++ ; return "" } return blob . read _shift ( cch , "sbcs-cont" ) } function parse _BIFF2FONTXTRA ( blob , length ) { blob . l += 6 ; blob . l += 2 ; blob . l += 1 ; blob . l += 3 ; blob . l += 1 ; blob . l += length - 13 } function parse _RString ( blob , length , opts ) { var end = blob . l + length ; var cell = parse _XLSCell ( blob , 6 ) ; var cch = blob . read _shift ( 2 ) ; var str = parse _XLUnicodeStringNoCch ( blob , cch , opts ) ; blob . l = end ; cell . t = "str" ; cell . val = str ; return cell } var DBF = function ( ) { var dbf _codepage _map = { 1 : 437 , 2 : 850 , 3 : 1252 , 4 : 1e4 , 100 : 852 , 101 : 866 , 102 : 865 , 103 : 861 , 104 : 895 , 105 : 620 , 106 : 737 , 107 : 857 , 120 : 950 , 121 : 949 , 122 : 936 , 123 : 932 , 124 : 874 , 125 : 1255 , 126 : 1256 , 150 : 10007 , 151 : 10029 , 152 : 10006 , 200 : 1250 , 201 : 1251 , 202 : 1254 , 203 : 1253 , 0 : 20127 , 8 : 865 , 9 : 437 , 10 : 850 , 11 : 437 , 13 : 437 , 14 : 850 , 15 : 437 , 16 : 850 , 17 : 437 , 18 : 850 , 19 : 932 , 20 : 850 , 21 : 437 , 22 : 850 , 23 : 865 , 24 : 437 , 25 : 437 , 26 : 850 , 27 : 437 , 28 : 863 , 29 : 850 , 31 : 852 , 34 : 852 , 35 : 852 , 36 : 860 , 37 : 850 , 38 : 866 , 55 : 850 , 64 : 852 , 77 : 936 , 78 : 949 , 79 : 950 , 80 : 874 , 87 : 1252 , 88 : 1252 , 89 : 1252 , 255 : 16969 } ; function dbf _to _aoa ( buf , opts ) { var out = [ ] ; var d = new _raw _buf ( 1 ) ; switch ( opts . type ) { case "base64" : d = s2a ( Base64 . decode ( buf ) ) ; break ; case "binary" : d = s2a ( buf ) ; break ; case "buffer" : case "array" : d = buf ; break } prep _blob ( d , 0 ) ; var ft = d . read _shift ( 1 ) ; var memo = false ; var vfp = false ; switch ( ft ) { case 2 : case 3 : break ; case 48 : vfp = true ; memo = true ; break ; case 49 : vfp = true ; break ; case 131 : memo = true ; break ; case 139 : memo = true ; break ; case 245 : memo = true ; break ; default : throw new Error ( "DBF Unsupported Version: " + ft . toString ( 16 ) ) } var filedate = new Date , nrow = 0 , fpos = 0 ; if ( ft == 2 ) nrow = d . read _shift ( 2 ) ; filedate = new Date ( d . read _shift ( 1 ) + 1900 , d . read _shift ( 1 ) - 1 , d . read _shift ( 1 ) ) ; if ( ft != 2 ) nrow = d . read _shift ( 4 ) ; if ( ft != 2 ) fpos = d . read _shift ( 2 ) ; var rlen = d . read _shift ( 2 ) ; var flags = 0 , current _cp = 1252 ; if ( ft != 2 ) { d . l += 16 ; flags = d . read _shift ( 1 ) ; if ( d [ d . l ] !== 0 ) current _cp = dbf _codepage _map [ d [ d . l ] ] ; d . l += 1 ; d . l += 2 } var fields = [ ] , field = { } ; var hend = fpos - 10 - ( vfp ? 264 : 0 ) ; while ( ft == 2 ? d . l < d . length && d [ d . l ] != 13 : d . l < hend ) { field = { } ; field . name = cptable . utils . decode ( current _cp , d . slice ( d . l , d . l + 10 ) ) . replace ( /[\u0000\r\n].*$/g , "" ) ; d . l += 11 ; field . type = String . fromCharCode ( d . read _shift ( 1 ) ) ; if ( ft != 2 ) field . offset = d . read _shift ( 4 ) ; field . len = d . read _shift ( 1 ) ; if ( ft == 2 ) field . offset = d . read _shift ( 2 ) ; field . dec = d . read _shift ( 1 ) ; if ( field . name . length ) fields . push ( field ) ; if ( ft != 2 ) d . l += 14 ; switch ( field . type ) { case "C" : break ; case "D" : break ; case "F" : break ; case "I" : break ; case "L" : break ; case "M" : break ; case "N" : break ; case "T" : break ; case "Y" : break ; case "0" : break ; case "+" : break ; case "@" : break ; default : throw new Error ( "Unknown Field Type: " + field . type ) } } if ( d [ d . l ] !== 13 ) d . l = fpos - 1 ; else if ( ft == 2 ) d . l = 521 ; if ( ft != 2 ) { if ( d . read _shift ( 1 ) !== 13 ) throw new Error ( "DBF Terminator not found " + d . l + " " + d [ d . l ] ) ; d . l = fpos } var R = 0 , C = 0 ; out [ 0 ] = [ ] ; for ( C = 0 ; C != fields . length ; ++ C ) out [ 0 ] [ C ] = fields [ C ] . name ; while ( nrow -- > 0 ) { if ( d [ d . l ] === 42 ) { d . l += rlen ; continue } ++ d . l ; out [ ++ R ] = [ ] ; C = 0 ; for ( C = 0 ; C != fields . length ; ++ C ) { var dd = d . slice ( d . l , d . l + fields [ C ] . len ) ; d . l += fields [ C ] . len ; prep _blob ( dd , 0 ) ; var s = cptable . utils . decode ( current _cp , dd ) ; switch ( fields [ C ] . type ) { case "C" : out [ R ] [ C ] = cptable .
length -= sz ; o . EncryptionVerifier = parse _EncryptionVerifier ( blob , length ) ; return o } function parse _RC4Header ( blob , length ) { var o = { } ; var vers = o . EncryptionVersionInfo = parse _CRYPTOVersion ( blob , 4 ) ; length -= 4 ; if ( vers . Major != 1 || vers . Minor != 1 ) throw "unrecognized version code " + vers . Major + " : " + vers . Minor ; o . Salt = blob . read _shift ( 16 ) ; o . EncryptedVerifier = blob . read _shift ( 16 ) ; o . EncryptedVerifierHash = blob . read _shift ( 16 ) ; return o } function crypto _CreatePasswordVerifier _Method1 ( Password ) { var Verifier = 0 , PasswordArray ; var PasswordDecoded = _JS2ANSI ( Password ) ; var len = PasswordDecoded . length + 1 , i , PasswordByte ; var Intermediate1 , Intermediate2 , Intermediate3 ; PasswordArray = new _raw _buf ( len ) ; PasswordArray [ 0 ] = PasswordDecoded . length ; for ( i = 1 ; i != len ; ++ i ) PasswordArray [ i ] = PasswordDecoded [ i - 1 ] ; for ( i = len - 1 ; i >= 0 ; -- i ) { PasswordByte = PasswordArray [ i ] ; Intermediate1 = ( Verifier & 16384 ) === 0 ? 0 : 1 ; Intermediate2 = Verifier << 1 & 32767 ; Intermediate3 = Intermediate1 | Intermediate2 ; Verifier = Intermediate3 ^ PasswordByte } return Verifier ^ 52811 } var crypto _CreateXorArray _Method1 = function ( ) { var PadArray = [ 187 , 255 , 255 , 186 , 255 , 255 , 185 , 128 , 0 , 190 , 15 , 0 , 191 , 15 , 0 ] ; var InitialCode = [ 57840 , 7439 , 52380 , 33984 , 4364 , 3600 , 61902 , 12606 , 6258 , 57657 , 54287 , 34041 , 10252 , 43370 , 20163 ] ; var XorMatrix = [ 44796 , 19929 , 39858 , 10053 , 20106 , 40212 , 10761 , 31585 , 63170 , 64933 , 60267 , 50935 , 40399 , 11199 , 17763 , 35526 , 1453 , 2906 , 5812 , 11624 , 23248 , 885 , 1770 , 3540 , 7080 , 14160 , 28320 , 56640 , 55369 , 41139 , 20807 , 41614 , 21821 , 43642 , 17621 , 28485 , 56970 , 44341 , 19019 , 38038 , 14605 , 29210 , 60195 , 50791 , 40175 , 10751 , 21502 , 43004 , 24537 , 18387 , 36774 , 3949 , 7898 , 15796 , 31592 , 63184 , 47201 , 24803 , 49606 , 37805 , 14203 , 28406 , 56812 , 17824 , 35648 , 1697 , 3394 , 6788 , 13576 , 27152 , 43601 , 17539 , 35078 , 557 , 1114 , 2228 , 4456 , 30388 , 60776 , 51953 , 34243 , 7079 , 14158 , 28316 , 14128 , 28256 , 56512 , 43425 , 17251 , 34502 , 7597 , 13105 , 26210 , 52420 , 35241 , 883 , 1766 , 3532 , 4129 , 8258 , 16516 , 33032 , 4657 , 9314 , 18628 ] ; 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 ( "" , 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 =
o [ o . length ] = '<a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="38000"/></a:srgbClr></a:outerShdw>' ; o [ o . length ] = "</a:effectLst>" ; o [ o . length ] = "</a:effectStyle>" ; o [ o . length ] = "<a:effectStyle>" ; o [ o . length ] = "<a:effectLst>" ; o [ o . length ] = '<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>' ; o [ o . length ] = "</a:effectLst>" ; o [ o . length ] = "</a:effectStyle>" ; o [ o . length ] = "<a:effectStyle>" ; o [ o . length ] = "<a:effectLst>" ; o [ o . length ] = '<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>' ; o [ o . length ] = "</a:effectLst>" ; o [ o . length ] = '<a:scene3d><a:camera prst="orthographicFront"><a:rot lat="0" lon="0" rev="0"/></a:camera><a:lightRig rig="threePt" dir="t"><a:rot lat="0" lon="0" rev="1200000"/></a:lightRig></a:scene3d>' ; o [ o . length ] = '<a:sp3d><a:bevelT w="63500" h="25400"/></a:sp3d>' ; o [ o . length ] = "</a:effectStyle>" ; o [ o . length ] = "</a:effectStyleLst>" ; o [ o . length ] = "<a:bgFillStyleLst>" ; o [ o . length ] = '<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>' ; o [ o . length ] = '<a:gradFill rotWithShape="1">' ; o [ o . length ] = "<a:gsLst>" ; o [ o . length ] = '<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs>' ; o [ o . length ] = '<a:gs pos="40000"><a:schemeClr val="phClr"><a:tint val="45000"/><a:shade val="99000"/><a:satMod val="350000"/></a:schemeClr></a:gs>' ; o [ o . length ] = '<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs>' ; o [ o . length ] = "</a:gsLst>" ; o [ o . length ] = '<a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path>' ; o [ o . length ] = "</a:gradFill>" ; o [ o . length ] = '<a:gradFill rotWithShape="1">' ; o [ o . length ] = "<a:gsLst>" ; o [ o . length ] = '<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs>' ; o [ o . length ] = '<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs>' ; o [ o . length ] = "</a:gsLst>" ; o [ o . length ] = '<a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path>' ; o [ o . length ] = "</a:gradFill>" ; o [ o . length ] = "</a:bgFillStyleLst>" ; o [ o . length ] = "</a:fmtScheme>" ; o [ o . length ] = "</a:themeElements>" ; o [ o . length ] = "<a:objectDefaults>" ; o [ o . length ] = "<a:spDef>" ; o [ o . length ] = '<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="1"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="3"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="2"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="lt1"/></a:fontRef></a:style>' ; o [ o . length ] = "</a:spDef>" ; o [ o . length ] = "<a:lnDef>" ; o [ o . length ] = '<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="2"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="0"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="1"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="tx1"/></a:fontRef></a:style>' ; o [ o . length ] = "</a:lnDef>" ; o [ o . length ] = "</a:objectDefaults>" ; o [ o . length ] = "<a:extraClrSchemeLst/>" ; o [ o . length ] = "</a:theme>" ; return o . join ( "" ) } function parse _Theme ( blob , length , opts ) { var dwThemeVersion = blob . read _shift ( 4 ) ; if ( dwThemeVersion === 124226 ) return ; blob . l += length - 4 } function parse _ColorTheme ( blob , length ) { return blob . read _shift ( 4 ) } function parse _FullColorExt ( blob , length ) { var o = { } ; o . xclrType = blob . read _shift ( 2 ) ; o . nTintShade = blob . read _shift ( 2 ) ; switch ( o . xclrType ) { case 0 : blob . l += 4 ; break ; case 1 : o . xclrValue = parse _IcvXF ( blob , 4 ) ; break ; case 2 : o . xclrValue = parse _LongRGBA ( blob , 4 ) ; break ; case 3 : o . xclrValue = parse _ColorTheme ( blob , 4 ) ; break ; case 4 : blob . l += 4 ; break } blob . l += 8 ; return o } function parse _IcvXF ( blob , length ) { return parsenoop ( blob , length ) } function parse _XFExtGradient ( blob , length ) { return parsenoop ( blob , length ) } function parse _ExtProp ( blob , length ) { var extType = blob . read _shift ( 2 ) ; var cb = blob . read _shift ( 2 ) ; var o = [ extType ] ; switch ( extType ) { case 4 : case 5 : case 7 : case 8 : case 9 : case 10 : case 11 : case 13 : o [ 1 ] = parse _FullColorExt ( blob , cb ) ; brea
} } else o = supbooks . SheetNames [ nameidx - 1 ] + "!" ; if ( supbooks [ bookidx ] && supbooks [ bookidx ] [ nameidx ] ) o += supbooks [ bookidx ] [ nameidx ] . Name ; else if ( supbooks [ 0 ] && supbooks [ 0 ] [ nameidx ] ) o += supbooks [ 0 ] [ nameidx ] . Name ; else o += "??NAMEX??" ; stack . push ( o ) ; break } if ( ! externbook ) externbook = { Name : "??NAMEX??" } ; stack . push ( externbook . Name ) ; break ; case "PtgParen" : var lp = "(" , rp = ")" ; if ( last _sp >= 0 ) { sp = "" ; switch ( formula [ 0 ] [ last _sp ] [ 1 ] [ 0 ] ) { case 2 : lp = fill ( " " , formula [ 0 ] [ last _sp ] [ 1 ] [ 1 ] ) + lp ; break ; case 3 : lp = fill ( "\r" , formula [ 0 ] [ last _sp ] [ 1 ] [ 1 ] ) + lp ; break ; case 4 : rp = fill ( " " , formula [ 0 ] [ last _sp ] [ 1 ] [ 1 ] ) + rp ; break ; case 5 : rp = fill ( "\r" , formula [ 0 ] [ last _sp ] [ 1 ] [ 1 ] ) + rp ; break ; default : if ( opts . WTF ) throw new Error ( "Unexpected PtgAttrSpaceType " + formula [ 0 ] [ last _sp ] [ 1 ] [ 0 ] ) } last _sp = - 1 } stack . push ( lp + stack . pop ( ) + rp ) ; break ; case "PtgRefErr" : stack . push ( "#REF!" ) ; break ; case "PtgRefErr3d" : stack . push ( "#REF!" ) ; break ; case "PtgExp" : c = { c : f [ 1 ] [ 1 ] , r : f [ 1 ] [ 0 ] } ; var q = { c : cell . c , r : cell . r } ; if ( supbooks . sharedf [ encode _cell ( c ) ] ) { var parsedf = supbooks . sharedf [ encode _cell ( c ) ] ; stack . push ( stringify _formula ( parsedf , _range , q , supbooks , opts ) ) } else { var fnd = false ; for ( e1 = 0 ; e1 != supbooks . arrayf . length ; ++ e1 ) { e2 = supbooks . arrayf [ e1 ] ; if ( c . c < e2 [ 0 ] . s . c || c . c > e2 [ 0 ] . e . c ) continue ; if ( c . r < e2 [ 0 ] . s . r || c . r > e2 [ 0 ] . e . r ) continue ; stack . push ( stringify _formula ( e2 [ 1 ] , _range , q , supbooks , opts ) ) ; fnd = true ; break } if ( ! fnd ) stack . push ( f [ 1 ] ) } break ; case "PtgArray" : stack . push ( "{" + stringify _array ( f [ 1 ] ) + "}" ) ; break ; case "PtgMemArea" : break ; case "PtgAttrSpace" : case "PtgAttrSpaceSemi" : last _sp = ff ; break ; case "PtgTbl" : break ; case "PtgMemErr" : break ; case "PtgMissArg" : stack . push ( "" ) ; break ; case "PtgAreaErr" : stack . push ( "#REF!" ) ; break ; case "PtgAreaErr3d" : stack . push ( "#REF!" ) ; break ; case "PtgMemFunc" : break ; default : throw new Error ( "Unrecognized Formula Token: " + String ( f ) ) } var PtgNonDisp = [ "PtgAttrSpace" , "PtgAttrSpaceSemi" , "PtgAttrGoto" ] ; if ( last _sp >= 0 && PtgNonDisp . indexOf ( formula [ 0 ] [ ff ] [ 0 ] ) == - 1 ) { f = formula [ 0 ] [ last _sp ] ; var _left = true ; switch ( f [ 1 ] [ 0 ] ) { case 4 : _left = false ; case 0 : sp = fill ( " " , f [ 1 ] [ 1 ] ) ; break ; case 5 : _left = false ; case 1 : sp = fill ( "\r" , f [ 1 ] [ 1 ] ) ; break ; default : sp = "" ; if ( opts . WTF ) throw new Error ( "Unexpected PtgAttrSpaceType " + f [ 1 ] [ 0 ] ) } stack . push ( ( _left ? sp : "" ) + stack . pop ( ) + ( _left ? "" : sp ) ) ; last _sp = - 1 } } if ( stack . length > 1 && opts . WTF ) throw new Error ( "bad formula stack" ) ; return stack [ 0 ] } function parse _XLSBParsedFormula ( data , length , opts ) { var end = data . l + length ; var cce = data . read _shift ( 4 ) ; var rgce = parse _Rgce ( data , cce , opts ) ; var cb = data . read _shift ( 4 ) ; var rgcb = cb > 0 ? parse _RgbExtra ( data , cb , rgce , opts ) : null ; return [ rgce , rgcb ] } var parse _XLSBArrayParsedFormula = parse _XLSBParsedFormula ; var parse _XLSBCellParsedFormula = parse _XLSBParsedFormula ; var parse _XLSBNameParsedFormula = parse _XLSBParsedFormula ; var parse _XLSBSharedParsedFormula = parse _XLSBParsedFormula ; var PtgDataType = { 1 : "REFERENCE" , 2 : "VALUE" , 3 : "ARRAY" } ; var Cetab = { 0 : "BEEP" , 1 : "OPEN" , 2 : "OPEN.LINKS" , 3 : "CLOSE.ALL" , 4 : "SAVE" , 5 : "SAVE.AS" , 6 : "FILE.DELETE" , 7 : "PAGE.SETUP" , 8 : "PRINT" , 9 : "PRINTER.SETUP" , 10 : "QUIT" , 11 : "NEW.WINDOW" , 12 : "ARRANGE.ALL" , 13 : "WINDOW.SIZE" , 14 : "WINDOW.MOVE" , 15 : "FULL" , 16 : "CLOSE" , 17 : "RUN" , 22 : "SET.PRINT.AREA" , 23 : "SET.PRINT.TITLES" , 24 : "SET.PAGE.BREAK" , 25 : "REMOVE.PAGE.BREAK" , 26 : "FONT" , 27 : "DISPLAY" , 28 : "PROTECT.DOCUMENT" , 29 : "PRECISION" , 30 : "A1.R1C1" , 31 : "CALCULATE.NOW" , 32 : "CALCULATION" , 34 : "DATA.FIND" , 35 : "EXTRACT" , 36 : "DATA.DELETE" , 37 : "SET.DATABASE" , 38 : "SET.CRITERIA" , 39 : "SORT" , 40 : "DATA.SERIES" , 41 : "TABLE" , 42 : "FORMAT.NUMBER" , 43 : "ALIGNMENT" , 44 : "STYLE" , 45 : "BORDER" , 46 : "CELL.PROTECTION" , 47 : "COLUMN.WIDTH" , 48 : "UNDO" , 49 : "CUT" , 50 : "COPY" , 51 : "PASTE" , 52 : "CLEAR" , 53 : "PASTE.SPECIAL" , 54 : "EDIT.DELETE" , 55 : "INSERT" , 56 : "FILL.RIGHT" , 57 : "FILL.DOWN" , 61 : "DEFINE.NAME" , 62 : "CREATE.NAMES" , 63 : "FORMULA.GOTO" , 64 : "FORMULA.FIND" , 65 : "SELECT.LAST.CELL" , 66 : "SHOW.ACTIVE.CELL" , 67 : "GALLERY.AREA" , 68 : "GALLERY.BAR" , 69 : "GALLERY.COLUMN" , 70 : "GALLERY.LINE" , 71 : "GALLERY.PIE" , 72 : "GALLERY.SCATTER" , 73 : "COMBINATION" , 74 : "PREFERRED" , 75 : "ADD.OVERLAY" , 76 : "GRIDLINES" , 77 : "SET.PREFERRED" , 78 : "AXES" , 79 : "LEGEND" , 80 : "ATTACH.TEXT" , 81 : "ADD.ARROW" , 82 : "SELECT.CHART" , 83 : "SELECT.PLOT.AREA" , 84 : "PATTERNS" , 85 : "MAIN.CHART" , 86 : "OVERLAY" , 87 : "SCALE" , 88 : "FORMAT.LEGEND" , 89 : "FORMAT.TEXT" , 90 : "EDIT.REPEAT" , 91 : "PARSE" , 92 : "JUSTIFY" , 93 : "HIDE" , 94 : "UNHIDE"
rowobj = { } ; rowrite = false ; if ( tag . ht ) { rowrite = true ; rowobj . hpt = parseFloat ( tag . ht ) ; rowobj . hpx = pt2px ( rowobj . hpt ) } if ( tag . hidden == "1" ) { rowrite = true ; rowobj . hidden = true } if ( rowrite ) rows [ tagr - 1 ] = rowobj } cells = x . substr ( ri ) . split ( cellregex ) ; for ( ri = 0 ; ri != cells . length ; ++ ri ) { x = cells [ ri ] . trim ( ) ; if ( x . length === 0 ) continue ; cref = x . match ( rregex ) ; idx = ri ; i = 0 ; cc = 0 ; x = "<c " + ( x . substr ( 0 , 1 ) == "<" ? ">" : "" ) + x ; if ( cref != null && cref . length === 2 ) { idx = 0 ; d = cref [ 1 ] ; for ( i = 0 ; i != d . length ; ++ i ) { if ( ( cc = d . charCodeAt ( i ) - 64 ) < 1 || cc > 26 ) break ; idx = 26 * idx + cc } -- idx ; tagc = idx } else ++ tagc ; for ( i = 0 ; i != x . length ; ++ i ) if ( x . charCodeAt ( i ) === 62 ) break ; ++ i ; tag = parsexmltag ( x . substr ( 0 , i ) , true ) ; if ( ! tag . r ) tag . r = encode _cell ( { r : tagr - 1 , c : tagc } ) ; d = x . substr ( i ) ; p = { t : "" } ; if ( ( cref = d . match ( match _v ) ) != null && cref [ 1 ] !== "" ) p . v = unescapexml ( cref [ 1 ] ) ; if ( opts . cellFormula ) { if ( ( cref = d . match ( match _f ) ) != null && cref [ 1 ] !== "" ) { p . f = unescapexml ( utf8read ( cref [ 1 ] ) ) . replace ( /_xlfn\./ , "" ) ; if ( cref [ 0 ] . indexOf ( 't="array"' ) > - 1 ) { p . F = ( d . match ( refregex ) || [ ] ) [ 1 ] ; if ( p . F . indexOf ( ":" ) > - 1 ) arrayf . push ( [ safe _decode _range ( p . F ) , p . F ] ) } else if ( cref [ 0 ] . indexOf ( 't="shared"' ) > - 1 ) { ftag = parsexmltag ( cref [ 0 ] ) ; sharedf [ parseInt ( ftag . si , 10 ) ] = [ ftag , unescapexml ( utf8read ( cref [ 1 ] ) ) ] } } else if ( cref = d . match ( /<f[^>]*\/>/ ) ) { ftag = parsexmltag ( cref [ 0 ] ) ; if ( sharedf [ ftag . si ] ) p . f = shift _formula _xlsx ( sharedf [ ftag . si ] [ 1 ] , sharedf [ ftag . si ] [ 0 ] . ref , tag . r ) } var _tag = decode _cell ( tag . r ) ; for ( i = 0 ; i < arrayf . length ; ++ i ) if ( _tag . r >= arrayf [ i ] [ 0 ] . s . r && _tag . r <= arrayf [ i ] [ 0 ] . e . r ) if ( _tag . c >= arrayf [ i ] [ 0 ] . s . c && _tag . c <= arrayf [ i ] [ 0 ] . e . c ) p . F = arrayf [ i ] [ 1 ] } if ( tag . t == null && p . v === undefined ) { if ( p . f || p . F ) { p . v = 0 ; p . t = "n" } else if ( ! opts . sheetStubs ) continue ; else p . t = "z" } else p . t = tag . t || "n" ; if ( guess . s . c > idx ) guess . s . c = idx ; if ( guess . e . c < idx ) guess . e . c = idx ; switch ( p . t ) { case "n" : p . v = parseFloat ( p . v ) ; break ; case "s" : sstr = strs [ parseInt ( p . v , 10 ) ] ; if ( typeof p . v == "undefined" ) { if ( ! opts . sheetStubs ) continue ; p . t = "z" } p . v = sstr . t ; p . r = sstr . r ; if ( opts . cellHTML ) p . h = sstr . h ; break ; case "str" : p . t = "s" ; p . v = p . v != null ? utf8read ( p . v ) : "" ; if ( opts . cellHTML ) p . h = escapehtml ( p . v ) ; break ; case "inlineStr" : cref = d . match ( isregex ) ; p . t = "s" ; if ( cref != null && ( sstr = parse _si ( cref [ 1 ] ) ) ) p . v = sstr . t ; else p . v = "" ; break ; case "b" : p . v = parsexmlbool ( p . v ) ; break ; case "d" : if ( ! opts . cellDates ) { p . v = datenum ( parseDate ( p . v ) ) ; p . t = "n" } break ; case "e" : if ( ! opts || opts . cellText !== false ) p . w = p . v ; p . v = RBErr [ p . v ] ; break } fmtid = fillid = 0 ; if ( do _format && tag . s !== undefined ) { cf = styles . CellXf [ tag . s ] ; if ( cf != null ) { if ( cf . numFmtId != null ) fmtid = cf . numFmtId ; if ( opts . cellStyles && cf . fillId != null ) fillid = cf . fillId } } safe _format ( p , fmtid , fillid , opts , themes , styles ) ; if ( opts . cellDates && do _format && p . t == "n" && SSF . is _date ( SSF . _table [ fmtid ] ) ) { var _d = SSF . parse _date _code ( p . v ) ; if ( _d ) { p . t = "d" ; p . v = new Date ( Date . UTC ( _d . y , _d . m - 1 , _d . d , _d . H , _d . M , _d . S , _d . u ) ) } } if ( dense ) { var _r = decode _cell ( tag . r ) ; if ( ! s [ _r . r ] ) s [ _r . r ] = [ ] ; s [ _r . r ] [ _r . c ] = p } else s [ tag . r ] = p } } if ( rows . length > 0 ) s [ "!rows" ] = rows } } ( ) ; function write _ws _xml _data ( ws , opts , idx , wb , rels ) { var o = [ ] , r = [ ] , range = safe _decode _range ( ws [ "!ref" ] ) , cell , ref , rr = "" , cols = [ ] , R = 0 , C = 0 , rows = ws [ "!rows" ] ; var dense = Array . isArray ( ws ) ; for ( C = range . s . c ; C <= range . e . c ; ++ C ) cols [ C ] = encode _col ( C ) ; for ( R = range . s . r ; R <= range . e . r ; ++ R ) { r = [ ] ; rr = encode _row ( R ) ; for ( C = range . s . c ; C <= range . e . c ; ++ C ) { ref = cols [ C ] + rr ; var _cell = dense ? ( ws [ R ] || [ ] ) [ C ] : ws [ ref ] ; if ( _cell === undefined ) continue ; if ( ( cell = write _ws _xml _cell ( _cell , ref , ws , opts , idx , wb ) ) != null ) r . push ( cell ) } if ( r . length > 0 ) { var params = { r : rr } ; if ( rows && rows [ R ] ) { var row = rows [ R ] ; if ( row . hidden ) params . hidden = 1 ; var height = - 1 ; if ( row . hpx ) height = px2pt ( row . hpx ) ; else if ( row . hpt ) height = row . hpt ; if ( height > - 1 ) { params . ht = height ; params . customHeight = 1 } } o [ o . length ] = writextag ( "row" , r . join ( "" ) , params ) } } return o . join ( "" ) } var WS _XML _ROOT = writextag ( "worksheet" , null , { xmlns : XMLNS . main [ 0 ] , "xmlns:r" : XMLNS . r } ) ; function write _ws _xml ( idx , opts , wb , rels ) { var o = [ XML _HEADER , WS _XML _ROOT ] ; var s = wb . SheetNames [ idx ] , sidx = 0 , rdata = "" ; var ws = wb . Sheets [ s ] ; if ( ws == null ) ws = { } ; var ref = ws [ "!ref" ] ; if ( ref == null ) ref = "A1" ; if ( ! rels ) rels = { } ; ws [ "!comments" ] = [ ] ; ws [ "!drawing" ] = [ ] ; o [ o . length ] = writextag ( "sheetPr" , null , { codeName : escapexml ( wb . SheetNames [ idx ] ) } ) ; o [ o . length ] = writextag ( "dimension" , null , { ref : ref } ) ; o [ o . length ] = write _ws _xml _sheetviews ( ws , opts , idx , wb ) ; if ( op
o . write _shift ( 4 , 0 ) ; write _XLSBCodeName ( "ThisWorkbook" , o ) ; return o . slice ( 0 , o . l ) } function parse _BrtFRTArchID$ ( data , length ) { var o = { } ; data . read _shift ( 4 ) ; o . ArchID = data . read _shift ( 4 ) ; data . l += length - 8 ; return o } function parse _BrtName ( data , length , opts ) { var end = data . l + length ; var flags = data . read _shift ( 4 ) ; var chKey = data . read _shift ( 1 ) ; var itab = data . read _shift ( 4 ) ; var name = parse _XLNameWideString ( data ) ; var formula = parse _XLSBNameParsedFormula ( data , 0 , opts ) ; var comment = parse _XLNullableWideString ( data ) ; data . l = end ; var out = { Name : name , Ptg : formula , Comment : comment } ; if ( itab < 268435455 ) out . Sheet = itab ; return out } function parse _wb _bin ( data , opts ) { var wb = { AppVersion : { } , WBProps : { } , WBView : [ ] , Sheets : [ ] , CalcPr : { } , xmlns : "" } ; var pass = false , z ; if ( ! opts ) opts = { } ; opts . biff = 12 ; var Names = [ ] ; var supbooks = [ ] ; supbooks . SheetNames = [ ] ; recordhopper ( data , function hopper _wb ( val , R _n , RT ) { switch ( RT ) { case 156 : supbooks . SheetNames . push ( val . name ) ; wb . Sheets . push ( val ) ; break ; case 39 : val . Ref = stringify _formula ( val . Ptg , null , null , supbooks , opts ) ; delete val . Ptg ; Names . push ( val ) ; break ; case 1036 : break ; case 2071 : case 534 : case 677 : case 158 : case 157 : case 610 : case 2050 : case 362 : case 155 : case 548 : case 676 : case 128 : case 665 : case 2128 : case 2125 : case 549 : case 2053 : case 361 : case 596 : case 667 : case 355 : case 358 : case 357 : case 2076 : case 2075 : case 2082 : case 397 : case 154 : case 153 : case 1117 : case 553 : case 2091 : break ; case 35 : pass = true ; break ; case 36 : pass = false ; break ; case 37 : break ; case 38 : break ; case 16 : break ; default : if ( ( R _n || "" ) . indexOf ( "Begin" ) > 0 ) { } else if ( ( R _n || "" ) . indexOf ( "End" ) > 0 ) { } else if ( ! pass || opts . WTF ) throw new Error ( "Unexpected record " + RT + " " + R _n ) } } , opts ) ; parse _wb _defaults ( wb ) ; wb . Names = Names ; return wb } function write _BUNDLESHS ( ba , wb , opts ) { write _record ( ba , "BrtBeginBundleShs" ) ; for ( var idx = 0 ; idx != wb . SheetNames . length ; ++ idx ) { var viz = wb . Workbook && wb . Workbook . Sheets && wb . Workbook . Sheets [ idx ] && wb . Workbook . Sheets [ idx ] . Hidden || 0 ; var d = { Hidden : viz , iTabID : idx + 1 , strRelID : "rId" + ( idx + 1 ) , name : wb . SheetNames [ idx ] } ; write _record ( ba , "BrtBundleSh" , write _BrtBundleSh ( d ) ) } write _record ( ba , "BrtEndBundleShs" ) } function write _BrtFileVersion ( data , o ) { if ( ! o ) o = new _buf ( 127 ) ; for ( var i = 0 ; i != 4 ; ++ i ) o . write _shift ( 4 , 0 ) ; write _XLWideString ( "SheetJS" , o ) ; write _XLWideString ( XLSX . version , o ) ; write _XLWideString ( XLSX . version , o ) ; write _XLWideString ( "7262" , o ) ; o . length = o . l ; return o . length > o . l ? o . slice ( 0 , o . l ) : o } function write _BrtBookView ( idx , o ) { if ( ! o ) o = new _buf ( 29 ) ; o . write _shift ( - 4 , 0 ) ; o . write _shift ( - 4 , 460 ) ; o . write _shift ( 4 , 28800 ) ; o . write _shift ( 4 , 17600 ) ; o . write _shift ( 4 , 500 ) ; o . write _shift ( 4 , idx ) ; o . write _shift ( 4 , idx ) ; var flags = 120 ; o . write _shift ( 1 , flags ) ; return o . length > o . l ? o . slice ( 0 , o . l ) : o } function write _BOOKVIEWS ( ba , wb , opts ) { if ( ! wb . Workbook || ! wb . Workbook . Sheets ) return ; var sheets = wb . Workbook . Sheets ; var i = 0 , vistab = - 1 , hidden = - 1 ; for ( ; i < sheets . length ; ++ i ) { if ( ! sheets [ i ] || ! sheets [ i ] . Hidden && vistab == - 1 ) vistab = i ; else if ( sheets [ i ] . Hidden == 1 && hidden == - 1 ) hidden = i } if ( hidden > vistab ) return ; write _record ( ba , "BrtBeginBookViews" ) ; write _record ( ba , "BrtBookView" , write _BrtBookView ( vistab ) ) ; write _record ( ba , "BrtEndBookViews" ) } function write _BrtCalcProp ( data , o ) { if ( ! o ) o = new _buf ( 26 ) ; o . write _shift ( 4 , 0 ) ; o . write _shift ( 4 , 1 ) ; o . write _shift ( 4 , 0 ) ; write _Xnum ( 0 , o ) ; o . write _shift ( - 4 , 1023 ) ; o . write _shift ( 1 , 51 ) ; o . write _shift ( 1 , 0 ) ; return o } function write _BrtFileRecover ( data , o ) { if ( ! o ) o = new _buf ( 1 ) ; o . write _shift ( 1 , 0 ) ; return o } function write _wb _bin ( wb , opts ) { var ba = buf _array ( ) ; write _record ( ba , "BrtBeginBook" ) ; write _record ( ba , "BrtFileVersion" , write _BrtFileVersion ( ) ) ; write _record ( ba , "BrtWbProp" , write _BrtWbProp ( ) ) ; write _BOOKVIEWS ( ba , wb , opts ) ; write _BUNDLESHS ( ba , wb , opts ) ; write _record ( ba , "BrtEndBook" ) ; return ba . end ( ) } function parse _wb ( data , name , opts ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _wb _bin ( data , opts ) ; return parse _wb _xml ( data , opts ) } function parse _ws ( data , name , opts , rels , wb , themes , styles ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _ws _bin ( data , opts , rels , wb , themes , styles ) ; return parse _ws _xml ( data , opts , rels , wb , themes , styles ) } function parse _cs ( data , name , opts , rels , wb , themes , styles ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _cs _bin ( data , opts , rels , wb , themes , styles ) ; return parse _cs _xml ( data , opts , rels , wb , themes , styles ) } function
case 4294967294 : l += 4 ; break ; default : if ( m > 400 ) throw new Error ( "Unsupported Clipboard: " + m . toString ( 16 ) ) ; l += m } m = _ _lpstr ( o , l ) ; l += m . length === 0 ? 0 : 5 + m . length ; v . Reserved1 = m ; if ( ( m = _ _readUInt32LE ( o , l ) ) !== 1907550708 ) return v ; throw new Error ( "Unsupported Unicode Extension" ) } function slurp ( R , blob , length , opts ) { var l = length ; var bufs = [ ] ; var d = blob . slice ( blob . l , blob . l + l ) ; if ( opts && opts . enc && opts . enc . insitu _decrypt ) switch ( R . n ) { case "BOF" : case "FilePass" : case "FileLock" : case "InterfaceHdr" : case "RRDInfo" : case "RRDHead" : case "UsrExcl" : break ; default : if ( d . length === 0 ) break ; opts . enc . insitu _decrypt ( d ) } bufs . push ( d ) ; blob . l += l ; var next = XLSRecordEnum [ _ _readUInt16LE ( blob , blob . l ) ] ; while ( next != null && next . n === "Continue" ) { l = _ _readUInt16LE ( blob , blob . l + 2 ) ; bufs . push ( blob . slice ( blob . l + 4 , blob . l + 4 + l ) ) ; blob . l += 4 + l ; next = XLSRecordEnum [ _ _readUInt16LE ( blob , blob . l ) ] } var b = bconcat ( bufs ) ; prep _blob ( b , 0 ) ; var ll = 0 ; b . lens = [ ] ; for ( var j = 0 ; j < bufs . length ; ++ j ) { b . lens . push ( ll ) ; ll += bufs [ j ] . length } return R . f ( b , b . length , opts ) } function safe _format _xf ( p , opts , date1904 ) { if ( p . t === "z" ) return ; if ( ! p . XF ) return ; try { var fmtid = p . z || p . XF . ifmt || 0 ; if ( opts . cellNF ) p . z = SSF . _table [ fmtid ] } catch ( e ) { if ( opts . WTF ) throw e } if ( ! opts || opts . cellText !== false ) 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 ) ; else p . w = SSF . _general _num ( p . v ) } else p . w = SSF . _general ( p . v ) } else p . w = SSF . format ( fmtid , p . v , { date1904 : ! ! date1904 } ) ; if ( opts . cellDates && fmtid && p . t == "n" && SSF . is _date ( SSF . _table [ fmtid ] ) ) { var _d = SSF . parse _date _code ( p . v ) ; if ( _d ) { p . t = "d" ; p . v = new Date ( Date . UTC ( _d . y , _d . m - 1 , _d . d , _d . H , _d . M , _d . S , _d . u ) ) } } } catch ( e ) { if ( opts . WTF ) throw e } } function make _cell ( val , ixfe , t ) { return { v : val , ixfe : ixfe , t : t } } function parse _workbook ( blob , options ) { var wb = { opts : { } } ; var Sheets = { } ; if ( DENSE != null && options . dense == null ) options . dense = DENSE ; var out = options . dense ? [ ] : { } ; var Directory = { } ; var found _sheet = false ; var range = { } ; var last _formula = null ; var sst = [ ] ; var cur _sheet = "" ; var Preamble = { } ; var lastcell , last _cell = "" , cc , cmnt , rng , rngC , rngR ; var shared _formulae = { } ; var array _formulae = [ ] ; var temp _val ; var country ; var cell _valid = true ; var XFs = [ ] ; var palette = [ ] ; var Workbook = { Sheets : [ ] } , wsprops = { } ; var get _rgb = function getrgb ( icv ) { if ( icv < 8 ) return XLSIcv [ icv ] ; if ( icv < 64 ) return palette [ icv - 8 ] || XLSIcv [ icv ] ; return XLSIcv [ icv ] } ; var process _cell _style = function pcs ( cell , line , options ) { var xfd = line . XF . data ; if ( ! xfd || ! xfd . patternType || ! options || ! options . cellStyles ) return ; line . s = { } ; line . s . patternType = xfd . patternType ; var t ; if ( t = rgb2Hex ( get _rgb ( xfd . icvFore ) ) ) { line . s . fgColor = { rgb : t } } if ( t = rgb2Hex ( get _rgb ( xfd . icvBack ) ) ) { line . s . bgColor = { rgb : t } } } ; var addcell = function addcell ( cell , line , options ) { if ( file _depth > 1 ) return ; if ( ! cell _valid ) return ; if ( options . cellStyles && line . XF && line . XF . data ) process _cell _style ( cell , line , options ) ; lastcell = cell ; last _cell = encode _cell ( cell ) ; if ( range . s ) { if ( cell . r < range . s . r ) range . s . r = cell . r ; if ( cell . c < range . s . c ) range . s . c = cell . c } if ( range . e ) { if ( cell . r + 1 > range . e . r ) range . e . r = cell . r + 1 ; if ( cell . c + 1 > range . e . c ) range . e . c = cell . c + 1 } if ( options . cellFormula && line . f ) { for ( var afi = 0 ; afi < array _formulae . length ; ++ afi ) { if ( array _formulae [ afi ] [ 0 ] . s . c > cell . c ) continue ; if ( array _formulae [ afi ] [ 0 ] . s . r > cell . r ) continue ; if ( array _formulae [ afi ] [ 0 ] . e . c < cell . c ) continue ; if ( array _formulae [ afi ] [ 0 ] . e . r < cell . r ) continue ; line . F = encode _range ( array _formulae [ afi ] [ 0 ] ) ; if ( array _formulae [ afi ] [ 0 ] . s . c != cell . c ) delete line . f ; if ( array _formulae [ afi ] [ 0 ] . s . r != cell . r ) delete line . f ; if ( line . f ) line . f = "" + stringify _formula ( array _formulae [ afi ] [ 1 ] , range , cell , supbooks , opts ) ; break } } if ( options . sheetRows && lastcell . r >= options . sheetRows ) cell _valid = false ; else { if ( options . dense ) { if ( ! out [ cell . r ] ) out [ cell . r ] = [ ] ; out [ cell . r ] [ cell . c ] = line } else out [ last _cell ] = line } } ; var opts = { enc : false , sbcch : 0 , snames : [ ] , sharedf : shared _formulae , arrayf : array _formulae , rrtabid : [ ] , lastuser : "" , biff : 8 , codepage : 0 , winlocked : 0 , cellStyles : ! ! options && ! ! options . cellStyles , WTF : ! ! options && ! ! options . wtf } ; if ( options . password ) opts . password = options . password ; var mergecells = [ ] ; var objects = [ ] ; var colinfo = [ ] , rowinfo = [ ] ; var defwidth = 0 , defheight = 0 ; var seencol = false ; var supbooks = [ ] ; supbooks . SheetNames = opts . snames ; supbooks . sharedf = opts . sha
f : parsenoop } , 359 : { n : "BrtSupTabs" , f : parsenoop } , 360 : { n : "BrtBeginSupBook" , f : parsenoop } , 361 : { n : "BrtPlaceholderName" , f : parsenoop } , 362 : { n : "BrtExternSheet" , f : parsenoop } , 363 : { n : "BrtExternTableStart" , f : parsenoop } , 364 : { n : "BrtExternTableEnd" , f : parsenoop } , 366 : { n : "BrtExternRowHdr" , f : parsenoop } , 367 : { n : "BrtExternCellBlank" , f : parsenoop } , 368 : { n : "BrtExternCellReal" , f : parsenoop } , 369 : { n : "BrtExternCellBool" , f : parsenoop } , 370 : { n : "BrtExternCellError" , f : parsenoop } , 371 : { n : "BrtExternCellString" , f : parsenoop } , 372 : { n : "BrtBeginEsmdx" , f : parsenoop } , 373 : { n : "BrtEndEsmdx" , f : parsenoop } , 374 : { n : "BrtBeginMdxSet" , f : parsenoop } , 375 : { n : "BrtEndMdxSet" , f : parsenoop } , 376 : { n : "BrtBeginMdxMbrProp" , f : parsenoop } , 377 : { n : "BrtEndMdxMbrProp" , f : parsenoop } , 378 : { n : "BrtBeginMdxKPI" , f : parsenoop } , 379 : { n : "BrtEndMdxKPI" , f : parsenoop } , 380 : { n : "BrtBeginEsstr" , f : parsenoop } , 381 : { n : "BrtEndEsstr" , f : parsenoop } , 382 : { n : "BrtBeginPRFItem" , f : parsenoop } , 383 : { n : "BrtEndPRFItem" , f : parsenoop } , 384 : { n : "BrtBeginPivotCacheIDs" , f : parsenoop } , 385 : { n : "BrtEndPivotCacheIDs" , f : parsenoop } , 386 : { n : "BrtBeginPivotCacheID" , f : parsenoop } , 387 : { n : "BrtEndPivotCacheID" , f : parsenoop } , 388 : { n : "BrtBeginISXVIs" , f : parsenoop } , 389 : { n : "BrtEndISXVIs" , f : parsenoop } , 390 : { n : "BrtBeginColInfos" , f : parsenoop } , 391 : { n : "BrtEndColInfos" , f : parsenoop } , 392 : { n : "BrtBeginRwBrk" , f : parsenoop } , 393 : { n : "BrtEndRwBrk" , f : parsenoop } , 394 : { n : "BrtBeginColBrk" , f : parsenoop } , 395 : { n : "BrtEndColBrk" , f : parsenoop } , 396 : { n : "BrtBrk" , f : parsenoop } , 397 : { n : "BrtUserBookView" , f : parsenoop } , 398 : { n : "BrtInfo" , f : parsenoop } , 399 : { n : "BrtCUsr" , f : parsenoop } , 400 : { n : "BrtUsr" , f : parsenoop } , 401 : { n : "BrtBeginUsers" , f : parsenoop } , 403 : { n : "BrtEOF" , f : parsenoop } , 404 : { n : "BrtUCR" , f : parsenoop } , 405 : { n : "BrtRRInsDel" , f : parsenoop } , 406 : { n : "BrtRREndInsDel" , f : parsenoop } , 407 : { n : "BrtRRMove" , f : parsenoop } , 408 : { n : "BrtRREndMove" , f : parsenoop } , 409 : { n : "BrtRRChgCell" , f : parsenoop } , 410 : { n : "BrtRREndChgCell" , f : parsenoop } , 411 : { n : "BrtRRHeader" , f : parsenoop } , 412 : { n : "BrtRRUserView" , f : parsenoop } , 413 : { n : "BrtRRRenSheet" , f : parsenoop } , 414 : { n : "BrtRRInsertSh" , f : parsenoop } , 415 : { n : "BrtRRDefName" , f : parsenoop } , 416 : { n : "BrtRRNote" , f : parsenoop } , 417 : { n : "BrtRRConflict" , f : parsenoop } , 418 : { n : "BrtRRTQSIF" , f : parsenoop } , 419 : { n : "BrtRRFormat" , f : parsenoop } , 420 : { n : "BrtRREndFormat" , f : parsenoop } , 421 : { n : "BrtRRAutoFmt" , f : parsenoop } , 422 : { n : "BrtBeginUserShViews" , f : parsenoop } , 423 : { n : "BrtBeginUserShView" , f : parsenoop } , 424 : { n : "BrtEndUserShView" , f : parsenoop } , 425 : { n : "BrtEndUserShViews" , f : parsenoop } , 426 : { n : "BrtArrFmla" , f : parse _BrtArrFmla } , 427 : { n : "BrtShrFmla" , f : parse _BrtShrFmla } , 428 : { n : "BrtTable" , f : parsenoop } , 429 : { n : "BrtBeginExtConnections" , f : parsenoop } , 430 : { n : "BrtEndExtConnections" , f : parsenoop } , 431 : { n : "BrtBeginPCDCalcMems" , f : parsenoop } , 432 : { n : "BrtEndPCDCalcMems" , f : parsenoop } , 433 : { n : "BrtBeginPCDCalcMem" , f : parsenoop } , 434 : { n : "BrtEndPCDCalcMem" , f : parsenoop } , 435 : { n : "BrtBeginPCDHGLevels" , f : parsenoop } , 436 : { n : "BrtEndPCDHGLevels" , f : parsenoop } , 437 : { n : "BrtBeginPCDHGLevel" , f : parsenoop } , 438 : { n : "BrtEndPCDHGLevel" , f : parsenoop } , 439 : { n : "BrtBeginPCDHGLGroups" , f : parsenoop } , 440 : { n : "BrtEndPCDHGLGroups" , f : parsenoop } , 441 : { n : "BrtBeginPCDHGLGroup" , f : parsenoop } , 442 : { n : "BrtEndPCDHGLGroup" , f : parsenoop } , 443 : { n : "BrtBeginPCDHGLGMembers" , f : parsenoop } , 444 : { n : "BrtEndPCDHGLGMembers" , f : parsenoop } , 445 : { n : "BrtBeginPCDHGLGMember" , f : parsenoop } , 446 : { n : "BrtEndPCDHGLGMember" , f : parsenoop } , 447 : { n : "BrtBeginQSI" , f : parsenoop } , 448 : { n : "BrtEndQSI" , f : parsenoop } , 449 : { n : "BrtBeginQSIR" , f : parsenoop } , 450 : { n : "BrtEndQSIR" , f : parsenoop } , 451 : { n : "BrtBeginDeletedNames" , f : parsenoop } , 452 : { n : "BrtEndDeletedNames" , f : parsenoop } , 453 : { n : "BrtBeginDeletedName" , f : parsenoop } , 454 : { n : "BrtEndDeletedName" , f : parsenoop } , 455 : { n : "BrtBeginQSIFs" , f : parsenoop } , 456 : { n : "BrtEndQSIFs" , f : parsenoop } , 457 : { n : "BrtBeginQSIF" , f : parsenoop } , 458 : { n : "BrtEndQSIF" , f : parsenoop } , 459 : { n : "BrtBeginAutoSortScope" , f : parsenoop } , 460 : { n : "BrtEndAutoSortScope" , f : parsenoop } , 461 : { n : "BrtBeginConditionalFormatting" , f : parsenoop } , 462 : { n : "BrtEndConditionalFormatting" , f : parsenoop } , 463 : { n : "BrtBeginCFRule" , f : parsenoop } , 464 : { n : "BrtEndCFRule" , f : parsenoop } , 465 : { n : "BrtBeginIconSet" , f : parsenoop } , 466 : { n : "BrtEndIconSet" , f : parsenoop } , 467 : { n : "BrtBeginDatabar" , f : parsenoop } , 468 : { n : "BrtEndDatabar" , f : parsen
f : parse _Series } , 4102 : { n : "DataFormat" , f : parse _DataFormat } , 4103 : { n : "LineFormat" , f : parse _LineFormat } , 4105 : { n : "MarkerFormat" , f : parse _MarkerFormat } , 4106 : { n : "AreaFormat" , f : parse _AreaFormat } , 4107 : { n : "PieFormat" , f : parse _PieFormat } , 4108 : { n : "AttachedLabel" , f : parse _AttachedLabel } , 4109 : { n : "SeriesText" , f : parse _SeriesText } , 4116 : { n : "ChartFormat" , f : parse _ChartFormat } , 4117 : { n : "Legend" , f : parse _Legend } , 4118 : { n : "SeriesList" , f : parse _SeriesList } , 4119 : { n : "Bar" , f : parse _Bar } , 4120 : { n : "Line" , f : parse _Line } , 4121 : { n : "Pie" , f : parse _Pie } , 4122 : { n : "Area" , f : parse _Area } , 4123 : { n : "Scatter" , f : parse _Scatter } , 4124 : { n : "CrtLine" , f : parse _CrtLine } , 4125 : { n : "Axis" , f : parse _Axis } , 4126 : { n : "Tick" , f : parse _Tick } , 4127 : { n : "ValueRange" , f : parse _ValueRange } , 4128 : { n : "CatSerRange" , f : parse _CatSerRange } , 4129 : { n : "AxisLine" , f : parse _AxisLine } , 4130 : { n : "CrtLink" , f : parse _CrtLink } , 4132 : { n : "DefaultText" , f : parse _DefaultText } , 4133 : { n : "Text" , f : parse _Text } , 4134 : { n : "FontX" , f : parse _FontX } , 4135 : { n : "ObjectLink" , f : parse _ObjectLink } , 4146 : { n : "Frame" , f : parse _Frame } , 4147 : { n : "Begin" , f : parse _Begin } , 4148 : { n : "End" , f : parse _End } , 4149 : { n : "PlotArea" , f : parse _PlotArea } , 4154 : { n : "Chart3d" , f : parse _Chart3d } , 4156 : { n : "PicF" , f : parse _PicF } , 4157 : { n : "DropBar" , f : parse _DropBar } , 4158 : { n : "Radar" , f : parse _Radar } , 4159 : { n : "Surf" , f : parse _Surf } , 4160 : { n : "RadarArea" , f : parse _RadarArea } , 4161 : { n : "AxisParent" , f : parse _AxisParent } , 4163 : { n : "LegendException" , f : parse _LegendException } , 4164 : { n : "ShtProps" , f : parse _ShtProps } , 4165 : { n : "SerToCrt" , f : parse _SerToCrt } , 4166 : { n : "AxesUsed" , f : parse _AxesUsed } , 4168 : { n : "SBaseRef" , f : parse _SBaseRef } , 4170 : { n : "SerParent" , f : parse _SerParent } , 4171 : { n : "SerAuxTrend" , f : parse _SerAuxTrend } , 4174 : { n : "IFmtRecord" , f : parse _IFmtRecord } , 4175 : { n : "Pos" , f : parse _Pos } , 4176 : { n : "AlRuns" , f : parse _AlRuns } , 4177 : { n : "BRAI" , f : parse _BRAI } , 4187 : { n : "SerAuxErrBar" , f : parse _SerAuxErrBar } , 4188 : { n : "ClrtClient" , f : parse _ClrtClient } , 4189 : { n : "SerFmt" , f : parse _SerFmt } , 4191 : { n : "Chart3DBarShape" , f : parse _Chart3DBarShape } , 4192 : { n : "Fbi" , f : parse _Fbi } , 4193 : { n : "BopPop" , f : parse _BopPop } , 4194 : { n : "AxcExt" , f : parse _AxcExt } , 4195 : { n : "Dat" , f : parse _Dat } , 4196 : { n : "PlotGrowth" , f : parse _PlotGrowth } , 4197 : { n : "SIIndex" , f : parse _SIIndex } , 4198 : { n : "GelFrame" , f : parse _GelFrame } , 4199 : { n : "BopPopCustom" , f : parse _BopPopCustom } , 4200 : { n : "Fbi2" , f : parse _Fbi2 } , 0 : { n : "Dimensions" , f : parse _Dimensions } , 2 : { n : "BIFF2INT" , f : parse _BIFF2INT } , 5 : { n : "BoolErr" , f : parse _BoolErr } , 7 : { n : "String" , f : parse _BIFF2STRING } , 8 : { n : "BIFF2ROW" , f : parsenoop } , 11 : { n : "Index" , f : parse _Index } , 22 : { n : "ExternCount" , f : parsenoop } , 30 : { n : "BIFF2FORMAT" , f : parse _BIFF2Format } , 31 : { n : "BIFF2FMTCNT" , f : parsenoop } , 32 : { n : "BIFF2COLINFO" , f : parsenoop } , 33 : { n : "Array" , f : parse _Array } , 37 : { n : "DefaultRowHeight" , f : parse _DefaultRowHeight } , 50 : { n : "BIFF2FONTXTRA" , f : parse _BIFF2FONTXTRA } , 62 : { n : "BIFF2WINDOW2" , f : parsenoop } , 69 : { n : "BIFF2FONTCLR" , f : parsenoop } , 86 : { n : "BIFF4FMTCNT" , f : parsenoop } , 126 : { n : "RK" , f : parsenoop } , 127 : { n : "ImData" , f : parse _ImData } , 135 : { n : "Addin" , f : parsenoop } , 136 : { n : "Edg" , f : parsenoop } , 137 : { n : "Pub" , f : parsenoop } , 145 : { n : "Sub" , f : parsenoop } , 148 : { n : "LHRecord" , f : parsenoop } , 149 : { n : "LHNGraph" , f : parsenoop } , 150 : { n : "Sound" , f : parsenoop } , 169 : { n : "CoordList" , f : parsenoop } , 171 : { n : "GCW" , f : parsenoop } , 188 : { n : "ShrFmla" , f : parsenoop } , 194 : { n : "AddMenu" , f : parsenoop } , 195 : { n : "DelMenu" , f : parsenoop } , 214 : { n : "RString" , f : parse _RString } , 223 : { n : "UDDesc" , f : parsenoop } , 234 : { n : "TabIdConf" , f : parsenoop } , 354 : { n : "XL5Modify" , f : parsenoop } , 421 : { n : "FileSharing2" , f : parsenoop } , 521 : { n : "BOF" , f : parse _BOF } , 536 : { n : "Lbl" , f : parse _Lbl } , 547 : { n : "ExternName" , f : parse _ExternName } , 561 : { n : "Font" , f : parsenoop } , 1033 : { n : "BOF" , f : parse _BOF } , 2157 : { n : "FeatInfo" , f : parsenoop } , 2163 : { n : "FeatInfo11" , f : parsenoop } , 2177 : { n : "SXAddl12" , f : parsenoop } , 2240 : { n : "AutoWebPub" , f : parsenoop } , 2241 : { n : "ListObj" , f : parsenoop } , 2242 : { n : "ListField" , f : parsenoop } , 2243 : { n : "ListDV" , f : parsenoop } , 2244 : { n : "ListCondFmt" , f : parsenoop } , 2245 : { n : "ListCF" , f : parsenoop } , 2246 : { n : "FMQry" , f : parsenoop } , 2247 : { n : "FMSQry" , f : parsenoop } , 2248 : { n : "PLV" , f : parsenoop } , 2249 : { n : "LnExt" , f : parsenoop } , 2250 : { n : "MkrExt" , f : parsenoop } , 2251 : { n : "CrtCoopt" , f : parsenoop } , 67 : { n : "BIFF2XF" , f : parsenoop } , 579 : { n : "BIFF3XF" , f : parsenoop } , 1091 : { n : "BIFF4XF" , f : parsenoop } , 29282 : { } } ; function write _biff _rec ( ba , t , payl
var i = 0 ; var sheetRels = { } ; var path , relsPath ; { var wbsheets = wb . Sheets ; props . Worksheets = wbsheets . length ; props . SheetNames = [ ] ; for ( var j = 0 ; j != wbsheets . length ; ++ j ) { props . SheetNames [ j ] = wbsheets [ j ] . name } } var wbext = xlsb ? "bin" : "xml" ; var wbrelsfile = "xl/_rels/workbook." + wbext + ".rels" ; var wbrels = parse _rels ( getzipstr ( zip , wbrelsfile , true ) , wbrelsfile ) ; if ( wbrels ) wbrels = safe _parse _wbrels ( wbrels , wb . Sheets ) ; var nmode = getzipdata ( zip , "xl/worksheets/sheet.xml" , true ) ? 1 : 0 ; for ( i = 0 ; i != props . Worksheets ; ++ i ) { var stype = "sheet" ; if ( wbrels && wbrels [ i ] ) { path = "xl/" + wbrels [ i ] [ 1 ] . replace ( /[\/]?xl\// , "" ) ; stype = wbrels [ i ] [ 2 ] } else { path = "xl/worksheets/sheet" + ( i + 1 - nmode ) + "." + wbext ; path = path . replace ( /sheet0\./ , "sheet." ) } relsPath = path . replace ( /^(.*)(\/)([^\/]*)$/ , "$1/_rels/$3.rels" ) ; safe _parse _sheet ( zip , path , relsPath , props . SheetNames [ i ] , sheetRels , sheets , stype , opts , wb , themes , styles ) } if ( dir . comments ) parse _comments ( zip , dir . comments , sheets , sheetRels , opts ) ; out = { Directory : dir , Workbook : wb , Props : props , Custprops : custprops , Deps : deps , Sheets : sheets , SheetNames : props . SheetNames , Strings : strs , Styles : styles , Themes : themes , SSF : SSF . get _table ( ) } ; if ( opts . bookFiles ) { out . keys = entries ; out . files = zip . files } if ( opts . bookVBA ) { if ( dir . vba . length > 0 ) out . vbaraw = getzipdata ( zip , dir . vba [ 0 ] . replace ( /^\// , "" ) , true ) ; else if ( dir . defaults && dir . defaults . bin === "application/vnd.ms-office.vbaProject" ) out . vbaraw = getzipdata ( zip , "xl/vbaProject.bin" , true ) } return out } function parse _xlsxcfb ( cfb , opts ) { var f = "Version" ; var data = cfb . find ( f ) ; if ( ! data ) throw new Error ( "ECMA-376 Encrypted file missing " + f ) ; var version = parse _DataSpaceVersionInfo ( data . content ) ; f = "DataSpaceMap" ; data = cfb . find ( f ) ; if ( ! data ) throw new Error ( "ECMA-376 Encrypted file missing " + f ) ; var dsm = parse _DataSpaceMap ( data . content ) ; if ( dsm . length != 1 || dsm [ 0 ] . comps . length != 1 || dsm [ 0 ] . comps [ 0 ] . t != 0 || dsm [ 0 ] . name != "StrongEncryptionDataSpace" || dsm [ 0 ] . comps [ 0 ] . v != "EncryptedPackage" ) throw new Error ( "ECMA-376 Encrypted file bad " + f ) ; f = "StrongEncryptionDataSpace" ; data = cfb . find ( f ) ; if ( ! data ) throw new Error ( "ECMA-376 Encrypted file missing " + f ) ; var seds = parse _DataSpaceDefinition ( data . content ) ; if ( seds . length != 1 || seds [ 0 ] != "StrongEncryptionTransform" ) throw new Error ( "ECMA-376 Encrypted file bad " + f ) ; f = "!Primary" ; data = cfb . find ( f ) ; if ( ! data ) throw new Error ( "ECMA-376 Encrypted file missing " + f ) ; var hdr = parse _Primary ( data . content ) ; f = "EncryptionInfo" ; data = cfb . find ( f ) ; if ( ! data ) throw new Error ( "ECMA-376 Encrypted file missing " + f ) ; var einfo = parse _EncryptionInfo ( data . content ) ; throw new Error ( "File is password-protected" ) } function write _zip ( wb , opts ) { _shapeid = 1024 ; if ( opts . bookType == "ods" ) return write _ods ( wb , opts ) ; if ( wb && ! wb . SSF ) { wb . SSF = SSF . get _table ( ) } if ( wb && wb . SSF ) { make _ssf ( SSF ) ; SSF . load _table ( wb . SSF ) ; opts . revssf = evert _num ( wb . SSF ) ; opts . revssf [ wb . SSF [ 65535 ] ] = 0 ; opts . ssf = wb . SSF } opts . rels = { } ; opts . wbrels = { } ; opts . Strings = [ ] ; opts . Strings . Count = 0 ; opts . Strings . Unique = 0 ; var wbext = opts . bookType == "xlsb" ? "bin" : "xml" ; var vbafmt = opts . bookType == "xlsb" || opts . bookType == "xlsm" ; var ct = { workbooks : [ ] , sheets : [ ] , charts : [ ] , dialogs : [ ] , macros : [ ] , rels : [ ] , strs : [ ] , comments : [ ] , coreprops : [ ] , extprops : [ ] , custprops : [ ] , themes : [ ] , styles : [ ] , calcchains : [ ] , vba : [ ] , drawings : [ ] , TODO : [ ] , xmlns : "" } ; fix _write _opts ( opts = opts || { } ) ; var zip = new jszip ; var f = "" , rId = 0 ; opts . cellXfs = [ ] ; get _cell _style ( opts . cellXfs , { } , { revssf : { General : 0 } } ) ; if ( ! wb . Props ) wb . Props = { } ; f = "docProps/core.xml" ; zip . file ( f , write _core _props ( wb . Props , opts ) ) ; ct . coreprops . push ( f ) ; add _rels ( opts . rels , 2 , f , RELS . CORE _PROPS ) ; f = "docProps/app.xml" ; if ( wb . Props && wb . Props . SheetNames ) { } else if ( ! wb . Workbook || ! wb . Workbook . Sheets ) wb . Props . SheetNames = wb . SheetNames ; else wb . Props . SheetNames = wb . SheetNames . map ( function ( x , i ) { return [ ( wb . Workbook . Sheets [ i ] || { } ) . Hidden != 2 , x ] } ) . filter ( function ( x ) { return x [ 0 ] } ) . map ( function ( x ) { return x [ 1 ] } ) ; wb . Props . Worksheets = wb . Props . SheetNames . length ; zip . file ( f , write _ext _props ( wb . Props , opts ) ) ; ct . extprops . push ( f ) ; add _rels ( opts . rels , 3 , f , RELS . EXT _PROPS ) ; if ( wb . Custprops !== wb . Props && keys ( wb . Custprops || { } ) . length > 0 ) { f = "docProps/custom.xml" ; zip . file ( f , write _cust _props ( wb . Custprops , opts ) ) ; ct . custprops . push ( f ) ; add _rels ( opts . rels , 4 , f , RELS . CUST _PROPS ) } f = "xl/workbook." + wbext ; zip . f