@peerbit/indexer-sqlite3 3.0.5 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/sqlite3/sqlite3.worker.min.js +7 -5
- package/dist/index.min.js +514 -512
- package/dist/index.min.js.map +4 -4
- package/package.json +4 -4
package/dist/index.min.js
CHANGED
|
@@ -18431,158 +18431,461 @@ var resize = (arr, newSize, defaultValue) => {
|
|
|
18431
18431
|
arr.length = newSize;
|
|
18432
18432
|
};
|
|
18433
18433
|
|
|
18434
|
-
// ../../../../node_modules/.pnpm
|
|
18435
|
-
var
|
|
18436
|
-
|
|
18437
|
-
|
|
18438
|
-
|
|
18439
|
-
|
|
18440
|
-
|
|
18441
|
-
|
|
18442
|
-
|
|
18443
|
-
|
|
18444
|
-
|
|
18434
|
+
// ../../../../node_modules/.pnpm/@stablelib+int@2.0.1/node_modules/@stablelib/int/lib/int.js
|
|
18435
|
+
var isInteger = Number.isInteger;
|
|
18436
|
+
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
|
|
18437
|
+
var isSafeInteger = Number.isSafeInteger;
|
|
18438
|
+
|
|
18439
|
+
// ../../../../node_modules/.pnpm/@stablelib+binary@2.0.1/node_modules/@stablelib/binary/lib/binary.js
|
|
18440
|
+
function readUint32BE(array, offset = 0) {
|
|
18441
|
+
return (array[offset] << 24 | array[offset + 1] << 16 | array[offset + 2] << 8 | array[offset + 3]) >>> 0;
|
|
18442
|
+
}
|
|
18443
|
+
function writeUint32BE(value, out = new Uint8Array(4), offset = 0) {
|
|
18444
|
+
out[offset + 0] = value >>> 24;
|
|
18445
|
+
out[offset + 1] = value >>> 16;
|
|
18446
|
+
out[offset + 2] = value >>> 8;
|
|
18447
|
+
out[offset + 3] = value >>> 0;
|
|
18448
|
+
return out;
|
|
18449
|
+
}
|
|
18450
|
+
|
|
18451
|
+
// ../../../../node_modules/.pnpm/@stablelib+wipe@2.0.1/node_modules/@stablelib/wipe/lib/wipe.js
|
|
18452
|
+
function wipe(array) {
|
|
18453
|
+
for (let i = 0; i < array.length; i++) {
|
|
18454
|
+
array[i] = 0;
|
|
18445
18455
|
}
|
|
18446
|
-
|
|
18456
|
+
return array;
|
|
18447
18457
|
}
|
|
18448
18458
|
|
|
18449
|
-
// ../../../../node_modules/.pnpm
|
|
18450
|
-
|
|
18451
|
-
|
|
18452
|
-
|
|
18459
|
+
// ../../../../node_modules/.pnpm/@stablelib+sha256@2.0.1/node_modules/@stablelib/sha256/lib/sha256.js
|
|
18460
|
+
var DIGEST_LENGTH = 32;
|
|
18461
|
+
var BLOCK_SIZE = 64;
|
|
18462
|
+
var SHA256 = class {
|
|
18463
|
+
/** Length of hash output */
|
|
18464
|
+
digestLength = DIGEST_LENGTH;
|
|
18465
|
+
/** Block size */
|
|
18466
|
+
blockSize = BLOCK_SIZE;
|
|
18467
|
+
// Note: Int32Array is used instead of Uint32Array for performance reasons.
|
|
18468
|
+
_state = new Int32Array(8);
|
|
18469
|
+
// hash state
|
|
18470
|
+
_temp = new Int32Array(64);
|
|
18471
|
+
// temporary state
|
|
18472
|
+
_buffer = new Uint8Array(128);
|
|
18473
|
+
// buffer for data to hash
|
|
18474
|
+
_bufferLength = 0;
|
|
18475
|
+
// number of bytes in buffer
|
|
18476
|
+
_bytesHashed = 0;
|
|
18477
|
+
// number of total bytes hashed
|
|
18478
|
+
_finished = false;
|
|
18479
|
+
// indicates whether the hash was finalized
|
|
18480
|
+
constructor() {
|
|
18481
|
+
this.reset();
|
|
18453
18482
|
}
|
|
18454
|
-
|
|
18455
|
-
|
|
18456
|
-
|
|
18483
|
+
_initState() {
|
|
18484
|
+
this._state[0] = 1779033703;
|
|
18485
|
+
this._state[1] = 3144134277;
|
|
18486
|
+
this._state[2] = 1013904242;
|
|
18487
|
+
this._state[3] = 2773480762;
|
|
18488
|
+
this._state[4] = 1359893119;
|
|
18489
|
+
this._state[5] = 2600822924;
|
|
18490
|
+
this._state[6] = 528734635;
|
|
18491
|
+
this._state[7] = 1541459225;
|
|
18457
18492
|
}
|
|
18458
|
-
|
|
18459
|
-
|
|
18460
|
-
|
|
18461
|
-
|
|
18462
|
-
|
|
18463
|
-
|
|
18464
|
-
|
|
18493
|
+
/**
|
|
18494
|
+
* Resets hash state making it possible
|
|
18495
|
+
* to re-use this instance to hash other data.
|
|
18496
|
+
*/
|
|
18497
|
+
reset() {
|
|
18498
|
+
this._initState();
|
|
18499
|
+
this._bufferLength = 0;
|
|
18500
|
+
this._bytesHashed = 0;
|
|
18501
|
+
this._finished = false;
|
|
18502
|
+
return this;
|
|
18465
18503
|
}
|
|
18466
|
-
|
|
18467
|
-
|
|
18468
|
-
|
|
18469
|
-
|
|
18470
|
-
|
|
18471
|
-
|
|
18472
|
-
|
|
18473
|
-
|
|
18474
|
-
|
|
18475
|
-
|
|
18476
|
-
|
|
18477
|
-
|
|
18478
|
-
|
|
18479
|
-
|
|
18480
|
-
|
|
18481
|
-
if (
|
|
18482
|
-
|
|
18483
|
-
}
|
|
18484
|
-
var zeroes = 0;
|
|
18485
|
-
var length = 0;
|
|
18486
|
-
var pbegin = 0;
|
|
18487
|
-
var pend = source.length;
|
|
18488
|
-
while (pbegin !== pend && source[pbegin] === 0) {
|
|
18489
|
-
pbegin++;
|
|
18490
|
-
zeroes++;
|
|
18504
|
+
/**
|
|
18505
|
+
* Cleans internal buffers and resets hash state.
|
|
18506
|
+
*/
|
|
18507
|
+
clean() {
|
|
18508
|
+
wipe(this._buffer);
|
|
18509
|
+
wipe(this._temp);
|
|
18510
|
+
this.reset();
|
|
18511
|
+
}
|
|
18512
|
+
/**
|
|
18513
|
+
* Updates hash state with the given data.
|
|
18514
|
+
*
|
|
18515
|
+
* Throws error when trying to update already finalized hash:
|
|
18516
|
+
* instance must be reset to update it again.
|
|
18517
|
+
*/
|
|
18518
|
+
update(data, dataLength = data.length) {
|
|
18519
|
+
if (this._finished) {
|
|
18520
|
+
throw new Error("SHA256: can't update because hash was finished.");
|
|
18491
18521
|
}
|
|
18492
|
-
|
|
18493
|
-
|
|
18494
|
-
|
|
18495
|
-
|
|
18496
|
-
|
|
18497
|
-
|
|
18498
|
-
carry += 256 * b58[it1] >>> 0;
|
|
18499
|
-
b58[it1] = carry % BASE >>> 0;
|
|
18500
|
-
carry = carry / BASE >>> 0;
|
|
18522
|
+
let dataPos = 0;
|
|
18523
|
+
this._bytesHashed += dataLength;
|
|
18524
|
+
if (this._bufferLength > 0) {
|
|
18525
|
+
while (this._bufferLength < this.blockSize && dataLength > 0) {
|
|
18526
|
+
this._buffer[this._bufferLength++] = data[dataPos++];
|
|
18527
|
+
dataLength--;
|
|
18501
18528
|
}
|
|
18502
|
-
if (
|
|
18503
|
-
|
|
18529
|
+
if (this._bufferLength === this.blockSize) {
|
|
18530
|
+
hashBlocks(this._temp, this._state, this._buffer, 0, this.blockSize);
|
|
18531
|
+
this._bufferLength = 0;
|
|
18504
18532
|
}
|
|
18505
|
-
length = i2;
|
|
18506
|
-
pbegin++;
|
|
18507
18533
|
}
|
|
18508
|
-
|
|
18509
|
-
|
|
18510
|
-
|
|
18534
|
+
if (dataLength >= this.blockSize) {
|
|
18535
|
+
dataPos = hashBlocks(this._temp, this._state, data, dataPos, dataLength);
|
|
18536
|
+
dataLength %= this.blockSize;
|
|
18511
18537
|
}
|
|
18512
|
-
|
|
18513
|
-
|
|
18514
|
-
|
|
18538
|
+
while (dataLength > 0) {
|
|
18539
|
+
this._buffer[this._bufferLength++] = data[dataPos++];
|
|
18540
|
+
dataLength--;
|
|
18515
18541
|
}
|
|
18516
|
-
return
|
|
18542
|
+
return this;
|
|
18517
18543
|
}
|
|
18518
|
-
|
|
18519
|
-
|
|
18520
|
-
|
|
18521
|
-
|
|
18522
|
-
|
|
18523
|
-
|
|
18524
|
-
|
|
18525
|
-
|
|
18526
|
-
|
|
18527
|
-
|
|
18528
|
-
|
|
18529
|
-
|
|
18530
|
-
|
|
18531
|
-
|
|
18532
|
-
zeroes++;
|
|
18533
|
-
psz++;
|
|
18534
|
-
}
|
|
18535
|
-
var size = (source.length - psz) * FACTOR + 1 >>> 0;
|
|
18536
|
-
var b256 = new Uint8Array(size);
|
|
18537
|
-
while (source[psz]) {
|
|
18538
|
-
var carry = BASE_MAP[source.charCodeAt(psz)];
|
|
18539
|
-
if (carry === 255) {
|
|
18540
|
-
return;
|
|
18541
|
-
}
|
|
18542
|
-
var i2 = 0;
|
|
18543
|
-
for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) {
|
|
18544
|
-
carry += BASE * b256[it3] >>> 0;
|
|
18545
|
-
b256[it3] = carry % 256 >>> 0;
|
|
18546
|
-
carry = carry / 256 >>> 0;
|
|
18547
|
-
}
|
|
18548
|
-
if (carry !== 0) {
|
|
18549
|
-
throw new Error("Non-zero carry");
|
|
18544
|
+
/**
|
|
18545
|
+
* Finalizes hash state and puts hash into out.
|
|
18546
|
+
* If hash was already finalized, puts the same value.
|
|
18547
|
+
*/
|
|
18548
|
+
finish(out) {
|
|
18549
|
+
if (!this._finished) {
|
|
18550
|
+
const bytesHashed = this._bytesHashed;
|
|
18551
|
+
const left = this._bufferLength;
|
|
18552
|
+
const bitLenHi = bytesHashed / 536870912 | 0;
|
|
18553
|
+
const bitLenLo = bytesHashed << 3;
|
|
18554
|
+
const padLength = bytesHashed % 64 < 56 ? 64 : 128;
|
|
18555
|
+
this._buffer[left] = 128;
|
|
18556
|
+
for (let i = left + 1; i < padLength - 8; i++) {
|
|
18557
|
+
this._buffer[i] = 0;
|
|
18550
18558
|
}
|
|
18551
|
-
|
|
18552
|
-
|
|
18553
|
-
|
|
18554
|
-
|
|
18555
|
-
return;
|
|
18556
|
-
}
|
|
18557
|
-
var it4 = size - length;
|
|
18558
|
-
while (it4 !== size && b256[it4] === 0) {
|
|
18559
|
-
it4++;
|
|
18559
|
+
writeUint32BE(bitLenHi, this._buffer, padLength - 8);
|
|
18560
|
+
writeUint32BE(bitLenLo, this._buffer, padLength - 4);
|
|
18561
|
+
hashBlocks(this._temp, this._state, this._buffer, 0, padLength);
|
|
18562
|
+
this._finished = true;
|
|
18560
18563
|
}
|
|
18561
|
-
|
|
18562
|
-
|
|
18563
|
-
while (it4 !== size) {
|
|
18564
|
-
vch[j2++] = b256[it4++];
|
|
18564
|
+
for (let i = 0; i < this.digestLength / 4; i++) {
|
|
18565
|
+
writeUint32BE(this._state[i], out, i * 4);
|
|
18565
18566
|
}
|
|
18566
|
-
return
|
|
18567
|
+
return this;
|
|
18567
18568
|
}
|
|
18568
|
-
|
|
18569
|
-
|
|
18570
|
-
|
|
18571
|
-
|
|
18572
|
-
|
|
18573
|
-
|
|
18569
|
+
/**
|
|
18570
|
+
* Returns the final hash digest.
|
|
18571
|
+
*/
|
|
18572
|
+
digest() {
|
|
18573
|
+
const out = new Uint8Array(this.digestLength);
|
|
18574
|
+
this.finish(out);
|
|
18575
|
+
return out;
|
|
18574
18576
|
}
|
|
18575
|
-
|
|
18576
|
-
|
|
18577
|
-
|
|
18578
|
-
|
|
18579
|
-
|
|
18580
|
-
|
|
18581
|
-
|
|
18582
|
-
|
|
18583
|
-
|
|
18584
|
-
|
|
18585
|
-
|
|
18577
|
+
/**
|
|
18578
|
+
* Function useful for HMAC/PBKDF2 optimization.
|
|
18579
|
+
* Returns hash state to be used with restoreState().
|
|
18580
|
+
* Only chain value is saved, not buffers or other
|
|
18581
|
+
* state variables.
|
|
18582
|
+
*/
|
|
18583
|
+
saveState() {
|
|
18584
|
+
if (this._finished) {
|
|
18585
|
+
throw new Error("SHA256: cannot save finished state");
|
|
18586
|
+
}
|
|
18587
|
+
return {
|
|
18588
|
+
state: new Int32Array(this._state),
|
|
18589
|
+
buffer: this._bufferLength > 0 ? new Uint8Array(this._buffer) : void 0,
|
|
18590
|
+
bufferLength: this._bufferLength,
|
|
18591
|
+
bytesHashed: this._bytesHashed
|
|
18592
|
+
};
|
|
18593
|
+
}
|
|
18594
|
+
/**
|
|
18595
|
+
* Function useful for HMAC/PBKDF2 optimization.
|
|
18596
|
+
* Restores state saved by saveState() and sets bytesHashed
|
|
18597
|
+
* to the given value.
|
|
18598
|
+
*/
|
|
18599
|
+
restoreState(savedState) {
|
|
18600
|
+
this._state.set(savedState.state);
|
|
18601
|
+
this._bufferLength = savedState.bufferLength;
|
|
18602
|
+
if (savedState.buffer) {
|
|
18603
|
+
this._buffer.set(savedState.buffer);
|
|
18604
|
+
}
|
|
18605
|
+
this._bytesHashed = savedState.bytesHashed;
|
|
18606
|
+
this._finished = false;
|
|
18607
|
+
return this;
|
|
18608
|
+
}
|
|
18609
|
+
/**
|
|
18610
|
+
* Cleans state returned by saveState().
|
|
18611
|
+
*/
|
|
18612
|
+
cleanSavedState(savedState) {
|
|
18613
|
+
wipe(savedState.state);
|
|
18614
|
+
if (savedState.buffer) {
|
|
18615
|
+
wipe(savedState.buffer);
|
|
18616
|
+
}
|
|
18617
|
+
savedState.bufferLength = 0;
|
|
18618
|
+
savedState.bytesHashed = 0;
|
|
18619
|
+
}
|
|
18620
|
+
};
|
|
18621
|
+
var K = new Int32Array([
|
|
18622
|
+
1116352408,
|
|
18623
|
+
1899447441,
|
|
18624
|
+
3049323471,
|
|
18625
|
+
3921009573,
|
|
18626
|
+
961987163,
|
|
18627
|
+
1508970993,
|
|
18628
|
+
2453635748,
|
|
18629
|
+
2870763221,
|
|
18630
|
+
3624381080,
|
|
18631
|
+
310598401,
|
|
18632
|
+
607225278,
|
|
18633
|
+
1426881987,
|
|
18634
|
+
1925078388,
|
|
18635
|
+
2162078206,
|
|
18636
|
+
2614888103,
|
|
18637
|
+
3248222580,
|
|
18638
|
+
3835390401,
|
|
18639
|
+
4022224774,
|
|
18640
|
+
264347078,
|
|
18641
|
+
604807628,
|
|
18642
|
+
770255983,
|
|
18643
|
+
1249150122,
|
|
18644
|
+
1555081692,
|
|
18645
|
+
1996064986,
|
|
18646
|
+
2554220882,
|
|
18647
|
+
2821834349,
|
|
18648
|
+
2952996808,
|
|
18649
|
+
3210313671,
|
|
18650
|
+
3336571891,
|
|
18651
|
+
3584528711,
|
|
18652
|
+
113926993,
|
|
18653
|
+
338241895,
|
|
18654
|
+
666307205,
|
|
18655
|
+
773529912,
|
|
18656
|
+
1294757372,
|
|
18657
|
+
1396182291,
|
|
18658
|
+
1695183700,
|
|
18659
|
+
1986661051,
|
|
18660
|
+
2177026350,
|
|
18661
|
+
2456956037,
|
|
18662
|
+
2730485921,
|
|
18663
|
+
2820302411,
|
|
18664
|
+
3259730800,
|
|
18665
|
+
3345764771,
|
|
18666
|
+
3516065817,
|
|
18667
|
+
3600352804,
|
|
18668
|
+
4094571909,
|
|
18669
|
+
275423344,
|
|
18670
|
+
430227734,
|
|
18671
|
+
506948616,
|
|
18672
|
+
659060556,
|
|
18673
|
+
883997877,
|
|
18674
|
+
958139571,
|
|
18675
|
+
1322822218,
|
|
18676
|
+
1537002063,
|
|
18677
|
+
1747873779,
|
|
18678
|
+
1955562222,
|
|
18679
|
+
2024104815,
|
|
18680
|
+
2227730452,
|
|
18681
|
+
2361852424,
|
|
18682
|
+
2428436474,
|
|
18683
|
+
2756734187,
|
|
18684
|
+
3204031479,
|
|
18685
|
+
3329325298
|
|
18686
|
+
]);
|
|
18687
|
+
function hashBlocks(w, v2, p, pos, len) {
|
|
18688
|
+
while (len >= 64) {
|
|
18689
|
+
let a = v2[0];
|
|
18690
|
+
let b = v2[1];
|
|
18691
|
+
let c = v2[2];
|
|
18692
|
+
let d = v2[3];
|
|
18693
|
+
let e = v2[4];
|
|
18694
|
+
let f = v2[5];
|
|
18695
|
+
let g = v2[6];
|
|
18696
|
+
let h = v2[7];
|
|
18697
|
+
for (let i = 0; i < 16; i++) {
|
|
18698
|
+
let j = pos + i * 4;
|
|
18699
|
+
w[i] = readUint32BE(p, j);
|
|
18700
|
+
}
|
|
18701
|
+
for (let i = 16; i < 64; i++) {
|
|
18702
|
+
let u = w[i - 2];
|
|
18703
|
+
let t1 = (u >>> 17 | u << 32 - 17) ^ (u >>> 19 | u << 32 - 19) ^ u >>> 10;
|
|
18704
|
+
u = w[i - 15];
|
|
18705
|
+
let t2 = (u >>> 7 | u << 32 - 7) ^ (u >>> 18 | u << 32 - 18) ^ u >>> 3;
|
|
18706
|
+
w[i] = (t1 + w[i - 7] | 0) + (t2 + w[i - 16] | 0);
|
|
18707
|
+
}
|
|
18708
|
+
for (let i = 0; i < 64; i++) {
|
|
18709
|
+
let t1 = (((e >>> 6 | e << 32 - 6) ^ (e >>> 11 | e << 32 - 11) ^ (e >>> 25 | e << 32 - 25)) + (e & f ^ ~e & g) | 0) + (h + (K[i] + w[i] | 0) | 0) | 0;
|
|
18710
|
+
let t2 = ((a >>> 2 | a << 32 - 2) ^ (a >>> 13 | a << 32 - 13) ^ (a >>> 22 | a << 32 - 22)) + (a & b ^ a & c ^ b & c) | 0;
|
|
18711
|
+
h = g;
|
|
18712
|
+
g = f;
|
|
18713
|
+
f = e;
|
|
18714
|
+
e = d + t1 | 0;
|
|
18715
|
+
d = c;
|
|
18716
|
+
c = b;
|
|
18717
|
+
b = a;
|
|
18718
|
+
a = t1 + t2 | 0;
|
|
18719
|
+
}
|
|
18720
|
+
v2[0] += a;
|
|
18721
|
+
v2[1] += b;
|
|
18722
|
+
v2[2] += c;
|
|
18723
|
+
v2[3] += d;
|
|
18724
|
+
v2[4] += e;
|
|
18725
|
+
v2[5] += f;
|
|
18726
|
+
v2[6] += g;
|
|
18727
|
+
v2[7] += h;
|
|
18728
|
+
pos += 64;
|
|
18729
|
+
len -= 64;
|
|
18730
|
+
}
|
|
18731
|
+
return pos;
|
|
18732
|
+
}
|
|
18733
|
+
|
|
18734
|
+
// ../../crypto/dist/src/utils.js
|
|
18735
|
+
var import_libsodium_wrappers = __toESM(require_libsodium_wrappers(), 1);
|
|
18736
|
+
|
|
18737
|
+
// ../../../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/bytes.js
|
|
18738
|
+
var empty = new Uint8Array(0);
|
|
18739
|
+
function coerce(o) {
|
|
18740
|
+
if (o instanceof Uint8Array && o.constructor.name === "Uint8Array") {
|
|
18741
|
+
return o;
|
|
18742
|
+
}
|
|
18743
|
+
if (o instanceof ArrayBuffer) {
|
|
18744
|
+
return new Uint8Array(o);
|
|
18745
|
+
}
|
|
18746
|
+
if (ArrayBuffer.isView(o)) {
|
|
18747
|
+
return new Uint8Array(o.buffer, o.byteOffset, o.byteLength);
|
|
18748
|
+
}
|
|
18749
|
+
throw new Error("Unknown type, must be binary type");
|
|
18750
|
+
}
|
|
18751
|
+
|
|
18752
|
+
// ../../../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/vendor/base-x.js
|
|
18753
|
+
function base(ALPHABET, name) {
|
|
18754
|
+
if (ALPHABET.length >= 255) {
|
|
18755
|
+
throw new TypeError("Alphabet too long");
|
|
18756
|
+
}
|
|
18757
|
+
var BASE_MAP = new Uint8Array(256);
|
|
18758
|
+
for (var j = 0; j < BASE_MAP.length; j++) {
|
|
18759
|
+
BASE_MAP[j] = 255;
|
|
18760
|
+
}
|
|
18761
|
+
for (var i = 0; i < ALPHABET.length; i++) {
|
|
18762
|
+
var x = ALPHABET.charAt(i);
|
|
18763
|
+
var xc = x.charCodeAt(0);
|
|
18764
|
+
if (BASE_MAP[xc] !== 255) {
|
|
18765
|
+
throw new TypeError(x + " is ambiguous");
|
|
18766
|
+
}
|
|
18767
|
+
BASE_MAP[xc] = i;
|
|
18768
|
+
}
|
|
18769
|
+
var BASE = ALPHABET.length;
|
|
18770
|
+
var LEADER = ALPHABET.charAt(0);
|
|
18771
|
+
var FACTOR = Math.log(BASE) / Math.log(256);
|
|
18772
|
+
var iFACTOR = Math.log(256) / Math.log(BASE);
|
|
18773
|
+
function encode(source) {
|
|
18774
|
+
if (source instanceof Uint8Array)
|
|
18775
|
+
;
|
|
18776
|
+
else if (ArrayBuffer.isView(source)) {
|
|
18777
|
+
source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
18778
|
+
} else if (Array.isArray(source)) {
|
|
18779
|
+
source = Uint8Array.from(source);
|
|
18780
|
+
}
|
|
18781
|
+
if (!(source instanceof Uint8Array)) {
|
|
18782
|
+
throw new TypeError("Expected Uint8Array");
|
|
18783
|
+
}
|
|
18784
|
+
if (source.length === 0) {
|
|
18785
|
+
return "";
|
|
18786
|
+
}
|
|
18787
|
+
var zeroes = 0;
|
|
18788
|
+
var length = 0;
|
|
18789
|
+
var pbegin = 0;
|
|
18790
|
+
var pend = source.length;
|
|
18791
|
+
while (pbegin !== pend && source[pbegin] === 0) {
|
|
18792
|
+
pbegin++;
|
|
18793
|
+
zeroes++;
|
|
18794
|
+
}
|
|
18795
|
+
var size = (pend - pbegin) * iFACTOR + 1 >>> 0;
|
|
18796
|
+
var b58 = new Uint8Array(size);
|
|
18797
|
+
while (pbegin !== pend) {
|
|
18798
|
+
var carry = source[pbegin];
|
|
18799
|
+
var i2 = 0;
|
|
18800
|
+
for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) {
|
|
18801
|
+
carry += 256 * b58[it1] >>> 0;
|
|
18802
|
+
b58[it1] = carry % BASE >>> 0;
|
|
18803
|
+
carry = carry / BASE >>> 0;
|
|
18804
|
+
}
|
|
18805
|
+
if (carry !== 0) {
|
|
18806
|
+
throw new Error("Non-zero carry");
|
|
18807
|
+
}
|
|
18808
|
+
length = i2;
|
|
18809
|
+
pbegin++;
|
|
18810
|
+
}
|
|
18811
|
+
var it2 = size - length;
|
|
18812
|
+
while (it2 !== size && b58[it2] === 0) {
|
|
18813
|
+
it2++;
|
|
18814
|
+
}
|
|
18815
|
+
var str = LEADER.repeat(zeroes);
|
|
18816
|
+
for (; it2 < size; ++it2) {
|
|
18817
|
+
str += ALPHABET.charAt(b58[it2]);
|
|
18818
|
+
}
|
|
18819
|
+
return str;
|
|
18820
|
+
}
|
|
18821
|
+
function decodeUnsafe(source) {
|
|
18822
|
+
if (typeof source !== "string") {
|
|
18823
|
+
throw new TypeError("Expected String");
|
|
18824
|
+
}
|
|
18825
|
+
if (source.length === 0) {
|
|
18826
|
+
return new Uint8Array();
|
|
18827
|
+
}
|
|
18828
|
+
var psz = 0;
|
|
18829
|
+
if (source[psz] === " ") {
|
|
18830
|
+
return;
|
|
18831
|
+
}
|
|
18832
|
+
var zeroes = 0;
|
|
18833
|
+
var length = 0;
|
|
18834
|
+
while (source[psz] === LEADER) {
|
|
18835
|
+
zeroes++;
|
|
18836
|
+
psz++;
|
|
18837
|
+
}
|
|
18838
|
+
var size = (source.length - psz) * FACTOR + 1 >>> 0;
|
|
18839
|
+
var b256 = new Uint8Array(size);
|
|
18840
|
+
while (source[psz]) {
|
|
18841
|
+
var carry = BASE_MAP[source.charCodeAt(psz)];
|
|
18842
|
+
if (carry === 255) {
|
|
18843
|
+
return;
|
|
18844
|
+
}
|
|
18845
|
+
var i2 = 0;
|
|
18846
|
+
for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) {
|
|
18847
|
+
carry += BASE * b256[it3] >>> 0;
|
|
18848
|
+
b256[it3] = carry % 256 >>> 0;
|
|
18849
|
+
carry = carry / 256 >>> 0;
|
|
18850
|
+
}
|
|
18851
|
+
if (carry !== 0) {
|
|
18852
|
+
throw new Error("Non-zero carry");
|
|
18853
|
+
}
|
|
18854
|
+
length = i2;
|
|
18855
|
+
psz++;
|
|
18856
|
+
}
|
|
18857
|
+
if (source[psz] === " ") {
|
|
18858
|
+
return;
|
|
18859
|
+
}
|
|
18860
|
+
var it4 = size - length;
|
|
18861
|
+
while (it4 !== size && b256[it4] === 0) {
|
|
18862
|
+
it4++;
|
|
18863
|
+
}
|
|
18864
|
+
var vch = new Uint8Array(zeroes + (size - it4));
|
|
18865
|
+
var j2 = zeroes;
|
|
18866
|
+
while (it4 !== size) {
|
|
18867
|
+
vch[j2++] = b256[it4++];
|
|
18868
|
+
}
|
|
18869
|
+
return vch;
|
|
18870
|
+
}
|
|
18871
|
+
function decode(string) {
|
|
18872
|
+
var buffer = decodeUnsafe(string);
|
|
18873
|
+
if (buffer) {
|
|
18874
|
+
return buffer;
|
|
18875
|
+
}
|
|
18876
|
+
throw new Error(`Non-${name} character`);
|
|
18877
|
+
}
|
|
18878
|
+
return {
|
|
18879
|
+
encode,
|
|
18880
|
+
decodeUnsafe,
|
|
18881
|
+
decode
|
|
18882
|
+
};
|
|
18883
|
+
}
|
|
18884
|
+
var src = base;
|
|
18885
|
+
var _brrp__multiformats_scope_baseX = src;
|
|
18886
|
+
var base_x_default = _brrp__multiformats_scope_baseX;
|
|
18887
|
+
|
|
18888
|
+
// ../../../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/bases/base.js
|
|
18586
18889
|
var Encoder = class {
|
|
18587
18890
|
name;
|
|
18588
18891
|
prefix;
|
|
@@ -18609,399 +18912,98 @@ var Decoder = class {
|
|
|
18609
18912
|
this.name = name;
|
|
18610
18913
|
this.prefix = prefix;
|
|
18611
18914
|
const prefixCodePoint = prefix.codePointAt(0);
|
|
18612
|
-
if (prefixCodePoint === void 0) {
|
|
18613
|
-
throw new Error("Invalid prefix character");
|
|
18614
|
-
}
|
|
18615
|
-
this.prefixCodePoint = prefixCodePoint;
|
|
18616
|
-
this.baseDecode = baseDecode;
|
|
18617
|
-
}
|
|
18618
|
-
decode(text) {
|
|
18619
|
-
if (typeof text === "string") {
|
|
18620
|
-
if (text.codePointAt(0) !== this.prefixCodePoint) {
|
|
18621
|
-
throw Error(`Unable to decode multibase string ${JSON.stringify(text)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);
|
|
18622
|
-
}
|
|
18623
|
-
return this.baseDecode(text.slice(this.prefix.length));
|
|
18624
|
-
} else {
|
|
18625
|
-
throw Error("Can only multibase decode strings");
|
|
18626
|
-
}
|
|
18627
|
-
}
|
|
18628
|
-
or(decoder) {
|
|
18629
|
-
return or(this, decoder);
|
|
18630
|
-
}
|
|
18631
|
-
};
|
|
18632
|
-
var ComposedDecoder = class {
|
|
18633
|
-
decoders;
|
|
18634
|
-
constructor(decoders) {
|
|
18635
|
-
this.decoders = decoders;
|
|
18636
|
-
}
|
|
18637
|
-
or(decoder) {
|
|
18638
|
-
return or(this, decoder);
|
|
18639
|
-
}
|
|
18640
|
-
decode(input) {
|
|
18641
|
-
const prefix = input[0];
|
|
18642
|
-
const decoder = this.decoders[prefix];
|
|
18643
|
-
if (decoder != null) {
|
|
18644
|
-
return decoder.decode(input);
|
|
18645
|
-
} else {
|
|
18646
|
-
throw RangeError(`Unable to decode multibase string ${JSON.stringify(input)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`);
|
|
18647
|
-
}
|
|
18648
|
-
}
|
|
18649
|
-
};
|
|
18650
|
-
function or(left, right) {
|
|
18651
|
-
return new ComposedDecoder({
|
|
18652
|
-
...left.decoders ?? { [left.prefix]: left },
|
|
18653
|
-
...right.decoders ?? { [right.prefix]: right }
|
|
18654
|
-
});
|
|
18655
|
-
}
|
|
18656
|
-
var Codec = class {
|
|
18657
|
-
name;
|
|
18658
|
-
prefix;
|
|
18659
|
-
baseEncode;
|
|
18660
|
-
baseDecode;
|
|
18661
|
-
encoder;
|
|
18662
|
-
decoder;
|
|
18663
|
-
constructor(name, prefix, baseEncode, baseDecode) {
|
|
18664
|
-
this.name = name;
|
|
18665
|
-
this.prefix = prefix;
|
|
18666
|
-
this.baseEncode = baseEncode;
|
|
18667
|
-
this.baseDecode = baseDecode;
|
|
18668
|
-
this.encoder = new Encoder(name, prefix, baseEncode);
|
|
18669
|
-
this.decoder = new Decoder(name, prefix, baseDecode);
|
|
18670
|
-
}
|
|
18671
|
-
encode(input) {
|
|
18672
|
-
return this.encoder.encode(input);
|
|
18673
|
-
}
|
|
18674
|
-
decode(input) {
|
|
18675
|
-
return this.decoder.decode(input);
|
|
18676
|
-
}
|
|
18677
|
-
};
|
|
18678
|
-
function from({ name, prefix, encode, decode }) {
|
|
18679
|
-
return new Codec(name, prefix, encode, decode);
|
|
18680
|
-
}
|
|
18681
|
-
function baseX({ name, prefix, alphabet }) {
|
|
18682
|
-
const { encode, decode } = base_x_default(alphabet, name);
|
|
18683
|
-
return from({
|
|
18684
|
-
prefix,
|
|
18685
|
-
name,
|
|
18686
|
-
encode,
|
|
18687
|
-
decode: (text) => coerce(decode(text))
|
|
18688
|
-
});
|
|
18689
|
-
}
|
|
18690
|
-
|
|
18691
|
-
// ../../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/bases/base58.js
|
|
18692
|
-
var base58btc = baseX({
|
|
18693
|
-
name: "base58btc",
|
|
18694
|
-
prefix: "z",
|
|
18695
|
-
alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
|
18696
|
-
});
|
|
18697
|
-
var base58flickr = baseX({
|
|
18698
|
-
name: "base58flickr",
|
|
18699
|
-
prefix: "Z",
|
|
18700
|
-
alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
|
|
18701
|
-
});
|
|
18702
|
-
|
|
18703
|
-
// ../../../../node_modules/.pnpm/@stablelib+int@2.0.1/node_modules/@stablelib/int/lib/int.js
|
|
18704
|
-
var isInteger = Number.isInteger;
|
|
18705
|
-
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
|
|
18706
|
-
var isSafeInteger = Number.isSafeInteger;
|
|
18707
|
-
|
|
18708
|
-
// ../../../../node_modules/.pnpm/@stablelib+binary@2.0.1/node_modules/@stablelib/binary/lib/binary.js
|
|
18709
|
-
function readUint32BE(array, offset = 0) {
|
|
18710
|
-
return (array[offset] << 24 | array[offset + 1] << 16 | array[offset + 2] << 8 | array[offset + 3]) >>> 0;
|
|
18711
|
-
}
|
|
18712
|
-
function writeUint32BE(value, out = new Uint8Array(4), offset = 0) {
|
|
18713
|
-
out[offset + 0] = value >>> 24;
|
|
18714
|
-
out[offset + 1] = value >>> 16;
|
|
18715
|
-
out[offset + 2] = value >>> 8;
|
|
18716
|
-
out[offset + 3] = value >>> 0;
|
|
18717
|
-
return out;
|
|
18718
|
-
}
|
|
18719
|
-
|
|
18720
|
-
// ../../../../node_modules/.pnpm/@stablelib+wipe@2.0.1/node_modules/@stablelib/wipe/lib/wipe.js
|
|
18721
|
-
function wipe(array) {
|
|
18722
|
-
for (let i = 0; i < array.length; i++) {
|
|
18723
|
-
array[i] = 0;
|
|
18724
|
-
}
|
|
18725
|
-
return array;
|
|
18726
|
-
}
|
|
18727
|
-
|
|
18728
|
-
// ../../../../node_modules/.pnpm/@stablelib+sha256@2.0.1/node_modules/@stablelib/sha256/lib/sha256.js
|
|
18729
|
-
var DIGEST_LENGTH = 32;
|
|
18730
|
-
var BLOCK_SIZE = 64;
|
|
18731
|
-
var SHA256 = class {
|
|
18732
|
-
/** Length of hash output */
|
|
18733
|
-
digestLength = DIGEST_LENGTH;
|
|
18734
|
-
/** Block size */
|
|
18735
|
-
blockSize = BLOCK_SIZE;
|
|
18736
|
-
// Note: Int32Array is used instead of Uint32Array for performance reasons.
|
|
18737
|
-
_state = new Int32Array(8);
|
|
18738
|
-
// hash state
|
|
18739
|
-
_temp = new Int32Array(64);
|
|
18740
|
-
// temporary state
|
|
18741
|
-
_buffer = new Uint8Array(128);
|
|
18742
|
-
// buffer for data to hash
|
|
18743
|
-
_bufferLength = 0;
|
|
18744
|
-
// number of bytes in buffer
|
|
18745
|
-
_bytesHashed = 0;
|
|
18746
|
-
// number of total bytes hashed
|
|
18747
|
-
_finished = false;
|
|
18748
|
-
// indicates whether the hash was finalized
|
|
18749
|
-
constructor() {
|
|
18750
|
-
this.reset();
|
|
18751
|
-
}
|
|
18752
|
-
_initState() {
|
|
18753
|
-
this._state[0] = 1779033703;
|
|
18754
|
-
this._state[1] = 3144134277;
|
|
18755
|
-
this._state[2] = 1013904242;
|
|
18756
|
-
this._state[3] = 2773480762;
|
|
18757
|
-
this._state[4] = 1359893119;
|
|
18758
|
-
this._state[5] = 2600822924;
|
|
18759
|
-
this._state[6] = 528734635;
|
|
18760
|
-
this._state[7] = 1541459225;
|
|
18761
|
-
}
|
|
18762
|
-
/**
|
|
18763
|
-
* Resets hash state making it possible
|
|
18764
|
-
* to re-use this instance to hash other data.
|
|
18765
|
-
*/
|
|
18766
|
-
reset() {
|
|
18767
|
-
this._initState();
|
|
18768
|
-
this._bufferLength = 0;
|
|
18769
|
-
this._bytesHashed = 0;
|
|
18770
|
-
this._finished = false;
|
|
18771
|
-
return this;
|
|
18772
|
-
}
|
|
18773
|
-
/**
|
|
18774
|
-
* Cleans internal buffers and resets hash state.
|
|
18775
|
-
*/
|
|
18776
|
-
clean() {
|
|
18777
|
-
wipe(this._buffer);
|
|
18778
|
-
wipe(this._temp);
|
|
18779
|
-
this.reset();
|
|
18780
|
-
}
|
|
18781
|
-
/**
|
|
18782
|
-
* Updates hash state with the given data.
|
|
18783
|
-
*
|
|
18784
|
-
* Throws error when trying to update already finalized hash:
|
|
18785
|
-
* instance must be reset to update it again.
|
|
18786
|
-
*/
|
|
18787
|
-
update(data, dataLength = data.length) {
|
|
18788
|
-
if (this._finished) {
|
|
18789
|
-
throw new Error("SHA256: can't update because hash was finished.");
|
|
18790
|
-
}
|
|
18791
|
-
let dataPos = 0;
|
|
18792
|
-
this._bytesHashed += dataLength;
|
|
18793
|
-
if (this._bufferLength > 0) {
|
|
18794
|
-
while (this._bufferLength < this.blockSize && dataLength > 0) {
|
|
18795
|
-
this._buffer[this._bufferLength++] = data[dataPos++];
|
|
18796
|
-
dataLength--;
|
|
18797
|
-
}
|
|
18798
|
-
if (this._bufferLength === this.blockSize) {
|
|
18799
|
-
hashBlocks(this._temp, this._state, this._buffer, 0, this.blockSize);
|
|
18800
|
-
this._bufferLength = 0;
|
|
18801
|
-
}
|
|
18802
|
-
}
|
|
18803
|
-
if (dataLength >= this.blockSize) {
|
|
18804
|
-
dataPos = hashBlocks(this._temp, this._state, data, dataPos, dataLength);
|
|
18805
|
-
dataLength %= this.blockSize;
|
|
18806
|
-
}
|
|
18807
|
-
while (dataLength > 0) {
|
|
18808
|
-
this._buffer[this._bufferLength++] = data[dataPos++];
|
|
18809
|
-
dataLength--;
|
|
18915
|
+
if (prefixCodePoint === void 0) {
|
|
18916
|
+
throw new Error("Invalid prefix character");
|
|
18810
18917
|
}
|
|
18811
|
-
|
|
18918
|
+
this.prefixCodePoint = prefixCodePoint;
|
|
18919
|
+
this.baseDecode = baseDecode;
|
|
18812
18920
|
}
|
|
18813
|
-
|
|
18814
|
-
|
|
18815
|
-
|
|
18816
|
-
|
|
18817
|
-
finish(out) {
|
|
18818
|
-
if (!this._finished) {
|
|
18819
|
-
const bytesHashed = this._bytesHashed;
|
|
18820
|
-
const left = this._bufferLength;
|
|
18821
|
-
const bitLenHi = bytesHashed / 536870912 | 0;
|
|
18822
|
-
const bitLenLo = bytesHashed << 3;
|
|
18823
|
-
const padLength = bytesHashed % 64 < 56 ? 64 : 128;
|
|
18824
|
-
this._buffer[left] = 128;
|
|
18825
|
-
for (let i = left + 1; i < padLength - 8; i++) {
|
|
18826
|
-
this._buffer[i] = 0;
|
|
18921
|
+
decode(text) {
|
|
18922
|
+
if (typeof text === "string") {
|
|
18923
|
+
if (text.codePointAt(0) !== this.prefixCodePoint) {
|
|
18924
|
+
throw Error(`Unable to decode multibase string ${JSON.stringify(text)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);
|
|
18827
18925
|
}
|
|
18828
|
-
|
|
18829
|
-
|
|
18830
|
-
|
|
18831
|
-
this._finished = true;
|
|
18832
|
-
}
|
|
18833
|
-
for (let i = 0; i < this.digestLength / 4; i++) {
|
|
18834
|
-
writeUint32BE(this._state[i], out, i * 4);
|
|
18926
|
+
return this.baseDecode(text.slice(this.prefix.length));
|
|
18927
|
+
} else {
|
|
18928
|
+
throw Error("Can only multibase decode strings");
|
|
18835
18929
|
}
|
|
18836
|
-
return this;
|
|
18837
18930
|
}
|
|
18838
|
-
|
|
18839
|
-
|
|
18840
|
-
*/
|
|
18841
|
-
digest() {
|
|
18842
|
-
const out = new Uint8Array(this.digestLength);
|
|
18843
|
-
this.finish(out);
|
|
18844
|
-
return out;
|
|
18931
|
+
or(decoder) {
|
|
18932
|
+
return or(this, decoder);
|
|
18845
18933
|
}
|
|
18846
|
-
|
|
18847
|
-
|
|
18848
|
-
|
|
18849
|
-
|
|
18850
|
-
|
|
18851
|
-
*/
|
|
18852
|
-
saveState() {
|
|
18853
|
-
if (this._finished) {
|
|
18854
|
-
throw new Error("SHA256: cannot save finished state");
|
|
18855
|
-
}
|
|
18856
|
-
return {
|
|
18857
|
-
state: new Int32Array(this._state),
|
|
18858
|
-
buffer: this._bufferLength > 0 ? new Uint8Array(this._buffer) : void 0,
|
|
18859
|
-
bufferLength: this._bufferLength,
|
|
18860
|
-
bytesHashed: this._bytesHashed
|
|
18861
|
-
};
|
|
18934
|
+
};
|
|
18935
|
+
var ComposedDecoder = class {
|
|
18936
|
+
decoders;
|
|
18937
|
+
constructor(decoders) {
|
|
18938
|
+
this.decoders = decoders;
|
|
18862
18939
|
}
|
|
18863
|
-
|
|
18864
|
-
|
|
18865
|
-
* Restores state saved by saveState() and sets bytesHashed
|
|
18866
|
-
* to the given value.
|
|
18867
|
-
*/
|
|
18868
|
-
restoreState(savedState) {
|
|
18869
|
-
this._state.set(savedState.state);
|
|
18870
|
-
this._bufferLength = savedState.bufferLength;
|
|
18871
|
-
if (savedState.buffer) {
|
|
18872
|
-
this._buffer.set(savedState.buffer);
|
|
18873
|
-
}
|
|
18874
|
-
this._bytesHashed = savedState.bytesHashed;
|
|
18875
|
-
this._finished = false;
|
|
18876
|
-
return this;
|
|
18940
|
+
or(decoder) {
|
|
18941
|
+
return or(this, decoder);
|
|
18877
18942
|
}
|
|
18878
|
-
|
|
18879
|
-
|
|
18880
|
-
|
|
18881
|
-
|
|
18882
|
-
|
|
18883
|
-
|
|
18884
|
-
|
|
18943
|
+
decode(input) {
|
|
18944
|
+
const prefix = input[0];
|
|
18945
|
+
const decoder = this.decoders[prefix];
|
|
18946
|
+
if (decoder != null) {
|
|
18947
|
+
return decoder.decode(input);
|
|
18948
|
+
} else {
|
|
18949
|
+
throw RangeError(`Unable to decode multibase string ${JSON.stringify(input)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`);
|
|
18885
18950
|
}
|
|
18886
|
-
savedState.bufferLength = 0;
|
|
18887
|
-
savedState.bytesHashed = 0;
|
|
18888
18951
|
}
|
|
18889
18952
|
};
|
|
18890
|
-
|
|
18891
|
-
|
|
18892
|
-
|
|
18893
|
-
|
|
18894
|
-
|
|
18895
|
-
|
|
18896
|
-
|
|
18897
|
-
|
|
18898
|
-
|
|
18899
|
-
|
|
18900
|
-
|
|
18901
|
-
|
|
18902
|
-
|
|
18903
|
-
|
|
18904
|
-
|
|
18905
|
-
|
|
18906
|
-
|
|
18907
|
-
|
|
18908
|
-
|
|
18909
|
-
|
|
18910
|
-
604807628,
|
|
18911
|
-
770255983,
|
|
18912
|
-
1249150122,
|
|
18913
|
-
1555081692,
|
|
18914
|
-
1996064986,
|
|
18915
|
-
2554220882,
|
|
18916
|
-
2821834349,
|
|
18917
|
-
2952996808,
|
|
18918
|
-
3210313671,
|
|
18919
|
-
3336571891,
|
|
18920
|
-
3584528711,
|
|
18921
|
-
113926993,
|
|
18922
|
-
338241895,
|
|
18923
|
-
666307205,
|
|
18924
|
-
773529912,
|
|
18925
|
-
1294757372,
|
|
18926
|
-
1396182291,
|
|
18927
|
-
1695183700,
|
|
18928
|
-
1986661051,
|
|
18929
|
-
2177026350,
|
|
18930
|
-
2456956037,
|
|
18931
|
-
2730485921,
|
|
18932
|
-
2820302411,
|
|
18933
|
-
3259730800,
|
|
18934
|
-
3345764771,
|
|
18935
|
-
3516065817,
|
|
18936
|
-
3600352804,
|
|
18937
|
-
4094571909,
|
|
18938
|
-
275423344,
|
|
18939
|
-
430227734,
|
|
18940
|
-
506948616,
|
|
18941
|
-
659060556,
|
|
18942
|
-
883997877,
|
|
18943
|
-
958139571,
|
|
18944
|
-
1322822218,
|
|
18945
|
-
1537002063,
|
|
18946
|
-
1747873779,
|
|
18947
|
-
1955562222,
|
|
18948
|
-
2024104815,
|
|
18949
|
-
2227730452,
|
|
18950
|
-
2361852424,
|
|
18951
|
-
2428436474,
|
|
18952
|
-
2756734187,
|
|
18953
|
-
3204031479,
|
|
18954
|
-
3329325298
|
|
18955
|
-
]);
|
|
18956
|
-
function hashBlocks(w, v2, p, pos, len) {
|
|
18957
|
-
while (len >= 64) {
|
|
18958
|
-
let a = v2[0];
|
|
18959
|
-
let b = v2[1];
|
|
18960
|
-
let c = v2[2];
|
|
18961
|
-
let d = v2[3];
|
|
18962
|
-
let e = v2[4];
|
|
18963
|
-
let f = v2[5];
|
|
18964
|
-
let g = v2[6];
|
|
18965
|
-
let h = v2[7];
|
|
18966
|
-
for (let i = 0; i < 16; i++) {
|
|
18967
|
-
let j = pos + i * 4;
|
|
18968
|
-
w[i] = readUint32BE(p, j);
|
|
18969
|
-
}
|
|
18970
|
-
for (let i = 16; i < 64; i++) {
|
|
18971
|
-
let u = w[i - 2];
|
|
18972
|
-
let t1 = (u >>> 17 | u << 32 - 17) ^ (u >>> 19 | u << 32 - 19) ^ u >>> 10;
|
|
18973
|
-
u = w[i - 15];
|
|
18974
|
-
let t2 = (u >>> 7 | u << 32 - 7) ^ (u >>> 18 | u << 32 - 18) ^ u >>> 3;
|
|
18975
|
-
w[i] = (t1 + w[i - 7] | 0) + (t2 + w[i - 16] | 0);
|
|
18976
|
-
}
|
|
18977
|
-
for (let i = 0; i < 64; i++) {
|
|
18978
|
-
let t1 = (((e >>> 6 | e << 32 - 6) ^ (e >>> 11 | e << 32 - 11) ^ (e >>> 25 | e << 32 - 25)) + (e & f ^ ~e & g) | 0) + (h + (K[i] + w[i] | 0) | 0) | 0;
|
|
18979
|
-
let t2 = ((a >>> 2 | a << 32 - 2) ^ (a >>> 13 | a << 32 - 13) ^ (a >>> 22 | a << 32 - 22)) + (a & b ^ a & c ^ b & c) | 0;
|
|
18980
|
-
h = g;
|
|
18981
|
-
g = f;
|
|
18982
|
-
f = e;
|
|
18983
|
-
e = d + t1 | 0;
|
|
18984
|
-
d = c;
|
|
18985
|
-
c = b;
|
|
18986
|
-
b = a;
|
|
18987
|
-
a = t1 + t2 | 0;
|
|
18988
|
-
}
|
|
18989
|
-
v2[0] += a;
|
|
18990
|
-
v2[1] += b;
|
|
18991
|
-
v2[2] += c;
|
|
18992
|
-
v2[3] += d;
|
|
18993
|
-
v2[4] += e;
|
|
18994
|
-
v2[5] += f;
|
|
18995
|
-
v2[6] += g;
|
|
18996
|
-
v2[7] += h;
|
|
18997
|
-
pos += 64;
|
|
18998
|
-
len -= 64;
|
|
18953
|
+
function or(left, right) {
|
|
18954
|
+
return new ComposedDecoder({
|
|
18955
|
+
...left.decoders ?? { [left.prefix]: left },
|
|
18956
|
+
...right.decoders ?? { [right.prefix]: right }
|
|
18957
|
+
});
|
|
18958
|
+
}
|
|
18959
|
+
var Codec = class {
|
|
18960
|
+
name;
|
|
18961
|
+
prefix;
|
|
18962
|
+
baseEncode;
|
|
18963
|
+
baseDecode;
|
|
18964
|
+
encoder;
|
|
18965
|
+
decoder;
|
|
18966
|
+
constructor(name, prefix, baseEncode, baseDecode) {
|
|
18967
|
+
this.name = name;
|
|
18968
|
+
this.prefix = prefix;
|
|
18969
|
+
this.baseEncode = baseEncode;
|
|
18970
|
+
this.baseDecode = baseDecode;
|
|
18971
|
+
this.encoder = new Encoder(name, prefix, baseEncode);
|
|
18972
|
+
this.decoder = new Decoder(name, prefix, baseDecode);
|
|
18999
18973
|
}
|
|
19000
|
-
|
|
18974
|
+
encode(input) {
|
|
18975
|
+
return this.encoder.encode(input);
|
|
18976
|
+
}
|
|
18977
|
+
decode(input) {
|
|
18978
|
+
return this.decoder.decode(input);
|
|
18979
|
+
}
|
|
18980
|
+
};
|
|
18981
|
+
function from({ name, prefix, encode, decode }) {
|
|
18982
|
+
return new Codec(name, prefix, encode, decode);
|
|
18983
|
+
}
|
|
18984
|
+
function baseX({ name, prefix, alphabet }) {
|
|
18985
|
+
const { encode, decode } = base_x_default(alphabet, name);
|
|
18986
|
+
return from({
|
|
18987
|
+
prefix,
|
|
18988
|
+
name,
|
|
18989
|
+
encode,
|
|
18990
|
+
decode: (text) => coerce(decode(text))
|
|
18991
|
+
});
|
|
19001
18992
|
}
|
|
19002
18993
|
|
|
18994
|
+
// ../../../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/bases/base58.js
|
|
18995
|
+
var base58btc = baseX({
|
|
18996
|
+
name: "base58btc",
|
|
18997
|
+
prefix: "z",
|
|
18998
|
+
alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
|
18999
|
+
});
|
|
19000
|
+
var base58flickr = baseX({
|
|
19001
|
+
name: "base58flickr",
|
|
19002
|
+
prefix: "Z",
|
|
19003
|
+
alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
|
|
19004
|
+
});
|
|
19005
|
+
|
|
19003
19006
|
// ../../crypto/dist/src/utils.js
|
|
19004
|
-
var import_libsodium_wrappers = __toESM(require_libsodium_wrappers(), 1);
|
|
19005
19007
|
var fromHexString = (hexString) => import_libsodium_wrappers.default.from_hex(hexString);
|
|
19006
19008
|
var asU8 = (bytes) => {
|
|
19007
19009
|
return bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|