// ==UserScript== // @name Bilibili 旧播放页 // @namespace MotooriKashin // @version 10.0.9-6b79f673c9d56093e8cf35943da14b35be3e4155 // @description 恢复Bilibili旧版页面,为了那些念旧的人。 // @author MotooriKashin, wly5556 // @homepage https://github.com/MotooriKashin/Bilibili-Old // @supportURL https://github.com/MotooriKashin/Bilibili-Old/issues // @icon https://www.bilibili.com/favicon.ico // @match *://*.bilibili.com/* // @connect * // @grant GM.xmlHttpRequest // @grant GM.getValue // @grant GM.setValue // @grant GM.deleteValue // @grant GM.cookie // @run-at document-start // @license MIT // @downloadURL none // ==/UserScript== const MODULES = ` var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __commonJS = (cb, mod2) => function __require() { return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports; }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps( isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target, mod2 )); var __publicField = (obj, key, value) => { __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); return value; }; // node_modules/crypt/crypt.js var require_crypt = __commonJS({ "node_modules/crypt/crypt.js"(exports2, module2) { (function() { var base64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", crypt = { rotl: function(n, b) { return n << b | n >>> 32 - b; }, rotr: function(n, b) { return n << 32 - b | n >>> b; }, endian: function(n) { if (n.constructor == Number) { return crypt.rotl(n, 8) & 16711935 | crypt.rotl(n, 24) & 4278255360; } for (var i = 0; i < n.length; i++) n[i] = crypt.endian(n[i]); return n; }, randomBytes: function(n) { for (var bytes = []; n > 0; n--) bytes.push(Math.floor(Math.random() * 256)); return bytes; }, bytesToWords: function(bytes) { for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8) words[b >>> 5] |= bytes[i] << 24 - b % 32; return words; }, wordsToBytes: function(words) { for (var bytes = [], b = 0; b < words.length * 32; b += 8) bytes.push(words[b >>> 5] >>> 24 - b % 32 & 255); return bytes; }, bytesToHex: function(bytes) { for (var hex = [], i = 0; i < bytes.length; i++) { hex.push((bytes[i] >>> 4).toString(16)); hex.push((bytes[i] & 15).toString(16)); } return hex.join(""); }, hexToBytes: function(hex) { for (var bytes = [], c = 0; c < hex.length; c += 2) bytes.push(parseInt(hex.substr(c, 2), 16)); return bytes; }, bytesToBase64: function(bytes) { for (var base64 = [], i = 0; i < bytes.length; i += 3) { var triplet = bytes[i] << 16 | bytes[i + 1] << 8 | bytes[i + 2]; for (var j = 0; j < 4; j++) if (i * 8 + j * 6 <= bytes.length * 8) base64.push(base64map.charAt(triplet >>> 6 * (3 - j) & 63)); else base64.push("="); } return base64.join(""); }, base64ToBytes: function(base64) { base64 = base64.replace(/[^A-Z0-9+\\/]/ig, ""); for (var bytes = [], i = 0, imod4 = 0; i < base64.length; imod4 = ++i % 4) { if (imod4 == 0) continue; bytes.push((base64map.indexOf(base64.charAt(i - 1)) & Math.pow(2, -2 * imod4 + 8) - 1) << imod4 * 2 | base64map.indexOf(base64.charAt(i)) >>> 6 - imod4 * 2); } return bytes; } }; module2.exports = crypt; })(); } }); // node_modules/charenc/charenc.js var require_charenc = __commonJS({ "node_modules/charenc/charenc.js"(exports2, module2) { var charenc = { utf8: { stringToBytes: function(str) { return charenc.bin.stringToBytes(unescape(encodeURIComponent(str))); }, bytesToString: function(bytes) { return decodeURIComponent(escape(charenc.bin.bytesToString(bytes))); } }, bin: { stringToBytes: function(str) { for (var bytes = [], i = 0; i < str.length; i++) bytes.push(str.charCodeAt(i) & 255); return bytes; }, bytesToString: function(bytes) { for (var str = [], i = 0; i < bytes.length; i++) str.push(String.fromCharCode(bytes[i])); return str.join(""); } } }; module2.exports = charenc; } }); // node_modules/is-buffer/index.js var require_is_buffer = __commonJS({ "node_modules/is-buffer/index.js"(exports2, module2) { module2.exports = function(obj) { return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer); }; function isBuffer(obj) { return !!obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj); } function isSlowBuffer(obj) { return typeof obj.readFloatLE === "function" && typeof obj.slice === "function" && isBuffer(obj.slice(0, 0)); } } }); // node_modules/md5/md5.js var require_md5 = __commonJS({ "node_modules/md5/md5.js"(exports2, module2) { (function() { var crypt = require_crypt(), utf8 = require_charenc().utf8, isBuffer = require_is_buffer(), bin = require_charenc().bin, md52 = function(message, options) { if (message.constructor == String) if (options && options.encoding === "binary") message = bin.stringToBytes(message); else message = utf8.stringToBytes(message); else if (isBuffer(message)) message = Array.prototype.slice.call(message, 0); else if (!Array.isArray(message) && message.constructor !== Uint8Array) message = message.toString(); var m = crypt.bytesToWords(message), l = message.length * 8, a = 1732584193, b = -271733879, c = -1732584194, d = 271733878; for (var i = 0; i < m.length; i++) { m[i] = (m[i] << 8 | m[i] >>> 24) & 16711935 | (m[i] << 24 | m[i] >>> 8) & 4278255360; } m[l >>> 5] |= 128 << l % 32; m[(l + 64 >>> 9 << 4) + 14] = l; var FF = md52._ff, GG = md52._gg, HH = md52._hh, II = md52._ii; for (var i = 0; i < m.length; i += 16) { var aa = a, bb = b, cc = c, dd = d; a = FF(a, b, c, d, m[i + 0], 7, -680876936); d = FF(d, a, b, c, m[i + 1], 12, -389564586); c = FF(c, d, a, b, m[i + 2], 17, 606105819); b = FF(b, c, d, a, m[i + 3], 22, -1044525330); a = FF(a, b, c, d, m[i + 4], 7, -176418897); d = FF(d, a, b, c, m[i + 5], 12, 1200080426); c = FF(c, d, a, b, m[i + 6], 17, -1473231341); b = FF(b, c, d, a, m[i + 7], 22, -45705983); a = FF(a, b, c, d, m[i + 8], 7, 1770035416); d = FF(d, a, b, c, m[i + 9], 12, -1958414417); c = FF(c, d, a, b, m[i + 10], 17, -42063); b = FF(b, c, d, a, m[i + 11], 22, -1990404162); a = FF(a, b, c, d, m[i + 12], 7, 1804603682); d = FF(d, a, b, c, m[i + 13], 12, -40341101); c = FF(c, d, a, b, m[i + 14], 17, -1502002290); b = FF(b, c, d, a, m[i + 15], 22, 1236535329); a = GG(a, b, c, d, m[i + 1], 5, -165796510); d = GG(d, a, b, c, m[i + 6], 9, -1069501632); c = GG(c, d, a, b, m[i + 11], 14, 643717713); b = GG(b, c, d, a, m[i + 0], 20, -373897302); a = GG(a, b, c, d, m[i + 5], 5, -701558691); d = GG(d, a, b, c, m[i + 10], 9, 38016083); c = GG(c, d, a, b, m[i + 15], 14, -660478335); b = GG(b, c, d, a, m[i + 4], 20, -405537848); a = GG(a, b, c, d, m[i + 9], 5, 568446438); d = GG(d, a, b, c, m[i + 14], 9, -1019803690); c = GG(c, d, a, b, m[i + 3], 14, -187363961); b = GG(b, c, d, a, m[i + 8], 20, 1163531501); a = GG(a, b, c, d, m[i + 13], 5, -1444681467); d = GG(d, a, b, c, m[i + 2], 9, -51403784); c = GG(c, d, a, b, m[i + 7], 14, 1735328473); b = GG(b, c, d, a, m[i + 12], 20, -1926607734); a = HH(a, b, c, d, m[i + 5], 4, -378558); d = HH(d, a, b, c, m[i + 8], 11, -2022574463); c = HH(c, d, a, b, m[i + 11], 16, 1839030562); b = HH(b, c, d, a, m[i + 14], 23, -35309556); a = HH(a, b, c, d, m[i + 1], 4, -1530992060); d = HH(d, a, b, c, m[i + 4], 11, 1272893353); c = HH(c, d, a, b, m[i + 7], 16, -155497632); b = HH(b, c, d, a, m[i + 10], 23, -1094730640); a = HH(a, b, c, d, m[i + 13], 4, 681279174); d = HH(d, a, b, c, m[i + 0], 11, -358537222); c = HH(c, d, a, b, m[i + 3], 16, -722521979); b = HH(b, c, d, a, m[i + 6], 23, 76029189); a = HH(a, b, c, d, m[i + 9], 4, -640364487); d = HH(d, a, b, c, m[i + 12], 11, -421815835); c = HH(c, d, a, b, m[i + 15], 16, 530742520); b = HH(b, c, d, a, m[i + 2], 23, -995338651); a = II(a, b, c, d, m[i + 0], 6, -198630844); d = II(d, a, b, c, m[i + 7], 10, 1126891415); c = II(c, d, a, b, m[i + 14], 15, -1416354905); b = II(b, c, d, a, m[i + 5], 21, -57434055); a = II(a, b, c, d, m[i + 12], 6, 1700485571); d = II(d, a, b, c, m[i + 3], 10, -1894986606); c = II(c, d, a, b, m[i + 10], 15, -1051523); b = II(b, c, d, a, m[i + 1], 21, -2054922799); a = II(a, b, c, d, m[i + 8], 6, 1873313359); d = II(d, a, b, c, m[i + 15], 10, -30611744); c = II(c, d, a, b, m[i + 6], 15, -1560198380); b = II(b, c, d, a, m[i + 13], 21, 1309151649); a = II(a, b, c, d, m[i + 4], 6, -145523070); d = II(d, a, b, c, m[i + 11], 10, -1120210379); c = II(c, d, a, b, m[i + 2], 15, 718787259); b = II(b, c, d, a, m[i + 9], 21, -343485551); a = a + aa >>> 0; b = b + bb >>> 0; c = c + cc >>> 0; d = d + dd >>> 0; } return crypt.endian([a, b, c, d]); }; md52._ff = function(a, b, c, d, x, s, t) { var n = a + (b & c | ~b & d) + (x >>> 0) + t; return (n << s | n >>> 32 - s) + b; }; md52._gg = function(a, b, c, d, x, s, t) { var n = a + (b & d | c & ~d) + (x >>> 0) + t; return (n << s | n >>> 32 - s) + b; }; md52._hh = function(a, b, c, d, x, s, t) { var n = a + (b ^ c ^ d) + (x >>> 0) + t; return (n << s | n >>> 32 - s) + b; }; md52._ii = function(a, b, c, d, x, s, t) { var n = a + (c ^ (b | ~d)) + (x >>> 0) + t; return (n << s | n >>> 32 - s) + b; }; md52._blocksize = 16; md52._digestsize = 16; module2.exports = function(message, options) { if (message === void 0 || message === null) throw new Error("Illegal argument " + message); var digestbytes = crypt.wordsToBytes(md52(message, options)); return options && options.asBytes ? digestbytes : options && options.asString ? bin.bytesToString(digestbytes) : crypt.bytesToHex(digestbytes); }; })(); } }); // node_modules/@protobufjs/aspromise/index.js var require_aspromise = __commonJS({ "node_modules/@protobufjs/aspromise/index.js"(exports2, module2) { "use strict"; module2.exports = asPromise; function asPromise(fn, ctx) { var params = new Array(arguments.length - 1), offset2 = 0, index = 2, pending = true; while (index < arguments.length) params[offset2++] = arguments[index++]; return new Promise(function executor(resolve, reject) { params[offset2] = function callback(err) { if (pending) { pending = false; if (err) reject(err); else { var params2 = new Array(arguments.length - 1), offset3 = 0; while (offset3 < params2.length) params2[offset3++] = arguments[offset3]; resolve.apply(null, params2); } } }; try { fn.apply(ctx || null, params); } catch (err) { if (pending) { pending = false; reject(err); } } }); } } }); // node_modules/@protobufjs/base64/index.js var require_base64 = __commonJS({ "node_modules/@protobufjs/base64/index.js"(exports2) { "use strict"; var base64 = exports2; base64.length = function length(string) { var p = string.length; if (!p) return 0; var n = 0; while (--p % 4 > 1 && string.charAt(p) === "=") ++n; return Math.ceil(string.length * 3) / 4 - n; }; var b64 = new Array(64); var s64 = new Array(123); for (i = 0; i < 64; ) s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++; var i; base64.encode = function encode(buffer, start, end) { var parts = null, chunk = []; var i2 = 0, j = 0, t; while (start < end) { var b = buffer[start++]; switch (j) { case 0: chunk[i2++] = b64[b >> 2]; t = (b & 3) << 4; j = 1; break; case 1: chunk[i2++] = b64[t | b >> 4]; t = (b & 15) << 2; j = 2; break; case 2: chunk[i2++] = b64[t | b >> 6]; chunk[i2++] = b64[b & 63]; j = 0; break; } if (i2 > 8191) { (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); i2 = 0; } } if (j) { chunk[i2++] = b64[t]; chunk[i2++] = 61; if (j === 1) chunk[i2++] = 61; } 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)); }; var invalidEncoding = "invalid encoding"; base64.decode = function decode(string, buffer, offset2) { var start = offset2; var j = 0, t; for (var i2 = 0; i2 < string.length; ) { var c = string.charCodeAt(i2++); if (c === 61 && j > 1) break; if ((c = s64[c]) === void 0) throw Error(invalidEncoding); switch (j) { case 0: t = c; j = 1; break; case 1: buffer[offset2++] = t << 2 | (c & 48) >> 4; t = c; j = 2; break; case 2: buffer[offset2++] = (t & 15) << 4 | (c & 60) >> 2; t = c; j = 3; break; case 3: buffer[offset2++] = (t & 3) << 6 | c; j = 0; break; } } if (j === 1) throw Error(invalidEncoding); return offset2 - start; }; base64.test = function test(string) { return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?\$/.test(string); }; } }); // node_modules/@protobufjs/eventemitter/index.js var require_eventemitter = __commonJS({ "node_modules/@protobufjs/eventemitter/index.js"(exports2, module2) { "use strict"; module2.exports = 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 i = 0; i < listeners.length; ) if (listeners[i].fn === fn) listeners.splice(i, 1); else ++i; } } return this; }; EventEmitter.prototype.emit = function emit(evt) { var listeners = this._listeners[evt]; if (listeners) { var args = [], i = 1; for (; i < arguments.length; ) args.push(arguments[i++]); for (i = 0; i < listeners.length; ) listeners[i].fn.apply(listeners[i++].ctx, args); } return this; }; } }); // node_modules/@protobufjs/float/index.js var require_float = __commonJS({ "node_modules/@protobufjs/float/index.js"(exports2, module2) { "use strict"; module2.exports = factory(factory); function factory(exports3) { 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]; } exports3.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev; exports3.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]; } exports3.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev; exports3.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 ? 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); } } exports3.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE); exports3.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); } exports3.readFloatLE = readFloat_ieee754.bind(null, readUintLE); exports3.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]; } exports3.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev; exports3.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]; } exports3.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev; exports3.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 ? 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); } } } exports3.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4); exports3.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); } exports3.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4); exports3.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0); })(); return exports3; } 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; } } }); // node_modules/@protobufjs/inquire/index.js var require_inquire = __commonJS({ "node_modules/@protobufjs/inquire/index.js"(exports, module) { "use strict"; module.exports = inquire; function inquire(moduleName) { try { var mod = eval("quire".replace(/^/, "re"))(moduleName); if (mod && (mod.length || Object.keys(mod).length)) return mod; } catch (e) { } return null; } } }); // node_modules/@protobufjs/utf8/index.js var require_utf8 = __commonJS({ "node_modules/@protobufjs/utf8/index.js"(exports2) { "use strict"; var utf8 = exports2; utf8.length = function utf8_length(string) { var len = 0, c = 0; for (var i = 0; i < string.length; ++i) { c = string.charCodeAt(i); if (c < 128) len += 1; else if (c < 2048) len += 2; else if ((c & 64512) === 55296 && (string.charCodeAt(i + 1) & 64512) === 56320) { ++i; len += 4; } else len += 3; } return len; }; utf8.read = function utf8_read(buffer, start, end) { var len = end - start; if (len < 1) return ""; var parts = null, chunk = [], i = 0, t; while (start < end) { t = buffer[start++]; if (t < 128) chunk[i++] = t; else if (t > 191 && t < 224) chunk[i++] = (t & 31) << 6 | buffer[start++] & 63; else if (t > 239 && t < 365) { t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 65536; chunk[i++] = 55296 + (t >> 10); chunk[i++] = 56320 + (t & 1023); } else chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63; if (i > 8191) { (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); i = 0; } } if (parts) { if (i) parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); return parts.join(""); } return String.fromCharCode.apply(String, chunk.slice(0, i)); }; utf8.write = function utf8_write(string, buffer, offset2) { var start = offset2, c1, c2; for (var i = 0; i < string.length; ++i) { c1 = string.charCodeAt(i); if (c1 < 128) { buffer[offset2++] = c1; } else if (c1 < 2048) { buffer[offset2++] = c1 >> 6 | 192; buffer[offset2++] = c1 & 63 | 128; } else if ((c1 & 64512) === 55296 && ((c2 = string.charCodeAt(i + 1)) & 64512) === 56320) { c1 = 65536 + ((c1 & 1023) << 10) + (c2 & 1023); ++i; buffer[offset2++] = c1 >> 18 | 240; buffer[offset2++] = c1 >> 12 & 63 | 128; buffer[offset2++] = c1 >> 6 & 63 | 128; buffer[offset2++] = c1 & 63 | 128; } else { buffer[offset2++] = c1 >> 12 | 224; buffer[offset2++] = c1 >> 6 & 63 | 128; buffer[offset2++] = c1 & 63 | 128; } } return offset2 - start; }; } }); // node_modules/@protobufjs/pool/index.js var require_pool = __commonJS({ "node_modules/@protobufjs/pool/index.js"(exports2, module2) { "use strict"; module2.exports = pool; function pool(alloc, slice, size) { var SIZE = size || 8192; var MAX = SIZE >>> 1; var slab = null; var offset2 = SIZE; return function pool_alloc(size2) { if (size2 < 1 || size2 > MAX) return alloc(size2); if (offset2 + size2 > SIZE) { slab = alloc(SIZE); offset2 = 0; } var buf = slice.call(slab, offset2, offset2 += size2); if (offset2 & 7) offset2 = (offset2 | 7) + 1; return buf; }; } } }); // node_modules/protobufjs/src/util/longbits.js var require_longbits = __commonJS({ "node_modules/protobufjs/src/util/longbits.js"(exports2, module2) { "use strict"; module2.exports = LongBits; var util = require_minimal(); function LongBits(lo, hi) { this.lo = lo >>> 0; this.hi = hi >>> 0; } var zero = LongBits.zero = new LongBits(0, 0); zero.toNumber = function() { return 0; }; zero.zzEncode = zero.zzDecode = function() { return this; }; zero.length = function() { return 1; }; var zeroHash = LongBits.zeroHash = "\\0\\0\\0\\0\\0\\0\\0\\0"; LongBits.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 LongBits(lo, hi); }; LongBits.from = function from(value) { if (typeof value === "number") return LongBits.fromNumber(value); if (util.isString(value)) { if (util.Long) value = util.Long.fromString(value); else return LongBits.fromNumber(parseInt(value, 10)); } return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero; }; LongBits.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; }; LongBits.prototype.toLong = function toLong(unsigned) { return util.Long ? new util.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; LongBits.fromHash = function fromHash(hash) { if (hash === zeroHash) return zero; return new LongBits( (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 ); }; LongBits.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 ); }; LongBits.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; }; LongBits.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; }; LongBits.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; }; } }); // node_modules/protobufjs/src/util/minimal.js var require_minimal = __commonJS({ "node_modules/protobufjs/src/util/minimal.js"(exports2) { "use strict"; var util = exports2; util.asPromise = require_aspromise(); util.base64 = require_base64(); util.EventEmitter = require_eventemitter(); util.float = require_float(); util.inquire = require_inquire(); util.utf8 = require_utf8(); util.pool = require_pool(); util.LongBits = require_longbits(); util.isNode = Boolean(typeof global !== "undefined" && global && global.process && global.process.versions && global.process.versions.node); util.global = util.isNode && global || typeof window !== "undefined" && window || typeof self !== "undefined" && self || exports2; util.emptyArray = Object.freeze ? Object.freeze([]) : []; util.emptyObject = Object.freeze ? Object.freeze({}) : {}; util.isInteger = Number.isInteger || function isInteger(value) { return typeof value === "number" && isFinite(value) && Math.floor(value) === value; }; util.isString = function isString(value) { return typeof value === "string" || value instanceof String; }; util.isObject = function isObject2(value) { return value && typeof value === "object"; }; util.isset = util.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; }; util.Buffer = function() { try { var Buffer2 = util.inquire("buffer").Buffer; return Buffer2.prototype.utf8Write ? Buffer2 : null; } catch (e) { return null; } }(); util._Buffer_from = null; util._Buffer_allocUnsafe = null; util.newBuffer = function newBuffer(sizeOrArray) { return typeof sizeOrArray === "number" ? util.Buffer ? util._Buffer_allocUnsafe(sizeOrArray) : new util.Array(sizeOrArray) : util.Buffer ? util._Buffer_from(sizeOrArray) : typeof Uint8Array === "undefined" ? sizeOrArray : new Uint8Array(sizeOrArray); }; util.Array = typeof Uint8Array !== "undefined" ? Uint8Array : Array; util.Long = util.global.dcodeIO && util.global.dcodeIO.Long || util.global.Long || util.inquire("long"); util.key2Re = /^true|false|0|1\$/; util.key32Re = /^-?(?:0|[1-9][0-9]*)\$/; util.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))\$/; util.longToHash = function longToHash(value) { return value ? util.LongBits.from(value).toHash() : util.LongBits.zeroHash; }; util.longFromHash = function longFromHash(hash, unsigned) { var bits = util.LongBits.fromHash(hash); if (util.Long) return util.Long.fromBits(bits.lo, bits.hi, unsigned); return bits.toNumber(Boolean(unsigned)); }; function merge(dst, src, ifNotSet) { for (var keys = Object.keys(src), i = 0; i < keys.length; ++i) if (dst[keys[i]] === void 0 || !ifNotSet) dst[keys[i]] = src[keys[i]]; return dst; } util.merge = merge; util.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() { return name; }, set: void 0, enumerable: false, configurable: true }, toString: { value() { return this.name + ": " + this.message; }, writable: true, enumerable: false, configurable: true } }); return CustomError; } util.newError = newError; util.ProtocolError = newError("ProtocolError"); util.oneOfGetter = function getOneOf(fieldNames) { var fieldMap = {}; for (var i = 0; i < fieldNames.length; ++i) fieldMap[fieldNames[i]] = 1; return function() { for (var keys = Object.keys(this), i2 = keys.length - 1; i2 > -1; --i2) if (fieldMap[keys[i2]] === 1 && this[keys[i2]] !== void 0 && this[keys[i2]] !== null) return keys[i2]; }; }; util.oneOfSetter = function setOneOf(fieldNames) { return function(name) { for (var i = 0; i < fieldNames.length; ++i) if (fieldNames[i] !== name) delete this[fieldNames[i]]; }; }; util.toJSONOptions = { longs: String, enums: String, bytes: String, json: true }; util._configure = function() { var Buffer2 = util.Buffer; if (!Buffer2) { util._Buffer_from = util._Buffer_allocUnsafe = null; return; } util._Buffer_from = Buffer2.from !== Uint8Array.from && Buffer2.from || function Buffer_from(value, encoding) { return new Buffer2(value, encoding); }; util._Buffer_allocUnsafe = Buffer2.allocUnsafe || function Buffer_allocUnsafe(size) { return new Buffer2(size); }; }; } }); // node_modules/protobufjs/src/writer.js var require_writer = __commonJS({ "node_modules/protobufjs/src/writer.js"(exports2, module2) { "use strict"; module2.exports = Writer; var util = require_minimal(); var BufferWriter; var LongBits = util.LongBits; var base64 = util.base64; var utf8 = util.utf8; function Op(fn, len, val) { this.fn = fn; this.len = len; this.next = void 0; this.val = val; } function noop() { } function State(writer) { this.head = writer.head; this.tail = writer.tail; this.len = writer.len; this.next = writer.states; } function Writer() { this.len = 0; this.head = new Op(noop, 0, 0); this.tail = this.head; this.states = null; } var create = function create2() { return util.Buffer ? function create_buffer_setup() { return (Writer.create = function create_buffer() { return new BufferWriter(); })(); } : function create_array() { return new Writer(); }; }; Writer.create = create(); Writer.alloc = function alloc(size) { return new util.Array(size); }; if (util.Array !== Array) Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray); Writer.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.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.prototype.int32 = function write_int32(value) { return value < 0 ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) : this.uint32(value); }; Writer.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.prototype.uint64 = function write_uint64(value) { var bits = LongBits.from(value); return this._push(writeVarint64, bits.length(), bits); }; Writer.prototype.int64 = Writer.prototype.uint64; Writer.prototype.sint64 = function write_sint64(value) { var bits = LongBits.from(value).zzEncode(); return this._push(writeVarint64, bits.length(), bits); }; Writer.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.prototype.fixed32 = function write_fixed32(value) { return this._push(writeFixed32, 4, value >>> 0); }; Writer.prototype.sfixed32 = Writer.prototype.fixed32; Writer.prototype.fixed64 = function write_fixed64(value) { var bits = LongBits.from(value); return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi); }; Writer.prototype.sfixed64 = Writer.prototype.fixed64; Writer.prototype.float = function write_float(value) { return this._push(util.float.writeFloatLE, 4, value); }; Writer.prototype.double = function write_double(value) { return this._push(util.float.writeDoubleLE, 8, value); }; var writeBytes = util.Array.prototype.set ? function writeBytes_set(val, buf, pos) { buf.set(val, pos); } : function writeBytes_for(val, buf, pos) { for (var i = 0; i < val.length; ++i) buf[pos + i] = val[i]; }; Writer.prototype.bytes = function write_bytes(value) { var len = value.length >>> 0; if (!len) return this._push(writeByte, 1, 0); if (util.isString(value)) { var buf = Writer.alloc(len = base64.length(value)); base64.decode(value, buf, 0); value = buf; } return this.uint32(len)._push(writeBytes, len, value); }; Writer.prototype.string = function write_string(value) { var len = utf8.length(value); return len ? this.uint32(len)._push(utf8.write, len, value) : this._push(writeByte, 1, 0); }; Writer.prototype.fork = function fork() { this.states = new State(this); this.head = this.tail = new Op(noop, 0, 0); this.len = 0; return this; }; Writer.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.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.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._configure = function(BufferWriter_) { BufferWriter = BufferWriter_; Writer.create = create(); BufferWriter._configure(); }; } }); // node_modules/protobufjs/src/writer_buffer.js var require_writer_buffer = __commonJS({ "node_modules/protobufjs/src/writer_buffer.js"(exports2, module2) { "use strict"; module2.exports = BufferWriter; var Writer = require_writer(); (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter; var util = require_minimal(); function BufferWriter() { Writer.call(this); } BufferWriter._configure = function() { BufferWriter.alloc = util._Buffer_allocUnsafe; BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.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 i = 0; i < val.length; ) buf[pos++] = val[i++]; }; }; BufferWriter.prototype.bytes = function write_bytes_buffer(value) { if (util.isString(value)) value = util._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.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.Buffer.byteLength(value); this.uint32(len); if (len) this._push(writeStringBuffer, len, value); return this; }; BufferWriter._configure(); } }); // node_modules/protobufjs/src/reader.js var require_reader = __commonJS({ "node_modules/protobufjs/src/reader.js"(exports2, module2) { "use strict"; module2.exports = Reader; var util = require_minimal(); var BufferReader; var LongBits = util.LongBits; var utf8 = util.utf8; function indexOutOfRange(reader, writeLength) { return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len); } function Reader(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(buffer); throw Error("illegal buffer"); } : function create_array2(buffer) { if (Array.isArray(buffer)) return new Reader(buffer); throw Error("illegal buffer"); }; var create = function create2() { return util.Buffer ? function create_buffer_setup(buffer) { return (Reader.create = function create_buffer(buffer2) { return util.Buffer.isBuffer(buffer2) ? new BufferReader(buffer2) : create_array(buffer2); })(buffer); } : create_array; }; Reader.create = create(); Reader.prototype._slice = util.Array.prototype.subarray || util.Array.prototype.slice; Reader.prototype.uint32 = 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.prototype.int32 = function read_int32() { return this.uint32() | 0; }; Reader.prototype.sint32 = function read_sint32() { var value = this.uint32(); return value >>> 1 ^ -(value & 1) | 0; }; function readLongVarint() { var bits = new LongBits(0, 0); var i = 0; if (this.len - this.pos > 4) { for (; i < 4; ++i) { bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 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; i = 0; } else { for (; i < 3; ++i) { if (this.pos >= this.len) throw indexOutOfRange(this); bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; if (this.buf[this.pos++] < 128) return bits; } bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0; return bits; } if (this.len - this.pos > 4) { for (; i < 5; ++i) { bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; if (this.buf[this.pos++] < 128) return bits; } } else { for (; i < 5; ++i) { if (this.pos >= this.len) throw indexOutOfRange(this); bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; if (this.buf[this.pos++] < 128) return bits; } } throw Error("invalid varint encoding"); } Reader.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.prototype.fixed32 = function read_fixed32() { if (this.pos + 4 > this.len) throw indexOutOfRange(this, 4); return readFixed32_end(this.buf, this.pos += 4); }; Reader.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.prototype.float = function read_float() { if (this.pos + 4 > this.len) throw indexOutOfRange(this, 4); var value = util.float.readFloatLE(this.buf, this.pos); this.pos += 4; return value; }; Reader.prototype.double = function read_double() { if (this.pos + 8 > this.len) throw indexOutOfRange(this, 4); var value = util.float.readDoubleLE(this.buf, this.pos); this.pos += 8; return value; }; Reader.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); return start === end ? new this.buf.constructor(0) : this._slice.call(this.buf, start, end); }; Reader.prototype.string = function read_string() { var bytes = this.bytes(); return utf8.read(bytes, 0, bytes.length); }; Reader.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.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._configure = function(BufferReader_) { BufferReader = BufferReader_; Reader.create = create(); BufferReader._configure(); var fn = util.Long ? "toLong" : "toNumber"; util.merge(Reader.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); } }); }; } }); // node_modules/protobufjs/src/reader_buffer.js var require_reader_buffer = __commonJS({ "node_modules/protobufjs/src/reader_buffer.js"(exports2, module2) { "use strict"; module2.exports = BufferReader; var Reader = require_reader(); (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader; var util = require_minimal(); function BufferReader(buffer) { Reader.call(this, buffer); } BufferReader._configure = function() { if (util.Buffer) BufferReader.prototype._slice = util.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(); } }); // node_modules/protobufjs/src/rpc/service.js var require_service = __commonJS({ "node_modules/protobufjs/src/rpc/service.js"(exports2, module2) { "use strict"; module2.exports = Service; var util = require_minimal(); (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(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; }; } }); // node_modules/protobufjs/src/rpc.js var require_rpc = __commonJS({ "node_modules/protobufjs/src/rpc.js"(exports2) { "use strict"; var rpc = exports2; rpc.Service = require_service(); } }); // node_modules/protobufjs/src/roots.js var require_roots = __commonJS({ "node_modules/protobufjs/src/roots.js"(exports2, module2) { "use strict"; module2.exports = {}; } }); // node_modules/protobufjs/src/index-minimal.js var require_index_minimal = __commonJS({ "node_modules/protobufjs/src/index-minimal.js"(exports2) { "use strict"; var protobuf = exports2; protobuf.build = "minimal"; protobuf.Writer = require_writer(); protobuf.BufferWriter = require_writer_buffer(); protobuf.Reader = require_reader(); protobuf.BufferReader = require_reader_buffer(); protobuf.util = require_minimal(); protobuf.rpc = require_rpc(); protobuf.roots = require_roots(); protobuf.configure = configure; function configure() { protobuf.util._configure(); protobuf.Writer._configure(protobuf.BufferWriter); protobuf.Reader._configure(protobuf.BufferReader); } configure(); } }); // node_modules/@protobufjs/codegen/index.js var require_codegen = __commonJS({ "node_modules/@protobufjs/codegen/index.js"(exports2, module2) { "use strict"; module2.exports = codegen; function codegen(functionParams, functionName) { if (typeof functionParams === "string") { functionName = functionParams; functionParams = void 0; } var body = []; function Codegen(formatStringOrScope) { if (typeof formatStringOrScope !== "string") { var source = toString2(); if (codegen.verbose) console.log("codegen: " + source); source = "return " + source; if (formatStringOrScope) { var scopeKeys = Object.keys(formatStringOrScope), scopeParams = new Array(scopeKeys.length + 1), scopeValues = new Array(scopeKeys.length), scopeOffset = 0; while (scopeOffset < scopeKeys.length) { scopeParams[scopeOffset] = scopeKeys[scopeOffset]; scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]]; } scopeParams[scopeOffset] = source; return Function.apply(null, scopeParams).apply(null, scopeValues); } return Function(source)(); } var formatParams = new Array(arguments.length - 1), formatOffset = 0; while (formatOffset < formatParams.length) formatParams[formatOffset] = arguments[++formatOffset]; formatOffset = 0; formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace(\$0, \$1) { var value = formatParams[formatOffset++]; switch (\$1) { case "d": case "f": return String(Number(value)); case "i": return String(Math.floor(value)); case "j": return JSON.stringify(value); case "s": return String(value); } return "%"; }); if (formatOffset !== formatParams.length) throw Error("parameter count mismatch"); body.push(formatStringOrScope); return Codegen; } function toString2(functionNameOverride) { return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\\n " + body.join("\\n ") + "\\n}"; } Codegen.toString = toString2; return Codegen; } codegen.verbose = false; } }); // node_modules/@protobufjs/fetch/index.js var require_fetch = __commonJS({ "node_modules/@protobufjs/fetch/index.js"(exports2, module2) { "use strict"; module2.exports = fetch2; var asPromise = require_aspromise(); var inquire2 = require_inquire(); var fs = inquire2("fs"); function fetch2(filename, options, callback) { if (typeof options === "function") { callback = options; options = {}; } else if (!options) options = {}; if (!callback) return asPromise(fetch2, this, filename, options); if (!options.xhr && fs && fs.readFile) return fs.readFile(filename, function fetchReadFileCallback(err, contents) { return err && typeof XMLHttpRequest !== "undefined" ? fetch2.xhr(filename, options, callback) : err ? callback(err) : callback(null, options.binary ? contents : contents.toString("utf8")); }); return fetch2.xhr(filename, options, callback); } fetch2.xhr = function fetch_xhr(filename, options, callback) { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function fetchOnReadyStateChange() { if (xhr.readyState !== 4) return void 0; if (xhr.status !== 0 && xhr.status !== 200) return callback(Error("status " + xhr.status)); if (options.binary) { var buffer = xhr.response; if (!buffer) { buffer = []; for (var i = 0; i < xhr.responseText.length; ++i) buffer.push(xhr.responseText.charCodeAt(i) & 255); } return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer); } return callback(null, xhr.responseText); }; if (options.binary) { if ("overrideMimeType" in xhr) xhr.overrideMimeType("text/plain; charset=x-user-defined"); xhr.responseType = "arraybuffer"; } xhr.open("GET", filename); xhr.send(); }; } }); // node_modules/@protobufjs/path/index.js var require_path = __commonJS({ "node_modules/@protobufjs/path/index.js"(exports2) { "use strict"; var path = exports2; var isAbsolute = path.isAbsolute = function isAbsolute2(path2) { return /^(?:\\/|\\w+:)/.test(path2); }; var normalize = path.normalize = function normalize2(path2) { path2 = path2.replace(/\\\\/g, "/").replace(/\\/{2,}/g, "/"); var parts = path2.split("/"), absolute = isAbsolute(path2), prefix = ""; if (absolute) prefix = parts.shift() + "/"; for (var i = 0; i < parts.length; ) { if (parts[i] === "..") { if (i > 0 && parts[i - 1] !== "..") parts.splice(--i, 2); else if (absolute) parts.splice(i, 1); else ++i; } else if (parts[i] === ".") parts.splice(i, 1); else ++i; } return prefix + parts.join("/"); }; path.resolve = function resolve(originPath, includePath, alreadyNormalized) { if (!alreadyNormalized) includePath = normalize(includePath); if (isAbsolute(includePath)) return includePath; if (!alreadyNormalized) originPath = normalize(originPath); return (originPath = originPath.replace(/(?:\\/|^)[^/]+\$/, "")).length ? normalize(originPath + "/" + includePath) : includePath; }; } }); // node_modules/protobufjs/src/types.js var require_types = __commonJS({ "node_modules/protobufjs/src/types.js"(exports2) { "use strict"; var types = exports2; var util = require_util(); var s = [ "double", "float", "int32", "uint32", "sint32", "fixed32", "sfixed32", "int64", "uint64", "sint64", "fixed64", "sfixed64", "bool", "string", "bytes" ]; function bake(values, offset2) { var i = 0, o = {}; offset2 |= 0; while (i < values.length) o[s[i + offset2]] = values[i++]; return o; } types.basic = bake([ 1, 5, 0, 0, 0, 5, 5, 0, 0, 0, 1, 1, 0, 2, 2 ]); types.defaults = bake([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false, "", util.emptyArray, null ]); types.long = bake([ 0, 0, 0, 1, 1 ], 7); types.mapKey = bake([ 0, 0, 0, 5, 5, 0, 0, 0, 1, 1, 0, 2 ], 2); types.packed = bake([ 1, 5, 0, 0, 0, 5, 5, 0, 0, 0, 1, 1, 0 ]); } }); // node_modules/protobufjs/src/field.js var require_field = __commonJS({ "node_modules/protobufjs/src/field.js"(exports2, module2) { "use strict"; module2.exports = Field; var ReflectionObject = require_object(); ((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = "Field"; var Enum = require_enum(); var types = require_types(); var util = require_util(); var Type2; var ruleRe = /^required|optional|repeated\$/; Field.fromJSON = function fromJSON(name, json) { return new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment); }; function Field(name, id, type, rule, extend, options, comment) { if (util.isObject(rule)) { comment = extend; options = rule; rule = extend = void 0; } else if (util.isObject(extend)) { comment = options; options = extend; extend = void 0; } ReflectionObject.call(this, name, options); if (!util.isInteger(id) || id < 0) throw TypeError("id must be a non-negative integer"); if (!util.isString(type)) throw TypeError("type must be a string"); if (rule !== void 0 && !ruleRe.test(rule = rule.toString().toLowerCase())) throw TypeError("rule must be a string rule"); if (extend !== void 0 && !util.isString(extend)) throw TypeError("extend must be a string"); if (rule === "proto3_optional") { rule = "optional"; } this.rule = rule && rule !== "optional" ? rule : void 0; this.type = type; this.id = id; this.extend = extend || void 0; this.required = rule === "required"; this.optional = !this.required; this.repeated = rule === "repeated"; this.map = false; this.message = null; this.partOf = null; this.typeDefault = null; this.defaultValue = null; this.long = util.Long ? types.long[type] !== void 0 : false; this.bytes = type === "bytes"; this.resolvedType = null; this.extensionField = null; this.declaringField = null; this._packed = null; this.comment = comment; } Object.defineProperty(Field.prototype, "packed", { get: function() { if (this._packed === null) this._packed = this.getOption("packed") !== false; return this._packed; } }); Field.prototype.setOption = function setOption(name, value, ifNotSet) { if (name === "packed") this._packed = null; return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet); }; Field.prototype.toJSON = function toJSON(toJSONOptions) { var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; return util.toObject([ "rule", this.rule !== "optional" && this.rule || void 0, "type", this.type, "id", this.id, "extend", this.extend, "options", this.options, "comment", keepComments ? this.comment : void 0 ]); }; Field.prototype.resolve = function resolve() { if (this.resolved) return this; if ((this.typeDefault = types.defaults[this.type]) === void 0) { this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type); if (this.resolvedType instanceof Type2) this.typeDefault = null; else this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; } else if (this.options && this.options.proto3_optional) { this.typeDefault = null; } if (this.options && this.options["default"] != null) { this.typeDefault = this.options["default"]; if (this.resolvedType instanceof Enum && typeof this.typeDefault === "string") this.typeDefault = this.resolvedType.values[this.typeDefault]; } if (this.options) { if (this.options.packed === true || this.options.packed !== void 0 && this.resolvedType && !(this.resolvedType instanceof Enum)) delete this.options.packed; if (!Object.keys(this.options).length) this.options = void 0; } if (this.long) { this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u"); if (Object.freeze) Object.freeze(this.typeDefault); } else if (this.bytes && typeof this.typeDefault === "string") { var buf; if (util.base64.test(this.typeDefault)) util.base64.decode(this.typeDefault, buf = util.newBuffer(util.base64.length(this.typeDefault)), 0); else util.utf8.write(this.typeDefault, buf = util.newBuffer(util.utf8.length(this.typeDefault)), 0); this.typeDefault = buf; } if (this.map) this.defaultValue = util.emptyObject; else if (this.repeated) this.defaultValue = util.emptyArray; else this.defaultValue = this.typeDefault; if (this.parent instanceof Type2) this.parent.ctor.prototype[this.name] = this.defaultValue; return ReflectionObject.prototype.resolve.call(this); }; Field.d = function decorateField(fieldId, fieldType, fieldRule, defaultValue) { if (typeof fieldType === "function") fieldType = util.decorateType(fieldType).name; else if (fieldType && typeof fieldType === "object") fieldType = util.decorateEnum(fieldType).name; return function fieldDecorator(prototype, fieldName) { util.decorateType(prototype.constructor).add(new Field(fieldName, fieldId, fieldType, fieldRule, { "default": defaultValue })); }; }; Field._configure = function configure(Type_) { Type2 = Type_; }; } }); // node_modules/protobufjs/src/oneof.js var require_oneof = __commonJS({ "node_modules/protobufjs/src/oneof.js"(exports2, module2) { "use strict"; module2.exports = OneOf; var ReflectionObject = require_object(); ((OneOf.prototype = Object.create(ReflectionObject.prototype)).constructor = OneOf).className = "OneOf"; var Field = require_field(); var util = require_util(); function OneOf(name, fieldNames, options, comment) { if (!Array.isArray(fieldNames)) { options = fieldNames; fieldNames = void 0; } ReflectionObject.call(this, name, options); if (!(fieldNames === void 0 || Array.isArray(fieldNames))) throw TypeError("fieldNames must be an Array"); this.oneof = fieldNames || []; this.fieldsArray = []; this.comment = comment; } OneOf.fromJSON = function fromJSON(name, json) { return new OneOf(name, json.oneof, json.options, json.comment); }; OneOf.prototype.toJSON = function toJSON(toJSONOptions) { var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; return util.toObject([ "options", this.options, "oneof", this.oneof, "comment", keepComments ? this.comment : void 0 ]); }; function addFieldsToParent(oneof) { if (oneof.parent) { for (var i = 0; i < oneof.fieldsArray.length; ++i) if (!oneof.fieldsArray[i].parent) oneof.parent.add(oneof.fieldsArray[i]); } } OneOf.prototype.add = function add(field) { if (!(field instanceof Field)) throw TypeError("field must be a Field"); if (field.parent && field.parent !== this.parent) field.parent.remove(field); this.oneof.push(field.name); this.fieldsArray.push(field); field.partOf = this; addFieldsToParent(this); return this; }; OneOf.prototype.remove = function remove(field) { if (!(field instanceof Field)) throw TypeError("field must be a Field"); var index = this.fieldsArray.indexOf(field); if (index < 0) throw Error(field + " is not a member of " + this); this.fieldsArray.splice(index, 1); index = this.oneof.indexOf(field.name); if (index > -1) this.oneof.splice(index, 1); field.partOf = null; return this; }; OneOf.prototype.onAdd = function onAdd(parent) { ReflectionObject.prototype.onAdd.call(this, parent); var self2 = this; for (var i = 0; i < this.oneof.length; ++i) { var field = parent.get(this.oneof[i]); if (field && !field.partOf) { field.partOf = self2; self2.fieldsArray.push(field); } } addFieldsToParent(this); }; OneOf.prototype.onRemove = function onRemove(parent) { for (var i = 0, field; i < this.fieldsArray.length; ++i) if ((field = this.fieldsArray[i]).parent) field.parent.remove(field); ReflectionObject.prototype.onRemove.call(this, parent); }; OneOf.d = function decorateOneOf() { var fieldNames = new Array(arguments.length), index = 0; while (index < arguments.length) fieldNames[index] = arguments[index++]; return function oneOfDecorator(prototype, oneofName) { util.decorateType(prototype.constructor).add(new OneOf(oneofName, fieldNames)); Object.defineProperty(prototype, oneofName, { get: util.oneOfGetter(fieldNames), set: util.oneOfSetter(fieldNames) }); }; }; } }); // node_modules/protobufjs/src/namespace.js var require_namespace = __commonJS({ "node_modules/protobufjs/src/namespace.js"(exports2, module2) { "use strict"; module2.exports = Namespace; var ReflectionObject = require_object(); ((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = "Namespace"; var Field = require_field(); var util = require_util(); var OneOf = require_oneof(); var Type2; var Service; var Enum; Namespace.fromJSON = function fromJSON(name, json) { return new Namespace(name, json.options).addJSON(json.nested); }; function arrayToJSON(array, toJSONOptions) { if (!(array && array.length)) return void 0; var obj = {}; for (var i = 0; i < array.length; ++i) obj[array[i].name] = array[i].toJSON(toJSONOptions); return obj; } Namespace.arrayToJSON = arrayToJSON; Namespace.isReservedId = function isReservedId(reserved, id) { if (reserved) { for (var i = 0; i < reserved.length; ++i) if (typeof reserved[i] !== "string" && reserved[i][0] <= id && reserved[i][1] > id) return true; } return false; }; Namespace.isReservedName = function isReservedName(reserved, name) { if (reserved) { for (var i = 0; i < reserved.length; ++i) if (reserved[i] === name) return true; } return false; }; function Namespace(name, options) { ReflectionObject.call(this, name, options); this.nested = void 0; this._nestedArray = null; } function clearCache(namespace) { namespace._nestedArray = null; return namespace; } Object.defineProperty(Namespace.prototype, "nestedArray", { get: function() { return this._nestedArray || (this._nestedArray = util.toArray(this.nested)); } }); Namespace.prototype.toJSON = function toJSON(toJSONOptions) { return util.toObject([ "options", this.options, "nested", arrayToJSON(this.nestedArray, toJSONOptions) ]); }; Namespace.prototype.addJSON = function addJSON(nestedJson) { var ns = this; if (nestedJson) { for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) { nested = nestedJson[names[i]]; ns.add( (nested.fields !== void 0 ? Type2.fromJSON : nested.values !== void 0 ? Enum.fromJSON : nested.methods !== void 0 ? Service.fromJSON : nested.id !== void 0 ? Field.fromJSON : Namespace.fromJSON)(names[i], nested) ); } } return this; }; Namespace.prototype.get = function get(name) { return this.nested && this.nested[name] || null; }; Namespace.prototype.getEnum = function getEnum(name) { if (this.nested && this.nested[name] instanceof Enum) return this.nested[name].values; throw Error("no such enum: " + name); }; Namespace.prototype.add = function add(object) { if (!(object instanceof Field && object.extend !== void 0 || object instanceof Type2 || object instanceof OneOf || object instanceof Enum || object instanceof Service || object instanceof Namespace)) throw TypeError("object must be a valid nested object"); if (!this.nested) this.nested = {}; else { var prev = this.get(object.name); if (prev) { if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type2 || prev instanceof Service)) { var nested = prev.nestedArray; for (var i = 0; i < nested.length; ++i) object.add(nested[i]); this.remove(prev); if (!this.nested) this.nested = {}; object.setOptions(prev.options, true); } else throw Error("duplicate name '" + object.name + "' in " + this); } } this.nested[object.name] = object; object.onAdd(this); return clearCache(this); }; Namespace.prototype.remove = function remove(object) { if (!(object instanceof ReflectionObject)) throw TypeError("object must be a ReflectionObject"); if (object.parent !== this) throw Error(object + " is not a member of " + this); delete this.nested[object.name]; if (!Object.keys(this.nested).length) this.nested = void 0; object.onRemove(this); return clearCache(this); }; Namespace.prototype.define = function define(path, json) { if (util.isString(path)) path = path.split("."); else if (!Array.isArray(path)) throw TypeError("illegal path"); if (path && path.length && path[0] === "") throw Error("path must be relative"); var ptr = this; while (path.length > 0) { var part = path.shift(); if (ptr.nested && ptr.nested[part]) { ptr = ptr.nested[part]; if (!(ptr instanceof Namespace)) throw Error("path conflicts with non-namespace objects"); } else ptr.add(ptr = new Namespace(part)); } if (json) ptr.addJSON(json); return ptr; }; Namespace.prototype.resolveAll = function resolveAll() { var nested = this.nestedArray, i = 0; while (i < nested.length) if (nested[i] instanceof Namespace) nested[i++].resolveAll(); else nested[i++].resolve(); return this.resolve(); }; Namespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChecked) { if (typeof filterTypes === "boolean") { parentAlreadyChecked = filterTypes; filterTypes = void 0; } else if (filterTypes && !Array.isArray(filterTypes)) filterTypes = [filterTypes]; if (util.isString(path) && path.length) { if (path === ".") return this.root; path = path.split("."); } else if (!path.length) return this; if (path[0] === "") return this.root.lookup(path.slice(1), filterTypes); var found = this.get(path[0]); if (found) { if (path.length === 1) { if (!filterTypes || filterTypes.indexOf(found.constructor) > -1) return found; } else if (found instanceof Namespace && (found = found.lookup(path.slice(1), filterTypes, true))) return found; } else for (var i = 0; i < this.nestedArray.length; ++i) if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i].lookup(path, filterTypes, true))) return found; if (this.parent === null || parentAlreadyChecked) return null; return this.parent.lookup(path, filterTypes); }; Namespace.prototype.lookupType = function lookupType(path) { var found = this.lookup(path, [Type2]); if (!found) throw Error("no such type: " + path); return found; }; Namespace.prototype.lookupEnum = function lookupEnum(path) { var found = this.lookup(path, [Enum]); if (!found) throw Error("no such Enum '" + path + "' in " + this); return found; }; Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) { var found = this.lookup(path, [Type2, Enum]); if (!found) throw Error("no such Type or Enum '" + path + "' in " + this); return found; }; Namespace.prototype.lookupService = function lookupService(path) { var found = this.lookup(path, [Service]); if (!found) throw Error("no such Service '" + path + "' in " + this); return found; }; Namespace._configure = function(Type_, Service_, Enum_) { Type2 = Type_; Service = Service_; Enum = Enum_; }; } }); // node_modules/protobufjs/src/mapfield.js var require_mapfield = __commonJS({ "node_modules/protobufjs/src/mapfield.js"(exports2, module2) { "use strict"; module2.exports = MapField; var Field = require_field(); ((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = "MapField"; var types = require_types(); var util = require_util(); function MapField(name, id, keyType, type, options, comment) { Field.call(this, name, id, type, void 0, void 0, options, comment); if (!util.isString(keyType)) throw TypeError("keyType must be a string"); this.keyType = keyType; this.resolvedKeyType = null; this.map = true; } MapField.fromJSON = function fromJSON(name, json) { return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment); }; MapField.prototype.toJSON = function toJSON(toJSONOptions) { var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; return util.toObject([ "keyType", this.keyType, "type", this.type, "id", this.id, "extend", this.extend, "options", this.options, "comment", keepComments ? this.comment : void 0 ]); }; MapField.prototype.resolve = function resolve() { if (this.resolved) return this; if (types.mapKey[this.keyType] === void 0) throw Error("invalid key type: " + this.keyType); return Field.prototype.resolve.call(this); }; MapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) { if (typeof fieldValueType === "function") fieldValueType = util.decorateType(fieldValueType).name; else if (fieldValueType && typeof fieldValueType === "object") fieldValueType = util.decorateEnum(fieldValueType).name; return function mapFieldDecorator(prototype, fieldName) { util.decorateType(prototype.constructor).add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType)); }; }; } }); // node_modules/protobufjs/src/method.js var require_method = __commonJS({ "node_modules/protobufjs/src/method.js"(exports2, module2) { "use strict"; module2.exports = Method; var ReflectionObject = require_object(); ((Method.prototype = Object.create(ReflectionObject.prototype)).constructor = Method).className = "Method"; var util = require_util(); function Method(name, type, requestType, responseType, requestStream, responseStream, options, comment, parsedOptions) { if (util.isObject(requestStream)) { options = requestStream; requestStream = responseStream = void 0; } else if (util.isObject(responseStream)) { options = responseStream; responseStream = void 0; } if (!(type === void 0 || util.isString(type))) throw TypeError("type must be a string"); if (!util.isString(requestType)) throw TypeError("requestType must be a string"); if (!util.isString(responseType)) throw TypeError("responseType must be a string"); ReflectionObject.call(this, name, options); this.type = type || "rpc"; this.requestType = requestType; this.requestStream = requestStream ? true : void 0; this.responseType = responseType; this.responseStream = responseStream ? true : void 0; this.resolvedRequestType = null; this.resolvedResponseType = null; this.comment = comment; this.parsedOptions = parsedOptions; } Method.fromJSON = function fromJSON(name, json) { return new Method(name, json.type, json.requestType, json.responseType, json.requestStream, json.responseStream, json.options, json.comment, json.parsedOptions); }; Method.prototype.toJSON = function toJSON(toJSONOptions) { var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; return util.toObject([ "type", this.type !== "rpc" && this.type || void 0, "requestType", this.requestType, "requestStream", this.requestStream, "responseType", this.responseType, "responseStream", this.responseStream, "options", this.options, "comment", keepComments ? this.comment : void 0, "parsedOptions", this.parsedOptions ]); }; Method.prototype.resolve = function resolve() { if (this.resolved) return this; this.resolvedRequestType = this.parent.lookupType(this.requestType); this.resolvedResponseType = this.parent.lookupType(this.responseType); return ReflectionObject.prototype.resolve.call(this); }; } }); // node_modules/protobufjs/src/service.js var require_service2 = __commonJS({ "node_modules/protobufjs/src/service.js"(exports2, module2) { "use strict"; module2.exports = Service; var Namespace = require_namespace(); ((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = "Service"; var Method = require_method(); var util = require_util(); var rpc = require_rpc(); function Service(name, options) { Namespace.call(this, name, options); this.methods = {}; this._methodsArray = null; } Service.fromJSON = function fromJSON(name, json) { var service = new Service(name, json.options); if (json.methods) for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i) service.add(Method.fromJSON(names[i], json.methods[names[i]])); if (json.nested) service.addJSON(json.nested); service.comment = json.comment; return service; }; Service.prototype.toJSON = function toJSON(toJSONOptions) { var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions); var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; return util.toObject([ "options", inherited && inherited.options || void 0, "methods", Namespace.arrayToJSON(this.methodsArray, toJSONOptions) || {}, "nested", inherited && inherited.nested || void 0, "comment", keepComments ? this.comment : void 0 ]); }; Object.defineProperty(Service.prototype, "methodsArray", { get: function() { return this._methodsArray || (this._methodsArray = util.toArray(this.methods)); } }); function clearCache(service) { service._methodsArray = null; return service; } Service.prototype.get = function get(name) { return this.methods[name] || Namespace.prototype.get.call(this, name); }; Service.prototype.resolveAll = function resolveAll() { var methods = this.methodsArray; for (var i = 0; i < methods.length; ++i) methods[i].resolve(); return Namespace.prototype.resolve.call(this); }; Service.prototype.add = function add(object) { if (this.get(object.name)) throw Error("duplicate name '" + object.name + "' in " + this); if (object instanceof Method) { this.methods[object.name] = object; object.parent = this; return clearCache(this); } return Namespace.prototype.add.call(this, object); }; Service.prototype.remove = function remove(object) { if (object instanceof Method) { if (this.methods[object.name] !== object) throw Error(object + " is not a member of " + this); delete this.methods[object.name]; object.parent = null; return clearCache(this); } return Namespace.prototype.remove.call(this, object); }; Service.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) { var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited); for (var i = 0, method; i < this.methodsArray.length; ++i) { var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^\$\\w_]/g, ""); rpcService[methodName] = util.codegen(["r", "c"], util.isReserved(methodName) ? methodName + "_" : methodName)("return this.rpcCall(m,q,s,r,c)")({ m: method, q: method.resolvedRequestType.ctor, s: method.resolvedResponseType.ctor }); } return rpcService; }; } }); // node_modules/protobufjs/src/message.js var require_message = __commonJS({ "node_modules/protobufjs/src/message.js"(exports2, module2) { "use strict"; module2.exports = Message; var util = require_minimal(); function Message(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) this[keys[i]] = properties[keys[i]]; } Message.create = function create(properties) { return this.\$type.create(properties); }; Message.encode = function encode(message, writer) { return this.\$type.encode(message, writer); }; Message.encodeDelimited = function encodeDelimited(message, writer) { return this.\$type.encodeDelimited(message, writer); }; Message.decode = function decode(reader) { return this.\$type.decode(reader); }; Message.decodeDelimited = function decodeDelimited(reader) { return this.\$type.decodeDelimited(reader); }; Message.verify = function verify(message) { return this.\$type.verify(message); }; Message.fromObject = function fromObject(object) { return this.\$type.fromObject(object); }; Message.toObject = function toObject2(message, options) { return this.\$type.toObject(message, options); }; Message.prototype.toJSON = function toJSON() { return this.\$type.toObject(this, util.toJSONOptions); }; } }); // node_modules/protobufjs/src/decoder.js var require_decoder = __commonJS({ "node_modules/protobufjs/src/decoder.js"(exports2, module2) { "use strict"; module2.exports = decoder; var Enum = require_enum(); var types = require_types(); var util = require_util(); function missing(field) { return "missing required '" + field.name + "'"; } function decoder(mtype) { var gen = util.codegen(["r", "l"], mtype.name + "\$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (mtype.fieldsArray.filter(function(field2) { return field2.map; }).length ? ",k,value" : ""))("while(r.pos>>3){"); var i = 0; for (; i < mtype.fieldsArray.length; ++i) { var field = mtype._fieldsArray[i].resolve(), type = field.resolvedType instanceof Enum ? "int32" : field.type, ref = "m" + util.safeProp(field.name); gen("case %i: {", field.id); if (field.map) { gen("if(%s===util.emptyObject)", ref)("%s={}", ref)("var c2 = r.uint32()+r.pos"); if (types.defaults[field.keyType] !== void 0) gen("k=%j", types.defaults[field.keyType]); else gen("k=null"); if (types.defaults[type] !== void 0) gen("value=%j", types.defaults[type]); else gen("value=null"); gen("while(r.pos>>3){")("case 1: k=r.%s(); break", field.keyType)("case 2:"); if (types.basic[type] === void 0) gen("value=types[%i].decode(r,r.uint32())", i); else gen("value=r.%s()", type); gen("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"); if (types.long[field.keyType] !== void 0) gen('%s[typeof k==="object"?util.longToHash(k):k]=value', ref); else gen("%s[k]=value", ref); } else if (field.repeated) { gen("if(!(%s&&%s.length))", ref, ref)("%s=[]", ref); if (types.packed[type] !== void 0) gen("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos>>0", prop, prop); break; case "int32": case "sint32": case "sfixed32": gen("m%s=d%s|0", prop, prop); break; case "uint64": isUnsigned = true; case "int64": case "sint64": case "fixed64": case "sfixed64": gen("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j", prop, prop, isUnsigned)('else if(typeof d%s==="string")', prop)("m%s=parseInt(d%s,10)", prop, prop)('else if(typeof d%s==="number")', prop)("m%s=d%s", prop, prop)('else if(typeof d%s==="object")', prop)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)", prop, prop, prop, isUnsigned ? "true" : ""); break; case "bytes": gen('if(typeof d%s==="string")', prop)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", prop, prop, prop)("else if(d%s.length >= 0)", prop)("m%s=d%s", prop, prop); break; case "string": gen("m%s=String(d%s)", prop, prop); break; case "bool": gen("m%s=Boolean(d%s)", prop, prop); break; } } return gen; } converter.fromObject = function fromObject(mtype) { var fields = mtype.fieldsArray; var gen = util.codegen(["d"], mtype.name + "\$fromObject")("if(d instanceof this.ctor)")("return d"); if (!fields.length) return gen("return new this.ctor"); gen("var m=new this.ctor"); for (var i = 0; i < fields.length; ++i) { var field = fields[i].resolve(), prop = util.safeProp(field.name); if (field.map) { gen("if(d%s){", prop)('if(typeof d%s!=="object")', prop)("throw TypeError(%j)", field.fullName + ": object expected")("m%s={}", prop)("for(var ks=Object.keys(d%s),i=0;i>>0,m%s.high>>>0).toNumber(%s):m%s", prop, prop, prop, prop, isUnsigned ? "true" : "", prop); break; case "bytes": gen("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", prop, prop, prop, prop, prop); break; default: gen("d%s=m%s", prop, prop); break; } } return gen; } converter.toObject = function toObject2(mtype) { var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById); if (!fields.length) return util.codegen()("return {}"); var gen = util.codegen(["m", "o"], mtype.name + "\$toObject")("if(!o)")("o={}")("var d={}"); var repeatedFields = [], mapFields = [], normalFields = [], i = 0; for (; i < fields.length; ++i) if (!fields[i].partOf) (fields[i].resolve().repeated ? repeatedFields : fields[i].map ? mapFields : normalFields).push(fields[i]); if (repeatedFields.length) { gen("if(o.arrays||o.defaults){"); for (i = 0; i < repeatedFields.length; ++i) gen("d%s=[]", util.safeProp(repeatedFields[i].name)); gen("}"); } if (mapFields.length) { gen("if(o.objects||o.defaults){"); for (i = 0; i < mapFields.length; ++i) gen("d%s={}", util.safeProp(mapFields[i].name)); gen("}"); } if (normalFields.length) { gen("if(o.defaults){"); for (i = 0; i < normalFields.length; ++i) { var field = normalFields[i], prop = util.safeProp(field.name); if (field.resolvedType instanceof Enum) gen("d%s=o.enums===String?%j:%j", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault); else if (field.long) gen("if(util.Long){")("var n=new util.Long(%i,%i,%j)", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", prop)("}else")("d%s=o.longs===String?%j:%i", prop, field.typeDefault.toString(), field.typeDefault.toNumber()); else if (field.bytes) { var arrayDefault = "[" + Array.prototype.slice.call(field.typeDefault).join(",") + "]"; gen("if(o.bytes===String)d%s=%j", prop, String.fromCharCode.apply(String, field.typeDefault))("else{")("d%s=%s", prop, arrayDefault)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", prop, prop)("}"); } else gen("d%s=%j", prop, field.typeDefault); } gen("}"); } var hasKs2 = false; for (i = 0; i < fields.length; ++i) { var field = fields[i], index = mtype._fieldsArray.indexOf(field), prop = util.safeProp(field.name); if (field.map) { if (!hasKs2) { hasKs2 = true; gen("var ks2"); } gen("if(m%s&&(ks2=Object.keys(m%s)).length){", prop, prop)("d%s={}", prop)("for(var j=0;j -1) { var altname = filename2.substring(idx); if (altname in common) return altname; } return null; } function process(filename2, source) { try { if (util.isString(source) && source.charAt(0) === "{") source = JSON.parse(source); if (!util.isString(source)) self2.setOptions(source.options).addJSON(source.nested); else { parse.filename = filename2; var parsed = parse(source, self2, options), resolved2, i2 = 0; if (parsed.imports) { for (; i2 < parsed.imports.length; ++i2) if (resolved2 = getBundledFileName(parsed.imports[i2]) || self2.resolvePath(filename2, parsed.imports[i2])) fetch2(resolved2); } if (parsed.weakImports) { for (i2 = 0; i2 < parsed.weakImports.length; ++i2) if (resolved2 = getBundledFileName(parsed.weakImports[i2]) || self2.resolvePath(filename2, parsed.weakImports[i2])) fetch2(resolved2, true); } } } catch (err) { finish(err); } if (!sync && !queued) finish(null, self2); } function fetch2(filename2, weak) { if (self2.files.indexOf(filename2) > -1) return; self2.files.push(filename2); if (filename2 in common) { if (sync) process(filename2, common[filename2]); else { ++queued; setTimeout(function() { --queued; process(filename2, common[filename2]); }); } return; } if (sync) { var source; try { source = util.fs.readFileSync(filename2).toString("utf8"); } catch (err) { if (!weak) finish(err); return; } process(filename2, source); } else { ++queued; self2.fetch(filename2, function(err, source2) { --queued; if (!callback) return; if (err) { if (!weak) finish(err); else if (!queued) finish(null, self2); return; } process(filename2, source2); }); } } var queued = 0; if (util.isString(filename)) filename = [filename]; for (var i = 0, resolved; i < filename.length; ++i) if (resolved = self2.resolvePath("", filename[i])) fetch2(resolved); if (sync) return self2; if (!queued) finish(null, self2); return void 0; }; Root2.prototype.loadSync = function loadSync(filename, options) { if (!util.isNode) throw Error("not supported"); return this.load(filename, options, SYNC); }; Root2.prototype.resolveAll = function resolveAll() { if (this.deferred.length) throw Error("unresolvable extensions: " + this.deferred.map(function(field) { return "'extend " + field.extend + "' in " + field.parent.fullName; }).join(", ")); return Namespace.prototype.resolveAll.call(this); }; var exposeRe = /^[A-Z]/; function tryHandleExtension(root, field) { var extendedType = field.parent.lookup(field.extend); if (extendedType) { var sisterField = new Field(field.fullName, field.id, field.type, field.rule, void 0, field.options); sisterField.declaringField = field; field.extensionField = sisterField; extendedType.add(sisterField); return true; } return false; } Root2.prototype._handleAdd = function _handleAdd(object) { if (object instanceof Field) { if (object.extend !== void 0 && !object.extensionField) { if (!tryHandleExtension(this, object)) this.deferred.push(object); } } else if (object instanceof Enum) { if (exposeRe.test(object.name)) object.parent[object.name] = object.values; } else if (!(object instanceof OneOf)) { if (object instanceof Type2) for (var i = 0; i < this.deferred.length; ) if (tryHandleExtension(this, this.deferred[i])) this.deferred.splice(i, 1); else ++i; for (var j = 0; j < object.nestedArray.length; ++j) this._handleAdd(object._nestedArray[j]); if (exposeRe.test(object.name)) object.parent[object.name] = object; } }; Root2.prototype._handleRemove = function _handleRemove(object) { if (object instanceof Field) { if (object.extend !== void 0) { if (object.extensionField) { object.extensionField.parent.remove(object.extensionField); object.extensionField = null; } else { var index = this.deferred.indexOf(object); if (index > -1) this.deferred.splice(index, 1); } } } else if (object instanceof Enum) { if (exposeRe.test(object.name)) delete object.parent[object.name]; } else if (object instanceof Namespace) { for (var i = 0; i < object.nestedArray.length; ++i) this._handleRemove(object._nestedArray[i]); if (exposeRe.test(object.name)) delete object.parent[object.name]; } }; Root2._configure = function(Type_, parse_, common_) { Type2 = Type_; parse = parse_; common = common_; }; } }); // node_modules/protobufjs/src/util.js var require_util = __commonJS({ "node_modules/protobufjs/src/util.js"(exports2, module2) { "use strict"; var util = module2.exports = require_minimal(); var roots = require_roots(); var Type2; var Enum; util.codegen = require_codegen(); util.fetch = require_fetch(); util.path = require_path(); util.fs = util.inquire("fs"); util.toArray = function toArray(object) { if (object) { var keys = Object.keys(object), array = new Array(keys.length), index = 0; while (index < keys.length) array[index] = object[keys[index++]]; return array; } return []; }; util.toObject = function toObject2(array) { var object = {}, index = 0; while (index < array.length) { var key = array[index++], val = array[index++]; if (val !== void 0) object[key] = val; } return object; }; var safePropBackslashRe = /\\\\/g; var safePropQuoteRe = /"/g; util.isReserved = function isReserved(name) { return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)\$/.test(name); }; util.safeProp = function safeProp(prop) { if (!/^[\$\\w_]+\$/.test(prop) || util.isReserved(prop)) return '["' + prop.replace(safePropBackslashRe, "\\\\\\\\").replace(safePropQuoteRe, '\\\\"') + '"]'; return "." + prop; }; util.ucFirst = function ucFirst(str) { return str.charAt(0).toUpperCase() + str.substring(1); }; var camelCaseRe = /_([a-z])/g; util.camelCase = function camelCase(str) { return str.substring(0, 1) + str.substring(1).replace(camelCaseRe, function(\$0, \$1) { return \$1.toUpperCase(); }); }; util.compareFieldsById = function compareFieldsById(a, b) { return a.id - b.id; }; util.decorateType = function decorateType(ctor, typeName) { if (ctor.\$type) { if (typeName && ctor.\$type.name !== typeName) { util.decorateRoot.remove(ctor.\$type); ctor.\$type.name = typeName; util.decorateRoot.add(ctor.\$type); } return ctor.\$type; } if (!Type2) Type2 = require_type(); var type = new Type2(typeName || ctor.name); util.decorateRoot.add(type); type.ctor = ctor; Object.defineProperty(ctor, "\$type", { value: type, enumerable: false }); Object.defineProperty(ctor.prototype, "\$type", { value: type, enumerable: false }); return type; }; var decorateEnumIndex = 0; util.decorateEnum = function decorateEnum(object) { if (object.\$type) return object.\$type; if (!Enum) Enum = require_enum(); var enm = new Enum("Enum" + decorateEnumIndex++, object); util.decorateRoot.add(enm); Object.defineProperty(object, "\$type", { value: enm, enumerable: false }); return enm; }; util.setProperty = function setProperty(dst, path, value) { function setProp(dst2, path2, value2) { var part = path2.shift(); if (part === "__proto__") { return dst2; } if (path2.length > 0) { dst2[part] = setProp(dst2[part] || {}, path2, value2); } else { var prevValue = dst2[part]; if (prevValue) value2 = [].concat(prevValue).concat(value2); dst2[part] = value2; } return dst2; } if (typeof dst !== "object") throw TypeError("dst must be an object"); if (!path) throw TypeError("path must be specified"); path = path.split("."); return setProp(dst, path, value); }; Object.defineProperty(util, "decorateRoot", { get: function() { return roots["decorated"] || (roots["decorated"] = new (require_root())()); } }); } }); // node_modules/protobufjs/src/object.js var require_object = __commonJS({ "node_modules/protobufjs/src/object.js"(exports2, module2) { "use strict"; module2.exports = ReflectionObject; ReflectionObject.className = "ReflectionObject"; var util = require_util(); var Root2; function ReflectionObject(name, options) { if (!util.isString(name)) throw TypeError("name must be a string"); if (options && !util.isObject(options)) throw TypeError("options must be an object"); this.options = options; this.parsedOptions = null; this.name = name; this.parent = null; this.resolved = false; this.comment = null; this.filename = null; } Object.defineProperties(ReflectionObject.prototype, { root: { get: function() { var ptr = this; while (ptr.parent !== null) ptr = ptr.parent; return ptr; } }, fullName: { get: function() { var path = [this.name], ptr = this.parent; while (ptr) { path.unshift(ptr.name); ptr = ptr.parent; } return path.join("."); } } }); ReflectionObject.prototype.toJSON = function toJSON() { throw Error(); }; ReflectionObject.prototype.onAdd = function onAdd(parent) { if (this.parent && this.parent !== parent) this.parent.remove(this); this.parent = parent; this.resolved = false; var root = parent.root; if (root instanceof Root2) root._handleAdd(this); }; ReflectionObject.prototype.onRemove = function onRemove(parent) { var root = parent.root; if (root instanceof Root2) root._handleRemove(this); this.parent = null; this.resolved = false; }; ReflectionObject.prototype.resolve = function resolve() { if (this.resolved) return this; if (this.root instanceof Root2) this.resolved = true; return this; }; ReflectionObject.prototype.getOption = function getOption(name) { if (this.options) return this.options[name]; return void 0; }; ReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) { if (!ifNotSet || !this.options || this.options[name] === void 0) (this.options || (this.options = {}))[name] = value; return this; }; ReflectionObject.prototype.setParsedOption = function setParsedOption(name, value, propName) { if (!this.parsedOptions) { this.parsedOptions = []; } var parsedOptions = this.parsedOptions; if (propName) { var opt = parsedOptions.find(function(opt2) { return Object.prototype.hasOwnProperty.call(opt2, name); }); if (opt) { var newValue = opt[name]; util.setProperty(newValue, propName, value); } else { opt = {}; opt[name] = util.setProperty({}, propName, value); parsedOptions.push(opt); } } else { var newOpt = {}; newOpt[name] = value; parsedOptions.push(newOpt); } return this; }; ReflectionObject.prototype.setOptions = function setOptions(options, ifNotSet) { if (options) for (var keys = Object.keys(options), i = 0; i < keys.length; ++i) this.setOption(keys[i], options[keys[i]], ifNotSet); return this; }; ReflectionObject.prototype.toString = function toString2() { var className = this.constructor.className, fullName = this.fullName; if (fullName.length) return className + " " + fullName; return className; }; ReflectionObject._configure = function(Root_) { Root2 = Root_; }; } }); // node_modules/protobufjs/src/enum.js var require_enum = __commonJS({ "node_modules/protobufjs/src/enum.js"(exports2, module2) { "use strict"; module2.exports = Enum; var ReflectionObject = require_object(); ((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = "Enum"; var Namespace = require_namespace(); var util = require_util(); function Enum(name, values, options, comment, comments, valuesOptions) { ReflectionObject.call(this, name, options); if (values && typeof values !== "object") throw TypeError("values must be an object"); this.valuesById = {}; this.values = Object.create(this.valuesById); this.comment = comment; this.comments = comments || {}; this.valuesOptions = valuesOptions; this.reserved = void 0; if (values) { for (var keys = Object.keys(values), i = 0; i < keys.length; ++i) if (typeof values[keys[i]] === "number") this.valuesById[this.values[keys[i]] = values[keys[i]]] = keys[i]; } } Enum.fromJSON = function fromJSON(name, json) { var enm = new Enum(name, json.values, json.options, json.comment, json.comments); enm.reserved = json.reserved; return enm; }; Enum.prototype.toJSON = function toJSON(toJSONOptions) { var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; return util.toObject([ "options", this.options, "valuesOptions", this.valuesOptions, "values", this.values, "reserved", this.reserved && this.reserved.length ? this.reserved : void 0, "comment", keepComments ? this.comment : void 0, "comments", keepComments ? this.comments : void 0 ]); }; Enum.prototype.add = function add(name, id, comment, options) { if (!util.isString(name)) throw TypeError("name must be a string"); if (!util.isInteger(id)) throw TypeError("id must be an integer"); if (this.values[name] !== void 0) throw Error("duplicate name '" + name + "' in " + this); if (this.isReservedId(id)) throw Error("id " + id + " is reserved in " + this); if (this.isReservedName(name)) throw Error("name '" + name + "' is reserved in " + this); if (this.valuesById[id] !== void 0) { if (!(this.options && this.options.allow_alias)) throw Error("duplicate id " + id + " in " + this); this.values[name] = id; } else this.valuesById[this.values[name] = id] = name; if (options) { if (this.valuesOptions === void 0) this.valuesOptions = {}; this.valuesOptions[name] = options || null; } this.comments[name] = comment || null; return this; }; Enum.prototype.remove = function remove(name) { if (!util.isString(name)) throw TypeError("name must be a string"); var val = this.values[name]; if (val == null) throw Error("name '" + name + "' does not exist in " + this); delete this.valuesById[val]; delete this.values[name]; delete this.comments[name]; if (this.valuesOptions) delete this.valuesOptions[name]; return this; }; Enum.prototype.isReservedId = function isReservedId(id) { return Namespace.isReservedId(this.reserved, id); }; Enum.prototype.isReservedName = function isReservedName(name) { return Namespace.isReservedName(this.reserved, name); }; } }); // node_modules/protobufjs/src/encoder.js var require_encoder = __commonJS({ "node_modules/protobufjs/src/encoder.js"(exports2, module2) { "use strict"; module2.exports = encoder; var Enum = require_enum(); var types = require_types(); var util = require_util(); function genTypePartial(gen, field, fieldIndex, ref) { return field.resolvedType.group ? gen("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", fieldIndex, ref, (field.id << 3 | 3) >>> 0, (field.id << 3 | 4) >>> 0) : gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0); } function encoder(mtype) { var gen = util.codegen(["m", "w"], mtype.name + "\$encode")("if(!w)")("w=Writer.create()"); var i, ref; var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById); for (var i = 0; i < fields.length; ++i) { var field = fields[i].resolve(), index = mtype._fieldsArray.indexOf(field), type = field.resolvedType instanceof Enum ? "int32" : field.type, wireType = types.basic[type]; ref = "m" + util.safeProp(field.name); if (field.map) { gen("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", ref, field.name)("for(var ks=Object.keys(%s),i=0;i>> 0, 8 | types.mapKey[field.keyType], field.keyType); if (wireType === void 0) gen("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", index, ref); else gen(".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | wireType, type, ref); gen("}")("}"); } else if (field.repeated) { gen("if(%s!=null&&%s.length){", ref, ref); if (field.packed && types.packed[type] !== void 0) { gen("w.uint32(%i).fork()", (field.id << 3 | 2) >>> 0)("for(var i=0;i<%s.length;++i)", ref)("w.%s(%s[i])", type, ref)("w.ldelim()"); } else { gen("for(var i=0;i<%s.length;++i)", ref); if (wireType === void 0) genTypePartial(gen, field, index, ref + "[i]"); else gen("w.uint32(%i).%s(%s[i])", (field.id << 3 | wireType) >>> 0, type, ref); } gen("}"); } else { if (field.optional) gen("if(%s!=null&&Object.hasOwnProperty.call(m,%j))", ref, field.name); if (wireType === void 0) genTypePartial(gen, field, index, ref); else gen("w.uint32(%i).%s(%s)", (field.id << 3 | wireType) >>> 0, type, ref); } } return gen("return w"); } } }); // node_modules/protobufjs/src/index-light.js var require_index_light = __commonJS({ "node_modules/protobufjs/src/index-light.js"(exports2, module2) { "use strict"; var protobuf = module2.exports = require_index_minimal(); protobuf.build = "light"; function load2(filename, root, callback) { if (typeof root === "function") { callback = root; root = new protobuf.Root(); } else if (!root) root = new protobuf.Root(); return root.load(filename, callback); } protobuf.load = load2; function loadSync(filename, root) { if (!root) root = new protobuf.Root(); return root.loadSync(filename); } protobuf.loadSync = loadSync; protobuf.encoder = require_encoder(); protobuf.decoder = require_decoder(); protobuf.verifier = require_verifier(); protobuf.converter = require_converter(); protobuf.ReflectionObject = require_object(); protobuf.Namespace = require_namespace(); protobuf.Root = require_root(); protobuf.Enum = require_enum(); protobuf.Type = require_type(); protobuf.Field = require_field(); protobuf.OneOf = require_oneof(); protobuf.MapField = require_mapfield(); protobuf.Service = require_service2(); protobuf.Method = require_method(); protobuf.Message = require_message(); protobuf.wrappers = require_wrappers(); protobuf.types = require_types(); protobuf.util = require_util(); protobuf.ReflectionObject._configure(protobuf.Root); protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum); protobuf.Root._configure(protobuf.Type); protobuf.Field._configure(protobuf.Type); } }); // node_modules/protobufjs/light.js var require_light = __commonJS({ "node_modules/protobufjs/light.js"(exports2, module2) { "use strict"; module2.exports = require_index_light(); } }); // src/utils/format/integer.ts function integerFormat(num, byte = 2) { return num < 10 ** byte ? (Array(byte).join("0") + num).slice(-1 * byte) : num; } // src/utils/format/time.ts function timeFormat(time = new Date().getTime(), type) { const date = new Date(time); const arr2 = date.toLocaleString().split(" "); const day = arr2[0].split("/"); day[1] = integerFormat(day[1], 2); day[2] = integerFormat(day[2], 2); return type ? day.join("-") + " " + arr2[1] : arr2[1]; } // src/utils/debug.ts var group = { i: 0, call: [] }; function debug(...data) { group.call.push(console.log.bind(console, \`%c[\${timeFormat()}]\`, "color: blue;", ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; } debug.assert = function(condition, ...data) { group.call.push(console.assert.bind(console, \`[\${timeFormat()}]\`, ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; debug.clear = function() { group.i = 0; group.call = []; setTimeout(console.clear.bind(console)); return debug; }; debug.debug = function(...data) { group.call.push(console.debug.bind(console, \`[\${timeFormat()}]\`, ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; debug.error = function(...data) { group.call.push(console.error.bind(console, \`[\${timeFormat()}]\`, ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; debug.group = function(...data) { group.i++; group.call.push(console.group.bind(console, \`[\${timeFormat()}]\`, ...arguments)); return debug; }; debug.groupCollapsed = function(...data) { group.i++; group.call.push(console.groupCollapsed.bind(console, \`[\${timeFormat()}]\`, ...arguments)); return debug; }; debug.groupEnd = function() { if (group.i) { group.i--; group.call.push(console.groupEnd.bind(console)); !group.i && (group.call.push(() => group.call = []), group.call.forEach((d) => setTimeout(d))); } return debug; }; debug.info = function(...data) { group.call.push(console.info.bind(console, \`%c[\${timeFormat()}]\`, "color: blue;", ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; debug.log = function(...data) { group.call.push(console.log.bind(console, \`%c[\${timeFormat()}]\`, "color: blue;", ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; debug.table = function(tabularData, properties) { group.call.push(console.table.bind(console, ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; debug.time = function(label) { console.time(label); return debug; }; debug.timeEnd = function(label) { console.timeEnd(label); return debug; }; debug.timeLog = function(label, ...data) { console.timeLog(label, \`[\${timeFormat()}]\`, ...data); return debug; }; debug.trace = function(...data) { group.call.push(console.trace.bind(console, ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; debug.warn = function(...data) { group.call.push(console.warn.bind(console, \`[\${timeFormat()}]\`, ...arguments)); !group.i && setTimeout(group.call.shift()); return debug; }; // src/utils/file.ts function readAs(file, type = "string", encoding = "utf-8") { return new Promise((resolve, reject) => { const reader = new FileReader(); switch (type) { case "ArrayBuffer": reader.readAsArrayBuffer(file); break; case "DataURL": reader.readAsDataURL(file); break; case "string": reader.readAsText(file, encoding); break; } reader.onload = () => resolve(reader.result); reader.onerror = (e) => reject(e); }); } async function saveAs(content, fileName, contentType = "text/plain") { const a = document.createElement("a"); const file = new Blob([content], { type: contentType }); a.href = URL.createObjectURL(file); a.download = fileName; a.addEventListener("load", () => URL.revokeObjectURL(a.href)); a.click(); } function fileRead(accept, multiple) { return new Promise((resolve, reject) => { const input = document.createElement("input"); let selected = false; input.type = "file"; accept && (input.accept = accept); multiple && (input.multiple = multiple); input.style.opacity = "0"; input.addEventListener("change", () => { selected = true; resolve(input.files); }); document.body.appendChild(input); input.click(); window.addEventListener("focus", () => { setTimeout(() => { selected || reject("取消选择~"); }, 100); }, { once: true }); }); } // src/utils/typeof.ts var isArray = Array.isArray; var isObject = (val) => val !== null && typeof val === "object"; var isNumber = (val) => !isNaN(parseFloat(val)) && isFinite(val); // src/utils/hook/method.ts function methodHook(target, propertyKey, callback, modifyArguments) { try { let modify2 = function() { loaded = true; if (values[0]) { Reflect.defineProperty(target, propertyKey, { configurable: true, value: values[0] }); iArguments.forEach((d) => values[0](...d)); } else { debug.error("拦截方法出错!", "目标方法", propertyKey, "所属对象", target); } }; var modify = modify2; const values = []; const iArguments = []; let loading2 = false; let loaded = false; Reflect.defineProperty(target, propertyKey, { configurable: true, set: (v) => { if (loading2 && !loaded) { values.unshift(v); } return true; }, get: () => { if (!loading2) { loading2 = true; setTimeout(() => { const res = callback(); if (res && res.finally) { res.finally(() => modify2()); } else { modify2(); } }); } return function() { modifyArguments?.(arguments); iArguments.push(arguments); }; } }); } catch (e) { debug.error(e); } } function propertyHook(target, propertyKey, propertyValue, configurable = true) { try { Reflect.defineProperty(target, propertyKey, { configurable, set: (v) => true, get: () => { Reflect.defineProperty(target, propertyKey, { configurable: true, value: propertyValue }); return propertyValue; } }); } catch (e) { debug.error(e); } } propertyHook.modify = (target, propertyKey, callback, once = false) => { try { let value = target[propertyKey]; value && (value = callback(value)); Reflect.defineProperty(target, propertyKey, { configurable: true, set: (v) => { value = callback(v); return true; }, get: () => { if (once) { Reflect.deleteProperty(target, propertyKey); Reflect.set(target, propertyKey, value); } return value; } }); } catch (e) { debug.error(e); } }; function ProxyHandler(target, parrent, key) { return new Proxy(target, { deleteProperty(target2, p) { const res = Reflect.deleteProperty(target2, p); parrent[key] = target2; return res; }, set(target2, p, newValue, receiver) { const res = Reflect.set(target2, p, newValue, receiver); parrent[key] = target2; return res; }, get(target2, p, receiver) { const res = Reflect.get(target2, p, receiver); if (isArray(res) || isObject(res)) { return ProxyHandler(res, receiver, p); } return res; } }); } function propertryChangeHook(target, callback) { return new Proxy(target, { deleteProperty(target2, p) { const res = Reflect.deleteProperty(target2, p); callback(p, void 0); return res; }, set(target2, p, newValue, receiver) { const res = Reflect.set(target2, p, newValue, receiver); callback(p, newValue); return res; }, get(target2, p, receiver) { const res = Reflect.get(target2, p, receiver); if (isArray(res) || isObject(res)) { return ProxyHandler(res, receiver, p); } return res; } }); } // src/utils/poll.ts function poll(check, callback, delay = 100, stop = 180) { let timer = setInterval(() => { const d = check(); if (d) { clearInterval(timer); callback(d); } }, delay); stop && setTimeout(() => clearInterval(timer), stop * 1e3); } // src/utils/element.ts function addElement(tag, attribute, parrent, innerHTML, top, replaced) { let element = document.createElement(tag); attribute && Object.entries(attribute).forEach((d) => element.setAttribute(d[0], d[1])); parrent = parrent || document.body; innerHTML && (element.innerHTML = innerHTML); replaced ? replaced.replaceWith(element) : top ? parrent.insertBefore(element, parrent.firstChild) : parrent.appendChild(element); return element; } async function addCss(txt, id, parrent) { if (!parrent && !document.head) { await new Promise((r) => poll(() => document.body, r)); } parrent = parrent || document.head; const style = document.createElement("style"); style.setAttribute("type", "text/css"); id && !parrent.querySelector(\`#\${id}\`) && style.setAttribute("id", id); style.appendChild(document.createTextNode(txt)); parrent.appendChild(style); return style; } function loadScript(src, onload) { return new Promise((r, j) => { const script = document.createElement("script"); script.type = "text/javascript"; script.src = src; script.addEventListener("load", () => { script.remove(); onload && onload(); r(true); }); script.addEventListener("error", () => { script.remove(); j(); }); (document.body || document.head || document.documentElement || document).appendChild(script); }); } function getTotalTop(node) { var sum = 0; do { sum += node.offsetTop; node = node.offsetParent; } while (node); return sum; } // src/html/button.html var button_default = '
按钮
\\r\\n'; // src/core/ui/utils/button.ts var PushButton = class extends HTMLElement { _button; constructor() { super(); const root = this.attachShadow({ mode: "closed" }); root.innerHTML = button_default; this._button = root.querySelector(".button"); this._button.addEventListener("click", (e) => { e.stopPropagation(); this.dispatchEvent(new Event("change")); }); } set text(v) { this._button.textContent = v; } }; customElements.get(\`button-\${"6b79f67"}\`) || customElements.define(\`button-\${"6b79f67"}\`, PushButton); // src/html/popupbox.html var popupbox_default = '
\\r\\n
\\r\\n
\\r\\n
\\r\\n'; // src/svg/fork.svg var fork_default = ''; // src/svg/gear.svg var gear_default = ''; // src/svg/wrench.svg var wrench_default = ''; // src/svg/note.svg var note_default = ''; // src/svg/dmset.svg var dmset_default = ''; // src/svg/stethoscope.svg var stethoscope_default = ''; // src/svg/play.svg var play_default = ''; // src/svg/palette.svg var palette_default = ''; // src/svg/download.svg var download_default = ''; // src/svg/warn.svg var warn_default = ''; // src/svg/linechart.svg var linechart_default = ''; // src/svg/blind.svg var blind_default = ''; // src/svg/like.svg var like_default = ''; // src/svg/dislike.svg var dislike_default = ''; // src/utils/svg.ts var svg = { fork: fork_default, gear: gear_default, wrench: wrench_default, note: note_default, dmset: dmset_default, stethoscope: stethoscope_default, play: play_default, palette: palette_default, download: download_default, warn: warn_default, linechart: linechart_default, blind: blind_default, like: like_default, dislike: dislike_default }; // src/core/ui/utils/popupbox.ts var ClickOutRemove = class { constructor(target) { this.target = target; target.addEventListener("click", (e) => e.stopPropagation()); } enabled = false; remove = () => { this.target.remove(); }; disable = () => { if (this.enabled) { document.removeEventListener("click", this.remove); this.enabled = false; } return this; }; enable = () => { this.enabled || setTimeout(() => { document.addEventListener("click", this.remove, { once: true }); this.enabled = true; }, 100); return this; }; }; var PopupBox = class extends HTMLElement { _contain; _fork; clickOutRemove; \$fork = true; constructor() { super(); const root = this.attachShadow({ mode: "closed" }); root.innerHTML = popupbox_default; this._contain = root.children[0].children[0]; this._fork = root.children[0].children[1]; this._fork.innerHTML = svg.fork; this._fork.addEventListener("click", () => this.remove()); this.clickOutRemove = new ClickOutRemove(this); document.body.appendChild(this); } append(...nodes) { this._contain.append(...nodes); } appendChild(node) { this._contain.appendChild(node); return node; } replaceChildren(...nodes) { this._contain.replaceChildren(...nodes); } setAttribute(qualifiedName, value) { this._contain.setAttribute(qualifiedName, value); } getAttribute(qualifiedName) { return this._contain.getAttribute(qualifiedName); } get style() { return this._contain.style; } get innerHTML() { return this._contain.innerHTML; } set innerHTML(v) { this._contain.innerHTML = v; } get fork() { return this.\$fork; } set fork(v) { this.\$fork = v; this._fork.style.display = v ? "" : "none"; if (v) { this.clickOutRemove.disable(); } else { this.clickOutRemove.enable(); } } }; customElements.get(\`popupbox-\${"6b79f67"}\`) || customElements.define(\`popupbox-\${"6b79f67"}\`, PopupBox); // src/core/ui/alert.ts function alert(msg, title, buttons) { isArray(msg) || (msg = [msg]); msg = msg.join("
"); const popup = new PopupBox(); popup.fork = false; popup.setAttribute("style", "max-width: 400px; max-height: 300px;line-height: 16px;"); popup.innerHTML = \`
\${title || "Bilibili Old"}
\${msg}
\`; if (buttons) { addElement("hr", { style: "width: 100%;opacity: .3;" }, popup); const div = addElement("div", { style: "display: flex;align-items: center;justify-content: space-around;" }, popup); buttons.forEach((d) => { const button = new PushButton(); button.text = d.text; button.addEventListener("change", () => { d.callback?.(); popup.remove(); }); div.appendChild(button); }); } } // src/html/toast.html var toast_default = '
\\r\\n\\r\\n'; // src/utils/type.ts function toObject(input) { switch (input) { case "undefined": input = void 0; break; case "null": input = null; break; case "NaN": input = NaN; break; default: if (!input) break; try { const temp = JSON.parse(input); if (typeof temp !== "number" || input === String(temp)) { input = temp; } } catch { try { const temp = Number(input); if (String(temp) !== "NaN" && !input.startsWith("0")) { input = temp; } } catch { } try { if (/^\\d+n\$/.test(input)) input = BigInt(input.slice(0, -1)); } catch { } } break; } return input; } function toString(input, space = "\\n") { let result; try { result = input.toString(); } catch { result = String(input); } if (result.startsWith("[object") && result.endsWith("]")) { try { const str = JSON.stringify(input, void 0, space); str === "{}" || (result = str); } catch { } } return result; } // src/core/toast.ts var Toastconfig = { position: "top-right", rtl: false, delay: 4, disabled: false }; var Toast = class extends HTMLDivElement { closeButton = document.createElement("div"); message = document.createElement("div"); timer; hovering = false; timeout = false; constructor() { super(); this.classList.add("toast"); this.setAttribute("aria-live", "assertive"); this.setAttribute("style", "padding-top: 0px;padding-bottom: 0px;height: 0px;"); this.appendChild(this.message); this.message.className = "toast-message"; this.closeButton.className = "toast-close-button"; this.closeButton.innerHTML = svg.fork; this.closeButton.addEventListener("click", (e) => { this.timeout = true; this.delay = 1; e.stopPropagation(); }); this.addEventListener("mouseover", () => this.hovering = true); this.addEventListener("mouseout", () => { this.hovering = false; this.timeout && (this.delay = 1); }); } set data(v) { isArray(v) || (v = [v]); let html = ""; v.forEach((d, i) => { d = toString(d); html += i ? \`
\${d}\` : \`\`; }); const close = this.message.contains(this.closeButton); this.message.innerHTML = html; close && (this.delay = 0); this.setAttribute("style", \`height: \${this.message.scrollHeight + 30}px;\`); } set type(v) { this.classList.remove("toast-success", "toast-error", "toast-info", "toast-warning"); v && this.classList.add(\`toast-\${v}\`); } set rtl(v) { v ? this.classList.add("rtl") : this.classList.remove("rtl"); } set delay(v) { clearTimeout(this.timer); v = Math.max(Math.trunc(v), 0); v ? this.message.contains(this.closeButton) && this.closeButton.remove() : this.message.contains(this.closeButton) || this.message.insertBefore(this.closeButton, this.message.firstChild); if (v === 1) { if (!this.hovering) { this.setAttribute("style", "padding-top: 0px;padding-bottom: 0px;height: 0px;"); setTimeout(() => this.remove(), 1e3); } } else if (v !== 0) { this.timer = setTimeout(() => { this.timeout = true; this.delay = 1; }, v * 1e3); } } }; customElements.get(\`toast-\${"6b79f67"}\`) || customElements.define(\`toast-\${"6b79f67"}\`, Toast, { extends: "div" }); var ToastContainer = class extends HTMLElement { container; static get observedAttributes() { return [ "position", "rtl", "delay", "disabled" ]; } constructor() { super(); const root = this.attachShadow({ mode: "closed" }); root.innerHTML = toast_default; this.container = root.children[0]; } update(value) { Object.entries(value).forEach((d) => { this[d[0]] = d[1]; }); } toast(delay, type = "info", ...data) { document.body.contains(this) || document.body.appendChild(this); const toast = new Toast(); toast.type = type; toast.rtl = this.rtl; this.container.insertBefore(toast, this.container.firstChild); toast.data = data; toast.delay = delay; return toast; } success(...data) { this.toast(this.delay, "success", ...data); return () => { debug(...data); }; } error(...data) { this.toast(this.delay, "error", ...data); return () => { debug.error(...data); }; } info(...data) { this.toast(this.delay, "info", ...data); return () => { debug.debug(...data); }; } warning(...data) { this.toast(this.delay, "warning", ...data); return () => { debug.warn(...data); }; } set position(v) { this.setAttribute("position", v); } get position() { return this.getAttribute("position"); } set rtl(v) { this.setAttribute("rtl", v); } get rtl() { return toObject(this.getAttribute("rtl")); } set delay(v) { this.setAttribute("delay", v); } get delay() { return toObject(this.getAttribute("delay")); } set disabled(v) { this.setAttribute("disabled", v); } get disabled() { return toObject(this.getAttribute("disabled")); } attributeChangedCallback(name, oldValue, newValue) { if (oldValue === newValue) return; switch (name) { case "position": newValue && (this.container.className = \`toast-\${newValue}\`); break; case "rtl": this.container.querySelectorAll(".toast").forEach((d) => { d.rtl = toObject(newValue); }); break; case "delay": this.container.querySelectorAll(".toast").forEach((d) => { d.delay = toObject(newValue); }); break; case "disabled": this.container.style.display = toObject(newValue) ? "none" : ""; default: break; } } }; customElements.get(\`toast-container-\${"6b79f67"}\`) || customElements.define(\`toast-container-\${"6b79f67"}\`, ToastContainer); // src/html/ui-entry.html var ui_entry_default = '
\\r\\n 设置\\r\\n
\\r\\n
\\r\\n'; // src/core/ui/entry.ts var UiEntryType = "new"; var BilioldEntry = class extends HTMLElement { stage; gear; root; static get observedAttributes() { return [ "type" ]; } constructor() { super(); this.root = this.attachShadow({ mode: "closed" }); this.root.innerHTML = ui_entry_default; this.stage = this.root.children[0]; this.gear = this.root.children[1]; this.gear.innerHTML = svg.gear; this.stage.remove(); this.gear.remove(); this.gear.addEventListener("mouseover", () => this.gear.style.opacity = "0.8"); this.gear.addEventListener("mouseout", () => this.gear.style.opacity = "0"); } get type() { return this.getAttribute("type"); } set type(v) { this.setAttribute("type", v); } attributeChangedCallback(name, oldValue, newValue) { if (oldValue === newValue) return; switch (name) { case "type": if (newValue === "old") { this.root.contains(this.gear) && this.gear.remove(); this.root.contains(this.stage) || this.root.appendChild(this.stage); } else { this.root.contains(this.stage) && this.stage.remove(); if (!this.root.contains(this.gear)) { this.root.appendChild(this.gear); setTimeout(() => { this.gear.style.opacity = "0"; }, 2e3); } } break; default: break; } } }; customElements.get("biliold-entry-6b79f67") || customElements.define("bilibili-entry-6b79f67", BilioldEntry); // src/core/userstatus.ts var userStatus = { development: true, index: true, toast: Toastconfig, header: true, comment: true, av: true, player: true, webRTC: false, elecShow: true, staff: false, bangumi: true, videoLimit: { status: false, server: "内置", th: "api.global.bilibili.com", tw: "", hk: "", cn: "" }, uposReplace: { th: "ks3(金山)", gat: "不替换", nor: "不替换", download: "不替换" }, bangumiEplist: false, accessKey: { token: "", date: 0, dateStr: "" }, watchlater: true, playlist: true, ranking: true, read: true, search: true, album: true, jointime: false, lostVideo: true, history: true, liveRecord: false, uiEntryType: UiEntryType, automate: { danmakuFirst: false, showBofqi: false, screenWide: false, noDanmaku: false, autoPlay: false, webFullScreen: false, videospeed: false }, videoDisableAA: false, disableSleepChcek: true, disableReport: true, commentJumpUrlTitle: false, ugcSection: false, downloadType: ["mp4"], TVresource: false, downloadQn: 127, downloadMethod: "浏览器", userAgent: "Bilibili Freedoooooom/MarkII", referer: "https://www.bilibili.com", filepath: "", aria2: { server: "http://localhost", port: 6800, token: "", split: 4, size: 20 }, ef2: { delay: false, silence: false }, like: false, bilibiliplayer: true, checkUpdate: true, show1080p: false, fullBannerCover: false, dmproto: true, dmwrap: true, dmExtension: "xml", dmContact: false }; // src/core/user.ts var User = class { constructor(BLOD2) { this.BLOD = BLOD2; this.BLOD.GM.getValue("userStatus", userStatus).then((status) => { status = Object.assign(userStatus, status); const proxy = propertryChangeHook(status, (key, value) => { clearTimeout(this.timer); this.timer = setTimeout(() => this.BLOD.GM.setValue("userStatus", status)); this.emitChange(key, value); }); this.userStatus = proxy; this.initialized = true; while (this.BLOD.userLoadedCallbacks.length) { this.BLOD.userLoadedCallbacks.shift()?.(this.userStatus); } }); } userStatus; initialized = false; updating; changes = {}; timer; bindChange(key, callback) { this.changes[key] || (this.changes[key] = []); const id = this.changes[key].push(callback); return () => { delete this.changes[key][id - 1]; }; } emitChange(key, newValue) { this.changes[key].forEach(async (d) => { d(newValue); }); } addCallback(callback) { if (typeof callback === "function") { if (this.initialized) { callback(this.userStatus); } else { this.BLOD.userLoadedCallbacks.push(callback); } } } restoreUserStatus() { this.BLOD.GM.deleteValue("userStatus"); this.BLOD.toast.warning("已恢复默认设置数据,请刷新页面以避免数据紊乱!"); } outputUserStatus() { this.BLOD.GM.getValue("userStatus", userStatus).then((d) => { saveAs(JSON.stringify(d, void 0, " "), \`Bilibili-Old-\${timeFormat(void 0, true).replace(/ |:/g, (d2) => "-")}\`, "application/json"); }); } inputUserStatus() { const msg = ["请选择一个备份的数据文件(.json)", "注意:无效的数据文件可能导致异常!"]; const toast = this.BLOD.toast.toast(0, "warning", ...msg); fileRead("application/json").then((d) => { if (d && d[0]) { msg.push(\`读取文件:\${d[0].name}\`); toast.data = msg; toast.type = "info"; return readAs(d[0]).then((d2) => { const data = JSON.parse(d2); if (typeof data === "object") { this.BLOD.GM.setValue("userStatus", data); const text = "已恢复设置数据,请刷新页面以避免数据紊乱!"; msg.push(text); toast.data = msg; toast.type = "success"; return alert(text, "刷新页面", [{ text: "刷新", callback: () => location.reload() }]); } }).catch((e) => { msg.push("读取文件出错!", e); toast.data = msg; toast.type = "error"; debug.error("恢复设置数据", e); }); } }).catch((e) => { msg.push(e); toast.data = msg; }).finally(() => { toast.delay = 4; }); } }; // src/utils/abv.ts var Abv = class { base58Table = "fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF"; digitMap = [11, 10, 3, 8, 4, 6]; xor = 177451812; add = 8728348608; bvidTemplate = ["B", "V", 1, "", "", 4, "", 1, "", 7, "", ""]; table = {}; constructor() { for (let i = 0; i < 58; i++) this.table[this.base58Table[i]] = i; } check(input) { if (/^[aA][vV][0-9]+\$/.test(String(input)) || /^\\d+\$/.test(String(input))) return this.avToBv(Number(/[0-9]+/.exec(String(input))[0])); if (/^1[fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF]{9}\$/.test(String(input))) return this.bvToAv("BV" + input); if (/^[bB][vV]1[fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF]{9}\$/.test(String(input))) return this.bvToAv(String(input)); throw input; } bvToAv(BV) { let r = 0; for (let i = 0; i < 6; i++) r += this.table[BV[this.digitMap[i]]] * 58 ** i; return r - this.add ^ this.xor; } avToBv(av) { let bv = Array.from(this.bvidTemplate); av = (av ^ this.xor) + this.add; for (let i = 0; i < 6; i++) bv[this.digitMap[i]] = this.base58Table[parseInt(String(av / 58 ** i)) % 58]; return bv.join(""); } }; function abv(input) { return new Abv().check(input); } function BV2avAll(str) { return str.replace(/[bB][vV]1[fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF]{9}/g, (s) => "av" + abv(s)); } // src/utils/format/url.ts var URL2 = class { hash; base; params = {}; get param() { return Object.entries(this.params).reduce((s, d) => { return s += \`\${s ? "&" : ""}\${d[0]}=\${d[1]}\`; }, ""); } constructor(url) { const arr1 = url.split("#"); let str = arr1.shift(); this.hash = arr1.join("#"); (this.hash || url.includes("#")) && (this.hash = \`#\${this.hash}\`); const arr2 = str.split("?"); this.base = arr2.shift(); str = arr2.join("?"); if (str) { str.split("&").forEach((d) => { const arr3 = d.split("="); const key = arr3.shift(); let value = arr3.join("=") || ""; try { if (!isNumber(value)) { value = JSON.parse(value); } } catch { value === "undefined" && (value = void 0); value === "NaN" && (value = NaN); } this.params[key] = value; }); } } sort() { this.params = Object.keys(this.params).sort().reduce((s, d) => { s[d] = this.params[d]; return s; }, {}); } toJSON() { return \`\${this.base ? this.param ? this.base + "?" : this.base : ""}\${this.param}\${this.hash || ""}\`; } }; function objUrl(url, obj) { const res = new URL2(url); Object.entries(obj).forEach((d) => { if (d[1] === void 0 || d[1] === null) return; res.params[d[0]] = d[1]; }); return res.toJSON(); } function urlObj(url) { const res = new URL2(url); return res.params; } // src/core/url.ts var paramsSet = /* @__PURE__ */ new Set([ "spm_id_from", "from_source", "msource", "bsource", "seid", "source", "session_id", "visit_id", "sourceFrom", "from_spmid", "share_source", "share_medium", "share_plat", "share_session_id", "share_tag", "unique_k", "vd_source", "csource" ]); var paramArr = Object.entries({ from: ["search"] }); var UrlCleaner = class { paramsSet = paramsSet; paramArr = paramArr; constructor() { this.location(); window.navigation?.addEventListener("navigate", (e) => { const newURL = this.clear(e.destination.url); if (e.destination.url != newURL) { e.preventDefault(); if (newURL == window.location.href) return; this.updateLocation(newURL); } }); window.addEventListener("click", (e) => this.anchorClick(e)); window.addEventListener("contextmenu", (e) => this.anchorClick(e)); document.addEventListener("DOMContentLoaded", () => { this.location(); this.anchor(document.querySelectorAll("a")); }, { once: true }); } clear(str) { const url = new URL2(str); if (url && !str.includes("passport.bilibili.com")) { const params = url.params; if (params.bvid) { params.aid = abv(params.bvid); } if (params.aid && !Number(params.aid)) { params.aid = abv(params.aid); } paramsSet.forEach((d) => { delete params[d]; }); paramArr.forEach((d) => { if (params[d[0]]) { if (d[1].includes(params[d[0]])) { delete params[d[0]]; } } }); url.base = BV2avAll(url.base); url.hash && (url.hash = BV2avAll(url.hash)); return url.toJSON(); } else return str; } location() { this.updateLocation(this.clear(location.href)); } updateLocation(url) { const Url = new self.URL(url); if (Url.host === location.host) { window.history.replaceState(window.history.state, "", url); } } anchorClick(e) { var f = e.target; for (; f && "A" !== f.tagName; ) { f = f.parentNode; } if ("A" !== f?.tagName) { return; } this.anchor([f]); } anchor(list) { list.forEach((d) => { if (!d.href) return; d.href = this.clear(d.href); }); } }; // src/utils/htmlvnode.ts var Vnode = class { tagName; props = {}; children = []; text; constructor(tagName) { this.tagName = tagName; } }; var Scanner = class { html; pos = 0; vnode = []; tagNames = []; targets = []; text = ""; quote = ""; constructor(html) { this.html = html; this.targets.push({ children: this.vnode }); while (this.html) { this.organizeTag(); } this.textContent(); } organizeTag() { if (!this.quote && this.html[0] === "<") { if (this.html.startsWith(\` s = d, void 0)}\`)) { this.textContent(); this.html = this.html.replace(new RegExp(\`^ s = d, void 0)}>\`), ""); this.popNode(); } else { this.removeScanned(); if (this.html.startsWith("!-- ")) { this.html = this.html.replace(/^!--[\\S\\s]+?-->/, ""); } if (/^[a-zA-Z]/.test(this.html)) { this.textContent(); const func = []; let stop = false; for (this.pos = 0; this.pos < this.html.length; this.pos++) { if (stop) { this.pos--; break; } switch (this.html[this.pos]) { case " ": case "\\r": case "\\n": func.push(() => this.organizeProp()); stop = true; break; case ">": this.html[this.pos - 1] === "/" ? func.push(() => this.popNode()) : func.push(() => this.tagSingle()); stop = true; break; } } const tagName = this.html.substring(0, this.pos); const tag = new Vnode(tagName); this.tagNames.push(tagName); this.targets.reduce((s, d) => s = d, void 0).children.push(tag); this.targets.push(tag); this.removeScanned(this.pos + 1); func.forEach((d) => d()); } } } else { switch (this.html[0]) { case "'": !this.quote ? this.quote = "'" : this.quote === "'" && (this.quote = ""); break; case '"': !this.quote ? this.quote = '"' : this.quote === '"' && (this.quote = ""); break; case "\`": !this.quote ? this.quote = "\`" : this.quote === "\`" && (this.quote = ""); break; } this.text += this.html[0]; this.removeScanned(); } } organizeProp() { let value = false; let stop = false; let start = 0; let popd = false; for (this.pos = 0; this.pos < this.html.length; this.pos++) { if (stop) break; switch (this.html[this.pos]) { case '"': value = !value; break; case " ": if (!value) { const str = this.html.substring(start, this.pos).replace(/\\r|\\n|"/g, "").replace(/^ +/, ""); const prop = str.split("="); const key = prop.shift(); key && key !== "/" && (this.targets.reduce((s, d) => s = d, void 0).props[key] = prop.join("=") || key); start = this.pos; } break; case ">": if (!value) { stop = true; const str = this.html.substring(start, this.pos).replace(/\\r|\\n|"/g, "").replace(/^ +/, ""); const prop = str.split("="); const key = prop.shift(); key && key !== "/" && (this.targets.reduce((s, d) => s = d, void 0).props[key] = prop.join("=") || key); if (this.html[this.pos - 1] === "/") { this.popNode(); popd = true; } } break; } } if (!popd) this.tagSingle(); this.removeScanned(this.pos--); } tagSingle() { switch (this.tagNames.reduce((s, d) => s = d, void 0)) { case "area": case "base": case "br": case "col": case "colgroup": case "command": case "embed": case "hr": case "img": case "input": case "keygen": case "link": case "meta": case "param": case "path": case "source": case "track": case "wbr": this.popNode(); break; } } popNode() { this.tagNames.splice(this.tagNames.length - 1, 1); this.targets.splice(this.targets.length - 1, 1); this.text = ""; } removeScanned(length = 1) { this.html = this.html.slice(length); } textContent() { const text = this.text.replace(/\\r|\\n| /g, ""); if (text) { const tag = new Vnode("text"); tag.text = this.text; this.targets.reduce((s, d) => s = d, void 0).children.push(tag); } this.text = ""; } }; function htmlVnode(html) { return new Scanner(html).vnode; } // src/utils/vdomtool.ts var VdomTool = class { vdom; script = []; constructor(html) { if (typeof html === "string") { this.vdom = htmlVnode(html); } else { this.vdom = html; } } toFragment() { const fragment = document.createDocumentFragment(); this.vdom.forEach((d) => { if (d.tagName === "script") { this.script.push(d); } else fragment.appendChild(this.createElement(d)); }); return fragment; } createElement(element) { if (element.tagName === "text") { return document.createTextNode(element.text); } if (element.tagName === "svg") { return this.createSVG(element); } const node = document.createElement(element.tagName); element.props && Object.entries(element.props).forEach((d) => { node.setAttribute(d[0], d[1]); }); element.text && node.appendChild(document.createTextNode(element.text)); element.event && Object.entries(element.event).forEach((d) => { node.addEventListener(...d); }); element.children && element.children.forEach((d) => { if (d.tagName === "script") { this.script.push(d); } else node.appendChild(this.createElement(d)); }); return node; } createSVG(element) { const node = document.createElementNS("http://www.w3.org/2000/svg", element.tagName); element.props && Object.entries(element.props).forEach((d) => { node.setAttribute(d[0], d[1]); }); element.children && element.children.forEach((d) => { node.appendChild(this.createSVG(d)); }); return node; } static loopScript(scripts) { return new Promise((r, j) => { const prev = scripts.shift(); if (prev) { if (prev.src) { prev.addEventListener("load", () => r(this.loopScript(scripts))); prev.addEventListener("abort", () => r(this.loopScript(scripts))); prev.addEventListener("error", () => r(this.loopScript(scripts))); return document.body.appendChild(prev); } document.body.appendChild(prev); r(this.loopScript(scripts)); } else r(); }); } loadScript() { const scripts = this.script.map((d) => this.createElement(d)); return VdomTool.loopScript(scripts); } appendTo(node) { node.append(this.toFragment()); } replace(node) { node.replaceWith(this.toFragment()); } addEventListener(target, type, listener) { try { const arr2 = target.split(""); let dom = this.vdom; let ele; while (dom && arr2.length) { const i = Number(arr2.shift()); if (i) { ele = dom[i]; dom = ele.children; } } ele.event || (ele.event = {}); ele.event[type] = listener; } catch (e) { debug.error(e); } } removeEventListener(target, type) { try { const arr2 = target.split(""); let dom = this.vdom; let ele; while (dom && arr2.length) { const i = Number(arr2.shift()); if (i) { ele = dom[i]; dom = ele.children; } } delete ele.event?.[type]; } catch (e) { debug.error(e); } } }; // src/page/page.ts var Page = class { vdom; initilized = false; constructor(html) { this.vdom = new VdomTool(html); Reflect.defineProperty(window, "_babelPolyfill", { configurable: true, set: () => true, get: () => void 0 }); Reflect.deleteProperty(window, "webpackJsonp"); } updateDom() { const title = document.title; this.vdom.replace(document.documentElement); Reflect.deleteProperty(window, "PlayerAgent"); this.vdom.loadScript().then(() => this.loadedCallback()); title && !title.includes("404") && (document.title = title); } loadedCallback() { this.initilized = true; poll(() => document.readyState === "complete", () => { document.querySelector("#jvs-cert") || window.dispatchEvent(new ProgressEvent("load")); }); } }; // src/html/index.html var html_default = '\\r\\n\\r\\n\\r\\n\\r\\n \\r\\n 哔哩哔哩 (゜-゜)つロ 干杯~-bilibili\\r\\n \\r\\n \\r\\n \\r\\n \\r\\n \\r\\n \\r\\n \\r\\n\\r\\n\\r\\n\\r\\n
\\r\\n
\\r\\n \\r\\n