// ==UserScript== // @name topt 动态密码 // @namespace https://scriptcat.org/ // @version 0.1.0 // @author monkey // @description 安装后会在脚本猫菜单页中定时刷新动态密码,点击即可复制 // @grant GM_getValue // @grant GM_registerMenuCommand // @grant GM_setClipboard // @grant GM_unregisterMenuCommand // @background // ==/UserScript== /* ==UserConfig== otpauth: migration: title: otpauth迁移 description: google authenticator导出成二维码,再使用二维码识别,一行一张 type: textarea ==/UserConfig== */ (function(global2, factory2) { typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory2() : typeof define === "function" && define.amd ? define(factory2) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2.monkey = factory2()); })(this, function() { "use strict"; var _GM_getValue = /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)(); var _GM_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)(); var _GM_setClipboard = /* @__PURE__ */ (() => typeof GM_setClipboard != "undefined" ? GM_setClipboard : void 0)(); var _GM_unregisterMenuCommand = /* @__PURE__ */ (() => typeof GM_unregisterMenuCommand != "undefined" ? GM_unregisterMenuCommand : void 0)(); var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; var indexMinimal = {}; var minimal$1 = {}; var aspromise = asPromise; function asPromise(fn, ctx) { var params = new Array(arguments.length - 1), offset = 0, index = 2, pending = true; while (index < arguments.length) params[offset++] = arguments[index++]; return new Promise(function executor(resolve, reject) { params[offset] = function callback(err) { if (pending) { pending = false; if (err) reject(err); else { var params2 = new Array(arguments.length - 1), offset2 = 0; while (offset2 < params2.length) params2[offset2++] = arguments[offset2]; resolve.apply(null, params2); } } }; try { fn.apply(ctx || null, params); } catch (err) { if (pending) { pending = false; reject(err); } } }); } var base64$1 = {}; (function(exports2) { var base642 = exports2; base642.length = function length(string) { var p2 = string.length; if (!p2) return 0; var n2 = 0; while (--p2 % 4 > 1 && string.charAt(p2) === "=") ++n2; return Math.ceil(string.length * 3) / 4 - n2; }; var b64 = new Array(64); var s64 = new Array(123); for (var i2 = 0; i2 < 64; ) s64[b64[i2] = i2 < 26 ? i2 + 65 : i2 < 52 ? i2 + 71 : i2 < 62 ? i2 - 4 : i2 - 59 | 43] = i2++; base642.encode = function encode(buffer, start, end) { var parts = null, chunk = []; var i3 = 0, j2 = 0, t2; while (start < end) { var b2 = buffer[start++]; switch (j2) { case 0: chunk[i3++] = b64[b2 >> 2]; t2 = (b2 & 3) << 4; j2 = 1; break; case 1: chunk[i3++] = b64[t2 | b2 >> 4]; t2 = (b2 & 15) << 2; j2 = 2; break; case 2: chunk[i3++] = b64[t2 | b2 >> 6]; chunk[i3++] = b64[b2 & 63]; j2 = 0; break; } if (i3 > 8191) { (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); i3 = 0; } } if (j2) { chunk[i3++] = b64[t2]; chunk[i3++] = 61; if (j2 === 1) chunk[i3++] = 61; } if (parts) { if (i3) parts.push(String.fromCharCode.apply(String, chunk.slice(0, i3))); return parts.join(""); } return String.fromCharCode.apply(String, chunk.slice(0, i3)); }; var invalidEncoding = "invalid encoding"; base642.decode = function decode(string, buffer, offset) { var start = offset; var j2 = 0, t2; for (var i3 = 0; i3 < string.length; ) { var c2 = string.charCodeAt(i3++); if (c2 === 61 && j2 > 1) break; if ((c2 = s64[c2]) === void 0) throw Error(invalidEncoding); switch (j2) { case 0: t2 = c2; j2 = 1; break; case 1: buffer[offset++] = t2 << 2 | (c2 & 48) >> 4; t2 = c2; j2 = 2; break; case 2: buffer[offset++] = (t2 & 15) << 4 | (c2 & 60) >> 2; t2 = c2; j2 = 3; break; case 3: buffer[offset++] = (t2 & 3) << 6 | c2; j2 = 0; break; } } if (j2 === 1) throw Error(invalidEncoding); return offset - start; }; base642.test = function test(string) { return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string); }; })(base64$1); var eventemitter = EventEmitter; function EventEmitter() { this._listeners = {}; } EventEmitter.prototype.on = function on(evt, fn, ctx) { (this._listeners[evt] || (this._listeners[evt] = [])).push({ fn, ctx: ctx || this }); return this; }; EventEmitter.prototype.off = function off(evt, fn) { if (evt === void 0) this._listeners = {}; else { if (fn === void 0) this._listeners[evt] = []; else { var listeners = this._listeners[evt]; for (var i2 = 0; i2 < listeners.length; ) if (listeners[i2].fn === fn) listeners.splice(i2, 1); else ++i2; } } return this; }; EventEmitter.prototype.emit = function emit(evt) { var listeners = this._listeners[evt]; if (listeners) { var args = [], i2 = 1; for (; i2 < arguments.length; ) args.push(arguments[i2++]); for (i2 = 0; i2 < listeners.length; ) listeners[i2].fn.apply(listeners[i2++].ctx, args); } return this; }; var float = factory(factory); function factory(exports2) { if (typeof Float32Array !== "undefined") (function() { var f32 = new Float32Array([-0]), f8b = new Uint8Array(f32.buffer), le = f8b[3] === 128; function writeFloat_f32_cpy(val, buf, pos) { f32[0] = val; buf[pos] = f8b[0]; buf[pos + 1] = f8b[1]; buf[pos + 2] = f8b[2]; buf[pos + 3] = f8b[3]; } function writeFloat_f32_rev(val, buf, pos) { f32[0] = val; buf[pos] = f8b[3]; buf[pos + 1] = f8b[2]; buf[pos + 2] = f8b[1]; buf[pos + 3] = f8b[0]; } exports2.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev; exports2.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy; function readFloat_f32_cpy(buf, pos) { f8b[0] = buf[pos]; f8b[1] = buf[pos + 1]; f8b[2] = buf[pos + 2]; f8b[3] = buf[pos + 3]; return f32[0]; } function readFloat_f32_rev(buf, pos) { f8b[3] = buf[pos]; f8b[2] = buf[pos + 1]; f8b[1] = buf[pos + 2]; f8b[0] = buf[pos + 3]; return f32[0]; } exports2.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev; exports2.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy; })(); else (function() { function writeFloat_ieee754(writeUint, val, buf, pos) { var sign = val < 0 ? 1 : 0; if (sign) val = -val; if (val === 0) writeUint(1 / val > 0 ? ( /* positive */ 0 ) : ( /* negative 0 */ 2147483648 ), buf, pos); else if (isNaN(val)) writeUint(2143289344, buf, pos); else if (val > 34028234663852886e22) writeUint((sign << 31 | 2139095040) >>> 0, buf, pos); else if (val < 11754943508222875e-54) writeUint((sign << 31 | Math.round(val / 1401298464324817e-60)) >>> 0, buf, pos); else { var exponent = Math.floor(Math.log(val) / Math.LN2), mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607; writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos); } } exports2.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE); exports2.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE); function readFloat_ieee754(readUint, buf, pos) { var uint = readUint(buf, pos), sign = (uint >> 31) * 2 + 1, exponent = uint >>> 23 & 255, mantissa = uint & 8388607; return exponent === 255 ? mantissa ? NaN : sign * Infinity : exponent === 0 ? sign * 1401298464324817e-60 * mantissa : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608); } exports2.readFloatLE = readFloat_ieee754.bind(null, readUintLE); exports2.readFloatBE = readFloat_ieee754.bind(null, readUintBE); })(); if (typeof Float64Array !== "undefined") (function() { var f64 = new Float64Array([-0]), f8b = new Uint8Array(f64.buffer), le = f8b[7] === 128; function writeDouble_f64_cpy(val, buf, pos) { f64[0] = val; buf[pos] = f8b[0]; buf[pos + 1] = f8b[1]; buf[pos + 2] = f8b[2]; buf[pos + 3] = f8b[3]; buf[pos + 4] = f8b[4]; buf[pos + 5] = f8b[5]; buf[pos + 6] = f8b[6]; buf[pos + 7] = f8b[7]; } function writeDouble_f64_rev(val, buf, pos) { f64[0] = val; buf[pos] = f8b[7]; buf[pos + 1] = f8b[6]; buf[pos + 2] = f8b[5]; buf[pos + 3] = f8b[4]; buf[pos + 4] = f8b[3]; buf[pos + 5] = f8b[2]; buf[pos + 6] = f8b[1]; buf[pos + 7] = f8b[0]; } exports2.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev; exports2.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy; function readDouble_f64_cpy(buf, pos) { f8b[0] = buf[pos]; f8b[1] = buf[pos + 1]; f8b[2] = buf[pos + 2]; f8b[3] = buf[pos + 3]; f8b[4] = buf[pos + 4]; f8b[5] = buf[pos + 5]; f8b[6] = buf[pos + 6]; f8b[7] = buf[pos + 7]; return f64[0]; } function readDouble_f64_rev(buf, pos) { f8b[7] = buf[pos]; f8b[6] = buf[pos + 1]; f8b[5] = buf[pos + 2]; f8b[4] = buf[pos + 3]; f8b[3] = buf[pos + 4]; f8b[2] = buf[pos + 5]; f8b[1] = buf[pos + 6]; f8b[0] = buf[pos + 7]; return f64[0]; } exports2.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev; exports2.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy; })(); else (function() { function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) { var sign = val < 0 ? 1 : 0; if (sign) val = -val; if (val === 0) { writeUint(0, buf, pos + off0); writeUint(1 / val > 0 ? ( /* positive */ 0 ) : ( /* negative 0 */ 2147483648 ), buf, pos + off1); } else if (isNaN(val)) { writeUint(0, buf, pos + off0); writeUint(2146959360, buf, pos + off1); } else if (val > 17976931348623157e292) { writeUint(0, buf, pos + off0); writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1); } else { var mantissa; if (val < 22250738585072014e-324) { mantissa = val / 5e-324; writeUint(mantissa >>> 0, buf, pos + off0); writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1); } else { var exponent = Math.floor(Math.log(val) / Math.LN2); if (exponent === 1024) exponent = 1023; mantissa = val * Math.pow(2, -exponent); writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0); writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1); } } } exports2.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4); exports2.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0); function readDouble_ieee754(readUint, off0, off1, buf, pos) { var lo = readUint(buf, pos + off0), hi = readUint(buf, pos + off1); var sign = (hi >> 31) * 2 + 1, exponent = hi >>> 20 & 2047, mantissa = 4294967296 * (hi & 1048575) + lo; return exponent === 2047 ? mantissa ? NaN : sign * Infinity : exponent === 0 ? sign * 5e-324 * mantissa : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496); } exports2.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4); exports2.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0); })(); return exports2; } function writeUintLE(val, buf, pos) { buf[pos] = val & 255; buf[pos + 1] = val >>> 8 & 255; buf[pos + 2] = val >>> 16 & 255; buf[pos + 3] = val >>> 24; } function writeUintBE(val, buf, pos) { buf[pos] = val >>> 24; buf[pos + 1] = val >>> 16 & 255; buf[pos + 2] = val >>> 8 & 255; buf[pos + 3] = val & 255; } function readUintLE(buf, pos) { return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16 | buf[pos + 3] << 24) >>> 0; } function readUintBE(buf, pos) { return (buf[pos] << 24 | buf[pos + 1] << 16 | buf[pos + 2] << 8 | buf[pos + 3]) >>> 0; } var inquire_1 = inquire; function inquire(moduleName) { try { var mod = eval("quire".replace(/^/, "re"))(moduleName); if (mod && (mod.length || Object.keys(mod).length)) return mod; } catch (e2) { } return null; } var utf8$2 = {}; (function(exports2) { var utf82 = exports2; utf82.length = function utf8_length(string) { var len = 0, c2 = 0; for (var i2 = 0; i2 < string.length; ++i2) { c2 = string.charCodeAt(i2); if (c2 < 128) len += 1; else if (c2 < 2048) len += 2; else if ((c2 & 64512) === 55296 && (string.charCodeAt(i2 + 1) & 64512) === 56320) { ++i2; len += 4; } else len += 3; } return len; }; utf82.read = function utf8_read(buffer, start, end) { var len = end - start; if (len < 1) return ""; var parts = null, chunk = [], i2 = 0, t2; while (start < end) { t2 = buffer[start++]; if (t2 < 128) chunk[i2++] = t2; else if (t2 > 191 && t2 < 224) chunk[i2++] = (t2 & 31) << 6 | buffer[start++] & 63; else if (t2 > 239 && t2 < 365) { t2 = ((t2 & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 65536; chunk[i2++] = 55296 + (t2 >> 10); chunk[i2++] = 56320 + (t2 & 1023); } else chunk[i2++] = (t2 & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63; if (i2 > 8191) { (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); i2 = 0; } } if (parts) { if (i2) parts.push(String.fromCharCode.apply(String, chunk.slice(0, i2))); return parts.join(""); } return String.fromCharCode.apply(String, chunk.slice(0, i2)); }; utf82.write = function utf8_write(string, buffer, offset) { var start = offset, c1, c2; for (var i2 = 0; i2 < string.length; ++i2) { c1 = string.charCodeAt(i2); if (c1 < 128) { buffer[offset++] = c1; } else if (c1 < 2048) { buffer[offset++] = c1 >> 6 | 192; buffer[offset++] = c1 & 63 | 128; } else if ((c1 & 64512) === 55296 && ((c2 = string.charCodeAt(i2 + 1)) & 64512) === 56320) { c1 = 65536 + ((c1 & 1023) << 10) + (c2 & 1023); ++i2; buffer[offset++] = c1 >> 18 | 240; buffer[offset++] = c1 >> 12 & 63 | 128; buffer[offset++] = c1 >> 6 & 63 | 128; buffer[offset++] = c1 & 63 | 128; } else { buffer[offset++] = c1 >> 12 | 224; buffer[offset++] = c1 >> 6 & 63 | 128; buffer[offset++] = c1 & 63 | 128; } } return offset - start; }; })(utf8$2); var pool_1 = pool; function pool(alloc, slice, size) { var SIZE = size || 8192; var MAX = SIZE >>> 1; var slab = null; var offset = SIZE; return function pool_alloc(size2) { if (size2 < 1 || size2 > MAX) return alloc(size2); if (offset + size2 > SIZE) { slab = alloc(SIZE); offset = 0; } var buf = slice.call(slab, offset, offset += size2); if (offset & 7) offset = (offset | 7) + 1; return buf; }; } var longbits; var hasRequiredLongbits; function requireLongbits() { if (hasRequiredLongbits) return longbits; hasRequiredLongbits = 1; longbits = LongBits2; var util2 = requireMinimal(); function LongBits2(lo, hi) { this.lo = lo >>> 0; this.hi = hi >>> 0; } var zero = LongBits2.zero = new LongBits2(0, 0); zero.toNumber = function() { return 0; }; zero.zzEncode = zero.zzDecode = function() { return this; }; zero.length = function() { return 1; }; var zeroHash = LongBits2.zeroHash = "\0\0\0\0\0\0\0\0"; LongBits2.fromNumber = function fromNumber(value) { if (value === 0) return zero; var sign = value < 0; if (sign) value = -value; var lo = value >>> 0, hi = (value - lo) / 4294967296 >>> 0; if (sign) { hi = ~hi >>> 0; lo = ~lo >>> 0; if (++lo > 4294967295) { lo = 0; if (++hi > 4294967295) hi = 0; } } return new LongBits2(lo, hi); }; LongBits2.from = function from(value) { if (typeof value === "number") return LongBits2.fromNumber(value); if (util2.isString(value)) { if (util2.Long) value = util2.Long.fromString(value); else return LongBits2.fromNumber(parseInt(value, 10)); } return value.low || value.high ? new LongBits2(value.low >>> 0, value.high >>> 0) : zero; }; LongBits2.prototype.toNumber = function toNumber(unsigned) { if (!unsigned && this.hi >>> 31) { var lo = ~this.lo + 1 >>> 0, hi = ~this.hi >>> 0; if (!lo) hi = hi + 1 >>> 0; return -(lo + hi * 4294967296); } return this.lo + this.hi * 4294967296; }; LongBits2.prototype.toLong = function toLong(unsigned) { return util2.Long ? new util2.Long(this.lo | 0, this.hi | 0, Boolean(unsigned)) : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) }; }; var charCodeAt = String.prototype.charCodeAt; LongBits2.fromHash = function fromHash(hash) { if (hash === zeroHash) return zero; return new LongBits2( (charCodeAt.call(hash, 0) | charCodeAt.call(hash, 1) << 8 | charCodeAt.call(hash, 2) << 16 | charCodeAt.call(hash, 3) << 24) >>> 0, (charCodeAt.call(hash, 4) | charCodeAt.call(hash, 5) << 8 | charCodeAt.call(hash, 6) << 16 | charCodeAt.call(hash, 7) << 24) >>> 0 ); }; LongBits2.prototype.toHash = function toHash() { return String.fromCharCode( this.lo & 255, this.lo >>> 8 & 255, this.lo >>> 16 & 255, this.lo >>> 24, this.hi & 255, this.hi >>> 8 & 255, this.hi >>> 16 & 255, this.hi >>> 24 ); }; LongBits2.prototype.zzEncode = function zzEncode() { var mask = this.hi >> 31; this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0; this.lo = (this.lo << 1 ^ mask) >>> 0; return this; }; LongBits2.prototype.zzDecode = function zzDecode() { var mask = -(this.lo & 1); this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0; this.hi = (this.hi >>> 1 ^ mask) >>> 0; return this; }; LongBits2.prototype.length = function length() { var part0 = this.lo, part1 = (this.lo >>> 28 | this.hi << 4) >>> 0, part2 = this.hi >>> 24; return part2 === 0 ? part1 === 0 ? part0 < 16384 ? part0 < 128 ? 1 : 2 : part0 < 2097152 ? 3 : 4 : part1 < 16384 ? part1 < 128 ? 5 : 6 : part1 < 2097152 ? 7 : 8 : part2 < 128 ? 9 : 10; }; return longbits; } var hasRequiredMinimal; function requireMinimal() { if (hasRequiredMinimal) return minimal$1; hasRequiredMinimal = 1; (function(exports2) { var util2 = exports2; util2.asPromise = aspromise; util2.base64 = base64$1; util2.EventEmitter = eventemitter; util2.float = float; util2.inquire = inquire_1; util2.utf8 = utf8$2; util2.pool = pool_1; util2.LongBits = requireLongbits(); util2.isNode = Boolean(typeof commonjsGlobal !== "undefined" && commonjsGlobal && commonjsGlobal.process && commonjsGlobal.process.versions && commonjsGlobal.process.versions.node); util2.global = util2.isNode && commonjsGlobal || typeof window !== "undefined" && window || typeof self !== "undefined" && self || commonjsGlobal; util2.emptyArray = Object.freeze ? Object.freeze([]) : ( /* istanbul ignore next */ [] ); util2.emptyObject = Object.freeze ? Object.freeze({}) : ( /* istanbul ignore next */ {} ); util2.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) { return typeof value === "number" && isFinite(value) && Math.floor(value) === value; }; util2.isString = function isString(value) { return typeof value === "string" || value instanceof String; }; util2.isObject = function isObject(value) { return value && typeof value === "object"; }; util2.isset = /** * Checks if a property on a message is considered to be present. * @param {Object} obj Plain object or message instance * @param {string} prop Property name * @returns {boolean} `true` if considered to be present, otherwise `false` */ util2.isSet = function isSet(obj, prop) { var value = obj[prop]; if (value != null && obj.hasOwnProperty(prop)) return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0; return false; }; util2.Buffer = function() { try { var Buffer = util2.inquire("buffer").Buffer; return Buffer.prototype.utf8Write ? Buffer : ( /* istanbul ignore next */ null ); } catch (e2) { return null; } }(); util2._Buffer_from = null; util2._Buffer_allocUnsafe = null; util2.newBuffer = function newBuffer(sizeOrArray) { return typeof sizeOrArray === "number" ? util2.Buffer ? util2._Buffer_allocUnsafe(sizeOrArray) : new util2.Array(sizeOrArray) : util2.Buffer ? util2._Buffer_from(sizeOrArray) : typeof Uint8Array === "undefined" ? sizeOrArray : new Uint8Array(sizeOrArray); }; util2.Array = typeof Uint8Array !== "undefined" ? Uint8Array : Array; util2.Long = /* istanbul ignore next */ util2.global.dcodeIO && /* istanbul ignore next */ util2.global.dcodeIO.Long || /* istanbul ignore next */ util2.global.Long || util2.inquire("long"); util2.key2Re = /^true|false|0|1$/; util2.key32Re = /^-?(?:0|[1-9][0-9]*)$/; util2.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/; util2.longToHash = function longToHash(value) { return value ? util2.LongBits.from(value).toHash() : util2.LongBits.zeroHash; }; util2.longFromHash = function longFromHash(hash, unsigned) { var bits = util2.LongBits.fromHash(hash); if (util2.Long) return util2.Long.fromBits(bits.lo, bits.hi, unsigned); return bits.toNumber(Boolean(unsigned)); }; function merge(dst, src, ifNotSet) { for (var keys = Object.keys(src), i2 = 0; i2 < keys.length; ++i2) if (dst[keys[i2]] === void 0 || !ifNotSet) dst[keys[i2]] = src[keys[i2]]; return dst; } util2.merge = merge; util2.lcFirst = function lcFirst(str) { return str.charAt(0).toLowerCase() + str.substring(1); }; function newError(name) { function CustomError(message, properties) { if (!(this instanceof CustomError)) return new CustomError(message, properties); Object.defineProperty(this, "message", { get: function() { return message; } }); if (Error.captureStackTrace) Error.captureStackTrace(this, CustomError); else Object.defineProperty(this, "stack", { value: new Error().stack || "" }); if (properties) merge(this, properties); } CustomError.prototype = Object.create(Error.prototype, { constructor: { value: CustomError, writable: true, enumerable: false, configurable: true }, name: { get: function get() { return name; }, set: void 0, enumerable: false, // configurable: false would accurately preserve the behavior of // the original, but I'm guessing that was not intentional. // For an actual error subclass, this property would // be configurable. configurable: true }, toString: { value: function value() { return this.name + ": " + this.message; }, writable: true, enumerable: false, configurable: true } }); return CustomError; } util2.newError = newError; util2.ProtocolError = newError("ProtocolError"); util2.oneOfGetter = function getOneOf(fieldNames) { var fieldMap = {}; for (var i2 = 0; i2 < fieldNames.length; ++i2) fieldMap[fieldNames[i2]] = 1; return function() { for (var keys = Object.keys(this), i3 = keys.length - 1; i3 > -1; --i3) if (fieldMap[keys[i3]] === 1 && this[keys[i3]] !== void 0 && this[keys[i3]] !== null) return keys[i3]; }; }; util2.oneOfSetter = function setOneOf(fieldNames) { return function(name) { for (var i2 = 0; i2 < fieldNames.length; ++i2) if (fieldNames[i2] !== name) delete this[fieldNames[i2]]; }; }; util2.toJSONOptions = { longs: String, enums: String, bytes: String, json: true }; util2._configure = function() { var Buffer = util2.Buffer; if (!Buffer) { util2._Buffer_from = util2._Buffer_allocUnsafe = null; return; } util2._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from || /* istanbul ignore next */ function Buffer_from(value, encoding) { return new Buffer(value, encoding); }; util2._Buffer_allocUnsafe = Buffer.allocUnsafe || /* istanbul ignore next */ function Buffer_allocUnsafe(size) { return new Buffer(size); }; }; })(minimal$1); return minimal$1; } var writer = Writer$1; var util$4 = requireMinimal(); var BufferWriter$1; var LongBits$1 = util$4.LongBits, base64 = util$4.base64, utf8$1 = util$4.utf8; function Op(fn, len, val) { this.fn = fn; this.len = len; this.next = void 0; this.val = val; } function noop() { } function State(writer2) { this.head = writer2.head; this.tail = writer2.tail; this.len = writer2.len; this.next = writer2.states; } function Writer$1() { this.len = 0; this.head = new Op(noop, 0, 0); this.tail = this.head; this.states = null; } var create$1 = function create2() { return util$4.Buffer ? function create_buffer_setup() { return (Writer$1.create = function create_buffer() { return new BufferWriter$1(); })(); } : function create_array2() { return new Writer$1(); }; }; Writer$1.create = create$1(); Writer$1.alloc = function alloc(size) { return new util$4.Array(size); }; if (util$4.Array !== Array) Writer$1.alloc = util$4.pool(Writer$1.alloc, util$4.Array.prototype.subarray); Writer$1.prototype._push = function push(fn, len, val) { this.tail = this.tail.next = new Op(fn, len, val); this.len += len; return this; }; function writeByte(val, buf, pos) { buf[pos] = val & 255; } function writeVarint32(val, buf, pos) { while (val > 127) { buf[pos++] = val & 127 | 128; val >>>= 7; } buf[pos] = val; } function VarintOp(len, val) { this.len = len; this.next = void 0; this.val = val; } VarintOp.prototype = Object.create(Op.prototype); VarintOp.prototype.fn = writeVarint32; Writer$1.prototype.uint32 = function write_uint32(value) { this.len += (this.tail = this.tail.next = new VarintOp( (value = value >>> 0) < 128 ? 1 : value < 16384 ? 2 : value < 2097152 ? 3 : value < 268435456 ? 4 : 5, value )).len; return this; }; Writer$1.prototype.int32 = function write_int32(value) { return value < 0 ? this._push(writeVarint64, 10, LongBits$1.fromNumber(value)) : this.uint32(value); }; Writer$1.prototype.sint32 = function write_sint32(value) { return this.uint32((value << 1 ^ value >> 31) >>> 0); }; function writeVarint64(val, buf, pos) { while (val.hi) { buf[pos++] = val.lo & 127 | 128; val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0; val.hi >>>= 7; } while (val.lo > 127) { buf[pos++] = val.lo & 127 | 128; val.lo = val.lo >>> 7; } buf[pos++] = val.lo; } Writer$1.prototype.uint64 = function write_uint64(value) { var bits = LongBits$1.from(value); return this._push(writeVarint64, bits.length(), bits); }; Writer$1.prototype.int64 = Writer$1.prototype.uint64; Writer$1.prototype.sint64 = function write_sint64(value) { var bits = LongBits$1.from(value).zzEncode(); return this._push(writeVarint64, bits.length(), bits); }; Writer$1.prototype.bool = function write_bool(value) { return this._push(writeByte, 1, value ? 1 : 0); }; function writeFixed32(val, buf, pos) { buf[pos] = val & 255; buf[pos + 1] = val >>> 8 & 255; buf[pos + 2] = val >>> 16 & 255; buf[pos + 3] = val >>> 24; } Writer$1.prototype.fixed32 = function write_fixed32(value) { return this._push(writeFixed32, 4, value >>> 0); }; Writer$1.prototype.sfixed32 = Writer$1.prototype.fixed32; Writer$1.prototype.fixed64 = function write_fixed64(value) { var bits = LongBits$1.from(value); return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi); }; Writer$1.prototype.sfixed64 = Writer$1.prototype.fixed64; Writer$1.prototype.float = function write_float(value) { return this._push(util$4.float.writeFloatLE, 4, value); }; Writer$1.prototype.double = function write_double(value) { return this._push(util$4.float.writeDoubleLE, 8, value); }; var writeBytes = util$4.Array.prototype.set ? function writeBytes_set(val, buf, pos) { buf.set(val, pos); } : function writeBytes_for(val, buf, pos) { for (var i2 = 0; i2 < val.length; ++i2) buf[pos + i2] = val[i2]; }; Writer$1.prototype.bytes = function write_bytes(value) { var len = value.length >>> 0; if (!len) return this._push(writeByte, 1, 0); if (util$4.isString(value)) { var buf = Writer$1.alloc(len = base64.length(value)); base64.decode(value, buf, 0); value = buf; } return this.uint32(len)._push(writeBytes, len, value); }; Writer$1.prototype.string = function write_string(value) { var len = utf8$1.length(value); return len ? this.uint32(len)._push(utf8$1.write, len, value) : this._push(writeByte, 1, 0); }; Writer$1.prototype.fork = function fork() { this.states = new State(this); this.head = this.tail = new Op(noop, 0, 0); this.len = 0; return this; }; Writer$1.prototype.reset = function reset() { if (this.states) { this.head = this.states.head; this.tail = this.states.tail; this.len = this.states.len; this.states = this.states.next; } else { this.head = this.tail = new Op(noop, 0, 0); this.len = 0; } return this; }; Writer$1.prototype.ldelim = function ldelim() { var head = this.head, tail = this.tail, len = this.len; this.reset().uint32(len); if (len) { this.tail.next = head.next; this.tail = tail; this.len += len; } return this; }; Writer$1.prototype.finish = function finish() { var head = this.head.next, buf = this.constructor.alloc(this.len), pos = 0; while (head) { head.fn(head.val, buf, pos); pos += head.len; head = head.next; } return buf; }; Writer$1._configure = function(BufferWriter_) { BufferWriter$1 = BufferWriter_; Writer$1.create = create$1(); BufferWriter$1._configure(); }; var writer_buffer = BufferWriter; var Writer = writer; (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter; var util$3 = requireMinimal(); function BufferWriter() { Writer.call(this); } BufferWriter._configure = function() { BufferWriter.alloc = util$3._Buffer_allocUnsafe; BufferWriter.writeBytesBuffer = util$3.Buffer && util$3.Buffer.prototype instanceof Uint8Array && util$3.Buffer.prototype.set.name === "set" ? function writeBytesBuffer_set(val, buf, pos) { buf.set(val, pos); } : function writeBytesBuffer_copy(val, buf, pos) { if (val.copy) val.copy(buf, pos, 0, val.length); else for (var i2 = 0; i2 < val.length; ) buf[pos++] = val[i2++]; }; }; BufferWriter.prototype.bytes = function write_bytes_buffer(value) { if (util$3.isString(value)) value = util$3._Buffer_from(value, "base64"); var len = value.length >>> 0; this.uint32(len); if (len) this._push(BufferWriter.writeBytesBuffer, len, value); return this; }; function writeStringBuffer(val, buf, pos) { if (val.length < 40) util$3.utf8.write(val, buf, pos); else if (buf.utf8Write) buf.utf8Write(val, pos); else buf.write(val, pos); } BufferWriter.prototype.string = function write_string_buffer(value) { var len = util$3.Buffer.byteLength(value); this.uint32(len); if (len) this._push(writeStringBuffer, len, value); return this; }; BufferWriter._configure(); var reader = Reader$1; var util$2 = requireMinimal(); var BufferReader$1; var LongBits = util$2.LongBits, utf8 = util$2.utf8; function indexOutOfRange(reader2, writeLength) { return RangeError("index out of range: " + reader2.pos + " + " + (writeLength || 1) + " > " + reader2.len); } function Reader$1(buffer) { this.buf = buffer; this.pos = 0; this.len = buffer.length; } var create_array = typeof Uint8Array !== "undefined" ? function create_typed_array(buffer) { if (buffer instanceof Uint8Array || Array.isArray(buffer)) return new Reader$1(buffer); throw Error("illegal buffer"); } : function create_array2(buffer) { if (Array.isArray(buffer)) return new Reader$1(buffer); throw Error("illegal buffer"); }; var create = function create2() { return util$2.Buffer ? function create_buffer_setup(buffer) { return (Reader$1.create = function create_buffer(buffer2) { return util$2.Buffer.isBuffer(buffer2) ? new BufferReader$1(buffer2) : create_array(buffer2); })(buffer); } : create_array; }; Reader$1.create = create(); Reader$1.prototype._slice = util$2.Array.prototype.subarray || /* istanbul ignore next */ util$2.Array.prototype.slice; Reader$1.prototype.uint32 = /* @__PURE__ */ function read_uint32_setup() { var value = 4294967295; return function read_uint32() { value = (this.buf[this.pos] & 127) >>> 0; if (this.buf[this.pos++] < 128) return value; value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value; value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value; value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value; value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value; if ((this.pos += 5) > this.len) { this.pos = this.len; throw indexOutOfRange(this, 10); } return value; }; }(); Reader$1.prototype.int32 = function read_int32() { return this.uint32() | 0; }; Reader$1.prototype.sint32 = function read_sint32() { var value = this.uint32(); return value >>> 1 ^ -(value & 1) | 0; }; function readLongVarint() { var bits = new LongBits(0, 0); var i2 = 0; if (this.len - this.pos > 4) { for (; i2 < 4; ++i2) { bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i2 * 7) >>> 0; if (this.buf[this.pos++] < 128) return bits; } bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0; bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0; if (this.buf[this.pos++] < 128) return bits; i2 = 0; } else { for (; i2 < 3; ++i2) { if (this.pos >= this.len) throw indexOutOfRange(this); bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i2 * 7) >>> 0; if (this.buf[this.pos++] < 128) return bits; } bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i2 * 7) >>> 0; return bits; } if (this.len - this.pos > 4) { for (; i2 < 5; ++i2) { bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i2 * 7 + 3) >>> 0; if (this.buf[this.pos++] < 128) return bits; } } else { for (; i2 < 5; ++i2) { if (this.pos >= this.len) throw indexOutOfRange(this); bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i2 * 7 + 3) >>> 0; if (this.buf[this.pos++] < 128) return bits; } } throw Error("invalid varint encoding"); } Reader$1.prototype.bool = function read_bool() { return this.uint32() !== 0; }; function readFixed32_end(buf, end) { return (buf[end - 4] | buf[end - 3] << 8 | buf[end - 2] << 16 | buf[end - 1] << 24) >>> 0; } Reader$1.prototype.fixed32 = function read_fixed32() { if (this.pos + 4 > this.len) throw indexOutOfRange(this, 4); return readFixed32_end(this.buf, this.pos += 4); }; Reader$1.prototype.sfixed32 = function read_sfixed32() { if (this.pos + 4 > this.len) throw indexOutOfRange(this, 4); return readFixed32_end(this.buf, this.pos += 4) | 0; }; function readFixed64() { if (this.pos + 8 > this.len) throw indexOutOfRange(this, 8); return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4)); } Reader$1.prototype.float = function read_float() { if (this.pos + 4 > this.len) throw indexOutOfRange(this, 4); var value = util$2.float.readFloatLE(this.buf, this.pos); this.pos += 4; return value; }; Reader$1.prototype.double = function read_double() { if (this.pos + 8 > this.len) throw indexOutOfRange(this, 4); var value = util$2.float.readDoubleLE(this.buf, this.pos); this.pos += 8; return value; }; Reader$1.prototype.bytes = function read_bytes() { var length = this.uint32(), start = this.pos, end = this.pos + length; if (end > this.len) throw indexOutOfRange(this, length); this.pos += length; if (Array.isArray(this.buf)) return this.buf.slice(start, end); if (start === end) { var nativeBuffer = util$2.Buffer; return nativeBuffer ? nativeBuffer.alloc(0) : new this.buf.constructor(0); } return this._slice.call(this.buf, start, end); }; Reader$1.prototype.string = function read_string() { var bytes = this.bytes(); return utf8.read(bytes, 0, bytes.length); }; Reader$1.prototype.skip = function skip(length) { if (typeof length === "number") { if (this.pos + length > this.len) throw indexOutOfRange(this, length); this.pos += length; } else { do { if (this.pos >= this.len) throw indexOutOfRange(this); } while (this.buf[this.pos++] & 128); } return this; }; Reader$1.prototype.skipType = function(wireType) { switch (wireType) { case 0: this.skip(); break; case 1: this.skip(8); break; case 2: this.skip(this.uint32()); break; case 3: while ((wireType = this.uint32() & 7) !== 4) { this.skipType(wireType); } break; case 5: this.skip(4); break; default: throw Error("invalid wire type " + wireType + " at offset " + this.pos); } return this; }; Reader$1._configure = function(BufferReader_) { BufferReader$1 = BufferReader_; Reader$1.create = create(); BufferReader$1._configure(); var fn = util$2.Long ? "toLong" : ( /* istanbul ignore next */ "toNumber" ); util$2.merge(Reader$1.prototype, { int64: function read_int64() { return readLongVarint.call(this)[fn](false); }, uint64: function read_uint64() { return readLongVarint.call(this)[fn](true); }, sint64: function read_sint64() { return readLongVarint.call(this).zzDecode()[fn](false); }, fixed64: function read_fixed64() { return readFixed64.call(this)[fn](true); }, sfixed64: function read_sfixed64() { return readFixed64.call(this)[fn](false); } }); }; var reader_buffer = BufferReader; var Reader = reader; (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader; var util$1 = requireMinimal(); function BufferReader(buffer) { Reader.call(this, buffer); } BufferReader._configure = function() { if (util$1.Buffer) BufferReader.prototype._slice = util$1.Buffer.prototype.slice; }; BufferReader.prototype.string = function read_string_buffer() { var len = this.uint32(); return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + len, this.len)); }; BufferReader._configure(); var rpc = {}; var service = Service; var util = requireMinimal(); (Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service; function Service(rpcImpl, requestDelimited, responseDelimited) { if (typeof rpcImpl !== "function") throw TypeError("rpcImpl must be a function"); util.EventEmitter.call(this); this.rpcImpl = rpcImpl; this.requestDelimited = Boolean(requestDelimited); this.responseDelimited = Boolean(responseDelimited); } Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) { if (!request) throw TypeError("request must be specified"); var self2 = this; if (!callback) return util.asPromise(rpcCall, self2, method, requestCtor, responseCtor, request); if (!self2.rpcImpl) { setTimeout(function() { callback(Error("already ended")); }, 0); return void 0; } try { return self2.rpcImpl( method, requestCtor[self2.requestDelimited ? "encodeDelimited" : "encode"](request).finish(), function rpcCallback(err, response) { if (err) { self2.emit("error", err, method); return callback(err); } if (response === null) { self2.end( /* endedByRPC */ true ); return void 0; } if (!(response instanceof responseCtor)) { try { response = responseCtor[self2.responseDelimited ? "decodeDelimited" : "decode"](response); } catch (err2) { self2.emit("error", err2, method); return callback(err2); } } self2.emit("data", response, method); return callback(null, response); } ); } catch (err) { self2.emit("error", err, method); setTimeout(function() { callback(err); }, 0); return void 0; } }; Service.prototype.end = function end(endedByRPC) { if (this.rpcImpl) { if (!endedByRPC) this.rpcImpl(null, null, null); this.rpcImpl = null; this.emit("end").off(); } return this; }; (function(exports2) { var rpc2 = exports2; rpc2.Service = service; })(rpc); var roots = {}; (function(exports2) { var protobuf = exports2; protobuf.build = "minimal"; protobuf.Writer = writer; protobuf.BufferWriter = writer_buffer; protobuf.Reader = reader; protobuf.BufferReader = reader_buffer; protobuf.util = requireMinimal(); protobuf.rpc = rpc; protobuf.roots = roots; protobuf.configure = configure; function configure() { protobuf.util._configure(); protobuf.Writer._configure(protobuf.BufferWriter); protobuf.Reader._configure(protobuf.BufferReader); } configure(); })(indexMinimal); var minimal = indexMinimal; const $Reader = minimal.Reader, $Writer = minimal.Writer, $util = minimal.util; const $root = minimal.roots["default"] || (minimal.roots["default"] = {}); const migration$1 = $root.migration = (() => { const migration2 = {}; migration2.Payload = function() { function Payload(properties) { this.otpParameters = []; if (properties) { for (let keys = Object.keys(properties), i2 = 0; i2 < keys.length; ++i2) if (properties[keys[i2]] != null) this[keys[i2]] = properties[keys[i2]]; } } Payload.prototype.otpParameters = $util.emptyArray; Payload.prototype.version = 0; Payload.prototype.batchSize = 0; Payload.prototype.batchIndex = 0; Payload.prototype.batchId = 0; Payload.create = function create2(properties) { return new Payload(properties); }; Payload.encode = function encode(message, writer2) { if (!writer2) writer2 = $Writer.create(); if (message.otpParameters != null && message.otpParameters.length) for (let i2 = 0; i2 < message.otpParameters.length; ++i2) $root.migration.Payload.OtpParameters.encode(message.otpParameters[i2], writer2.uint32( /* id 1, wireType 2 =*/ 10 ).fork()).ldelim(); if (message.version != null && Object.hasOwnProperty.call(message, "version")) writer2.uint32( /* id 2, wireType 0 =*/ 16 ).int32(message.version); if (message.batchSize != null && Object.hasOwnProperty.call(message, "batchSize")) writer2.uint32( /* id 3, wireType 0 =*/ 24 ).int32(message.batchSize); if (message.batchIndex != null && Object.hasOwnProperty.call(message, "batchIndex")) writer2.uint32( /* id 4, wireType 0 =*/ 32 ).int32(message.batchIndex); if (message.batchId != null && Object.hasOwnProperty.call(message, "batchId")) writer2.uint32( /* id 5, wireType 0 =*/ 40 ).int32(message.batchId); return writer2; }; Payload.encodeDelimited = function encodeDelimited(message, writer2) { return this.encode(message, writer2).ldelim(); }; Payload.decode = function decode(reader2, length) { if (!(reader2 instanceof $Reader)) reader2 = $Reader.create(reader2); let end = length === void 0 ? reader2.len : reader2.pos + length, message = new $root.migration.Payload(); while (reader2.pos < end) { let tag = reader2.uint32(); switch (tag >>> 3) { case 1: { if (!(message.otpParameters && message.otpParameters.length)) message.otpParameters = []; message.otpParameters.push($root.migration.Payload.OtpParameters.decode(reader2, reader2.uint32())); break; } case 2: { message.version = reader2.int32(); break; } case 3: { message.batchSize = reader2.int32(); break; } case 4: { message.batchIndex = reader2.int32(); break; } case 5: { message.batchId = reader2.int32(); break; } default: reader2.skipType(tag & 7); break; } } return message; }; Payload.decodeDelimited = function decodeDelimited(reader2) { if (!(reader2 instanceof $Reader)) reader2 = new $Reader(reader2); return this.decode(reader2, reader2.uint32()); }; Payload.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.otpParameters != null && message.hasOwnProperty("otpParameters")) { if (!Array.isArray(message.otpParameters)) return "otpParameters: array expected"; for (let i2 = 0; i2 < message.otpParameters.length; ++i2) { let error = $root.migration.Payload.OtpParameters.verify(message.otpParameters[i2]); if (error) return "otpParameters." + error; } } if (message.version != null && message.hasOwnProperty("version")) { if (!$util.isInteger(message.version)) return "version: integer expected"; } if (message.batchSize != null && message.hasOwnProperty("batchSize")) { if (!$util.isInteger(message.batchSize)) return "batchSize: integer expected"; } if (message.batchIndex != null && message.hasOwnProperty("batchIndex")) { if (!$util.isInteger(message.batchIndex)) return "batchIndex: integer expected"; } if (message.batchId != null && message.hasOwnProperty("batchId")) { if (!$util.isInteger(message.batchId)) return "batchId: integer expected"; } return null; }; Payload.fromObject = function fromObject(object) { if (object instanceof $root.migration.Payload) return object; let message = new $root.migration.Payload(); if (object.otpParameters) { if (!Array.isArray(object.otpParameters)) throw TypeError(".migration.Payload.otpParameters: array expected"); message.otpParameters = []; for (let i2 = 0; i2 < object.otpParameters.length; ++i2) { if (typeof object.otpParameters[i2] !== "object") throw TypeError(".migration.Payload.otpParameters: object expected"); message.otpParameters[i2] = $root.migration.Payload.OtpParameters.fromObject(object.otpParameters[i2]); } } if (object.version != null) message.version = object.version | 0; if (object.batchSize != null) message.batchSize = object.batchSize | 0; if (object.batchIndex != null) message.batchIndex = object.batchIndex | 0; if (object.batchId != null) message.batchId = object.batchId | 0; return message; }; Payload.toObject = function toObject(message, options) { if (!options) options = {}; let object = {}; if (options.arrays || options.defaults) object.otpParameters = []; if (options.defaults) { object.version = 0; object.batchSize = 0; object.batchIndex = 0; object.batchId = 0; } if (message.otpParameters && message.otpParameters.length) { object.otpParameters = []; for (let j2 = 0; j2 < message.otpParameters.length; ++j2) object.otpParameters[j2] = $root.migration.Payload.OtpParameters.toObject(message.otpParameters[j2], options); } if (message.version != null && message.hasOwnProperty("version")) object.version = message.version; if (message.batchSize != null && message.hasOwnProperty("batchSize")) object.batchSize = message.batchSize; if (message.batchIndex != null && message.hasOwnProperty("batchIndex")) object.batchIndex = message.batchIndex; if (message.batchId != null && message.hasOwnProperty("batchId")) object.batchId = message.batchId; return object; }; Payload.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, minimal.util.toJSONOptions); }; Payload.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === void 0) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/migration.Payload"; }; Payload.Algorithm = function() { const valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "ALGORITHM_UNSPECIFIED"] = 0; values[valuesById[1] = "ALGORITHM_SHA1"] = 1; values[valuesById[2] = "ALGORITHM_SHA256"] = 2; values[valuesById[3] = "ALGORITHM_SHA512"] = 3; values[valuesById[4] = "ALGORITHM_MD5"] = 4; return values; }(); Payload.DigitCount = function() { const valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "DIGIT_COUNT_UNSPECIFIED"] = 0; values[valuesById[1] = "DIGIT_COUNT_SIX"] = 1; values[valuesById[2] = "DIGIT_COUNT_EIGHT"] = 2; return values; }(); Payload.OtpType = function() { const valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "OTP_TYPE_UNSPECIFIED"] = 0; values[valuesById[1] = "OTP_TYPE_HOTP"] = 1; values[valuesById[2] = "OTP_TYPE_TOTP"] = 2; return values; }(); Payload.OtpParameters = function() { function OtpParameters(properties) { if (properties) { for (let keys = Object.keys(properties), i2 = 0; i2 < keys.length; ++i2) if (properties[keys[i2]] != null) this[keys[i2]] = properties[keys[i2]]; } } OtpParameters.prototype.secret = $util.newBuffer([]); OtpParameters.prototype.name = ""; OtpParameters.prototype.issuer = ""; OtpParameters.prototype.algorithm = 0; OtpParameters.prototype.digits = 0; OtpParameters.prototype.type = 0; OtpParameters.prototype.counter = $util.Long ? $util.Long.fromBits(0, 0, true) : 0; OtpParameters.create = function create2(properties) { return new OtpParameters(properties); }; OtpParameters.encode = function encode(message, writer2) { if (!writer2) writer2 = $Writer.create(); if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) writer2.uint32( /* id 1, wireType 2 =*/ 10 ).bytes(message.secret); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer2.uint32( /* id 2, wireType 2 =*/ 18 ).string(message.name); if (message.issuer != null && Object.hasOwnProperty.call(message, "issuer")) writer2.uint32( /* id 3, wireType 2 =*/ 26 ).string(message.issuer); if (message.algorithm != null && Object.hasOwnProperty.call(message, "algorithm")) writer2.uint32( /* id 4, wireType 0 =*/ 32 ).int32(message.algorithm); if (message.digits != null && Object.hasOwnProperty.call(message, "digits")) writer2.uint32( /* id 5, wireType 0 =*/ 40 ).int32(message.digits); if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer2.uint32( /* id 6, wireType 0 =*/ 48 ).int32(message.type); if (message.counter != null && Object.hasOwnProperty.call(message, "counter")) writer2.uint32( /* id 7, wireType 0 =*/ 56 ).uint64(message.counter); return writer2; }; OtpParameters.encodeDelimited = function encodeDelimited(message, writer2) { return this.encode(message, writer2).ldelim(); }; OtpParameters.decode = function decode(reader2, length) { if (!(reader2 instanceof $Reader)) reader2 = $Reader.create(reader2); let end = length === void 0 ? reader2.len : reader2.pos + length, message = new $root.migration.Payload.OtpParameters(); while (reader2.pos < end) { let tag = reader2.uint32(); switch (tag >>> 3) { case 1: { message.secret = reader2.bytes(); break; } case 2: { message.name = reader2.string(); break; } case 3: { message.issuer = reader2.string(); break; } case 4: { message.algorithm = reader2.int32(); break; } case 5: { message.digits = reader2.int32(); break; } case 6: { message.type = reader2.int32(); break; } case 7: { message.counter = reader2.uint64(); break; } default: reader2.skipType(tag & 7); break; } } return message; }; OtpParameters.decodeDelimited = function decodeDelimited(reader2) { if (!(reader2 instanceof $Reader)) reader2 = new $Reader(reader2); return this.decode(reader2, reader2.uint32()); }; OtpParameters.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.secret != null && message.hasOwnProperty("secret")) { if (!(message.secret && typeof message.secret.length === "number" || $util.isString(message.secret))) return "secret: buffer expected"; } if (message.name != null && message.hasOwnProperty("name")) { if (!$util.isString(message.name)) return "name: string expected"; } if (message.issuer != null && message.hasOwnProperty("issuer")) { if (!$util.isString(message.issuer)) return "issuer: string expected"; } if (message.algorithm != null && message.hasOwnProperty("algorithm")) switch (message.algorithm) { default: return "algorithm: enum value expected"; case 0: case 1: case 2: case 3: case 4: break; } if (message.digits != null && message.hasOwnProperty("digits")) switch (message.digits) { default: return "digits: enum value expected"; case 0: case 1: case 2: break; } if (message.type != null && message.hasOwnProperty("type")) switch (message.type) { default: return "type: enum value expected"; case 0: case 1: case 2: break; } if (message.counter != null && message.hasOwnProperty("counter")) { if (!$util.isInteger(message.counter) && !(message.counter && $util.isInteger(message.counter.low) && $util.isInteger(message.counter.high))) return "counter: integer|Long expected"; } return null; }; OtpParameters.fromObject = function fromObject(object) { if (object instanceof $root.migration.Payload.OtpParameters) return object; let message = new $root.migration.Payload.OtpParameters(); if (object.secret != null) { if (typeof object.secret === "string") $util.base64.decode(object.secret, message.secret = $util.newBuffer($util.base64.length(object.secret)), 0); else if (object.secret.length >= 0) message.secret = object.secret; } if (object.name != null) message.name = String(object.name); if (object.issuer != null) message.issuer = String(object.issuer); switch (object.algorithm) { default: if (typeof object.algorithm === "number") { message.algorithm = object.algorithm; break; } break; case "ALGORITHM_UNSPECIFIED": case 0: message.algorithm = 0; break; case "ALGORITHM_SHA1": case 1: message.algorithm = 1; break; case "ALGORITHM_SHA256": case 2: message.algorithm = 2; break; case "ALGORITHM_SHA512": case 3: message.algorithm = 3; break; case "ALGORITHM_MD5": case 4: message.algorithm = 4; break; } switch (object.digits) { default: if (typeof object.digits === "number") { message.digits = object.digits; break; } break; case "DIGIT_COUNT_UNSPECIFIED": case 0: message.digits = 0; break; case "DIGIT_COUNT_SIX": case 1: message.digits = 1; break; case "DIGIT_COUNT_EIGHT": case 2: message.digits = 2; break; } switch (object.type) { default: if (typeof object.type === "number") { message.type = object.type; break; } break; case "OTP_TYPE_UNSPECIFIED": case 0: message.type = 0; break; case "OTP_TYPE_HOTP": case 1: message.type = 1; break; case "OTP_TYPE_TOTP": case 2: message.type = 2; break; } if (object.counter != null) { if ($util.Long) (message.counter = $util.Long.fromValue(object.counter)).unsigned = true; else if (typeof object.counter === "string") message.counter = parseInt(object.counter, 10); else if (typeof object.counter === "number") message.counter = object.counter; else if (typeof object.counter === "object") message.counter = new $util.LongBits(object.counter.low >>> 0, object.counter.high >>> 0).toNumber(true); } return message; }; OtpParameters.toObject = function toObject(message, options) { if (!options) options = {}; let object = {}; if (options.defaults) { if (options.bytes === String) object.secret = ""; else { object.secret = []; if (options.bytes !== Array) object.secret = $util.newBuffer(object.secret); } object.name = ""; object.issuer = ""; object.algorithm = options.enums === String ? "ALGORITHM_UNSPECIFIED" : 0; object.digits = options.enums === String ? "DIGIT_COUNT_UNSPECIFIED" : 0; object.type = options.enums === String ? "OTP_TYPE_UNSPECIFIED" : 0; if ($util.Long) { let long = new $util.Long(0, 0, true); object.counter = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.counter = options.longs === String ? "0" : 0; } if (message.secret != null && message.hasOwnProperty("secret")) object.secret = options.bytes === String ? $util.base64.encode(message.secret, 0, message.secret.length) : options.bytes === Array ? Array.prototype.slice.call(message.secret) : message.secret; if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; if (message.issuer != null && message.hasOwnProperty("issuer")) object.issuer = message.issuer; if (message.algorithm != null && message.hasOwnProperty("algorithm")) object.algorithm = options.enums === String ? $root.migration.Payload.Algorithm[message.algorithm] === void 0 ? message.algorithm : $root.migration.Payload.Algorithm[message.algorithm] : message.algorithm; if (message.digits != null && message.hasOwnProperty("digits")) object.digits = options.enums === String ? $root.migration.Payload.DigitCount[message.digits] === void 0 ? message.digits : $root.migration.Payload.DigitCount[message.digits] : message.digits; if (message.type != null && message.hasOwnProperty("type")) object.type = options.enums === String ? $root.migration.Payload.OtpType[message.type] === void 0 ? message.type : $root.migration.Payload.OtpType[message.type] : message.type; if (message.counter != null && message.hasOwnProperty("counter")) if (typeof message.counter === "number") object.counter = options.longs === String ? String(message.counter) : message.counter; else object.counter = options.longs === String ? $util.Long.prototype.toString.call(message.counter) : options.longs === Number ? new $util.LongBits(message.counter.low >>> 0, message.counter.high >>> 0).toNumber(true) : message.counter; return object; }; OtpParameters.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, minimal.util.toJSONOptions); }; OtpParameters.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === void 0) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/migration.Payload.OtpParameters"; }; return OtpParameters; }(); return Payload; }(); return migration2; })(); function toURI(info) { const url = new URL(`otpauth://${info.type}/${encodeURIComponent(`${info.issuer ? `${info.issuer}:` : ""}${info.name}`)}`); const searchParams = url.searchParams; if (info.issuer) { searchParams.set("issuer", info.issuer); } if (info.algorithm) { searchParams.set("algorithm", info.algorithm); } if (info.digits) { searchParams.set("digits", info.digits.toString()); } if (info.type === "totp") { if (info.period) { searchParams.set("period", info.period.toString()); } } if (info.type === "hotp") { if (info.counter) { searchParams.set("counter", info.counter.toString()); } } searchParams.set("secret", info.secret); return url.toString(); } function extractData(uri) { if (!uri.startsWith("otpauth-migration://offline")) { throw new Error("Invalid protocol"); } const url = new URL(uri); const parsed = url.searchParams; const base642 = parsed.get("data"); if (!base642) { throw new Error("Invalid data"); } const uint8 = Uint8Array.from(atob(base642), (c2) => c2.charCodeAt(0)); return uint8; } function payloadToInfo(payload) { const type = parseType(payload); if (type === "totp") { return { type: "totp", name: parseName(payload), issuer: parseIssuer(payload), algorithm: parseAlgorithm(payload), digits: parseDigits(payload), secret: parseSecret(payload) }; } else { return { type: parseType(payload), name: parseName(payload), issuer: parseIssuer(payload), algorithm: parseAlgorithm(payload), digits: parseDigits(payload), secret: parseSecret(payload), counter: parseCounter(payload) }; } } function parseType(payload) { if (payload.type === migration$1.Payload.OtpType.OTP_TYPE_HOTP) { return "hotp"; } if (payload.type === migration$1.Payload.OtpType.OTP_TYPE_TOTP) { return "totp"; } throw new Error("Unknown type"); } function parseName(payload) { if (payload.name) { return payload.name; } else { return ""; } } function parseIssuer(payload) { if (payload.issuer) { return payload.issuer; } else { return ""; } } function parseAlgorithm(payload) { if (payload.algorithm === migration$1.Payload.Algorithm.ALGORITHM_SHA1) { return "SHA1"; } if (payload.algorithm === migration$1.Payload.Algorithm.ALGORITHM_SHA256) { return "SHA256"; } if (payload.algorithm === migration$1.Payload.Algorithm.ALGORITHM_SHA512) { return "SHA512"; } if (payload.algorithm === migration$1.Payload.Algorithm.ALGORITHM_MD5) { return "MD5"; } throw new Error("Unknown algorithm"); } function parseDigits(payload) { if (payload.digits === migration$1.Payload.DigitCount.DIGIT_COUNT_SIX) { return 6; } if (payload.digits === migration$1.Payload.DigitCount.DIGIT_COUNT_EIGHT) { return 8; } throw new Error("Unknown digits"); } function parseCounter(payload) { if (typeof payload.counter === "number") { return payload.counter; } else if (payload.counter === void 0 || payload.counter === null) { return 0; } else { return payload.counter.toNumber(); } } function parseSecret(payload) { if (payload.secret) { return base32Encode(payload.secret); } else { throw new Error("Missing secret"); } } const base32Encode = (data) => { const base32chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; let base32 = ""; let i2 = 0; let value = 0; let digit = 0; while (i2 < data.length) { value = value << 8 | data[i2++]; digit += 8; while (digit >= 5) { base32 += base32chars[value >>> digit - 5 & 31]; digit -= 5; } } if (digit > 0) { base32 += base32chars[value << 5 - digit & 31]; } return base32; }; function parseURI(uri) { const data = extractData(uri); const payload = migration$1.Payload.decode(data); const infos = payload.otpParameters.map(payloadToInfo); return infos; } function toOTPAuthURIs(otpauth_migration_uri) { const infos = parseURI(otpauth_migration_uri); const otpauth_uris = infos.map(toURI); return otpauth_uris; } const uintToBuf = (num) => { const buf = new ArrayBuffer(8); const arr = new Uint8Array(buf); let acc = num; for (let i2 = 7; i2 >= 0; i2--) { if (acc === 0) break; arr[i2] = acc & 255; acc -= arr[i2]; acc /= 256; } return buf; }; const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", n = "ARRAYBUFFER not supported by this environment", e = "UINT8ARRAY not supported by this environment"; function r(t2, n2, e2, r2) { let i2, s2, o2; const h2 = n2 || [0], u2 = (e2 = e2 || 0) >>> 3, w2 = -1 === r2 ? 3 : 0; for (i2 = 0; i2 < t2.length; i2 += 1) o2 = i2 + u2, s2 = o2 >>> 2, h2.length <= s2 && h2.push(0), h2[s2] |= t2[i2] << 8 * (w2 + r2 * (o2 % 4)); return { value: h2, binLen: 8 * t2.length + e2 }; } function i(i2, s2, o2) { switch (s2) { case "UTF8": case "UTF16BE": case "UTF16LE": break; default: throw new Error("encoding must be UTF8, UTF16BE, or UTF16LE"); } switch (i2) { case "HEX": return function(t2, n2, e2) { return function(t3, n3, e3, r2) { let i3, s3, o3, h2; if (0 != t3.length % 2) throw new Error("String of HEX type must be in byte increments"); const u2 = n3 || [0], w2 = (e3 = e3 || 0) >>> 3, c2 = -1 === r2 ? 3 : 0; for (i3 = 0; i3 < t3.length; i3 += 2) { if (s3 = parseInt(t3.substr(i3, 2), 16), isNaN(s3)) throw new Error("String of HEX type contains invalid characters"); for (h2 = (i3 >>> 1) + w2, o3 = h2 >>> 2; u2.length <= o3; ) u2.push(0); u2[o3] |= s3 << 8 * (c2 + r2 * (h2 % 4)); } return { value: u2, binLen: 4 * t3.length + e3 }; }(t2, n2, e2, o2); }; case "TEXT": return function(t2, n2, e2) { return function(t3, n3, e3, r2, i3) { let s3, o3, h2, u2, w2, c2, f2, a2, l2 = 0; const A2 = e3 || [0], E2 = (r2 = r2 || 0) >>> 3; if ("UTF8" === n3) for (f2 = -1 === i3 ? 3 : 0, h2 = 0; h2 < t3.length; h2 += 1) for (s3 = t3.charCodeAt(h2), o3 = [], 128 > s3 ? o3.push(s3) : 2048 > s3 ? (o3.push(192 | s3 >>> 6), o3.push(128 | 63 & s3)) : 55296 > s3 || 57344 <= s3 ? o3.push(224 | s3 >>> 12, 128 | s3 >>> 6 & 63, 128 | 63 & s3) : (h2 += 1, s3 = 65536 + ((1023 & s3) << 10 | 1023 & t3.charCodeAt(h2)), o3.push(240 | s3 >>> 18, 128 | s3 >>> 12 & 63, 128 | s3 >>> 6 & 63, 128 | 63 & s3)), u2 = 0; u2 < o3.length; u2 += 1) { for (c2 = l2 + E2, w2 = c2 >>> 2; A2.length <= w2; ) A2.push(0); A2[w2] |= o3[u2] << 8 * (f2 + i3 * (c2 % 4)), l2 += 1; } else for (f2 = -1 === i3 ? 2 : 0, a2 = "UTF16LE" === n3 && 1 !== i3 || "UTF16LE" !== n3 && 1 === i3, h2 = 0; h2 < t3.length; h2 += 1) { for (s3 = t3.charCodeAt(h2), true === a2 && (u2 = 255 & s3, s3 = u2 << 8 | s3 >>> 8), c2 = l2 + E2, w2 = c2 >>> 2; A2.length <= w2; ) A2.push(0); A2[w2] |= s3 << 8 * (f2 + i3 * (c2 % 4)), l2 += 2; } return { value: A2, binLen: 8 * l2 + r2 }; }(t2, s2, n2, e2, o2); }; case "B64": return function(n2, e2, r2) { return function(n3, e3, r3, i3) { let s3, o3, h2, u2, w2, c2, f2, a2 = 0; const l2 = e3 || [0], A2 = (r3 = r3 || 0) >>> 3, E2 = -1 === i3 ? 3 : 0, H2 = n3.indexOf("="); if (-1 === n3.search(/^[a-zA-Z0-9=+/]+$/)) throw new Error("Invalid character in base-64 string"); if (n3 = n3.replace(/=/g, ""), -1 !== H2 && H2 < n3.length) throw new Error("Invalid '=' found in base-64 string"); for (o3 = 0; o3 < n3.length; o3 += 4) { for (w2 = n3.substr(o3, 4), u2 = 0, h2 = 0; h2 < w2.length; h2 += 1) s3 = t.indexOf(w2.charAt(h2)), u2 |= s3 << 18 - 6 * h2; for (h2 = 0; h2 < w2.length - 1; h2 += 1) { for (f2 = a2 + A2, c2 = f2 >>> 2; l2.length <= c2; ) l2.push(0); l2[c2] |= (u2 >>> 16 - 8 * h2 & 255) << 8 * (E2 + i3 * (f2 % 4)), a2 += 1; } } return { value: l2, binLen: 8 * a2 + r3 }; }(n2, e2, r2, o2); }; case "BYTES": return function(t2, n2, e2) { return function(t3, n3, e3, r2) { let i3, s3, o3, h2; const u2 = n3 || [0], w2 = (e3 = e3 || 0) >>> 3, c2 = -1 === r2 ? 3 : 0; for (s3 = 0; s3 < t3.length; s3 += 1) i3 = t3.charCodeAt(s3), h2 = s3 + w2, o3 = h2 >>> 2, u2.length <= o3 && u2.push(0), u2[o3] |= i3 << 8 * (c2 + r2 * (h2 % 4)); return { value: u2, binLen: 8 * t3.length + e3 }; }(t2, n2, e2, o2); }; case "ARRAYBUFFER": try { new ArrayBuffer(0); } catch (t2) { throw new Error(n); } return function(t2, n2, e2) { return function(t3, n3, e3, i3) { return r(new Uint8Array(t3), n3, e3, i3); }(t2, n2, e2, o2); }; case "UINT8ARRAY": try { new Uint8Array(0); } catch (t2) { throw new Error(e); } return function(t2, n2, e2) { return r(t2, n2, e2, o2); }; default: throw new Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY"); } } function s(r2, i2, s2, o2) { switch (r2) { case "HEX": return function(t2) { return function(t3, n2, e2, r3) { const i3 = "0123456789abcdef"; let s3, o3, h2 = ""; const u2 = n2 / 8, w2 = -1 === e2 ? 3 : 0; for (s3 = 0; s3 < u2; s3 += 1) o3 = t3[s3 >>> 2] >>> 8 * (w2 + e2 * (s3 % 4)), h2 += i3.charAt(o3 >>> 4 & 15) + i3.charAt(15 & o3); return r3.outputUpper ? h2.toUpperCase() : h2; }(t2, i2, s2, o2); }; case "B64": return function(n2) { return function(n3, e2, r3, i3) { let s3, o3, h2, u2, w2, c2 = ""; const f2 = e2 / 8, a2 = -1 === r3 ? 3 : 0; for (s3 = 0; s3 < f2; s3 += 3) for (u2 = s3 + 1 < f2 ? n3[s3 + 1 >>> 2] : 0, w2 = s3 + 2 < f2 ? n3[s3 + 2 >>> 2] : 0, h2 = (n3[s3 >>> 2] >>> 8 * (a2 + r3 * (s3 % 4)) & 255) << 16 | (u2 >>> 8 * (a2 + r3 * ((s3 + 1) % 4)) & 255) << 8 | w2 >>> 8 * (a2 + r3 * ((s3 + 2) % 4)) & 255, o3 = 0; o3 < 4; o3 += 1) c2 += 8 * s3 + 6 * o3 <= e2 ? t.charAt(h2 >>> 6 * (3 - o3) & 63) : i3.b64Pad; return c2; }(n2, i2, s2, o2); }; case "BYTES": return function(t2) { return function(t3, n2, e2) { let r3, i3, s3 = ""; const o3 = n2 / 8, h2 = -1 === e2 ? 3 : 0; for (r3 = 0; r3 < o3; r3 += 1) i3 = t3[r3 >>> 2] >>> 8 * (h2 + e2 * (r3 % 4)) & 255, s3 += String.fromCharCode(i3); return s3; }(t2, i2, s2); }; case "ARRAYBUFFER": try { new ArrayBuffer(0); } catch (t2) { throw new Error(n); } return function(t2) { return function(t3, n2, e2) { let r3; const i3 = n2 / 8, s3 = new ArrayBuffer(i3), o3 = new Uint8Array(s3), h2 = -1 === e2 ? 3 : 0; for (r3 = 0; r3 < i3; r3 += 1) o3[r3] = t3[r3 >>> 2] >>> 8 * (h2 + e2 * (r3 % 4)) & 255; return s3; }(t2, i2, s2); }; case "UINT8ARRAY": try { new Uint8Array(0); } catch (t2) { throw new Error(e); } return function(t2) { return function(t3, n2, e2) { let r3; const i3 = n2 / 8, s3 = -1 === e2 ? 3 : 0, o3 = new Uint8Array(i3); for (r3 = 0; r3 < i3; r3 += 1) o3[r3] = t3[r3 >>> 2] >>> 8 * (s3 + e2 * (r3 % 4)) & 255; return o3; }(t2, i2, s2); }; default: throw new Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY"); } } const o = 4294967296, h = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298], u = [3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428], w = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225], c = "Chosen SHA variant is not supported", f = "Cannot set numRounds with MAC"; function a(t2, n2) { let e2, r2; const i2 = t2.binLen >>> 3, s2 = n2.binLen >>> 3, o2 = i2 << 3, h2 = 4 - i2 << 3; if (i2 % 4 != 0) { for (e2 = 0; e2 < s2; e2 += 4) r2 = i2 + e2 >>> 2, t2.value[r2] |= n2.value[e2 >>> 2] << o2, t2.value.push(0), t2.value[r2 + 1] |= n2.value[e2 >>> 2] >>> h2; return (t2.value.length << 2) - 4 >= s2 + i2 && t2.value.pop(), { value: t2.value, binLen: t2.binLen + n2.binLen }; } return { value: t2.value.concat(n2.value), binLen: t2.binLen + n2.binLen }; } function l(t2) { const n2 = { outputUpper: false, b64Pad: "=", outputLen: -1 }, e2 = t2 || {}, r2 = "Output length must be a multiple of 8"; if (n2.outputUpper = e2.outputUpper || false, e2.b64Pad && (n2.b64Pad = e2.b64Pad), e2.outputLen) { if (e2.outputLen % 8 != 0) throw new Error(r2); n2.outputLen = e2.outputLen; } else if (e2.shakeLen) { if (e2.shakeLen % 8 != 0) throw new Error(r2); n2.outputLen = e2.shakeLen; } if ("boolean" != typeof n2.outputUpper) throw new Error("Invalid outputUpper formatting option"); if ("string" != typeof n2.b64Pad) throw new Error("Invalid b64Pad formatting option"); return n2; } function A(t2, n2, e2, r2) { const s2 = t2 + " must include a value and format"; if (!n2) { if (!r2) throw new Error(s2); return r2; } if (void 0 === n2.value || !n2.format) throw new Error(s2); return i(n2.format, n2.encoding || "UTF8", e2)(n2.value); } class E { constructor(t2, n2, e2) { const r2 = e2 || {}; if (this.t = n2, this.i = r2.encoding || "UTF8", this.numRounds = r2.numRounds || 1, isNaN(this.numRounds) || this.numRounds !== parseInt(this.numRounds, 10) || 1 > this.numRounds) throw new Error("numRounds must a integer >= 1"); this.o = t2, this.h = [], this.u = 0, this.l = false, this.A = 0, this.H = false, this.S = [], this.p = []; } update(t2) { let n2, e2 = 0; const r2 = this.m >>> 5, i2 = this.C(t2, this.h, this.u), s2 = i2.binLen, o2 = i2.value, h2 = s2 >>> 5; for (n2 = 0; n2 < h2; n2 += r2) e2 + this.m <= s2 && (this.U = this.v(o2.slice(n2, n2 + r2), this.U), e2 += this.m); return this.A += e2, this.h = o2.slice(e2 >>> 5), this.u = s2 % this.m, this.l = true, this; } getHash(t2, n2) { let e2, r2, i2 = this.R; const o2 = l(n2); if (this.K) { if (-1 === o2.outputLen) throw new Error("Output length must be specified in options"); i2 = o2.outputLen; } const h2 = s(t2, i2, this.T, o2); if (this.H && this.g) return h2(this.g(o2)); for (r2 = this.F(this.h.slice(), this.u, this.A, this.L(this.U), i2), e2 = 1; e2 < this.numRounds; e2 += 1) this.K && i2 % 32 != 0 && (r2[r2.length - 1] &= 16777215 >>> 24 - i2 % 32), r2 = this.F(r2, i2, 0, this.B(this.o), i2); return h2(r2); } setHMACKey(t2, n2, e2) { if (!this.M) throw new Error("Variant does not support HMAC"); if (this.l) throw new Error("Cannot set MAC key after calling update"); const r2 = i(n2, (e2 || {}).encoding || "UTF8", this.T); this.k(r2(t2)); } k(t2) { const n2 = this.m >>> 3, e2 = n2 / 4 - 1; let r2; if (1 !== this.numRounds) throw new Error(f); if (this.H) throw new Error("MAC key already set"); for (n2 < t2.binLen / 8 && (t2.value = this.F(t2.value, t2.binLen, 0, this.B(this.o), this.R)); t2.value.length <= e2; ) t2.value.push(0); for (r2 = 0; r2 <= e2; r2 += 1) this.S[r2] = 909522486 ^ t2.value[r2], this.p[r2] = 1549556828 ^ t2.value[r2]; this.U = this.v(this.S, this.U), this.A = this.m, this.H = true; } getHMAC(t2, n2) { const e2 = l(n2); return s(t2, this.R, this.T, e2)(this.Y()); } Y() { let t2; if (!this.H) throw new Error("Cannot call getHMAC without first setting MAC key"); const n2 = this.F(this.h.slice(), this.u, this.A, this.L(this.U), this.R); return t2 = this.v(this.p, this.B(this.o)), t2 = this.F(n2, this.R, this.m, t2, this.R), t2; } } function H(t2, n2) { return t2 << n2 | t2 >>> 32 - n2; } function S(t2, n2) { return t2 >>> n2 | t2 << 32 - n2; } function b(t2, n2) { return t2 >>> n2; } function p(t2, n2, e2) { return t2 ^ n2 ^ e2; } function d(t2, n2, e2) { return t2 & n2 ^ ~t2 & e2; } function m(t2, n2, e2) { return t2 & n2 ^ t2 & e2 ^ n2 & e2; } function C(t2) { return S(t2, 2) ^ S(t2, 13) ^ S(t2, 22); } function y(t2, n2) { const e2 = (65535 & t2) + (65535 & n2); return (65535 & (t2 >>> 16) + (n2 >>> 16) + (e2 >>> 16)) << 16 | 65535 & e2; } function U(t2, n2, e2, r2) { const i2 = (65535 & t2) + (65535 & n2) + (65535 & e2) + (65535 & r2); return (65535 & (t2 >>> 16) + (n2 >>> 16) + (e2 >>> 16) + (r2 >>> 16) + (i2 >>> 16)) << 16 | 65535 & i2; } function v(t2, n2, e2, r2, i2) { const s2 = (65535 & t2) + (65535 & n2) + (65535 & e2) + (65535 & r2) + (65535 & i2); return (65535 & (t2 >>> 16) + (n2 >>> 16) + (e2 >>> 16) + (r2 >>> 16) + (i2 >>> 16) + (s2 >>> 16)) << 16 | 65535 & s2; } function R(t2) { return S(t2, 7) ^ S(t2, 18) ^ b(t2, 3); } function K(t2) { return S(t2, 6) ^ S(t2, 11) ^ S(t2, 25); } function T(t2) { return [1732584193, 4023233417, 2562383102, 271733878, 3285377520]; } function g(t2, n2) { let e2, r2, i2, s2, o2, h2, u2; const w2 = []; for (e2 = n2[0], r2 = n2[1], i2 = n2[2], s2 = n2[3], o2 = n2[4], u2 = 0; u2 < 80; u2 += 1) w2[u2] = u2 < 16 ? t2[u2] : H(w2[u2 - 3] ^ w2[u2 - 8] ^ w2[u2 - 14] ^ w2[u2 - 16], 1), h2 = u2 < 20 ? v(H(e2, 5), d(r2, i2, s2), o2, 1518500249, w2[u2]) : u2 < 40 ? v(H(e2, 5), p(r2, i2, s2), o2, 1859775393, w2[u2]) : u2 < 60 ? v(H(e2, 5), m(r2, i2, s2), o2, 2400959708, w2[u2]) : v(H(e2, 5), p(r2, i2, s2), o2, 3395469782, w2[u2]), o2 = s2, s2 = i2, i2 = H(r2, 30), r2 = e2, e2 = h2; return n2[0] = y(e2, n2[0]), n2[1] = y(r2, n2[1]), n2[2] = y(i2, n2[2]), n2[3] = y(s2, n2[3]), n2[4] = y(o2, n2[4]), n2; } function F(t2, n2, e2, r2) { let i2; const s2 = 15 + (n2 + 65 >>> 9 << 4), h2 = n2 + e2; for (; t2.length <= s2; ) t2.push(0); for (t2[n2 >>> 5] |= 128 << 24 - n2 % 32, t2[s2] = 4294967295 & h2, t2[s2 - 1] = h2 / o | 0, i2 = 0; i2 < t2.length; i2 += 16) r2 = g(t2.slice(i2, i2 + 16), r2); return r2; } let L = class extends E { constructor(t2, n2, e2) { if ("SHA-1" !== t2) throw new Error(c); super(t2, n2, e2); const r2 = e2 || {}; this.M = true, this.g = this.Y, this.T = -1, this.C = i(this.t, this.i, this.T), this.v = g, this.L = function(t3) { return t3.slice(); }, this.B = T, this.F = F, this.U = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.m = 512, this.R = 160, this.K = false, r2.hmacKey && this.k(A("hmacKey", r2.hmacKey, this.T)); } }; function B(t2) { let n2; return n2 = "SHA-224" == t2 ? u.slice() : w.slice(), n2; } function M(t2, n2) { let e2, r2, i2, s2, o2, u2, w2, c2, f2, a2, l2; const A2 = []; for (e2 = n2[0], r2 = n2[1], i2 = n2[2], s2 = n2[3], o2 = n2[4], u2 = n2[5], w2 = n2[6], c2 = n2[7], l2 = 0; l2 < 64; l2 += 1) A2[l2] = l2 < 16 ? t2[l2] : U(S(E2 = A2[l2 - 2], 17) ^ S(E2, 19) ^ b(E2, 10), A2[l2 - 7], R(A2[l2 - 15]), A2[l2 - 16]), f2 = v(c2, K(o2), d(o2, u2, w2), h[l2], A2[l2]), a2 = y(C(e2), m(e2, r2, i2)), c2 = w2, w2 = u2, u2 = o2, o2 = y(s2, f2), s2 = i2, i2 = r2, r2 = e2, e2 = y(f2, a2); var E2; return n2[0] = y(e2, n2[0]), n2[1] = y(r2, n2[1]), n2[2] = y(i2, n2[2]), n2[3] = y(s2, n2[3]), n2[4] = y(o2, n2[4]), n2[5] = y(u2, n2[5]), n2[6] = y(w2, n2[6]), n2[7] = y(c2, n2[7]), n2; } let k = class extends E { constructor(t2, n2, e2) { if ("SHA-224" !== t2 && "SHA-256" !== t2) throw new Error(c); super(t2, n2, e2); const r2 = e2 || {}; this.g = this.Y, this.M = true, this.T = -1, this.C = i(this.t, this.i, this.T), this.v = M, this.L = function(t3) { return t3.slice(); }, this.B = B, this.F = function(n3, e3, r3, i2) { return function(t3, n4, e4, r4, i3) { let s2, h2; const u2 = 15 + (n4 + 65 >>> 9 << 4), w2 = n4 + e4; for (; t3.length <= u2; ) t3.push(0); for (t3[n4 >>> 5] |= 128 << 24 - n4 % 32, t3[u2] = 4294967295 & w2, t3[u2 - 1] = w2 / o | 0, s2 = 0; s2 < t3.length; s2 += 16) r4 = M(t3.slice(s2, s2 + 16), r4); return h2 = "SHA-224" === i3 ? [r4[0], r4[1], r4[2], r4[3], r4[4], r4[5], r4[6]] : r4, h2; }(n3, e3, r3, i2, t2); }, this.U = B(t2), this.m = 512, this.R = "SHA-224" === t2 ? 224 : 256, this.K = false, r2.hmacKey && this.k(A("hmacKey", r2.hmacKey, this.T)); } }; class Y { constructor(t2, n2) { this.N = t2, this.I = n2; } } function N(t2, n2) { let e2; return n2 > 32 ? (e2 = 64 - n2, new Y(t2.I << n2 | t2.N >>> e2, t2.N << n2 | t2.I >>> e2)) : 0 !== n2 ? (e2 = 32 - n2, new Y(t2.N << n2 | t2.I >>> e2, t2.I << n2 | t2.N >>> e2)) : t2; } function I(t2, n2) { let e2; return n2 < 32 ? (e2 = 32 - n2, new Y(t2.N >>> n2 | t2.I << e2, t2.I >>> n2 | t2.N << e2)) : (e2 = 64 - n2, new Y(t2.I >>> n2 | t2.N << e2, t2.N >>> n2 | t2.I << e2)); } function X(t2, n2) { return new Y(t2.N >>> n2, t2.I >>> n2 | t2.N << 32 - n2); } function z(t2, n2, e2) { return new Y(t2.N & n2.N ^ t2.N & e2.N ^ n2.N & e2.N, t2.I & n2.I ^ t2.I & e2.I ^ n2.I & e2.I); } function x(t2) { const n2 = I(t2, 28), e2 = I(t2, 34), r2 = I(t2, 39); return new Y(n2.N ^ e2.N ^ r2.N, n2.I ^ e2.I ^ r2.I); } function _(t2, n2) { let e2, r2; e2 = (65535 & t2.I) + (65535 & n2.I), r2 = (t2.I >>> 16) + (n2.I >>> 16) + (e2 >>> 16); const i2 = (65535 & r2) << 16 | 65535 & e2; e2 = (65535 & t2.N) + (65535 & n2.N) + (r2 >>> 16), r2 = (t2.N >>> 16) + (n2.N >>> 16) + (e2 >>> 16); return new Y((65535 & r2) << 16 | 65535 & e2, i2); } function O(t2, n2, e2, r2) { let i2, s2; i2 = (65535 & t2.I) + (65535 & n2.I) + (65535 & e2.I) + (65535 & r2.I), s2 = (t2.I >>> 16) + (n2.I >>> 16) + (e2.I >>> 16) + (r2.I >>> 16) + (i2 >>> 16); const o2 = (65535 & s2) << 16 | 65535 & i2; i2 = (65535 & t2.N) + (65535 & n2.N) + (65535 & e2.N) + (65535 & r2.N) + (s2 >>> 16), s2 = (t2.N >>> 16) + (n2.N >>> 16) + (e2.N >>> 16) + (r2.N >>> 16) + (i2 >>> 16); return new Y((65535 & s2) << 16 | 65535 & i2, o2); } function P(t2, n2, e2, r2, i2) { let s2, o2; s2 = (65535 & t2.I) + (65535 & n2.I) + (65535 & e2.I) + (65535 & r2.I) + (65535 & i2.I), o2 = (t2.I >>> 16) + (n2.I >>> 16) + (e2.I >>> 16) + (r2.I >>> 16) + (i2.I >>> 16) + (s2 >>> 16); const h2 = (65535 & o2) << 16 | 65535 & s2; s2 = (65535 & t2.N) + (65535 & n2.N) + (65535 & e2.N) + (65535 & r2.N) + (65535 & i2.N) + (o2 >>> 16), o2 = (t2.N >>> 16) + (n2.N >>> 16) + (e2.N >>> 16) + (r2.N >>> 16) + (i2.N >>> 16) + (s2 >>> 16); return new Y((65535 & o2) << 16 | 65535 & s2, h2); } function V(t2, n2) { return new Y(t2.N ^ n2.N, t2.I ^ n2.I); } function Z(t2) { const n2 = I(t2, 19), e2 = I(t2, 61), r2 = X(t2, 6); return new Y(n2.N ^ e2.N ^ r2.N, n2.I ^ e2.I ^ r2.I); } function j(t2) { const n2 = I(t2, 1), e2 = I(t2, 8), r2 = X(t2, 7); return new Y(n2.N ^ e2.N ^ r2.N, n2.I ^ e2.I ^ r2.I); } function q(t2) { const n2 = I(t2, 14), e2 = I(t2, 18), r2 = I(t2, 41); return new Y(n2.N ^ e2.N ^ r2.N, n2.I ^ e2.I ^ r2.I); } const D = [new Y(h[0], 3609767458), new Y(h[1], 602891725), new Y(h[2], 3964484399), new Y(h[3], 2173295548), new Y(h[4], 4081628472), new Y(h[5], 3053834265), new Y(h[6], 2937671579), new Y(h[7], 3664609560), new Y(h[8], 2734883394), new Y(h[9], 1164996542), new Y(h[10], 1323610764), new Y(h[11], 3590304994), new Y(h[12], 4068182383), new Y(h[13], 991336113), new Y(h[14], 633803317), new Y(h[15], 3479774868), new Y(h[16], 2666613458), new Y(h[17], 944711139), new Y(h[18], 2341262773), new Y(h[19], 2007800933), new Y(h[20], 1495990901), new Y(h[21], 1856431235), new Y(h[22], 3175218132), new Y(h[23], 2198950837), new Y(h[24], 3999719339), new Y(h[25], 766784016), new Y(h[26], 2566594879), new Y(h[27], 3203337956), new Y(h[28], 1034457026), new Y(h[29], 2466948901), new Y(h[30], 3758326383), new Y(h[31], 168717936), new Y(h[32], 1188179964), new Y(h[33], 1546045734), new Y(h[34], 1522805485), new Y(h[35], 2643833823), new Y(h[36], 2343527390), new Y(h[37], 1014477480), new Y(h[38], 1206759142), new Y(h[39], 344077627), new Y(h[40], 1290863460), new Y(h[41], 3158454273), new Y(h[42], 3505952657), new Y(h[43], 106217008), new Y(h[44], 3606008344), new Y(h[45], 1432725776), new Y(h[46], 1467031594), new Y(h[47], 851169720), new Y(h[48], 3100823752), new Y(h[49], 1363258195), new Y(h[50], 3750685593), new Y(h[51], 3785050280), new Y(h[52], 3318307427), new Y(h[53], 3812723403), new Y(h[54], 2003034995), new Y(h[55], 3602036899), new Y(h[56], 1575990012), new Y(h[57], 1125592928), new Y(h[58], 2716904306), new Y(h[59], 442776044), new Y(h[60], 593698344), new Y(h[61], 3733110249), new Y(h[62], 2999351573), new Y(h[63], 3815920427), new Y(3391569614, 3928383900), new Y(3515267271, 566280711), new Y(3940187606, 3454069534), new Y(4118630271, 4000239992), new Y(116418474, 1914138554), new Y(174292421, 2731055270), new Y(289380356, 3203993006), new Y(460393269, 320620315), new Y(685471733, 587496836), new Y(852142971, 1086792851), new Y(1017036298, 365543100), new Y(1126000580, 2618297676), new Y(1288033470, 3409855158), new Y(1501505948, 4234509866), new Y(1607167915, 987167468), new Y(1816402316, 1246189591)]; function G(t2) { return "SHA-384" === t2 ? [new Y(3418070365, u[0]), new Y(1654270250, u[1]), new Y(2438529370, u[2]), new Y(355462360, u[3]), new Y(1731405415, u[4]), new Y(41048885895, u[5]), new Y(3675008525, u[6]), new Y(1203062813, u[7])] : [new Y(w[0], 4089235720), new Y(w[1], 2227873595), new Y(w[2], 4271175723), new Y(w[3], 1595750129), new Y(w[4], 2917565137), new Y(w[5], 725511199), new Y(w[6], 4215389547), new Y(w[7], 327033209)]; } function J(t2, n2) { let e2, r2, i2, s2, o2, h2, u2, w2, c2, f2, a2, l2; const A2 = []; for (e2 = n2[0], r2 = n2[1], i2 = n2[2], s2 = n2[3], o2 = n2[4], h2 = n2[5], u2 = n2[6], w2 = n2[7], a2 = 0; a2 < 80; a2 += 1) a2 < 16 ? (l2 = 2 * a2, A2[a2] = new Y(t2[l2], t2[l2 + 1])) : A2[a2] = O(Z(A2[a2 - 2]), A2[a2 - 7], j(A2[a2 - 15]), A2[a2 - 16]), c2 = P(w2, q(o2), (H2 = h2, S2 = u2, new Y((E2 = o2).N & H2.N ^ ~E2.N & S2.N, E2.I & H2.I ^ ~E2.I & S2.I)), D[a2], A2[a2]), f2 = _(x(e2), z(e2, r2, i2)), w2 = u2, u2 = h2, h2 = o2, o2 = _(s2, c2), s2 = i2, i2 = r2, r2 = e2, e2 = _(c2, f2); var E2, H2, S2; return n2[0] = _(e2, n2[0]), n2[1] = _(r2, n2[1]), n2[2] = _(i2, n2[2]), n2[3] = _(s2, n2[3]), n2[4] = _(o2, n2[4]), n2[5] = _(h2, n2[5]), n2[6] = _(u2, n2[6]), n2[7] = _(w2, n2[7]), n2; } let Q = class extends E { constructor(t2, n2, e2) { if ("SHA-384" !== t2 && "SHA-512" !== t2) throw new Error(c); super(t2, n2, e2); const r2 = e2 || {}; this.g = this.Y, this.M = true, this.T = -1, this.C = i(this.t, this.i, this.T), this.v = J, this.L = function(t3) { return t3.slice(); }, this.B = G, this.F = function(n3, e3, r3, i2) { return function(t3, n4, e4, r4, i3) { let s2, h2; const u2 = 31 + (n4 + 129 >>> 10 << 5), w2 = n4 + e4; for (; t3.length <= u2; ) t3.push(0); for (t3[n4 >>> 5] |= 128 << 24 - n4 % 32, t3[u2] = 4294967295 & w2, t3[u2 - 1] = w2 / o | 0, s2 = 0; s2 < t3.length; s2 += 32) r4 = J(t3.slice(s2, s2 + 32), r4); return h2 = "SHA-384" === i3 ? [r4[0].N, r4[0].I, r4[1].N, r4[1].I, r4[2].N, r4[2].I, r4[3].N, r4[3].I, r4[4].N, r4[4].I, r4[5].N, r4[5].I] : [r4[0].N, r4[0].I, r4[1].N, r4[1].I, r4[2].N, r4[2].I, r4[3].N, r4[3].I, r4[4].N, r4[4].I, r4[5].N, r4[5].I, r4[6].N, r4[6].I, r4[7].N, r4[7].I], h2; }(n3, e3, r3, i2, t2); }, this.U = G(t2), this.m = 1024, this.R = "SHA-384" === t2 ? 384 : 512, this.K = false, r2.hmacKey && this.k(A("hmacKey", r2.hmacKey, this.T)); } }; const W = [new Y(0, 1), new Y(0, 32898), new Y(2147483648, 32906), new Y(2147483648, 2147516416), new Y(0, 32907), new Y(0, 2147483649), new Y(2147483648, 2147516545), new Y(2147483648, 32777), new Y(0, 138), new Y(0, 136), new Y(0, 2147516425), new Y(0, 2147483658), new Y(0, 2147516555), new Y(2147483648, 139), new Y(2147483648, 32905), new Y(2147483648, 32771), new Y(2147483648, 32770), new Y(2147483648, 128), new Y(0, 32778), new Y(2147483648, 2147483658), new Y(2147483648, 2147516545), new Y(2147483648, 32896), new Y(0, 2147483649), new Y(2147483648, 2147516424)], $ = [[0, 36, 3, 41, 18], [1, 44, 10, 45, 2], [62, 6, 43, 15, 61], [28, 55, 25, 21, 56], [27, 20, 39, 8, 14]]; function tt(t2) { let n2; const e2 = []; for (n2 = 0; n2 < 5; n2 += 1) e2[n2] = [new Y(0, 0), new Y(0, 0), new Y(0, 0), new Y(0, 0), new Y(0, 0)]; return e2; } function nt(t2) { let n2; const e2 = []; for (n2 = 0; n2 < 5; n2 += 1) e2[n2] = t2[n2].slice(); return e2; } function et(t2, n2) { let e2, r2, i2, s2; const o2 = [], h2 = []; if (null !== t2) for (r2 = 0; r2 < t2.length; r2 += 2) n2[(r2 >>> 1) % 5][(r2 >>> 1) / 5 | 0] = V(n2[(r2 >>> 1) % 5][(r2 >>> 1) / 5 | 0], new Y(t2[r2 + 1], t2[r2])); for (e2 = 0; e2 < 24; e2 += 1) { for (s2 = tt(), r2 = 0; r2 < 5; r2 += 1) o2[r2] = (u2 = n2[r2][0], w2 = n2[r2][1], c2 = n2[r2][2], f2 = n2[r2][3], a2 = n2[r2][4], new Y(u2.N ^ w2.N ^ c2.N ^ f2.N ^ a2.N, u2.I ^ w2.I ^ c2.I ^ f2.I ^ a2.I)); for (r2 = 0; r2 < 5; r2 += 1) h2[r2] = V(o2[(r2 + 4) % 5], N(o2[(r2 + 1) % 5], 1)); for (r2 = 0; r2 < 5; r2 += 1) for (i2 = 0; i2 < 5; i2 += 1) n2[r2][i2] = V(n2[r2][i2], h2[r2]); for (r2 = 0; r2 < 5; r2 += 1) for (i2 = 0; i2 < 5; i2 += 1) s2[i2][(2 * r2 + 3 * i2) % 5] = N(n2[r2][i2], $[r2][i2]); for (r2 = 0; r2 < 5; r2 += 1) for (i2 = 0; i2 < 5; i2 += 1) n2[r2][i2] = V(s2[r2][i2], new Y(~s2[(r2 + 1) % 5][i2].N & s2[(r2 + 2) % 5][i2].N, ~s2[(r2 + 1) % 5][i2].I & s2[(r2 + 2) % 5][i2].I)); n2[0][0] = V(n2[0][0], W[e2]); } var u2, w2, c2, f2, a2; return n2; } function rt(t2) { let n2, e2, r2 = 0; const i2 = [0, 0], s2 = [4294967295 & t2, t2 / o & 2097151]; for (n2 = 6; n2 >= 0; n2--) e2 = s2[n2 >> 2] >>> 8 * n2 & 255, 0 === e2 && 0 === r2 || (i2[r2 + 1 >> 2] |= e2 << 8 * (r2 + 1), r2 += 1); return r2 = 0 !== r2 ? r2 : 1, i2[0] |= r2, { value: r2 + 1 > 4 ? i2 : [i2[0]], binLen: 8 + 8 * r2 }; } function it(t2) { return a(rt(t2.binLen), t2); } function st(t2, n2) { let e2, r2 = rt(n2); r2 = a(r2, t2); const i2 = n2 >>> 2, s2 = (i2 - r2.value.length % i2) % i2; for (e2 = 0; e2 < s2; e2++) r2.value.push(0); return r2.value; } let ot = class extends E { constructor(t2, n2, e2) { let r2 = 6, s2 = 0; super(t2, n2, e2); const o2 = e2 || {}; if (1 !== this.numRounds) { if (o2.kmacKey || o2.hmacKey) throw new Error(f); if ("CSHAKE128" === this.o || "CSHAKE256" === this.o) throw new Error("Cannot set numRounds for CSHAKE variants"); } switch (this.T = 1, this.C = i(this.t, this.i, this.T), this.v = et, this.L = nt, this.B = tt, this.U = tt(), this.K = false, t2) { case "SHA3-224": this.m = s2 = 1152, this.R = 224, this.M = true, this.g = this.Y; break; case "SHA3-256": this.m = s2 = 1088, this.R = 256, this.M = true, this.g = this.Y; break; case "SHA3-384": this.m = s2 = 832, this.R = 384, this.M = true, this.g = this.Y; break; case "SHA3-512": this.m = s2 = 576, this.R = 512, this.M = true, this.g = this.Y; break; case "SHAKE128": r2 = 31, this.m = s2 = 1344, this.R = -1, this.K = true, this.M = false, this.g = null; break; case "SHAKE256": r2 = 31, this.m = s2 = 1088, this.R = -1, this.K = true, this.M = false, this.g = null; break; case "KMAC128": r2 = 4, this.m = s2 = 1344, this.X(e2), this.R = -1, this.K = true, this.M = false, this.g = this._; break; case "KMAC256": r2 = 4, this.m = s2 = 1088, this.X(e2), this.R = -1, this.K = true, this.M = false, this.g = this._; break; case "CSHAKE128": this.m = s2 = 1344, r2 = this.O(e2), this.R = -1, this.K = true, this.M = false, this.g = null; break; case "CSHAKE256": this.m = s2 = 1088, r2 = this.O(e2), this.R = -1, this.K = true, this.M = false, this.g = null; break; default: throw new Error(c); } this.F = function(t3, n3, e3, i2, o3) { return function(t4, n4, e4, r3, i3, s3, o4) { let h2, u2, w2 = 0; const c2 = [], f2 = i3 >>> 5, a2 = n4 >>> 5; for (h2 = 0; h2 < a2 && n4 >= i3; h2 += f2) r3 = et(t4.slice(h2, h2 + f2), r3), n4 -= i3; for (t4 = t4.slice(h2), n4 %= i3; t4.length < f2; ) t4.push(0); for (h2 = n4 >>> 3, t4[h2 >> 2] ^= s3 << h2 % 4 * 8, t4[f2 - 1] ^= 2147483648, r3 = et(t4, r3); 32 * c2.length < o4 && (u2 = r3[w2 % 5][w2 / 5 | 0], c2.push(u2.I), !(32 * c2.length >= o4)); ) c2.push(u2.N), w2 += 1, 0 == 64 * w2 % i3 && (et(null, r3), w2 = 0); return c2; }(t3, n3, 0, i2, s2, r2, o3); }, o2.hmacKey && this.k(A("hmacKey", o2.hmacKey, this.T)); } O(t2, n2) { const e2 = function(t3) { const n3 = t3 || {}; return { funcName: A("funcName", n3.funcName, 1, { value: [], binLen: 0 }), customization: A("Customization", n3.customization, 1, { value: [], binLen: 0 }) }; }(t2 || {}); n2 && (e2.funcName = n2); const r2 = a(it(e2.funcName), it(e2.customization)); if (0 !== e2.customization.binLen || 0 !== e2.funcName.binLen) { const t3 = st(r2, this.m >>> 3); for (let n3 = 0; n3 < t3.length; n3 += this.m >>> 5) this.U = this.v(t3.slice(n3, n3 + (this.m >>> 5)), this.U), this.A += this.m; return 4; } return 31; } X(t2) { const n2 = function(t3) { const n3 = t3 || {}; return { kmacKey: A("kmacKey", n3.kmacKey, 1), funcName: { value: [1128353099], binLen: 32 }, customization: A("Customization", n3.customization, 1, { value: [], binLen: 0 }) }; }(t2 || {}); this.O(t2, n2.funcName); const e2 = st(it(n2.kmacKey), this.m >>> 3); for (let t3 = 0; t3 < e2.length; t3 += this.m >>> 5) this.U = this.v(e2.slice(t3, t3 + (this.m >>> 5)), this.U), this.A += this.m; this.H = true; } _(t2) { const n2 = a({ value: this.h.slice(), binLen: this.u }, function(t3) { let n3, e2, r2 = 0; const i2 = [0, 0], s2 = [4294967295 & t3, t3 / o & 2097151]; for (n3 = 6; n3 >= 0; n3--) e2 = s2[n3 >> 2] >>> 8 * n3 & 255, 0 === e2 && 0 === r2 || (i2[r2 >> 2] |= e2 << 8 * r2, r2 += 1); return r2 = 0 !== r2 ? r2 : 1, i2[r2 >> 2] |= r2 << 8 * r2, { value: r2 + 1 > 4 ? i2 : [i2[0]], binLen: 8 + 8 * r2 }; }(t2.outputLen)); return this.F(n2.value, n2.binLen, this.A, this.L(this.U), t2.outputLen); } }; class ht { constructor(t2, n2, e2) { if ("SHA-1" == t2) this.P = new L(t2, n2, e2); else if ("SHA-224" == t2 || "SHA-256" == t2) this.P = new k(t2, n2, e2); else if ("SHA-384" == t2 || "SHA-512" == t2) this.P = new Q(t2, n2, e2); else { if ("SHA3-224" != t2 && "SHA3-256" != t2 && "SHA3-384" != t2 && "SHA3-512" != t2 && "SHAKE128" != t2 && "SHAKE256" != t2 && "CSHAKE128" != t2 && "CSHAKE256" != t2 && "KMAC128" != t2 && "KMAC256" != t2) throw new Error(c); this.P = new ot(t2, n2, e2); } } update(t2) { return this.P.update(t2), this; } getHash(t2, n2) { return this.P.getHash(t2, n2); } setHMACKey(t2, n2, e2) { this.P.setHMACKey(t2, n2, e2); } getHMAC(t2, n2) { return this.P.getHMAC(t2, n2); } } const globalScope = (() => { if (typeof globalThis === "object") return globalThis; else { Object.defineProperty(Object.prototype, "__GLOBALTHIS__", { get() { return this; }, configurable: true }); try { if (typeof __GLOBALTHIS__ !== "undefined") return __GLOBALTHIS__; } finally { delete Object.prototype.__GLOBALTHIS__; } } if (typeof self !== "undefined") return self; else if (typeof window !== "undefined") return window; else if (typeof global !== "undefined") return global; return void 0; })(); const OPENSSL_JSSHA_ALGO_MAP = { SHA1: "SHA-1", SHA224: "SHA-224", SHA256: "SHA-256", SHA384: "SHA-384", SHA512: "SHA-512", "SHA3-224": "SHA3-224", "SHA3-256": "SHA3-256", "SHA3-384": "SHA3-384", "SHA3-512": "SHA3-512" }; const hmacDigest = (algorithm, key, message) => { { const variant = OPENSSL_JSSHA_ALGO_MAP[algorithm.toUpperCase()]; if (typeof variant === "undefined") { throw new TypeError("Unknown hash function"); } const hmac = new ht(variant, "ARRAYBUFFER"); hmac.setHMACKey(key, "ARRAYBUFFER"); hmac.update(message); return hmac.getHMAC("ARRAYBUFFER"); } }; const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; const base32ToBuf = (str) => { let end = str.length; while (str[end - 1] === "=") --end; const cstr = (end < str.length ? str.substring(0, end) : str).toUpperCase(); const buf = new ArrayBuffer(cstr.length * 5 / 8 | 0); const arr = new Uint8Array(buf); let bits = 0; let value = 0; let index = 0; for (let i2 = 0; i2 < cstr.length; i2++) { const idx = ALPHABET.indexOf(cstr[i2]); if (idx === -1) throw new TypeError(`Invalid character found: ${cstr[i2]}`); value = value << 5 | idx; bits += 5; if (bits >= 8) { bits -= 8; arr[index++] = value >>> bits; } } return buf; }; const base32FromBuf = (buf) => { const arr = new Uint8Array(buf); let bits = 0; let value = 0; let str = ""; for (let i2 = 0; i2 < arr.length; i2++) { value = value << 8 | arr[i2]; bits += 8; while (bits >= 5) { str += ALPHABET[value >>> bits - 5 & 31]; bits -= 5; } } if (bits > 0) { str += ALPHABET[value << 5 - bits & 31]; } return str; }; const hexToBuf = (str) => { const buf = new ArrayBuffer(str.length / 2); const arr = new Uint8Array(buf); for (let i2 = 0; i2 < str.length; i2 += 2) { arr[i2 / 2] = parseInt(str.substring(i2, i2 + 2), 16); } return buf; }; const hexFromBuf = (buf) => { const arr = new Uint8Array(buf); let str = ""; for (let i2 = 0; i2 < arr.length; i2++) { const hex = arr[i2].toString(16); if (hex.length === 1) str += "0"; str += hex; } return str.toUpperCase(); }; const latin1ToBuf = (str) => { const buf = new ArrayBuffer(str.length); const arr = new Uint8Array(buf); for (let i2 = 0; i2 < str.length; i2++) { arr[i2] = str.charCodeAt(i2) & 255; } return buf; }; const latin1FromBuf = (buf) => { const arr = new Uint8Array(buf); let str = ""; for (let i2 = 0; i2 < arr.length; i2++) { str += String.fromCharCode(arr[i2]); } return str; }; const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder("utf-8") : null; const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder("utf-8") : null; const utf8ToBuf = (str) => { if (!ENCODER) { throw new Error("Encoding API not available"); } return ENCODER.encode(str).buffer; }; const utf8FromBuf = (buf) => { if (!DECODER) { throw new Error("Encoding API not available"); } return DECODER.decode(buf); }; const randomBytes = (size) => { var _a; { if (!((_a = globalScope.crypto) == null ? void 0 : _a.getRandomValues)) { throw new Error("Cryptography API not available"); } return globalScope.crypto.getRandomValues(new Uint8Array(size)).buffer; } }; class Secret { /** * Creates a secret key object. * @param {Object} [config] Configuration options. * @param {ArrayBuffer} [config.buffer=randomBytes] Secret key. * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided. */ constructor({ buffer, size = 20 } = {}) { this.buffer = typeof buffer === "undefined" ? randomBytes(size) : buffer; } /** * Converts a Latin-1 string to a Secret object. * @param {string} str Latin-1 string. * @returns {Secret} Secret object. */ static fromLatin1(str) { return new Secret({ buffer: latin1ToBuf(str) }); } /** * Converts an UTF-8 string to a Secret object. * @param {string} str UTF-8 string. * @returns {Secret} Secret object. */ static fromUTF8(str) { return new Secret({ buffer: utf8ToBuf(str) }); } /** * Converts a base32 string to a Secret object. * @param {string} str Base32 string. * @returns {Secret} Secret object. */ static fromBase32(str) { return new Secret({ buffer: base32ToBuf(str) }); } /** * Converts a hexadecimal string to a Secret object. * @param {string} str Hexadecimal string. * @returns {Secret} Secret object. */ static fromHex(str) { return new Secret({ buffer: hexToBuf(str) }); } /** * Latin-1 string representation of secret key. * @type {string} */ get latin1() { Object.defineProperty(this, "latin1", { enumerable: true, value: latin1FromBuf(this.buffer) }); return this.latin1; } /** * UTF-8 string representation of secret key. * @type {string} */ get utf8() { Object.defineProperty(this, "utf8", { enumerable: true, value: utf8FromBuf(this.buffer) }); return this.utf8; } /** * Base32 string representation of secret key. * @type {string} */ get base32() { Object.defineProperty(this, "base32", { enumerable: true, value: base32FromBuf(this.buffer) }); return this.base32; } /** * Hexadecimal string representation of secret key. * @type {string} */ get hex() { Object.defineProperty(this, "hex", { enumerable: true, value: hexFromBuf(this.buffer) }); return this.hex; } } const timingSafeEqual = (a2, b2) => { { if (a2.length !== b2.length) { throw new TypeError("Input strings must have the same length"); } let i2 = -1; let out = 0; while (++i2 < a2.length) { out |= a2.charCodeAt(i2) ^ b2.charCodeAt(i2); } return out === 0; } }; class HOTP { /** * Default configuration. * @type {{ * issuer: string, * label: string, * issuerInLabel: boolean, * algorithm: string, * digits: number, * counter: number * window: number * }} */ static get defaults() { return { issuer: "", label: "OTPAuth", issuerInLabel: true, algorithm: "SHA1", digits: 6, counter: 0, window: 1 }; } /** * Creates an HOTP object. * @param {Object} [config] Configuration options. * @param {string} [config.issuer=''] Account provider. * @param {string} [config.label='OTPAuth'] Account label. * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label. * @param {Secret|string} [config.secret=Secret] Secret key. * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm. * @param {number} [config.digits=6] Token length. * @param {number} [config.counter=0] Initial counter value. */ constructor({ issuer = HOTP.defaults.issuer, label = HOTP.defaults.label, issuerInLabel = HOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter } = {}) { this.issuer = issuer; this.label = label; this.issuerInLabel = issuerInLabel; this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret; this.algorithm = algorithm.toUpperCase(); this.digits = digits; this.counter = counter; } /** * Generates an HOTP token. * @param {Object} config Configuration options. * @param {Secret} config.secret Secret key. * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm. * @param {number} [config.digits=6] Token length. * @param {number} [config.counter=0] Counter value. * @returns {string} Token. */ static generate({ secret, algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter }) { const digest = new Uint8Array(hmacDigest(algorithm, secret.buffer, uintToBuf(counter))); const offset = digest[digest.byteLength - 1] & 15; const otp = ((digest[offset] & 127) << 24 | (digest[offset + 1] & 255) << 16 | (digest[offset + 2] & 255) << 8 | digest[offset + 3] & 255) % 10 ** digits; return otp.toString().padStart(digits, "0"); } /** * Generates an HOTP token. * @param {Object} [config] Configuration options. * @param {number} [config.counter=this.counter++] Counter value. * @returns {string} Token. */ generate({ counter = this.counter++ } = {}) { return HOTP.generate({ secret: this.secret, algorithm: this.algorithm, digits: this.digits, counter }); } /** * Validates an HOTP token. * @param {Object} config Configuration options. * @param {string} config.token Token value. * @param {Secret} config.secret Secret key. * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm. * @param {number} config.digits Token length. * @param {number} [config.counter=0] Counter value. * @param {number} [config.window=1] Window of counter values to test. * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid. */ static validate({ token, secret, algorithm, digits, counter = HOTP.defaults.counter, window: window2 = HOTP.defaults.window }) { if (token.length !== digits) return null; let delta = null; for (let i2 = counter - window2; i2 <= counter + window2; ++i2) { const generatedToken = HOTP.generate({ secret, algorithm, digits, counter: i2 }); if (timingSafeEqual(token, generatedToken)) { delta = i2 - counter; } } return delta; } /** * Validates an HOTP token. * @param {Object} config Configuration options. * @param {string} config.token Token value. * @param {number} [config.counter=this.counter] Counter value. * @param {number} [config.window=1] Window of counter values to test. * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid. */ validate({ token, counter = this.counter, window: window2 }) { return HOTP.validate({ token, secret: this.secret, algorithm: this.algorithm, digits: this.digits, counter, window: window2 }); } /** * Returns a Google Authenticator key URI. * @returns {string} URI. */ toString() { const e2 = encodeURIComponent; return `otpauth://hotp/${this.issuer.length > 0 ? this.issuerInLabel ? `${e2(this.issuer)}:${e2(this.label)}?issuer=${e2(this.issuer)}&` : `${e2(this.label)}?issuer=${e2(this.issuer)}&` : `${e2(this.label)}?`}secret=${e2(this.secret.base32)}&algorithm=${e2(this.algorithm)}&digits=${e2(this.digits)}&counter=${e2(this.counter)}`; } } class TOTP { /** * Default configuration. * @type {{ * issuer: string, * label: string, * issuerInLabel: boolean, * algorithm: string, * digits: number, * period: number * window: number * }} */ static get defaults() { return { issuer: "", label: "OTPAuth", issuerInLabel: true, algorithm: "SHA1", digits: 6, period: 30, window: 1 }; } /** * Creates a TOTP object. * @param {Object} [config] Configuration options. * @param {string} [config.issuer=''] Account provider. * @param {string} [config.label='OTPAuth'] Account label. * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label. * @param {Secret|string} [config.secret=Secret] Secret key. * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm. * @param {number} [config.digits=6] Token length. * @param {number} [config.period=30] Token time-step duration. */ constructor({ issuer = TOTP.defaults.issuer, label = TOTP.defaults.label, issuerInLabel = TOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = TOTP.defaults.algorithm, digits = TOTP.defaults.digits, period = TOTP.defaults.period } = {}) { this.issuer = issuer; this.label = label; this.issuerInLabel = issuerInLabel; this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret; this.algorithm = algorithm.toUpperCase(); this.digits = digits; this.period = period; } /** * Generates a TOTP token. * @param {Object} config Configuration options. * @param {Secret} config.secret Secret key. * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm. * @param {number} [config.digits=6] Token length. * @param {number} [config.period=30] Token time-step duration. * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds. * @returns {string} Token. */ static generate({ secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now() }) { return HOTP.generate({ secret, algorithm, digits, counter: Math.floor(timestamp / 1e3 / period) }); } /** * Generates a TOTP token. * @param {Object} [config] Configuration options. * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds. * @returns {string} Token. */ generate({ timestamp = Date.now() } = {}) { return TOTP.generate({ secret: this.secret, algorithm: this.algorithm, digits: this.digits, period: this.period, timestamp }); } /** * Validates a TOTP token. * @param {Object} config Configuration options. * @param {string} config.token Token value. * @param {Secret} config.secret Secret key. * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm. * @param {number} config.digits Token length. * @param {number} [config.period=30] Token time-step duration. * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds. * @param {number} [config.window=1] Window of counter values to test. * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid. */ static validate({ token, secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), window: window2 }) { return HOTP.validate({ token, secret, algorithm, digits, counter: Math.floor(timestamp / 1e3 / period), window: window2 }); } /** * Validates a TOTP token. * @param {Object} config Configuration options. * @param {string} config.token Token value. * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds. * @param {number} [config.window=1] Window of counter values to test. * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid. */ validate({ token, timestamp, window: window2 }) { return TOTP.validate({ token, secret: this.secret, algorithm: this.algorithm, digits: this.digits, period: this.period, timestamp, window: window2 }); } /** * Returns a Google Authenticator key URI. * @returns {string} URI. */ toString() { const e2 = encodeURIComponent; return `otpauth://totp/${this.issuer.length > 0 ? this.issuerInLabel ? `${e2(this.issuer)}:${e2(this.label)}?issuer=${e2(this.issuer)}&` : `${e2(this.label)}?issuer=${e2(this.issuer)}&` : `${e2(this.label)}?`}secret=${e2(this.secret.base32)}&algorithm=${e2(this.algorithm)}&digits=${e2(this.digits)}&period=${e2(this.period)}`; } } const migration = _GM_getValue("otpauth.migration"); const totpList = []; migration.split("\n").forEach((line) => { if (line.trim().length > 0) { totpList.push( ...toOTPAuthURIs(line).map((uri) => { const url = new URL(uri); return new TOTP({ issuer: url.searchParams.get("issuer") || decodeURIComponent( url.pathname.substring(url.pathname.lastIndexOf("/") + 1) ), algorithm: url.searchParams.get("algorithm") || "SHA1", digits: parseInt(url.searchParams.get("digits") || "6"), period: parseInt(url.searchParams.get("period") || "30"), secret: url.searchParams.get("secret") || "" }); }) ); } }); const main = new Promise(() => { const menuId = []; const refresh = () => { menuId.forEach((id) => _GM_unregisterMenuCommand(id)); totpList.forEach((totp) => { menuId.push( _GM_registerMenuCommand(totp.issuer, () => { _GM_setClipboard(totp.generate(), "text"); }) ); }); }; const next = () => { const now = /* @__PURE__ */ new Date(); const seconds = now.getSeconds(); const next2 = seconds < 30 ? 30 : 60; return new Date(now.getTime() + (next2 - seconds) * 1e3); }; const timer = () => { refresh(); setTimeout(timer, next().getTime() - (/* @__PURE__ */ new Date()).getTime()); }; timer(); }); return main; }); return window.monkey;