flat:AI+
This commit is contained in:
132
lib/uuid-min.js
vendored
Normal file
132
lib/uuid-min.js
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
/**
|
||||
* Minified by jsDelivr using Terser v5.19.2.
|
||||
* Original file: /npm/uuidjs@5.1.0/dist/uuid.js
|
||||
*
|
||||
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
||||
*/
|
||||
/**
|
||||
* UUID.js - RFC-compliant UUID Generator for JavaScript
|
||||
*
|
||||
* @author LiosK
|
||||
* @version v5.1.0
|
||||
* @license Apache License 2.0: Copyright (c) 2010-2024 LiosK
|
||||
* @packageDocumentation
|
||||
*/
|
||||
var _a;
|
||||
export class UUID {
|
||||
static generate() {
|
||||
var e = _a._getRandomInt,
|
||||
t = _a._hexAligner;
|
||||
return t(e(32), 8) + '-' + t(e(16), 4) + '-' + t(16384 | e(12), 4) + '-' + t(32768 | e(14), 4) + '-' + t(e(48), 12);
|
||||
}
|
||||
static _getRandomInt(e) {
|
||||
if (e < 0 || e > 53) return NaN;
|
||||
var t = 0 | (1073741824 * Math.random());
|
||||
return e > 30 ? t + 1073741824 * (0 | (Math.random() * (1 << (e - 30)))) : t >>> (30 - e);
|
||||
}
|
||||
static _hexAligner(e, t) {
|
||||
for (var a = e.toString(16), i = t - a.length, n = '0'; i > 0; i >>>= 1, n += n) 1 & i && (a = n + a);
|
||||
return a;
|
||||
}
|
||||
static useMathRandom() {
|
||||
_a._getRandomInt = _a._mathPRNG;
|
||||
}
|
||||
static genV4() {
|
||||
var e = _a._getRandomInt;
|
||||
return new _a(e(32), e(16), 16384 | e(12), 128 | e(6), e(8), e(48));
|
||||
}
|
||||
static parse(e) {
|
||||
var t;
|
||||
if ((t = /^\s*(urn:uuid:|\{)?([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})(\})?\s*$/i.exec(e))) {
|
||||
var a = t[1] || '',
|
||||
i = t[8] || '';
|
||||
if (a + i === '' || ('{' === a && '}' === i) || ('urn:uuid:' === a.toLowerCase() && '' === i))
|
||||
return new _a(parseInt(t[2], 16), parseInt(t[3], 16), parseInt(t[4], 16), parseInt(t[5], 16), parseInt(t[6], 16), parseInt(t[7], 16));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
constructor(e, t, a, i, n, s) {
|
||||
var r = _a.FIELD_NAMES,
|
||||
_ = _a.FIELD_SIZES,
|
||||
h = _a._binAligner,
|
||||
d = _a._hexAligner;
|
||||
(this.intFields = new Array(6)), (this.bitFields = new Array(6)), (this.hexFields = new Array(6));
|
||||
for (var o = 0; o < 6; o++) {
|
||||
var u = parseInt(arguments[o] || 0);
|
||||
(this.intFields[o] = this.intFields[r[o]] = u), (this.bitFields[o] = this.bitFields[r[o]] = h(u, _[o])), (this.hexFields[o] = this.hexFields[r[o]] = d(u, _[o] >>> 2));
|
||||
}
|
||||
(this.version = (this.intFields.timeHiAndVersion >>> 12) & 15),
|
||||
(this.bitString = this.bitFields.join('')),
|
||||
(this.hexNoDelim = this.hexFields.join('')),
|
||||
(this.hexString = this.hexFields[0] + '-' + this.hexFields[1] + '-' + this.hexFields[2] + '-' + this.hexFields[3] + this.hexFields[4] + '-' + this.hexFields[5]),
|
||||
(this.urn = 'urn:uuid:' + this.hexString);
|
||||
}
|
||||
static _binAligner(e, t) {
|
||||
for (var a = e.toString(2), i = t - a.length, n = '0'; i > 0; i >>>= 1, n += n) 1 & i && (a = n + a);
|
||||
return a;
|
||||
}
|
||||
toString() {
|
||||
return this.hexString;
|
||||
}
|
||||
equals(e) {
|
||||
if (!(e instanceof _a)) return !1;
|
||||
for (var t = 0; t < 6; t++) if (this.intFields[t] !== e.intFields[t]) return !1;
|
||||
return !0;
|
||||
}
|
||||
static genV1() {
|
||||
null == _a._state && (_a._state = new UUIDState());
|
||||
var e = new Date().getTime(),
|
||||
t = _a._state;
|
||||
e != t.timestamp ? (e < t.timestamp && t.sequence++, (t.timestamp = e), (t.tick = _a._getRandomInt(12))) : t.tick < 9992 ? (t.tick += 1 + _a._getRandomInt(3)) : t.sequence++;
|
||||
var a = _a._getTimeFieldValues(t.timestamp),
|
||||
i = a.low + t.tick,
|
||||
n = (4095 & a.hi) | 4096;
|
||||
t.sequence &= 16383;
|
||||
var s = (t.sequence >>> 8) | 128,
|
||||
r = 255 & t.sequence;
|
||||
return new _a(i, a.mid, n, s, r, t.node);
|
||||
}
|
||||
static resetState() {
|
||||
_a._state = new UUIDState();
|
||||
}
|
||||
static _getTimeFieldValues(e) {
|
||||
var t = e - Date.UTC(1582, 9, 15),
|
||||
a = ((t / 4294967296) * 1e4) & 268435455;
|
||||
return { low: (1e4 * (268435455 & t)) % 4294967296, mid: 65535 & a, hi: a >>> 16, timestamp: t };
|
||||
}
|
||||
static genV6() {
|
||||
null == _a._state && (_a._state = new UUIDState());
|
||||
var e = new Date().getTime(),
|
||||
t = _a._state;
|
||||
e != t.timestamp ? (e < t.timestamp && t.sequence++, (t.timestamp = e), (t.tick = _a._getRandomInt(12))) : t.tick < 9992 ? (t.tick += 1 + _a._getRandomInt(3)) : t.sequence++;
|
||||
var a = t.timestamp - Date.UTC(1582, 9, 15),
|
||||
i = Math.floor((a / 268435456) * 1e4) % 4294967296,
|
||||
n = ((1e4 * (268435455 & a)) & 268435455) + t.tick,
|
||||
s = n >>> 12,
|
||||
r = (4095 & n) | 24576;
|
||||
t.sequence &= 16383;
|
||||
var _ = (t.sequence >>> 8) | 128,
|
||||
h = 255 & t.sequence;
|
||||
return new _a(i, s, r, _, h, t.node);
|
||||
}
|
||||
}
|
||||
(_a = UUID),
|
||||
(UUID._mathPRNG = _a._getRandomInt),
|
||||
'undefined' != typeof crypto &&
|
||||
crypto.getRandomValues &&
|
||||
(_a._getRandomInt = (e) => {
|
||||
if (e < 0 || e > 53) return NaN;
|
||||
var t = new Uint32Array(e > 32 ? 2 : 1);
|
||||
return crypto.getRandomValues(t), e > 32 ? t[0] + 4294967296 * (t[1] >>> (64 - e)) : t[0] >>> (32 - e);
|
||||
}),
|
||||
(UUID.FIELD_NAMES = ['timeLow', 'timeMid', 'timeHiAndVersion', 'clockSeqHiAndReserved', 'clockSeqLow', 'node']),
|
||||
(UUID.FIELD_SIZES = [32, 16, 16, 8, 8, 48]),
|
||||
(UUID.NIL = new _a(0, 0, 0, 0, 0, 0)),
|
||||
(UUID._state = null);
|
||||
class UUIDState {
|
||||
constructor() {
|
||||
var e = UUID._getRandomInt;
|
||||
(this.timestamp = 0), (this.tick = 0), (this.sequence = e(14)), (this.node = 1099511627776 * (1 | e(8)) + e(40));
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=/sm/14547599d24239455943f4481cadea00302ff64afee28ff8598a7fb36c36ddc0.map
|
Reference in New Issue
Block a user