@thunderid/browser 0.7.0 → 0.8.1
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/cjs/index.cjs +728 -199
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +717 -200
- package/dist/index.js.map +1 -1
- package/dist/utils/SPACryptoUtils.d.ts.map +1 -1
- package/dist/utils/anonymousAnimalIcons.generated.d.ts +26 -0
- package/dist/utils/anonymousAnimalIcons.generated.d.ts.map +1 -0
- package/dist/utils/anonymousEntityIcons.generated.d.ts +26 -0
- package/dist/utils/anonymousEntityIcons.generated.d.ts.map +1 -0
- package/dist/utils/buildAvatarSpec.d.ts +35 -0
- package/dist/utils/buildAvatarSpec.d.ts.map +1 -0
- package/dist/utils/extractAvatarParamsFromUri.d.ts +61 -0
- package/dist/utils/extractAvatarParamsFromUri.d.ts.map +1 -0
- package/dist/utils/generateAvatarDataUri.d.ts +65 -0
- package/dist/utils/generateAvatarDataUri.d.ts.map +1 -0
- package/dist/utils/hashStr.d.ts +30 -0
- package/dist/utils/hashStr.d.ts.map +1 -0
- package/dist/utils/isAvatarUri.d.ts +34 -0
- package/dist/utils/isAvatarUri.d.ts.map +1 -0
- package/dist/utils/pickAnonymousAvatarName.d.ts +36 -0
- package/dist/utils/pickAnonymousAvatarName.d.ts.map +1 -0
- package/dist/utils/pickAnonymousEntityName.d.ts +37 -0
- package/dist/utils/pickAnonymousEntityName.d.ts.map +1 -0
- package/dist/utils/resolveLogoUri.d.ts +55 -0
- package/dist/utils/resolveLogoUri.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -1140,7 +1140,7 @@ var require_base64_js = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/b
|
|
|
1140
1140
|
//#region ../../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js
|
|
1141
1141
|
var require_ieee754 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js": ((exports) => {
|
|
1142
1142
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
1143
|
-
exports.read = function(buffer
|
|
1143
|
+
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
|
|
1144
1144
|
var e, m;
|
|
1145
1145
|
var eLen = nBytes * 8 - mLen - 1;
|
|
1146
1146
|
var eMax = (1 << eLen) - 1;
|
|
@@ -1148,16 +1148,16 @@ var require_ieee754 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/iee
|
|
|
1148
1148
|
var nBits = -7;
|
|
1149
1149
|
var i$1 = isLE ? nBytes - 1 : 0;
|
|
1150
1150
|
var d = isLE ? -1 : 1;
|
|
1151
|
-
var s = buffer
|
|
1151
|
+
var s = buffer[offset + i$1];
|
|
1152
1152
|
i$1 += d;
|
|
1153
1153
|
e = s & (1 << -nBits) - 1;
|
|
1154
1154
|
s >>= -nBits;
|
|
1155
1155
|
nBits += eLen;
|
|
1156
|
-
for (; nBits > 0; e = e * 256 + buffer
|
|
1156
|
+
for (; nBits > 0; e = e * 256 + buffer[offset + i$1], i$1 += d, nBits -= 8);
|
|
1157
1157
|
m = e & (1 << -nBits) - 1;
|
|
1158
1158
|
e >>= -nBits;
|
|
1159
1159
|
nBits += mLen;
|
|
1160
|
-
for (; nBits > 0; m = m * 256 + buffer
|
|
1160
|
+
for (; nBits > 0; m = m * 256 + buffer[offset + i$1], i$1 += d, nBits -= 8);
|
|
1161
1161
|
if (e === 0) e = 1 - eBias;
|
|
1162
1162
|
else if (e === eMax) return m ? NaN : (s ? -1 : 1) * Infinity;
|
|
1163
1163
|
else {
|
|
@@ -1166,7 +1166,7 @@ var require_ieee754 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/iee
|
|
|
1166
1166
|
}
|
|
1167
1167
|
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
1168
1168
|
};
|
|
1169
|
-
exports.write = function(buffer
|
|
1169
|
+
exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
|
|
1170
1170
|
var e, m, c;
|
|
1171
1171
|
var eLen = nBytes * 8 - mLen - 1;
|
|
1172
1172
|
var eMax = (1 << eLen) - 1;
|
|
@@ -1202,11 +1202,11 @@ var require_ieee754 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/iee
|
|
|
1202
1202
|
e = 0;
|
|
1203
1203
|
}
|
|
1204
1204
|
}
|
|
1205
|
-
for (; mLen >= 8; buffer
|
|
1205
|
+
for (; mLen >= 8; buffer[offset + i$1] = m & 255, i$1 += d, m /= 256, mLen -= 8);
|
|
1206
1206
|
e = e << mLen | m;
|
|
1207
1207
|
eLen += mLen;
|
|
1208
|
-
for (; eLen > 0; buffer
|
|
1209
|
-
buffer
|
|
1208
|
+
for (; eLen > 0; buffer[offset + i$1] = e & 255, i$1 += d, e /= 256, eLen -= 8);
|
|
1209
|
+
buffer[offset + i$1 - d] |= s * 128;
|
|
1210
1210
|
};
|
|
1211
1211
|
}) });
|
|
1212
1212
|
|
|
@@ -1216,7 +1216,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1216
1216
|
const base64 = require_base64_js();
|
|
1217
1217
|
const ieee754 = require_ieee754();
|
|
1218
1218
|
const customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
|
|
1219
|
-
exports.Buffer = Buffer$
|
|
1219
|
+
exports.Buffer = Buffer$2;
|
|
1220
1220
|
exports.SlowBuffer = SlowBuffer;
|
|
1221
1221
|
exports.INSPECT_MAX_BYTES = 50;
|
|
1222
1222
|
const K_MAX_LENGTH = 2147483647;
|
|
@@ -1235,8 +1235,8 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1235
1235
|
* (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
|
|
1236
1236
|
* for __proto__ and has a buggy typed array implementation.
|
|
1237
1237
|
*/
|
|
1238
|
-
Buffer$
|
|
1239
|
-
if (!Buffer$
|
|
1238
|
+
Buffer$2.TYPED_ARRAY_SUPPORT = typedArraySupport();
|
|
1239
|
+
if (!Buffer$2.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
|
|
1240
1240
|
function typedArraySupport() {
|
|
1241
1241
|
try {
|
|
1242
1242
|
const arr = new Uint8Array(1);
|
|
@@ -1250,24 +1250,24 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1250
1250
|
return false;
|
|
1251
1251
|
}
|
|
1252
1252
|
}
|
|
1253
|
-
Object.defineProperty(Buffer$
|
|
1253
|
+
Object.defineProperty(Buffer$2.prototype, "parent", {
|
|
1254
1254
|
enumerable: true,
|
|
1255
1255
|
get: function() {
|
|
1256
|
-
if (!Buffer$
|
|
1256
|
+
if (!Buffer$2.isBuffer(this)) return void 0;
|
|
1257
1257
|
return this.buffer;
|
|
1258
1258
|
}
|
|
1259
1259
|
});
|
|
1260
|
-
Object.defineProperty(Buffer$
|
|
1260
|
+
Object.defineProperty(Buffer$2.prototype, "offset", {
|
|
1261
1261
|
enumerable: true,
|
|
1262
1262
|
get: function() {
|
|
1263
|
-
if (!Buffer$
|
|
1263
|
+
if (!Buffer$2.isBuffer(this)) return void 0;
|
|
1264
1264
|
return this.byteOffset;
|
|
1265
1265
|
}
|
|
1266
1266
|
});
|
|
1267
1267
|
function createBuffer(length) {
|
|
1268
1268
|
if (length > K_MAX_LENGTH) throw new RangeError("The value \"" + length + "\" is invalid for option \"size\"");
|
|
1269
1269
|
const buf = new Uint8Array(length);
|
|
1270
|
-
Object.setPrototypeOf(buf, Buffer$
|
|
1270
|
+
Object.setPrototypeOf(buf, Buffer$2.prototype);
|
|
1271
1271
|
return buf;
|
|
1272
1272
|
}
|
|
1273
1273
|
/**
|
|
@@ -1279,14 +1279,14 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1279
1279
|
*
|
|
1280
1280
|
* The `Uint8Array` prototype remains unmodified.
|
|
1281
1281
|
*/
|
|
1282
|
-
function Buffer$
|
|
1282
|
+
function Buffer$2(arg, encodingOrOffset, length) {
|
|
1283
1283
|
if (typeof arg === "number") {
|
|
1284
1284
|
if (typeof encodingOrOffset === "string") throw new TypeError("The \"string\" argument must be of type string. Received type number");
|
|
1285
1285
|
return allocUnsafe(arg);
|
|
1286
1286
|
}
|
|
1287
1287
|
return from(arg, encodingOrOffset, length);
|
|
1288
1288
|
}
|
|
1289
|
-
Buffer$
|
|
1289
|
+
Buffer$2.poolSize = 8192;
|
|
1290
1290
|
function from(value, encodingOrOffset, length) {
|
|
1291
1291
|
if (typeof value === "string") return fromString(value, encodingOrOffset);
|
|
1292
1292
|
if (ArrayBuffer.isView(value)) return fromArrayView(value);
|
|
@@ -1295,10 +1295,10 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1295
1295
|
if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) return fromArrayBuffer(value, encodingOrOffset, length);
|
|
1296
1296
|
if (typeof value === "number") throw new TypeError("The \"value\" argument must not be of type number. Received type number");
|
|
1297
1297
|
const valueOf = value.valueOf && value.valueOf();
|
|
1298
|
-
if (valueOf != null && valueOf !== value) return Buffer$
|
|
1298
|
+
if (valueOf != null && valueOf !== value) return Buffer$2.from(valueOf, encodingOrOffset, length);
|
|
1299
1299
|
const b = fromObject(value);
|
|
1300
1300
|
if (b) return b;
|
|
1301
|
-
if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") return Buffer$
|
|
1301
|
+
if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") return Buffer$2.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
|
|
1302
1302
|
throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
|
|
1303
1303
|
}
|
|
1304
1304
|
/**
|
|
@@ -1309,11 +1309,11 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1309
1309
|
* Buffer.from(buffer)
|
|
1310
1310
|
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
1311
1311
|
**/
|
|
1312
|
-
Buffer$
|
|
1312
|
+
Buffer$2.from = function(value, encodingOrOffset, length) {
|
|
1313
1313
|
return from(value, encodingOrOffset, length);
|
|
1314
1314
|
};
|
|
1315
|
-
Object.setPrototypeOf(Buffer$
|
|
1316
|
-
Object.setPrototypeOf(Buffer$
|
|
1315
|
+
Object.setPrototypeOf(Buffer$2.prototype, Uint8Array.prototype);
|
|
1316
|
+
Object.setPrototypeOf(Buffer$2, Uint8Array);
|
|
1317
1317
|
function assertSize(size) {
|
|
1318
1318
|
if (typeof size !== "number") throw new TypeError("\"size\" argument must be of type number");
|
|
1319
1319
|
else if (size < 0) throw new RangeError("The value \"" + size + "\" is invalid for option \"size\"");
|
|
@@ -1328,7 +1328,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1328
1328
|
* Creates a new filled Buffer instance.
|
|
1329
1329
|
* alloc(size[, fill[, encoding]])
|
|
1330
1330
|
**/
|
|
1331
|
-
Buffer$
|
|
1331
|
+
Buffer$2.alloc = function(size, fill, encoding) {
|
|
1332
1332
|
return alloc(size, fill, encoding);
|
|
1333
1333
|
};
|
|
1334
1334
|
function allocUnsafe(size) {
|
|
@@ -1338,18 +1338,18 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1338
1338
|
/**
|
|
1339
1339
|
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
1340
1340
|
* */
|
|
1341
|
-
Buffer$
|
|
1341
|
+
Buffer$2.allocUnsafe = function(size) {
|
|
1342
1342
|
return allocUnsafe(size);
|
|
1343
1343
|
};
|
|
1344
1344
|
/**
|
|
1345
1345
|
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
1346
1346
|
*/
|
|
1347
|
-
Buffer$
|
|
1347
|
+
Buffer$2.allocUnsafeSlow = function(size) {
|
|
1348
1348
|
return allocUnsafe(size);
|
|
1349
1349
|
};
|
|
1350
1350
|
function fromString(string, encoding) {
|
|
1351
1351
|
if (typeof encoding !== "string" || encoding === "") encoding = "utf8";
|
|
1352
|
-
if (!Buffer$
|
|
1352
|
+
if (!Buffer$2.isEncoding(encoding)) throw new TypeError("Unknown encoding: " + encoding);
|
|
1353
1353
|
const length = byteLength(string, encoding) | 0;
|
|
1354
1354
|
let buf = createBuffer(length);
|
|
1355
1355
|
const actual = buf.write(string, encoding);
|
|
@@ -1376,11 +1376,11 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1376
1376
|
if (byteOffset === void 0 && length === void 0) buf = new Uint8Array(array);
|
|
1377
1377
|
else if (length === void 0) buf = new Uint8Array(array, byteOffset);
|
|
1378
1378
|
else buf = new Uint8Array(array, byteOffset, length);
|
|
1379
|
-
Object.setPrototypeOf(buf, Buffer$
|
|
1379
|
+
Object.setPrototypeOf(buf, Buffer$2.prototype);
|
|
1380
1380
|
return buf;
|
|
1381
1381
|
}
|
|
1382
1382
|
function fromObject(obj) {
|
|
1383
|
-
if (Buffer$
|
|
1383
|
+
if (Buffer$2.isBuffer(obj)) {
|
|
1384
1384
|
const len$1 = checked(obj.length) | 0;
|
|
1385
1385
|
const buf = createBuffer(len$1);
|
|
1386
1386
|
if (buf.length === 0) return buf;
|
|
@@ -1399,15 +1399,15 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1399
1399
|
}
|
|
1400
1400
|
function SlowBuffer(length) {
|
|
1401
1401
|
if (+length != length) length = 0;
|
|
1402
|
-
return Buffer$
|
|
1402
|
+
return Buffer$2.alloc(+length);
|
|
1403
1403
|
}
|
|
1404
|
-
Buffer$
|
|
1405
|
-
return b != null && b._isBuffer === true && b !== Buffer$
|
|
1404
|
+
Buffer$2.isBuffer = function isBuffer(b) {
|
|
1405
|
+
return b != null && b._isBuffer === true && b !== Buffer$2.prototype;
|
|
1406
1406
|
};
|
|
1407
|
-
Buffer$
|
|
1408
|
-
if (isInstance(a, Uint8Array)) a = Buffer$
|
|
1409
|
-
if (isInstance(b, Uint8Array)) b = Buffer$
|
|
1410
|
-
if (!Buffer$
|
|
1407
|
+
Buffer$2.compare = function compare(a, b) {
|
|
1408
|
+
if (isInstance(a, Uint8Array)) a = Buffer$2.from(a, a.offset, a.byteLength);
|
|
1409
|
+
if (isInstance(b, Uint8Array)) b = Buffer$2.from(b, b.offset, b.byteLength);
|
|
1410
|
+
if (!Buffer$2.isBuffer(a) || !Buffer$2.isBuffer(b)) throw new TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");
|
|
1411
1411
|
if (a === b) return 0;
|
|
1412
1412
|
let x = a.length;
|
|
1413
1413
|
let y = b.length;
|
|
@@ -1420,7 +1420,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1420
1420
|
if (y < x) return 1;
|
|
1421
1421
|
return 0;
|
|
1422
1422
|
};
|
|
1423
|
-
Buffer$
|
|
1423
|
+
Buffer$2.isEncoding = function isEncoding(encoding) {
|
|
1424
1424
|
switch (String(encoding).toLowerCase()) {
|
|
1425
1425
|
case "hex":
|
|
1426
1426
|
case "utf8":
|
|
@@ -1436,30 +1436,30 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1436
1436
|
default: return false;
|
|
1437
1437
|
}
|
|
1438
1438
|
};
|
|
1439
|
-
Buffer$
|
|
1439
|
+
Buffer$2.concat = function concat(list, length) {
|
|
1440
1440
|
if (!Array.isArray(list)) throw new TypeError("\"list\" argument must be an Array of Buffers");
|
|
1441
|
-
if (list.length === 0) return Buffer$
|
|
1441
|
+
if (list.length === 0) return Buffer$2.alloc(0);
|
|
1442
1442
|
let i$1;
|
|
1443
1443
|
if (length === void 0) {
|
|
1444
1444
|
length = 0;
|
|
1445
1445
|
for (i$1 = 0; i$1 < list.length; ++i$1) length += list[i$1].length;
|
|
1446
1446
|
}
|
|
1447
|
-
const buffer
|
|
1447
|
+
const buffer = Buffer$2.allocUnsafe(length);
|
|
1448
1448
|
let pos = 0;
|
|
1449
1449
|
for (i$1 = 0; i$1 < list.length; ++i$1) {
|
|
1450
1450
|
let buf = list[i$1];
|
|
1451
|
-
if (isInstance(buf, Uint8Array)) if (pos + buf.length > buffer
|
|
1452
|
-
if (!Buffer$
|
|
1453
|
-
buf.copy(buffer
|
|
1454
|
-
} else Uint8Array.prototype.set.call(buffer
|
|
1455
|
-
else if (!Buffer$
|
|
1456
|
-
else buf.copy(buffer
|
|
1451
|
+
if (isInstance(buf, Uint8Array)) if (pos + buf.length > buffer.length) {
|
|
1452
|
+
if (!Buffer$2.isBuffer(buf)) buf = Buffer$2.from(buf);
|
|
1453
|
+
buf.copy(buffer, pos);
|
|
1454
|
+
} else Uint8Array.prototype.set.call(buffer, buf, pos);
|
|
1455
|
+
else if (!Buffer$2.isBuffer(buf)) throw new TypeError("\"list\" argument must be an Array of Buffers");
|
|
1456
|
+
else buf.copy(buffer, pos);
|
|
1457
1457
|
pos += buf.length;
|
|
1458
1458
|
}
|
|
1459
|
-
return buffer
|
|
1459
|
+
return buffer;
|
|
1460
1460
|
};
|
|
1461
1461
|
function byteLength(string, encoding) {
|
|
1462
|
-
if (Buffer$
|
|
1462
|
+
if (Buffer$2.isBuffer(string)) return string.length;
|
|
1463
1463
|
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) return string.byteLength;
|
|
1464
1464
|
if (typeof string !== "string") throw new TypeError("The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type " + typeof string);
|
|
1465
1465
|
const len$1 = string.length;
|
|
@@ -1484,7 +1484,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1484
1484
|
loweredCase = true;
|
|
1485
1485
|
}
|
|
1486
1486
|
}
|
|
1487
|
-
Buffer$
|
|
1487
|
+
Buffer$2.byteLength = byteLength;
|
|
1488
1488
|
function slowToString(encoding, start, end) {
|
|
1489
1489
|
let loweredCase = false;
|
|
1490
1490
|
if (start === void 0 || start < 0) start = 0;
|
|
@@ -1513,19 +1513,19 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1513
1513
|
loweredCase = true;
|
|
1514
1514
|
}
|
|
1515
1515
|
}
|
|
1516
|
-
Buffer$
|
|
1516
|
+
Buffer$2.prototype._isBuffer = true;
|
|
1517
1517
|
function swap(b, n, m) {
|
|
1518
1518
|
const i$1 = b[n];
|
|
1519
1519
|
b[n] = b[m];
|
|
1520
1520
|
b[m] = i$1;
|
|
1521
1521
|
}
|
|
1522
|
-
Buffer$
|
|
1522
|
+
Buffer$2.prototype.swap16 = function swap16() {
|
|
1523
1523
|
const len$1 = this.length;
|
|
1524
1524
|
if (len$1 % 2 !== 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
1525
1525
|
for (let i$1 = 0; i$1 < len$1; i$1 += 2) swap(this, i$1, i$1 + 1);
|
|
1526
1526
|
return this;
|
|
1527
1527
|
};
|
|
1528
|
-
Buffer$
|
|
1528
|
+
Buffer$2.prototype.swap32 = function swap32() {
|
|
1529
1529
|
const len$1 = this.length;
|
|
1530
1530
|
if (len$1 % 4 !== 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
1531
1531
|
for (let i$1 = 0; i$1 < len$1; i$1 += 4) {
|
|
@@ -1534,7 +1534,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1534
1534
|
}
|
|
1535
1535
|
return this;
|
|
1536
1536
|
};
|
|
1537
|
-
Buffer$
|
|
1537
|
+
Buffer$2.prototype.swap64 = function swap64() {
|
|
1538
1538
|
const len$1 = this.length;
|
|
1539
1539
|
if (len$1 % 8 !== 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
1540
1540
|
for (let i$1 = 0; i$1 < len$1; i$1 += 8) {
|
|
@@ -1545,29 +1545,29 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1545
1545
|
}
|
|
1546
1546
|
return this;
|
|
1547
1547
|
};
|
|
1548
|
-
Buffer$
|
|
1548
|
+
Buffer$2.prototype.toString = function toString() {
|
|
1549
1549
|
const length = this.length;
|
|
1550
1550
|
if (length === 0) return "";
|
|
1551
1551
|
if (arguments.length === 0) return utf8Slice(this, 0, length);
|
|
1552
1552
|
return slowToString.apply(this, arguments);
|
|
1553
1553
|
};
|
|
1554
|
-
Buffer$
|
|
1555
|
-
Buffer$
|
|
1556
|
-
if (!Buffer$
|
|
1554
|
+
Buffer$2.prototype.toLocaleString = Buffer$2.prototype.toString;
|
|
1555
|
+
Buffer$2.prototype.equals = function equals(b) {
|
|
1556
|
+
if (!Buffer$2.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
|
|
1557
1557
|
if (this === b) return true;
|
|
1558
|
-
return Buffer$
|
|
1558
|
+
return Buffer$2.compare(this, b) === 0;
|
|
1559
1559
|
};
|
|
1560
|
-
Buffer$
|
|
1560
|
+
Buffer$2.prototype.inspect = function inspect() {
|
|
1561
1561
|
let str = "";
|
|
1562
1562
|
const max = exports.INSPECT_MAX_BYTES;
|
|
1563
1563
|
str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
|
|
1564
1564
|
if (this.length > max) str += " ... ";
|
|
1565
1565
|
return "<Buffer " + str + ">";
|
|
1566
1566
|
};
|
|
1567
|
-
if (customInspectSymbol) Buffer$
|
|
1568
|
-
Buffer$
|
|
1569
|
-
if (isInstance(target, Uint8Array)) target = Buffer$
|
|
1570
|
-
if (!Buffer$
|
|
1567
|
+
if (customInspectSymbol) Buffer$2.prototype[customInspectSymbol] = Buffer$2.prototype.inspect;
|
|
1568
|
+
Buffer$2.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
|
|
1569
|
+
if (isInstance(target, Uint8Array)) target = Buffer$2.from(target, target.offset, target.byteLength);
|
|
1570
|
+
if (!Buffer$2.isBuffer(target)) throw new TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type " + typeof target);
|
|
1571
1571
|
if (start === void 0) start = 0;
|
|
1572
1572
|
if (end === void 0) end = target ? target.length : 0;
|
|
1573
1573
|
if (thisStart === void 0) thisStart = 0;
|
|
@@ -1595,29 +1595,29 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1595
1595
|
if (y < x) return 1;
|
|
1596
1596
|
return 0;
|
|
1597
1597
|
};
|
|
1598
|
-
function bidirectionalIndexOf(buffer
|
|
1599
|
-
if (buffer
|
|
1598
|
+
function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
|
|
1599
|
+
if (buffer.length === 0) return -1;
|
|
1600
1600
|
if (typeof byteOffset === "string") {
|
|
1601
1601
|
encoding = byteOffset;
|
|
1602
1602
|
byteOffset = 0;
|
|
1603
1603
|
} else if (byteOffset > 2147483647) byteOffset = 2147483647;
|
|
1604
1604
|
else if (byteOffset < -2147483648) byteOffset = -2147483648;
|
|
1605
1605
|
byteOffset = +byteOffset;
|
|
1606
|
-
if (numberIsNaN(byteOffset)) byteOffset = dir ? 0 : buffer
|
|
1607
|
-
if (byteOffset < 0) byteOffset = buffer
|
|
1608
|
-
if (byteOffset >= buffer
|
|
1609
|
-
else byteOffset = buffer
|
|
1606
|
+
if (numberIsNaN(byteOffset)) byteOffset = dir ? 0 : buffer.length - 1;
|
|
1607
|
+
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
|
|
1608
|
+
if (byteOffset >= buffer.length) if (dir) return -1;
|
|
1609
|
+
else byteOffset = buffer.length - 1;
|
|
1610
1610
|
else if (byteOffset < 0) if (dir) byteOffset = 0;
|
|
1611
1611
|
else return -1;
|
|
1612
|
-
if (typeof val === "string") val = Buffer$
|
|
1613
|
-
if (Buffer$
|
|
1612
|
+
if (typeof val === "string") val = Buffer$2.from(val, encoding);
|
|
1613
|
+
if (Buffer$2.isBuffer(val)) {
|
|
1614
1614
|
if (val.length === 0) return -1;
|
|
1615
|
-
return arrayIndexOf(buffer
|
|
1615
|
+
return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
|
|
1616
1616
|
} else if (typeof val === "number") {
|
|
1617
1617
|
val = val & 255;
|
|
1618
|
-
if (typeof Uint8Array.prototype.indexOf === "function") if (dir) return Uint8Array.prototype.indexOf.call(buffer
|
|
1619
|
-
else return Uint8Array.prototype.lastIndexOf.call(buffer
|
|
1620
|
-
return arrayIndexOf(buffer
|
|
1618
|
+
if (typeof Uint8Array.prototype.indexOf === "function") if (dir) return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
|
|
1619
|
+
else return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
|
|
1620
|
+
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
|
|
1621
1621
|
}
|
|
1622
1622
|
throw new TypeError("val must be string, number or Buffer");
|
|
1623
1623
|
}
|
|
@@ -1662,13 +1662,13 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1662
1662
|
}
|
|
1663
1663
|
return -1;
|
|
1664
1664
|
}
|
|
1665
|
-
Buffer$
|
|
1665
|
+
Buffer$2.prototype.includes = function includes(val, byteOffset, encoding) {
|
|
1666
1666
|
return this.indexOf(val, byteOffset, encoding) !== -1;
|
|
1667
1667
|
};
|
|
1668
|
-
Buffer$
|
|
1668
|
+
Buffer$2.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
|
|
1669
1669
|
return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
|
|
1670
1670
|
};
|
|
1671
|
-
Buffer$
|
|
1671
|
+
Buffer$2.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
|
|
1672
1672
|
return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
|
|
1673
1673
|
};
|
|
1674
1674
|
function hexWrite(buf, string, offset, length) {
|
|
@@ -1701,7 +1701,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1701
1701
|
function ucs2Write(buf, string, offset, length) {
|
|
1702
1702
|
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
|
|
1703
1703
|
}
|
|
1704
|
-
Buffer$
|
|
1704
|
+
Buffer$2.prototype.write = function write(string, offset, length, encoding) {
|
|
1705
1705
|
if (offset === void 0) {
|
|
1706
1706
|
encoding = "utf8";
|
|
1707
1707
|
length = this.length;
|
|
@@ -1743,7 +1743,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1743
1743
|
loweredCase = true;
|
|
1744
1744
|
}
|
|
1745
1745
|
};
|
|
1746
|
-
Buffer$
|
|
1746
|
+
Buffer$2.prototype.toJSON = function toJSON() {
|
|
1747
1747
|
return {
|
|
1748
1748
|
type: "Buffer",
|
|
1749
1749
|
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
@@ -1840,7 +1840,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1840
1840
|
for (let i$1 = 0; i$1 < bytes.length - 1; i$1 += 2) res += String.fromCharCode(bytes[i$1] + bytes[i$1 + 1] * 256);
|
|
1841
1841
|
return res;
|
|
1842
1842
|
}
|
|
1843
|
-
Buffer$
|
|
1843
|
+
Buffer$2.prototype.slice = function slice(start, end) {
|
|
1844
1844
|
const len$1 = this.length;
|
|
1845
1845
|
start = ~~start;
|
|
1846
1846
|
end = end === void 0 ? len$1 : ~~end;
|
|
@@ -1854,14 +1854,14 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1854
1854
|
} else if (end > len$1) end = len$1;
|
|
1855
1855
|
if (end < start) end = start;
|
|
1856
1856
|
const newBuf = this.subarray(start, end);
|
|
1857
|
-
Object.setPrototypeOf(newBuf, Buffer$
|
|
1857
|
+
Object.setPrototypeOf(newBuf, Buffer$2.prototype);
|
|
1858
1858
|
return newBuf;
|
|
1859
1859
|
};
|
|
1860
1860
|
function checkOffset(offset, ext, length) {
|
|
1861
1861
|
if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
|
|
1862
1862
|
if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
|
|
1863
1863
|
}
|
|
1864
|
-
Buffer$
|
|
1864
|
+
Buffer$2.prototype.readUintLE = Buffer$2.prototype.readUIntLE = function readUIntLE(offset, byteLength$2, noAssert) {
|
|
1865
1865
|
offset = offset >>> 0;
|
|
1866
1866
|
byteLength$2 = byteLength$2 >>> 0;
|
|
1867
1867
|
if (!noAssert) checkOffset(offset, byteLength$2, this.length);
|
|
@@ -1871,7 +1871,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1871
1871
|
while (++i$1 < byteLength$2 && (mul *= 256)) val += this[offset + i$1] * mul;
|
|
1872
1872
|
return val;
|
|
1873
1873
|
};
|
|
1874
|
-
Buffer$
|
|
1874
|
+
Buffer$2.prototype.readUintBE = Buffer$2.prototype.readUIntBE = function readUIntBE(offset, byteLength$2, noAssert) {
|
|
1875
1875
|
offset = offset >>> 0;
|
|
1876
1876
|
byteLength$2 = byteLength$2 >>> 0;
|
|
1877
1877
|
if (!noAssert) checkOffset(offset, byteLength$2, this.length);
|
|
@@ -1880,32 +1880,32 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1880
1880
|
while (byteLength$2 > 0 && (mul *= 256)) val += this[offset + --byteLength$2] * mul;
|
|
1881
1881
|
return val;
|
|
1882
1882
|
};
|
|
1883
|
-
Buffer$
|
|
1883
|
+
Buffer$2.prototype.readUint8 = Buffer$2.prototype.readUInt8 = function readUInt8(offset, noAssert) {
|
|
1884
1884
|
offset = offset >>> 0;
|
|
1885
1885
|
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
1886
1886
|
return this[offset];
|
|
1887
1887
|
};
|
|
1888
|
-
Buffer$
|
|
1888
|
+
Buffer$2.prototype.readUint16LE = Buffer$2.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
|
|
1889
1889
|
offset = offset >>> 0;
|
|
1890
1890
|
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1891
1891
|
return this[offset] | this[offset + 1] << 8;
|
|
1892
1892
|
};
|
|
1893
|
-
Buffer$
|
|
1893
|
+
Buffer$2.prototype.readUint16BE = Buffer$2.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
|
|
1894
1894
|
offset = offset >>> 0;
|
|
1895
1895
|
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1896
1896
|
return this[offset] << 8 | this[offset + 1];
|
|
1897
1897
|
};
|
|
1898
|
-
Buffer$
|
|
1898
|
+
Buffer$2.prototype.readUint32LE = Buffer$2.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
|
|
1899
1899
|
offset = offset >>> 0;
|
|
1900
1900
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1901
1901
|
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
|
|
1902
1902
|
};
|
|
1903
|
-
Buffer$
|
|
1903
|
+
Buffer$2.prototype.readUint32BE = Buffer$2.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
|
|
1904
1904
|
offset = offset >>> 0;
|
|
1905
1905
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1906
1906
|
return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
|
1907
1907
|
};
|
|
1908
|
-
Buffer$
|
|
1908
|
+
Buffer$2.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {
|
|
1909
1909
|
offset = offset >>> 0;
|
|
1910
1910
|
validateNumber(offset, "offset");
|
|
1911
1911
|
const first = this[offset];
|
|
@@ -1915,7 +1915,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1915
1915
|
const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;
|
|
1916
1916
|
return BigInt(lo) + (BigInt(hi) << BigInt(32));
|
|
1917
1917
|
});
|
|
1918
|
-
Buffer$
|
|
1918
|
+
Buffer$2.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {
|
|
1919
1919
|
offset = offset >>> 0;
|
|
1920
1920
|
validateNumber(offset, "offset");
|
|
1921
1921
|
const first = this[offset];
|
|
@@ -1925,7 +1925,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1925
1925
|
const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;
|
|
1926
1926
|
return (BigInt(hi) << BigInt(32)) + BigInt(lo);
|
|
1927
1927
|
});
|
|
1928
|
-
Buffer$
|
|
1928
|
+
Buffer$2.prototype.readIntLE = function readIntLE(offset, byteLength$2, noAssert) {
|
|
1929
1929
|
offset = offset >>> 0;
|
|
1930
1930
|
byteLength$2 = byteLength$2 >>> 0;
|
|
1931
1931
|
if (!noAssert) checkOffset(offset, byteLength$2, this.length);
|
|
@@ -1937,7 +1937,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1937
1937
|
if (val >= mul) val -= Math.pow(2, 8 * byteLength$2);
|
|
1938
1938
|
return val;
|
|
1939
1939
|
};
|
|
1940
|
-
Buffer$
|
|
1940
|
+
Buffer$2.prototype.readIntBE = function readIntBE(offset, byteLength$2, noAssert) {
|
|
1941
1941
|
offset = offset >>> 0;
|
|
1942
1942
|
byteLength$2 = byteLength$2 >>> 0;
|
|
1943
1943
|
if (!noAssert) checkOffset(offset, byteLength$2, this.length);
|
|
@@ -1949,35 +1949,35 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1949
1949
|
if (val >= mul) val -= Math.pow(2, 8 * byteLength$2);
|
|
1950
1950
|
return val;
|
|
1951
1951
|
};
|
|
1952
|
-
Buffer$
|
|
1952
|
+
Buffer$2.prototype.readInt8 = function readInt8(offset, noAssert) {
|
|
1953
1953
|
offset = offset >>> 0;
|
|
1954
1954
|
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
1955
1955
|
if (!(this[offset] & 128)) return this[offset];
|
|
1956
1956
|
return (255 - this[offset] + 1) * -1;
|
|
1957
1957
|
};
|
|
1958
|
-
Buffer$
|
|
1958
|
+
Buffer$2.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
|
|
1959
1959
|
offset = offset >>> 0;
|
|
1960
1960
|
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1961
1961
|
const val = this[offset] | this[offset + 1] << 8;
|
|
1962
1962
|
return val & 32768 ? val | 4294901760 : val;
|
|
1963
1963
|
};
|
|
1964
|
-
Buffer$
|
|
1964
|
+
Buffer$2.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
|
|
1965
1965
|
offset = offset >>> 0;
|
|
1966
1966
|
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1967
1967
|
const val = this[offset + 1] | this[offset] << 8;
|
|
1968
1968
|
return val & 32768 ? val | 4294901760 : val;
|
|
1969
1969
|
};
|
|
1970
|
-
Buffer$
|
|
1970
|
+
Buffer$2.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
|
|
1971
1971
|
offset = offset >>> 0;
|
|
1972
1972
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1973
1973
|
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
|
1974
1974
|
};
|
|
1975
|
-
Buffer$
|
|
1975
|
+
Buffer$2.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
|
|
1976
1976
|
offset = offset >>> 0;
|
|
1977
1977
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1978
1978
|
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
|
1979
1979
|
};
|
|
1980
|
-
Buffer$
|
|
1980
|
+
Buffer$2.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {
|
|
1981
1981
|
offset = offset >>> 0;
|
|
1982
1982
|
validateNumber(offset, "offset");
|
|
1983
1983
|
const first = this[offset];
|
|
@@ -1986,7 +1986,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1986
1986
|
const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);
|
|
1987
1987
|
return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);
|
|
1988
1988
|
});
|
|
1989
|
-
Buffer$
|
|
1989
|
+
Buffer$2.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {
|
|
1990
1990
|
offset = offset >>> 0;
|
|
1991
1991
|
validateNumber(offset, "offset");
|
|
1992
1992
|
const first = this[offset];
|
|
@@ -1995,32 +1995,32 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1995
1995
|
const val = (first << 24) + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
|
|
1996
1996
|
return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);
|
|
1997
1997
|
});
|
|
1998
|
-
Buffer$
|
|
1998
|
+
Buffer$2.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
|
|
1999
1999
|
offset = offset >>> 0;
|
|
2000
2000
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2001
2001
|
return ieee754.read(this, offset, true, 23, 4);
|
|
2002
2002
|
};
|
|
2003
|
-
Buffer$
|
|
2003
|
+
Buffer$2.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
|
|
2004
2004
|
offset = offset >>> 0;
|
|
2005
2005
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2006
2006
|
return ieee754.read(this, offset, false, 23, 4);
|
|
2007
2007
|
};
|
|
2008
|
-
Buffer$
|
|
2008
|
+
Buffer$2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
|
|
2009
2009
|
offset = offset >>> 0;
|
|
2010
2010
|
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
2011
2011
|
return ieee754.read(this, offset, true, 52, 8);
|
|
2012
2012
|
};
|
|
2013
|
-
Buffer$
|
|
2013
|
+
Buffer$2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
|
|
2014
2014
|
offset = offset >>> 0;
|
|
2015
2015
|
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
2016
2016
|
return ieee754.read(this, offset, false, 52, 8);
|
|
2017
2017
|
};
|
|
2018
2018
|
function checkInt(buf, value, offset, ext, max, min) {
|
|
2019
|
-
if (!Buffer$
|
|
2019
|
+
if (!Buffer$2.isBuffer(buf)) throw new TypeError("\"buffer\" argument must be a Buffer instance");
|
|
2020
2020
|
if (value > max || value < min) throw new RangeError("\"value\" argument is out of bounds");
|
|
2021
2021
|
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
2022
2022
|
}
|
|
2023
|
-
Buffer$
|
|
2023
|
+
Buffer$2.prototype.writeUintLE = Buffer$2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength$2, noAssert) {
|
|
2024
2024
|
value = +value;
|
|
2025
2025
|
offset = offset >>> 0;
|
|
2026
2026
|
byteLength$2 = byteLength$2 >>> 0;
|
|
@@ -2034,7 +2034,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2034
2034
|
while (++i$1 < byteLength$2 && (mul *= 256)) this[offset + i$1] = value / mul & 255;
|
|
2035
2035
|
return offset + byteLength$2;
|
|
2036
2036
|
};
|
|
2037
|
-
Buffer$
|
|
2037
|
+
Buffer$2.prototype.writeUintBE = Buffer$2.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength$2, noAssert) {
|
|
2038
2038
|
value = +value;
|
|
2039
2039
|
offset = offset >>> 0;
|
|
2040
2040
|
byteLength$2 = byteLength$2 >>> 0;
|
|
@@ -2048,14 +2048,14 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2048
2048
|
while (--i$1 >= 0 && (mul *= 256)) this[offset + i$1] = value / mul & 255;
|
|
2049
2049
|
return offset + byteLength$2;
|
|
2050
2050
|
};
|
|
2051
|
-
Buffer$
|
|
2051
|
+
Buffer$2.prototype.writeUint8 = Buffer$2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
|
|
2052
2052
|
value = +value;
|
|
2053
2053
|
offset = offset >>> 0;
|
|
2054
2054
|
if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
|
|
2055
2055
|
this[offset] = value & 255;
|
|
2056
2056
|
return offset + 1;
|
|
2057
2057
|
};
|
|
2058
|
-
Buffer$
|
|
2058
|
+
Buffer$2.prototype.writeUint16LE = Buffer$2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
|
|
2059
2059
|
value = +value;
|
|
2060
2060
|
offset = offset >>> 0;
|
|
2061
2061
|
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
@@ -2063,7 +2063,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2063
2063
|
this[offset + 1] = value >>> 8;
|
|
2064
2064
|
return offset + 2;
|
|
2065
2065
|
};
|
|
2066
|
-
Buffer$
|
|
2066
|
+
Buffer$2.prototype.writeUint16BE = Buffer$2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
|
|
2067
2067
|
value = +value;
|
|
2068
2068
|
offset = offset >>> 0;
|
|
2069
2069
|
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
@@ -2071,7 +2071,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2071
2071
|
this[offset + 1] = value & 255;
|
|
2072
2072
|
return offset + 2;
|
|
2073
2073
|
};
|
|
2074
|
-
Buffer$
|
|
2074
|
+
Buffer$2.prototype.writeUint32LE = Buffer$2.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
|
|
2075
2075
|
value = +value;
|
|
2076
2076
|
offset = offset >>> 0;
|
|
2077
2077
|
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
@@ -2081,7 +2081,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2081
2081
|
this[offset] = value & 255;
|
|
2082
2082
|
return offset + 4;
|
|
2083
2083
|
};
|
|
2084
|
-
Buffer$
|
|
2084
|
+
Buffer$2.prototype.writeUint32BE = Buffer$2.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
|
|
2085
2085
|
value = +value;
|
|
2086
2086
|
offset = offset >>> 0;
|
|
2087
2087
|
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
@@ -2131,13 +2131,13 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2131
2131
|
buf[offset] = hi;
|
|
2132
2132
|
return offset + 8;
|
|
2133
2133
|
}
|
|
2134
|
-
Buffer$
|
|
2134
|
+
Buffer$2.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {
|
|
2135
2135
|
return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
2136
2136
|
});
|
|
2137
|
-
Buffer$
|
|
2137
|
+
Buffer$2.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {
|
|
2138
2138
|
return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
2139
2139
|
});
|
|
2140
|
-
Buffer$
|
|
2140
|
+
Buffer$2.prototype.writeIntLE = function writeIntLE(value, offset, byteLength$2, noAssert) {
|
|
2141
2141
|
value = +value;
|
|
2142
2142
|
offset = offset >>> 0;
|
|
2143
2143
|
if (!noAssert) {
|
|
@@ -2154,7 +2154,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2154
2154
|
}
|
|
2155
2155
|
return offset + byteLength$2;
|
|
2156
2156
|
};
|
|
2157
|
-
Buffer$
|
|
2157
|
+
Buffer$2.prototype.writeIntBE = function writeIntBE(value, offset, byteLength$2, noAssert) {
|
|
2158
2158
|
value = +value;
|
|
2159
2159
|
offset = offset >>> 0;
|
|
2160
2160
|
if (!noAssert) {
|
|
@@ -2171,7 +2171,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2171
2171
|
}
|
|
2172
2172
|
return offset + byteLength$2;
|
|
2173
2173
|
};
|
|
2174
|
-
Buffer$
|
|
2174
|
+
Buffer$2.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
|
|
2175
2175
|
value = +value;
|
|
2176
2176
|
offset = offset >>> 0;
|
|
2177
2177
|
if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
|
|
@@ -2179,7 +2179,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2179
2179
|
this[offset] = value & 255;
|
|
2180
2180
|
return offset + 1;
|
|
2181
2181
|
};
|
|
2182
|
-
Buffer$
|
|
2182
|
+
Buffer$2.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
|
|
2183
2183
|
value = +value;
|
|
2184
2184
|
offset = offset >>> 0;
|
|
2185
2185
|
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
@@ -2187,7 +2187,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2187
2187
|
this[offset + 1] = value >>> 8;
|
|
2188
2188
|
return offset + 2;
|
|
2189
2189
|
};
|
|
2190
|
-
Buffer$
|
|
2190
|
+
Buffer$2.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
|
|
2191
2191
|
value = +value;
|
|
2192
2192
|
offset = offset >>> 0;
|
|
2193
2193
|
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
@@ -2195,7 +2195,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2195
2195
|
this[offset + 1] = value & 255;
|
|
2196
2196
|
return offset + 2;
|
|
2197
2197
|
};
|
|
2198
|
-
Buffer$
|
|
2198
|
+
Buffer$2.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
|
|
2199
2199
|
value = +value;
|
|
2200
2200
|
offset = offset >>> 0;
|
|
2201
2201
|
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
@@ -2205,7 +2205,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2205
2205
|
this[offset + 3] = value >>> 24;
|
|
2206
2206
|
return offset + 4;
|
|
2207
2207
|
};
|
|
2208
|
-
Buffer$
|
|
2208
|
+
Buffer$2.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
|
|
2209
2209
|
value = +value;
|
|
2210
2210
|
offset = offset >>> 0;
|
|
2211
2211
|
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
@@ -2216,10 +2216,10 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2216
2216
|
this[offset + 3] = value & 255;
|
|
2217
2217
|
return offset + 4;
|
|
2218
2218
|
};
|
|
2219
|
-
Buffer$
|
|
2219
|
+
Buffer$2.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {
|
|
2220
2220
|
return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
2221
2221
|
});
|
|
2222
|
-
Buffer$
|
|
2222
|
+
Buffer$2.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {
|
|
2223
2223
|
return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
2224
2224
|
});
|
|
2225
2225
|
function checkIEEE754(buf, value, offset, ext, max, min) {
|
|
@@ -2233,10 +2233,10 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2233
2233
|
ieee754.write(buf, value, offset, littleEndian, 23, 4);
|
|
2234
2234
|
return offset + 4;
|
|
2235
2235
|
}
|
|
2236
|
-
Buffer$
|
|
2236
|
+
Buffer$2.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
|
|
2237
2237
|
return writeFloat(this, value, offset, true, noAssert);
|
|
2238
2238
|
};
|
|
2239
|
-
Buffer$
|
|
2239
|
+
Buffer$2.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
|
|
2240
2240
|
return writeFloat(this, value, offset, false, noAssert);
|
|
2241
2241
|
};
|
|
2242
2242
|
function writeDouble(buf, value, offset, littleEndian, noAssert) {
|
|
@@ -2246,14 +2246,14 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2246
2246
|
ieee754.write(buf, value, offset, littleEndian, 52, 8);
|
|
2247
2247
|
return offset + 8;
|
|
2248
2248
|
}
|
|
2249
|
-
Buffer$
|
|
2249
|
+
Buffer$2.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
|
|
2250
2250
|
return writeDouble(this, value, offset, true, noAssert);
|
|
2251
2251
|
};
|
|
2252
|
-
Buffer$
|
|
2252
|
+
Buffer$2.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
|
|
2253
2253
|
return writeDouble(this, value, offset, false, noAssert);
|
|
2254
2254
|
};
|
|
2255
|
-
Buffer$
|
|
2256
|
-
if (!Buffer$
|
|
2255
|
+
Buffer$2.prototype.copy = function copy(target, targetStart, start, end) {
|
|
2256
|
+
if (!Buffer$2.isBuffer(target)) throw new TypeError("argument should be a Buffer");
|
|
2257
2257
|
if (!start) start = 0;
|
|
2258
2258
|
if (!end && end !== 0) end = this.length;
|
|
2259
2259
|
if (targetStart >= target.length) targetStart = target.length;
|
|
@@ -2271,7 +2271,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2271
2271
|
else Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);
|
|
2272
2272
|
return len$1;
|
|
2273
2273
|
};
|
|
2274
|
-
Buffer$
|
|
2274
|
+
Buffer$2.prototype.fill = function fill(val, start, end, encoding) {
|
|
2275
2275
|
if (typeof val === "string") {
|
|
2276
2276
|
if (typeof start === "string") {
|
|
2277
2277
|
encoding = start;
|
|
@@ -2282,7 +2282,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2282
2282
|
end = this.length;
|
|
2283
2283
|
}
|
|
2284
2284
|
if (encoding !== void 0 && typeof encoding !== "string") throw new TypeError("encoding must be a string");
|
|
2285
|
-
if (typeof encoding === "string" && !Buffer$
|
|
2285
|
+
if (typeof encoding === "string" && !Buffer$2.isEncoding(encoding)) throw new TypeError("Unknown encoding: " + encoding);
|
|
2286
2286
|
if (val.length === 1) {
|
|
2287
2287
|
const code$1 = val.charCodeAt(0);
|
|
2288
2288
|
if (encoding === "utf8" && code$1 < 128 || encoding === "latin1") val = code$1;
|
|
@@ -2297,7 +2297,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2297
2297
|
let i$1;
|
|
2298
2298
|
if (typeof val === "number") for (i$1 = start; i$1 < end; ++i$1) this[i$1] = val;
|
|
2299
2299
|
else {
|
|
2300
|
-
const bytes = Buffer$
|
|
2300
|
+
const bytes = Buffer$2.isBuffer(val) ? val : Buffer$2.from(val, encoding);
|
|
2301
2301
|
const len$1 = bytes.length;
|
|
2302
2302
|
if (len$1 === 0) throw new TypeError("The value \"" + val + "\" is invalid for argument \"value\"");
|
|
2303
2303
|
for (i$1 = 0; i$1 < end - start; ++i$1) this[i$1 + start] = bytes[i$1 % len$1];
|
|
@@ -2492,75 +2492,10 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2492
2492
|
}
|
|
2493
2493
|
}) });
|
|
2494
2494
|
|
|
2495
|
-
//#endregion
|
|
2496
|
-
//#region ../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js
|
|
2497
|
-
var require_safe_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js": ((exports, module) => {
|
|
2498
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
2499
|
-
var buffer = require_buffer();
|
|
2500
|
-
var Buffer$3 = buffer.Buffer;
|
|
2501
|
-
function copyProps(src, dst) {
|
|
2502
|
-
for (var key in src) dst[key] = src[key];
|
|
2503
|
-
}
|
|
2504
|
-
if (Buffer$3.from && Buffer$3.alloc && Buffer$3.allocUnsafe && Buffer$3.allocUnsafeSlow) module.exports = buffer;
|
|
2505
|
-
else {
|
|
2506
|
-
copyProps(buffer, exports);
|
|
2507
|
-
exports.Buffer = SafeBuffer;
|
|
2508
|
-
}
|
|
2509
|
-
function SafeBuffer(arg, encodingOrOffset, length) {
|
|
2510
|
-
return Buffer$3(arg, encodingOrOffset, length);
|
|
2511
|
-
}
|
|
2512
|
-
SafeBuffer.prototype = Object.create(Buffer$3.prototype);
|
|
2513
|
-
copyProps(Buffer$3, SafeBuffer);
|
|
2514
|
-
SafeBuffer.from = function(arg, encodingOrOffset, length) {
|
|
2515
|
-
if (typeof arg === "number") throw new TypeError("Argument must not be a number");
|
|
2516
|
-
return Buffer$3(arg, encodingOrOffset, length);
|
|
2517
|
-
};
|
|
2518
|
-
SafeBuffer.alloc = function(size, fill, encoding) {
|
|
2519
|
-
if (typeof size !== "number") throw new TypeError("Argument must be a number");
|
|
2520
|
-
var buf = Buffer$3(size);
|
|
2521
|
-
if (fill !== void 0) if (typeof encoding === "string") buf.fill(fill, encoding);
|
|
2522
|
-
else buf.fill(fill);
|
|
2523
|
-
else buf.fill(0);
|
|
2524
|
-
return buf;
|
|
2525
|
-
};
|
|
2526
|
-
SafeBuffer.allocUnsafe = function(size) {
|
|
2527
|
-
if (typeof size !== "number") throw new TypeError("Argument must be a number");
|
|
2528
|
-
return Buffer$3(size);
|
|
2529
|
-
};
|
|
2530
|
-
SafeBuffer.allocUnsafeSlow = function(size) {
|
|
2531
|
-
if (typeof size !== "number") throw new TypeError("Argument must be a number");
|
|
2532
|
-
return buffer.SlowBuffer(size);
|
|
2533
|
-
};
|
|
2534
|
-
}) });
|
|
2535
|
-
|
|
2536
|
-
//#endregion
|
|
2537
|
-
//#region ../../node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/browser.js
|
|
2538
|
-
var require_browser = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/browser.js": ((exports, module) => {
|
|
2539
|
-
var MAX_BYTES = 65536;
|
|
2540
|
-
var MAX_UINT32 = 4294967295;
|
|
2541
|
-
function oldBrowser() {
|
|
2542
|
-
throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11");
|
|
2543
|
-
}
|
|
2544
|
-
var Buffer$2 = require_safe_buffer().Buffer;
|
|
2545
|
-
var crypto = globalThis.crypto || globalThis.msCrypto;
|
|
2546
|
-
if (crypto && crypto.getRandomValues) module.exports = randomBytes;
|
|
2547
|
-
else module.exports = oldBrowser;
|
|
2548
|
-
function randomBytes(size, cb) {
|
|
2549
|
-
if (size > MAX_UINT32) throw new RangeError("requested too many random bytes");
|
|
2550
|
-
var bytes = Buffer$2.allocUnsafe(size);
|
|
2551
|
-
if (size > 0) if (size > MAX_BYTES) for (var generated = 0; generated < size; generated += MAX_BYTES) crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES));
|
|
2552
|
-
else crypto.getRandomValues(bytes);
|
|
2553
|
-
if (typeof cb === "function") return process.nextTick(function() {
|
|
2554
|
-
cb(null, bytes);
|
|
2555
|
-
});
|
|
2556
|
-
return bytes;
|
|
2557
|
-
}
|
|
2558
|
-
}) });
|
|
2559
|
-
|
|
2560
2495
|
//#endregion
|
|
2561
2496
|
//#region src/utils/SPACryptoUtils.ts
|
|
2562
2497
|
var import_buffer = /* @__PURE__ */ __toESM(require_buffer(), 1);
|
|
2563
|
-
|
|
2498
|
+
const MAX_RANDOM_VALUES_BYTES = 65536;
|
|
2564
2499
|
/**
|
|
2565
2500
|
* Browser-side `Crypto` implementation using native Web Crypto APIs and `jose` for JWT verification.
|
|
2566
2501
|
*/
|
|
@@ -2599,7 +2534,9 @@ var SPACryptoUtils = class {
|
|
|
2599
2534
|
* @returns A `Buffer` of random bytes.
|
|
2600
2535
|
*/
|
|
2601
2536
|
generateRandomBytes(length) {
|
|
2602
|
-
|
|
2537
|
+
const bytes = new Uint8Array(length);
|
|
2538
|
+
for (let offset = 0; offset < length; offset += MAX_RANDOM_VALUES_BYTES) crypto.getRandomValues(bytes.subarray(offset, offset + MAX_RANDOM_VALUES_BYTES));
|
|
2539
|
+
return import_buffer.Buffer.from(bytes);
|
|
2603
2540
|
}
|
|
2604
2541
|
/**
|
|
2605
2542
|
* Verifies a JWT against a JWK using `jose`.
|
|
@@ -3364,6 +3301,586 @@ const resolveEmojiUrisInHtml = (html) => {
|
|
|
3364
3301
|
};
|
|
3365
3302
|
var resolveEmojiUrisInHtml_default = resolveEmojiUrisInHtml;
|
|
3366
3303
|
|
|
3304
|
+
//#endregion
|
|
3305
|
+
//#region src/utils/isAvatarUri.ts
|
|
3306
|
+
/**
|
|
3307
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3308
|
+
*
|
|
3309
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
3310
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
3311
|
+
* in compliance with the License.
|
|
3312
|
+
* You may obtain a copy of the License at
|
|
3313
|
+
*
|
|
3314
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3315
|
+
*
|
|
3316
|
+
* Unless required by applicable law or agreed to in writing,
|
|
3317
|
+
* software distributed under the License is distributed on an
|
|
3318
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
3319
|
+
* KIND, either express or implied. See the License for the
|
|
3320
|
+
* specific language governing permissions and limitations
|
|
3321
|
+
* under the License.
|
|
3322
|
+
*/
|
|
3323
|
+
const AVATAR_URI_SCHEME = "avatar:";
|
|
3324
|
+
/**
|
|
3325
|
+
* Checks whether a given URI uses the `avatar:` scheme
|
|
3326
|
+
* (e.g. `"avatar:style=rounded,text=Acme,colors=2"`).
|
|
3327
|
+
*
|
|
3328
|
+
* @param uri - The URI string to check.
|
|
3329
|
+
* @returns `true` if the URI starts with `"avatar:"`, `false` otherwise.
|
|
3330
|
+
*
|
|
3331
|
+
* @example
|
|
3332
|
+
* ```typescript
|
|
3333
|
+
* isAvatarUri("avatar:style=circle,text=Acme,colors=0"); // true
|
|
3334
|
+
* isAvatarUri("emoji:🐯"); // false
|
|
3335
|
+
* ```
|
|
3336
|
+
*/
|
|
3337
|
+
const isAvatarUri = (uri) => typeof uri === "string" && uri.startsWith(AVATAR_URI_SCHEME);
|
|
3338
|
+
var isAvatarUri_default = isAvatarUri;
|
|
3339
|
+
|
|
3340
|
+
//#endregion
|
|
3341
|
+
//#region src/utils/extractAvatarParamsFromUri.ts
|
|
3342
|
+
const DEFAULT_PARAMS = {
|
|
3343
|
+
colors: 0,
|
|
3344
|
+
content: "",
|
|
3345
|
+
shape: "rounded",
|
|
3346
|
+
variant: "two_letter"
|
|
3347
|
+
};
|
|
3348
|
+
/**
|
|
3349
|
+
* Parses the comma-separated `key=value` pairs of an `avatar:` URI, e.g.
|
|
3350
|
+
* `"avatar:shape=circle,variant=two_letter,content=BM,colors=2,bg=#FF5733"`.
|
|
3351
|
+
*
|
|
3352
|
+
* @param uri - A URI string in the form `"avatar:shape=...,variant=...,content=...,colors=...,bg=..."`.
|
|
3353
|
+
* @returns The parsed avatar parameters, falling back to defaults for any missing/invalid field.
|
|
3354
|
+
*
|
|
3355
|
+
* @example
|
|
3356
|
+
* ```typescript
|
|
3357
|
+
* extractAvatarParamsFromUri("avatar:shape=circle,variant=anonymous_animal,content=jackalope");
|
|
3358
|
+
* // { shape: "circle", variant: "anonymous_animal", content: "jackalope", colors: 0 }
|
|
3359
|
+
* ```
|
|
3360
|
+
*/
|
|
3361
|
+
const extractAvatarParamsFromUri = (uri) => {
|
|
3362
|
+
if (!isAvatarUri_default(uri)) return { ...DEFAULT_PARAMS };
|
|
3363
|
+
const raw = uri.slice(AVATAR_URI_SCHEME.length);
|
|
3364
|
+
const params = {};
|
|
3365
|
+
raw.split(",").forEach((pair) => {
|
|
3366
|
+
const [key, ...rest] = pair.split("=");
|
|
3367
|
+
if (key) params[key.trim()] = rest.join("=").trim();
|
|
3368
|
+
});
|
|
3369
|
+
const shape = ["circle", "rounded"].includes(params["shape"]) ? params["shape"] : DEFAULT_PARAMS.shape;
|
|
3370
|
+
const variant = [
|
|
3371
|
+
"anonymous_animal",
|
|
3372
|
+
"anonymous_entity",
|
|
3373
|
+
"blank",
|
|
3374
|
+
"one_letter",
|
|
3375
|
+
"two_letter"
|
|
3376
|
+
].includes(params["variant"]) ? params["variant"] : DEFAULT_PARAMS.variant;
|
|
3377
|
+
const colors = Number.parseInt(params["colors"], 10);
|
|
3378
|
+
return {
|
|
3379
|
+
...params["bg"] ? { bg: params["bg"] } : {},
|
|
3380
|
+
colors: Number.isFinite(colors) ? colors : DEFAULT_PARAMS.colors,
|
|
3381
|
+
content: params["content"] ?? DEFAULT_PARAMS.content,
|
|
3382
|
+
shape,
|
|
3383
|
+
variant
|
|
3384
|
+
};
|
|
3385
|
+
};
|
|
3386
|
+
var extractAvatarParamsFromUri_default = extractAvatarParamsFromUri;
|
|
3387
|
+
|
|
3388
|
+
//#endregion
|
|
3389
|
+
//#region src/utils/buildAvatarSpec.ts
|
|
3390
|
+
/**
|
|
3391
|
+
* Serializes {@link AvatarParams} into an `avatar:` URI, the inverse of
|
|
3392
|
+
* {@link extractAvatarParamsFromUri}.
|
|
3393
|
+
*
|
|
3394
|
+
* @param params - The avatar parameters to serialize.
|
|
3395
|
+
* @returns An `"avatar:shape=...,variant=...,content=...,colors=..."` spec string, with a
|
|
3396
|
+
* trailing `,bg=...` when {@link AvatarParams.bg} is set.
|
|
3397
|
+
*
|
|
3398
|
+
* @example
|
|
3399
|
+
* ```typescript
|
|
3400
|
+
* buildAvatarSpec({shape: 'circle', variant: 'two_letter', content: 'BM', colors: 2});
|
|
3401
|
+
* // "avatar:shape=circle,variant=two_letter,content=BM,colors=2"
|
|
3402
|
+
* ```
|
|
3403
|
+
*/
|
|
3404
|
+
const buildAvatarSpec = ({ shape, variant, content, colors, bg }) => {
|
|
3405
|
+
const base = `${AVATAR_URI_SCHEME}shape=${shape},variant=${variant},content=${content},colors=${colors}`;
|
|
3406
|
+
return bg ? `${base},bg=${bg}` : base;
|
|
3407
|
+
};
|
|
3408
|
+
var buildAvatarSpec_default = buildAvatarSpec;
|
|
3409
|
+
|
|
3410
|
+
//#endregion
|
|
3411
|
+
//#region src/utils/anonymousAnimalIcons.generated.ts
|
|
3412
|
+
const ANONYMOUS_ANIMAL_ICONS = {
|
|
3413
|
+
capybara: {
|
|
3414
|
+
color: "#8A6A2E",
|
|
3415
|
+
markup: "<ellipse cx=\"50\" cy=\"58\" rx=\"30\" ry=\"20\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"24\" cy=\"50\" rx=\"5\" ry=\"5\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"76\" cy=\"50\" rx=\"5\" ry=\"5\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"50\" cy=\"70\" rx=\"14\" ry=\"10\" fill=\"#FFFFFF\"/>\n<circle cx=\"36\" cy=\"56\" r=\"3\" fill=\"%COLOR%\"/>\n<circle cx=\"64\" cy=\"56\" r=\"3\" fill=\"%COLOR%\"/>"
|
|
3416
|
+
},
|
|
3417
|
+
chameleon: {
|
|
3418
|
+
color: "#C23B7A",
|
|
3419
|
+
markup: "<path d=\"M30 60 Q20 55 25 45 Q35 35 45 42 L55 35 Q65 25 72 35 Q78 42 68 48 L55 55 Q60 65 45 68 Q32 70 30 60 Z\" fill=\"#FFFFFF\"/>\n<circle cx=\"60\" cy=\"35\" r=\"9\" fill=\"#FFFFFF\"/>\n<circle cx=\"60\" cy=\"35\" r=\"3\" fill=\"%COLOR%\"/>\n<path d=\"M25 62 Q15 65 12 78\" stroke=\"#FFFFFF\" stroke-width=\"5\" fill=\"none\" stroke-linecap=\"round\"/>"
|
|
3420
|
+
},
|
|
3421
|
+
chinchilla: {
|
|
3422
|
+
color: "#5B6BC0",
|
|
3423
|
+
markup: "<circle cx=\"30\" cy=\"34\" r=\"14\" fill=\"#FFFFFF\"/>\n<circle cx=\"70\" cy=\"34\" r=\"14\" fill=\"#FFFFFF\"/>\n<circle cx=\"30\" cy=\"34\" r=\"7\" fill=\"%COLOR%\"/>\n<circle cx=\"70\" cy=\"34\" r=\"7\" fill=\"%COLOR%\"/>\n<circle cx=\"50\" cy=\"58\" r=\"26\" fill=\"#FFFFFF\"/>\n<circle cx=\"38\" cy=\"55\" r=\"3.5\" fill=\"%COLOR%\"/>\n<circle cx=\"62\" cy=\"55\" r=\"3.5\" fill=\"%COLOR%\"/>\n<circle cx=\"50\" cy=\"65\" r=\"4\" fill=\"%COLOR%\"/>"
|
|
3424
|
+
},
|
|
3425
|
+
chipmunk: {
|
|
3426
|
+
color: "#B5522C",
|
|
3427
|
+
markup: "<circle cx=\"50\" cy=\"52\" r=\"22\" fill=\"#FFFFFF\"/>\n<path d=\"M28 34 L22 16 L38 28 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M72 34 L78 16 L62 28 Z\" fill=\"#FFFFFF\"/>\n<circle cx=\"30\" cy=\"60\" r=\"8\" fill=\"#FFFFFF\"/>\n<circle cx=\"70\" cy=\"60\" r=\"8\" fill=\"#FFFFFF\"/>\n<path d=\"M50 75 Q70 70 78 85 Q65 95 50 88 Q35 95 22 85 Q30 70 50 75 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M40 88 Q50 82 60 88\" stroke=\"%COLOR%\" stroke-width=\"3\" fill=\"none\"/>"
|
|
3428
|
+
},
|
|
3429
|
+
chupacabra: {
|
|
3430
|
+
color: "#4B7A3F",
|
|
3431
|
+
markup: "<path d=\"M20 50 L15 35 M28 42 L25 22 M38 38 L38 15 M50 36 L50 12 M62 38 L62 15 M72 42 L75 22 M80 50 L85 35\" stroke=\"#FFFFFF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n<ellipse cx=\"50\" cy=\"58\" rx=\"24\" ry=\"20\" fill=\"#FFFFFF\"/>\n<circle cx=\"38\" cy=\"52\" r=\"6\" fill=\"%COLOR%\"/>\n<circle cx=\"62\" cy=\"52\" r=\"6\" fill=\"%COLOR%\"/>\n<circle cx=\"38\" cy=\"52\" r=\"3\" fill=\"#FFFFFF\"/>\n<circle cx=\"62\" cy=\"52\" r=\"3\" fill=\"#FFFFFF\"/>"
|
|
3432
|
+
},
|
|
3433
|
+
dingo: {
|
|
3434
|
+
color: "#B5892C",
|
|
3435
|
+
markup: "<path d=\"M30 30 L22 10 L38 24 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M70 30 L78 10 L62 24 Z\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"50\" cy=\"55\" rx=\"22\" ry=\"18\" fill=\"#FFFFFF\"/>\n<path d=\"M40 68 Q50 82 60 68 Q66 60 55 60 L45 60 Q34 60 40 68 Z\" fill=\"#FFFFFF\"/>"
|
|
3436
|
+
},
|
|
3437
|
+
dinosaur: {
|
|
3438
|
+
color: "#2E8F5B",
|
|
3439
|
+
markup: "<path d=\"M20 78 Q18 55 35 45 L38 25 L46 42 L55 30 L58 45 Q75 50 75 65 L78 78 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M40 45 L45 30 L50 45 L57 33 L60 45\" stroke=\"#FFFFFF\" stroke-width=\"0\" fill=\"#FFFFFF\"/>\n<circle cx=\"42\" cy=\"40\" r=\"2.5\" fill=\"%COLOR%\"/>"
|
|
3440
|
+
},
|
|
3441
|
+
frog: {
|
|
3442
|
+
color: "#4FA33F",
|
|
3443
|
+
markup: "<circle cx=\"30\" cy=\"35\" r=\"14\" fill=\"#FFFFFF\"/>\n<circle cx=\"70\" cy=\"35\" r=\"14\" fill=\"#FFFFFF\"/>\n<circle cx=\"30\" cy=\"35\" r=\"6\" fill=\"%COLOR%\"/>\n<circle cx=\"70\" cy=\"35\" r=\"6\" fill=\"%COLOR%\"/>\n<ellipse cx=\"50\" cy=\"62\" rx=\"32\" ry=\"22\" fill=\"#FFFFFF\"/>\n<path d=\"M25 65 Q50 78 75 65\" stroke=\"%COLOR%\" stroke-width=\"4\" fill=\"none\" stroke-linecap=\"round\"/>"
|
|
3444
|
+
},
|
|
3445
|
+
giraffe: {
|
|
3446
|
+
color: "#C99A2E",
|
|
3447
|
+
markup: "<path d=\"M42 90 L38 40 Q37 20 48 15 L55 15 Q62 20 58 28 Q52 30 52 38 L58 40 L54 90 Z\" fill=\"#FFFFFF\"/>\n<circle cx=\"47\" cy=\"14\" r=\"3\" fill=\"#FFFFFF\"/>\n<circle cx=\"58\" cy=\"14\" r=\"3\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"30\" cy=\"55\" rx=\"4\" ry=\"6\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"44\" cy=\"70\" rx=\"4\" ry=\"6\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"60\" cy=\"50\" rx=\"4\" ry=\"6\" fill=\"#FFFFFF\"/>"
|
|
3448
|
+
},
|
|
3449
|
+
hedgehog: {
|
|
3450
|
+
color: "#8A9A3B",
|
|
3451
|
+
markup: "<path d=\"M20 55 L10 40 M25 42 L18 25 M35 33 L30 15 M50 30 L48 10 M65 33 L70 15 M75 42 L82 25 M80 55 L90 40\" stroke=\"#FFFFFF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n<circle cx=\"50\" cy=\"60\" r=\"26\" fill=\"#FFFFFF\"/>\n<path d=\"M50 60 Q30 90 20 75 Q30 70 34 60 Z\" fill=\"#FFFFFF\"/>\n<circle cx=\"30\" cy=\"56\" r=\"3.5\" fill=\"%COLOR%\"/>"
|
|
3452
|
+
},
|
|
3453
|
+
hippo: {
|
|
3454
|
+
color: "#5B7A9E",
|
|
3455
|
+
markup: "<ellipse cx=\"50\" cy=\"52\" rx=\"34\" ry=\"24\" fill=\"#FFFFFF\"/>\n<circle cx=\"30\" cy=\"30\" r=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"70\" cy=\"30\" r=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"34\" cy=\"42\" r=\"3.5\" fill=\"%COLOR%\"/>\n<circle cx=\"66\" cy=\"42\" r=\"3.5\" fill=\"%COLOR%\"/>\n<ellipse cx=\"50\" cy=\"70\" rx=\"20\" ry=\"10\" fill=\"#FFFFFF\"/>\n<path d=\"M35 70 Q50 78 65 70\" stroke=\"%COLOR%\" stroke-width=\"3\" fill=\"none\"/>"
|
|
3456
|
+
},
|
|
3457
|
+
jackal: {
|
|
3458
|
+
color: "#D6822C",
|
|
3459
|
+
markup: "<path d=\"M28 32 L18 8 L40 26 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M72 32 L82 8 L60 26 Z\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"50\" cy=\"55\" rx=\"20\" ry=\"17\" fill=\"#FFFFFF\"/>\n<path d=\"M42 66 Q50 82 58 66 Q64 58 52 58 L48 58 Q36 58 42 66 Z\" fill=\"#FFFFFF\"/>"
|
|
3460
|
+
},
|
|
3461
|
+
jackalope: {
|
|
3462
|
+
color: "#2E9E9E",
|
|
3463
|
+
markup: "<path d=\"M35 20 L28 5 M35 20 L38 8\" stroke=\"#FFFFFF\" stroke-width=\"4\" stroke-linecap=\"round\" fill=\"none\"/>\n<path d=\"M65 20 L72 5 M65 20 L62 8\" stroke=\"#FFFFFF\" stroke-width=\"4\" stroke-linecap=\"round\" fill=\"none\"/>\n<ellipse cx=\"40\" cy=\"35\" rx=\"7\" ry=\"16\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"60\" cy=\"35\" rx=\"7\" ry=\"16\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"50\" cy=\"62\" rx=\"22\" ry=\"20\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"50\" cy=\"78\" rx=\"10\" ry=\"7\" fill=\"#FFFFFF\"/>"
|
|
3464
|
+
},
|
|
3465
|
+
mink: {
|
|
3466
|
+
color: "#3B7DD8",
|
|
3467
|
+
markup: "<ellipse cx=\"50\" cy=\"55\" rx=\"24\" ry=\"16\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"24\" cy=\"46\" rx=\"6\" ry=\"6\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"76\" cy=\"46\" rx=\"6\" ry=\"6\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"18\" cy=\"60\" rx=\"10\" ry=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"12\" cy=\"60\" r=\"2.5\" fill=\"%COLOR%\"/>"
|
|
3468
|
+
},
|
|
3469
|
+
otter: {
|
|
3470
|
+
color: "#E8622C",
|
|
3471
|
+
markup: "<circle cx=\"50\" cy=\"55\" r=\"24\" fill=\"#FFFFFF\"/>\n<circle cx=\"30\" cy=\"38\" r=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"70\" cy=\"38\" r=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"38\" cy=\"52\" r=\"4\" fill=\"%COLOR%\"/>\n<circle cx=\"62\" cy=\"52\" r=\"4\" fill=\"%COLOR%\"/>\n<circle cx=\"50\" cy=\"62\" r=\"5\" fill=\"%COLOR%\"/>\n<path d=\"M30 68 L15 65 M30 71 L14 71 M30 74 L15 77 M70 68 L85 65 M70 71 L86 71 M70 74 L85 77\" stroke=\"#FFFFFF\" stroke-width=\"3\" stroke-linecap=\"round\"/>"
|
|
3472
|
+
},
|
|
3473
|
+
platypus: {
|
|
3474
|
+
color: "#C23B7A",
|
|
3475
|
+
markup: "<ellipse cx=\"55\" cy=\"55\" rx=\"22\" ry=\"18\" fill=\"#FFFFFF\"/>\n<path d=\"M18 52 Q10 55 18 62 Q35 68 42 55 Q35 45 18 52 Z\" fill=\"#FFFFFF\"/>"
|
|
3476
|
+
},
|
|
3477
|
+
quagga: {
|
|
3478
|
+
color: "#D6455C",
|
|
3479
|
+
markup: "<path d=\"M25 70 L30 30 Q35 20 45 22 L60 25 Q68 27 72 35 L75 55 L68 70 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M35 25 L20 10 M42 22 L34 6\" stroke=\"#FFFFFF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n<rect x=\"33\" y=\"30\" width=\"6\" height=\"10\" fill=\"%COLOR%\"/>\n<rect x=\"45\" y=\"32\" width=\"6\" height=\"12\" fill=\"%COLOR%\"/>\n<rect x=\"57\" y=\"35\" width=\"6\" height=\"12\" fill=\"%COLOR%\"/>"
|
|
3480
|
+
},
|
|
3481
|
+
raccoon: {
|
|
3482
|
+
color: "#E0348E",
|
|
3483
|
+
markup: "<circle cx=\"50\" cy=\"55\" r=\"24\" fill=\"#FFFFFF\"/>\n<path d=\"M25 35 L18 15 L38 28 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M75 35 L82 15 L62 28 Z\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"36\" cy=\"52\" rx=\"9\" ry=\"6\" fill=\"%COLOR%\"/>\n<ellipse cx=\"64\" cy=\"52\" rx=\"9\" ry=\"6\" fill=\"%COLOR%\"/>\n<circle cx=\"50\" cy=\"63\" r=\"4\" fill=\"%COLOR%\"/>"
|
|
3484
|
+
},
|
|
3485
|
+
skunk: {
|
|
3486
|
+
color: "#7B3F9E",
|
|
3487
|
+
markup: "<circle cx=\"38\" cy=\"55\" r=\"18\" fill=\"#FFFFFF\"/>\n<path d=\"M50 45 Q85 30 85 65 Q85 90 55 82 Q78 68 65 55 Q60 48 50 45 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M55 45 Q80 35 80 65\" stroke=\"%COLOR%\" stroke-width=\"4\" fill=\"none\" stroke-linecap=\"round\"/>\n<ellipse cx=\"24\" cy=\"48\" rx=\"4\" ry=\"5\" fill=\"%COLOR%\"/>"
|
|
3488
|
+
}
|
|
3489
|
+
};
|
|
3490
|
+
|
|
3491
|
+
//#endregion
|
|
3492
|
+
//#region src/utils/anonymousEntityIcons.generated.ts
|
|
3493
|
+
const ANONYMOUS_ENTITY_ICONS = {
|
|
3494
|
+
anchor: {
|
|
3495
|
+
color: "#D6455C",
|
|
3496
|
+
markup: "<circle cx=\"50\" cy=\"18\" r=\"8\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"6\"/>\n<rect x=\"46\" y=\"26\" width=\"8\" height=\"50\" fill=\"#FFFFFF\"/>\n<path d=\"M20 55 Q20 80 50 82 Q80 80 80 55\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"7\"/>\n<rect x=\"28\" y=\"42\" width=\"44\" height=\"7\" fill=\"#FFFFFF\"/>"
|
|
3497
|
+
},
|
|
3498
|
+
antenna: {
|
|
3499
|
+
color: "#8A9A3B",
|
|
3500
|
+
markup: "<rect x=\"46\" y=\"45\" width=\"8\" height=\"40\" fill=\"#FFFFFF\"/>\n<circle cx=\"50\" cy=\"35\" r=\"7\" fill=\"#FFFFFF\"/>\n<path d=\"M35 30 Q50 10 65 30 M28 40 Q50 8 72 40\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"5\" stroke-linecap=\"round\"/>"
|
|
3501
|
+
},
|
|
3502
|
+
anvil: {
|
|
3503
|
+
color: "#B5522C",
|
|
3504
|
+
markup: "<rect x=\"20\" y=\"30\" width=\"60\" height=\"14\" rx=\"3\" fill=\"#FFFFFF\"/>\n<polygon points=\"35,44 65,44 58,60 42,60\" fill=\"#FFFFFF\"/>\n<rect x=\"42\" y=\"60\" width=\"16\" height=\"10\" fill=\"#FFFFFF\"/>\n<rect x=\"30\" y=\"70\" width=\"40\" height=\"12\" rx=\"3\" fill=\"#FFFFFF\"/>"
|
|
3505
|
+
},
|
|
3506
|
+
arch: {
|
|
3507
|
+
color: "#E0348E",
|
|
3508
|
+
markup: "<path d=\"M20 85 L20 50 Q20 15 50 15 Q80 15 80 50 L80 85 Z\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"10\"/>"
|
|
3509
|
+
},
|
|
3510
|
+
bridge: {
|
|
3511
|
+
color: "#B5892C",
|
|
3512
|
+
markup: "<path d=\"M10 55 Q50 20 90 55\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"7\"/>\n<rect x=\"10\" y=\"55\" width=\"80\" height=\"8\" fill=\"#FFFFFF\"/>\n<rect x=\"20\" y=\"63\" width=\"6\" height=\"18\" fill=\"#FFFFFF\"/>\n<rect x=\"74\" y=\"63\" width=\"6\" height=\"18\" fill=\"#FFFFFF\"/>"
|
|
3513
|
+
},
|
|
3514
|
+
chevron: {
|
|
3515
|
+
color: "#C99A2E",
|
|
3516
|
+
markup: "<polygon points=\"15,30 50,30 85,60 50,60\" fill=\"#FFFFFF\"/>\n<polygon points=\"15,55 50,55 85,85 50,85\" fill=\"#FFFFFF\" opacity=\"0.55\"/>"
|
|
3517
|
+
},
|
|
3518
|
+
circuit_node: {
|
|
3519
|
+
color: "#5B7A9E",
|
|
3520
|
+
markup: "<circle cx=\"50\" cy=\"50\" r=\"10\" fill=\"#FFFFFF\"/>\n<circle cx=\"20\" cy=\"20\" r=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"80\" cy=\"20\" r=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"20\" cy=\"80\" r=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"80\" cy=\"80\" r=\"7\" fill=\"#FFFFFF\"/>\n<path d=\"M50 50 L20 20 M50 50 L80 20 M50 50 L20 80 M50 50 L80 80\" stroke=\"#FFFFFF\" stroke-width=\"5\"/>"
|
|
3521
|
+
},
|
|
3522
|
+
compass: {
|
|
3523
|
+
color: "#4FA33F",
|
|
3524
|
+
markup: "<circle cx=\"50\" cy=\"50\" r=\"34\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"6\"/>\n<polygon points=\"50,28 58,50 50,72 42,50\" fill=\"#FFFFFF\"/>"
|
|
3525
|
+
},
|
|
3526
|
+
cube: {
|
|
3527
|
+
color: "#2E9E9E",
|
|
3528
|
+
markup: "<polygon points=\"50,12 84,30 84,70 50,88 16,70 16,30\" fill=\"#FFFFFF\" opacity=\"0.35\"/>\n<polygon points=\"50,12 84,30 50,48 16,30\" fill=\"#FFFFFF\"/>\n<polygon points=\"50,48 84,30 84,70 50,88\" fill=\"#FFFFFF\" opacity=\"0.7\"/>"
|
|
3529
|
+
},
|
|
3530
|
+
diamond: {
|
|
3531
|
+
color: "#E8622C",
|
|
3532
|
+
markup: "<polygon points=\"50,12 82,50 50,88 18,50\" fill=\"#FFFFFF\"/>"
|
|
3533
|
+
},
|
|
3534
|
+
dome: {
|
|
3535
|
+
color: "#D6822C",
|
|
3536
|
+
markup: "<path d=\"M20 85 L20 55 Q20 20 50 20 Q80 20 80 55 L80 85 Z\" fill=\"#FFFFFF\"/>\n<rect x=\"46\" y=\"8\" width=\"8\" height=\"12\" fill=\"#FFFFFF\"/>\n<circle cx=\"50\" cy=\"6\" r=\"4\" fill=\"#FFFFFF\"/>"
|
|
3537
|
+
},
|
|
3538
|
+
gate: {
|
|
3539
|
+
color: "#3B7DD8",
|
|
3540
|
+
markup: "<path d=\"M22 85 L22 40 Q22 15 50 15 Q78 15 78 40 L78 85\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"12\"/>"
|
|
3541
|
+
},
|
|
3542
|
+
hexagon: {
|
|
3543
|
+
color: "#3B7DD8",
|
|
3544
|
+
markup: "<polygon points=\"50,15 82,33 82,67 50,85 18,67 18,33\" fill=\"#FFFFFF\"/>"
|
|
3545
|
+
},
|
|
3546
|
+
key: {
|
|
3547
|
+
color: "#C99A2E",
|
|
3548
|
+
markup: "<circle cx=\"30\" cy=\"35\" r=\"16\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"8\"/>\n<rect x=\"42\" y=\"46\" width=\"42\" height=\"9\" fill=\"#FFFFFF\"/>\n<rect x=\"66\" y=\"55\" width=\"9\" height=\"14\" fill=\"#FFFFFF\"/>\n<rect x=\"78\" y=\"55\" width=\"9\" height=\"20\" fill=\"#FFFFFF\"/>"
|
|
3549
|
+
},
|
|
3550
|
+
lighthouse: {
|
|
3551
|
+
color: "#D6455C",
|
|
3552
|
+
markup: "<polygon points=\"42,85 58,85 54,25 46,25\" fill=\"#FFFFFF\"/>\n<rect x=\"40\" y=\"15\" width=\"20\" height=\"12\" fill=\"#FFFFFF\"/>\n<polygon points=\"38,15 62,15 50,5\" fill=\"#FFFFFF\"/>\n<rect x=\"30\" y=\"85\" width=\"40\" height=\"6\" fill=\"#FFFFFF\"/>"
|
|
3553
|
+
},
|
|
3554
|
+
lock: {
|
|
3555
|
+
color: "#E0348E",
|
|
3556
|
+
markup: "<rect x=\"26\" y=\"45\" width=\"48\" height=\"38\" rx=\"6\" fill=\"#FFFFFF\"/>\n<path d=\"M34 45 L34 32 Q34 14 50 14 Q66 14 66 32 L66 45\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"8\"/>\n<circle cx=\"50\" cy=\"63\" r=\"6\" fill=\"%COLOR%\"/>"
|
|
3557
|
+
},
|
|
3558
|
+
obelisk: {
|
|
3559
|
+
color: "#5B6BC0",
|
|
3560
|
+
markup: "<polygon points=\"50,8 62,25 62,85 38,85 38,25\" fill=\"#FFFFFF\"/>"
|
|
3561
|
+
},
|
|
3562
|
+
octagon: {
|
|
3563
|
+
color: "#B5522C",
|
|
3564
|
+
markup: "<polygon points=\"35,15 65,15 85,35 85,65 65,85 35,85 15,65 15,35\" fill=\"#FFFFFF\"/>"
|
|
3565
|
+
},
|
|
3566
|
+
orbit_ring: {
|
|
3567
|
+
color: "#4FA33F",
|
|
3568
|
+
markup: "<circle cx=\"50\" cy=\"50\" r=\"10\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"50\" cy=\"50\" rx=\"38\" ry=\"16\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"5\" transform=\"rotate(-25 50 50)\"/>"
|
|
3569
|
+
},
|
|
3570
|
+
parallelogram: {
|
|
3571
|
+
color: "#2E8F5B",
|
|
3572
|
+
markup: "<polygon points=\"30,25 90,25 70,75 10,75\" fill=\"#FFFFFF\"/>"
|
|
3573
|
+
},
|
|
3574
|
+
pavilion: {
|
|
3575
|
+
color: "#4FA33F",
|
|
3576
|
+
markup: "<polygon points=\"50,12 90,45 10,45\" fill=\"#FFFFFF\"/>\n<rect x=\"20\" y=\"45\" width=\"60\" height=\"40\" fill=\"#FFFFFF\" opacity=\"0.6\"/>\n<rect x=\"44\" y=\"20\" width=\"6\" height=\"14\" fill=\"#FFFFFF\"/>"
|
|
3577
|
+
},
|
|
3578
|
+
pentagon: {
|
|
3579
|
+
color: "#7B3F9E",
|
|
3580
|
+
markup: "<polygon points=\"50,12 86,38 72,82 28,82 14,38\" fill=\"#FFFFFF\"/>"
|
|
3581
|
+
},
|
|
3582
|
+
plus_facet: {
|
|
3583
|
+
color: "#E0348E",
|
|
3584
|
+
markup: "<polygon points=\"38,12 62,12 62,38 88,38 88,62 62,62 62,88 38,88 38,62 12,62 12,38 38,38\" fill=\"#FFFFFF\"/>"
|
|
3585
|
+
},
|
|
3586
|
+
silo: {
|
|
3587
|
+
color: "#8A6A2E",
|
|
3588
|
+
markup: "<rect x=\"30\" y=\"35\" width=\"40\" height=\"50\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"50\" cy=\"35\" rx=\"20\" ry=\"10\" fill=\"#FFFFFF\"/>\n<path d=\"M35 20 Q50 5 65 20\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"6\" stroke-linecap=\"round\"/>"
|
|
3589
|
+
},
|
|
3590
|
+
spiral: {
|
|
3591
|
+
color: "#8A9A3B",
|
|
3592
|
+
markup: "<path d=\"M50 50 m-30 0 a30 30 0 1 1 60 0 a22 22 0 1 1 -44 0 a14 14 0 1 1 28 0 a6 6 0 1 1 -12 0\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"6\" stroke-linecap=\"round\"/>"
|
|
3593
|
+
},
|
|
3594
|
+
spire: {
|
|
3595
|
+
color: "#7B3F9E",
|
|
3596
|
+
markup: "<polygon points=\"50,8 62,50 38,50\" fill=\"#FFFFFF\"/>\n<rect x=\"30\" y=\"50\" width=\"40\" height=\"35\" fill=\"#FFFFFF\"/>"
|
|
3597
|
+
},
|
|
3598
|
+
star: {
|
|
3599
|
+
color: "#5B6BC0",
|
|
3600
|
+
markup: "<polygon points=\"50,10 61,38 90,38 66,56 75,86 50,68 25,86 34,56 10,38 39,38\" fill=\"#FFFFFF\"/>"
|
|
3601
|
+
},
|
|
3602
|
+
tower: {
|
|
3603
|
+
color: "#C23B7A",
|
|
3604
|
+
markup: "<rect x=\"38\" y=\"20\" width=\"24\" height=\"65\" fill=\"#FFFFFF\"/>\n<polygon points=\"50,8 62,20 38,20\" fill=\"#FFFFFF\"/>\n<rect x=\"44\" y=\"32\" width=\"6\" height=\"8\" fill=\"%COLOR%\"/>\n<rect x=\"44\" y=\"48\" width=\"6\" height=\"8\" fill=\"%COLOR%\"/>\n<rect x=\"44\" y=\"64\" width=\"6\" height=\"8\" fill=\"%COLOR%\"/>"
|
|
3605
|
+
},
|
|
3606
|
+
townhouse: {
|
|
3607
|
+
color: "#5B7A9E",
|
|
3608
|
+
markup: "<polygon points=\"50,15 82,35 82,85 18,85 18,35\" fill=\"#FFFFFF\"/>\n<rect x=\"42\" y=\"60\" width=\"16\" height=\"25\" fill=\"%COLOR%\"/>\n<rect x=\"26\" y=\"45\" width=\"10\" height=\"10\" fill=\"%COLOR%\"/>\n<rect x=\"64\" y=\"45\" width=\"10\" height=\"10\" fill=\"%COLOR%\"/>"
|
|
3609
|
+
},
|
|
3610
|
+
triangle_stack: {
|
|
3611
|
+
color: "#D6455C",
|
|
3612
|
+
markup: "<polygon points=\"50,15 78,60 22,60\" fill=\"#FFFFFF\"/>\n<polygon points=\"50,42 90,88 10,88\" fill=\"#FFFFFF\" opacity=\"0.55\"/>"
|
|
3613
|
+
},
|
|
3614
|
+
turbine: {
|
|
3615
|
+
color: "#7B3F9E",
|
|
3616
|
+
markup: "<circle cx=\"50\" cy=\"50\" r=\"9\" fill=\"#FFFFFF\"/>\n<path d=\"M50 50 Q20 40 20 15 Q50 25 50 50 Q80 40 80 15 Q50 25 50 50 Q80 60 80 85 Q50 75 50 50 Q20 60 20 85 Q50 75 50 50\" fill=\"#FFFFFF\"/>"
|
|
3617
|
+
},
|
|
3618
|
+
valve: {
|
|
3619
|
+
color: "#D68A2C",
|
|
3620
|
+
markup: "<circle cx=\"50\" cy=\"50\" r=\"12\" fill=\"#FFFFFF\"/>\n<path d=\"M50 20 L50 32 M50 68 L50 80 M20 50 L32 50 M68 50 L80 50 M30 30 L38 38 M62 62 L70 70 M70 30 L62 38 M38 62 L30 70\" stroke=\"#FFFFFF\" stroke-width=\"6\" stroke-linecap=\"round\"/>"
|
|
3621
|
+
},
|
|
3622
|
+
windmill: {
|
|
3623
|
+
color: "#2E9E9E",
|
|
3624
|
+
markup: "<polygon points=\"46,85 54,85 52,25 48,25\" fill=\"#FFFFFF\"/>\n<circle cx=\"50\" cy=\"25\" r=\"5\" fill=\"#FFFFFF\"/>\n<path d=\"M50 25 L25 10 M50 25 L75 10 M50 25 L25 40 M50 25 L75 40\" stroke=\"#FFFFFF\" stroke-width=\"6\" stroke-linecap=\"round\"/>"
|
|
3625
|
+
}
|
|
3626
|
+
};
|
|
3627
|
+
|
|
3628
|
+
//#endregion
|
|
3629
|
+
//#region src/utils/hashStr.ts
|
|
3630
|
+
/**
|
|
3631
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3632
|
+
*
|
|
3633
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
3634
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
3635
|
+
* in compliance with the License.
|
|
3636
|
+
* You may obtain a copy of the License at
|
|
3637
|
+
*
|
|
3638
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3639
|
+
*
|
|
3640
|
+
* Unless required by applicable law or agreed to in writing,
|
|
3641
|
+
* software distributed under the License is distributed on an
|
|
3642
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
3643
|
+
* KIND, either express or implied. See the License for the
|
|
3644
|
+
* specific language governing permissions and limitations
|
|
3645
|
+
* under the License.
|
|
3646
|
+
*/
|
|
3647
|
+
/**
|
|
3648
|
+
* 32-bit unsigned polynomial hash (`h = h*31 + charCode`), used to deterministically derive
|
|
3649
|
+
* avatar colors/icons from a seed string. Shared by every avatar util that needs the same
|
|
3650
|
+
* hash so seeds map identically across them.
|
|
3651
|
+
*
|
|
3652
|
+
* @example
|
|
3653
|
+
* ```typescript
|
|
3654
|
+
* hashStr('session-abc123');
|
|
3655
|
+
* ```
|
|
3656
|
+
*/
|
|
3657
|
+
const hashStr = (str) => {
|
|
3658
|
+
let h = 0;
|
|
3659
|
+
for (let i$1 = 0; i$1 < str.length; i$1++) h = h * 31 + str.charCodeAt(i$1) >>> 0;
|
|
3660
|
+
return h;
|
|
3661
|
+
};
|
|
3662
|
+
var hashStr_default = hashStr;
|
|
3663
|
+
|
|
3664
|
+
//#endregion
|
|
3665
|
+
//#region src/utils/pickAnonymousAvatarName.ts
|
|
3666
|
+
const ANONYMOUS_AVATAR_NAMES = Object.keys(ANONYMOUS_ANIMAL_ICONS).sort();
|
|
3667
|
+
/**
|
|
3668
|
+
* Deterministically picks one of the curated anonymous-avatar animal keys for a given seed
|
|
3669
|
+
* (e.g. a session or device identifier), so the same seed always maps to the same avatar.
|
|
3670
|
+
*
|
|
3671
|
+
* Use this to derive the `content` value for an `avatar:variant=anonymous_animal` spec —
|
|
3672
|
+
* the spec parser itself does no hashing, it just looks up whatever key it's given.
|
|
3673
|
+
*
|
|
3674
|
+
* @param seed - Seed text the pick is derived from. Falls back to a random pick when omitted.
|
|
3675
|
+
* @returns An anonymous animal key (e.g. `"otter"`) usable as `avatar:` spec's `content` param.
|
|
3676
|
+
*
|
|
3677
|
+
* @example
|
|
3678
|
+
* ```typescript
|
|
3679
|
+
* pickAnonymousAvatarName('session-abc123'); // "otter"
|
|
3680
|
+
* `avatar:variant=anonymous_animal,content=${pickAnonymousAvatarName(sessionId)}`;
|
|
3681
|
+
* ```
|
|
3682
|
+
*/
|
|
3683
|
+
const pickAnonymousAvatarName = (seed) => {
|
|
3684
|
+
return ANONYMOUS_AVATAR_NAMES[seed ? hashStr_default(seed) % ANONYMOUS_AVATAR_NAMES.length : Math.floor(Math.random() * ANONYMOUS_AVATAR_NAMES.length)];
|
|
3685
|
+
};
|
|
3686
|
+
var pickAnonymousAvatarName_default = pickAnonymousAvatarName;
|
|
3687
|
+
|
|
3688
|
+
//#endregion
|
|
3689
|
+
//#region src/utils/pickAnonymousEntityName.ts
|
|
3690
|
+
const ANONYMOUS_ENTITY_NAMES = Object.keys(ANONYMOUS_ENTITY_ICONS).sort();
|
|
3691
|
+
/**
|
|
3692
|
+
* Deterministically picks one of the curated anonymous-entity icon keys for a given seed
|
|
3693
|
+
* (e.g. an application, organization, or resource server identifier), so the same seed
|
|
3694
|
+
* always maps to the same icon.
|
|
3695
|
+
*
|
|
3696
|
+
* Use this to derive the `content` value for an `avatar:variant=anonymous_entity` spec —
|
|
3697
|
+
* the spec parser itself does no hashing, it just looks up whatever key it's given.
|
|
3698
|
+
*
|
|
3699
|
+
* @param seed - Seed text the pick is derived from. Falls back to a random pick when omitted.
|
|
3700
|
+
* @returns An anonymous entity key (e.g. `"hexagon"`) usable as `avatar:` spec's `content` param.
|
|
3701
|
+
*
|
|
3702
|
+
* @example
|
|
3703
|
+
* ```typescript
|
|
3704
|
+
* pickAnonymousEntityName('app-abc123'); // "hexagon"
|
|
3705
|
+
* `avatar:variant=anonymous_entity,content=${pickAnonymousEntityName(appId)}`;
|
|
3706
|
+
* ```
|
|
3707
|
+
*/
|
|
3708
|
+
const pickAnonymousEntityName = (seed) => {
|
|
3709
|
+
return ANONYMOUS_ENTITY_NAMES[seed ? hashStr_default(seed) % ANONYMOUS_ENTITY_NAMES.length : Math.floor(Math.random() * ANONYMOUS_ENTITY_NAMES.length)];
|
|
3710
|
+
};
|
|
3711
|
+
var pickAnonymousEntityName_default = pickAnonymousEntityName;
|
|
3712
|
+
|
|
3713
|
+
//#endregion
|
|
3714
|
+
//#region src/utils/generateAvatarDataUri.ts
|
|
3715
|
+
const AVATAR_PALETTES = [
|
|
3716
|
+
["#FF7300", "#EF4223"],
|
|
3717
|
+
["#3688FF", "#1d5eb4"],
|
|
3718
|
+
["#5567D5", "#8B6FE8"],
|
|
3719
|
+
["#06b6d4", "#0891b2"],
|
|
3720
|
+
["#10b981", "#059669"],
|
|
3721
|
+
["#ec4899", "#be185d"],
|
|
3722
|
+
["#f59e0b", "#ea580c"],
|
|
3723
|
+
["#8b5cf6", "#6d28d9"],
|
|
3724
|
+
["#5CD1FF", "#3688FF"],
|
|
3725
|
+
["#ef4444", "#b91c1c"]
|
|
3726
|
+
];
|
|
3727
|
+
/**
|
|
3728
|
+
* Number of distinct gradient rotations `colors` cycles through for the `blank`,
|
|
3729
|
+
* `one_letter`, and `two_letter` variants. Callers that offer a "pick a background" UI
|
|
3730
|
+
* (e.g. a shuffleable swatch grid) can sample `colors` indices in `[0, AVATAR_GRADIENT_COUNT)`
|
|
3731
|
+
* without needing the actual palette values.
|
|
3732
|
+
*/
|
|
3733
|
+
const AVATAR_GRADIENT_COUNT = AVATAR_PALETTES.length;
|
|
3734
|
+
/**
|
|
3735
|
+
* Fills in `params.content` when the spec itself didn't carry one, deriving it from a raw
|
|
3736
|
+
* seed name (e.g. an app or user display name) — extracting initials for letter variants,
|
|
3737
|
+
* or hash-picking a curated animal key for `anonymous_animal`.
|
|
3738
|
+
*
|
|
3739
|
+
* Callers that already have a final `content` value (pre-computed initials, or an exact
|
|
3740
|
+
* animal key) should skip this and pass it directly instead.
|
|
3741
|
+
*
|
|
3742
|
+
* @param variant - The avatar variant `content` is being derived for.
|
|
3743
|
+
* @param seedText - A raw name/seed to derive `content` from.
|
|
3744
|
+
* @returns A ready-to-render `content` value.
|
|
3745
|
+
*
|
|
3746
|
+
* @example
|
|
3747
|
+
* ```typescript
|
|
3748
|
+
* deriveAvatarContent('two_letter', 'Jane Doe'); // "JD"
|
|
3749
|
+
* deriveAvatarContent('anonymous_animal', 'session-abc123'); // "otter"
|
|
3750
|
+
* deriveAvatarContent('anonymous_entity', 'app-abc123'); // "hexagon"
|
|
3751
|
+
* deriveAvatarContent('blank', 'Jane Doe'); // ""
|
|
3752
|
+
* ```
|
|
3753
|
+
*/
|
|
3754
|
+
const deriveAvatarContent = (variant, seedText) => {
|
|
3755
|
+
if (variant === "anonymous_animal") return pickAnonymousAvatarName_default(seedText || void 0);
|
|
3756
|
+
if (variant === "anonymous_entity") return pickAnonymousEntityName_default(seedText || void 0);
|
|
3757
|
+
if (variant === "blank") return "";
|
|
3758
|
+
const letterCount = variant === "one_letter" ? 1 : 2;
|
|
3759
|
+
return (seedText.match(/[A-Za-z0-9]/g) ?? ["A"]).slice(0, letterCount).join("").toUpperCase();
|
|
3760
|
+
};
|
|
3761
|
+
/**
|
|
3762
|
+
* Renders the 100x100 background shape, filled either with a gradient/flat-color reference.
|
|
3763
|
+
*/
|
|
3764
|
+
const shapeMarkup = (shape, fill) => shape === "circle" ? `<circle cx="50" cy="50" r="50" fill="${fill}"/>` : `<rect width="100" height="100" rx="22" fill="${fill}"/>`;
|
|
3765
|
+
/**
|
|
3766
|
+
* Renders a Vercel-style gradient avatar: a rounded/circle swatch, either bare (`blank`) or
|
|
3767
|
+
* topped with initials (`one_letter`/`two_letter`). `content` is assumed final (already the
|
|
3768
|
+
* initials to display, or empty for `blank`) — pass it through {@link deriveAvatarContent}
|
|
3769
|
+
* first if it needs deriving.
|
|
3770
|
+
*/
|
|
3771
|
+
const generateGradientAvatar = ({ shape, variant, content, colors, bg }) => {
|
|
3772
|
+
let background;
|
|
3773
|
+
let defs = "";
|
|
3774
|
+
if (bg) background = bg;
|
|
3775
|
+
else {
|
|
3776
|
+
const h = hashStr_default(content || "App");
|
|
3777
|
+
const [c1, c2] = AVATAR_PALETTES[((h + colors) % AVATAR_PALETTES.length + AVATAR_PALETTES.length) % AVATAR_PALETTES.length];
|
|
3778
|
+
defs = `<defs><linearGradient id="g" x1="0%" y1="0%" x2="100%" y2="100%" gradientTransform="rotate(${(((h >> 4) + colors * 37) % 360 + 360) % 360} 0.5 0.5)"><stop offset="0%" stop-color="${c1}"/><stop offset="100%" stop-color="${c2}"/></linearGradient></defs>`;
|
|
3779
|
+
background = "url(#g)";
|
|
3780
|
+
}
|
|
3781
|
+
let text = "";
|
|
3782
|
+
if (variant !== "blank") {
|
|
3783
|
+
const letterCount = variant === "one_letter" ? 1 : 2;
|
|
3784
|
+
const initials = (content || "A").toUpperCase().slice(0, letterCount);
|
|
3785
|
+
text = `<text x="50" y="64" font-family="Helvetica,Arial,sans-serif" font-weight="700" font-size="${letterCount === 1 ? 46 : 34}" text-anchor="middle" fill="#fff">${initials}</text>`;
|
|
3786
|
+
}
|
|
3787
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">${defs}${shapeMarkup(shape, background)}${text}</svg>`;
|
|
3788
|
+
return `data:image/svg+xml,${encodeURIComponent(svg)}`;
|
|
3789
|
+
};
|
|
3790
|
+
/**
|
|
3791
|
+
* Renders one of the curated anonymous-animal icons, applying the requested background
|
|
3792
|
+
* shape and (optionally) recoloring the whole icon with `bg`. `content` is assumed to
|
|
3793
|
+
* already be a valid animal key — pass it through {@link deriveAvatarContent} first if
|
|
3794
|
+
* it needs deriving, or if it might be invalid/empty.
|
|
3795
|
+
*/
|
|
3796
|
+
const generateAnonymousAnimalAvatar = ({ shape, content, bg }) => {
|
|
3797
|
+
const icon = ANONYMOUS_ANIMAL_ICONS[Object.prototype.hasOwnProperty.call(ANONYMOUS_ANIMAL_ICONS, content) ? content : pickAnonymousAvatarName_default()];
|
|
3798
|
+
const color = bg ?? icon.color;
|
|
3799
|
+
const markup = icon.markup.replaceAll("%COLOR%", color);
|
|
3800
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">${shapeMarkup(shape, color)}${markup}</svg>`;
|
|
3801
|
+
return `data:image/svg+xml,${encodeURIComponent(svg)}`;
|
|
3802
|
+
};
|
|
3803
|
+
/**
|
|
3804
|
+
* Renders one of the curated anonymous-entity icons (application/organization/resource-server
|
|
3805
|
+
* shapes), applying the requested background shape and (optionally) recoloring the whole icon
|
|
3806
|
+
* with `bg`. `content` is assumed to already be a valid entity key — pass it through
|
|
3807
|
+
* {@link deriveAvatarContent} first if it needs deriving, or if it might be invalid/empty.
|
|
3808
|
+
*/
|
|
3809
|
+
const generateAnonymousEntityAvatar = ({ shape, content, bg }) => {
|
|
3810
|
+
const icon = ANONYMOUS_ENTITY_ICONS[Object.prototype.hasOwnProperty.call(ANONYMOUS_ENTITY_ICONS, content) ? content : pickAnonymousEntityName_default()];
|
|
3811
|
+
const color = bg ?? icon.color;
|
|
3812
|
+
const markup = icon.markup.replaceAll("%COLOR%", color);
|
|
3813
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">${shapeMarkup(shape, color)}${markup}</svg>`;
|
|
3814
|
+
return `data:image/svg+xml,${encodeURIComponent(svg)}`;
|
|
3815
|
+
};
|
|
3816
|
+
/**
|
|
3817
|
+
* Generates an avatar image as an `svg+xml` data URI from a fully-resolved {@link AvatarParams}.
|
|
3818
|
+
* `params.content` is assumed final; use {@link deriveAvatarContent} first if it might be
|
|
3819
|
+
* empty or otherwise needs deriving from a raw seed name.
|
|
3820
|
+
*
|
|
3821
|
+
* @param params - Resolved avatar parameters (see {@link AvatarParams}).
|
|
3822
|
+
* @returns A `data:image/svg+xml,...` URI rendering the generated avatar.
|
|
3823
|
+
*
|
|
3824
|
+
* @example
|
|
3825
|
+
* ```typescript
|
|
3826
|
+
* generateAvatarDataUri({shape: 'circle', variant: 'two_letter', content: 'BM', colors: 2});
|
|
3827
|
+
* generateAvatarDataUri({shape: 'rounded', variant: 'anonymous_animal', content: 'jackalope'});
|
|
3828
|
+
* generateAvatarDataUri({shape: 'rounded', variant: 'anonymous_entity', content: 'hexagon'});
|
|
3829
|
+
* generateAvatarDataUri({shape: 'circle', variant: 'blank', content: '', colors: 5});
|
|
3830
|
+
* ```
|
|
3831
|
+
*/
|
|
3832
|
+
const generateAvatarDataUri = (params) => {
|
|
3833
|
+
if (params.variant === "anonymous_animal") return generateAnonymousAnimalAvatar(params);
|
|
3834
|
+
if (params.variant === "anonymous_entity") return generateAnonymousEntityAvatar(params);
|
|
3835
|
+
return generateGradientAvatar(params);
|
|
3836
|
+
};
|
|
3837
|
+
var generateAvatarDataUri_default = generateAvatarDataUri;
|
|
3838
|
+
|
|
3839
|
+
//#endregion
|
|
3840
|
+
//#region src/utils/resolveLogoUri.ts
|
|
3841
|
+
/**
|
|
3842
|
+
* Resolves an application logo spec string — `emoji:<glyph>`, `avatar:shape=...,variant=...,
|
|
3843
|
+
* content=...,colors=...,bg=...`, or a bare URL — into a renderable representation.
|
|
3844
|
+
*
|
|
3845
|
+
* A spec in none of the recognized schemes falls back to treating it as a plain URL so
|
|
3846
|
+
* callers can always render *something* without special-casing.
|
|
3847
|
+
*
|
|
3848
|
+
* @param spec - The stored logo spec string.
|
|
3849
|
+
* @param fallbackSeedText - Raw seed name (e.g. an app or user display name) used to derive
|
|
3850
|
+
* an `avatar:` spec's `content` when the spec itself doesn't carry one (e.g. an app name
|
|
3851
|
+
* to keep the avatar in sync as it changes).
|
|
3852
|
+
* @returns The resolved logo, ready to render.
|
|
3853
|
+
*
|
|
3854
|
+
* @example
|
|
3855
|
+
* ```typescript
|
|
3856
|
+
* resolveLogoUri("emoji:🛡️"); // { kind: "emoji", glyph: "🛡️" }
|
|
3857
|
+
* resolveLogoUri("avatar:shape=circle,variant=two_letter,content=BM"); // { kind: "avatar", imgSrc: "data:image/svg+xml,..." }
|
|
3858
|
+
* resolveLogoUri("https://example.com/logo.png"); // { kind: "url", imgSrc: "https://example.com/logo.png" }
|
|
3859
|
+
* ```
|
|
3860
|
+
*/
|
|
3861
|
+
const resolveLogoUri = (spec, fallbackSeedText = "") => {
|
|
3862
|
+
if ((0, __thunderid_javascript.isEmojiUri)(spec)) return {
|
|
3863
|
+
glyph: (0, __thunderid_javascript.extractEmojiFromUri)(spec),
|
|
3864
|
+
kind: "emoji"
|
|
3865
|
+
};
|
|
3866
|
+
if (isAvatarUri_default(spec)) {
|
|
3867
|
+
const params = extractAvatarParamsFromUri_default(spec);
|
|
3868
|
+
const content = params.content || deriveAvatarContent(params.variant, fallbackSeedText);
|
|
3869
|
+
return {
|
|
3870
|
+
imgSrc: generateAvatarDataUri_default({
|
|
3871
|
+
...params,
|
|
3872
|
+
content
|
|
3873
|
+
}),
|
|
3874
|
+
kind: "avatar"
|
|
3875
|
+
};
|
|
3876
|
+
}
|
|
3877
|
+
return {
|
|
3878
|
+
imgSrc: spec,
|
|
3879
|
+
kind: "url"
|
|
3880
|
+
};
|
|
3881
|
+
};
|
|
3882
|
+
var resolveLogoUri_default = resolveLogoUri;
|
|
3883
|
+
|
|
3367
3884
|
//#endregion
|
|
3368
3885
|
//#region src/theme/themeDetection.ts
|
|
3369
3886
|
const logger = (0, __thunderid_javascript.createPackageComponentLogger)("@thunderid/browser", "ThemeDetection");
|
|
@@ -3446,6 +3963,10 @@ var getActiveTheme_default = getActiveTheme;
|
|
|
3446
3963
|
|
|
3447
3964
|
//#endregion
|
|
3448
3965
|
exports.ACCESS_TOKEN_INVALID = ACCESS_TOKEN_INVALID;
|
|
3966
|
+
exports.ANONYMOUS_ANIMAL_ICONS = ANONYMOUS_ANIMAL_ICONS;
|
|
3967
|
+
exports.ANONYMOUS_ENTITY_ICONS = ANONYMOUS_ENTITY_ICONS;
|
|
3968
|
+
exports.AVATAR_GRADIENT_COUNT = AVATAR_GRADIENT_COUNT;
|
|
3969
|
+
exports.AVATAR_URI_SCHEME = AVATAR_URI_SCHEME;
|
|
3449
3970
|
exports.AuthenticationHelper = AuthenticationHelper_default;
|
|
3450
3971
|
exports.BrowserHooks = Hooks;
|
|
3451
3972
|
exports.BrowserStorage = BrowserStorage_default;
|
|
@@ -3474,17 +3995,25 @@ exports.STATE_QUERY = STATE_QUERY;
|
|
|
3474
3995
|
exports.SessionStore = SessionStore_default;
|
|
3475
3996
|
exports.TOKEN_REQUEST_CONFIG_KEY = TOKEN_REQUEST_CONFIG_KEY;
|
|
3476
3997
|
exports.ThunderIDBrowserClient = ThunderIDBrowserClient_default;
|
|
3998
|
+
exports.buildAvatarSpec = buildAvatarSpec_default;
|
|
3477
3999
|
exports.createClassObserver = createClassObserver;
|
|
3478
4000
|
exports.createMediaQueryListener = createMediaQueryListener;
|
|
3479
4001
|
exports.createSessionManagementHelper = SessionManagementHelper_default;
|
|
4002
|
+
exports.deriveAvatarContent = deriveAvatarContent;
|
|
3480
4003
|
exports.detectThemeMode = detectThemeMode;
|
|
4004
|
+
exports.extractAvatarParamsFromUri = extractAvatarParamsFromUri_default;
|
|
4005
|
+
exports.generateAvatarDataUri = generateAvatarDataUri_default;
|
|
3481
4006
|
exports.getActiveTheme = getActiveTheme_default;
|
|
3482
4007
|
exports.handleWebAuthnAuthentication = handleWebAuthnAuthentication_default;
|
|
3483
4008
|
exports.hasAuthParamsInUrl = hasAuthParamsInUrl_default;
|
|
3484
4009
|
exports.hasCalledForThisInstanceInUrl = hasCalledForThisInstanceInUrl_default;
|
|
3485
4010
|
exports.http = http_default;
|
|
4011
|
+
exports.isAvatarUri = isAvatarUri_default;
|
|
3486
4012
|
exports.navigate = navigate_default;
|
|
4013
|
+
exports.pickAnonymousAvatarName = pickAnonymousAvatarName_default;
|
|
4014
|
+
exports.pickAnonymousEntityName = pickAnonymousEntityName_default;
|
|
3487
4015
|
exports.resolveEmojiUrisInHtml = resolveEmojiUrisInHtml_default;
|
|
4016
|
+
exports.resolveLogoUri = resolveLogoUri_default;
|
|
3488
4017
|
Object.keys(__thunderid_javascript).forEach(function (k) {
|
|
3489
4018
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
3490
4019
|
enumerable: true,
|