@@ -1109,6 +1109,189 @@ var timestamp = Timestamp;
1109
1109
var Timestamp_1 = Timestamp ;
1110
1110
timestamp . Timestamp = Timestamp_1 ;
1111
1111
1112
+ /*
1113
+ The MIT License (MIT)
1114
+
1115
+ Copyright (c) 2016 CoderPuppy
1116
+
1117
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1118
+ of this software and associated documentation files (the "Software"), to deal
1119
+ in the Software without restriction, including without limitation the rights
1120
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1121
+ copies of the Software, and to permit persons to whom the Software is
1122
+ furnished to do so, subject to the following conditions:
1123
+
1124
+ The above copyright notice and this permission notice shall be included in all
1125
+ copies or substantial portions of the Software.
1126
+
1127
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1128
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1129
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1130
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1131
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1132
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1133
+ SOFTWARE.
1134
+
1135
+ */
1136
+ var _endianness ;
1137
+ function endianness ( ) {
1138
+ if ( typeof _endianness === 'undefined' ) {
1139
+ var a = new ArrayBuffer ( 2 ) ;
1140
+ var b = new Uint8Array ( a ) ;
1141
+ var c = new Uint16Array ( a ) ;
1142
+ b [ 0 ] = 1 ;
1143
+ b [ 1 ] = 2 ;
1144
+ if ( c [ 0 ] === 258 ) {
1145
+ _endianness = 'BE' ;
1146
+ } else if ( c [ 0 ] === 513 ) {
1147
+ _endianness = 'LE' ;
1148
+ } else {
1149
+ throw new Error ( 'unable to figure out endianess' ) ;
1150
+ }
1151
+ }
1152
+ return _endianness ;
1153
+ }
1154
+
1155
+ function hostname ( ) {
1156
+ if ( typeof global . location !== 'undefined' ) {
1157
+ return global . location . hostname ;
1158
+ } else return '' ;
1159
+ }
1160
+
1161
+ function loadavg ( ) {
1162
+ return [ ] ;
1163
+ }
1164
+
1165
+ function uptime ( ) {
1166
+ return 0 ;
1167
+ }
1168
+
1169
+ function freemem ( ) {
1170
+ return Number . MAX_VALUE ;
1171
+ }
1172
+
1173
+ function totalmem ( ) {
1174
+ return Number . MAX_VALUE ;
1175
+ }
1176
+
1177
+ function cpus ( ) {
1178
+ return [ ] ;
1179
+ }
1180
+
1181
+ function type ( ) {
1182
+ return 'Browser' ;
1183
+ }
1184
+
1185
+ function release ( ) {
1186
+ if ( typeof global . navigator !== 'undefined' ) {
1187
+ return global . navigator . appVersion ;
1188
+ }
1189
+ return '' ;
1190
+ }
1191
+
1192
+ function networkInterfaces ( ) { }
1193
+ function getNetworkInterfaces ( ) { }
1194
+
1195
+ function arch ( ) {
1196
+ return 'javascript' ;
1197
+ }
1198
+
1199
+ function platform ( ) {
1200
+ return 'browser' ;
1201
+ }
1202
+
1203
+ function tmpDir ( ) {
1204
+ return '/tmp' ;
1205
+ }
1206
+ var tmpdir = tmpDir ;
1207
+
1208
+ var EOL = '\n' ;
1209
+ var os = {
1210
+ EOL : EOL ,
1211
+ tmpdir : tmpdir ,
1212
+ tmpDir : tmpDir ,
1213
+ networkInterfaces : networkInterfaces ,
1214
+ getNetworkInterfaces : getNetworkInterfaces ,
1215
+ release : release ,
1216
+ type : type ,
1217
+ cpus : cpus ,
1218
+ totalmem : totalmem ,
1219
+ freemem : freemem ,
1220
+ uptime : uptime ,
1221
+ loadavg : loadavg ,
1222
+ hostname : hostname ,
1223
+ endianness : endianness
1224
+ } ;
1225
+
1226
+ var os$1 = Object . freeze ( {
1227
+ endianness : endianness ,
1228
+ hostname : hostname ,
1229
+ loadavg : loadavg ,
1230
+ uptime : uptime ,
1231
+ freemem : freemem ,
1232
+ totalmem : totalmem ,
1233
+ cpus : cpus ,
1234
+ type : type ,
1235
+ release : release ,
1236
+ networkInterfaces : networkInterfaces ,
1237
+ getNetworkInterfaces : getNetworkInterfaces ,
1238
+ arch : arch ,
1239
+ platform : platform ,
1240
+ tmpDir : tmpDir ,
1241
+ tmpdir : tmpdir ,
1242
+ EOL : EOL ,
1243
+ default : os
1244
+ } ) ;
1245
+
1246
+ var MASK_8 = 0xff ;
1247
+ var MASK_24 = 0xffffff ;
1248
+ var MASK_32 = 0xffffffff ;
1249
+
1250
+ // See http://www.isthe.com/chongo/tech/comp/fnv/#FNV-param for the definition of these parameters;
1251
+ var FNV_PRIME = new long_1 ( 16777619 , 0 ) ;
1252
+ var OFFSET_BASIS = new long_1 ( 2166136261 , 0 ) ;
1253
+ var FNV_MASK = new long_1 ( MASK_32 , 0 ) ;
1254
+
1255
+ /**
1256
+ * Implementation of the FNV-1a hash for a 32-bit hash value
1257
+ * Algorithm can be found here: http://www.isthe.com/chongo/tech/comp/fnv/#FNV-1a
1258
+ * @ignore
1259
+ */
1260
+ function fnv1a32 ( input , encoding ) {
1261
+ encoding = encoding || 'utf8' ;
1262
+ var octets = Buffer . from ( input , encoding ) ;
1263
+
1264
+ var hash = OFFSET_BASIS ;
1265
+ for ( var i = 0 ; i < octets . length ; i += 1 ) {
1266
+ hash = hash . xor ( new long_1 ( octets [ i ] , 0 ) ) ;
1267
+ hash = hash . multiply ( FNV_PRIME ) ;
1268
+ hash = hash . and ( FNV_MASK ) ;
1269
+ }
1270
+ return hash . getLowBitsUnsigned ( ) ;
1271
+ }
1272
+
1273
+ /**
1274
+ * Implements FNV-1a to generate 32-bit hash, then uses xor-folding
1275
+ * to convert to a 24-bit hash. See here for more info:
1276
+ * http://www.isthe.com/chongo/tech/comp/fnv/#xor-fold
1277
+ * @ignore
1278
+ */
1279
+ function fnv1a24 ( input , encoding ) {
1280
+ var _32bit = fnv1a32 ( input , encoding ) ;
1281
+ var base = _32bit & MASK_24 ;
1282
+ var top = _32bit >>> 24 & MASK_8 ;
1283
+ var final = ( base ^ top ) & MASK_24 ;
1284
+
1285
+ return final ;
1286
+ }
1287
+
1288
+ var fnv1a = { fnv1a24 : fnv1a24 , fnv1a32 : fnv1a32 } ;
1289
+
1290
+ var require$$0 = ( os$1 && os ) || os$1 ;
1291
+
1292
+ var hostname$1 = require$$0 . hostname ;
1293
+ var fnv1a24$1 = fnv1a . fnv1a24 ;
1294
+
1112
1295
/**
1113
1296
* Machine id.
1114
1297
*
@@ -1117,8 +1300,7 @@ timestamp.Timestamp = Timestamp_1;
1117
1300
* that would mean an asyc call to gethostname, so we don't bother.
1118
1301
* @ignore
1119
1302
*/
1120
-
1121
- var MACHINE_ID = parseInt ( Math . random ( ) * 0xffffff , 10 ) ;
1303
+ var MACHINE_ID = fnv1a24$1 ( hostname$1 ) ;
1122
1304
1123
1305
// Regular expression that checks for hex value
1124
1306
var checkForHexRegExp = new RegExp ( '^[0-9a-fA-F]{24}$' ) ;
0 commit comments