@hashgraphonline/standards-sdk 0.0.37 → 0.0.38
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.
|
@@ -19,7 +19,6 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
19
19
|
});
|
|
20
20
|
var _names, _data, _dataLength, _Writer_instances, writeData_fn, _data2, _offset, _bytesRead, _parent, _maxInflation, _Reader_instances, incrementBytesRead_fn, peekBytes_fn, _options, _offset2, _tokens, _TokenString_instances, subTokenString_fn, _ParamType_instances, walkAsync_fn, _AbiCoder_instances, getCoder_fn, _errors, _events, _functions, _abiCoder, _Interface_instances, getFunction_fn, getEvent_fn;
|
|
21
21
|
import { ContractId, AccountId, Client, PrivateKey, Transaction, PublicKey, Status, AccountUpdateTransaction, AccountCreateTransaction, Hbar, CustomFixedFee, KeyList, TopicCreateTransaction, TopicMessageSubmitTransaction, TopicId } from "@hashgraph/sdk";
|
|
22
|
-
import process from "vite-plugin-node-polyfills/shims/process";
|
|
23
22
|
import { proto } from "@hashgraph/proto";
|
|
24
23
|
let Logger$1 = class Logger {
|
|
25
24
|
constructor(options = {}) {
|
|
@@ -1943,7 +1942,6 @@ peekBytes_fn = function(offset, length, loose) {
|
|
|
1943
1942
|
return __privateGet(this, _data2).slice(__privateGet(this, _offset), __privateGet(this, _offset) + alignedLength);
|
|
1944
1943
|
};
|
|
1945
1944
|
let Reader = _Reader;
|
|
1946
|
-
const global$1 = globalThis || void 0 || self;
|
|
1947
1945
|
function number(n2) {
|
|
1948
1946
|
if (!Number.isSafeInteger(n2) || n2 < 0)
|
|
1949
1947
|
throw new Error(`Wrong positive integer: ${n2}`);
|
|
@@ -5975,1822 +5973,56 @@ class EVMBridge {
|
|
|
5975
5973
|
data: command,
|
|
5976
5974
|
estimate: false,
|
|
5977
5975
|
gas: 3e5,
|
|
5978
|
-
gasPrice: 1e8,
|
|
5979
|
-
from: fromAddress.startsWith("0x") ? fromAddress : `0x${fromAddress}`,
|
|
5980
|
-
to: toAddress?.startsWith("0x") ? toAddress : `0x${toAddress}`,
|
|
5981
|
-
value: 0
|
|
5982
|
-
})
|
|
5983
|
-
}
|
|
5984
|
-
);
|
|
5985
|
-
if (!response.ok) {
|
|
5986
|
-
throw new Error(`HTTP error! status: ${response.status}`);
|
|
5987
|
-
}
|
|
5988
|
-
return await response.json();
|
|
5989
|
-
} catch (error) {
|
|
5990
|
-
this.logger.error("Error reading from mirror node:", error);
|
|
5991
|
-
return null;
|
|
5992
|
-
}
|
|
5993
|
-
}
|
|
5994
|
-
// Add method to clear cache if needed
|
|
5995
|
-
async clearCache() {
|
|
5996
|
-
await this.cache.clear();
|
|
5997
|
-
}
|
|
5998
|
-
// Add method to remove specific cache entry
|
|
5999
|
-
async clearCacheForContract(contractAddress, functionName) {
|
|
6000
|
-
await this.cache.delete(`${contractAddress}-${functionName}`);
|
|
6001
|
-
}
|
|
6002
|
-
// Method to set log level for this bridge instance
|
|
6003
|
-
setLogLevel(level) {
|
|
6004
|
-
this.logger.setLogLevel(level);
|
|
6005
|
-
}
|
|
6006
|
-
}
|
|
6007
|
-
function formatValue(value, type) {
|
|
6008
|
-
if (value === null || value === void 0) {
|
|
6009
|
-
return "0";
|
|
6010
|
-
}
|
|
6011
|
-
if (value._isBigNumber) {
|
|
6012
|
-
return value.toString();
|
|
6013
|
-
}
|
|
6014
|
-
if (type.startsWith("uint") || type.startsWith("int")) {
|
|
6015
|
-
return String(value);
|
|
6016
|
-
} else if (type === "bool") {
|
|
6017
|
-
return value ? "true" : "false";
|
|
6018
|
-
} else if (type === "string") {
|
|
6019
|
-
return value;
|
|
6020
|
-
} else if (type === "address") {
|
|
6021
|
-
return String(value).toLowerCase();
|
|
6022
|
-
} else if (type.endsWith("[]")) {
|
|
6023
|
-
return Array.isArray(value) ? value.map((v) => String(v)) : [];
|
|
6024
|
-
} else {
|
|
6025
|
-
return String(value);
|
|
6026
|
-
}
|
|
6027
|
-
}
|
|
6028
|
-
var buffer$1 = {};
|
|
6029
|
-
var base64Js$1 = {};
|
|
6030
|
-
base64Js$1.byteLength = byteLength$1;
|
|
6031
|
-
base64Js$1.toByteArray = toByteArray$1;
|
|
6032
|
-
base64Js$1.fromByteArray = fromByteArray$1;
|
|
6033
|
-
var lookup$1 = [];
|
|
6034
|
-
var revLookup$1 = [];
|
|
6035
|
-
var Arr$1 = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
|
|
6036
|
-
var code$1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
6037
|
-
for (var i$3 = 0, len$1 = code$1.length; i$3 < len$1; ++i$3) {
|
|
6038
|
-
lookup$1[i$3] = code$1[i$3];
|
|
6039
|
-
revLookup$1[code$1.charCodeAt(i$3)] = i$3;
|
|
6040
|
-
}
|
|
6041
|
-
revLookup$1["-".charCodeAt(0)] = 62;
|
|
6042
|
-
revLookup$1["_".charCodeAt(0)] = 63;
|
|
6043
|
-
function getLens$1(b64) {
|
|
6044
|
-
var len = b64.length;
|
|
6045
|
-
if (len % 4 > 0) {
|
|
6046
|
-
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
6047
|
-
}
|
|
6048
|
-
var validLen = b64.indexOf("=");
|
|
6049
|
-
if (validLen === -1) validLen = len;
|
|
6050
|
-
var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
|
|
6051
|
-
return [validLen, placeHoldersLen];
|
|
6052
|
-
}
|
|
6053
|
-
function byteLength$1(b64) {
|
|
6054
|
-
var lens = getLens$1(b64);
|
|
6055
|
-
var validLen = lens[0];
|
|
6056
|
-
var placeHoldersLen = lens[1];
|
|
6057
|
-
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
|
6058
|
-
}
|
|
6059
|
-
function _byteLength$1(b64, validLen, placeHoldersLen) {
|
|
6060
|
-
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
|
6061
|
-
}
|
|
6062
|
-
function toByteArray$1(b64) {
|
|
6063
|
-
var tmp;
|
|
6064
|
-
var lens = getLens$1(b64);
|
|
6065
|
-
var validLen = lens[0];
|
|
6066
|
-
var placeHoldersLen = lens[1];
|
|
6067
|
-
var arr = new Arr$1(_byteLength$1(b64, validLen, placeHoldersLen));
|
|
6068
|
-
var curByte = 0;
|
|
6069
|
-
var len = placeHoldersLen > 0 ? validLen - 4 : validLen;
|
|
6070
|
-
var i;
|
|
6071
|
-
for (i = 0; i < len; i += 4) {
|
|
6072
|
-
tmp = revLookup$1[b64.charCodeAt(i)] << 18 | revLookup$1[b64.charCodeAt(i + 1)] << 12 | revLookup$1[b64.charCodeAt(i + 2)] << 6 | revLookup$1[b64.charCodeAt(i + 3)];
|
|
6073
|
-
arr[curByte++] = tmp >> 16 & 255;
|
|
6074
|
-
arr[curByte++] = tmp >> 8 & 255;
|
|
6075
|
-
arr[curByte++] = tmp & 255;
|
|
6076
|
-
}
|
|
6077
|
-
if (placeHoldersLen === 2) {
|
|
6078
|
-
tmp = revLookup$1[b64.charCodeAt(i)] << 2 | revLookup$1[b64.charCodeAt(i + 1)] >> 4;
|
|
6079
|
-
arr[curByte++] = tmp & 255;
|
|
6080
|
-
}
|
|
6081
|
-
if (placeHoldersLen === 1) {
|
|
6082
|
-
tmp = revLookup$1[b64.charCodeAt(i)] << 10 | revLookup$1[b64.charCodeAt(i + 1)] << 4 | revLookup$1[b64.charCodeAt(i + 2)] >> 2;
|
|
6083
|
-
arr[curByte++] = tmp >> 8 & 255;
|
|
6084
|
-
arr[curByte++] = tmp & 255;
|
|
6085
|
-
}
|
|
6086
|
-
return arr;
|
|
6087
|
-
}
|
|
6088
|
-
function tripletToBase64$1(num) {
|
|
6089
|
-
return lookup$1[num >> 18 & 63] + lookup$1[num >> 12 & 63] + lookup$1[num >> 6 & 63] + lookup$1[num & 63];
|
|
6090
|
-
}
|
|
6091
|
-
function encodeChunk$1(uint8, start, end) {
|
|
6092
|
-
var tmp;
|
|
6093
|
-
var output2 = [];
|
|
6094
|
-
for (var i = start; i < end; i += 3) {
|
|
6095
|
-
tmp = (uint8[i] << 16 & 16711680) + (uint8[i + 1] << 8 & 65280) + (uint8[i + 2] & 255);
|
|
6096
|
-
output2.push(tripletToBase64$1(tmp));
|
|
6097
|
-
}
|
|
6098
|
-
return output2.join("");
|
|
6099
|
-
}
|
|
6100
|
-
function fromByteArray$1(uint8) {
|
|
6101
|
-
var tmp;
|
|
6102
|
-
var len = uint8.length;
|
|
6103
|
-
var extraBytes = len % 3;
|
|
6104
|
-
var parts = [];
|
|
6105
|
-
var maxChunkLength = 16383;
|
|
6106
|
-
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
6107
|
-
parts.push(encodeChunk$1(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
|
|
6108
|
-
}
|
|
6109
|
-
if (extraBytes === 1) {
|
|
6110
|
-
tmp = uint8[len - 1];
|
|
6111
|
-
parts.push(
|
|
6112
|
-
lookup$1[tmp >> 2] + lookup$1[tmp << 4 & 63] + "=="
|
|
6113
|
-
);
|
|
6114
|
-
} else if (extraBytes === 2) {
|
|
6115
|
-
tmp = (uint8[len - 2] << 8) + uint8[len - 1];
|
|
6116
|
-
parts.push(
|
|
6117
|
-
lookup$1[tmp >> 10] + lookup$1[tmp >> 4 & 63] + lookup$1[tmp << 2 & 63] + "="
|
|
6118
|
-
);
|
|
6119
|
-
}
|
|
6120
|
-
return parts.join("");
|
|
6121
|
-
}
|
|
6122
|
-
var ieee754$2 = {};
|
|
6123
|
-
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
6124
|
-
ieee754$2.read = function(buffer2, offset, isLE2, mLen, nBytes) {
|
|
6125
|
-
var e, m;
|
|
6126
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
6127
|
-
var eMax = (1 << eLen) - 1;
|
|
6128
|
-
var eBias = eMax >> 1;
|
|
6129
|
-
var nBits = -7;
|
|
6130
|
-
var i = isLE2 ? nBytes - 1 : 0;
|
|
6131
|
-
var d = isLE2 ? -1 : 1;
|
|
6132
|
-
var s = buffer2[offset + i];
|
|
6133
|
-
i += d;
|
|
6134
|
-
e = s & (1 << -nBits) - 1;
|
|
6135
|
-
s >>= -nBits;
|
|
6136
|
-
nBits += eLen;
|
|
6137
|
-
for (; nBits > 0; e = e * 256 + buffer2[offset + i], i += d, nBits -= 8) {
|
|
6138
|
-
}
|
|
6139
|
-
m = e & (1 << -nBits) - 1;
|
|
6140
|
-
e >>= -nBits;
|
|
6141
|
-
nBits += mLen;
|
|
6142
|
-
for (; nBits > 0; m = m * 256 + buffer2[offset + i], i += d, nBits -= 8) {
|
|
6143
|
-
}
|
|
6144
|
-
if (e === 0) {
|
|
6145
|
-
e = 1 - eBias;
|
|
6146
|
-
} else if (e === eMax) {
|
|
6147
|
-
return m ? NaN : (s ? -1 : 1) * Infinity;
|
|
6148
|
-
} else {
|
|
6149
|
-
m = m + Math.pow(2, mLen);
|
|
6150
|
-
e = e - eBias;
|
|
6151
|
-
}
|
|
6152
|
-
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
6153
|
-
};
|
|
6154
|
-
ieee754$2.write = function(buffer2, value, offset, isLE2, mLen, nBytes) {
|
|
6155
|
-
var e, m, c;
|
|
6156
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
6157
|
-
var eMax = (1 << eLen) - 1;
|
|
6158
|
-
var eBias = eMax >> 1;
|
|
6159
|
-
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
|
|
6160
|
-
var i = isLE2 ? 0 : nBytes - 1;
|
|
6161
|
-
var d = isLE2 ? 1 : -1;
|
|
6162
|
-
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
|
|
6163
|
-
value = Math.abs(value);
|
|
6164
|
-
if (isNaN(value) || value === Infinity) {
|
|
6165
|
-
m = isNaN(value) ? 1 : 0;
|
|
6166
|
-
e = eMax;
|
|
6167
|
-
} else {
|
|
6168
|
-
e = Math.floor(Math.log(value) / Math.LN2);
|
|
6169
|
-
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
6170
|
-
e--;
|
|
6171
|
-
c *= 2;
|
|
6172
|
-
}
|
|
6173
|
-
if (e + eBias >= 1) {
|
|
6174
|
-
value += rt / c;
|
|
6175
|
-
} else {
|
|
6176
|
-
value += rt * Math.pow(2, 1 - eBias);
|
|
6177
|
-
}
|
|
6178
|
-
if (value * c >= 2) {
|
|
6179
|
-
e++;
|
|
6180
|
-
c /= 2;
|
|
6181
|
-
}
|
|
6182
|
-
if (e + eBias >= eMax) {
|
|
6183
|
-
m = 0;
|
|
6184
|
-
e = eMax;
|
|
6185
|
-
} else if (e + eBias >= 1) {
|
|
6186
|
-
m = (value * c - 1) * Math.pow(2, mLen);
|
|
6187
|
-
e = e + eBias;
|
|
6188
|
-
} else {
|
|
6189
|
-
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
6190
|
-
e = 0;
|
|
6191
|
-
}
|
|
6192
|
-
}
|
|
6193
|
-
for (; mLen >= 8; buffer2[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {
|
|
6194
|
-
}
|
|
6195
|
-
e = e << mLen | m;
|
|
6196
|
-
eLen += mLen;
|
|
6197
|
-
for (; eLen > 0; buffer2[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {
|
|
6198
|
-
}
|
|
6199
|
-
buffer2[offset + i - d] |= s * 128;
|
|
6200
|
-
};
|
|
6201
|
-
/*!
|
|
6202
|
-
* The buffer module from node.js, for the browser.
|
|
6203
|
-
*
|
|
6204
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
6205
|
-
* @license MIT
|
|
6206
|
-
*/
|
|
6207
|
-
(function(exports) {
|
|
6208
|
-
const base64 = base64Js$1;
|
|
6209
|
-
const ieee754$12 = ieee754$2;
|
|
6210
|
-
const customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
|
|
6211
|
-
exports.Buffer = Buffer3;
|
|
6212
|
-
exports.SlowBuffer = SlowBuffer;
|
|
6213
|
-
exports.INSPECT_MAX_BYTES = 50;
|
|
6214
|
-
const K_MAX_LENGTH = 2147483647;
|
|
6215
|
-
exports.kMaxLength = K_MAX_LENGTH;
|
|
6216
|
-
const { Uint8Array: GlobalUint8Array, ArrayBuffer: GlobalArrayBuffer, SharedArrayBuffer: GlobalSharedArrayBuffer } = globalThis;
|
|
6217
|
-
Buffer3.TYPED_ARRAY_SUPPORT = typedArraySupport();
|
|
6218
|
-
if (!Buffer3.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
|
|
6219
|
-
console.error(
|
|
6220
|
-
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
6221
|
-
);
|
|
6222
|
-
}
|
|
6223
|
-
function typedArraySupport() {
|
|
6224
|
-
try {
|
|
6225
|
-
const arr = new GlobalUint8Array(1);
|
|
6226
|
-
const proto2 = { foo: function() {
|
|
6227
|
-
return 42;
|
|
6228
|
-
} };
|
|
6229
|
-
Object.setPrototypeOf(proto2, GlobalUint8Array.prototype);
|
|
6230
|
-
Object.setPrototypeOf(arr, proto2);
|
|
6231
|
-
return arr.foo() === 42;
|
|
6232
|
-
} catch (e) {
|
|
6233
|
-
return false;
|
|
6234
|
-
}
|
|
6235
|
-
}
|
|
6236
|
-
Object.defineProperty(Buffer3.prototype, "parent", {
|
|
6237
|
-
enumerable: true,
|
|
6238
|
-
get: function() {
|
|
6239
|
-
if (!Buffer3.isBuffer(this)) return void 0;
|
|
6240
|
-
return this.buffer;
|
|
6241
|
-
}
|
|
6242
|
-
});
|
|
6243
|
-
Object.defineProperty(Buffer3.prototype, "offset", {
|
|
6244
|
-
enumerable: true,
|
|
6245
|
-
get: function() {
|
|
6246
|
-
if (!Buffer3.isBuffer(this)) return void 0;
|
|
6247
|
-
return this.byteOffset;
|
|
6248
|
-
}
|
|
6249
|
-
});
|
|
6250
|
-
function createBuffer(length) {
|
|
6251
|
-
if (length > K_MAX_LENGTH) {
|
|
6252
|
-
throw new RangeError('The value "' + length + '" is invalid for option "size"');
|
|
6253
|
-
}
|
|
6254
|
-
const buf = new GlobalUint8Array(length);
|
|
6255
|
-
Object.setPrototypeOf(buf, Buffer3.prototype);
|
|
6256
|
-
return buf;
|
|
6257
|
-
}
|
|
6258
|
-
function Buffer3(arg, encodingOrOffset, length) {
|
|
6259
|
-
if (typeof arg === "number") {
|
|
6260
|
-
if (typeof encodingOrOffset === "string") {
|
|
6261
|
-
throw new TypeError(
|
|
6262
|
-
'The "string" argument must be of type string. Received type number'
|
|
6263
|
-
);
|
|
6264
|
-
}
|
|
6265
|
-
return allocUnsafe(arg);
|
|
6266
|
-
}
|
|
6267
|
-
return from(arg, encodingOrOffset, length);
|
|
6268
|
-
}
|
|
6269
|
-
Buffer3.poolSize = 8192;
|
|
6270
|
-
function from(value, encodingOrOffset, length) {
|
|
6271
|
-
if (typeof value === "string") {
|
|
6272
|
-
return fromString(value, encodingOrOffset);
|
|
6273
|
-
}
|
|
6274
|
-
if (GlobalArrayBuffer.isView(value)) {
|
|
6275
|
-
return fromArrayView(value);
|
|
6276
|
-
}
|
|
6277
|
-
if (value == null) {
|
|
6278
|
-
throw new TypeError(
|
|
6279
|
-
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
|
|
6280
|
-
);
|
|
6281
|
-
}
|
|
6282
|
-
if (isInstance(value, GlobalArrayBuffer) || value && isInstance(value.buffer, GlobalArrayBuffer)) {
|
|
6283
|
-
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
6284
|
-
}
|
|
6285
|
-
if (typeof GlobalSharedArrayBuffer !== "undefined" && (isInstance(value, GlobalSharedArrayBuffer) || value && isInstance(value.buffer, GlobalSharedArrayBuffer))) {
|
|
6286
|
-
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
6287
|
-
}
|
|
6288
|
-
if (typeof value === "number") {
|
|
6289
|
-
throw new TypeError(
|
|
6290
|
-
'The "value" argument must not be of type number. Received type number'
|
|
6291
|
-
);
|
|
6292
|
-
}
|
|
6293
|
-
const valueOf = value.valueOf && value.valueOf();
|
|
6294
|
-
if (valueOf != null && valueOf !== value) {
|
|
6295
|
-
return Buffer3.from(valueOf, encodingOrOffset, length);
|
|
6296
|
-
}
|
|
6297
|
-
const b2 = fromObject(value);
|
|
6298
|
-
if (b2) return b2;
|
|
6299
|
-
if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
|
|
6300
|
-
return Buffer3.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
|
|
6301
|
-
}
|
|
6302
|
-
throw new TypeError(
|
|
6303
|
-
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
|
|
6304
|
-
);
|
|
6305
|
-
}
|
|
6306
|
-
Buffer3.from = function(value, encodingOrOffset, length) {
|
|
6307
|
-
return from(value, encodingOrOffset, length);
|
|
6308
|
-
};
|
|
6309
|
-
Object.setPrototypeOf(Buffer3.prototype, GlobalUint8Array.prototype);
|
|
6310
|
-
Object.setPrototypeOf(Buffer3, GlobalUint8Array);
|
|
6311
|
-
function assertSize(size) {
|
|
6312
|
-
if (typeof size !== "number") {
|
|
6313
|
-
throw new TypeError('"size" argument must be of type number');
|
|
6314
|
-
} else if (size < 0) {
|
|
6315
|
-
throw new RangeError('The value "' + size + '" is invalid for option "size"');
|
|
6316
|
-
}
|
|
6317
|
-
}
|
|
6318
|
-
function alloc(size, fill, encoding) {
|
|
6319
|
-
assertSize(size);
|
|
6320
|
-
if (size <= 0) {
|
|
6321
|
-
return createBuffer(size);
|
|
6322
|
-
}
|
|
6323
|
-
if (fill !== void 0) {
|
|
6324
|
-
return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
|
|
6325
|
-
}
|
|
6326
|
-
return createBuffer(size);
|
|
6327
|
-
}
|
|
6328
|
-
Buffer3.alloc = function(size, fill, encoding) {
|
|
6329
|
-
return alloc(size, fill, encoding);
|
|
6330
|
-
};
|
|
6331
|
-
function allocUnsafe(size) {
|
|
6332
|
-
assertSize(size);
|
|
6333
|
-
return createBuffer(size < 0 ? 0 : checked(size) | 0);
|
|
6334
|
-
}
|
|
6335
|
-
Buffer3.allocUnsafe = function(size) {
|
|
6336
|
-
return allocUnsafe(size);
|
|
6337
|
-
};
|
|
6338
|
-
Buffer3.allocUnsafeSlow = function(size) {
|
|
6339
|
-
return allocUnsafe(size);
|
|
6340
|
-
};
|
|
6341
|
-
function fromString(string, encoding) {
|
|
6342
|
-
if (typeof encoding !== "string" || encoding === "") {
|
|
6343
|
-
encoding = "utf8";
|
|
6344
|
-
}
|
|
6345
|
-
if (!Buffer3.isEncoding(encoding)) {
|
|
6346
|
-
throw new TypeError("Unknown encoding: " + encoding);
|
|
6347
|
-
}
|
|
6348
|
-
const length = byteLength2(string, encoding) | 0;
|
|
6349
|
-
let buf = createBuffer(length);
|
|
6350
|
-
const actual = buf.write(string, encoding);
|
|
6351
|
-
if (actual !== length) {
|
|
6352
|
-
buf = buf.slice(0, actual);
|
|
6353
|
-
}
|
|
6354
|
-
return buf;
|
|
6355
|
-
}
|
|
6356
|
-
function fromArrayLike(array) {
|
|
6357
|
-
const length = array.length < 0 ? 0 : checked(array.length) | 0;
|
|
6358
|
-
const buf = createBuffer(length);
|
|
6359
|
-
for (let i = 0; i < length; i += 1) {
|
|
6360
|
-
buf[i] = array[i] & 255;
|
|
6361
|
-
}
|
|
6362
|
-
return buf;
|
|
6363
|
-
}
|
|
6364
|
-
function fromArrayView(arrayView) {
|
|
6365
|
-
if (isInstance(arrayView, GlobalUint8Array)) {
|
|
6366
|
-
const copy = new GlobalUint8Array(arrayView);
|
|
6367
|
-
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
|
|
6368
|
-
}
|
|
6369
|
-
return fromArrayLike(arrayView);
|
|
6370
|
-
}
|
|
6371
|
-
function fromArrayBuffer(array, byteOffset, length) {
|
|
6372
|
-
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
6373
|
-
throw new RangeError('"offset" is outside of buffer bounds');
|
|
6374
|
-
}
|
|
6375
|
-
if (array.byteLength < byteOffset + (length || 0)) {
|
|
6376
|
-
throw new RangeError('"length" is outside of buffer bounds');
|
|
6377
|
-
}
|
|
6378
|
-
let buf;
|
|
6379
|
-
if (byteOffset === void 0 && length === void 0) {
|
|
6380
|
-
buf = new GlobalUint8Array(array);
|
|
6381
|
-
} else if (length === void 0) {
|
|
6382
|
-
buf = new GlobalUint8Array(array, byteOffset);
|
|
6383
|
-
} else {
|
|
6384
|
-
buf = new GlobalUint8Array(array, byteOffset, length);
|
|
6385
|
-
}
|
|
6386
|
-
Object.setPrototypeOf(buf, Buffer3.prototype);
|
|
6387
|
-
return buf;
|
|
6388
|
-
}
|
|
6389
|
-
function fromObject(obj) {
|
|
6390
|
-
if (Buffer3.isBuffer(obj)) {
|
|
6391
|
-
const len = checked(obj.length) | 0;
|
|
6392
|
-
const buf = createBuffer(len);
|
|
6393
|
-
if (buf.length === 0) {
|
|
6394
|
-
return buf;
|
|
6395
|
-
}
|
|
6396
|
-
obj.copy(buf, 0, 0, len);
|
|
6397
|
-
return buf;
|
|
6398
|
-
}
|
|
6399
|
-
if (obj.length !== void 0) {
|
|
6400
|
-
if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
|
|
6401
|
-
return createBuffer(0);
|
|
6402
|
-
}
|
|
6403
|
-
return fromArrayLike(obj);
|
|
6404
|
-
}
|
|
6405
|
-
if (obj.type === "Buffer" && Array.isArray(obj.data)) {
|
|
6406
|
-
return fromArrayLike(obj.data);
|
|
6407
|
-
}
|
|
6408
|
-
}
|
|
6409
|
-
function checked(length) {
|
|
6410
|
-
if (length >= K_MAX_LENGTH) {
|
|
6411
|
-
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
|
|
6412
|
-
}
|
|
6413
|
-
return length | 0;
|
|
6414
|
-
}
|
|
6415
|
-
function SlowBuffer(length) {
|
|
6416
|
-
if (+length != length) {
|
|
6417
|
-
length = 0;
|
|
6418
|
-
}
|
|
6419
|
-
return Buffer3.alloc(+length);
|
|
6420
|
-
}
|
|
6421
|
-
Buffer3.isBuffer = function isBuffer2(b2) {
|
|
6422
|
-
return b2 != null && b2._isBuffer === true && b2 !== Buffer3.prototype;
|
|
6423
|
-
};
|
|
6424
|
-
Buffer3.compare = function compare(a, b2) {
|
|
6425
|
-
if (isInstance(a, GlobalUint8Array)) a = Buffer3.from(a, a.offset, a.byteLength);
|
|
6426
|
-
if (isInstance(b2, GlobalUint8Array)) b2 = Buffer3.from(b2, b2.offset, b2.byteLength);
|
|
6427
|
-
if (!Buffer3.isBuffer(a) || !Buffer3.isBuffer(b2)) {
|
|
6428
|
-
throw new TypeError(
|
|
6429
|
-
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
6430
|
-
);
|
|
6431
|
-
}
|
|
6432
|
-
if (a === b2) return 0;
|
|
6433
|
-
let x = a.length;
|
|
6434
|
-
let y = b2.length;
|
|
6435
|
-
for (let i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
6436
|
-
if (a[i] !== b2[i]) {
|
|
6437
|
-
x = a[i];
|
|
6438
|
-
y = b2[i];
|
|
6439
|
-
break;
|
|
6440
|
-
}
|
|
6441
|
-
}
|
|
6442
|
-
if (x < y) return -1;
|
|
6443
|
-
if (y < x) return 1;
|
|
6444
|
-
return 0;
|
|
6445
|
-
};
|
|
6446
|
-
Buffer3.isEncoding = function isEncoding(encoding) {
|
|
6447
|
-
switch (String(encoding).toLowerCase()) {
|
|
6448
|
-
case "hex":
|
|
6449
|
-
case "utf8":
|
|
6450
|
-
case "utf-8":
|
|
6451
|
-
case "ascii":
|
|
6452
|
-
case "latin1":
|
|
6453
|
-
case "binary":
|
|
6454
|
-
case "base64":
|
|
6455
|
-
case "ucs2":
|
|
6456
|
-
case "ucs-2":
|
|
6457
|
-
case "utf16le":
|
|
6458
|
-
case "utf-16le":
|
|
6459
|
-
return true;
|
|
6460
|
-
default:
|
|
6461
|
-
return false;
|
|
6462
|
-
}
|
|
6463
|
-
};
|
|
6464
|
-
Buffer3.concat = function concat2(list, length) {
|
|
6465
|
-
if (!Array.isArray(list)) {
|
|
6466
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
6467
|
-
}
|
|
6468
|
-
if (list.length === 0) {
|
|
6469
|
-
return Buffer3.alloc(0);
|
|
6470
|
-
}
|
|
6471
|
-
let i;
|
|
6472
|
-
if (length === void 0) {
|
|
6473
|
-
length = 0;
|
|
6474
|
-
for (i = 0; i < list.length; ++i) {
|
|
6475
|
-
length += list[i].length;
|
|
6476
|
-
}
|
|
6477
|
-
}
|
|
6478
|
-
const buffer2 = Buffer3.allocUnsafe(length);
|
|
6479
|
-
let pos = 0;
|
|
6480
|
-
for (i = 0; i < list.length; ++i) {
|
|
6481
|
-
let buf = list[i];
|
|
6482
|
-
if (isInstance(buf, GlobalUint8Array)) {
|
|
6483
|
-
if (pos + buf.length > buffer2.length) {
|
|
6484
|
-
if (!Buffer3.isBuffer(buf)) buf = Buffer3.from(buf);
|
|
6485
|
-
buf.copy(buffer2, pos);
|
|
6486
|
-
} else {
|
|
6487
|
-
GlobalUint8Array.prototype.set.call(
|
|
6488
|
-
buffer2,
|
|
6489
|
-
buf,
|
|
6490
|
-
pos
|
|
6491
|
-
);
|
|
6492
|
-
}
|
|
6493
|
-
} else if (!Buffer3.isBuffer(buf)) {
|
|
6494
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
6495
|
-
} else {
|
|
6496
|
-
buf.copy(buffer2, pos);
|
|
6497
|
-
}
|
|
6498
|
-
pos += buf.length;
|
|
6499
|
-
}
|
|
6500
|
-
return buffer2;
|
|
6501
|
-
};
|
|
6502
|
-
function byteLength2(string, encoding) {
|
|
6503
|
-
if (Buffer3.isBuffer(string)) {
|
|
6504
|
-
return string.length;
|
|
6505
|
-
}
|
|
6506
|
-
if (GlobalArrayBuffer.isView(string) || isInstance(string, GlobalArrayBuffer)) {
|
|
6507
|
-
return string.byteLength;
|
|
6508
|
-
}
|
|
6509
|
-
if (typeof string !== "string") {
|
|
6510
|
-
throw new TypeError(
|
|
6511
|
-
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string
|
|
6512
|
-
);
|
|
6513
|
-
}
|
|
6514
|
-
const len = string.length;
|
|
6515
|
-
const mustMatch = arguments.length > 2 && arguments[2] === true;
|
|
6516
|
-
if (!mustMatch && len === 0) return 0;
|
|
6517
|
-
let loweredCase = false;
|
|
6518
|
-
for (; ; ) {
|
|
6519
|
-
switch (encoding) {
|
|
6520
|
-
case "ascii":
|
|
6521
|
-
case "latin1":
|
|
6522
|
-
case "binary":
|
|
6523
|
-
return len;
|
|
6524
|
-
case "utf8":
|
|
6525
|
-
case "utf-8":
|
|
6526
|
-
return utf8ToBytes2(string).length;
|
|
6527
|
-
case "ucs2":
|
|
6528
|
-
case "ucs-2":
|
|
6529
|
-
case "utf16le":
|
|
6530
|
-
case "utf-16le":
|
|
6531
|
-
return len * 2;
|
|
6532
|
-
case "hex":
|
|
6533
|
-
return len >>> 1;
|
|
6534
|
-
case "base64":
|
|
6535
|
-
return base64ToBytes(string).length;
|
|
6536
|
-
default:
|
|
6537
|
-
if (loweredCase) {
|
|
6538
|
-
return mustMatch ? -1 : utf8ToBytes2(string).length;
|
|
6539
|
-
}
|
|
6540
|
-
encoding = ("" + encoding).toLowerCase();
|
|
6541
|
-
loweredCase = true;
|
|
6542
|
-
}
|
|
6543
|
-
}
|
|
6544
|
-
}
|
|
6545
|
-
Buffer3.byteLength = byteLength2;
|
|
6546
|
-
function slowToString(encoding, start, end) {
|
|
6547
|
-
let loweredCase = false;
|
|
6548
|
-
if (start === void 0 || start < 0) {
|
|
6549
|
-
start = 0;
|
|
6550
|
-
}
|
|
6551
|
-
if (start > this.length) {
|
|
6552
|
-
return "";
|
|
6553
|
-
}
|
|
6554
|
-
if (end === void 0 || end > this.length) {
|
|
6555
|
-
end = this.length;
|
|
6556
|
-
}
|
|
6557
|
-
if (end <= 0) {
|
|
6558
|
-
return "";
|
|
6559
|
-
}
|
|
6560
|
-
end >>>= 0;
|
|
6561
|
-
start >>>= 0;
|
|
6562
|
-
if (end <= start) {
|
|
6563
|
-
return "";
|
|
6564
|
-
}
|
|
6565
|
-
if (!encoding) encoding = "utf8";
|
|
6566
|
-
while (true) {
|
|
6567
|
-
switch (encoding) {
|
|
6568
|
-
case "hex":
|
|
6569
|
-
return hexSlice(this, start, end);
|
|
6570
|
-
case "utf8":
|
|
6571
|
-
case "utf-8":
|
|
6572
|
-
return utf8Slice(this, start, end);
|
|
6573
|
-
case "ascii":
|
|
6574
|
-
return asciiSlice(this, start, end);
|
|
6575
|
-
case "latin1":
|
|
6576
|
-
case "binary":
|
|
6577
|
-
return latin1Slice(this, start, end);
|
|
6578
|
-
case "base64":
|
|
6579
|
-
return base64Slice(this, start, end);
|
|
6580
|
-
case "ucs2":
|
|
6581
|
-
case "ucs-2":
|
|
6582
|
-
case "utf16le":
|
|
6583
|
-
case "utf-16le":
|
|
6584
|
-
return utf16leSlice(this, start, end);
|
|
6585
|
-
default:
|
|
6586
|
-
if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
|
|
6587
|
-
encoding = (encoding + "").toLowerCase();
|
|
6588
|
-
loweredCase = true;
|
|
6589
|
-
}
|
|
6590
|
-
}
|
|
6591
|
-
}
|
|
6592
|
-
Buffer3.prototype._isBuffer = true;
|
|
6593
|
-
function swap(b2, n2, m) {
|
|
6594
|
-
const i = b2[n2];
|
|
6595
|
-
b2[n2] = b2[m];
|
|
6596
|
-
b2[m] = i;
|
|
6597
|
-
}
|
|
6598
|
-
Buffer3.prototype.swap16 = function swap16() {
|
|
6599
|
-
const len = this.length;
|
|
6600
|
-
if (len % 2 !== 0) {
|
|
6601
|
-
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
6602
|
-
}
|
|
6603
|
-
for (let i = 0; i < len; i += 2) {
|
|
6604
|
-
swap(this, i, i + 1);
|
|
6605
|
-
}
|
|
6606
|
-
return this;
|
|
6607
|
-
};
|
|
6608
|
-
Buffer3.prototype.swap32 = function swap32() {
|
|
6609
|
-
const len = this.length;
|
|
6610
|
-
if (len % 4 !== 0) {
|
|
6611
|
-
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
6612
|
-
}
|
|
6613
|
-
for (let i = 0; i < len; i += 4) {
|
|
6614
|
-
swap(this, i, i + 3);
|
|
6615
|
-
swap(this, i + 1, i + 2);
|
|
6616
|
-
}
|
|
6617
|
-
return this;
|
|
6618
|
-
};
|
|
6619
|
-
Buffer3.prototype.swap64 = function swap64() {
|
|
6620
|
-
const len = this.length;
|
|
6621
|
-
if (len % 8 !== 0) {
|
|
6622
|
-
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
6623
|
-
}
|
|
6624
|
-
for (let i = 0; i < len; i += 8) {
|
|
6625
|
-
swap(this, i, i + 7);
|
|
6626
|
-
swap(this, i + 1, i + 6);
|
|
6627
|
-
swap(this, i + 2, i + 5);
|
|
6628
|
-
swap(this, i + 3, i + 4);
|
|
6629
|
-
}
|
|
6630
|
-
return this;
|
|
6631
|
-
};
|
|
6632
|
-
Buffer3.prototype.toString = function toString4() {
|
|
6633
|
-
const length = this.length;
|
|
6634
|
-
if (length === 0) return "";
|
|
6635
|
-
if (arguments.length === 0) return utf8Slice(this, 0, length);
|
|
6636
|
-
return slowToString.apply(this, arguments);
|
|
6637
|
-
};
|
|
6638
|
-
Buffer3.prototype.toLocaleString = Buffer3.prototype.toString;
|
|
6639
|
-
Buffer3.prototype.equals = function equals(b2) {
|
|
6640
|
-
if (!Buffer3.isBuffer(b2)) throw new TypeError("Argument must be a Buffer");
|
|
6641
|
-
if (this === b2) return true;
|
|
6642
|
-
return Buffer3.compare(this, b2) === 0;
|
|
6643
|
-
};
|
|
6644
|
-
Buffer3.prototype.inspect = function inspect() {
|
|
6645
|
-
let str = "";
|
|
6646
|
-
const max2 = exports.INSPECT_MAX_BYTES;
|
|
6647
|
-
str = this.toString("hex", 0, max2).replace(/(.{2})/g, "$1 ").trim();
|
|
6648
|
-
if (this.length > max2) str += " ... ";
|
|
6649
|
-
return "<Buffer " + str + ">";
|
|
6650
|
-
};
|
|
6651
|
-
if (customInspectSymbol) {
|
|
6652
|
-
Buffer3.prototype[customInspectSymbol] = Buffer3.prototype.inspect;
|
|
6653
|
-
}
|
|
6654
|
-
Buffer3.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
|
|
6655
|
-
if (isInstance(target, GlobalUint8Array)) {
|
|
6656
|
-
target = Buffer3.from(target, target.offset, target.byteLength);
|
|
6657
|
-
}
|
|
6658
|
-
if (!Buffer3.isBuffer(target)) {
|
|
6659
|
-
throw new TypeError(
|
|
6660
|
-
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target
|
|
6661
|
-
);
|
|
6662
|
-
}
|
|
6663
|
-
if (start === void 0) {
|
|
6664
|
-
start = 0;
|
|
6665
|
-
}
|
|
6666
|
-
if (end === void 0) {
|
|
6667
|
-
end = target ? target.length : 0;
|
|
6668
|
-
}
|
|
6669
|
-
if (thisStart === void 0) {
|
|
6670
|
-
thisStart = 0;
|
|
6671
|
-
}
|
|
6672
|
-
if (thisEnd === void 0) {
|
|
6673
|
-
thisEnd = this.length;
|
|
6674
|
-
}
|
|
6675
|
-
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
6676
|
-
throw new RangeError("out of range index");
|
|
6677
|
-
}
|
|
6678
|
-
if (thisStart >= thisEnd && start >= end) {
|
|
6679
|
-
return 0;
|
|
6680
|
-
}
|
|
6681
|
-
if (thisStart >= thisEnd) {
|
|
6682
|
-
return -1;
|
|
6683
|
-
}
|
|
6684
|
-
if (start >= end) {
|
|
6685
|
-
return 1;
|
|
6686
|
-
}
|
|
6687
|
-
start >>>= 0;
|
|
6688
|
-
end >>>= 0;
|
|
6689
|
-
thisStart >>>= 0;
|
|
6690
|
-
thisEnd >>>= 0;
|
|
6691
|
-
if (this === target) return 0;
|
|
6692
|
-
let x = thisEnd - thisStart;
|
|
6693
|
-
let y = end - start;
|
|
6694
|
-
const len = Math.min(x, y);
|
|
6695
|
-
const thisCopy = this.slice(thisStart, thisEnd);
|
|
6696
|
-
const targetCopy = target.slice(start, end);
|
|
6697
|
-
for (let i = 0; i < len; ++i) {
|
|
6698
|
-
if (thisCopy[i] !== targetCopy[i]) {
|
|
6699
|
-
x = thisCopy[i];
|
|
6700
|
-
y = targetCopy[i];
|
|
6701
|
-
break;
|
|
6702
|
-
}
|
|
6703
|
-
}
|
|
6704
|
-
if (x < y) return -1;
|
|
6705
|
-
if (y < x) return 1;
|
|
6706
|
-
return 0;
|
|
6707
|
-
};
|
|
6708
|
-
function bidirectionalIndexOf(buffer2, val, byteOffset, encoding, dir) {
|
|
6709
|
-
if (buffer2.length === 0) return -1;
|
|
6710
|
-
if (typeof byteOffset === "string") {
|
|
6711
|
-
encoding = byteOffset;
|
|
6712
|
-
byteOffset = 0;
|
|
6713
|
-
} else if (byteOffset > 2147483647) {
|
|
6714
|
-
byteOffset = 2147483647;
|
|
6715
|
-
} else if (byteOffset < -2147483648) {
|
|
6716
|
-
byteOffset = -2147483648;
|
|
6717
|
-
}
|
|
6718
|
-
byteOffset = +byteOffset;
|
|
6719
|
-
if (numberIsNaN(byteOffset)) {
|
|
6720
|
-
byteOffset = dir ? 0 : buffer2.length - 1;
|
|
6721
|
-
}
|
|
6722
|
-
if (byteOffset < 0) byteOffset = buffer2.length + byteOffset;
|
|
6723
|
-
if (byteOffset >= buffer2.length) {
|
|
6724
|
-
if (dir) return -1;
|
|
6725
|
-
else byteOffset = buffer2.length - 1;
|
|
6726
|
-
} else if (byteOffset < 0) {
|
|
6727
|
-
if (dir) byteOffset = 0;
|
|
6728
|
-
else return -1;
|
|
6729
|
-
}
|
|
6730
|
-
if (typeof val === "string") {
|
|
6731
|
-
val = Buffer3.from(val, encoding);
|
|
6732
|
-
}
|
|
6733
|
-
if (Buffer3.isBuffer(val)) {
|
|
6734
|
-
if (val.length === 0) {
|
|
6735
|
-
return -1;
|
|
6736
|
-
}
|
|
6737
|
-
return arrayIndexOf(buffer2, val, byteOffset, encoding, dir);
|
|
6738
|
-
} else if (typeof val === "number") {
|
|
6739
|
-
val = val & 255;
|
|
6740
|
-
if (typeof GlobalUint8Array.prototype.indexOf === "function") {
|
|
6741
|
-
if (dir) {
|
|
6742
|
-
return GlobalUint8Array.prototype.indexOf.call(buffer2, val, byteOffset);
|
|
6743
|
-
} else {
|
|
6744
|
-
return GlobalUint8Array.prototype.lastIndexOf.call(buffer2, val, byteOffset);
|
|
6745
|
-
}
|
|
6746
|
-
}
|
|
6747
|
-
return arrayIndexOf(buffer2, [val], byteOffset, encoding, dir);
|
|
6748
|
-
}
|
|
6749
|
-
throw new TypeError("val must be string, number or Buffer");
|
|
6750
|
-
}
|
|
6751
|
-
function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
|
|
6752
|
-
let indexSize = 1;
|
|
6753
|
-
let arrLength = arr.length;
|
|
6754
|
-
let valLength = val.length;
|
|
6755
|
-
if (encoding !== void 0) {
|
|
6756
|
-
encoding = String(encoding).toLowerCase();
|
|
6757
|
-
if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
|
|
6758
|
-
if (arr.length < 2 || val.length < 2) {
|
|
6759
|
-
return -1;
|
|
6760
|
-
}
|
|
6761
|
-
indexSize = 2;
|
|
6762
|
-
arrLength /= 2;
|
|
6763
|
-
valLength /= 2;
|
|
6764
|
-
byteOffset /= 2;
|
|
6765
|
-
}
|
|
6766
|
-
}
|
|
6767
|
-
function read(buf, i2) {
|
|
6768
|
-
if (indexSize === 1) {
|
|
6769
|
-
return buf[i2];
|
|
6770
|
-
} else {
|
|
6771
|
-
return buf.readUInt16BE(i2 * indexSize);
|
|
6772
|
-
}
|
|
6773
|
-
}
|
|
6774
|
-
let i;
|
|
6775
|
-
if (dir) {
|
|
6776
|
-
let foundIndex = -1;
|
|
6777
|
-
for (i = byteOffset; i < arrLength; i++) {
|
|
6778
|
-
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
6779
|
-
if (foundIndex === -1) foundIndex = i;
|
|
6780
|
-
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
|
|
6781
|
-
} else {
|
|
6782
|
-
if (foundIndex !== -1) i -= i - foundIndex;
|
|
6783
|
-
foundIndex = -1;
|
|
6784
|
-
}
|
|
6785
|
-
}
|
|
6786
|
-
} else {
|
|
6787
|
-
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
|
|
6788
|
-
for (i = byteOffset; i >= 0; i--) {
|
|
6789
|
-
let found = true;
|
|
6790
|
-
for (let j = 0; j < valLength; j++) {
|
|
6791
|
-
if (read(arr, i + j) !== read(val, j)) {
|
|
6792
|
-
found = false;
|
|
6793
|
-
break;
|
|
6794
|
-
}
|
|
6795
|
-
}
|
|
6796
|
-
if (found) return i;
|
|
6797
|
-
}
|
|
6798
|
-
}
|
|
6799
|
-
return -1;
|
|
6800
|
-
}
|
|
6801
|
-
Buffer3.prototype.includes = function includes2(val, byteOffset, encoding) {
|
|
6802
|
-
return this.indexOf(val, byteOffset, encoding) !== -1;
|
|
6803
|
-
};
|
|
6804
|
-
Buffer3.prototype.indexOf = function indexOf2(val, byteOffset, encoding) {
|
|
6805
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
|
|
6806
|
-
};
|
|
6807
|
-
Buffer3.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
|
|
6808
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
|
|
6809
|
-
};
|
|
6810
|
-
function hexWrite(buf, string, offset, length) {
|
|
6811
|
-
offset = Number(offset) || 0;
|
|
6812
|
-
const remaining = buf.length - offset;
|
|
6813
|
-
if (!length) {
|
|
6814
|
-
length = remaining;
|
|
6815
|
-
} else {
|
|
6816
|
-
length = Number(length);
|
|
6817
|
-
if (length > remaining) {
|
|
6818
|
-
length = remaining;
|
|
6819
|
-
}
|
|
6820
|
-
}
|
|
6821
|
-
const strLen = string.length;
|
|
6822
|
-
if (length > strLen / 2) {
|
|
6823
|
-
length = strLen / 2;
|
|
6824
|
-
}
|
|
6825
|
-
let i;
|
|
6826
|
-
for (i = 0; i < length; ++i) {
|
|
6827
|
-
const parsed = parseInt(string.substr(i * 2, 2), 16);
|
|
6828
|
-
if (numberIsNaN(parsed)) return i;
|
|
6829
|
-
buf[offset + i] = parsed;
|
|
6830
|
-
}
|
|
6831
|
-
return i;
|
|
6832
|
-
}
|
|
6833
|
-
function utf8Write(buf, string, offset, length) {
|
|
6834
|
-
return blitBuffer(utf8ToBytes2(string, buf.length - offset), buf, offset, length);
|
|
6835
|
-
}
|
|
6836
|
-
function asciiWrite(buf, string, offset, length) {
|
|
6837
|
-
return blitBuffer(asciiToBytes(string), buf, offset, length);
|
|
6838
|
-
}
|
|
6839
|
-
function base64Write(buf, string, offset, length) {
|
|
6840
|
-
return blitBuffer(base64ToBytes(string), buf, offset, length);
|
|
6841
|
-
}
|
|
6842
|
-
function ucs2Write(buf, string, offset, length) {
|
|
6843
|
-
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
|
|
6844
|
-
}
|
|
6845
|
-
Buffer3.prototype.write = function write(string, offset, length, encoding) {
|
|
6846
|
-
if (offset === void 0) {
|
|
6847
|
-
encoding = "utf8";
|
|
6848
|
-
length = this.length;
|
|
6849
|
-
offset = 0;
|
|
6850
|
-
} else if (length === void 0 && typeof offset === "string") {
|
|
6851
|
-
encoding = offset;
|
|
6852
|
-
length = this.length;
|
|
6853
|
-
offset = 0;
|
|
6854
|
-
} else if (isFinite(offset)) {
|
|
6855
|
-
offset = offset >>> 0;
|
|
6856
|
-
if (isFinite(length)) {
|
|
6857
|
-
length = length >>> 0;
|
|
6858
|
-
if (encoding === void 0) encoding = "utf8";
|
|
6859
|
-
} else {
|
|
6860
|
-
encoding = length;
|
|
6861
|
-
length = void 0;
|
|
6862
|
-
}
|
|
6863
|
-
} else {
|
|
6864
|
-
throw new Error(
|
|
6865
|
-
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
|
|
6866
|
-
);
|
|
6867
|
-
}
|
|
6868
|
-
const remaining = this.length - offset;
|
|
6869
|
-
if (length === void 0 || length > remaining) length = remaining;
|
|
6870
|
-
if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
|
|
6871
|
-
throw new RangeError("Attempt to write outside buffer bounds");
|
|
6872
|
-
}
|
|
6873
|
-
if (!encoding) encoding = "utf8";
|
|
6874
|
-
let loweredCase = false;
|
|
6875
|
-
for (; ; ) {
|
|
6876
|
-
switch (encoding) {
|
|
6877
|
-
case "hex":
|
|
6878
|
-
return hexWrite(this, string, offset, length);
|
|
6879
|
-
case "utf8":
|
|
6880
|
-
case "utf-8":
|
|
6881
|
-
return utf8Write(this, string, offset, length);
|
|
6882
|
-
case "ascii":
|
|
6883
|
-
case "latin1":
|
|
6884
|
-
case "binary":
|
|
6885
|
-
return asciiWrite(this, string, offset, length);
|
|
6886
|
-
case "base64":
|
|
6887
|
-
return base64Write(this, string, offset, length);
|
|
6888
|
-
case "ucs2":
|
|
6889
|
-
case "ucs-2":
|
|
6890
|
-
case "utf16le":
|
|
6891
|
-
case "utf-16le":
|
|
6892
|
-
return ucs2Write(this, string, offset, length);
|
|
6893
|
-
default:
|
|
6894
|
-
if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
|
|
6895
|
-
encoding = ("" + encoding).toLowerCase();
|
|
6896
|
-
loweredCase = true;
|
|
6897
|
-
}
|
|
6898
|
-
}
|
|
6899
|
-
};
|
|
6900
|
-
Buffer3.prototype.toJSON = function toJSON3() {
|
|
6901
|
-
return {
|
|
6902
|
-
type: "Buffer",
|
|
6903
|
-
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
6904
|
-
};
|
|
6905
|
-
};
|
|
6906
|
-
function base64Slice(buf, start, end) {
|
|
6907
|
-
if (start === 0 && end === buf.length) {
|
|
6908
|
-
return base64.fromByteArray(buf);
|
|
6909
|
-
} else {
|
|
6910
|
-
return base64.fromByteArray(buf.slice(start, end));
|
|
6911
|
-
}
|
|
6912
|
-
}
|
|
6913
|
-
function utf8Slice(buf, start, end) {
|
|
6914
|
-
end = Math.min(buf.length, end);
|
|
6915
|
-
const res = [];
|
|
6916
|
-
let i = start;
|
|
6917
|
-
while (i < end) {
|
|
6918
|
-
const firstByte = buf[i];
|
|
6919
|
-
let codePoint = null;
|
|
6920
|
-
let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
|
|
6921
|
-
if (i + bytesPerSequence <= end) {
|
|
6922
|
-
let secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
6923
|
-
switch (bytesPerSequence) {
|
|
6924
|
-
case 1:
|
|
6925
|
-
if (firstByte < 128) {
|
|
6926
|
-
codePoint = firstByte;
|
|
6927
|
-
}
|
|
6928
|
-
break;
|
|
6929
|
-
case 2:
|
|
6930
|
-
secondByte = buf[i + 1];
|
|
6931
|
-
if ((secondByte & 192) === 128) {
|
|
6932
|
-
tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
|
|
6933
|
-
if (tempCodePoint > 127) {
|
|
6934
|
-
codePoint = tempCodePoint;
|
|
6935
|
-
}
|
|
6936
|
-
}
|
|
6937
|
-
break;
|
|
6938
|
-
case 3:
|
|
6939
|
-
secondByte = buf[i + 1];
|
|
6940
|
-
thirdByte = buf[i + 2];
|
|
6941
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
|
|
6942
|
-
tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
|
|
6943
|
-
if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
|
|
6944
|
-
codePoint = tempCodePoint;
|
|
6945
|
-
}
|
|
6946
|
-
}
|
|
6947
|
-
break;
|
|
6948
|
-
case 4:
|
|
6949
|
-
secondByte = buf[i + 1];
|
|
6950
|
-
thirdByte = buf[i + 2];
|
|
6951
|
-
fourthByte = buf[i + 3];
|
|
6952
|
-
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
|
|
6953
|
-
tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
|
|
6954
|
-
if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
|
|
6955
|
-
codePoint = tempCodePoint;
|
|
6956
|
-
}
|
|
6957
|
-
}
|
|
6958
|
-
}
|
|
6959
|
-
}
|
|
6960
|
-
if (codePoint === null) {
|
|
6961
|
-
codePoint = 65533;
|
|
6962
|
-
bytesPerSequence = 1;
|
|
6963
|
-
} else if (codePoint > 65535) {
|
|
6964
|
-
codePoint -= 65536;
|
|
6965
|
-
res.push(codePoint >>> 10 & 1023 | 55296);
|
|
6966
|
-
codePoint = 56320 | codePoint & 1023;
|
|
6967
|
-
}
|
|
6968
|
-
res.push(codePoint);
|
|
6969
|
-
i += bytesPerSequence;
|
|
6970
|
-
}
|
|
6971
|
-
return decodeCodePointsArray(res);
|
|
6972
|
-
}
|
|
6973
|
-
const MAX_ARGUMENTS_LENGTH = 4096;
|
|
6974
|
-
function decodeCodePointsArray(codePoints) {
|
|
6975
|
-
const len = codePoints.length;
|
|
6976
|
-
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
6977
|
-
return String.fromCharCode.apply(String, codePoints);
|
|
6978
|
-
}
|
|
6979
|
-
let res = "";
|
|
6980
|
-
let i = 0;
|
|
6981
|
-
while (i < len) {
|
|
6982
|
-
res += String.fromCharCode.apply(
|
|
6983
|
-
String,
|
|
6984
|
-
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
6985
|
-
);
|
|
6986
|
-
}
|
|
6987
|
-
return res;
|
|
6988
|
-
}
|
|
6989
|
-
function asciiSlice(buf, start, end) {
|
|
6990
|
-
let ret = "";
|
|
6991
|
-
end = Math.min(buf.length, end);
|
|
6992
|
-
for (let i = start; i < end; ++i) {
|
|
6993
|
-
ret += String.fromCharCode(buf[i] & 127);
|
|
6994
|
-
}
|
|
6995
|
-
return ret;
|
|
6996
|
-
}
|
|
6997
|
-
function latin1Slice(buf, start, end) {
|
|
6998
|
-
let ret = "";
|
|
6999
|
-
end = Math.min(buf.length, end);
|
|
7000
|
-
for (let i = start; i < end; ++i) {
|
|
7001
|
-
ret += String.fromCharCode(buf[i]);
|
|
7002
|
-
}
|
|
7003
|
-
return ret;
|
|
7004
|
-
}
|
|
7005
|
-
function hexSlice(buf, start, end) {
|
|
7006
|
-
const len = buf.length;
|
|
7007
|
-
if (!start || start < 0) start = 0;
|
|
7008
|
-
if (!end || end < 0 || end > len) end = len;
|
|
7009
|
-
let out = "";
|
|
7010
|
-
for (let i = start; i < end; ++i) {
|
|
7011
|
-
out += hexSliceLookupTable[buf[i]];
|
|
7012
|
-
}
|
|
7013
|
-
return out;
|
|
7014
|
-
}
|
|
7015
|
-
function utf16leSlice(buf, start, end) {
|
|
7016
|
-
const bytes2 = buf.slice(start, end);
|
|
7017
|
-
let res = "";
|
|
7018
|
-
for (let i = 0; i < bytes2.length - 1; i += 2) {
|
|
7019
|
-
res += String.fromCharCode(bytes2[i] + bytes2[i + 1] * 256);
|
|
7020
|
-
}
|
|
7021
|
-
return res;
|
|
7022
|
-
}
|
|
7023
|
-
Buffer3.prototype.slice = function slice(start, end) {
|
|
7024
|
-
const len = this.length;
|
|
7025
|
-
start = ~~start;
|
|
7026
|
-
end = end === void 0 ? len : ~~end;
|
|
7027
|
-
if (start < 0) {
|
|
7028
|
-
start += len;
|
|
7029
|
-
if (start < 0) start = 0;
|
|
7030
|
-
} else if (start > len) {
|
|
7031
|
-
start = len;
|
|
7032
|
-
}
|
|
7033
|
-
if (end < 0) {
|
|
7034
|
-
end += len;
|
|
7035
|
-
if (end < 0) end = 0;
|
|
7036
|
-
} else if (end > len) {
|
|
7037
|
-
end = len;
|
|
7038
|
-
}
|
|
7039
|
-
if (end < start) end = start;
|
|
7040
|
-
const newBuf = this.subarray(start, end);
|
|
7041
|
-
Object.setPrototypeOf(newBuf, Buffer3.prototype);
|
|
7042
|
-
return newBuf;
|
|
7043
|
-
};
|
|
7044
|
-
function checkOffset(offset, ext, length) {
|
|
7045
|
-
if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
|
|
7046
|
-
if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
|
|
7047
|
-
}
|
|
7048
|
-
Buffer3.prototype.readUintLE = Buffer3.prototype.readUIntLE = function readUIntLE(offset, byteLength3, noAssert) {
|
|
7049
|
-
offset = offset >>> 0;
|
|
7050
|
-
byteLength3 = byteLength3 >>> 0;
|
|
7051
|
-
if (!noAssert) checkOffset(offset, byteLength3, this.length);
|
|
7052
|
-
let val = this[offset];
|
|
7053
|
-
let mul = 1;
|
|
7054
|
-
let i = 0;
|
|
7055
|
-
while (++i < byteLength3 && (mul *= 256)) {
|
|
7056
|
-
val += this[offset + i] * mul;
|
|
7057
|
-
}
|
|
7058
|
-
return val;
|
|
7059
|
-
};
|
|
7060
|
-
Buffer3.prototype.readUintBE = Buffer3.prototype.readUIntBE = function readUIntBE(offset, byteLength3, noAssert) {
|
|
7061
|
-
offset = offset >>> 0;
|
|
7062
|
-
byteLength3 = byteLength3 >>> 0;
|
|
7063
|
-
if (!noAssert) {
|
|
7064
|
-
checkOffset(offset, byteLength3, this.length);
|
|
7065
|
-
}
|
|
7066
|
-
let val = this[offset + --byteLength3];
|
|
7067
|
-
let mul = 1;
|
|
7068
|
-
while (byteLength3 > 0 && (mul *= 256)) {
|
|
7069
|
-
val += this[offset + --byteLength3] * mul;
|
|
7070
|
-
}
|
|
7071
|
-
return val;
|
|
7072
|
-
};
|
|
7073
|
-
Buffer3.prototype.readUint8 = Buffer3.prototype.readUInt8 = function readUInt8(offset, noAssert) {
|
|
7074
|
-
offset = offset >>> 0;
|
|
7075
|
-
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
7076
|
-
return this[offset];
|
|
7077
|
-
};
|
|
7078
|
-
Buffer3.prototype.readUint16LE = Buffer3.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
|
|
7079
|
-
offset = offset >>> 0;
|
|
7080
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
7081
|
-
return this[offset] | this[offset + 1] << 8;
|
|
7082
|
-
};
|
|
7083
|
-
Buffer3.prototype.readUint16BE = Buffer3.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
|
|
7084
|
-
offset = offset >>> 0;
|
|
7085
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
7086
|
-
return this[offset] << 8 | this[offset + 1];
|
|
7087
|
-
};
|
|
7088
|
-
Buffer3.prototype.readUint32LE = Buffer3.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
|
|
7089
|
-
offset = offset >>> 0;
|
|
7090
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
7091
|
-
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
|
|
7092
|
-
};
|
|
7093
|
-
Buffer3.prototype.readUint32BE = Buffer3.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
|
|
7094
|
-
offset = offset >>> 0;
|
|
7095
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
7096
|
-
return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
|
7097
|
-
};
|
|
7098
|
-
Buffer3.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {
|
|
7099
|
-
offset = offset >>> 0;
|
|
7100
|
-
validateNumber(offset, "offset");
|
|
7101
|
-
const first = this[offset];
|
|
7102
|
-
const last = this[offset + 7];
|
|
7103
|
-
if (first === void 0 || last === void 0) {
|
|
7104
|
-
boundsError(offset, this.length - 8);
|
|
7105
|
-
}
|
|
7106
|
-
const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;
|
|
7107
|
-
const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;
|
|
7108
|
-
return BigInt(lo) + (BigInt(hi) << BigInt(32));
|
|
7109
|
-
});
|
|
7110
|
-
Buffer3.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {
|
|
7111
|
-
offset = offset >>> 0;
|
|
7112
|
-
validateNumber(offset, "offset");
|
|
7113
|
-
const first = this[offset];
|
|
7114
|
-
const last = this[offset + 7];
|
|
7115
|
-
if (first === void 0 || last === void 0) {
|
|
7116
|
-
boundsError(offset, this.length - 8);
|
|
7117
|
-
}
|
|
7118
|
-
const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
|
|
7119
|
-
const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;
|
|
7120
|
-
return (BigInt(hi) << BigInt(32)) + BigInt(lo);
|
|
7121
|
-
});
|
|
7122
|
-
Buffer3.prototype.readIntLE = function readIntLE(offset, byteLength3, noAssert) {
|
|
7123
|
-
offset = offset >>> 0;
|
|
7124
|
-
byteLength3 = byteLength3 >>> 0;
|
|
7125
|
-
if (!noAssert) checkOffset(offset, byteLength3, this.length);
|
|
7126
|
-
let val = this[offset];
|
|
7127
|
-
let mul = 1;
|
|
7128
|
-
let i = 0;
|
|
7129
|
-
while (++i < byteLength3 && (mul *= 256)) {
|
|
7130
|
-
val += this[offset + i] * mul;
|
|
7131
|
-
}
|
|
7132
|
-
mul *= 128;
|
|
7133
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength3);
|
|
7134
|
-
return val;
|
|
7135
|
-
};
|
|
7136
|
-
Buffer3.prototype.readIntBE = function readIntBE(offset, byteLength3, noAssert) {
|
|
7137
|
-
offset = offset >>> 0;
|
|
7138
|
-
byteLength3 = byteLength3 >>> 0;
|
|
7139
|
-
if (!noAssert) checkOffset(offset, byteLength3, this.length);
|
|
7140
|
-
let i = byteLength3;
|
|
7141
|
-
let mul = 1;
|
|
7142
|
-
let val = this[offset + --i];
|
|
7143
|
-
while (i > 0 && (mul *= 256)) {
|
|
7144
|
-
val += this[offset + --i] * mul;
|
|
7145
|
-
}
|
|
7146
|
-
mul *= 128;
|
|
7147
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength3);
|
|
7148
|
-
return val;
|
|
7149
|
-
};
|
|
7150
|
-
Buffer3.prototype.readInt8 = function readInt8(offset, noAssert) {
|
|
7151
|
-
offset = offset >>> 0;
|
|
7152
|
-
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
7153
|
-
if (!(this[offset] & 128)) return this[offset];
|
|
7154
|
-
return (255 - this[offset] + 1) * -1;
|
|
7155
|
-
};
|
|
7156
|
-
Buffer3.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
|
|
7157
|
-
offset = offset >>> 0;
|
|
7158
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
7159
|
-
const val = this[offset] | this[offset + 1] << 8;
|
|
7160
|
-
return val & 32768 ? val | 4294901760 : val;
|
|
7161
|
-
};
|
|
7162
|
-
Buffer3.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
|
|
7163
|
-
offset = offset >>> 0;
|
|
7164
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
7165
|
-
const val = this[offset + 1] | this[offset] << 8;
|
|
7166
|
-
return val & 32768 ? val | 4294901760 : val;
|
|
7167
|
-
};
|
|
7168
|
-
Buffer3.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
|
|
7169
|
-
offset = offset >>> 0;
|
|
7170
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
7171
|
-
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
|
7172
|
-
};
|
|
7173
|
-
Buffer3.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
|
|
7174
|
-
offset = offset >>> 0;
|
|
7175
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
7176
|
-
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
|
7177
|
-
};
|
|
7178
|
-
Buffer3.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {
|
|
7179
|
-
offset = offset >>> 0;
|
|
7180
|
-
validateNumber(offset, "offset");
|
|
7181
|
-
const first = this[offset];
|
|
7182
|
-
const last = this[offset + 7];
|
|
7183
|
-
if (first === void 0 || last === void 0) {
|
|
7184
|
-
boundsError(offset, this.length - 8);
|
|
7185
|
-
}
|
|
7186
|
-
const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);
|
|
7187
|
-
return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);
|
|
7188
|
-
});
|
|
7189
|
-
Buffer3.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {
|
|
7190
|
-
offset = offset >>> 0;
|
|
7191
|
-
validateNumber(offset, "offset");
|
|
7192
|
-
const first = this[offset];
|
|
7193
|
-
const last = this[offset + 7];
|
|
7194
|
-
if (first === void 0 || last === void 0) {
|
|
7195
|
-
boundsError(offset, this.length - 8);
|
|
7196
|
-
}
|
|
7197
|
-
const val = (first << 24) + // Overflow
|
|
7198
|
-
this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
|
|
7199
|
-
return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);
|
|
7200
|
-
});
|
|
7201
|
-
Buffer3.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
|
|
7202
|
-
offset = offset >>> 0;
|
|
7203
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
7204
|
-
return ieee754$12.read(this, offset, true, 23, 4);
|
|
7205
|
-
};
|
|
7206
|
-
Buffer3.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
|
|
7207
|
-
offset = offset >>> 0;
|
|
7208
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
7209
|
-
return ieee754$12.read(this, offset, false, 23, 4);
|
|
7210
|
-
};
|
|
7211
|
-
Buffer3.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
|
|
7212
|
-
offset = offset >>> 0;
|
|
7213
|
-
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
7214
|
-
return ieee754$12.read(this, offset, true, 52, 8);
|
|
7215
|
-
};
|
|
7216
|
-
Buffer3.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
|
|
7217
|
-
offset = offset >>> 0;
|
|
7218
|
-
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
7219
|
-
return ieee754$12.read(this, offset, false, 52, 8);
|
|
7220
|
-
};
|
|
7221
|
-
function checkInt(buf, value, offset, ext, max2, min) {
|
|
7222
|
-
if (!Buffer3.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
7223
|
-
if (value > max2 || value < min) throw new RangeError('"value" argument is out of bounds');
|
|
7224
|
-
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
7225
|
-
}
|
|
7226
|
-
Buffer3.prototype.writeUintLE = Buffer3.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength3, noAssert) {
|
|
7227
|
-
value = +value;
|
|
7228
|
-
offset = offset >>> 0;
|
|
7229
|
-
byteLength3 = byteLength3 >>> 0;
|
|
7230
|
-
if (!noAssert) {
|
|
7231
|
-
const maxBytes = Math.pow(2, 8 * byteLength3) - 1;
|
|
7232
|
-
checkInt(this, value, offset, byteLength3, maxBytes, 0);
|
|
7233
|
-
}
|
|
7234
|
-
let mul = 1;
|
|
7235
|
-
let i = 0;
|
|
7236
|
-
this[offset] = value & 255;
|
|
7237
|
-
while (++i < byteLength3 && (mul *= 256)) {
|
|
7238
|
-
this[offset + i] = value / mul & 255;
|
|
7239
|
-
}
|
|
7240
|
-
return offset + byteLength3;
|
|
7241
|
-
};
|
|
7242
|
-
Buffer3.prototype.writeUintBE = Buffer3.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength3, noAssert) {
|
|
7243
|
-
value = +value;
|
|
7244
|
-
offset = offset >>> 0;
|
|
7245
|
-
byteLength3 = byteLength3 >>> 0;
|
|
7246
|
-
if (!noAssert) {
|
|
7247
|
-
const maxBytes = Math.pow(2, 8 * byteLength3) - 1;
|
|
7248
|
-
checkInt(this, value, offset, byteLength3, maxBytes, 0);
|
|
7249
|
-
}
|
|
7250
|
-
let i = byteLength3 - 1;
|
|
7251
|
-
let mul = 1;
|
|
7252
|
-
this[offset + i] = value & 255;
|
|
7253
|
-
while (--i >= 0 && (mul *= 256)) {
|
|
7254
|
-
this[offset + i] = value / mul & 255;
|
|
7255
|
-
}
|
|
7256
|
-
return offset + byteLength3;
|
|
7257
|
-
};
|
|
7258
|
-
Buffer3.prototype.writeUint8 = Buffer3.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
|
|
7259
|
-
value = +value;
|
|
7260
|
-
offset = offset >>> 0;
|
|
7261
|
-
if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
|
|
7262
|
-
this[offset] = value & 255;
|
|
7263
|
-
return offset + 1;
|
|
7264
|
-
};
|
|
7265
|
-
Buffer3.prototype.writeUint16LE = Buffer3.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
|
|
7266
|
-
value = +value;
|
|
7267
|
-
offset = offset >>> 0;
|
|
7268
|
-
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
7269
|
-
this[offset] = value & 255;
|
|
7270
|
-
this[offset + 1] = value >>> 8;
|
|
7271
|
-
return offset + 2;
|
|
7272
|
-
};
|
|
7273
|
-
Buffer3.prototype.writeUint16BE = Buffer3.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
|
|
7274
|
-
value = +value;
|
|
7275
|
-
offset = offset >>> 0;
|
|
7276
|
-
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
7277
|
-
this[offset] = value >>> 8;
|
|
7278
|
-
this[offset + 1] = value & 255;
|
|
7279
|
-
return offset + 2;
|
|
7280
|
-
};
|
|
7281
|
-
Buffer3.prototype.writeUint32LE = Buffer3.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
|
|
7282
|
-
value = +value;
|
|
7283
|
-
offset = offset >>> 0;
|
|
7284
|
-
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
7285
|
-
this[offset + 3] = value >>> 24;
|
|
7286
|
-
this[offset + 2] = value >>> 16;
|
|
7287
|
-
this[offset + 1] = value >>> 8;
|
|
7288
|
-
this[offset] = value & 255;
|
|
7289
|
-
return offset + 4;
|
|
7290
|
-
};
|
|
7291
|
-
Buffer3.prototype.writeUint32BE = Buffer3.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
|
|
7292
|
-
value = +value;
|
|
7293
|
-
offset = offset >>> 0;
|
|
7294
|
-
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
7295
|
-
this[offset] = value >>> 24;
|
|
7296
|
-
this[offset + 1] = value >>> 16;
|
|
7297
|
-
this[offset + 2] = value >>> 8;
|
|
7298
|
-
this[offset + 3] = value & 255;
|
|
7299
|
-
return offset + 4;
|
|
7300
|
-
};
|
|
7301
|
-
function wrtBigUInt64LE(buf, value, offset, min, max2) {
|
|
7302
|
-
checkIntBI(value, min, max2, buf, offset, 7);
|
|
7303
|
-
let lo = Number(value & BigInt(4294967295));
|
|
7304
|
-
buf[offset++] = lo;
|
|
7305
|
-
lo = lo >> 8;
|
|
7306
|
-
buf[offset++] = lo;
|
|
7307
|
-
lo = lo >> 8;
|
|
7308
|
-
buf[offset++] = lo;
|
|
7309
|
-
lo = lo >> 8;
|
|
7310
|
-
buf[offset++] = lo;
|
|
7311
|
-
let hi = Number(value >> BigInt(32) & BigInt(4294967295));
|
|
7312
|
-
buf[offset++] = hi;
|
|
7313
|
-
hi = hi >> 8;
|
|
7314
|
-
buf[offset++] = hi;
|
|
7315
|
-
hi = hi >> 8;
|
|
7316
|
-
buf[offset++] = hi;
|
|
7317
|
-
hi = hi >> 8;
|
|
7318
|
-
buf[offset++] = hi;
|
|
7319
|
-
return offset;
|
|
7320
|
-
}
|
|
7321
|
-
function wrtBigUInt64BE(buf, value, offset, min, max2) {
|
|
7322
|
-
checkIntBI(value, min, max2, buf, offset, 7);
|
|
7323
|
-
let lo = Number(value & BigInt(4294967295));
|
|
7324
|
-
buf[offset + 7] = lo;
|
|
7325
|
-
lo = lo >> 8;
|
|
7326
|
-
buf[offset + 6] = lo;
|
|
7327
|
-
lo = lo >> 8;
|
|
7328
|
-
buf[offset + 5] = lo;
|
|
7329
|
-
lo = lo >> 8;
|
|
7330
|
-
buf[offset + 4] = lo;
|
|
7331
|
-
let hi = Number(value >> BigInt(32) & BigInt(4294967295));
|
|
7332
|
-
buf[offset + 3] = hi;
|
|
7333
|
-
hi = hi >> 8;
|
|
7334
|
-
buf[offset + 2] = hi;
|
|
7335
|
-
hi = hi >> 8;
|
|
7336
|
-
buf[offset + 1] = hi;
|
|
7337
|
-
hi = hi >> 8;
|
|
7338
|
-
buf[offset] = hi;
|
|
7339
|
-
return offset + 8;
|
|
7340
|
-
}
|
|
7341
|
-
Buffer3.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {
|
|
7342
|
-
return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
7343
|
-
});
|
|
7344
|
-
Buffer3.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {
|
|
7345
|
-
return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
7346
|
-
});
|
|
7347
|
-
Buffer3.prototype.writeIntLE = function writeIntLE(value, offset, byteLength3, noAssert) {
|
|
7348
|
-
value = +value;
|
|
7349
|
-
offset = offset >>> 0;
|
|
7350
|
-
if (!noAssert) {
|
|
7351
|
-
const limit = Math.pow(2, 8 * byteLength3 - 1);
|
|
7352
|
-
checkInt(this, value, offset, byteLength3, limit - 1, -limit);
|
|
7353
|
-
}
|
|
7354
|
-
let i = 0;
|
|
7355
|
-
let mul = 1;
|
|
7356
|
-
let sub = 0;
|
|
7357
|
-
this[offset] = value & 255;
|
|
7358
|
-
while (++i < byteLength3 && (mul *= 256)) {
|
|
7359
|
-
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
7360
|
-
sub = 1;
|
|
7361
|
-
}
|
|
7362
|
-
this[offset + i] = (value / mul >> 0) - sub & 255;
|
|
7363
|
-
}
|
|
7364
|
-
return offset + byteLength3;
|
|
7365
|
-
};
|
|
7366
|
-
Buffer3.prototype.writeIntBE = function writeIntBE(value, offset, byteLength3, noAssert) {
|
|
7367
|
-
value = +value;
|
|
7368
|
-
offset = offset >>> 0;
|
|
7369
|
-
if (!noAssert) {
|
|
7370
|
-
const limit = Math.pow(2, 8 * byteLength3 - 1);
|
|
7371
|
-
checkInt(this, value, offset, byteLength3, limit - 1, -limit);
|
|
7372
|
-
}
|
|
7373
|
-
let i = byteLength3 - 1;
|
|
7374
|
-
let mul = 1;
|
|
7375
|
-
let sub = 0;
|
|
7376
|
-
this[offset + i] = value & 255;
|
|
7377
|
-
while (--i >= 0 && (mul *= 256)) {
|
|
7378
|
-
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
7379
|
-
sub = 1;
|
|
7380
|
-
}
|
|
7381
|
-
this[offset + i] = (value / mul >> 0) - sub & 255;
|
|
7382
|
-
}
|
|
7383
|
-
return offset + byteLength3;
|
|
7384
|
-
};
|
|
7385
|
-
Buffer3.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
|
|
7386
|
-
value = +value;
|
|
7387
|
-
offset = offset >>> 0;
|
|
7388
|
-
if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
|
|
7389
|
-
if (value < 0) value = 255 + value + 1;
|
|
7390
|
-
this[offset] = value & 255;
|
|
7391
|
-
return offset + 1;
|
|
7392
|
-
};
|
|
7393
|
-
Buffer3.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
|
|
7394
|
-
value = +value;
|
|
7395
|
-
offset = offset >>> 0;
|
|
7396
|
-
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
7397
|
-
this[offset] = value & 255;
|
|
7398
|
-
this[offset + 1] = value >>> 8;
|
|
7399
|
-
return offset + 2;
|
|
7400
|
-
};
|
|
7401
|
-
Buffer3.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
|
|
7402
|
-
value = +value;
|
|
7403
|
-
offset = offset >>> 0;
|
|
7404
|
-
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
7405
|
-
this[offset] = value >>> 8;
|
|
7406
|
-
this[offset + 1] = value & 255;
|
|
7407
|
-
return offset + 2;
|
|
7408
|
-
};
|
|
7409
|
-
Buffer3.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
|
|
7410
|
-
value = +value;
|
|
7411
|
-
offset = offset >>> 0;
|
|
7412
|
-
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
7413
|
-
this[offset] = value & 255;
|
|
7414
|
-
this[offset + 1] = value >>> 8;
|
|
7415
|
-
this[offset + 2] = value >>> 16;
|
|
7416
|
-
this[offset + 3] = value >>> 24;
|
|
7417
|
-
return offset + 4;
|
|
7418
|
-
};
|
|
7419
|
-
Buffer3.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
|
|
7420
|
-
value = +value;
|
|
7421
|
-
offset = offset >>> 0;
|
|
7422
|
-
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
7423
|
-
if (value < 0) value = 4294967295 + value + 1;
|
|
7424
|
-
this[offset] = value >>> 24;
|
|
7425
|
-
this[offset + 1] = value >>> 16;
|
|
7426
|
-
this[offset + 2] = value >>> 8;
|
|
7427
|
-
this[offset + 3] = value & 255;
|
|
7428
|
-
return offset + 4;
|
|
7429
|
-
};
|
|
7430
|
-
Buffer3.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {
|
|
7431
|
-
return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
7432
|
-
});
|
|
7433
|
-
Buffer3.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {
|
|
7434
|
-
return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
7435
|
-
});
|
|
7436
|
-
function checkIEEE754(buf, value, offset, ext, max2, min) {
|
|
7437
|
-
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
7438
|
-
if (offset < 0) throw new RangeError("Index out of range");
|
|
7439
|
-
}
|
|
7440
|
-
function writeFloat(buf, value, offset, littleEndian, noAssert) {
|
|
7441
|
-
value = +value;
|
|
7442
|
-
offset = offset >>> 0;
|
|
7443
|
-
if (!noAssert) {
|
|
7444
|
-
checkIEEE754(buf, value, offset, 4);
|
|
7445
|
-
}
|
|
7446
|
-
ieee754$12.write(buf, value, offset, littleEndian, 23, 4);
|
|
7447
|
-
return offset + 4;
|
|
7448
|
-
}
|
|
7449
|
-
Buffer3.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
|
|
7450
|
-
return writeFloat(this, value, offset, true, noAssert);
|
|
7451
|
-
};
|
|
7452
|
-
Buffer3.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
|
|
7453
|
-
return writeFloat(this, value, offset, false, noAssert);
|
|
7454
|
-
};
|
|
7455
|
-
function writeDouble(buf, value, offset, littleEndian, noAssert) {
|
|
7456
|
-
value = +value;
|
|
7457
|
-
offset = offset >>> 0;
|
|
7458
|
-
if (!noAssert) {
|
|
7459
|
-
checkIEEE754(buf, value, offset, 8);
|
|
7460
|
-
}
|
|
7461
|
-
ieee754$12.write(buf, value, offset, littleEndian, 52, 8);
|
|
7462
|
-
return offset + 8;
|
|
7463
|
-
}
|
|
7464
|
-
Buffer3.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
|
|
7465
|
-
return writeDouble(this, value, offset, true, noAssert);
|
|
7466
|
-
};
|
|
7467
|
-
Buffer3.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
|
|
7468
|
-
return writeDouble(this, value, offset, false, noAssert);
|
|
7469
|
-
};
|
|
7470
|
-
Buffer3.prototype.copy = function copy(target, targetStart, start, end) {
|
|
7471
|
-
if (!Buffer3.isBuffer(target)) throw new TypeError("argument should be a Buffer");
|
|
7472
|
-
if (!start) start = 0;
|
|
7473
|
-
if (!end && end !== 0) end = this.length;
|
|
7474
|
-
if (targetStart >= target.length) targetStart = target.length;
|
|
7475
|
-
if (!targetStart) targetStart = 0;
|
|
7476
|
-
if (end > 0 && end < start) end = start;
|
|
7477
|
-
if (end === start) return 0;
|
|
7478
|
-
if (target.length === 0 || this.length === 0) return 0;
|
|
7479
|
-
if (targetStart < 0) {
|
|
7480
|
-
throw new RangeError("targetStart out of bounds");
|
|
7481
|
-
}
|
|
7482
|
-
if (start < 0 || start >= this.length) throw new RangeError("Index out of range");
|
|
7483
|
-
if (end < 0) throw new RangeError("sourceEnd out of bounds");
|
|
7484
|
-
if (end > this.length) end = this.length;
|
|
7485
|
-
if (target.length - targetStart < end - start) {
|
|
7486
|
-
end = target.length - targetStart + start;
|
|
7487
|
-
}
|
|
7488
|
-
const len = end - start;
|
|
7489
|
-
if (this === target && typeof GlobalUint8Array.prototype.copyWithin === "function") {
|
|
7490
|
-
this.copyWithin(targetStart, start, end);
|
|
7491
|
-
} else {
|
|
7492
|
-
GlobalUint8Array.prototype.set.call(
|
|
7493
|
-
target,
|
|
7494
|
-
this.subarray(start, end),
|
|
7495
|
-
targetStart
|
|
7496
|
-
);
|
|
7497
|
-
}
|
|
7498
|
-
return len;
|
|
7499
|
-
};
|
|
7500
|
-
Buffer3.prototype.fill = function fill(val, start, end, encoding) {
|
|
7501
|
-
if (typeof val === "string") {
|
|
7502
|
-
if (typeof start === "string") {
|
|
7503
|
-
encoding = start;
|
|
7504
|
-
start = 0;
|
|
7505
|
-
end = this.length;
|
|
7506
|
-
} else if (typeof end === "string") {
|
|
7507
|
-
encoding = end;
|
|
7508
|
-
end = this.length;
|
|
7509
|
-
}
|
|
7510
|
-
if (encoding !== void 0 && typeof encoding !== "string") {
|
|
7511
|
-
throw new TypeError("encoding must be a string");
|
|
7512
|
-
}
|
|
7513
|
-
if (typeof encoding === "string" && !Buffer3.isEncoding(encoding)) {
|
|
7514
|
-
throw new TypeError("Unknown encoding: " + encoding);
|
|
7515
|
-
}
|
|
7516
|
-
if (val.length === 1) {
|
|
7517
|
-
const code2 = val.charCodeAt(0);
|
|
7518
|
-
if (encoding === "utf8" && code2 < 128 || encoding === "latin1") {
|
|
7519
|
-
val = code2;
|
|
7520
|
-
}
|
|
7521
|
-
}
|
|
7522
|
-
} else if (typeof val === "number") {
|
|
7523
|
-
val = val & 255;
|
|
7524
|
-
} else if (typeof val === "boolean") {
|
|
7525
|
-
val = Number(val);
|
|
7526
|
-
}
|
|
7527
|
-
if (start < 0 || this.length < start || this.length < end) {
|
|
7528
|
-
throw new RangeError("Out of range index");
|
|
7529
|
-
}
|
|
7530
|
-
if (end <= start) {
|
|
7531
|
-
return this;
|
|
7532
|
-
}
|
|
7533
|
-
start = start >>> 0;
|
|
7534
|
-
end = end === void 0 ? this.length : end >>> 0;
|
|
7535
|
-
if (!val) val = 0;
|
|
7536
|
-
let i;
|
|
7537
|
-
if (typeof val === "number") {
|
|
7538
|
-
for (i = start; i < end; ++i) {
|
|
7539
|
-
this[i] = val;
|
|
7540
|
-
}
|
|
7541
|
-
} else {
|
|
7542
|
-
const bytes2 = Buffer3.isBuffer(val) ? val : Buffer3.from(val, encoding);
|
|
7543
|
-
const len = bytes2.length;
|
|
7544
|
-
if (len === 0) {
|
|
7545
|
-
throw new TypeError('The value "' + val + '" is invalid for argument "value"');
|
|
7546
|
-
}
|
|
7547
|
-
for (i = 0; i < end - start; ++i) {
|
|
7548
|
-
this[i + start] = bytes2[i % len];
|
|
7549
|
-
}
|
|
7550
|
-
}
|
|
7551
|
-
return this;
|
|
7552
|
-
};
|
|
7553
|
-
const errors = {};
|
|
7554
|
-
function E(sym, getMessage, Base) {
|
|
7555
|
-
errors[sym] = class NodeError extends Base {
|
|
7556
|
-
constructor() {
|
|
7557
|
-
super();
|
|
7558
|
-
Object.defineProperty(this, "message", {
|
|
7559
|
-
value: getMessage.apply(this, arguments),
|
|
7560
|
-
writable: true,
|
|
7561
|
-
configurable: true
|
|
7562
|
-
});
|
|
7563
|
-
this.name = `${this.name} [${sym}]`;
|
|
7564
|
-
this.stack;
|
|
7565
|
-
delete this.name;
|
|
7566
|
-
}
|
|
7567
|
-
get code() {
|
|
7568
|
-
return sym;
|
|
7569
|
-
}
|
|
7570
|
-
set code(value) {
|
|
7571
|
-
Object.defineProperty(this, "code", {
|
|
7572
|
-
configurable: true,
|
|
7573
|
-
enumerable: true,
|
|
7574
|
-
value,
|
|
7575
|
-
writable: true
|
|
7576
|
-
});
|
|
7577
|
-
}
|
|
7578
|
-
toString() {
|
|
7579
|
-
return `${this.name} [${sym}]: ${this.message}`;
|
|
7580
|
-
}
|
|
7581
|
-
};
|
|
7582
|
-
}
|
|
7583
|
-
E(
|
|
7584
|
-
"ERR_BUFFER_OUT_OF_BOUNDS",
|
|
7585
|
-
function(name) {
|
|
7586
|
-
if (name) {
|
|
7587
|
-
return `${name} is outside of buffer bounds`;
|
|
7588
|
-
}
|
|
7589
|
-
return "Attempt to access memory outside buffer bounds";
|
|
7590
|
-
},
|
|
7591
|
-
RangeError
|
|
7592
|
-
);
|
|
7593
|
-
E(
|
|
7594
|
-
"ERR_INVALID_ARG_TYPE",
|
|
7595
|
-
function(name, actual) {
|
|
7596
|
-
return `The "${name}" argument must be of type number. Received type ${typeof actual}`;
|
|
7597
|
-
},
|
|
7598
|
-
TypeError
|
|
7599
|
-
);
|
|
7600
|
-
E(
|
|
7601
|
-
"ERR_OUT_OF_RANGE",
|
|
7602
|
-
function(str, range, input) {
|
|
7603
|
-
let msg = `The value of "${str}" is out of range.`;
|
|
7604
|
-
let received = input;
|
|
7605
|
-
if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
|
|
7606
|
-
received = addNumericalSeparator(String(input));
|
|
7607
|
-
} else if (typeof input === "bigint") {
|
|
7608
|
-
received = String(input);
|
|
7609
|
-
if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
|
|
7610
|
-
received = addNumericalSeparator(received);
|
|
7611
|
-
}
|
|
7612
|
-
received += "n";
|
|
7613
|
-
}
|
|
7614
|
-
msg += ` It must be ${range}. Received ${received}`;
|
|
7615
|
-
return msg;
|
|
7616
|
-
},
|
|
7617
|
-
RangeError
|
|
7618
|
-
);
|
|
7619
|
-
function addNumericalSeparator(val) {
|
|
7620
|
-
let res = "";
|
|
7621
|
-
let i = val.length;
|
|
7622
|
-
const start = val[0] === "-" ? 1 : 0;
|
|
7623
|
-
for (; i >= start + 4; i -= 3) {
|
|
7624
|
-
res = `_${val.slice(i - 3, i)}${res}`;
|
|
7625
|
-
}
|
|
7626
|
-
return `${val.slice(0, i)}${res}`;
|
|
7627
|
-
}
|
|
7628
|
-
function checkBounds(buf, offset, byteLength3) {
|
|
7629
|
-
validateNumber(offset, "offset");
|
|
7630
|
-
if (buf[offset] === void 0 || buf[offset + byteLength3] === void 0) {
|
|
7631
|
-
boundsError(offset, buf.length - (byteLength3 + 1));
|
|
7632
|
-
}
|
|
7633
|
-
}
|
|
7634
|
-
function checkIntBI(value, min, max2, buf, offset, byteLength3) {
|
|
7635
|
-
if (value > max2 || value < min) {
|
|
7636
|
-
const n2 = typeof min === "bigint" ? "n" : "";
|
|
7637
|
-
let range;
|
|
7638
|
-
{
|
|
7639
|
-
if (min === 0 || min === BigInt(0)) {
|
|
7640
|
-
range = `>= 0${n2} and < 2${n2} ** ${(byteLength3 + 1) * 8}${n2}`;
|
|
7641
|
-
} else {
|
|
7642
|
-
range = `>= -(2${n2} ** ${(byteLength3 + 1) * 8 - 1}${n2}) and < 2 ** ${(byteLength3 + 1) * 8 - 1}${n2}`;
|
|
7643
|
-
}
|
|
7644
|
-
}
|
|
7645
|
-
throw new errors.ERR_OUT_OF_RANGE("value", range, value);
|
|
7646
|
-
}
|
|
7647
|
-
checkBounds(buf, offset, byteLength3);
|
|
7648
|
-
}
|
|
7649
|
-
function validateNumber(value, name) {
|
|
7650
|
-
if (typeof value !== "number") {
|
|
7651
|
-
throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value);
|
|
7652
|
-
}
|
|
7653
|
-
}
|
|
7654
|
-
function boundsError(value, length, type) {
|
|
7655
|
-
if (Math.floor(value) !== value) {
|
|
7656
|
-
validateNumber(value, type);
|
|
7657
|
-
throw new errors.ERR_OUT_OF_RANGE("offset", "an integer", value);
|
|
7658
|
-
}
|
|
7659
|
-
if (length < 0) {
|
|
7660
|
-
throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();
|
|
7661
|
-
}
|
|
7662
|
-
throw new errors.ERR_OUT_OF_RANGE(
|
|
7663
|
-
"offset",
|
|
7664
|
-
`>= ${0} and <= ${length}`,
|
|
7665
|
-
value
|
|
7666
|
-
);
|
|
7667
|
-
}
|
|
7668
|
-
const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
|
|
7669
|
-
function base64clean(str) {
|
|
7670
|
-
str = str.split("=")[0];
|
|
7671
|
-
str = str.trim().replace(INVALID_BASE64_RE, "");
|
|
7672
|
-
if (str.length < 2) return "";
|
|
7673
|
-
while (str.length % 4 !== 0) {
|
|
7674
|
-
str = str + "=";
|
|
7675
|
-
}
|
|
7676
|
-
return str;
|
|
7677
|
-
}
|
|
7678
|
-
function utf8ToBytes2(string, units) {
|
|
7679
|
-
units = units || Infinity;
|
|
7680
|
-
let codePoint;
|
|
7681
|
-
const length = string.length;
|
|
7682
|
-
let leadSurrogate = null;
|
|
7683
|
-
const bytes2 = [];
|
|
7684
|
-
for (let i = 0; i < length; ++i) {
|
|
7685
|
-
codePoint = string.charCodeAt(i);
|
|
7686
|
-
if (codePoint > 55295 && codePoint < 57344) {
|
|
7687
|
-
if (!leadSurrogate) {
|
|
7688
|
-
if (codePoint > 56319) {
|
|
7689
|
-
if ((units -= 3) > -1) bytes2.push(239, 191, 189);
|
|
7690
|
-
continue;
|
|
7691
|
-
} else if (i + 1 === length) {
|
|
7692
|
-
if ((units -= 3) > -1) bytes2.push(239, 191, 189);
|
|
7693
|
-
continue;
|
|
7694
|
-
}
|
|
7695
|
-
leadSurrogate = codePoint;
|
|
7696
|
-
continue;
|
|
7697
|
-
}
|
|
7698
|
-
if (codePoint < 56320) {
|
|
7699
|
-
if ((units -= 3) > -1) bytes2.push(239, 191, 189);
|
|
7700
|
-
leadSurrogate = codePoint;
|
|
7701
|
-
continue;
|
|
7702
|
-
}
|
|
7703
|
-
codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
|
|
7704
|
-
} else if (leadSurrogate) {
|
|
7705
|
-
if ((units -= 3) > -1) bytes2.push(239, 191, 189);
|
|
7706
|
-
}
|
|
7707
|
-
leadSurrogate = null;
|
|
7708
|
-
if (codePoint < 128) {
|
|
7709
|
-
if ((units -= 1) < 0) break;
|
|
7710
|
-
bytes2.push(codePoint);
|
|
7711
|
-
} else if (codePoint < 2048) {
|
|
7712
|
-
if ((units -= 2) < 0) break;
|
|
7713
|
-
bytes2.push(
|
|
7714
|
-
codePoint >> 6 | 192,
|
|
7715
|
-
codePoint & 63 | 128
|
|
7716
|
-
);
|
|
7717
|
-
} else if (codePoint < 65536) {
|
|
7718
|
-
if ((units -= 3) < 0) break;
|
|
7719
|
-
bytes2.push(
|
|
7720
|
-
codePoint >> 12 | 224,
|
|
7721
|
-
codePoint >> 6 & 63 | 128,
|
|
7722
|
-
codePoint & 63 | 128
|
|
7723
|
-
);
|
|
7724
|
-
} else if (codePoint < 1114112) {
|
|
7725
|
-
if ((units -= 4) < 0) break;
|
|
7726
|
-
bytes2.push(
|
|
7727
|
-
codePoint >> 18 | 240,
|
|
7728
|
-
codePoint >> 12 & 63 | 128,
|
|
7729
|
-
codePoint >> 6 & 63 | 128,
|
|
7730
|
-
codePoint & 63 | 128
|
|
7731
|
-
);
|
|
7732
|
-
} else {
|
|
7733
|
-
throw new Error("Invalid code point");
|
|
5976
|
+
gasPrice: 1e8,
|
|
5977
|
+
from: fromAddress.startsWith("0x") ? fromAddress : `0x${fromAddress}`,
|
|
5978
|
+
to: toAddress?.startsWith("0x") ? toAddress : `0x${toAddress}`,
|
|
5979
|
+
value: 0
|
|
5980
|
+
})
|
|
5981
|
+
}
|
|
5982
|
+
);
|
|
5983
|
+
if (!response.ok) {
|
|
5984
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
7734
5985
|
}
|
|
5986
|
+
return await response.json();
|
|
5987
|
+
} catch (error) {
|
|
5988
|
+
this.logger.error("Error reading from mirror node:", error);
|
|
5989
|
+
return null;
|
|
7735
5990
|
}
|
|
7736
|
-
return bytes2;
|
|
7737
|
-
}
|
|
7738
|
-
function asciiToBytes(str) {
|
|
7739
|
-
const byteArray = [];
|
|
7740
|
-
for (let i = 0; i < str.length; ++i) {
|
|
7741
|
-
byteArray.push(str.charCodeAt(i) & 255);
|
|
7742
|
-
}
|
|
7743
|
-
return byteArray;
|
|
7744
|
-
}
|
|
7745
|
-
function utf16leToBytes(str, units) {
|
|
7746
|
-
let c, hi, lo;
|
|
7747
|
-
const byteArray = [];
|
|
7748
|
-
for (let i = 0; i < str.length; ++i) {
|
|
7749
|
-
if ((units -= 2) < 0) break;
|
|
7750
|
-
c = str.charCodeAt(i);
|
|
7751
|
-
hi = c >> 8;
|
|
7752
|
-
lo = c % 256;
|
|
7753
|
-
byteArray.push(lo);
|
|
7754
|
-
byteArray.push(hi);
|
|
7755
|
-
}
|
|
7756
|
-
return byteArray;
|
|
7757
5991
|
}
|
|
7758
|
-
|
|
7759
|
-
|
|
5992
|
+
// Add method to clear cache if needed
|
|
5993
|
+
async clearCache() {
|
|
5994
|
+
await this.cache.clear();
|
|
7760
5995
|
}
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
if (i + offset >= dst.length || i >= src.length) break;
|
|
7765
|
-
dst[i + offset] = src[i];
|
|
7766
|
-
}
|
|
7767
|
-
return i;
|
|
5996
|
+
// Add method to remove specific cache entry
|
|
5997
|
+
async clearCacheForContract(contractAddress, functionName) {
|
|
5998
|
+
await this.cache.delete(`${contractAddress}-${functionName}`);
|
|
7768
5999
|
}
|
|
7769
|
-
|
|
7770
|
-
|
|
6000
|
+
// Method to set log level for this bridge instance
|
|
6001
|
+
setLogLevel(level) {
|
|
6002
|
+
this.logger.setLogLevel(level);
|
|
7771
6003
|
}
|
|
7772
|
-
|
|
7773
|
-
|
|
6004
|
+
}
|
|
6005
|
+
function formatValue(value, type) {
|
|
6006
|
+
if (value === null || value === void 0) {
|
|
6007
|
+
return "0";
|
|
7774
6008
|
}
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
const table = new Array(256);
|
|
7778
|
-
for (let i = 0; i < 16; ++i) {
|
|
7779
|
-
const i16 = i * 16;
|
|
7780
|
-
for (let j = 0; j < 16; ++j) {
|
|
7781
|
-
table[i16 + j] = alphabet[i] + alphabet[j];
|
|
7782
|
-
}
|
|
7783
|
-
}
|
|
7784
|
-
return table;
|
|
7785
|
-
}();
|
|
7786
|
-
function defineBigIntMethod(fn) {
|
|
7787
|
-
return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;
|
|
6009
|
+
if (value._isBigNumber) {
|
|
6010
|
+
return value.toString();
|
|
7788
6011
|
}
|
|
7789
|
-
|
|
7790
|
-
|
|
6012
|
+
if (type.startsWith("uint") || type.startsWith("int")) {
|
|
6013
|
+
return String(value);
|
|
6014
|
+
} else if (type === "bool") {
|
|
6015
|
+
return value ? "true" : "false";
|
|
6016
|
+
} else if (type === "string") {
|
|
6017
|
+
return value;
|
|
6018
|
+
} else if (type === "address") {
|
|
6019
|
+
return String(value).toLowerCase();
|
|
6020
|
+
} else if (type.endsWith("[]")) {
|
|
6021
|
+
return Array.isArray(value) ? value.map((v) => String(v)) : [];
|
|
6022
|
+
} else {
|
|
6023
|
+
return String(value);
|
|
7791
6024
|
}
|
|
7792
|
-
}
|
|
7793
|
-
const Buffer2 = buffer$1.Buffer;
|
|
6025
|
+
}
|
|
7794
6026
|
class PayloadSizeError extends Error {
|
|
7795
6027
|
constructor(message, payloadSize) {
|
|
7796
6028
|
super(message);
|
|
@@ -7816,6 +6048,168 @@ class ConnectionConfirmationError extends Error {
|
|
|
7816
6048
|
this.name = "ConnectionConfirmationError";
|
|
7817
6049
|
}
|
|
7818
6050
|
}
|
|
6051
|
+
function getDefaultExportFromCjs$2(x) {
|
|
6052
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
6053
|
+
}
|
|
6054
|
+
var browser$2 = { exports: {} };
|
|
6055
|
+
var process$1 = browser$2.exports = {};
|
|
6056
|
+
var cachedSetTimeout;
|
|
6057
|
+
var cachedClearTimeout;
|
|
6058
|
+
function defaultSetTimout() {
|
|
6059
|
+
throw new Error("setTimeout has not been defined");
|
|
6060
|
+
}
|
|
6061
|
+
function defaultClearTimeout() {
|
|
6062
|
+
throw new Error("clearTimeout has not been defined");
|
|
6063
|
+
}
|
|
6064
|
+
(function() {
|
|
6065
|
+
try {
|
|
6066
|
+
if (typeof setTimeout === "function") {
|
|
6067
|
+
cachedSetTimeout = setTimeout;
|
|
6068
|
+
} else {
|
|
6069
|
+
cachedSetTimeout = defaultSetTimout;
|
|
6070
|
+
}
|
|
6071
|
+
} catch (e) {
|
|
6072
|
+
cachedSetTimeout = defaultSetTimout;
|
|
6073
|
+
}
|
|
6074
|
+
try {
|
|
6075
|
+
if (typeof clearTimeout === "function") {
|
|
6076
|
+
cachedClearTimeout = clearTimeout;
|
|
6077
|
+
} else {
|
|
6078
|
+
cachedClearTimeout = defaultClearTimeout;
|
|
6079
|
+
}
|
|
6080
|
+
} catch (e) {
|
|
6081
|
+
cachedClearTimeout = defaultClearTimeout;
|
|
6082
|
+
}
|
|
6083
|
+
})();
|
|
6084
|
+
function runTimeout(fun) {
|
|
6085
|
+
if (cachedSetTimeout === setTimeout) {
|
|
6086
|
+
return setTimeout(fun, 0);
|
|
6087
|
+
}
|
|
6088
|
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
6089
|
+
cachedSetTimeout = setTimeout;
|
|
6090
|
+
return setTimeout(fun, 0);
|
|
6091
|
+
}
|
|
6092
|
+
try {
|
|
6093
|
+
return cachedSetTimeout(fun, 0);
|
|
6094
|
+
} catch (e) {
|
|
6095
|
+
try {
|
|
6096
|
+
return cachedSetTimeout.call(null, fun, 0);
|
|
6097
|
+
} catch (e2) {
|
|
6098
|
+
return cachedSetTimeout.call(this, fun, 0);
|
|
6099
|
+
}
|
|
6100
|
+
}
|
|
6101
|
+
}
|
|
6102
|
+
function runClearTimeout(marker) {
|
|
6103
|
+
if (cachedClearTimeout === clearTimeout) {
|
|
6104
|
+
return clearTimeout(marker);
|
|
6105
|
+
}
|
|
6106
|
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
6107
|
+
cachedClearTimeout = clearTimeout;
|
|
6108
|
+
return clearTimeout(marker);
|
|
6109
|
+
}
|
|
6110
|
+
try {
|
|
6111
|
+
return cachedClearTimeout(marker);
|
|
6112
|
+
} catch (e) {
|
|
6113
|
+
try {
|
|
6114
|
+
return cachedClearTimeout.call(null, marker);
|
|
6115
|
+
} catch (e2) {
|
|
6116
|
+
return cachedClearTimeout.call(this, marker);
|
|
6117
|
+
}
|
|
6118
|
+
}
|
|
6119
|
+
}
|
|
6120
|
+
var queue = [];
|
|
6121
|
+
var draining = false;
|
|
6122
|
+
var currentQueue;
|
|
6123
|
+
var queueIndex = -1;
|
|
6124
|
+
function cleanUpNextTick() {
|
|
6125
|
+
if (!draining || !currentQueue) {
|
|
6126
|
+
return;
|
|
6127
|
+
}
|
|
6128
|
+
draining = false;
|
|
6129
|
+
if (currentQueue.length) {
|
|
6130
|
+
queue = currentQueue.concat(queue);
|
|
6131
|
+
} else {
|
|
6132
|
+
queueIndex = -1;
|
|
6133
|
+
}
|
|
6134
|
+
if (queue.length) {
|
|
6135
|
+
drainQueue();
|
|
6136
|
+
}
|
|
6137
|
+
}
|
|
6138
|
+
function drainQueue() {
|
|
6139
|
+
if (draining) {
|
|
6140
|
+
return;
|
|
6141
|
+
}
|
|
6142
|
+
var timeout = runTimeout(cleanUpNextTick);
|
|
6143
|
+
draining = true;
|
|
6144
|
+
var len = queue.length;
|
|
6145
|
+
while (len) {
|
|
6146
|
+
currentQueue = queue;
|
|
6147
|
+
queue = [];
|
|
6148
|
+
while (++queueIndex < len) {
|
|
6149
|
+
if (currentQueue) {
|
|
6150
|
+
currentQueue[queueIndex].run();
|
|
6151
|
+
}
|
|
6152
|
+
}
|
|
6153
|
+
queueIndex = -1;
|
|
6154
|
+
len = queue.length;
|
|
6155
|
+
}
|
|
6156
|
+
currentQueue = null;
|
|
6157
|
+
draining = false;
|
|
6158
|
+
runClearTimeout(timeout);
|
|
6159
|
+
}
|
|
6160
|
+
process$1.nextTick = function(fun) {
|
|
6161
|
+
var args = new Array(arguments.length - 1);
|
|
6162
|
+
if (arguments.length > 1) {
|
|
6163
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6164
|
+
args[i - 1] = arguments[i];
|
|
6165
|
+
}
|
|
6166
|
+
}
|
|
6167
|
+
queue.push(new Item(fun, args));
|
|
6168
|
+
if (queue.length === 1 && !draining) {
|
|
6169
|
+
runTimeout(drainQueue);
|
|
6170
|
+
}
|
|
6171
|
+
};
|
|
6172
|
+
function Item(fun, array) {
|
|
6173
|
+
this.fun = fun;
|
|
6174
|
+
this.array = array;
|
|
6175
|
+
}
|
|
6176
|
+
Item.prototype.run = function() {
|
|
6177
|
+
this.fun.apply(null, this.array);
|
|
6178
|
+
};
|
|
6179
|
+
process$1.title = "browser";
|
|
6180
|
+
process$1.browser = true;
|
|
6181
|
+
process$1.env = {};
|
|
6182
|
+
process$1.argv = [];
|
|
6183
|
+
process$1.version = "";
|
|
6184
|
+
process$1.versions = {};
|
|
6185
|
+
function noop$2() {
|
|
6186
|
+
}
|
|
6187
|
+
process$1.on = noop$2;
|
|
6188
|
+
process$1.addListener = noop$2;
|
|
6189
|
+
process$1.once = noop$2;
|
|
6190
|
+
process$1.off = noop$2;
|
|
6191
|
+
process$1.removeListener = noop$2;
|
|
6192
|
+
process$1.removeAllListeners = noop$2;
|
|
6193
|
+
process$1.emit = noop$2;
|
|
6194
|
+
process$1.prependListener = noop$2;
|
|
6195
|
+
process$1.prependOnceListener = noop$2;
|
|
6196
|
+
process$1.listeners = function(name) {
|
|
6197
|
+
return [];
|
|
6198
|
+
};
|
|
6199
|
+
process$1.binding = function(name) {
|
|
6200
|
+
throw new Error("process.binding is not supported");
|
|
6201
|
+
};
|
|
6202
|
+
process$1.cwd = function() {
|
|
6203
|
+
return "/";
|
|
6204
|
+
};
|
|
6205
|
+
process$1.chdir = function(dir) {
|
|
6206
|
+
throw new Error("process.chdir is not supported");
|
|
6207
|
+
};
|
|
6208
|
+
process$1.umask = function() {
|
|
6209
|
+
return 0;
|
|
6210
|
+
};
|
|
6211
|
+
var browserExports$2 = browser$2.exports;
|
|
6212
|
+
const process$1$1 = /* @__PURE__ */ getDefaultExportFromCjs$2(browserExports$2);
|
|
7819
6213
|
var __defProp2 = Object.defineProperty;
|
|
7820
6214
|
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7821
6215
|
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -9584,8 +7978,8 @@ ieee754$1.write = function(buffer2, value, offset, isLE2, mLen, nBytes) {
|
|
|
9584
7978
|
throw new Error("BigInt not supported");
|
|
9585
7979
|
}
|
|
9586
7980
|
})(buffer);
|
|
9587
|
-
const
|
|
9588
|
-
const global = globalThis || void 0 || self;
|
|
7981
|
+
const Buffer2 = buffer.Buffer;
|
|
7982
|
+
const global$1 = globalThis || void 0 || self;
|
|
9589
7983
|
function bind$1(fn, thisArg) {
|
|
9590
7984
|
return function wrap() {
|
|
9591
7985
|
return fn.apply(thisArg, arguments);
|
|
@@ -9680,7 +8074,7 @@ function findKey$1(obj, key) {
|
|
|
9680
8074
|
}
|
|
9681
8075
|
const _global$1 = (() => {
|
|
9682
8076
|
if (typeof globalThis !== "undefined") return globalThis;
|
|
9683
|
-
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
|
|
8077
|
+
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global$1;
|
|
9684
8078
|
})();
|
|
9685
8079
|
const isContextDefined$1 = (context) => !isUndefined$1(context) && context !== _global$1;
|
|
9686
8080
|
function merge$1() {
|
|
@@ -9892,7 +8286,7 @@ const _setImmediate$1 = ((setImmediateSupported, postMessageSupported) => {
|
|
|
9892
8286
|
typeof setImmediate === "function",
|
|
9893
8287
|
isFunction$1(_global$1.postMessage)
|
|
9894
8288
|
);
|
|
9895
|
-
const asap$1 = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global$1) : typeof process !== "undefined" && process.nextTick || _setImmediate$1;
|
|
8289
|
+
const asap$1 = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global$1) : typeof process$1$1 !== "undefined" && process$1$1.nextTick || _setImmediate$1;
|
|
9896
8290
|
const utils$1$1 = {
|
|
9897
8291
|
isArray: isArray$1,
|
|
9898
8292
|
isArrayBuffer: isArrayBuffer$1,
|
|
@@ -10073,7 +8467,7 @@ function toFormData$2(obj, formData, options) {
|
|
|
10073
8467
|
throw new AxiosError$2("Blob is not supported. Use a Buffer instead.");
|
|
10074
8468
|
}
|
|
10075
8469
|
if (utils$1$1.isArrayBuffer(value) || utils$1$1.isTypedArray(value)) {
|
|
10076
|
-
return useBlob && typeof Blob === "function" ? new Blob([value]) :
|
|
8470
|
+
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer2.from(value);
|
|
10077
8471
|
}
|
|
10078
8472
|
return value;
|
|
10079
8473
|
}
|
|
@@ -11942,7 +10336,7 @@ axios$1.default = axios$1;
|
|
|
11942
10336
|
const _Logger = class _Logger2 {
|
|
11943
10337
|
constructor() {
|
|
11944
10338
|
__publicField2(this, "isProduction");
|
|
11945
|
-
this.isProduction = process.env.NODE_ENV === "production";
|
|
10339
|
+
this.isProduction = process$1$1.env.NODE_ENV === "production";
|
|
11946
10340
|
}
|
|
11947
10341
|
static getInstance() {
|
|
11948
10342
|
if (!_Logger2.instance) {
|
|
@@ -12023,7 +10417,7 @@ class Auth {
|
|
|
12023
10417
|
async signMessage(message) {
|
|
12024
10418
|
const messageBytes = new TextEncoder().encode(message);
|
|
12025
10419
|
const signatureBytes = await this.privateKey.sign(messageBytes);
|
|
12026
|
-
return
|
|
10420
|
+
return Buffer2.from(signatureBytes).toString("hex");
|
|
12027
10421
|
}
|
|
12028
10422
|
}
|
|
12029
10423
|
class ClientAuth {
|
|
@@ -12080,7 +10474,7 @@ class ClientAuth {
|
|
|
12080
10474
|
const signatureBytes = await this.signer.sign([messageBytes], {
|
|
12081
10475
|
encoding: "utf-8"
|
|
12082
10476
|
});
|
|
12083
|
-
return
|
|
10477
|
+
return Buffer2.from(signatureBytes == null ? void 0 : signatureBytes[0].signature).toString("hex");
|
|
12084
10478
|
} catch (e) {
|
|
12085
10479
|
this.logger.error(`Failed to sign message`, e);
|
|
12086
10480
|
throw new Error("Failed to sign message");
|
|
@@ -13438,8 +11832,8 @@ function requireBrowser$1() {
|
|
|
13438
11832
|
r = exports.storage.getItem("debug");
|
|
13439
11833
|
} catch (error) {
|
|
13440
11834
|
}
|
|
13441
|
-
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
13442
|
-
r = process.env.DEBUG;
|
|
11835
|
+
if (!r && typeof process$1$1 !== "undefined" && "env" in process$1$1) {
|
|
11836
|
+
r = process$1$1.env.DEBUG;
|
|
13443
11837
|
}
|
|
13444
11838
|
return r;
|
|
13445
11839
|
}
|
|
@@ -15709,7 +14103,7 @@ const _InscriptionSDK = class _InscriptionSDK2 {
|
|
|
15709
14103
|
}
|
|
15710
14104
|
try {
|
|
15711
14105
|
const sanitizedBase64 = base64Data.replace(/\s/g, "");
|
|
15712
|
-
const buffer2 =
|
|
14106
|
+
const buffer2 = Buffer2.from(sanitizedBase64, "base64");
|
|
15713
14107
|
const typeResult = await fileTypeFromBuffer$1(buffer2);
|
|
15714
14108
|
return (typeResult == null ? void 0 : typeResult.mime) || "application/octet-stream";
|
|
15715
14109
|
} catch (err2) {
|
|
@@ -15804,7 +14198,7 @@ const _InscriptionSDK = class _InscriptionSDK2 {
|
|
|
15804
14198
|
const privateKey = PrivateKey.fromString(clientConfig.privateKey);
|
|
15805
14199
|
client.setOperator(clientConfig.accountId, privateKey);
|
|
15806
14200
|
const transaction = Transaction.fromBytes(
|
|
15807
|
-
|
|
14201
|
+
Buffer2.from(transactionBytes, "base64")
|
|
15808
14202
|
);
|
|
15809
14203
|
const signedTransaction = await transaction.sign(privateKey);
|
|
15810
14204
|
const executeTx = await signedTransaction.execute(client);
|
|
@@ -15832,7 +14226,7 @@ const _InscriptionSDK = class _InscriptionSDK2 {
|
|
|
15832
14226
|
async executeTransactionWithSigner(transactionBytes, signer) {
|
|
15833
14227
|
try {
|
|
15834
14228
|
const transaction = Transaction.fromBytes(
|
|
15835
|
-
|
|
14229
|
+
Buffer2.from(transactionBytes, "base64")
|
|
15836
14230
|
);
|
|
15837
14231
|
const executeTx = await transaction.executeWithSigner(signer);
|
|
15838
14232
|
const receipt = await executeTx.getReceiptWithSigner(signer);
|
|
@@ -16296,7 +14690,7 @@ function findKey(obj, key) {
|
|
|
16296
14690
|
}
|
|
16297
14691
|
const _global = (() => {
|
|
16298
14692
|
if (typeof globalThis !== "undefined") return globalThis;
|
|
16299
|
-
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global
|
|
14693
|
+
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
|
|
16300
14694
|
})();
|
|
16301
14695
|
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
16302
14696
|
function merge() {
|
|
@@ -16689,7 +15083,7 @@ function toFormData$1(obj, formData, options) {
|
|
|
16689
15083
|
throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
|
|
16690
15084
|
}
|
|
16691
15085
|
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
16692
|
-
return useBlob && typeof Blob === "function" ? new Blob([value]) :
|
|
15086
|
+
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
|
|
16693
15087
|
}
|
|
16694
15088
|
return value;
|
|
16695
15089
|
}
|
|
@@ -18660,7 +17054,7 @@ class HederaMirrorNode {
|
|
|
18660
17054
|
let messageContent;
|
|
18661
17055
|
try {
|
|
18662
17056
|
if (this.isServerEnvironment) {
|
|
18663
|
-
messageContent =
|
|
17057
|
+
messageContent = Buffer.from(message.message, "base64").toString("utf-8");
|
|
18664
17058
|
} else {
|
|
18665
17059
|
messageContent = new TextDecoder().decode(
|
|
18666
17060
|
Uint8Array.from(atob(message.message), (c) => c.charCodeAt(0))
|
|
@@ -18757,7 +17151,7 @@ class HederaMirrorNode {
|
|
|
18757
17151
|
...listKey.thresholdKey ? { thresholdKey: listKey.thresholdKey } : {}
|
|
18758
17152
|
}).finish();
|
|
18759
17153
|
const hasNestedAccess = await this.checkKeyListAccess(
|
|
18760
|
-
|
|
17154
|
+
Buffer.from(nestedKeyBytes),
|
|
18761
17155
|
userPublicKey
|
|
18762
17156
|
);
|
|
18763
17157
|
if (hasNestedAccess) {
|
|
@@ -18774,7 +17168,7 @@ class HederaMirrorNode {
|
|
|
18774
17168
|
}
|
|
18775
17169
|
compareEd25519Key(keyData, userPublicKey) {
|
|
18776
17170
|
try {
|
|
18777
|
-
const decodedKey = PublicKey.fromBytes(
|
|
17171
|
+
const decodedKey = PublicKey.fromBytes(Buffer.from(keyData));
|
|
18778
17172
|
return decodedKey.toString() === userPublicKey.toString();
|
|
18779
17173
|
} catch (err2) {
|
|
18780
17174
|
return false;
|
|
@@ -19220,6 +17614,30 @@ class HCS10Cache {
|
|
|
19220
17614
|
function getDefaultExportFromCjs(x) {
|
|
19221
17615
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
19222
17616
|
}
|
|
17617
|
+
function getAugmentedNamespace(n2) {
|
|
17618
|
+
if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2;
|
|
17619
|
+
var f = n2.default;
|
|
17620
|
+
if (typeof f == "function") {
|
|
17621
|
+
var a = function a2() {
|
|
17622
|
+
if (this instanceof a2) {
|
|
17623
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
17624
|
+
}
|
|
17625
|
+
return f.apply(this, arguments);
|
|
17626
|
+
};
|
|
17627
|
+
a.prototype = f.prototype;
|
|
17628
|
+
} else a = {};
|
|
17629
|
+
Object.defineProperty(a, "__esModule", { value: true });
|
|
17630
|
+
Object.keys(n2).forEach(function(k) {
|
|
17631
|
+
var d = Object.getOwnPropertyDescriptor(n2, k);
|
|
17632
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
17633
|
+
enumerable: true,
|
|
17634
|
+
get: function() {
|
|
17635
|
+
return n2[k];
|
|
17636
|
+
}
|
|
17637
|
+
});
|
|
17638
|
+
});
|
|
17639
|
+
return a;
|
|
17640
|
+
}
|
|
19223
17641
|
var mimeTypes$1 = {};
|
|
19224
17642
|
const require$$0 = {
|
|
19225
17643
|
"application/1d-interleaved-parityfec": { "source": "iana" },
|
|
@@ -21516,413 +19934,12 @@ function requireMimeDb() {
|
|
|
21516
19934
|
mimeDb = require$$0;
|
|
21517
19935
|
return mimeDb;
|
|
21518
19936
|
}
|
|
21519
|
-
|
|
21520
|
-
|
|
21521
|
-
|
|
21522
|
-
|
|
21523
|
-
|
|
21524
|
-
|
|
21525
|
-
if (typeof path !== "string") {
|
|
21526
|
-
throw new TypeError("Path must be a string. Received " + JSON.stringify(path));
|
|
21527
|
-
}
|
|
21528
|
-
}
|
|
21529
|
-
function normalizeStringPosix(path, allowAboveRoot) {
|
|
21530
|
-
var res = "";
|
|
21531
|
-
var lastSegmentLength = 0;
|
|
21532
|
-
var lastSlash = -1;
|
|
21533
|
-
var dots = 0;
|
|
21534
|
-
var code2;
|
|
21535
|
-
for (var i = 0; i <= path.length; ++i) {
|
|
21536
|
-
if (i < path.length)
|
|
21537
|
-
code2 = path.charCodeAt(i);
|
|
21538
|
-
else if (code2 === 47)
|
|
21539
|
-
break;
|
|
21540
|
-
else
|
|
21541
|
-
code2 = 47;
|
|
21542
|
-
if (code2 === 47) {
|
|
21543
|
-
if (lastSlash === i - 1 || dots === 1) ;
|
|
21544
|
-
else if (lastSlash !== i - 1 && dots === 2) {
|
|
21545
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 || res.charCodeAt(res.length - 2) !== 46) {
|
|
21546
|
-
if (res.length > 2) {
|
|
21547
|
-
var lastSlashIndex = res.lastIndexOf("/");
|
|
21548
|
-
if (lastSlashIndex !== res.length - 1) {
|
|
21549
|
-
if (lastSlashIndex === -1) {
|
|
21550
|
-
res = "";
|
|
21551
|
-
lastSegmentLength = 0;
|
|
21552
|
-
} else {
|
|
21553
|
-
res = res.slice(0, lastSlashIndex);
|
|
21554
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
21555
|
-
}
|
|
21556
|
-
lastSlash = i;
|
|
21557
|
-
dots = 0;
|
|
21558
|
-
continue;
|
|
21559
|
-
}
|
|
21560
|
-
} else if (res.length === 2 || res.length === 1) {
|
|
21561
|
-
res = "";
|
|
21562
|
-
lastSegmentLength = 0;
|
|
21563
|
-
lastSlash = i;
|
|
21564
|
-
dots = 0;
|
|
21565
|
-
continue;
|
|
21566
|
-
}
|
|
21567
|
-
}
|
|
21568
|
-
if (allowAboveRoot) {
|
|
21569
|
-
if (res.length > 0)
|
|
21570
|
-
res += "/..";
|
|
21571
|
-
else
|
|
21572
|
-
res = "..";
|
|
21573
|
-
lastSegmentLength = 2;
|
|
21574
|
-
}
|
|
21575
|
-
} else {
|
|
21576
|
-
if (res.length > 0)
|
|
21577
|
-
res += "/" + path.slice(lastSlash + 1, i);
|
|
21578
|
-
else
|
|
21579
|
-
res = path.slice(lastSlash + 1, i);
|
|
21580
|
-
lastSegmentLength = i - lastSlash - 1;
|
|
21581
|
-
}
|
|
21582
|
-
lastSlash = i;
|
|
21583
|
-
dots = 0;
|
|
21584
|
-
} else if (code2 === 46 && dots !== -1) {
|
|
21585
|
-
++dots;
|
|
21586
|
-
} else {
|
|
21587
|
-
dots = -1;
|
|
21588
|
-
}
|
|
21589
|
-
}
|
|
21590
|
-
return res;
|
|
21591
|
-
}
|
|
21592
|
-
function _format(sep, pathObject) {
|
|
21593
|
-
var dir = pathObject.dir || pathObject.root;
|
|
21594
|
-
var base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
21595
|
-
if (!dir) {
|
|
21596
|
-
return base;
|
|
21597
|
-
}
|
|
21598
|
-
if (dir === pathObject.root) {
|
|
21599
|
-
return dir + base;
|
|
21600
|
-
}
|
|
21601
|
-
return dir + sep + base;
|
|
21602
|
-
}
|
|
21603
|
-
var posix = {
|
|
21604
|
-
// path.resolve([from ...], to)
|
|
21605
|
-
resolve: function resolve() {
|
|
21606
|
-
var resolvedPath = "";
|
|
21607
|
-
var resolvedAbsolute = false;
|
|
21608
|
-
var cwd;
|
|
21609
|
-
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
21610
|
-
var path;
|
|
21611
|
-
if (i >= 0)
|
|
21612
|
-
path = arguments[i];
|
|
21613
|
-
else {
|
|
21614
|
-
if (cwd === void 0)
|
|
21615
|
-
cwd = process.cwd();
|
|
21616
|
-
path = cwd;
|
|
21617
|
-
}
|
|
21618
|
-
assertPath(path);
|
|
21619
|
-
if (path.length === 0) {
|
|
21620
|
-
continue;
|
|
21621
|
-
}
|
|
21622
|
-
resolvedPath = path + "/" + resolvedPath;
|
|
21623
|
-
resolvedAbsolute = path.charCodeAt(0) === 47;
|
|
21624
|
-
}
|
|
21625
|
-
resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
|
|
21626
|
-
if (resolvedAbsolute) {
|
|
21627
|
-
if (resolvedPath.length > 0)
|
|
21628
|
-
return "/" + resolvedPath;
|
|
21629
|
-
else
|
|
21630
|
-
return "/";
|
|
21631
|
-
} else if (resolvedPath.length > 0) {
|
|
21632
|
-
return resolvedPath;
|
|
21633
|
-
} else {
|
|
21634
|
-
return ".";
|
|
21635
|
-
}
|
|
21636
|
-
},
|
|
21637
|
-
normalize: function normalize(path) {
|
|
21638
|
-
assertPath(path);
|
|
21639
|
-
if (path.length === 0) return ".";
|
|
21640
|
-
var isAbsolute = path.charCodeAt(0) === 47;
|
|
21641
|
-
var trailingSeparator = path.charCodeAt(path.length - 1) === 47;
|
|
21642
|
-
path = normalizeStringPosix(path, !isAbsolute);
|
|
21643
|
-
if (path.length === 0 && !isAbsolute) path = ".";
|
|
21644
|
-
if (path.length > 0 && trailingSeparator) path += "/";
|
|
21645
|
-
if (isAbsolute) return "/" + path;
|
|
21646
|
-
return path;
|
|
21647
|
-
},
|
|
21648
|
-
isAbsolute: function isAbsolute(path) {
|
|
21649
|
-
assertPath(path);
|
|
21650
|
-
return path.length > 0 && path.charCodeAt(0) === 47;
|
|
21651
|
-
},
|
|
21652
|
-
join: function join() {
|
|
21653
|
-
if (arguments.length === 0)
|
|
21654
|
-
return ".";
|
|
21655
|
-
var joined;
|
|
21656
|
-
for (var i = 0; i < arguments.length; ++i) {
|
|
21657
|
-
var arg = arguments[i];
|
|
21658
|
-
assertPath(arg);
|
|
21659
|
-
if (arg.length > 0) {
|
|
21660
|
-
if (joined === void 0)
|
|
21661
|
-
joined = arg;
|
|
21662
|
-
else
|
|
21663
|
-
joined += "/" + arg;
|
|
21664
|
-
}
|
|
21665
|
-
}
|
|
21666
|
-
if (joined === void 0)
|
|
21667
|
-
return ".";
|
|
21668
|
-
return posix.normalize(joined);
|
|
21669
|
-
},
|
|
21670
|
-
relative: function relative(from, to) {
|
|
21671
|
-
assertPath(from);
|
|
21672
|
-
assertPath(to);
|
|
21673
|
-
if (from === to) return "";
|
|
21674
|
-
from = posix.resolve(from);
|
|
21675
|
-
to = posix.resolve(to);
|
|
21676
|
-
if (from === to) return "";
|
|
21677
|
-
var fromStart = 1;
|
|
21678
|
-
for (; fromStart < from.length; ++fromStart) {
|
|
21679
|
-
if (from.charCodeAt(fromStart) !== 47)
|
|
21680
|
-
break;
|
|
21681
|
-
}
|
|
21682
|
-
var fromEnd = from.length;
|
|
21683
|
-
var fromLen = fromEnd - fromStart;
|
|
21684
|
-
var toStart = 1;
|
|
21685
|
-
for (; toStart < to.length; ++toStart) {
|
|
21686
|
-
if (to.charCodeAt(toStart) !== 47)
|
|
21687
|
-
break;
|
|
21688
|
-
}
|
|
21689
|
-
var toEnd = to.length;
|
|
21690
|
-
var toLen = toEnd - toStart;
|
|
21691
|
-
var length = fromLen < toLen ? fromLen : toLen;
|
|
21692
|
-
var lastCommonSep = -1;
|
|
21693
|
-
var i = 0;
|
|
21694
|
-
for (; i <= length; ++i) {
|
|
21695
|
-
if (i === length) {
|
|
21696
|
-
if (toLen > length) {
|
|
21697
|
-
if (to.charCodeAt(toStart + i) === 47) {
|
|
21698
|
-
return to.slice(toStart + i + 1);
|
|
21699
|
-
} else if (i === 0) {
|
|
21700
|
-
return to.slice(toStart + i);
|
|
21701
|
-
}
|
|
21702
|
-
} else if (fromLen > length) {
|
|
21703
|
-
if (from.charCodeAt(fromStart + i) === 47) {
|
|
21704
|
-
lastCommonSep = i;
|
|
21705
|
-
} else if (i === 0) {
|
|
21706
|
-
lastCommonSep = 0;
|
|
21707
|
-
}
|
|
21708
|
-
}
|
|
21709
|
-
break;
|
|
21710
|
-
}
|
|
21711
|
-
var fromCode = from.charCodeAt(fromStart + i);
|
|
21712
|
-
var toCode = to.charCodeAt(toStart + i);
|
|
21713
|
-
if (fromCode !== toCode)
|
|
21714
|
-
break;
|
|
21715
|
-
else if (fromCode === 47)
|
|
21716
|
-
lastCommonSep = i;
|
|
21717
|
-
}
|
|
21718
|
-
var out = "";
|
|
21719
|
-
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
|
21720
|
-
if (i === fromEnd || from.charCodeAt(i) === 47) {
|
|
21721
|
-
if (out.length === 0)
|
|
21722
|
-
out += "..";
|
|
21723
|
-
else
|
|
21724
|
-
out += "/..";
|
|
21725
|
-
}
|
|
21726
|
-
}
|
|
21727
|
-
if (out.length > 0)
|
|
21728
|
-
return out + to.slice(toStart + lastCommonSep);
|
|
21729
|
-
else {
|
|
21730
|
-
toStart += lastCommonSep;
|
|
21731
|
-
if (to.charCodeAt(toStart) === 47)
|
|
21732
|
-
++toStart;
|
|
21733
|
-
return to.slice(toStart);
|
|
21734
|
-
}
|
|
21735
|
-
},
|
|
21736
|
-
_makeLong: function _makeLong(path) {
|
|
21737
|
-
return path;
|
|
21738
|
-
},
|
|
21739
|
-
dirname: function dirname(path) {
|
|
21740
|
-
assertPath(path);
|
|
21741
|
-
if (path.length === 0) return ".";
|
|
21742
|
-
var code2 = path.charCodeAt(0);
|
|
21743
|
-
var hasRoot = code2 === 47;
|
|
21744
|
-
var end = -1;
|
|
21745
|
-
var matchedSlash = true;
|
|
21746
|
-
for (var i = path.length - 1; i >= 1; --i) {
|
|
21747
|
-
code2 = path.charCodeAt(i);
|
|
21748
|
-
if (code2 === 47) {
|
|
21749
|
-
if (!matchedSlash) {
|
|
21750
|
-
end = i;
|
|
21751
|
-
break;
|
|
21752
|
-
}
|
|
21753
|
-
} else {
|
|
21754
|
-
matchedSlash = false;
|
|
21755
|
-
}
|
|
21756
|
-
}
|
|
21757
|
-
if (end === -1) return hasRoot ? "/" : ".";
|
|
21758
|
-
if (hasRoot && end === 1) return "//";
|
|
21759
|
-
return path.slice(0, end);
|
|
21760
|
-
},
|
|
21761
|
-
basename: function basename(path, ext) {
|
|
21762
|
-
if (ext !== void 0 && typeof ext !== "string") throw new TypeError('"ext" argument must be a string');
|
|
21763
|
-
assertPath(path);
|
|
21764
|
-
var start = 0;
|
|
21765
|
-
var end = -1;
|
|
21766
|
-
var matchedSlash = true;
|
|
21767
|
-
var i;
|
|
21768
|
-
if (ext !== void 0 && ext.length > 0 && ext.length <= path.length) {
|
|
21769
|
-
if (ext.length === path.length && ext === path) return "";
|
|
21770
|
-
var extIdx = ext.length - 1;
|
|
21771
|
-
var firstNonSlashEnd = -1;
|
|
21772
|
-
for (i = path.length - 1; i >= 0; --i) {
|
|
21773
|
-
var code2 = path.charCodeAt(i);
|
|
21774
|
-
if (code2 === 47) {
|
|
21775
|
-
if (!matchedSlash) {
|
|
21776
|
-
start = i + 1;
|
|
21777
|
-
break;
|
|
21778
|
-
}
|
|
21779
|
-
} else {
|
|
21780
|
-
if (firstNonSlashEnd === -1) {
|
|
21781
|
-
matchedSlash = false;
|
|
21782
|
-
firstNonSlashEnd = i + 1;
|
|
21783
|
-
}
|
|
21784
|
-
if (extIdx >= 0) {
|
|
21785
|
-
if (code2 === ext.charCodeAt(extIdx)) {
|
|
21786
|
-
if (--extIdx === -1) {
|
|
21787
|
-
end = i;
|
|
21788
|
-
}
|
|
21789
|
-
} else {
|
|
21790
|
-
extIdx = -1;
|
|
21791
|
-
end = firstNonSlashEnd;
|
|
21792
|
-
}
|
|
21793
|
-
}
|
|
21794
|
-
}
|
|
21795
|
-
}
|
|
21796
|
-
if (start === end) end = firstNonSlashEnd;
|
|
21797
|
-
else if (end === -1) end = path.length;
|
|
21798
|
-
return path.slice(start, end);
|
|
21799
|
-
} else {
|
|
21800
|
-
for (i = path.length - 1; i >= 0; --i) {
|
|
21801
|
-
if (path.charCodeAt(i) === 47) {
|
|
21802
|
-
if (!matchedSlash) {
|
|
21803
|
-
start = i + 1;
|
|
21804
|
-
break;
|
|
21805
|
-
}
|
|
21806
|
-
} else if (end === -1) {
|
|
21807
|
-
matchedSlash = false;
|
|
21808
|
-
end = i + 1;
|
|
21809
|
-
}
|
|
21810
|
-
}
|
|
21811
|
-
if (end === -1) return "";
|
|
21812
|
-
return path.slice(start, end);
|
|
21813
|
-
}
|
|
21814
|
-
},
|
|
21815
|
-
extname: function extname(path) {
|
|
21816
|
-
assertPath(path);
|
|
21817
|
-
var startDot = -1;
|
|
21818
|
-
var startPart = 0;
|
|
21819
|
-
var end = -1;
|
|
21820
|
-
var matchedSlash = true;
|
|
21821
|
-
var preDotState = 0;
|
|
21822
|
-
for (var i = path.length - 1; i >= 0; --i) {
|
|
21823
|
-
var code2 = path.charCodeAt(i);
|
|
21824
|
-
if (code2 === 47) {
|
|
21825
|
-
if (!matchedSlash) {
|
|
21826
|
-
startPart = i + 1;
|
|
21827
|
-
break;
|
|
21828
|
-
}
|
|
21829
|
-
continue;
|
|
21830
|
-
}
|
|
21831
|
-
if (end === -1) {
|
|
21832
|
-
matchedSlash = false;
|
|
21833
|
-
end = i + 1;
|
|
21834
|
-
}
|
|
21835
|
-
if (code2 === 46) {
|
|
21836
|
-
if (startDot === -1)
|
|
21837
|
-
startDot = i;
|
|
21838
|
-
else if (preDotState !== 1)
|
|
21839
|
-
preDotState = 1;
|
|
21840
|
-
} else if (startDot !== -1) {
|
|
21841
|
-
preDotState = -1;
|
|
21842
|
-
}
|
|
21843
|
-
}
|
|
21844
|
-
if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
|
|
21845
|
-
preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
|
|
21846
|
-
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
21847
|
-
return "";
|
|
21848
|
-
}
|
|
21849
|
-
return path.slice(startDot, end);
|
|
21850
|
-
},
|
|
21851
|
-
format: function format(pathObject) {
|
|
21852
|
-
if (pathObject === null || typeof pathObject !== "object") {
|
|
21853
|
-
throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
|
21854
|
-
}
|
|
21855
|
-
return _format("/", pathObject);
|
|
21856
|
-
},
|
|
21857
|
-
parse: function parse(path) {
|
|
21858
|
-
assertPath(path);
|
|
21859
|
-
var ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
21860
|
-
if (path.length === 0) return ret;
|
|
21861
|
-
var code2 = path.charCodeAt(0);
|
|
21862
|
-
var isAbsolute = code2 === 47;
|
|
21863
|
-
var start;
|
|
21864
|
-
if (isAbsolute) {
|
|
21865
|
-
ret.root = "/";
|
|
21866
|
-
start = 1;
|
|
21867
|
-
} else {
|
|
21868
|
-
start = 0;
|
|
21869
|
-
}
|
|
21870
|
-
var startDot = -1;
|
|
21871
|
-
var startPart = 0;
|
|
21872
|
-
var end = -1;
|
|
21873
|
-
var matchedSlash = true;
|
|
21874
|
-
var i = path.length - 1;
|
|
21875
|
-
var preDotState = 0;
|
|
21876
|
-
for (; i >= start; --i) {
|
|
21877
|
-
code2 = path.charCodeAt(i);
|
|
21878
|
-
if (code2 === 47) {
|
|
21879
|
-
if (!matchedSlash) {
|
|
21880
|
-
startPart = i + 1;
|
|
21881
|
-
break;
|
|
21882
|
-
}
|
|
21883
|
-
continue;
|
|
21884
|
-
}
|
|
21885
|
-
if (end === -1) {
|
|
21886
|
-
matchedSlash = false;
|
|
21887
|
-
end = i + 1;
|
|
21888
|
-
}
|
|
21889
|
-
if (code2 === 46) {
|
|
21890
|
-
if (startDot === -1) startDot = i;
|
|
21891
|
-
else if (preDotState !== 1) preDotState = 1;
|
|
21892
|
-
} else if (startDot !== -1) {
|
|
21893
|
-
preDotState = -1;
|
|
21894
|
-
}
|
|
21895
|
-
}
|
|
21896
|
-
if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
|
|
21897
|
-
preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
|
|
21898
|
-
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
21899
|
-
if (end !== -1) {
|
|
21900
|
-
if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);
|
|
21901
|
-
else ret.base = ret.name = path.slice(startPart, end);
|
|
21902
|
-
}
|
|
21903
|
-
} else {
|
|
21904
|
-
if (startPart === 0 && isAbsolute) {
|
|
21905
|
-
ret.name = path.slice(1, startDot);
|
|
21906
|
-
ret.base = path.slice(1, end);
|
|
21907
|
-
} else {
|
|
21908
|
-
ret.name = path.slice(startPart, startDot);
|
|
21909
|
-
ret.base = path.slice(startPart, end);
|
|
21910
|
-
}
|
|
21911
|
-
ret.ext = path.slice(startDot, end);
|
|
21912
|
-
}
|
|
21913
|
-
if (startPart > 0) ret.dir = path.slice(0, startPart - 1);
|
|
21914
|
-
else if (isAbsolute) ret.dir = "/";
|
|
21915
|
-
return ret;
|
|
21916
|
-
},
|
|
21917
|
-
sep: "/",
|
|
21918
|
-
delimiter: ":",
|
|
21919
|
-
win32: null,
|
|
21920
|
-
posix: null
|
|
21921
|
-
};
|
|
21922
|
-
posix.posix = posix;
|
|
21923
|
-
pathBrowserify = posix;
|
|
21924
|
-
return pathBrowserify;
|
|
21925
|
-
}
|
|
19937
|
+
const __viteBrowserExternal = {};
|
|
19938
|
+
const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
19939
|
+
__proto__: null,
|
|
19940
|
+
default: __viteBrowserExternal
|
|
19941
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
19942
|
+
const require$$1 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
|
|
21926
19943
|
/*!
|
|
21927
19944
|
* mime-types
|
|
21928
19945
|
* Copyright(c) 2014 Jonathan Ong
|
|
@@ -21935,7 +19952,7 @@ function requireMimeTypes() {
|
|
|
21935
19952
|
hasRequiredMimeTypes = 1;
|
|
21936
19953
|
(function(exports) {
|
|
21937
19954
|
var db = requireMimeDb();
|
|
21938
|
-
var extname =
|
|
19955
|
+
var extname = require$$1.extname;
|
|
21939
19956
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
21940
19957
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
21941
19958
|
exports.charset = charset;
|
|
@@ -22247,7 +20264,7 @@ async function inscribe(input, clientConfig, options, existingSDK) {
|
|
|
22247
20264
|
...baseRequest,
|
|
22248
20265
|
file: {
|
|
22249
20266
|
type: "base64",
|
|
22250
|
-
base64:
|
|
20267
|
+
base64: Buffer.from(input.buffer).toString("base64"),
|
|
22251
20268
|
fileName: input.fileName,
|
|
22252
20269
|
mimeType: input.mimeType
|
|
22253
20270
|
}
|
|
@@ -22375,7 +20392,7 @@ async function inscribeWithSigner(input, signer, options, existingSDK) {
|
|
|
22375
20392
|
...baseRequest,
|
|
22376
20393
|
file: {
|
|
22377
20394
|
type: "base64",
|
|
22378
|
-
base64:
|
|
20395
|
+
base64: Buffer.from(input.buffer).toString("base64"),
|
|
22379
20396
|
fileName: input.fileName,
|
|
22380
20397
|
mimeType: input.mimeType
|
|
22381
20398
|
}
|
|
@@ -30485,7 +28502,7 @@ class HCS11Client {
|
|
|
30485
28502
|
callback: progressCallback
|
|
30486
28503
|
});
|
|
30487
28504
|
progressReporter.preparing("Preparing content for inscription", 10);
|
|
30488
|
-
const contentBuffer = typeof content === "string" ?
|
|
28505
|
+
const contentBuffer = typeof content === "string" ? Buffer.from(content, "utf-8") : content;
|
|
30489
28506
|
const contentType = mimeType || mimeTypesExports.lookup(fileName) || "application/octet-stream";
|
|
30490
28507
|
const input = {
|
|
30491
28508
|
type: "buffer",
|
|
@@ -30706,7 +28723,7 @@ class HCS11Client {
|
|
|
30706
28723
|
const profileJson = this.profileToJSONString(profile);
|
|
30707
28724
|
const fileName = `profile-${profile.display_name.toLowerCase().replace(/\s+/g, "-")}.json`;
|
|
30708
28725
|
try {
|
|
30709
|
-
const contentBuffer =
|
|
28726
|
+
const contentBuffer = Buffer.from(profileJson, "utf-8");
|
|
30710
28727
|
const contentType = "application/json";
|
|
30711
28728
|
progressReporter.preparing("Preparing profile for inscription", 20);
|
|
30712
28729
|
const input = {
|
|
@@ -30885,7 +28902,7 @@ class HCS11Client {
|
|
|
30885
28902
|
}
|
|
30886
28903
|
try {
|
|
30887
28904
|
const sanitizedBase64 = base64Data.replace(/\s/g, "");
|
|
30888
|
-
const buffer2 =
|
|
28905
|
+
const buffer2 = Buffer.from(sanitizedBase64, "base64");
|
|
30889
28906
|
const typeResult = await fileTypeFromBuffer(buffer2);
|
|
30890
28907
|
return typeResult?.mime || "application/octet-stream";
|
|
30891
28908
|
} catch (err2) {
|
|
@@ -31385,13 +29402,13 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
31385
29402
|
m: memo
|
|
31386
29403
|
};
|
|
31387
29404
|
const payloadString = JSON.stringify(payload);
|
|
31388
|
-
const isLargePayload =
|
|
29405
|
+
const isLargePayload = Buffer.from(payloadString).length > 1e3;
|
|
31389
29406
|
if (isLargePayload) {
|
|
31390
29407
|
this.logger.info(
|
|
31391
29408
|
"Message payload exceeds 1000 bytes, storing via inscription"
|
|
31392
29409
|
);
|
|
31393
29410
|
try {
|
|
31394
|
-
const contentBuffer =
|
|
29411
|
+
const contentBuffer = Buffer.from(data);
|
|
31395
29412
|
const fileName = `message-${Date.now()}.json`;
|
|
31396
29413
|
const inscriptionResult = await this.inscribeFile(
|
|
31397
29414
|
contentBuffer,
|
|
@@ -31468,7 +29485,7 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
31468
29485
|
}
|
|
31469
29486
|
async submitPayload(topicId, payload, submitKey, requiresFee = false) {
|
|
31470
29487
|
const message = typeof payload === "string" ? payload : JSON.stringify(payload);
|
|
31471
|
-
const payloadSizeInBytes =
|
|
29488
|
+
const payloadSizeInBytes = Buffer.byteLength(message, "utf8");
|
|
31472
29489
|
if (payloadSizeInBytes > 1e3) {
|
|
31473
29490
|
throw new PayloadSizeError(
|
|
31474
29491
|
"Payload size exceeds 1000 bytes limit",
|
|
@@ -31683,7 +29700,7 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
31683
29700
|
try {
|
|
31684
29701
|
const userPublicKey = await this.mirrorNode.getPublicKey(userAccountId);
|
|
31685
29702
|
if (topicInfo.submit_key._type === "ProtobufEncoded") {
|
|
31686
|
-
const keyBytes =
|
|
29703
|
+
const keyBytes = Buffer.from(topicInfo.submit_key.key, "hex");
|
|
31687
29704
|
const hasAccess = await this.mirrorNode.checkKeyListAccess(
|
|
31688
29705
|
keyBytes,
|
|
31689
29706
|
userPublicKey
|
|
@@ -31809,7 +29826,7 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
31809
29826
|
}
|
|
31810
29827
|
if (registrationResult.transaction) {
|
|
31811
29828
|
const transaction = Transaction.fromBytes(
|
|
31812
|
-
|
|
29829
|
+
Buffer.from(registrationResult.transaction, "base64")
|
|
31813
29830
|
);
|
|
31814
29831
|
this.logger.info(`Processing registration transaction`);
|
|
31815
29832
|
await transaction.execute(this.client);
|
|
@@ -32069,13 +30086,13 @@ class BrowserHCSClient extends HCS10BaseClient {
|
|
|
32069
30086
|
m: memo
|
|
32070
30087
|
};
|
|
32071
30088
|
const payloadString = JSON.stringify(payload);
|
|
32072
|
-
const isLargePayload =
|
|
30089
|
+
const isLargePayload = Buffer.from(payloadString).length > 1e3;
|
|
32073
30090
|
if (isLargePayload) {
|
|
32074
30091
|
this.logger.info(
|
|
32075
30092
|
"Message payload exceeds 1000 bytes, storing via inscription"
|
|
32076
30093
|
);
|
|
32077
30094
|
try {
|
|
32078
|
-
const contentBuffer =
|
|
30095
|
+
const contentBuffer = Buffer.from(data);
|
|
32079
30096
|
const fileName = `message-${Date.now()}.json`;
|
|
32080
30097
|
const inscriptionResult = await this.inscribeFile(
|
|
32081
30098
|
contentBuffer,
|
|
@@ -32501,7 +30518,7 @@ class BrowserHCSClient extends HCS10BaseClient {
|
|
|
32501
30518
|
transactionId: registrationResult.transactionId
|
|
32502
30519
|
});
|
|
32503
30520
|
const transaction = Transaction.fromBytes(
|
|
32504
|
-
|
|
30521
|
+
Buffer.from(registrationResult.transaction, "base64")
|
|
32505
30522
|
);
|
|
32506
30523
|
this.logger.info(`Processing registration transaction`);
|
|
32507
30524
|
progressReporter.submitting("Submitting transaction to network", 50, {
|