scratch-storage 6.1.5 → 6.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/chunks/fetch-worker.35b372c60d5dbced60fa.js +4 -3
- package/dist/node/chunks/fetch-worker.35b372c60d5dbced60fa.js.map +1 -1
- package/dist/node/scratch-storage.js +1748 -1748
- package/dist/node/scratch-storage.js.map +1 -1
- package/dist/web/chunks/fetch-worker.881578c221a680573772.js +1 -1
- package/dist/web/chunks/fetch-worker.881578c221a680573772.js.map +1 -1
- package/dist/web/chunks/fetch-worker.f865243047f8d2a9ab59.js +4 -3
- package/dist/web/chunks/fetch-worker.f865243047f8d2a9ab59.js.map +1 -1
- package/dist/web/scratch-storage.js +657 -657
- package/dist/web/scratch-storage.js.map +1 -1
- package/dist/web/scratch-storage.min.js +1 -1
- package/dist/web/scratch-storage.min.js.map +1 -1
- package/package.json +7 -7
|
@@ -8,6 +8,20 @@ module.exports = __webpack_require__(14)("iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAAAAA
|
|
|
8
8
|
|
|
9
9
|
/***/ },
|
|
10
10
|
|
|
11
|
+
/***/ 680
|
|
12
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
13
|
+
|
|
14
|
+
module.exports = __webpack_require__(14)("UklGRiYAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQIAAAAAAA==")
|
|
15
|
+
|
|
16
|
+
/***/ },
|
|
17
|
+
|
|
18
|
+
/***/ 914
|
|
19
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
20
|
+
|
|
21
|
+
module.exports = __webpack_require__(14)("PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjEyOCIgaGVpZ2h0PSIxMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiA8Zz4KICA8cmVjdCBmaWxsPSIjQ0NDIiBoZWlnaHQ9IjEyOCIgd2lkdGg9IjEyOCIvPgogIDx0ZXh0IGZpbGw9ImJsYWNrIiB5PSIxMDciIHg9IjM1LjUiIGZvbnQtc2l6ZT0iMTI4Ij4/PC90ZXh0PgogPC9nPgo8L3N2Zz4K")
|
|
22
|
+
|
|
23
|
+
/***/ },
|
|
24
|
+
|
|
11
25
|
/***/ 14
|
|
12
26
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
13
27
|
|
|
@@ -30,1846 +44,1643 @@ module.exports = function (base64Data) {
|
|
|
30
44
|
|
|
31
45
|
/***/ },
|
|
32
46
|
|
|
33
|
-
/***/
|
|
34
|
-
(
|
|
35
|
-
|
|
36
|
-
var Transform = __webpack_require__(408),
|
|
37
|
-
Filter = __webpack_require__(84);
|
|
47
|
+
/***/ 287
|
|
48
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
38
49
|
|
|
39
|
-
|
|
40
|
-
|
|
50
|
+
"use strict";
|
|
51
|
+
var __webpack_unused_export__;
|
|
52
|
+
/*!
|
|
53
|
+
* The buffer module from node.js, for the browser.
|
|
54
|
+
*
|
|
55
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
56
|
+
* @license MIT
|
|
57
|
+
*/
|
|
58
|
+
/* eslint-disable no-proto */
|
|
41
59
|
|
|
42
|
-
exports = module.exports = function create(name) {
|
|
43
|
-
var o = function() { log.write(name, undefined, slice.call(arguments)); return o; };
|
|
44
|
-
o.debug = function() { log.write(name, 'debug', slice.call(arguments)); return o; };
|
|
45
|
-
o.info = function() { log.write(name, 'info', slice.call(arguments)); return o; };
|
|
46
|
-
o.warn = function() { log.write(name, 'warn', slice.call(arguments)); return o; };
|
|
47
|
-
o.error = function() { log.write(name, 'error', slice.call(arguments)); return o; };
|
|
48
|
-
o.log = o.debug; // for interface compliance with Node and browser consoles
|
|
49
|
-
o.suggest = exports.suggest;
|
|
50
|
-
o.format = log.format;
|
|
51
|
-
return o;
|
|
52
|
-
};
|
|
53
60
|
|
|
54
|
-
// filled in separately
|
|
55
|
-
exports.defaultBackend = exports.defaultFormatter = null;
|
|
56
61
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
const base64 = __webpack_require__(523)
|
|
63
|
+
const ieee754 = __webpack_require__(251)
|
|
64
|
+
const customInspectSymbol =
|
|
65
|
+
(typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation
|
|
66
|
+
? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
|
|
67
|
+
: null
|
|
60
68
|
|
|
61
|
-
exports.
|
|
62
|
-
|
|
63
|
-
|
|
69
|
+
exports.hp = Buffer
|
|
70
|
+
__webpack_unused_export__ = SlowBuffer
|
|
71
|
+
exports.IS = 50
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
// this is the default filter that's applied when .enable() is called normally
|
|
68
|
-
// you can bypass it completely and set up your own pipes
|
|
69
|
-
exports.suggest = new Filter();
|
|
73
|
+
const K_MAX_LENGTH = 0x7fffffff
|
|
74
|
+
__webpack_unused_export__ = K_MAX_LENGTH
|
|
70
75
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
/**
|
|
77
|
+
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
78
|
+
* === true Use Uint8Array implementation (fastest)
|
|
79
|
+
* === false Print warning and recommend using `buffer` v4.x which has an Object
|
|
80
|
+
* implementation (most compatible, even IE6)
|
|
81
|
+
*
|
|
82
|
+
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
|
83
|
+
* Opera 11.6+, iOS 4.2+.
|
|
84
|
+
*
|
|
85
|
+
* We report that the browser does not support typed arrays if the are not subclassable
|
|
86
|
+
* using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
|
|
87
|
+
* (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
|
|
88
|
+
* for __proto__ and has a buggy typed array implementation.
|
|
89
|
+
*/
|
|
90
|
+
Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
|
|
80
91
|
|
|
92
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
|
|
93
|
+
typeof console.error === 'function') {
|
|
94
|
+
console.error(
|
|
95
|
+
'This browser lacks typed array (Uint8Array) support which is required by ' +
|
|
96
|
+
'`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
|
|
97
|
+
)
|
|
98
|
+
}
|
|
81
99
|
|
|
100
|
+
function typedArraySupport () {
|
|
101
|
+
// Can typed array instances can be augmented?
|
|
102
|
+
try {
|
|
103
|
+
const arr = new Uint8Array(1)
|
|
104
|
+
const proto = { foo: function () { return 42 } }
|
|
105
|
+
Object.setPrototypeOf(proto, Uint8Array.prototype)
|
|
106
|
+
Object.setPrototypeOf(arr, proto)
|
|
107
|
+
return arr.foo() === 42
|
|
108
|
+
} catch (e) {
|
|
109
|
+
return false
|
|
110
|
+
}
|
|
111
|
+
}
|
|
82
112
|
|
|
83
|
-
|
|
113
|
+
Object.defineProperty(Buffer.prototype, 'parent', {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
get: function () {
|
|
116
|
+
if (!Buffer.isBuffer(this)) return undefined
|
|
117
|
+
return this.buffer
|
|
118
|
+
}
|
|
119
|
+
})
|
|
84
120
|
|
|
85
|
-
|
|
86
|
-
|
|
121
|
+
Object.defineProperty(Buffer.prototype, 'offset', {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: function () {
|
|
124
|
+
if (!Buffer.isBuffer(this)) return undefined
|
|
125
|
+
return this.byteOffset
|
|
126
|
+
}
|
|
127
|
+
})
|
|
87
128
|
|
|
88
|
-
|
|
89
|
-
|
|
129
|
+
function createBuffer (length) {
|
|
130
|
+
if (length > K_MAX_LENGTH) {
|
|
131
|
+
throw new RangeError('The value "' + length + '" is invalid for option "size"')
|
|
132
|
+
}
|
|
133
|
+
// Return an augmented `Uint8Array` instance
|
|
134
|
+
const buf = new Uint8Array(length)
|
|
135
|
+
Object.setPrototypeOf(buf, Buffer.prototype)
|
|
136
|
+
return buf
|
|
137
|
+
}
|
|
90
138
|
|
|
91
|
-
|
|
139
|
+
/**
|
|
140
|
+
* The Buffer constructor returns instances of `Uint8Array` that have their
|
|
141
|
+
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
|
142
|
+
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
|
143
|
+
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
|
144
|
+
* returns a single octet.
|
|
145
|
+
*
|
|
146
|
+
* The `Uint8Array` prototype remains unmodified.
|
|
147
|
+
*/
|
|
92
148
|
|
|
93
|
-
function
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
149
|
+
function Buffer (arg, encodingOrOffset, length) {
|
|
150
|
+
// Common case.
|
|
151
|
+
if (typeof arg === 'number') {
|
|
152
|
+
if (typeof encodingOrOffset === 'string') {
|
|
153
|
+
throw new TypeError(
|
|
154
|
+
'The "string" argument must be of type string. Received type number'
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
return allocUnsafe(arg)
|
|
158
|
+
}
|
|
159
|
+
return from(arg, encodingOrOffset, length)
|
|
97
160
|
}
|
|
98
161
|
|
|
99
|
-
|
|
162
|
+
Buffer.poolSize = 8192 // not used by this implementation
|
|
100
163
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
};
|
|
164
|
+
function from (value, encodingOrOffset, length) {
|
|
165
|
+
if (typeof value === 'string') {
|
|
166
|
+
return fromString(value, encodingOrOffset)
|
|
167
|
+
}
|
|
106
168
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return this;
|
|
111
|
-
};
|
|
169
|
+
if (ArrayBuffer.isView(value)) {
|
|
170
|
+
return fromArrayView(value)
|
|
171
|
+
}
|
|
112
172
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
173
|
+
if (value == null) {
|
|
174
|
+
throw new TypeError(
|
|
175
|
+
'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
|
176
|
+
'or Array-like Object. Received type ' + (typeof value)
|
|
177
|
+
)
|
|
178
|
+
}
|
|
118
179
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
180
|
+
if (isInstance(value, ArrayBuffer) ||
|
|
181
|
+
(value && isInstance(value.buffer, ArrayBuffer))) {
|
|
182
|
+
return fromArrayBuffer(value, encodingOrOffset, length)
|
|
183
|
+
}
|
|
123
184
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return true;
|
|
129
|
-
}
|
|
130
|
-
if(this._black[i] && test(this._black[i], name) && levelMap[level] <= this._black[i].l) {
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
185
|
+
if (typeof SharedArrayBuffer !== 'undefined' &&
|
|
186
|
+
(isInstance(value, SharedArrayBuffer) ||
|
|
187
|
+
(value && isInstance(value.buffer, SharedArrayBuffer)))) {
|
|
188
|
+
return fromArrayBuffer(value, encodingOrOffset, length)
|
|
133
189
|
}
|
|
134
|
-
return this.defaultResult;
|
|
135
|
-
};
|
|
136
190
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
191
|
+
if (typeof value === 'number') {
|
|
192
|
+
throw new TypeError(
|
|
193
|
+
'The "value" argument must not be of type number. Received type number'
|
|
194
|
+
)
|
|
140
195
|
}
|
|
141
|
-
};
|
|
142
196
|
|
|
143
|
-
|
|
197
|
+
const valueOf = value.valueOf && value.valueOf()
|
|
198
|
+
if (valueOf != null && valueOf !== value) {
|
|
199
|
+
return Buffer.from(valueOf, encodingOrOffset, length)
|
|
200
|
+
}
|
|
144
201
|
|
|
202
|
+
const b = fromObject(value)
|
|
203
|
+
if (b) return b
|
|
145
204
|
|
|
146
|
-
|
|
205
|
+
if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
|
|
206
|
+
typeof value[Symbol.toPrimitive] === 'function') {
|
|
207
|
+
return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)
|
|
208
|
+
}
|
|
147
209
|
|
|
148
|
-
|
|
149
|
-
|
|
210
|
+
throw new TypeError(
|
|
211
|
+
'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
|
212
|
+
'or Array-like Object. Received type ' + (typeof value)
|
|
213
|
+
)
|
|
214
|
+
}
|
|
150
215
|
|
|
151
|
-
|
|
152
|
-
|
|
216
|
+
/**
|
|
217
|
+
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
|
218
|
+
* if value is a number.
|
|
219
|
+
* Buffer.from(str[, encoding])
|
|
220
|
+
* Buffer.from(array)
|
|
221
|
+
* Buffer.from(buffer)
|
|
222
|
+
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
223
|
+
**/
|
|
224
|
+
Buffer.from = function (value, encodingOrOffset, length) {
|
|
225
|
+
return from(value, encodingOrOffset, length)
|
|
226
|
+
}
|
|
153
227
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
try {
|
|
159
|
-
if(!cache) { cache = (window.localStorage.minilog ? JSON.parse(window.localStorage.minilog) : []); }
|
|
160
|
-
cache.push([ new Date().toString(), name, level, args ]);
|
|
161
|
-
window.localStorage.minilog = JSON.stringify(cache);
|
|
162
|
-
} catch(e) {}
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
module.exports = logger;
|
|
166
|
-
|
|
167
|
-
/***/ },
|
|
228
|
+
// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
|
|
229
|
+
// https://github.com/feross/buffer/pull/148
|
|
230
|
+
Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)
|
|
231
|
+
Object.setPrototypeOf(Buffer, Uint8Array)
|
|
168
232
|
|
|
169
|
-
|
|
170
|
-
(
|
|
233
|
+
function assertSize (size) {
|
|
234
|
+
if (typeof size !== 'number') {
|
|
235
|
+
throw new TypeError('"size" argument must be of type number')
|
|
236
|
+
} else if (size < 0) {
|
|
237
|
+
throw new RangeError('The value "' + size + '" is invalid for option "size"')
|
|
238
|
+
}
|
|
239
|
+
}
|
|
171
240
|
|
|
172
|
-
function
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
var e = this._events;
|
|
177
|
-
(e[ev] || (e[ev] = [])).push(cb);
|
|
178
|
-
return this;
|
|
179
|
-
},
|
|
180
|
-
removeListener: function(ev, cb) {
|
|
181
|
-
var e = this._events[ev] || [], i;
|
|
182
|
-
for(i = e.length-1; i >= 0 && e[i]; i--){
|
|
183
|
-
if(e[i] === cb || e[i].cb === cb) { e.splice(i, 1); }
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
removeAllListeners: function(ev) {
|
|
187
|
-
if(!ev) { this._events = {}; }
|
|
188
|
-
else { this._events[ev] && (this._events[ev] = []); }
|
|
189
|
-
},
|
|
190
|
-
listeners: function(ev) {
|
|
191
|
-
return (this._events ? this._events[ev] || [] : []);
|
|
192
|
-
},
|
|
193
|
-
emit: function(ev) {
|
|
194
|
-
this._events || (this._events = {});
|
|
195
|
-
var args = Array.prototype.slice.call(arguments, 1), i, e = this._events[ev] || [];
|
|
196
|
-
for(i = e.length-1; i >= 0 && e[i]; i--){
|
|
197
|
-
e[i].apply(this, args);
|
|
198
|
-
}
|
|
199
|
-
return this;
|
|
200
|
-
},
|
|
201
|
-
when: function(ev, cb) {
|
|
202
|
-
return this.once(ev, cb, true);
|
|
203
|
-
},
|
|
204
|
-
once: function(ev, cb, when) {
|
|
205
|
-
if(!cb) return this;
|
|
206
|
-
function c() {
|
|
207
|
-
if(!when) this.removeListener(ev, c);
|
|
208
|
-
if(cb.apply(this, arguments) && when) this.removeListener(ev, c);
|
|
209
|
-
}
|
|
210
|
-
c.cb = cb;
|
|
211
|
-
this.on(ev, c);
|
|
212
|
-
return this;
|
|
241
|
+
function alloc (size, fill, encoding) {
|
|
242
|
+
assertSize(size)
|
|
243
|
+
if (size <= 0) {
|
|
244
|
+
return createBuffer(size)
|
|
213
245
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
246
|
+
if (fill !== undefined) {
|
|
247
|
+
// Only pay attention to encoding if it's a string. This
|
|
248
|
+
// prevents accidentally sending in a number that would
|
|
249
|
+
// be interpreted as a start offset.
|
|
250
|
+
return typeof encoding === 'string'
|
|
251
|
+
? createBuffer(size).fill(fill, encoding)
|
|
252
|
+
: createBuffer(size).fill(fill)
|
|
219
253
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
/***/ },
|
|
254
|
+
return createBuffer(size)
|
|
255
|
+
}
|
|
225
256
|
|
|
226
|
-
|
|
227
|
-
|
|
257
|
+
/**
|
|
258
|
+
* Creates a new filled Buffer instance.
|
|
259
|
+
* alloc(size[, fill[, encoding]])
|
|
260
|
+
**/
|
|
261
|
+
Buffer.alloc = function (size, fill, encoding) {
|
|
262
|
+
return alloc(size, fill, encoding)
|
|
263
|
+
}
|
|
228
264
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
green: '#25bc26',
|
|
233
|
-
yellow: '#bbbb00',
|
|
234
|
-
blue: '#492ee1',
|
|
235
|
-
magenta: '#d338d3',
|
|
236
|
-
cyan: '#33bbc8',
|
|
237
|
-
gray: '#808080',
|
|
238
|
-
purple: '#708'
|
|
239
|
-
};
|
|
240
|
-
function color(fg, isInverse) {
|
|
241
|
-
if(isInverse) {
|
|
242
|
-
return 'color: #fff; background: '+hex[fg]+';';
|
|
243
|
-
} else {
|
|
244
|
-
return 'color: '+hex[fg]+';';
|
|
245
|
-
}
|
|
265
|
+
function allocUnsafe (size) {
|
|
266
|
+
assertSize(size)
|
|
267
|
+
return createBuffer(size < 0 ? 0 : checked(size) | 0)
|
|
246
268
|
}
|
|
247
269
|
|
|
248
|
-
|
|
270
|
+
/**
|
|
271
|
+
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
272
|
+
* */
|
|
273
|
+
Buffer.allocUnsafe = function (size) {
|
|
274
|
+
return allocUnsafe(size)
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
278
|
+
*/
|
|
279
|
+
Buffer.allocUnsafeSlow = function (size) {
|
|
280
|
+
return allocUnsafe(size)
|
|
281
|
+
}
|
|
249
282
|
|
|
283
|
+
function fromString (string, encoding) {
|
|
284
|
+
if (typeof encoding !== 'string' || encoding === '') {
|
|
285
|
+
encoding = 'utf8'
|
|
286
|
+
}
|
|
250
287
|
|
|
251
|
-
|
|
288
|
+
if (!Buffer.isEncoding(encoding)) {
|
|
289
|
+
throw new TypeError('Unknown encoding: ' + encoding)
|
|
290
|
+
}
|
|
252
291
|
|
|
253
|
-
|
|
254
|
-
(
|
|
292
|
+
const length = byteLength(string, encoding) | 0
|
|
293
|
+
let buf = createBuffer(length)
|
|
255
294
|
|
|
256
|
-
|
|
257
|
-
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
|
258
|
-
var e, m
|
|
259
|
-
var eLen = (nBytes * 8) - mLen - 1
|
|
260
|
-
var eMax = (1 << eLen) - 1
|
|
261
|
-
var eBias = eMax >> 1
|
|
262
|
-
var nBits = -7
|
|
263
|
-
var i = isLE ? (nBytes - 1) : 0
|
|
264
|
-
var d = isLE ? -1 : 1
|
|
265
|
-
var s = buffer[offset + i]
|
|
295
|
+
const actual = buf.write(string, encoding)
|
|
266
296
|
|
|
267
|
-
|
|
297
|
+
if (actual !== length) {
|
|
298
|
+
// Writing a hex string, for example, that contains invalid characters will
|
|
299
|
+
// cause everything after the first invalid character to be ignored. (e.g.
|
|
300
|
+
// 'abxxcd' will be treated as 'ab')
|
|
301
|
+
buf = buf.slice(0, actual)
|
|
302
|
+
}
|
|
268
303
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
nBits += eLen
|
|
272
|
-
for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
|
304
|
+
return buf
|
|
305
|
+
}
|
|
273
306
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
for (
|
|
307
|
+
function fromArrayLike (array) {
|
|
308
|
+
const length = array.length < 0 ? 0 : checked(array.length) | 0
|
|
309
|
+
const buf = createBuffer(length)
|
|
310
|
+
for (let i = 0; i < length; i += 1) {
|
|
311
|
+
buf[i] = array[i] & 255
|
|
312
|
+
}
|
|
313
|
+
return buf
|
|
314
|
+
}
|
|
278
315
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
return
|
|
283
|
-
} else {
|
|
284
|
-
m = m + Math.pow(2, mLen)
|
|
285
|
-
e = e - eBias
|
|
316
|
+
function fromArrayView (arrayView) {
|
|
317
|
+
if (isInstance(arrayView, Uint8Array)) {
|
|
318
|
+
const copy = new Uint8Array(arrayView)
|
|
319
|
+
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
|
|
286
320
|
}
|
|
287
|
-
return (
|
|
321
|
+
return fromArrayLike(arrayView)
|
|
288
322
|
}
|
|
289
323
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
var eBias = eMax >> 1
|
|
295
|
-
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
|
|
296
|
-
var i = isLE ? 0 : (nBytes - 1)
|
|
297
|
-
var d = isLE ? 1 : -1
|
|
298
|
-
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
|
|
324
|
+
function fromArrayBuffer (array, byteOffset, length) {
|
|
325
|
+
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
326
|
+
throw new RangeError('"offset" is outside of buffer bounds')
|
|
327
|
+
}
|
|
299
328
|
|
|
300
|
-
|
|
329
|
+
if (array.byteLength < byteOffset + (length || 0)) {
|
|
330
|
+
throw new RangeError('"length" is outside of buffer bounds')
|
|
331
|
+
}
|
|
301
332
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
333
|
+
let buf
|
|
334
|
+
if (byteOffset === undefined && length === undefined) {
|
|
335
|
+
buf = new Uint8Array(array)
|
|
336
|
+
} else if (length === undefined) {
|
|
337
|
+
buf = new Uint8Array(array, byteOffset)
|
|
305
338
|
} else {
|
|
306
|
-
|
|
307
|
-
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
308
|
-
e--
|
|
309
|
-
c *= 2
|
|
310
|
-
}
|
|
311
|
-
if (e + eBias >= 1) {
|
|
312
|
-
value += rt / c
|
|
313
|
-
} else {
|
|
314
|
-
value += rt * Math.pow(2, 1 - eBias)
|
|
315
|
-
}
|
|
316
|
-
if (value * c >= 2) {
|
|
317
|
-
e++
|
|
318
|
-
c /= 2
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
if (e + eBias >= eMax) {
|
|
322
|
-
m = 0
|
|
323
|
-
e = eMax
|
|
324
|
-
} else if (e + eBias >= 1) {
|
|
325
|
-
m = ((value * c) - 1) * Math.pow(2, mLen)
|
|
326
|
-
e = e + eBias
|
|
327
|
-
} else {
|
|
328
|
-
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
|
|
329
|
-
e = 0
|
|
330
|
-
}
|
|
339
|
+
buf = new Uint8Array(array, byteOffset, length)
|
|
331
340
|
}
|
|
332
341
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
e = (e << mLen) | m
|
|
336
|
-
eLen += mLen
|
|
337
|
-
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
|
342
|
+
// Return an augmented `Uint8Array` instance
|
|
343
|
+
Object.setPrototypeOf(buf, Buffer.prototype)
|
|
338
344
|
|
|
339
|
-
|
|
345
|
+
return buf
|
|
340
346
|
}
|
|
341
347
|
|
|
348
|
+
function fromObject (obj) {
|
|
349
|
+
if (Buffer.isBuffer(obj)) {
|
|
350
|
+
const len = checked(obj.length) | 0
|
|
351
|
+
const buf = createBuffer(len)
|
|
342
352
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
(module, __unused_webpack_exports, __webpack_require__) {
|
|
347
|
-
|
|
348
|
-
var Transform = __webpack_require__(408);
|
|
349
|
-
|
|
350
|
-
var newlines = /\n+$/,
|
|
351
|
-
logger = new Transform();
|
|
353
|
+
if (buf.length === 0) {
|
|
354
|
+
return buf
|
|
355
|
+
}
|
|
352
356
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
if (typeof console === 'undefined' || !console.log) {
|
|
356
|
-
return;
|
|
357
|
+
obj.copy(buf, 0, 0, len)
|
|
358
|
+
return buf
|
|
357
359
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
// for IE8/9: make console.log at least a bit less awful
|
|
363
|
-
if(args[i] && typeof args[i] == 'string') {
|
|
364
|
-
args[i] = args[i].replace(newlines, '');
|
|
360
|
+
|
|
361
|
+
if (obj.length !== undefined) {
|
|
362
|
+
if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
|
|
363
|
+
return createBuffer(0)
|
|
365
364
|
}
|
|
366
|
-
|
|
367
|
-
for(i = 0; i < args.length; i++) {
|
|
368
|
-
args[i] = JSON.stringify(args[i]);
|
|
369
|
-
}
|
|
370
|
-
} catch(e) {}
|
|
371
|
-
console.log(args.join(' '));
|
|
365
|
+
return fromArrayLike(obj)
|
|
372
366
|
}
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
logger.formatters = ['color', 'minilog'];
|
|
376
|
-
logger.color = __webpack_require__(638);
|
|
377
|
-
logger.minilog = __webpack_require__(658);
|
|
378
|
-
|
|
379
|
-
module.exports = logger;
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
/***/ },
|
|
383
367
|
|
|
384
|
-
|
|
385
|
-
(
|
|
368
|
+
if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
|
|
369
|
+
return fromArrayLike(obj.data)
|
|
370
|
+
}
|
|
371
|
+
}
|
|
386
372
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
373
|
+
function checked (length) {
|
|
374
|
+
// Note: cannot use `length < K_MAX_LENGTH` here because that fails when
|
|
375
|
+
// length is NaN (which is otherwise coerced to zero.)
|
|
376
|
+
if (length >= K_MAX_LENGTH) {
|
|
377
|
+
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
|
378
|
+
'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
|
|
379
|
+
}
|
|
380
|
+
return length | 0
|
|
381
|
+
}
|
|
396
382
|
|
|
383
|
+
function SlowBuffer (length) {
|
|
384
|
+
if (+length != length) { // eslint-disable-line eqeqeq
|
|
385
|
+
length = 0
|
|
386
|
+
}
|
|
387
|
+
return Buffer.alloc(+length)
|
|
388
|
+
}
|
|
397
389
|
|
|
390
|
+
Buffer.isBuffer = function isBuffer (b) {
|
|
391
|
+
return b != null && b._isBuffer === true &&
|
|
392
|
+
b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
|
|
393
|
+
}
|
|
398
394
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
(
|
|
403
|
-
|
|
404
|
-
|
|
395
|
+
Buffer.compare = function compare (a, b) {
|
|
396
|
+
if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
|
|
397
|
+
if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
|
|
398
|
+
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
|
399
|
+
throw new TypeError(
|
|
400
|
+
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
401
|
+
)
|
|
402
|
+
}
|
|
405
403
|
|
|
406
|
-
|
|
407
|
-
__webpack_unused_export__ = SlowBuffer
|
|
408
|
-
exports.IS = 50
|
|
404
|
+
if (a === b) return 0
|
|
409
405
|
|
|
410
|
-
|
|
411
|
-
|
|
406
|
+
let x = a.length
|
|
407
|
+
let y = b.length
|
|
412
408
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
* Opera 11.6+, iOS 4.2+.
|
|
421
|
-
*
|
|
422
|
-
* We report that the browser does not support typed arrays if the are not subclassable
|
|
423
|
-
* using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
|
|
424
|
-
* (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
|
|
425
|
-
* for __proto__ and has a buggy typed array implementation.
|
|
426
|
-
*/
|
|
427
|
-
Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
|
|
409
|
+
for (let i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
410
|
+
if (a[i] !== b[i]) {
|
|
411
|
+
x = a[i]
|
|
412
|
+
y = b[i]
|
|
413
|
+
break
|
|
414
|
+
}
|
|
415
|
+
}
|
|
428
416
|
|
|
429
|
-
if (
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
'This browser lacks typed array (Uint8Array) support which is required by ' +
|
|
433
|
-
'`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
|
|
434
|
-
)
|
|
417
|
+
if (x < y) return -1
|
|
418
|
+
if (y < x) return 1
|
|
419
|
+
return 0
|
|
435
420
|
}
|
|
436
421
|
|
|
437
|
-
function
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
422
|
+
Buffer.isEncoding = function isEncoding (encoding) {
|
|
423
|
+
switch (String(encoding).toLowerCase()) {
|
|
424
|
+
case 'hex':
|
|
425
|
+
case 'utf8':
|
|
426
|
+
case 'utf-8':
|
|
427
|
+
case 'ascii':
|
|
428
|
+
case 'latin1':
|
|
429
|
+
case 'binary':
|
|
430
|
+
case 'base64':
|
|
431
|
+
case 'ucs2':
|
|
432
|
+
case 'ucs-2':
|
|
433
|
+
case 'utf16le':
|
|
434
|
+
case 'utf-16le':
|
|
435
|
+
return true
|
|
436
|
+
default:
|
|
437
|
+
return false
|
|
447
438
|
}
|
|
448
439
|
}
|
|
449
440
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
if (!Buffer.isBuffer(this)) return undefined
|
|
454
|
-
return this.buffer
|
|
441
|
+
Buffer.concat = function concat (list, length) {
|
|
442
|
+
if (!Array.isArray(list)) {
|
|
443
|
+
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
455
444
|
}
|
|
456
|
-
})
|
|
457
445
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
get: function () {
|
|
461
|
-
if (!Buffer.isBuffer(this)) return undefined
|
|
462
|
-
return this.byteOffset
|
|
446
|
+
if (list.length === 0) {
|
|
447
|
+
return Buffer.alloc(0)
|
|
463
448
|
}
|
|
464
|
-
})
|
|
465
449
|
|
|
466
|
-
|
|
467
|
-
if (length
|
|
468
|
-
|
|
450
|
+
let i
|
|
451
|
+
if (length === undefined) {
|
|
452
|
+
length = 0
|
|
453
|
+
for (i = 0; i < list.length; ++i) {
|
|
454
|
+
length += list[i].length
|
|
455
|
+
}
|
|
469
456
|
}
|
|
470
|
-
// Return an augmented `Uint8Array` instance
|
|
471
|
-
const buf = new Uint8Array(length)
|
|
472
|
-
Object.setPrototypeOf(buf, Buffer.prototype)
|
|
473
|
-
return buf
|
|
474
|
-
}
|
|
475
457
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
)
|
|
458
|
+
const buffer = Buffer.allocUnsafe(length)
|
|
459
|
+
let pos = 0
|
|
460
|
+
for (i = 0; i < list.length; ++i) {
|
|
461
|
+
let buf = list[i]
|
|
462
|
+
if (isInstance(buf, Uint8Array)) {
|
|
463
|
+
if (pos + buf.length > buffer.length) {
|
|
464
|
+
if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)
|
|
465
|
+
buf.copy(buffer, pos)
|
|
466
|
+
} else {
|
|
467
|
+
Uint8Array.prototype.set.call(
|
|
468
|
+
buffer,
|
|
469
|
+
buf,
|
|
470
|
+
pos
|
|
471
|
+
)
|
|
472
|
+
}
|
|
473
|
+
} else if (!Buffer.isBuffer(buf)) {
|
|
474
|
+
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
475
|
+
} else {
|
|
476
|
+
buf.copy(buffer, pos)
|
|
493
477
|
}
|
|
494
|
-
|
|
478
|
+
pos += buf.length
|
|
495
479
|
}
|
|
496
|
-
return
|
|
480
|
+
return buffer
|
|
497
481
|
}
|
|
498
482
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
if (typeof value === 'string') {
|
|
503
|
-
return fromString(value, encodingOrOffset)
|
|
483
|
+
function byteLength (string, encoding) {
|
|
484
|
+
if (Buffer.isBuffer(string)) {
|
|
485
|
+
return string.length
|
|
504
486
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
return fromArrayView(value)
|
|
487
|
+
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
|
|
488
|
+
return string.byteLength
|
|
508
489
|
}
|
|
509
|
-
|
|
510
|
-
if (value == null) {
|
|
490
|
+
if (typeof string !== 'string') {
|
|
511
491
|
throw new TypeError(
|
|
512
|
-
'The
|
|
513
|
-
'
|
|
492
|
+
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
|
|
493
|
+
'Received type ' + typeof string
|
|
514
494
|
)
|
|
515
495
|
}
|
|
516
496
|
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
}
|
|
497
|
+
const len = string.length
|
|
498
|
+
const mustMatch = (arguments.length > 2 && arguments[2] === true)
|
|
499
|
+
if (!mustMatch && len === 0) return 0
|
|
521
500
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
501
|
+
// Use a for loop to avoid recursion
|
|
502
|
+
let loweredCase = false
|
|
503
|
+
for (;;) {
|
|
504
|
+
switch (encoding) {
|
|
505
|
+
case 'ascii':
|
|
506
|
+
case 'latin1':
|
|
507
|
+
case 'binary':
|
|
508
|
+
return len
|
|
509
|
+
case 'utf8':
|
|
510
|
+
case 'utf-8':
|
|
511
|
+
return utf8ToBytes(string).length
|
|
512
|
+
case 'ucs2':
|
|
513
|
+
case 'ucs-2':
|
|
514
|
+
case 'utf16le':
|
|
515
|
+
case 'utf-16le':
|
|
516
|
+
return len * 2
|
|
517
|
+
case 'hex':
|
|
518
|
+
return len >>> 1
|
|
519
|
+
case 'base64':
|
|
520
|
+
return base64ToBytes(string).length
|
|
521
|
+
default:
|
|
522
|
+
if (loweredCase) {
|
|
523
|
+
return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
|
|
524
|
+
}
|
|
525
|
+
encoding = ('' + encoding).toLowerCase()
|
|
526
|
+
loweredCase = true
|
|
527
|
+
}
|
|
526
528
|
}
|
|
529
|
+
}
|
|
530
|
+
Buffer.byteLength = byteLength
|
|
527
531
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
+
function slowToString (encoding, start, end) {
|
|
533
|
+
let loweredCase = false
|
|
534
|
+
|
|
535
|
+
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
|
536
|
+
// property of a typed array.
|
|
537
|
+
|
|
538
|
+
// This behaves neither like String nor Uint8Array in that we set start/end
|
|
539
|
+
// to their upper/lower bounds if the value passed is out of range.
|
|
540
|
+
// undefined is handled specially as per ECMA-262 6th Edition,
|
|
541
|
+
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
|
542
|
+
if (start === undefined || start < 0) {
|
|
543
|
+
start = 0
|
|
544
|
+
}
|
|
545
|
+
// Return early if start > this.length. Done here to prevent potential uint32
|
|
546
|
+
// coercion fail below.
|
|
547
|
+
if (start > this.length) {
|
|
548
|
+
return ''
|
|
532
549
|
}
|
|
533
550
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
return Buffer.from(valueOf, encodingOrOffset, length)
|
|
551
|
+
if (end === undefined || end > this.length) {
|
|
552
|
+
end = this.length
|
|
537
553
|
}
|
|
538
554
|
|
|
539
|
-
|
|
540
|
-
|
|
555
|
+
if (end <= 0) {
|
|
556
|
+
return ''
|
|
557
|
+
}
|
|
541
558
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
559
|
+
// Force coercion to uint32. This will also coerce falsey/NaN values to 0.
|
|
560
|
+
end >>>= 0
|
|
561
|
+
start >>>= 0
|
|
562
|
+
|
|
563
|
+
if (end <= start) {
|
|
564
|
+
return ''
|
|
545
565
|
}
|
|
546
566
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
567
|
+
if (!encoding) encoding = 'utf8'
|
|
568
|
+
|
|
569
|
+
while (true) {
|
|
570
|
+
switch (encoding) {
|
|
571
|
+
case 'hex':
|
|
572
|
+
return hexSlice(this, start, end)
|
|
573
|
+
|
|
574
|
+
case 'utf8':
|
|
575
|
+
case 'utf-8':
|
|
576
|
+
return utf8Slice(this, start, end)
|
|
577
|
+
|
|
578
|
+
case 'ascii':
|
|
579
|
+
return asciiSlice(this, start, end)
|
|
580
|
+
|
|
581
|
+
case 'latin1':
|
|
582
|
+
case 'binary':
|
|
583
|
+
return latin1Slice(this, start, end)
|
|
584
|
+
|
|
585
|
+
case 'base64':
|
|
586
|
+
return base64Slice(this, start, end)
|
|
587
|
+
|
|
588
|
+
case 'ucs2':
|
|
589
|
+
case 'ucs-2':
|
|
590
|
+
case 'utf16le':
|
|
591
|
+
case 'utf-16le':
|
|
592
|
+
return utf16leSlice(this, start, end)
|
|
593
|
+
|
|
594
|
+
default:
|
|
595
|
+
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
596
|
+
encoding = (encoding + '').toLowerCase()
|
|
597
|
+
loweredCase = true
|
|
598
|
+
}
|
|
599
|
+
}
|
|
551
600
|
}
|
|
552
601
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
602
|
+
// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
|
|
603
|
+
// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
|
|
604
|
+
// reliably in a browserify context because there could be multiple different
|
|
605
|
+
// copies of the 'buffer' package in use. This method works even for Buffer
|
|
606
|
+
// instances that were created from another copy of the `buffer` package.
|
|
607
|
+
// See: https://github.com/feross/buffer/issues/154
|
|
608
|
+
Buffer.prototype._isBuffer = true
|
|
609
|
+
|
|
610
|
+
function swap (b, n, m) {
|
|
611
|
+
const i = b[n]
|
|
612
|
+
b[n] = b[m]
|
|
613
|
+
b[m] = i
|
|
563
614
|
}
|
|
564
615
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
616
|
+
Buffer.prototype.swap16 = function swap16 () {
|
|
617
|
+
const len = this.length
|
|
618
|
+
if (len % 2 !== 0) {
|
|
619
|
+
throw new RangeError('Buffer size must be a multiple of 16-bits')
|
|
620
|
+
}
|
|
621
|
+
for (let i = 0; i < len; i += 2) {
|
|
622
|
+
swap(this, i, i + 1)
|
|
623
|
+
}
|
|
624
|
+
return this
|
|
625
|
+
}
|
|
569
626
|
|
|
570
|
-
function
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
627
|
+
Buffer.prototype.swap32 = function swap32 () {
|
|
628
|
+
const len = this.length
|
|
629
|
+
if (len % 4 !== 0) {
|
|
630
|
+
throw new RangeError('Buffer size must be a multiple of 32-bits')
|
|
631
|
+
}
|
|
632
|
+
for (let i = 0; i < len; i += 4) {
|
|
633
|
+
swap(this, i, i + 3)
|
|
634
|
+
swap(this, i + 1, i + 2)
|
|
575
635
|
}
|
|
636
|
+
return this
|
|
576
637
|
}
|
|
577
638
|
|
|
578
|
-
function
|
|
579
|
-
|
|
580
|
-
if (
|
|
581
|
-
|
|
639
|
+
Buffer.prototype.swap64 = function swap64 () {
|
|
640
|
+
const len = this.length
|
|
641
|
+
if (len % 8 !== 0) {
|
|
642
|
+
throw new RangeError('Buffer size must be a multiple of 64-bits')
|
|
582
643
|
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
? createBuffer(size).fill(fill, encoding)
|
|
589
|
-
: createBuffer(size).fill(fill)
|
|
644
|
+
for (let i = 0; i < len; i += 8) {
|
|
645
|
+
swap(this, i, i + 7)
|
|
646
|
+
swap(this, i + 1, i + 6)
|
|
647
|
+
swap(this, i + 2, i + 5)
|
|
648
|
+
swap(this, i + 3, i + 4)
|
|
590
649
|
}
|
|
591
|
-
return
|
|
650
|
+
return this
|
|
592
651
|
}
|
|
593
652
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
return alloc(size, fill, encoding)
|
|
653
|
+
Buffer.prototype.toString = function toString () {
|
|
654
|
+
const length = this.length
|
|
655
|
+
if (length === 0) return ''
|
|
656
|
+
if (arguments.length === 0) return utf8Slice(this, 0, length)
|
|
657
|
+
return slowToString.apply(this, arguments)
|
|
600
658
|
}
|
|
601
659
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
660
|
+
Buffer.prototype.toLocaleString = Buffer.prototype.toString
|
|
661
|
+
|
|
662
|
+
Buffer.prototype.equals = function equals (b) {
|
|
663
|
+
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
|
664
|
+
if (this === b) return true
|
|
665
|
+
return Buffer.compare(this, b) === 0
|
|
605
666
|
}
|
|
606
667
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
668
|
+
Buffer.prototype.inspect = function inspect () {
|
|
669
|
+
let str = ''
|
|
670
|
+
const max = exports.IS
|
|
671
|
+
str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
|
|
672
|
+
if (this.length > max) str += ' ... '
|
|
673
|
+
return '<Buffer ' + str + '>'
|
|
612
674
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
*/
|
|
616
|
-
Buffer.allocUnsafeSlow = function (size) {
|
|
617
|
-
return allocUnsafe(size)
|
|
675
|
+
if (customInspectSymbol) {
|
|
676
|
+
Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect
|
|
618
677
|
}
|
|
619
678
|
|
|
620
|
-
function
|
|
621
|
-
if (
|
|
622
|
-
|
|
679
|
+
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
|
680
|
+
if (isInstance(target, Uint8Array)) {
|
|
681
|
+
target = Buffer.from(target, target.offset, target.byteLength)
|
|
623
682
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
683
|
+
if (!Buffer.isBuffer(target)) {
|
|
684
|
+
throw new TypeError(
|
|
685
|
+
'The "target" argument must be one of type Buffer or Uint8Array. ' +
|
|
686
|
+
'Received type ' + (typeof target)
|
|
687
|
+
)
|
|
627
688
|
}
|
|
628
689
|
|
|
629
|
-
|
|
630
|
-
|
|
690
|
+
if (start === undefined) {
|
|
691
|
+
start = 0
|
|
692
|
+
}
|
|
693
|
+
if (end === undefined) {
|
|
694
|
+
end = target ? target.length : 0
|
|
695
|
+
}
|
|
696
|
+
if (thisStart === undefined) {
|
|
697
|
+
thisStart = 0
|
|
698
|
+
}
|
|
699
|
+
if (thisEnd === undefined) {
|
|
700
|
+
thisEnd = this.length
|
|
701
|
+
}
|
|
631
702
|
|
|
632
|
-
|
|
703
|
+
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
704
|
+
throw new RangeError('out of range index')
|
|
705
|
+
}
|
|
633
706
|
|
|
634
|
-
if (
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
707
|
+
if (thisStart >= thisEnd && start >= end) {
|
|
708
|
+
return 0
|
|
709
|
+
}
|
|
710
|
+
if (thisStart >= thisEnd) {
|
|
711
|
+
return -1
|
|
712
|
+
}
|
|
713
|
+
if (start >= end) {
|
|
714
|
+
return 1
|
|
639
715
|
}
|
|
640
716
|
|
|
641
|
-
|
|
642
|
-
|
|
717
|
+
start >>>= 0
|
|
718
|
+
end >>>= 0
|
|
719
|
+
thisStart >>>= 0
|
|
720
|
+
thisEnd >>>= 0
|
|
643
721
|
|
|
644
|
-
|
|
645
|
-
const length = array.length < 0 ? 0 : checked(array.length) | 0
|
|
646
|
-
const buf = createBuffer(length)
|
|
647
|
-
for (let i = 0; i < length; i += 1) {
|
|
648
|
-
buf[i] = array[i] & 255
|
|
649
|
-
}
|
|
650
|
-
return buf
|
|
651
|
-
}
|
|
722
|
+
if (this === target) return 0
|
|
652
723
|
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
724
|
+
let x = thisEnd - thisStart
|
|
725
|
+
let y = end - start
|
|
726
|
+
const len = Math.min(x, y)
|
|
727
|
+
|
|
728
|
+
const thisCopy = this.slice(thisStart, thisEnd)
|
|
729
|
+
const targetCopy = target.slice(start, end)
|
|
730
|
+
|
|
731
|
+
for (let i = 0; i < len; ++i) {
|
|
732
|
+
if (thisCopy[i] !== targetCopy[i]) {
|
|
733
|
+
x = thisCopy[i]
|
|
734
|
+
y = targetCopy[i]
|
|
735
|
+
break
|
|
736
|
+
}
|
|
657
737
|
}
|
|
658
|
-
|
|
738
|
+
|
|
739
|
+
if (x < y) return -1
|
|
740
|
+
if (y < x) return 1
|
|
741
|
+
return 0
|
|
659
742
|
}
|
|
660
743
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
744
|
+
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
|
|
745
|
+
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
|
|
746
|
+
//
|
|
747
|
+
// Arguments:
|
|
748
|
+
// - buffer - a Buffer to search
|
|
749
|
+
// - val - a string, Buffer, or number
|
|
750
|
+
// - byteOffset - an index into `buffer`; will be clamped to an int32
|
|
751
|
+
// - encoding - an optional encoding, relevant is val is a string
|
|
752
|
+
// - dir - true for indexOf, false for lastIndexOf
|
|
753
|
+
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
|
754
|
+
// Empty buffer means no match
|
|
755
|
+
if (buffer.length === 0) return -1
|
|
756
|
+
|
|
757
|
+
// Normalize byteOffset
|
|
758
|
+
if (typeof byteOffset === 'string') {
|
|
759
|
+
encoding = byteOffset
|
|
760
|
+
byteOffset = 0
|
|
761
|
+
} else if (byteOffset > 0x7fffffff) {
|
|
762
|
+
byteOffset = 0x7fffffff
|
|
763
|
+
} else if (byteOffset < -0x80000000) {
|
|
764
|
+
byteOffset = -0x80000000
|
|
765
|
+
}
|
|
766
|
+
byteOffset = +byteOffset // Coerce to Number.
|
|
767
|
+
if (numberIsNaN(byteOffset)) {
|
|
768
|
+
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
|
|
769
|
+
byteOffset = dir ? 0 : (buffer.length - 1)
|
|
664
770
|
}
|
|
665
771
|
|
|
666
|
-
|
|
667
|
-
|
|
772
|
+
// Normalize byteOffset: negative offsets start from the end of the buffer
|
|
773
|
+
if (byteOffset < 0) byteOffset = buffer.length + byteOffset
|
|
774
|
+
if (byteOffset >= buffer.length) {
|
|
775
|
+
if (dir) return -1
|
|
776
|
+
else byteOffset = buffer.length - 1
|
|
777
|
+
} else if (byteOffset < 0) {
|
|
778
|
+
if (dir) byteOffset = 0
|
|
779
|
+
else return -1
|
|
668
780
|
}
|
|
669
781
|
|
|
670
|
-
|
|
671
|
-
if (
|
|
672
|
-
|
|
673
|
-
} else if (length === undefined) {
|
|
674
|
-
buf = new Uint8Array(array, byteOffset)
|
|
675
|
-
} else {
|
|
676
|
-
buf = new Uint8Array(array, byteOffset, length)
|
|
782
|
+
// Normalize val
|
|
783
|
+
if (typeof val === 'string') {
|
|
784
|
+
val = Buffer.from(val, encoding)
|
|
677
785
|
}
|
|
678
786
|
|
|
679
|
-
//
|
|
680
|
-
|
|
787
|
+
// Finally, search either indexOf (if dir is true) or lastIndexOf
|
|
788
|
+
if (Buffer.isBuffer(val)) {
|
|
789
|
+
// Special case: looking for empty string/buffer always fails
|
|
790
|
+
if (val.length === 0) {
|
|
791
|
+
return -1
|
|
792
|
+
}
|
|
793
|
+
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
|
794
|
+
} else if (typeof val === 'number') {
|
|
795
|
+
val = val & 0xFF // Search for a byte value [0-255]
|
|
796
|
+
if (typeof Uint8Array.prototype.indexOf === 'function') {
|
|
797
|
+
if (dir) {
|
|
798
|
+
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
|
799
|
+
} else {
|
|
800
|
+
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
|
|
804
|
+
}
|
|
681
805
|
|
|
682
|
-
|
|
806
|
+
throw new TypeError('val must be string, number or Buffer')
|
|
683
807
|
}
|
|
684
808
|
|
|
685
|
-
function
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
809
|
+
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
|
810
|
+
let indexSize = 1
|
|
811
|
+
let arrLength = arr.length
|
|
812
|
+
let valLength = val.length
|
|
689
813
|
|
|
690
|
-
|
|
691
|
-
|
|
814
|
+
if (encoding !== undefined) {
|
|
815
|
+
encoding = String(encoding).toLowerCase()
|
|
816
|
+
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
|
817
|
+
encoding === 'utf16le' || encoding === 'utf-16le') {
|
|
818
|
+
if (arr.length < 2 || val.length < 2) {
|
|
819
|
+
return -1
|
|
820
|
+
}
|
|
821
|
+
indexSize = 2
|
|
822
|
+
arrLength /= 2
|
|
823
|
+
valLength /= 2
|
|
824
|
+
byteOffset /= 2
|
|
692
825
|
}
|
|
693
|
-
|
|
694
|
-
obj.copy(buf, 0, 0, len)
|
|
695
|
-
return buf
|
|
696
826
|
}
|
|
697
827
|
|
|
698
|
-
|
|
699
|
-
if (
|
|
700
|
-
return
|
|
828
|
+
function read (buf, i) {
|
|
829
|
+
if (indexSize === 1) {
|
|
830
|
+
return buf[i]
|
|
831
|
+
} else {
|
|
832
|
+
return buf.readUInt16BE(i * indexSize)
|
|
701
833
|
}
|
|
702
|
-
return fromArrayLike(obj)
|
|
703
834
|
}
|
|
704
835
|
|
|
705
|
-
|
|
706
|
-
|
|
836
|
+
let i
|
|
837
|
+
if (dir) {
|
|
838
|
+
let foundIndex = -1
|
|
839
|
+
for (i = byteOffset; i < arrLength; i++) {
|
|
840
|
+
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
841
|
+
if (foundIndex === -1) foundIndex = i
|
|
842
|
+
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
|
843
|
+
} else {
|
|
844
|
+
if (foundIndex !== -1) i -= i - foundIndex
|
|
845
|
+
foundIndex = -1
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
} else {
|
|
849
|
+
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
|
850
|
+
for (i = byteOffset; i >= 0; i--) {
|
|
851
|
+
let found = true
|
|
852
|
+
for (let j = 0; j < valLength; j++) {
|
|
853
|
+
if (read(arr, i + j) !== read(val, j)) {
|
|
854
|
+
found = false
|
|
855
|
+
break
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
if (found) return i
|
|
859
|
+
}
|
|
707
860
|
}
|
|
861
|
+
|
|
862
|
+
return -1
|
|
708
863
|
}
|
|
709
864
|
|
|
710
|
-
function
|
|
711
|
-
|
|
712
|
-
// length is NaN (which is otherwise coerced to zero.)
|
|
713
|
-
if (length >= K_MAX_LENGTH) {
|
|
714
|
-
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
|
715
|
-
'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
|
|
716
|
-
}
|
|
717
|
-
return length | 0
|
|
865
|
+
Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
|
866
|
+
return this.indexOf(val, byteOffset, encoding) !== -1
|
|
718
867
|
}
|
|
719
868
|
|
|
720
|
-
function
|
|
721
|
-
|
|
722
|
-
length = 0
|
|
723
|
-
}
|
|
724
|
-
return Buffer.alloc(+length)
|
|
869
|
+
Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
|
870
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
|
725
871
|
}
|
|
726
872
|
|
|
727
|
-
Buffer.
|
|
728
|
-
return
|
|
729
|
-
b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
|
|
873
|
+
Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
|
874
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
|
730
875
|
}
|
|
731
876
|
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
if (!
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
)
|
|
877
|
+
function hexWrite (buf, string, offset, length) {
|
|
878
|
+
offset = Number(offset) || 0
|
|
879
|
+
const remaining = buf.length - offset
|
|
880
|
+
if (!length) {
|
|
881
|
+
length = remaining
|
|
882
|
+
} else {
|
|
883
|
+
length = Number(length)
|
|
884
|
+
if (length > remaining) {
|
|
885
|
+
length = remaining
|
|
886
|
+
}
|
|
739
887
|
}
|
|
740
888
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
let x = a.length
|
|
744
|
-
let y = b.length
|
|
889
|
+
const strLen = string.length
|
|
745
890
|
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
891
|
+
if (length > strLen / 2) {
|
|
892
|
+
length = strLen / 2
|
|
893
|
+
}
|
|
894
|
+
let i
|
|
895
|
+
for (i = 0; i < length; ++i) {
|
|
896
|
+
const parsed = parseInt(string.substr(i * 2, 2), 16)
|
|
897
|
+
if (numberIsNaN(parsed)) return i
|
|
898
|
+
buf[offset + i] = parsed
|
|
752
899
|
}
|
|
900
|
+
return i
|
|
901
|
+
}
|
|
753
902
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
return 0
|
|
903
|
+
function utf8Write (buf, string, offset, length) {
|
|
904
|
+
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
|
757
905
|
}
|
|
758
906
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
case 'hex':
|
|
762
|
-
case 'utf8':
|
|
763
|
-
case 'utf-8':
|
|
764
|
-
case 'ascii':
|
|
765
|
-
case 'latin1':
|
|
766
|
-
case 'binary':
|
|
767
|
-
case 'base64':
|
|
768
|
-
case 'ucs2':
|
|
769
|
-
case 'ucs-2':
|
|
770
|
-
case 'utf16le':
|
|
771
|
-
case 'utf-16le':
|
|
772
|
-
return true
|
|
773
|
-
default:
|
|
774
|
-
return false
|
|
775
|
-
}
|
|
907
|
+
function asciiWrite (buf, string, offset, length) {
|
|
908
|
+
return blitBuffer(asciiToBytes(string), buf, offset, length)
|
|
776
909
|
}
|
|
777
910
|
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
if (list.length === 0) {
|
|
784
|
-
return Buffer.alloc(0)
|
|
785
|
-
}
|
|
911
|
+
function base64Write (buf, string, offset, length) {
|
|
912
|
+
return blitBuffer(base64ToBytes(string), buf, offset, length)
|
|
913
|
+
}
|
|
786
914
|
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
for (i = 0; i < list.length; ++i) {
|
|
791
|
-
length += list[i].length
|
|
792
|
-
}
|
|
793
|
-
}
|
|
915
|
+
function ucs2Write (buf, string, offset, length) {
|
|
916
|
+
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
|
917
|
+
}
|
|
794
918
|
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
919
|
+
Buffer.prototype.write = function write (string, offset, length, encoding) {
|
|
920
|
+
// Buffer#write(string)
|
|
921
|
+
if (offset === undefined) {
|
|
922
|
+
encoding = 'utf8'
|
|
923
|
+
length = this.length
|
|
924
|
+
offset = 0
|
|
925
|
+
// Buffer#write(string, encoding)
|
|
926
|
+
} else if (length === undefined && typeof offset === 'string') {
|
|
927
|
+
encoding = offset
|
|
928
|
+
length = this.length
|
|
929
|
+
offset = 0
|
|
930
|
+
// Buffer#write(string, offset[, length][, encoding])
|
|
931
|
+
} else if (isFinite(offset)) {
|
|
932
|
+
offset = offset >>> 0
|
|
933
|
+
if (isFinite(length)) {
|
|
934
|
+
length = length >>> 0
|
|
935
|
+
if (encoding === undefined) encoding = 'utf8'
|
|
812
936
|
} else {
|
|
813
|
-
|
|
937
|
+
encoding = length
|
|
938
|
+
length = undefined
|
|
814
939
|
}
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
function byteLength (string, encoding) {
|
|
821
|
-
if (Buffer.isBuffer(string)) {
|
|
822
|
-
return string.length
|
|
823
|
-
}
|
|
824
|
-
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
|
|
825
|
-
return string.byteLength
|
|
826
|
-
}
|
|
827
|
-
if (typeof string !== 'string') {
|
|
828
|
-
throw new TypeError(
|
|
829
|
-
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
|
|
830
|
-
'Received type ' + typeof string
|
|
940
|
+
} else {
|
|
941
|
+
throw new Error(
|
|
942
|
+
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
|
831
943
|
)
|
|
832
944
|
}
|
|
833
945
|
|
|
834
|
-
const
|
|
835
|
-
|
|
836
|
-
if (!mustMatch && len === 0) return 0
|
|
837
|
-
|
|
838
|
-
// Use a for loop to avoid recursion
|
|
839
|
-
let loweredCase = false
|
|
840
|
-
for (;;) {
|
|
841
|
-
switch (encoding) {
|
|
842
|
-
case 'ascii':
|
|
843
|
-
case 'latin1':
|
|
844
|
-
case 'binary':
|
|
845
|
-
return len
|
|
846
|
-
case 'utf8':
|
|
847
|
-
case 'utf-8':
|
|
848
|
-
return utf8ToBytes(string).length
|
|
849
|
-
case 'ucs2':
|
|
850
|
-
case 'ucs-2':
|
|
851
|
-
case 'utf16le':
|
|
852
|
-
case 'utf-16le':
|
|
853
|
-
return len * 2
|
|
854
|
-
case 'hex':
|
|
855
|
-
return len >>> 1
|
|
856
|
-
case 'base64':
|
|
857
|
-
return base64ToBytes(string).length
|
|
858
|
-
default:
|
|
859
|
-
if (loweredCase) {
|
|
860
|
-
return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
|
|
861
|
-
}
|
|
862
|
-
encoding = ('' + encoding).toLowerCase()
|
|
863
|
-
loweredCase = true
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
Buffer.byteLength = byteLength
|
|
868
|
-
|
|
869
|
-
function slowToString (encoding, start, end) {
|
|
870
|
-
let loweredCase = false
|
|
871
|
-
|
|
872
|
-
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
|
873
|
-
// property of a typed array.
|
|
874
|
-
|
|
875
|
-
// This behaves neither like String nor Uint8Array in that we set start/end
|
|
876
|
-
// to their upper/lower bounds if the value passed is out of range.
|
|
877
|
-
// undefined is handled specially as per ECMA-262 6th Edition,
|
|
878
|
-
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
|
879
|
-
if (start === undefined || start < 0) {
|
|
880
|
-
start = 0
|
|
881
|
-
}
|
|
882
|
-
// Return early if start > this.length. Done here to prevent potential uint32
|
|
883
|
-
// coercion fail below.
|
|
884
|
-
if (start > this.length) {
|
|
885
|
-
return ''
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
if (end === undefined || end > this.length) {
|
|
889
|
-
end = this.length
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
if (end <= 0) {
|
|
893
|
-
return ''
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
// Force coercion to uint32. This will also coerce falsey/NaN values to 0.
|
|
897
|
-
end >>>= 0
|
|
898
|
-
start >>>= 0
|
|
946
|
+
const remaining = this.length - offset
|
|
947
|
+
if (length === undefined || length > remaining) length = remaining
|
|
899
948
|
|
|
900
|
-
if (
|
|
901
|
-
|
|
949
|
+
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
|
950
|
+
throw new RangeError('Attempt to write outside buffer bounds')
|
|
902
951
|
}
|
|
903
952
|
|
|
904
953
|
if (!encoding) encoding = 'utf8'
|
|
905
954
|
|
|
906
|
-
|
|
955
|
+
let loweredCase = false
|
|
956
|
+
for (;;) {
|
|
907
957
|
switch (encoding) {
|
|
908
958
|
case 'hex':
|
|
909
|
-
return
|
|
959
|
+
return hexWrite(this, string, offset, length)
|
|
910
960
|
|
|
911
961
|
case 'utf8':
|
|
912
962
|
case 'utf-8':
|
|
913
|
-
return
|
|
963
|
+
return utf8Write(this, string, offset, length)
|
|
914
964
|
|
|
915
965
|
case 'ascii':
|
|
916
|
-
return asciiSlice(this, start, end)
|
|
917
|
-
|
|
918
966
|
case 'latin1':
|
|
919
967
|
case 'binary':
|
|
920
|
-
return
|
|
968
|
+
return asciiWrite(this, string, offset, length)
|
|
921
969
|
|
|
922
970
|
case 'base64':
|
|
923
|
-
|
|
971
|
+
// Warning: maxLength not taken into account in base64Write
|
|
972
|
+
return base64Write(this, string, offset, length)
|
|
924
973
|
|
|
925
974
|
case 'ucs2':
|
|
926
975
|
case 'ucs-2':
|
|
927
976
|
case 'utf16le':
|
|
928
977
|
case 'utf-16le':
|
|
929
|
-
return
|
|
978
|
+
return ucs2Write(this, string, offset, length)
|
|
930
979
|
|
|
931
980
|
default:
|
|
932
981
|
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
933
|
-
encoding = (
|
|
982
|
+
encoding = ('' + encoding).toLowerCase()
|
|
934
983
|
loweredCase = true
|
|
935
984
|
}
|
|
936
985
|
}
|
|
937
986
|
}
|
|
938
987
|
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
// instances that were created from another copy of the `buffer` package.
|
|
944
|
-
// See: https://github.com/feross/buffer/issues/154
|
|
945
|
-
Buffer.prototype._isBuffer = true
|
|
946
|
-
|
|
947
|
-
function swap (b, n, m) {
|
|
948
|
-
const i = b[n]
|
|
949
|
-
b[n] = b[m]
|
|
950
|
-
b[m] = i
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
Buffer.prototype.swap16 = function swap16 () {
|
|
954
|
-
const len = this.length
|
|
955
|
-
if (len % 2 !== 0) {
|
|
956
|
-
throw new RangeError('Buffer size must be a multiple of 16-bits')
|
|
957
|
-
}
|
|
958
|
-
for (let i = 0; i < len; i += 2) {
|
|
959
|
-
swap(this, i, i + 1)
|
|
988
|
+
Buffer.prototype.toJSON = function toJSON () {
|
|
989
|
+
return {
|
|
990
|
+
type: 'Buffer',
|
|
991
|
+
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
960
992
|
}
|
|
961
|
-
return this
|
|
962
993
|
}
|
|
963
994
|
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
for (let i = 0; i < len; i += 4) {
|
|
970
|
-
swap(this, i, i + 3)
|
|
971
|
-
swap(this, i + 1, i + 2)
|
|
995
|
+
function base64Slice (buf, start, end) {
|
|
996
|
+
if (start === 0 && end === buf.length) {
|
|
997
|
+
return base64.fromByteArray(buf)
|
|
998
|
+
} else {
|
|
999
|
+
return base64.fromByteArray(buf.slice(start, end))
|
|
972
1000
|
}
|
|
973
|
-
return this
|
|
974
1001
|
}
|
|
975
1002
|
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
throw new RangeError('Buffer size must be a multiple of 64-bits')
|
|
980
|
-
}
|
|
981
|
-
for (let i = 0; i < len; i += 8) {
|
|
982
|
-
swap(this, i, i + 7)
|
|
983
|
-
swap(this, i + 1, i + 6)
|
|
984
|
-
swap(this, i + 2, i + 5)
|
|
985
|
-
swap(this, i + 3, i + 4)
|
|
986
|
-
}
|
|
987
|
-
return this
|
|
988
|
-
}
|
|
1003
|
+
function utf8Slice (buf, start, end) {
|
|
1004
|
+
end = Math.min(buf.length, end)
|
|
1005
|
+
const res = []
|
|
989
1006
|
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1007
|
+
let i = start
|
|
1008
|
+
while (i < end) {
|
|
1009
|
+
const firstByte = buf[i]
|
|
1010
|
+
let codePoint = null
|
|
1011
|
+
let bytesPerSequence = (firstByte > 0xEF)
|
|
1012
|
+
? 4
|
|
1013
|
+
: (firstByte > 0xDF)
|
|
1014
|
+
? 3
|
|
1015
|
+
: (firstByte > 0xBF)
|
|
1016
|
+
? 2
|
|
1017
|
+
: 1
|
|
996
1018
|
|
|
997
|
-
|
|
1019
|
+
if (i + bytesPerSequence <= end) {
|
|
1020
|
+
let secondByte, thirdByte, fourthByte, tempCodePoint
|
|
998
1021
|
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
}
|
|
1022
|
+
switch (bytesPerSequence) {
|
|
1023
|
+
case 1:
|
|
1024
|
+
if (firstByte < 0x80) {
|
|
1025
|
+
codePoint = firstByte
|
|
1026
|
+
}
|
|
1027
|
+
break
|
|
1028
|
+
case 2:
|
|
1029
|
+
secondByte = buf[i + 1]
|
|
1030
|
+
if ((secondByte & 0xC0) === 0x80) {
|
|
1031
|
+
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
|
|
1032
|
+
if (tempCodePoint > 0x7F) {
|
|
1033
|
+
codePoint = tempCodePoint
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
break
|
|
1037
|
+
case 3:
|
|
1038
|
+
secondByte = buf[i + 1]
|
|
1039
|
+
thirdByte = buf[i + 2]
|
|
1040
|
+
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
|
1041
|
+
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
|
|
1042
|
+
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
|
1043
|
+
codePoint = tempCodePoint
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
break
|
|
1047
|
+
case 4:
|
|
1048
|
+
secondByte = buf[i + 1]
|
|
1049
|
+
thirdByte = buf[i + 2]
|
|
1050
|
+
fourthByte = buf[i + 3]
|
|
1051
|
+
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
|
1052
|
+
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
|
|
1053
|
+
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
|
1054
|
+
codePoint = tempCodePoint
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1004
1059
|
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1060
|
+
if (codePoint === null) {
|
|
1061
|
+
// we did not generate a valid codePoint so insert a
|
|
1062
|
+
// replacement char (U+FFFD) and advance only 1 byte
|
|
1063
|
+
codePoint = 0xFFFD
|
|
1064
|
+
bytesPerSequence = 1
|
|
1065
|
+
} else if (codePoint > 0xFFFF) {
|
|
1066
|
+
// encode to utf16 (surrogate pair dance)
|
|
1067
|
+
codePoint -= 0x10000
|
|
1068
|
+
res.push(codePoint >>> 10 & 0x3FF | 0xD800)
|
|
1069
|
+
codePoint = 0xDC00 | codePoint & 0x3FF
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
res.push(codePoint)
|
|
1073
|
+
i += bytesPerSequence
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
return decodeCodePointsArray(res)
|
|
1014
1077
|
}
|
|
1015
1078
|
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1079
|
+
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
|
1080
|
+
// the lowest limit is Chrome, with 0x10000 args.
|
|
1081
|
+
// We go 1 magnitude less, for safety
|
|
1082
|
+
const MAX_ARGUMENTS_LENGTH = 0x1000
|
|
1083
|
+
|
|
1084
|
+
function decodeCodePointsArray (codePoints) {
|
|
1085
|
+
const len = codePoints.length
|
|
1086
|
+
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
1087
|
+
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
|
|
1019
1088
|
}
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1089
|
+
|
|
1090
|
+
// Decode in chunks to avoid "call stack size exceeded".
|
|
1091
|
+
let res = ''
|
|
1092
|
+
let i = 0
|
|
1093
|
+
while (i < len) {
|
|
1094
|
+
res += String.fromCharCode.apply(
|
|
1095
|
+
String,
|
|
1096
|
+
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
1024
1097
|
)
|
|
1025
1098
|
}
|
|
1099
|
+
return res
|
|
1100
|
+
}
|
|
1026
1101
|
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
if (thisStart === undefined) {
|
|
1034
|
-
thisStart = 0
|
|
1102
|
+
function asciiSlice (buf, start, end) {
|
|
1103
|
+
let ret = ''
|
|
1104
|
+
end = Math.min(buf.length, end)
|
|
1105
|
+
|
|
1106
|
+
for (let i = start; i < end; ++i) {
|
|
1107
|
+
ret += String.fromCharCode(buf[i] & 0x7F)
|
|
1035
1108
|
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1109
|
+
return ret
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
function latin1Slice (buf, start, end) {
|
|
1113
|
+
let ret = ''
|
|
1114
|
+
end = Math.min(buf.length, end)
|
|
1115
|
+
|
|
1116
|
+
for (let i = start; i < end; ++i) {
|
|
1117
|
+
ret += String.fromCharCode(buf[i])
|
|
1038
1118
|
}
|
|
1119
|
+
return ret
|
|
1120
|
+
}
|
|
1039
1121
|
|
|
1040
|
-
|
|
1041
|
-
|
|
1122
|
+
function hexSlice (buf, start, end) {
|
|
1123
|
+
const len = buf.length
|
|
1124
|
+
|
|
1125
|
+
if (!start || start < 0) start = 0
|
|
1126
|
+
if (!end || end < 0 || end > len) end = len
|
|
1127
|
+
|
|
1128
|
+
let out = ''
|
|
1129
|
+
for (let i = start; i < end; ++i) {
|
|
1130
|
+
out += hexSliceLookupTable[buf[i]]
|
|
1042
1131
|
}
|
|
1132
|
+
return out
|
|
1133
|
+
}
|
|
1043
1134
|
|
|
1044
|
-
|
|
1045
|
-
|
|
1135
|
+
function utf16leSlice (buf, start, end) {
|
|
1136
|
+
const bytes = buf.slice(start, end)
|
|
1137
|
+
let res = ''
|
|
1138
|
+
// If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
|
|
1139
|
+
for (let i = 0; i < bytes.length - 1; i += 2) {
|
|
1140
|
+
res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
|
|
1046
1141
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1142
|
+
return res
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
Buffer.prototype.slice = function slice (start, end) {
|
|
1146
|
+
const len = this.length
|
|
1147
|
+
start = ~~start
|
|
1148
|
+
end = end === undefined ? len : ~~end
|
|
1149
|
+
|
|
1150
|
+
if (start < 0) {
|
|
1151
|
+
start += len
|
|
1152
|
+
if (start < 0) start = 0
|
|
1153
|
+
} else if (start > len) {
|
|
1154
|
+
start = len
|
|
1049
1155
|
}
|
|
1050
|
-
|
|
1051
|
-
|
|
1156
|
+
|
|
1157
|
+
if (end < 0) {
|
|
1158
|
+
end += len
|
|
1159
|
+
if (end < 0) end = 0
|
|
1160
|
+
} else if (end > len) {
|
|
1161
|
+
end = len
|
|
1052
1162
|
}
|
|
1053
1163
|
|
|
1054
|
-
start
|
|
1055
|
-
end >>>= 0
|
|
1056
|
-
thisStart >>>= 0
|
|
1057
|
-
thisEnd >>>= 0
|
|
1164
|
+
if (end < start) end = start
|
|
1058
1165
|
|
|
1059
|
-
|
|
1166
|
+
const newBuf = this.subarray(start, end)
|
|
1167
|
+
// Return an augmented `Uint8Array` instance
|
|
1168
|
+
Object.setPrototypeOf(newBuf, Buffer.prototype)
|
|
1060
1169
|
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
const len = Math.min(x, y)
|
|
1170
|
+
return newBuf
|
|
1171
|
+
}
|
|
1064
1172
|
|
|
1065
|
-
|
|
1066
|
-
|
|
1173
|
+
/*
|
|
1174
|
+
* Need to make sure that buffer isn't trying to write out of bounds.
|
|
1175
|
+
*/
|
|
1176
|
+
function checkOffset (offset, ext, length) {
|
|
1177
|
+
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
|
1178
|
+
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
|
1179
|
+
}
|
|
1067
1180
|
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1181
|
+
Buffer.prototype.readUintLE =
|
|
1182
|
+
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
|
1183
|
+
offset = offset >>> 0
|
|
1184
|
+
byteLength = byteLength >>> 0
|
|
1185
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
1186
|
+
|
|
1187
|
+
let val = this[offset]
|
|
1188
|
+
let mul = 1
|
|
1189
|
+
let i = 0
|
|
1190
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
1191
|
+
val += this[offset + i] * mul
|
|
1074
1192
|
}
|
|
1075
1193
|
|
|
1076
|
-
|
|
1077
|
-
if (y < x) return 1
|
|
1078
|
-
return 0
|
|
1194
|
+
return val
|
|
1079
1195
|
}
|
|
1080
1196
|
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
// - byteOffset - an index into `buffer`; will be clamped to an int32
|
|
1088
|
-
// - encoding - an optional encoding, relevant is val is a string
|
|
1089
|
-
// - dir - true for indexOf, false for lastIndexOf
|
|
1090
|
-
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
|
1091
|
-
// Empty buffer means no match
|
|
1092
|
-
if (buffer.length === 0) return -1
|
|
1093
|
-
|
|
1094
|
-
// Normalize byteOffset
|
|
1095
|
-
if (typeof byteOffset === 'string') {
|
|
1096
|
-
encoding = byteOffset
|
|
1097
|
-
byteOffset = 0
|
|
1098
|
-
} else if (byteOffset > 0x7fffffff) {
|
|
1099
|
-
byteOffset = 0x7fffffff
|
|
1100
|
-
} else if (byteOffset < -0x80000000) {
|
|
1101
|
-
byteOffset = -0x80000000
|
|
1102
|
-
}
|
|
1103
|
-
byteOffset = +byteOffset // Coerce to Number.
|
|
1104
|
-
if (numberIsNaN(byteOffset)) {
|
|
1105
|
-
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
|
|
1106
|
-
byteOffset = dir ? 0 : (buffer.length - 1)
|
|
1197
|
+
Buffer.prototype.readUintBE =
|
|
1198
|
+
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
|
1199
|
+
offset = offset >>> 0
|
|
1200
|
+
byteLength = byteLength >>> 0
|
|
1201
|
+
if (!noAssert) {
|
|
1202
|
+
checkOffset(offset, byteLength, this.length)
|
|
1107
1203
|
}
|
|
1108
1204
|
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
else byteOffset = buffer.length - 1
|
|
1114
|
-
} else if (byteOffset < 0) {
|
|
1115
|
-
if (dir) byteOffset = 0
|
|
1116
|
-
else return -1
|
|
1205
|
+
let val = this[offset + --byteLength]
|
|
1206
|
+
let mul = 1
|
|
1207
|
+
while (byteLength > 0 && (mul *= 0x100)) {
|
|
1208
|
+
val += this[offset + --byteLength] * mul
|
|
1117
1209
|
}
|
|
1118
1210
|
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
val = Buffer.from(val, encoding)
|
|
1122
|
-
}
|
|
1211
|
+
return val
|
|
1212
|
+
}
|
|
1123
1213
|
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
}
|
|
1130
|
-
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
|
1131
|
-
} else if (typeof val === 'number') {
|
|
1132
|
-
val = val & 0xFF // Search for a byte value [0-255]
|
|
1133
|
-
if (typeof Uint8Array.prototype.indexOf === 'function') {
|
|
1134
|
-
if (dir) {
|
|
1135
|
-
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
|
1136
|
-
} else {
|
|
1137
|
-
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
throw new TypeError('val must be string, number or Buffer')
|
|
1214
|
+
Buffer.prototype.readUint8 =
|
|
1215
|
+
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
|
1216
|
+
offset = offset >>> 0
|
|
1217
|
+
if (!noAssert) checkOffset(offset, 1, this.length)
|
|
1218
|
+
return this[offset]
|
|
1144
1219
|
}
|
|
1145
1220
|
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
if (encoding !== undefined) {
|
|
1152
|
-
encoding = String(encoding).toLowerCase()
|
|
1153
|
-
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
|
1154
|
-
encoding === 'utf16le' || encoding === 'utf-16le') {
|
|
1155
|
-
if (arr.length < 2 || val.length < 2) {
|
|
1156
|
-
return -1
|
|
1157
|
-
}
|
|
1158
|
-
indexSize = 2
|
|
1159
|
-
arrLength /= 2
|
|
1160
|
-
valLength /= 2
|
|
1161
|
-
byteOffset /= 2
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
function read (buf, i) {
|
|
1166
|
-
if (indexSize === 1) {
|
|
1167
|
-
return buf[i]
|
|
1168
|
-
} else {
|
|
1169
|
-
return buf.readUInt16BE(i * indexSize)
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
let i
|
|
1174
|
-
if (dir) {
|
|
1175
|
-
let foundIndex = -1
|
|
1176
|
-
for (i = byteOffset; i < arrLength; i++) {
|
|
1177
|
-
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
1178
|
-
if (foundIndex === -1) foundIndex = i
|
|
1179
|
-
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
|
1180
|
-
} else {
|
|
1181
|
-
if (foundIndex !== -1) i -= i - foundIndex
|
|
1182
|
-
foundIndex = -1
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
} else {
|
|
1186
|
-
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
|
1187
|
-
for (i = byteOffset; i >= 0; i--) {
|
|
1188
|
-
let found = true
|
|
1189
|
-
for (let j = 0; j < valLength; j++) {
|
|
1190
|
-
if (read(arr, i + j) !== read(val, j)) {
|
|
1191
|
-
found = false
|
|
1192
|
-
break
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
|
-
if (found) return i
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
return -1
|
|
1221
|
+
Buffer.prototype.readUint16LE =
|
|
1222
|
+
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
|
1223
|
+
offset = offset >>> 0
|
|
1224
|
+
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
1225
|
+
return this[offset] | (this[offset + 1] << 8)
|
|
1200
1226
|
}
|
|
1201
1227
|
|
|
1202
|
-
Buffer.prototype.
|
|
1203
|
-
|
|
1228
|
+
Buffer.prototype.readUint16BE =
|
|
1229
|
+
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
|
1230
|
+
offset = offset >>> 0
|
|
1231
|
+
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
1232
|
+
return (this[offset] << 8) | this[offset + 1]
|
|
1204
1233
|
}
|
|
1205
1234
|
|
|
1206
|
-
Buffer.prototype.
|
|
1207
|
-
|
|
1235
|
+
Buffer.prototype.readUint32LE =
|
|
1236
|
+
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
|
1237
|
+
offset = offset >>> 0
|
|
1238
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
1239
|
+
|
|
1240
|
+
return ((this[offset]) |
|
|
1241
|
+
(this[offset + 1] << 8) |
|
|
1242
|
+
(this[offset + 2] << 16)) +
|
|
1243
|
+
(this[offset + 3] * 0x1000000)
|
|
1208
1244
|
}
|
|
1209
1245
|
|
|
1210
|
-
Buffer.prototype.
|
|
1211
|
-
|
|
1246
|
+
Buffer.prototype.readUint32BE =
|
|
1247
|
+
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
|
1248
|
+
offset = offset >>> 0
|
|
1249
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
1250
|
+
|
|
1251
|
+
return (this[offset] * 0x1000000) +
|
|
1252
|
+
((this[offset + 1] << 16) |
|
|
1253
|
+
(this[offset + 2] << 8) |
|
|
1254
|
+
this[offset + 3])
|
|
1212
1255
|
}
|
|
1213
1256
|
|
|
1214
|
-
|
|
1215
|
-
offset =
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
length
|
|
1221
|
-
if (length > remaining) {
|
|
1222
|
-
length = remaining
|
|
1223
|
-
}
|
|
1257
|
+
Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {
|
|
1258
|
+
offset = offset >>> 0
|
|
1259
|
+
validateNumber(offset, 'offset')
|
|
1260
|
+
const first = this[offset]
|
|
1261
|
+
const last = this[offset + 7]
|
|
1262
|
+
if (first === undefined || last === undefined) {
|
|
1263
|
+
boundsError(offset, this.length - 8)
|
|
1224
1264
|
}
|
|
1225
1265
|
|
|
1226
|
-
const
|
|
1266
|
+
const lo = first +
|
|
1267
|
+
this[++offset] * 2 ** 8 +
|
|
1268
|
+
this[++offset] * 2 ** 16 +
|
|
1269
|
+
this[++offset] * 2 ** 24
|
|
1227
1270
|
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
for (i = 0; i < length; ++i) {
|
|
1233
|
-
const parsed = parseInt(string.substr(i * 2, 2), 16)
|
|
1234
|
-
if (numberIsNaN(parsed)) return i
|
|
1235
|
-
buf[offset + i] = parsed
|
|
1236
|
-
}
|
|
1237
|
-
return i
|
|
1238
|
-
}
|
|
1271
|
+
const hi = this[++offset] +
|
|
1272
|
+
this[++offset] * 2 ** 8 +
|
|
1273
|
+
this[++offset] * 2 ** 16 +
|
|
1274
|
+
last * 2 ** 24
|
|
1239
1275
|
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
}
|
|
1276
|
+
return BigInt(lo) + (BigInt(hi) << BigInt(32))
|
|
1277
|
+
})
|
|
1243
1278
|
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1279
|
+
Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {
|
|
1280
|
+
offset = offset >>> 0
|
|
1281
|
+
validateNumber(offset, 'offset')
|
|
1282
|
+
const first = this[offset]
|
|
1283
|
+
const last = this[offset + 7]
|
|
1284
|
+
if (first === undefined || last === undefined) {
|
|
1285
|
+
boundsError(offset, this.length - 8)
|
|
1286
|
+
}
|
|
1247
1287
|
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1288
|
+
const hi = first * 2 ** 24 +
|
|
1289
|
+
this[++offset] * 2 ** 16 +
|
|
1290
|
+
this[++offset] * 2 ** 8 +
|
|
1291
|
+
this[++offset]
|
|
1251
1292
|
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1293
|
+
const lo = this[++offset] * 2 ** 24 +
|
|
1294
|
+
this[++offset] * 2 ** 16 +
|
|
1295
|
+
this[++offset] * 2 ** 8 +
|
|
1296
|
+
last
|
|
1255
1297
|
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
if (offset === undefined) {
|
|
1259
|
-
encoding = 'utf8'
|
|
1260
|
-
length = this.length
|
|
1261
|
-
offset = 0
|
|
1262
|
-
// Buffer#write(string, encoding)
|
|
1263
|
-
} else if (length === undefined && typeof offset === 'string') {
|
|
1264
|
-
encoding = offset
|
|
1265
|
-
length = this.length
|
|
1266
|
-
offset = 0
|
|
1267
|
-
// Buffer#write(string, offset[, length][, encoding])
|
|
1268
|
-
} else if (isFinite(offset)) {
|
|
1269
|
-
offset = offset >>> 0
|
|
1270
|
-
if (isFinite(length)) {
|
|
1271
|
-
length = length >>> 0
|
|
1272
|
-
if (encoding === undefined) encoding = 'utf8'
|
|
1273
|
-
} else {
|
|
1274
|
-
encoding = length
|
|
1275
|
-
length = undefined
|
|
1276
|
-
}
|
|
1277
|
-
} else {
|
|
1278
|
-
throw new Error(
|
|
1279
|
-
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
|
1280
|
-
)
|
|
1281
|
-
}
|
|
1298
|
+
return (BigInt(hi) << BigInt(32)) + BigInt(lo)
|
|
1299
|
+
})
|
|
1282
1300
|
|
|
1283
|
-
|
|
1284
|
-
|
|
1301
|
+
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
|
1302
|
+
offset = offset >>> 0
|
|
1303
|
+
byteLength = byteLength >>> 0
|
|
1304
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
1285
1305
|
|
|
1286
|
-
|
|
1287
|
-
|
|
1306
|
+
let val = this[offset]
|
|
1307
|
+
let mul = 1
|
|
1308
|
+
let i = 0
|
|
1309
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
1310
|
+
val += this[offset + i] * mul
|
|
1288
1311
|
}
|
|
1312
|
+
mul *= 0x80
|
|
1289
1313
|
|
|
1290
|
-
if (
|
|
1314
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
|
1291
1315
|
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
switch (encoding) {
|
|
1295
|
-
case 'hex':
|
|
1296
|
-
return hexWrite(this, string, offset, length)
|
|
1316
|
+
return val
|
|
1317
|
+
}
|
|
1297
1318
|
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1319
|
+
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
|
1320
|
+
offset = offset >>> 0
|
|
1321
|
+
byteLength = byteLength >>> 0
|
|
1322
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
1301
1323
|
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1324
|
+
let i = byteLength
|
|
1325
|
+
let mul = 1
|
|
1326
|
+
let val = this[offset + --i]
|
|
1327
|
+
while (i > 0 && (mul *= 0x100)) {
|
|
1328
|
+
val += this[offset + --i] * mul
|
|
1329
|
+
}
|
|
1330
|
+
mul *= 0x80
|
|
1306
1331
|
|
|
1307
|
-
|
|
1308
|
-
// Warning: maxLength not taken into account in base64Write
|
|
1309
|
-
return base64Write(this, string, offset, length)
|
|
1332
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
|
1310
1333
|
|
|
1311
|
-
|
|
1312
|
-
case 'ucs-2':
|
|
1313
|
-
case 'utf16le':
|
|
1314
|
-
case 'utf-16le':
|
|
1315
|
-
return ucs2Write(this, string, offset, length)
|
|
1316
|
-
|
|
1317
|
-
default:
|
|
1318
|
-
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
1319
|
-
encoding = ('' + encoding).toLowerCase()
|
|
1320
|
-
loweredCase = true
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1334
|
+
return val
|
|
1323
1335
|
}
|
|
1324
1336
|
|
|
1325
|
-
Buffer.prototype.
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1337
|
+
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
|
1338
|
+
offset = offset >>> 0
|
|
1339
|
+
if (!noAssert) checkOffset(offset, 1, this.length)
|
|
1340
|
+
if (!(this[offset] & 0x80)) return (this[offset])
|
|
1341
|
+
return ((0xff - this[offset] + 1) * -1)
|
|
1330
1342
|
}
|
|
1331
1343
|
|
|
1332
|
-
function
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
}
|
|
1344
|
+
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
|
1345
|
+
offset = offset >>> 0
|
|
1346
|
+
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
1347
|
+
const val = this[offset] | (this[offset + 1] << 8)
|
|
1348
|
+
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
1338
1349
|
}
|
|
1339
1350
|
|
|
1340
|
-
function
|
|
1341
|
-
|
|
1342
|
-
|
|
1351
|
+
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
|
1352
|
+
offset = offset >>> 0
|
|
1353
|
+
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
1354
|
+
const val = this[offset + 1] | (this[offset] << 8)
|
|
1355
|
+
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
1356
|
+
}
|
|
1343
1357
|
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
let codePoint = null
|
|
1348
|
-
let bytesPerSequence = (firstByte > 0xEF)
|
|
1349
|
-
? 4
|
|
1350
|
-
: (firstByte > 0xDF)
|
|
1351
|
-
? 3
|
|
1352
|
-
: (firstByte > 0xBF)
|
|
1353
|
-
? 2
|
|
1354
|
-
: 1
|
|
1358
|
+
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
|
1359
|
+
offset = offset >>> 0
|
|
1360
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
1355
1361
|
|
|
1356
|
-
|
|
1357
|
-
|
|
1362
|
+
return (this[offset]) |
|
|
1363
|
+
(this[offset + 1] << 8) |
|
|
1364
|
+
(this[offset + 2] << 16) |
|
|
1365
|
+
(this[offset + 3] << 24)
|
|
1366
|
+
}
|
|
1358
1367
|
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
codePoint = firstByte
|
|
1363
|
-
}
|
|
1364
|
-
break
|
|
1365
|
-
case 2:
|
|
1366
|
-
secondByte = buf[i + 1]
|
|
1367
|
-
if ((secondByte & 0xC0) === 0x80) {
|
|
1368
|
-
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
|
|
1369
|
-
if (tempCodePoint > 0x7F) {
|
|
1370
|
-
codePoint = tempCodePoint
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
break
|
|
1374
|
-
case 3:
|
|
1375
|
-
secondByte = buf[i + 1]
|
|
1376
|
-
thirdByte = buf[i + 2]
|
|
1377
|
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
|
1378
|
-
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
|
|
1379
|
-
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
|
1380
|
-
codePoint = tempCodePoint
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
break
|
|
1384
|
-
case 4:
|
|
1385
|
-
secondByte = buf[i + 1]
|
|
1386
|
-
thirdByte = buf[i + 2]
|
|
1387
|
-
fourthByte = buf[i + 3]
|
|
1388
|
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
|
1389
|
-
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
|
|
1390
|
-
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
|
1391
|
-
codePoint = tempCodePoint
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
|
-
}
|
|
1368
|
+
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
|
1369
|
+
offset = offset >>> 0
|
|
1370
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
1396
1371
|
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
} else if (codePoint > 0xFFFF) {
|
|
1403
|
-
// encode to utf16 (surrogate pair dance)
|
|
1404
|
-
codePoint -= 0x10000
|
|
1405
|
-
res.push(codePoint >>> 10 & 0x3FF | 0xD800)
|
|
1406
|
-
codePoint = 0xDC00 | codePoint & 0x3FF
|
|
1407
|
-
}
|
|
1372
|
+
return (this[offset] << 24) |
|
|
1373
|
+
(this[offset + 1] << 16) |
|
|
1374
|
+
(this[offset + 2] << 8) |
|
|
1375
|
+
(this[offset + 3])
|
|
1376
|
+
}
|
|
1408
1377
|
|
|
1409
|
-
|
|
1410
|
-
|
|
1378
|
+
Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {
|
|
1379
|
+
offset = offset >>> 0
|
|
1380
|
+
validateNumber(offset, 'offset')
|
|
1381
|
+
const first = this[offset]
|
|
1382
|
+
const last = this[offset + 7]
|
|
1383
|
+
if (first === undefined || last === undefined) {
|
|
1384
|
+
boundsError(offset, this.length - 8)
|
|
1411
1385
|
}
|
|
1412
1386
|
|
|
1413
|
-
|
|
1414
|
-
|
|
1387
|
+
const val = this[offset + 4] +
|
|
1388
|
+
this[offset + 5] * 2 ** 8 +
|
|
1389
|
+
this[offset + 6] * 2 ** 16 +
|
|
1390
|
+
(last << 24) // Overflow
|
|
1415
1391
|
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1392
|
+
return (BigInt(val) << BigInt(32)) +
|
|
1393
|
+
BigInt(first +
|
|
1394
|
+
this[++offset] * 2 ** 8 +
|
|
1395
|
+
this[++offset] * 2 ** 16 +
|
|
1396
|
+
this[++offset] * 2 ** 24)
|
|
1397
|
+
})
|
|
1420
1398
|
|
|
1421
|
-
function
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1399
|
+
Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {
|
|
1400
|
+
offset = offset >>> 0
|
|
1401
|
+
validateNumber(offset, 'offset')
|
|
1402
|
+
const first = this[offset]
|
|
1403
|
+
const last = this[offset + 7]
|
|
1404
|
+
if (first === undefined || last === undefined) {
|
|
1405
|
+
boundsError(offset, this.length - 8)
|
|
1425
1406
|
}
|
|
1426
1407
|
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
res += String.fromCharCode.apply(
|
|
1432
|
-
String,
|
|
1433
|
-
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
1434
|
-
)
|
|
1435
|
-
}
|
|
1436
|
-
return res
|
|
1437
|
-
}
|
|
1408
|
+
const val = (first << 24) + // Overflow
|
|
1409
|
+
this[++offset] * 2 ** 16 +
|
|
1410
|
+
this[++offset] * 2 ** 8 +
|
|
1411
|
+
this[++offset]
|
|
1438
1412
|
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1413
|
+
return (BigInt(val) << BigInt(32)) +
|
|
1414
|
+
BigInt(this[++offset] * 2 ** 24 +
|
|
1415
|
+
this[++offset] * 2 ** 16 +
|
|
1416
|
+
this[++offset] * 2 ** 8 +
|
|
1417
|
+
last)
|
|
1418
|
+
})
|
|
1442
1419
|
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
return
|
|
1420
|
+
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
|
1421
|
+
offset = offset >>> 0
|
|
1422
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
1423
|
+
return ieee754.read(this, offset, true, 23, 4)
|
|
1447
1424
|
}
|
|
1448
1425
|
|
|
1449
|
-
function
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
for (let i = start; i < end; ++i) {
|
|
1454
|
-
ret += String.fromCharCode(buf[i])
|
|
1455
|
-
}
|
|
1456
|
-
return ret
|
|
1426
|
+
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
|
1427
|
+
offset = offset >>> 0
|
|
1428
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
1429
|
+
return ieee754.read(this, offset, false, 23, 4)
|
|
1457
1430
|
}
|
|
1458
1431
|
|
|
1459
|
-
function
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
if (!end || end < 0 || end > len) end = len
|
|
1464
|
-
|
|
1465
|
-
let out = ''
|
|
1466
|
-
for (let i = start; i < end; ++i) {
|
|
1467
|
-
out += hexSliceLookupTable[buf[i]]
|
|
1468
|
-
}
|
|
1469
|
-
return out
|
|
1432
|
+
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
|
1433
|
+
offset = offset >>> 0
|
|
1434
|
+
if (!noAssert) checkOffset(offset, 8, this.length)
|
|
1435
|
+
return ieee754.read(this, offset, true, 52, 8)
|
|
1470
1436
|
}
|
|
1471
1437
|
|
|
1472
|
-
function
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
for (let i = 0; i < bytes.length - 1; i += 2) {
|
|
1477
|
-
res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
|
|
1478
|
-
}
|
|
1479
|
-
return res
|
|
1438
|
+
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
|
1439
|
+
offset = offset >>> 0
|
|
1440
|
+
if (!noAssert) checkOffset(offset, 8, this.length)
|
|
1441
|
+
return ieee754.read(this, offset, false, 52, 8)
|
|
1480
1442
|
}
|
|
1481
1443
|
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1444
|
+
function checkInt (buf, value, offset, ext, max, min) {
|
|
1445
|
+
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
|
1446
|
+
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
|
1447
|
+
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
1448
|
+
}
|
|
1486
1449
|
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1450
|
+
Buffer.prototype.writeUintLE =
|
|
1451
|
+
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
|
1452
|
+
value = +value
|
|
1453
|
+
offset = offset >>> 0
|
|
1454
|
+
byteLength = byteLength >>> 0
|
|
1455
|
+
if (!noAssert) {
|
|
1456
|
+
const maxBytes = Math.pow(2, 8 * byteLength) - 1
|
|
1457
|
+
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
|
1492
1458
|
}
|
|
1493
1459
|
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1460
|
+
let mul = 1
|
|
1461
|
+
let i = 0
|
|
1462
|
+
this[offset] = value & 0xFF
|
|
1463
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
1464
|
+
this[offset + i] = (value / mul) & 0xFF
|
|
1499
1465
|
}
|
|
1500
1466
|
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
const newBuf = this.subarray(start, end)
|
|
1504
|
-
// Return an augmented `Uint8Array` instance
|
|
1505
|
-
Object.setPrototypeOf(newBuf, Buffer.prototype)
|
|
1506
|
-
|
|
1507
|
-
return newBuf
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
|
-
/*
|
|
1511
|
-
* Need to make sure that buffer isn't trying to write out of bounds.
|
|
1512
|
-
*/
|
|
1513
|
-
function checkOffset (offset, ext, length) {
|
|
1514
|
-
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
|
1515
|
-
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
Buffer.prototype.readUintLE =
|
|
1519
|
-
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
|
1520
|
-
offset = offset >>> 0
|
|
1521
|
-
byteLength = byteLength >>> 0
|
|
1522
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
1523
|
-
|
|
1524
|
-
let val = this[offset]
|
|
1525
|
-
let mul = 1
|
|
1526
|
-
let i = 0
|
|
1527
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
1528
|
-
val += this[offset + i] * mul
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
return val
|
|
1467
|
+
return offset + byteLength
|
|
1532
1468
|
}
|
|
1533
1469
|
|
|
1534
|
-
Buffer.prototype.
|
|
1535
|
-
Buffer.prototype.
|
|
1470
|
+
Buffer.prototype.writeUintBE =
|
|
1471
|
+
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
|
1472
|
+
value = +value
|
|
1536
1473
|
offset = offset >>> 0
|
|
1537
1474
|
byteLength = byteLength >>> 0
|
|
1538
1475
|
if (!noAssert) {
|
|
1539
|
-
|
|
1476
|
+
const maxBytes = Math.pow(2, 8 * byteLength) - 1
|
|
1477
|
+
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
|
1540
1478
|
}
|
|
1541
1479
|
|
|
1542
|
-
let
|
|
1480
|
+
let i = byteLength - 1
|
|
1543
1481
|
let mul = 1
|
|
1544
|
-
|
|
1545
|
-
|
|
1482
|
+
this[offset + i] = value & 0xFF
|
|
1483
|
+
while (--i >= 0 && (mul *= 0x100)) {
|
|
1484
|
+
this[offset + i] = (value / mul) & 0xFF
|
|
1546
1485
|
}
|
|
1547
1486
|
|
|
1548
|
-
return
|
|
1487
|
+
return offset + byteLength
|
|
1549
1488
|
}
|
|
1550
1489
|
|
|
1551
|
-
Buffer.prototype.
|
|
1552
|
-
Buffer.prototype.
|
|
1490
|
+
Buffer.prototype.writeUint8 =
|
|
1491
|
+
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
|
1492
|
+
value = +value
|
|
1553
1493
|
offset = offset >>> 0
|
|
1554
|
-
if (!noAssert)
|
|
1555
|
-
|
|
1494
|
+
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
|
|
1495
|
+
this[offset] = (value & 0xff)
|
|
1496
|
+
return offset + 1
|
|
1556
1497
|
}
|
|
1557
1498
|
|
|
1558
|
-
Buffer.prototype.
|
|
1559
|
-
Buffer.prototype.
|
|
1499
|
+
Buffer.prototype.writeUint16LE =
|
|
1500
|
+
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
|
1501
|
+
value = +value
|
|
1560
1502
|
offset = offset >>> 0
|
|
1561
|
-
if (!noAssert)
|
|
1562
|
-
|
|
1503
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
|
1504
|
+
this[offset] = (value & 0xff)
|
|
1505
|
+
this[offset + 1] = (value >>> 8)
|
|
1506
|
+
return offset + 2
|
|
1563
1507
|
}
|
|
1564
1508
|
|
|
1565
|
-
Buffer.prototype.
|
|
1566
|
-
Buffer.prototype.
|
|
1509
|
+
Buffer.prototype.writeUint16BE =
|
|
1510
|
+
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
|
1511
|
+
value = +value
|
|
1567
1512
|
offset = offset >>> 0
|
|
1568
|
-
if (!noAssert)
|
|
1569
|
-
|
|
1513
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
|
1514
|
+
this[offset] = (value >>> 8)
|
|
1515
|
+
this[offset + 1] = (value & 0xff)
|
|
1516
|
+
return offset + 2
|
|
1570
1517
|
}
|
|
1571
1518
|
|
|
1572
|
-
Buffer.prototype.
|
|
1573
|
-
Buffer.prototype.
|
|
1519
|
+
Buffer.prototype.writeUint32LE =
|
|
1520
|
+
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
|
1521
|
+
value = +value
|
|
1574
1522
|
offset = offset >>> 0
|
|
1575
|
-
if (!noAssert)
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1523
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
|
1524
|
+
this[offset + 3] = (value >>> 24)
|
|
1525
|
+
this[offset + 2] = (value >>> 16)
|
|
1526
|
+
this[offset + 1] = (value >>> 8)
|
|
1527
|
+
this[offset] = (value & 0xff)
|
|
1528
|
+
return offset + 4
|
|
1581
1529
|
}
|
|
1582
1530
|
|
|
1583
|
-
Buffer.prototype.
|
|
1584
|
-
Buffer.prototype.
|
|
1531
|
+
Buffer.prototype.writeUint32BE =
|
|
1532
|
+
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
|
1533
|
+
value = +value
|
|
1585
1534
|
offset = offset >>> 0
|
|
1586
|
-
if (!noAssert)
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1535
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
|
1536
|
+
this[offset] = (value >>> 24)
|
|
1537
|
+
this[offset + 1] = (value >>> 16)
|
|
1538
|
+
this[offset + 2] = (value >>> 8)
|
|
1539
|
+
this[offset + 3] = (value & 0xff)
|
|
1540
|
+
return offset + 4
|
|
1592
1541
|
}
|
|
1593
1542
|
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
validateNumber(offset, 'offset')
|
|
1597
|
-
const first = this[offset]
|
|
1598
|
-
const last = this[offset + 7]
|
|
1599
|
-
if (first === undefined || last === undefined) {
|
|
1600
|
-
boundsError(offset, this.length - 8)
|
|
1601
|
-
}
|
|
1602
|
-
|
|
1603
|
-
const lo = first +
|
|
1604
|
-
this[++offset] * 2 ** 8 +
|
|
1605
|
-
this[++offset] * 2 ** 16 +
|
|
1606
|
-
this[++offset] * 2 ** 24
|
|
1607
|
-
|
|
1608
|
-
const hi = this[++offset] +
|
|
1609
|
-
this[++offset] * 2 ** 8 +
|
|
1610
|
-
this[++offset] * 2 ** 16 +
|
|
1611
|
-
last * 2 ** 24
|
|
1543
|
+
function wrtBigUInt64LE (buf, value, offset, min, max) {
|
|
1544
|
+
checkIntBI(value, min, max, buf, offset, 7)
|
|
1612
1545
|
|
|
1613
|
-
|
|
1614
|
-
|
|
1546
|
+
let lo = Number(value & BigInt(0xffffffff))
|
|
1547
|
+
buf[offset++] = lo
|
|
1548
|
+
lo = lo >> 8
|
|
1549
|
+
buf[offset++] = lo
|
|
1550
|
+
lo = lo >> 8
|
|
1551
|
+
buf[offset++] = lo
|
|
1552
|
+
lo = lo >> 8
|
|
1553
|
+
buf[offset++] = lo
|
|
1554
|
+
let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
|
|
1555
|
+
buf[offset++] = hi
|
|
1556
|
+
hi = hi >> 8
|
|
1557
|
+
buf[offset++] = hi
|
|
1558
|
+
hi = hi >> 8
|
|
1559
|
+
buf[offset++] = hi
|
|
1560
|
+
hi = hi >> 8
|
|
1561
|
+
buf[offset++] = hi
|
|
1562
|
+
return offset
|
|
1563
|
+
}
|
|
1615
1564
|
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
validateNumber(offset, 'offset')
|
|
1619
|
-
const first = this[offset]
|
|
1620
|
-
const last = this[offset + 7]
|
|
1621
|
-
if (first === undefined || last === undefined) {
|
|
1622
|
-
boundsError(offset, this.length - 8)
|
|
1623
|
-
}
|
|
1565
|
+
function wrtBigUInt64BE (buf, value, offset, min, max) {
|
|
1566
|
+
checkIntBI(value, min, max, buf, offset, 7)
|
|
1624
1567
|
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1568
|
+
let lo = Number(value & BigInt(0xffffffff))
|
|
1569
|
+
buf[offset + 7] = lo
|
|
1570
|
+
lo = lo >> 8
|
|
1571
|
+
buf[offset + 6] = lo
|
|
1572
|
+
lo = lo >> 8
|
|
1573
|
+
buf[offset + 5] = lo
|
|
1574
|
+
lo = lo >> 8
|
|
1575
|
+
buf[offset + 4] = lo
|
|
1576
|
+
let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
|
|
1577
|
+
buf[offset + 3] = hi
|
|
1578
|
+
hi = hi >> 8
|
|
1579
|
+
buf[offset + 2] = hi
|
|
1580
|
+
hi = hi >> 8
|
|
1581
|
+
buf[offset + 1] = hi
|
|
1582
|
+
hi = hi >> 8
|
|
1583
|
+
buf[offset] = hi
|
|
1584
|
+
return offset + 8
|
|
1585
|
+
}
|
|
1629
1586
|
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
last
|
|
1587
|
+
Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {
|
|
1588
|
+
return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
|
|
1589
|
+
})
|
|
1634
1590
|
|
|
1635
|
-
|
|
1591
|
+
Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {
|
|
1592
|
+
return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
|
|
1636
1593
|
})
|
|
1637
1594
|
|
|
1638
|
-
Buffer.prototype.
|
|
1595
|
+
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
|
1596
|
+
value = +value
|
|
1639
1597
|
offset = offset >>> 0
|
|
1640
|
-
|
|
1641
|
-
|
|
1598
|
+
if (!noAssert) {
|
|
1599
|
+
const limit = Math.pow(2, (8 * byteLength) - 1)
|
|
1600
|
+
|
|
1601
|
+
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
|
1602
|
+
}
|
|
1642
1603
|
|
|
1643
|
-
let val = this[offset]
|
|
1644
|
-
let mul = 1
|
|
1645
1604
|
let i = 0
|
|
1605
|
+
let mul = 1
|
|
1606
|
+
let sub = 0
|
|
1607
|
+
this[offset] = value & 0xFF
|
|
1646
1608
|
while (++i < byteLength && (mul *= 0x100)) {
|
|
1647
|
-
|
|
1609
|
+
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
1610
|
+
sub = 1
|
|
1611
|
+
}
|
|
1612
|
+
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
|
1648
1613
|
}
|
|
1649
|
-
mul *= 0x80
|
|
1650
1614
|
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
return val
|
|
1615
|
+
return offset + byteLength
|
|
1654
1616
|
}
|
|
1655
1617
|
|
|
1656
|
-
Buffer.prototype.
|
|
1618
|
+
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
|
1619
|
+
value = +value
|
|
1657
1620
|
offset = offset >>> 0
|
|
1658
|
-
|
|
1659
|
-
|
|
1621
|
+
if (!noAssert) {
|
|
1622
|
+
const limit = Math.pow(2, (8 * byteLength) - 1)
|
|
1660
1623
|
|
|
1661
|
-
|
|
1662
|
-
let mul = 1
|
|
1663
|
-
let val = this[offset + --i]
|
|
1664
|
-
while (i > 0 && (mul *= 0x100)) {
|
|
1665
|
-
val += this[offset + --i] * mul
|
|
1624
|
+
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
|
1666
1625
|
}
|
|
1667
|
-
mul *= 0x80
|
|
1668
1626
|
|
|
1669
|
-
|
|
1627
|
+
let i = byteLength - 1
|
|
1628
|
+
let mul = 1
|
|
1629
|
+
let sub = 0
|
|
1630
|
+
this[offset + i] = value & 0xFF
|
|
1631
|
+
while (--i >= 0 && (mul *= 0x100)) {
|
|
1632
|
+
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
1633
|
+
sub = 1
|
|
1634
|
+
}
|
|
1635
|
+
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
|
1636
|
+
}
|
|
1670
1637
|
|
|
1671
|
-
return
|
|
1638
|
+
return offset + byteLength
|
|
1672
1639
|
}
|
|
1673
1640
|
|
|
1674
|
-
Buffer.prototype.
|
|
1641
|
+
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
|
1642
|
+
value = +value
|
|
1675
1643
|
offset = offset >>> 0
|
|
1676
|
-
if (!noAssert)
|
|
1677
|
-
if (
|
|
1678
|
-
return ((0xff - this[offset] + 1) * -1)
|
|
1679
|
-
}
|
|
1680
|
-
|
|
1681
|
-
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
|
1682
|
-
offset = offset >>> 0
|
|
1683
|
-
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
1684
|
-
const val = this[offset] | (this[offset + 1] << 8)
|
|
1685
|
-
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
1686
|
-
}
|
|
1687
|
-
|
|
1688
|
-
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
|
1689
|
-
offset = offset >>> 0
|
|
1690
|
-
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
1691
|
-
const val = this[offset + 1] | (this[offset] << 8)
|
|
1692
|
-
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
|
-
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
|
1696
|
-
offset = offset >>> 0
|
|
1697
|
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
1698
|
-
|
|
1699
|
-
return (this[offset]) |
|
|
1700
|
-
(this[offset + 1] << 8) |
|
|
1701
|
-
(this[offset + 2] << 16) |
|
|
1702
|
-
(this[offset + 3] << 24)
|
|
1703
|
-
}
|
|
1704
|
-
|
|
1705
|
-
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
|
1706
|
-
offset = offset >>> 0
|
|
1707
|
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
1708
|
-
|
|
1709
|
-
return (this[offset] << 24) |
|
|
1710
|
-
(this[offset + 1] << 16) |
|
|
1711
|
-
(this[offset + 2] << 8) |
|
|
1712
|
-
(this[offset + 3])
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {
|
|
1716
|
-
offset = offset >>> 0
|
|
1717
|
-
validateNumber(offset, 'offset')
|
|
1718
|
-
const first = this[offset]
|
|
1719
|
-
const last = this[offset + 7]
|
|
1720
|
-
if (first === undefined || last === undefined) {
|
|
1721
|
-
boundsError(offset, this.length - 8)
|
|
1722
|
-
}
|
|
1723
|
-
|
|
1724
|
-
const val = this[offset + 4] +
|
|
1725
|
-
this[offset + 5] * 2 ** 8 +
|
|
1726
|
-
this[offset + 6] * 2 ** 16 +
|
|
1727
|
-
(last << 24) // Overflow
|
|
1728
|
-
|
|
1729
|
-
return (BigInt(val) << BigInt(32)) +
|
|
1730
|
-
BigInt(first +
|
|
1731
|
-
this[++offset] * 2 ** 8 +
|
|
1732
|
-
this[++offset] * 2 ** 16 +
|
|
1733
|
-
this[++offset] * 2 ** 24)
|
|
1734
|
-
})
|
|
1735
|
-
|
|
1736
|
-
Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {
|
|
1737
|
-
offset = offset >>> 0
|
|
1738
|
-
validateNumber(offset, 'offset')
|
|
1739
|
-
const first = this[offset]
|
|
1740
|
-
const last = this[offset + 7]
|
|
1741
|
-
if (first === undefined || last === undefined) {
|
|
1742
|
-
boundsError(offset, this.length - 8)
|
|
1743
|
-
}
|
|
1744
|
-
|
|
1745
|
-
const val = (first << 24) + // Overflow
|
|
1746
|
-
this[++offset] * 2 ** 16 +
|
|
1747
|
-
this[++offset] * 2 ** 8 +
|
|
1748
|
-
this[++offset]
|
|
1749
|
-
|
|
1750
|
-
return (BigInt(val) << BigInt(32)) +
|
|
1751
|
-
BigInt(this[++offset] * 2 ** 24 +
|
|
1752
|
-
this[++offset] * 2 ** 16 +
|
|
1753
|
-
this[++offset] * 2 ** 8 +
|
|
1754
|
-
last)
|
|
1755
|
-
})
|
|
1756
|
-
|
|
1757
|
-
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
|
1758
|
-
offset = offset >>> 0
|
|
1759
|
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
1760
|
-
return ieee754.read(this, offset, true, 23, 4)
|
|
1761
|
-
}
|
|
1762
|
-
|
|
1763
|
-
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
|
1764
|
-
offset = offset >>> 0
|
|
1765
|
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
1766
|
-
return ieee754.read(this, offset, false, 23, 4)
|
|
1767
|
-
}
|
|
1768
|
-
|
|
1769
|
-
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
|
1770
|
-
offset = offset >>> 0
|
|
1771
|
-
if (!noAssert) checkOffset(offset, 8, this.length)
|
|
1772
|
-
return ieee754.read(this, offset, true, 52, 8)
|
|
1773
|
-
}
|
|
1774
|
-
|
|
1775
|
-
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
|
1776
|
-
offset = offset >>> 0
|
|
1777
|
-
if (!noAssert) checkOffset(offset, 8, this.length)
|
|
1778
|
-
return ieee754.read(this, offset, false, 52, 8)
|
|
1779
|
-
}
|
|
1780
|
-
|
|
1781
|
-
function checkInt (buf, value, offset, ext, max, min) {
|
|
1782
|
-
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
|
1783
|
-
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
|
1784
|
-
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
1785
|
-
}
|
|
1786
|
-
|
|
1787
|
-
Buffer.prototype.writeUintLE =
|
|
1788
|
-
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
|
1789
|
-
value = +value
|
|
1790
|
-
offset = offset >>> 0
|
|
1791
|
-
byteLength = byteLength >>> 0
|
|
1792
|
-
if (!noAssert) {
|
|
1793
|
-
const maxBytes = Math.pow(2, 8 * byteLength) - 1
|
|
1794
|
-
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1797
|
-
let mul = 1
|
|
1798
|
-
let i = 0
|
|
1799
|
-
this[offset] = value & 0xFF
|
|
1800
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
1801
|
-
this[offset + i] = (value / mul) & 0xFF
|
|
1802
|
-
}
|
|
1803
|
-
|
|
1804
|
-
return offset + byteLength
|
|
1805
|
-
}
|
|
1806
|
-
|
|
1807
|
-
Buffer.prototype.writeUintBE =
|
|
1808
|
-
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
|
1809
|
-
value = +value
|
|
1810
|
-
offset = offset >>> 0
|
|
1811
|
-
byteLength = byteLength >>> 0
|
|
1812
|
-
if (!noAssert) {
|
|
1813
|
-
const maxBytes = Math.pow(2, 8 * byteLength) - 1
|
|
1814
|
-
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
|
1815
|
-
}
|
|
1816
|
-
|
|
1817
|
-
let i = byteLength - 1
|
|
1818
|
-
let mul = 1
|
|
1819
|
-
this[offset + i] = value & 0xFF
|
|
1820
|
-
while (--i >= 0 && (mul *= 0x100)) {
|
|
1821
|
-
this[offset + i] = (value / mul) & 0xFF
|
|
1822
|
-
}
|
|
1823
|
-
|
|
1824
|
-
return offset + byteLength
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
|
-
Buffer.prototype.writeUint8 =
|
|
1828
|
-
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
|
1829
|
-
value = +value
|
|
1830
|
-
offset = offset >>> 0
|
|
1831
|
-
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
|
|
1644
|
+
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
|
|
1645
|
+
if (value < 0) value = 0xff + value + 1
|
|
1832
1646
|
this[offset] = (value & 0xff)
|
|
1833
1647
|
return offset + 1
|
|
1834
1648
|
}
|
|
1835
1649
|
|
|
1836
|
-
Buffer.prototype.
|
|
1837
|
-
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
|
1650
|
+
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
|
1838
1651
|
value = +value
|
|
1839
1652
|
offset = offset >>> 0
|
|
1840
|
-
if (!noAssert) checkInt(this, value, offset, 2,
|
|
1653
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
|
1841
1654
|
this[offset] = (value & 0xff)
|
|
1842
1655
|
this[offset + 1] = (value >>> 8)
|
|
1843
1656
|
return offset + 2
|
|
1844
1657
|
}
|
|
1845
1658
|
|
|
1846
|
-
Buffer.prototype.
|
|
1847
|
-
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
|
1659
|
+
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
|
1848
1660
|
value = +value
|
|
1849
1661
|
offset = offset >>> 0
|
|
1850
|
-
if (!noAssert) checkInt(this, value, offset, 2,
|
|
1662
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
|
1851
1663
|
this[offset] = (value >>> 8)
|
|
1852
1664
|
this[offset + 1] = (value & 0xff)
|
|
1853
1665
|
return offset + 2
|
|
1854
1666
|
}
|
|
1855
1667
|
|
|
1856
|
-
Buffer.prototype.
|
|
1857
|
-
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
|
1668
|
+
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
|
1858
1669
|
value = +value
|
|
1859
1670
|
offset = offset >>> 0
|
|
1860
|
-
if (!noAssert) checkInt(this, value, offset, 4,
|
|
1861
|
-
this[offset + 3] = (value >>> 24)
|
|
1862
|
-
this[offset + 2] = (value >>> 16)
|
|
1863
|
-
this[offset + 1] = (value >>> 8)
|
|
1671
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
|
1864
1672
|
this[offset] = (value & 0xff)
|
|
1673
|
+
this[offset + 1] = (value >>> 8)
|
|
1674
|
+
this[offset + 2] = (value >>> 16)
|
|
1675
|
+
this[offset + 3] = (value >>> 24)
|
|
1865
1676
|
return offset + 4
|
|
1866
1677
|
}
|
|
1867
1678
|
|
|
1868
|
-
Buffer.prototype.
|
|
1869
|
-
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
|
1679
|
+
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
|
1870
1680
|
value = +value
|
|
1871
1681
|
offset = offset >>> 0
|
|
1872
|
-
if (!noAssert) checkInt(this, value, offset, 4,
|
|
1682
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
|
1683
|
+
if (value < 0) value = 0xffffffff + value + 1
|
|
1873
1684
|
this[offset] = (value >>> 24)
|
|
1874
1685
|
this[offset + 1] = (value >>> 16)
|
|
1875
1686
|
this[offset + 2] = (value >>> 8)
|
|
@@ -1877,190 +1688,42 @@ Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert
|
|
|
1877
1688
|
return offset + 4
|
|
1878
1689
|
}
|
|
1879
1690
|
|
|
1880
|
-
function
|
|
1881
|
-
|
|
1691
|
+
Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {
|
|
1692
|
+
return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
|
|
1693
|
+
})
|
|
1882
1694
|
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
buf[offset++] = lo
|
|
1887
|
-
lo = lo >> 8
|
|
1888
|
-
buf[offset++] = lo
|
|
1889
|
-
lo = lo >> 8
|
|
1890
|
-
buf[offset++] = lo
|
|
1891
|
-
let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
|
|
1892
|
-
buf[offset++] = hi
|
|
1893
|
-
hi = hi >> 8
|
|
1894
|
-
buf[offset++] = hi
|
|
1895
|
-
hi = hi >> 8
|
|
1896
|
-
buf[offset++] = hi
|
|
1897
|
-
hi = hi >> 8
|
|
1898
|
-
buf[offset++] = hi
|
|
1899
|
-
return offset
|
|
1900
|
-
}
|
|
1695
|
+
Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {
|
|
1696
|
+
return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
|
|
1697
|
+
})
|
|
1901
1698
|
|
|
1902
|
-
function
|
|
1903
|
-
|
|
1699
|
+
function checkIEEE754 (buf, value, offset, ext, max, min) {
|
|
1700
|
+
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
1701
|
+
if (offset < 0) throw new RangeError('Index out of range')
|
|
1702
|
+
}
|
|
1904
1703
|
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
|
|
1914
|
-
buf[offset + 3] = hi
|
|
1915
|
-
hi = hi >> 8
|
|
1916
|
-
buf[offset + 2] = hi
|
|
1917
|
-
hi = hi >> 8
|
|
1918
|
-
buf[offset + 1] = hi
|
|
1919
|
-
hi = hi >> 8
|
|
1920
|
-
buf[offset] = hi
|
|
1921
|
-
return offset + 8
|
|
1704
|
+
function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
|
1705
|
+
value = +value
|
|
1706
|
+
offset = offset >>> 0
|
|
1707
|
+
if (!noAssert) {
|
|
1708
|
+
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
|
|
1709
|
+
}
|
|
1710
|
+
ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
|
1711
|
+
return offset + 4
|
|
1922
1712
|
}
|
|
1923
1713
|
|
|
1924
|
-
Buffer.prototype.
|
|
1925
|
-
return
|
|
1926
|
-
}
|
|
1714
|
+
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
|
1715
|
+
return writeFloat(this, value, offset, true, noAssert)
|
|
1716
|
+
}
|
|
1927
1717
|
|
|
1928
|
-
Buffer.prototype.
|
|
1929
|
-
return
|
|
1930
|
-
}
|
|
1718
|
+
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
|
1719
|
+
return writeFloat(this, value, offset, false, noAssert)
|
|
1720
|
+
}
|
|
1931
1721
|
|
|
1932
|
-
|
|
1722
|
+
function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
|
1933
1723
|
value = +value
|
|
1934
1724
|
offset = offset >>> 0
|
|
1935
1725
|
if (!noAssert) {
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
|
1939
|
-
}
|
|
1940
|
-
|
|
1941
|
-
let i = 0
|
|
1942
|
-
let mul = 1
|
|
1943
|
-
let sub = 0
|
|
1944
|
-
this[offset] = value & 0xFF
|
|
1945
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
1946
|
-
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
1947
|
-
sub = 1
|
|
1948
|
-
}
|
|
1949
|
-
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
|
1950
|
-
}
|
|
1951
|
-
|
|
1952
|
-
return offset + byteLength
|
|
1953
|
-
}
|
|
1954
|
-
|
|
1955
|
-
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
|
1956
|
-
value = +value
|
|
1957
|
-
offset = offset >>> 0
|
|
1958
|
-
if (!noAssert) {
|
|
1959
|
-
const limit = Math.pow(2, (8 * byteLength) - 1)
|
|
1960
|
-
|
|
1961
|
-
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
|
1962
|
-
}
|
|
1963
|
-
|
|
1964
|
-
let i = byteLength - 1
|
|
1965
|
-
let mul = 1
|
|
1966
|
-
let sub = 0
|
|
1967
|
-
this[offset + i] = value & 0xFF
|
|
1968
|
-
while (--i >= 0 && (mul *= 0x100)) {
|
|
1969
|
-
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
1970
|
-
sub = 1
|
|
1971
|
-
}
|
|
1972
|
-
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
|
-
return offset + byteLength
|
|
1976
|
-
}
|
|
1977
|
-
|
|
1978
|
-
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
|
1979
|
-
value = +value
|
|
1980
|
-
offset = offset >>> 0
|
|
1981
|
-
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
|
|
1982
|
-
if (value < 0) value = 0xff + value + 1
|
|
1983
|
-
this[offset] = (value & 0xff)
|
|
1984
|
-
return offset + 1
|
|
1985
|
-
}
|
|
1986
|
-
|
|
1987
|
-
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
|
1988
|
-
value = +value
|
|
1989
|
-
offset = offset >>> 0
|
|
1990
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
|
1991
|
-
this[offset] = (value & 0xff)
|
|
1992
|
-
this[offset + 1] = (value >>> 8)
|
|
1993
|
-
return offset + 2
|
|
1994
|
-
}
|
|
1995
|
-
|
|
1996
|
-
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
|
1997
|
-
value = +value
|
|
1998
|
-
offset = offset >>> 0
|
|
1999
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
|
2000
|
-
this[offset] = (value >>> 8)
|
|
2001
|
-
this[offset + 1] = (value & 0xff)
|
|
2002
|
-
return offset + 2
|
|
2003
|
-
}
|
|
2004
|
-
|
|
2005
|
-
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
|
2006
|
-
value = +value
|
|
2007
|
-
offset = offset >>> 0
|
|
2008
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
|
2009
|
-
this[offset] = (value & 0xff)
|
|
2010
|
-
this[offset + 1] = (value >>> 8)
|
|
2011
|
-
this[offset + 2] = (value >>> 16)
|
|
2012
|
-
this[offset + 3] = (value >>> 24)
|
|
2013
|
-
return offset + 4
|
|
2014
|
-
}
|
|
2015
|
-
|
|
2016
|
-
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
|
2017
|
-
value = +value
|
|
2018
|
-
offset = offset >>> 0
|
|
2019
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
|
2020
|
-
if (value < 0) value = 0xffffffff + value + 1
|
|
2021
|
-
this[offset] = (value >>> 24)
|
|
2022
|
-
this[offset + 1] = (value >>> 16)
|
|
2023
|
-
this[offset + 2] = (value >>> 8)
|
|
2024
|
-
this[offset + 3] = (value & 0xff)
|
|
2025
|
-
return offset + 4
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {
|
|
2029
|
-
return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
|
|
2030
|
-
})
|
|
2031
|
-
|
|
2032
|
-
Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {
|
|
2033
|
-
return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
|
|
2034
|
-
})
|
|
2035
|
-
|
|
2036
|
-
function checkIEEE754 (buf, value, offset, ext, max, min) {
|
|
2037
|
-
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
2038
|
-
if (offset < 0) throw new RangeError('Index out of range')
|
|
2039
|
-
}
|
|
2040
|
-
|
|
2041
|
-
function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
|
2042
|
-
value = +value
|
|
2043
|
-
offset = offset >>> 0
|
|
2044
|
-
if (!noAssert) {
|
|
2045
|
-
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
|
|
2046
|
-
}
|
|
2047
|
-
ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
|
2048
|
-
return offset + 4
|
|
2049
|
-
}
|
|
2050
|
-
|
|
2051
|
-
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
|
2052
|
-
return writeFloat(this, value, offset, true, noAssert)
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
|
2056
|
-
return writeFloat(this, value, offset, false, noAssert)
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
|
-
function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
|
2060
|
-
value = +value
|
|
2061
|
-
offset = offset >>> 0
|
|
2062
|
-
if (!noAssert) {
|
|
2063
|
-
checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
|
|
1726
|
+
checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
|
|
2064
1727
|
}
|
|
2065
1728
|
ieee754.write(buf, value, offset, littleEndian, 52, 8)
|
|
2066
1729
|
return offset + 8
|
|
@@ -2444,54 +2107,332 @@ function utf16leToBytes (str, units) {
|
|
|
2444
2107
|
return byteArray
|
|
2445
2108
|
}
|
|
2446
2109
|
|
|
2447
|
-
function base64ToBytes (str) {
|
|
2448
|
-
return base64.toByteArray(base64clean(str))
|
|
2449
|
-
}
|
|
2110
|
+
function base64ToBytes (str) {
|
|
2111
|
+
return base64.toByteArray(base64clean(str))
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2114
|
+
function blitBuffer (src, dst, offset, length) {
|
|
2115
|
+
let i
|
|
2116
|
+
for (i = 0; i < length; ++i) {
|
|
2117
|
+
if ((i + offset >= dst.length) || (i >= src.length)) break
|
|
2118
|
+
dst[i + offset] = src[i]
|
|
2119
|
+
}
|
|
2120
|
+
return i
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
|
|
2124
|
+
// the `instanceof` check but they should be treated as of that type.
|
|
2125
|
+
// See: https://github.com/feross/buffer/issues/166
|
|
2126
|
+
function isInstance (obj, type) {
|
|
2127
|
+
return obj instanceof type ||
|
|
2128
|
+
(obj != null && obj.constructor != null && obj.constructor.name != null &&
|
|
2129
|
+
obj.constructor.name === type.name)
|
|
2130
|
+
}
|
|
2131
|
+
function numberIsNaN (obj) {
|
|
2132
|
+
// For IE11 support
|
|
2133
|
+
return obj !== obj // eslint-disable-line no-self-compare
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
// Create lookup table for `toString('hex')`
|
|
2137
|
+
// See: https://github.com/feross/buffer/issues/219
|
|
2138
|
+
const hexSliceLookupTable = (function () {
|
|
2139
|
+
const alphabet = '0123456789abcdef'
|
|
2140
|
+
const table = new Array(256)
|
|
2141
|
+
for (let i = 0; i < 16; ++i) {
|
|
2142
|
+
const i16 = i * 16
|
|
2143
|
+
for (let j = 0; j < 16; ++j) {
|
|
2144
|
+
table[i16 + j] = alphabet[i] + alphabet[j]
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
return table
|
|
2148
|
+
})()
|
|
2149
|
+
|
|
2150
|
+
// Return not function with Error if BigInt not supported
|
|
2151
|
+
function defineBigIntMethod (fn) {
|
|
2152
|
+
return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
function BufferBigIntNotDefined () {
|
|
2156
|
+
throw new Error('BigInt not supported')
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
|
|
2160
|
+
/***/ },
|
|
2161
|
+
|
|
2162
|
+
/***/ 767
|
|
2163
|
+
(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
|
2164
|
+
|
|
2165
|
+
"use strict";
|
|
2166
|
+
(function(r){function x(){}function y(){}var z=String.fromCharCode,v={}.toString,A=v.call(r.SharedArrayBuffer),B=v(),q=r.Uint8Array,t=q||Array,w=q?ArrayBuffer:t,C=w.isView||function(g){return g&&"length"in g},D=v.call(w.prototype);w=y.prototype;var E=r.TextEncoder,a=new (q?Uint16Array:t)(32);x.prototype.decode=function(g){if(!C(g)){var l=v.call(g);if(l!==D&&l!==A&&l!==B)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");
|
|
2167
|
+
g=q?new t(g):g||[]}for(var f=l="",b=0,c=g.length|0,u=c-32|0,e,d,h=0,p=0,m,k=0,n=-1;b<c;){for(e=b<=u?32:c-b|0;k<e;b=b+1|0,k=k+1|0){d=g[b]&255;switch(d>>4){case 15:m=g[b=b+1|0]&255;if(2!==m>>6||247<d){b=b-1|0;break}h=(d&7)<<6|m&63;p=5;d=256;case 14:m=g[b=b+1|0]&255,h<<=6,h|=(d&15)<<6|m&63,p=2===m>>6?p+4|0:24,d=d+256&768;case 13:case 12:m=g[b=b+1|0]&255,h<<=6,h|=(d&31)<<6|m&63,p=p+7|0,b<c&&2===m>>6&&h>>p&&1114112>h?(d=h,h=h-65536|0,0<=h&&(n=(h>>10)+55296|0,d=(h&1023)+56320|0,31>k?(a[k]=n,k=k+1|0,n=-1):
|
|
2168
|
+
(m=n,n=d,d=m))):(d>>=8,b=b-d-1|0,d=65533),h=p=0,e=b<=u?32:c-b|0;default:a[k]=d;continue;case 11:case 10:case 9:case 8:}a[k]=65533}f+=z(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15],a[16],a[17],a[18],a[19],a[20],a[21],a[22],a[23],a[24],a[25],a[26],a[27],a[28],a[29],a[30],a[31]);32>k&&(f=f.slice(0,k-32|0));if(b<c){if(a[0]=n,k=~n>>>31,n=-1,f.length<l.length)continue}else-1!==n&&(f+=z(n));l+=f;f=""}return l};w.encode=function(g){g=void 0===g?"":""+g;var l=g.length|
|
|
2169
|
+
0,f=new t((l<<1)+8|0),b,c=0,u=!q;for(b=0;b<l;b=b+1|0,c=c+1|0){var e=g.charCodeAt(b)|0;if(127>=e)f[c]=e;else{if(2047>=e)f[c]=192|e>>6;else{a:{if(55296<=e)if(56319>=e){var d=g.charCodeAt(b=b+1|0)|0;if(56320<=d&&57343>=d){e=(e<<10)+d-56613888|0;if(65535<e){f[c]=240|e>>18;f[c=c+1|0]=128|e>>12&63;f[c=c+1|0]=128|e>>6&63;f[c=c+1|0]=128|e&63;continue}break a}e=65533}else 57343>=e&&(e=65533);!u&&b<<1<c&&b<<1<(c-7|0)&&(u=!0,d=new t(3*l),d.set(f),f=d)}f[c]=224|e>>12;f[c=c+1|0]=128|e>>6&63}f[c=c+1|0]=128|e&63}}return q?
|
|
2170
|
+
f.subarray(0,c):f.slice(0,c)};E||(r.TextDecoder=x,r.TextEncoder=y)})(""+void 0==typeof __webpack_require__.g?""+void 0==typeof self?this:self:__webpack_require__.g);//AnonyCo
|
|
2171
|
+
//# sourceMappingURL=https://cdn.jsdelivr.net/gh/AnonyCo/FastestSmallestTextEncoderDecoder/EncoderDecoderTogether.min.js.map
|
|
2172
|
+
|
|
2173
|
+
|
|
2174
|
+
/***/ },
|
|
2175
|
+
|
|
2176
|
+
/***/ 251
|
|
2177
|
+
(__unused_webpack_module, exports) {
|
|
2178
|
+
|
|
2179
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
2180
|
+
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
|
2181
|
+
var e, m
|
|
2182
|
+
var eLen = (nBytes * 8) - mLen - 1
|
|
2183
|
+
var eMax = (1 << eLen) - 1
|
|
2184
|
+
var eBias = eMax >> 1
|
|
2185
|
+
var nBits = -7
|
|
2186
|
+
var i = isLE ? (nBytes - 1) : 0
|
|
2187
|
+
var d = isLE ? -1 : 1
|
|
2188
|
+
var s = buffer[offset + i]
|
|
2189
|
+
|
|
2190
|
+
i += d
|
|
2191
|
+
|
|
2192
|
+
e = s & ((1 << (-nBits)) - 1)
|
|
2193
|
+
s >>= (-nBits)
|
|
2194
|
+
nBits += eLen
|
|
2195
|
+
for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
|
2196
|
+
|
|
2197
|
+
m = e & ((1 << (-nBits)) - 1)
|
|
2198
|
+
e >>= (-nBits)
|
|
2199
|
+
nBits += mLen
|
|
2200
|
+
for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
|
2201
|
+
|
|
2202
|
+
if (e === 0) {
|
|
2203
|
+
e = 1 - eBias
|
|
2204
|
+
} else if (e === eMax) {
|
|
2205
|
+
return m ? NaN : ((s ? -1 : 1) * Infinity)
|
|
2206
|
+
} else {
|
|
2207
|
+
m = m + Math.pow(2, mLen)
|
|
2208
|
+
e = e - eBias
|
|
2209
|
+
}
|
|
2210
|
+
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
|
2214
|
+
var e, m, c
|
|
2215
|
+
var eLen = (nBytes * 8) - mLen - 1
|
|
2216
|
+
var eMax = (1 << eLen) - 1
|
|
2217
|
+
var eBias = eMax >> 1
|
|
2218
|
+
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
|
|
2219
|
+
var i = isLE ? 0 : (nBytes - 1)
|
|
2220
|
+
var d = isLE ? 1 : -1
|
|
2221
|
+
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
|
|
2222
|
+
|
|
2223
|
+
value = Math.abs(value)
|
|
2224
|
+
|
|
2225
|
+
if (isNaN(value) || value === Infinity) {
|
|
2226
|
+
m = isNaN(value) ? 1 : 0
|
|
2227
|
+
e = eMax
|
|
2228
|
+
} else {
|
|
2229
|
+
e = Math.floor(Math.log(value) / Math.LN2)
|
|
2230
|
+
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
2231
|
+
e--
|
|
2232
|
+
c *= 2
|
|
2233
|
+
}
|
|
2234
|
+
if (e + eBias >= 1) {
|
|
2235
|
+
value += rt / c
|
|
2236
|
+
} else {
|
|
2237
|
+
value += rt * Math.pow(2, 1 - eBias)
|
|
2238
|
+
}
|
|
2239
|
+
if (value * c >= 2) {
|
|
2240
|
+
e++
|
|
2241
|
+
c /= 2
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
if (e + eBias >= eMax) {
|
|
2245
|
+
m = 0
|
|
2246
|
+
e = eMax
|
|
2247
|
+
} else if (e + eBias >= 1) {
|
|
2248
|
+
m = ((value * c) - 1) * Math.pow(2, mLen)
|
|
2249
|
+
e = e + eBias
|
|
2250
|
+
} else {
|
|
2251
|
+
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
|
|
2252
|
+
e = 0
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
|
2257
|
+
|
|
2258
|
+
e = (e << mLen) | m
|
|
2259
|
+
eLen += mLen
|
|
2260
|
+
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
|
2261
|
+
|
|
2262
|
+
buffer[offset + i - d] |= s * 128
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
|
|
2266
|
+
/***/ },
|
|
2267
|
+
|
|
2268
|
+
/***/ 173
|
|
2269
|
+
(module) {
|
|
2270
|
+
|
|
2271
|
+
function M() { this._events = {}; }
|
|
2272
|
+
M.prototype = {
|
|
2273
|
+
on: function(ev, cb) {
|
|
2274
|
+
this._events || (this._events = {});
|
|
2275
|
+
var e = this._events;
|
|
2276
|
+
(e[ev] || (e[ev] = [])).push(cb);
|
|
2277
|
+
return this;
|
|
2278
|
+
},
|
|
2279
|
+
removeListener: function(ev, cb) {
|
|
2280
|
+
var e = this._events[ev] || [], i;
|
|
2281
|
+
for(i = e.length-1; i >= 0 && e[i]; i--){
|
|
2282
|
+
if(e[i] === cb || e[i].cb === cb) { e.splice(i, 1); }
|
|
2283
|
+
}
|
|
2284
|
+
},
|
|
2285
|
+
removeAllListeners: function(ev) {
|
|
2286
|
+
if(!ev) { this._events = {}; }
|
|
2287
|
+
else { this._events[ev] && (this._events[ev] = []); }
|
|
2288
|
+
},
|
|
2289
|
+
listeners: function(ev) {
|
|
2290
|
+
return (this._events ? this._events[ev] || [] : []);
|
|
2291
|
+
},
|
|
2292
|
+
emit: function(ev) {
|
|
2293
|
+
this._events || (this._events = {});
|
|
2294
|
+
var args = Array.prototype.slice.call(arguments, 1), i, e = this._events[ev] || [];
|
|
2295
|
+
for(i = e.length-1; i >= 0 && e[i]; i--){
|
|
2296
|
+
e[i].apply(this, args);
|
|
2297
|
+
}
|
|
2298
|
+
return this;
|
|
2299
|
+
},
|
|
2300
|
+
when: function(ev, cb) {
|
|
2301
|
+
return this.once(ev, cb, true);
|
|
2302
|
+
},
|
|
2303
|
+
once: function(ev, cb, when) {
|
|
2304
|
+
if(!cb) return this;
|
|
2305
|
+
function c() {
|
|
2306
|
+
if(!when) this.removeListener(ev, c);
|
|
2307
|
+
if(cb.apply(this, arguments) && when) this.removeListener(ev, c);
|
|
2308
|
+
}
|
|
2309
|
+
c.cb = cb;
|
|
2310
|
+
this.on(ev, c);
|
|
2311
|
+
return this;
|
|
2312
|
+
}
|
|
2313
|
+
};
|
|
2314
|
+
M.mixin = function(dest) {
|
|
2315
|
+
var o = M.prototype, k;
|
|
2316
|
+
for (k in o) {
|
|
2317
|
+
o.hasOwnProperty(k) && (dest.prototype[k] = o[k]);
|
|
2318
|
+
}
|
|
2319
|
+
};
|
|
2320
|
+
module.exports = M;
|
|
2321
|
+
|
|
2322
|
+
|
|
2323
|
+
/***/ },
|
|
2324
|
+
|
|
2325
|
+
/***/ 84
|
|
2326
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
2327
|
+
|
|
2328
|
+
// default filter
|
|
2329
|
+
var Transform = __webpack_require__(408);
|
|
2330
|
+
|
|
2331
|
+
var levelMap = { debug: 1, info: 2, warn: 3, error: 4 };
|
|
2332
|
+
|
|
2333
|
+
function Filter() {
|
|
2334
|
+
this.enabled = true;
|
|
2335
|
+
this.defaultResult = true;
|
|
2336
|
+
this.clear();
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
Transform.mixin(Filter);
|
|
2340
|
+
|
|
2341
|
+
// allow all matching, with level >= given level
|
|
2342
|
+
Filter.prototype.allow = function(name, level) {
|
|
2343
|
+
this._white.push({ n: name, l: levelMap[level] });
|
|
2344
|
+
return this;
|
|
2345
|
+
};
|
|
2346
|
+
|
|
2347
|
+
// deny all matching, with level <= given level
|
|
2348
|
+
Filter.prototype.deny = function(name, level) {
|
|
2349
|
+
this._black.push({ n: name, l: levelMap[level] });
|
|
2350
|
+
return this;
|
|
2351
|
+
};
|
|
2352
|
+
|
|
2353
|
+
Filter.prototype.clear = function() {
|
|
2354
|
+
this._white = [];
|
|
2355
|
+
this._black = [];
|
|
2356
|
+
return this;
|
|
2357
|
+
};
|
|
2358
|
+
|
|
2359
|
+
function test(rule, name) {
|
|
2360
|
+
// use .test for RegExps
|
|
2361
|
+
return (rule.n.test ? rule.n.test(name) : rule.n == name);
|
|
2362
|
+
};
|
|
2363
|
+
|
|
2364
|
+
Filter.prototype.test = function(name, level) {
|
|
2365
|
+
var i, len = Math.max(this._white.length, this._black.length);
|
|
2366
|
+
for(i = 0; i < len; i++) {
|
|
2367
|
+
if(this._white[i] && test(this._white[i], name) && levelMap[level] >= this._white[i].l) {
|
|
2368
|
+
return true;
|
|
2369
|
+
}
|
|
2370
|
+
if(this._black[i] && test(this._black[i], name) && levelMap[level] <= this._black[i].l) {
|
|
2371
|
+
return false;
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
return this.defaultResult;
|
|
2375
|
+
};
|
|
2376
|
+
|
|
2377
|
+
Filter.prototype.write = function(name, level, args) {
|
|
2378
|
+
if(!this.enabled || this.test(name, level)) {
|
|
2379
|
+
return this.emit('item', name, level, args);
|
|
2380
|
+
}
|
|
2381
|
+
};
|
|
2382
|
+
|
|
2383
|
+
module.exports = Filter;
|
|
2384
|
+
|
|
2385
|
+
|
|
2386
|
+
/***/ },
|
|
2387
|
+
|
|
2388
|
+
/***/ 15
|
|
2389
|
+
(module, exports, __webpack_require__) {
|
|
2390
|
+
|
|
2391
|
+
var Transform = __webpack_require__(408),
|
|
2392
|
+
Filter = __webpack_require__(84);
|
|
2393
|
+
|
|
2394
|
+
var log = new Transform(),
|
|
2395
|
+
slice = Array.prototype.slice;
|
|
2396
|
+
|
|
2397
|
+
exports = module.exports = function create(name) {
|
|
2398
|
+
var o = function() { log.write(name, undefined, slice.call(arguments)); return o; };
|
|
2399
|
+
o.debug = function() { log.write(name, 'debug', slice.call(arguments)); return o; };
|
|
2400
|
+
o.info = function() { log.write(name, 'info', slice.call(arguments)); return o; };
|
|
2401
|
+
o.warn = function() { log.write(name, 'warn', slice.call(arguments)); return o; };
|
|
2402
|
+
o.error = function() { log.write(name, 'error', slice.call(arguments)); return o; };
|
|
2403
|
+
o.log = o.debug; // for interface compliance with Node and browser consoles
|
|
2404
|
+
o.suggest = exports.suggest;
|
|
2405
|
+
o.format = log.format;
|
|
2406
|
+
return o;
|
|
2407
|
+
};
|
|
2408
|
+
|
|
2409
|
+
// filled in separately
|
|
2410
|
+
exports.defaultBackend = exports.defaultFormatter = null;
|
|
2411
|
+
|
|
2412
|
+
exports.pipe = function(dest) {
|
|
2413
|
+
return log.pipe(dest);
|
|
2414
|
+
};
|
|
2450
2415
|
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
if ((i + offset >= dst.length) || (i >= src.length)) break
|
|
2455
|
-
dst[i + offset] = src[i]
|
|
2456
|
-
}
|
|
2457
|
-
return i
|
|
2458
|
-
}
|
|
2416
|
+
exports.end = exports.unpipe = exports.disable = function(from) {
|
|
2417
|
+
return log.unpipe(from);
|
|
2418
|
+
};
|
|
2459
2419
|
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
//
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
(obj != null && obj.constructor != null && obj.constructor.name != null &&
|
|
2466
|
-
obj.constructor.name === type.name)
|
|
2467
|
-
}
|
|
2468
|
-
function numberIsNaN (obj) {
|
|
2469
|
-
// For IE11 support
|
|
2470
|
-
return obj !== obj // eslint-disable-line no-self-compare
|
|
2471
|
-
}
|
|
2420
|
+
exports.Transform = Transform;
|
|
2421
|
+
exports.Filter = Filter;
|
|
2422
|
+
// this is the default filter that's applied when .enable() is called normally
|
|
2423
|
+
// you can bypass it completely and set up your own pipes
|
|
2424
|
+
exports.suggest = new Filter();
|
|
2472
2425
|
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
for (let i = 0; i < 16; ++i) {
|
|
2479
|
-
const i16 = i * 16
|
|
2480
|
-
for (let j = 0; j < 16; ++j) {
|
|
2481
|
-
table[i16 + j] = alphabet[i] + alphabet[j]
|
|
2482
|
-
}
|
|
2426
|
+
exports.enable = function() {
|
|
2427
|
+
if(exports.defaultFormatter) {
|
|
2428
|
+
return log.pipe(exports.suggest) // filter
|
|
2429
|
+
.pipe(exports.defaultFormatter) // formatter
|
|
2430
|
+
.pipe(exports.defaultBackend); // backend
|
|
2483
2431
|
}
|
|
2484
|
-
return
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
// Return not function with Error if BigInt not supported
|
|
2488
|
-
function defineBigIntMethod (fn) {
|
|
2489
|
-
return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn
|
|
2490
|
-
}
|
|
2432
|
+
return log.pipe(exports.suggest) // filter
|
|
2433
|
+
.pipe(exports.defaultBackend); // formatter
|
|
2434
|
+
};
|
|
2491
2435
|
|
|
2492
|
-
function BufferBigIntNotDefined () {
|
|
2493
|
-
throw new Error('BigInt not supported')
|
|
2494
|
-
}
|
|
2495
2436
|
|
|
2496
2437
|
|
|
2497
2438
|
/***/ },
|
|
@@ -2575,60 +2516,63 @@ module.exports = Transform;
|
|
|
2575
2516
|
|
|
2576
2517
|
/***/ },
|
|
2577
2518
|
|
|
2578
|
-
/***/
|
|
2579
|
-
(module) {
|
|
2519
|
+
/***/ 692
|
|
2520
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
2580
2521
|
|
|
2581
|
-
|
|
2582
|
-
|
|
2522
|
+
var Transform = __webpack_require__(408),
|
|
2523
|
+
cache = [ ];
|
|
2583
2524
|
|
|
2584
|
-
|
|
2525
|
+
var logger = new Transform();
|
|
2585
2526
|
|
|
2586
|
-
|
|
2587
|
-
(
|
|
2527
|
+
logger.write = function(name, level, args) {
|
|
2528
|
+
cache.push([ name, level, args ]);
|
|
2529
|
+
};
|
|
2588
2530
|
|
|
2589
|
-
|
|
2531
|
+
// utility functions
|
|
2532
|
+
logger.get = function() { return cache; };
|
|
2533
|
+
logger.empty = function() { cache = []; };
|
|
2590
2534
|
|
|
2591
|
-
|
|
2592
|
-
oldDisable = Minilog.disable,
|
|
2593
|
-
isChrome = (typeof navigator != 'undefined' && /chrome/i.test(navigator.userAgent)),
|
|
2594
|
-
console = __webpack_require__(260);
|
|
2535
|
+
module.exports = logger;
|
|
2595
2536
|
|
|
2596
|
-
// Use a more capable logging backend if on Chrome
|
|
2597
|
-
Minilog.defaultBackend = (isChrome ? console.minilog : console);
|
|
2598
2537
|
|
|
2599
|
-
|
|
2600
|
-
if(typeof window != 'undefined') {
|
|
2601
|
-
try {
|
|
2602
|
-
Minilog.enable(JSON.parse(window.localStorage['minilogSettings']));
|
|
2603
|
-
} catch(e) {}
|
|
2604
|
-
if(window.location && window.location.search) {
|
|
2605
|
-
var match = RegExp('[?&]minilog=([^&]*)').exec(window.location.search);
|
|
2606
|
-
match && Minilog.enable(decodeURIComponent(match[1]));
|
|
2607
|
-
}
|
|
2608
|
-
}
|
|
2538
|
+
/***/ },
|
|
2609
2539
|
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
oldEnable.call(Minilog, true);
|
|
2613
|
-
try { window.localStorage['minilogSettings'] = JSON.stringify(true); } catch(e) {}
|
|
2614
|
-
return this;
|
|
2615
|
-
};
|
|
2540
|
+
/***/ 260
|
|
2541
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
2616
2542
|
|
|
2617
|
-
|
|
2618
|
-
oldDisable.call(Minilog);
|
|
2619
|
-
try { delete window.localStorage.minilogSettings; } catch(e) {}
|
|
2620
|
-
return this;
|
|
2621
|
-
};
|
|
2543
|
+
var Transform = __webpack_require__(408);
|
|
2622
2544
|
|
|
2623
|
-
|
|
2545
|
+
var newlines = /\n+$/,
|
|
2546
|
+
logger = new Transform();
|
|
2624
2547
|
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2548
|
+
logger.write = function(name, level, args) {
|
|
2549
|
+
var i = args.length-1;
|
|
2550
|
+
if (typeof console === 'undefined' || !console.log) {
|
|
2551
|
+
return;
|
|
2552
|
+
}
|
|
2553
|
+
if(console.log.apply) {
|
|
2554
|
+
return console.log.apply(console, [name, level].concat(args));
|
|
2555
|
+
} else if(JSON && JSON.stringify) {
|
|
2556
|
+
// console.log.apply is undefined in IE8 and IE9
|
|
2557
|
+
// for IE8/9: make console.log at least a bit less awful
|
|
2558
|
+
if(args[i] && typeof args[i] == 'string') {
|
|
2559
|
+
args[i] = args[i].replace(newlines, '');
|
|
2560
|
+
}
|
|
2561
|
+
try {
|
|
2562
|
+
for(i = 0; i < args.length; i++) {
|
|
2563
|
+
args[i] = JSON.stringify(args[i]);
|
|
2564
|
+
}
|
|
2565
|
+
} catch(e) {}
|
|
2566
|
+
console.log(args.join(' '));
|
|
2567
|
+
}
|
|
2630
2568
|
};
|
|
2631
2569
|
|
|
2570
|
+
logger.formatters = ['color', 'minilog'];
|
|
2571
|
+
logger.color = __webpack_require__(638);
|
|
2572
|
+
logger.minilog = __webpack_require__(658);
|
|
2573
|
+
|
|
2574
|
+
module.exports = logger;
|
|
2575
|
+
|
|
2632
2576
|
|
|
2633
2577
|
/***/ },
|
|
2634
2578
|
|
|
@@ -2690,30 +2634,78 @@ module.exports = logger;
|
|
|
2690
2634
|
|
|
2691
2635
|
/***/ },
|
|
2692
2636
|
|
|
2693
|
-
/***/
|
|
2694
|
-
(module
|
|
2637
|
+
/***/ 193
|
|
2638
|
+
(module) {
|
|
2639
|
+
|
|
2640
|
+
var hex = {
|
|
2641
|
+
black: '#000',
|
|
2642
|
+
red: '#c23621',
|
|
2643
|
+
green: '#25bc26',
|
|
2644
|
+
yellow: '#bbbb00',
|
|
2645
|
+
blue: '#492ee1',
|
|
2646
|
+
magenta: '#d338d3',
|
|
2647
|
+
cyan: '#33bbc8',
|
|
2648
|
+
gray: '#808080',
|
|
2649
|
+
purple: '#708'
|
|
2650
|
+
};
|
|
2651
|
+
function color(fg, isInverse) {
|
|
2652
|
+
if(isInverse) {
|
|
2653
|
+
return 'color: #fff; background: '+hex[fg]+';';
|
|
2654
|
+
} else {
|
|
2655
|
+
return 'color: '+hex[fg]+';';
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
|
|
2659
|
+
module.exports = color;
|
|
2695
2660
|
|
|
2696
|
-
module.exports = __webpack_require__(14)("UklGRiYAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQIAAAAAAA==")
|
|
2697
2661
|
|
|
2698
2662
|
/***/ },
|
|
2699
2663
|
|
|
2700
|
-
/***/
|
|
2701
|
-
(module,
|
|
2664
|
+
/***/ 557
|
|
2665
|
+
(module, exports, __webpack_require__) {
|
|
2702
2666
|
|
|
2703
|
-
var
|
|
2704
|
-
cache = [ ];
|
|
2667
|
+
var Minilog = __webpack_require__(15);
|
|
2705
2668
|
|
|
2706
|
-
var
|
|
2669
|
+
var oldEnable = Minilog.enable,
|
|
2670
|
+
oldDisable = Minilog.disable,
|
|
2671
|
+
isChrome = (typeof navigator != 'undefined' && /chrome/i.test(navigator.userAgent)),
|
|
2672
|
+
console = __webpack_require__(260);
|
|
2707
2673
|
|
|
2708
|
-
|
|
2709
|
-
|
|
2674
|
+
// Use a more capable logging backend if on Chrome
|
|
2675
|
+
Minilog.defaultBackend = (isChrome ? console.minilog : console);
|
|
2676
|
+
|
|
2677
|
+
// apply enable inputs from localStorage and from the URL
|
|
2678
|
+
if(typeof window != 'undefined') {
|
|
2679
|
+
try {
|
|
2680
|
+
Minilog.enable(JSON.parse(window.localStorage['minilogSettings']));
|
|
2681
|
+
} catch(e) {}
|
|
2682
|
+
if(window.location && window.location.search) {
|
|
2683
|
+
var match = RegExp('[?&]minilog=([^&]*)').exec(window.location.search);
|
|
2684
|
+
match && Minilog.enable(decodeURIComponent(match[1]));
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
// Make enable also add to localStorage
|
|
2689
|
+
Minilog.enable = function() {
|
|
2690
|
+
oldEnable.call(Minilog, true);
|
|
2691
|
+
try { window.localStorage['minilogSettings'] = JSON.stringify(true); } catch(e) {}
|
|
2692
|
+
return this;
|
|
2710
2693
|
};
|
|
2711
2694
|
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2695
|
+
Minilog.disable = function() {
|
|
2696
|
+
oldDisable.call(Minilog);
|
|
2697
|
+
try { delete window.localStorage.minilogSettings; } catch(e) {}
|
|
2698
|
+
return this;
|
|
2699
|
+
};
|
|
2715
2700
|
|
|
2716
|
-
module.exports =
|
|
2701
|
+
exports = module.exports = Minilog;
|
|
2702
|
+
|
|
2703
|
+
exports.backends = {
|
|
2704
|
+
array: __webpack_require__(692),
|
|
2705
|
+
browser: Minilog.defaultBackend,
|
|
2706
|
+
localStorage: __webpack_require__(113),
|
|
2707
|
+
jQuery: __webpack_require__(740)
|
|
2708
|
+
};
|
|
2717
2709
|
|
|
2718
2710
|
|
|
2719
2711
|
/***/ },
|
|
@@ -2799,24 +2791,32 @@ module.exports = AjaxLogger;
|
|
|
2799
2791
|
|
|
2800
2792
|
/***/ },
|
|
2801
2793
|
|
|
2802
|
-
/***/
|
|
2803
|
-
(
|
|
2794
|
+
/***/ 113
|
|
2795
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
2804
2796
|
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2797
|
+
var Transform = __webpack_require__(408),
|
|
2798
|
+
cache = false;
|
|
2799
|
+
|
|
2800
|
+
var logger = new Transform();
|
|
2801
|
+
|
|
2802
|
+
logger.write = function(name, level, args) {
|
|
2803
|
+
if(typeof window == 'undefined' || typeof JSON == 'undefined' || !JSON.stringify || !JSON.parse) return;
|
|
2804
|
+
try {
|
|
2805
|
+
if(!cache) { cache = (window.localStorage.minilog ? JSON.parse(window.localStorage.minilog) : []); }
|
|
2806
|
+
cache.push([ new Date().toString(), name, level, args ]);
|
|
2807
|
+
window.localStorage.minilog = JSON.stringify(cache);
|
|
2808
|
+
} catch(e) {}
|
|
2809
|
+
};
|
|
2812
2810
|
|
|
2811
|
+
module.exports = logger;
|
|
2813
2812
|
|
|
2814
2813
|
/***/ },
|
|
2815
2814
|
|
|
2816
|
-
/***/
|
|
2817
|
-
(module
|
|
2815
|
+
/***/ 523
|
|
2816
|
+
(module) {
|
|
2818
2817
|
|
|
2819
|
-
|
|
2818
|
+
"use strict";
|
|
2819
|
+
module.exports = require("base64-js");
|
|
2820
2820
|
|
|
2821
2821
|
/***/ }
|
|
2822
2822
|
|