@seelen-ui/lib 2.4.7 → 2.4.9
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/esm/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts +23 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_common16.js +51 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_common32.d.ts +35 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_common32.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_common32.js +192 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_validate_binary_like.d.ts +2 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_validate_binary_like.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_validate_binary_like.js +26 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/ascii85.d.ts +61 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/ascii85.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/ascii85.js +152 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/base32.d.ts +40 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/base32.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/base32.js +87 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/base58.d.ts +40 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/base58.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/base58.js +131 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/base64.d.ts +40 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/base64.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/base64.js +82 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts +39 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/hex.js +87 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/mod.d.ts +98 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/mod.js +99 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/varint.d.ts +120 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/varint.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/varint.js +205 -0
- package/esm/gen/types/FancyToolbarSettings.d.ts +0 -8
- package/esm/gen/types/FancyToolbarSettings.d.ts.map +1 -1
- package/esm/gen/types/FocusedApp.d.ts +6 -0
- package/esm/gen/types/FocusedApp.d.ts.map +1 -1
- package/esm/gen/types/SeelenCommandArgument.d.ts +4 -0
- package/esm/gen/types/SeelenCommandArgument.d.ts.map +1 -1
- package/esm/gen/types/SeelenCommandReturn.d.ts +4 -0
- package/esm/gen/types/SeelenCommandReturn.d.ts.map +1 -1
- package/esm/gen/types/SeelenEventPayload.d.ts +0 -4
- package/esm/gen/types/SeelenEventPayload.d.ts.map +1 -1
- package/esm/gen/types/Wallpaper.d.ts +9 -2
- package/esm/gen/types/Wallpaper.d.ts.map +1 -1
- package/esm/gen/types/WallpaperKind.d.ts +7 -0
- package/esm/gen/types/WallpaperKind.d.ts.map +1 -0
- package/esm/gen/types/WallpaperKind.js +8 -0
- package/esm/gen/types/mod.d.ts +1 -0
- package/esm/gen/types/mod.d.ts.map +1 -1
- package/esm/gen/types/mod.js +1 -0
- package/esm/src/handlers/commands.d.ts +2 -0
- package/esm/src/handlers/commands.d.ts.map +1 -1
- package/esm/src/handlers/commands.js +2 -0
- package/esm/src/handlers/events.d.ts +0 -2
- package/esm/src/handlers/events.d.ts.map +1 -1
- package/esm/src/handlers/events.js +0 -2
- package/esm/src/state/theme/mod.d.ts.map +1 -1
- package/esm/src/state/theme/mod.js +2 -0
- package/esm/src/state/theme/theming.d.ts +2 -0
- package/esm/src/state/theme/theming.d.ts.map +1 -0
- package/esm/src/state/theme/theming.js +59 -0
- package/esm/src/state/widget/mod.js +1 -1
- package/package.json +7 -6
- package/script/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts +23 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_common16.js +57 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_common32.d.ts +35 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_common32.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_common32.js +198 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_validate_binary_like.d.ts +2 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_validate_binary_like.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_validate_binary_like.js +29 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/ascii85.d.ts +61 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/ascii85.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/ascii85.js +156 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/base32.d.ts +40 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/base32.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/base32.js +91 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/base58.d.ts +40 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/base58.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/base58.js +135 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/base64.d.ts +40 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/base64.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/base64.js +86 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts +39 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/hex.js +91 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/mod.d.ts +98 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/mod.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/mod.js +115 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/varint.d.ts +120 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/varint.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/varint.js +211 -0
- package/script/gen/types/FancyToolbarSettings.d.ts +0 -8
- package/script/gen/types/FancyToolbarSettings.d.ts.map +1 -1
- package/script/gen/types/FocusedApp.d.ts +6 -0
- package/script/gen/types/FocusedApp.d.ts.map +1 -1
- package/script/gen/types/SeelenCommandArgument.d.ts +4 -0
- package/script/gen/types/SeelenCommandArgument.d.ts.map +1 -1
- package/script/gen/types/SeelenCommandReturn.d.ts +4 -0
- package/script/gen/types/SeelenCommandReturn.d.ts.map +1 -1
- package/script/gen/types/SeelenEventPayload.d.ts +0 -4
- package/script/gen/types/SeelenEventPayload.d.ts.map +1 -1
- package/script/gen/types/Wallpaper.d.ts +9 -2
- package/script/gen/types/Wallpaper.d.ts.map +1 -1
- package/script/gen/types/WallpaperKind.d.ts +7 -0
- package/script/gen/types/WallpaperKind.d.ts.map +1 -0
- package/script/gen/types/WallpaperKind.js +11 -0
- package/script/gen/types/mod.d.ts +1 -0
- package/script/gen/types/mod.d.ts.map +1 -1
- package/script/gen/types/mod.js +1 -0
- package/script/src/handlers/commands.d.ts +2 -0
- package/script/src/handlers/commands.d.ts.map +1 -1
- package/script/src/handlers/commands.js +2 -0
- package/script/src/handlers/events.d.ts +0 -2
- package/script/src/handlers/events.d.ts.map +1 -1
- package/script/src/handlers/events.js +0 -2
- package/script/src/re-exports/tauri.js +17 -7
- package/script/src/state/theme/mod.d.ts.map +1 -1
- package/script/src/state/theme/mod.js +2 -0
- package/script/src/state/theme/theming.d.ts +2 -0
- package/script/src/state/theme/theming.d.ts.map +1 -0
- package/script/src/state/theme/theming.js +62 -0
- package/script/src/state/widget/mod.js +19 -9
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Uint8Array_ } from "./_types.js";
|
|
2
|
+
export type { Uint8Array_ };
|
|
3
|
+
export declare const alphabet: Uint8Array<ArrayBufferLike>;
|
|
4
|
+
export declare const rAlphabet: Uint8Array<ArrayBuffer>;
|
|
5
|
+
/**
|
|
6
|
+
* Calculate the output size needed to encode a given input size for
|
|
7
|
+
* {@linkcode encodeIntoHex}.
|
|
8
|
+
*
|
|
9
|
+
* @param originalSize The size of the input buffer.
|
|
10
|
+
* @returns The size of the output buffer.
|
|
11
|
+
*
|
|
12
|
+
* @example Basic Usage
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { assertEquals } from "@std/assert";
|
|
15
|
+
* import { calcSizeHex } from "@std/encoding/unstable-hex";
|
|
16
|
+
*
|
|
17
|
+
* assertEquals(calcSizeHex(1), 2);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function calcSizeHex(originalSize: number): number;
|
|
21
|
+
export declare function encode(buffer: Uint8Array_, i: number, o: number, alphabet: Uint8Array): number;
|
|
22
|
+
export declare function decode(buffer: Uint8Array_, i: number, o: number, alphabet: Uint8Array): number;
|
|
23
|
+
//# sourceMappingURL=_common16.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_common16.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/1.0.10/_common16.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,eAAO,MAAM,QAAQ,6BAA+C,CAAC;AACrE,eAAO,MAAM,SAAS,yBAA+B,CAAC;AAMtD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,MAAM,CACpB,MAAM,EAAE,WAAW,EACnB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,QAAQ,EAAE,UAAU,GACnB,MAAM,CAOR;AAED,wBAAgB,MAAM,CACpB,MAAM,EAAE,WAAW,EACnB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,QAAQ,EAAE,UAAU,GACnB,MAAM,CAeR"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
export const alphabet = new TextEncoder().encode("0123456789abcdef");
|
|
3
|
+
export const rAlphabet = new Uint8Array(128).fill(16); // alphabet.Hex.length
|
|
4
|
+
alphabet.forEach((byte, i) => rAlphabet[byte] = i);
|
|
5
|
+
new TextEncoder()
|
|
6
|
+
.encode("ABCDEF")
|
|
7
|
+
.forEach((byte, i) => rAlphabet[byte] = i + 10);
|
|
8
|
+
/**
|
|
9
|
+
* Calculate the output size needed to encode a given input size for
|
|
10
|
+
* {@linkcode encodeIntoHex}.
|
|
11
|
+
*
|
|
12
|
+
* @param originalSize The size of the input buffer.
|
|
13
|
+
* @returns The size of the output buffer.
|
|
14
|
+
*
|
|
15
|
+
* @example Basic Usage
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { assertEquals } from "@std/assert";
|
|
18
|
+
* import { calcSizeHex } from "@std/encoding/unstable-hex";
|
|
19
|
+
*
|
|
20
|
+
* assertEquals(calcSizeHex(1), 2);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function calcSizeHex(originalSize) {
|
|
24
|
+
return originalSize * 2;
|
|
25
|
+
}
|
|
26
|
+
export function encode(buffer, i, o, alphabet) {
|
|
27
|
+
for (; i < buffer.length; ++i) {
|
|
28
|
+
const x = buffer[i];
|
|
29
|
+
buffer[o++] = alphabet[x >> 4];
|
|
30
|
+
buffer[o++] = alphabet[x & 0xF];
|
|
31
|
+
}
|
|
32
|
+
return o;
|
|
33
|
+
}
|
|
34
|
+
export function decode(buffer, i, o, alphabet) {
|
|
35
|
+
if ((buffer.length - o) % 2 === 1) {
|
|
36
|
+
throw new RangeError(`Cannot decode input as hex: Length (${buffer.length - o}) must be divisible by 2`);
|
|
37
|
+
}
|
|
38
|
+
i += 1;
|
|
39
|
+
for (; i < buffer.length; i += 2) {
|
|
40
|
+
buffer[o++] = (getByte(buffer[i - 1], alphabet) << 4) |
|
|
41
|
+
getByte(buffer[i], alphabet);
|
|
42
|
+
}
|
|
43
|
+
return o;
|
|
44
|
+
}
|
|
45
|
+
function getByte(char, alphabet) {
|
|
46
|
+
const byte = alphabet[char] ?? 16;
|
|
47
|
+
if (byte === 16) { // alphabet.Hex.length
|
|
48
|
+
throw new TypeError(`Cannot decode input as hex: Invalid character (${String.fromCharCode(char)})`);
|
|
49
|
+
}
|
|
50
|
+
return byte;
|
|
51
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Uint8Array_ } from "./_types.js";
|
|
2
|
+
export type { Uint8Array_ };
|
|
3
|
+
export declare const padding: number;
|
|
4
|
+
export declare const alphabet: Record<Base32Alphabet, Uint8Array>;
|
|
5
|
+
export declare const rAlphabet: Record<Base32Alphabet, Uint8Array>;
|
|
6
|
+
/**
|
|
7
|
+
* Options for encoding and decoding base32 strings.
|
|
8
|
+
*/
|
|
9
|
+
export interface Base32Options {
|
|
10
|
+
/** The base32 alphabet. Defaults to "base32" */
|
|
11
|
+
alphabet?: Base32Alphabet;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The base32 alphabets.
|
|
15
|
+
*/
|
|
16
|
+
export type Base32Alphabet = "base32" | "base32hex" | "base32crockford";
|
|
17
|
+
/**
|
|
18
|
+
* Calculate the output size needed to encode a given input size for
|
|
19
|
+
* {@linkcode encodeIntoBase32}.
|
|
20
|
+
*
|
|
21
|
+
* @param rawSize The size of the input buffer.
|
|
22
|
+
* @returns The size of the output buffer.
|
|
23
|
+
*
|
|
24
|
+
* @example Basic Usage
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { assertEquals } from "@std/assert";
|
|
27
|
+
* import { calcSizeBase32 } from "@std/encoding/unstable-base32";
|
|
28
|
+
*
|
|
29
|
+
* assertEquals(calcSizeBase32(1), 8);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function calcSizeBase32(rawSize: number): number;
|
|
33
|
+
export declare function encode(buffer: Uint8Array_, i: number, o: number, alphabet: Uint8Array, padding: number): number;
|
|
34
|
+
export declare function decode(buffer: Uint8Array_, i: number, o: number, alphabet: Uint8Array, padding: number): number;
|
|
35
|
+
//# sourceMappingURL=_common32.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_common32.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/1.0.10/_common32.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,eAAO,MAAM,OAAO,QAAoB,CAAC;AACzC,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,cAAc,EAAE,UAAU,CAIvD,CAAC;AACF,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,cAAc,EAAE,UAAU,CAIxD,CAAC;AAQF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,gDAAgD;IAChD,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,WAAW,GAAG,iBAAiB,CAAC;AAExE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,MAAM,CACpB,MAAM,EAAE,WAAW,EACnB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,MAAM,GACd,MAAM,CAmER;AAED,wBAAgB,MAAM,CACpB,MAAM,EAAE,WAAW,EACnB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,MAAM,GACd,MAAM,CAyFR"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
export const padding = "=".charCodeAt(0);
|
|
3
|
+
export const alphabet = {
|
|
4
|
+
base32: new TextEncoder().encode("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),
|
|
5
|
+
base32hex: new TextEncoder().encode("0123456789ABCDEFGHIJKLMNOPQRSTUV"),
|
|
6
|
+
base32crockford: new TextEncoder().encode("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),
|
|
7
|
+
};
|
|
8
|
+
export const rAlphabet = {
|
|
9
|
+
base32: new Uint8Array(128).fill(32), // alphabet.base32.length
|
|
10
|
+
base32hex: new Uint8Array(128).fill(32),
|
|
11
|
+
base32crockford: new Uint8Array(128).fill(32),
|
|
12
|
+
};
|
|
13
|
+
alphabet.base32
|
|
14
|
+
.forEach((byte, i) => rAlphabet.base32[byte] = i);
|
|
15
|
+
alphabet.base32hex
|
|
16
|
+
.forEach((byte, i) => rAlphabet.base32hex[byte] = i);
|
|
17
|
+
alphabet.base32crockford
|
|
18
|
+
.forEach((byte, i) => rAlphabet.base32crockford[byte] = i);
|
|
19
|
+
/**
|
|
20
|
+
* Calculate the output size needed to encode a given input size for
|
|
21
|
+
* {@linkcode encodeIntoBase32}.
|
|
22
|
+
*
|
|
23
|
+
* @param rawSize The size of the input buffer.
|
|
24
|
+
* @returns The size of the output buffer.
|
|
25
|
+
*
|
|
26
|
+
* @example Basic Usage
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { assertEquals } from "@std/assert";
|
|
29
|
+
* import { calcSizeBase32 } from "@std/encoding/unstable-base32";
|
|
30
|
+
*
|
|
31
|
+
* assertEquals(calcSizeBase32(1), 8);
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export function calcSizeBase32(rawSize) {
|
|
35
|
+
return ((rawSize + 4) / 5 | 0) * 8;
|
|
36
|
+
}
|
|
37
|
+
export function encode(buffer, i, o, alphabet, padding) {
|
|
38
|
+
i += 4;
|
|
39
|
+
for (; i < buffer.length; i += 5) {
|
|
40
|
+
let x = (buffer[i - 4] << 16) | (buffer[i - 3] << 8) | buffer[i - 2];
|
|
41
|
+
buffer[o++] = alphabet[x >> 19];
|
|
42
|
+
buffer[o++] = alphabet[x >> 14 & 0x1F];
|
|
43
|
+
buffer[o++] = alphabet[x >> 9 & 0x1F];
|
|
44
|
+
buffer[o++] = alphabet[x >> 4 & 0x1F];
|
|
45
|
+
x = (x << 16) | (buffer[i - 1] << 8) | buffer[i];
|
|
46
|
+
buffer[o++] = alphabet[x >> 15 & 0x1F];
|
|
47
|
+
buffer[o++] = alphabet[x >> 10 & 0x1F];
|
|
48
|
+
buffer[o++] = alphabet[x >> 5 & 0x1F];
|
|
49
|
+
buffer[o++] = alphabet[x & 0x1F];
|
|
50
|
+
}
|
|
51
|
+
switch (i) {
|
|
52
|
+
case buffer.length + 3: {
|
|
53
|
+
const x = buffer[i - 4] << 16;
|
|
54
|
+
buffer[o++] = alphabet[x >> 19];
|
|
55
|
+
buffer[o++] = alphabet[x >> 14 & 0x1F];
|
|
56
|
+
buffer[o++] = padding;
|
|
57
|
+
buffer[o++] = padding;
|
|
58
|
+
buffer[o++] = padding;
|
|
59
|
+
buffer[o++] = padding;
|
|
60
|
+
buffer[o++] = padding;
|
|
61
|
+
buffer[o++] = padding;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case buffer.length + 2: {
|
|
65
|
+
const x = (buffer[i - 4] << 16) | (buffer[i - 3] << 8);
|
|
66
|
+
buffer[o++] = alphabet[x >> 19];
|
|
67
|
+
buffer[o++] = alphabet[x >> 14 & 0x1F];
|
|
68
|
+
buffer[o++] = alphabet[x >> 9 & 0x1F];
|
|
69
|
+
buffer[o++] = alphabet[x >> 4 & 0x1F];
|
|
70
|
+
buffer[o++] = padding;
|
|
71
|
+
buffer[o++] = padding;
|
|
72
|
+
buffer[o++] = padding;
|
|
73
|
+
buffer[o++] = padding;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
case buffer.length + 1: {
|
|
77
|
+
let x = (buffer[i - 4] << 16) | (buffer[i - 3] << 8) | buffer[i - 2];
|
|
78
|
+
buffer[o++] = alphabet[x >> 19];
|
|
79
|
+
buffer[o++] = alphabet[x >> 14 & 0x1F];
|
|
80
|
+
buffer[o++] = alphabet[x >> 9 & 0x1F];
|
|
81
|
+
buffer[o++] = alphabet[x >> 4 & 0x1F];
|
|
82
|
+
x <<= 16;
|
|
83
|
+
buffer[o++] = alphabet[x >> 15 & 0x1F];
|
|
84
|
+
buffer[o++] = padding;
|
|
85
|
+
buffer[o++] = padding;
|
|
86
|
+
buffer[o++] = padding;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
case buffer.length: {
|
|
90
|
+
let x = (buffer[i - 4] << 16) | (buffer[i - 3] << 8) | buffer[i - 2];
|
|
91
|
+
buffer[o++] = alphabet[x >> 19];
|
|
92
|
+
buffer[o++] = alphabet[x >> 14 & 0x1F];
|
|
93
|
+
buffer[o++] = alphabet[x >> 9 & 0x1F];
|
|
94
|
+
buffer[o++] = alphabet[x >> 4 & 0x1F];
|
|
95
|
+
x = (x << 16) | (buffer[i - 1] << 8);
|
|
96
|
+
buffer[o++] = alphabet[x >> 15 & 0x1F];
|
|
97
|
+
buffer[o++] = alphabet[x >> 10 & 0x1F];
|
|
98
|
+
buffer[o++] = alphabet[x >> 5 & 0x1F];
|
|
99
|
+
buffer[o++] = padding;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return o;
|
|
104
|
+
}
|
|
105
|
+
export function decode(buffer, i, o, alphabet, padding) {
|
|
106
|
+
for (let x = buffer.length - 6; x < buffer.length; ++x) {
|
|
107
|
+
if (buffer[x] === padding) {
|
|
108
|
+
for (let y = x + 1; y < buffer.length; ++y) {
|
|
109
|
+
if (buffer[y] !== padding) {
|
|
110
|
+
throw new TypeError(`Cannot decode input as base32: Invalid character (${String.fromCharCode(buffer[y])})`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
buffer = buffer.subarray(0, x);
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
switch ((buffer.length - o) % 8) {
|
|
118
|
+
case 6:
|
|
119
|
+
case 3:
|
|
120
|
+
case 1:
|
|
121
|
+
throw new RangeError(`Cannot decode input as base32: Length (${buffer.length - o}), excluding padding, must not have a remainder of 1, 3, or 6 when divided by 8`);
|
|
122
|
+
}
|
|
123
|
+
i += 7;
|
|
124
|
+
for (; i < buffer.length; i += 8) {
|
|
125
|
+
let x = (getByte(buffer[i - 7], alphabet) << 19) |
|
|
126
|
+
(getByte(buffer[i - 6], alphabet) << 14) |
|
|
127
|
+
(getByte(buffer[i - 5], alphabet) << 9) |
|
|
128
|
+
(getByte(buffer[i - 4], alphabet) << 4);
|
|
129
|
+
buffer[o++] = x >> 16;
|
|
130
|
+
buffer[o++] = x >> 8 & 0xFF;
|
|
131
|
+
x = (x << 16) |
|
|
132
|
+
(getByte(buffer[i - 3], alphabet) << 15) |
|
|
133
|
+
(getByte(buffer[i - 2], alphabet) << 10) |
|
|
134
|
+
(getByte(buffer[i - 1], alphabet) << 5) |
|
|
135
|
+
getByte(buffer[i], alphabet);
|
|
136
|
+
buffer[o++] = x >> 16 & 0xFF;
|
|
137
|
+
buffer[o++] = x >> 8 & 0xFF;
|
|
138
|
+
buffer[o++] = x & 0xFF;
|
|
139
|
+
}
|
|
140
|
+
switch (i) {
|
|
141
|
+
case buffer.length + 5: {
|
|
142
|
+
const x = (getByte(buffer[i - 7], alphabet) << 19) |
|
|
143
|
+
(getByte(buffer[i - 6], alphabet) << 14);
|
|
144
|
+
buffer[o++] = x >> 16;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
case buffer.length + 3: {
|
|
148
|
+
const x = (getByte(buffer[i - 7], alphabet) << 19) |
|
|
149
|
+
(getByte(buffer[i - 6], alphabet) << 14) |
|
|
150
|
+
(getByte(buffer[i - 5], alphabet) << 9) |
|
|
151
|
+
(getByte(buffer[i - 4], alphabet) << 4);
|
|
152
|
+
buffer[o++] = x >> 16;
|
|
153
|
+
buffer[o++] = x >> 8 & 0xFF;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
case buffer.length + 2: {
|
|
157
|
+
let x = (getByte(buffer[i - 7], alphabet) << 19) |
|
|
158
|
+
(getByte(buffer[i - 6], alphabet) << 14) |
|
|
159
|
+
(getByte(buffer[i - 5], alphabet) << 9) |
|
|
160
|
+
(getByte(buffer[i - 4], alphabet) << 4);
|
|
161
|
+
buffer[o++] = x >> 16;
|
|
162
|
+
buffer[o++] = x >> 8 & 0xFF;
|
|
163
|
+
x = (x << 16) |
|
|
164
|
+
(getByte(buffer[i - 3], alphabet) << 15);
|
|
165
|
+
buffer[o++] = x >> 16 & 0xFF;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
case buffer.length: {
|
|
169
|
+
let x = (getByte(buffer[i - 7], alphabet) << 19) |
|
|
170
|
+
(getByte(buffer[i - 6], alphabet) << 14) |
|
|
171
|
+
(getByte(buffer[i - 5], alphabet) << 9) |
|
|
172
|
+
(getByte(buffer[i - 4], alphabet) << 4);
|
|
173
|
+
buffer[o++] = x >> 16;
|
|
174
|
+
buffer[o++] = x >> 8 & 0xFF;
|
|
175
|
+
x = (x << 16) |
|
|
176
|
+
(getByte(buffer[i - 3], alphabet) << 15) |
|
|
177
|
+
(getByte(buffer[i - 2], alphabet) << 10) |
|
|
178
|
+
(getByte(buffer[i - 1], alphabet) << 5);
|
|
179
|
+
buffer[o++] = x >> 16 & 0xFF;
|
|
180
|
+
buffer[o++] = x >> 8 & 0xFF;
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return o;
|
|
185
|
+
}
|
|
186
|
+
function getByte(char, alphabet) {
|
|
187
|
+
const byte = alphabet[char] ?? 32;
|
|
188
|
+
if (byte === 32) { // alphabet.Base32.length
|
|
189
|
+
throw new TypeError(`Cannot decode input as base32: Invalid character (${String.fromCharCode(char)})`);
|
|
190
|
+
}
|
|
191
|
+
return byte;
|
|
192
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_validate_binary_like.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/1.0.10/_validate_binary_like.ts"],"names":[],"mappings":"AAeA,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,GAAG,UAAU,CAa9D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
const encoder = new TextEncoder();
|
|
3
|
+
function getTypeName(value) {
|
|
4
|
+
const type = typeof value;
|
|
5
|
+
if (type !== "object") {
|
|
6
|
+
return type;
|
|
7
|
+
}
|
|
8
|
+
else if (value === null) {
|
|
9
|
+
return "null";
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return value?.constructor?.name ?? "object";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function validateBinaryLike(source) {
|
|
16
|
+
if (typeof source === "string") {
|
|
17
|
+
return encoder.encode(source);
|
|
18
|
+
}
|
|
19
|
+
else if (source instanceof Uint8Array) {
|
|
20
|
+
return source;
|
|
21
|
+
}
|
|
22
|
+
else if (source instanceof ArrayBuffer) {
|
|
23
|
+
return new Uint8Array(source);
|
|
24
|
+
}
|
|
25
|
+
throw new TypeError(`Cannot validate the input as it must be a Uint8Array, a string, or an ArrayBuffer: received a value of the type ${getTypeName(source)}`);
|
|
26
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Uint8Array_ } from "./_types.js";
|
|
2
|
+
export type { Uint8Array_ };
|
|
3
|
+
/**
|
|
4
|
+
* Supported ascii85 standards for {@linkcode EncodeAscii85Options} and
|
|
5
|
+
* {@linkcode DecodeAscii85Options}.
|
|
6
|
+
*/
|
|
7
|
+
export type Ascii85Standard = "Adobe" | "btoa" | "RFC 1924" | "Z85";
|
|
8
|
+
/** Options for {@linkcode encodeAscii85}. */
|
|
9
|
+
export interface EncodeAscii85Options {
|
|
10
|
+
/**
|
|
11
|
+
* Character set and delimiter (if supported and used).
|
|
12
|
+
*
|
|
13
|
+
* @default {"Adobe"}
|
|
14
|
+
*/
|
|
15
|
+
standard?: Ascii85Standard;
|
|
16
|
+
/**
|
|
17
|
+
* Whether to use a delimiter (if supported).
|
|
18
|
+
*
|
|
19
|
+
* @default {false}
|
|
20
|
+
*/
|
|
21
|
+
delimiter?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Converts data into an ascii85-encoded string.
|
|
25
|
+
*
|
|
26
|
+
* @param data The data to encode.
|
|
27
|
+
* @param options Options for encoding.
|
|
28
|
+
*
|
|
29
|
+
* @returns The ascii85-encoded string.
|
|
30
|
+
*
|
|
31
|
+
* @example Usage
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { encodeAscii85 } from "@std/encoding/ascii85";
|
|
34
|
+
* import { assertEquals } from "@std/assert";
|
|
35
|
+
*
|
|
36
|
+
* assertEquals(encodeAscii85("Hello world!"), "87cURD]j7BEbo80");
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function encodeAscii85(data: ArrayBuffer | Uint8Array | string, options?: EncodeAscii85Options): string;
|
|
40
|
+
/** Options for {@linkcode decodeAscii85}. */
|
|
41
|
+
export type DecodeAscii85Options = Omit<EncodeAscii85Options, "delimiter">;
|
|
42
|
+
/**
|
|
43
|
+
* Decodes a ascii85-encoded string.
|
|
44
|
+
*
|
|
45
|
+
* @param ascii85 The ascii85-encoded string to decode.
|
|
46
|
+
* @param options Options for decoding.
|
|
47
|
+
* @returns The decoded data.
|
|
48
|
+
*
|
|
49
|
+
* @example Usage
|
|
50
|
+
* ```ts
|
|
51
|
+
* import { decodeAscii85 } from "@std/encoding/ascii85";
|
|
52
|
+
* import { assertEquals } from "@std/assert";
|
|
53
|
+
*
|
|
54
|
+
* assertEquals(
|
|
55
|
+
* decodeAscii85("87cURD]j7BEbo80"),
|
|
56
|
+
* new TextEncoder().encode("Hello world!"),
|
|
57
|
+
* );
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function decodeAscii85(ascii85: string, options?: DecodeAscii85Options): Uint8Array_;
|
|
61
|
+
//# sourceMappingURL=ascii85.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ascii85.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/1.0.10/ascii85.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,CAAC;AAwB5B;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;AAEpE,6CAA6C;AAC7C,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAOD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,MAAM,EACvC,OAAO,GAAE,oBAAyB,GACjC,MAAM,CA6DR;AAED,6CAA6C;AAC7C,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;AAE3E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,oBAAyB,GACjC,WAAW,CA4Cb"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
/**
|
|
4
|
+
* Utilities for working with {@link https://en.wikipedia.org/wiki/Ascii85 | ascii85} encoding.
|
|
5
|
+
*
|
|
6
|
+
* ## Specifying a standard and delimiter
|
|
7
|
+
*
|
|
8
|
+
* By default, all functions are using the most popular Adobe version of ascii85
|
|
9
|
+
* and not adding any delimiter. However, there are three more standards
|
|
10
|
+
* supported - btoa (different delimiter and additional compression of 4 bytes
|
|
11
|
+
* equal to 32), {@link https://rfc.zeromq.org/spec/32/ | Z85} and
|
|
12
|
+
* {@link https://www.rfc-editor.org/rfc/rfc1924.html | RFC 1924}. It's possible to use a
|
|
13
|
+
* different encoding by specifying it in `options` object as a second parameter.
|
|
14
|
+
*
|
|
15
|
+
* Similarly, it's possible to make `encode` add a delimiter (`<~` and `~>` for
|
|
16
|
+
* Adobe, `xbtoa Begin` and `xbtoa End` with newlines between the delimiters and
|
|
17
|
+
* encoded data for btoa. Checksums for btoa are not supported. Delimiters are not
|
|
18
|
+
* supported by other encodings.)
|
|
19
|
+
*
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
import { validateBinaryLike } from "./_validate_binary_like.js";
|
|
23
|
+
const rfc1924 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~";
|
|
24
|
+
const Z85 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#";
|
|
25
|
+
/**
|
|
26
|
+
* Converts data into an ascii85-encoded string.
|
|
27
|
+
*
|
|
28
|
+
* @param data The data to encode.
|
|
29
|
+
* @param options Options for encoding.
|
|
30
|
+
*
|
|
31
|
+
* @returns The ascii85-encoded string.
|
|
32
|
+
*
|
|
33
|
+
* @example Usage
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { encodeAscii85 } from "@std/encoding/ascii85";
|
|
36
|
+
* import { assertEquals } from "@std/assert";
|
|
37
|
+
*
|
|
38
|
+
* assertEquals(encodeAscii85("Hello world!"), "87cURD]j7BEbo80");
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function encodeAscii85(data, options = {}) {
|
|
42
|
+
let uint8 = validateBinaryLike(data);
|
|
43
|
+
const { standard = "Adobe" } = options;
|
|
44
|
+
let output = [];
|
|
45
|
+
let v;
|
|
46
|
+
let n = 0;
|
|
47
|
+
let difference = 0;
|
|
48
|
+
if (uint8.length % 4 !== 0) {
|
|
49
|
+
const tmp = uint8;
|
|
50
|
+
difference = 4 - (tmp.length % 4);
|
|
51
|
+
uint8 = new Uint8Array(tmp.length + difference);
|
|
52
|
+
uint8.set(tmp);
|
|
53
|
+
}
|
|
54
|
+
const view = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);
|
|
55
|
+
for (let i = 0; i < uint8.length; i += 4) {
|
|
56
|
+
v = view.getUint32(i);
|
|
57
|
+
// Adobe and btoa standards compress 4 zeroes to single "z" character
|
|
58
|
+
if ((standard === "Adobe" || standard === "btoa") &&
|
|
59
|
+
v === 0 &&
|
|
60
|
+
i < uint8.length - difference - 3) {
|
|
61
|
+
output[n++] = "z";
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
// btoa compresses 4 spaces - that is, bytes equal to 32 - into single "y" character
|
|
65
|
+
if (standard === "btoa" && v === 538976288) {
|
|
66
|
+
output[n++] = "y";
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
for (let j = 4; j >= 0; j--) {
|
|
70
|
+
output[n + j] = String.fromCharCode((v % 85) + 33);
|
|
71
|
+
v = Math.trunc(v / 85);
|
|
72
|
+
}
|
|
73
|
+
n += 5;
|
|
74
|
+
}
|
|
75
|
+
switch (standard) {
|
|
76
|
+
case "Adobe":
|
|
77
|
+
if (options?.delimiter) {
|
|
78
|
+
return `<~${output.slice(0, output.length - difference).join("")}~>`;
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
case "btoa":
|
|
82
|
+
if (options?.delimiter) {
|
|
83
|
+
return `xbtoa Begin\n${output
|
|
84
|
+
.slice(0, output.length - difference)
|
|
85
|
+
.join("")}\nxbtoa End`;
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case "RFC 1924":
|
|
89
|
+
output = output.map((val) => rfc1924[val.charCodeAt(0) - 33]);
|
|
90
|
+
break;
|
|
91
|
+
case "Z85":
|
|
92
|
+
output = output.map((val) => Z85[val.charCodeAt(0) - 33]);
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
return output.slice(0, output.length - difference).join("");
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Decodes a ascii85-encoded string.
|
|
99
|
+
*
|
|
100
|
+
* @param ascii85 The ascii85-encoded string to decode.
|
|
101
|
+
* @param options Options for decoding.
|
|
102
|
+
* @returns The decoded data.
|
|
103
|
+
*
|
|
104
|
+
* @example Usage
|
|
105
|
+
* ```ts
|
|
106
|
+
* import { decodeAscii85 } from "@std/encoding/ascii85";
|
|
107
|
+
* import { assertEquals } from "@std/assert";
|
|
108
|
+
*
|
|
109
|
+
* assertEquals(
|
|
110
|
+
* decodeAscii85("87cURD]j7BEbo80"),
|
|
111
|
+
* new TextEncoder().encode("Hello world!"),
|
|
112
|
+
* );
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export function decodeAscii85(ascii85, options = {}) {
|
|
116
|
+
const { standard = "Adobe" } = options;
|
|
117
|
+
// translate all encodings to most basic adobe/btoa one and decompress some special characters ("z" and "y")
|
|
118
|
+
switch (standard) {
|
|
119
|
+
case "Adobe":
|
|
120
|
+
ascii85 = ascii85.replaceAll(/(<~|~>)/g, "").replaceAll("z", "!!!!!");
|
|
121
|
+
break;
|
|
122
|
+
case "btoa":
|
|
123
|
+
ascii85 = ascii85
|
|
124
|
+
.replaceAll(/(xbtoa Begin|xbtoa End|\n)/g, "")
|
|
125
|
+
.replaceAll("z", "!!!!!")
|
|
126
|
+
.replaceAll("y", "+<VdL");
|
|
127
|
+
break;
|
|
128
|
+
case "RFC 1924":
|
|
129
|
+
ascii85 = ascii85.replaceAll(/./g, (match) => String.fromCharCode(rfc1924.indexOf(match) + 33));
|
|
130
|
+
break;
|
|
131
|
+
case "Z85":
|
|
132
|
+
ascii85 = ascii85.replaceAll(/./g, (match) => String.fromCharCode(Z85.indexOf(match) + 33));
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
// remove all invalid characters
|
|
136
|
+
ascii85 = ascii85.replaceAll(/[^!-u]/g, "");
|
|
137
|
+
const len = ascii85.length;
|
|
138
|
+
const output = new Uint8Array(len + 4 - (len % 4));
|
|
139
|
+
const view = new DataView(output.buffer);
|
|
140
|
+
let v = 0;
|
|
141
|
+
let n = 0;
|
|
142
|
+
let max = 0;
|
|
143
|
+
for (let i = 0; i < len;) {
|
|
144
|
+
for (max += 5; i < max; i++) {
|
|
145
|
+
v = v * 85 + (i < len ? ascii85.charCodeAt(i) : 117) - 33;
|
|
146
|
+
}
|
|
147
|
+
view.setUint32(n, v);
|
|
148
|
+
v = 0;
|
|
149
|
+
n += 4;
|
|
150
|
+
}
|
|
151
|
+
return output.slice(0, Math.trunc(len * 0.8));
|
|
152
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Uint8Array_ } from "./_types.js";
|
|
2
|
+
export type { Uint8Array_ };
|
|
3
|
+
/**
|
|
4
|
+
* Converts data into a base32-encoded string.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-6}
|
|
7
|
+
*
|
|
8
|
+
* @param data The data to encode.
|
|
9
|
+
* @returns The base32-encoded string.
|
|
10
|
+
*
|
|
11
|
+
* @example Usage
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { encodeBase32 } from "@std/encoding/base32";
|
|
14
|
+
* import { assertEquals } from "@std/assert";
|
|
15
|
+
*
|
|
16
|
+
* assertEquals(encodeBase32("6c60c0"), "GZRTMMDDGA======");
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function encodeBase32(data: ArrayBuffer | Uint8Array | string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Decodes a base32-encoded string.
|
|
22
|
+
*
|
|
23
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-6}
|
|
24
|
+
*
|
|
25
|
+
* @param b32 The base32-encoded string to decode.
|
|
26
|
+
* @returns The decoded data.
|
|
27
|
+
*
|
|
28
|
+
* @example Usage
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { decodeBase32 } from "@std/encoding/base32";
|
|
31
|
+
* import { assertEquals } from "@std/assert";
|
|
32
|
+
*
|
|
33
|
+
* assertEquals(
|
|
34
|
+
* decodeBase32("GZRTMMDDGA======"),
|
|
35
|
+
* new TextEncoder().encode("6c60c0"),
|
|
36
|
+
* );
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function decodeBase32(b32: string): Uint8Array_;
|
|
40
|
+
//# sourceMappingURL=base32.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base32.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/1.0.10/base32.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,CAAC;AAQ5B;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAW5E;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAUrD"}
|