2017-04-26 15:58:19 +02:00
( function webpackUniversalModuleDefinition ( root , factory ) {
if ( typeof exports === 'object' && typeof module === 'object' )
module . exports = factory ( ) ;
else if ( typeof define === 'function' && define . amd )
define ( [ ] , factory ) ;
else if ( typeof exports === 'object' )
2017-05-10 09:36:07 +02:00
exports [ "js-bigchaindb-driver" ] = factory ( ) ;
2017-04-26 15:58:19 +02:00
else
2017-05-10 09:36:07 +02:00
root [ "js-bigchaindb-driver" ] = factory ( ) ;
2017-04-26 15:58:19 +02:00
} ) ( this , function ( ) {
return /******/ ( function ( modules ) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = { } ;
/******/
/******/ // The require function
/******/ function _ _webpack _require _ _ ( moduleId ) {
/******/
/******/ // Check if module is in cache
2017-05-10 09:36:07 +02:00
/******/ if ( installedModules [ moduleId ] ) {
2017-04-26 15:58:19 +02:00
/******/ return installedModules [ moduleId ] . exports ;
2017-05-10 09:36:07 +02:00
/******/ }
2017-04-26 15:58:19 +02:00
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules [ moduleId ] = {
/******/ i : moduleId ,
/******/ l : false ,
/******/ exports : { }
/******/ } ;
/******/
/******/ // Execute the module function
/******/ modules [ moduleId ] . call ( module . exports , module , module . exports , _ _webpack _require _ _ ) ;
/******/
/******/ // Flag the module as loaded
/******/ module . l = true ;
/******/
/******/ // Return the exports of the module
/******/ return module . exports ;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ _ _webpack _require _ _ . m = modules ;
/******/
/******/ // expose the module cache
/******/ _ _webpack _require _ _ . c = installedModules ;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ _ _webpack _require _ _ . i = function ( value ) { return value ; } ;
/******/
/******/ // define getter function for harmony exports
/******/ _ _webpack _require _ _ . d = function ( exports , name , getter ) {
/******/ if ( ! _ _webpack _require _ _ . o ( exports , name ) ) {
/******/ Object . defineProperty ( exports , name , {
/******/ configurable : false ,
/******/ enumerable : true ,
/******/ get : getter
/******/ } ) ;
/******/ }
/******/ } ;
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ _ _webpack _require _ _ . n = function ( module ) {
/******/ var getter = module && module . _ _esModule ?
/******/ function getDefault ( ) { return module [ 'default' ] ; } :
/******/ function getModuleExports ( ) { return module ; } ;
/******/ _ _webpack _require _ _ . d ( getter , 'a' , getter ) ;
/******/ return getter ;
/******/ } ;
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ _ _webpack _require _ _ . o = function ( object , property ) { return Object . prototype . hasOwnProperty . call ( object , property ) ; } ;
/******/
/******/ // __webpack_public_path__
/******/ _ _webpack _require _ _ . p = "" ;
/******/
/******/ // Load entry module and return exports
2017-05-05 17:24:23 +02:00
/******/ return _ _webpack _require _ _ ( _ _webpack _require _ _ . s = 95 ) ;
2017-04-26 15:58:19 +02:00
/******/ } )
/************************************************************************/
/******/ ( [
/* 0 */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = getApiUrls ;
function getApiUrls ( API _PATH ) {
return {
'blocks' : API _PATH + 'blocks' ,
'blocks_detail' : API _PATH + 'blocks/%(blockId)s' ,
'outputs' : API _PATH + 'outputs' ,
'statuses' : API _PATH + 'statuses' ,
'transactions' : API _PATH + 'transactions' ,
'transactions_detail' : API _PATH + 'transactions/%(txId)s' ,
'votes' : API _PATH + 'votes'
} ;
}
/***/ } ) ,
/* 1 */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = request ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _baseRequest _ _ = _ _webpack _require _ _ ( 28 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _sanitize _ _ = _ _webpack _require _ _ ( 38 ) ;
2017-04-26 15:58:19 +02:00
var _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ;
var DEFAULT _REQUEST _CONFIG = {
credentials : 'include' ,
headers : {
'Accept' : 'application/json'
}
} ;
/ * *
* Small wrapper around js - utility - belt ' s request that provides url resolving , default settings , and
* response handling .
* /
function request ( url ) {
var config = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { } ;
var onlyJsonResponse = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : true ;
// Load default fetch configuration and remove any falsy query parameters
var requestConfig = _extends ( { } , DEFAULT _REQUEST _CONFIG , config , {
query : config . query && _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _1 _ _sanitize _ _ [ "a" /* default */ ] ) ( config . query )
} ) ;
var apiUrl = url ;
if ( requestConfig . jsonBody ) {
requestConfig . headers = _extends ( { } , requestConfig . headers , {
'Content-Type' : 'application/json'
} ) ;
}
if ( ! url ) {
return Promise . reject ( new Error ( 'Request was not given a url.' ) ) ;
}
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _0 _ _baseRequest _ _ [ "a" /* default */ ] ) ( apiUrl , requestConfig ) . then ( function ( res ) {
return onlyJsonResponse ? res . json ( ) : {
json : res . json ( ) ,
url : res . url
} ;
} ) . catch ( function ( err ) {
console . error ( err ) ;
throw err ;
} ) ;
}
/***/ } ) ,
/* 2 */
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
"use strict" ;
/* WEBPACK VAR INJECTION */ ( function ( global ) { / * !
* The buffer module from node . js , for the browser .
*
* @ author Feross Aboukhadijeh < feross @ feross . org > < http : //feross.org>
* @ license MIT
* /
/* eslint-disable no-proto */
2017-05-05 17:24:23 +02:00
var base64 = _ _webpack _require _ _ ( 52 )
var ieee754 = _ _webpack _require _ _ ( 83 )
var isArray = _ _webpack _require _ _ ( 84 )
2017-04-26 15:58:19 +02:00
exports . Buffer = Buffer
exports . SlowBuffer = SlowBuffer
exports . INSPECT _MAX _BYTES = 50
/ * *
* If ` Buffer.TYPED_ARRAY_SUPPORT ` :
* === true Use Uint8Array implementation ( fastest )
* === false Use Object implementation ( most compatible , even IE6 )
*
* Browsers that support typed arrays are IE 10 + , Firefox 4 + , Chrome 7 + , Safari 5.1 + ,
* Opera 11.6 + , iOS 4.2 + .
*
* Due to various browser bugs , sometimes the Object implementation will be used even
* when the browser supports typed arrays .
*
* Note :
*
* - Firefox 4 - 29 lacks support for adding new properties to ` Uint8Array ` instances ,
* See : https : //bugzilla.mozilla.org/show_bug.cgi?id=695438.
*
* - Chrome 9 - 10 is missing the ` TypedArray.prototype.subarray ` function .
*
* - IE10 has a broken ` TypedArray.prototype.subarray ` function which returns arrays of
* incorrect length in some situations .
* We detect these buggy browsers and set ` Buffer.TYPED_ARRAY_SUPPORT ` to ` false ` so they
* get the Object implementation , which is slower but behaves correctly .
* /
Buffer . TYPED _ARRAY _SUPPORT = global . TYPED _ARRAY _SUPPORT !== undefined
? global . TYPED _ARRAY _SUPPORT
: typedArraySupport ( )
/ *
* Export kMaxLength after typed array support is determined .
* /
exports . kMaxLength = kMaxLength ( )
function typedArraySupport ( ) {
try {
var arr = new Uint8Array ( 1 )
arr . _ _proto _ _ = { _ _proto _ _ : Uint8Array . prototype , foo : function ( ) { return 42 } }
return arr . foo ( ) === 42 && // typed array instances can be augmented
typeof arr . subarray === 'function' && // chrome 9-10 lack `subarray`
arr . subarray ( 1 , 1 ) . byteLength === 0 // ie10 has broken `subarray`
} catch ( e ) {
return false
}
}
function kMaxLength ( ) {
return Buffer . TYPED _ARRAY _SUPPORT
? 0x7fffffff
: 0x3fffffff
}
function createBuffer ( that , length ) {
if ( kMaxLength ( ) < length ) {
throw new RangeError ( 'Invalid typed array length' )
}
if ( Buffer . TYPED _ARRAY _SUPPORT ) {
// Return an augmented `Uint8Array` instance, for best performance
that = new Uint8Array ( length )
that . _ _proto _ _ = Buffer . prototype
} else {
// Fallback: Return an object instance of the Buffer class
if ( that === null ) {
that = new Buffer ( length )
}
that . length = length
}
return that
}
/ * *
* The Buffer constructor returns instances of ` Uint8Array ` that have their
* prototype changed to ` Buffer.prototype ` . Furthermore , ` Buffer ` is a subclass of
* ` Uint8Array ` , so the returned instances will have all the node ` Buffer ` methods
* and the ` Uint8Array ` methods . Square bracket notation works as expected -- it
* returns a single octet .
*
* The ` Uint8Array ` prototype remains unmodified .
* /
function Buffer ( arg , encodingOrOffset , length ) {
if ( ! Buffer . TYPED _ARRAY _SUPPORT && ! ( this instanceof Buffer ) ) {
return new Buffer ( arg , encodingOrOffset , length )
}
// Common case.
if ( typeof arg === 'number' ) {
if ( typeof encodingOrOffset === 'string' ) {
throw new Error (
'If encoding is specified then the first argument must be a string'
)
}
return allocUnsafe ( this , arg )
}
return from ( this , arg , encodingOrOffset , length )
}
Buffer . poolSize = 8192 // not used by this implementation
// TODO: Legacy, not needed anymore. Remove in next major version.
Buffer . _augment = function ( arr ) {
arr . _ _proto _ _ = Buffer . prototype
return arr
}
function from ( that , value , encodingOrOffset , length ) {
if ( typeof value === 'number' ) {
throw new TypeError ( '"value" argument must not be a number' )
}
if ( typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer ) {
return fromArrayBuffer ( that , value , encodingOrOffset , length )
}
if ( typeof value === 'string' ) {
return fromString ( that , value , encodingOrOffset )
}
return fromObject ( that , value )
}
/ * *
* Functionally equivalent to Buffer ( arg , encoding ) but throws a TypeError
* if value is a number .
* Buffer . from ( str [ , encoding ] )
* Buffer . from ( array )
* Buffer . from ( buffer )
* Buffer . from ( arrayBuffer [ , byteOffset [ , length ] ] )
* * /
Buffer . from = function ( value , encodingOrOffset , length ) {
return from ( null , value , encodingOrOffset , length )
}
if ( Buffer . TYPED _ARRAY _SUPPORT ) {
Buffer . prototype . _ _proto _ _ = Uint8Array . prototype
Buffer . _ _proto _ _ = Uint8Array
if ( typeof Symbol !== 'undefined' && Symbol . species &&
Buffer [ Symbol . species ] === Buffer ) {
// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
Object . defineProperty ( Buffer , Symbol . species , {
value : null ,
configurable : true
} )
}
}
function assertSize ( size ) {
if ( typeof size !== 'number' ) {
throw new TypeError ( '"size" argument must be a number' )
} else if ( size < 0 ) {
throw new RangeError ( '"size" argument must not be negative' )
}
}
function alloc ( that , size , fill , encoding ) {
assertSize ( size )
if ( size <= 0 ) {
return createBuffer ( that , size )
}
if ( fill !== undefined ) {
// Only pay attention to encoding if it's a string. This
// prevents accidentally sending in a number that would
// be interpretted as a start offset.
return typeof encoding === 'string'
? createBuffer ( that , size ) . fill ( fill , encoding )
: createBuffer ( that , size ) . fill ( fill )
}
return createBuffer ( that , size )
}
/ * *
* Creates a new filled Buffer instance .
* alloc ( size [ , fill [ , encoding ] ] )
* * /
Buffer . alloc = function ( size , fill , encoding ) {
return alloc ( null , size , fill , encoding )
}
function allocUnsafe ( that , size ) {
assertSize ( size )
that = createBuffer ( that , size < 0 ? 0 : checked ( size ) | 0 )
if ( ! Buffer . TYPED _ARRAY _SUPPORT ) {
for ( var i = 0 ; i < size ; ++ i ) {
that [ i ] = 0
}
}
return that
}
/ * *
* Equivalent to Buffer ( num ) , by default creates a non - zero - filled Buffer instance .
* * /
Buffer . allocUnsafe = function ( size ) {
return allocUnsafe ( null , size )
}
/ * *
* Equivalent to SlowBuffer ( num ) , by default creates a non - zero - filled Buffer instance .
* /
Buffer . allocUnsafeSlow = function ( size ) {
return allocUnsafe ( null , size )
}
function fromString ( that , string , encoding ) {
if ( typeof encoding !== 'string' || encoding === '' ) {
encoding = 'utf8'
}
if ( ! Buffer . isEncoding ( encoding ) ) {
throw new TypeError ( '"encoding" must be a valid string encoding' )
}
var length = byteLength ( string , encoding ) | 0
that = createBuffer ( that , length )
var actual = that . write ( string , encoding )
if ( actual !== length ) {
// Writing a hex string, for example, that contains invalid characters will
// cause everything after the first invalid character to be ignored. (e.g.
// 'abxxcd' will be treated as 'ab')
that = that . slice ( 0 , actual )
}
return that
}
function fromArrayLike ( that , array ) {
var length = array . length < 0 ? 0 : checked ( array . length ) | 0
that = createBuffer ( that , length )
for ( var i = 0 ; i < length ; i += 1 ) {
that [ i ] = array [ i ] & 255
}
return that
}
function fromArrayBuffer ( that , array , byteOffset , length ) {
array . byteLength // this throws if `array` is not a valid ArrayBuffer
if ( byteOffset < 0 || array . byteLength < byteOffset ) {
throw new RangeError ( '\'offset\' is out of bounds' )
}
if ( array . byteLength < byteOffset + ( length || 0 ) ) {
throw new RangeError ( '\'length\' is out of bounds' )
}
if ( byteOffset === undefined && length === undefined ) {
array = new Uint8Array ( array )
} else if ( length === undefined ) {
array = new Uint8Array ( array , byteOffset )
} else {
array = new Uint8Array ( array , byteOffset , length )
}
if ( Buffer . TYPED _ARRAY _SUPPORT ) {
// Return an augmented `Uint8Array` instance, for best performance
that = array
that . _ _proto _ _ = Buffer . prototype
} else {
// Fallback: Return an object instance of the Buffer class
that = fromArrayLike ( that , array )
}
return that
}
function fromObject ( that , obj ) {
if ( Buffer . isBuffer ( obj ) ) {
var len = checked ( obj . length ) | 0
that = createBuffer ( that , len )
if ( that . length === 0 ) {
return that
}
obj . copy ( that , 0 , 0 , len )
return that
}
if ( obj ) {
if ( ( typeof ArrayBuffer !== 'undefined' &&
obj . buffer instanceof ArrayBuffer ) || 'length' in obj ) {
if ( typeof obj . length !== 'number' || isnan ( obj . length ) ) {
return createBuffer ( that , 0 )
}
return fromArrayLike ( that , obj )
}
if ( obj . type === 'Buffer' && isArray ( obj . data ) ) {
return fromArrayLike ( that , obj . data )
}
}
throw new TypeError ( 'First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.' )
}
function checked ( length ) {
// Note: cannot use `length < kMaxLength()` here because that fails when
// length is NaN (which is otherwise coerced to zero.)
if ( length >= kMaxLength ( ) ) {
throw new RangeError ( 'Attempt to allocate Buffer larger than maximum ' +
'size: 0x' + kMaxLength ( ) . toString ( 16 ) + ' bytes' )
}
return length | 0
}
function SlowBuffer ( length ) {
if ( + length != length ) { // eslint-disable-line eqeqeq
length = 0
}
return Buffer . alloc ( + length )
}
Buffer . isBuffer = function isBuffer ( b ) {
return ! ! ( b != null && b . _isBuffer )
}
Buffer . compare = function compare ( a , b ) {
if ( ! Buffer . isBuffer ( a ) || ! Buffer . isBuffer ( b ) ) {
throw new TypeError ( 'Arguments must be Buffers' )
}
if ( a === b ) return 0
var x = a . length
var y = b . length
for ( var i = 0 , len = Math . min ( x , y ) ; i < len ; ++ i ) {
if ( a [ i ] !== b [ i ] ) {
x = a [ i ]
y = b [ i ]
break
}
}
if ( x < y ) return - 1
if ( y < x ) return 1
return 0
}
Buffer . isEncoding = function isEncoding ( encoding ) {
switch ( String ( encoding ) . toLowerCase ( ) ) {
case 'hex' :
case 'utf8' :
case 'utf-8' :
case 'ascii' :
case 'latin1' :
case 'binary' :
case 'base64' :
case 'ucs2' :
case 'ucs-2' :
case 'utf16le' :
case 'utf-16le' :
return true
default :
return false
}
}
Buffer . concat = function concat ( list , length ) {
if ( ! isArray ( list ) ) {
throw new TypeError ( '"list" argument must be an Array of Buffers' )
}
if ( list . length === 0 ) {
return Buffer . alloc ( 0 )
}
var i
if ( length === undefined ) {
length = 0
for ( i = 0 ; i < list . length ; ++ i ) {
length += list [ i ] . length
}
}
var buffer = Buffer . allocUnsafe ( length )
var pos = 0
for ( i = 0 ; i < list . length ; ++ i ) {
var buf = list [ i ]
if ( ! Buffer . isBuffer ( buf ) ) {
throw new TypeError ( '"list" argument must be an Array of Buffers' )
}
buf . copy ( buffer , pos )
pos += buf . length
}
return buffer
}
function byteLength ( string , encoding ) {
if ( Buffer . isBuffer ( string ) ) {
return string . length
}
if ( typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer . isView === 'function' &&
( ArrayBuffer . isView ( string ) || string instanceof ArrayBuffer ) ) {
return string . byteLength
}
if ( typeof string !== 'string' ) {
string = '' + string
}
var len = string . length
if ( len === 0 ) return 0
// Use a for loop to avoid recursion
var loweredCase = false
for ( ; ; ) {
switch ( encoding ) {
case 'ascii' :
case 'latin1' :
case 'binary' :
return len
case 'utf8' :
case 'utf-8' :
case undefined :
return utf8ToBytes ( string ) . length
case 'ucs2' :
case 'ucs-2' :
case 'utf16le' :
case 'utf-16le' :
return len * 2
case 'hex' :
return len >>> 1
case 'base64' :
return base64ToBytes ( string ) . length
default :
if ( loweredCase ) return utf8ToBytes ( string ) . length // assume utf8
encoding = ( '' + encoding ) . toLowerCase ( )
loweredCase = true
}
}
}
Buffer . byteLength = byteLength
function slowToString ( encoding , start , end ) {
var loweredCase = false
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
// property of a typed array.
// This behaves neither like String nor Uint8Array in that we set start/end
// to their upper/lower bounds if the value passed is out of range.
// undefined is handled specially as per ECMA-262 6th Edition,
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
if ( start === undefined || start < 0 ) {
start = 0
}
// Return early if start > this.length. Done here to prevent potential uint32
// coercion fail below.
if ( start > this . length ) {
return ''
}
if ( end === undefined || end > this . length ) {
end = this . length
}
if ( end <= 0 ) {
return ''
}
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
end >>>= 0
start >>>= 0
if ( end <= start ) {
return ''
}
if ( ! encoding ) encoding = 'utf8'
while ( true ) {
switch ( encoding ) {
case 'hex' :
return hexSlice ( this , start , end )
case 'utf8' :
case 'utf-8' :
return utf8Slice ( this , start , end )
case 'ascii' :
return asciiSlice ( this , start , end )
case 'latin1' :
case 'binary' :
return latin1Slice ( this , start , end )
case 'base64' :
return base64Slice ( this , start , end )
case 'ucs2' :
case 'ucs-2' :
case 'utf16le' :
case 'utf-16le' :
return utf16leSlice ( this , start , end )
default :
if ( loweredCase ) throw new TypeError ( 'Unknown encoding: ' + encoding )
encoding = ( encoding + '' ) . toLowerCase ( )
loweredCase = true
}
}
}
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
// Buffer instances.
Buffer . prototype . _isBuffer = true
function swap ( b , n , m ) {
var i = b [ n ]
b [ n ] = b [ m ]
b [ m ] = i
}
Buffer . prototype . swap16 = function swap16 ( ) {
var len = this . length
if ( len % 2 !== 0 ) {
throw new RangeError ( 'Buffer size must be a multiple of 16-bits' )
}
for ( var i = 0 ; i < len ; i += 2 ) {
swap ( this , i , i + 1 )
}
return this
}
Buffer . prototype . swap32 = function swap32 ( ) {
var len = this . length
if ( len % 4 !== 0 ) {
throw new RangeError ( 'Buffer size must be a multiple of 32-bits' )
}
for ( var i = 0 ; i < len ; i += 4 ) {
swap ( this , i , i + 3 )
swap ( this , i + 1 , i + 2 )
}
return this
}
Buffer . prototype . swap64 = function swap64 ( ) {
var len = this . length
if ( len % 8 !== 0 ) {
throw new RangeError ( 'Buffer size must be a multiple of 64-bits' )
}
for ( var i = 0 ; i < len ; i += 8 ) {
swap ( this , i , i + 7 )
swap ( this , i + 1 , i + 6 )
swap ( this , i + 2 , i + 5 )
swap ( this , i + 3 , i + 4 )
}
return this
}
Buffer . prototype . toString = function toString ( ) {
var length = this . length | 0
if ( length === 0 ) return ''
if ( arguments . length === 0 ) return utf8Slice ( this , 0 , length )
return slowToString . apply ( this , arguments )
}
Buffer . prototype . equals = function equals ( b ) {
if ( ! Buffer . isBuffer ( b ) ) throw new TypeError ( 'Argument must be a Buffer' )
if ( this === b ) return true
return Buffer . compare ( this , b ) === 0
}
Buffer . prototype . inspect = function inspect ( ) {
var str = ''
var max = exports . INSPECT _MAX _BYTES
if ( this . length > 0 ) {
str = this . toString ( 'hex' , 0 , max ) . match ( /.{2}/g ) . join ( ' ' )
if ( this . length > max ) str += ' ... '
}
return '<Buffer ' + str + '>'
}
Buffer . prototype . compare = function compare ( target , start , end , thisStart , thisEnd ) {
if ( ! Buffer . isBuffer ( target ) ) {
throw new TypeError ( 'Argument must be a Buffer' )
}
if ( start === undefined ) {
start = 0
}
if ( end === undefined ) {
end = target ? target . length : 0
}
if ( thisStart === undefined ) {
thisStart = 0
}
if ( thisEnd === undefined ) {
thisEnd = this . length
}
if ( start < 0 || end > target . length || thisStart < 0 || thisEnd > this . length ) {
throw new RangeError ( 'out of range index' )
}
if ( thisStart >= thisEnd && start >= end ) {
return 0
}
if ( thisStart >= thisEnd ) {
return - 1
}
if ( start >= end ) {
return 1
}
start >>>= 0
end >>>= 0
thisStart >>>= 0
thisEnd >>>= 0
if ( this === target ) return 0
var x = thisEnd - thisStart
var y = end - start
var len = Math . min ( x , y )
var thisCopy = this . slice ( thisStart , thisEnd )
var targetCopy = target . slice ( start , end )
for ( var i = 0 ; i < len ; ++ i ) {
if ( thisCopy [ i ] !== targetCopy [ i ] ) {
x = thisCopy [ i ]
y = targetCopy [ i ]
break
}
}
if ( x < y ) return - 1
if ( y < x ) return 1
return 0
}
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
//
// Arguments:
// - buffer - a Buffer to search
// - val - a string, Buffer, or number
// - byteOffset - an index into `buffer`; will be clamped to an int32
// - encoding - an optional encoding, relevant is val is a string
// - dir - true for indexOf, false for lastIndexOf
function bidirectionalIndexOf ( buffer , val , byteOffset , encoding , dir ) {
// Empty buffer means no match
if ( buffer . length === 0 ) return - 1
// Normalize byteOffset
if ( typeof byteOffset === 'string' ) {
encoding = byteOffset
byteOffset = 0
} else if ( byteOffset > 0x7fffffff ) {
byteOffset = 0x7fffffff
} else if ( byteOffset < - 0x80000000 ) {
byteOffset = - 0x80000000
}
byteOffset = + byteOffset // Coerce to Number.
if ( isNaN ( byteOffset ) ) {
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
byteOffset = dir ? 0 : ( buffer . length - 1 )
}
// Normalize byteOffset: negative offsets start from the end of the buffer
if ( byteOffset < 0 ) byteOffset = buffer . length + byteOffset
if ( byteOffset >= buffer . length ) {
if ( dir ) return - 1
else byteOffset = buffer . length - 1
} else if ( byteOffset < 0 ) {
if ( dir ) byteOffset = 0
else return - 1
}
// Normalize val
if ( typeof val === 'string' ) {
val = Buffer . from ( val , encoding )
}
// Finally, search either indexOf (if dir is true) or lastIndexOf
if ( Buffer . isBuffer ( val ) ) {
// Special case: looking for empty string/buffer always fails
if ( val . length === 0 ) {
return - 1
}
return arrayIndexOf ( buffer , val , byteOffset , encoding , dir )
} else if ( typeof val === 'number' ) {
val = val & 0xFF // Search for a byte value [0-255]
if ( Buffer . TYPED _ARRAY _SUPPORT &&
typeof Uint8Array . prototype . indexOf === 'function' ) {
if ( dir ) {
return Uint8Array . prototype . indexOf . call ( buffer , val , byteOffset )
} else {
return Uint8Array . prototype . lastIndexOf . call ( buffer , val , byteOffset )
}
}
return arrayIndexOf ( buffer , [ val ] , byteOffset , encoding , dir )
}
throw new TypeError ( 'val must be string, number or Buffer' )
}
function arrayIndexOf ( arr , val , byteOffset , encoding , dir ) {
var indexSize = 1
var arrLength = arr . length
var valLength = val . length
if ( encoding !== undefined ) {
encoding = String ( encoding ) . toLowerCase ( )
if ( encoding === 'ucs2' || encoding === 'ucs-2' ||
encoding === 'utf16le' || encoding === 'utf-16le' ) {
if ( arr . length < 2 || val . length < 2 ) {
return - 1
}
indexSize = 2
arrLength /= 2
valLength /= 2
byteOffset /= 2
}
}
function read ( buf , i ) {
if ( indexSize === 1 ) {
return buf [ i ]
} else {
return buf . readUInt16BE ( i * indexSize )
}
}
var i
if ( dir ) {
var foundIndex = - 1
for ( i = byteOffset ; i < arrLength ; i ++ ) {
if ( read ( arr , i ) === read ( val , foundIndex === - 1 ? 0 : i - foundIndex ) ) {
if ( foundIndex === - 1 ) foundIndex = i
if ( i - foundIndex + 1 === valLength ) return foundIndex * indexSize
} else {
if ( foundIndex !== - 1 ) i -= i - foundIndex
foundIndex = - 1
}
}
} else {
if ( byteOffset + valLength > arrLength ) byteOffset = arrLength - valLength
for ( i = byteOffset ; i >= 0 ; i -- ) {
var found = true
for ( var j = 0 ; j < valLength ; j ++ ) {
if ( read ( arr , i + j ) !== read ( val , j ) ) {
found = false
break
}
}
if ( found ) return i
}
}
return - 1
}
Buffer . prototype . includes = function includes ( val , byteOffset , encoding ) {
return this . indexOf ( val , byteOffset , encoding ) !== - 1
}
Buffer . prototype . indexOf = function indexOf ( val , byteOffset , encoding ) {
return bidirectionalIndexOf ( this , val , byteOffset , encoding , true )
}
Buffer . prototype . lastIndexOf = function lastIndexOf ( val , byteOffset , encoding ) {
return bidirectionalIndexOf ( this , val , byteOffset , encoding , false )
}
function hexWrite ( buf , string , offset , length ) {
offset = Number ( offset ) || 0
var remaining = buf . length - offset
if ( ! length ) {
length = remaining
} else {
length = Number ( length )
if ( length > remaining ) {
length = remaining
}
}
// must be an even number of digits
var strLen = string . length
if ( strLen % 2 !== 0 ) throw new TypeError ( 'Invalid hex string' )
if ( length > strLen / 2 ) {
length = strLen / 2
}
for ( var i = 0 ; i < length ; ++ i ) {
var parsed = parseInt ( string . substr ( i * 2 , 2 ) , 16 )
if ( isNaN ( parsed ) ) return i
buf [ offset + i ] = parsed
}
return i
}
function utf8Write ( buf , string , offset , length ) {
return blitBuffer ( utf8ToBytes ( string , buf . length - offset ) , buf , offset , length )
}
function asciiWrite ( buf , string , offset , length ) {
return blitBuffer ( asciiToBytes ( string ) , buf , offset , length )
}
function latin1Write ( buf , string , offset , length ) {
return asciiWrite ( buf , string , offset , length )
}
function base64Write ( buf , string , offset , length ) {
return blitBuffer ( base64ToBytes ( string ) , buf , offset , length )
}
function ucs2Write ( buf , string , offset , length ) {
return blitBuffer ( utf16leToBytes ( string , buf . length - offset ) , buf , offset , length )
}
Buffer . prototype . write = function write ( string , offset , length , encoding ) {
// Buffer#write(string)
if ( offset === undefined ) {
encoding = 'utf8'
length = this . length
offset = 0
// Buffer#write(string, encoding)
} else if ( length === undefined && typeof offset === 'string' ) {
encoding = offset
length = this . length
offset = 0
// Buffer#write(string, offset[, length][, encoding])
} else if ( isFinite ( offset ) ) {
offset = offset | 0
if ( isFinite ( length ) ) {
length = length | 0
if ( encoding === undefined ) encoding = 'utf8'
} else {
encoding = length
length = undefined
}
// legacy write(string, encoding, offset, length) - remove in v0.13
} else {
throw new Error (
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
)
}
var remaining = this . length - offset
if ( length === undefined || length > remaining ) length = remaining
if ( ( string . length > 0 && ( length < 0 || offset < 0 ) ) || offset > this . length ) {
throw new RangeError ( 'Attempt to write outside buffer bounds' )
}
if ( ! encoding ) encoding = 'utf8'
var loweredCase = false
for ( ; ; ) {
switch ( encoding ) {
case 'hex' :
return hexWrite ( this , string , offset , length )
case 'utf8' :
case 'utf-8' :
return utf8Write ( this , string , offset , length )
case 'ascii' :
return asciiWrite ( this , string , offset , length )
case 'latin1' :
case 'binary' :
return latin1Write ( this , string , offset , length )
case 'base64' :
// Warning: maxLength not taken into account in base64Write
return base64Write ( this , string , offset , length )
case 'ucs2' :
case 'ucs-2' :
case 'utf16le' :
case 'utf-16le' :
return ucs2Write ( this , string , offset , length )
default :
if ( loweredCase ) throw new TypeError ( 'Unknown encoding: ' + encoding )
encoding = ( '' + encoding ) . toLowerCase ( )
loweredCase = true
}
}
}
Buffer . prototype . toJSON = function toJSON ( ) {
return {
type : 'Buffer' ,
data : Array . prototype . slice . call ( this . _arr || this , 0 )
}
}
function base64Slice ( buf , start , end ) {
if ( start === 0 && end === buf . length ) {
return base64 . fromByteArray ( buf )
} else {
return base64 . fromByteArray ( buf . slice ( start , end ) )
}
}
function utf8Slice ( buf , start , end ) {
end = Math . min ( buf . length , end )
var res = [ ]
var i = start
while ( i < end ) {
var firstByte = buf [ i ]
var codePoint = null
var bytesPerSequence = ( firstByte > 0xEF ) ? 4
: ( firstByte > 0xDF ) ? 3
: ( firstByte > 0xBF ) ? 2
: 1
if ( i + bytesPerSequence <= end ) {
var secondByte , thirdByte , fourthByte , tempCodePoint
switch ( bytesPerSequence ) {
case 1 :
if ( firstByte < 0x80 ) {
codePoint = firstByte
}
break
case 2 :
secondByte = buf [ i + 1 ]
if ( ( secondByte & 0xC0 ) === 0x80 ) {
tempCodePoint = ( firstByte & 0x1F ) << 0x6 | ( secondByte & 0x3F )
if ( tempCodePoint > 0x7F ) {
codePoint = tempCodePoint
}
}
break
case 3 :
secondByte = buf [ i + 1 ]
thirdByte = buf [ i + 2 ]
if ( ( secondByte & 0xC0 ) === 0x80 && ( thirdByte & 0xC0 ) === 0x80 ) {
tempCodePoint = ( firstByte & 0xF ) << 0xC | ( secondByte & 0x3F ) << 0x6 | ( thirdByte & 0x3F )
if ( tempCodePoint > 0x7FF && ( tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF ) ) {
codePoint = tempCodePoint
}
}
break
case 4 :
secondByte = buf [ i + 1 ]
thirdByte = buf [ i + 2 ]
fourthByte = buf [ i + 3 ]
if ( ( secondByte & 0xC0 ) === 0x80 && ( thirdByte & 0xC0 ) === 0x80 && ( fourthByte & 0xC0 ) === 0x80 ) {
tempCodePoint = ( firstByte & 0xF ) << 0x12 | ( secondByte & 0x3F ) << 0xC | ( thirdByte & 0x3F ) << 0x6 | ( fourthByte & 0x3F )
if ( tempCodePoint > 0xFFFF && tempCodePoint < 0x110000 ) {
codePoint = tempCodePoint
}
}
}
}
if ( codePoint === null ) {
// we did not generate a valid codePoint so insert a
// replacement char (U+FFFD) and advance only 1 byte
codePoint = 0xFFFD
bytesPerSequence = 1
} else if ( codePoint > 0xFFFF ) {
// encode to utf16 (surrogate pair dance)
codePoint -= 0x10000
res . push ( codePoint >>> 10 & 0x3FF | 0xD800 )
codePoint = 0xDC00 | codePoint & 0x3FF
}
res . push ( codePoint )
i += bytesPerSequence
}
return decodeCodePointsArray ( res )
}
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
// the lowest limit is Chrome, with 0x10000 args.
// We go 1 magnitude less, for safety
var MAX _ARGUMENTS _LENGTH = 0x1000
function decodeCodePointsArray ( codePoints ) {
var len = codePoints . length
if ( len <= MAX _ARGUMENTS _LENGTH ) {
return String . fromCharCode . apply ( String , codePoints ) // avoid extra slice()
}
// Decode in chunks to avoid "call stack size exceeded".
var res = ''
var i = 0
while ( i < len ) {
res += String . fromCharCode . apply (
String ,
codePoints . slice ( i , i += MAX _ARGUMENTS _LENGTH )
)
}
return res
}
function asciiSlice ( buf , start , end ) {
var ret = ''
end = Math . min ( buf . length , end )
for ( var i = start ; i < end ; ++ i ) {
ret += String . fromCharCode ( buf [ i ] & 0x7F )
}
return ret
}
function latin1Slice ( buf , start , end ) {
var ret = ''
end = Math . min ( buf . length , end )
for ( var i = start ; i < end ; ++ i ) {
ret += String . fromCharCode ( buf [ i ] )
}
return ret
}
function hexSlice ( buf , start , end ) {
var len = buf . length
if ( ! start || start < 0 ) start = 0
if ( ! end || end < 0 || end > len ) end = len
var out = ''
for ( var i = start ; i < end ; ++ i ) {
out += toHex ( buf [ i ] )
}
return out
}
function utf16leSlice ( buf , start , end ) {
var bytes = buf . slice ( start , end )
var res = ''
for ( var i = 0 ; i < bytes . length ; i += 2 ) {
res += String . fromCharCode ( bytes [ i ] + bytes [ i + 1 ] * 256 )
}
return res
}
Buffer . prototype . slice = function slice ( start , end ) {
var len = this . length
start = ~ ~ start
end = end === undefined ? len : ~ ~ end
if ( start < 0 ) {
start += len
if ( start < 0 ) start = 0
} else if ( start > len ) {
start = len
}
if ( end < 0 ) {
end += len
if ( end < 0 ) end = 0
} else if ( end > len ) {
end = len
}
if ( end < start ) end = start
var newBuf
if ( Buffer . TYPED _ARRAY _SUPPORT ) {
newBuf = this . subarray ( start , end )
newBuf . _ _proto _ _ = Buffer . prototype
} else {
var sliceLen = end - start
newBuf = new Buffer ( sliceLen , undefined )
for ( var i = 0 ; i < sliceLen ; ++ i ) {
newBuf [ i ] = this [ i + start ]
}
}
return newBuf
}
/ *
* Need to make sure that buffer isn ' t trying to write out of bounds .
* /
function checkOffset ( offset , ext , length ) {
if ( ( offset % 1 ) !== 0 || offset < 0 ) throw new RangeError ( 'offset is not uint' )
if ( offset + ext > length ) throw new RangeError ( 'Trying to access beyond buffer length' )
}
Buffer . prototype . readUIntLE = function readUIntLE ( offset , byteLength , noAssert ) {
offset = offset | 0
byteLength = byteLength | 0
if ( ! noAssert ) checkOffset ( offset , byteLength , this . length )
var val = this [ offset ]
var mul = 1
var i = 0
while ( ++ i < byteLength && ( mul *= 0x100 ) ) {
val += this [ offset + i ] * mul
}
return val
}
Buffer . prototype . readUIntBE = function readUIntBE ( offset , byteLength , noAssert ) {
offset = offset | 0
byteLength = byteLength | 0
if ( ! noAssert ) {
checkOffset ( offset , byteLength , this . length )
}
var val = this [ offset + -- byteLength ]
var mul = 1
while ( byteLength > 0 && ( mul *= 0x100 ) ) {
val += this [ offset + -- byteLength ] * mul
}
return val
}
Buffer . prototype . readUInt8 = function readUInt8 ( offset , noAssert ) {
if ( ! noAssert ) checkOffset ( offset , 1 , this . length )
return this [ offset ]
}
Buffer . prototype . readUInt16LE = function readUInt16LE ( offset , noAssert ) {
if ( ! noAssert ) checkOffset ( offset , 2 , this . length )
return this [ offset ] | ( this [ offset + 1 ] << 8 )
}
Buffer . prototype . readUInt16BE = function readUInt16BE ( offset , noAssert ) {
if ( ! noAssert ) checkOffset ( offset , 2 , this . length )
return ( this [ offset ] << 8 ) | this [ offset + 1 ]
}
Buffer . prototype . readUInt32LE = function readUInt32LE ( offset , noAssert ) {
if ( ! noAssert ) checkOffset ( offset , 4 , this . length )
return ( ( this [ offset ] ) |
( this [ offset + 1 ] << 8 ) |
( this [ offset + 2 ] << 16 ) ) +
( this [ offset + 3 ] * 0x1000000 )
}
Buffer . prototype . readUInt32BE = function readUInt32BE ( offset , noAssert ) {
if ( ! noAssert ) checkOffset ( offset , 4 , this . length )
return ( this [ offset ] * 0x1000000 ) +
( ( this [ offset + 1 ] << 16 ) |
( this [ offset + 2 ] << 8 ) |
this [ offset + 3 ] )
}
Buffer . prototype . readIntLE = function readIntLE ( offset , byteLength , noAssert ) {
offset = offset | 0
byteLength = byteLength | 0
if ( ! noAssert ) checkOffset ( offset , byteLength , this . length )
var val = this [ offset ]
var mul = 1
var i = 0
while ( ++ i < byteLength && ( mul *= 0x100 ) ) {
val += this [ offset + i ] * mul
}
mul *= 0x80
if ( val >= mul ) val -= Math . pow ( 2 , 8 * byteLength )
return val
}
Buffer . prototype . readIntBE = function readIntBE ( offset , byteLength , noAssert ) {
offset = offset | 0
byteLength = byteLength | 0
if ( ! noAssert ) checkOffset ( offset , byteLength , this . length )
var i = byteLength
var mul = 1
var val = this [ offset + -- i ]
while ( i > 0 && ( mul *= 0x100 ) ) {
val += this [ offset + -- i ] * mul
}
mul *= 0x80
if ( val >= mul ) val -= Math . pow ( 2 , 8 * byteLength )
return val
}
Buffer . prototype . readInt8 = function readInt8 ( offset , noAssert ) {
if ( ! noAssert ) checkOffset ( offset , 1 , this . length )
if ( ! ( this [ offset ] & 0x80 ) ) return ( this [ offset ] )
return ( ( 0xff - this [ offset ] + 1 ) * - 1 )
}
Buffer . prototype . readInt16LE = function readInt16LE ( offset , noAssert ) {
if ( ! noAssert ) checkOffset ( offset , 2 , this . length )
var val = this [ offset ] | ( this [ offset + 1 ] << 8 )
return ( val & 0x8000 ) ? val | 0xFFFF0000 : val
}
Buffer . prototype . readInt16BE = function readInt16BE ( offset , noAssert ) {
if ( ! noAssert ) checkOffset ( offset , 2 , this . length )
var val = this [ offset + 1 ] | ( this [ offset ] << 8 )
return ( val & 0x8000 ) ? val | 0xFFFF0000 : val
}
Buffer . prototype . readInt32LE = function readInt32LE ( offset , noAssert ) {
if ( ! noAssert ) checkOffset ( offset , 4 , this . length )
return ( this [ offset ] ) |
( this [ offset + 1 ] << 8 ) |
( this [ offset + 2 ] << 16 ) |
( this [ offset + 3 ] << 24 )
}
Buffer . prototype . readInt32BE = function readInt32BE ( offset , noAssert ) {
if ( ! noAssert ) checkOffset ( offset , 4 , this . length )
return ( this [ offset ] << 24 ) |
( this [ offset + 1 ] << 16 ) |
( this [ offset + 2 ] << 8 ) |
( this [ offset + 3 ] )
}
Buffer . prototype . readFloatLE = function readFloatLE ( offset , noAssert ) {
if ( ! noAssert ) checkOffset ( offset , 4 , this . length )
return ieee754 . read ( this , offset , true , 23 , 4 )
}
Buffer . prototype . readFloatBE = function readFloatBE ( offset , noAssert ) {
if ( ! noAssert ) checkOffset ( offset , 4 , this . length )
return ieee754 . read ( this , offset , false , 23 , 4 )
}
Buffer . prototype . readDoubleLE = function readDoubleLE ( offset , noAssert ) {
if ( ! noAssert ) checkOffset ( offset , 8 , this . length )
return ieee754 . read ( this , offset , true , 52 , 8 )
}
Buffer . prototype . readDoubleBE = function readDoubleBE ( offset , noAssert ) {
if ( ! noAssert ) checkOffset ( offset , 8 , this . length )
return ieee754 . read ( this , offset , false , 52 , 8 )
}
function checkInt ( buf , value , offset , ext , max , min ) {
if ( ! Buffer . isBuffer ( buf ) ) throw new TypeError ( '"buffer" argument must be a Buffer instance' )
if ( value > max || value < min ) throw new RangeError ( '"value" argument is out of bounds' )
if ( offset + ext > buf . length ) throw new RangeError ( 'Index out of range' )
}
Buffer . prototype . writeUIntLE = function writeUIntLE ( value , offset , byteLength , noAssert ) {
value = + value
offset = offset | 0
byteLength = byteLength | 0
if ( ! noAssert ) {
var maxBytes = Math . pow ( 2 , 8 * byteLength ) - 1
checkInt ( this , value , offset , byteLength , maxBytes , 0 )
}
var mul = 1
var i = 0
this [ offset ] = value & 0xFF
while ( ++ i < byteLength && ( mul *= 0x100 ) ) {
this [ offset + i ] = ( value / mul ) & 0xFF
}
return offset + byteLength
}
Buffer . prototype . writeUIntBE = function writeUIntBE ( value , offset , byteLength , noAssert ) {
value = + value
offset = offset | 0
byteLength = byteLength | 0
if ( ! noAssert ) {
var maxBytes = Math . pow ( 2 , 8 * byteLength ) - 1
checkInt ( this , value , offset , byteLength , maxBytes , 0 )
}
var i = byteLength - 1
var mul = 1
this [ offset + i ] = value & 0xFF
while ( -- i >= 0 && ( mul *= 0x100 ) ) {
this [ offset + i ] = ( value / mul ) & 0xFF
}
return offset + byteLength
}
Buffer . prototype . writeUInt8 = function writeUInt8 ( value , offset , noAssert ) {
value = + value
offset = offset | 0
if ( ! noAssert ) checkInt ( this , value , offset , 1 , 0xff , 0 )
if ( ! Buffer . TYPED _ARRAY _SUPPORT ) value = Math . floor ( value )
this [ offset ] = ( value & 0xff )
return offset + 1
}
function objectWriteUInt16 ( buf , value , offset , littleEndian ) {
if ( value < 0 ) value = 0xffff + value + 1
for ( var i = 0 , j = Math . min ( buf . length - offset , 2 ) ; i < j ; ++ i ) {
buf [ offset + i ] = ( value & ( 0xff << ( 8 * ( littleEndian ? i : 1 - i ) ) ) ) >>>
( littleEndian ? i : 1 - i ) * 8
}
}
Buffer . prototype . writeUInt16LE = function writeUInt16LE ( value , offset , noAssert ) {
value = + value
offset = offset | 0
if ( ! noAssert ) checkInt ( this , value , offset , 2 , 0xffff , 0 )
if ( Buffer . TYPED _ARRAY _SUPPORT ) {
this [ offset ] = ( value & 0xff )
this [ offset + 1 ] = ( value >>> 8 )
} else {
objectWriteUInt16 ( this , value , offset , true )
}
return offset + 2
}
Buffer . prototype . writeUInt16BE = function writeUInt16BE ( value , offset , noAssert ) {
value = + value
offset = offset | 0
if ( ! noAssert ) checkInt ( this , value , offset , 2 , 0xffff , 0 )
if ( Buffer . TYPED _ARRAY _SUPPORT ) {
this [ offset ] = ( value >>> 8 )
this [ offset + 1 ] = ( value & 0xff )
} else {
objectWriteUInt16 ( this , value , offset , false )
}
return offset + 2
}
function objectWriteUInt32 ( buf , value , offset , littleEndian ) {
if ( value < 0 ) value = 0xffffffff + value + 1
for ( var i = 0 , j = Math . min ( buf . length - offset , 4 ) ; i < j ; ++ i ) {
buf [ offset + i ] = ( value >>> ( littleEndian ? i : 3 - i ) * 8 ) & 0xff
}
}
Buffer . prototype . writeUInt32LE = function writeUInt32LE ( value , offset , noAssert ) {
value = + value
offset = offset | 0
if ( ! noAssert ) checkInt ( this , value , offset , 4 , 0xffffffff , 0 )
if ( Buffer . TYPED _ARRAY _SUPPORT ) {
this [ offset + 3 ] = ( value >>> 24 )
this [ offset + 2 ] = ( value >>> 16 )
this [ offset + 1 ] = ( value >>> 8 )
this [ offset ] = ( value & 0xff )
} else {
objectWriteUInt32 ( this , value , offset , true )
}
return offset + 4
}
Buffer . prototype . writeUInt32BE = function writeUInt32BE ( value , offset , noAssert ) {
value = + value
offset = offset | 0
if ( ! noAssert ) checkInt ( this , value , offset , 4 , 0xffffffff , 0 )
if ( Buffer . TYPED _ARRAY _SUPPORT ) {
this [ offset ] = ( value >>> 24 )
this [ offset + 1 ] = ( value >>> 16 )
this [ offset + 2 ] = ( value >>> 8 )
this [ offset + 3 ] = ( value & 0xff )
} else {
objectWriteUInt32 ( this , value , offset , false )
}
return offset + 4
}
Buffer . prototype . writeIntLE = function writeIntLE ( value , offset , byteLength , noAssert ) {
value = + value
offset = offset | 0
if ( ! noAssert ) {
var limit = Math . pow ( 2 , 8 * byteLength - 1 )
checkInt ( this , value , offset , byteLength , limit - 1 , - limit )
}
var i = 0
var mul = 1
var sub = 0
this [ offset ] = value & 0xFF
while ( ++ i < byteLength && ( mul *= 0x100 ) ) {
if ( value < 0 && sub === 0 && this [ offset + i - 1 ] !== 0 ) {
sub = 1
}
this [ offset + i ] = ( ( value / mul ) >> 0 ) - sub & 0xFF
}
return offset + byteLength
}
Buffer . prototype . writeIntBE = function writeIntBE ( value , offset , byteLength , noAssert ) {
value = + value
offset = offset | 0
if ( ! noAssert ) {
var limit = Math . pow ( 2 , 8 * byteLength - 1 )
checkInt ( this , value , offset , byteLength , limit - 1 , - limit )
}
var i = byteLength - 1
var mul = 1
var sub = 0
this [ offset + i ] = value & 0xFF
while ( -- i >= 0 && ( mul *= 0x100 ) ) {
if ( value < 0 && sub === 0 && this [ offset + i + 1 ] !== 0 ) {
sub = 1
}
this [ offset + i ] = ( ( value / mul ) >> 0 ) - sub & 0xFF
}
return offset + byteLength
}
Buffer . prototype . writeInt8 = function writeInt8 ( value , offset , noAssert ) {
value = + value
offset = offset | 0
if ( ! noAssert ) checkInt ( this , value , offset , 1 , 0x7f , - 0x80 )
if ( ! Buffer . TYPED _ARRAY _SUPPORT ) value = Math . floor ( value )
if ( value < 0 ) value = 0xff + value + 1
this [ offset ] = ( value & 0xff )
return offset + 1
}
Buffer . prototype . writeInt16LE = function writeInt16LE ( value , offset , noAssert ) {
value = + value
offset = offset | 0
if ( ! noAssert ) checkInt ( this , value , offset , 2 , 0x7fff , - 0x8000 )
if ( Buffer . TYPED _ARRAY _SUPPORT ) {
this [ offset ] = ( value & 0xff )
this [ offset + 1 ] = ( value >>> 8 )
} else {
objectWriteUInt16 ( this , value , offset , true )
}
return offset + 2
}
Buffer . prototype . writeInt16BE = function writeInt16BE ( value , offset , noAssert ) {
value = + value
offset = offset | 0
if ( ! noAssert ) checkInt ( this , value , offset , 2 , 0x7fff , - 0x8000 )
if ( Buffer . TYPED _ARRAY _SUPPORT ) {
this [ offset ] = ( value >>> 8 )
this [ offset + 1 ] = ( value & 0xff )
} else {
objectWriteUInt16 ( this , value , offset , false )
}
return offset + 2
}
Buffer . prototype . writeInt32LE = function writeInt32LE ( value , offset , noAssert ) {
value = + value
offset = offset | 0
if ( ! noAssert ) checkInt ( this , value , offset , 4 , 0x7fffffff , - 0x80000000 )
if ( Buffer . TYPED _ARRAY _SUPPORT ) {
this [ offset ] = ( value & 0xff )
this [ offset + 1 ] = ( value >>> 8 )
this [ offset + 2 ] = ( value >>> 16 )
this [ offset + 3 ] = ( value >>> 24 )
} else {
objectWriteUInt32 ( this , value , offset , true )
}
return offset + 4
}
Buffer . prototype . writeInt32BE = function writeInt32BE ( value , offset , noAssert ) {
value = + value
offset = offset | 0
if ( ! noAssert ) checkInt ( this , value , offset , 4 , 0x7fffffff , - 0x80000000 )
if ( value < 0 ) value = 0xffffffff + value + 1
if ( Buffer . TYPED _ARRAY _SUPPORT ) {
this [ offset ] = ( value >>> 24 )
this [ offset + 1 ] = ( value >>> 16 )
this [ offset + 2 ] = ( value >>> 8 )
this [ offset + 3 ] = ( value & 0xff )
} else {
objectWriteUInt32 ( this , value , offset , false )
}
return offset + 4
}
function checkIEEE754 ( buf , value , offset , ext , max , min ) {
if ( offset + ext > buf . length ) throw new RangeError ( 'Index out of range' )
if ( offset < 0 ) throw new RangeError ( 'Index out of range' )
}
function writeFloat ( buf , value , offset , littleEndian , noAssert ) {
if ( ! noAssert ) {
checkIEEE754 ( buf , value , offset , 4 , 3.4028234663852886 e + 38 , - 3.4028234663852886 e + 38 )
}
ieee754 . write ( buf , value , offset , littleEndian , 23 , 4 )
return offset + 4
}
Buffer . prototype . writeFloatLE = function writeFloatLE ( value , offset , noAssert ) {
return writeFloat ( this , value , offset , true , noAssert )
}
Buffer . prototype . writeFloatBE = function writeFloatBE ( value , offset , noAssert ) {
return writeFloat ( this , value , offset , false , noAssert )
}
function writeDouble ( buf , value , offset , littleEndian , noAssert ) {
if ( ! noAssert ) {
checkIEEE754 ( buf , value , offset , 8 , 1.7976931348623157 E + 308 , - 1.7976931348623157 E + 308 )
}
ieee754 . write ( buf , value , offset , littleEndian , 52 , 8 )
return offset + 8
}
Buffer . prototype . writeDoubleLE = function writeDoubleLE ( value , offset , noAssert ) {
return writeDouble ( this , value , offset , true , noAssert )
}
Buffer . prototype . writeDoubleBE = function writeDoubleBE ( value , offset , noAssert ) {
return writeDouble ( this , value , offset , false , noAssert )
}
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
Buffer . prototype . copy = function copy ( target , targetStart , start , end ) {
if ( ! start ) start = 0
if ( ! end && end !== 0 ) end = this . length
if ( targetStart >= target . length ) targetStart = target . length
if ( ! targetStart ) targetStart = 0
if ( end > 0 && end < start ) end = start
// Copy 0 bytes; we're done
if ( end === start ) return 0
if ( target . length === 0 || this . length === 0 ) return 0
// Fatal error conditions
if ( targetStart < 0 ) {
throw new RangeError ( 'targetStart out of bounds' )
}
if ( start < 0 || start >= this . length ) throw new RangeError ( 'sourceStart out of bounds' )
if ( end < 0 ) throw new RangeError ( 'sourceEnd out of bounds' )
// Are we oob?
if ( end > this . length ) end = this . length
if ( target . length - targetStart < end - start ) {
end = target . length - targetStart + start
}
var len = end - start
var i
if ( this === target && start < targetStart && targetStart < end ) {
// descending copy from end
for ( i = len - 1 ; i >= 0 ; -- i ) {
target [ i + targetStart ] = this [ i + start ]
}
} else if ( len < 1000 || ! Buffer . TYPED _ARRAY _SUPPORT ) {
// ascending copy from start
for ( i = 0 ; i < len ; ++ i ) {
target [ i + targetStart ] = this [ i + start ]
}
} else {
Uint8Array . prototype . set . call (
target ,
this . subarray ( start , start + len ) ,
targetStart
)
}
return len
}
// Usage:
// buffer.fill(number[, offset[, end]])
// buffer.fill(buffer[, offset[, end]])
// buffer.fill(string[, offset[, end]][, encoding])
Buffer . prototype . fill = function fill ( val , start , end , encoding ) {
// Handle string cases:
if ( typeof val === 'string' ) {
if ( typeof start === 'string' ) {
encoding = start
start = 0
end = this . length
} else if ( typeof end === 'string' ) {
encoding = end
end = this . length
}
if ( val . length === 1 ) {
var code = val . charCodeAt ( 0 )
if ( code < 256 ) {
val = code
}
}
if ( encoding !== undefined && typeof encoding !== 'string' ) {
throw new TypeError ( 'encoding must be a string' )
}
if ( typeof encoding === 'string' && ! Buffer . isEncoding ( encoding ) ) {
throw new TypeError ( 'Unknown encoding: ' + encoding )
}
} else if ( typeof val === 'number' ) {
val = val & 255
}
// Invalid ranges are not set to a default, so can range check early.
if ( start < 0 || this . length < start || this . length < end ) {
throw new RangeError ( 'Out of range index' )
}
if ( end <= start ) {
return this
}
start = start >>> 0
end = end === undefined ? this . length : end >>> 0
if ( ! val ) val = 0
var i
if ( typeof val === 'number' ) {
for ( i = start ; i < end ; ++ i ) {
this [ i ] = val
}
} else {
var bytes = Buffer . isBuffer ( val )
? val
: utf8ToBytes ( new Buffer ( val , encoding ) . toString ( ) )
var len = bytes . length
for ( i = 0 ; i < end - start ; ++ i ) {
this [ i + start ] = bytes [ i % len ]
}
}
return this
}
// HELPER FUNCTIONS
// ================
var INVALID _BASE64 _RE = /[^+\/0-9A-Za-z-_]/g
function base64clean ( str ) {
// Node strips out invalid characters like \n and \t from the string, base64-js does not
str = stringtrim ( str ) . replace ( INVALID _BASE64 _RE , '' )
// Node converts strings with length < 2 to ''
if ( str . length < 2 ) return ''
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
while ( str . length % 4 !== 0 ) {
str = str + '='
}
return str
}
function stringtrim ( str ) {
if ( str . trim ) return str . trim ( )
return str . replace ( /^\s+|\s+$/g , '' )
}
function toHex ( n ) {
if ( n < 16 ) return '0' + n . toString ( 16 )
return n . toString ( 16 )
}
function utf8ToBytes ( string , units ) {
units = units || Infinity
var codePoint
var length = string . length
var leadSurrogate = null
var bytes = [ ]
for ( var i = 0 ; i < length ; ++ i ) {
codePoint = string . charCodeAt ( i )
// is surrogate component
if ( codePoint > 0xD7FF && codePoint < 0xE000 ) {
// last char was a lead
if ( ! leadSurrogate ) {
// no lead yet
if ( codePoint > 0xDBFF ) {
// unexpected trail
if ( ( units -= 3 ) > - 1 ) bytes . push ( 0xEF , 0xBF , 0xBD )
continue
} else if ( i + 1 === length ) {
// unpaired lead
if ( ( units -= 3 ) > - 1 ) bytes . push ( 0xEF , 0xBF , 0xBD )
continue
}
// valid lead
leadSurrogate = codePoint
continue
}
// 2 leads in a row
if ( codePoint < 0xDC00 ) {
if ( ( units -= 3 ) > - 1 ) bytes . push ( 0xEF , 0xBF , 0xBD )
leadSurrogate = codePoint
continue
}
// valid surrogate pair
codePoint = ( leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 ) + 0x10000
} else if ( leadSurrogate ) {
// valid bmp char, but last char was a lead
if ( ( units -= 3 ) > - 1 ) bytes . push ( 0xEF , 0xBF , 0xBD )
}
leadSurrogate = null
// encode utf8
if ( codePoint < 0x80 ) {
if ( ( units -= 1 ) < 0 ) break
bytes . push ( codePoint )
} else if ( codePoint < 0x800 ) {
if ( ( units -= 2 ) < 0 ) break
bytes . push (
codePoint >> 0x6 | 0xC0 ,
codePoint & 0x3F | 0x80
)
} else if ( codePoint < 0x10000 ) {
if ( ( units -= 3 ) < 0 ) break
bytes . push (
codePoint >> 0xC | 0xE0 ,
codePoint >> 0x6 & 0x3F | 0x80 ,
codePoint & 0x3F | 0x80
)
} else if ( codePoint < 0x110000 ) {
if ( ( units -= 4 ) < 0 ) break
bytes . push (
codePoint >> 0x12 | 0xF0 ,
codePoint >> 0xC & 0x3F | 0x80 ,
codePoint >> 0x6 & 0x3F | 0x80 ,
codePoint & 0x3F | 0x80
)
} else {
throw new Error ( 'Invalid code point' )
}
}
return bytes
}
function asciiToBytes ( str ) {
var byteArray = [ ]
for ( var i = 0 ; i < str . length ; ++ i ) {
// Node's code seems to be doing this and not & 0x7F..
byteArray . push ( str . charCodeAt ( i ) & 0xFF )
}
return byteArray
}
function utf16leToBytes ( str , units ) {
var c , hi , lo
var byteArray = [ ]
for ( var i = 0 ; i < str . length ; ++ i ) {
if ( ( units -= 2 ) < 0 ) break
c = str . charCodeAt ( i )
hi = c >> 8
lo = c % 256
byteArray . push ( lo )
byteArray . push ( hi )
}
return byteArray
}
function base64ToBytes ( str ) {
return base64 . toByteArray ( base64clean ( str ) )
}
function blitBuffer ( src , dst , offset , length ) {
for ( var i = 0 ; i < length ; ++ i ) {
if ( ( i + offset >= dst . length ) || ( i >= src . length ) ) break
dst [ i + offset ] = src [ i ]
}
return i
}
function isnan ( val ) {
return val !== val // eslint-disable-line no-self-compare
}
2017-05-05 17:24:23 +02:00
/* WEBPACK VAR INJECTION */ } . call ( exports , _ _webpack _require _ _ ( 14 ) ) )
2017-04-26 15:58:19 +02:00
/***/ } ) ,
/* 3 */
2017-05-05 17:24:23 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
var basex = _ _webpack _require _ _ ( 51 )
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
module . exports = basex ( ALPHABET )
/***/ } ) ,
/* 4 */
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
! function ( t , e ) { true ? module . exports = e ( ) : "function" == typeof define && define . amd ? define ( "FiveBellsCondition" , [ ] , e ) : "object" == typeof exports ? exports . FiveBellsCondition = e ( ) : t . FiveBellsCondition = e ( ) } ( this , function ( ) { return function ( t ) { function e ( n ) { if ( r [ n ] ) return r [ n ] . exports ; var i = r [ n ] = { i : n , l : ! 1 , exports : { } } ; return t [ n ] . call ( i . exports , i , i . exports , e ) , i . l = ! 0 , i . exports } var r = { } ; return e . m = t , e . c = r , e . i = function ( t ) { return t } , e . d = function ( t , e , r ) { Object . defineProperty ( t , e , { configurable : ! 1 , enumerable : ! 0 , get : r } ) } , e . n = function ( t ) { var r = t && t . _ _esModule ? function ( ) { return t . default } : function ( ) { return t } ; return e . d ( r , "a" , r ) , r } , e . o = function ( t , e ) { return Object . prototype . hasOwnProperty . call ( t , e ) } , e . p = "" , e ( e . s = 613 ) } ( [ function ( t , e , r ) { var n = r ( 4 ) , i = r ( 32 ) , o = r ( 14 ) , a = r ( 15 ) , f = r ( 33 ) , s = "prototype" , u = function ( t , e , r ) { var h , c , d , l , p = t & u . F , b = t & u . G , v = t & u . S , y = t & u . P , m = t & u . B , g = b ? n : v ? n [ e ] || ( n [ e ] = { } ) : ( n [ e ] || { } ) [ s ] , w = b ? i : i [ e ] || ( i [ e ] = { } ) , _ = w [ s ] || ( w [ s ] = { } ) ; b && ( r = e ) ; for ( h in r ) c = ! p && g && void 0 !== g [ h ] , d = ( c ? g : r ) [ h ] , l = m && c ? f ( d , n ) : y && "function" == typeof d ? f ( Function . call , d ) : d , g && a ( g , h , d , t & u . U ) , w [ h ] != d && o ( w , h , l ) , y && _ [ h ] != d && ( _ [ h ] = d ) } ; n . core = i , u . F = 1 , u . G = 2 , u . S = 4 , u . P = 8 , u . B = 16 , u . W = 32 , u . U = 64 , u . R = 128 , t . exports = u } , function ( t , e , r ) { "use strict" ; ( function ( t , n ) { function i ( ) { try { var t = new Uint8Array ( 1 ) ; return t . _ _proto _ _ = { _ _proto _ _ : Uint8Array . prototype , foo : function ( ) { return 42 } } , 42 === t . foo ( ) && "function" == typeof t . subarray && 0 === t . subarray ( 1 , 1 ) . byteLength } catch ( t ) { return ! 1 } } function o ( ) { return t . TYPED _ARRAY _SUPPORT ? 2147483647 : 1073741823 } function a ( e , r ) { if ( o ( ) < r ) throw new RangeError ( "Invalid typed array length" ) ; return t . TYPED _ARRAY _SUPPORT ? ( e = new Uint8Array ( r ) , e . _ _proto _ _ = t . prototype ) : ( null === e && ( e = new t ( r ) ) , e . length = r ) , e } function t ( e , r , n ) { if ( ! ( t . TYPED _ARRAY _SUPPORT || this instanceof t ) ) return new t ( e , r , n ) ; if ( "number" == typeof e ) { if ( "string" == typeof r ) throw new Error ( "If encoding is specified then the first argument must be a string" ) ; return h ( this , e ) } return f ( this , e , r , n ) } function f ( t , e , r , n ) { if ( "number" == typeof e ) throw new TypeError ( '"value" argument must not be a number' ) ; return "undefined" != typeof ArrayBuffer && e instanceof ArrayBuffer ? l ( t , e , r , n ) : "string" == typeof e ? c ( t , e , r ) : p ( t , e ) } function s ( t ) { if ( "number" != typeof t ) throw new TypeError ( '"size" argument must be a number' ) ; if ( t < 0 ) throw new RangeError ( '"size" argument must not be negative' ) } function u ( t , e , r , n ) { return s ( e ) , e <= 0 ? a ( t , e ) : void 0 !== r ? "string" == typeof n ? a ( t , e ) . fill ( r , n ) : a ( t , e ) . fill ( r ) : a ( t , e ) } function h ( e , r ) { if ( s ( r ) , e = a ( e , r < 0 ? 0 : 0 | b ( r ) ) , ! t . TYPED _ARRAY _SUPPORT ) for ( var n = 0 ; n < r ; ++ n ) e [ n ] = 0 ; return e } function c ( e , r , n ) { if ( "string" == typeof n && "" !== n || ( n = "utf8" ) , ! t . isEncoding ( n ) ) throw new TypeError ( '"encoding" must be a valid string encoding' ) ; var i = 0 | y ( r , n ) ; e = a ( e , i ) ; var o = e . write ( r , n ) ; return o !== i && ( e = e . slice ( 0 , o ) ) , e } function d ( t , e ) { var r = e . length < 0 ? 0 : 0 | b ( e . length ) ; t = a ( t , r ) ; for ( var n = 0 ; n < r ; n += 1 ) t [ n ] = 255 & e [ n ] ; return t } function l ( e , r , n , i ) { if ( r . byteLength , n < 0 || r . byteLength < n ) throw new RangeError ( "'offset' is out of bounds" ) ; if ( r . byteLength < n + ( i || 0 ) ) throw new RangeError ( "'length' is out of bounds" ) ; return r = void 0 === n && void 0 === i ? new Uint8Array ( r ) : void 0 === i ? new Uint8Array ( r , n ) : new Uint8Array ( r , n , i ) , t . TYPED _ARRAY _SUPPORT ? ( e = r , e . _ _proto _ _ = t . prototype ) : e = d ( e , r ) , e } function p ( e , r ) { if ( t . isBuffer ( r ) ) { var n = 0 | b ( r . length ) ; return e = a ( e , n ) , 0 === e . length ? e : ( r . copy ( e , 0 , 0 , n ) , e ) } if ( r ) { if ( "undefined" != typeof ArrayBuffer && r . buffer instanceof ArrayBuffer || "length" in r ) return "number" != typeof r . length || Z ( r . length ) ? a ( e , 0 ) : d ( e , r ) ; if ( "Buffer" === r . type && Q ( r . data ) ) return d ( e , r . data ) } throw new TypeError ( "First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object." ) } function b ( t ) { if ( t >= o ( ) ) throw new RangeError ( "Attempt to allocate Buffer larger than maximum size: 0x" + o ( ) . toString ( 16 ) + " bytes" ) ; return 0 | t } function v ( e ) { return + e != e && ( e = 0 ) , t . alloc ( + e ) } function y ( e , r ) { if ( t . isBuffer ( e ) ) return e . length ; if ( "undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer . isView && ( ArrayBuffer . isView ( e ) || e instanceof ArrayBuffer ) ) return e . byteLength ; "string" != typeof e && ( e = "" + e ) ; var n = e . length ; if ( 0 === n ) return 0 ; for ( var i = ! 1 ; ; ) switch ( r ) { case "ascii" : case "latin1" : ca
h . iushrn ( 8 ) , u [ o - f - 1 ] = a } return u } , Math . clz32 ? o . prototype . _countBits = function ( t ) { return 32 - Math . clz32 ( t ) } : o . prototype . _countBits = function ( t ) { var e = t , r = 0 ; return e >= 4096 && ( r += 13 , e >>>= 13 ) , e >= 64 && ( r += 7 , e >>>= 7 ) , e >= 8 && ( r += 4 , e >>>= 4 ) , e >= 2 && ( r += 2 , e >>>= 2 ) , r + e } , o . prototype . _zeroBits = function ( t ) { if ( 0 === t ) return 26 ; var e = t , r = 0 ; return 0 === ( 8191 & e ) && ( r += 13 , e >>>= 13 ) , 0 === ( 127 & e ) && ( r += 7 , e >>>= 7 ) , 0 === ( 15 & e ) && ( r += 4 , e >>>= 4 ) , 0 === ( 3 & e ) && ( r += 2 , e >>>= 2 ) , 0 === ( 1 & e ) && r ++ , r } , o . prototype . bitLength = function ( ) { var t = this . words [ this . length - 1 ] , e = this . _countBits ( t ) ; return 26 * ( this . length - 1 ) + e } , o . prototype . zeroBits = function ( ) { if ( this . isZero ( ) ) return 0 ; for ( var t = 0 , e = 0 ; e < this . length ; e ++ ) { var r = this . _zeroBits ( this . words [ e ] ) ; if ( t += r , 26 !== r ) break } return t } , o . prototype . byteLength = function ( ) { return Math . ceil ( this . bitLength ( ) / 8 ) } , o . prototype . toTwos = function ( t ) { return 0 !== this . negative ? this . abs ( ) . inotn ( t ) . iaddn ( 1 ) : this . clone ( ) } , o . prototype . fromTwos = function ( t ) { return this . testn ( t - 1 ) ? this . notn ( t ) . iaddn ( 1 ) . ineg ( ) : this . clone ( ) } , o . prototype . isNeg = function ( ) { return 0 !== this . negative } , o . prototype . neg = function ( ) { return this . clone ( ) . ineg ( ) } , o . prototype . ineg = function ( ) { return this . isZero ( ) || ( this . negative ^= 1 ) , this } , o . prototype . iuor = function ( t ) { for ( ; this . length < t . length ; ) this . words [ this . length ++ ] = 0 ; for ( var e = 0 ; e < t . length ; e ++ ) this . words [ e ] = this . words [ e ] | t . words [ e ] ; return this . strip ( ) } , o . prototype . ior = function ( t ) { return n ( 0 === ( this . negative | t . negative ) ) , this . iuor ( t ) } , o . prototype . or = function ( t ) { return this . length > t . length ? this . clone ( ) . ior ( t ) : t . clone ( ) . ior ( this ) } , o . prototype . uor = function ( t ) { return this . length > t . length ? this . clone ( ) . iuor ( t ) : t . clone ( ) . iuor ( this ) } , o . prototype . iuand = function ( t ) { var e ; e = this . length > t . length ? t : this ; for ( var r = 0 ; r < e . length ; r ++ ) this . words [ r ] = this . words [ r ] & t . words [ r ] ; return this . length = e . length , this . strip ( ) } , o . prototype . iand = function ( t ) { return n ( 0 === ( this . negative | t . negative ) ) , this . iuand ( t ) } , o . prototype . and = function ( t ) { return this . length > t . length ? this . clone ( ) . iand ( t ) : t . clone ( ) . iand ( this ) } , o . prototype . uand = function ( t ) { return this . length > t . length ? this . clone ( ) . iuand ( t ) : t . clone ( ) . iuand ( this ) } , o . prototype . iuxor = function ( t ) { var e , r ; this . length > t . length ? ( e = this , r = t ) : ( e = t , r = this ) ; for ( var n = 0 ; n < r . length ; n ++ ) this . words [ n ] = e . words [ n ] ^ r . words [ n ] ; if ( this !== e ) for ( ; n < e . length ; n ++ ) this . words [ n ] = e . words [ n ] ; return this . length = e . length , this . strip ( ) } , o . prototype . ixor = function ( t ) { return n ( 0 === ( this . negative | t . negative ) ) , this . iuxor ( t ) } , o . prototype . xor = function ( t ) { return this . length > t . length ? this . clone ( ) . ixor ( t ) : t . clone ( ) . ixor ( this ) } , o . prototype . uxor = function ( t ) { return this . length > t . length ? this . clone ( ) . iuxor ( t ) : t . clone ( ) . iuxor ( this ) } , o . prototype . inotn = function ( t ) { n ( "number" == typeof t && t >= 0 ) ; var e = 0 | Math . ceil ( t / 26 ) , r = t % 26 ; this . _expand ( e ) , r > 0 && e -- ; for ( var i = 0 ; i < e ; i ++ ) this . words [ i ] = 67108863 & ~ this . words [ i ] ; return r > 0 && ( this . words [ i ] = ~ this . words [ i ] & 67108863 >> 26 - r ) , this . strip ( ) } , o . prototype . notn = function ( t ) { return this . clone ( ) . inotn ( t ) } , o . prototype . setn = function ( t , e ) { n ( "number" == typeof t && t >= 0 ) ; var r = t / 26 | 0 , i = t % 26 ; return this . _expand ( r + 1 ) , e ? this . words [ r ] = this . words [ r ] | 1 << i : this . words [ r ] = this . words [ r ] & ~ ( 1 << i ) , this . strip ( ) } , o . prototype . iadd = function ( t ) { var e ; if ( 0 !== this . negative && 0 === t . negative ) return this . negative = 0 , e = this . isub ( t ) , this . negative ^= 1 , this . _normSign ( ) ; if ( 0 === this . negative && 0 !== t . negative ) return t . negative = 0 , e = this . isub ( t ) , t . negative = 1 , e . _normSign ( ) ; var r , n ; this . length > t . length ? ( r = this , n = t ) : ( r = t , n = this ) ; for ( var i = 0 , o = 0 ; o < n . length ; o ++ ) e = ( 0 | r . words [ o ] ) + ( 0 | n . words [ o ] ) + i , this . words [ o ] = 67108863 & e , i = e >>> 26 ; for ( ; 0 !== i && o < r . length ; o ++ ) e = ( 0 | r . words [ o ] ) + i , this . words [ o ] = 67108863 & e , i = e >>> 26 ; if ( this . length = r . length , 0 !== i ) this . words [ this . length ] = i , this . length ++ ; else if ( r !== this ) for ( ; o < r . length ; o ++ ) this . words [ o ] = r . words [ o ] ; return this } , o . prototype . add = function ( t ) { var e ; return 0 !== t . negative && 0 === this . negative ? ( t . negative = 0 , e = this . sub ( t ) , t . negative ^= 1 , e ) : 0 === t . negative && 0 !== this . negative ? ( this . negative = 0 , e = t . sub ( this ) , this . negative = 1 , e ) : this . length > t . length ? this . clone ( ) . iadd ( t ) : t . clone ( ) . iadd ( this ) } , o . prototype . isub = function ( t ) { if ( 0 !== t . negative ) { t . negative = 0 ; var e = this . iadd ( t ) ; return t . negat
return r . cmp ( this . m ) >= 0 && r . isub ( this . m ) , r } , m . prototype . sub = function ( t , e ) { this . _verify2 ( t , e ) ; var r = t . sub ( e ) ; return r . cmpn ( 0 ) < 0 && r . iadd ( this . m ) , r . _forceRed ( this ) } , m . prototype . isub = function ( t , e ) { this . _verify2 ( t , e ) ; var r = t . isub ( e ) ; return r . cmpn ( 0 ) < 0 && r . iadd ( this . m ) , r } , m . prototype . shl = function ( t , e ) { return this . _verify1 ( t ) , this . imod ( t . ushln ( e ) ) } , m . prototype . imul = function ( t , e ) { return this . _verify2 ( t , e ) , this . imod ( t . imul ( e ) ) } , m . prototype . mul = function ( t , e ) { return this . _verify2 ( t , e ) , this . imod ( t . mul ( e ) ) } , m . prototype . isqr = function ( t ) { return this . imul ( t , t . clone ( ) ) } , m . prototype . sqr = function ( t ) { return this . mul ( t , t ) } , m . prototype . sqrt = function ( t ) { if ( t . isZero ( ) ) return t . clone ( ) ; var e = this . m . andln ( 3 ) ; if ( n ( e % 2 === 1 ) , 3 === e ) { var r = this . m . add ( new o ( 1 ) ) . iushrn ( 2 ) ; return this . pow ( t , r ) } for ( var i = this . m . subn ( 1 ) , a = 0 ; ! i . isZero ( ) && 0 === i . andln ( 1 ) ; ) a ++ , i . iushrn ( 1 ) ; n ( ! i . isZero ( ) ) ; var f = new o ( 1 ) . toRed ( this ) , s = f . redNeg ( ) , u = this . m . subn ( 1 ) . iushrn ( 1 ) , h = this . m . bitLength ( ) ; for ( h = new o ( 2 * h * h ) . toRed ( this ) ; 0 !== this . pow ( h , u ) . cmp ( s ) ; ) h . redIAdd ( s ) ; for ( var c = this . pow ( h , i ) , d = this . pow ( t , i . addn ( 1 ) . iushrn ( 1 ) ) , l = this . pow ( t , i ) , p = a ; 0 !== l . cmp ( f ) ; ) { for ( var b = l , v = 0 ; 0 !== b . cmp ( f ) ; v ++ ) b = b . redSqr ( ) ; n ( v < p ) ; var y = this . pow ( c , new o ( 1 ) . iushln ( p - v - 1 ) ) ; d = d . redMul ( y ) , c = y . redSqr ( ) , l = l . redMul ( c ) , p = v } return d } , m . prototype . invm = function ( t ) { var e = t . _invmp ( this . m ) ; return 0 !== e . negative ? ( e . negative = 0 , this . imod ( e ) . redNeg ( ) ) : this . imod ( e ) } , m . prototype . pow = function ( t , e ) { if ( e . isZero ( ) ) return new o ( 1 ) ; if ( 0 === e . cmpn ( 1 ) ) return t . clone ( ) ; var r = 4 , n = new Array ( 1 << r ) ; n [ 0 ] = new o ( 1 ) . toRed ( this ) , n [ 1 ] = t ; for ( var i = 2 ; i < n . length ; i ++ ) n [ i ] = this . mul ( n [ i - 1 ] , t ) ; var a = n [ 0 ] , f = 0 , s = 0 , u = e . bitLength ( ) % 26 ; for ( 0 === u && ( u = 26 ) , i = e . length - 1 ; i >= 0 ; i -- ) { for ( var h = e . words [ i ] , c = u - 1 ; c >= 0 ; c -- ) { var d = h >> c & 1 ; a !== n [ 0 ] && ( a = this . sqr ( a ) ) , 0 !== d || 0 !== f ? ( f <<= 1 , f |= d , s ++ , ( s === r || 0 === i && 0 === c ) && ( a = this . mul ( a , n [ f ] ) , s = 0 , f = 0 ) ) : s = 0 } u = 26 } return a } , m . prototype . convertTo = function ( t ) { var e = t . umod ( this . m ) ; return e === t ? e . clone ( ) : e } , m . prototype . convertFrom = function ( t ) { var e = t . clone ( ) ; return e . red = null , e } , o . mont = function ( t ) { return new g ( t ) } , i ( g , m ) , g . prototype . convertTo = function ( t ) { return this . imod ( t . ushln ( this . shift ) ) } , g . prototype . convertFrom = function ( t ) { var e = this . imod ( t . mul ( this . rinv ) ) ; return e . red = null , e } , g . prototype . imul = function ( t , e ) { if ( t . isZero ( ) || e . isZero ( ) ) return t . words [ 0 ] = 0 , t . length = 1 , t ; var r = t . imul ( e ) , n = r . maskn ( this . shift ) . mul ( this . minv ) . imaskn ( this . shift ) . mul ( this . m ) , i = r . isub ( n ) . iushrn ( this . shift ) , o = i ; return i . cmp ( this . m ) >= 0 ? o = i . isub ( this . m ) : i . cmpn ( 0 ) < 0 && ( o = i . iadd ( this . m ) ) , o . _forceRed ( this ) } , g . prototype . mul = function ( t , e ) { if ( t . isZero ( ) || e . isZero ( ) ) return new o ( 0 ) . _forceRed ( this ) ; var r = t . mul ( e ) , n = r . maskn ( this . shift ) . mul ( this . minv ) . imaskn ( this . shift ) . mul ( this . m ) , i = r . isub ( n ) . iushrn ( this . shift ) , a = i ; return i . cmp ( this . m ) >= 0 ? a = i . isub ( this . m ) : i . cmpn ( 0 ) < 0 && ( a = i . iadd ( this . m ) ) , a . _forceRed ( this ) } , g . prototype . invm = function ( t ) { var e = this . imod ( t . _invmp ( this . m ) . mul ( this . r2 ) ) ; return e . _forceRed ( this ) } } ( "undefined" == typeof t || t , this ) } ) . call ( e , r ( 92 ) ( t ) ) } , function ( t , e , r ) { "use strict" ; var n = e ; n . version = r ( 465 ) . version , n . utils = r ( 521 ) , n . rand = r ( 522 ) , n . hmacDRBG = r ( 519 ) , n . curve = r ( 99 ) , n . curves = r ( 512 ) , n . ec = r ( 513 ) , n . eddsa = r ( 516 ) } , function ( t , e , r ) { var n = r ( 66 ) , i = r ( 37 ) , o = r ( 17 ) , a = r ( 29 ) , f = r ( 12 ) , s = r ( 174 ) , u = Object . getOwnPropertyDescriptor ; e . f = r ( 8 ) ? u : function ( t , e ) { if ( t = o ( t ) , e = a ( e , ! 0 ) , s ) try { return u ( t , e ) } catch ( t ) { } if ( f ( t , e ) ) return i ( ! n . f . call ( t , e ) , t [ e ] ) } } , function ( t , e , r ) { var n = r ( 12 ) , i = r ( 11 ) , o = r ( 133 ) ( "IE_PROTO" ) , a = Object . prototype ; t . exports = Object . getPrototypeOf || function ( t ) { return t = i ( t ) , n ( t , o ) ? t [ o ] : "function" == typeof t . constructor && t instanceof t . constructor ? t . constructor . prototype : t instanceof Object ? a : null } } , function ( t , e , r ) { "use strict" ; var n = e ; n . version = r ( 467 ) . version , n . utils = r ( 558 ) , n . rand = r ( 559 ) , n . hmacDRBG = r ( 556 ) , n . curve = r ( 104 ) , n . curves = r ( 549 ) , n . ec = r ( 550 ) , n . eddsa = r ( 553 ) } , function ( t , e ) { var r = { } . toString ; t . exports = function ( t ) { return r . call ( t ) . slice ( 8 , - 1 ) } } , function ( t , e ) { t . exports = function ( t ) { if ( void 0 == t ) throw TypeError ( "Can't call method on " + t ) ; return t } } , function ( t , e , r ) { var n = r ( 5 ) ; t . exports = function ( t , e ) { return ! ! t && n ( function ( ) { e ? t . call ( null , function ( ) { } , 1 ) : t . call ( null ) } ) } } , function ( t ,
this . convert13b ( e . words , e . length , u , n ) , this . transform ( a , o , f , s , n , i ) , this . transform ( u , o , h , c , n , i ) ; for ( var l = 0 ; l < n ; l ++ ) { var p = f [ l ] * h [ l ] - s [ l ] * c [ l ] ; s [ l ] = f [ l ] * c [ l ] + s [ l ] * h [ l ] , f [ l ] = p } return this . conjugate ( f , s , n ) , this . transform ( f , s , d , o , n , i ) , this . conjugate ( d , o , n ) , this . normalize13b ( d , n ) , r . negative = t . negative ^ e . negative , r . length = t . length + e . length , r . strip ( ) } , o . prototype . mul = function ( t ) { var e = new o ( null ) ; return e . words = new Array ( this . length + t . length ) , this . mulTo ( t , e ) } , o . prototype . mulf = function ( t ) { var e = new o ( null ) ; return e . words = new Array ( this . length + t . length ) , c ( this , t , e ) } , o . prototype . imul = function ( t ) { return this . clone ( ) . mulTo ( t , this ) } , o . prototype . imuln = function ( t ) { n ( "number" == typeof t ) , n ( t < 67108864 ) ; for ( var e = 0 , r = 0 ; r < this . length ; r ++ ) { var i = ( 0 | this . words [ r ] ) * t , o = ( 67108863 & i ) + ( 67108863 & e ) ; e >>= 26 , e += i / 67108864 | 0 , e += o >>> 26 , this . words [ r ] = 67108863 & o } return 0 !== e && ( this . words [ r ] = e , this . length ++ ) , this } , o . prototype . muln = function ( t ) { return this . clone ( ) . imuln ( t ) } , o . prototype . sqr = function ( ) { return this . mul ( this ) } , o . prototype . isqr = function ( ) { return this . imul ( this . clone ( ) ) } , o . prototype . pow = function ( t ) { var e = s ( t ) ; if ( 0 === e . length ) return new o ( 1 ) ; for ( var r = this , n = 0 ; n < e . length && 0 === e [ n ] ; n ++ , r = r . sqr ( ) ) ; if ( ++ n < e . length ) for ( var i = r . sqr ( ) ; n < e . length ; n ++ , i = i . sqr ( ) ) 0 !== e [ n ] && ( r = r . mul ( i ) ) ; return r } , o . prototype . iushln = function ( t ) { n ( "number" == typeof t && t >= 0 ) ; var e , r = t % 26 , i = ( t - r ) / 26 , o = 67108863 >>> 26 - r << 26 - r ; if ( 0 !== r ) { var a = 0 ; for ( e = 0 ; e < this . length ; e ++ ) { var f = this . words [ e ] & o , s = ( 0 | this . words [ e ] ) - f << r ; this . words [ e ] = s | a , a = f >>> 26 - r } a && ( this . words [ e ] = a , this . length ++ ) } if ( 0 !== i ) { for ( e = this . length - 1 ; e >= 0 ; e -- ) this . words [ e + i ] = this . words [ e ] ; for ( e = 0 ; e < i ; e ++ ) this . words [ e ] = 0 ; this . length += i } return this . strip ( ) } , o . prototype . ishln = function ( t ) { return n ( 0 === this . negative ) , this . iushln ( t ) } , o . prototype . iushrn = function ( t , e , r ) { n ( "number" == typeof t && t >= 0 ) ; var i ; i = e ? ( e - e % 26 ) / 26 : 0 ; var o = t % 26 , a = Math . min ( ( t - o ) / 26 , this . length ) , f = 67108863 ^ 67108863 >>> o << o , s = r ; if ( i -= a , i = Math . max ( 0 , i ) , s ) { for ( var u = 0 ; u < a ; u ++ ) s . words [ u ] = this . words [ u ] ; s . length = a } if ( 0 === a ) ; else if ( this . length > a ) for ( this . length -= a , u = 0 ; u < this . length ; u ++ ) this . words [ u ] = this . words [ u + a ] ; else this . words [ 0 ] = 0 , this . length = 1 ; var h = 0 ; for ( u = this . length - 1 ; u >= 0 && ( 0 !== h || u >= i ) ; u -- ) { var c = 0 | this . words [ u ] ; this . words [ u ] = h << 26 - o | c >>> o , h = c & f } return s && 0 !== h && ( s . words [ s . length ++ ] = h ) , 0 === this . length && ( this . words [ 0 ] = 0 , this . length = 1 ) , this . strip ( ) } , o . prototype . ishrn = function ( t , e , r ) { return n ( 0 === this . negative ) , this . iushrn ( t , e , r ) } , o . prototype . shln = function ( t ) { return this . clone ( ) . ishln ( t ) } , o . prototype . ushln = function ( t ) { return this . clone ( ) . iushln ( t ) } , o . prototype . shrn = function ( t ) { return this . clone ( ) . ishrn ( t ) } , o . prototype . ushrn = function ( t ) { return this . clone ( ) . iushrn ( t ) } , o . prototype . testn = function ( t ) { n ( "number" == typeof t && t >= 0 ) ; var e = t % 26 , r = ( t - e ) / 26 , i = 1 << e ; if ( this . length <= r ) return ! 1 ; var o = this . words [ r ] ; return ! ! ( o & i ) } , o . prototype . imaskn = function ( t ) { n ( "number" == typeof t && t >= 0 ) ; var e = t % 26 , r = ( t - e ) / 26 ; if ( n ( 0 === this . negative , "imaskn works only with positive numbers" ) , this . length <= r ) return this ; if ( 0 !== e && r ++ , this . length = Math . min ( r , this . length ) , 0 !== e ) { var i = 67108863 ^ 67108863 >>> e << e ; this . words [ this . length - 1 ] &= i } return this . strip ( ) } , o . prototype . maskn = function ( t ) { return this . clone ( ) . imaskn ( t ) } , o . prototype . iaddn = function ( t ) { return n ( "number" == typeof t ) , n ( t < 67108864 ) , t < 0 ? this . isubn ( - t ) : 0 !== this . negative ? 1 === this . length && ( 0 | this . words [ 0 ] ) < t ? ( this . words [ 0 ] = t - ( 0 | this . words [ 0 ] ) , this . negative = 0 , this ) : ( this . negative = 0 , this . isubn ( t ) , this . negative = 1 , this ) : this . _iaddn ( t ) } , o . prototype . _iaddn = function ( t ) { this . words [ 0 ] += t ; for ( var e = 0 ; e < this . length && this . words [ e ] >= 67108864 ; e ++ ) this . words [ e ] -= 67108864 , e === this . length - 1 ? this . words [ e + 1 ] = 1 : this . words [ e + 1 ] ++ ; return this . length = Math . max ( this . length , e + 1 ) , this } , o . prototype . isubn = function ( t ) { if ( n ( "number" == typeof t ) , n ( t < 67108864 ) , t < 0 ) return this . iaddn ( - t ) ; if ( 0 !== this . negative ) return this . negative = 0 , this . iaddn ( t ) , this . negative = 1 , this ; if ( this . words [ 0 ] -= t , 1 === this . length && this . words [ 0 ] < 0 ) this . words [ 0 ] = - this . words [ 0 ] , this . negative = 1 ; else for ( var e = 0 ; e < this . length && this . words [ e ] < 0 ; e ++ ) this . words [ e ] += 67108864 , this . words [ e + 1 ] -= 1 ; return this . strip ( ) } , o . prototy
return ! e || "object" != typeof e && "function" != typeof e ? t : e } function o ( t , e ) { if ( "function" != typeof e && null !== e ) throw new TypeError ( "Super expression must either be null or a function, not " + typeof e ) ; t . prototype = Object . create ( e && e . prototype , { constructor : { value : t , enumerable : ! 1 , writable : ! 0 , configurable : ! 0 } } ) , e && ( Object . setPrototypeOf ? Object . setPrototypeOf ( t , e ) : t . _ _proto _ _ = e ) } var a = r ( 62 ) , f = function ( t ) { function e ( ) { return n ( this , e ) , i ( this , ( e . _ _proto _ _ || Object . getPrototypeOf ( e ) ) . apply ( this , arguments ) ) } return o ( e , t ) , e } ( a ) ; t . exports = f } , function ( t , e , r ) { var n = r ( 7 ) ( "unscopables" ) , i = Array . prototype ; void 0 == i [ n ] && r ( 14 ) ( i , n , { } ) , t . exports = function ( t ) { i [ n ] [ t ] = ! 0 } } , function ( t , e , r ) { var n = r ( 33 ) , i = r ( 176 ) , o = r ( 125 ) , a = r ( 3 ) , f = r ( 10 ) , s = r ( 142 ) , u = { } , h = { } , e = t . exports = function ( t , e , r , c , d ) { var l , p , b , v , y = d ? function ( ) { return t } : s ( t ) , m = n ( r , c , e ? 2 : 1 ) , g = 0 ; if ( "function" != typeof y ) throw TypeError ( t + " is not iterable!" ) ; if ( o ( y ) ) { for ( l = f ( t . length ) ; l > g ; g ++ ) if ( v = e ? m ( a ( p = t [ g ] ) [ 0 ] , p [ 1 ] ) : m ( t [ g ] ) , v === u || v === h ) return v } else for ( b = y . call ( t ) ; ! ( p = b . next ( ) ) . done ; ) if ( v = i ( b , m , p . value , e ) , v === u || v === h ) return v } ; e . BREAK = u , e . RETURN = h } , function ( t , e ) { t . exports = { } } , function ( t , e , r ) { var n = r ( 9 ) . f , i = r ( 12 ) , o = r ( 7 ) ( "toStringTag" ) ; t . exports = function ( t , e , r ) { t && ! i ( t = r ? t : t . prototype , o ) && n ( t , o , { configurable : ! 0 , value : e } ) } } , function ( t , e , r ) { var n = r ( 0 ) , i = r ( 24 ) , o = r ( 5 ) , a = r ( 138 ) , f = "[" + a + "]" , s = "
" , u = RegExp ( "^" + f + f + "*" ) , h = RegExp ( f + f + "*$" ) , c = function ( t , e , r ) { var i = { } , f = o ( function ( ) { return ! ! a [ t ] ( ) || s [ t ] ( ) != s } ) , u = i [ t ] = f ? e ( d ) : a [ t ] ; r && ( i [ r ] = u ) , n ( n . P + n . F * f , "String" , i ) } , d = c . trim = function ( t , e ) { return t = String ( i ( t ) ) , 1 & e && ( t = t . replace ( u , "" ) ) , 2 & e && ( t = t . replace ( h , "" ) ) , t } ; t . exports = c } , function ( t , e , r ) { "use strict" ; ( function ( e ) { function n ( t ) { u . call ( this , "digest" ) , this . _hash = t , this . buffers = [ ] } function i ( t ) { u . call ( this , "digest" ) , this . _hash = t } var o = r ( 2 ) , a = r ( 105 ) , f = r ( 567 ) , s = r ( 568 ) , u = r ( 566 ) ; o ( n , u ) , n . prototype . _update = function ( t ) { this . buffers . push ( t ) } , n . prototype . _final = function ( ) { var t = e . concat ( this . buffers ) , r = this . _hash ( t ) ; return this . buffers = null , r } , o ( i , u ) , i . prototype . _update = function ( t ) { this . _hash . update ( t ) } , i . prototype . _final = function ( ) { return this . _hash . digest ( ) } , t . exports = function ( t ) { return t = t . toLowerCase ( ) , "md5" === t ? new n ( a ) : "rmd160" === t || "ripemd160" === t ? new n ( f ) : new i ( s ( t ) ) } } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e , r ) { ( function ( e ) { function r ( t , r ) { this . _block = new e ( t ) , this . _finalSize = r , this . _blockSize = t , this . _len = 0 , this . _s = 0 } r . prototype . update = function ( t , r ) { "string" == typeof t && ( r = r || "utf8" , t = new e ( t , r ) ) ; for ( var n = this . _len += t . length , i = this . _s || 0 , o = 0 , a = this . _block ; i < n ; ) { for ( var f = Math . min ( t . length , o + this . _blockSize - i % this . _blockSize ) , s = f - o , u = 0 ; u < s ; u ++ ) a [ i % this . _blockSize + u ] = t [ u + o ] ; i += s , o += s , i % this . _blockSize === 0 && this . _update ( a ) } return this . _s = i , this } , r . prototype . digest = function ( t ) { var e = 8 * this . _len ; this . _block [ this . _len % this . _blockSize ] = 128 , this . _block . fill ( 0 , this . _len % this . _blockSize + 1 ) , e % ( 8 * this . _blockSize ) >= 8 * this . _finalSize && ( this . _update ( this . _block ) , this . _block . fill ( 0 ) ) , this . _block . writeInt32BE ( e , this . _blockSize - 4 ) ; var r = this . _update ( this . _block ) || this . _hash ( ) ; return t ? r . toString ( t ) : r } , r . prototype . _update = function ( ) { throw new Error ( "_update must be implemented by subclass" ) } , t . exports = r } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e , r ) { "use strict" ; ( function ( e , r , n ) { function i ( ) { throw new Error ( "secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11" ) } function o ( t , i ) { if ( t > 65536 ) throw new Error ( "requested too many random bytes" ) ; var o = new e . Uint8Array ( t ) ; t > 0 && a . getRandomValues ( o ) ; var f = new r ( o . buffer ) ; return "function" == typeof i ? n . nextTick ( function ( ) { i ( null , f ) } ) : f } var a = e . crypto || e . msCrypto ; a && a . getRandomValues ? t . exports = o : t . exports = i } ) . call ( e , r ( 39 ) , r ( 1 ) . Buffer , r ( 26 ) ) } , function ( t , e ) { "use strict" ; function r ( t , e ) { if ( ! ( t instanceof e ) ) throw new TypeError ( "Cannot call a class as a function" ) } function n ( t , e ) { if ( ! t ) throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; return ! e || "object" != typeof e && "function" != typeof e ? t : e } function i ( t , e ) { if ( "function" != typeof e && null !== e ) throw new TypeError ( "Super expression must either be null or a function, not " + ty
d . prototype . permute = function ( t , e , r , n , i , o ) { for ( var a = 0 ; a < o ; a ++ ) n [ a ] = e [ t [ a ] ] , i [ a ] = r [ t [ a ] ] } , d . prototype . transform = function ( t , e , r , n , i , o ) { this . permute ( o , t , e , r , n , i ) ; for ( var a = 1 ; a < i ; a <<= 1 ) for ( var f = a << 1 , s = Math . cos ( 2 * Math . PI / f ) , u = Math . sin ( 2 * Math . PI / f ) , h = 0 ; h < i ; h += f ) for ( var c = s , d = u , l = 0 ; l < a ; l ++ ) { var p = r [ h + l ] , b = n [ h + l ] , v = r [ h + l + a ] , y = n [ h + l + a ] , m = c * v - d * y ; y = c * y + d * v , v = m , r [ h + l ] = p + v , n [ h + l ] = b + y , r [ h + l + a ] = p - v , n [ h + l + a ] = b - y , l !== f && ( m = s * c - u * d , d = s * d + u * c , c = m ) } } , d . prototype . guessLen13b = function ( t , e ) { var r = 1 | Math . max ( e , t ) , n = 1 & r , i = 0 ; for ( r = r / 2 | 0 ; r ; r >>>= 1 ) i ++ ; return 1 << i + 1 + n } , d . prototype . conjugate = function ( t , e , r ) { if ( ! ( r <= 1 ) ) for ( var n = 0 ; n < r / 2 ; n ++ ) { var i = t [ n ] ; t [ n ] = t [ r - n - 1 ] , t [ r - n - 1 ] = i , i = e [ n ] , e [ n ] = - e [ r - n - 1 ] , e [ r - n - 1 ] = - i } } , d . prototype . normalize13b = function ( t , e ) { for ( var r = 0 , n = 0 ; n < e / 2 ; n ++ ) { var i = 8192 * Math . round ( t [ 2 * n + 1 ] / e ) + Math . round ( t [ 2 * n ] / e ) + r ; t [ n ] = 67108863 & i , r = i < 67108864 ? 0 : i / 67108864 | 0 } return t } , d . prototype . convert13b = function ( t , e , r , i ) { for ( var o = 0 , a = 0 ; a < e ; a ++ ) o += 0 | t [ a ] , r [ 2 * a ] = 8191 & o , o >>>= 13 , r [ 2 * a + 1 ] = 8191 & o , o >>>= 13 ; for ( a = 2 * e ; a < i ; ++ a ) r [ a ] = 0 ; n ( 0 === o ) , n ( 0 === ( o & - 8192 ) ) } , d . prototype . stub = function ( t ) { for ( var e = new Array ( t ) , r = 0 ; r < t ; r ++ ) e [ r ] = 0 ; return e } , d . prototype . mulp = function ( t , e , r ) { var n = 2 * this . guessLen13b ( t . length , e . length ) , i = this . makeRBT ( n ) , o = this . stub ( n ) , a = new Array ( n ) , f = new Array ( n ) , s = new Array ( n ) , u = new Array ( n ) , h = new Array ( n ) , c = new Array ( n ) , d = r . words ; d . length = n , this . convert13b ( t . words , t . length , a , n ) , this . convert13b ( e . words , e . length , u , n ) , this . transform ( a , o , f , s , n , i ) , this . transform ( u , o , h , c , n , i ) ; for ( var l = 0 ; l < n ; l ++ ) { var p = f [ l ] * h [ l ] - s [ l ] * c [ l ] ; s [ l ] = f [ l ] * c [ l ] + s [ l ] * h [ l ] , f [ l ] = p } return this . conjugate ( f , s , n ) , this . transform ( f , s , d , o , n , i ) , this . conjugate ( d , o , n ) , this . normalize13b ( d , n ) , r . negative = t . negative ^ e . negative , r . length = t . length + e . length , r . strip ( ) } , o . prototype . mul = function ( t ) { var e = new o ( null ) ; return e . words = new Array ( this . length + t . length ) , this . mulTo ( t , e ) } , o . prototype . mulf = function ( t ) { var e = new o ( null ) ; return e . words = new Array ( this . length + t . length ) , c ( this , t , e ) } , o . prototype . imul = function ( t ) { return this . clone ( ) . mulTo ( t , this ) } , o . prototype . imuln = function ( t ) { n ( "number" == typeof t ) , n ( t < 67108864 ) ; for ( var e = 0 , r = 0 ; r < this . length ; r ++ ) { var i = ( 0 | this . words [ r ] ) * t , o = ( 67108863 & i ) + ( 67108863 & e ) ; e >>= 26 , e += i / 67108864 | 0 , e += o >>> 26 , this . words [ r ] = 67108863 & o } return 0 !== e && ( this . words [ r ] = e , this . length ++ ) , this } , o . prototype . muln = function ( t ) { return this . clone ( ) . imuln ( t ) } , o . prototype . sqr = function ( ) { return this . mul ( this ) } , o . prototype . isqr = function ( ) { return this . imul ( this . clone ( ) ) } , o . prototype . pow = function ( t ) { var e = s ( t ) ; if ( 0 === e . length ) return new o ( 1 ) ; for ( var r = this , n = 0 ; n < e . length && 0 === e [ n ] ; n ++ , r = r . sqr ( ) ) ; if ( ++ n < e . length ) for ( var i = r . sqr ( ) ; n < e . length ; n ++ , i = i . sqr ( ) ) 0 !== e [ n ] && ( r = r . mul ( i ) ) ; return r } , o . prototype . iushln = function ( t ) { n ( "number" == typeof t && t >= 0 ) ; var e , r = t % 26 , i = ( t - r ) / 26 , o = 67108863 >>> 26 - r << 26 - r ; if ( 0 !== r ) { var a = 0 ; for ( e = 0 ; e < this . length ; e ++ ) { var f = this . words [ e ] & o , s = ( 0 | this . words [ e ] ) - f << r ; this . words [ e ] = s | a , a = f >>> 26 - r } a && ( this . words [ e ] = a , this . length ++ ) } if ( 0 !== i ) { for ( e = this . length - 1 ; e >= 0 ; e -- ) this . words [ e + i ] = this . words [ e ] ; for ( e = 0 ; e < i ; e ++ ) this . words [ e ] = 0 ; this . length += i } return this . strip ( ) } , o . prototype . ishln = function ( t ) { return n ( 0 === this . negative ) , this . iushln ( t ) } , o . prototype . iushrn = function ( t , e , r ) { n ( "number" == typeof t && t >= 0 ) ; var i ; i = e ? ( e - e % 26 ) / 26 : 0 ; var o = t % 26 , a = Math . min ( ( t - o ) / 26 , this . length ) , f = 67108863 ^ 67108863 >>> o << o , s = r ; if ( i -= a , i = Math . max ( 0 , i ) , s ) { for ( var u = 0 ; u < a ; u ++ ) s . words [ u ] = this . words [ u ] ; s . length = a } if ( 0 === a ) ; else if ( this . length > a ) for ( this . length -= a , u = 0 ; u < this . length ; u ++ ) this . words [ u ] = this . words [ u + a ] ; else this . words [ 0 ] = 0 , this . length = 1 ; var h = 0 ; for ( u = this . length - 1 ; u >= 0 && ( 0 !== h || u >= i ) ; u -- ) { var c = 0 | this . words [ u ] ; this . words [ u ] = h << 26 - o | c >>> o , h = c & f } return s && 0 !== h && ( s . words [ s . length ++ ] = h ) , 0 === this . length && ( this . words [ 0 ] = 0 , this . length = 1 ) , this . strip ( ) } , o . prototype . ishrn = function ( t , e , r ) { return n ( 0 === this . negative ) , this . iushrn ( t , e , r ) } , o . prototype . shln = function ( t ) { return this . clone ( ) . ishln ( t ) } , o . prototype . ushln = function ( t ) { return this . clone ( ) . iushln ( t ) } , o . prototype . shrn = function ( t ) { return this . clone ( ) . ishrn ( t ) } , o . prototype . ushrn = function ( t ) { return this . clone ( ) . iushrn ( t ) } , o . prototype . testn = function ( t ) { n ( "number" =
return ! 0 } , a . prototype . encryptBlock = function ( e ) { e = o ( new t ( e ) ) ; var r = this . _doCryptBlock ( e , this . _keySchedule , s . SUB _MIX , s . SBOX ) , n = new t ( 16 ) ; return n . writeUInt32BE ( r [ 0 ] , 0 ) , n . writeUInt32BE ( r [ 1 ] , 4 ) , n . writeUInt32BE ( r [ 2 ] , 8 ) , n . writeUInt32BE ( r [ 3 ] , 12 ) , n } , a . prototype . decryptBlock = function ( e ) { e = o ( new t ( e ) ) ; var r = [ e [ 3 ] , e [ 1 ] ] ; e [ 1 ] = r [ 0 ] , e [ 3 ] = r [ 1 ] ; var n = this . _doCryptBlock ( e , this . _invKeySchedule , s . INV _SUB _MIX , s . INV _SBOX ) , i = new t ( 16 ) ; return i . writeUInt32BE ( n [ 0 ] , 0 ) , i . writeUInt32BE ( n [ 3 ] , 4 ) , i . writeUInt32BE ( n [ 2 ] , 8 ) , i . writeUInt32BE ( n [ 1 ] , 12 ) , i } , a . prototype . scrub = function ( ) { n ( this . _keySchedule ) , n ( this . _invKeySchedule ) , n ( this . _key ) } , a . prototype . _doCryptBlock = function ( t , e , n , i ) { var o , a , f , s , u , h , c , d , l ; a = t [ 0 ] ^ e [ 0 ] , f = t [ 1 ] ^ e [ 1 ] , s = t [ 2 ] ^ e [ 2 ] , u = t [ 3 ] ^ e [ 3 ] , o = 4 ; for ( var p = 1 ; p < this . _nRounds ; p ++ ) h = n [ 0 ] [ a >>> 24 ] ^ n [ 1 ] [ f >>> 16 & 255 ] ^ n [ 2 ] [ s >>> 8 & 255 ] ^ n [ 3 ] [ 255 & u ] ^ e [ o ++ ] , c = n [ 0 ] [ f >>> 24 ] ^ n [ 1 ] [ s >>> 16 & 255 ] ^ n [ 2 ] [ u >>> 8 & 255 ] ^ n [ 3 ] [ 255 & a ] ^ e [ o ++ ] , d = n [ 0 ] [ s >>> 24 ] ^ n [ 1 ] [ u >>> 16 & 255 ] ^ n [ 2 ] [ a >>> 8 & 255 ] ^ n [ 3 ] [ 255 & f ] ^ e [ o ++ ] , l = n [ 0 ] [ u >>> 24 ] ^ n [ 1 ] [ a >>> 16 & 255 ] ^ n [ 2 ] [ f >>> 8 & 255 ] ^ n [ 3 ] [ 255 & s ] ^ e [ o ++ ] , a = h , f = c , s = d , u = l ; return h = ( i [ a >>> 24 ] << 24 | i [ f >>> 16 & 255 ] << 16 | i [ s >>> 8 & 255 ] << 8 | i [ 255 & u ] ) ^ e [ o ++ ] , c = ( i [ f >>> 24 ] << 24 | i [ s >>> 16 & 255 ] << 16 | i [ u >>> 8 & 255 ] << 8 | i [ 255 & a ] ) ^ e [ o ++ ] , d = ( i [ s >>> 24 ] << 24 | i [ u >>> 16 & 255 ] << 16 | i [ a >>> 8 & 255 ] << 8 | i [ 255 & f ] ) ^ e [ o ++ ] , l = ( i [ u >>> 24 ] << 24 | i [ a >>> 16 & 255 ] << 16 | i [ f >>> 8 & 255 ] << 8 | i [ 255 & s ] ) ^ e [ o ++ ] , [ r ( h ) , r ( c ) , r ( d ) , r ( l ) ] } , e . AES = a } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e ) { e [ "aes-128-ecb" ] = { cipher : "AES" , key : 128 , iv : 0 , mode : "ECB" , type : "block" } , e [ "aes-192-ecb" ] = { cipher : "AES" , key : 192 , iv : 0 , mode : "ECB" , type : "block" } , e [ "aes-256-ecb" ] = { cipher : "AES" , key : 256 , iv : 0 , mode : "ECB" , type : "block" } , e [ "aes-128-cbc" ] = { cipher : "AES" , key : 128 , iv : 16 , mode : "CBC" , type : "block" } , e [ "aes-192-cbc" ] = { cipher : "AES" , key : 192 , iv : 16 , mode : "CBC" , type : "block" } , e [ "aes-256-cbc" ] = { cipher : "AES" , key : 256 , iv : 16 , mode : "CBC" , type : "block" } , e . aes128 = e [ "aes-128-cbc" ] , e . aes192 = e [ "aes-192-cbc" ] , e . aes256 = e [ "aes-256-cbc" ] , e [ "aes-128-cfb" ] = { cipher : "AES" , key : 128 , iv : 16 , mode : "CFB" , type : "stream" } , e [ "aes-192-cfb" ] = { cipher : "AES" , key : 192 , iv : 16 , mode : "CFB" , type : "stream" } , e [ "aes-256-cfb" ] = { cipher : "AES" , key : 256 , iv : 16 , mode : "CFB" , type : "stream" } , e [ "aes-128-cfb8" ] = { cipher : "AES" , key : 128 , iv : 16 , mode : "CFB8" , type : "stream" } , e [ "aes-192-cfb8" ] = { cipher : "AES" , key : 192 , iv : 16 , mode : "CFB8" , type : "stream" } , e [ "aes-256-cfb8" ] = { cipher : "AES" , key : 256 , iv : 16 , mode : "CFB8" , type : "stream" } , e [ "aes-128-cfb1" ] = { cipher : "AES" , key : 128 , iv : 16 , mode : "CFB1" , type : "stream" } , e [ "aes-192-cfb1" ] = { cipher : "AES" , key : 192 , iv : 16 , mode : "CFB1" , type : "stream" } , e [ "aes-256-cfb1" ] = { cipher : "AES" , key : 256 , iv : 16 , mode : "CFB1" , type : "stream" } , e [ "aes-128-ofb" ] = { cipher : "AES" , key : 128 , iv : 16 , mode : "OFB" , type : "stream" } , e [ "aes-192-ofb" ] = { cipher : "AES" , key : 192 , iv : 16 , mode : "OFB" , type : "stream" } , e [ "aes-256-ofb" ] = { cipher : "AES" , key : 256 , iv : 16 , mode : "OFB" , type : "stream" } , e [ "aes-128-ctr" ] = { cipher : "AES" , key : 128 , iv : 16 , mode : "CTR" , type : "stream" } , e [ "aes-192-ctr" ] = { cipher : "AES" , key : 192 , iv : 16 , mode : "CTR" , type : "stream" } , e [ "aes-256-ctr" ] = { cipher : "AES" , key : 256 , iv : 16 , mode : "CTR" , type : "stream" } , e [ "aes-128-gcm" ] = { cipher : "AES" , key : 128 , iv : 12 , mode : "GCM" , type : "auth" } , e [ "aes-192-gcm" ] = { cipher : "AES" , key : 192 , iv : 12 , mode : "GCM" , type : "auth" } , e [ "aes-256-gcm" ] = { cipher : "AES" , key : 256 , iv : 12 , mode : "GCM" , type : "auth" } } , function ( t , e , r ) { ( function ( t ) { function n ( t ) { for ( var e , r = t . length ; r -- ; ) { if ( e = t . readUInt8 ( r ) , 255 !== e ) { e ++ , t . writeUInt8 ( e , r ) ; break } t . writeUInt8 ( 0 , r ) } } function i ( t ) { var e = t . _cipher . encryptBlock ( t . _prev ) ; return n ( t . _prev ) , e } var o = r ( 67 ) ; e . encrypt = function ( e , r ) { for ( ; e . _cache . length < r . length ; ) e . _cache = t . concat ( [ e . _cache , i ( e ) ] ) ; var n = e . _cache . slice ( 0 , r . length ) ; return e . _cache = e . _cache . slice ( r . length ) , o ( r , n ) } } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e , r ) { ( function ( e ) { function n ( t ) { i . call ( this ) , this . hashMode = "string" == typeof t , this . hashMode ? this [ t ] = this . _finalOrDigest : this . final = this . _finalOrDigest , this . _decoder = null , this . _encoding = null } var i = r ( 31 ) . Transform , o = r ( 2 ) , a = r ( 52 ) . StringDecoder ; t . exports = n , o ( n , i ) , n . prototype . update = function ( t , r , n ) { "string" == typeof t && ( t = new e ( t , r ) ) ; var i = this . _update ( t ) ; return this . hashMode ? this : ( n && ( i = this . _toString ( i , n ) ) , i ) } , n . prototype . setAutoPadding = function ( ) { } , n . prototype . getAuthTag = function ( ) { t
var n , i , o , a = Array ( r ) , f = 8 * r - e - 1 , s = ( 1 << f ) - 1 , u = s >> 1 , h = 23 === e ? B ( 2 , - 24 ) - B ( 2 , - 77 ) : 0 , c = 0 , d = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0 ; for ( t = I ( t ) , t != t || t === k ? ( i = t != t ? 1 : 0 , n = s ) : ( n = O ( R ( t ) / P ) , t * ( o = B ( 2 , - n ) ) < 1 && ( n -- , o *= 2 ) , t += n + u >= 1 ? h / o : h * B ( 2 , 1 - u ) , t * o >= 2 && ( n ++ , o /= 2 ) , n + u >= s ? ( i = 0 , n = s ) : n + u >= 1 ? ( i = ( t * o - 1 ) * B ( 2 , e ) , n += u ) : ( i = t * B ( 2 , u - 1 ) * B ( 2 , e ) , n = 0 ) ) ; e >= 8 ; a [ c ++ ] = 255 & i , i /= 256 , e -= 8 ) ; for ( n = n << e | i , f += e ; f > 0 ; a [ c ++ ] = 255 & n , n /= 256 , f -= 8 ) ; return a [ -- c ] |= 128 * d , a } , D = function ( t , e , r ) { var n , i = 8 * r - e - 1 , o = ( 1 << i ) - 1 , a = o >> 1 , f = i - 7 , s = r - 1 , u = t [ s -- ] , h = 127 & u ; for ( u >>= 7 ; f > 0 ; h = 256 * h + t [ s ] , s -- , f -= 8 ) ; for ( n = h & ( 1 << - f ) - 1 , h >>= - f , f += e ; f > 0 ; n = 256 * n + t [ s ] , s -- , f -= 8 ) ; if ( 0 === h ) h = 1 - a ; else { if ( h === o ) return n ? NaN : u ? - k : k ; n += B ( 2 , e ) , h -= a } return ( u ? - 1 : 1 ) * n * B ( 2 , h - e ) } , q = function ( t ) { return t [ 3 ] << 24 | t [ 2 ] << 16 | t [ 1 ] << 8 | t [ 0 ] } , F = function ( t ) { return [ 255 & t ] } , K = function ( t ) { return [ 255 & t , t >> 8 & 255 ] } , G = function ( t ) { return [ 255 & t , t >> 8 & 255 , t >> 16 & 255 , t >> 24 & 255 ] } , V = function ( t ) { return z ( t , 52 , 8 ) } , H = function ( t ) { return z ( t , 23 , 4 ) } , X = function ( t , e , r ) { p ( t [ g ] , e , { get : function ( ) { return this [ r ] } } ) } , Y = function ( t , e , r , n ) { var i = + r , o = c ( i ) ; if ( i != o || o < 0 || o + e > t [ L ] ) throw A ( _ ) ; var a = t [ N ] . _b , f = o + t [ U ] , s = a . slice ( f , f + e ) ; return n ? s : s . reverse ( ) } , W = function ( t , e , r , n , i , o ) { var a = + r , f = c ( a ) ; if ( a != f || f < 0 || f + e > t [ L ] ) throw A ( _ ) ; for ( var s = t [ N ] . _b , u = f + t [ U ] , h = n ( + i ) , d = 0 ; d < e ; d ++ ) s [ u + d ] = h [ o ? d : e - d - 1 ] } , Z = function ( t , e ) { h ( t , M , y ) ; var r = + e , n = d ( r ) ; if ( r != n ) throw A ( w ) ; return n } ; if ( a . ABV ) { if ( ! u ( function ( ) { new M } ) || ! u ( function ( ) { new M ( . 5 ) } ) ) { M = function ( t ) { return new x ( Z ( this , t ) ) } ; for ( var J , $ = M [ g ] = x [ g ] , Q = l ( x ) , tt = 0 ; Q . length > tt ; ) ( J = Q [ tt ++ ] ) in M || f ( M , J , x [ J ] ) ; o || ( $ . constructor = M ) } var et = new S ( new M ( 2 ) ) , rt = S [ g ] . setInt8 ; et . setInt8 ( 0 , 2147483648 ) , et . setInt8 ( 1 , 2147483649 ) , ! et . getInt8 ( 0 ) && et . getInt8 ( 1 ) || s ( S [ g ] , { setInt8 : function ( t , e ) { rt . call ( this , t , e << 24 >> 24 ) } , setUint8 : function ( t , e ) { rt . call ( this , t , e << 24 >> 24 ) } } , ! 0 ) } else M = function ( t ) { var e = Z ( this , t ) ; this . _b = b . call ( Array ( e ) , 0 ) , this [ L ] = e } , S = function ( t , e , r ) { h ( this , S , m ) , h ( t , M , m ) ; var n = t [ L ] , i = c ( e ) ; if ( i < 0 || i > n ) throw A ( "Wrong offset!" ) ; if ( r = void 0 === r ? n - i : d ( r ) , i + r > n ) throw A ( w ) ; this [ N ] = t , this [ U ] = i , this [ L ] = r } , i && ( X ( M , j , "_l" ) , X ( S , T , "_b" ) , X ( S , j , "_l" ) , X ( S , C , "_o" ) ) , s ( S [ g ] , { getInt8 : function ( t ) { return Y ( this , 1 , t ) [ 0 ] << 24 >> 24 } , getUint8 : function ( t ) { return Y ( this , 1 , t ) [ 0 ] } , getInt16 : function ( t ) { var e = Y ( this , 2 , t , arguments [ 1 ] ) ; return ( e [ 1 ] << 8 | e [ 0 ] ) << 16 >> 16 } , getUint16 : function ( t ) { var e = Y ( this , 2 , t , arguments [ 1 ] ) ; return e [ 1 ] << 8 | e [ 0 ] } , getInt32 : function ( t ) { return q ( Y ( this , 4 , t , arguments [ 1 ] ) ) } , getUint32 : function ( t ) { return q ( Y ( this , 4 , t , arguments [ 1 ] ) ) >>> 0 } , getFloat32 : function ( t ) { return D ( Y ( this , 4 , t , arguments [ 1 ] ) , 23 , 4 ) } , getFloat64 : function ( t ) { return D ( Y ( this , 8 , t , arguments [ 1 ] ) , 52 , 8 ) } , setInt8 : function ( t , e ) { W ( this , 1 , t , F , e ) } , setUint8 : function ( t , e ) { W ( this , 1 , t , F , e ) } , setInt16 : function ( t , e ) { W ( this , 2 , t , K , e , arguments [ 2 ] ) } , setUint16 : function ( t , e ) { W ( this , 2 , t , K , e , arguments [ 2 ] ) } , setInt32 : function ( t , e ) { W ( this , 4 , t , G , e , arguments [ 2 ] ) } , setUint32 : function ( t , e ) { W ( this , 4 , t , G , e , arguments [ 2 ] ) } , setFloat32 : function ( t , e ) { W ( this , 4 , t , H , e , arguments [ 2 ] ) } , setFloat64 : function ( t , e ) { W ( this , 8 , t , V , e , arguments [ 2 ] ) } } ) ; v ( M , y ) , v ( S , m ) , f ( S [ g ] , a . VIEW , ! 0 ) , e [ y ] = M , e [ m ] = S } , function ( t , e , r ) { var n = r ( 4 ) , i = r ( 32 ) , o = r ( 41 ) , a = r ( 189 ) , f = r ( 9 ) . f ; t . exports = function ( t ) { var e = i . Symbol || ( i . Symbol = o ? { } : n . Symbol || { } ) ; "_" == t . charAt ( 0 ) || t in e || f ( e , t , { value : a . f ( t ) } ) } } , function ( t , e , r ) { var n = r ( 64 ) , i = r ( 7 ) ( "iterator" ) , o = r ( 56 ) ; t . exports = r ( 32 ) . getIteratorMethod = function ( t ) { if ( void 0 != t ) return t [ i ] || t [ "@@iterator" ] || o [ n ( t ) ] } } , function ( t , e , r ) { "use strict" ; var n = r ( 54 ) , i = r ( 177 ) , o = r ( 56 ) , a = r ( 17 ) ; t . exports = r ( 128 ) ( Array , "Array" , function ( t , e ) { this . _t = a ( t ) , this . _i = 0 , this . _k = e } , function ( ) { var t = this . _t , e = this . _k , r = this . _i ++ ; return ! t || r >= t . length ? ( this . _t = void 0 , i ( 1 ) ) : "keys" == e ? i ( 0 , r ) : "values" == e ? i ( 0 , t [ r ] ) : i ( 0 , [ r , t [ r ] ] ) } , "values" ) , o . Arguments = o . Array , n ( "keys" ) , n ( "values" ) , n ( "entries" ) } , function ( t , e , r ) { t . exports = ! r ( 199 ) ( function ( ) { return 7 != Object . defineProperty ( { } , "a" , { get : function ( ) { return 7 } } ) . a } ) } , function ( t , e , r ) { "use strict" ; e . utils = r ( 505 ) , e . Cipher = r ( 502 ) , e . DES = r ( 503 ) , e . CBC = r ( 501 ) , e . EDE = r ( 504 ) } , function ( t , e , r ) { ( function ( e ) { function n ( t , r , n , o ) { e . isBuffer ( t ) || ( t = new e ( t , "binary" ) ) , r && ! e . isBuffer ( r ) && ( r = new e ( r , "binary" ) ) , n /= 8 , o = o || 0 ; for ( var a , f , s = 0 , u = 0 , h = new e ( n ) , c = new e ( o ) , d =
l !== f && ( m = s * c - u * d , d = s * d + u * c , c = m ) } } , d . prototype . guessLen13b = function ( t , e ) { var r = 1 | Math . max ( e , t ) , n = 1 & r , i = 0 ; for ( r = r / 2 | 0 ; r ; r >>>= 1 ) i ++ ; return 1 << i + 1 + n } , d . prototype . conjugate = function ( t , e , r ) { if ( ! ( r <= 1 ) ) for ( var n = 0 ; n < r / 2 ; n ++ ) { var i = t [ n ] ; t [ n ] = t [ r - n - 1 ] , t [ r - n - 1 ] = i , i = e [ n ] , e [ n ] = - e [ r - n - 1 ] , e [ r - n - 1 ] = - i } } , d . prototype . normalize13b = function ( t , e ) { for ( var r = 0 , n = 0 ; n < e / 2 ; n ++ ) { var i = 8192 * Math . round ( t [ 2 * n + 1 ] / e ) + Math . round ( t [ 2 * n ] / e ) + r ; t [ n ] = 67108863 & i , r = i < 67108864 ? 0 : i / 67108864 | 0 } return t } , d . prototype . convert13b = function ( t , e , r , i ) { for ( var o = 0 , a = 0 ; a < e ; a ++ ) o += 0 | t [ a ] , r [ 2 * a ] = 8191 & o , o >>>= 13 , r [ 2 * a + 1 ] = 8191 & o , o >>>= 13 ; for ( a = 2 * e ; a < i ; ++ a ) r [ a ] = 0 ; n ( 0 === o ) , n ( 0 === ( o & - 8192 ) ) } , d . prototype . stub = function ( t ) { for ( var e = new Array ( t ) , r = 0 ; r < t ; r ++ ) e [ r ] = 0 ; return e } , d . prototype . mulp = function ( t , e , r ) { var n = 2 * this . guessLen13b ( t . length , e . length ) , i = this . makeRBT ( n ) , o = this . stub ( n ) , a = new Array ( n ) , f = new Array ( n ) , s = new Array ( n ) , u = new Array ( n ) , h = new Array ( n ) , c = new Array ( n ) , d = r . words ; d . length = n , this . convert13b ( t . words , t . length , a , n ) , this . convert13b ( e . words , e . length , u , n ) , this . transform ( a , o , f , s , n , i ) , this . transform ( u , o , h , c , n , i ) ; for ( var l = 0 ; l < n ; l ++ ) { var p = f [ l ] * h [ l ] - s [ l ] * c [ l ] ; s [ l ] = f [ l ] * c [ l ] + s [ l ] * h [ l ] , f [ l ] = p } return this . conjugate ( f , s , n ) , this . transform ( f , s , d , o , n , i ) , this . conjugate ( d , o , n ) , this . normalize13b ( d , n ) , r . negative = t . negative ^ e . negative , r . length = t . length + e . length , r . strip ( ) } , o . prototype . mul = function ( t ) { var e = new o ( null ) ; return e . words = new Array ( this . length + t . length ) , this . mulTo ( t , e ) } , o . prototype . mulf = function ( t ) { var e = new o ( null ) ; return e . words = new Array ( this . length + t . length ) , c ( this , t , e ) } , o . prototype . imul = function ( t ) { return this . clone ( ) . mulTo ( t , this ) } , o . prototype . imuln = function ( t ) { n ( "number" == typeof t ) , n ( t < 67108864 ) ; for ( var e = 0 , r = 0 ; r < this . length ; r ++ ) { var i = ( 0 | this . words [ r ] ) * t , o = ( 67108863 & i ) + ( 67108863 & e ) ; e >>= 26 , e += i / 67108864 | 0 , e += o >>> 26 , this . words [ r ] = 67108863 & o } return 0 !== e && ( this . words [ r ] = e , this . length ++ ) , this } , o . prototype . muln = function ( t ) { return this . clone ( ) . imuln ( t ) } , o . prototype . sqr = function ( ) { return this . mul ( this ) } , o . prototype . isqr = function ( ) { return this . imul ( this . clone ( ) ) } , o . prototype . pow = function ( t ) { var e = s ( t ) ; if ( 0 === e . length ) return new o ( 1 ) ; for ( var r = this , n = 0 ; n < e . length && 0 === e [ n ] ; n ++ , r = r . sqr ( ) ) ; if ( ++ n < e . length ) for ( var i = r . sqr ( ) ; n < e . length ; n ++ , i = i . sqr ( ) ) 0 !== e [ n ] && ( r = r . mul ( i ) ) ; return r } , o . prototype . iushln = function ( t ) { n ( "number" == typeof t && t >= 0 ) ; var e , r = t % 26 , i = ( t - r ) / 26 , o = 67108863 >>> 26 - r << 26 - r ; if ( 0 !== r ) { var a = 0 ; for ( e = 0 ; e < this . length ; e ++ ) { var f = this . words [ e ] & o , s = ( 0 | this . words [ e ] ) - f << r ; this . words [ e ] = s | a , a = f >>> 26 - r } a && ( this . words [ e ] = a , this . length ++ ) } if ( 0 !== i ) { for ( e = this . length - 1 ; e >= 0 ; e -- ) this . words [ e + i ] = this . words [ e ] ; for ( e = 0 ; e < i ; e ++ ) this . words [ e ] = 0 ; this . length += i } return this . strip ( ) } , o . prototype . ishln = function ( t ) { return n ( 0 === this . negative ) , this . iushln ( t ) } , o . prototype . iushrn = function ( t , e , r ) { n ( "number" == typeof t && t >= 0 ) ; var i ; i = e ? ( e - e % 26 ) / 26 : 0 ; var o = t % 26 , a = Math . min ( ( t - o ) / 26 , this . length ) , f = 67108863 ^ 67108863 >>> o << o , s = r ; if ( i -= a , i = Math . max ( 0 , i ) , s ) { for ( var u = 0 ; u < a ; u ++ ) s . words [ u ] = this . words [ u ] ; s . length = a } if ( 0 === a ) ; else if ( this . length > a ) for ( this . length -= a , u = 0 ; u < this . length ; u ++ ) this . words [ u ] = this . words [ u + a ] ; else this . words [ 0 ] = 0 , this . length = 1 ; var h = 0 ; for ( u = this . length - 1 ; u >= 0 && ( 0 !== h || u >= i ) ; u -- ) { var c = 0 | this . words [ u ] ; this . words [ u ] = h << 26 - o | c >>> o , h = c & f } return s && 0 !== h && ( s . words [ s . length ++ ] = h ) , 0 === this . length && ( this . words [ 0 ] = 0 , this . length = 1 ) , this . strip ( ) } , o . prototype . ishrn = function ( t , e , r ) { return n ( 0 === this . negative ) , this . iushrn ( t , e , r ) } , o . prototype . shln = function ( t ) { return this . clone ( ) . ishln ( t ) } , o . prototype . ushln = function ( t ) { return this . clone ( ) . iushln ( t ) } , o . prototype . shrn = function ( t ) { return this . clone ( ) . ishrn ( t ) } , o . prototype . ushrn = function ( t ) { return this . clone ( ) . iushrn ( t ) } , o . prototype . testn = function ( t ) { n ( "number" == typeof t && t >= 0 ) ; var e = t % 26 , r = ( t - e ) / 26 , i = 1 << e ; if ( this . length <= r ) return ! 1 ; var o = this . words [ r ] ; return ! ! ( o & i ) } , o . prototype . imaskn = function ( t ) { n ( "number" == typeof t && t >= 0 ) ; var e = t % 26 , r = ( t - e ) / 26 ; if ( n ( 0 === this . negative , "imaskn works only with positive numbers" ) , this . length <= r ) return this ; if ( 0 !== e && r ++ , this . length = Math . min ( r , this . length ) , 0 !== e ) { var i = 67108863 ^ 67108863 >>> e << e ; this . words [ this . length - 1 ] &= i } ret
} ) . call ( e , r ( 26 ) ) } , function ( t , e , r ) { ( function ( t , n ) { function i ( t , e ) { this . _id = t , this . _clearFn = e } var o = r ( 26 ) . nextTick , a = Function . prototype . apply , f = Array . prototype . slice , s = { } , u = 0 ; e . setTimeout = function ( ) { return new i ( a . call ( setTimeout , window , arguments ) , clearTimeout ) } , e . setInterval = function ( ) { return new i ( a . call ( setInterval , window , arguments ) , clearInterval ) } , e . clearTimeout = e . clearInterval = function ( t ) { t . close ( ) } , i . prototype . unref = i . prototype . ref = function ( ) { } , i . prototype . close = function ( ) { this . _clearFn . call ( window , this . _id ) } , e . enroll = function ( t , e ) { clearTimeout ( t . _idleTimeoutId ) , t . _idleTimeout = e } , e . unenroll = function ( t ) { clearTimeout ( t . _idleTimeoutId ) , t . _idleTimeout = - 1 } , e . _unrefActive = e . active = function ( t ) { clearTimeout ( t . _idleTimeoutId ) ; var e = t . _idleTimeout ; e >= 0 && ( t . _idleTimeoutId = setTimeout ( function ( ) { t . _onTimeout && t . _onTimeout ( ) } , e ) ) } , e . setImmediate = "function" == typeof t ? t : function ( t ) { var r = u ++ , n = ! ( arguments . length < 2 ) && f . call ( arguments , 1 ) ; return s [ r ] = ! 0 , o ( function ( ) { s [ r ] && ( n ? t . apply ( null , n ) : t . call ( null ) , e . clearImmediate ( r ) ) } ) , r } , e . clearImmediate = "function" == typeof n ? n : function ( t ) { delete s [ t ] } } ) . call ( e , r ( 158 ) . setImmediate , r ( 158 ) . clearImmediate ) } , function ( t , e , r ) { "use strict" ; function n ( t , e ) { if ( ! ( t instanceof e ) ) throw new TypeError ( "Cannot call a class as a function" ) } function i ( t , e ) { if ( ! t ) throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; return ! e || "object" != typeof e && "function" != typeof e ? t : e } function o ( t , e ) { if ( "function" != typeof e && null !== e ) throw new TypeError ( "Super expression must either be null or a function, not " + typeof e ) ; t . prototype = Object . create ( e && e . prototype , { constructor : { value : t , enumerable : ! 1 , writable : ! 0 , configurable : ! 0 } } ) , e && ( Object . setPrototypeOf ? Object . setPrototypeOf ( t , e ) : t . _ _proto _ _ = e ) } var a = r ( 62 ) , f = function ( t ) { function e ( ) { return n ( this , e ) , i ( this , ( e . _ _proto _ _ || Object . getPrototypeOf ( e ) ) . apply ( this , arguments ) ) } return o ( e , t ) , e } ( a ) ; t . exports = f } , function ( t , e , r ) { "use strict" ; function n ( t , e ) { if ( ! ( t instanceof e ) ) throw new TypeError ( "Cannot call a class as a function" ) } function i ( t , e ) { if ( ! t ) throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; return ! e || "object" != typeof e && "function" != typeof e ? t : e } function o ( t , e ) { if ( "function" != typeof e && null !== e ) throw new TypeError ( "Super expression must either be null or a function, not " + typeof e ) ; t . prototype = Object . create ( e && e . prototype , { constructor : { value : t , enumerable : ! 1 , writable : ! 0 , configurable : ! 0 } } ) , e && ( Object . setPrototypeOf ? Object . setPrototypeOf ( t , e ) : t . _ _proto _ _ = e ) } var a = r ( 62 ) , f = function ( t ) { function e ( ) { return n ( this , e ) , i ( this , ( e . _ _proto _ _ || Object . getPrototypeOf ( e ) ) . apply ( this , arguments ) ) } return o ( e , t ) , e } ( a ) ; t . exports = f } , function ( t , e , r ) { "use strict" ; ( function ( e ) { function n ( t , e ) { if ( ! ( t instanceof e ) ) throw new TypeError ( "Cannot call a class as a function" ) } var i = function ( ) { function t ( t , e ) { for ( var r = 0 ; r < e . length ; r ++ ) { var n = e [ r ] ; n . enumerable = n . enumerable || ! 1 , n . configurable = ! 0 , "value" in n && ( n . writable = ! 0 ) , Object . defineProperty ( t , n . key , n ) } } return function ( e , r , n ) { return r && t ( e . prototype , r ) , n && t ( e , n ) , e } } ( ) , o = r ( 257 ) . Ber , a = 65537 , f = function ( ) { function t ( ) { n ( this , t ) } return i ( t , null , [ { key : "modulusToPem" , value : function ( t ) { if ( 0 === t [ 0 ] ) throw new Error ( "Modulus may not start with zero" ) ; 128 & t [ 0 ] && ( t = e . concat ( [ new e ( [ 0 ] ) , t ] ) ) ; var r = new o . Writer ; return r . startSequence ( ) , r . writeBuffer ( t , 2 ) , r . writeInt ( a ) , r . endSequence ( ) , "-----BEGIN RSA PUBLIC KEY-----\n" + r . buffer . toString ( "base64" ) . match ( /.{1,64}/g ) . join ( "\n" ) + "\n-----END RSA PUBLIC KEY-----\n" } } , { key : "modulusFromPrivateKey" , value : function ( t ) { var r = t . replace ( "-----BEGIN RSA PRIVATE KEY-----" , "" ) . replace ( "-----END RSA PRIVATE KEY-----" , "" ) . replace ( /\s+|\n\r|\n|\r$/gm , "" ) , n = new e ( r , "base64" ) , i = new o . Reader ( n ) ; i . readSequence ( ) , i . readString ( 2 , ! 0 ) ; var a = i . readString ( 2 , ! 0 ) ; return 0 === a [ 0 ] ? a . slice ( 1 ) : a } } ] ) , t } ( ) ; t . exports = f } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e , r ) { r ( 281 ) , t . exports = r ( 163 ) . Number . isInteger } , function ( t , e ) { var r = t . exports = { version : "2.4.0" } ; "number" == typeof _ _e && ( _ _e = r ) } , function ( t , e ) { t . exports = function ( t ) { try { return ! ! t ( ) } catch ( t ) { return ! 0 } } } , function ( t , e ) { var r = t . exports = "undefined" != type
* The buffer module from node . js , for the browser .
*
* @ author Feross Aboukhadijeh < feross @ feross . org > < http : //feross.org>
* @ license MIT
* /
function n ( t , e ) { if ( t === e ) return 0 ; for ( var r = t . length , n = e . length , i = 0 , o = Math . min ( r , n ) ; i < o ; ++ i ) if ( t [ i ] !== e [ i ] ) { r = t [ i ] , n = e [ i ] ; break } return r < n ? - 1 : n < r ? 1 : 0 } function i ( t ) { return e . Buffer && "function" == typeof e . Buffer . isBuffer ? e . Buffer . isBuffer ( t ) : ! ( null == t || ! t . _isBuffer ) } function o ( t ) { return Object . prototype . toString . call ( t ) } function a ( t ) { return ! i ( t ) && ( "function" == typeof e . ArrayBuffer && ( "function" == typeof ArrayBuffer . isView ? ArrayBuffer . isView ( t ) : ! ! t && ( t instanceof DataView || ! ! ( t . buffer && t . buffer instanceof ArrayBuffer ) ) ) ) } function f ( t ) { if ( w . isFunction ( t ) ) { if ( S ) return t . name ; var e = t . toString ( ) , r = e . match ( A ) ; return r && r [ 1 ] } } function s ( t , e ) { return "string" == typeof t ? t . length < e ? t : t . slice ( 0 , e ) : t } function u ( t ) { if ( S || ! w . isFunction ( t ) ) return w . inspect ( t ) ; var e = f ( t ) , r = e ? ": " + e : "" ; return "[Function" + r + "]" } function h ( t ) { return s ( u ( t . actual ) , 128 ) + " " + t . operator + " " + s ( u ( t . expected ) , 128 ) } function c ( t , e , r , n , i ) { throw new E . AssertionError ( { message : r , actual : t , expected : e , operator : n , stackStartFunction : i } ) } function d ( t , e ) { t || c ( t , ! 0 , e , "==" , E . ok ) } function l ( t , e , r , f ) { if ( t === e ) return ! 0 ; if ( i ( t ) && i ( e ) ) return 0 === n ( t , e ) ; if ( w . isDate ( t ) && w . isDate ( e ) ) return t . getTime ( ) === e . getTime ( ) ; if ( w . isRegExp ( t ) && w . isRegExp ( e ) ) return t . source === e . source && t . global === e . global && t . multiline === e . multiline && t . lastIndex === e . lastIndex && t . ignoreCase === e . ignoreCase ; if ( null !== t && "object" == typeof t || null !== e && "object" == typeof e ) { if ( a ( t ) && a ( e ) && o ( t ) === o ( e ) && ! ( t instanceof Float32Array || t instanceof Float64Array ) ) return 0 === n ( new Uint8Array ( t . buffer ) , new Uint8Array ( e . buffer ) ) ; if ( i ( t ) !== i ( e ) ) return ! 1 ; f = f || { actual : [ ] , expected : [ ] } ; var s = f . actual . indexOf ( t ) ; return s !== - 1 && s === f . expected . indexOf ( e ) || ( f . actual . push ( t ) , f . expected . push ( e ) , b ( t , e , r , f ) ) } return r ? t === e : t == e } function p ( t ) { return "[object Arguments]" == Object . prototype . toString . call ( t ) } function b ( t , e , r , n ) { if ( null === t || void 0 === t || null === e || void 0 === e ) return ! 1 ; if ( w . isPrimitive ( t ) || w . isPrimitive ( e ) ) return t === e ; if ( r && Object . getPrototypeOf ( t ) !== Object . getPrototypeOf ( e ) ) return ! 1 ; var i = p ( t ) , o = p ( e ) ; if ( i && ! o || ! i && o ) return ! 1 ; if ( i ) return t = M . call ( t ) , e = M . call ( e ) , l ( t , e , r ) ; var a , f , s = k ( t ) , u = k ( e ) ; if ( s . length !== u . length ) return ! 1 ; for ( s . sort ( ) , u . sort ( ) , f = s . length - 1 ; f >= 0 ; f -- ) if ( s [ f ] !== u [ f ] ) return ! 1 ; for ( f = s . length - 1 ; f >= 0 ; f -- ) if ( a = s [ f ] , ! l ( t [ a ] , e [ a ] , r , n ) ) return ! 1 ; return ! 0 } function v ( t , e , r ) { l ( t , e , ! 0 ) && c ( t , e , r , "notDeepStrictEqual" , v ) } function y ( t , e ) { if ( ! t || ! e ) return ! 1 ; if ( "[object RegExp]" == Object . prototype . toString . call ( e ) ) return e . test ( t ) ; try { if ( t instanceof e ) return ! 0 } catch ( t ) { } return ! Error . isPrototypeOf ( e ) && e . call ( { } , t ) === ! 0 } function m ( t ) { var e ; try { t ( ) } catch ( t ) { e = t } return e } function g ( t , e , r , n ) { var i ; if ( "function" != typeof e ) throw new TypeError ( '"block" argument must be a function' ) ; "string" == typeof r && ( n = r , r = null ) , i = m ( e ) , n = ( r && r . name ? " (" + r . name + ")." : "." ) + ( n ? " " + n : "." ) , t && ! i && c ( i , r , "Missing expected exception" + n ) ; var o = "string" == typeof n , a = ! t && w . isError ( i ) , f = ! t && i && ! r ; if ( ( a && o && y ( i , r ) || f ) && c ( i , r , "Got unwanted exception" + n ) , t && i && r && ! y ( i , r ) || ! t && i ) throw i } var w = r ( 606 ) , _ = Object . prototype . hasOwnProperty , M = Array . prototype . slice , S = function ( ) { return "foo" === function ( ) { } . name } ( ) , E = t . exports = d , A = /\s*function\s+([^\(\s]*)\s*/ ; E . AssertionError = function ( t ) { this . name = "AssertionError" , this . actual = t . actual , this . expected = t . expected , this . operator = t . operator , t . message ? ( this . message = t . message , this . generatedMessage = ! 1 ) : ( this . message = h ( this ) , this . generatedMessage = ! 0 ) ; var e = t . stackStartFunction || c ; if ( Error . captureStackTrace ) Error . captureStackTrace ( this , e ) ; else { var r = new Error ; if ( r . stack ) { var n = r . stack , i = f ( e ) , o = n . indexOf ( "\n" + i ) ; if ( o >= 0 ) { var a = n . indexOf ( "\n" , o + 1 ) ; n = n . substring ( a + 1 ) } this . stack = n } } } , w . inherits ( E . AssertionError , Error ) , E . fail = c , E . ok = d , E . equal = function ( t , e , r ) { t != e && c ( t , e , r , "==" , E . equal ) } , E . notEqual = function ( t , e , r ) { t == e && c ( t , e , r , "!=" , E . notEqual ) } , E . deepEqual = function ( t , e , r ) { l ( t , e , ! 1 ) || c ( t , e , r , "deepEqual" , E . deepEqual ) } , E . deepStrictEqual = function ( t , e , r ) { l ( t , e , ! 0 ) || c ( t , e , r , "deepStrictEqual" , E . deepStrictEqual ) } , E . notDeepEqual = function ( t , e , r ) { l ( t , e , ! 1 ) && c ( t , e , r , "notDeepEqual" , E . notDeepEqual ) } , E . notDeepStrictEqual = v , E . strictEqual = function ( t , e , r ) { t !== e && c ( t , e , r , "===" , E . strict
B = e [ I - 4 ] , O = e [ I - 4 + 1 ] ; var T = h ( B , O ) , j = c ( O , B ) , C = e [ I - 14 ] , N = e [ I - 14 + 1 ] , L = e [ I - 32 ] , U = e [ I - 32 + 1 ] , z = P + N | 0 , D = R + C + d ( z , P ) | 0 ; z = z + j | 0 , D = D + T + d ( z , j ) | 0 , z = z + U | 0 , D = D + L + d ( z , U ) | 0 , e [ I ] = D , e [ I + 1 ] = z } for ( var q = 0 ; q < 160 ; q += 2 ) { D = e [ q ] , z = e [ q + 1 ] ; var F = o ( r , n , l ) , K = o ( w , _ , M ) , G = a ( r , w ) , V = a ( w , r ) , H = f ( v , E ) , X = f ( E , v ) , Y = b [ q ] , W = b [ q + 1 ] , Z = i ( v , y , m ) , J = i ( E , A , k ) , $ = x + X | 0 , Q = g + H + d ( $ , x ) | 0 ; $ = $ + J | 0 , Q = Q + Z + d ( $ , J ) | 0 , $ = $ + W | 0 , Q = Q + Y + d ( $ , W ) | 0 , $ = $ + z | 0 , Q = Q + D + d ( $ , z ) | 0 ; var tt = V + K | 0 , et = G + F + d ( tt , V ) | 0 ; g = m , x = k , m = y , k = A , y = v , A = E , E = S + $ | 0 , v = p + Q + d ( E , S ) | 0 , p = l , S = M , l = n , M = _ , n = r , _ = w , w = $ + tt | 0 , r = Q + et + d ( w , $ ) | 0 } this . _al = this . _al + w | 0 , this . _bl = this . _bl + _ | 0 , this . _cl = this . _cl + M | 0 , this . _dl = this . _dl + S | 0 , this . _el = this . _el + E | 0 , this . _fl = this . _fl + A | 0 , this . _gl = this . _gl + k | 0 , this . _hl = this . _hl + x | 0 , this . _ah = this . _ah + r + d ( this . _al , w ) | 0 , this . _bh = this . _bh + n + d ( this . _bl , _ ) | 0 , this . _ch = this . _ch + l + d ( this . _cl , M ) | 0 , this . _dh = this . _dh + p + d ( this . _dl , S ) | 0 , this . _eh = this . _eh + v + d ( this . _el , E ) | 0 , this . _fh = this . _fh + y + d ( this . _fl , A ) | 0 , this . _gh = this . _gh + m + d ( this . _gl , k ) | 0 , this . _hh = this . _hh + g + d ( this . _hl , x ) | 0 } , n . prototype . _hash = function ( ) { function t ( t , e , n ) { r . writeInt32BE ( t , n ) , r . writeInt32BE ( e , n + 4 ) } var r = new e ( 64 ) ; return t ( this . _ah , this . _al , 0 ) , t ( this . _bh , this . _bl , 8 ) , t ( this . _ch , this . _cl , 16 ) , t ( this . _dh , this . _dl , 24 ) , t ( this . _eh , this . _el , 32 ) , t ( this . _fh , this . _fl , 40 ) , t ( this . _gh , this . _gl , 48 ) , t ( this . _hh , this . _hl , 56 ) , r } , t . exports = n } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e , r ) { function n ( ) { if ( null !== g ) return g ; var t = 1048576 , e = [ ] ; e [ 0 ] = 2 ; for ( var r = 1 , n = 3 ; n < t ; n += 2 ) { for ( var i = Math . ceil ( Math . sqrt ( n ) ) , o = 0 ; o < r && e [ o ] <= i && n % e [ o ] !== 0 ; o ++ ) ; r !== o && e [ o ] <= i || ( e [ r ++ ] = n ) } return g = e , e } function i ( t ) { for ( var e = n ( ) , r = 0 ; r < e . length ; r ++ ) if ( 0 === t . modn ( e [ r ] ) ) return 0 === t . cmpn ( e [ r ] ) ; return ! 0 } function o ( t ) { var e = s . mont ( t ) ; return 0 === l . toRed ( e ) . redPow ( t . subn ( 1 ) ) . fromRed ( ) . cmpn ( 1 ) } function a ( t , e ) { if ( t < 16 ) return new s ( 2 === e || 5 === e ? [ 140 , 123 ] : [ 140 , 39 ] ) ; e = new s ( e ) ; for ( var r , n ; ; ) { for ( r = new s ( f ( Math . ceil ( t / 8 ) ) ) ; r . bitLength ( ) > t ; ) r . ishrn ( 1 ) ; if ( r . isEven ( ) && r . iadd ( d ) , r . testn ( 1 ) || r . iadd ( l ) , e . cmp ( l ) ) { if ( ! e . cmp ( p ) ) for ( ; r . mod ( b ) . cmp ( v ) ; ) r . iadd ( m ) } else for ( ; r . mod ( u ) . cmp ( y ) ; ) r . iadd ( m ) ; if ( n = r . shrn ( 1 ) , i ( n ) && i ( r ) && o ( n ) && o ( r ) && c . test ( n ) && c . test ( r ) ) return r } } var f = r ( 61 ) ; t . exports = a , a . simpleSieve = i , a . fermatTest = o ; var s = r ( 150 ) , u = new s ( 24 ) , h = r ( 230 ) , c = new h , d = new s ( 1 ) , l = new s ( 2 ) , p = new s ( 5 ) , b = ( new s ( 16 ) , new s ( 8 ) , new s ( 10 ) ) , v = new s ( 3 ) , y = ( new s ( 7 ) , new s ( 11 ) ) , m = new s ( 4 ) , g = ( new s ( 12 ) , null ) } , function ( t , e , r ) { function n ( t ) { this . rand = t || new o . Rand } var i = r ( 150 ) , o = r ( 575 ) ; t . exports = n , n . create = function ( t ) { return new n ( t ) } , n . prototype . _rand = function ( t ) { var e = t . bitLength ( ) , r = this . rand . generate ( Math . ceil ( e / 8 ) ) ; r [ 0 ] |= 3 ; var n = 7 & e ; return 0 !== n && ( r [ r . length - 1 ] >>= 7 - n ) , new i ( r ) } , n . prototype . test = function ( t , e , r ) { var n = t . bitLength ( ) , o = i . mont ( t ) , a = new i ( 1 ) . toRed ( o ) ; e || ( e = Math . max ( 1 , n / 48 | 0 ) ) ; for ( var f = t . subn ( 1 ) , s = f . subn ( 1 ) , u = 0 ; ! f . testn ( u ) ; u ++ ) ; for ( var h = t . shrn ( u ) , c = f . toRed ( o ) , d = ! 0 ; e > 0 ; e -- ) { var l = this . _rand ( s ) ; r && r ( l ) ; var p = l . toRed ( o ) . redPow ( h ) ; if ( 0 !== p . cmp ( a ) && 0 !== p . cmp ( c ) ) { for ( var b = 1 ; b < u ; b ++ ) { if ( p = p . redSqr ( ) , 0 === p . cmp ( a ) ) return ! 1 ; if ( 0 === p . cmp ( c ) ) break } if ( b === u ) return ! 1 } } return d } , n . prototype . getDivisor = function ( t , e ) { var r = t . bitLength ( ) , n = i . mont ( t ) , o = new i ( 1 ) . toRed ( n ) ; e || ( e = Math . max ( 1 , r / 48 | 0 ) ) ; for ( var a = t . subn ( 1 ) , f = a . subn ( 1 ) , s = 0 ; ! a . testn ( s ) ; s ++ ) ; for ( var u = t . shrn ( s ) , h = a . toRed ( n ) ; e > 0 ; e -- ) { var c = this . _rand ( f ) , d = t . gcd ( c ) ; if ( 0 !== d . cmpn ( 1 ) ) return d ; var l = c . toRed ( n ) . redPow ( u ) ; if ( 0 !== l . cmp ( o ) && 0 !== l . cmp ( h ) ) { for ( var p = 1 ; p < s ; p ++ ) { if ( l = l . redSqr ( ) , 0 === l . cmp ( o ) ) return l . fromRed ( ) . subn ( 1 ) . gcd ( t ) ; if ( 0 === l . cmp ( h ) ) break } if ( p === s ) return l = l . redSqr ( ) , l . fromRed ( ) . subn ( 1 ) . gcd ( t ) } } return ! 1 } } , function ( t , e , r ) { ( function ( e ) { function n ( t ) { var r = new e ( 4 ) ; return r . writeUInt32BE ( t , 0 ) , r } var i = r ( 59 ) ; t . exports = function ( t , r ) { for ( var o , a = new e ( "" ) , f = 0 ; a . length < r ; ) o = n ( f ++ ) , a = e . concat ( [ a , i ( "sha1" ) . update ( t ) . update ( o ) . digest ( ) ] ) ; return a . slice ( 0 , r ) } } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e , r ) { ( function ( e ) { function n ( t ) { var e = o ( t ) , r = e . toRed ( a . mont ( t . modulus ) ) . redPow ( new a ( t . publicExponent ) ) . fromRed ( ) ; return { blinder : r , unblinder : e . invm ( t . modulus ) } } function i ( t , r ) { var i = n ( r ) , o = r . modulus . byteLength ( ) , f = ( a . mont ( r . modulus ) , new a ( t ) . mul ( i . blinder ) . umod ( r . modulus ) ) , s = f . toRed ( a . mont ( r . prime1 ) ) , u = f . t
configurable : ! 0 , value : r } ) } } catch ( t ) { return function ( t , e , r ) { t [ e ] = r } } } ( ) , globals = [ "Array" , "Boolean" , "Date" , "Error" , "EvalError" , "Function" , "Infinity" , "JSON" , "Math" , "NaN" , "Number" , "Object" , "RangeError" , "ReferenceError" , "RegExp" , "String" , "SyntaxError" , "TypeError" , "URIError" , "decodeURI" , "decodeURIComponent" , "encodeURI" , "encodeURIComponent" , "escape" , "eval" , "isFinite" , "isNaN" , "parseFloat" , "parseInt" , "undefined" , "unescape" ] ; Context . prototype = { } ; var Script = exports . Script = function ( t ) { return this instanceof Script ? void ( this . code = t ) : new Script ( t ) } ; Script . prototype . runInContext = function ( t ) { if ( ! ( t instanceof Context ) ) throw new TypeError ( "needs a 'context' argument." ) ; var e = document . createElement ( "iframe" ) ; e . style || ( e . style = { } ) , e . style . display = "none" , document . body . appendChild ( e ) ; var r = e . contentWindow , n = r . eval , i = r . execScript ; ! n && i && ( i . call ( r , "null" ) , n = r . eval ) , forEach ( Object _keys ( t ) , function ( e ) { r [ e ] = t [ e ] } ) , forEach ( globals , function ( e ) { t [ e ] && ( r [ e ] = t [ e ] ) } ) ; var o = Object _keys ( r ) , a = n . call ( r , this . code ) ; return forEach ( Object _keys ( r ) , function ( e ) { ( e in t || indexOf ( o , e ) === - 1 ) && ( t [ e ] = r [ e ] ) } ) , forEach ( globals , function ( e ) { e in t || defineProp ( t , e , r [ e ] ) } ) , document . body . removeChild ( e ) , a } , Script . prototype . runInThisContext = function ( ) { return eval ( this . code ) } , Script . prototype . runInNewContext = function ( t ) { var e = Script . createContext ( t ) , r = this . runInContext ( e ) ; return forEach ( Object _keys ( e ) , function ( r ) { t [ r ] = e [ r ] } ) , r } , forEach ( Object _keys ( Script . prototype ) , function ( t ) { exports [ t ] = Script [ t ] = function ( e ) { var r = Script ( e ) ; return r [ t ] . apply ( r , [ ] . slice . call ( arguments , 1 ) ) } } ) , exports . createScript = function ( t ) { return exports . Script ( t ) } , exports . createContext = Script . createContext = function ( t ) { var e = new Context ; return "object" == typeof t && forEach ( Object _keys ( t ) , function ( r ) { e [ r ] = t [ r ] } ) , e } } , function ( t , e , r ) { "use strict" ; ( function ( e ) { var n = r ( 75 ) , i = r ( 63 ) , o = r ( 115 ) , a = r ( 264 ) , f = r ( 263 ) , s = r ( 266 ) , u = r ( 265 ) , h = r ( 262 ) , c = r ( 116 ) , d = new e ( 0 ) , l = function ( t ) { var e = n . fromUri ( t ) ; return e . validate ( ) } , p = function ( t , r , n ) { if ( "undefined" == typeof n && ( n = d ) , ! e . isBuffer ( n ) ) throw new Error ( "Message must be provided as a Buffer" ) ; var o = i . fromUri ( t ) , a = o . getConditionUri ( ) ; if ( a !== r ) throw new Error ( "Fulfillment does not match condition (expected: " + r + ", actual: " + a + ")" ) ; return o . validate ( n ) } , b = function ( t ) { var e = i . fromUri ( t ) ; return e . getConditionUri ( ) } ; o . registerType ( a ) , o . registerType ( f ) , o . registerType ( s ) , o . registerType ( u ) , o . registerType ( h ) , t . exports = { Condition : n , Fulfillment : i , TypeRegistry : o , PreimageSha256 : a , RsaSha256 : u , PrefixSha256 : f , ThresholdSha256 : s , Ed25519 : h , validateCondition : l , validateFulfillment : p , fulfillmentToCondition : b , base64url : c , fromConditionUri : n . fromUri . bind ( n ) , fromConditionBinary : n . fromBinary . bind ( n ) , fromFulfillmentUri : i . fromUri . bind ( i ) , fromFulfillmentBinary : i . fromBinary . bind ( i ) } } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e , r ) { "use strict" ; ( function ( t ) { function e ( t , e , r ) { t [ e ] || Object [ n ] ( t , e , { writable : ! 0 , configurable : ! 0 , value : r } ) } if ( r ( 461 ) , r ( 268 ) , r ( 269 ) , t . _babelPolyfill ) throw new Error ( "only one instance of babel-polyfill is allowed" ) ; t . _babelPolyfill = ! 0 ; var n = "defineProperty" ; e ( String . prototype , "padLeft" , "" . padStart ) , e ( String . prototype , "padRight" , "" . padEnd ) , "pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill" . split ( "," ) . forEach ( function ( t ) { [ ] [ t ] && e ( Array , t , Function . call . bind ( [ ] [ t ] ) ) } ) } ) . call ( e , r ( 39 ) ) } , function ( t , e , r ) { var n = r ( 111 ) , i = r ( 112 ) , o = r ( 255 ) , a = r ( 256 ) ; t . exports = { Reader : o , Writer : a } ; for ( var f in i ) i . hasOwnProperty ( f ) && ( t . exports [ f ] = i [ f ] ) ; for ( var s in n ) n . hasOwnProperty ( s ) && ( t . exports [ s ] = n [ s ] ) } , function ( t , e , r ) { ( function ( e ) { function n ( t ) { if ( ! t || ! e . isBuffer ( t ) ) throw new TypeError ( "data must be a node Buffer" ) ; this . _buf = t , this . _size = t . length , this . _len = 0 , this . _offset = 0 } var i = r ( 202 ) , o = r ( 112 ) , a = r ( 111 ) , f = a . newInvalidAsn1Error ; Object . defineProperty ( n . prototype , "length" , { enumerable : ! 0 , get : function ( ) { return this . _len } } ) , Object . defineProperty ( n . prototype , "offset" , { enumerable : ! 0 , get : function ( ) { return this . _offset } } ) , Object . defineProperty ( n . prototype , "remain" , { get : function ( ) { return this . _size - this .
value : function ( t ) { var e = t . type === m ? t . body . getCondition ( ) . getMaxFulfillmentLength ( ) : t . body . getMaxFulfillmentLength ( ) , r = new c ; return r . writeUInt16 ( ) , r . writeVarOctetString ( { length : e } ) , r . getSize ( ) } } , { key : "calculateWorstCaseLength" , value : function ( t , e , r ) { if ( r = r || 0 , t <= 0 ) return 0 ; if ( r < e . length ) { var n = e [ r ] ; return Math . max ( n . size + this . calculateWorstCaseLength ( t - n . weight , e , r + 1 ) , this . calculateWorstCaseLength ( t , e , r + 1 ) ) } return - ( 1 / 0 ) } } , { key : "calculateSmallestValidFulfillmentSet" , value : function ( t , e , r ) { if ( r = r || { index : 0 , size : 0 , set : [ ] } , t <= 0 ) return { size : r . size , set : r . set } ; if ( r . index < e . length ) { var n = e [ r . index ] , i = this . calculateSmallestValidFulfillmentSet ( t - n . weight , e , { size : r . size + n . size , index : r . index + 1 , set : r . set . concat ( n . index ) } ) , o = this . calculateSmallestValidFulfillmentSet ( t , e , { size : r . size + n . omitSize , index : r . index + 1 , set : r . set } ) ; return i . size < o . size ? i : o } return { size : 1 / 0 } } } , { key : "sortBuffers" , value : function ( t ) { return t . slice ( ) . sort ( function ( t , r ) { return t . length !== r . length ? t . length - r . length : e . compare ( t , r ) } ) } } ] ) , r } ( h ) ; g . TYPE _ID = 2 , g . FEATURE _BITMASK = 9 , g . prototype . addSubconditionUri = g . prototype . addSubcondition , g . prototype . addSubfulfillmentUri = g . prototype . addSubfulfillment , t . exports = g } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e , r ) { "use strict" ; ( function ( e ) { function r ( t , r ) { if ( ! e . isBuffer ( t ) || ! e . isBuffer ( r ) ) throw new Error ( "Arguments must be buffers" ) ; if ( t . length !== r . length ) throw new Error ( "Buffers must be the same length" ) ; for ( var n = new e ( t . length ) , i = 0 ; i < t . length ; i ++ ) n [ i ] = t [ i ] ^ r [ i ] ; return n } t . exports = r } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e , r ) { ( function ( e , r ) { ! function ( e ) { "use strict" ; function n ( t , e , r , n ) { var i = Object . create ( ( e || o ) . prototype ) , a = new p ( n || [ ] ) ; return i . _invoke = c ( t , r , a ) , i } function i ( t , e , r ) { try { return { type : "normal" , arg : t . call ( e , r ) } } catch ( t ) { return { type : "throw" , arg : t } } } function o ( ) { } function a ( ) { } function f ( ) { } function s ( t ) { [ "next" , "throw" , "return" ] . forEach ( function ( e ) { t [ e ] = function ( t ) { return this . _invoke ( e , t ) } } ) } function u ( t ) { this . arg = t } function h ( t ) { function e ( r , n , o , a ) { var f = i ( t [ r ] , t , n ) ; if ( "throw" !== f . type ) { var s = f . arg , h = s . value ; return h instanceof u ? Promise . resolve ( h . arg ) . then ( function ( t ) { e ( "next" , t , o , a ) } , function ( t ) { e ( "throw" , t , o , a ) } ) : Promise . resolve ( h ) . then ( function ( t ) { s . value = t , o ( s ) } , a ) } a ( f . arg ) } function n ( t , r ) { function n ( ) { return new Promise ( function ( n , i ) { e ( t , r , n , i ) } ) } return o = o ? o . then ( n , n ) : n ( ) } "object" == typeof r && r . domain && ( e = r . domain . bind ( e ) ) ; var o ; this . _invoke = n } function c ( t , e , r ) { var n = E ; return function ( o , a ) { if ( n === k ) throw new Error ( "Generator is already running" ) ; if ( n === x ) { if ( "throw" === o ) throw a ; return v ( ) } for ( ; ; ) { var f = r . delegate ; if ( f ) { if ( "return" === o || "throw" === o && f . iterator [ o ] === y ) { r . delegate = null ; var s = f . iterator . return ; if ( s ) { var u = i ( s , f . iterator , a ) ; if ( "throw" === u . type ) { o = "throw" , a = u . arg ; continue } } if ( "return" === o ) continue } var u = i ( f . iterator [ o ] , f . iterator , a ) ; if ( "throw" === u . type ) { r . delegate = null , o = "throw" , a = u . arg ; continue } o = "next" , a = y ; var h = u . arg ; if ( ! h . done ) return n = A , h ; r [ f . resultName ] = h . value , r . next = f . nextLoc , r . delegate = null } if ( "next" === o ) r . sent = r . _sent = a ; else if ( "throw" === o ) { if ( n === E ) throw n = x , a ; r . dispatchException ( a ) && ( o = "next" , a = y ) } else "return" === o && r . abrupt ( "return" , a ) ; n = k ; var u = i ( t , e , r ) ; if ( "normal" === u . type ) { n = r . done ? x : A ; var h = { value : u . arg , done : r . done } ; if ( u . arg !== I ) return h ; r . delegate && "next" === o && ( a = y ) } else "throw" === u . type && ( n = x , o = "throw" , a = u . arg ) } } } function d ( t ) { var e = { tryLoc : t [ 0 ] } ; 1 in t && ( e . catchLoc = t [ 1 ] ) , 2 in t && ( e . finallyLoc = t [ 2 ] , e . afterLoc = t [ 3 ] ) , this . tryEntries . push ( e ) } function l ( t ) { var e = t . completion || { } ; e . type = "normal" , delete e . arg , t . completion = e } function p ( t ) { this . tryEntries = [ { tryLoc : "root" } ] , t . forEach ( d , this ) , this . reset ( ! 0 ) } function b ( t ) { if ( t ) { var e = t [ w ] ; if ( e ) return e . call ( t ) ; if ( "function" == typeof t . next ) return t ; if ( ! isNaN ( t . length ) ) { var r = - 1 , n = function e ( ) { for ( ; ++ r < t . length ; ) if ( m . call ( t , r ) ) return e . value = t [ r ] , e . done = ! 1 , e ; return e . value = y , e . done = ! 0 , e } ; return n . next = n } } return { next : v } } function v ( ) { return { value : y , done : ! 0 } } var y , m = Object . prototype . hasOwnProperty , g = "function" == typeof Symbol ? Symbol : { } , w = g . iterator || "@@iterator" , _ = g . toStringTag || "@@toStringTag" , M = "object" == typeof t , S = e . regeneratorRuntime ; if ( S ) return void ( M && ( t . expo
r ( 80 ) ( "replace" , 2 , function ( t , e , r ) { return [ function ( n , i ) { "use strict" ; var o = t ( this ) , a = void 0 == n ? void 0 : n [ e ] ; return void 0 !== a ? a . call ( n , o , i ) : r . call ( String ( o ) , n , i ) } , r ] } ) } , function ( t , e , r ) { r ( 80 ) ( "search" , 1 , function ( t , e , r ) { return [ function ( r ) { "use strict" ; var n = t ( this ) , i = void 0 == r ? void 0 : r [ e ] ; return void 0 !== i ? i . call ( r , n ) : new RegExp ( r ) [ e ] ( String ( n ) ) } , r ] } ) } , function ( t , e , r ) { r ( 80 ) ( "split" , 2 , function ( t , e , n ) { "use strict" ; var i = r ( 83 ) , o = n , a = [ ] . push , f = "split" , s = "length" , u = "lastIndex" ; if ( "c" == "abbc" [ f ] ( /(b)*/ ) [ 1 ] || 4 != "test" [ f ] ( /(?:)/ , - 1 ) [ s ] || 2 != "ab" [ f ] ( /(?:ab)*/ ) [ s ] || 4 != "." [ f ] ( /(.?)(.?)/ ) [ s ] || "." [ f ] ( /()()/ ) [ s ] > 1 || "" [ f ] ( /.?/ ) [ s ] ) { var h = void 0 === /()??/ . exec ( "" ) [ 1 ] ; n = function ( t , e ) { var r = String ( this ) ; if ( void 0 === t && 0 === e ) return [ ] ; if ( ! i ( t ) ) return o . call ( r , t , e ) ; var n , f , c , d , l , p = [ ] , b = ( t . ignoreCase ? "i" : "" ) + ( t . multiline ? "m" : "" ) + ( t . unicode ? "u" : "" ) + ( t . sticky ? "y" : "" ) , v = 0 , y = void 0 === e ? 4294967295 : e >>> 0 , m = new RegExp ( t . source , b + "g" ) ; for ( h || ( n = new RegExp ( "^" + m . source + "$(?!\\s)" , b ) ) ; ( f = m . exec ( r ) ) && ( c = f . index + f [ 0 ] [ s ] , ! ( c > v && ( p . push ( r . slice ( v , f . index ) ) , ! h && f [ s ] > 1 && f [ 0 ] . replace ( n , function ( ) { for ( l = 1 ; l < arguments [ s ] - 2 ; l ++ ) void 0 === arguments [ l ] && ( f [ l ] = void 0 ) } ) , f [ s ] > 1 && f . index < r [ s ] && a . apply ( p , f . slice ( 1 ) ) , d = f [ 0 ] [ s ] , v = c , p [ s ] >= y ) ) ) ; ) m [ u ] === f . index && m [ u ] ++ ; return v === r [ s ] ? ! d && m . test ( "" ) || p . push ( "" ) : p . push ( r . slice ( v ) ) , p [ s ] > y ? p . slice ( 0 , y ) : p } } else "0" [ f ] ( void 0 , 0 ) [ s ] && ( n = function ( t , e ) { return void 0 === t && 0 === e ? [ ] : o . call ( this , t , e ) } ) ; return [ function ( r , i ) { var o = t ( this ) , a = void 0 == r ? void 0 : r [ e ] ; return void 0 !== a ? a . call ( r , o , i ) : n . call ( String ( o ) , r , i ) } , n ] } ) } , function ( t , e , r ) { "use strict" ; r ( 191 ) ; var n = r ( 3 ) , i = r ( 81 ) , o = r ( 8 ) , a = "toString" , f = /./ [ a ] , s = function ( t ) { r ( 15 ) ( RegExp . prototype , a , t , ! 0 ) } ; r ( 5 ) ( function ( ) { return "/a/b" != f . call ( { source : "a" , flags : "b" } ) } ) ? s ( function ( ) { var t = n ( this ) ; return "/" . concat ( t . source , "/" , "flags" in t ? t . flags : ! o && t instanceof RegExp ? i . call ( t ) : void 0 ) } ) : f . name != a && s ( function ( ) { return f . call ( this ) } ) } , function ( t , e , r ) { "use strict" ; r ( 16 ) ( "anchor" , function ( t ) { return function ( e ) { return t ( this , "a" , "name" , e ) } } ) } , function ( t , e , r ) { "use strict" ; r ( 16 ) ( "big" , function ( t ) { return function ( ) { return t ( this , "big" , "" , "" ) } } ) } , function ( t , e , r ) { "use strict" ; r ( 16 ) ( "blink" , function ( t ) { return function ( ) { return t ( this , "blink" , "" , "" ) } } ) } , function ( t , e , r ) { "use strict" ; r ( 16 ) ( "bold" , function ( t ) { return function ( ) { return t ( this , "b" , "" , "" ) } } ) } , function ( t , e , r ) { "use strict" ; var n = r ( 0 ) , i = r ( 135 ) ( ! 1 ) ; n ( n . P , "String" , { codePointAt : function ( t ) { return i ( this , t ) } } ) } , function ( t , e , r ) { "use strict" ; var n = r ( 0 ) , i = r ( 10 ) , o = r ( 136 ) , a = "endsWith" , f = "" [ a ] ; n ( n . P + n . F * r ( 122 ) ( a ) , "String" , { endsWith : function ( t ) { var e = o ( this , t , a ) , r = arguments . length > 1 ? arguments [ 1 ] : void 0 , n = i ( e . length ) , s = void 0 === r ? n : Math . min ( i ( r ) , n ) , u = String ( t ) ; return f ? f . call ( e , u , s ) : e . slice ( s - u . length , s ) === u } } ) } , function ( t , e , r ) { "use strict" ; r ( 16 ) ( "fixed" , function ( t ) { return function ( ) { return t ( this , "tt" , "" , "" ) } } ) } , function ( t , e , r ) { "use strict" ; r ( 16 ) ( "fontcolor" , function ( t ) { return function ( e ) { return t ( this , "font" , "color" , e ) } } ) } , function ( t , e , r ) { "use strict" ; r ( 16 ) ( "fontsize" , function ( t ) { return function ( e ) { return t ( this , "font" , "size" , e ) } } ) } , function ( t , e , r ) { var n = r ( 0 ) , i = r ( 47 ) , o = String . fromCharCode , a = String . fromCodePoint ; n ( n . S + n . F * ( ! ! a && 1 != a . length ) , "String" , { fromCodePoint : function ( t ) { for ( var e , r = [ ] , n = arguments . length , a = 0 ; n > a ; ) { if ( e = + arguments [ a ++ ] , i ( e , 1114111 ) !== e ) throw RangeError ( e + " is not a valid code point" ) ; r . push ( e < 65536 ? o ( e ) : o ( ( ( e -= 65536 ) >> 10 ) + 55296 , e % 1024 + 56320 ) ) } return r . join ( "" ) } } ) } , function ( t , e , r ) { "use strict" ; var n = r ( 0 ) , i = r ( 136 ) , o = "includes" ; n ( n . P + n . F * r ( 122 ) ( o ) , "String" , { includes : function ( t ) { return ! ! ~ i ( this , t , o ) . indexOf ( t , arguments . length > 1 ? arguments [ 1 ] : void 0 ) } } ) } , function ( t , e , r ) { "use strict" ; r ( 16 ) ( "italics" , function ( t ) { return function ( ) { return t ( this , "i" , "" , "" ) } } ) } , function ( t , e , r ) { "use strict" ; var n = r ( 135 ) ( ! 0 ) ; r ( 128 ) ( String , "String" , function ( t ) { this . _t = String ( t ) , this . _i = 0 } , function ( ) { var t , e = this . _t , r = this . _i ; return r >= e . length ? { value : void 0 , done : ! 0 } : ( t = n ( e , r ) , this . _i += t . length , { value : t , done : ! 1 } ) } ) } , function ( t , e , r ) { "use strict" ; r ( 16 ) ( "link" , function ( t ) { return function ( e ) { return t ( this , "a" , "href" , e ) } } ) } , function ( t , e , r ) { var n = r ( 0 ) , i = r ( 17 ) , o = r ( 10 ) ; n ( n . S , "String" ,
} , modp17 : { gen : "02" , prime : "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff" } , modp18 : { gen : "02" , prime : "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff" } } } , function ( t , e ) { t . exports = { "2.16.840.1.101.3.4.1.1" : "aes-128-ecb" , "2.16.840.1.101.3.4.1.2" : "aes-128-cbc" , "2.16.840.1.101.3.4.1.3" : "aes-128-ofb" , "2.16.840.1.101.3.4.1.4" : "aes-128-cfb" , "2.16.840.1.101.3.4.1.21" : "aes-192-ecb" , "2.16.840.1.101.3.4.1.22" : "aes-192-cbc" , "2.16.840.1.101.3.4.1.23" : "aes-192-ofb" , "2.16.840.1.101.3.4.1.24" : "aes-192-cfb" , "2.16.840.1.101.3.4.1.41" : "aes-256-ecb" , "2.16.840.1.101.3.4.1.42" : "aes-256-cbc" , "2.16.840.1.101.3.4.1.43" : " aes - 2
m ( r [ 0 ] , ut ) , m ( r [ 1 ] , ht ) , m ( r [ 2 ] , ot ) , x ( r [ 3 ] , ut , ht ) , F ( t , r , e ) } function G ( t , e , r ) { var n , i = new Uint8Array ( 64 ) , o = [ tt ( ) , tt ( ) , tt ( ) , tt ( ) ] ; for ( r || et ( e , 32 ) , U ( i , e , 32 ) , i [ 0 ] &= 248 , i [ 31 ] &= 127 , i [ 31 ] |= 64 , K ( o , i ) , q ( t , o ) , n = 0 ; n < 32 ; n ++ ) e [ n + 32 ] = t [ n ] ; return 0 } function V ( t , e ) { var r , n , i , o ; for ( n = 63 ; n >= 32 ; -- n ) { for ( r = 0 , i = n - 32 , o = n - 12 ; i < o ; ++ i ) e [ i ] += r - 16 * e [ n ] * yt [ i - ( n - 32 ) ] , r = e [ i ] + 128 >> 8 , e [ i ] -= 256 * r ; e [ i ] += r , e [ n ] = 0 } for ( r = 0 , i = 0 ; i < 32 ; i ++ ) e [ i ] += r - ( e [ 31 ] >> 4 ) * yt [ i ] , r = e [ i ] >> 8 , e [ i ] &= 255 ; for ( i = 0 ; i < 32 ; i ++ ) e [ i ] -= r * yt [ i ] ; for ( n = 0 ; n < 32 ; n ++ ) e [ n + 1 ] += e [ n ] >> 8 , t [ n ] = 255 & e [ n ] } function H ( t ) { var e , r = new Float64Array ( 64 ) ; for ( e = 0 ; e < 64 ; e ++ ) r [ e ] = t [ e ] ; for ( e = 0 ; e < 64 ; e ++ ) t [ e ] = 0 ; V ( t , r ) } function X ( t , e , r , n ) { var i , o , a = new Uint8Array ( 64 ) , f = new Uint8Array ( 64 ) , s = new Uint8Array ( 64 ) , u = new Float64Array ( 64 ) , h = [ tt ( ) , tt ( ) , tt ( ) , tt ( ) ] ; U ( a , n , 32 ) , a [ 0 ] &= 248 , a [ 31 ] &= 127 , a [ 31 ] |= 64 ; var c = r + 64 ; for ( i = 0 ; i < r ; i ++ ) t [ 64 + i ] = e [ i ] ; for ( i = 0 ; i < 32 ; i ++ ) t [ 32 + i ] = a [ 32 + i ] ; for ( U ( s , t . subarray ( 32 ) , r + 32 ) , H ( s ) , K ( h , s ) , q ( t , h ) , i = 32 ; i < 64 ; i ++ ) t [ i ] = n [ i ] ; for ( U ( f , t , r + 64 ) , H ( f ) , i = 0 ; i < 64 ; i ++ ) u [ i ] = 0 ; for ( i = 0 ; i < 32 ; i ++ ) u [ i ] = s [ i ] ; for ( i = 0 ; i < 32 ; i ++ ) for ( o = 0 ; o < 32 ; o ++ ) u [ i + o ] += f [ i ] * a [ o ] ; return V ( t . subarray ( 32 ) , u ) , c } function Y ( t , e ) { var r = tt ( ) , n = tt ( ) , i = tt ( ) , o = tt ( ) , a = tt ( ) , f = tt ( ) , s = tt ( ) ; return m ( t [ 2 ] , ot ) , E ( t [ 1 ] , e ) , I ( i , t [ 1 ] ) , x ( o , i , ft ) , k ( i , i , t [ 2 ] ) , A ( o , t [ 2 ] , o ) , I ( a , o ) , I ( f , a ) , x ( s , f , a ) , x ( r , s , i ) , x ( r , r , o ) , O ( r , r ) , x ( r , r , i ) , x ( r , r , o ) , x ( r , r , o ) , x ( t [ 0 ] , r , o ) , I ( n , t [ 0 ] ) , x ( n , n , o ) , M ( n , i ) && x ( t [ 0 ] , t [ 0 ] , ct ) , I ( n , t [ 0 ] ) , x ( n , n , o ) , M ( n , i ) ? - 1 : ( S ( t [ 0 ] ) === e [ 31 ] >> 7 && k ( t [ 0 ] , it , t [ 0 ] ) , x ( t [ 3 ] , t [ 0 ] , t [ 1 ] ) , 0 ) } function W ( t , e , r , n ) { var i , a , f = new Uint8Array ( 32 ) , s = new Uint8Array ( 64 ) , u = [ tt ( ) , tt ( ) , tt ( ) , tt ( ) ] , h = [ tt ( ) , tt ( ) , tt ( ) , tt ( ) ] ; if ( a = - 1 , r < 64 ) return - 1 ; if ( Y ( h , n ) ) return - 1 ; for ( i = 0 ; i < r ; i ++ ) t [ i ] = e [ i ] ; for ( i = 0 ; i < 32 ; i ++ ) t [ i + 32 ] = n [ i ] ; if ( U ( s , t , r ) , H ( s ) , F ( u , h , s ) , K ( h , e . subarray ( 32 ) ) , z ( u , h ) , q ( f , u ) , r -= 64 , o ( e , 0 , f , 0 ) ) { for ( i = 0 ; i < r ; i ++ ) t [ i ] = 0 ; return - 1 } for ( i = 0 ; i < r ; i ++ ) t [ i ] = e [ i + 64 ] ; return a = r } function Z ( t , e ) { if ( t . length !== mt ) throw new Error ( "bad key size" ) ; if ( e . length !== gt ) throw new Error ( "bad nonce size" ) } function J ( t , e ) { if ( t . length !== Et ) throw new Error ( "bad public key size" ) ; if ( e . length !== At ) throw new Error ( "bad secret key size" ) } function $ ( ) { var t , e ; for ( e = 0 ; e < arguments . length ; e ++ ) if ( "[object Uint8Array]" !== ( t = Object . prototype . toString . call ( arguments [ e ] ) ) ) throw new TypeError ( "unexpected type " + t + ", use Uint8Array" ) } function Q ( t ) { for ( var e = 0 ; e < t . length ; e ++ ) t [ e ] = 0 } var tt = function ( t ) { var e , r = new Float64Array ( 16 ) ; if ( t ) for ( e = 0 ; e < t . length ; e ++ ) r [ e ] = t [ e ] ; return r } , et = function ( ) { throw new Error ( "no PRNG" ) } , rt = new Uint8Array ( 16 ) , nt = new Uint8Array ( 32 ) ; nt [ 0 ] = 9 ; var it = tt ( ) , ot = tt ( [ 1 ] ) , at = tt ( [ 56129 , 1 ] ) , ft = tt ( [ 30883 , 4953 , 19914 , 30187 , 55467 , 16705 , 2637 , 112 , 59544 , 30585 , 16505 , 36039 , 65139 , 11119 , 27886 , 20995 ] ) , st = tt ( [ 61785 , 9906 , 39828 , 60374 , 45398 , 33411 , 5274 , 224 , 53552 , 61171 , 33010 , 6542 , 64743 , 22239 , 55772 , 9222 ] ) , ut = tt ( [ 54554 , 36645 , 11616 , 51542 , 42930 , 38181 , 51040 , 26924 , 56412 , 64982 , 57905 , 49316 , 21502 , 52590 , 14035 , 8553 ] ) , ht = tt ( [ 26200 , 26214 , 26214 , 26214 , 26214 , 26214 , 26214 , 26214 , 26214 , 26214 , 26214 , 26214 , 26214 , 26214 , 26214 , 26214 ] ) , ct = tt ( [ 41136 , 18958 , 6951 , 50414 , 58488 , 44335 , 6150 , 12099 , 55207 , 15867 , 153 , 11085 , 57099 , 20417 , 9344 , 11139 ] ) , dt = new Uint8Array ( [ 101 , 120 , 112 , 97 , 110 , 100 , 32 , 51 , 50 , 45 , 98 , 121 , 116 , 101 , 32 , 107 ] ) , lt = function ( t ) { this . buffer = new Uint8Array ( 16 ) , this . r = new Uint16Array ( 10 ) , this . h = new Uint16Array ( 10 ) , this . pad = new Uint16Array ( 8 ) , this . leftover = 0 , this . fin = 0 ; var e , r , n , i , o , a , f , s ; e = 255 & t [ 0 ] | ( 255 & t [ 1 ] ) << 8 , this . r [ 0 ] = 8191 & e , r = 255 & t [ 2 ] | ( 255 & t [ 3 ] ) << 8 , this . r [ 1 ] = 8191 & ( e >>> 13 | r << 3 ) , n = 255 & t [ 4 ] | ( 255 & t [ 5 ] ) << 8 , this . r [ 2 ] = 7939 & ( r >>> 10 | n << 6 ) , i = 255 & t [ 6 ] | ( 255 & t [ 7 ] ) << 8 , this . r [ 3 ] = 8191 & ( n >>> 7 | i << 9 ) , o = 255 & t [ 8 ] | ( 255 & t [ 9 ] ) << 8 , this . r [ 4 ] = 255 & ( i >>> 4 | o << 12 ) , this . r [ 5 ] = o >>> 1 & 8190 , a = 255 & t [ 10 ] | ( 255 & t [ 11 ] ) << 8 , this . r [ 6 ] = 8191 & ( o >>> 14 | a << 2 ) , f = 255 & t [ 12 ] | ( 255 & t [ 13 ] ) << 8 , this . r [ 7 ] = 8065 & ( a >>> 11 | f << 5 ) , s = 255 & t [ 14 ] | ( 255 & t [ 15 ] ) << 8 , this . r [ 8 ] = 8191 & ( f >>> 8 | s << 8 ) , this . r [ 9 ] = s >>> 5 & 127 , this . pad [ 0 ] = 255 & t [ 16 ] | ( 255 & t [ 17 ] ) << 8 , this . pad [ 1 ] = 255 & t [ 18 ] | ( 255 & t [ 19 ] ) << 8 , this . pad [ 2 ] = 255 & t [ 20 ] | ( 255 & t [ 21 ] ) << 8 , this . pad [ 3 ] = 255 & t [ 22 ] | ( 255 & t [ 23 ] ) << 8 , this . pad [ 4 ] = 255 & t [ 24 ] | ( 255 & t [ 25 ] ) << 8 , this . pad [ 5 ] = 255 & t [ 26 ] | ( 255 & t [ 27 ] ) << 8 , this . pad [ 6 ] = 255 & t [ 28 ] | ( 255 & t [ 29 ] ) << 8 , this . pad [ 7 ] = 255 & t [ 30 ] | ( 255 & t [ 31 ] ) << 8 } ; lt . prototype . blocks = function ( t , e , r ) { for ( v
for ( var f = 0 ; f <= 24 ; f += 8 ) i <<= 1 , i |= e >> f + a & 1 ; for ( var f = 0 ; f <= 24 ; f += 8 ) i <<= 1 , i |= t >> f + a & 1 } for ( var f = 0 ; f <= 24 ; f += 8 ) i <<= 1 , i |= e >> f + a & 1 ; for ( var a = 1 ; a <= 3 ; a ++ ) { for ( var f = 0 ; f <= 24 ; f += 8 ) o <<= 1 , o |= e >> f + a & 1 ; for ( var f = 0 ; f <= 24 ; f += 8 ) o <<= 1 , o |= t >> f + a & 1 } for ( var f = 0 ; f <= 24 ; f += 8 ) o <<= 1 , o |= t >> f + a & 1 ; r [ n + 0 ] = i >>> 0 , r [ n + 1 ] = o >>> 0 } , e . r28shl = function ( t , e ) { return t << e & 268435455 | t >>> 28 - e } ; var r = [ 14 , 11 , 17 , 4 , 27 , 23 , 25 , 0 , 13 , 22 , 7 , 18 , 5 , 9 , 16 , 24 , 2 , 20 , 12 , 21 , 1 , 8 , 15 , 26 , 15 , 4 , 25 , 19 , 9 , 1 , 26 , 16 , 5 , 11 , 23 , 8 , 12 , 7 , 17 , 0 , 22 , 3 , 10 , 14 , 6 , 20 , 27 , 24 ] ; e . pc2 = function ( t , e , n , i ) { for ( var o = 0 , a = 0 , f = r . length >>> 1 , s = 0 ; s < f ; s ++ ) o <<= 1 , o |= t >>> r [ s ] & 1 ; for ( var s = f ; s < r . length ; s ++ ) a <<= 1 , a |= e >>> r [ s ] & 1 ; n [ i + 0 ] = o >>> 0 , n [ i + 1 ] = a >>> 0 } , e . expand = function ( t , e , r ) { var n = 0 , i = 0 ; n = ( 1 & t ) << 5 | t >>> 27 ; for ( var o = 23 ; o >= 15 ; o -= 4 ) n <<= 6 , n |= t >>> o & 63 ; for ( var o = 11 ; o >= 3 ; o -= 4 ) i |= t >>> o & 63 , i <<= 6 ; i |= ( 31 & t ) << 1 | t >>> 31 , e [ r + 0 ] = n >>> 0 , e [ r + 1 ] = i >>> 0 } ; var n = [ 14 , 0 , 4 , 15 , 13 , 7 , 1 , 4 , 2 , 14 , 15 , 2 , 11 , 13 , 8 , 1 , 3 , 10 , 10 , 6 , 6 , 12 , 12 , 11 , 5 , 9 , 9 , 5 , 0 , 3 , 7 , 8 , 4 , 15 , 1 , 12 , 14 , 8 , 8 , 2 , 13 , 4 , 6 , 9 , 2 , 1 , 11 , 7 , 15 , 5 , 12 , 11 , 9 , 3 , 7 , 14 , 3 , 10 , 10 , 0 , 5 , 6 , 0 , 13 , 15 , 3 , 1 , 13 , 8 , 4 , 14 , 7 , 6 , 15 , 11 , 2 , 3 , 8 , 4 , 14 , 9 , 12 , 7 , 0 , 2 , 1 , 13 , 10 , 12 , 6 , 0 , 9 , 5 , 11 , 10 , 5 , 0 , 13 , 14 , 8 , 7 , 10 , 11 , 1 , 10 , 3 , 4 , 15 , 13 , 4 , 1 , 2 , 5 , 11 , 8 , 6 , 12 , 7 , 6 , 12 , 9 , 0 , 3 , 5 , 2 , 14 , 15 , 9 , 10 , 13 , 0 , 7 , 9 , 0 , 14 , 9 , 6 , 3 , 3 , 4 , 15 , 6 , 5 , 10 , 1 , 2 , 13 , 8 , 12 , 5 , 7 , 14 , 11 , 12 , 4 , 11 , 2 , 15 , 8 , 1 , 13 , 1 , 6 , 10 , 4 , 13 , 9 , 0 , 8 , 6 , 15 , 9 , 3 , 8 , 0 , 7 , 11 , 4 , 1 , 15 , 2 , 14 , 12 , 3 , 5 , 11 , 10 , 5 , 14 , 2 , 7 , 12 , 7 , 13 , 13 , 8 , 14 , 11 , 3 , 5 , 0 , 6 , 6 , 15 , 9 , 0 , 10 , 3 , 1 , 4 , 2 , 7 , 8 , 2 , 5 , 12 , 11 , 1 , 12 , 10 , 4 , 14 , 15 , 9 , 10 , 3 , 6 , 15 , 9 , 0 , 0 , 6 , 12 , 10 , 11 , 1 , 7 , 13 , 13 , 8 , 15 , 9 , 1 , 4 , 3 , 5 , 14 , 11 , 5 , 12 , 2 , 7 , 8 , 2 , 4 , 14 , 2 , 14 , 12 , 11 , 4 , 2 , 1 , 12 , 7 , 4 , 10 , 7 , 11 , 13 , 6 , 1 , 8 , 5 , 5 , 0 , 3 , 15 , 15 , 10 , 13 , 3 , 0 , 9 , 14 , 8 , 9 , 6 , 4 , 11 , 2 , 8 , 1 , 12 , 11 , 7 , 10 , 1 , 13 , 14 , 7 , 2 , 8 , 13 , 15 , 6 , 9 , 15 , 12 , 0 , 5 , 9 , 6 , 10 , 3 , 4 , 0 , 5 , 14 , 3 , 12 , 10 , 1 , 15 , 10 , 4 , 15 , 2 , 9 , 7 , 2 , 12 , 6 , 9 , 8 , 5 , 0 , 6 , 13 , 1 , 3 , 13 , 4 , 14 , 14 , 0 , 7 , 11 , 5 , 3 , 11 , 8 , 9 , 4 , 14 , 3 , 15 , 2 , 5 , 12 , 2 , 9 , 8 , 5 , 12 , 15 , 3 , 10 , 7 , 11 , 0 , 14 , 4 , 1 , 10 , 7 , 1 , 6 , 13 , 0 , 11 , 8 , 6 , 13 , 4 , 13 , 11 , 0 , 2 , 11 , 14 , 7 , 15 , 4 , 0 , 9 , 8 , 1 , 13 , 10 , 3 , 14 , 12 , 3 , 9 , 5 , 7 , 12 , 5 , 2 , 10 , 15 , 6 , 8 , 1 , 6 , 1 , 6 , 4 , 11 , 11 , 13 , 13 , 8 , 12 , 1 , 3 , 4 , 7 , 10 , 14 , 7 , 10 , 9 , 15 , 5 , 6 , 0 , 8 , 15 , 0 , 14 , 5 , 2 , 9 , 3 , 2 , 12 , 13 , 1 , 2 , 15 , 8 , 13 , 4 , 8 , 6 , 10 , 15 , 3 , 11 , 7 , 1 , 4 , 10 , 12 , 9 , 5 , 3 , 6 , 14 , 11 , 5 , 0 , 0 , 14 , 12 , 9 , 7 , 2 , 7 , 2 , 11 , 1 , 4 , 14 , 1 , 7 , 9 , 4 , 12 , 10 , 14 , 8 , 2 , 13 , 0 , 15 , 6 , 12 , 10 , 9 , 13 , 0 , 15 , 3 , 3 , 5 , 5 , 6 , 8 , 11 ] ; e . substitute = function ( t , e ) { for ( var r = 0 , i = 0 ; i < 4 ; i ++ ) { var o = t >>> 18 - 6 * i & 63 , a = n [ 64 * i + o ] ; r <<= 4 , r |= a } for ( var i = 0 ; i < 4 ; i ++ ) { var o = e >>> 18 - 6 * i & 63 , a = n [ 256 + 64 * i + o ] ; r <<= 4 , r |= a } return r >>> 0 } ; var i = [ 16 , 25 , 12 , 11 , 3 , 20 , 4 , 15 , 31 , 17 , 9 , 6 , 27 , 14 , 1 , 22 , 30 , 24 , 8 , 18 , 0 , 5 , 29 , 23 , 13 , 19 , 2 , 26 , 10 , 21 , 28 , 7 ] ; e . permute = function ( t ) { for ( var e = 0 , r = 0 ; r < i . length ; r ++ ) e <<= 1 , e |= t >>> i [ r ] & 1 ; return e >>> 0 } , e . padSplit = function ( t , e , r ) { for ( var n = t . toString ( 2 ) ; n . length < e ; ) n = "0" + n ; for ( var i = [ ] , o = 0 ; o < e ; o += r ) i . push ( n . slice ( o , o + r ) ) ; return i . join ( " " ) } } , function ( t , e , r ) { ( function ( e ) { function n ( t ) { c . Writable . call ( this ) ; var e = l [ t ] ; if ( ! e ) throw new Error ( "Unknown message digest" ) ; this . _hashType = e . hash , this . _hash = s ( e . hash ) , this . _tag = e . id , this . _signType = e . sign } function i ( t ) { c . Writable . call ( this ) ; var e = l [ t ] ; if ( ! e ) throw new Error ( "Unknown message digest" ) ; this . _hash = s ( e . hash ) , this . _tag = e . id , this . _signType = e . sign } function o ( t ) { return new n ( t ) } function a ( t ) { return new i ( t ) } var f = r ( 211 ) , s = r ( 59 ) , u = r ( 2 ) , h = r ( 542 ) , c = r ( 31 ) , d = r ( 543 ) , l = { } ; Object . keys ( f ) . forEach ( function ( t ) { l [ t ] = l [ t . toLowerCase ( ) ] = f [ t ] } ) , u ( n , c . Writable ) , n . prototype . _write = function ( t , e , r ) { this . _hash . update ( t ) , r ( ) } , n . prototype . update = function ( t , r ) { return "string" == typeof t && ( t = new e ( t , r ) ) , this . _hash . update ( t ) , this } , n . prototype . sign = function ( t , r ) { this . end ( ) ; var n = this . _hash . digest ( ) , i = h ( e . concat ( [ this . _tag , n ] ) , t , this . _hashType , this . _signType ) ; return r ? i . toString ( r ) : i } , u ( i , c . Writable ) , i . prototype . _write = function ( t , e , r ) { this . _hash . update ( t ) , r ( ) } , i . prototype . update = function ( t , r ) { return "string" == typeof t && ( t = new e ( t , r ) ) , this . _hash . update ( t ) , this } , i . prototype . verify = function ( t , r , n ) { "string" == typeof r && ( r = new e ( r , n ) ) , this . end ( ) ; var i = this . _hash . digest ( ) ; return d ( r , e . concat ( [ this . _tag , i ] ) , t , this . _signType ) } , t . exports = { Sign : o , Verify : a , createSign : o , createVerify : a } } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e , r ) { ( function ( e ) { function n ( t ) { var e = o ( t ) , r = e . toRed ( a . mont ( t . modulus ) ) . redPow ( new a ( t . publicExponent ) ) . fromRed ( ) ; return { blinder : r , unblinder : e . invm ( t . modulus ) } } function i ( t , r ) { var i = n ( r ) , o = r . modulus . byteLength ( ) , f = ( a . mont ( r . modulus ) , new
type : "short" , prime : null , p : "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff" , a : "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc" , b : "5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b" , n : "ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551" , hash : a . sha256 , gRed : ! 1 , g : [ "6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296" , "4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5" ] } ) , i ( "p384" , { type : "short" , prime : null , p : "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff" , a : "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc" , b : "b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef" , n : "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973" , hash : a . sha384 , gRed : ! 1 , g : [ "aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7" , "3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f" ] } ) , i ( "p521" , { type : "short" , prime : null , p : "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff" , a : "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc" , b : "00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00" , n : "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409" , hash : a . sha512 , gRed : ! 1 , g : [ "000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66" , "00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650" ] } ) , i ( "curve25519" , { type : "mont" , prime : "p25519" , p : "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" , a : "76d06" , b : "0" , n : "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed" , hash : a . sha256 , gRed : ! 1 , g : [ "9" ] } ) , i ( "ed25519" , { type : "edwards" , prime : "p25519" , p : "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" , a : "-1" , c : "1" , d : "52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3" , n : "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed" , hash : a . sha256 , gRed : ! 1 , g : [ "216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a" , "6666666666666666666666666666666666666666666666666666666666666658" ] } ) ; var u ; try { u = r ( 520 ) } catch ( t ) { u = void 0 } i ( "secp256k1" , { type : "short" , prime : "k256" , p : "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" , a : "0" , b : "7" , n : "ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141" , h : "1" , hash : a . sha256 , beta : "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee" , lambda : "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72" , basis : [ { a : "3086d221a7d46bcde86c90e49284eb15" , b : "-e4437ed6010e88286f547fa90abfe4c3" } , { a : "114ca50f7a8e2f3f657c1108d9d44cfd8" , b : "3086d221a7d46bcde86c90e49284eb15" } ] , gRed : ! 1 , g : [ "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" , "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8" , u ] } ) } , function ( t , e , r ) { "use strict" ; function n ( t ) { return this instanceof n ? ( "string" == typeof t && ( f ( o . curves . hasOwnProperty ( t ) , "Unknown curve " + t ) , t = o . curves [ t ] ) , t instanceof o . curves . PresetCurve && ( t = { curve : t } ) , this . curve = t . curve . curve , this . n = this . curve . n , this . nh = this . n . ushrn ( 1 ) , this . g = this . curve . g , this . g = t . curve . g , this . g . precompute ( t . curve . n . bitLength ( ) + 1 ) , void ( this . hash = t . hash || t . curve . hash ) ) : new n ( t ) } var i = r ( 18 ) , o = r ( 19 ) , a = o . utils , f = a . assert , s = r ( 514 ) , u = r ( 515 ) ; t . exports = n , n
} } } , function ( t , e , r ) { "use strict" ; function n ( t , e ) { if ( Array . isArray ( t ) ) return t . slice ( ) ; if ( ! t ) return [ ] ; var r = [ ] ; if ( "string" != typeof t ) { for ( var n = 0 ; n < t . length ; n ++ ) r [ n ] = 0 | t [ n ] ; return r } if ( e ) { if ( "hex" === e ) { t = t . replace ( /[^a-z0-9]+/gi , "" ) , t . length % 2 !== 0 && ( t = "0" + t ) ; for ( var n = 0 ; n < t . length ; n += 2 ) r . push ( parseInt ( t [ n ] + t [ n + 1 ] , 16 ) ) } } else for ( var n = 0 ; n < t . length ; n ++ ) { var i = t . charCodeAt ( n ) , o = i >> 8 , a = 255 & i ; o ? r . push ( o , a ) : r . push ( a ) } return r } function i ( t ) { return 1 === t . length ? "0" + t : t } function o ( t ) { for ( var e = "" , r = 0 ; r < t . length ; r ++ ) e += i ( t [ r ] . toString ( 16 ) ) ; return e } function a ( t , e ) { for ( var r = [ ] , n = 1 << e + 1 , i = t . clone ( ) ; i . cmpn ( 1 ) >= 0 ; ) { var o ; if ( i . isOdd ( ) ) { var a = i . andln ( n - 1 ) ; o = a > ( n >> 1 ) - 1 ? ( n >> 1 ) - a : a , i . isubn ( o ) } else o = 0 ; r . push ( o ) ; for ( var f = 0 !== i . cmpn ( 0 ) && 0 === i . andln ( n - 1 ) ? e + 1 : 1 , s = 1 ; s < f ; s ++ ) r . push ( 0 ) ; i . iushrn ( f ) } return r } function f ( t , e ) { var r = [ [ ] , [ ] ] ; t = t . clone ( ) , e = e . clone ( ) ; for ( var n = 0 , i = 0 ; t . cmpn ( - n ) > 0 || e . cmpn ( - i ) > 0 ; ) { var o = t . andln ( 3 ) + n & 3 , a = e . andln ( 3 ) + i & 3 ; 3 === o && ( o = - 1 ) , 3 === a && ( a = - 1 ) ; var f ; if ( 0 === ( 1 & o ) ) f = 0 ; else { var s = t . andln ( 7 ) + n & 7 ; f = 3 !== s && 5 !== s || 2 !== a ? o : - o } r [ 0 ] . push ( f ) ; var u ; if ( 0 === ( 1 & a ) ) u = 0 ; else { var s = e . andln ( 7 ) + i & 7 ; u = 3 !== s && 5 !== s || 2 !== o ? a : - a } r [ 1 ] . push ( u ) , 2 * n === f + 1 && ( n = 1 - n ) , 2 * i === u + 1 && ( i = 1 - i ) , t . iushrn ( 1 ) , e . iushrn ( 1 ) } return r } function s ( t , e , r ) { var n = "_" + e ; t . prototype [ e ] = function ( ) { return void 0 !== this [ n ] ? this [ n ] : this [ n ] = r . call ( this ) } } function u ( t ) { return "string" == typeof t ? c . toArray ( t , "hex" ) : t } function h ( t ) { return new d ( t , "hex" , "le" ) } var c = e , d = r ( 18 ) ; c . assert = function ( t , e ) { if ( ! t ) throw new Error ( e || "Assertion failed" ) } , c . toArray = n , c . zero2 = i , c . toHex = o , c . encode = function ( t , e ) { return "hex" === e ? o ( t ) : t } , c . getNAF = a , c . getJSF = f , c . cachedProperty = s , c . parseBytes = u , c . intFromLE = h } , function ( t , e , r ) { function n ( t ) { this . rand = t } var i ; if ( t . exports = function ( t ) { return i || ( i = new n ( null ) ) , i . generate ( t ) } , t . exports . Rand = n , n . prototype . generate = function ( t ) { return this . _rand ( t ) } , "object" == typeof window ) window . crypto && window . crypto . getRandomValues ? n . prototype . _rand = function ( t ) { var e = new Uint8Array ( t ) ; return window . crypto . getRandomValues ( e ) , e } : window . msCrypto && window . msCrypto . getRandomValues ? n . prototype . _rand = function ( t ) { var e = new Uint8Array ( t ) ; return window . msCrypto . getRandomValues ( e ) , e } : n . prototype . _rand = function ( ) { throw new Error ( "Not implemented yet" ) } ; else try { var o = r ( 609 ) ; n . prototype . _rand = function ( t ) { return o . randomBytes ( t ) } } catch ( t ) { n . prototype . _rand = function ( t ) { for ( var e = new Uint8Array ( t ) , r = 0 ; r < e . length ; r ++ ) e [ r ] = this . rand . getByte ( ) ; return e } } } , function ( t , e , r ) { function n ( ) { this . pending = null , this . pendingTotal = 0 , this . blockSize = this . constructor . blockSize , this . outSize = this . constructor . outSize , this . hmacStrength = this . constructor . hmacStrength , this . padLength = this . constructor . padLength / 8 , this . endian = "big" , this . _delta8 = this . blockSize / 8 , this . _delta32 = this . blockSize / 32 } var i = r ( 49 ) , o = i . utils , a = o . assert ; e . BlockHash = n , n . prototype . update = function ( t , e ) { if ( t = o . toArray ( t , e ) , this . pending ? this . pending = this . pending . concat ( t ) : this . pending = t , this . pendingTotal += t . length , this . pending . length >= this . _delta8 ) { t = this . pending ; var r = t . length % this . _delta8 ; this . pending = t . slice ( t . length - r , t . length ) , 0 === this . pending . length && ( this . pending = null ) , t = o . join32 ( t , 0 , t . length - r , this . endian ) ; for ( var n = 0 ; n < t . length ; n += this . _delta32 ) this . _update ( t , n , n + this . _delta32 ) } return this } , n . prototype . digest = function ( t ) { return this . update ( this . _pad ( ) ) , a ( null === this . pending ) , this . _digest ( t ) } , n . prototype . _pad = function ( ) { var t = this . pendingTotal , e = this . _delta8 , r = e - ( t + this . padLength ) % e , n = new Array ( r + this . padLength ) ; n [ 0 ] = 128 ; for ( var i = 1 ; i < r ; i ++ ) n [ i ] = 0 ; if ( t <<= 3 , "big" === this . endian ) { for ( var o = 8 ; o < this . padLength ; o ++ ) n [ i ++ ] = 0 ; n [ i ++ ] = 0 , n [ i ++ ] = 0 , n [ i ++ ] = 0 , n [ i ++ ] = 0 , n [ i ++ ] = t >>> 24 & 255 , n [ i ++ ] = t >>> 16 & 255 , n [ i ++ ] = t >>> 8 & 255 , n [ i ++ ] = 255 & t } else { n [ i ++ ] = 255 & t , n [ i ++ ] = t >>> 8 & 255 , n [ i ++ ] = t >>> 16 & 255 , n [ i ++ ] = t >>> 24 & 255 , n [ i ++ ] = 0 , n [ i ++ ] = 0 , n [ i ++ ] = 0 , n [ i ++ ] = 0 ; for ( var o = 8 ; o < this . padLength ; o ++ ) n [ i ++ ] = 0 } return n } } , function ( t , e , r ) { function n ( t , e , r ) { return this instanceof n ? ( this . Hash = t , this . blockSize = t . blockSize / 8 , this . outSize = t . outSize / 8 , this . inner = null , this . outer = null , void this . _init ( o . toArray ( e , r ) ) ) : new n ( t , e , r ) } var i = r ( 49 ) , o = i . utils , a = o . assert ; t . exports = n , n . prototype . _init = function (
21 : "videostr" , 22 : "ia5str" , 23 : "utctime" , 24 : "gentime" , 25 : "graphstr" , 26 : "iso646str" , 27 : "genstr" , 28 : "unistr" , 29 : "charstr" , 30 : "bmpstr" } , e . tagByName = n . _reverse ( e . tag ) } , function ( t , e , r ) { var n = e ; n . der = r ( 216 ) , n . pem = r ( 535 ) } , function ( t , e , r ) { function n ( t ) { a . call ( this , t ) , this . enc = "pem" } var i = r ( 2 ) , o = r ( 1 ) . Buffer , a = r ( 216 ) ; i ( n , a ) , t . exports = n , n . prototype . decode = function ( t , e ) { for ( var r = t . toString ( ) . split ( /[\r\n]+/g ) , n = e . label . toUpperCase ( ) , i = /^-----(BEGIN|END) ([^-]+)-----$/ , f = - 1 , s = - 1 , u = 0 ; u < r . length ; u ++ ) { var h = r [ u ] . match ( i ) ; if ( null !== h && h [ 2 ] === n ) { if ( f !== - 1 ) { if ( "END" !== h [ 1 ] ) break ; s = u ; break } if ( "BEGIN" !== h [ 1 ] ) break ; f = u } } if ( f === - 1 || s === - 1 ) throw new Error ( "PEM section not found for: " + n ) ; var c = r . slice ( f + 1 , s ) . join ( "" ) ; c . replace ( /[^a-z0-9\+\/=]+/gi , "" ) ; var d = new o ( c , "base64" ) ; return a . prototype . decode . call ( this , d , e ) } } , function ( t , e , r ) { var n = e ; n . der = r ( 217 ) , n . pem = r ( 537 ) } , function ( t , e , r ) { function n ( t ) { o . call ( this , t ) , this . enc = "pem" } var i = r ( 2 ) , o = r ( 217 ) ; i ( n , o ) , t . exports = n , n . prototype . encode = function ( t , e ) { for ( var r = o . prototype . encode . call ( this , t ) , n = r . toString ( "base64" ) , i = [ "-----BEGIN " + e . label + "-----" ] , a = 0 ; a < n . length ; a += 64 ) i . push ( n . slice ( a , a + 64 ) ) ; return i . push ( "-----END " + e . label + "-----" ) , i . join ( "\n" ) } } , function ( t , e ) { function r ( t , e ) { if ( ! t ) throw new Error ( e || "Assertion failed" ) } t . exports = r , r . equal = function ( t , e , r ) { if ( t != e ) throw new Error ( r || "Assertion failed: " + t + " != " + e ) } } , function ( t , e , r ) { ( function ( t ) { function n ( e , r , o ) { return this instanceof n ? ( u . call ( this ) , this . _cache = new i , this . _last = void 0 , this . _cipher = new s . AES ( r ) , this . _prev = new t ( o . length ) , o . copy ( this . _prev ) , this . _mode = e , void ( this . _autopadding = ! 0 ) ) : new n ( e , r , o ) } function i ( ) { return this instanceof i ? void ( this . cache = new t ( "" ) ) : new i } function o ( t ) { for ( var e = t [ 15 ] , r = - 1 ; ++ r < e ; ) if ( t [ r + ( 16 - e ) ] !== e ) throw new Error ( "unable to decrypt data" ) ; if ( 16 !== e ) return t . slice ( 0 , 16 - e ) } function a ( e , r , i ) { var o = c [ e . toLowerCase ( ) ] ; if ( ! o ) throw new TypeError ( "invalid suite type" ) ; if ( "string" == typeof i && ( i = new t ( i ) ) , "string" == typeof r && ( r = new t ( r ) ) , r . length !== o . key / 8 ) throw new TypeError ( "invalid key length " + r . length ) ; if ( i . length !== o . iv ) throw new TypeError ( "invalid iv length " + i . length ) ; return "stream" === o . type ? new d ( b [ o . mode ] , r , i , ! 0 ) : "auth" === o . type ? new l ( b [ o . mode ] , r , i , ! 0 ) : new n ( b [ o . mode ] , r , i ) } function f ( t , e ) { var r = c [ t . toLowerCase ( ) ] ; if ( ! r ) throw new TypeError ( "invalid suite type" ) ; var n = p ( e , ! 1 , r . key , r . iv ) ; return a ( t , n . key , n . iv ) } var s = r ( 101 ) , u = r ( 103 ) , h = r ( 2 ) , c = r ( 147 ) , d = r ( 226 ) , l = r ( 218 ) , p = r ( 148 ) ; h ( n , u ) , n . prototype . _update = function ( e ) { this . _cache . add ( e ) ; for ( var r , n , i = [ ] ; r = this . _cache . get ( this . _autopadding ) ; ) n = this . _mode . decrypt ( this , r ) , i . push ( n ) ; return t . concat ( i ) } , n . prototype . _final = function ( ) { var t = this . _cache . flush ( ) ; if ( this . _autopadding ) return o ( this . _mode . decrypt ( this , t ) ) ; if ( t ) throw new Error ( "data not multiple of block length" ) } , n . prototype . setAutoPadding = function ( t ) { return this . _autopadding = ! ! t , this } , i . prototype . add = function ( e ) { this . cache = t . concat ( [ this . cache , e ] ) } , i . prototype . get = function ( t ) { var e ; if ( t ) { if ( this . cache . length > 16 ) return e = this . cache . slice ( 0 , 16 ) , this . cache = this . cache . slice ( 16 ) , e } else if ( this . cache . length >= 16 ) return e = this . cache . slice ( 0 , 16 ) , this . cache = this . cache . slice ( 16 ) , e ; return null } , i . prototype . flush = function ( ) { if ( this . cache . length ) return this . cache } ; var b = { ECB : r ( 224 ) , CBC : r ( 220 ) , CFB : r ( 221 ) , CFB8 : r ( 223 ) , CFB1 : r ( 222 ) , OFB : r ( 225 ) , CTR : r ( 102 ) , GCM : r ( 102 ) } ; e . createDecipher = f , e . createDecipheriv = a } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e , r ) { ( function ( t ) { function n ( e , r , o ) { return this instanceof n ? ( s . call ( this ) , this . _cache = new i , this . _cipher = new f . AES ( r ) , this . _prev = new t ( o . length ) , o . copy ( this . _prev ) , this . _mode = e , void ( this . _autopadding = ! 0 ) ) : new n ( e , r , o ) } function i ( ) { return this instanceof i ? void ( this . cache = new t ( "" ) ) : new i } function o ( e , r , i ) { var o = h [ e . toLowerCase ( ) ] ; if ( ! o ) throw new TypeError ( "invalid suite type" ) ; if ( "string" == typeof i && ( i = new t ( i ) ) , "string" == typeof r && ( r = new t ( r ) ) , r . length !== o . key / 8 ) throw new TypeError ( "invalid key length " + r . length ) ; if ( i . length !== o . iv ) throw new TypeError ( "invalid iv length " + i . length ) ; return "stream" === o . type ? new d ( p [ o . mode ] , r , i ) : "auth" === o . type ? new l ( p [ o . mode ] , r , i ) : new n ( p [ o . mode ] , r , i ) } function
u ( o , h . BasePoint ) , n . prototype . jpoint = function ( t , e , r ) { return new o ( this , t , e , r ) } , o . prototype . toP = function ( ) { if ( this . isInfinity ( ) ) return this . curve . point ( null , null ) ; var t = this . z . redInvm ( ) , e = t . redSqr ( ) , r = this . x . redMul ( e ) , n = this . y . redMul ( e ) . redMul ( t ) ; return this . curve . point ( r , n ) } , o . prototype . neg = function ( ) { return this . curve . jpoint ( this . x , this . y . redNeg ( ) , this . z ) } , o . prototype . add = function ( t ) { if ( this . isInfinity ( ) ) return t ; if ( t . isInfinity ( ) ) return this ; var e = t . z . redSqr ( ) , r = this . z . redSqr ( ) , n = this . x . redMul ( e ) , i = t . x . redMul ( r ) , o = this . y . redMul ( e . redMul ( t . z ) ) , a = t . y . redMul ( r . redMul ( this . z ) ) , f = n . redSub ( i ) , s = o . redSub ( a ) ; if ( 0 === f . cmpn ( 0 ) ) return 0 !== s . cmpn ( 0 ) ? this . curve . jpoint ( null , null , null ) : this . dbl ( ) ; var u = f . redSqr ( ) , h = u . redMul ( f ) , c = n . redMul ( u ) , d = s . redSqr ( ) . redIAdd ( h ) . redISub ( c ) . redISub ( c ) , l = s . redMul ( c . redISub ( d ) ) . redISub ( o . redMul ( h ) ) , p = this . z . redMul ( t . z ) . redMul ( f ) ; return this . curve . jpoint ( d , l , p ) } , o . prototype . mixedAdd = function ( t ) { if ( this . isInfinity ( ) ) return t . toJ ( ) ; if ( t . isInfinity ( ) ) return this ; var e = this . z . redSqr ( ) , r = this . x , n = t . x . redMul ( e ) , i = this . y , o = t . y . redMul ( e ) . redMul ( this . z ) , a = r . redSub ( n ) , f = i . redSub ( o ) ; if ( 0 === a . cmpn ( 0 ) ) return 0 !== f . cmpn ( 0 ) ? this . curve . jpoint ( null , null , null ) : this . dbl ( ) ; var s = a . redSqr ( ) , u = s . redMul ( a ) , h = r . redMul ( s ) , c = f . redSqr ( ) . redIAdd ( u ) . redISub ( h ) . redISub ( h ) , d = f . redMul ( h . redISub ( c ) ) . redISub ( i . redMul ( u ) ) , l = this . z . redMul ( a ) ; return this . curve . jpoint ( c , d , l ) } , o . prototype . dblp = function ( t ) { if ( 0 === t ) return this ; if ( this . isInfinity ( ) ) return this ; if ( ! t ) return this . dbl ( ) ; if ( this . curve . zeroA || this . curve . threeA ) { for ( var e = this , r = 0 ; r < t ; r ++ ) e = e . dbl ( ) ; return e } for ( var n = this . curve . a , i = this . curve . tinv , o = this . x , a = this . y , f = this . z , s = f . redSqr ( ) . redSqr ( ) , u = a . redAdd ( a ) , r = 0 ; r < t ; r ++ ) { var h = o . redSqr ( ) , c = u . redSqr ( ) , d = c . redSqr ( ) , l = h . redAdd ( h ) . redIAdd ( h ) . redIAdd ( n . redMul ( s ) ) , p = o . redMul ( c ) , b = l . redSqr ( ) . redISub ( p . redAdd ( p ) ) , v = p . redISub ( b ) , y = l . redMul ( v ) ; y = y . redIAdd ( y ) . redISub ( d ) ; var m = u . redMul ( f ) ; r + 1 < t && ( s = s . redMul ( d ) ) , o = b , f = m , u = y } return this . curve . jpoint ( o , u . redMul ( i ) , f ) } , o . prototype . dbl = function ( ) { return this . isInfinity ( ) ? this : this . curve . zeroA ? this . _zeroDbl ( ) : this . curve . threeA ? this . _threeDbl ( ) : this . _dbl ( ) } , o . prototype . _zeroDbl = function ( ) { var t , e , r ; if ( this . zOne ) { var n = this . x . redSqr ( ) , i = this . y . redSqr ( ) , o = i . redSqr ( ) , a = this . x . redAdd ( i ) . redSqr ( ) . redISub ( n ) . redISub ( o ) ; a = a . redIAdd ( a ) ; var f = n . redAdd ( n ) . redIAdd ( n ) , s = f . redSqr ( ) . redISub ( a ) . redISub ( a ) , u = o . redIAdd ( o ) ; u = u . redIAdd ( u ) , u = u . redIAdd ( u ) , t = s , e = f . redMul ( a . redISub ( s ) ) . redISub ( u ) , r = this . y . redAdd ( this . y ) } else { var h = this . x . redSqr ( ) , c = this . y . redSqr ( ) , d = c . redSqr ( ) , l = this . x . redAdd ( c ) . redSqr ( ) . redISub ( h ) . redISub ( d ) ; l = l . redIAdd ( l ) ; var p = h . redAdd ( h ) . redIAdd ( h ) , b = p . redSqr ( ) , v = d . redIAdd ( d ) ; v = v . redIAdd ( v ) , v = v . redIAdd ( v ) , t = b . redISub ( l ) . redISub ( l ) , e = p . redMul ( l . redISub ( t ) ) . redISub ( v ) , r = this . y . redMul ( this . z ) , r = r . redIAdd ( r ) } return this . curve . jpoint ( t , e , r ) } , o . prototype . _threeDbl = function ( ) { var t , e , r ; if ( this . zOne ) { var n = this . x . redSqr ( ) , i = this . y . redSqr ( ) , o = i . redSqr ( ) , a = this . x . redAdd ( i ) . redSqr ( ) . redISub ( n ) . redISub ( o ) ; a = a . redIAdd ( a ) ; var f = n . redAdd ( n ) . redIAdd ( n ) . redIAdd ( this . curve . a ) , s = f . redSqr ( ) . redISub ( a ) . redISub ( a ) ; t = s ; var u = o . redIAdd ( o ) ; u = u . redIAdd ( u ) , u = u . redIAdd ( u ) , e = f . redMul ( a . redISub ( s ) ) . redISub ( u ) , r = this . y . redAdd ( this . y ) } else { var h = this . z . redSqr ( ) , c = this . y . redSqr ( ) , d = this . x . redMul ( c ) , l = this . x . redSub ( h ) . redMul ( this . x . redAdd ( h ) ) ; l = l . redAdd ( l ) . redIAdd ( l ) ; var p = d . redIAdd ( d ) ; p = p . redIAdd ( p ) ; var b = p . redAdd ( p ) ; t = l . redSqr ( ) . redISub ( b ) , r = this . y . redAdd ( this . z ) . redSqr ( ) . redISub ( c ) . redISub ( h ) ; var v = c . redSqr ( ) ; v = v . redIAdd ( v ) , v = v . redIAdd ( v ) , v = v . redIAdd ( v ) , e = l . redMul ( p . redISub ( t ) ) . redISub ( v ) } return this . curve . jpoint ( t , e , r ) } , o . prototype . _dbl = function ( ) { var t = this . curve . a , e = this . x , r = this . y , n = this . z , i = n . redSqr ( ) . redSqr ( ) , o = e . redSqr ( ) , a = r . redSqr ( ) , f = o . redAdd ( o ) . redIAdd ( o ) . redIAdd ( t . redMul ( i ) ) , s = e . redAdd ( e ) ; s = s . redIAdd ( s ) ; var u = s . redMul ( a ) , h = f . redSqr ( ) . redISub ( u . redAdd ( u ) ) , c = u . redISub ( h ) , d = a . redSqr ( ) ; d = d . redIAdd ( d ) , d = d . redIAdd ( d ) , d = d . redIAdd ( d ) ; var l = f . redMul ( c ) . redISub ( d ) , p = r . redAdd ( r ) . redMul ( n ) ; return this . curve . jpoint ( h , l , p ) } , o . prototype . trpl = function ( ) { if ( ! this . curve . zeroA ) return this . dbl ( ) . add ( this ) ; var t = this . x . redSqr ( ) , e = this . y . redS
} } } , function ( t , e , r ) { "use strict" ; function n ( t , e ) { if ( Array . isArray ( t ) ) return t . slice ( ) ; if ( ! t ) return [ ] ; var r = [ ] ; if ( "string" != typeof t ) { for ( var n = 0 ; n < t . length ; n ++ ) r [ n ] = 0 | t [ n ] ; return r } if ( e ) { if ( "hex" === e ) { t = t . replace ( /[^a-z0-9]+/gi , "" ) , t . length % 2 !== 0 && ( t = "0" + t ) ; for ( var n = 0 ; n < t . length ; n += 2 ) r . push ( parseInt ( t [ n ] + t [ n + 1 ] , 16 ) ) } } else for ( var n = 0 ; n < t . length ; n ++ ) { var i = t . charCodeAt ( n ) , o = i >> 8 , a = 255 & i ; o ? r . push ( o , a ) : r . push ( a ) } return r } function i ( t ) { return 1 === t . length ? "0" + t : t } function o ( t ) { for ( var e = "" , r = 0 ; r < t . length ; r ++ ) e += i ( t [ r ] . toString ( 16 ) ) ; return e } function a ( t , e ) { for ( var r = [ ] , n = 1 << e + 1 , i = t . clone ( ) ; i . cmpn ( 1 ) >= 0 ; ) { var o ; if ( i . isOdd ( ) ) { var a = i . andln ( n - 1 ) ; o = a > ( n >> 1 ) - 1 ? ( n >> 1 ) - a : a , i . isubn ( o ) } else o = 0 ; r . push ( o ) ; for ( var f = 0 !== i . cmpn ( 0 ) && 0 === i . andln ( n - 1 ) ? e + 1 : 1 , s = 1 ; s < f ; s ++ ) r . push ( 0 ) ; i . iushrn ( f ) } return r } function f ( t , e ) { var r = [ [ ] , [ ] ] ; t = t . clone ( ) , e = e . clone ( ) ; for ( var n = 0 , i = 0 ; t . cmpn ( - n ) > 0 || e . cmpn ( - i ) > 0 ; ) { var o = t . andln ( 3 ) + n & 3 , a = e . andln ( 3 ) + i & 3 ; 3 === o && ( o = - 1 ) , 3 === a && ( a = - 1 ) ; var f ; if ( 0 === ( 1 & o ) ) f = 0 ; else { var s = t . andln ( 7 ) + n & 7 ; f = 3 !== s && 5 !== s || 2 !== a ? o : - o } r [ 0 ] . push ( f ) ; var u ; if ( 0 === ( 1 & a ) ) u = 0 ; else { var s = e . andln ( 7 ) + i & 7 ; u = 3 !== s && 5 !== s || 2 !== o ? a : - a } r [ 1 ] . push ( u ) , 2 * n === f + 1 && ( n = 1 - n ) , 2 * i === u + 1 && ( i = 1 - i ) , t . iushrn ( 1 ) , e . iushrn ( 1 ) } return r } function s ( t , e , r ) { var n = "_" + e ; t . prototype [ e ] = function ( ) { return void 0 !== this [ n ] ? this [ n ] : this [ n ] = r . call ( this ) } } function u ( t ) { return "string" == typeof t ? c . toArray ( t , "hex" ) : t } function h ( t ) { return new d ( t , "hex" , "le" ) } var c = e , d = r ( 30 ) ; c . assert = function ( t , e ) { if ( ! t ) throw new Error ( e || "Assertion failed" ) } , c . toArray = n , c . zero2 = i , c . toHex = o , c . encode = function ( t , e ) { return "hex" === e ? o ( t ) : t } , c . getNAF = a , c . getJSF = f , c . cachedProperty = s , c . parseBytes = u , c . intFromLE = h } , function ( t , e , r ) { function n ( t ) { this . rand = t } var i ; if ( t . exports = function ( t ) { return i || ( i = new n ( null ) ) , i . generate ( t ) } , t . exports . Rand = n , n . prototype . generate = function ( t ) { return this . _rand ( t ) } , "object" == typeof window ) window . crypto && window . crypto . getRandomValues ? n . prototype . _rand = function ( t ) { var e = new Uint8Array ( t ) ; return window . crypto . getRandomValues ( e ) , e } : window . msCrypto && window . msCrypto . getRandomValues ? n . prototype . _rand = function ( t ) { var e = new Uint8Array ( t ) ; return window . msCrypto . getRandomValues ( e ) , e } : n . prototype . _rand = function ( ) { throw new Error ( "Not implemented yet" ) } ; else try { var o = r ( 610 ) ; n . prototype . _rand = function ( t ) { return o . randomBytes ( t ) } } catch ( t ) { n . prototype . _rand = function ( t ) { for ( var e = new Uint8Array ( t ) , r = 0 ; r < e . length ; r ++ ) e [ r ] = this . rand . getByte ( ) ; return e } } } , function ( t , e , r ) { function n ( ) { this . pending = null , this . pendingTotal = 0 , this . blockSize = this . constructor . blockSize , this . outSize = this . constructor . outSize , this . hmacStrength = this . constructor . hmacStrength , this . padLength = this . constructor . padLength / 8 , this . endian = "big" , this . _delta8 = this . blockSize / 8 , this . _delta32 = this . blockSize / 32 } var i = r ( 50 ) , o = i . utils , a = o . assert ; e . BlockHash = n , n . prototype . update = function ( t , e ) { if ( t = o . toArray ( t , e ) , this . pending ? this . pending = this . pending . concat ( t ) : this . pending = t , this . pendingTotal += t . length , this . pending . length >= this . _delta8 ) { t = this . pending ; var r = t . length % this . _delta8 ; this . pending = t . slice ( t . length - r , t . length ) , 0 === this . pending . length && ( this . pending = null ) , t = o . join32 ( t , 0 , t . length - r , this . endian ) ; for ( var n = 0 ; n < t . length ; n += this . _delta32 ) this . _update ( t , n , n + this . _delta32 ) } return this } , n . prototype . digest = function ( t ) { return this . update ( this . _pad ( ) ) , a ( null === this . pending ) , this . _digest ( t ) } , n . prototype . _pad = function ( ) { var t = this . pendingTotal , e = this . _delta8 , r = e - ( t + this . padLength ) % e , n = new Array ( r + this . padLength ) ; n [ 0 ] = 128 ; for ( var i = 1 ; i < r ; i ++ ) n [ i ] = 0 ; if ( t <<= 3 , "big" === this . endian ) { for ( var o = 8 ; o < this . padLength ; o ++ ) n [ i ++ ] = 0 ; n [ i ++ ] = 0 , n [ i ++ ] = 0 , n [ i ++ ] = 0 , n [ i ++ ] = 0 , n [ i ++ ] = t >>> 24 & 255 , n [ i ++ ] = t >>> 16 & 255 , n [ i ++ ] = t >>> 8 & 255 , n [ i ++ ] = 255 & t } else { n [ i ++ ] = 255 & t , n [ i ++ ] = t >>> 8 & 255 , n [ i ++ ] = t >>> 16 & 255 , n [ i ++ ] = t >>> 24 & 255 , n [ i ++ ] = 0 , n [ i ++ ] = 0 , n [ i ++ ] = 0 , n [ i ++ ] = 0 ; for ( var o = 8 ; o < this . padLength ; o ++ ) n [ i ++ ] = 0 } return n } } , function ( t , e , r ) { function n ( t , e , r ) { return this instanceof n ? ( this . Hash = t , this . blockSize = t . blockSize / 8 , this . outSize = t . outSize / 8 , this . inner = null , this . outer = null , void this . _init ( o . toArray ( e , r ) ) ) : new n ( t , e , r ) } var i = r ( 50 ) , o = i . utils , a = o . assert ; t . exports = n , n . prototype . _init = function (
( c ) 2012 by Cédric Mesnil . All rights reserved .
Redistribution and use in source and binary forms , with or without modification , are permitted provided that the following conditions are met :
- Redistributions of source code must retain the above copyright notice , this list of conditions and the following disclaimer .
- Redistributions in binary form must reproduce the above copyright notice , this list of conditions and the following disclaimer in the documentation and / or other materials provided with the distribution .
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
* /
var d = [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 7 , 4 , 13 , 1 , 10 , 6 , 15 , 3 , 12 , 0 , 9 , 5 , 2 , 14 , 11 , 8 , 3 , 10 , 14 , 4 , 9 , 15 , 8 , 1 , 2 , 7 , 0 , 6 , 13 , 11 , 5 , 12 , 1 , 9 , 11 , 10 , 0 , 8 , 12 , 4 , 13 , 3 , 7 , 15 , 14 , 5 , 6 , 2 , 4 , 0 , 5 , 9 , 7 , 12 , 2 , 10 , 14 , 1 , 3 , 8 , 11 , 6 , 15 , 13 ] , l = [ 5 , 14 , 7 , 0 , 9 , 2 , 11 , 4 , 13 , 6 , 15 , 8 , 1 , 10 , 3 , 12 , 6 , 11 , 3 , 7 , 0 , 13 , 5 , 10 , 14 , 15 , 8 , 12 , 4 , 9 , 1 , 2 , 15 , 5 , 1 , 3 , 7 , 14 , 6 , 9 , 11 , 8 , 12 , 2 , 10 , 0 , 4 , 13 , 8 , 6 , 4 , 1 , 3 , 11 , 15 , 0 , 5 , 12 , 2 , 13 , 9 , 7 , 10 , 14 , 12 , 15 , 10 , 4 , 1 , 5 , 8 , 7 , 6 , 2 , 13 , 14 , 0 , 3 , 9 , 11 ] , p = [ 11 , 14 , 15 , 12 , 5 , 8 , 7 , 9 , 11 , 13 , 14 , 15 , 6 , 7 , 9 , 8 , 7 , 6 , 8 , 13 , 11 , 9 , 7 , 15 , 7 , 12 , 15 , 9 , 11 , 7 , 13 , 12 , 11 , 13 , 6 , 7 , 14 , 9 , 13 , 15 , 14 , 8 , 13 , 6 , 5 , 12 , 7 , 5 , 11 , 12 , 14 , 15 , 14 , 15 , 9 , 8 , 9 , 14 , 5 , 6 , 8 , 6 , 5 , 12 , 9 , 15 , 5 , 11 , 6 , 8 , 13 , 12 , 5 , 12 , 13 , 14 , 11 , 8 , 5 , 6 ] , b = [ 8 , 9 , 9 , 11 , 13 , 15 , 15 , 5 , 7 , 7 , 8 , 11 , 14 , 14 , 12 , 6 , 9 , 13 , 15 , 7 , 12 , 8 , 9 , 11 , 7 , 7 , 12 , 7 , 6 , 15 , 13 , 11 , 9 , 7 , 15 , 11 , 8 , 6 , 6 , 14 , 12 , 13 , 5 , 14 , 13 , 13 , 7 , 5 , 15 , 5 , 8 , 11 , 14 , 14 , 6 , 14 , 6 , 9 , 12 , 9 , 12 , 5 , 15 , 8 , 8 , 5 , 12 , 9 , 12 , 5 , 14 , 6 , 8 , 13 , 6 , 5 , 15 , 13 , 11 , 11 ] , v = [ 0 , 1518500249 , 1859775393 , 2400959708 , 2840853838 ] , y = [ 1352829926 , 1548603684 , 1836072691 , 2053994217 , 0 ] ; t . exports = c } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e , r ) { var e = t . exports = function ( t ) { t = t . toLowerCase ( ) ; var r = e [ t ] ; if ( ! r ) throw new Error ( t + " is not supported (we accept pull requests)" ) ; return new r } ; e . sha = r ( 569 ) , e . sha1 = r ( 570 ) , e . sha224 = r ( 571 ) , e . sha256 = r ( 227 ) , e . sha384 = r ( 572 ) , e . sha512 = r ( 228 ) } , function ( t , e , r ) { ( function ( e ) { function n ( ) { this . init ( ) , this . _w = h , s . call ( this , 64 , 56 ) } function i ( t ) { return t << 5 | t >>> 27 } function o ( t ) { return t << 30 | t >>> 2 } function a ( t , e , r , n ) { return 0 === t ? e & r | ~ e & n : 2 === t ? e & r | e & n | r & n : e ^ r ^ n } var f = r ( 2 ) , s = r ( 60 ) , u = [ 1518500249 , 1859775393 , - 1894007588 , - 899497514 ] , h = new Array ( 80 ) ; f ( n , s ) , n . prototype . init = function ( ) { return this . _a = 1732584193 , this . _b = 4023233417 , this . _c = 2562383102 , this . _d = 271733878 , this . _e = 3285377520 , this } , n . prototype . _update = function ( t ) { for ( var e = this . _w , r = 0 | this . _a , n = 0 | this . _b , f = 0 | this . _c , s = 0 | this . _d , h = 0 | this . _e , c = 0 ; c < 16 ; ++ c ) e [ c ] = t . readInt32BE ( 4 * c ) ; for ( ; c < 80 ; ++ c ) e [ c ] = e [ c - 3 ] ^ e [ c - 8 ] ^ e [ c - 14 ] ^ e [ c - 16 ] ; for ( var d = 0 ; d < 80 ; ++ d ) { var l = ~ ~ ( d / 20 ) , p = i ( r ) + a ( l , n , f , s ) + h + e [ d ] + u [ l ] | 0 ; h = s , s = f , f = o ( n ) , n = r , r = p } this . _a = r + this . _a | 0 , this . _b = n + this . _b | 0 , this . _c = f + this . _c | 0 , this . _d = s + this . _d | 0 , this . _e = h + this . _e | 0 } , n . prototype . _hash = function ( ) { var t = new e ( 20 ) ; return t . writeInt32BE ( 0 | this . _a , 0 ) , t . writeInt32BE ( 0 | this . _b , 4 ) , t . writeInt32BE ( 0 | this . _c , 8 ) , t . writeInt32BE ( 0 | this . _d , 12 ) , t . writeInt32BE ( 0 | this . _e , 16 ) , t } , t . exports = n } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e , r ) { ( function ( e ) { function n ( ) { this . init ( ) , this . _w = c , u . call ( this , 64 , 56 ) } function i ( t ) { return t << 1 | t >>> 31 } function o ( t ) { return t << 5 | t >>> 27 } function a ( t ) { return t << 30 | t >>> 2 } function f ( t , e , r , n ) { return 0 === t ? e & r | ~ e & n : 2 === t ? e & r | e & n | r & n : e ^ r ^ n } var s = r ( 2 ) , u = r ( 60 ) , h = [ 1518500249 , 1859775393 , - 1894007588 , - 899497514 ] , c = new Array ( 80 ) ; s ( n , u ) , n . prototype . init = function ( ) { return this . _a = 1732584193 , this . _b = 4023233417 , this . _c = 2562383102 , this . _d = 271733878 , this . _e = 3285377520 , this } , n . prototype . _update = function ( t ) { for ( var e = this . _w , r = 0 | this . _a , n = 0 | this . _b , s = 0 | this . _c , u = 0 | this . _d , c = 0 | this . _e , d = 0 ; d < 16 ; ++ d ) e [ d ] = t . readInt32BE ( 4 * d ) ; for ( ; d < 80 ; ++ d ) e [ d ] = i ( e [ d - 3 ] ^ e [ d - 8 ] ^ e [ d - 14 ] ^ e [ d - 16 ] ) ; for ( var l = 0 ; l < 80 ; ++ l ) { var p = ~ ~ ( l / 20 ) , b = o ( r ) + f ( p , n , s , u ) + c + e [ l ] + h [ p ] | 0 ; c = u , u = s , s = a ( n ) , n = r , r = b } this . _a = r + this . _a | 0 , this . _b = n + this . _b | 0 , this . _c = s + this . _c | 0 , this . _d = u + this . _d | 0 , this . _e = c + this . _e | 0 } , n . prototype . _hash = function ( ) { var t = new e ( 20 ) ; return t . writeInt32BE ( 0 | this . _a , 0 ) , t . writeInt32BE ( 0 | this . _b , 4 ) , t . writeInt32BE ( 0 | this . _c , 8 ) , t . writeInt32BE ( 0 | this . _d , 12 ) , t . writeInt32BE ( 0 | this . _e , 16 ) , t } , t . exports = n } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e , r ) { ( function ( e ) { function n ( ) { this . init ( ) , this . _w = f , a . call ( this , 64 , 56 ) } var i = r ( 2 ) , o = r ( 227 ) , a = r ( 60 ) , f = new Array ( 64 ) ; i ( n , o ) , n . prototype . init = function ( ) { return this . _a = 3238371032 , this . _b = 914150663 , this . _c = 812702999 , this . _d = 4144912697 , this . _e = 4290775857 , this . _f = 1750603025 , this . _g = 1694076839 , this . _h = 3204075428 , this } , n . prototype . _hash = function ( ) { var t = new e ( 28 ) ; return t . writeInt32BE ( this . _a , 0 ) , t . writeInt32BE ( this . _b , 4 ) , t . writeInt32BE ( this . _c , 8 ) , t . writeInt32BE ( this . _d , 12 ) , t . writeInt32BE ( this . _e , 16 ) , t . writeInt32BE ( this . _f , 20 ) , t . writeInt32BE ( this . _g , 24 ) , t } , t . exports = n } ) . call ( e , r ( 1 ) . Buffer ) } , function ( t , e , r ) { ( function ( e ) { function n ( ) { this . init ( ) , this . _w = f , a . call ( this , 128 , 112 ) } var i = r ( 2 ) , o = r ( 228 ) , a = r ( 60 ) , f = new Array ( 160 ) ; i ( n , o ) , n . prototype .
r ++ ) : r && ( t . splice ( n , 1 ) , r -- ) } if ( e ) for ( ; r -- ; r ) t . unshift ( ".." ) ; return t } function n ( t , e ) { if ( t . filter ) return t . filter ( e ) ; for ( var r = [ ] , n = 0 ; n < t . length ; n ++ ) e ( t [ n ] , n , t ) && r . push ( t [ n ] ) ; return r } var i = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/ , o = function ( t ) { return i . exec ( t ) . slice ( 1 ) } ; e . resolve = function ( ) { for ( var e = "" , i = ! 1 , o = arguments . length - 1 ; o >= - 1 && ! i ; o -- ) { var a = o >= 0 ? arguments [ o ] : t . cwd ( ) ; if ( "string" != typeof a ) throw new TypeError ( "Arguments to path.resolve must be strings" ) ; a && ( e = a + "/" + e , i = "/" === a . charAt ( 0 ) ) } return e = r ( n ( e . split ( "/" ) , function ( t ) { return ! ! t } ) , ! i ) . join ( "/" ) , ( i ? "/" : "" ) + e || "." } , e . normalize = function ( t ) { var i = e . isAbsolute ( t ) , o = "/" === a ( t , - 1 ) ; return t = r ( n ( t . split ( "/" ) , function ( t ) { return ! ! t } ) , ! i ) . join ( "/" ) , t || i || ( t = "." ) , t && o && ( t += "/" ) , ( i ? "/" : "" ) + t } , e . isAbsolute = function ( t ) { return "/" === t . charAt ( 0 ) } , e . join = function ( ) { var t = Array . prototype . slice . call ( arguments , 0 ) ; return e . normalize ( n ( t , function ( t , e ) { if ( "string" != typeof t ) throw new TypeError ( "Arguments to path.join must be strings" ) ; return t } ) . join ( "/" ) ) } , e . relative = function ( t , r ) { function n ( t ) { for ( var e = 0 ; e < t . length && "" === t [ e ] ; e ++ ) ; for ( var r = t . length - 1 ; r >= 0 && "" === t [ r ] ; r -- ) ; return e > r ? [ ] : t . slice ( e , r - e + 1 ) } t = e . resolve ( t ) . substr ( 1 ) , r = e . resolve ( r ) . substr ( 1 ) ; for ( var i = n ( t . split ( "/" ) ) , o = n ( r . split ( "/" ) ) , a = Math . min ( i . length , o . length ) , f = a , s = 0 ; s < a ; s ++ ) if ( i [ s ] !== o [ s ] ) { f = s ; break } for ( var u = [ ] , s = f ; s < i . length ; s ++ ) u . push ( ".." ) ; return u = u . concat ( o . slice ( f ) ) , u . join ( "/" ) } , e . sep = "/" , e . delimiter = ":" , e . dirname = function ( t ) { var e = o ( t ) , r = e [ 0 ] , n = e [ 1 ] ; return r || n ? ( n && ( n = n . substr ( 0 , n . length - 1 ) ) , r + n ) : "." } , e . basename = function ( t , e ) { var r = o ( t ) [ 2 ] ; return e && r . substr ( - 1 * e . length ) === e && ( r = r . substr ( 0 , r . length - e . length ) ) , r } , e . extname = function ( t ) { return o ( t ) [ 3 ] } ; var a = "b" === "ab" . substr ( - 1 ) ? function ( t , e , r ) { return t . substr ( e , r ) } : function ( t , e , r ) { return e < 0 && ( e = t . length + e ) , t . substr ( e , r ) } } ) . call ( e , r ( 26 ) ) } , function ( t , e , r ) { t . exports = r ( 51 ) } , function ( t , e , r ) { "use strict" ; function n ( ) { this . head = null , this . tail = null , this . length = 0 } var i = ( r ( 1 ) . Buffer , r ( 156 ) ) ; t . exports = n , n . prototype . push = function ( t ) { var e = { data : t , next : null } ; this . length > 0 ? this . tail . next = e : this . head = e , this . tail = e , ++ this . length } , n . prototype . unshift = function ( t ) { var e = { data : t , next : this . head } ; 0 === this . length && ( this . tail = e ) , this . head = e , ++ this . length } , n . prototype . shift = function ( ) { if ( 0 !== this . length ) { var t = this . head . data ; return 1 === this . length ? this . head = this . tail = null : this . head = this . head . next , -- this . length , t } } , n . prototype . clear = function ( ) { this . head = this . tail = null , this . length = 0 } , n . prototype . join = function ( t ) { if ( 0 === this . length ) return "" ; for ( var e = this . head , r = "" + e . data ; e = e . next ; ) r += t + e . data ; return r } , n . prototype . concat = function ( t ) { if ( 0 === this . length ) return i . alloc ( 0 ) ; if ( 1 === this . length ) return this . head . data ; for ( var e = i . allocUnsafe ( t >>> 0 ) , r = this . head , n = 0 ; r ; ) r . data . copy ( e , n ) , n += r . data . length , r = r . next ; return e } } , function ( t , e ) { var r = { } . toString ; t . exports = Array . isArray || function ( t ) { return "[object Array]" == r . call ( t ) } } , function ( t , e , r ) { ( function ( e ) { function r ( t , e ) { function r ( ) { if ( ! i ) { if ( n ( "throwDeprecation" ) ) throw new Error ( e ) ; n ( "traceDeprecation" ) ? console . trace ( e ) : console . warn ( e ) , i = ! 0 } return t . apply ( this , arguments ) } if ( n ( "noDeprecation" ) ) return t ; var i = ! 1 ; return r } function n ( t ) { try { if ( ! e . localStorage ) return ! 1 } catch ( t ) { return ! 1 } var r = e . localStorage [ t ] ; return null != r && "true" === String ( r ) . toLowerCase ( ) } t . exports = r } ) . call ( e , r ( 39 ) ) } , function ( t , e , r ) { t . exports = r ( 249 ) } , function ( t , e , r ) { ( function ( n ) { var i = function ( ) { try { return r ( 31 ) } catch ( t ) { } } ( ) ; e = t . exports = r ( 250 ) , e . Stream = i || e , e . Readable = e , e . Writable = r ( 155 ) , e . Duplex = r ( 51 ) , e . Transform = r ( 154 ) , e . PassThrough = r ( 249 ) , ! n . browser && "disable" === n . env . READABLE _STREAM && i && ( t . exports = i ) } ) . call ( e , r ( 26 ) ) } , function ( t , e , r ) { t . exports = r ( 154 ) } , function ( t , e , r ) { t . exports = r ( 155 ) } , function ( t , e ) { "function" == typeof Object . create ? t . exports = function ( t , e ) { t . super _ = e , t . prototype = Object . create ( e . prototype , { constructor : { value : t , enumerable : ! 1 , writable : ! 0 , configurable : ! 0 } } ) } : t . exports = function ( t , e ) { t . super _ = e ; var r = function ( ) { } ; r . prototype = e . prototype , t . prototype = new r , t . prototype . constructor = t } } , function ( t , e ) { "function" == typeof Object . create ? t . exports = funct
/***/ } ) ,
/* 5 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = ccJsonify ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ = _ _webpack _require _ _ ( 3 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ ) ;
/ * *
* @ public
* Serializes a crypto - condition class ( Condition or Fulfillment ) into a BigchainDB - compatible JSON
* @ param { cc . Fulfillment } fulfillment base58 encoded Ed25519 public key for the recipient of the Transaction
* @ returns { object } Ed25519 Condition ( that will need to wrapped in an Output )
* /
function ccJsonify ( fulfillment ) {
var conditionUri = void 0 ;
if ( 'getConditionUri' in fulfillment ) conditionUri = fulfillment . getConditionUri ( ) ; else if ( 'serializeUri' in fulfillment ) conditionUri = fulfillment . serializeUri ( ) ;
var jsonBody = {
'details' : { } ,
'uri' : conditionUri
} ;
if ( fulfillment . getTypeId ( ) === 0 ) {
jsonBody . details . type _id = 0 ;
jsonBody . details . bitmask = 3 ;
if ( 'preimage' in fulfillment ) {
jsonBody . details . preimage = fulfillment . preimage . toString ( ) ;
jsonBody . details . type = 'fulfillment' ;
}
}
if ( fulfillment . getTypeId ( ) === 2 ) return {
'details' : {
'type_id' : 2 ,
'type' : 'fulfillment' ,
'bitmask' : fulfillment . getBitmask ( ) ,
'threshold' : fulfillment . threshold ,
'subfulfillments' : fulfillment . subconditions . map ( function ( subcondition ) {
var subconditionJson = ccJsonify ( subcondition . body ) ;
subconditionJson . details . weight = 1 ;
return subconditionJson . details ;
} )
} ,
'uri' : conditionUri
} ;
if ( fulfillment . getTypeId ( ) === 4 ) {
jsonBody . details . type _id = 4 ;
jsonBody . details . bitmask = 32 ;
if ( 'publicKey' in fulfillment ) {
jsonBody . details . signature = null ;
jsonBody . details . public _key = _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ _default . a . encode ( fulfillment . publicKey ) ;
jsonBody . details . type = 'fulfillment' ;
}
}
if ( 'hash' in fulfillment ) {
jsonBody . details . hash = _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ _default . a . encode ( fulfillment . hash ) ;
jsonBody . details . max _fulfillment _length = fulfillment . maxFulfillmentLength ;
jsonBody . details . type = 'condition' ;
}
return jsonBody ;
}
/***/ } ) ,
/* 6 */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-04-26 15:58:19 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = makeTransaction ;
2017-05-10 09:36:07 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _hashTransaction _ _ = _ _webpack _require _ _ ( 41 ) ;
2017-04-26 15:58:19 +02:00
function makeTransactionTemplate ( ) {
return {
'id' : null ,
'operation' : null ,
'outputs' : [ ] ,
'inputs' : [ ] ,
'metadata' : null ,
'asset' : null ,
'version' : '0.9'
} ;
}
function makeTransaction ( operation , asset ) {
var metadata = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : null ;
var outputs = arguments . length > 3 && arguments [ 3 ] !== undefined ? arguments [ 3 ] : [ ] ;
var inputs = arguments . length > 4 && arguments [ 4 ] !== undefined ? arguments [ 4 ] : [ ] ;
var tx = makeTransactionTemplate ( ) ;
tx . operation = operation ;
tx . asset = asset ;
tx . metadata = metadata ;
tx . inputs = inputs ;
tx . outputs = outputs ;
// Hashing must be done after, as the hash is of the Transaction (up to now)
tx . id = _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _0 _ _hashTransaction _ _ [ "a" /* default */ ] ) ( tx ) ;
return tx ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 7 */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
2017-04-26 15:58:19 +02:00
2017-05-05 17:24:23 +02:00
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = serializeTransactionIntoCanonicalString ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _json _stable _stringify _ _ = _ _webpack _require _ _ ( 85 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _json _stable _stringify _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _0 _json _stable _stringify _ _ ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _clone _ _ = _ _webpack _require _ _ ( 18 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _clone _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _1 _clone _ _ ) ;
2017-04-26 15:58:19 +02:00
2017-05-05 17:24:23 +02:00
/ * *
* @ public
* Canonically serializes a transaction into a string by sorting the keys
* @ param { object } ( transaction )
* @ return { string } a canonically serialized Transaction
* /
function serializeTransactionIntoCanonicalString ( transaction ) {
// BigchainDB signs fulfillments by serializing transactions into a "canonical" format where
var tx = _ _WEBPACK _IMPORTED _MODULE _1 _clone _ _ _default ( ) ( transaction ) ;
// TODO: set fulfillments to null
// Sort the keys
return _ _WEBPACK _IMPORTED _MODULE _0 _json _stable _stringify _ _ _default ( ) ( tx , function ( a , b ) {
return a . key > b . key ? 1 : - 1 ;
} ) ;
}
2017-04-26 15:58:19 +02:00
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 8 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
var core = module . exports = { version : '2.4.0' } ;
if ( typeof _ _e == 'number' ) _ _e = core ; // eslint-disable-line no-undef
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 9 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
// Thank's IE8 for his funny defineProperty
2017-05-05 17:24:23 +02:00
module . exports = ! _ _webpack _require _ _ ( 22 ) ( function ( ) {
2017-04-26 15:58:19 +02:00
return Object . defineProperty ( { } , 'a' , { get : function ( ) { return 7 ; } } ) . a != 7 ;
} ) ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 10 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module . exports = typeof window != 'undefined' && window . Math == Math
? window : typeof self != 'undefined' && self . Math == Math ? self : Function ( 'return this' ) ( ) ;
if ( typeof _ _g == 'number' ) _ _g = global ; // eslint-disable-line no-undef
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 11 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
module . exports = function ( it ) {
return typeof it === 'object' ? it !== null : typeof it === 'function' ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 12 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
2017-05-05 17:24:23 +02:00
var IObject = _ _webpack _require _ _ ( 65 )
, defined = _ _webpack _require _ _ ( 59 ) ;
2017-04-26 15:58:19 +02:00
module . exports = function ( it ) {
return IObject ( defined ( it ) ) ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 13 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
// shim for using process in browser
var process = module . exports = { } ;
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout ;
var cachedClearTimeout ;
function defaultSetTimout ( ) {
throw new Error ( 'setTimeout has not been defined' ) ;
}
function defaultClearTimeout ( ) {
throw new Error ( 'clearTimeout has not been defined' ) ;
}
( function ( ) {
try {
if ( typeof setTimeout === 'function' ) {
cachedSetTimeout = setTimeout ;
} else {
cachedSetTimeout = defaultSetTimout ;
}
} catch ( e ) {
cachedSetTimeout = defaultSetTimout ;
}
try {
if ( typeof clearTimeout === 'function' ) {
cachedClearTimeout = clearTimeout ;
} else {
cachedClearTimeout = defaultClearTimeout ;
}
} catch ( e ) {
cachedClearTimeout = defaultClearTimeout ;
}
} ( ) )
function runTimeout ( fun ) {
if ( cachedSetTimeout === setTimeout ) {
//normal enviroments in sane situations
return setTimeout ( fun , 0 ) ;
}
// if setTimeout wasn't available but was latter defined
if ( ( cachedSetTimeout === defaultSetTimout || ! cachedSetTimeout ) && setTimeout ) {
cachedSetTimeout = setTimeout ;
return setTimeout ( fun , 0 ) ;
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout ( fun , 0 ) ;
} catch ( e ) {
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout . call ( null , fun , 0 ) ;
} catch ( e ) {
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout . call ( this , fun , 0 ) ;
}
}
}
function runClearTimeout ( marker ) {
if ( cachedClearTimeout === clearTimeout ) {
//normal enviroments in sane situations
return clearTimeout ( marker ) ;
}
// if clearTimeout wasn't available but was latter defined
if ( ( cachedClearTimeout === defaultClearTimeout || ! cachedClearTimeout ) && clearTimeout ) {
cachedClearTimeout = clearTimeout ;
return clearTimeout ( marker ) ;
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout ( marker ) ;
} catch ( e ) {
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout . call ( null , marker ) ;
} catch ( e ) {
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout . call ( this , marker ) ;
}
}
}
var queue = [ ] ;
var draining = false ;
var currentQueue ;
var queueIndex = - 1 ;
function cleanUpNextTick ( ) {
if ( ! draining || ! currentQueue ) {
return ;
}
draining = false ;
if ( currentQueue . length ) {
queue = currentQueue . concat ( queue ) ;
} else {
queueIndex = - 1 ;
}
if ( queue . length ) {
drainQueue ( ) ;
}
}
function drainQueue ( ) {
if ( draining ) {
return ;
}
var timeout = runTimeout ( cleanUpNextTick ) ;
draining = true ;
var len = queue . length ;
while ( len ) {
currentQueue = queue ;
queue = [ ] ;
while ( ++ queueIndex < len ) {
if ( currentQueue ) {
currentQueue [ queueIndex ] . run ( ) ;
}
}
queueIndex = - 1 ;
len = queue . length ;
}
currentQueue = null ;
draining = false ;
runClearTimeout ( timeout ) ;
}
process . nextTick = function ( fun ) {
var args = new Array ( arguments . length - 1 ) ;
if ( arguments . length > 1 ) {
for ( var i = 1 ; i < arguments . length ; i ++ ) {
args [ i - 1 ] = arguments [ i ] ;
}
}
queue . push ( new Item ( fun , args ) ) ;
if ( queue . length === 1 && ! draining ) {
runTimeout ( drainQueue ) ;
}
} ;
// v8 likes predictible objects
function Item ( fun , array ) {
this . fun = fun ;
this . array = array ;
}
Item . prototype . run = function ( ) {
this . fun . apply ( null , this . array ) ;
} ;
process . title = 'browser' ;
process . browser = true ;
process . env = { } ;
process . argv = [ ] ;
process . version = '' ; // empty string to avoid regexp issues
process . versions = { } ;
function noop ( ) { }
process . on = noop ;
process . addListener = noop ;
process . once = noop ;
process . off = noop ;
process . removeListener = noop ;
process . removeAllListeners = noop ;
process . emit = noop ;
2017-05-10 09:36:07 +02:00
process . prependListener = noop ;
process . prependOnceListener = noop ;
process . listeners = function ( name ) { return [ ] }
2017-04-26 15:58:19 +02:00
process . binding = function ( name ) {
throw new Error ( 'process.binding is not supported' ) ;
} ;
process . cwd = function ( ) { return '/' } ;
process . chdir = function ( dir ) {
throw new Error ( 'process.chdir is not supported' ) ;
} ;
process . umask = function ( ) { return 0 ; } ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 14 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
var g ;
// This works in non-strict mode
g = ( function ( ) {
return this ;
} ) ( ) ;
try {
// This works if eval is allowed (see CSP)
g = g || Function ( "return this" ) ( ) || ( 1 , eval ) ( "this" ) ;
} catch ( e ) {
// This works if the window reference is available
if ( typeof window === "object" )
g = window ;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module . exports = g ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 15 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = getStatus ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ = _ _webpack _require _ _ ( 0 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ = _ _webpack _require _ _ ( 1 ) ;
2017-05-05 17:24:23 +02:00
/ * *
* @ public
* @ param tx _id
* @ param API _PATH
* /
2017-04-26 15:58:19 +02:00
function getStatus ( tx _id , API _PATH ) {
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ [ "a" /* default */ ] ) ( _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ [ "a" /* default */ ] ) ( API _PATH ) [ 'statuses' ] , {
query : {
tx _id : tx _id
}
} ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 16 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = getTransaction ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ = _ _webpack _require _ _ ( 0 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ = _ _webpack _require _ _ ( 1 ) ;
2017-05-05 17:24:23 +02:00
/ * *
* @ public
* @ param txId
* @ param API _PATH
* /
2017-04-26 15:58:19 +02:00
function getTransaction ( txId , API _PATH ) {
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ [ "a" /* default */ ] ) ( _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ [ "a" /* default */ ] ) ( API _PATH ) [ 'transactions_detail' ] , {
urlTemplateSpec : {
txId : txId
}
} ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 17 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = makeInputTemplate ;
function makeInputTemplate ( ) {
var publicKeys = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : [ ] ;
var fulfills = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : null ;
var fulfillment = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : null ;
return {
fulfillment : fulfillment ,
fulfills : fulfills ,
'owners_before' : publicKeys
} ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 18 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
/* WEBPACK VAR INJECTION */ ( function ( Buffer ) { var clone = ( function ( ) {
'use strict' ;
function _instanceof ( obj , type ) {
return type != null && obj instanceof type ;
}
var nativeMap ;
try {
nativeMap = Map ;
} catch ( _ ) {
// maybe a reference error because no `Map`. Give it a dummy value that no
// value will ever be an instanceof.
nativeMap = function ( ) { } ;
}
var nativeSet ;
try {
nativeSet = Set ;
} catch ( _ ) {
nativeSet = function ( ) { } ;
}
var nativePromise ;
try {
nativePromise = Promise ;
} catch ( _ ) {
nativePromise = function ( ) { } ;
}
/ * *
* Clones ( copies ) an Object using deep copying .
*
* This function supports circular references by default , but if you are certain
* there are no circular references in your object , you can save some CPU time
* by calling clone ( obj , false ) .
*
* Caution : if ` circular ` is false and ` parent ` contains circular references ,
* your program may enter an infinite loop and crash .
*
* @ param ` parent ` - the object to be cloned
* @ param ` circular ` - set to true if the object to be cloned may contain
* circular references . ( optional - true by default )
* @ param ` depth ` - set to a number if the object is only to be cloned to
* a particular depth . ( optional - defaults to Infinity )
* @ param ` prototype ` - sets the prototype to be used when cloning an object .
* ( optional - defaults to parent prototype ) .
* @ param ` includeNonEnumerable ` - set to true if the non - enumerable properties
* should be cloned as well . Non - enumerable properties on the prototype
* chain will be ignored . ( optional - false by default )
* /
function clone ( parent , circular , depth , prototype , includeNonEnumerable ) {
if ( typeof circular === 'object' ) {
depth = circular . depth ;
prototype = circular . prototype ;
includeNonEnumerable = circular . includeNonEnumerable ;
circular = circular . circular ;
}
// maintain two arrays for circular references, where corresponding parents
// and children have the same index
var allParents = [ ] ;
var allChildren = [ ] ;
var useBuffer = typeof Buffer != 'undefined' ;
if ( typeof circular == 'undefined' )
circular = true ;
if ( typeof depth == 'undefined' )
depth = Infinity ;
// recurse this function so we don't reset allParents and allChildren
function _clone ( parent , depth ) {
// cloning null always returns null
if ( parent === null )
return null ;
if ( depth === 0 )
return parent ;
var child ;
var proto ;
if ( typeof parent != 'object' ) {
return parent ;
}
if ( _instanceof ( parent , nativeMap ) ) {
child = new nativeMap ( ) ;
} else if ( _instanceof ( parent , nativeSet ) ) {
child = new nativeSet ( ) ;
} else if ( _instanceof ( parent , nativePromise ) ) {
child = new nativePromise ( function ( resolve , reject ) {
parent . then ( function ( value ) {
resolve ( _clone ( value , depth - 1 ) ) ;
} , function ( err ) {
reject ( _clone ( err , depth - 1 ) ) ;
} ) ;
} ) ;
} else if ( clone . _ _isArray ( parent ) ) {
child = [ ] ;
} else if ( clone . _ _isRegExp ( parent ) ) {
child = new RegExp ( parent . source , _ _getRegExpFlags ( parent ) ) ;
if ( parent . lastIndex ) child . lastIndex = parent . lastIndex ;
} else if ( clone . _ _isDate ( parent ) ) {
child = new Date ( parent . getTime ( ) ) ;
} else if ( useBuffer && Buffer . isBuffer ( parent ) ) {
child = new Buffer ( parent . length ) ;
parent . copy ( child ) ;
return child ;
} else if ( _instanceof ( parent , Error ) ) {
child = Object . create ( parent ) ;
} else {
if ( typeof prototype == 'undefined' ) {
proto = Object . getPrototypeOf ( parent ) ;
child = Object . create ( proto ) ;
}
else {
child = Object . create ( prototype ) ;
proto = prototype ;
}
}
if ( circular ) {
var index = allParents . indexOf ( parent ) ;
if ( index != - 1 ) {
return allChildren [ index ] ;
}
allParents . push ( parent ) ;
allChildren . push ( child ) ;
}
if ( _instanceof ( parent , nativeMap ) ) {
parent . forEach ( function ( value , key ) {
var keyChild = _clone ( key , depth - 1 ) ;
var valueChild = _clone ( value , depth - 1 ) ;
child . set ( keyChild , valueChild ) ;
} ) ;
}
if ( _instanceof ( parent , nativeSet ) ) {
parent . forEach ( function ( value ) {
var entryChild = _clone ( value , depth - 1 ) ;
child . add ( entryChild ) ;
} ) ;
}
for ( var i in parent ) {
var attrs ;
if ( proto ) {
attrs = Object . getOwnPropertyDescriptor ( proto , i ) ;
}
if ( attrs && attrs . set == null ) {
continue ;
}
child [ i ] = _clone ( parent [ i ] , depth - 1 ) ;
}
if ( Object . getOwnPropertySymbols ) {
var symbols = Object . getOwnPropertySymbols ( parent ) ;
for ( var i = 0 ; i < symbols . length ; i ++ ) {
// Don't need to worry about cloning a symbol because it is a primitive,
// like a number or string.
var symbol = symbols [ i ] ;
var descriptor = Object . getOwnPropertyDescriptor ( parent , symbol ) ;
if ( descriptor && ! descriptor . enumerable && ! includeNonEnumerable ) {
continue ;
}
child [ symbol ] = _clone ( parent [ symbol ] , depth - 1 ) ;
if ( ! descriptor . enumerable ) {
Object . defineProperty ( child , symbol , {
enumerable : false
} ) ;
}
}
}
if ( includeNonEnumerable ) {
var allPropertyNames = Object . getOwnPropertyNames ( parent ) ;
for ( var i = 0 ; i < allPropertyNames . length ; i ++ ) {
var propertyName = allPropertyNames [ i ] ;
var descriptor = Object . getOwnPropertyDescriptor ( parent , propertyName ) ;
if ( descriptor && descriptor . enumerable ) {
continue ;
}
child [ propertyName ] = _clone ( parent [ propertyName ] , depth - 1 ) ;
Object . defineProperty ( child , propertyName , {
enumerable : false
} ) ;
}
}
return child ;
}
return _clone ( parent , depth ) ;
}
/ * *
* Simple flat clone using prototype , accepts only objects , usefull for property
* override on FLAT configuration object ( no nested props ) .
*
* USE WITH CAUTION ! This may not behave as you wish if you do not know how this
* works .
* /
clone . clonePrototype = function clonePrototype ( parent ) {
if ( parent === null )
return null ;
var c = function ( ) { } ;
c . prototype = parent ;
return new c ( ) ;
} ;
// private utility functions
function _ _objToStr ( o ) {
return Object . prototype . toString . call ( o ) ;
}
clone . _ _objToStr = _ _objToStr ;
function _ _isDate ( o ) {
return typeof o === 'object' && _ _objToStr ( o ) === '[object Date]' ;
}
clone . _ _isDate = _ _isDate ;
function _ _isArray ( o ) {
return typeof o === 'object' && _ _objToStr ( o ) === '[object Array]' ;
}
clone . _ _isArray = _ _isArray ;
function _ _isRegExp ( o ) {
return typeof o === 'object' && _ _objToStr ( o ) === '[object RegExp]' ;
}
clone . _ _isRegExp = _ _isRegExp ;
function _ _getRegExpFlags ( re ) {
var flags = '' ;
if ( re . global ) flags += 'g' ;
if ( re . ignoreCase ) flags += 'i' ;
if ( re . multiline ) flags += 'm' ;
return flags ;
}
clone . _ _getRegExpFlags = _ _getRegExpFlags ;
return clone ;
} ) ( ) ;
if ( typeof module === 'object' && module . exports ) {
module . exports = clone ;
}
/* WEBPACK VAR INJECTION */ } . call ( exports , _ _webpack _require _ _ ( 2 ) . Buffer ) )
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 19 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
_ _webpack _require _ _ ( 79 ) ;
module . exports = _ _webpack _require _ _ ( 8 ) . Object . entries ;
2017-04-26 15:58:19 +02:00
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 20 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
// false -> Array#indexOf
// true -> Array#includes
2017-05-05 17:24:23 +02:00
var toIObject = _ _webpack _require _ _ ( 12 )
, toLength = _ _webpack _require _ _ ( 75 )
, toIndex = _ _webpack _require _ _ ( 74 ) ;
2017-04-26 15:58:19 +02:00
module . exports = function ( IS _INCLUDES ) {
return function ( $this , el , fromIndex ) {
var O = toIObject ( $this )
, length = toLength ( O . length )
, index = toIndex ( fromIndex , length )
, value ;
// Array#includes uses SameValueZero equality algorithm
if ( IS _INCLUDES && el != el ) while ( length > index ) {
value = O [ index ++ ] ;
if ( value != value ) return true ;
// Array#toIndex ignores holes, Array#includes - not
} else for ( ; length > index ; index ++ ) if ( IS _INCLUDES || index in O ) {
if ( O [ index ] === el ) return IS _INCLUDES || index || 0 ;
} return ! IS _INCLUDES && - 1 ;
} ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 21 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
var global = _ _webpack _require _ _ ( 10 )
, core = _ _webpack _require _ _ ( 8 )
, ctx = _ _webpack _require _ _ ( 58 )
, hide = _ _webpack _require _ _ ( 63 )
2017-04-26 15:58:19 +02:00
, PROTOTYPE = 'prototype' ;
var $export = function ( type , name , source ) {
var IS _FORCED = type & $export . F
, IS _GLOBAL = type & $export . G
, IS _STATIC = type & $export . S
, IS _PROTO = type & $export . P
, IS _BIND = type & $export . B
, IS _WRAP = type & $export . W
, exports = IS _GLOBAL ? core : core [ name ] || ( core [ name ] = { } )
, expProto = exports [ PROTOTYPE ]
, target = IS _GLOBAL ? global : IS _STATIC ? global [ name ] : ( global [ name ] || { } ) [ PROTOTYPE ]
, key , own , out ;
if ( IS _GLOBAL ) source = name ;
for ( key in source ) {
// contains in native
own = ! IS _FORCED && target && target [ key ] !== undefined ;
if ( own && key in exports ) continue ;
// export native or passed
out = own ? target [ key ] : source [ key ] ;
// prevent global pollution for namespaces
exports [ key ] = IS _GLOBAL && typeof target [ key ] != 'function' ? source [ key ]
// bind timers to global for call from export context
: IS _BIND && own ? ctx ( out , global )
// wrap global constructors for prevent change them in library
: IS _WRAP && target [ key ] == out ? ( function ( C ) {
var F = function ( a , b , c ) {
if ( this instanceof C ) {
switch ( arguments . length ) {
case 0 : return new C ;
case 1 : return new C ( a ) ;
case 2 : return new C ( a , b ) ;
} return new C ( a , b , c ) ;
} return C . apply ( this , arguments ) ;
} ;
F [ PROTOTYPE ] = C [ PROTOTYPE ] ;
return F ;
// make static versions for prototype methods
} ) ( out ) : IS _PROTO && typeof out == 'function' ? ctx ( Function . call , out ) : out ;
// export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
if ( IS _PROTO ) {
( exports . virtual || ( exports . virtual = { } ) ) [ key ] = out ;
// export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
if ( type & $export . R && expProto && ! expProto [ key ] ) hide ( expProto , key , out ) ;
}
}
} ;
// type bitmap
$export . F = 1 ; // forced
$export . G = 2 ; // global
$export . S = 4 ; // static
$export . P = 8 ; // proto
$export . B = 16 ; // bind
$export . W = 32 ; // wrap
$export . U = 64 ; // safe
$export . R = 128 ; // real proto method for `library`
module . exports = $export ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 22 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
module . exports = function ( exec ) {
try {
return ! ! exec ( ) ;
} catch ( e ) {
return true ;
}
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 23 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
// 7.1.4 ToInteger
var ceil = Math . ceil
, floor = Math . floor ;
module . exports = function ( it ) {
return isNaN ( it = + it ) ? 0 : ( it > 0 ? floor : ceil ) ( it ) ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 24 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
/* WEBPACK VAR INJECTION */ ( function ( process , global ) { / * *
* [ js - sha3 ] { @ link https : //github.com/emn178/js-sha3}
*
* @ version 0.5 . 7
* @ author Chen , Yi - Cyuan [ emn178 @ gmail . com ]
* @ copyright Chen , Yi - Cyuan 2015 - 2016
* @ license MIT
* /
/*jslint bitwise: true */
( function ( ) {
'use strict' ;
var root = typeof window === 'object' ? window : { } ;
var NODE _JS = ! root . JS _SHA3 _NO _NODE _JS && typeof process === 'object' && process . versions && process . versions . node ;
if ( NODE _JS ) {
root = global ;
}
var COMMON _JS = ! root . JS _SHA3 _NO _COMMON _JS && typeof module === 'object' && module . exports ;
var HEX _CHARS = '0123456789abcdef' . split ( '' ) ;
var SHAKE _PADDING = [ 31 , 7936 , 2031616 , 520093696 ] ;
var KECCAK _PADDING = [ 1 , 256 , 65536 , 16777216 ] ;
var PADDING = [ 6 , 1536 , 393216 , 100663296 ] ;
var SHIFT = [ 0 , 8 , 16 , 24 ] ;
var RC = [ 1 , 0 , 32898 , 0 , 32906 , 2147483648 , 2147516416 , 2147483648 , 32907 , 0 , 2147483649 ,
0 , 2147516545 , 2147483648 , 32777 , 2147483648 , 138 , 0 , 136 , 0 , 2147516425 , 0 ,
2147483658 , 0 , 2147516555 , 0 , 139 , 2147483648 , 32905 , 2147483648 , 32771 ,
2147483648 , 32770 , 2147483648 , 128 , 2147483648 , 32778 , 0 , 2147483658 , 2147483648 ,
2147516545 , 2147483648 , 32896 , 2147483648 , 2147483649 , 0 , 2147516424 , 2147483648 ] ;
var BITS = [ 224 , 256 , 384 , 512 ] ;
var SHAKE _BITS = [ 128 , 256 ] ;
var OUTPUT _TYPES = [ 'hex' , 'buffer' , 'arrayBuffer' , 'array' ] ;
var createOutputMethod = function ( bits , padding , outputType ) {
return function ( message ) {
return new Keccak ( bits , padding , bits ) . update ( message ) [ outputType ] ( ) ;
} ;
} ;
var createShakeOutputMethod = function ( bits , padding , outputType ) {
return function ( message , outputBits ) {
return new Keccak ( bits , padding , outputBits ) . update ( message ) [ outputType ] ( ) ;
} ;
} ;
var createMethod = function ( bits , padding ) {
var method = createOutputMethod ( bits , padding , 'hex' ) ;
method . create = function ( ) {
return new Keccak ( bits , padding , bits ) ;
} ;
method . update = function ( message ) {
return method . create ( ) . update ( message ) ;
} ;
for ( var i = 0 ; i < OUTPUT _TYPES . length ; ++ i ) {
var type = OUTPUT _TYPES [ i ] ;
method [ type ] = createOutputMethod ( bits , padding , type ) ;
}
return method ;
} ;
var createShakeMethod = function ( bits , padding ) {
var method = createShakeOutputMethod ( bits , padding , 'hex' ) ;
method . create = function ( outputBits ) {
return new Keccak ( bits , padding , outputBits ) ;
} ;
method . update = function ( message , outputBits ) {
return method . create ( outputBits ) . update ( message ) ;
} ;
for ( var i = 0 ; i < OUTPUT _TYPES . length ; ++ i ) {
var type = OUTPUT _TYPES [ i ] ;
method [ type ] = createShakeOutputMethod ( bits , padding , type ) ;
}
return method ;
} ;
var algorithms = [
{ name : 'keccak' , padding : KECCAK _PADDING , bits : BITS , createMethod : createMethod } ,
{ name : 'sha3' , padding : PADDING , bits : BITS , createMethod : createMethod } ,
{ name : 'shake' , padding : SHAKE _PADDING , bits : SHAKE _BITS , createMethod : createShakeMethod }
] ;
var methods = { } , methodNames = [ ] ;
for ( var i = 0 ; i < algorithms . length ; ++ i ) {
var algorithm = algorithms [ i ] ;
var bits = algorithm . bits ;
for ( var j = 0 ; j < bits . length ; ++ j ) {
var methodName = algorithm . name + '_' + bits [ j ] ;
methodNames . push ( methodName ) ;
methods [ methodName ] = algorithm . createMethod ( bits [ j ] , algorithm . padding ) ;
}
}
function Keccak ( bits , padding , outputBits ) {
this . blocks = [ ] ;
this . s = [ ] ;
this . padding = padding ;
this . outputBits = outputBits ;
this . reset = true ;
this . block = 0 ;
this . start = 0 ;
this . blockCount = ( 1600 - ( bits << 1 ) ) >> 5 ;
this . byteCount = this . blockCount << 2 ;
this . outputBlocks = outputBits >> 5 ;
this . extraBytes = ( outputBits & 31 ) >> 3 ;
for ( var i = 0 ; i < 50 ; ++ i ) {
this . s [ i ] = 0 ;
}
}
Keccak . prototype . update = function ( message ) {
var notString = typeof message !== 'string' ;
if ( notString && message . constructor === ArrayBuffer ) {
message = new Uint8Array ( message ) ;
}
var length = message . length , blocks = this . blocks , byteCount = this . byteCount ,
blockCount = this . blockCount , index = 0 , s = this . s , i , code ;
while ( index < length ) {
if ( this . reset ) {
this . reset = false ;
blocks [ 0 ] = this . block ;
for ( i = 1 ; i < blockCount + 1 ; ++ i ) {
blocks [ i ] = 0 ;
}
}
if ( notString ) {
for ( i = this . start ; index < length && i < byteCount ; ++ index ) {
blocks [ i >> 2 ] |= message [ index ] << SHIFT [ i ++ & 3 ] ;
}
} else {
for ( i = this . start ; index < length && i < byteCount ; ++ index ) {
code = message . charCodeAt ( index ) ;
if ( code < 0x80 ) {
blocks [ i >> 2 ] |= code << SHIFT [ i ++ & 3 ] ;
} else if ( code < 0x800 ) {
blocks [ i >> 2 ] |= ( 0xc0 | ( code >> 6 ) ) << SHIFT [ i ++ & 3 ] ;
blocks [ i >> 2 ] |= ( 0x80 | ( code & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
} else if ( code < 0xd800 || code >= 0xe000 ) {
blocks [ i >> 2 ] |= ( 0xe0 | ( code >> 12 ) ) << SHIFT [ i ++ & 3 ] ;
blocks [ i >> 2 ] |= ( 0x80 | ( ( code >> 6 ) & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
blocks [ i >> 2 ] |= ( 0x80 | ( code & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
} else {
code = 0x10000 + ( ( ( code & 0x3ff ) << 10 ) | ( message . charCodeAt ( ++ index ) & 0x3ff ) ) ;
blocks [ i >> 2 ] |= ( 0xf0 | ( code >> 18 ) ) << SHIFT [ i ++ & 3 ] ;
blocks [ i >> 2 ] |= ( 0x80 | ( ( code >> 12 ) & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
blocks [ i >> 2 ] |= ( 0x80 | ( ( code >> 6 ) & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
blocks [ i >> 2 ] |= ( 0x80 | ( code & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
}
}
}
this . lastByteIndex = i ;
if ( i >= byteCount ) {
this . start = i - byteCount ;
this . block = blocks [ blockCount ] ;
for ( i = 0 ; i < blockCount ; ++ i ) {
s [ i ] ^= blocks [ i ] ;
}
f ( s ) ;
this . reset = true ;
} else {
this . start = i ;
}
}
return this ;
} ;
Keccak . prototype . finalize = function ( ) {
var blocks = this . blocks , i = this . lastByteIndex , blockCount = this . blockCount , s = this . s ;
blocks [ i >> 2 ] |= this . padding [ i & 3 ] ;
if ( this . lastByteIndex === this . byteCount ) {
blocks [ 0 ] = blocks [ blockCount ] ;
for ( i = 1 ; i < blockCount + 1 ; ++ i ) {
blocks [ i ] = 0 ;
}
}
blocks [ blockCount - 1 ] |= 0x80000000 ;
for ( i = 0 ; i < blockCount ; ++ i ) {
s [ i ] ^= blocks [ i ] ;
}
f ( s ) ;
} ;
Keccak . prototype . toString = Keccak . prototype . hex = function ( ) {
this . finalize ( ) ;
var blockCount = this . blockCount , s = this . s , outputBlocks = this . outputBlocks ,
extraBytes = this . extraBytes , i = 0 , j = 0 ;
var hex = '' , block ;
while ( j < outputBlocks ) {
for ( i = 0 ; i < blockCount && j < outputBlocks ; ++ i , ++ j ) {
block = s [ i ] ;
hex += HEX _CHARS [ ( block >> 4 ) & 0x0F ] + HEX _CHARS [ block & 0x0F ] +
HEX _CHARS [ ( block >> 12 ) & 0x0F ] + HEX _CHARS [ ( block >> 8 ) & 0x0F ] +
HEX _CHARS [ ( block >> 20 ) & 0x0F ] + HEX _CHARS [ ( block >> 16 ) & 0x0F ] +
HEX _CHARS [ ( block >> 28 ) & 0x0F ] + HEX _CHARS [ ( block >> 24 ) & 0x0F ] ;
}
if ( j % blockCount === 0 ) {
f ( s ) ;
i = 0 ;
}
}
if ( extraBytes ) {
block = s [ i ] ;
if ( extraBytes > 0 ) {
hex += HEX _CHARS [ ( block >> 4 ) & 0x0F ] + HEX _CHARS [ block & 0x0F ] ;
}
if ( extraBytes > 1 ) {
hex += HEX _CHARS [ ( block >> 12 ) & 0x0F ] + HEX _CHARS [ ( block >> 8 ) & 0x0F ] ;
}
if ( extraBytes > 2 ) {
hex += HEX _CHARS [ ( block >> 20 ) & 0x0F ] + HEX _CHARS [ ( block >> 16 ) & 0x0F ] ;
}
}
return hex ;
} ;
Keccak . prototype . arrayBuffer = function ( ) {
this . finalize ( ) ;
var blockCount = this . blockCount , s = this . s , outputBlocks = this . outputBlocks ,
extraBytes = this . extraBytes , i = 0 , j = 0 ;
var bytes = this . outputBits >> 3 ;
var buffer ;
if ( extraBytes ) {
buffer = new ArrayBuffer ( ( outputBlocks + 1 ) << 2 ) ;
} else {
buffer = new ArrayBuffer ( bytes ) ;
}
var array = new Uint32Array ( buffer ) ;
while ( j < outputBlocks ) {
for ( i = 0 ; i < blockCount && j < outputBlocks ; ++ i , ++ j ) {
array [ j ] = s [ i ] ;
}
if ( j % blockCount === 0 ) {
f ( s ) ;
}
}
if ( extraBytes ) {
array [ i ] = s [ i ] ;
buffer = buffer . slice ( 0 , bytes ) ;
}
return buffer ;
} ;
Keccak . prototype . buffer = Keccak . prototype . arrayBuffer ;
Keccak . prototype . digest = Keccak . prototype . array = function ( ) {
this . finalize ( ) ;
var blockCount = this . blockCount , s = this . s , outputBlocks = this . outputBlocks ,
extraBytes = this . extraBytes , i = 0 , j = 0 ;
var array = [ ] , offset , block ;
while ( j < outputBlocks ) {
for ( i = 0 ; i < blockCount && j < outputBlocks ; ++ i , ++ j ) {
offset = j << 2 ;
block = s [ i ] ;
array [ offset ] = block & 0xFF ;
array [ offset + 1 ] = ( block >> 8 ) & 0xFF ;
array [ offset + 2 ] = ( block >> 16 ) & 0xFF ;
array [ offset + 3 ] = ( block >> 24 ) & 0xFF ;
}
if ( j % blockCount === 0 ) {
f ( s ) ;
}
}
if ( extraBytes ) {
offset = j << 2 ;
block = s [ i ] ;
if ( extraBytes > 0 ) {
array [ offset ] = block & 0xFF ;
}
if ( extraBytes > 1 ) {
array [ offset + 1 ] = ( block >> 8 ) & 0xFF ;
}
if ( extraBytes > 2 ) {
array [ offset + 2 ] = ( block >> 16 ) & 0xFF ;
}
}
return array ;
} ;
var f = function ( s ) {
var h , l , n , c0 , c1 , c2 , c3 , c4 , c5 , c6 , c7 , c8 , c9 ,
b0 , b1 , b2 , b3 , b4 , b5 , b6 , b7 , b8 , b9 , b10 , b11 , b12 , b13 , b14 , b15 , b16 , b17 ,
b18 , b19 , b20 , b21 , b22 , b23 , b24 , b25 , b26 , b27 , b28 , b29 , b30 , b31 , b32 , b33 ,
b34 , b35 , b36 , b37 , b38 , b39 , b40 , b41 , b42 , b43 , b44 , b45 , b46 , b47 , b48 , b49 ;
for ( n = 0 ; n < 48 ; n += 2 ) {
c0 = s [ 0 ] ^ s [ 10 ] ^ s [ 20 ] ^ s [ 30 ] ^ s [ 40 ] ;
c1 = s [ 1 ] ^ s [ 11 ] ^ s [ 21 ] ^ s [ 31 ] ^ s [ 41 ] ;
c2 = s [ 2 ] ^ s [ 12 ] ^ s [ 22 ] ^ s [ 32 ] ^ s [ 42 ] ;
c3 = s [ 3 ] ^ s [ 13 ] ^ s [ 23 ] ^ s [ 33 ] ^ s [ 43 ] ;
c4 = s [ 4 ] ^ s [ 14 ] ^ s [ 24 ] ^ s [ 34 ] ^ s [ 44 ] ;
c5 = s [ 5 ] ^ s [ 15 ] ^ s [ 25 ] ^ s [ 35 ] ^ s [ 45 ] ;
c6 = s [ 6 ] ^ s [ 16 ] ^ s [ 26 ] ^ s [ 36 ] ^ s [ 46 ] ;
c7 = s [ 7 ] ^ s [ 17 ] ^ s [ 27 ] ^ s [ 37 ] ^ s [ 47 ] ;
c8 = s [ 8 ] ^ s [ 18 ] ^ s [ 28 ] ^ s [ 38 ] ^ s [ 48 ] ;
c9 = s [ 9 ] ^ s [ 19 ] ^ s [ 29 ] ^ s [ 39 ] ^ s [ 49 ] ;
h = c8 ^ ( ( c2 << 1 ) | ( c3 >>> 31 ) ) ;
l = c9 ^ ( ( c3 << 1 ) | ( c2 >>> 31 ) ) ;
s [ 0 ] ^= h ;
s [ 1 ] ^= l ;
s [ 10 ] ^= h ;
s [ 11 ] ^= l ;
s [ 20 ] ^= h ;
s [ 21 ] ^= l ;
s [ 30 ] ^= h ;
s [ 31 ] ^= l ;
s [ 40 ] ^= h ;
s [ 41 ] ^= l ;
h = c0 ^ ( ( c4 << 1 ) | ( c5 >>> 31 ) ) ;
l = c1 ^ ( ( c5 << 1 ) | ( c4 >>> 31 ) ) ;
s [ 2 ] ^= h ;
s [ 3 ] ^= l ;
s [ 12 ] ^= h ;
s [ 13 ] ^= l ;
s [ 22 ] ^= h ;
s [ 23 ] ^= l ;
s [ 32 ] ^= h ;
s [ 33 ] ^= l ;
s [ 42 ] ^= h ;
s [ 43 ] ^= l ;
h = c2 ^ ( ( c6 << 1 ) | ( c7 >>> 31 ) ) ;
l = c3 ^ ( ( c7 << 1 ) | ( c6 >>> 31 ) ) ;
s [ 4 ] ^= h ;
s [ 5 ] ^= l ;
s [ 14 ] ^= h ;
s [ 15 ] ^= l ;
s [ 24 ] ^= h ;
s [ 25 ] ^= l ;
s [ 34 ] ^= h ;
s [ 35 ] ^= l ;
s [ 44 ] ^= h ;
s [ 45 ] ^= l ;
h = c4 ^ ( ( c8 << 1 ) | ( c9 >>> 31 ) ) ;
l = c5 ^ ( ( c9 << 1 ) | ( c8 >>> 31 ) ) ;
s [ 6 ] ^= h ;
s [ 7 ] ^= l ;
s [ 16 ] ^= h ;
s [ 17 ] ^= l ;
s [ 26 ] ^= h ;
s [ 27 ] ^= l ;
s [ 36 ] ^= h ;
s [ 37 ] ^= l ;
s [ 46 ] ^= h ;
s [ 47 ] ^= l ;
h = c6 ^ ( ( c0 << 1 ) | ( c1 >>> 31 ) ) ;
l = c7 ^ ( ( c1 << 1 ) | ( c0 >>> 31 ) ) ;
s [ 8 ] ^= h ;
s [ 9 ] ^= l ;
s [ 18 ] ^= h ;
s [ 19 ] ^= l ;
s [ 28 ] ^= h ;
s [ 29 ] ^= l ;
s [ 38 ] ^= h ;
s [ 39 ] ^= l ;
s [ 48 ] ^= h ;
s [ 49 ] ^= l ;
b0 = s [ 0 ] ;
b1 = s [ 1 ] ;
b32 = ( s [ 11 ] << 4 ) | ( s [ 10 ] >>> 28 ) ;
b33 = ( s [ 10 ] << 4 ) | ( s [ 11 ] >>> 28 ) ;
b14 = ( s [ 20 ] << 3 ) | ( s [ 21 ] >>> 29 ) ;
b15 = ( s [ 21 ] << 3 ) | ( s [ 20 ] >>> 29 ) ;
b46 = ( s [ 31 ] << 9 ) | ( s [ 30 ] >>> 23 ) ;
b47 = ( s [ 30 ] << 9 ) | ( s [ 31 ] >>> 23 ) ;
b28 = ( s [ 40 ] << 18 ) | ( s [ 41 ] >>> 14 ) ;
b29 = ( s [ 41 ] << 18 ) | ( s [ 40 ] >>> 14 ) ;
b20 = ( s [ 2 ] << 1 ) | ( s [ 3 ] >>> 31 ) ;
b21 = ( s [ 3 ] << 1 ) | ( s [ 2 ] >>> 31 ) ;
b2 = ( s [ 13 ] << 12 ) | ( s [ 12 ] >>> 20 ) ;
b3 = ( s [ 12 ] << 12 ) | ( s [ 13 ] >>> 20 ) ;
b34 = ( s [ 22 ] << 10 ) | ( s [ 23 ] >>> 22 ) ;
b35 = ( s [ 23 ] << 10 ) | ( s [ 22 ] >>> 22 ) ;
b16 = ( s [ 33 ] << 13 ) | ( s [ 32 ] >>> 19 ) ;
b17 = ( s [ 32 ] << 13 ) | ( s [ 33 ] >>> 19 ) ;
b48 = ( s [ 42 ] << 2 ) | ( s [ 43 ] >>> 30 ) ;
b49 = ( s [ 43 ] << 2 ) | ( s [ 42 ] >>> 30 ) ;
b40 = ( s [ 5 ] << 30 ) | ( s [ 4 ] >>> 2 ) ;
b41 = ( s [ 4 ] << 30 ) | ( s [ 5 ] >>> 2 ) ;
b22 = ( s [ 14 ] << 6 ) | ( s [ 15 ] >>> 26 ) ;
b23 = ( s [ 15 ] << 6 ) | ( s [ 14 ] >>> 26 ) ;
b4 = ( s [ 25 ] << 11 ) | ( s [ 24 ] >>> 21 ) ;
b5 = ( s [ 24 ] << 11 ) | ( s [ 25 ] >>> 21 ) ;
b36 = ( s [ 34 ] << 15 ) | ( s [ 35 ] >>> 17 ) ;
b37 = ( s [ 35 ] << 15 ) | ( s [ 34 ] >>> 17 ) ;
b18 = ( s [ 45 ] << 29 ) | ( s [ 44 ] >>> 3 ) ;
b19 = ( s [ 44 ] << 29 ) | ( s [ 45 ] >>> 3 ) ;
b10 = ( s [ 6 ] << 28 ) | ( s [ 7 ] >>> 4 ) ;
b11 = ( s [ 7 ] << 28 ) | ( s [ 6 ] >>> 4 ) ;
b42 = ( s [ 17 ] << 23 ) | ( s [ 16 ] >>> 9 ) ;
b43 = ( s [ 16 ] << 23 ) | ( s [ 17 ] >>> 9 ) ;
b24 = ( s [ 26 ] << 25 ) | ( s [ 27 ] >>> 7 ) ;
b25 = ( s [ 27 ] << 25 ) | ( s [ 26 ] >>> 7 ) ;
b6 = ( s [ 36 ] << 21 ) | ( s [ 37 ] >>> 11 ) ;
b7 = ( s [ 37 ] << 21 ) | ( s [ 36 ] >>> 11 ) ;
b38 = ( s [ 47 ] << 24 ) | ( s [ 46 ] >>> 8 ) ;
b39 = ( s [ 46 ] << 24 ) | ( s [ 47 ] >>> 8 ) ;
b30 = ( s [ 8 ] << 27 ) | ( s [ 9 ] >>> 5 ) ;
b31 = ( s [ 9 ] << 27 ) | ( s [ 8 ] >>> 5 ) ;
b12 = ( s [ 18 ] << 20 ) | ( s [ 19 ] >>> 12 ) ;
b13 = ( s [ 19 ] << 20 ) | ( s [ 18 ] >>> 12 ) ;
b44 = ( s [ 29 ] << 7 ) | ( s [ 28 ] >>> 25 ) ;
b45 = ( s [ 28 ] << 7 ) | ( s [ 29 ] >>> 25 ) ;
b26 = ( s [ 38 ] << 8 ) | ( s [ 39 ] >>> 24 ) ;
b27 = ( s [ 39 ] << 8 ) | ( s [ 38 ] >>> 24 ) ;
b8 = ( s [ 48 ] << 14 ) | ( s [ 49 ] >>> 18 ) ;
b9 = ( s [ 49 ] << 14 ) | ( s [ 48 ] >>> 18 ) ;
s [ 0 ] = b0 ^ ( ~ b2 & b4 ) ;
s [ 1 ] = b1 ^ ( ~ b3 & b5 ) ;
s [ 10 ] = b10 ^ ( ~ b12 & b14 ) ;
s [ 11 ] = b11 ^ ( ~ b13 & b15 ) ;
s [ 20 ] = b20 ^ ( ~ b22 & b24 ) ;
s [ 21 ] = b21 ^ ( ~ b23 & b25 ) ;
s [ 30 ] = b30 ^ ( ~ b32 & b34 ) ;
s [ 31 ] = b31 ^ ( ~ b33 & b35 ) ;
s [ 40 ] = b40 ^ ( ~ b42 & b44 ) ;
s [ 41 ] = b41 ^ ( ~ b43 & b45 ) ;
s [ 2 ] = b2 ^ ( ~ b4 & b6 ) ;
s [ 3 ] = b3 ^ ( ~ b5 & b7 ) ;
s [ 12 ] = b12 ^ ( ~ b14 & b16 ) ;
s [ 13 ] = b13 ^ ( ~ b15 & b17 ) ;
s [ 22 ] = b22 ^ ( ~ b24 & b26 ) ;
s [ 23 ] = b23 ^ ( ~ b25 & b27 ) ;
s [ 32 ] = b32 ^ ( ~ b34 & b36 ) ;
s [ 33 ] = b33 ^ ( ~ b35 & b37 ) ;
s [ 42 ] = b42 ^ ( ~ b44 & b46 ) ;
s [ 43 ] = b43 ^ ( ~ b45 & b47 ) ;
s [ 4 ] = b4 ^ ( ~ b6 & b8 ) ;
s [ 5 ] = b5 ^ ( ~ b7 & b9 ) ;
s [ 14 ] = b14 ^ ( ~ b16 & b18 ) ;
s [ 15 ] = b15 ^ ( ~ b17 & b19 ) ;
s [ 24 ] = b24 ^ ( ~ b26 & b28 ) ;
s [ 25 ] = b25 ^ ( ~ b27 & b29 ) ;
s [ 34 ] = b34 ^ ( ~ b36 & b38 ) ;
s [ 35 ] = b35 ^ ( ~ b37 & b39 ) ;
s [ 44 ] = b44 ^ ( ~ b46 & b48 ) ;
s [ 45 ] = b45 ^ ( ~ b47 & b49 ) ;
s [ 6 ] = b6 ^ ( ~ b8 & b0 ) ;
s [ 7 ] = b7 ^ ( ~ b9 & b1 ) ;
s [ 16 ] = b16 ^ ( ~ b18 & b10 ) ;
s [ 17 ] = b17 ^ ( ~ b19 & b11 ) ;
s [ 26 ] = b26 ^ ( ~ b28 & b20 ) ;
s [ 27 ] = b27 ^ ( ~ b29 & b21 ) ;
s [ 36 ] = b36 ^ ( ~ b38 & b30 ) ;
s [ 37 ] = b37 ^ ( ~ b39 & b31 ) ;
s [ 46 ] = b46 ^ ( ~ b48 & b40 ) ;
s [ 47 ] = b47 ^ ( ~ b49 & b41 ) ;
s [ 8 ] = b8 ^ ( ~ b0 & b2 ) ;
s [ 9 ] = b9 ^ ( ~ b1 & b3 ) ;
s [ 18 ] = b18 ^ ( ~ b10 & b12 ) ;
s [ 19 ] = b19 ^ ( ~ b11 & b13 ) ;
s [ 28 ] = b28 ^ ( ~ b20 & b22 ) ;
s [ 29 ] = b29 ^ ( ~ b21 & b23 ) ;
s [ 38 ] = b38 ^ ( ~ b30 & b32 ) ;
s [ 39 ] = b39 ^ ( ~ b31 & b33 ) ;
s [ 48 ] = b48 ^ ( ~ b40 & b42 ) ;
s [ 49 ] = b49 ^ ( ~ b41 & b43 ) ;
s [ 0 ] ^= RC [ n ] ;
s [ 1 ] ^= RC [ n + 1 ] ;
}
} ;
if ( COMMON _JS ) {
module . exports = methods ;
} else {
for ( var i = 0 ; i < methodNames . length ; ++ i ) {
root [ methodNames [ i ] ] = methods [ methodNames [ i ] ] ;
}
}
} ) ( ) ;
2017-05-05 17:24:23 +02:00
/* WEBPACK VAR INJECTION */ } . call ( exports , _ _webpack _require _ _ ( 13 ) , _ _webpack _require _ _ ( 14 ) ) )
2017-04-26 15:58:19 +02:00
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 25 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-10 09:36:07 +02:00
var _ _WEBPACK _AMD _DEFINE _RESULT _ _ ; /* globals window, exports, define */
2017-04-26 15:58:19 +02:00
( function ( window ) {
2017-05-10 09:36:07 +02:00
'use strict'
2017-04-26 15:58:19 +02:00
var re = {
not _string : /[^s]/ ,
2017-05-10 09:36:07 +02:00
not _bool : /[^t]/ ,
not _type : /[^T]/ ,
not _primitive : /[^v]/ ,
2017-04-26 15:58:19 +02:00
number : /[diefg]/ ,
2017-05-10 09:36:07 +02:00
numeric _arg : /[bcdiefguxX]/ ,
2017-04-26 15:58:19 +02:00
json : /[j]/ ,
not _json : /[^j]/ ,
text : /^[^\x25]+/ ,
modulo : /^\x25{2}/ ,
2017-05-10 09:36:07 +02:00
placeholder : /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/ ,
2017-04-26 15:58:19 +02:00
key : /^([a-z_][a-z_\d]*)/i ,
key _access : /^\.([a-z_][a-z_\d]*)/i ,
index _access : /^\[(\d+)\]/ ,
sign : /^[\+\-]/
}
function sprintf ( ) {
var key = arguments [ 0 ] , cache = sprintf . cache
2017-05-10 09:36:07 +02:00
if ( ! ( cache [ key ] ) ) {
2017-04-26 15:58:19 +02:00
cache [ key ] = sprintf . parse ( key )
}
return sprintf . format . call ( null , cache [ key ] , arguments )
}
sprintf . format = function ( parse _tree , argv ) {
2017-05-10 09:36:07 +02:00
var cursor = 1 , tree _length = parse _tree . length , node _type = '' , arg , output = [ ] , i , k , match , pad , pad _character , pad _length , is _positive = true , sign = ''
2017-04-26 15:58:19 +02:00
for ( i = 0 ; i < tree _length ; i ++ ) {
node _type = get _type ( parse _tree [ i ] )
2017-05-10 09:36:07 +02:00
if ( node _type === 'string' ) {
2017-04-26 15:58:19 +02:00
output [ output . length ] = parse _tree [ i ]
}
2017-05-10 09:36:07 +02:00
else if ( node _type === 'array' ) {
2017-04-26 15:58:19 +02:00
match = parse _tree [ i ] // convenience purposes only
if ( match [ 2 ] ) { // keyword argument
arg = argv [ cursor ]
for ( k = 0 ; k < match [ 2 ] . length ; k ++ ) {
if ( ! arg . hasOwnProperty ( match [ 2 ] [ k ] ) ) {
2017-05-10 09:36:07 +02:00
throw new Error ( sprintf ( '[sprintf] property "%s" does not exist' , match [ 2 ] [ k ] ) )
2017-04-26 15:58:19 +02:00
}
arg = arg [ match [ 2 ] [ k ] ]
}
}
else if ( match [ 1 ] ) { // positional argument (explicit)
arg = argv [ match [ 1 ] ]
}
else { // positional argument (implicit)
arg = argv [ cursor ++ ]
}
2017-05-10 09:36:07 +02:00
if ( re . not _type . test ( match [ 8 ] ) && re . not _primitive . test ( match [ 8 ] ) && get _type ( arg ) == 'function' ) {
2017-04-26 15:58:19 +02:00
arg = arg ( )
}
2017-05-10 09:36:07 +02:00
if ( re . numeric _arg . test ( match [ 8 ] ) && ( get _type ( arg ) != 'number' && isNaN ( arg ) ) ) {
2017-04-26 15:58:19 +02:00
throw new TypeError ( sprintf ( "[sprintf] expecting number but found %s" , get _type ( arg ) ) )
}
if ( re . number . test ( match [ 8 ] ) ) {
is _positive = arg >= 0
}
switch ( match [ 8 ] ) {
2017-05-10 09:36:07 +02:00
case 'b' :
arg = parseInt ( arg , 10 ) . toString ( 2 )
2017-04-26 15:58:19 +02:00
break
2017-05-10 09:36:07 +02:00
case 'c' :
arg = String . fromCharCode ( parseInt ( arg , 10 ) )
2017-04-26 15:58:19 +02:00
break
2017-05-10 09:36:07 +02:00
case 'd' :
case 'i' :
2017-04-26 15:58:19 +02:00
arg = parseInt ( arg , 10 )
break
2017-05-10 09:36:07 +02:00
case 'j' :
2017-04-26 15:58:19 +02:00
arg = JSON . stringify ( arg , null , match [ 6 ] ? parseInt ( match [ 6 ] ) : 0 )
break
2017-05-10 09:36:07 +02:00
case 'e' :
arg = match [ 7 ] ? parseFloat ( arg ) . toExponential ( match [ 7 ] ) : parseFloat ( arg ) . toExponential ( )
2017-04-26 15:58:19 +02:00
break
2017-05-10 09:36:07 +02:00
case 'f' :
2017-04-26 15:58:19 +02:00
arg = match [ 7 ] ? parseFloat ( arg ) . toFixed ( match [ 7 ] ) : parseFloat ( arg )
break
2017-05-10 09:36:07 +02:00
case 'g' :
2017-04-26 15:58:19 +02:00
arg = match [ 7 ] ? parseFloat ( arg ) . toPrecision ( match [ 7 ] ) : parseFloat ( arg )
break
2017-05-10 09:36:07 +02:00
case 'o' :
2017-04-26 15:58:19 +02:00
arg = arg . toString ( 8 )
break
2017-05-10 09:36:07 +02:00
case 's' :
arg = String ( arg )
arg = ( match [ 7 ] ? arg . substring ( 0 , match [ 7 ] ) : arg )
2017-04-26 15:58:19 +02:00
break
2017-05-10 09:36:07 +02:00
case 't' :
arg = String ( ! ! arg )
arg = ( match [ 7 ] ? arg . substring ( 0 , match [ 7 ] ) : arg )
2017-04-26 15:58:19 +02:00
break
2017-05-10 09:36:07 +02:00
case 'T' :
arg = get _type ( arg )
arg = ( match [ 7 ] ? arg . substring ( 0 , match [ 7 ] ) : arg )
2017-04-26 15:58:19 +02:00
break
2017-05-10 09:36:07 +02:00
case 'u' :
arg = parseInt ( arg , 10 ) >>> 0
break
case 'v' :
arg = arg . valueOf ( )
arg = ( match [ 7 ] ? arg . substring ( 0 , match [ 7 ] ) : arg )
break
case 'x' :
arg = parseInt ( arg , 10 ) . toString ( 16 )
break
case 'X' :
arg = parseInt ( arg , 10 ) . toString ( 16 ) . toUpperCase ( )
2017-04-26 15:58:19 +02:00
break
}
if ( re . json . test ( match [ 8 ] ) ) {
output [ output . length ] = arg
}
else {
if ( re . number . test ( match [ 8 ] ) && ( ! is _positive || match [ 3 ] ) ) {
2017-05-10 09:36:07 +02:00
sign = is _positive ? '+' : '-'
arg = arg . toString ( ) . replace ( re . sign , '' )
2017-04-26 15:58:19 +02:00
}
else {
2017-05-10 09:36:07 +02:00
sign = ''
2017-04-26 15:58:19 +02:00
}
2017-05-10 09:36:07 +02:00
pad _character = match [ 4 ] ? match [ 4 ] === '0' ? '0' : match [ 4 ] . charAt ( 1 ) : ' '
2017-04-26 15:58:19 +02:00
pad _length = match [ 6 ] - ( sign + arg ) . length
2017-05-10 09:36:07 +02:00
pad = match [ 6 ] ? ( pad _length > 0 ? str _repeat ( pad _character , pad _length ) : '' ) : ''
output [ output . length ] = match [ 5 ] ? sign + arg + pad : ( pad _character === '0' ? sign + pad + arg : pad + sign + arg )
2017-04-26 15:58:19 +02:00
}
}
}
2017-05-10 09:36:07 +02:00
return output . join ( '' )
2017-04-26 15:58:19 +02:00
}
2017-05-10 09:36:07 +02:00
sprintf . cache = Object . create ( null )
2017-04-26 15:58:19 +02:00
sprintf . parse = function ( fmt ) {
var _fmt = fmt , match = [ ] , parse _tree = [ ] , arg _names = 0
while ( _fmt ) {
if ( ( match = re . text . exec ( _fmt ) ) !== null ) {
parse _tree [ parse _tree . length ] = match [ 0 ]
}
else if ( ( match = re . modulo . exec ( _fmt ) ) !== null ) {
2017-05-10 09:36:07 +02:00
parse _tree [ parse _tree . length ] = '%'
2017-04-26 15:58:19 +02:00
}
else if ( ( match = re . placeholder . exec ( _fmt ) ) !== null ) {
if ( match [ 2 ] ) {
arg _names |= 1
var field _list = [ ] , replacement _field = match [ 2 ] , field _match = [ ]
if ( ( field _match = re . key . exec ( replacement _field ) ) !== null ) {
field _list [ field _list . length ] = field _match [ 1 ]
2017-05-10 09:36:07 +02:00
while ( ( replacement _field = replacement _field . substring ( field _match [ 0 ] . length ) ) !== '' ) {
2017-04-26 15:58:19 +02:00
if ( ( field _match = re . key _access . exec ( replacement _field ) ) !== null ) {
field _list [ field _list . length ] = field _match [ 1 ]
}
else if ( ( field _match = re . index _access . exec ( replacement _field ) ) !== null ) {
field _list [ field _list . length ] = field _match [ 1 ]
}
else {
throw new SyntaxError ( "[sprintf] failed to parse named argument key" )
}
}
}
else {
throw new SyntaxError ( "[sprintf] failed to parse named argument key" )
}
match [ 2 ] = field _list
}
else {
arg _names |= 2
}
if ( arg _names === 3 ) {
throw new Error ( "[sprintf] mixing positional and named placeholders is not (yet) supported" )
}
parse _tree [ parse _tree . length ] = match
}
else {
throw new SyntaxError ( "[sprintf] unexpected placeholder" )
}
_fmt = _fmt . substring ( match [ 0 ] . length )
}
return parse _tree
}
var vsprintf = function ( fmt , argv , _argv ) {
_argv = ( argv || [ ] ) . slice ( 0 )
_argv . splice ( 0 , 0 , fmt )
return sprintf . apply ( null , _argv )
}
/ * *
* helpers
* /
function get _type ( variable ) {
2017-05-10 09:36:07 +02:00
if ( typeof variable === 'number' ) {
return 'number'
}
else if ( typeof variable === 'string' ) {
return 'string'
}
else {
return Object . prototype . toString . call ( variable ) . slice ( 8 , - 1 ) . toLowerCase ( )
}
2017-04-26 15:58:19 +02:00
}
2017-05-10 09:36:07 +02:00
var preformattedPadding = {
'0' : [ '' , '0' , '00' , '000' , '0000' , '00000' , '000000' , '0000000' ] ,
' ' : [ '' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' ] ,
'_' : [ '' , '_' , '__' , '___' , '____' , '_____' , '______' , '_______' ] ,
}
2017-04-26 15:58:19 +02:00
function str _repeat ( input , multiplier ) {
2017-05-10 09:36:07 +02:00
if ( multiplier >= 0 && multiplier <= 7 && preformattedPadding [ input ] ) {
return preformattedPadding [ input ] [ multiplier ]
}
2017-04-26 15:58:19 +02:00
return Array ( multiplier + 1 ) . join ( input )
}
/ * *
* export to either browser or node . js
* /
if ( true ) {
exports . sprintf = sprintf
exports . vsprintf = vsprintf
}
2017-05-10 09:36:07 +02:00
if ( typeof window !== 'undefined' ) {
2017-04-26 15:58:19 +02:00
window . sprintf = sprintf
window . vsprintf = vsprintf
2017-05-10 09:36:07 +02:00
if ( true ) {
! ( _ _WEBPACK _AMD _DEFINE _RESULT _ _ = function ( ) {
2017-04-26 15:58:19 +02:00
return {
sprintf : sprintf ,
vsprintf : vsprintf
}
2017-05-10 09:36:07 +02:00
} . call ( exports , _ _webpack _require _ _ , exports , module ) ,
_ _WEBPACK _AMD _DEFINE _RESULT _ _ !== undefined && ( module . exports = _ _WEBPACK _AMD _DEFINE _RESULT _ _ ) )
2017-04-26 15:58:19 +02:00
}
}
2017-05-10 09:36:07 +02:00
} ) ( typeof window === 'undefined' ? this : window ) ;
2017-04-26 15:58:19 +02:00
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 26 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( _ _webpack _exports _ _ , "__esModule" , { value : true } ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _Ed25519Keypair _ _ = _ _webpack _require _ _ ( 27 ) ;
2017-04-26 15:58:19 +02:00
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Ed25519Keypair" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _0 _ _Ed25519Keypair _ _ [ "a" ] ; } ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _transaction _ _ = _ _webpack _require _ _ ( 42 ) ;
2017-04-26 15:58:19 +02:00
/* harmony reexport (module object) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Transaction" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _1 _ _transaction _ _ ; } ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _ _connection _ _ = _ _webpack _require _ _ ( 30 ) ;
2017-04-26 15:58:19 +02:00
/* harmony reexport (module object) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Connection" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _2 _ _connection _ _ ; } ) ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 27 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = Ed25519Keypair ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ = _ _webpack _require _ _ ( 3 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _tweetnacl _ _ = _ _webpack _require _ _ ( 92 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _tweetnacl _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _1 _tweetnacl _ _ ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _js _sha3 _ _ = _ _webpack _require _ _ ( 24 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _js _sha3 _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _2 _js _sha3 _ _ ) ;
/ * *
2017-05-05 17:24:23 +02:00
* @ public
2017-04-26 15:58:19 +02:00
* @ class Keypair Ed25519 keypair in base58 ( as BigchainDB expects base58 keys )
* @ type { Object }
2017-05-05 17:24:23 +02:00
* @ param { number } [ secret ] A seed that will be used as a key derivation function
2017-04-26 15:58:19 +02:00
* @ property { string } publicKey
* @ property { string } privateKey
* /
function Ed25519Keypair ( secret ) {
var keyPair = void 0 ;
if ( secret ) {
// Quick and dirty: use key derivation function instead
var secretHash = _ _WEBPACK _IMPORTED _MODULE _2 _js _sha3 _ _ _default . a . sha3 _256 . create ( ) . update ( secret ) . array ( ) ;
keyPair = _ _WEBPACK _IMPORTED _MODULE _1 _tweetnacl _ _ _default . a . sign . keyPair . fromSeed ( new Uint8Array ( secretHash ) ) ;
} else {
keyPair = _ _WEBPACK _IMPORTED _MODULE _1 _tweetnacl _ _ _default . a . sign . keyPair ( ) ;
}
this . publicKey = _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ _default . a . encode ( keyPair . publicKey ) ;
// tweetnacl's generated secret key is the secret key + public key (resulting in a 64-byte buffer)
this . privateKey = _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ _default . a . encode ( keyPair . secretKey . slice ( 0 , 32 ) ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 28 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* WEBPACK VAR INJECTION */ ( function ( process ) { /* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = baseRequest ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _es6 _promise _ _ = _ _webpack _require _ _ ( 81 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _es6 _promise _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _0 _es6 _promise _ _ ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _fetch _ponyfill _ _ = _ _webpack _require _ _ ( 82 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _fetch _ponyfill _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _1 _fetch _ponyfill _ _ ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _sprintf _js _ _ = _ _webpack _require _ _ ( 25 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _sprintf _js _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _2 _sprintf _js _ _ ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _3 _ _format _text _ _ = _ _webpack _require _ _ ( 37 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _4 _ _stringify _as _query _param _ _ = _ _webpack _require _ _ ( 40 ) ;
2017-04-26 15:58:19 +02:00
var _typeof = typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ? function ( obj ) { return typeof obj ; } : function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ;
function _objectWithoutProperties ( obj , keys ) { var target = { } ; for ( var i in obj ) { if ( keys . indexOf ( i ) >= 0 ) continue ; if ( ! Object . prototype . hasOwnProperty . call ( obj , i ) ) continue ; target [ i ] = obj [ i ] ; } return target ; }
var fetch = _ _WEBPACK _IMPORTED _MODULE _1 _fetch _ponyfill _ _ _default ( ) ( _ _WEBPACK _IMPORTED _MODULE _0 _es6 _promise _ _ [ "Promise" ] ) ;
/ * *
* imported from https : //github.com/bigchaindb/js-utility-belt/
*
* Global fetch wrapper that adds some basic error handling and ease of use enhancements .
* Considers any non - 2 xx response as an error .
*
* For more information on fetch , see https : //developer.mozilla.org/en-US/docs/Web/API/GlobalFetch/fetch.
*
* Expects fetch to already be available ( either in a ES6 environment , bundled through webpack , or
* injected through a polyfill ) .
*
* @ param { string } url Url to request . Can be specified as a sprintf format string ( see
* https : //github.com/alexei/sprintf.js) that will be resolved using
* ` config.urlTemplateSpec ` .
* @ param { object } config Additional configuration , mostly passed to fetch as its 'init' config
* ( see https : //developer.mozilla.org/en-US/docs/Web/API/GlobalFetch/fetch#Parameters).
* @ param { * } config . jsonBody Json payload to the request . Will automatically be
* JSON . stringify ( ) - ed and override ` config.body ` .
* @ param { string | object } config . query Query parameter to append to the end of the url .
* If specified as an object , keys will be
* decamelized into snake case first .
* @ param { * [ ] | object } config . urlTemplateSpec Format spec to use to expand the url ( see sprintf ) .
* @ param { * } config . * All other options are passed through to fetch .
*
* @ return { Promise } Promise that will resolve with the response if its status was 2 xx ;
* otherwise rejects with the response
* /
function baseRequest ( url ) {
var _ref = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { } ;
var jsonBody = _ref . jsonBody ,
query = _ref . query ,
urlTemplateSpec = _ref . urlTemplateSpec ,
fetchConfig = _objectWithoutProperties ( _ref , [ 'jsonBody' , 'query' , 'urlTemplateSpec' ] ) ;
var expandedUrl = url ;
if ( urlTemplateSpec != null ) {
if ( Array . isArray ( urlTemplateSpec ) && urlTemplateSpec . length ) {
// Use vsprintf for the array call signature
expandedUrl = _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _2 _sprintf _js _ _ [ "vsprintf" ] ) ( url , urlTemplateSpec ) ;
} else if ( urlTemplateSpec && ( typeof urlTemplateSpec === 'undefined' ? 'undefined' : _typeof ( urlTemplateSpec ) ) === 'object' && Object . keys ( urlTemplateSpec ) . length ) {
expandedUrl = _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _3 _ _format _text _ _ [ "a" /* default */ ] ) ( url , urlTemplateSpec ) ;
} else if ( process . env . NODE _ENV !== 'production' ) {
// eslint-disable-next-line no-console
console . warn ( 'Supplied urlTemplateSpec was not an array or object. Ignoring...' ) ;
}
}
if ( query != null ) {
if ( typeof query === 'string' ) {
expandedUrl += query ;
} else if ( query && ( typeof query === 'undefined' ? 'undefined' : _typeof ( query ) ) === 'object' ) {
expandedUrl += _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _4 _ _stringify _as _query _param _ _ [ "a" /* default */ ] ) ( query ) ;
} else if ( process . env . NODE _ENV !== 'production' ) {
// eslint-disable-next-line no-console
console . warn ( 'Supplied query was not a string or object. Ignoring...' ) ;
}
}
if ( jsonBody != null ) {
fetchConfig . body = JSON . stringify ( jsonBody ) ;
}
return fetch . fetch ( expandedUrl , fetchConfig ) . then ( function ( res ) {
// If status is not a 2xx (based on Response.ok), assume it's an error
// See https://developer.mozilla.org/en-US/docs/Web/API/GlobalFetch/fetch
if ( ! ( res && res . ok ) ) {
throw res ;
}
return res ;
} ) ;
}
2017-05-05 17:24:23 +02:00
/* WEBPACK VAR INJECTION */ } . call ( _ _webpack _exports _ _ , _ _webpack _require _ _ ( 13 ) ) )
2017-04-26 15:58:19 +02:00
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 29 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = getBlock ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ = _ _webpack _require _ _ ( 0 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ = _ _webpack _require _ _ ( 1 ) ;
2017-05-05 17:24:23 +02:00
/ * *
* @ public
* @ param blockId
* @ param API _PATH
* /
2017-04-26 15:58:19 +02:00
function getBlock ( blockId , API _PATH ) {
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ [ "a" /* default */ ] ) ( _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ [ "a" /* default */ ] ) ( API _PATH ) [ 'blocks_detail' ] , {
urlTemplateSpec : {
blockId : blockId
}
} ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 30 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( _ _webpack _exports _ _ , "__esModule" , { value : true } ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _getBlock _ _ = _ _webpack _require _ _ ( 29 ) ;
2017-04-26 15:58:19 +02:00
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "getBlock" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _0 _ _getBlock _ _ [ "a" ] ; } ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _getTransaction _ _ = _ _webpack _require _ _ ( 16 ) ;
2017-04-26 15:58:19 +02:00
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "getTransaction" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _1 _ _getTransaction _ _ [ "a" ] ; } ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _ _getStatus _ _ = _ _webpack _require _ _ ( 15 ) ;
2017-04-26 15:58:19 +02:00
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "getStatus" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _2 _ _getStatus _ _ [ "a" ] ; } ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _3 _ _listBlocks _ _ = _ _webpack _require _ _ ( 31 ) ;
2017-04-26 15:58:19 +02:00
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "listBlocks" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _3 _ _listBlocks _ _ [ "a" ] ; } ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _4 _ _listOutputs _ _ = _ _webpack _require _ _ ( 32 ) ;
2017-04-26 15:58:19 +02:00
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "listOutputs" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _4 _ _listOutputs _ _ [ "a" ] ; } ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _5 _ _listTransactions _ _ = _ _webpack _require _ _ ( 33 ) ;
2017-04-26 15:58:19 +02:00
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "listTransactions" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _5 _ _listTransactions _ _ [ "a" ] ; } ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _6 _ _listVotes _ _ = _ _webpack _require _ _ ( 34 ) ;
2017-04-26 15:58:19 +02:00
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "listVotes" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _6 _ _listVotes _ _ [ "a" ] ; } ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _7 _ _pollStatusAndFetchTransaction _ _ = _ _webpack _require _ _ ( 35 ) ;
2017-04-26 15:58:19 +02:00
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "pollStatusAndFetchTransaction" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _7 _ _pollStatusAndFetchTransaction _ _ [ "a" ] ; } ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _8 _ _postTransaction _ _ = _ _webpack _require _ _ ( 36 ) ;
2017-04-26 15:58:19 +02:00
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "postTransaction" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _8 _ _postTransaction _ _ [ "a" ] ; } ) ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 31 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = listBlocks ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ = _ _webpack _require _ _ ( 0 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ = _ _webpack _require _ _ ( 1 ) ;
2017-05-05 17:24:23 +02:00
/ * *
* @ public
* @ param tx _id
* @ param status
* @ param API _PATH
* /
2017-04-26 15:58:19 +02:00
function listBlocks ( _ref , API _PATH ) {
var tx _id = _ref . tx _id ,
status = _ref . status ;
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ [ "a" /* default */ ] ) ( _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ [ "a" /* default */ ] ) ( API _PATH ) [ 'blocks' ] , {
query : {
tx _id : tx _id ,
status : status
}
} ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 32 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = listOutputs ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ = _ _webpack _require _ _ ( 0 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ = _ _webpack _require _ _ ( 1 ) ;
2017-05-05 17:24:23 +02:00
/ * *
* @ public
* @ param public _key
* @ param unspent
* @ param API _PATH
* @ param onlyJsonResponse
* /
2017-04-26 15:58:19 +02:00
function listOutputs ( _ref , API _PATH ) {
var public _key = _ref . public _key ,
unspent = _ref . unspent ;
var onlyJsonResponse = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : true ;
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ [ "a" /* default */ ] ) ( _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ [ "a" /* default */ ] ) ( API _PATH ) [ 'outputs' ] , {
query : {
public _key : public _key ,
unspent : unspent
}
} , onlyJsonResponse ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 33 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = listTransactions ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ = _ _webpack _require _ _ ( 0 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ = _ _webpack _require _ _ ( 1 ) ;
2017-05-05 17:24:23 +02:00
/ * *
* @ public
* @ param asset _id
* @ param operation
* @ param API _PATH
* /
2017-04-26 15:58:19 +02:00
function listTransactions ( _ref , API _PATH ) {
var asset _id = _ref . asset _id ,
operation = _ref . operation ;
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ [ "a" /* default */ ] ) ( _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ [ "a" /* default */ ] ) ( API _PATH ) [ 'transactions' ] , {
query : {
asset _id : asset _id ,
operation : operation
}
} ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 34 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = listVotes ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ = _ _webpack _require _ _ ( 0 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ = _ _webpack _require _ _ ( 1 ) ;
2017-05-05 17:24:23 +02:00
/ * *
* @ public
* @ param block _id
* @ param API _PATH
* /
2017-04-26 15:58:19 +02:00
function listVotes ( block _id , API _PATH ) {
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ [ "a" /* default */ ] ) ( _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ [ "a" /* default */ ] ) ( API _PATH ) [ 'votes' ] , {
query : {
block _id : block _id
}
} ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 35 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _getTransaction _ _ = _ _webpack _require _ _ ( 16 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _getStatus _ _ = _ _webpack _require _ _ ( 15 ) ;
2017-04-26 15:58:19 +02:00
2017-05-05 17:24:23 +02:00
/ * *
* @ public
* @ param tx _id
* @ param API _PATH
* @ return { Promise }
* /
2017-04-26 15:58:19 +02:00
/* harmony default export */ _ _webpack _exports _ _ [ "a" ] = ( function ( tx _id , API _PATH ) {
return new Promise ( function ( resolve , reject ) {
var timer = setInterval ( function ( ) {
_ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _1 _ _getStatus _ _ [ "a" /* default */ ] ) ( tx _id , API _PATH ) . then ( function ( res ) {
console . log ( 'Fetched transaction status:' , res ) ;
if ( res . status === 'valid' ) {
clearInterval ( timer ) ;
_ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _0 _ _getTransaction _ _ [ "a" /* default */ ] ) ( tx _id , API _PATH ) . then ( function ( res ) {
console . log ( 'Fetched transaction:' , res ) ;
resolve ( res ) ;
} ) ;
}
} ) . catch ( function ( err ) {
clearInterval ( timer ) ;
reject ( err ) ;
} ) ;
} , 500 ) ;
} ) ;
} ) ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 36 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = postTransaction ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ = _ _webpack _require _ _ ( 0 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ = _ _webpack _require _ _ ( 1 ) ;
2017-05-05 17:24:23 +02:00
/ * *
* @ public
*
* @ param transaction
* @ param API _PATH
* /
2017-04-26 15:58:19 +02:00
function postTransaction ( transaction , API _PATH ) {
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _1 _ _request _ _ [ "a" /* default */ ] ) ( _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _0 _ _getApiUrls _ _ [ "a" /* default */ ] ) ( API _PATH ) [ 'transactions' ] , {
method : 'POST' ,
jsonBody : transaction
} ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 37 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = formatText ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _sprintf _js _ _ = _ _webpack _require _ _ ( 25 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _sprintf _js _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _0 _sprintf _js _ _ ) ;
var _typeof = typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ? function ( obj ) { return typeof obj ; } : function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ;
// Regexes taken from or inspired by sprintf-js
var Regex = {
TEMPLATE _LITERAL : /\${([^\)]+?)}/g ,
KEY : /^([a-z_][a-z_\d]*)/i ,
KEY _ACCESS : /^\.([a-z_][a-z_\d]*)/i ,
INDEX _ACCESS : /^\[(\d+)\]/
} ;
/ * *
* imported from https : //github.com/bigchaindb/js-utility-belt/
*
* Formats strings similarly to C 's sprintf, with the addition of ' $ { ... } ' formats .
*
* Makes a first pass replacing '${...}' formats before passing the expanded string and other
* arguments to sprintf - js . For more information on what sprintf can do , see
* https : //github.com/alexei/sprintf.js.
*
* Examples :
* formatText ( 'Hi there ${dimi}!' , { dimi : 'Dimi' } )
* => 'Hi there Dimi!'
*
* formatText ( '${database} is %(status)s' , { database : 'BigchainDB' , status : 'big' } )
* => 'BigchainDB is big'
*
* Like sprintf - js , string interpolation for keywords and indexes is supported too :
* formatText ( 'Berlin is best known for its ${berlin.topKnownFor[0].name}' , {
* berlin : {
* topKnownFor : [ {
* name : 'Currywurst'
* } , ...
* ]
* }
* } )
* => 'Berlin is best known for its Currywurst'
* /
function formatText ( s ) {
var expandedFormatStr = s ;
// Try to replace formats of the form '${...}' if named replacement fields are used
for ( var _len = arguments . length , argv = Array ( _len > 1 ? _len - 1 : 0 ) , _key = 1 ; _key < _len ; _key ++ ) {
argv [ _key - 1 ] = arguments [ _key ] ;
}
if ( s && argv . length === 1 && _typeof ( argv [ 0 ] ) === 'object' ) {
var templateSpecObj = argv [ 0 ] ;
expandedFormatStr = s . replace ( Regex . TEMPLATE _LITERAL , function ( match , replacement ) {
var interpolationLeft = replacement ;
/ * *
* Interpolation algorithm inspired by sprintf - js .
*
* Goes through the replacement string getting the left - most key or index to interpolate
* on each pass . ` value ` at each step holds the last interpolation result , ` curMatch ` is
* the current property match , and ` interpolationLeft ` is the portion of the replacement
* string still to be interpolated .
*
* It ' s useful to note that RegExp . exec ( ) returns with an array holding :
* [ 0 ] : Full string matched
* [ 1 + ] : Matching groups
*
* And that in the regexes defined , the first matching group always corresponds to the
* property matched .
* /
var value = void 0 ;
var curMatch = Regex . KEY . exec ( interpolationLeft ) ;
if ( curMatch !== null ) {
value = templateSpecObj [ curMatch [ 1 ] ] ;
// Assigning in the conditionals here makes the code less bloated
/* eslint-disable no-cond-assign */
while ( ( interpolationLeft = interpolationLeft . substring ( curMatch [ 0 ] . length ) ) && value != null ) {
if ( curMatch = Regex . KEY _ACCESS . exec ( interpolationLeft ) ) {
value = value [ curMatch [ 1 ] ] ;
} else if ( curMatch = Regex . INDEX _ACCESS . exec ( interpolationLeft ) ) {
value = value [ curMatch [ 1 ] ] ;
} else {
break ;
}
}
/* eslint-enable no-cond-assign */
}
// If there's anything left to interpolate by the end then we've failed to interpolate
// the entire replacement string.
if ( interpolationLeft . length ) {
throw new SyntaxError ( '[formatText] failed to parse named argument key: ' + replacement ) ;
}
return value ;
} ) ;
}
return _ _WEBPACK _IMPORTED _MODULE _0 _sprintf _js _ _ [ "sprintf" ] . apply ( undefined , [ expandedFormatStr ] . concat ( argv ) ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 38 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = sanitize ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _core _js _library _fn _array _includes _ _ = _ _webpack _require _ _ ( 53 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _core _js _library _fn _array _includes _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _0 _core _js _library _fn _array _includes _ _ ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _core _js _library _fn _object _entries _ _ = _ _webpack _require _ _ ( 19 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _core _js _library _fn _object _entries _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _1 _core _js _library _fn _object _entries _ _ ) ;
var _slicedToArray = function ( ) { function sliceIterator ( arr , i ) { var _arr = [ ] ; var _n = true ; var _d = false ; var _e = undefined ; try { for ( var _i = arr [ Symbol . iterator ] ( ) , _s ; ! ( _n = ( _s = _i . next ( ) ) . done ) ; _n = true ) { _arr . push ( _s . value ) ; if ( i && _arr . length === i ) break ; } } catch ( err ) { _d = true ; _e = err ; } finally { try { if ( ! _n && _i [ "return" ] ) _i [ "return" ] ( ) ; } finally { if ( _d ) throw _e ; } } return _arr ; } return function ( arr , i ) { if ( Array . isArray ( arr ) ) { return arr ; } else if ( Symbol . iterator in Object ( arr ) ) { return sliceIterator ( arr , i ) ; } else { throw new TypeError ( "Invalid attempt to destructure non-iterable instance" ) ; } } ; } ( ) ;
var _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ;
/ * *
* Abstraction for selectFromObject and omitFromObject for DRYness .
* Set isInclusion to true if the filter should be for including the filtered items ( ie . selecting
* only them vs omitting only them ) .
* /
function filterFromObject ( obj , filter ) {
var _ref = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : { } ,
_ref$isInclusion = _ref . isInclusion ,
isInclusion = _ref$isInclusion === undefined ? true : _ref$isInclusion ;
if ( filter && Array . isArray ( filter ) ) {
return applyFilterOnObject ( obj , isInclusion ? function ( _ , key ) {
return _ _WEBPACK _IMPORTED _MODULE _0 _core _js _library _fn _array _includes _ _ _default ( ) ( filter , key ) ;
} : function ( _ , key ) {
return ! _ _WEBPACK _IMPORTED _MODULE _0 _core _js _library _fn _array _includes _ _ _default ( ) ( filter , key ) ;
} ) ;
} else if ( filter && typeof filter === 'function' ) {
// Flip the filter fn's return if it's for inclusion
return applyFilterOnObject ( obj , isInclusion ? filter : function ( ) {
return ! filter . apply ( undefined , arguments ) ;
} ) ;
} else {
throw new Error ( 'The given filter is not an array or function. Exclude aborted' ) ;
}
}
/ * *
* Returns a filtered copy of the given object ' s own enumerable properties ( no inherited
* properties ) , keeping any keys that pass the given filter function .
* /
function applyFilterOnObject ( obj , filterFn ) {
if ( filterFn == null ) {
return _extends ( { } , obj ) ;
}
var filteredObj = { } ;
_ _WEBPACK _IMPORTED _MODULE _1 _core _js _library _fn _object _entries _ _ _default ( ) ( obj ) . forEach ( function ( _ref2 ) {
var _ref3 = _slicedToArray ( _ref2 , 2 ) ,
key = _ref3 [ 0 ] ,
val = _ref3 [ 1 ] ;
if ( filterFn ( val , key ) ) {
filteredObj [ key ] = val ;
}
} ) ;
return filteredObj ;
}
/ * *
* Similar to lodash 's _.pick(), this returns a copy of the given object' s
* own and inherited enumerable properties , selecting only the keys in
* the given array or whose value pass the given filter function .
* @ param { object } obj Source object
* @ param { array | function } filter Array of key names to select or function to invoke per iteration
* @ return { object } The new object
* /
function selectFromObject ( obj , filter ) {
return filterFromObject ( obj , filter ) ;
}
/ * *
* Glorified selectFromObject . Takes an object and returns a filtered shallow copy that strips out
* any properties that are falsy ( including coercions , ie . undefined , null , '' , 0 , ... ) .
* Does not modify the passed in object .
*
* @ param { object } obj Javascript object
* @ return { object } Sanitized Javascript object
* /
function sanitize ( obj ) {
return selectFromObject ( obj , function ( val ) {
return ! ! val ;
} ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 39 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = sha256Hash ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _js _sha3 _ _ = _ _webpack _require _ _ ( 24 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _js _sha3 _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _0 _js _sha3 _ _ ) ;
function sha256Hash ( data ) {
return _ _WEBPACK _IMPORTED _MODULE _0 _js _sha3 _ _ _default . a . sha3 _256 . create ( ) . update ( data ) . hex ( ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 40 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = stringifyAsQueryParam ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _core _js _library _fn _object _entries _ _ = _ _webpack _require _ _ ( 19 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _core _js _library _fn _object _entries _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _0 _core _js _library _fn _object _entries _ _ ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _decamelize _ _ = _ _webpack _require _ _ ( 80 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _decamelize _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _1 _decamelize _ _ ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _query _string _ _ = _ _webpack _require _ _ ( 90 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _query _string _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _2 _query _string _ _ ) ;
var _slicedToArray = function ( ) { function sliceIterator ( arr , i ) { var _arr = [ ] ; var _n = true ; var _d = false ; var _e = undefined ; try { for ( var _i = arr [ Symbol . iterator ] ( ) , _s ; ! ( _n = ( _s = _i . next ( ) ) . done ) ; _n = true ) { _arr . push ( _s . value ) ; if ( i && _arr . length === i ) break ; } } catch ( err ) { _d = true ; _e = err ; } finally { try { if ( ! _n && _i [ "return" ] ) _i [ "return" ] ( ) ; } finally { if ( _d ) throw _e ; } } return _arr ; } return function ( arr , i ) { if ( Array . isArray ( arr ) ) { return arr ; } else if ( Symbol . iterator in Object ( arr ) ) { return sliceIterator ( arr , i ) ; } else { throw new TypeError ( "Invalid attempt to destructure non-iterable instance" ) ; } } ; } ( ) ;
var _typeof = typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ? function ( obj ) { return typeof obj ; } : function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ;
/ * *
* imported from https : //github.com/bigchaindb/js-utility-belt/
*
* Takes a key - value dictionary ( ie . object ) and converts it to a query - parameter string that you
* can directly append into a URL .
*
* Extends queryString . stringify by allowing you to specify a ` transform ` function that will be
* invoked on each of the dictionary ' s keys before being stringified into the query - parameter
* string .
*
* By default ` transform ` is ` decamelize ` , so a dictionary of the form :
*
* {
* page : 1 ,
* pageSize : 10
* }
*
* will be converted to a string like :
*
* ? page = 1 & page _size = 10
*
* @ param { object } obj Query params dictionary
* @ param { function } [ transform = decamelize ] Transform function for each of the param keys
* @ return { string } Query param string
* /
function stringifyAsQueryParam ( obj ) {
var transform = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : _ _WEBPACK _IMPORTED _MODULE _1 _decamelize _ _ _default . a ;
if ( ! obj || ( typeof obj === 'undefined' ? 'undefined' : _typeof ( obj ) ) !== 'object' || ! Object . keys ( obj ) . length ) {
return '' ;
}
var transformedKeysObj = _ _WEBPACK _IMPORTED _MODULE _0 _core _js _library _fn _object _entries _ _ _default ( ) ( obj ) . reduce ( function ( paramsObj , _ref ) {
var _ref2 = _slicedToArray ( _ref , 2 ) ,
key = _ref2 [ 0 ] ,
value = _ref2 [ 1 ] ;
paramsObj [ transform ( key ) ] = value ;
return paramsObj ;
} , { } ) ;
return '?' + _ _WEBPACK _IMPORTED _MODULE _2 _query _string _ _ _default . a . stringify ( transformedKeysObj ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 41 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = hashTransaction ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _serializeTransactionIntoCanonicalString _ _ = _ _webpack _require _ _ ( 7 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _sha256Hash _ _ = _ _webpack _require _ _ ( 39 ) ;
2017-04-26 15:58:19 +02:00
var _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ;
function hashTransaction ( transaction ) {
// Safely remove any tx id from the given transaction for hashing
var tx = _extends ( { } , transaction ) ;
delete tx . id ;
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _1 _ _sha256Hash _ _ [ "a" /* default */ ] ) ( _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _0 _ _serializeTransactionIntoCanonicalString _ _ [ "a" /* default */ ] ) ( tx ) ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 42 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( _ _webpack _exports _ _ , "__esModule" , { value : true } ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _makeEd25519Condition _ _ = _ _webpack _require _ _ ( 44 ) ;
2017-04-26 15:58:19 +02:00
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "makeEd25519Condition" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _0 _ _makeEd25519Condition _ _ [ "a" ] ; } ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _makeSha256Condition _ _ = _ _webpack _require _ _ ( 46 ) ;
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "makeSha256Condition" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _1 _ _makeSha256Condition _ _ [ "a" ] ; } ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _ _makeThresholdCondition _ _ = _ _webpack _require _ _ ( 47 ) ;
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "makeThresholdCondition" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _2 _ _makeThresholdCondition _ _ [ "a" ] ; } ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _3 _ _makeCreateTransaction _ _ = _ _webpack _require _ _ ( 43 ) ;
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "makeCreateTransaction" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _3 _ _makeCreateTransaction _ _ [ "a" ] ; } ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _4 _ _makeOutput _ _ = _ _webpack _require _ _ ( 45 ) ;
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "makeOutput" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _4 _ _makeOutput _ _ [ "a" ] ; } ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _5 _ _makeTransaction _ _ = _ _webpack _require _ _ ( 6 ) ;
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "makeTransaction" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _5 _ _makeTransaction _ _ [ "a" ] ; } ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _6 _ _makeTransferTransaction _ _ = _ _webpack _require _ _ ( 48 ) ;
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "makeTransferTransaction" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _6 _ _makeTransferTransaction _ _ [ "a" ] ; } ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _7 _ _serializeTransactionIntoCanonicalString _ _ = _ _webpack _require _ _ ( 7 ) ;
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "serializeTransactionIntoCanonicalString" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _7 _ _serializeTransactionIntoCanonicalString _ _ [ "a" ] ; } ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _8 _ _signTransaction _ _ = _ _webpack _require _ _ ( 49 ) ;
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "signTransaction" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _8 _ _signTransaction _ _ [ "a" ] ; } ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _9 _ _utils _ccJsonLoad _ _ = _ _webpack _require _ _ ( 50 ) ;
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ccJsonLoad" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _9 _ _utils _ccJsonLoad _ _ [ "a" ] ; } ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _10 _ _utils _ccJsonify _ _ = _ _webpack _require _ _ ( 5 ) ;
/* harmony reexport (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ccJsonify" , function ( ) { return _ _WEBPACK _IMPORTED _MODULE _10 _ _utils _ccJsonify _ _ [ "a" ] ; } ) ;
2017-04-26 15:58:19 +02:00
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 43 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = makeCreateTransaction ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _makeInputTemplate _ _ = _ _webpack _require _ _ ( 17 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _makeTransaction _ _ = _ _webpack _require _ _ ( 6 ) ;
2017-04-26 15:58:19 +02:00
/ * *
2017-05-05 17:24:23 +02:00
* @ public
2017-04-26 15:58:19 +02:00
* Generate a ` CREATE ` transaction holding the ` asset ` , ` metadata ` , and ` outputs ` , to be signed by
* the ` issuers ` .
* @ param { object } asset Created asset ' s data
* @ param { object } metadata Metadata for the Transaction
* @ param { object [ ] } outputs Array of Output objects to add to the Transaction .
* Think of these as the recipients of the asset after the transaction .
* For ` CREATE ` Transactions , this should usually just be a list of
* Outputs wrapping Ed25519 Conditions generated from the issuers ' public
* keys ( so that the issuers are the recipients of the created asset ) .
* @ param { ... string [ ] } issuers Public key of one or more issuers to the asset being created by this
* Transaction .
* Note : Each of the private keys corresponding to the given public
* keys MUST be used later ( and in the same order ) when signing the
* Transaction ( ` signTransaction() ` ) .
* @ returns { object } Unsigned transaction -- make sure to call signTransaction ( ) on it before
* sending it off !
* /
function makeCreateTransaction ( asset , metadata , outputs ) {
var assetDefinition = {
'data' : asset || null
} ;
for ( var _len = arguments . length , issuers = Array ( _len > 3 ? _len - 3 : 0 ) , _key = 3 ; _key < _len ; _key ++ ) {
issuers [ _key - 3 ] = arguments [ _key ] ;
}
var inputs = issuers . map ( function ( issuer ) {
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _0 _ _makeInputTemplate _ _ [ "a" /* default */ ] ) ( [ issuer ] ) ;
} ) ;
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _1 _ _makeTransaction _ _ [ "a" /* default */ ] ) ( 'CREATE' , assetDefinition , metadata , outputs , inputs ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 44 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = makeEd25519Condition ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _buffer _ _ = _ _webpack _require _ _ ( 2 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _buffer _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _0 _buffer _ _ ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _bs58 _ _ = _ _webpack _require _ _ ( 3 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _bs58 _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _1 _bs58 _ _ ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _five _bells _condition _ _ = _ _webpack _require _ _ ( 4 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _five _bells _condition _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _2 _five _bells _condition _ _ ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _3 _ _utils _ccJsonify _ _ = _ _webpack _require _ _ ( 5 ) ;
2017-04-26 15:58:19 +02:00
2017-05-05 17:24:23 +02:00
2017-04-26 15:58:19 +02:00
/ * *
2017-05-05 17:24:23 +02:00
* @ public
2017-04-26 15:58:19 +02:00
* Create an Ed25519 Cryptocondition from an Ed25519 public key to put into an Output of a Transaction
* @ param { string } publicKey base58 encoded Ed25519 public key for the recipient of the Transaction
2017-05-05 17:24:23 +02:00
* @ param { boolean } [ json = true ] If true returns a json object otherwise a crypto - condition type
2017-04-26 15:58:19 +02:00
* @ returns { object } Ed25519 Condition ( that will need to wrapped in an Output )
* /
function makeEd25519Condition ( publicKey ) {
2017-05-05 17:24:23 +02:00
var json = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : true ;
2017-04-26 15:58:19 +02:00
var publicKeyBuffer = new _ _WEBPACK _IMPORTED _MODULE _0 _buffer _ _ [ "Buffer" ] ( _ _WEBPACK _IMPORTED _MODULE _1 _bs58 _ _ _default . a . decode ( publicKey ) ) ;
var ed25519Fulfillment = new _ _WEBPACK _IMPORTED _MODULE _2 _five _bells _condition _ _ _default . a . Ed25519 ( ) ;
ed25519Fulfillment . setPublicKey ( publicKeyBuffer ) ;
2017-05-05 17:24:23 +02:00
if ( json ) {
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _3 _ _utils _ccJsonify _ _ [ "a" /* default */ ] ) ( ed25519Fulfillment ) ;
}
return ed25519Fulfillment ;
2017-04-26 15:58:19 +02:00
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 45 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = makeOutput ;
/ * *
2017-05-05 17:24:23 +02:00
* @ public
2017-04-26 15:58:19 +02:00
* Create an Output from a Condition .
* Note : Assumes the given Condition was generated from a single public key ( e . g . a Ed25519 Condition )
* @ param { object } condition Condition ( e . g . a Ed25519 Condition from ` makeEd25519Condition() ` )
* @ param { number } amount Amount of the output
* @ returns { object } An Output usable in a Transaction
* /
function makeOutput ( condition ) {
var amount = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : 1 ;
return {
2017-05-05 17:24:23 +02:00
amount : JSON . stringify ( amount ) ,
2017-04-26 15:58:19 +02:00
condition : condition ,
2017-05-05 17:24:23 +02:00
'public_keys' : condition . details . hasOwnProperty ( 'public_key' ) ? [ condition . details . public _key ] : [ ]
2017-04-26 15:58:19 +02:00
} ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 46 */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = makeSha256Condition ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _buffer _ _ = _ _webpack _require _ _ ( 2 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _buffer _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _0 _buffer _ _ ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _five _bells _condition _ _ = _ _webpack _require _ _ ( 4 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _five _bells _condition _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _1 _five _bells _condition _ _ ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _ _utils _ccJsonify _ _ = _ _webpack _require _ _ ( 5 ) ;
/ * *
* @ public
* Create a Preimage - Sha256 Cryptocondition from a secret to put into an Output of a Transaction
* @ param { string } preimage Preimage to be hashed and wrapped in a crypto - condition
* @ param { boolean } [ json = true ] If true returns a json object otherwise a crypto - condition type
* @ returns { object } Preimage - Sha256 Condition ( that will need to wrapped in an Output )
* /
function makeSha256Condition ( preimage ) {
var json = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : true ;
var sha256Fulfillment = new _ _WEBPACK _IMPORTED _MODULE _1 _five _bells _condition _ _ _default . a . PreimageSha256 ( ) ;
sha256Fulfillment . preimage = new _ _WEBPACK _IMPORTED _MODULE _0 _buffer _ _ [ "Buffer" ] ( preimage ) ;
if ( json ) {
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _2 _ _utils _ccJsonify _ _ [ "a" /* default */ ] ) ( sha256Fulfillment ) ;
}
return sha256Fulfillment ;
}
/***/ } ) ,
/* 47 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = makeThresholdCondition ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _five _bells _condition _ _ = _ _webpack _require _ _ ( 4 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _five _bells _condition _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _0 _five _bells _condition _ _ ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _utils _ccJsonify _ _ = _ _webpack _require _ _ ( 5 ) ;
/ * *
* @ public
* Create an Sha256 Threshold Cryptocondition from threshold to put into an Output of a Transaction
* @ param { number } threshold
* @ param { Array } [ subconditions = [ ] ]
* @ param { boolean } [ json = true ] If true returns a json object otherwise a crypto - condition type
* @ returns { object } Sha256 Threshold Condition ( that will need to wrapped in an Output )
* /
function makeThresholdCondition ( threshold ) {
var subconditions = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : [ ] ;
var json = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : true ;
var thresholdCondition = new _ _WEBPACK _IMPORTED _MODULE _0 _five _bells _condition _ _ _default . a . ThresholdSha256 ( ) ;
thresholdCondition . threshold = threshold ;
subconditions . forEach ( function ( subcondition ) {
// TODO: add support for Condition and URIs
thresholdCondition . addSubfulfillment ( subcondition ) ;
} ) ;
if ( json ) {
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _1 _ _utils _ccJsonify _ _ [ "a" /* default */ ] ) ( thresholdCondition ) ;
}
return thresholdCondition ;
}
/***/ } ) ,
/* 48 */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = makeTransferTransaction ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _ _makeInputTemplate _ _ = _ _webpack _require _ _ ( 17 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _ _makeTransaction _ _ = _ _webpack _require _ _ ( 6 ) ;
2017-04-26 15:58:19 +02:00
/ * *
2017-05-05 17:24:23 +02:00
* @ public
2017-04-26 15:58:19 +02:00
* Generate a ` TRANSFER ` transaction holding the ` asset ` , ` metadata ` , and ` outputs ` , that fulfills
* the ` fulfilledOutputs ` of ` unspentTransaction ` .
* @ param { object } unspentTransaction Previous Transaction you have control over ( i . e . can fulfill
* its Output Condition )
* @ param { object } metadata Metadata for the Transaction
* @ param { object [ ] } outputs Array of Output objects to add to the Transaction .
* Think of these as the recipients of the asset after the transaction .
* For ` TRANSFER ` Transactions , this should usually just be a list of
* Outputs wrapping Ed25519 Conditions generated from the public keys of
* the recipients .
* @ param { ... number } fulfilledOutputs Indices of the Outputs in ` unspentTransaction ` that this
* Transaction fulfills .
* Note that the public keys listed in the fulfilled Outputs
* must be used ( and in the same order ) to sign the Transaction
* ( ` signTransaction() ` ) .
* @ returns { object } Unsigned transaction -- make sure to call signTransaction ( ) on it before
* sending it off !
* /
function makeTransferTransaction ( unspentTransaction , metadata , outputs ) {
for ( var _len = arguments . length , fulfilledOutputs = Array ( _len > 3 ? _len - 3 : 0 ) , _key = 3 ; _key < _len ; _key ++ ) {
fulfilledOutputs [ _key - 3 ] = arguments [ _key ] ;
}
var inputs = fulfilledOutputs . map ( function ( outputIndex ) {
var fulfilledOutput = unspentTransaction . outputs [ outputIndex ] ;
var transactionLink = {
'output' : outputIndex ,
'txid' : unspentTransaction . id
} ;
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _0 _ _makeInputTemplate _ _ [ "a" /* default */ ] ) ( fulfilledOutput . public _keys , transactionLink ) ;
} ) ;
var assetLink = {
'id' : unspentTransaction . operation === 'CREATE' ? unspentTransaction . id : unspentTransaction . asset . id
} ;
return _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _1 _ _makeTransaction _ _ [ "a" /* default */ ] ) ( 'TRANSFER' , assetLink , metadata , outputs , inputs ) ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 49 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = signTransaction ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _buffer _ _ = _ _webpack _require _ _ ( 2 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _buffer _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _0 _buffer _ _ ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _bs58 _ _ = _ _webpack _require _ _ ( 3 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _bs58 _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _1 _bs58 _ _ ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _five _bells _condition _ _ = _ _webpack _require _ _ ( 4 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _five _bells _condition _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _2 _five _bells _condition _ _ ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _3 _clone _ _ = _ _webpack _require _ _ ( 18 ) ;
2017-04-26 15:58:19 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _3 _clone _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _3 _clone _ _ ) ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _4 _ _serializeTransactionIntoCanonicalString _ _ = _ _webpack _require _ _ ( 7 ) ;
2017-04-26 15:58:19 +02:00
/ * *
2017-05-05 17:24:23 +02:00
* @ public
2017-04-26 15:58:19 +02:00
* Sign the given ` transaction ` with the given ` privateKey ` s , returning a new copy of ` transaction `
* that ' s been signed .
* Note : Only generates Ed25519 Fulfillments . Thresholds and other types of Fulfillments are left as
* an exercise for the user .
* @ param { object } transaction Transaction to sign . ` transaction ` is not modified .
* @ param { ... string } privateKeys Private keys associated with the issuers of the ` transaction ` .
* Looped through to iteratively sign any Input Fulfillments found in
* the ` transaction ` .
* @ returns { object } The signed version of ` transaction ` .
* /
function signTransaction ( transaction ) {
for ( var _len = arguments . length , privateKeys = Array ( _len > 1 ? _len - 1 : 0 ) , _key = 1 ; _key < _len ; _key ++ ) {
privateKeys [ _key - 1 ] = arguments [ _key ] ;
}
var signedTx = _ _WEBPACK _IMPORTED _MODULE _3 _clone _ _ _default ( ) ( transaction ) ;
signedTx . inputs . forEach ( function ( input , index ) {
var privateKey = privateKeys [ index ] ;
var privateKeyBuffer = new _ _WEBPACK _IMPORTED _MODULE _0 _buffer _ _ [ "Buffer" ] ( _ _WEBPACK _IMPORTED _MODULE _1 _bs58 _ _ _default . a . decode ( privateKey ) ) ;
2017-05-05 17:24:23 +02:00
var serializedTransaction = _ _webpack _require _ _ . i ( _ _WEBPACK _IMPORTED _MODULE _4 _ _serializeTransactionIntoCanonicalString _ _ [ "a" /* default */ ] ) ( transaction ) ;
2017-04-26 15:58:19 +02:00
var ed25519Fulfillment = new _ _WEBPACK _IMPORTED _MODULE _2 _five _bells _condition _ _ _default . a . Ed25519 ( ) ;
ed25519Fulfillment . sign ( new _ _WEBPACK _IMPORTED _MODULE _0 _buffer _ _ [ "Buffer" ] ( serializedTransaction ) , privateKeyBuffer ) ;
var fulfillmentUri = ed25519Fulfillment . serializeUri ( ) ;
input . fulfillment = fulfillmentUri ;
} ) ;
return signedTx ;
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 50 */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-10 09:36:07 +02:00
/* harmony export (immutable) */ _ _webpack _exports _ _ [ "a" ] = ccJsonLoad ;
2017-05-05 17:24:23 +02:00
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ = _ _webpack _require _ _ ( 3 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _five _bells _condition _ _ = _ _webpack _require _ _ ( 4 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _1 _five _bells _condition _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _1 _five _bells _condition _ _ ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _buffer _ _ = _ _webpack _require _ _ ( 2 ) ;
/* harmony import */ var _ _WEBPACK _IMPORTED _MODULE _2 _buffer _ _ _default = _ _webpack _require _ _ . n ( _ _WEBPACK _IMPORTED _MODULE _2 _buffer _ _ ) ;
/ * *
* @ public
* Loads a crypto - condition class ( Fulfillment or Condition ) from a BigchainDB JSON object
* @ param { object } conditionJson
* @ returns { cc . Condition } Ed25519 Condition ( that will need to wrapped in an Output )
* /
function ccJsonLoad ( conditionJson ) {
if ( 'hash' in conditionJson ) {
var condition = new _ _WEBPACK _IMPORTED _MODULE _1 _five _bells _condition _ _ _default . a . Condition ( ) ;
condition . type = conditionJson . type _id ;
condition . bitmask = conditionJson . bitmask ;
condition . hash = new _ _WEBPACK _IMPORTED _MODULE _2 _buffer _ _ [ "Buffer" ] ( _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ _default . a . decode ( conditionJson . hash ) ) ;
condition . maxFulfillmentLength = parseInt ( conditionJson . max _fulfillment _length , 10 ) ;
return condition ;
} else {
var fulfillment = void 0 ;
if ( conditionJson . type _id === 2 ) {
fulfillment = new _ _WEBPACK _IMPORTED _MODULE _1 _five _bells _condition _ _ _default . a . ThresholdSha256 ( ) ;
fulfillment . threshold = conditionJson . threshold ;
conditionJson . subfulfillments . forEach ( function ( subfulfillment ) {
subfulfillment = ccJsonLoad ( subfulfillment ) ;
if ( 'getConditionUri' in subfulfillment ) fulfillment . addSubfulfillment ( subfulfillment ) ; else if ( 'serializeUri' in subfulfillment ) fulfillment . addSubcondition ( subfulfillment ) ;
} ) ;
}
if ( conditionJson . type _id === 0 ) {
fulfillment = new _ _WEBPACK _IMPORTED _MODULE _1 _five _bells _condition _ _ _default . a . PreimageSha256 ( ) ;
fulfillment . preimage = new _ _WEBPACK _IMPORTED _MODULE _2 _buffer _ _ [ "Buffer" ] ( conditionJson . preimage ) ;
}
if ( conditionJson . type _id === 4 ) {
fulfillment = new _ _WEBPACK _IMPORTED _MODULE _1 _five _bells _condition _ _ _default . a . Ed25519 ( ) ;
fulfillment . publicKey = new _ _WEBPACK _IMPORTED _MODULE _2 _buffer _ _ [ "Buffer" ] ( _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ _default . a . decode ( conditionJson . public _key ) ) ;
if ( conditionJson . signature ) fulfillment . signature = new _ _WEBPACK _IMPORTED _MODULE _2 _buffer _ _ [ "Buffer" ] ( _ _WEBPACK _IMPORTED _MODULE _0 _bs58 _ _ _default . a . decode ( conditionJson . signature ) ) ;
}
return fulfillment ;
}
}
/***/ } ) ,
/* 51 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
/* WEBPACK VAR INJECTION */ ( function ( Buffer ) { // base-x encoding
// Forked from https://github.com/cryptocoinjs/bs58
// Originally written by Mike Hearn for BitcoinJ
// Copyright (c) 2011 Google Inc
// Ported to JavaScript by Stefan Thomas
// Merged Buffer refactorings from base58-native by Stephen Pair
// Copyright (c) 2013 BitPay Inc
module . exports = function base ( ALPHABET ) {
var ALPHABET _MAP = { }
var BASE = ALPHABET . length
var LEADER = ALPHABET . charAt ( 0 )
// pre-compute lookup table
for ( var z = 0 ; z < ALPHABET . length ; z ++ ) {
var x = ALPHABET . charAt ( z )
if ( ALPHABET _MAP [ x ] !== undefined ) throw new TypeError ( x + ' is ambiguous' )
ALPHABET _MAP [ x ] = z
}
function encode ( source ) {
if ( source . length === 0 ) return ''
var digits = [ 0 ]
for ( var i = 0 ; i < source . length ; ++ i ) {
for ( var j = 0 , carry = source [ i ] ; j < digits . length ; ++ j ) {
carry += digits [ j ] << 8
digits [ j ] = carry % BASE
carry = ( carry / BASE ) | 0
}
while ( carry > 0 ) {
digits . push ( carry % BASE )
carry = ( carry / BASE ) | 0
}
}
var string = ''
// deal with leading zeros
for ( var k = 0 ; source [ k ] === 0 && k < source . length - 1 ; ++ k ) string += ALPHABET [ 0 ]
// convert digits to a string
for ( var q = digits . length - 1 ; q >= 0 ; -- q ) string += ALPHABET [ digits [ q ] ]
return string
}
function decodeUnsafe ( string ) {
if ( string . length === 0 ) return new Buffer ( 0 )
var bytes = [ 0 ]
for ( var i = 0 ; i < string . length ; i ++ ) {
var value = ALPHABET _MAP [ string [ i ] ]
if ( value === undefined ) return
for ( var j = 0 , carry = value ; j < bytes . length ; ++ j ) {
carry += bytes [ j ] * BASE
bytes [ j ] = carry & 0xff
carry >>= 8
}
while ( carry > 0 ) {
bytes . push ( carry & 0xff )
carry >>= 8
}
}
// deal with leading zeros
for ( var k = 0 ; string [ k ] === LEADER && k < string . length - 1 ; ++ k ) {
bytes . push ( 0 )
}
return new Buffer ( bytes . reverse ( ) )
}
function decode ( string ) {
var buffer = decodeUnsafe ( string )
if ( buffer ) return buffer
throw new Error ( 'Non-base' + BASE + ' character' )
}
return {
encode : encode ,
decodeUnsafe : decodeUnsafe ,
decode : decode
}
}
/* WEBPACK VAR INJECTION */ } . call ( exports , _ _webpack _require _ _ ( 2 ) . Buffer ) )
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 52 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
"use strict" ;
exports . byteLength = byteLength
exports . toByteArray = toByteArray
exports . fromByteArray = fromByteArray
var lookup = [ ]
var revLookup = [ ]
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
for ( var i = 0 , len = code . length ; i < len ; ++ i ) {
lookup [ i ] = code [ i ]
revLookup [ code . charCodeAt ( i ) ] = i
}
revLookup [ '-' . charCodeAt ( 0 ) ] = 62
revLookup [ '_' . charCodeAt ( 0 ) ] = 63
function placeHoldersCount ( b64 ) {
var len = b64 . length
if ( len % 4 > 0 ) {
throw new Error ( 'Invalid string. Length must be a multiple of 4' )
}
// the number of equal signs (place holders)
// if there are two placeholders, than the two characters before it
// represent one byte
// if there is only one, then the three characters before it represent 2 bytes
// this is just a cheap hack to not do indexOf twice
return b64 [ len - 2 ] === '=' ? 2 : b64 [ len - 1 ] === '=' ? 1 : 0
}
function byteLength ( b64 ) {
// base64 is 4/3 + up to two characters of the original data
return b64 . length * 3 / 4 - placeHoldersCount ( b64 )
}
function toByteArray ( b64 ) {
var i , j , l , tmp , placeHolders , arr
var len = b64 . length
placeHolders = placeHoldersCount ( b64 )
arr = new Arr ( len * 3 / 4 - placeHolders )
// if there are placeholders, only get up to the last complete 4 chars
l = placeHolders > 0 ? len - 4 : len
var L = 0
for ( i = 0 , j = 0 ; i < l ; i += 4 , j += 3 ) {
tmp = ( revLookup [ b64 . charCodeAt ( i ) ] << 18 ) | ( revLookup [ b64 . charCodeAt ( i + 1 ) ] << 12 ) | ( revLookup [ b64 . charCodeAt ( i + 2 ) ] << 6 ) | revLookup [ b64 . charCodeAt ( i + 3 ) ]
arr [ L ++ ] = ( tmp >> 16 ) & 0xFF
arr [ L ++ ] = ( tmp >> 8 ) & 0xFF
arr [ L ++ ] = tmp & 0xFF
}
if ( placeHolders === 2 ) {
tmp = ( revLookup [ b64 . charCodeAt ( i ) ] << 2 ) | ( revLookup [ b64 . charCodeAt ( i + 1 ) ] >> 4 )
arr [ L ++ ] = tmp & 0xFF
} else if ( placeHolders === 1 ) {
tmp = ( revLookup [ b64 . charCodeAt ( i ) ] << 10 ) | ( revLookup [ b64 . charCodeAt ( i + 1 ) ] << 4 ) | ( revLookup [ b64 . charCodeAt ( i + 2 ) ] >> 2 )
arr [ L ++ ] = ( tmp >> 8 ) & 0xFF
arr [ L ++ ] = tmp & 0xFF
}
return arr
}
function tripletToBase64 ( num ) {
return lookup [ num >> 18 & 0x3F ] + lookup [ num >> 12 & 0x3F ] + lookup [ num >> 6 & 0x3F ] + lookup [ num & 0x3F ]
}
function encodeChunk ( uint8 , start , end ) {
var tmp
var output = [ ]
for ( var i = start ; i < end ; i += 3 ) {
tmp = ( uint8 [ i ] << 16 ) + ( uint8 [ i + 1 ] << 8 ) + ( uint8 [ i + 2 ] )
output . push ( tripletToBase64 ( tmp ) )
}
return output . join ( '' )
}
function fromByteArray ( uint8 ) {
var tmp
var len = uint8 . length
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
var output = ''
var parts = [ ]
var maxChunkLength = 16383 // must be multiple of 3
// go through the array every three bytes, we'll deal with trailing stuff later
for ( var i = 0 , len2 = len - extraBytes ; i < len2 ; i += maxChunkLength ) {
parts . push ( encodeChunk ( uint8 , i , ( i + maxChunkLength ) > len2 ? len2 : ( i + maxChunkLength ) ) )
}
// pad the end with zeros, but make sure to not forget the extra bytes
if ( extraBytes === 1 ) {
tmp = uint8 [ len - 1 ]
output += lookup [ tmp >> 2 ]
output += lookup [ ( tmp << 4 ) & 0x3F ]
output += '=='
} else if ( extraBytes === 2 ) {
tmp = ( uint8 [ len - 2 ] << 8 ) + ( uint8 [ len - 1 ] )
output += lookup [ tmp >> 10 ]
output += lookup [ ( tmp >> 4 ) & 0x3F ]
output += lookup [ ( tmp << 2 ) & 0x3F ]
output += '='
}
parts . push ( output )
return parts . join ( '' )
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 53 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
_ _webpack _require _ _ ( 78 ) ;
module . exports = _ _webpack _require _ _ ( 8 ) . Array . includes ;
2017-04-26 15:58:19 +02:00
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 54 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
module . exports = function ( it ) {
if ( typeof it != 'function' ) throw TypeError ( it + ' is not a function!' ) ;
return it ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 55 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
module . exports = function ( ) { /* empty */ } ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 56 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
var isObject = _ _webpack _require _ _ ( 11 ) ;
2017-04-26 15:58:19 +02:00
module . exports = function ( it ) {
if ( ! isObject ( it ) ) throw TypeError ( it + ' is not an object!' ) ;
return it ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 57 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
var toString = { } . toString ;
module . exports = function ( it ) {
return toString . call ( it ) . slice ( 8 , - 1 ) ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 58 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
// optional / simple context binding
2017-05-05 17:24:23 +02:00
var aFunction = _ _webpack _require _ _ ( 54 ) ;
2017-04-26 15:58:19 +02:00
module . exports = function ( fn , that , length ) {
aFunction ( fn ) ;
if ( that === undefined ) return fn ;
switch ( length ) {
case 1 : return function ( a ) {
return fn . call ( that , a ) ;
} ;
case 2 : return function ( a , b ) {
return fn . call ( that , a , b ) ;
} ;
case 3 : return function ( a , b , c ) {
return fn . call ( that , a , b , c ) ;
} ;
}
return function ( /* ...args */ ) {
return fn . apply ( that , arguments ) ;
} ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 59 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
// 7.2.1 RequireObjectCoercible(argument)
module . exports = function ( it ) {
if ( it == undefined ) throw TypeError ( "Can't call method on " + it ) ;
return it ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 60 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
var isObject = _ _webpack _require _ _ ( 11 )
, document = _ _webpack _require _ _ ( 10 ) . document
2017-04-26 15:58:19 +02:00
// in old IE typeof document.createElement is 'object'
, is = isObject ( document ) && isObject ( document . createElement ) ;
module . exports = function ( it ) {
return is ? document . createElement ( it ) : { } ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 61 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
// IE 8- don't enum bug keys
module . exports = (
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
) . split ( ',' ) ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 62 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
var hasOwnProperty = { } . hasOwnProperty ;
module . exports = function ( it , key ) {
return hasOwnProperty . call ( it , key ) ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 63 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
var dP = _ _webpack _require _ _ ( 66 )
, createDesc = _ _webpack _require _ _ ( 71 ) ;
module . exports = _ _webpack _require _ _ ( 9 ) ? function ( object , key , value ) {
2017-04-26 15:58:19 +02:00
return dP . f ( object , key , createDesc ( 1 , value ) ) ;
} : function ( object , key , value ) {
object [ key ] = value ;
return object ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 64 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
module . exports = ! _ _webpack _require _ _ ( 9 ) && ! _ _webpack _require _ _ ( 22 ) ( function ( ) {
return Object . defineProperty ( _ _webpack _require _ _ ( 60 ) ( 'div' ) , 'a' , { get : function ( ) { return 7 ; } } ) . a != 7 ;
2017-04-26 15:58:19 +02:00
} ) ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 65 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
2017-05-05 17:24:23 +02:00
var cof = _ _webpack _require _ _ ( 57 ) ;
2017-04-26 15:58:19 +02:00
module . exports = Object ( 'z' ) . propertyIsEnumerable ( 0 ) ? Object : function ( it ) {
return cof ( it ) == 'String' ? it . split ( '' ) : Object ( it ) ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 66 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
var anObject = _ _webpack _require _ _ ( 56 )
, IE8 _DOM _DEFINE = _ _webpack _require _ _ ( 64 )
, toPrimitive = _ _webpack _require _ _ ( 76 )
2017-04-26 15:58:19 +02:00
, dP = Object . defineProperty ;
2017-05-05 17:24:23 +02:00
exports . f = _ _webpack _require _ _ ( 9 ) ? Object . defineProperty : function defineProperty ( O , P , Attributes ) {
2017-04-26 15:58:19 +02:00
anObject ( O ) ;
P = toPrimitive ( P , true ) ;
anObject ( Attributes ) ;
if ( IE8 _DOM _DEFINE ) try {
return dP ( O , P , Attributes ) ;
} catch ( e ) { /* empty */ }
if ( 'get' in Attributes || 'set' in Attributes ) throw TypeError ( 'Accessors not supported!' ) ;
if ( 'value' in Attributes ) O [ P ] = Attributes . value ;
return O ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 67 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
var has = _ _webpack _require _ _ ( 62 )
, toIObject = _ _webpack _require _ _ ( 12 )
, arrayIndexOf = _ _webpack _require _ _ ( 20 ) ( false )
, IE _PROTO = _ _webpack _require _ _ ( 72 ) ( 'IE_PROTO' ) ;
2017-04-26 15:58:19 +02:00
module . exports = function ( object , names ) {
var O = toIObject ( object )
, i = 0
, result = [ ]
, key ;
for ( key in O ) if ( key != IE _PROTO ) has ( O , key ) && result . push ( key ) ;
// Don't enum bug & hidden keys
while ( names . length > i ) if ( has ( O , key = names [ i ++ ] ) ) {
~ arrayIndexOf ( result , key ) || result . push ( key ) ;
}
return result ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 68 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
2017-05-05 17:24:23 +02:00
var $keys = _ _webpack _require _ _ ( 67 )
, enumBugKeys = _ _webpack _require _ _ ( 61 ) ;
2017-04-26 15:58:19 +02:00
module . exports = Object . keys || function keys ( O ) {
return $keys ( O , enumBugKeys ) ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 69 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
exports . f = { } . propertyIsEnumerable ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 70 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
var getKeys = _ _webpack _require _ _ ( 68 )
, toIObject = _ _webpack _require _ _ ( 12 )
, isEnum = _ _webpack _require _ _ ( 69 ) . f ;
2017-04-26 15:58:19 +02:00
module . exports = function ( isEntries ) {
return function ( it ) {
var O = toIObject ( it )
, keys = getKeys ( O )
, length = keys . length
, i = 0
, result = [ ]
, key ;
while ( length > i ) if ( isEnum . call ( O , key = keys [ i ++ ] ) ) {
result . push ( isEntries ? [ key , O [ key ] ] : O [ key ] ) ;
} return result ;
} ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 71 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
module . exports = function ( bitmap , value ) {
return {
enumerable : ! ( bitmap & 1 ) ,
configurable : ! ( bitmap & 2 ) ,
writable : ! ( bitmap & 4 ) ,
value : value
} ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 72 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
var shared = _ _webpack _require _ _ ( 73 ) ( 'keys' )
, uid = _ _webpack _require _ _ ( 77 ) ;
2017-04-26 15:58:19 +02:00
module . exports = function ( key ) {
return shared [ key ] || ( shared [ key ] = uid ( key ) ) ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 73 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
var global = _ _webpack _require _ _ ( 10 )
2017-04-26 15:58:19 +02:00
, SHARED = '__core-js_shared__'
, store = global [ SHARED ] || ( global [ SHARED ] = { } ) ;
module . exports = function ( key ) {
return store [ key ] || ( store [ key ] = { } ) ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 74 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
var toInteger = _ _webpack _require _ _ ( 23 )
2017-04-26 15:58:19 +02:00
, max = Math . max
, min = Math . min ;
module . exports = function ( index , length ) {
index = toInteger ( index ) ;
return index < 0 ? max ( index + length , 0 ) : min ( index , length ) ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 75 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
// 7.1.15 ToLength
2017-05-05 17:24:23 +02:00
var toInteger = _ _webpack _require _ _ ( 23 )
2017-04-26 15:58:19 +02:00
, min = Math . min ;
module . exports = function ( it ) {
return it > 0 ? min ( toInteger ( it ) , 0x1fffffffffffff ) : 0 ; // pow(2, 53) - 1 == 9007199254740991
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 76 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
// 7.1.1 ToPrimitive(input [, PreferredType])
2017-05-05 17:24:23 +02:00
var isObject = _ _webpack _require _ _ ( 11 ) ;
2017-04-26 15:58:19 +02:00
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module . exports = function ( it , S ) {
if ( ! isObject ( it ) ) return it ;
var fn , val ;
if ( S && typeof ( fn = it . toString ) == 'function' && ! isObject ( val = fn . call ( it ) ) ) return val ;
if ( typeof ( fn = it . valueOf ) == 'function' && ! isObject ( val = fn . call ( it ) ) ) return val ;
if ( ! S && typeof ( fn = it . toString ) == 'function' && ! isObject ( val = fn . call ( it ) ) ) return val ;
throw TypeError ( "Can't convert object to primitive value" ) ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 77 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
var id = 0
, px = Math . random ( ) ;
module . exports = function ( key ) {
return 'Symbol(' . concat ( key === undefined ? '' : key , ')_' , ( ++ id + px ) . toString ( 36 ) ) ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 78 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
"use strict" ;
// https://github.com/tc39/Array.prototype.includes
2017-05-05 17:24:23 +02:00
var $export = _ _webpack _require _ _ ( 21 )
, $includes = _ _webpack _require _ _ ( 20 ) ( true ) ;
2017-04-26 15:58:19 +02:00
$export ( $export . P , 'Array' , {
includes : function includes ( el /*, fromIndex = 0 */ ) {
return $includes ( this , el , arguments . length > 1 ? arguments [ 1 ] : undefined ) ;
}
} ) ;
2017-05-05 17:24:23 +02:00
_ _webpack _require _ _ ( 55 ) ( 'includes' ) ;
2017-04-26 15:58:19 +02:00
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 79 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
// https://github.com/tc39/proposal-object-values-entries
2017-05-05 17:24:23 +02:00
var $export = _ _webpack _require _ _ ( 21 )
, $entries = _ _webpack _require _ _ ( 70 ) ( true ) ;
2017-04-26 15:58:19 +02:00
$export ( $export . S , 'Object' , {
entries : function entries ( it ) {
return $entries ( it ) ;
}
} ) ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 80 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
"use strict" ;
module . exports = function ( str , sep ) {
if ( typeof str !== 'string' ) {
throw new TypeError ( 'Expected a string' ) ;
}
sep = typeof sep === 'undefined' ? '_' : sep ;
return str
. replace ( /([a-z\d])([A-Z])/g , '$1' + sep + '$2' )
. replace ( /([A-Z]+)([A-Z][a-z\d]+)/g , '$1' + sep + '$2' )
. toLowerCase ( ) ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 81 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
/* WEBPACK VAR INJECTION */ ( function ( process , global ) { var require ; / * !
* @ overview es6 - promise - a tiny implementation of Promises / A + .
* @ copyright Copyright ( c ) 2014 Yehuda Katz , Tom Dale , Stefan Penner and contributors ( Conversion to ES6 API by Jake Archibald )
* @ license Licensed under MIT license
* See https : //raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @ version 4.1 . 0
* /
( function ( global , factory ) {
true ? module . exports = factory ( ) :
typeof define === 'function' && define . amd ? define ( factory ) :
( global . ES6Promise = factory ( ) ) ;
} ( this , ( function ( ) { 'use strict' ;
function objectOrFunction ( x ) {
return typeof x === 'function' || typeof x === 'object' && x !== null ;
}
function isFunction ( x ) {
return typeof x === 'function' ;
}
var _isArray = undefined ;
if ( ! Array . isArray ) {
_isArray = function ( x ) {
return Object . prototype . toString . call ( x ) === '[object Array]' ;
} ;
} else {
_isArray = Array . isArray ;
}
var isArray = _isArray ;
var len = 0 ;
var vertxNext = undefined ;
var customSchedulerFn = undefined ;
var asap = function asap ( callback , arg ) {
queue [ len ] = callback ;
queue [ len + 1 ] = arg ;
len += 2 ;
if ( len === 2 ) {
// If len is 2, that means that we need to schedule an async flush.
// If additional callbacks are queued before the queue is flushed, they
// will be processed by this flush that we are scheduling.
if ( customSchedulerFn ) {
customSchedulerFn ( flush ) ;
} else {
scheduleFlush ( ) ;
}
}
} ;
function setScheduler ( scheduleFn ) {
customSchedulerFn = scheduleFn ;
}
function setAsap ( asapFn ) {
asap = asapFn ;
}
var browserWindow = typeof window !== 'undefined' ? window : undefined ;
var browserGlobal = browserWindow || { } ;
var BrowserMutationObserver = browserGlobal . MutationObserver || browserGlobal . WebKitMutationObserver ;
var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ( { } ) . toString . call ( process ) === '[object process]' ;
// test for web worker but not in IE10
var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined' ;
// node
function useNextTick ( ) {
// node version 0.10.x displays a deprecation warning when nextTick is used recursively
// see https://github.com/cujojs/when/issues/410 for details
return function ( ) {
return process . nextTick ( flush ) ;
} ;
}
// vertx
function useVertxTimer ( ) {
if ( typeof vertxNext !== 'undefined' ) {
return function ( ) {
vertxNext ( flush ) ;
} ;
}
return useSetTimeout ( ) ;
}
function useMutationObserver ( ) {
var iterations = 0 ;
var observer = new BrowserMutationObserver ( flush ) ;
var node = document . createTextNode ( '' ) ;
observer . observe ( node , { characterData : true } ) ;
return function ( ) {
node . data = iterations = ++ iterations % 2 ;
} ;
}
// web worker
function useMessageChannel ( ) {
var channel = new MessageChannel ( ) ;
channel . port1 . onmessage = flush ;
return function ( ) {
return channel . port2 . postMessage ( 0 ) ;
} ;
}
function useSetTimeout ( ) {
// Store setTimeout reference so es6-promise will be unaffected by
// other code modifying setTimeout (like sinon.useFakeTimers())
var globalSetTimeout = setTimeout ;
return function ( ) {
return globalSetTimeout ( flush , 1 ) ;
} ;
}
var queue = new Array ( 1000 ) ;
function flush ( ) {
for ( var i = 0 ; i < len ; i += 2 ) {
var callback = queue [ i ] ;
var arg = queue [ i + 1 ] ;
callback ( arg ) ;
queue [ i ] = undefined ;
queue [ i + 1 ] = undefined ;
}
len = 0 ;
}
function attemptVertx ( ) {
try {
var r = require ;
2017-05-05 17:24:23 +02:00
var vertx = _ _webpack _require _ _ ( 93 ) ;
2017-04-26 15:58:19 +02:00
vertxNext = vertx . runOnLoop || vertx . runOnContext ;
return useVertxTimer ( ) ;
} catch ( e ) {
return useSetTimeout ( ) ;
}
}
var scheduleFlush = undefined ;
// Decide what async method to use to triggering processing of queued callbacks:
if ( isNode ) {
scheduleFlush = useNextTick ( ) ;
} else if ( BrowserMutationObserver ) {
scheduleFlush = useMutationObserver ( ) ;
} else if ( isWorker ) {
scheduleFlush = useMessageChannel ( ) ;
} else if ( browserWindow === undefined && "function" === 'function' ) {
scheduleFlush = attemptVertx ( ) ;
} else {
scheduleFlush = useSetTimeout ( ) ;
}
function then ( onFulfillment , onRejection ) {
var _arguments = arguments ;
var parent = this ;
var child = new this . constructor ( noop ) ;
if ( child [ PROMISE _ID ] === undefined ) {
makePromise ( child ) ;
}
var _state = parent . _state ;
if ( _state ) {
( function ( ) {
var callback = _arguments [ _state - 1 ] ;
asap ( function ( ) {
return invokeCallback ( _state , child , callback , parent . _result ) ;
} ) ;
} ) ( ) ;
} else {
subscribe ( parent , child , onFulfillment , onRejection ) ;
}
return child ;
}
/ * *
` Promise.resolve ` returns a promise that will become resolved with the
passed ` value ` . It is shorthand for the following :
` ` ` javascript
let promise = new Promise ( function ( resolve , reject ) {
resolve ( 1 ) ;
} ) ;
promise . then ( function ( value ) {
// value === 1
} ) ;
` ` `
Instead of writing the above , your code now simply becomes the following :
` ` ` javascript
let promise = Promise . resolve ( 1 ) ;
promise . then ( function ( value ) {
// value === 1
} ) ;
` ` `
@ method resolve
@ static
@ param { Any } value value that the returned promise will be resolved with
Useful for tooling .
@ return { Promise } a promise that will become fulfilled with the given
` value `
* /
function resolve ( object ) {
/*jshint validthis:true */
var Constructor = this ;
if ( object && typeof object === 'object' && object . constructor === Constructor ) {
return object ;
}
var promise = new Constructor ( noop ) ;
_resolve ( promise , object ) ;
return promise ;
}
var PROMISE _ID = Math . random ( ) . toString ( 36 ) . substring ( 16 ) ;
function noop ( ) { }
var PENDING = void 0 ;
var FULFILLED = 1 ;
var REJECTED = 2 ;
var GET _THEN _ERROR = new ErrorObject ( ) ;
function selfFulfillment ( ) {
return new TypeError ( "You cannot resolve a promise with itself" ) ;
}
function cannotReturnOwn ( ) {
return new TypeError ( 'A promises callback cannot return that same promise.' ) ;
}
function getThen ( promise ) {
try {
return promise . then ;
} catch ( error ) {
GET _THEN _ERROR . error = error ;
return GET _THEN _ERROR ;
}
}
function tryThen ( then , value , fulfillmentHandler , rejectionHandler ) {
try {
then . call ( value , fulfillmentHandler , rejectionHandler ) ;
} catch ( e ) {
return e ;
}
}
function handleForeignThenable ( promise , thenable , then ) {
asap ( function ( promise ) {
var sealed = false ;
var error = tryThen ( then , thenable , function ( value ) {
if ( sealed ) {
return ;
}
sealed = true ;
if ( thenable !== value ) {
_resolve ( promise , value ) ;
} else {
fulfill ( promise , value ) ;
}
} , function ( reason ) {
if ( sealed ) {
return ;
}
sealed = true ;
_reject ( promise , reason ) ;
} , 'Settle: ' + ( promise . _label || ' unknown promise' ) ) ;
if ( ! sealed && error ) {
sealed = true ;
_reject ( promise , error ) ;
}
} , promise ) ;
}
function handleOwnThenable ( promise , thenable ) {
if ( thenable . _state === FULFILLED ) {
fulfill ( promise , thenable . _result ) ;
} else if ( thenable . _state === REJECTED ) {
_reject ( promise , thenable . _result ) ;
} else {
subscribe ( thenable , undefined , function ( value ) {
return _resolve ( promise , value ) ;
} , function ( reason ) {
return _reject ( promise , reason ) ;
} ) ;
}
}
function handleMaybeThenable ( promise , maybeThenable , then$$ ) {
if ( maybeThenable . constructor === promise . constructor && then$$ === then && maybeThenable . constructor . resolve === resolve ) {
handleOwnThenable ( promise , maybeThenable ) ;
} else {
if ( then$$ === GET _THEN _ERROR ) {
_reject ( promise , GET _THEN _ERROR . error ) ;
GET _THEN _ERROR . error = null ;
} else if ( then$$ === undefined ) {
fulfill ( promise , maybeThenable ) ;
} else if ( isFunction ( then$$ ) ) {
handleForeignThenable ( promise , maybeThenable , then$$ ) ;
} else {
fulfill ( promise , maybeThenable ) ;
}
}
}
function _resolve ( promise , value ) {
if ( promise === value ) {
_reject ( promise , selfFulfillment ( ) ) ;
} else if ( objectOrFunction ( value ) ) {
handleMaybeThenable ( promise , value , getThen ( value ) ) ;
} else {
fulfill ( promise , value ) ;
}
}
function publishRejection ( promise ) {
if ( promise . _onerror ) {
promise . _onerror ( promise . _result ) ;
}
publish ( promise ) ;
}
function fulfill ( promise , value ) {
if ( promise . _state !== PENDING ) {
return ;
}
promise . _result = value ;
promise . _state = FULFILLED ;
if ( promise . _subscribers . length !== 0 ) {
asap ( publish , promise ) ;
}
}
function _reject ( promise , reason ) {
if ( promise . _state !== PENDING ) {
return ;
}
promise . _state = REJECTED ;
promise . _result = reason ;
asap ( publishRejection , promise ) ;
}
function subscribe ( parent , child , onFulfillment , onRejection ) {
var _subscribers = parent . _subscribers ;
var length = _subscribers . length ;
parent . _onerror = null ;
_subscribers [ length ] = child ;
_subscribers [ length + FULFILLED ] = onFulfillment ;
_subscribers [ length + REJECTED ] = onRejection ;
if ( length === 0 && parent . _state ) {
asap ( publish , parent ) ;
}
}
function publish ( promise ) {
var subscribers = promise . _subscribers ;
var settled = promise . _state ;
if ( subscribers . length === 0 ) {
return ;
}
var child = undefined ,
callback = undefined ,
detail = promise . _result ;
for ( var i = 0 ; i < subscribers . length ; i += 3 ) {
child = subscribers [ i ] ;
callback = subscribers [ i + settled ] ;
if ( child ) {
invokeCallback ( settled , child , callback , detail ) ;
} else {
callback ( detail ) ;
}
}
promise . _subscribers . length = 0 ;
}
function ErrorObject ( ) {
this . error = null ;
}
var TRY _CATCH _ERROR = new ErrorObject ( ) ;
function tryCatch ( callback , detail ) {
try {
return callback ( detail ) ;
} catch ( e ) {
TRY _CATCH _ERROR . error = e ;
return TRY _CATCH _ERROR ;
}
}
function invokeCallback ( settled , promise , callback , detail ) {
var hasCallback = isFunction ( callback ) ,
value = undefined ,
error = undefined ,
succeeded = undefined ,
failed = undefined ;
if ( hasCallback ) {
value = tryCatch ( callback , detail ) ;
if ( value === TRY _CATCH _ERROR ) {
failed = true ;
error = value . error ;
value . error = null ;
} else {
succeeded = true ;
}
if ( promise === value ) {
_reject ( promise , cannotReturnOwn ( ) ) ;
return ;
}
} else {
value = detail ;
succeeded = true ;
}
if ( promise . _state !== PENDING ) {
// noop
} else if ( hasCallback && succeeded ) {
_resolve ( promise , value ) ;
} else if ( failed ) {
_reject ( promise , error ) ;
} else if ( settled === FULFILLED ) {
fulfill ( promise , value ) ;
} else if ( settled === REJECTED ) {
_reject ( promise , value ) ;
}
}
function initializePromise ( promise , resolver ) {
try {
resolver ( function resolvePromise ( value ) {
_resolve ( promise , value ) ;
} , function rejectPromise ( reason ) {
_reject ( promise , reason ) ;
} ) ;
} catch ( e ) {
_reject ( promise , e ) ;
}
}
var id = 0 ;
function nextId ( ) {
return id ++ ;
}
function makePromise ( promise ) {
promise [ PROMISE _ID ] = id ++ ;
promise . _state = undefined ;
promise . _result = undefined ;
promise . _subscribers = [ ] ;
}
function Enumerator ( Constructor , input ) {
this . _instanceConstructor = Constructor ;
this . promise = new Constructor ( noop ) ;
if ( ! this . promise [ PROMISE _ID ] ) {
makePromise ( this . promise ) ;
}
if ( isArray ( input ) ) {
this . _input = input ;
this . length = input . length ;
this . _remaining = input . length ;
this . _result = new Array ( this . length ) ;
if ( this . length === 0 ) {
fulfill ( this . promise , this . _result ) ;
} else {
this . length = this . length || 0 ;
this . _enumerate ( ) ;
if ( this . _remaining === 0 ) {
fulfill ( this . promise , this . _result ) ;
}
}
} else {
_reject ( this . promise , validationError ( ) ) ;
}
}
function validationError ( ) {
return new Error ( 'Array Methods must be provided an Array' ) ;
} ;
Enumerator . prototype . _enumerate = function ( ) {
var length = this . length ;
var _input = this . _input ;
for ( var i = 0 ; this . _state === PENDING && i < length ; i ++ ) {
this . _eachEntry ( _input [ i ] , i ) ;
}
} ;
Enumerator . prototype . _eachEntry = function ( entry , i ) {
var c = this . _instanceConstructor ;
var resolve$$ = c . resolve ;
if ( resolve$$ === resolve ) {
var _then = getThen ( entry ) ;
if ( _then === then && entry . _state !== PENDING ) {
this . _settledAt ( entry . _state , i , entry . _result ) ;
} else if ( typeof _then !== 'function' ) {
this . _remaining -- ;
this . _result [ i ] = entry ;
} else if ( c === Promise ) {
var promise = new c ( noop ) ;
handleMaybeThenable ( promise , entry , _then ) ;
this . _willSettleAt ( promise , i ) ;
} else {
this . _willSettleAt ( new c ( function ( resolve$$ ) {
return resolve$$ ( entry ) ;
} ) , i ) ;
}
} else {
this . _willSettleAt ( resolve$$ ( entry ) , i ) ;
}
} ;
Enumerator . prototype . _settledAt = function ( state , i , value ) {
var promise = this . promise ;
if ( promise . _state === PENDING ) {
this . _remaining -- ;
if ( state === REJECTED ) {
_reject ( promise , value ) ;
} else {
this . _result [ i ] = value ;
}
}
if ( this . _remaining === 0 ) {
fulfill ( promise , this . _result ) ;
}
} ;
Enumerator . prototype . _willSettleAt = function ( promise , i ) {
var enumerator = this ;
subscribe ( promise , undefined , function ( value ) {
return enumerator . _settledAt ( FULFILLED , i , value ) ;
} , function ( reason ) {
return enumerator . _settledAt ( REJECTED , i , reason ) ;
} ) ;
} ;
/ * *
` Promise.all ` accepts an array of promises , and returns a new promise which
is fulfilled with an array of fulfillment values for the passed promises , or
rejected with the reason of the first passed promise to be rejected . It casts all
elements of the passed iterable to promises as it runs this algorithm .
Example :
` ` ` javascript
let promise1 = resolve ( 1 ) ;
let promise2 = resolve ( 2 ) ;
let promise3 = resolve ( 3 ) ;
let promises = [ promise1 , promise2 , promise3 ] ;
Promise . all ( promises ) . then ( function ( array ) {
// The array here would be [ 1, 2, 3 ];
} ) ;
` ` `
If any of the ` promises ` given to ` all ` are rejected , the first promise
that is rejected will be given as an argument to the returned promises ' s
rejection handler . For example :
Example :
` ` ` javascript
let promise1 = resolve ( 1 ) ;
let promise2 = reject ( new Error ( "2" ) ) ;
let promise3 = reject ( new Error ( "3" ) ) ;
let promises = [ promise1 , promise2 , promise3 ] ;
Promise . all ( promises ) . then ( function ( array ) {
// Code here never runs because there are rejected promises!
} , function ( error ) {
// error.message === "2"
} ) ;
` ` `
@ method all
@ static
@ param { Array } entries array of promises
@ param { String } label optional string for labeling the promise .
Useful for tooling .
@ return { Promise } promise that is fulfilled when all ` promises ` have been
fulfilled , or rejected if any of them become rejected .
@ static
* /
function all ( entries ) {
return new Enumerator ( this , entries ) . promise ;
}
/ * *
` Promise.race ` returns a new promise which is settled in the same way as the
first passed promise to settle .
Example :
` ` ` javascript
let promise1 = new Promise ( function ( resolve , reject ) {
setTimeout ( function ( ) {
resolve ( 'promise 1' ) ;
} , 200 ) ;
} ) ;
let promise2 = new Promise ( function ( resolve , reject ) {
setTimeout ( function ( ) {
resolve ( 'promise 2' ) ;
} , 100 ) ;
} ) ;
Promise . race ( [ promise1 , promise2 ] ) . then ( function ( result ) {
// result === 'promise 2' because it was resolved before promise1
// was resolved.
} ) ;
` ` `
` Promise.race ` is deterministic in that only the state of the first
settled promise matters . For example , even if other promises given to the
` promises ` array argument are resolved , but the first settled promise has
become rejected before the other promises became fulfilled , the returned
promise will become rejected :
` ` ` javascript
let promise1 = new Promise ( function ( resolve , reject ) {
setTimeout ( function ( ) {
resolve ( 'promise 1' ) ;
} , 200 ) ;
} ) ;
let promise2 = new Promise ( function ( resolve , reject ) {
setTimeout ( function ( ) {
reject ( new Error ( 'promise 2' ) ) ;
} , 100 ) ;
} ) ;
Promise . race ( [ promise1 , promise2 ] ) . then ( function ( result ) {
// Code here never runs
} , function ( reason ) {
// reason.message === 'promise 2' because promise 2 became rejected before
// promise 1 became fulfilled
} ) ;
` ` `
An example real - world use case is implementing timeouts :
` ` ` javascript
Promise . race ( [ ajax ( 'foo.json' ) , timeout ( 5000 ) ] )
` ` `
@ method race
@ static
@ param { Array } promises array of promises to observe
Useful for tooling .
@ return { Promise } a promise which settles in the same way as the first passed
promise to settle .
* /
function race ( entries ) {
/*jshint validthis:true */
var Constructor = this ;
if ( ! isArray ( entries ) ) {
return new Constructor ( function ( _ , reject ) {
return reject ( new TypeError ( 'You must pass an array to race.' ) ) ;
} ) ;
} else {
return new Constructor ( function ( resolve , reject ) {
var length = entries . length ;
for ( var i = 0 ; i < length ; i ++ ) {
Constructor . resolve ( entries [ i ] ) . then ( resolve , reject ) ;
}
} ) ;
}
}
/ * *
` Promise.reject ` returns a promise rejected with the passed ` reason ` .
It is shorthand for the following :
` ` ` javascript
let promise = new Promise ( function ( resolve , reject ) {
reject ( new Error ( 'WHOOPS' ) ) ;
} ) ;
promise . then ( function ( value ) {
// Code here doesn't run because the promise is rejected!
} , function ( reason ) {
// reason.message === 'WHOOPS'
} ) ;
` ` `
Instead of writing the above , your code now simply becomes the following :
` ` ` javascript
let promise = Promise . reject ( new Error ( 'WHOOPS' ) ) ;
promise . then ( function ( value ) {
// Code here doesn't run because the promise is rejected!
} , function ( reason ) {
// reason.message === 'WHOOPS'
} ) ;
` ` `
@ method reject
@ static
@ param { Any } reason value that the returned promise will be rejected with .
Useful for tooling .
@ return { Promise } a promise rejected with the given ` reason ` .
* /
function reject ( reason ) {
/*jshint validthis:true */
var Constructor = this ;
var promise = new Constructor ( noop ) ;
_reject ( promise , reason ) ;
return promise ;
}
function needsResolver ( ) {
throw new TypeError ( 'You must pass a resolver function as the first argument to the promise constructor' ) ;
}
function needsNew ( ) {
throw new TypeError ( "Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function." ) ;
}
/ * *
Promise objects represent the eventual result of an asynchronous operation . The
primary way of interacting with a promise is through its ` then ` method , which
registers callbacks to receive either a promise ' s eventual value or the reason
why the promise cannot be fulfilled .
Terminology
-- -- -- -- -- -
- ` promise ` is an object or function with a ` then ` method whose behavior conforms to this specification .
- ` thenable ` is an object or function that defines a ` then ` method .
- ` value ` is any legal JavaScript value ( including undefined , a thenable , or a promise ) .
- ` exception ` is a value that is thrown using the throw statement .
- ` reason ` is a value that indicates why a promise was rejected .
- ` settled ` the final resting state of a promise , fulfilled or rejected .
A promise can be in one of three states : pending , fulfilled , or rejected .
Promises that are fulfilled have a fulfillment value and are in the fulfilled
state . Promises that are rejected have a rejection reason and are in the
rejected state . A fulfillment value is never a thenable .
Promises can also be said to * resolve * a value . If this value is also a
promise , then the original promise 's settled state will match the value' s
settled state . So a promise that * resolves * a promise that rejects will
itself reject , and a promise that * resolves * a promise that fulfills will
itself fulfill .
Basic Usage :
-- -- -- -- -- --
` ` ` js
let promise = new Promise ( function ( resolve , reject ) {
// on success
resolve ( value ) ;
// on failure
reject ( reason ) ;
} ) ;
promise . then ( function ( value ) {
// on fulfillment
} , function ( reason ) {
// on rejection
} ) ;
` ` `
Advanced Usage :
-- -- -- -- -- -- -- -
Promises shine when abstracting away asynchronous interactions such as
` XMLHttpRequest ` s .
` ` ` js
function getJSON ( url ) {
return new Promise ( function ( resolve , reject ) {
let xhr = new XMLHttpRequest ( ) ;
xhr . open ( 'GET' , url ) ;
xhr . onreadystatechange = handler ;
xhr . responseType = 'json' ;
xhr . setRequestHeader ( 'Accept' , 'application/json' ) ;
xhr . send ( ) ;
function handler ( ) {
if ( this . readyState === this . DONE ) {
if ( this . status === 200 ) {
resolve ( this . response ) ;
} else {
reject ( new Error ( 'getJSON: `' + url + '` failed with status: [' + this . status + ']' ) ) ;
}
}
} ;
} ) ;
}
getJSON ( '/posts.json' ) . then ( function ( json ) {
// on fulfillment
} , function ( reason ) {
// on rejection
} ) ;
` ` `
Unlike callbacks , promises are great composable primitives .
` ` ` js
Promise . all ( [
getJSON ( '/posts' ) ,
getJSON ( '/comments' )
] ) . then ( function ( values ) {
values [ 0 ] // => postsJSON
values [ 1 ] // => commentsJSON
return values ;
} ) ;
` ` `
@ class Promise
@ param { function } resolver
Useful for tooling .
@ constructor
* /
function Promise ( resolver ) {
this [ PROMISE _ID ] = nextId ( ) ;
this . _result = this . _state = undefined ;
this . _subscribers = [ ] ;
if ( noop !== resolver ) {
typeof resolver !== 'function' && needsResolver ( ) ;
this instanceof Promise ? initializePromise ( this , resolver ) : needsNew ( ) ;
}
}
Promise . all = all ;
Promise . race = race ;
Promise . resolve = resolve ;
Promise . reject = reject ;
Promise . _setScheduler = setScheduler ;
Promise . _setAsap = setAsap ;
Promise . _asap = asap ;
Promise . prototype = {
constructor : Promise ,
/ * *
The primary way of interacting with a promise is through its ` then ` method ,
which registers callbacks to receive either a promise ' s eventual value or the
reason why the promise cannot be fulfilled .
` ` ` js
findUser ( ) . then ( function ( user ) {
// user is available
} , function ( reason ) {
// user is unavailable, and you are given the reason why
} ) ;
` ` `
Chaining
-- -- -- --
The return value of ` then ` is itself a promise . This second , 'downstream'
promise is resolved with the return value of the first promise ' s fulfillment
or rejection handler , or rejected if the handler throws an exception .
` ` ` js
findUser ( ) . then ( function ( user ) {
return user . name ;
} , function ( reason ) {
return 'default name' ;
} ) . then ( function ( userName ) {
// If `findUser` fulfilled, `userName` will be the user's name, otherwise it
// will be `'default name'`
} ) ;
findUser ( ) . then ( function ( user ) {
throw new Error ( 'Found user, but still unhappy' ) ;
} , function ( reason ) {
throw new Error ( '`findUser` rejected and we' re unhappy ' ) ;
} ) . then ( function ( value ) {
// never reached
} , function ( reason ) {
// if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
// If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
} ) ;
` ` `
If the downstream promise does not specify a rejection handler , rejection reasons will be propagated further downstream .
` ` ` js
findUser ( ) . then ( function ( user ) {
throw new PedagogicalException ( 'Upstream error' ) ;
} ) . then ( function ( value ) {
// never reached
} ) . then ( function ( value ) {
// never reached
} , function ( reason ) {
// The `PedgagocialException` is propagated all the way down to here
} ) ;
` ` `
Assimilation
-- -- -- -- -- --
Sometimes the value you want to propagate to a downstream promise can only be
retrieved asynchronously . This can be achieved by returning a promise in the
fulfillment or rejection handler . The downstream promise will then be pending
until the returned promise is settled . This is called * assimilation * .
` ` ` js
findUser ( ) . then ( function ( user ) {
return findCommentsByAuthor ( user ) ;
} ) . then ( function ( comments ) {
// The user's comments are now available
} ) ;
` ` `
If the assimliated promise rejects , then the downstream promise will also reject .
` ` ` js
findUser ( ) . then ( function ( user ) {
return findCommentsByAuthor ( user ) ;
} ) . then ( function ( comments ) {
// If `findCommentsByAuthor` fulfills, we'll have the value here
} , function ( reason ) {
// If `findCommentsByAuthor` rejects, we'll have the reason here
} ) ;
` ` `
Simple Example
-- -- -- -- -- -- --
Synchronous Example
` ` ` javascript
let result ;
try {
result = findResult ( ) ;
// success
} catch ( reason ) {
// failure
}
` ` `
Errback Example
` ` ` js
findResult ( function ( result , err ) {
if ( err ) {
// failure
} else {
// success
}
} ) ;
` ` `
Promise Example ;
` ` ` javascript
findResult ( ) . then ( function ( result ) {
// success
} , function ( reason ) {
// failure
} ) ;
` ` `
Advanced Example
-- -- -- -- -- -- --
Synchronous Example
` ` ` javascript
let author , books ;
try {
author = findAuthor ( ) ;
books = findBooksByAuthor ( author ) ;
// success
} catch ( reason ) {
// failure
}
` ` `
Errback Example
` ` ` js
function foundBooks ( books ) {
}
function failure ( reason ) {
}
findAuthor ( function ( author , err ) {
if ( err ) {
failure ( err ) ;
// failure
} else {
try {
findBoooksByAuthor ( author , function ( books , err ) {
if ( err ) {
failure ( err ) ;
} else {
try {
foundBooks ( books ) ;
} catch ( reason ) {
failure ( reason ) ;
}
}
} ) ;
} catch ( error ) {
failure ( err ) ;
}
// success
}
} ) ;
` ` `
Promise Example ;
` ` ` javascript
findAuthor ( ) .
then ( findBooksByAuthor ) .
then ( function ( books ) {
// found books
} ) . catch ( function ( reason ) {
// something went wrong
} ) ;
` ` `
@ method then
@ param { Function } onFulfilled
@ param { Function } onRejected
Useful for tooling .
@ return { Promise }
* /
then : then ,
/ * *
` catch ` is simply sugar for ` then(undefined, onRejection) ` which makes it the same
as the catch block of a try / c a t c h s t a t e m e n t .
` ` ` js
function findAuthor ( ) {
throw new Error ( 'couldn' t find that author ' ) ;
}
// synchronous
try {
findAuthor ( ) ;
} catch ( reason ) {
// something went wrong
}
// async with promises
findAuthor ( ) . catch ( function ( reason ) {
// something went wrong
} ) ;
` ` `
@ method catch
@ param { Function } onRejection
Useful for tooling .
@ return { Promise }
* /
'catch' : function _catch ( onRejection ) {
return this . then ( null , onRejection ) ;
}
} ;
function polyfill ( ) {
var local = undefined ;
if ( typeof global !== 'undefined' ) {
local = global ;
} else if ( typeof self !== 'undefined' ) {
local = self ;
} else {
try {
local = Function ( 'return this' ) ( ) ;
} catch ( e ) {
throw new Error ( 'polyfill failed because global object is unavailable in this environment' ) ;
}
}
var P = local . Promise ;
if ( P ) {
var promiseToString = null ;
try {
promiseToString = Object . prototype . toString . call ( P . resolve ( ) ) ;
} catch ( e ) {
// silently ignored
}
if ( promiseToString === '[object Promise]' && ! P . cast ) {
return ;
}
}
local . Promise = Promise ;
}
// Strange compat..
Promise . polyfill = polyfill ;
Promise . Promise = Promise ;
return Promise ;
} ) ) ) ;
//# sourceMappingURL=es6-promise.map
2017-05-05 17:24:23 +02:00
/* WEBPACK VAR INJECTION */ } . call ( exports , _ _webpack _require _ _ ( 13 ) , _ _webpack _require _ _ ( 14 ) ) )
2017-04-26 15:58:19 +02:00
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 82 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
var _ _WEBPACK _AMD _DEFINE _RESULT _ _ ; ( function ( self ) {
'use strict' ;
function fetchPonyfill ( options ) {
var Promise = options && options . Promise || self . Promise ;
var XMLHttpRequest = options && options . XMLHttpRequest || self . XMLHttpRequest ;
var global = self ;
return ( function ( ) {
var self = Object . create ( global , {
fetch : {
value : undefined ,
writable : true
}
} ) ;
( function ( self ) {
'use strict' ;
if ( self . fetch ) {
return
}
var support = {
searchParams : 'URLSearchParams' in self ,
iterable : 'Symbol' in self && 'iterator' in Symbol ,
blob : 'FileReader' in self && 'Blob' in self && ( function ( ) {
try {
new Blob ( )
return true
} catch ( e ) {
return false
}
} ) ( ) ,
formData : 'FormData' in self ,
arrayBuffer : 'ArrayBuffer' in self
}
if ( support . arrayBuffer ) {
var viewClasses = [
'[object Int8Array]' ,
'[object Uint8Array]' ,
'[object Uint8ClampedArray]' ,
'[object Int16Array]' ,
'[object Uint16Array]' ,
'[object Int32Array]' ,
'[object Uint32Array]' ,
'[object Float32Array]' ,
'[object Float64Array]'
]
var isDataView = function ( obj ) {
return obj && DataView . prototype . isPrototypeOf ( obj )
}
var isArrayBufferView = ArrayBuffer . isView || function ( obj ) {
return obj && viewClasses . indexOf ( Object . prototype . toString . call ( obj ) ) > - 1
}
}
function normalizeName ( name ) {
if ( typeof name !== 'string' ) {
name = String ( name )
}
if ( /[^a-z0-9\-#$%&'*+.\^_`|~]/i . test ( name ) ) {
throw new TypeError ( 'Invalid character in header field name' )
}
return name . toLowerCase ( )
}
function normalizeValue ( value ) {
if ( typeof value !== 'string' ) {
value = String ( value )
}
return value
}
// Build a destructive iterator for the value list
function iteratorFor ( items ) {
var iterator = {
next : function ( ) {
var value = items . shift ( )
return { done : value === undefined , value : value }
}
}
if ( support . iterable ) {
iterator [ Symbol . iterator ] = function ( ) {
return iterator
}
}
return iterator
}
function Headers ( headers ) {
this . map = { }
if ( headers instanceof Headers ) {
headers . forEach ( function ( value , name ) {
this . append ( name , value )
} , this )
} else if ( headers ) {
Object . getOwnPropertyNames ( headers ) . forEach ( function ( name ) {
this . append ( name , headers [ name ] )
} , this )
}
}
Headers . prototype . append = function ( name , value ) {
name = normalizeName ( name )
value = normalizeValue ( value )
var oldValue = this . map [ name ]
this . map [ name ] = oldValue ? oldValue + ',' + value : value
}
Headers . prototype [ 'delete' ] = function ( name ) {
delete this . map [ normalizeName ( name ) ]
}
Headers . prototype . get = function ( name ) {
name = normalizeName ( name )
return this . has ( name ) ? this . map [ name ] : null
}
Headers . prototype . has = function ( name ) {
return this . map . hasOwnProperty ( normalizeName ( name ) )
}
Headers . prototype . set = function ( name , value ) {
this . map [ normalizeName ( name ) ] = normalizeValue ( value )
}
Headers . prototype . forEach = function ( callback , thisArg ) {
for ( var name in this . map ) {
if ( this . map . hasOwnProperty ( name ) ) {
callback . call ( thisArg , this . map [ name ] , name , this )
}
}
}
Headers . prototype . keys = function ( ) {
var items = [ ]
this . forEach ( function ( value , name ) { items . push ( name ) } )
return iteratorFor ( items )
}
Headers . prototype . values = function ( ) {
var items = [ ]
this . forEach ( function ( value ) { items . push ( value ) } )
return iteratorFor ( items )
}
Headers . prototype . entries = function ( ) {
var items = [ ]
this . forEach ( function ( value , name ) { items . push ( [ name , value ] ) } )
return iteratorFor ( items )
}
if ( support . iterable ) {
Headers . prototype [ Symbol . iterator ] = Headers . prototype . entries
}
function consumed ( body ) {
if ( body . bodyUsed ) {
return Promise . reject ( new TypeError ( 'Already read' ) )
}
body . bodyUsed = true
}
function fileReaderReady ( reader ) {
return new Promise ( function ( resolve , reject ) {
reader . onload = function ( ) {
resolve ( reader . result )
}
reader . onerror = function ( ) {
reject ( reader . error )
}
} )
}
function readBlobAsArrayBuffer ( blob ) {
var reader = new FileReader ( )
var promise = fileReaderReady ( reader )
reader . readAsArrayBuffer ( blob )
return promise
}
function readBlobAsText ( blob ) {
var reader = new FileReader ( )
var promise = fileReaderReady ( reader )
reader . readAsText ( blob )
return promise
}
function readArrayBufferAsText ( buf ) {
var view = new Uint8Array ( buf )
var chars = new Array ( view . length )
for ( var i = 0 ; i < view . length ; i ++ ) {
chars [ i ] = String . fromCharCode ( view [ i ] )
}
return chars . join ( '' )
}
function bufferClone ( buf ) {
if ( buf . slice ) {
return buf . slice ( 0 )
} else {
var view = new Uint8Array ( buf . byteLength )
view . set ( new Uint8Array ( buf ) )
return view . buffer
}
}
function Body ( ) {
this . bodyUsed = false
this . _initBody = function ( body ) {
this . _bodyInit = body
if ( ! body ) {
this . _bodyText = ''
} else if ( typeof body === 'string' ) {
this . _bodyText = body
} else if ( support . blob && Blob . prototype . isPrototypeOf ( body ) ) {
this . _bodyBlob = body
} else if ( support . formData && FormData . prototype . isPrototypeOf ( body ) ) {
this . _bodyFormData = body
} else if ( support . searchParams && URLSearchParams . prototype . isPrototypeOf ( body ) ) {
this . _bodyText = body . toString ( )
} else if ( support . arrayBuffer && support . blob && isDataView ( body ) ) {
this . _bodyArrayBuffer = bufferClone ( body . buffer )
// IE 10-11 can't handle a DataView body.
this . _bodyInit = new Blob ( [ this . _bodyArrayBuffer ] )
} else if ( support . arrayBuffer && ( ArrayBuffer . prototype . isPrototypeOf ( body ) || isArrayBufferView ( body ) ) ) {
this . _bodyArrayBuffer = bufferClone ( body )
} else {
throw new Error ( 'unsupported BodyInit type' )
}
if ( ! this . headers . get ( 'content-type' ) ) {
if ( typeof body === 'string' ) {
this . headers . set ( 'content-type' , 'text/plain;charset=UTF-8' )
} else if ( this . _bodyBlob && this . _bodyBlob . type ) {
this . headers . set ( 'content-type' , this . _bodyBlob . type )
} else if ( support . searchParams && URLSearchParams . prototype . isPrototypeOf ( body ) ) {
this . headers . set ( 'content-type' , 'application/x-www-form-urlencoded;charset=UTF-8' )
}
}
}
if ( support . blob ) {
this . blob = function ( ) {
var rejected = consumed ( this )
if ( rejected ) {
return rejected
}
if ( this . _bodyBlob ) {
return Promise . resolve ( this . _bodyBlob )
} else if ( this . _bodyArrayBuffer ) {
return Promise . resolve ( new Blob ( [ this . _bodyArrayBuffer ] ) )
} else if ( this . _bodyFormData ) {
throw new Error ( 'could not read FormData body as blob' )
} else {
return Promise . resolve ( new Blob ( [ this . _bodyText ] ) )
}
}
this . arrayBuffer = function ( ) {
if ( this . _bodyArrayBuffer ) {
return consumed ( this ) || Promise . resolve ( this . _bodyArrayBuffer )
} else {
return this . blob ( ) . then ( readBlobAsArrayBuffer )
}
}
}
this . text = function ( ) {
var rejected = consumed ( this )
if ( rejected ) {
return rejected
}
if ( this . _bodyBlob ) {
return readBlobAsText ( this . _bodyBlob )
} else if ( this . _bodyArrayBuffer ) {
return Promise . resolve ( readArrayBufferAsText ( this . _bodyArrayBuffer ) )
} else if ( this . _bodyFormData ) {
throw new Error ( 'could not read FormData body as text' )
} else {
return Promise . resolve ( this . _bodyText )
}
}
if ( support . formData ) {
this . formData = function ( ) {
return this . text ( ) . then ( decode )
}
}
this . json = function ( ) {
return this . text ( ) . then ( JSON . parse )
}
return this
}
// HTTP methods whose capitalization should be normalized
var methods = [ 'DELETE' , 'GET' , 'HEAD' , 'OPTIONS' , 'POST' , 'PUT' ]
function normalizeMethod ( method ) {
var upcased = method . toUpperCase ( )
return ( methods . indexOf ( upcased ) > - 1 ) ? upcased : method
}
function Request ( input , options ) {
options = options || { }
var body = options . body
if ( input instanceof Request ) {
if ( input . bodyUsed ) {
throw new TypeError ( 'Already read' )
}
this . url = input . url
this . credentials = input . credentials
if ( ! options . headers ) {
this . headers = new Headers ( input . headers )
}
this . method = input . method
this . mode = input . mode
if ( ! body && input . _bodyInit != null ) {
body = input . _bodyInit
input . bodyUsed = true
}
} else {
this . url = String ( input )
}
this . credentials = options . credentials || this . credentials || 'omit'
if ( options . headers || ! this . headers ) {
this . headers = new Headers ( options . headers )
}
this . method = normalizeMethod ( options . method || this . method || 'GET' )
this . mode = options . mode || this . mode || null
this . referrer = null
if ( ( this . method === 'GET' || this . method === 'HEAD' ) && body ) {
throw new TypeError ( 'Body not allowed for GET or HEAD requests' )
}
this . _initBody ( body )
}
Request . prototype . clone = function ( ) {
return new Request ( this , { body : this . _bodyInit } )
}
function decode ( body ) {
var form = new FormData ( )
body . trim ( ) . split ( '&' ) . forEach ( function ( bytes ) {
if ( bytes ) {
var split = bytes . split ( '=' )
var name = split . shift ( ) . replace ( /\+/g , ' ' )
var value = split . join ( '=' ) . replace ( /\+/g , ' ' )
form . append ( decodeURIComponent ( name ) , decodeURIComponent ( value ) )
}
} )
return form
}
function parseHeaders ( rawHeaders ) {
var headers = new Headers ( )
rawHeaders . split ( /\r?\n/ ) . forEach ( function ( line ) {
var parts = line . split ( ':' )
var key = parts . shift ( ) . trim ( )
if ( key ) {
var value = parts . join ( ':' ) . trim ( )
headers . append ( key , value )
}
} )
return headers
}
Body . call ( Request . prototype )
function Response ( bodyInit , options ) {
if ( ! options ) {
options = { }
}
this . type = 'default'
this . status = 'status' in options ? options . status : 200
this . ok = this . status >= 200 && this . status < 300
this . statusText = 'statusText' in options ? options . statusText : 'OK'
this . headers = new Headers ( options . headers )
this . url = options . url || ''
this . _initBody ( bodyInit )
}
Body . call ( Response . prototype )
Response . prototype . clone = function ( ) {
return new Response ( this . _bodyInit , {
status : this . status ,
statusText : this . statusText ,
headers : new Headers ( this . headers ) ,
url : this . url
} )
}
Response . error = function ( ) {
var response = new Response ( null , { status : 0 , statusText : '' } )
response . type = 'error'
return response
}
var redirectStatuses = [ 301 , 302 , 303 , 307 , 308 ]
Response . redirect = function ( url , status ) {
if ( redirectStatuses . indexOf ( status ) === - 1 ) {
throw new RangeError ( 'Invalid status code' )
}
return new Response ( null , { status : status , headers : { location : url } } )
}
self . Headers = Headers
self . Request = Request
self . Response = Response
self . fetch = function ( input , init ) {
return new Promise ( function ( resolve , reject ) {
var request = new Request ( input , init )
var xhr = new XMLHttpRequest ( )
xhr . onload = function ( ) {
var options = {
status : xhr . status ,
statusText : xhr . statusText ,
headers : parseHeaders ( xhr . getAllResponseHeaders ( ) || '' )
}
options . url = 'responseURL' in xhr ? xhr . responseURL : options . headers . get ( 'X-Request-URL' )
var body = 'response' in xhr ? xhr . response : xhr . responseText
resolve ( new Response ( body , options ) )
}
xhr . onerror = function ( ) {
reject ( new TypeError ( 'Network request failed' ) )
}
xhr . ontimeout = function ( ) {
reject ( new TypeError ( 'Network request failed' ) )
}
xhr . open ( request . method , request . url , true )
if ( request . credentials === 'include' ) {
xhr . withCredentials = true
}
if ( 'responseType' in xhr && support . blob ) {
xhr . responseType = 'blob'
}
request . headers . forEach ( function ( value , name ) {
xhr . setRequestHeader ( name , value )
} )
xhr . send ( typeof request . _bodyInit === 'undefined' ? null : request . _bodyInit )
} )
}
self . fetch . polyfill = true
} ) ( typeof self !== 'undefined' ? self : this ) ;
return {
fetch : self . fetch ,
Headers : self . Headers ,
Request : self . Request ,
Response : self . Response
} ;
} ( ) ) ;
}
if ( true ) {
! ( _ _WEBPACK _AMD _DEFINE _RESULT _ _ = function ( ) {
return fetchPonyfill ;
} . call ( exports , _ _webpack _require _ _ , exports , module ) ,
_ _WEBPACK _AMD _DEFINE _RESULT _ _ !== undefined && ( module . exports = _ _WEBPACK _AMD _DEFINE _RESULT _ _ ) ) ;
} else if ( typeof exports === 'object' ) {
module . exports = fetchPonyfill ;
} else {
self . fetchPonyfill = fetchPonyfill ;
}
} ( typeof self === 'undefined' ? this : self ) ) ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 83 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
exports . read = function ( buffer , offset , isLE , mLen , nBytes ) {
var e , m
var eLen = nBytes * 8 - mLen - 1
var eMax = ( 1 << eLen ) - 1
var eBias = eMax >> 1
var nBits = - 7
var i = isLE ? ( nBytes - 1 ) : 0
var d = isLE ? - 1 : 1
var s = buffer [ offset + i ]
i += d
e = s & ( ( 1 << ( - nBits ) ) - 1 )
s >>= ( - nBits )
nBits += eLen
for ( ; nBits > 0 ; e = e * 256 + buffer [ offset + i ] , i += d , nBits -= 8 ) { }
m = e & ( ( 1 << ( - nBits ) ) - 1 )
e >>= ( - nBits )
nBits += mLen
for ( ; nBits > 0 ; m = m * 256 + buffer [ offset + i ] , i += d , nBits -= 8 ) { }
if ( e === 0 ) {
e = 1 - eBias
} else if ( e === eMax ) {
return m ? NaN : ( ( s ? - 1 : 1 ) * Infinity )
} else {
m = m + Math . pow ( 2 , mLen )
e = e - eBias
}
return ( s ? - 1 : 1 ) * m * Math . pow ( 2 , e - mLen )
}
exports . write = function ( buffer , value , offset , isLE , mLen , nBytes ) {
var e , m , c
var eLen = nBytes * 8 - mLen - 1
var eMax = ( 1 << eLen ) - 1
var eBias = eMax >> 1
var rt = ( mLen === 23 ? Math . pow ( 2 , - 24 ) - Math . pow ( 2 , - 77 ) : 0 )
var i = isLE ? 0 : ( nBytes - 1 )
var d = isLE ? 1 : - 1
var s = value < 0 || ( value === 0 && 1 / value < 0 ) ? 1 : 0
value = Math . abs ( value )
if ( isNaN ( value ) || value === Infinity ) {
m = isNaN ( value ) ? 1 : 0
e = eMax
} else {
e = Math . floor ( Math . log ( value ) / Math . LN2 )
if ( value * ( c = Math . pow ( 2 , - e ) ) < 1 ) {
e --
c *= 2
}
if ( e + eBias >= 1 ) {
value += rt / c
} else {
value += rt * Math . pow ( 2 , 1 - eBias )
}
if ( value * c >= 2 ) {
e ++
c /= 2
}
if ( e + eBias >= eMax ) {
m = 0
e = eMax
} else if ( e + eBias >= 1 ) {
m = ( value * c - 1 ) * Math . pow ( 2 , mLen )
e = e + eBias
} else {
m = value * Math . pow ( 2 , eBias - 1 ) * Math . pow ( 2 , mLen )
e = 0
}
}
for ( ; mLen >= 8 ; buffer [ offset + i ] = m & 0xff , i += d , m /= 256 , mLen -= 8 ) { }
e = ( e << mLen ) | m
eLen += mLen
for ( ; eLen > 0 ; buffer [ offset + i ] = e & 0xff , i += d , e /= 256 , eLen -= 8 ) { }
buffer [ offset + i - d ] |= s * 128
}
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 84 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
var toString = { } . toString ;
module . exports = Array . isArray || function ( arr ) {
return toString . call ( arr ) == '[object Array]' ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 85 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
var json = typeof JSON !== 'undefined' ? JSON : _ _webpack _require _ _ ( 86 ) ;
2017-04-26 15:58:19 +02:00
module . exports = function ( obj , opts ) {
if ( ! opts ) opts = { } ;
if ( typeof opts === 'function' ) opts = { cmp : opts } ;
var space = opts . space || '' ;
if ( typeof space === 'number' ) space = Array ( space + 1 ) . join ( ' ' ) ;
var cycles = ( typeof opts . cycles === 'boolean' ) ? opts . cycles : false ;
var replacer = opts . replacer || function ( key , value ) { return value ; } ;
var cmp = opts . cmp && ( function ( f ) {
return function ( node ) {
return function ( a , b ) {
var aobj = { key : a , value : node [ a ] } ;
var bobj = { key : b , value : node [ b ] } ;
return f ( aobj , bobj ) ;
} ;
} ;
} ) ( opts . cmp ) ;
var seen = [ ] ;
return ( function stringify ( parent , key , node , level ) {
var indent = space ? ( '\n' + new Array ( level + 1 ) . join ( space ) ) : '' ;
var colonSeparator = space ? ': ' : ':' ;
if ( node && node . toJSON && typeof node . toJSON === 'function' ) {
node = node . toJSON ( ) ;
}
node = replacer . call ( parent , key , node ) ;
if ( node === undefined ) {
return ;
}
if ( typeof node !== 'object' || node === null ) {
return json . stringify ( node ) ;
}
if ( isArray ( node ) ) {
var out = [ ] ;
for ( var i = 0 ; i < node . length ; i ++ ) {
var item = stringify ( node , i , node [ i ] , level + 1 ) || json . stringify ( null ) ;
out . push ( indent + space + item ) ;
}
return '[' + out . join ( ',' ) + indent + ']' ;
}
else {
if ( seen . indexOf ( node ) !== - 1 ) {
if ( cycles ) return json . stringify ( '__cycle__' ) ;
throw new TypeError ( 'Converting circular structure to JSON' ) ;
}
else seen . push ( node ) ;
var keys = objectKeys ( node ) . sort ( cmp && cmp ( node ) ) ;
var out = [ ] ;
for ( var i = 0 ; i < keys . length ; i ++ ) {
var key = keys [ i ] ;
var value = stringify ( node , key , node [ key ] , level + 1 ) ;
if ( ! value ) continue ;
var keyValue = json . stringify ( key )
+ colonSeparator
+ value ;
;
out . push ( indent + space + keyValue ) ;
}
seen . splice ( seen . indexOf ( node ) , 1 ) ;
return '{' + out . join ( ',' ) + indent + '}' ;
}
} ) ( { '' : obj } , '' , obj , 0 ) ;
} ;
var isArray = Array . isArray || function ( x ) {
return { } . toString . call ( x ) === '[object Array]' ;
} ;
var objectKeys = Object . keys || function ( obj ) {
var has = Object . prototype . hasOwnProperty || function ( ) { return true } ;
var keys = [ ] ;
for ( var key in obj ) {
if ( has . call ( obj , key ) ) keys . push ( key ) ;
}
return keys ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 86 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
exports . parse = _ _webpack _require _ _ ( 87 ) ;
exports . stringify = _ _webpack _require _ _ ( 88 ) ;
2017-04-26 15:58:19 +02:00
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 87 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
var at , // The index of the current character
ch , // The current character
escapee = {
'"' : '"' ,
'\\' : '\\' ,
'/' : '/' ,
b : '\b' ,
f : '\f' ,
n : '\n' ,
r : '\r' ,
t : '\t'
} ,
text ,
error = function ( m ) {
// Call error when something is wrong.
throw {
name : 'SyntaxError' ,
message : m ,
at : at ,
text : text
} ;
} ,
next = function ( c ) {
// If a c parameter is provided, verify that it matches the current character.
if ( c && c !== ch ) {
error ( "Expected '" + c + "' instead of '" + ch + "'" ) ;
}
// Get the next character. When there are no more characters,
// return the empty string.
ch = text . charAt ( at ) ;
at += 1 ;
return ch ;
} ,
number = function ( ) {
// Parse a number value.
var number ,
string = '' ;
if ( ch === '-' ) {
string = '-' ;
next ( '-' ) ;
}
while ( ch >= '0' && ch <= '9' ) {
string += ch ;
next ( ) ;
}
if ( ch === '.' ) {
string += '.' ;
while ( next ( ) && ch >= '0' && ch <= '9' ) {
string += ch ;
}
}
if ( ch === 'e' || ch === 'E' ) {
string += ch ;
next ( ) ;
if ( ch === '-' || ch === '+' ) {
string += ch ;
next ( ) ;
}
while ( ch >= '0' && ch <= '9' ) {
string += ch ;
next ( ) ;
}
}
number = + string ;
if ( ! isFinite ( number ) ) {
error ( "Bad number" ) ;
} else {
return number ;
}
} ,
string = function ( ) {
// Parse a string value.
var hex ,
i ,
string = '' ,
uffff ;
// When parsing for string values, we must look for " and \ characters.
if ( ch === '"' ) {
while ( next ( ) ) {
if ( ch === '"' ) {
next ( ) ;
return string ;
} else if ( ch === '\\' ) {
next ( ) ;
if ( ch === 'u' ) {
uffff = 0 ;
for ( i = 0 ; i < 4 ; i += 1 ) {
hex = parseInt ( next ( ) , 16 ) ;
if ( ! isFinite ( hex ) ) {
break ;
}
uffff = uffff * 16 + hex ;
}
string += String . fromCharCode ( uffff ) ;
} else if ( typeof escapee [ ch ] === 'string' ) {
string += escapee [ ch ] ;
} else {
break ;
}
} else {
string += ch ;
}
}
}
error ( "Bad string" ) ;
} ,
white = function ( ) {
// Skip whitespace.
while ( ch && ch <= ' ' ) {
next ( ) ;
}
} ,
word = function ( ) {
// true, false, or null.
switch ( ch ) {
case 't' :
next ( 't' ) ;
next ( 'r' ) ;
next ( 'u' ) ;
next ( 'e' ) ;
return true ;
case 'f' :
next ( 'f' ) ;
next ( 'a' ) ;
next ( 'l' ) ;
next ( 's' ) ;
next ( 'e' ) ;
return false ;
case 'n' :
next ( 'n' ) ;
next ( 'u' ) ;
next ( 'l' ) ;
next ( 'l' ) ;
return null ;
}
error ( "Unexpected '" + ch + "'" ) ;
} ,
value , // Place holder for the value function.
array = function ( ) {
// Parse an array value.
var array = [ ] ;
if ( ch === '[' ) {
next ( '[' ) ;
white ( ) ;
if ( ch === ']' ) {
next ( ']' ) ;
return array ; // empty array
}
while ( ch ) {
array . push ( value ( ) ) ;
white ( ) ;
if ( ch === ']' ) {
next ( ']' ) ;
return array ;
}
next ( ',' ) ;
white ( ) ;
}
}
error ( "Bad array" ) ;
} ,
object = function ( ) {
// Parse an object value.
var key ,
object = { } ;
if ( ch === '{' ) {
next ( '{' ) ;
white ( ) ;
if ( ch === '}' ) {
next ( '}' ) ;
return object ; // empty object
}
while ( ch ) {
key = string ( ) ;
white ( ) ;
next ( ':' ) ;
if ( Object . hasOwnProperty . call ( object , key ) ) {
error ( 'Duplicate key "' + key + '"' ) ;
}
object [ key ] = value ( ) ;
white ( ) ;
if ( ch === '}' ) {
next ( '}' ) ;
return object ;
}
next ( ',' ) ;
white ( ) ;
}
}
error ( "Bad object" ) ;
} ;
value = function ( ) {
// Parse a JSON value. It could be an object, an array, a string, a number,
// or a word.
white ( ) ;
switch ( ch ) {
case '{' :
return object ( ) ;
case '[' :
return array ( ) ;
case '"' :
return string ( ) ;
case '-' :
return number ( ) ;
default :
return ch >= '0' && ch <= '9' ? number ( ) : word ( ) ;
}
} ;
// Return the json_parse function. It will have access to all of the above
// functions and variables.
module . exports = function ( source , reviver ) {
var result ;
text = source ;
at = 0 ;
ch = ' ' ;
result = value ( ) ;
white ( ) ;
if ( ch ) {
error ( "Syntax error" ) ;
}
// If there is a reviver function, we recursively walk the new structure,
// passing each name/value pair to the reviver function for possible
// transformation, starting with a temporary root object that holds the result
// in an empty key. If there is not a reviver function, we simply return the
// result.
return typeof reviver === 'function' ? ( function walk ( holder , key ) {
var k , v , value = holder [ key ] ;
if ( value && typeof value === 'object' ) {
for ( k in value ) {
if ( Object . prototype . hasOwnProperty . call ( value , k ) ) {
v = walk ( value , k ) ;
if ( v !== undefined ) {
value [ k ] = v ;
} else {
delete value [ k ] ;
}
}
}
}
return reviver . call ( holder , key , value ) ;
} ( { '' : result } , '' ) ) : result ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 88 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g ,
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g ,
gap ,
indent ,
meta = { // table of character substitutions
'\b' : '\\b' ,
'\t' : '\\t' ,
'\n' : '\\n' ,
'\f' : '\\f' ,
'\r' : '\\r' ,
'"' : '\\"' ,
'\\' : '\\\\'
} ,
rep ;
function quote ( string ) {
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
escapable . lastIndex = 0 ;
return escapable . test ( string ) ? '"' + string . replace ( escapable , function ( a ) {
var c = meta [ a ] ;
return typeof c === 'string' ? c :
'\\u' + ( '0000' + a . charCodeAt ( 0 ) . toString ( 16 ) ) . slice ( - 4 ) ;
} ) + '"' : '"' + string + '"' ;
}
function str ( key , holder ) {
// Produce a string from holder[key].
var i , // The loop counter.
k , // The member key.
v , // The member value.
length ,
mind = gap ,
partial ,
value = holder [ key ] ;
// If the value has a toJSON method, call it to obtain a replacement value.
if ( value && typeof value === 'object' &&
typeof value . toJSON === 'function' ) {
value = value . toJSON ( key ) ;
}
// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
if ( typeof rep === 'function' ) {
value = rep . call ( holder , key , value ) ;
}
// What happens next depends on the value's type.
switch ( typeof value ) {
case 'string' :
return quote ( value ) ;
case 'number' :
// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite ( value ) ? String ( value ) : 'null' ;
case 'boolean' :
case 'null' :
// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.
return String ( value ) ;
case 'object' :
if ( ! value ) return 'null' ;
gap += indent ;
partial = [ ] ;
// Array.isArray
if ( Object . prototype . toString . apply ( value ) === '[object Array]' ) {
length = value . length ;
for ( i = 0 ; i < length ; i += 1 ) {
partial [ i ] = str ( i , value ) || 'null' ;
}
// Join all of the elements together, separated with commas, and
// wrap them in brackets.
v = partial . length === 0 ? '[]' : gap ?
'[\n' + gap + partial . join ( ',\n' + gap ) + '\n' + mind + ']' :
'[' + partial . join ( ',' ) + ']' ;
gap = mind ;
return v ;
}
// If the replacer is an array, use it to select the members to be
// stringified.
if ( rep && typeof rep === 'object' ) {
length = rep . length ;
for ( i = 0 ; i < length ; i += 1 ) {
k = rep [ i ] ;
if ( typeof k === 'string' ) {
v = str ( k , value ) ;
if ( v ) {
partial . push ( quote ( k ) + ( gap ? ': ' : ':' ) + v ) ;
}
}
}
}
else {
// Otherwise, iterate through all of the keys in the object.
for ( k in value ) {
if ( Object . prototype . hasOwnProperty . call ( value , k ) ) {
v = str ( k , value ) ;
if ( v ) {
partial . push ( quote ( k ) + ( gap ? ': ' : ':' ) + v ) ;
}
}
}
}
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
v = partial . length === 0 ? '{}' : gap ?
'{\n' + gap + partial . join ( ',\n' + gap ) + '\n' + mind + '}' :
'{' + partial . join ( ',' ) + '}' ;
gap = mind ;
return v ;
}
}
module . exports = function ( value , replacer , space ) {
var i ;
gap = '' ;
indent = '' ;
// If the space parameter is a number, make an indent string containing that
// many spaces.
if ( typeof space === 'number' ) {
for ( i = 0 ; i < space ; i += 1 ) {
indent += ' ' ;
}
}
// If the space parameter is a string, it will be used as the indent string.
else if ( typeof space === 'string' ) {
indent = space ;
}
// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.
rep = replacer ;
if ( replacer && typeof replacer !== 'function'
&& ( typeof replacer !== 'object' || typeof replacer . length !== 'number' ) ) {
throw new Error ( 'JSON.stringify' ) ;
}
// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.
return str ( '' , { '' : value } ) ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 89 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
"use strict" ;
/ *
object - assign
( c ) Sindre Sorhus
@ license MIT
* /
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object . getOwnPropertySymbols ;
var hasOwnProperty = Object . prototype . hasOwnProperty ;
var propIsEnumerable = Object . prototype . propertyIsEnumerable ;
function toObject ( val ) {
if ( val === null || val === undefined ) {
throw new TypeError ( 'Object.assign cannot be called with null or undefined' ) ;
}
return Object ( val ) ;
}
function shouldUseNative ( ) {
try {
if ( ! Object . assign ) {
return false ;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String ( 'abc' ) ; // eslint-disable-line no-new-wrappers
test1 [ 5 ] = 'de' ;
if ( Object . getOwnPropertyNames ( test1 ) [ 0 ] === '5' ) {
return false ;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = { } ;
for ( var i = 0 ; i < 10 ; i ++ ) {
test2 [ '_' + String . fromCharCode ( i ) ] = i ;
}
var order2 = Object . getOwnPropertyNames ( test2 ) . map ( function ( n ) {
return test2 [ n ] ;
} ) ;
if ( order2 . join ( '' ) !== '0123456789' ) {
return false ;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = { } ;
'abcdefghijklmnopqrst' . split ( '' ) . forEach ( function ( letter ) {
test3 [ letter ] = letter ;
} ) ;
if ( Object . keys ( Object . assign ( { } , test3 ) ) . join ( '' ) !==
'abcdefghijklmnopqrst' ) {
return false ;
}
return true ;
} catch ( err ) {
// We don't expect any of the above to throw, but better to be safe.
return false ;
}
}
module . exports = shouldUseNative ( ) ? Object . assign : function ( target , source ) {
var from ;
var to = toObject ( target ) ;
var symbols ;
for ( var s = 1 ; s < arguments . length ; s ++ ) {
from = Object ( arguments [ s ] ) ;
for ( var key in from ) {
if ( hasOwnProperty . call ( from , key ) ) {
to [ key ] = from [ key ] ;
}
}
if ( getOwnPropertySymbols ) {
symbols = getOwnPropertySymbols ( from ) ;
for ( var i = 0 ; i < symbols . length ; i ++ ) {
if ( propIsEnumerable . call ( from , symbols [ i ] ) ) {
to [ symbols [ i ] ] = from [ symbols [ i ] ] ;
}
}
}
}
return to ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 90 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
"use strict" ;
2017-05-05 17:24:23 +02:00
var strictUriEncode = _ _webpack _require _ _ ( 91 ) ;
var objectAssign = _ _webpack _require _ _ ( 89 ) ;
2017-04-26 15:58:19 +02:00
function encoderForArrayFormat ( opts ) {
switch ( opts . arrayFormat ) {
case 'index' :
return function ( key , value , index ) {
return value === null ? [
encode ( key , opts ) ,
'[' ,
index ,
']'
] . join ( '' ) : [
encode ( key , opts ) ,
'[' ,
encode ( index , opts ) ,
']=' ,
encode ( value , opts )
] . join ( '' ) ;
} ;
case 'bracket' :
return function ( key , value ) {
return value === null ? encode ( key , opts ) : [
encode ( key , opts ) ,
'[]=' ,
encode ( value , opts )
] . join ( '' ) ;
} ;
default :
return function ( key , value ) {
return value === null ? encode ( key , opts ) : [
encode ( key , opts ) ,
'=' ,
encode ( value , opts )
] . join ( '' ) ;
} ;
}
}
function parserForArrayFormat ( opts ) {
var result ;
switch ( opts . arrayFormat ) {
case 'index' :
return function ( key , value , accumulator ) {
result = /\[(\d*)\]$/ . exec ( key ) ;
key = key . replace ( /\[\d*\]$/ , '' ) ;
if ( ! result ) {
accumulator [ key ] = value ;
return ;
}
if ( accumulator [ key ] === undefined ) {
accumulator [ key ] = { } ;
}
accumulator [ key ] [ result [ 1 ] ] = value ;
} ;
case 'bracket' :
return function ( key , value , accumulator ) {
result = /(\[\])$/ . exec ( key ) ;
key = key . replace ( /\[\]$/ , '' ) ;
2017-05-10 09:36:07 +02:00
if ( ! result ) {
2017-04-26 15:58:19 +02:00
accumulator [ key ] = value ;
return ;
2017-05-10 09:36:07 +02:00
} else if ( accumulator [ key ] === undefined ) {
accumulator [ key ] = [ value ] ;
return ;
2017-04-26 15:58:19 +02:00
}
accumulator [ key ] = [ ] . concat ( accumulator [ key ] , value ) ;
} ;
default :
return function ( key , value , accumulator ) {
if ( accumulator [ key ] === undefined ) {
accumulator [ key ] = value ;
return ;
}
accumulator [ key ] = [ ] . concat ( accumulator [ key ] , value ) ;
} ;
}
}
function encode ( value , opts ) {
if ( opts . encode ) {
return opts . strict ? strictUriEncode ( value ) : encodeURIComponent ( value ) ;
}
return value ;
}
function keysSorter ( input ) {
if ( Array . isArray ( input ) ) {
return input . sort ( ) ;
} else if ( typeof input === 'object' ) {
return keysSorter ( Object . keys ( input ) ) . sort ( function ( a , b ) {
return Number ( a ) - Number ( b ) ;
} ) . map ( function ( key ) {
return input [ key ] ;
} ) ;
}
return input ;
}
exports . extract = function ( str ) {
return str . split ( '?' ) [ 1 ] || '' ;
} ;
exports . parse = function ( str , opts ) {
opts = objectAssign ( { arrayFormat : 'none' } , opts ) ;
var formatter = parserForArrayFormat ( opts ) ;
// Create an object with no prototype
// https://github.com/sindresorhus/query-string/issues/47
var ret = Object . create ( null ) ;
if ( typeof str !== 'string' ) {
return ret ;
}
str = str . trim ( ) . replace ( /^(\?|#|&)/ , '' ) ;
if ( ! str ) {
return ret ;
}
str . split ( '&' ) . forEach ( function ( param ) {
var parts = param . replace ( /\+/g , ' ' ) . split ( '=' ) ;
// Firefox (pre 40) decodes `%3D` to `=`
// https://github.com/sindresorhus/query-string/pull/37
var key = parts . shift ( ) ;
var val = parts . length > 0 ? parts . join ( '=' ) : undefined ;
// missing `=` should be `null`:
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
val = val === undefined ? null : decodeURIComponent ( val ) ;
formatter ( decodeURIComponent ( key ) , val , ret ) ;
} ) ;
return Object . keys ( ret ) . sort ( ) . reduce ( function ( result , key ) {
var val = ret [ key ] ;
if ( Boolean ( val ) && typeof val === 'object' && ! Array . isArray ( val ) ) {
// Sort object keys, not values
result [ key ] = keysSorter ( val ) ;
} else {
result [ key ] = val ;
}
return result ;
} , Object . create ( null ) ) ;
} ;
exports . stringify = function ( obj , opts ) {
var defaults = {
encode : true ,
strict : true ,
arrayFormat : 'none'
} ;
opts = objectAssign ( defaults , opts ) ;
var formatter = encoderForArrayFormat ( opts ) ;
return obj ? Object . keys ( obj ) . sort ( ) . map ( function ( key ) {
var val = obj [ key ] ;
if ( val === undefined ) {
return '' ;
}
if ( val === null ) {
return encode ( key , opts ) ;
}
if ( Array . isArray ( val ) ) {
var result = [ ] ;
val . slice ( ) . forEach ( function ( val2 ) {
if ( val2 === undefined ) {
return ;
}
result . push ( formatter ( key , val2 , result . length ) ) ;
} ) ;
return result . join ( '&' ) ;
}
return encode ( key , opts ) + '=' + encode ( val , opts ) ;
} ) . filter ( function ( x ) {
return x . length > 0 ;
} ) . join ( '&' ) : '' ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 91 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
"use strict" ;
module . exports = function ( str ) {
return encodeURIComponent ( str ) . replace ( /[!'()*]/g , function ( c ) {
return '%' + c . charCodeAt ( 0 ) . toString ( 16 ) . toUpperCase ( ) ;
} ) ;
} ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 92 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
( function ( nacl ) {
'use strict' ;
// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
// Public domain.
//
// Implementation derived from TweetNaCl version 20140427.
// See for details: http://tweetnacl.cr.yp.to/
var gf = function ( init ) {
var i , r = new Float64Array ( 16 ) ;
if ( init ) for ( i = 0 ; i < init . length ; i ++ ) r [ i ] = init [ i ] ;
return r ;
} ;
// Pluggable, initialized in high-level API below.
var randombytes = function ( /* x, n */ ) { throw new Error ( 'no PRNG' ) ; } ;
var _0 = new Uint8Array ( 16 ) ;
var _9 = new Uint8Array ( 32 ) ; _9 [ 0 ] = 9 ;
var gf0 = gf ( ) ,
gf1 = gf ( [ 1 ] ) ,
_121665 = gf ( [ 0xdb41 , 1 ] ) ,
D = gf ( [ 0x78a3 , 0x1359 , 0x4dca , 0x75eb , 0xd8ab , 0x4141 , 0x0a4d , 0x0070 , 0xe898 , 0x7779 , 0x4079 , 0x8cc7 , 0xfe73 , 0x2b6f , 0x6cee , 0x5203 ] ) ,
D2 = gf ( [ 0xf159 , 0x26b2 , 0x9b94 , 0xebd6 , 0xb156 , 0x8283 , 0x149a , 0x00e0 , 0xd130 , 0xeef3 , 0x80f2 , 0x198e , 0xfce7 , 0x56df , 0xd9dc , 0x2406 ] ) ,
X = gf ( [ 0xd51a , 0x8f25 , 0x2d60 , 0xc956 , 0xa7b2 , 0x9525 , 0xc760 , 0x692c , 0xdc5c , 0xfdd6 , 0xe231 , 0xc0a4 , 0x53fe , 0xcd6e , 0x36d3 , 0x2169 ] ) ,
Y = gf ( [ 0x6658 , 0x6666 , 0x6666 , 0x6666 , 0x6666 , 0x6666 , 0x6666 , 0x6666 , 0x6666 , 0x6666 , 0x6666 , 0x6666 , 0x6666 , 0x6666 , 0x6666 , 0x6666 ] ) ,
I = gf ( [ 0xa0b0 , 0x4a0e , 0x1b27 , 0xc4ee , 0xe478 , 0xad2f , 0x1806 , 0x2f43 , 0xd7a7 , 0x3dfb , 0x0099 , 0x2b4d , 0xdf0b , 0x4fc1 , 0x2480 , 0x2b83 ] ) ;
function ts64 ( x , i , h , l ) {
x [ i ] = ( h >> 24 ) & 0xff ;
x [ i + 1 ] = ( h >> 16 ) & 0xff ;
x [ i + 2 ] = ( h >> 8 ) & 0xff ;
x [ i + 3 ] = h & 0xff ;
x [ i + 4 ] = ( l >> 24 ) & 0xff ;
x [ i + 5 ] = ( l >> 16 ) & 0xff ;
x [ i + 6 ] = ( l >> 8 ) & 0xff ;
x [ i + 7 ] = l & 0xff ;
}
function vn ( x , xi , y , yi , n ) {
var i , d = 0 ;
for ( i = 0 ; i < n ; i ++ ) d |= x [ xi + i ] ^ y [ yi + i ] ;
return ( 1 & ( ( d - 1 ) >>> 8 ) ) - 1 ;
}
function crypto _verify _16 ( x , xi , y , yi ) {
return vn ( x , xi , y , yi , 16 ) ;
}
function crypto _verify _32 ( x , xi , y , yi ) {
return vn ( x , xi , y , yi , 32 ) ;
}
function core _salsa20 ( o , p , k , c ) {
var j0 = c [ 0 ] & 0xff | ( c [ 1 ] & 0xff ) << 8 | ( c [ 2 ] & 0xff ) << 16 | ( c [ 3 ] & 0xff ) << 24 ,
j1 = k [ 0 ] & 0xff | ( k [ 1 ] & 0xff ) << 8 | ( k [ 2 ] & 0xff ) << 16 | ( k [ 3 ] & 0xff ) << 24 ,
j2 = k [ 4 ] & 0xff | ( k [ 5 ] & 0xff ) << 8 | ( k [ 6 ] & 0xff ) << 16 | ( k [ 7 ] & 0xff ) << 24 ,
j3 = k [ 8 ] & 0xff | ( k [ 9 ] & 0xff ) << 8 | ( k [ 10 ] & 0xff ) << 16 | ( k [ 11 ] & 0xff ) << 24 ,
j4 = k [ 12 ] & 0xff | ( k [ 13 ] & 0xff ) << 8 | ( k [ 14 ] & 0xff ) << 16 | ( k [ 15 ] & 0xff ) << 24 ,
j5 = c [ 4 ] & 0xff | ( c [ 5 ] & 0xff ) << 8 | ( c [ 6 ] & 0xff ) << 16 | ( c [ 7 ] & 0xff ) << 24 ,
j6 = p [ 0 ] & 0xff | ( p [ 1 ] & 0xff ) << 8 | ( p [ 2 ] & 0xff ) << 16 | ( p [ 3 ] & 0xff ) << 24 ,
j7 = p [ 4 ] & 0xff | ( p [ 5 ] & 0xff ) << 8 | ( p [ 6 ] & 0xff ) << 16 | ( p [ 7 ] & 0xff ) << 24 ,
j8 = p [ 8 ] & 0xff | ( p [ 9 ] & 0xff ) << 8 | ( p [ 10 ] & 0xff ) << 16 | ( p [ 11 ] & 0xff ) << 24 ,
j9 = p [ 12 ] & 0xff | ( p [ 13 ] & 0xff ) << 8 | ( p [ 14 ] & 0xff ) << 16 | ( p [ 15 ] & 0xff ) << 24 ,
j10 = c [ 8 ] & 0xff | ( c [ 9 ] & 0xff ) << 8 | ( c [ 10 ] & 0xff ) << 16 | ( c [ 11 ] & 0xff ) << 24 ,
j11 = k [ 16 ] & 0xff | ( k [ 17 ] & 0xff ) << 8 | ( k [ 18 ] & 0xff ) << 16 | ( k [ 19 ] & 0xff ) << 24 ,
j12 = k [ 20 ] & 0xff | ( k [ 21 ] & 0xff ) << 8 | ( k [ 22 ] & 0xff ) << 16 | ( k [ 23 ] & 0xff ) << 24 ,
j13 = k [ 24 ] & 0xff | ( k [ 25 ] & 0xff ) << 8 | ( k [ 26 ] & 0xff ) << 16 | ( k [ 27 ] & 0xff ) << 24 ,
j14 = k [ 28 ] & 0xff | ( k [ 29 ] & 0xff ) << 8 | ( k [ 30 ] & 0xff ) << 16 | ( k [ 31 ] & 0xff ) << 24 ,
j15 = c [ 12 ] & 0xff | ( c [ 13 ] & 0xff ) << 8 | ( c [ 14 ] & 0xff ) << 16 | ( c [ 15 ] & 0xff ) << 24 ;
var x0 = j0 , x1 = j1 , x2 = j2 , x3 = j3 , x4 = j4 , x5 = j5 , x6 = j6 , x7 = j7 ,
x8 = j8 , x9 = j9 , x10 = j10 , x11 = j11 , x12 = j12 , x13 = j13 , x14 = j14 ,
x15 = j15 , u ;
for ( var i = 0 ; i < 20 ; i += 2 ) {
u = x0 + x12 | 0 ;
x4 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x4 + x0 | 0 ;
x8 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x8 + x4 | 0 ;
x12 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x12 + x8 | 0 ;
x0 ^= u << 18 | u >>> ( 32 - 18 ) ;
u = x5 + x1 | 0 ;
x9 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x9 + x5 | 0 ;
x13 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x13 + x9 | 0 ;
x1 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x1 + x13 | 0 ;
x5 ^= u << 18 | u >>> ( 32 - 18 ) ;
u = x10 + x6 | 0 ;
x14 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x14 + x10 | 0 ;
x2 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x2 + x14 | 0 ;
x6 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x6 + x2 | 0 ;
x10 ^= u << 18 | u >>> ( 32 - 18 ) ;
u = x15 + x11 | 0 ;
x3 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x3 + x15 | 0 ;
x7 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x7 + x3 | 0 ;
x11 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x11 + x7 | 0 ;
x15 ^= u << 18 | u >>> ( 32 - 18 ) ;
u = x0 + x3 | 0 ;
x1 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x1 + x0 | 0 ;
x2 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x2 + x1 | 0 ;
x3 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x3 + x2 | 0 ;
x0 ^= u << 18 | u >>> ( 32 - 18 ) ;
u = x5 + x4 | 0 ;
x6 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x6 + x5 | 0 ;
x7 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x7 + x6 | 0 ;
x4 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x4 + x7 | 0 ;
x5 ^= u << 18 | u >>> ( 32 - 18 ) ;
u = x10 + x9 | 0 ;
x11 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x11 + x10 | 0 ;
x8 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x8 + x11 | 0 ;
x9 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x9 + x8 | 0 ;
x10 ^= u << 18 | u >>> ( 32 - 18 ) ;
u = x15 + x14 | 0 ;
x12 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x12 + x15 | 0 ;
x13 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x13 + x12 | 0 ;
x14 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x14 + x13 | 0 ;
x15 ^= u << 18 | u >>> ( 32 - 18 ) ;
}
x0 = x0 + j0 | 0 ;
x1 = x1 + j1 | 0 ;
x2 = x2 + j2 | 0 ;
x3 = x3 + j3 | 0 ;
x4 = x4 + j4 | 0 ;
x5 = x5 + j5 | 0 ;
x6 = x6 + j6 | 0 ;
x7 = x7 + j7 | 0 ;
x8 = x8 + j8 | 0 ;
x9 = x9 + j9 | 0 ;
x10 = x10 + j10 | 0 ;
x11 = x11 + j11 | 0 ;
x12 = x12 + j12 | 0 ;
x13 = x13 + j13 | 0 ;
x14 = x14 + j14 | 0 ;
x15 = x15 + j15 | 0 ;
o [ 0 ] = x0 >>> 0 & 0xff ;
o [ 1 ] = x0 >>> 8 & 0xff ;
o [ 2 ] = x0 >>> 16 & 0xff ;
o [ 3 ] = x0 >>> 24 & 0xff ;
o [ 4 ] = x1 >>> 0 & 0xff ;
o [ 5 ] = x1 >>> 8 & 0xff ;
o [ 6 ] = x1 >>> 16 & 0xff ;
o [ 7 ] = x1 >>> 24 & 0xff ;
o [ 8 ] = x2 >>> 0 & 0xff ;
o [ 9 ] = x2 >>> 8 & 0xff ;
o [ 10 ] = x2 >>> 16 & 0xff ;
o [ 11 ] = x2 >>> 24 & 0xff ;
o [ 12 ] = x3 >>> 0 & 0xff ;
o [ 13 ] = x3 >>> 8 & 0xff ;
o [ 14 ] = x3 >>> 16 & 0xff ;
o [ 15 ] = x3 >>> 24 & 0xff ;
o [ 16 ] = x4 >>> 0 & 0xff ;
o [ 17 ] = x4 >>> 8 & 0xff ;
o [ 18 ] = x4 >>> 16 & 0xff ;
o [ 19 ] = x4 >>> 24 & 0xff ;
o [ 20 ] = x5 >>> 0 & 0xff ;
o [ 21 ] = x5 >>> 8 & 0xff ;
o [ 22 ] = x5 >>> 16 & 0xff ;
o [ 23 ] = x5 >>> 24 & 0xff ;
o [ 24 ] = x6 >>> 0 & 0xff ;
o [ 25 ] = x6 >>> 8 & 0xff ;
o [ 26 ] = x6 >>> 16 & 0xff ;
o [ 27 ] = x6 >>> 24 & 0xff ;
o [ 28 ] = x7 >>> 0 & 0xff ;
o [ 29 ] = x7 >>> 8 & 0xff ;
o [ 30 ] = x7 >>> 16 & 0xff ;
o [ 31 ] = x7 >>> 24 & 0xff ;
o [ 32 ] = x8 >>> 0 & 0xff ;
o [ 33 ] = x8 >>> 8 & 0xff ;
o [ 34 ] = x8 >>> 16 & 0xff ;
o [ 35 ] = x8 >>> 24 & 0xff ;
o [ 36 ] = x9 >>> 0 & 0xff ;
o [ 37 ] = x9 >>> 8 & 0xff ;
o [ 38 ] = x9 >>> 16 & 0xff ;
o [ 39 ] = x9 >>> 24 & 0xff ;
o [ 40 ] = x10 >>> 0 & 0xff ;
o [ 41 ] = x10 >>> 8 & 0xff ;
o [ 42 ] = x10 >>> 16 & 0xff ;
o [ 43 ] = x10 >>> 24 & 0xff ;
o [ 44 ] = x11 >>> 0 & 0xff ;
o [ 45 ] = x11 >>> 8 & 0xff ;
o [ 46 ] = x11 >>> 16 & 0xff ;
o [ 47 ] = x11 >>> 24 & 0xff ;
o [ 48 ] = x12 >>> 0 & 0xff ;
o [ 49 ] = x12 >>> 8 & 0xff ;
o [ 50 ] = x12 >>> 16 & 0xff ;
o [ 51 ] = x12 >>> 24 & 0xff ;
o [ 52 ] = x13 >>> 0 & 0xff ;
o [ 53 ] = x13 >>> 8 & 0xff ;
o [ 54 ] = x13 >>> 16 & 0xff ;
o [ 55 ] = x13 >>> 24 & 0xff ;
o [ 56 ] = x14 >>> 0 & 0xff ;
o [ 57 ] = x14 >>> 8 & 0xff ;
o [ 58 ] = x14 >>> 16 & 0xff ;
o [ 59 ] = x14 >>> 24 & 0xff ;
o [ 60 ] = x15 >>> 0 & 0xff ;
o [ 61 ] = x15 >>> 8 & 0xff ;
o [ 62 ] = x15 >>> 16 & 0xff ;
o [ 63 ] = x15 >>> 24 & 0xff ;
}
function core _hsalsa20 ( o , p , k , c ) {
var j0 = c [ 0 ] & 0xff | ( c [ 1 ] & 0xff ) << 8 | ( c [ 2 ] & 0xff ) << 16 | ( c [ 3 ] & 0xff ) << 24 ,
j1 = k [ 0 ] & 0xff | ( k [ 1 ] & 0xff ) << 8 | ( k [ 2 ] & 0xff ) << 16 | ( k [ 3 ] & 0xff ) << 24 ,
j2 = k [ 4 ] & 0xff | ( k [ 5 ] & 0xff ) << 8 | ( k [ 6 ] & 0xff ) << 16 | ( k [ 7 ] & 0xff ) << 24 ,
j3 = k [ 8 ] & 0xff | ( k [ 9 ] & 0xff ) << 8 | ( k [ 10 ] & 0xff ) << 16 | ( k [ 11 ] & 0xff ) << 24 ,
j4 = k [ 12 ] & 0xff | ( k [ 13 ] & 0xff ) << 8 | ( k [ 14 ] & 0xff ) << 16 | ( k [ 15 ] & 0xff ) << 24 ,
j5 = c [ 4 ] & 0xff | ( c [ 5 ] & 0xff ) << 8 | ( c [ 6 ] & 0xff ) << 16 | ( c [ 7 ] & 0xff ) << 24 ,
j6 = p [ 0 ] & 0xff | ( p [ 1 ] & 0xff ) << 8 | ( p [ 2 ] & 0xff ) << 16 | ( p [ 3 ] & 0xff ) << 24 ,
j7 = p [ 4 ] & 0xff | ( p [ 5 ] & 0xff ) << 8 | ( p [ 6 ] & 0xff ) << 16 | ( p [ 7 ] & 0xff ) << 24 ,
j8 = p [ 8 ] & 0xff | ( p [ 9 ] & 0xff ) << 8 | ( p [ 10 ] & 0xff ) << 16 | ( p [ 11 ] & 0xff ) << 24 ,
j9 = p [ 12 ] & 0xff | ( p [ 13 ] & 0xff ) << 8 | ( p [ 14 ] & 0xff ) << 16 | ( p [ 15 ] & 0xff ) << 24 ,
j10 = c [ 8 ] & 0xff | ( c [ 9 ] & 0xff ) << 8 | ( c [ 10 ] & 0xff ) << 16 | ( c [ 11 ] & 0xff ) << 24 ,
j11 = k [ 16 ] & 0xff | ( k [ 17 ] & 0xff ) << 8 | ( k [ 18 ] & 0xff ) << 16 | ( k [ 19 ] & 0xff ) << 24 ,
j12 = k [ 20 ] & 0xff | ( k [ 21 ] & 0xff ) << 8 | ( k [ 22 ] & 0xff ) << 16 | ( k [ 23 ] & 0xff ) << 24 ,
j13 = k [ 24 ] & 0xff | ( k [ 25 ] & 0xff ) << 8 | ( k [ 26 ] & 0xff ) << 16 | ( k [ 27 ] & 0xff ) << 24 ,
j14 = k [ 28 ] & 0xff | ( k [ 29 ] & 0xff ) << 8 | ( k [ 30 ] & 0xff ) << 16 | ( k [ 31 ] & 0xff ) << 24 ,
j15 = c [ 12 ] & 0xff | ( c [ 13 ] & 0xff ) << 8 | ( c [ 14 ] & 0xff ) << 16 | ( c [ 15 ] & 0xff ) << 24 ;
var x0 = j0 , x1 = j1 , x2 = j2 , x3 = j3 , x4 = j4 , x5 = j5 , x6 = j6 , x7 = j7 ,
x8 = j8 , x9 = j9 , x10 = j10 , x11 = j11 , x12 = j12 , x13 = j13 , x14 = j14 ,
x15 = j15 , u ;
for ( var i = 0 ; i < 20 ; i += 2 ) {
u = x0 + x12 | 0 ;
x4 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x4 + x0 | 0 ;
x8 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x8 + x4 | 0 ;
x12 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x12 + x8 | 0 ;
x0 ^= u << 18 | u >>> ( 32 - 18 ) ;
u = x5 + x1 | 0 ;
x9 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x9 + x5 | 0 ;
x13 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x13 + x9 | 0 ;
x1 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x1 + x13 | 0 ;
x5 ^= u << 18 | u >>> ( 32 - 18 ) ;
u = x10 + x6 | 0 ;
x14 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x14 + x10 | 0 ;
x2 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x2 + x14 | 0 ;
x6 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x6 + x2 | 0 ;
x10 ^= u << 18 | u >>> ( 32 - 18 ) ;
u = x15 + x11 | 0 ;
x3 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x3 + x15 | 0 ;
x7 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x7 + x3 | 0 ;
x11 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x11 + x7 | 0 ;
x15 ^= u << 18 | u >>> ( 32 - 18 ) ;
u = x0 + x3 | 0 ;
x1 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x1 + x0 | 0 ;
x2 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x2 + x1 | 0 ;
x3 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x3 + x2 | 0 ;
x0 ^= u << 18 | u >>> ( 32 - 18 ) ;
u = x5 + x4 | 0 ;
x6 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x6 + x5 | 0 ;
x7 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x7 + x6 | 0 ;
x4 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x4 + x7 | 0 ;
x5 ^= u << 18 | u >>> ( 32 - 18 ) ;
u = x10 + x9 | 0 ;
x11 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x11 + x10 | 0 ;
x8 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x8 + x11 | 0 ;
x9 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x9 + x8 | 0 ;
x10 ^= u << 18 | u >>> ( 32 - 18 ) ;
u = x15 + x14 | 0 ;
x12 ^= u << 7 | u >>> ( 32 - 7 ) ;
u = x12 + x15 | 0 ;
x13 ^= u << 9 | u >>> ( 32 - 9 ) ;
u = x13 + x12 | 0 ;
x14 ^= u << 13 | u >>> ( 32 - 13 ) ;
u = x14 + x13 | 0 ;
x15 ^= u << 18 | u >>> ( 32 - 18 ) ;
}
o [ 0 ] = x0 >>> 0 & 0xff ;
o [ 1 ] = x0 >>> 8 & 0xff ;
o [ 2 ] = x0 >>> 16 & 0xff ;
o [ 3 ] = x0 >>> 24 & 0xff ;
o [ 4 ] = x5 >>> 0 & 0xff ;
o [ 5 ] = x5 >>> 8 & 0xff ;
o [ 6 ] = x5 >>> 16 & 0xff ;
o [ 7 ] = x5 >>> 24 & 0xff ;
o [ 8 ] = x10 >>> 0 & 0xff ;
o [ 9 ] = x10 >>> 8 & 0xff ;
o [ 10 ] = x10 >>> 16 & 0xff ;
o [ 11 ] = x10 >>> 24 & 0xff ;
o [ 12 ] = x15 >>> 0 & 0xff ;
o [ 13 ] = x15 >>> 8 & 0xff ;
o [ 14 ] = x15 >>> 16 & 0xff ;
o [ 15 ] = x15 >>> 24 & 0xff ;
o [ 16 ] = x6 >>> 0 & 0xff ;
o [ 17 ] = x6 >>> 8 & 0xff ;
o [ 18 ] = x6 >>> 16 & 0xff ;
o [ 19 ] = x6 >>> 24 & 0xff ;
o [ 20 ] = x7 >>> 0 & 0xff ;
o [ 21 ] = x7 >>> 8 & 0xff ;
o [ 22 ] = x7 >>> 16 & 0xff ;
o [ 23 ] = x7 >>> 24 & 0xff ;
o [ 24 ] = x8 >>> 0 & 0xff ;
o [ 25 ] = x8 >>> 8 & 0xff ;
o [ 26 ] = x8 >>> 16 & 0xff ;
o [ 27 ] = x8 >>> 24 & 0xff ;
o [ 28 ] = x9 >>> 0 & 0xff ;
o [ 29 ] = x9 >>> 8 & 0xff ;
o [ 30 ] = x9 >>> 16 & 0xff ;
o [ 31 ] = x9 >>> 24 & 0xff ;
}
function crypto _core _salsa20 ( out , inp , k , c ) {
core _salsa20 ( out , inp , k , c ) ;
}
function crypto _core _hsalsa20 ( out , inp , k , c ) {
core _hsalsa20 ( out , inp , k , c ) ;
}
var sigma = new Uint8Array ( [ 101 , 120 , 112 , 97 , 110 , 100 , 32 , 51 , 50 , 45 , 98 , 121 , 116 , 101 , 32 , 107 ] ) ;
// "expand 32-byte k"
function crypto _stream _salsa20 _xor ( c , cpos , m , mpos , b , n , k ) {
var z = new Uint8Array ( 16 ) , x = new Uint8Array ( 64 ) ;
var u , i ;
for ( i = 0 ; i < 16 ; i ++ ) z [ i ] = 0 ;
for ( i = 0 ; i < 8 ; i ++ ) z [ i ] = n [ i ] ;
while ( b >= 64 ) {
crypto _core _salsa20 ( x , z , k , sigma ) ;
for ( i = 0 ; i < 64 ; i ++ ) c [ cpos + i ] = m [ mpos + i ] ^ x [ i ] ;
u = 1 ;
for ( i = 8 ; i < 16 ; i ++ ) {
u = u + ( z [ i ] & 0xff ) | 0 ;
z [ i ] = u & 0xff ;
u >>>= 8 ;
}
b -= 64 ;
cpos += 64 ;
mpos += 64 ;
}
if ( b > 0 ) {
crypto _core _salsa20 ( x , z , k , sigma ) ;
for ( i = 0 ; i < b ; i ++ ) c [ cpos + i ] = m [ mpos + i ] ^ x [ i ] ;
}
return 0 ;
}
function crypto _stream _salsa20 ( c , cpos , b , n , k ) {
var z = new Uint8Array ( 16 ) , x = new Uint8Array ( 64 ) ;
var u , i ;
for ( i = 0 ; i < 16 ; i ++ ) z [ i ] = 0 ;
for ( i = 0 ; i < 8 ; i ++ ) z [ i ] = n [ i ] ;
while ( b >= 64 ) {
crypto _core _salsa20 ( x , z , k , sigma ) ;
for ( i = 0 ; i < 64 ; i ++ ) c [ cpos + i ] = x [ i ] ;
u = 1 ;
for ( i = 8 ; i < 16 ; i ++ ) {
u = u + ( z [ i ] & 0xff ) | 0 ;
z [ i ] = u & 0xff ;
u >>>= 8 ;
}
b -= 64 ;
cpos += 64 ;
}
if ( b > 0 ) {
crypto _core _salsa20 ( x , z , k , sigma ) ;
for ( i = 0 ; i < b ; i ++ ) c [ cpos + i ] = x [ i ] ;
}
return 0 ;
}
function crypto _stream ( c , cpos , d , n , k ) {
var s = new Uint8Array ( 32 ) ;
crypto _core _hsalsa20 ( s , n , k , sigma ) ;
var sn = new Uint8Array ( 8 ) ;
for ( var i = 0 ; i < 8 ; i ++ ) sn [ i ] = n [ i + 16 ] ;
return crypto _stream _salsa20 ( c , cpos , d , sn , s ) ;
}
function crypto _stream _xor ( c , cpos , m , mpos , d , n , k ) {
var s = new Uint8Array ( 32 ) ;
crypto _core _hsalsa20 ( s , n , k , sigma ) ;
var sn = new Uint8Array ( 8 ) ;
for ( var i = 0 ; i < 8 ; i ++ ) sn [ i ] = n [ i + 16 ] ;
return crypto _stream _salsa20 _xor ( c , cpos , m , mpos , d , sn , s ) ;
}
/ *
* Port of Andrew Moon ' s Poly1305 - donna - 16. Public domain .
* https : //github.com/floodyberry/poly1305-donna
* /
var poly1305 = function ( key ) {
this . buffer = new Uint8Array ( 16 ) ;
this . r = new Uint16Array ( 10 ) ;
this . h = new Uint16Array ( 10 ) ;
this . pad = new Uint16Array ( 8 ) ;
this . leftover = 0 ;
this . fin = 0 ;
var t0 , t1 , t2 , t3 , t4 , t5 , t6 , t7 ;
t0 = key [ 0 ] & 0xff | ( key [ 1 ] & 0xff ) << 8 ; this . r [ 0 ] = ( t0 ) & 0x1fff ;
t1 = key [ 2 ] & 0xff | ( key [ 3 ] & 0xff ) << 8 ; this . r [ 1 ] = ( ( t0 >>> 13 ) | ( t1 << 3 ) ) & 0x1fff ;
t2 = key [ 4 ] & 0xff | ( key [ 5 ] & 0xff ) << 8 ; this . r [ 2 ] = ( ( t1 >>> 10 ) | ( t2 << 6 ) ) & 0x1f03 ;
t3 = key [ 6 ] & 0xff | ( key [ 7 ] & 0xff ) << 8 ; this . r [ 3 ] = ( ( t2 >>> 7 ) | ( t3 << 9 ) ) & 0x1fff ;
t4 = key [ 8 ] & 0xff | ( key [ 9 ] & 0xff ) << 8 ; this . r [ 4 ] = ( ( t3 >>> 4 ) | ( t4 << 12 ) ) & 0x00ff ;
this . r [ 5 ] = ( ( t4 >>> 1 ) ) & 0x1ffe ;
t5 = key [ 10 ] & 0xff | ( key [ 11 ] & 0xff ) << 8 ; this . r [ 6 ] = ( ( t4 >>> 14 ) | ( t5 << 2 ) ) & 0x1fff ;
t6 = key [ 12 ] & 0xff | ( key [ 13 ] & 0xff ) << 8 ; this . r [ 7 ] = ( ( t5 >>> 11 ) | ( t6 << 5 ) ) & 0x1f81 ;
t7 = key [ 14 ] & 0xff | ( key [ 15 ] & 0xff ) << 8 ; this . r [ 8 ] = ( ( t6 >>> 8 ) | ( t7 << 8 ) ) & 0x1fff ;
this . r [ 9 ] = ( ( t7 >>> 5 ) ) & 0x007f ;
this . pad [ 0 ] = key [ 16 ] & 0xff | ( key [ 17 ] & 0xff ) << 8 ;
this . pad [ 1 ] = key [ 18 ] & 0xff | ( key [ 19 ] & 0xff ) << 8 ;
this . pad [ 2 ] = key [ 20 ] & 0xff | ( key [ 21 ] & 0xff ) << 8 ;
this . pad [ 3 ] = key [ 22 ] & 0xff | ( key [ 23 ] & 0xff ) << 8 ;
this . pad [ 4 ] = key [ 24 ] & 0xff | ( key [ 25 ] & 0xff ) << 8 ;
this . pad [ 5 ] = key [ 26 ] & 0xff | ( key [ 27 ] & 0xff ) << 8 ;
this . pad [ 6 ] = key [ 28 ] & 0xff | ( key [ 29 ] & 0xff ) << 8 ;
this . pad [ 7 ] = key [ 30 ] & 0xff | ( key [ 31 ] & 0xff ) << 8 ;
} ;
poly1305 . prototype . blocks = function ( m , mpos , bytes ) {
var hibit = this . fin ? 0 : ( 1 << 11 ) ;
var t0 , t1 , t2 , t3 , t4 , t5 , t6 , t7 , c ;
var d0 , d1 , d2 , d3 , d4 , d5 , d6 , d7 , d8 , d9 ;
var h0 = this . h [ 0 ] ,
h1 = this . h [ 1 ] ,
h2 = this . h [ 2 ] ,
h3 = this . h [ 3 ] ,
h4 = this . h [ 4 ] ,
h5 = this . h [ 5 ] ,
h6 = this . h [ 6 ] ,
h7 = this . h [ 7 ] ,
h8 = this . h [ 8 ] ,
h9 = this . h [ 9 ] ;
var r0 = this . r [ 0 ] ,
r1 = this . r [ 1 ] ,
r2 = this . r [ 2 ] ,
r3 = this . r [ 3 ] ,
r4 = this . r [ 4 ] ,
r5 = this . r [ 5 ] ,
r6 = this . r [ 6 ] ,
r7 = this . r [ 7 ] ,
r8 = this . r [ 8 ] ,
r9 = this . r [ 9 ] ;
while ( bytes >= 16 ) {
t0 = m [ mpos + 0 ] & 0xff | ( m [ mpos + 1 ] & 0xff ) << 8 ; h0 += ( t0 ) & 0x1fff ;
t1 = m [ mpos + 2 ] & 0xff | ( m [ mpos + 3 ] & 0xff ) << 8 ; h1 += ( ( t0 >>> 13 ) | ( t1 << 3 ) ) & 0x1fff ;
t2 = m [ mpos + 4 ] & 0xff | ( m [ mpos + 5 ] & 0xff ) << 8 ; h2 += ( ( t1 >>> 10 ) | ( t2 << 6 ) ) & 0x1fff ;
t3 = m [ mpos + 6 ] & 0xff | ( m [ mpos + 7 ] & 0xff ) << 8 ; h3 += ( ( t2 >>> 7 ) | ( t3 << 9 ) ) & 0x1fff ;
t4 = m [ mpos + 8 ] & 0xff | ( m [ mpos + 9 ] & 0xff ) << 8 ; h4 += ( ( t3 >>> 4 ) | ( t4 << 12 ) ) & 0x1fff ;
h5 += ( ( t4 >>> 1 ) ) & 0x1fff ;
t5 = m [ mpos + 10 ] & 0xff | ( m [ mpos + 11 ] & 0xff ) << 8 ; h6 += ( ( t4 >>> 14 ) | ( t5 << 2 ) ) & 0x1fff ;
t6 = m [ mpos + 12 ] & 0xff | ( m [ mpos + 13 ] & 0xff ) << 8 ; h7 += ( ( t5 >>> 11 ) | ( t6 << 5 ) ) & 0x1fff ;
t7 = m [ mpos + 14 ] & 0xff | ( m [ mpos + 15 ] & 0xff ) << 8 ; h8 += ( ( t6 >>> 8 ) | ( t7 << 8 ) ) & 0x1fff ;
h9 += ( ( t7 >>> 5 ) ) | hibit ;
c = 0 ;
d0 = c ;
d0 += h0 * r0 ;
d0 += h1 * ( 5 * r9 ) ;
d0 += h2 * ( 5 * r8 ) ;
d0 += h3 * ( 5 * r7 ) ;
d0 += h4 * ( 5 * r6 ) ;
c = ( d0 >>> 13 ) ; d0 &= 0x1fff ;
d0 += h5 * ( 5 * r5 ) ;
d0 += h6 * ( 5 * r4 ) ;
d0 += h7 * ( 5 * r3 ) ;
d0 += h8 * ( 5 * r2 ) ;
d0 += h9 * ( 5 * r1 ) ;
c += ( d0 >>> 13 ) ; d0 &= 0x1fff ;
d1 = c ;
d1 += h0 * r1 ;
d1 += h1 * r0 ;
d1 += h2 * ( 5 * r9 ) ;
d1 += h3 * ( 5 * r8 ) ;
d1 += h4 * ( 5 * r7 ) ;
c = ( d1 >>> 13 ) ; d1 &= 0x1fff ;
d1 += h5 * ( 5 * r6 ) ;
d1 += h6 * ( 5 * r5 ) ;
d1 += h7 * ( 5 * r4 ) ;
d1 += h8 * ( 5 * r3 ) ;
d1 += h9 * ( 5 * r2 ) ;
c += ( d1 >>> 13 ) ; d1 &= 0x1fff ;
d2 = c ;
d2 += h0 * r2 ;
d2 += h1 * r1 ;
d2 += h2 * r0 ;
d2 += h3 * ( 5 * r9 ) ;
d2 += h4 * ( 5 * r8 ) ;
c = ( d2 >>> 13 ) ; d2 &= 0x1fff ;
d2 += h5 * ( 5 * r7 ) ;
d2 += h6 * ( 5 * r6 ) ;
d2 += h7 * ( 5 * r5 ) ;
d2 += h8 * ( 5 * r4 ) ;
d2 += h9 * ( 5 * r3 ) ;
c += ( d2 >>> 13 ) ; d2 &= 0x1fff ;
d3 = c ;
d3 += h0 * r3 ;
d3 += h1 * r2 ;
d3 += h2 * r1 ;
d3 += h3 * r0 ;
d3 += h4 * ( 5 * r9 ) ;
c = ( d3 >>> 13 ) ; d3 &= 0x1fff ;
d3 += h5 * ( 5 * r8 ) ;
d3 += h6 * ( 5 * r7 ) ;
d3 += h7 * ( 5 * r6 ) ;
d3 += h8 * ( 5 * r5 ) ;
d3 += h9 * ( 5 * r4 ) ;
c += ( d3 >>> 13 ) ; d3 &= 0x1fff ;
d4 = c ;
d4 += h0 * r4 ;
d4 += h1 * r3 ;
d4 += h2 * r2 ;
d4 += h3 * r1 ;
d4 += h4 * r0 ;
c = ( d4 >>> 13 ) ; d4 &= 0x1fff ;
d4 += h5 * ( 5 * r9 ) ;
d4 += h6 * ( 5 * r8 ) ;
d4 += h7 * ( 5 * r7 ) ;
d4 += h8 * ( 5 * r6 ) ;
d4 += h9 * ( 5 * r5 ) ;
c += ( d4 >>> 13 ) ; d4 &= 0x1fff ;
d5 = c ;
d5 += h0 * r5 ;
d5 += h1 * r4 ;
d5 += h2 * r3 ;
d5 += h3 * r2 ;
d5 += h4 * r1 ;
c = ( d5 >>> 13 ) ; d5 &= 0x1fff ;
d5 += h5 * r0 ;
d5 += h6 * ( 5 * r9 ) ;
d5 += h7 * ( 5 * r8 ) ;
d5 += h8 * ( 5 * r7 ) ;
d5 += h9 * ( 5 * r6 ) ;
c += ( d5 >>> 13 ) ; d5 &= 0x1fff ;
d6 = c ;
d6 += h0 * r6 ;
d6 += h1 * r5 ;
d6 += h2 * r4 ;
d6 += h3 * r3 ;
d6 += h4 * r2 ;
c = ( d6 >>> 13 ) ; d6 &= 0x1fff ;
d6 += h5 * r1 ;
d6 += h6 * r0 ;
d6 += h7 * ( 5 * r9 ) ;
d6 += h8 * ( 5 * r8 ) ;
d6 += h9 * ( 5 * r7 ) ;
c += ( d6 >>> 13 ) ; d6 &= 0x1fff ;
d7 = c ;
d7 += h0 * r7 ;
d7 += h1 * r6 ;
d7 += h2 * r5 ;
d7 += h3 * r4 ;
d7 += h4 * r3 ;
c = ( d7 >>> 13 ) ; d7 &= 0x1fff ;
d7 += h5 * r2 ;
d7 += h6 * r1 ;
d7 += h7 * r0 ;
d7 += h8 * ( 5 * r9 ) ;
d7 += h9 * ( 5 * r8 ) ;
c += ( d7 >>> 13 ) ; d7 &= 0x1fff ;
d8 = c ;
d8 += h0 * r8 ;
d8 += h1 * r7 ;
d8 += h2 * r6 ;
d8 += h3 * r5 ;
d8 += h4 * r4 ;
c = ( d8 >>> 13 ) ; d8 &= 0x1fff ;
d8 += h5 * r3 ;
d8 += h6 * r2 ;
d8 += h7 * r1 ;
d8 += h8 * r0 ;
d8 += h9 * ( 5 * r9 ) ;
c += ( d8 >>> 13 ) ; d8 &= 0x1fff ;
d9 = c ;
d9 += h0 * r9 ;
d9 += h1 * r8 ;
d9 += h2 * r7 ;
d9 += h3 * r6 ;
d9 += h4 * r5 ;
c = ( d9 >>> 13 ) ; d9 &= 0x1fff ;
d9 += h5 * r4 ;
d9 += h6 * r3 ;
d9 += h7 * r2 ;
d9 += h8 * r1 ;
d9 += h9 * r0 ;
c += ( d9 >>> 13 ) ; d9 &= 0x1fff ;
c = ( ( ( c << 2 ) + c ) ) | 0 ;
c = ( c + d0 ) | 0 ;
d0 = c & 0x1fff ;
c = ( c >>> 13 ) ;
d1 += c ;
h0 = d0 ;
h1 = d1 ;
h2 = d2 ;
h3 = d3 ;
h4 = d4 ;
h5 = d5 ;
h6 = d6 ;
h7 = d7 ;
h8 = d8 ;
h9 = d9 ;
mpos += 16 ;
bytes -= 16 ;
}
this . h [ 0 ] = h0 ;
this . h [ 1 ] = h1 ;
this . h [ 2 ] = h2 ;
this . h [ 3 ] = h3 ;
this . h [ 4 ] = h4 ;
this . h [ 5 ] = h5 ;
this . h [ 6 ] = h6 ;
this . h [ 7 ] = h7 ;
this . h [ 8 ] = h8 ;
this . h [ 9 ] = h9 ;
} ;
poly1305 . prototype . finish = function ( mac , macpos ) {
var g = new Uint16Array ( 10 ) ;
var c , mask , f , i ;
if ( this . leftover ) {
i = this . leftover ;
this . buffer [ i ++ ] = 1 ;
for ( ; i < 16 ; i ++ ) this . buffer [ i ] = 0 ;
this . fin = 1 ;
this . blocks ( this . buffer , 0 , 16 ) ;
}
c = this . h [ 1 ] >>> 13 ;
this . h [ 1 ] &= 0x1fff ;
for ( i = 2 ; i < 10 ; i ++ ) {
this . h [ i ] += c ;
c = this . h [ i ] >>> 13 ;
this . h [ i ] &= 0x1fff ;
}
this . h [ 0 ] += ( c * 5 ) ;
c = this . h [ 0 ] >>> 13 ;
this . h [ 0 ] &= 0x1fff ;
this . h [ 1 ] += c ;
c = this . h [ 1 ] >>> 13 ;
this . h [ 1 ] &= 0x1fff ;
this . h [ 2 ] += c ;
g [ 0 ] = this . h [ 0 ] + 5 ;
c = g [ 0 ] >>> 13 ;
g [ 0 ] &= 0x1fff ;
for ( i = 1 ; i < 10 ; i ++ ) {
g [ i ] = this . h [ i ] + c ;
c = g [ i ] >>> 13 ;
g [ i ] &= 0x1fff ;
}
g [ 9 ] -= ( 1 << 13 ) ;
mask = ( c ^ 1 ) - 1 ;
for ( i = 0 ; i < 10 ; i ++ ) g [ i ] &= mask ;
mask = ~ mask ;
for ( i = 0 ; i < 10 ; i ++ ) this . h [ i ] = ( this . h [ i ] & mask ) | g [ i ] ;
this . h [ 0 ] = ( ( this . h [ 0 ] ) | ( this . h [ 1 ] << 13 ) ) & 0xffff ;
this . h [ 1 ] = ( ( this . h [ 1 ] >>> 3 ) | ( this . h [ 2 ] << 10 ) ) & 0xffff ;
this . h [ 2 ] = ( ( this . h [ 2 ] >>> 6 ) | ( this . h [ 3 ] << 7 ) ) & 0xffff ;
this . h [ 3 ] = ( ( this . h [ 3 ] >>> 9 ) | ( this . h [ 4 ] << 4 ) ) & 0xffff ;
this . h [ 4 ] = ( ( this . h [ 4 ] >>> 12 ) | ( this . h [ 5 ] << 1 ) | ( this . h [ 6 ] << 14 ) ) & 0xffff ;
this . h [ 5 ] = ( ( this . h [ 6 ] >>> 2 ) | ( this . h [ 7 ] << 11 ) ) & 0xffff ;
this . h [ 6 ] = ( ( this . h [ 7 ] >>> 5 ) | ( this . h [ 8 ] << 8 ) ) & 0xffff ;
this . h [ 7 ] = ( ( this . h [ 8 ] >>> 8 ) | ( this . h [ 9 ] << 5 ) ) & 0xffff ;
f = this . h [ 0 ] + this . pad [ 0 ] ;
this . h [ 0 ] = f & 0xffff ;
for ( i = 1 ; i < 8 ; i ++ ) {
f = ( ( ( this . h [ i ] + this . pad [ i ] ) | 0 ) + ( f >>> 16 ) ) | 0 ;
this . h [ i ] = f & 0xffff ;
}
mac [ macpos + 0 ] = ( this . h [ 0 ] >>> 0 ) & 0xff ;
mac [ macpos + 1 ] = ( this . h [ 0 ] >>> 8 ) & 0xff ;
mac [ macpos + 2 ] = ( this . h [ 1 ] >>> 0 ) & 0xff ;
mac [ macpos + 3 ] = ( this . h [ 1 ] >>> 8 ) & 0xff ;
mac [ macpos + 4 ] = ( this . h [ 2 ] >>> 0 ) & 0xff ;
mac [ macpos + 5 ] = ( this . h [ 2 ] >>> 8 ) & 0xff ;
mac [ macpos + 6 ] = ( this . h [ 3 ] >>> 0 ) & 0xff ;
mac [ macpos + 7 ] = ( this . h [ 3 ] >>> 8 ) & 0xff ;
mac [ macpos + 8 ] = ( this . h [ 4 ] >>> 0 ) & 0xff ;
mac [ macpos + 9 ] = ( this . h [ 4 ] >>> 8 ) & 0xff ;
mac [ macpos + 10 ] = ( this . h [ 5 ] >>> 0 ) & 0xff ;
mac [ macpos + 11 ] = ( this . h [ 5 ] >>> 8 ) & 0xff ;
mac [ macpos + 12 ] = ( this . h [ 6 ] >>> 0 ) & 0xff ;
mac [ macpos + 13 ] = ( this . h [ 6 ] >>> 8 ) & 0xff ;
mac [ macpos + 14 ] = ( this . h [ 7 ] >>> 0 ) & 0xff ;
mac [ macpos + 15 ] = ( this . h [ 7 ] >>> 8 ) & 0xff ;
} ;
poly1305 . prototype . update = function ( m , mpos , bytes ) {
var i , want ;
if ( this . leftover ) {
want = ( 16 - this . leftover ) ;
if ( want > bytes )
want = bytes ;
for ( i = 0 ; i < want ; i ++ )
this . buffer [ this . leftover + i ] = m [ mpos + i ] ;
bytes -= want ;
mpos += want ;
this . leftover += want ;
if ( this . leftover < 16 )
return ;
this . blocks ( this . buffer , 0 , 16 ) ;
this . leftover = 0 ;
}
if ( bytes >= 16 ) {
want = bytes - ( bytes % 16 ) ;
this . blocks ( m , mpos , want ) ;
mpos += want ;
bytes -= want ;
}
if ( bytes ) {
for ( i = 0 ; i < bytes ; i ++ )
this . buffer [ this . leftover + i ] = m [ mpos + i ] ;
this . leftover += bytes ;
}
} ;
function crypto _onetimeauth ( out , outpos , m , mpos , n , k ) {
var s = new poly1305 ( k ) ;
s . update ( m , mpos , n ) ;
s . finish ( out , outpos ) ;
return 0 ;
}
function crypto _onetimeauth _verify ( h , hpos , m , mpos , n , k ) {
var x = new Uint8Array ( 16 ) ;
crypto _onetimeauth ( x , 0 , m , mpos , n , k ) ;
return crypto _verify _16 ( h , hpos , x , 0 ) ;
}
function crypto _secretbox ( c , m , d , n , k ) {
var i ;
if ( d < 32 ) return - 1 ;
crypto _stream _xor ( c , 0 , m , 0 , d , n , k ) ;
crypto _onetimeauth ( c , 16 , c , 32 , d - 32 , c ) ;
for ( i = 0 ; i < 16 ; i ++ ) c [ i ] = 0 ;
return 0 ;
}
function crypto _secretbox _open ( m , c , d , n , k ) {
var i ;
var x = new Uint8Array ( 32 ) ;
if ( d < 32 ) return - 1 ;
crypto _stream ( x , 0 , 32 , n , k ) ;
if ( crypto _onetimeauth _verify ( c , 16 , c , 32 , d - 32 , x ) !== 0 ) return - 1 ;
crypto _stream _xor ( m , 0 , c , 0 , d , n , k ) ;
for ( i = 0 ; i < 32 ; i ++ ) m [ i ] = 0 ;
return 0 ;
}
function set25519 ( r , a ) {
var i ;
for ( i = 0 ; i < 16 ; i ++ ) r [ i ] = a [ i ] | 0 ;
}
function car25519 ( o ) {
var i , v , c = 1 ;
for ( i = 0 ; i < 16 ; i ++ ) {
v = o [ i ] + c + 65535 ;
c = Math . floor ( v / 65536 ) ;
o [ i ] = v - c * 65536 ;
}
o [ 0 ] += c - 1 + 37 * ( c - 1 ) ;
}
function sel25519 ( p , q , b ) {
var t , c = ~ ( b - 1 ) ;
for ( var i = 0 ; i < 16 ; i ++ ) {
t = c & ( p [ i ] ^ q [ i ] ) ;
p [ i ] ^= t ;
q [ i ] ^= t ;
}
}
function pack25519 ( o , n ) {
var i , j , b ;
var m = gf ( ) , t = gf ( ) ;
for ( i = 0 ; i < 16 ; i ++ ) t [ i ] = n [ i ] ;
car25519 ( t ) ;
car25519 ( t ) ;
car25519 ( t ) ;
for ( j = 0 ; j < 2 ; j ++ ) {
m [ 0 ] = t [ 0 ] - 0xffed ;
for ( i = 1 ; i < 15 ; i ++ ) {
m [ i ] = t [ i ] - 0xffff - ( ( m [ i - 1 ] >> 16 ) & 1 ) ;
m [ i - 1 ] &= 0xffff ;
}
m [ 15 ] = t [ 15 ] - 0x7fff - ( ( m [ 14 ] >> 16 ) & 1 ) ;
b = ( m [ 15 ] >> 16 ) & 1 ;
m [ 14 ] &= 0xffff ;
sel25519 ( t , m , 1 - b ) ;
}
for ( i = 0 ; i < 16 ; i ++ ) {
o [ 2 * i ] = t [ i ] & 0xff ;
o [ 2 * i + 1 ] = t [ i ] >> 8 ;
}
}
function neq25519 ( a , b ) {
var c = new Uint8Array ( 32 ) , d = new Uint8Array ( 32 ) ;
pack25519 ( c , a ) ;
pack25519 ( d , b ) ;
return crypto _verify _32 ( c , 0 , d , 0 ) ;
}
function par25519 ( a ) {
var d = new Uint8Array ( 32 ) ;
pack25519 ( d , a ) ;
return d [ 0 ] & 1 ;
}
function unpack25519 ( o , n ) {
var i ;
for ( i = 0 ; i < 16 ; i ++ ) o [ i ] = n [ 2 * i ] + ( n [ 2 * i + 1 ] << 8 ) ;
o [ 15 ] &= 0x7fff ;
}
function A ( o , a , b ) {
for ( var i = 0 ; i < 16 ; i ++ ) o [ i ] = a [ i ] + b [ i ] ;
}
function Z ( o , a , b ) {
for ( var i = 0 ; i < 16 ; i ++ ) o [ i ] = a [ i ] - b [ i ] ;
}
function M ( o , a , b ) {
var v , c ,
t0 = 0 , t1 = 0 , t2 = 0 , t3 = 0 , t4 = 0 , t5 = 0 , t6 = 0 , t7 = 0 ,
t8 = 0 , t9 = 0 , t10 = 0 , t11 = 0 , t12 = 0 , t13 = 0 , t14 = 0 , t15 = 0 ,
t16 = 0 , t17 = 0 , t18 = 0 , t19 = 0 , t20 = 0 , t21 = 0 , t22 = 0 , t23 = 0 ,
t24 = 0 , t25 = 0 , t26 = 0 , t27 = 0 , t28 = 0 , t29 = 0 , t30 = 0 ,
b0 = b [ 0 ] ,
b1 = b [ 1 ] ,
b2 = b [ 2 ] ,
b3 = b [ 3 ] ,
b4 = b [ 4 ] ,
b5 = b [ 5 ] ,
b6 = b [ 6 ] ,
b7 = b [ 7 ] ,
b8 = b [ 8 ] ,
b9 = b [ 9 ] ,
b10 = b [ 10 ] ,
b11 = b [ 11 ] ,
b12 = b [ 12 ] ,
b13 = b [ 13 ] ,
b14 = b [ 14 ] ,
b15 = b [ 15 ] ;
v = a [ 0 ] ;
t0 += v * b0 ;
t1 += v * b1 ;
t2 += v * b2 ;
t3 += v * b3 ;
t4 += v * b4 ;
t5 += v * b5 ;
t6 += v * b6 ;
t7 += v * b7 ;
t8 += v * b8 ;
t9 += v * b9 ;
t10 += v * b10 ;
t11 += v * b11 ;
t12 += v * b12 ;
t13 += v * b13 ;
t14 += v * b14 ;
t15 += v * b15 ;
v = a [ 1 ] ;
t1 += v * b0 ;
t2 += v * b1 ;
t3 += v * b2 ;
t4 += v * b3 ;
t5 += v * b4 ;
t6 += v * b5 ;
t7 += v * b6 ;
t8 += v * b7 ;
t9 += v * b8 ;
t10 += v * b9 ;
t11 += v * b10 ;
t12 += v * b11 ;
t13 += v * b12 ;
t14 += v * b13 ;
t15 += v * b14 ;
t16 += v * b15 ;
v = a [ 2 ] ;
t2 += v * b0 ;
t3 += v * b1 ;
t4 += v * b2 ;
t5 += v * b3 ;
t6 += v * b4 ;
t7 += v * b5 ;
t8 += v * b6 ;
t9 += v * b7 ;
t10 += v * b8 ;
t11 += v * b9 ;
t12 += v * b10 ;
t13 += v * b11 ;
t14 += v * b12 ;
t15 += v * b13 ;
t16 += v * b14 ;
t17 += v * b15 ;
v = a [ 3 ] ;
t3 += v * b0 ;
t4 += v * b1 ;
t5 += v * b2 ;
t6 += v * b3 ;
t7 += v * b4 ;
t8 += v * b5 ;
t9 += v * b6 ;
t10 += v * b7 ;
t11 += v * b8 ;
t12 += v * b9 ;
t13 += v * b10 ;
t14 += v * b11 ;
t15 += v * b12 ;
t16 += v * b13 ;
t17 += v * b14 ;
t18 += v * b15 ;
v = a [ 4 ] ;
t4 += v * b0 ;
t5 += v * b1 ;
t6 += v * b2 ;
t7 += v * b3 ;
t8 += v * b4 ;
t9 += v * b5 ;
t10 += v * b6 ;
t11 += v * b7 ;
t12 += v * b8 ;
t13 += v * b9 ;
t14 += v * b10 ;
t15 += v * b11 ;
t16 += v * b12 ;
t17 += v * b13 ;
t18 += v * b14 ;
t19 += v * b15 ;
v = a [ 5 ] ;
t5 += v * b0 ;
t6 += v * b1 ;
t7 += v * b2 ;
t8 += v * b3 ;
t9 += v * b4 ;
t10 += v * b5 ;
t11 += v * b6 ;
t12 += v * b7 ;
t13 += v * b8 ;
t14 += v * b9 ;
t15 += v * b10 ;
t16 += v * b11 ;
t17 += v * b12 ;
t18 += v * b13 ;
t19 += v * b14 ;
t20 += v * b15 ;
v = a [ 6 ] ;
t6 += v * b0 ;
t7 += v * b1 ;
t8 += v * b2 ;
t9 += v * b3 ;
t10 += v * b4 ;
t11 += v * b5 ;
t12 += v * b6 ;
t13 += v * b7 ;
t14 += v * b8 ;
t15 += v * b9 ;
t16 += v * b10 ;
t17 += v * b11 ;
t18 += v * b12 ;
t19 += v * b13 ;
t20 += v * b14 ;
t21 += v * b15 ;
v = a [ 7 ] ;
t7 += v * b0 ;
t8 += v * b1 ;
t9 += v * b2 ;
t10 += v * b3 ;
t11 += v * b4 ;
t12 += v * b5 ;
t13 += v * b6 ;
t14 += v * b7 ;
t15 += v * b8 ;
t16 += v * b9 ;
t17 += v * b10 ;
t18 += v * b11 ;
t19 += v * b12 ;
t20 += v * b13 ;
t21 += v * b14 ;
t22 += v * b15 ;
v = a [ 8 ] ;
t8 += v * b0 ;
t9 += v * b1 ;
t10 += v * b2 ;
t11 += v * b3 ;
t12 += v * b4 ;
t13 += v * b5 ;
t14 += v * b6 ;
t15 += v * b7 ;
t16 += v * b8 ;
t17 += v * b9 ;
t18 += v * b10 ;
t19 += v * b11 ;
t20 += v * b12 ;
t21 += v * b13 ;
t22 += v * b14 ;
t23 += v * b15 ;
v = a [ 9 ] ;
t9 += v * b0 ;
t10 += v * b1 ;
t11 += v * b2 ;
t12 += v * b3 ;
t13 += v * b4 ;
t14 += v * b5 ;
t15 += v * b6 ;
t16 += v * b7 ;
t17 += v * b8 ;
t18 += v * b9 ;
t19 += v * b10 ;
t20 += v * b11 ;
t21 += v * b12 ;
t22 += v * b13 ;
t23 += v * b14 ;
t24 += v * b15 ;
v = a [ 10 ] ;
t10 += v * b0 ;
t11 += v * b1 ;
t12 += v * b2 ;
t13 += v * b3 ;
t14 += v * b4 ;
t15 += v * b5 ;
t16 += v * b6 ;
t17 += v * b7 ;
t18 += v * b8 ;
t19 += v * b9 ;
t20 += v * b10 ;
t21 += v * b11 ;
t22 += v * b12 ;
t23 += v * b13 ;
t24 += v * b14 ;
t25 += v * b15 ;
v = a [ 11 ] ;
t11 += v * b0 ;
t12 += v * b1 ;
t13 += v * b2 ;
t14 += v * b3 ;
t15 += v * b4 ;
t16 += v * b5 ;
t17 += v * b6 ;
t18 += v * b7 ;
t19 += v * b8 ;
t20 += v * b9 ;
t21 += v * b10 ;
t22 += v * b11 ;
t23 += v * b12 ;
t24 += v * b13 ;
t25 += v * b14 ;
t26 += v * b15 ;
v = a [ 12 ] ;
t12 += v * b0 ;
t13 += v * b1 ;
t14 += v * b2 ;
t15 += v * b3 ;
t16 += v * b4 ;
t17 += v * b5 ;
t18 += v * b6 ;
t19 += v * b7 ;
t20 += v * b8 ;
t21 += v * b9 ;
t22 += v * b10 ;
t23 += v * b11 ;
t24 += v * b12 ;
t25 += v * b13 ;
t26 += v * b14 ;
t27 += v * b15 ;
v = a [ 13 ] ;
t13 += v * b0 ;
t14 += v * b1 ;
t15 += v * b2 ;
t16 += v * b3 ;
t17 += v * b4 ;
t18 += v * b5 ;
t19 += v * b6 ;
t20 += v * b7 ;
t21 += v * b8 ;
t22 += v * b9 ;
t23 += v * b10 ;
t24 += v * b11 ;
t25 += v * b12 ;
t26 += v * b13 ;
t27 += v * b14 ;
t28 += v * b15 ;
v = a [ 14 ] ;
t14 += v * b0 ;
t15 += v * b1 ;
t16 += v * b2 ;
t17 += v * b3 ;
t18 += v * b4 ;
t19 += v * b5 ;
t20 += v * b6 ;
t21 += v * b7 ;
t22 += v * b8 ;
t23 += v * b9 ;
t24 += v * b10 ;
t25 += v * b11 ;
t26 += v * b12 ;
t27 += v * b13 ;
t28 += v * b14 ;
t29 += v * b15 ;
v = a [ 15 ] ;
t15 += v * b0 ;
t16 += v * b1 ;
t17 += v * b2 ;
t18 += v * b3 ;
t19 += v * b4 ;
t20 += v * b5 ;
t21 += v * b6 ;
t22 += v * b7 ;
t23 += v * b8 ;
t24 += v * b9 ;
t25 += v * b10 ;
t26 += v * b11 ;
t27 += v * b12 ;
t28 += v * b13 ;
t29 += v * b14 ;
t30 += v * b15 ;
t0 += 38 * t16 ;
t1 += 38 * t17 ;
t2 += 38 * t18 ;
t3 += 38 * t19 ;
t4 += 38 * t20 ;
t5 += 38 * t21 ;
t6 += 38 * t22 ;
t7 += 38 * t23 ;
t8 += 38 * t24 ;
t9 += 38 * t25 ;
t10 += 38 * t26 ;
t11 += 38 * t27 ;
t12 += 38 * t28 ;
t13 += 38 * t29 ;
t14 += 38 * t30 ;
// t15 left as is
// first car
c = 1 ;
v = t0 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t0 = v - c * 65536 ;
v = t1 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t1 = v - c * 65536 ;
v = t2 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t2 = v - c * 65536 ;
v = t3 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t3 = v - c * 65536 ;
v = t4 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t4 = v - c * 65536 ;
v = t5 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t5 = v - c * 65536 ;
v = t6 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t6 = v - c * 65536 ;
v = t7 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t7 = v - c * 65536 ;
v = t8 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t8 = v - c * 65536 ;
v = t9 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t9 = v - c * 65536 ;
v = t10 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t10 = v - c * 65536 ;
v = t11 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t11 = v - c * 65536 ;
v = t12 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t12 = v - c * 65536 ;
v = t13 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t13 = v - c * 65536 ;
v = t14 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t14 = v - c * 65536 ;
v = t15 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t15 = v - c * 65536 ;
t0 += c - 1 + 37 * ( c - 1 ) ;
// second car
c = 1 ;
v = t0 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t0 = v - c * 65536 ;
v = t1 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t1 = v - c * 65536 ;
v = t2 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t2 = v - c * 65536 ;
v = t3 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t3 = v - c * 65536 ;
v = t4 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t4 = v - c * 65536 ;
v = t5 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t5 = v - c * 65536 ;
v = t6 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t6 = v - c * 65536 ;
v = t7 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t7 = v - c * 65536 ;
v = t8 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t8 = v - c * 65536 ;
v = t9 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t9 = v - c * 65536 ;
v = t10 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t10 = v - c * 65536 ;
v = t11 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t11 = v - c * 65536 ;
v = t12 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t12 = v - c * 65536 ;
v = t13 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t13 = v - c * 65536 ;
v = t14 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t14 = v - c * 65536 ;
v = t15 + c + 65535 ; c = Math . floor ( v / 65536 ) ; t15 = v - c * 65536 ;
t0 += c - 1 + 37 * ( c - 1 ) ;
o [ 0 ] = t0 ;
o [ 1 ] = t1 ;
o [ 2 ] = t2 ;
o [ 3 ] = t3 ;
o [ 4 ] = t4 ;
o [ 5 ] = t5 ;
o [ 6 ] = t6 ;
o [ 7 ] = t7 ;
o [ 8 ] = t8 ;
o [ 9 ] = t9 ;
o [ 10 ] = t10 ;
o [ 11 ] = t11 ;
o [ 12 ] = t12 ;
o [ 13 ] = t13 ;
o [ 14 ] = t14 ;
o [ 15 ] = t15 ;
}
function S ( o , a ) {
M ( o , a , a ) ;
}
function inv25519 ( o , i ) {
var c = gf ( ) ;
var a ;
for ( a = 0 ; a < 16 ; a ++ ) c [ a ] = i [ a ] ;
for ( a = 253 ; a >= 0 ; a -- ) {
S ( c , c ) ;
if ( a !== 2 && a !== 4 ) M ( c , c , i ) ;
}
for ( a = 0 ; a < 16 ; a ++ ) o [ a ] = c [ a ] ;
}
function pow2523 ( o , i ) {
var c = gf ( ) ;
var a ;
for ( a = 0 ; a < 16 ; a ++ ) c [ a ] = i [ a ] ;
for ( a = 250 ; a >= 0 ; a -- ) {
S ( c , c ) ;
if ( a !== 1 ) M ( c , c , i ) ;
}
for ( a = 0 ; a < 16 ; a ++ ) o [ a ] = c [ a ] ;
}
function crypto _scalarmult ( q , n , p ) {
var z = new Uint8Array ( 32 ) ;
var x = new Float64Array ( 80 ) , r , i ;
var a = gf ( ) , b = gf ( ) , c = gf ( ) ,
d = gf ( ) , e = gf ( ) , f = gf ( ) ;
for ( i = 0 ; i < 31 ; i ++ ) z [ i ] = n [ i ] ;
z [ 31 ] = ( n [ 31 ] & 127 ) | 64 ;
z [ 0 ] &= 248 ;
unpack25519 ( x , p ) ;
for ( i = 0 ; i < 16 ; i ++ ) {
b [ i ] = x [ i ] ;
d [ i ] = a [ i ] = c [ i ] = 0 ;
}
a [ 0 ] = d [ 0 ] = 1 ;
for ( i = 254 ; i >= 0 ; -- i ) {
r = ( z [ i >>> 3 ] >>> ( i & 7 ) ) & 1 ;
sel25519 ( a , b , r ) ;
sel25519 ( c , d , r ) ;
A ( e , a , c ) ;
Z ( a , a , c ) ;
A ( c , b , d ) ;
Z ( b , b , d ) ;
S ( d , e ) ;
S ( f , a ) ;
M ( a , c , a ) ;
M ( c , b , e ) ;
A ( e , a , c ) ;
Z ( a , a , c ) ;
S ( b , a ) ;
Z ( c , d , f ) ;
M ( a , c , _121665 ) ;
A ( a , a , d ) ;
M ( c , c , a ) ;
M ( a , d , f ) ;
M ( d , b , x ) ;
S ( b , e ) ;
sel25519 ( a , b , r ) ;
sel25519 ( c , d , r ) ;
}
for ( i = 0 ; i < 16 ; i ++ ) {
x [ i + 16 ] = a [ i ] ;
x [ i + 32 ] = c [ i ] ;
x [ i + 48 ] = b [ i ] ;
x [ i + 64 ] = d [ i ] ;
}
var x32 = x . subarray ( 32 ) ;
var x16 = x . subarray ( 16 ) ;
inv25519 ( x32 , x32 ) ;
M ( x16 , x16 , x32 ) ;
pack25519 ( q , x16 ) ;
return 0 ;
}
function crypto _scalarmult _base ( q , n ) {
return crypto _scalarmult ( q , n , _9 ) ;
}
function crypto _box _keypair ( y , x ) {
randombytes ( x , 32 ) ;
return crypto _scalarmult _base ( y , x ) ;
}
function crypto _box _beforenm ( k , y , x ) {
var s = new Uint8Array ( 32 ) ;
crypto _scalarmult ( s , x , y ) ;
return crypto _core _hsalsa20 ( k , _0 , s , sigma ) ;
}
var crypto _box _afternm = crypto _secretbox ;
var crypto _box _open _afternm = crypto _secretbox _open ;
function crypto _box ( c , m , d , n , y , x ) {
var k = new Uint8Array ( 32 ) ;
crypto _box _beforenm ( k , y , x ) ;
return crypto _box _afternm ( c , m , d , n , k ) ;
}
function crypto _box _open ( m , c , d , n , y , x ) {
var k = new Uint8Array ( 32 ) ;
crypto _box _beforenm ( k , y , x ) ;
return crypto _box _open _afternm ( m , c , d , n , k ) ;
}
var K = [
0x428a2f98 , 0xd728ae22 , 0x71374491 , 0x23ef65cd ,
0xb5c0fbcf , 0xec4d3b2f , 0xe9b5dba5 , 0x8189dbbc ,
0x3956c25b , 0xf348b538 , 0x59f111f1 , 0xb605d019 ,
0x923f82a4 , 0xaf194f9b , 0xab1c5ed5 , 0xda6d8118 ,
0xd807aa98 , 0xa3030242 , 0x12835b01 , 0x45706fbe ,
0x243185be , 0x4ee4b28c , 0x550c7dc3 , 0xd5ffb4e2 ,
0x72be5d74 , 0xf27b896f , 0x80deb1fe , 0x3b1696b1 ,
0x9bdc06a7 , 0x25c71235 , 0xc19bf174 , 0xcf692694 ,
0xe49b69c1 , 0x9ef14ad2 , 0xefbe4786 , 0x384f25e3 ,
0x0fc19dc6 , 0x8b8cd5b5 , 0x240ca1cc , 0x77ac9c65 ,
0x2de92c6f , 0x592b0275 , 0x4a7484aa , 0x6ea6e483 ,
0x5cb0a9dc , 0xbd41fbd4 , 0x76f988da , 0x831153b5 ,
0x983e5152 , 0xee66dfab , 0xa831c66d , 0x2db43210 ,
0xb00327c8 , 0x98fb213f , 0xbf597fc7 , 0xbeef0ee4 ,
0xc6e00bf3 , 0x3da88fc2 , 0xd5a79147 , 0x930aa725 ,
0x06ca6351 , 0xe003826f , 0x14292967 , 0x0a0e6e70 ,
0x27b70a85 , 0x46d22ffc , 0x2e1b2138 , 0x5c26c926 ,
0x4d2c6dfc , 0x5ac42aed , 0x53380d13 , 0x9d95b3df ,
0x650a7354 , 0x8baf63de , 0x766a0abb , 0x3c77b2a8 ,
0x81c2c92e , 0x47edaee6 , 0x92722c85 , 0x1482353b ,
0xa2bfe8a1 , 0x4cf10364 , 0xa81a664b , 0xbc423001 ,
0xc24b8b70 , 0xd0f89791 , 0xc76c51a3 , 0x0654be30 ,
0xd192e819 , 0xd6ef5218 , 0xd6990624 , 0x5565a910 ,
0xf40e3585 , 0x5771202a , 0x106aa070 , 0x32bbd1b8 ,
0x19a4c116 , 0xb8d2d0c8 , 0x1e376c08 , 0x5141ab53 ,
0x2748774c , 0xdf8eeb99 , 0x34b0bcb5 , 0xe19b48a8 ,
0x391c0cb3 , 0xc5c95a63 , 0x4ed8aa4a , 0xe3418acb ,
0x5b9cca4f , 0x7763e373 , 0x682e6ff3 , 0xd6b2b8a3 ,
0x748f82ee , 0x5defb2fc , 0x78a5636f , 0x43172f60 ,
0x84c87814 , 0xa1f0ab72 , 0x8cc70208 , 0x1a6439ec ,
0x90befffa , 0x23631e28 , 0xa4506ceb , 0xde82bde9 ,
0xbef9a3f7 , 0xb2c67915 , 0xc67178f2 , 0xe372532b ,
0xca273ece , 0xea26619c , 0xd186b8c7 , 0x21c0c207 ,
0xeada7dd6 , 0xcde0eb1e , 0xf57d4f7f , 0xee6ed178 ,
0x06f067aa , 0x72176fba , 0x0a637dc5 , 0xa2c898a6 ,
0x113f9804 , 0xbef90dae , 0x1b710b35 , 0x131c471b ,
0x28db77f5 , 0x23047d84 , 0x32caab7b , 0x40c72493 ,
0x3c9ebe0a , 0x15c9bebc , 0x431d67c4 , 0x9c100d4c ,
0x4cc5d4be , 0xcb3e42b6 , 0x597f299c , 0xfc657e2a ,
0x5fcb6fab , 0x3ad6faec , 0x6c44198c , 0x4a475817
] ;
function crypto _hashblocks _hl ( hh , hl , m , n ) {
var wh = new Int32Array ( 16 ) , wl = new Int32Array ( 16 ) ,
bh0 , bh1 , bh2 , bh3 , bh4 , bh5 , bh6 , bh7 ,
bl0 , bl1 , bl2 , bl3 , bl4 , bl5 , bl6 , bl7 ,
th , tl , i , j , h , l , a , b , c , d ;
var ah0 = hh [ 0 ] ,
ah1 = hh [ 1 ] ,
ah2 = hh [ 2 ] ,
ah3 = hh [ 3 ] ,
ah4 = hh [ 4 ] ,
ah5 = hh [ 5 ] ,
ah6 = hh [ 6 ] ,
ah7 = hh [ 7 ] ,
al0 = hl [ 0 ] ,
al1 = hl [ 1 ] ,
al2 = hl [ 2 ] ,
al3 = hl [ 3 ] ,
al4 = hl [ 4 ] ,
al5 = hl [ 5 ] ,
al6 = hl [ 6 ] ,
al7 = hl [ 7 ] ;
var pos = 0 ;
while ( n >= 128 ) {
for ( i = 0 ; i < 16 ; i ++ ) {
j = 8 * i + pos ;
wh [ i ] = ( m [ j + 0 ] << 24 ) | ( m [ j + 1 ] << 16 ) | ( m [ j + 2 ] << 8 ) | m [ j + 3 ] ;
wl [ i ] = ( m [ j + 4 ] << 24 ) | ( m [ j + 5 ] << 16 ) | ( m [ j + 6 ] << 8 ) | m [ j + 7 ] ;
}
for ( i = 0 ; i < 80 ; i ++ ) {
bh0 = ah0 ;
bh1 = ah1 ;
bh2 = ah2 ;
bh3 = ah3 ;
bh4 = ah4 ;
bh5 = ah5 ;
bh6 = ah6 ;
bh7 = ah7 ;
bl0 = al0 ;
bl1 = al1 ;
bl2 = al2 ;
bl3 = al3 ;
bl4 = al4 ;
bl5 = al5 ;
bl6 = al6 ;
bl7 = al7 ;
// add
h = ah7 ;
l = al7 ;
a = l & 0xffff ; b = l >>> 16 ;
c = h & 0xffff ; d = h >>> 16 ;
// Sigma1
h = ( ( ah4 >>> 14 ) | ( al4 << ( 32 - 14 ) ) ) ^ ( ( ah4 >>> 18 ) | ( al4 << ( 32 - 18 ) ) ) ^ ( ( al4 >>> ( 41 - 32 ) ) | ( ah4 << ( 32 - ( 41 - 32 ) ) ) ) ;
l = ( ( al4 >>> 14 ) | ( ah4 << ( 32 - 14 ) ) ) ^ ( ( al4 >>> 18 ) | ( ah4 << ( 32 - 18 ) ) ) ^ ( ( ah4 >>> ( 41 - 32 ) ) | ( al4 << ( 32 - ( 41 - 32 ) ) ) ) ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
// Ch
h = ( ah4 & ah5 ) ^ ( ~ ah4 & ah6 ) ;
l = ( al4 & al5 ) ^ ( ~ al4 & al6 ) ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
// K
h = K [ i * 2 ] ;
l = K [ i * 2 + 1 ] ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
// w
h = wh [ i % 16 ] ;
l = wl [ i % 16 ] ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
b += a >>> 16 ;
c += b >>> 16 ;
d += c >>> 16 ;
th = c & 0xffff | d << 16 ;
tl = a & 0xffff | b << 16 ;
// add
h = th ;
l = tl ;
a = l & 0xffff ; b = l >>> 16 ;
c = h & 0xffff ; d = h >>> 16 ;
// Sigma0
h = ( ( ah0 >>> 28 ) | ( al0 << ( 32 - 28 ) ) ) ^ ( ( al0 >>> ( 34 - 32 ) ) | ( ah0 << ( 32 - ( 34 - 32 ) ) ) ) ^ ( ( al0 >>> ( 39 - 32 ) ) | ( ah0 << ( 32 - ( 39 - 32 ) ) ) ) ;
l = ( ( al0 >>> 28 ) | ( ah0 << ( 32 - 28 ) ) ) ^ ( ( ah0 >>> ( 34 - 32 ) ) | ( al0 << ( 32 - ( 34 - 32 ) ) ) ) ^ ( ( ah0 >>> ( 39 - 32 ) ) | ( al0 << ( 32 - ( 39 - 32 ) ) ) ) ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
// Maj
h = ( ah0 & ah1 ) ^ ( ah0 & ah2 ) ^ ( ah1 & ah2 ) ;
l = ( al0 & al1 ) ^ ( al0 & al2 ) ^ ( al1 & al2 ) ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
b += a >>> 16 ;
c += b >>> 16 ;
d += c >>> 16 ;
bh7 = ( c & 0xffff ) | ( d << 16 ) ;
bl7 = ( a & 0xffff ) | ( b << 16 ) ;
// add
h = bh3 ;
l = bl3 ;
a = l & 0xffff ; b = l >>> 16 ;
c = h & 0xffff ; d = h >>> 16 ;
h = th ;
l = tl ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
b += a >>> 16 ;
c += b >>> 16 ;
d += c >>> 16 ;
bh3 = ( c & 0xffff ) | ( d << 16 ) ;
bl3 = ( a & 0xffff ) | ( b << 16 ) ;
ah1 = bh0 ;
ah2 = bh1 ;
ah3 = bh2 ;
ah4 = bh3 ;
ah5 = bh4 ;
ah6 = bh5 ;
ah7 = bh6 ;
ah0 = bh7 ;
al1 = bl0 ;
al2 = bl1 ;
al3 = bl2 ;
al4 = bl3 ;
al5 = bl4 ;
al6 = bl5 ;
al7 = bl6 ;
al0 = bl7 ;
if ( i % 16 === 15 ) {
for ( j = 0 ; j < 16 ; j ++ ) {
// add
h = wh [ j ] ;
l = wl [ j ] ;
a = l & 0xffff ; b = l >>> 16 ;
c = h & 0xffff ; d = h >>> 16 ;
h = wh [ ( j + 9 ) % 16 ] ;
l = wl [ ( j + 9 ) % 16 ] ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
// sigma0
th = wh [ ( j + 1 ) % 16 ] ;
tl = wl [ ( j + 1 ) % 16 ] ;
h = ( ( th >>> 1 ) | ( tl << ( 32 - 1 ) ) ) ^ ( ( th >>> 8 ) | ( tl << ( 32 - 8 ) ) ) ^ ( th >>> 7 ) ;
l = ( ( tl >>> 1 ) | ( th << ( 32 - 1 ) ) ) ^ ( ( tl >>> 8 ) | ( th << ( 32 - 8 ) ) ) ^ ( ( tl >>> 7 ) | ( th << ( 32 - 7 ) ) ) ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
// sigma1
th = wh [ ( j + 14 ) % 16 ] ;
tl = wl [ ( j + 14 ) % 16 ] ;
h = ( ( th >>> 19 ) | ( tl << ( 32 - 19 ) ) ) ^ ( ( tl >>> ( 61 - 32 ) ) | ( th << ( 32 - ( 61 - 32 ) ) ) ) ^ ( th >>> 6 ) ;
l = ( ( tl >>> 19 ) | ( th << ( 32 - 19 ) ) ) ^ ( ( th >>> ( 61 - 32 ) ) | ( tl << ( 32 - ( 61 - 32 ) ) ) ) ^ ( ( tl >>> 6 ) | ( th << ( 32 - 6 ) ) ) ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
b += a >>> 16 ;
c += b >>> 16 ;
d += c >>> 16 ;
wh [ j ] = ( c & 0xffff ) | ( d << 16 ) ;
wl [ j ] = ( a & 0xffff ) | ( b << 16 ) ;
}
}
}
// add
h = ah0 ;
l = al0 ;
a = l & 0xffff ; b = l >>> 16 ;
c = h & 0xffff ; d = h >>> 16 ;
h = hh [ 0 ] ;
l = hl [ 0 ] ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
b += a >>> 16 ;
c += b >>> 16 ;
d += c >>> 16 ;
hh [ 0 ] = ah0 = ( c & 0xffff ) | ( d << 16 ) ;
hl [ 0 ] = al0 = ( a & 0xffff ) | ( b << 16 ) ;
h = ah1 ;
l = al1 ;
a = l & 0xffff ; b = l >>> 16 ;
c = h & 0xffff ; d = h >>> 16 ;
h = hh [ 1 ] ;
l = hl [ 1 ] ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
b += a >>> 16 ;
c += b >>> 16 ;
d += c >>> 16 ;
hh [ 1 ] = ah1 = ( c & 0xffff ) | ( d << 16 ) ;
hl [ 1 ] = al1 = ( a & 0xffff ) | ( b << 16 ) ;
h = ah2 ;
l = al2 ;
a = l & 0xffff ; b = l >>> 16 ;
c = h & 0xffff ; d = h >>> 16 ;
h = hh [ 2 ] ;
l = hl [ 2 ] ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
b += a >>> 16 ;
c += b >>> 16 ;
d += c >>> 16 ;
hh [ 2 ] = ah2 = ( c & 0xffff ) | ( d << 16 ) ;
hl [ 2 ] = al2 = ( a & 0xffff ) | ( b << 16 ) ;
h = ah3 ;
l = al3 ;
a = l & 0xffff ; b = l >>> 16 ;
c = h & 0xffff ; d = h >>> 16 ;
h = hh [ 3 ] ;
l = hl [ 3 ] ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
b += a >>> 16 ;
c += b >>> 16 ;
d += c >>> 16 ;
hh [ 3 ] = ah3 = ( c & 0xffff ) | ( d << 16 ) ;
hl [ 3 ] = al3 = ( a & 0xffff ) | ( b << 16 ) ;
h = ah4 ;
l = al4 ;
a = l & 0xffff ; b = l >>> 16 ;
c = h & 0xffff ; d = h >>> 16 ;
h = hh [ 4 ] ;
l = hl [ 4 ] ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
b += a >>> 16 ;
c += b >>> 16 ;
d += c >>> 16 ;
hh [ 4 ] = ah4 = ( c & 0xffff ) | ( d << 16 ) ;
hl [ 4 ] = al4 = ( a & 0xffff ) | ( b << 16 ) ;
h = ah5 ;
l = al5 ;
a = l & 0xffff ; b = l >>> 16 ;
c = h & 0xffff ; d = h >>> 16 ;
h = hh [ 5 ] ;
l = hl [ 5 ] ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
b += a >>> 16 ;
c += b >>> 16 ;
d += c >>> 16 ;
hh [ 5 ] = ah5 = ( c & 0xffff ) | ( d << 16 ) ;
hl [ 5 ] = al5 = ( a & 0xffff ) | ( b << 16 ) ;
h = ah6 ;
l = al6 ;
a = l & 0xffff ; b = l >>> 16 ;
c = h & 0xffff ; d = h >>> 16 ;
h = hh [ 6 ] ;
l = hl [ 6 ] ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
b += a >>> 16 ;
c += b >>> 16 ;
d += c >>> 16 ;
hh [ 6 ] = ah6 = ( c & 0xffff ) | ( d << 16 ) ;
hl [ 6 ] = al6 = ( a & 0xffff ) | ( b << 16 ) ;
h = ah7 ;
l = al7 ;
a = l & 0xffff ; b = l >>> 16 ;
c = h & 0xffff ; d = h >>> 16 ;
h = hh [ 7 ] ;
l = hl [ 7 ] ;
a += l & 0xffff ; b += l >>> 16 ;
c += h & 0xffff ; d += h >>> 16 ;
b += a >>> 16 ;
c += b >>> 16 ;
d += c >>> 16 ;
hh [ 7 ] = ah7 = ( c & 0xffff ) | ( d << 16 ) ;
hl [ 7 ] = al7 = ( a & 0xffff ) | ( b << 16 ) ;
pos += 128 ;
n -= 128 ;
}
return n ;
}
function crypto _hash ( out , m , n ) {
var hh = new Int32Array ( 8 ) ,
hl = new Int32Array ( 8 ) ,
x = new Uint8Array ( 256 ) ,
i , b = n ;
hh [ 0 ] = 0x6a09e667 ;
hh [ 1 ] = 0xbb67ae85 ;
hh [ 2 ] = 0x3c6ef372 ;
hh [ 3 ] = 0xa54ff53a ;
hh [ 4 ] = 0x510e527f ;
hh [ 5 ] = 0x9b05688c ;
hh [ 6 ] = 0x1f83d9ab ;
hh [ 7 ] = 0x5be0cd19 ;
hl [ 0 ] = 0xf3bcc908 ;
hl [ 1 ] = 0x84caa73b ;
hl [ 2 ] = 0xfe94f82b ;
hl [ 3 ] = 0x5f1d36f1 ;
hl [ 4 ] = 0xade682d1 ;
hl [ 5 ] = 0x2b3e6c1f ;
hl [ 6 ] = 0xfb41bd6b ;
hl [ 7 ] = 0x137e2179 ;
crypto _hashblocks _hl ( hh , hl , m , n ) ;
n %= 128 ;
for ( i = 0 ; i < n ; i ++ ) x [ i ] = m [ b - n + i ] ;
x [ n ] = 128 ;
n = 256 - 128 * ( n < 112 ? 1 : 0 ) ;
x [ n - 9 ] = 0 ;
ts64 ( x , n - 8 , ( b / 0x20000000 ) | 0 , b << 3 ) ;
crypto _hashblocks _hl ( hh , hl , x , n ) ;
for ( i = 0 ; i < 8 ; i ++ ) ts64 ( out , 8 * i , hh [ i ] , hl [ i ] ) ;
return 0 ;
}
function add ( p , q ) {
var a = gf ( ) , b = gf ( ) , c = gf ( ) ,
d = gf ( ) , e = gf ( ) , f = gf ( ) ,
g = gf ( ) , h = gf ( ) , t = gf ( ) ;
Z ( a , p [ 1 ] , p [ 0 ] ) ;
Z ( t , q [ 1 ] , q [ 0 ] ) ;
M ( a , a , t ) ;
A ( b , p [ 0 ] , p [ 1 ] ) ;
A ( t , q [ 0 ] , q [ 1 ] ) ;
M ( b , b , t ) ;
M ( c , p [ 3 ] , q [ 3 ] ) ;
M ( c , c , D2 ) ;
M ( d , p [ 2 ] , q [ 2 ] ) ;
A ( d , d , d ) ;
Z ( e , b , a ) ;
Z ( f , d , c ) ;
A ( g , d , c ) ;
A ( h , b , a ) ;
M ( p [ 0 ] , e , f ) ;
M ( p [ 1 ] , h , g ) ;
M ( p [ 2 ] , g , f ) ;
M ( p [ 3 ] , e , h ) ;
}
function cswap ( p , q , b ) {
var i ;
for ( i = 0 ; i < 4 ; i ++ ) {
sel25519 ( p [ i ] , q [ i ] , b ) ;
}
}
function pack ( r , p ) {
var tx = gf ( ) , ty = gf ( ) , zi = gf ( ) ;
inv25519 ( zi , p [ 2 ] ) ;
M ( tx , p [ 0 ] , zi ) ;
M ( ty , p [ 1 ] , zi ) ;
pack25519 ( r , ty ) ;
r [ 31 ] ^= par25519 ( tx ) << 7 ;
}
function scalarmult ( p , q , s ) {
var b , i ;
set25519 ( p [ 0 ] , gf0 ) ;
set25519 ( p [ 1 ] , gf1 ) ;
set25519 ( p [ 2 ] , gf1 ) ;
set25519 ( p [ 3 ] , gf0 ) ;
for ( i = 255 ; i >= 0 ; -- i ) {
b = ( s [ ( i / 8 ) | 0 ] >> ( i & 7 ) ) & 1 ;
cswap ( p , q , b ) ;
add ( q , p ) ;
add ( p , p ) ;
cswap ( p , q , b ) ;
}
}
function scalarbase ( p , s ) {
var q = [ gf ( ) , gf ( ) , gf ( ) , gf ( ) ] ;
set25519 ( q [ 0 ] , X ) ;
set25519 ( q [ 1 ] , Y ) ;
set25519 ( q [ 2 ] , gf1 ) ;
M ( q [ 3 ] , X , Y ) ;
scalarmult ( p , q , s ) ;
}
function crypto _sign _keypair ( pk , sk , seeded ) {
var d = new Uint8Array ( 64 ) ;
var p = [ gf ( ) , gf ( ) , gf ( ) , gf ( ) ] ;
var i ;
if ( ! seeded ) randombytes ( sk , 32 ) ;
crypto _hash ( d , sk , 32 ) ;
d [ 0 ] &= 248 ;
d [ 31 ] &= 127 ;
d [ 31 ] |= 64 ;
scalarbase ( p , d ) ;
pack ( pk , p ) ;
for ( i = 0 ; i < 32 ; i ++ ) sk [ i + 32 ] = pk [ i ] ;
return 0 ;
}
var L = new Float64Array ( [ 0xed , 0xd3 , 0xf5 , 0x5c , 0x1a , 0x63 , 0x12 , 0x58 , 0xd6 , 0x9c , 0xf7 , 0xa2 , 0xde , 0xf9 , 0xde , 0x14 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x10 ] ) ;
function modL ( r , x ) {
var carry , i , j , k ;
for ( i = 63 ; i >= 32 ; -- i ) {
carry = 0 ;
for ( j = i - 32 , k = i - 12 ; j < k ; ++ j ) {
x [ j ] += carry - 16 * x [ i ] * L [ j - ( i - 32 ) ] ;
carry = ( x [ j ] + 128 ) >> 8 ;
x [ j ] -= carry * 256 ;
}
x [ j ] += carry ;
x [ i ] = 0 ;
}
carry = 0 ;
for ( j = 0 ; j < 32 ; j ++ ) {
x [ j ] += carry - ( x [ 31 ] >> 4 ) * L [ j ] ;
carry = x [ j ] >> 8 ;
x [ j ] &= 255 ;
}
for ( j = 0 ; j < 32 ; j ++ ) x [ j ] -= carry * L [ j ] ;
for ( i = 0 ; i < 32 ; i ++ ) {
x [ i + 1 ] += x [ i ] >> 8 ;
r [ i ] = x [ i ] & 255 ;
}
}
function reduce ( r ) {
var x = new Float64Array ( 64 ) , i ;
for ( i = 0 ; i < 64 ; i ++ ) x [ i ] = r [ i ] ;
for ( i = 0 ; i < 64 ; i ++ ) r [ i ] = 0 ;
modL ( r , x ) ;
}
// Note: difference from C - smlen returned, not passed as argument.
function crypto _sign ( sm , m , n , sk ) {
var d = new Uint8Array ( 64 ) , h = new Uint8Array ( 64 ) , r = new Uint8Array ( 64 ) ;
var i , j , x = new Float64Array ( 64 ) ;
var p = [ gf ( ) , gf ( ) , gf ( ) , gf ( ) ] ;
crypto _hash ( d , sk , 32 ) ;
d [ 0 ] &= 248 ;
d [ 31 ] &= 127 ;
d [ 31 ] |= 64 ;
var smlen = n + 64 ;
for ( i = 0 ; i < n ; i ++ ) sm [ 64 + i ] = m [ i ] ;
for ( i = 0 ; i < 32 ; i ++ ) sm [ 32 + i ] = d [ 32 + i ] ;
crypto _hash ( r , sm . subarray ( 32 ) , n + 32 ) ;
reduce ( r ) ;
scalarbase ( p , r ) ;
pack ( sm , p ) ;
for ( i = 32 ; i < 64 ; i ++ ) sm [ i ] = sk [ i ] ;
crypto _hash ( h , sm , n + 64 ) ;
reduce ( h ) ;
for ( i = 0 ; i < 64 ; i ++ ) x [ i ] = 0 ;
for ( i = 0 ; i < 32 ; i ++ ) x [ i ] = r [ i ] ;
for ( i = 0 ; i < 32 ; i ++ ) {
for ( j = 0 ; j < 32 ; j ++ ) {
x [ i + j ] += h [ i ] * d [ j ] ;
}
}
modL ( sm . subarray ( 32 ) , x ) ;
return smlen ;
}
function unpackneg ( r , p ) {
var t = gf ( ) , chk = gf ( ) , num = gf ( ) ,
den = gf ( ) , den2 = gf ( ) , den4 = gf ( ) ,
den6 = gf ( ) ;
set25519 ( r [ 2 ] , gf1 ) ;
unpack25519 ( r [ 1 ] , p ) ;
S ( num , r [ 1 ] ) ;
M ( den , num , D ) ;
Z ( num , num , r [ 2 ] ) ;
A ( den , r [ 2 ] , den ) ;
S ( den2 , den ) ;
S ( den4 , den2 ) ;
M ( den6 , den4 , den2 ) ;
M ( t , den6 , num ) ;
M ( t , t , den ) ;
pow2523 ( t , t ) ;
M ( t , t , num ) ;
M ( t , t , den ) ;
M ( t , t , den ) ;
M ( r [ 0 ] , t , den ) ;
S ( chk , r [ 0 ] ) ;
M ( chk , chk , den ) ;
if ( neq25519 ( chk , num ) ) M ( r [ 0 ] , r [ 0 ] , I ) ;
S ( chk , r [ 0 ] ) ;
M ( chk , chk , den ) ;
if ( neq25519 ( chk , num ) ) return - 1 ;
if ( par25519 ( r [ 0 ] ) === ( p [ 31 ] >> 7 ) ) Z ( r [ 0 ] , gf0 , r [ 0 ] ) ;
M ( r [ 3 ] , r [ 0 ] , r [ 1 ] ) ;
return 0 ;
}
function crypto _sign _open ( m , sm , n , pk ) {
var i , mlen ;
var t = new Uint8Array ( 32 ) , h = new Uint8Array ( 64 ) ;
var p = [ gf ( ) , gf ( ) , gf ( ) , gf ( ) ] ,
q = [ gf ( ) , gf ( ) , gf ( ) , gf ( ) ] ;
mlen = - 1 ;
if ( n < 64 ) return - 1 ;
if ( unpackneg ( q , pk ) ) return - 1 ;
for ( i = 0 ; i < n ; i ++ ) m [ i ] = sm [ i ] ;
for ( i = 0 ; i < 32 ; i ++ ) m [ i + 32 ] = pk [ i ] ;
crypto _hash ( h , m , n ) ;
reduce ( h ) ;
scalarmult ( p , q , h ) ;
scalarbase ( q , sm . subarray ( 32 ) ) ;
add ( p , q ) ;
pack ( t , p ) ;
n -= 64 ;
if ( crypto _verify _32 ( sm , 0 , t , 0 ) ) {
for ( i = 0 ; i < n ; i ++ ) m [ i ] = 0 ;
return - 1 ;
}
for ( i = 0 ; i < n ; i ++ ) m [ i ] = sm [ i + 64 ] ;
mlen = n ;
return mlen ;
}
var crypto _secretbox _KEYBYTES = 32 ,
crypto _secretbox _NONCEBYTES = 24 ,
crypto _secretbox _ZEROBYTES = 32 ,
crypto _secretbox _BOXZEROBYTES = 16 ,
crypto _scalarmult _BYTES = 32 ,
crypto _scalarmult _SCALARBYTES = 32 ,
crypto _box _PUBLICKEYBYTES = 32 ,
crypto _box _SECRETKEYBYTES = 32 ,
crypto _box _BEFORENMBYTES = 32 ,
crypto _box _NONCEBYTES = crypto _secretbox _NONCEBYTES ,
crypto _box _ZEROBYTES = crypto _secretbox _ZEROBYTES ,
crypto _box _BOXZEROBYTES = crypto _secretbox _BOXZEROBYTES ,
crypto _sign _BYTES = 64 ,
crypto _sign _PUBLICKEYBYTES = 32 ,
crypto _sign _SECRETKEYBYTES = 64 ,
crypto _sign _SEEDBYTES = 32 ,
crypto _hash _BYTES = 64 ;
nacl . lowlevel = {
crypto _core _hsalsa20 : crypto _core _hsalsa20 ,
crypto _stream _xor : crypto _stream _xor ,
crypto _stream : crypto _stream ,
crypto _stream _salsa20 _xor : crypto _stream _salsa20 _xor ,
crypto _stream _salsa20 : crypto _stream _salsa20 ,
crypto _onetimeauth : crypto _onetimeauth ,
crypto _onetimeauth _verify : crypto _onetimeauth _verify ,
crypto _verify _16 : crypto _verify _16 ,
crypto _verify _32 : crypto _verify _32 ,
crypto _secretbox : crypto _secretbox ,
crypto _secretbox _open : crypto _secretbox _open ,
crypto _scalarmult : crypto _scalarmult ,
crypto _scalarmult _base : crypto _scalarmult _base ,
crypto _box _beforenm : crypto _box _beforenm ,
crypto _box _afternm : crypto _box _afternm ,
crypto _box : crypto _box ,
crypto _box _open : crypto _box _open ,
crypto _box _keypair : crypto _box _keypair ,
crypto _hash : crypto _hash ,
crypto _sign : crypto _sign ,
crypto _sign _keypair : crypto _sign _keypair ,
crypto _sign _open : crypto _sign _open ,
crypto _secretbox _KEYBYTES : crypto _secretbox _KEYBYTES ,
crypto _secretbox _NONCEBYTES : crypto _secretbox _NONCEBYTES ,
crypto _secretbox _ZEROBYTES : crypto _secretbox _ZEROBYTES ,
crypto _secretbox _BOXZEROBYTES : crypto _secretbox _BOXZEROBYTES ,
crypto _scalarmult _BYTES : crypto _scalarmult _BYTES ,
crypto _scalarmult _SCALARBYTES : crypto _scalarmult _SCALARBYTES ,
crypto _box _PUBLICKEYBYTES : crypto _box _PUBLICKEYBYTES ,
crypto _box _SECRETKEYBYTES : crypto _box _SECRETKEYBYTES ,
crypto _box _BEFORENMBYTES : crypto _box _BEFORENMBYTES ,
crypto _box _NONCEBYTES : crypto _box _NONCEBYTES ,
crypto _box _ZEROBYTES : crypto _box _ZEROBYTES ,
crypto _box _BOXZEROBYTES : crypto _box _BOXZEROBYTES ,
crypto _sign _BYTES : crypto _sign _BYTES ,
crypto _sign _PUBLICKEYBYTES : crypto _sign _PUBLICKEYBYTES ,
crypto _sign _SECRETKEYBYTES : crypto _sign _SECRETKEYBYTES ,
crypto _sign _SEEDBYTES : crypto _sign _SEEDBYTES ,
crypto _hash _BYTES : crypto _hash _BYTES
} ;
/* High-level API */
function checkLengths ( k , n ) {
if ( k . length !== crypto _secretbox _KEYBYTES ) throw new Error ( 'bad key size' ) ;
if ( n . length !== crypto _secretbox _NONCEBYTES ) throw new Error ( 'bad nonce size' ) ;
}
function checkBoxLengths ( pk , sk ) {
if ( pk . length !== crypto _box _PUBLICKEYBYTES ) throw new Error ( 'bad public key size' ) ;
if ( sk . length !== crypto _box _SECRETKEYBYTES ) throw new Error ( 'bad secret key size' ) ;
}
function checkArrayTypes ( ) {
var t , i ;
for ( i = 0 ; i < arguments . length ; i ++ ) {
if ( ( t = Object . prototype . toString . call ( arguments [ i ] ) ) !== '[object Uint8Array]' )
throw new TypeError ( 'unexpected type ' + t + ', use Uint8Array' ) ;
}
}
function cleanup ( arr ) {
for ( var i = 0 ; i < arr . length ; i ++ ) arr [ i ] = 0 ;
}
// TODO: Completely remove this in v0.15.
if ( ! nacl . util ) {
nacl . util = { } ;
nacl . util . decodeUTF8 = nacl . util . encodeUTF8 = nacl . util . encodeBase64 = nacl . util . decodeBase64 = function ( ) {
throw new Error ( 'nacl.util moved into separate package: https://github.com/dchest/tweetnacl-util-js' ) ;
} ;
}
nacl . randomBytes = function ( n ) {
var b = new Uint8Array ( n ) ;
randombytes ( b , n ) ;
return b ;
} ;
nacl . secretbox = function ( msg , nonce , key ) {
checkArrayTypes ( msg , nonce , key ) ;
checkLengths ( key , nonce ) ;
var m = new Uint8Array ( crypto _secretbox _ZEROBYTES + msg . length ) ;
var c = new Uint8Array ( m . length ) ;
for ( var i = 0 ; i < msg . length ; i ++ ) m [ i + crypto _secretbox _ZEROBYTES ] = msg [ i ] ;
crypto _secretbox ( c , m , m . length , nonce , key ) ;
return c . subarray ( crypto _secretbox _BOXZEROBYTES ) ;
} ;
nacl . secretbox . open = function ( box , nonce , key ) {
checkArrayTypes ( box , nonce , key ) ;
checkLengths ( key , nonce ) ;
var c = new Uint8Array ( crypto _secretbox _BOXZEROBYTES + box . length ) ;
var m = new Uint8Array ( c . length ) ;
for ( var i = 0 ; i < box . length ; i ++ ) c [ i + crypto _secretbox _BOXZEROBYTES ] = box [ i ] ;
if ( c . length < 32 ) return false ;
if ( crypto _secretbox _open ( m , c , c . length , nonce , key ) !== 0 ) return false ;
return m . subarray ( crypto _secretbox _ZEROBYTES ) ;
} ;
nacl . secretbox . keyLength = crypto _secretbox _KEYBYTES ;
nacl . secretbox . nonceLength = crypto _secretbox _NONCEBYTES ;
nacl . secretbox . overheadLength = crypto _secretbox _BOXZEROBYTES ;
nacl . scalarMult = function ( n , p ) {
checkArrayTypes ( n , p ) ;
if ( n . length !== crypto _scalarmult _SCALARBYTES ) throw new Error ( 'bad n size' ) ;
if ( p . length !== crypto _scalarmult _BYTES ) throw new Error ( 'bad p size' ) ;
var q = new Uint8Array ( crypto _scalarmult _BYTES ) ;
crypto _scalarmult ( q , n , p ) ;
return q ;
} ;
nacl . scalarMult . base = function ( n ) {
checkArrayTypes ( n ) ;
if ( n . length !== crypto _scalarmult _SCALARBYTES ) throw new Error ( 'bad n size' ) ;
var q = new Uint8Array ( crypto _scalarmult _BYTES ) ;
crypto _scalarmult _base ( q , n ) ;
return q ;
} ;
nacl . scalarMult . scalarLength = crypto _scalarmult _SCALARBYTES ;
nacl . scalarMult . groupElementLength = crypto _scalarmult _BYTES ;
nacl . box = function ( msg , nonce , publicKey , secretKey ) {
var k = nacl . box . before ( publicKey , secretKey ) ;
return nacl . secretbox ( msg , nonce , k ) ;
} ;
nacl . box . before = function ( publicKey , secretKey ) {
checkArrayTypes ( publicKey , secretKey ) ;
checkBoxLengths ( publicKey , secretKey ) ;
var k = new Uint8Array ( crypto _box _BEFORENMBYTES ) ;
crypto _box _beforenm ( k , publicKey , secretKey ) ;
return k ;
} ;
nacl . box . after = nacl . secretbox ;
nacl . box . open = function ( msg , nonce , publicKey , secretKey ) {
var k = nacl . box . before ( publicKey , secretKey ) ;
return nacl . secretbox . open ( msg , nonce , k ) ;
} ;
nacl . box . open . after = nacl . secretbox . open ;
nacl . box . keyPair = function ( ) {
var pk = new Uint8Array ( crypto _box _PUBLICKEYBYTES ) ;
var sk = new Uint8Array ( crypto _box _SECRETKEYBYTES ) ;
crypto _box _keypair ( pk , sk ) ;
return { publicKey : pk , secretKey : sk } ;
} ;
nacl . box . keyPair . fromSecretKey = function ( secretKey ) {
checkArrayTypes ( secretKey ) ;
if ( secretKey . length !== crypto _box _SECRETKEYBYTES )
throw new Error ( 'bad secret key size' ) ;
var pk = new Uint8Array ( crypto _box _PUBLICKEYBYTES ) ;
crypto _scalarmult _base ( pk , secretKey ) ;
return { publicKey : pk , secretKey : new Uint8Array ( secretKey ) } ;
} ;
nacl . box . publicKeyLength = crypto _box _PUBLICKEYBYTES ;
nacl . box . secretKeyLength = crypto _box _SECRETKEYBYTES ;
nacl . box . sharedKeyLength = crypto _box _BEFORENMBYTES ;
nacl . box . nonceLength = crypto _box _NONCEBYTES ;
nacl . box . overheadLength = nacl . secretbox . overheadLength ;
nacl . sign = function ( msg , secretKey ) {
checkArrayTypes ( msg , secretKey ) ;
if ( secretKey . length !== crypto _sign _SECRETKEYBYTES )
throw new Error ( 'bad secret key size' ) ;
var signedMsg = new Uint8Array ( crypto _sign _BYTES + msg . length ) ;
crypto _sign ( signedMsg , msg , msg . length , secretKey ) ;
return signedMsg ;
} ;
nacl . sign . open = function ( signedMsg , publicKey ) {
if ( arguments . length !== 2 )
throw new Error ( 'nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?' ) ;
checkArrayTypes ( signedMsg , publicKey ) ;
if ( publicKey . length !== crypto _sign _PUBLICKEYBYTES )
throw new Error ( 'bad public key size' ) ;
var tmp = new Uint8Array ( signedMsg . length ) ;
var mlen = crypto _sign _open ( tmp , signedMsg , signedMsg . length , publicKey ) ;
if ( mlen < 0 ) return null ;
var m = new Uint8Array ( mlen ) ;
for ( var i = 0 ; i < m . length ; i ++ ) m [ i ] = tmp [ i ] ;
return m ;
} ;
nacl . sign . detached = function ( msg , secretKey ) {
var signedMsg = nacl . sign ( msg , secretKey ) ;
var sig = new Uint8Array ( crypto _sign _BYTES ) ;
for ( var i = 0 ; i < sig . length ; i ++ ) sig [ i ] = signedMsg [ i ] ;
return sig ;
} ;
nacl . sign . detached . verify = function ( msg , sig , publicKey ) {
checkArrayTypes ( msg , sig , publicKey ) ;
if ( sig . length !== crypto _sign _BYTES )
throw new Error ( 'bad signature size' ) ;
if ( publicKey . length !== crypto _sign _PUBLICKEYBYTES )
throw new Error ( 'bad public key size' ) ;
var sm = new Uint8Array ( crypto _sign _BYTES + msg . length ) ;
var m = new Uint8Array ( crypto _sign _BYTES + msg . length ) ;
var i ;
for ( i = 0 ; i < crypto _sign _BYTES ; i ++ ) sm [ i ] = sig [ i ] ;
for ( i = 0 ; i < msg . length ; i ++ ) sm [ i + crypto _sign _BYTES ] = msg [ i ] ;
return ( crypto _sign _open ( m , sm , sm . length , publicKey ) >= 0 ) ;
} ;
nacl . sign . keyPair = function ( ) {
var pk = new Uint8Array ( crypto _sign _PUBLICKEYBYTES ) ;
var sk = new Uint8Array ( crypto _sign _SECRETKEYBYTES ) ;
crypto _sign _keypair ( pk , sk ) ;
return { publicKey : pk , secretKey : sk } ;
} ;
nacl . sign . keyPair . fromSecretKey = function ( secretKey ) {
checkArrayTypes ( secretKey ) ;
if ( secretKey . length !== crypto _sign _SECRETKEYBYTES )
throw new Error ( 'bad secret key size' ) ;
var pk = new Uint8Array ( crypto _sign _PUBLICKEYBYTES ) ;
for ( var i = 0 ; i < pk . length ; i ++ ) pk [ i ] = secretKey [ 32 + i ] ;
return { publicKey : pk , secretKey : new Uint8Array ( secretKey ) } ;
} ;
nacl . sign . keyPair . fromSeed = function ( seed ) {
checkArrayTypes ( seed ) ;
if ( seed . length !== crypto _sign _SEEDBYTES )
throw new Error ( 'bad seed size' ) ;
var pk = new Uint8Array ( crypto _sign _PUBLICKEYBYTES ) ;
var sk = new Uint8Array ( crypto _sign _SECRETKEYBYTES ) ;
for ( var i = 0 ; i < 32 ; i ++ ) sk [ i ] = seed [ i ] ;
crypto _sign _keypair ( pk , sk , true ) ;
return { publicKey : pk , secretKey : sk } ;
} ;
nacl . sign . publicKeyLength = crypto _sign _PUBLICKEYBYTES ;
nacl . sign . secretKeyLength = crypto _sign _SECRETKEYBYTES ;
nacl . sign . seedLength = crypto _sign _SEEDBYTES ;
nacl . sign . signatureLength = crypto _sign _BYTES ;
nacl . hash = function ( msg ) {
checkArrayTypes ( msg ) ;
var h = new Uint8Array ( crypto _hash _BYTES ) ;
crypto _hash ( h , msg , msg . length ) ;
return h ;
} ;
nacl . hash . hashLength = crypto _hash _BYTES ;
nacl . verify = function ( x , y ) {
checkArrayTypes ( x , y ) ;
// Zero length arguments are considered not equal.
if ( x . length === 0 || y . length === 0 ) return false ;
if ( x . length !== y . length ) return false ;
return ( vn ( x , 0 , y , 0 , x . length ) === 0 ) ? true : false ;
} ;
nacl . setPRNG = function ( fn ) {
randombytes = fn ;
} ;
( function ( ) {
// Initialize PRNG if environment provides CSPRNG.
// If not, methods calling randombytes will throw.
var crypto = typeof self !== 'undefined' ? ( self . crypto || self . msCrypto ) : null ;
if ( crypto && crypto . getRandomValues ) {
// Browsers.
var QUOTA = 65536 ;
nacl . setPRNG ( function ( x , n ) {
var i , v = new Uint8Array ( n ) ;
for ( i = 0 ; i < n ; i += QUOTA ) {
crypto . getRandomValues ( v . subarray ( i , i + Math . min ( n - i , QUOTA ) ) ) ;
}
for ( i = 0 ; i < n ; i ++ ) x [ i ] = v [ i ] ;
cleanup ( v ) ;
} ) ;
} else if ( true ) {
// Node.js.
2017-05-05 17:24:23 +02:00
crypto = _ _webpack _require _ _ ( 94 ) ;
2017-04-26 15:58:19 +02:00
if ( crypto && crypto . randomBytes ) {
nacl . setPRNG ( function ( x , n ) {
var i , v = crypto . randomBytes ( n ) ;
for ( i = 0 ; i < n ; i ++ ) x [ i ] = v [ i ] ;
cleanup ( v ) ;
} ) ;
}
}
} ) ( ) ;
} ) ( typeof module !== 'undefined' && module . exports ? module . exports : ( self . nacl = self . nacl || { } ) ) ;
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 93 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
/* (ignored) */
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 94 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports ) {
/* (ignored) */
/***/ } ) ,
2017-05-05 17:24:23 +02:00
/* 95 */
2017-04-26 15:58:19 +02:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-05-05 17:24:23 +02:00
module . exports = _ _webpack _require _ _ ( 26 ) ;
2017-04-26 15:58:19 +02:00
/***/ } )
/******/ ] ) ;
} ) ;
2017-05-10 09:36:07 +02:00
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay91bml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uIiwid2VicGFjazovLy93ZWJwYWNrL2Jvb3RzdHJhcCBmNmYxY2VkNGRkOTQyOWE2OTA4YyIsIndlYnBhY2s6Ly8vLi9zcmMvY29ubmVjdGlvbi9nZXRBcGlVcmxzLmpzIiwid2VicGFjazovLy8uL3NyYy9yZXF1ZXN0LmpzIiwid2VicGFjazovLy8uL34vbm9kZS1saWJzLWJyb3dzZXIvfi9idWZmZXIvaW5kZXguanMiLCJ3ZWJwYWNrOi8vLy4vfi9iczU4L2luZGV4LmpzIiwid2VicGFjazovLy8uL34vZml2ZS1iZWxscy1jb25kaXRpb24vZGlzdC9pbmRleC5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvdHJhbnNhY3Rpb24vdXRpbHMvY2NKc29uaWZ5LmpzIiwid2VicGFjazovLy8uL3NyYy90cmFuc2FjdGlvbi9tYWtlVHJhbnNhY3Rpb24uanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3RyYW5zYWN0aW9uL3NlcmlhbGl6ZVRyYW5zYWN0aW9uSW50b0Nhbm9uaWNhbFN0cmluZy5qcyIsIndlYnBhY2s6Ly8vLi9+L2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19jb3JlLmpzIiwid2VicGFjazovLy8uL34vY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2Rlc2NyaXB0b3JzLmpzIiwid2VicGFjazovLy8uL34vY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2dsb2JhbC5qcyIsIndlYnBhY2s6Ly8vLi9+L2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19pcy1vYmplY3QuanMiLCJ3ZWJwYWNrOi8vLy4vfi9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fdG8taW9iamVjdC5qcyIsIndlYnBhY2s6Ly8vLi9+L3Byb2Nlc3MvYnJvd3Nlci5qcyIsIndlYnBhY2s6Ly8vKHdlYnBhY2spL2J1aWxkaW4vZ2xvYmFsLmpzIiwid2VicGFjazovLy8uL3NyYy9jb25uZWN0aW9uL2dldFN0YXR1cy5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvY29ubmVjdGlvbi9nZXRUcmFuc2FjdGlvbi5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvdHJhbnNhY3Rpb24vbWFrZUlucHV0VGVtcGxhdGUuanMiLCJ3ZWJwYWNrOi8vLy4vfi9jbG9uZS9jbG9uZS5qcyIsIndlYnBhY2s6Ly8vLi9+L2NvcmUtanMvbGlicmFyeS9mbi9vYmplY3QvZW50cmllcy5qcyIsIndlYnBhY2s6Ly8vLi9+L2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19hcnJheS1pbmNsdWRlcy5qcyIsIndlYnBhY2s6Ly8vLi9+L2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19leHBvcnQuanMiLCJ3ZWJwYWNrOi8vLy4vfi9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fZmFpbHMuanMiLCJ3ZWJwYWNrOi8vLy4vfi9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fdG8taW50ZWdlci5qcyIsIndlYnBhY2s6Ly8vLi9+L2pzLXNoYTMvc3JjL3NoYTMuanMiLCJ3ZWJwYWNrOi8vLy4vfi9zcHJpbnRmLWpzL3NyYy9zcHJpbnRmLmpzIiwid2VicGFjazovLy8uL3NyYy9FZDI1NTE5S2V5cGFpci5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvYmFzZVJlcXVlc3QuanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL2Nvbm5lY3Rpb24vZ2V0QmxvY2suanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL2Nvbm5lY3Rpb24vbGlzdEJsb2Nrcy5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvY29ubmVjdGlvbi9saXN0T3V0cHV0cy5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvY29ubmVjdGlvbi9saXN0VHJhbnNhY3Rpb25zLmpzIiwid2VicGFjazovLy8uL3NyYy9jb25uZWN0aW9uL2xpc3RWb3Rlcy5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvY29ubmVjdGlvbi9wb2xsU3RhdHVzQW5kRmV0Y2hUcmFuc2FjdGlvbi5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvY29ubmVjdGlvbi9wb3N0VHJhbnNhY3Rpb24uanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL2Zvcm1hdF90ZXh0LmpzIiwid2VicGFjazovLy8uL3NyYy9zYW5pdGl6ZS5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvc2hhMjU2SGFzaC5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvc3RyaW5naWZ5X2FzX3F1ZXJ5X3BhcmFtLmpzIiwid2VicGFjazovLy8uL3NyYy90cmFuc2FjdGlvbi9oYXNoVHJhbnNhY3Rpb24uanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3RyYW5zYWN0aW9uL21ha2VDcmVhdGVUcmFuc2FjdGlvbi5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvdHJhbnNhY3Rpb24vbWFrZUVkMjU1MTlDb25kaXRpb24uanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3RyYW5zYWN0aW9uL21ha2VPdXRwdXQuanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3RyYW5zYWN0aW9uL21ha2VTaGEyNTZDb25kaXRpb24uanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3RyYW5zYWN0aW9uL21ha2VUaHJlc2hvbGRDb25kaXRpb24uanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3RyYW5zYWN0aW9uL21ha2VUcmFuc2ZlclRyYW5zYWN0aW9uLmpzIiwid2VicGFjazovLy8uL3NyYy90cmFuc2FjdGlvbi9zaWduVHJhbnNhY3Rpb24uanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3RyYW5zYWN0aW9uL3V0aWxzL2NjSnNvbkxvYWQuanMiLCJ3ZWJwYWNrOi8vLy4vfi9iYXNlLXgvaW5kZXguanMiLCJ3ZWJwYWNrOi8vLy4vfi9iYXNlNjQtanMvaW5kZXguanMiLCJ3ZWJwYWNrOi8vLy4vfi9jb3JlLWpzL2xpYnJhcnkvZm4vYXJyYXkvaW5jbHVkZXMuanMiLCJ3ZWJwYWNrOi8vLy4vfi9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fYS1mdW5jdGlvbi5qcyIsIndlYnBhY2s6Ly8vLi9+L2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19hZGQtdG8tdW5zY29wYWJsZXMuanMiLCJ3ZWJwYWNrOi8vLy4vfi9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fYW4tb2JqZWN0LmpzIiwid2VicGFjazovLy8uL34vY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2NvZi5qcyIsIndlYnBhY2s6Ly8vLi9+L2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19jdHguanMiLCJ3ZWJwYWNrOi8vLy4vfi9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fZGVmaW5lZC5qcyIsIndlYnBhY2s6Ly8vLi9+L2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19kb20tY3JlYXRlLmpzIiwid2VicGFjazovLy8uL34vY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2VudW0tYnVnLWtleXMuanMiLCJ3ZWJwYWNrOi8vLy4vfi9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9faGFzLmpzIiw