// ==UserScript== // @name Bilibili 旧播放页 // @namespace MotooriKashin // @version 10.1.3-855f3686b22c5c493d7df808d348e7e511658617 // @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( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. 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 = { // Bit-wise rotation left rotl: function(n, b) { return n << b | n >>> 32 - b; }, // Bit-wise rotation right rotr: function(n, b) { return n << 32 - b | n >>> b; }, // Swap big-endian to little-endian and vice versa 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; }, // Generate an array of any length of random bytes randomBytes: function(n) { for (var bytes = []; n > 0; n--) bytes.push(Math.floor(Math.random() * 256)); return bytes; }, // Convert a byte array to big-endian 32-bit words 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; }, // Convert big-endian 32-bit words to a byte array 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; }, // Convert a byte array to a hex string 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(""); }, // Convert a hex string to a byte array hexToBytes: function(hex) { for (var bytes = [], c = 0; c < hex.length; c += 2) bytes.push(parseInt(hex.substr(c, 2), 16)); return bytes; }, // Convert a byte array to a base-64 string 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(""); }, // Convert a base-64 string to a byte array 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 = { // UTF-8 encoding utf8: { // Convert a string to a byte array stringToBytes: function(str) { return charenc.bin.stringToBytes(unescape(encodeURIComponent(str))); }, // Convert a byte array to a string bytesToString: function(bytes) { return decodeURIComponent(escape(charenc.bin.bytesToString(bytes))); } }, // Binary encoding bin: { // Convert a string to a byte array stringToBytes: function(str) { for (var bytes = [], i = 0; i < str.length; i++) bytes.push(str.charCodeAt(i) & 255); return bytes; }, // Convert a byte array to a string 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/quill-delta-to-html-cb/dist/commonjs/value-types.js var require_value_types = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/value-types.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var NewLine = "\\n"; exports2.NewLine = NewLine; var ListType; (function(ListType2) { ListType2["Ordered"] = "ordered"; ListType2["Bullet"] = "bullet"; ListType2["Checked"] = "checked"; ListType2["Unchecked"] = "unchecked"; })(ListType || (ListType = {})); exports2.ListType = ListType; var ScriptType; (function(ScriptType2) { ScriptType2["Sub"] = "sub"; ScriptType2["Super"] = "super"; })(ScriptType || (ScriptType = {})); exports2.ScriptType = ScriptType; var DirectionType; (function(DirectionType2) { DirectionType2["Rtl"] = "rtl"; })(DirectionType || (DirectionType = {})); exports2.DirectionType = DirectionType; var AlignType; (function(AlignType2) { AlignType2["Left"] = "left"; AlignType2["Center"] = "center"; AlignType2["Right"] = "right"; AlignType2["Justify"] = "justify"; })(AlignType || (AlignType = {})); exports2.AlignType = AlignType; var DataType; (function(DataType2) { DataType2["Image"] = "image"; DataType2["Video"] = "video"; DataType2["Formula"] = "formula"; DataType2["Text"] = "text"; })(DataType || (DataType = {})); exports2.DataType = DataType; var GroupType; (function(GroupType2) { GroupType2["Block"] = "block"; GroupType2["InlineGroup"] = "inline-group"; GroupType2["List"] = "list"; GroupType2["Video"] = "video"; GroupType2["Table"] = "table"; })(GroupType || (GroupType = {})); exports2.GroupType = GroupType; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/InsertData.js var require_InsertData = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/InsertData.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var InsertDataQuill = function() { function InsertDataQuill2(type, value) { this.type = type; this.value = value; } return InsertDataQuill2; }(); exports2.InsertDataQuill = InsertDataQuill; var InsertDataCustom = function() { function InsertDataCustom2(type, value) { this.type = type; this.value = value; } return InsertDataCustom2; }(); exports2.InsertDataCustom = InsertDataCustom; } }); // node_modules/lodash.isequal/index.js var require_lodash = __commonJS({ "node_modules/lodash.isequal/index.js"(exports2, module2) { var LARGE_ARRAY_SIZE = 200; var HASH_UNDEFINED = "__lodash_hash_undefined__"; var COMPARE_PARTIAL_FLAG = 1; var COMPARE_UNORDERED_FLAG = 2; var MAX_SAFE_INTEGER = 9007199254740991; var argsTag = "[object Arguments]"; var arrayTag = "[object Array]"; var asyncTag = "[object AsyncFunction]"; var boolTag = "[object Boolean]"; var dateTag = "[object Date]"; var errorTag = "[object Error]"; var funcTag = "[object Function]"; var genTag = "[object GeneratorFunction]"; var mapTag = "[object Map]"; var numberTag = "[object Number]"; var nullTag = "[object Null]"; var objectTag = "[object Object]"; var promiseTag = "[object Promise]"; var proxyTag = "[object Proxy]"; var regexpTag = "[object RegExp]"; var setTag = "[object Set]"; var stringTag = "[object String]"; var symbolTag = "[object Symbol]"; var undefinedTag = "[object Undefined]"; var weakMapTag = "[object WeakMap]"; var arrayBufferTag = "[object ArrayBuffer]"; var dataViewTag = "[object DataView]"; var float32Tag = "[object Float32Array]"; var float64Tag = "[object Float64Array]"; var int8Tag = "[object Int8Array]"; var int16Tag = "[object Int16Array]"; var int32Tag = "[object Int32Array]"; var uint8Tag = "[object Uint8Array]"; var uint8ClampedTag = "[object Uint8ClampedArray]"; var uint16Tag = "[object Uint16Array]"; var uint32Tag = "[object Uint32Array]"; var reRegExpChar = /[\\\\^\$.*+?()[\\]{}|]/g; var reIsHostCtor = /^\\[object .+?Constructor\\]\$/; var reIsUint = /^(?:0|[1-9]\\d*)\$/; var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; var freeGlobal = typeof global == "object" && global && global.Object === Object && global; var freeSelf = typeof self == "object" && self && self.Object === Object && self; var root = freeGlobal || freeSelf || Function("return this")(); var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2; var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2; var moduleExports = freeModule && freeModule.exports === freeExports; var freeProcess = moduleExports && freeGlobal.process; var nodeUtil = function() { try { return freeProcess && freeProcess.binding && freeProcess.binding("util"); } catch (e) { } }(); var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; function arrayFilter(array, predicate) { var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[resIndex++] = value; } } return result; } function arrayPush(array, values) { var index = -1, length = values.length, offset2 = array.length; while (++index < length) { array[offset2 + index] = values[index]; } return array; } function arraySome(array, predicate) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } function baseUnary(func) { return function(value) { return func(value); }; } function cacheHas(cache, key) { return cache.has(key); } function getValue(object, key) { return object == null ? void 0 : object[key]; } function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = value; }); return result; } var arrayProto = Array.prototype; var funcProto = Function.prototype; var objectProto = Object.prototype; var coreJsData = root["__core-js_shared__"]; var funcToString = funcProto.toString; var hasOwnProperty = objectProto.hasOwnProperty; var maskSrcKey = function() { var uid2 = /[^.]+\$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); return uid2 ? "Symbol(src)_1." + uid2 : ""; }(); var nativeObjectToString = objectProto.toString; var reIsNative = RegExp( "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, "\$1.*?") + "\$" ); var Buffer2 = moduleExports ? root.Buffer : void 0; var Symbol2 = root.Symbol; var Uint8Array2 = root.Uint8Array; var propertyIsEnumerable = objectProto.propertyIsEnumerable; var splice = arrayProto.splice; var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0; var nativeGetSymbols = Object.getOwnPropertySymbols; var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0; var nativeKeys = overArg(Object.keys, Object); var DataView = getNative(root, "DataView"); var Map = getNative(root, "Map"); var Promise2 = getNative(root, "Promise"); var Set2 = getNative(root, "Set"); var WeakMap = getNative(root, "WeakMap"); var nativeCreate = getNative(Object, "create"); var dataViewCtorString = toSource(DataView); var mapCtorString = toSource(Map); var promiseCtorString = toSource(Promise2); var setCtorString = toSource(Set2); var weakMapCtorString = toSource(WeakMap); var symbolProto = Symbol2 ? Symbol2.prototype : void 0; var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0; function Hash(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; } function hashDelete(key) { var result = this.has(key) && delete this.__data__[key]; this.size -= result ? 1 : 0; return result; } function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? void 0 : result; } return hasOwnProperty.call(data, key) ? data[key] : void 0; } function hashHas(key) { var data = this.__data__; return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key); } function hashSet(key, value) { var data = this.__data__; this.size += this.has(key) ? 0 : 1; data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value; return this; } Hash.prototype.clear = hashClear; Hash.prototype["delete"] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; function ListCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } function listCacheClear() { this.__data__ = []; this.size = 0; } function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } --this.size; return true; } function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? void 0 : data[index][1]; } function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { ++this.size; data.push([key, value]); } else { data[index][1] = value; } return this; } ListCache.prototype.clear = listCacheClear; ListCache.prototype["delete"] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; function MapCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } function mapCacheClear() { this.size = 0; this.__data__ = { "hash": new Hash(), "map": new (Map || ListCache)(), "string": new Hash() }; } function mapCacheDelete(key) { var result = getMapData(this, key)["delete"](key); this.size -= result ? 1 : 0; return result; } function mapCacheGet(key) { return getMapData(this, key).get(key); } function mapCacheHas(key) { return getMapData(this, key).has(key); } function mapCacheSet(key, value) { var data = getMapData(this, key), size = data.size; data.set(key, value); this.size += data.size == size ? 0 : 1; return this; } MapCache.prototype.clear = mapCacheClear; MapCache.prototype["delete"] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; function SetCache(values) { var index = -1, length = values == null ? 0 : values.length; this.__data__ = new MapCache(); while (++index < length) { this.add(values[index]); } } function setCacheAdd(value) { this.__data__.set(value, HASH_UNDEFINED); return this; } function setCacheHas(value) { return this.__data__.has(value); } SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.has = setCacheHas; function Stack(entries) { var data = this.__data__ = new ListCache(entries); this.size = data.size; } function stackClear() { this.__data__ = new ListCache(); this.size = 0; } function stackDelete(key) { var data = this.__data__, result = data["delete"](key); this.size = data.size; return result; } function stackGet(key) { return this.__data__.get(key); } function stackHas(key) { return this.__data__.has(key); } function stackSet(key, value) { var data = this.__data__; if (data instanceof ListCache) { var pairs = data.__data__; if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) { pairs.push([key, value]); this.size = ++data.size; return this; } data = this.__data__ = new MapCache(pairs); } data.set(key, value); this.size = data.size; return this; } Stack.prototype.clear = stackClear; Stack.prototype["delete"] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; function arrayLikeKeys(value, inherited) { var isArr = isArray2(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length; for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable \`arguments.length\` in strict mode. (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. isIndex(key, length)))) { result.push(key); } } return result; } function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } function baseGetAllKeys(object, keysFunc, symbolsFunc) { var result = keysFunc(object); return isArray2(object) ? result : arrayPush(result, symbolsFunc(object)); } function baseGetTag(value) { if (value == null) { return value === void 0 ? undefinedTag : nullTag; } return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value); } function baseIsArguments(value) { return isObjectLike(value) && baseGetTag(value) == argsTag; } function baseIsEqual(value, other, bitmask, customizer, stack) { if (value === other) { return true; } if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); } function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); objTag = objTag == argsTag ? objectTag : objTag; othTag = othTag == argsTag ? objectTag : othTag; var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && isBuffer(object)) { if (!isBuffer(other)) { return false; } objIsArr = true; objIsObj = false; } if (isSameTag && !objIsObj) { stack || (stack = new Stack()); return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__"); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new Stack()); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack()); return equalObjects(object, other, bitmask, customizer, equalFunc, stack); } function baseIsNative(value) { if (!isObject2(value) || isMasked(value)) { return false; } var pattern = isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } function baseIsTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } var result = []; for (var key in Object(object)) { if (hasOwnProperty.call(object, key) && key != "constructor") { result.push(key); } } return result; } function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } var stacked = stack.get(array); if (stacked && stack.get(other)) { return stacked == other; } var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : void 0; stack.set(array, other); stack.set(other, array); while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== void 0) { if (compared) { continue; } result = false; break; } if (seen) { if (!arraySome(other, function(othValue2, othIndex) { if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { return seen.push(othIndex); } })) { result = false; break; } } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { result = false; break; } } stack["delete"](array); stack["delete"](other); return result; } function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { switch (tag) { case dataViewTag: if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { return false; } object = object.buffer; other = other.buffer; case arrayBufferTag: if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) { return false; } return true; case boolTag: case dateTag: case numberTag: return eq(+object, +other); case errorTag: return object.name == other.name && object.message == other.message; case regexpTag: case stringTag: return object == other + ""; case mapTag: var convert = mapToArray; case setTag: var isPartial = bitmask & COMPARE_PARTIAL_FLAG; convert || (convert = setToArray); if (object.size != other.size && !isPartial) { return false; } var stacked = stack.get(object); if (stacked) { return stacked == other; } bitmask |= COMPARE_UNORDERED_FLAG; stack.set(object, other); var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); stack["delete"](object); return result; case symbolTag: if (symbolValueOf) { return symbolValueOf.call(object) == symbolValueOf.call(other); } } return false; } function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { return false; } } var stacked = stack.get(object); if (stacked && stack.get(other)) { return stacked == other; } var result = true; stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { result = false; break; } skipCtor || (skipCtor = key == "constructor"); } if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { result = false; } } stack["delete"](object); stack["delete"](other); return result; } function getAllKeys(object) { return baseGetAllKeys(object, keys, getSymbols); } function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; } function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : void 0; } function getRawTag(value) { var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = void 0; var unmasked = true; } catch (e) { } var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result; } var getSymbols = !nativeGetSymbols ? stubArray : function(object) { if (object == null) { return []; } object = Object(object); return arrayFilter(nativeGetSymbols(object), function(symbol) { return propertyIsEnumerable.call(object, symbol); }); }; var getTag = baseGetTag; if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) { getTag = function(value) { var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : ""; if (ctorString) { switch (ctorString) { case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } } return result; }; } function isIndex(value, length) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } function isKeyable(value) { var type = typeof value; return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; } function isMasked(func) { return !!maskSrcKey && maskSrcKey in func; } function isPrototype(value) { var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto; return value === proto; } function objectToString(value) { return nativeObjectToString.call(value); } function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) { } try { return func + ""; } catch (e) { } } return ""; } function eq(value, other) { return value === other || value !== value && other !== other; } var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); }; var isArray2 = Array.isArray; function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } var isBuffer = nativeIsBuffer || stubFalse; function isEqual(value, other) { return baseIsEqual(value, other); } function isFunction(value) { if (!isObject2(value)) { return false; } var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } function isLength(value) { return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } function isObject2(value) { var type = typeof value; return value != null && (type == "object" || type == "function"); } function isObjectLike(value) { return value != null && typeof value == "object"; } var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; function keys(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } function stubArray() { return []; } function stubFalse() { return false; } module2.exports = isEqual; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/DeltaInsertOp.js var require_DeltaInsertOp = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/DeltaInsertOp.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod2) { return mod2 && mod2.__esModule ? mod2 : { "default": mod2 }; }; Object.defineProperty(exports2, "__esModule", { value: true }); var value_types_1 = require_value_types(); var InsertData_1 = require_InsertData(); var lodash_isequal_1 = __importDefault(require_lodash()); var DeltaInsertOp = function() { function DeltaInsertOp2(insertVal, attrs) { if (typeof insertVal === "string") { insertVal = new InsertData_1.InsertDataQuill(value_types_1.DataType.Text, insertVal + ""); } this.insert = insertVal; this.attributes = attrs || {}; } DeltaInsertOp2.createNewLineOp = function() { return new DeltaInsertOp2(value_types_1.NewLine); }; DeltaInsertOp2.prototype.isContainerBlock = function() { return this.isBlockquote() || this.isList() || this.isTable() || this.isCodeBlock() || this.isHeader() || this.isBlockAttribute() || this.isCustomTextBlock(); }; DeltaInsertOp2.prototype.isBlockAttribute = function() { var attrs = this.attributes; return !!(attrs.align || attrs.direction || attrs.indent); }; DeltaInsertOp2.prototype.isBlockquote = function() { return !!this.attributes.blockquote; }; DeltaInsertOp2.prototype.isHeader = function() { return !!this.attributes.header; }; DeltaInsertOp2.prototype.isTable = function() { return !!this.attributes.table; }; DeltaInsertOp2.prototype.isSameHeaderAs = function(op) { return op.attributes.header === this.attributes.header && this.isHeader(); }; DeltaInsertOp2.prototype.hasSameAdiAs = function(op) { return this.attributes.align === op.attributes.align && this.attributes.direction === op.attributes.direction && this.attributes.indent === op.attributes.indent; }; DeltaInsertOp2.prototype.hasSameIndentationAs = function(op) { return this.attributes.indent === op.attributes.indent; }; DeltaInsertOp2.prototype.hasSameAttr = function(op) { return lodash_isequal_1.default(this.attributes, op.attributes); }; DeltaInsertOp2.prototype.hasHigherIndentThan = function(op) { return (Number(this.attributes.indent) || 0) > (Number(op.attributes.indent) || 0); }; DeltaInsertOp2.prototype.isInline = function() { return !(this.isContainerBlock() || this.isVideo() || this.isCustomEmbedBlock()); }; DeltaInsertOp2.prototype.isCodeBlock = function() { return !!this.attributes["code-block"]; }; DeltaInsertOp2.prototype.hasSameLangAs = function(op) { return this.attributes["code-block"] === op.attributes["code-block"]; }; DeltaInsertOp2.prototype.isJustNewline = function() { return this.insert.value === value_types_1.NewLine; }; DeltaInsertOp2.prototype.isList = function() { return this.isOrderedList() || this.isBulletList() || this.isCheckedList() || this.isUncheckedList(); }; DeltaInsertOp2.prototype.isOrderedList = function() { return this.attributes.list === value_types_1.ListType.Ordered; }; DeltaInsertOp2.prototype.isBulletList = function() { return this.attributes.list === value_types_1.ListType.Bullet; }; DeltaInsertOp2.prototype.isCheckedList = function() { return this.attributes.list === value_types_1.ListType.Checked; }; DeltaInsertOp2.prototype.isUncheckedList = function() { return this.attributes.list === value_types_1.ListType.Unchecked; }; DeltaInsertOp2.prototype.isACheckList = function() { return this.attributes.list == value_types_1.ListType.Unchecked || this.attributes.list === value_types_1.ListType.Checked; }; DeltaInsertOp2.prototype.isSameListAs = function(op) { return !!op.attributes.list && (this.attributes.list === op.attributes.list || op.isACheckList() && this.isACheckList()); }; DeltaInsertOp2.prototype.isSameTableRowAs = function(op) { return !!op.isTable() && this.isTable() && this.attributes.table === op.attributes.table; }; DeltaInsertOp2.prototype.isText = function() { return this.insert.type === value_types_1.DataType.Text; }; DeltaInsertOp2.prototype.isImage = function() { return this.insert.type === value_types_1.DataType.Image; }; DeltaInsertOp2.prototype.isFormula = function() { return this.insert.type === value_types_1.DataType.Formula; }; DeltaInsertOp2.prototype.isVideo = function() { return this.insert.type === value_types_1.DataType.Video; }; DeltaInsertOp2.prototype.isLink = function() { return this.isText() && !!this.attributes.link; }; DeltaInsertOp2.prototype.isCustomEmbed = function() { return this.insert instanceof InsertData_1.InsertDataCustom; }; DeltaInsertOp2.prototype.isCustomEmbedBlock = function() { return this.isCustomEmbed() && !!this.attributes.renderAsBlock; }; DeltaInsertOp2.prototype.isCustomTextBlock = function() { return this.isText() && !!this.attributes.renderAsBlock; }; DeltaInsertOp2.prototype.isMentions = function() { return this.isText() && !!this.attributes.mentions; }; return DeltaInsertOp2; }(); exports2.DeltaInsertOp = DeltaInsertOp; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/mentions/MentionSanitizer.js var require_MentionSanitizer = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/mentions/MentionSanitizer.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var OpAttributeSanitizer_1 = require_OpAttributeSanitizer(); var MentionSanitizer = function() { function MentionSanitizer2() { } MentionSanitizer2.sanitize = function(dirtyObj, sanitizeOptions) { var cleanObj = {}; if (!dirtyObj || typeof dirtyObj !== "object") { return cleanObj; } if (dirtyObj.class && MentionSanitizer2.IsValidClass(dirtyObj.class)) { cleanObj.class = dirtyObj.class; } if (dirtyObj.id && MentionSanitizer2.IsValidId(dirtyObj.id)) { cleanObj.id = dirtyObj.id; } if (MentionSanitizer2.IsValidTarget(dirtyObj.target + "")) { cleanObj.target = dirtyObj.target; } if (dirtyObj.avatar) { cleanObj.avatar = OpAttributeSanitizer_1.OpAttributeSanitizer.sanitizeLinkUsingOptions(dirtyObj.avatar + "", sanitizeOptions); } if (dirtyObj["end-point"]) { cleanObj["end-point"] = OpAttributeSanitizer_1.OpAttributeSanitizer.sanitizeLinkUsingOptions(dirtyObj["end-point"] + "", sanitizeOptions); } if (dirtyObj.slug) { cleanObj.slug = dirtyObj.slug + ""; } return cleanObj; }; MentionSanitizer2.IsValidClass = function(classAttr) { return !!classAttr.match(/^[a-zA-Z0-9_\\-]{1,500}\$/i); }; MentionSanitizer2.IsValidId = function(idAttr) { return !!idAttr.match(/^[a-zA-Z0-9_\\-\\:\\.]{1,500}\$/i); }; MentionSanitizer2.IsValidTarget = function(target) { return ["_self", "_blank", "_parent", "_top"].indexOf(target) > -1; }; return MentionSanitizer2; }(); exports2.MentionSanitizer = MentionSanitizer; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/url.js var require_url = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/url.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); function sanitize(str) { var val = str; val = val.replace(/^\\s*/gm, ""); var whiteList = /^((https?|s?ftp|file|blob|mailto|tel):|#|\\/|data:image\\/)/; if (whiteList.test(val)) { return val; } return "unsafe:" + val; } exports2.sanitize = sanitize; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/funcs-html.js var require_funcs_html = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/funcs-html.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var EncodeTarget; (function(EncodeTarget2) { EncodeTarget2[EncodeTarget2["Html"] = 0] = "Html"; EncodeTarget2[EncodeTarget2["Url"] = 1] = "Url"; })(EncodeTarget || (EncodeTarget = {})); function makeStartTag(tag, attrs) { if (attrs === void 0) { attrs = void 0; } if (!tag) { return ""; } var attrsStr = ""; if (attrs) { var arrAttrs = [].concat(attrs); attrsStr = arrAttrs.map(function(attr) { return attr.key + (attr.value ? '="' + attr.value + '"' : ""); }).join(" "); } var closing = ">"; if (tag === "img" || tag === "br") { closing = "/>"; } return attrsStr ? "<" + tag + " " + attrsStr + closing : "<" + tag + closing; } exports2.makeStartTag = makeStartTag; function makeEndTag(tag) { if (tag === void 0) { tag = ""; } return tag && "" || ""; } exports2.makeEndTag = makeEndTag; function decodeHtml(str) { return encodeMappings(EncodeTarget.Html).reduce(decodeMapping, str); } exports2.decodeHtml = decodeHtml; function encodeHtml(str, preventDoubleEncoding) { if (preventDoubleEncoding === void 0) { preventDoubleEncoding = true; } if (preventDoubleEncoding) { str = decodeHtml(str); } return encodeMappings(EncodeTarget.Html).reduce(encodeMapping, str); } exports2.encodeHtml = encodeHtml; function encodeLink(str) { var linkMaps = encodeMappings(EncodeTarget.Url); var decoded = linkMaps.reduce(decodeMapping, str); return linkMaps.reduce(encodeMapping, decoded); } exports2.encodeLink = encodeLink; function encodeMappings(mtype) { var maps = [ ["&", "&"], ["<", "<"], [">", ">"], ['"', """], ["'", "'"], ["\\\\/", "/"], ["\\\\(", "("], ["\\\\)", ")"] ]; if (mtype === EncodeTarget.Html) { return maps.filter(function(_a) { var v = _a[0], _ = _a[1]; return v.indexOf("(") === -1 && v.indexOf(")") === -1; }); } else { return maps.filter(function(_a) { var v = _a[0], _ = _a[1]; return v.indexOf("/") === -1; }); } } function encodeMapping(str, mapping) { return str.replace(new RegExp(mapping[0], "g"), mapping[1]); } function decodeMapping(str, mapping) { return str.replace(new RegExp(mapping[1], "g"), mapping[0].replace("\\\\", "")); } } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/array.js var require_array = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/array.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); function preferSecond(arr2) { if (arr2.length === 0) { return null; } return arr2.length >= 2 ? arr2[1] : arr2[0]; } exports2.preferSecond = preferSecond; function flatten(arr2) { return arr2.reduce(function(pv, v) { return pv.concat(Array.isArray(v) ? flatten(v) : v); }, []); } exports2.flatten = flatten; function find(arr2, predicate) { if (Array.prototype.find) { return Array.prototype.find.call(arr2, predicate); } for (var i = 0; i < arr2.length; i++) { if (predicate(arr2[i])) return arr2[i]; } return void 0; } exports2.find = find; function groupConsecutiveElementsWhile(arr2, predicate) { var groups = []; var currElm, currGroup; for (var i = 0; i < arr2.length; i++) { currElm = arr2[i]; if (i > 0 && predicate(currElm, arr2[i - 1])) { currGroup = groups[groups.length - 1]; currGroup.push(currElm); } else { groups.push([currElm]); } } return groups.map(function(g) { return g.length === 1 ? g[0] : g; }); } exports2.groupConsecutiveElementsWhile = groupConsecutiveElementsWhile; function sliceFromReverseWhile(arr2, startIndex, predicate) { var result = { elements: [], sliceStartsAt: -1 }; for (var i = startIndex; i >= 0; i--) { if (!predicate(arr2[i])) { break; } result.sliceStartsAt = i; result.elements.unshift(arr2[i]); } return result; } exports2.sliceFromReverseWhile = sliceFromReverseWhile; function intersperse(arr2, item) { return arr2.reduce(function(pv, v, index) { pv.push(v); if (index < arr2.length - 1) { pv.push(item); } return pv; }, []); } exports2.intersperse = intersperse; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/OpAttributeSanitizer.js var require_OpAttributeSanitizer = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/OpAttributeSanitizer.js"(exports2) { "use strict"; var __importStar = exports2 && exports2.__importStar || function(mod2) { if (mod2 && mod2.__esModule) return mod2; var result = {}; if (mod2 != null) { for (var k in mod2) if (Object.hasOwnProperty.call(mod2, k)) result[k] = mod2[k]; } result["default"] = mod2; return result; }; Object.defineProperty(exports2, "__esModule", { value: true }); var value_types_1 = require_value_types(); var MentionSanitizer_1 = require_MentionSanitizer(); var url = __importStar(require_url()); var funcs_html_1 = require_funcs_html(); var array_1 = require_array(); var OpAttributeSanitizer = function() { function OpAttributeSanitizer2() { } OpAttributeSanitizer2.sanitize = function(dirtyAttrs, sanitizeOptions) { var cleanAttrs = {}; if (!dirtyAttrs || typeof dirtyAttrs !== "object") { return cleanAttrs; } var booleanAttrs = [ "bold", "italic", "underline", "strike", "code", "blockquote", "code-block", "renderAsBlock" ]; var colorAttrs = ["background", "color"]; var font = dirtyAttrs.font, size = dirtyAttrs.size, link = dirtyAttrs.link, script = dirtyAttrs.script, list = dirtyAttrs.list, header = dirtyAttrs.header, align = dirtyAttrs.align, direction = dirtyAttrs.direction, indent = dirtyAttrs.indent, mentions = dirtyAttrs.mentions, mention = dirtyAttrs.mention, width = dirtyAttrs.width, target = dirtyAttrs.target, rel = dirtyAttrs.rel; var codeBlock = dirtyAttrs["code-block"]; var sanitizedAttrs = booleanAttrs.concat(colorAttrs, [ "font", "size", "link", "script", "list", "header", "align", "direction", "indent", "mentions", "mention", "width", "target", "rel", "code-block" ]); booleanAttrs.forEach(function(prop) { var v = dirtyAttrs[prop]; if (v) { cleanAttrs[prop] = !!v; } }); colorAttrs.forEach(function(prop) { var val = dirtyAttrs[prop]; if (val && (OpAttributeSanitizer2.IsValidHexColor(val + "") || OpAttributeSanitizer2.IsValidColorLiteral(val + "") || OpAttributeSanitizer2.IsValidRGBColor(val + ""))) { cleanAttrs[prop] = val; } }); if (font && OpAttributeSanitizer2.IsValidFontName(font + "")) { cleanAttrs.font = font; } if (size && OpAttributeSanitizer2.IsValidSize(size + "")) { cleanAttrs.size = size; } if (width && OpAttributeSanitizer2.IsValidWidth(width + "")) { cleanAttrs.width = width; } if (link) { cleanAttrs.link = OpAttributeSanitizer2.sanitizeLinkUsingOptions(link + "", sanitizeOptions); } if (target && OpAttributeSanitizer2.isValidTarget(target)) { cleanAttrs.target = target; } if (rel && OpAttributeSanitizer2.IsValidRel(rel)) { cleanAttrs.rel = rel; } if (codeBlock) { if (OpAttributeSanitizer2.IsValidLang(codeBlock)) { cleanAttrs["code-block"] = codeBlock; } else { cleanAttrs["code-block"] = !!codeBlock; } } if (script === value_types_1.ScriptType.Sub || value_types_1.ScriptType.Super === script) { cleanAttrs.script = script; } if (list === value_types_1.ListType.Bullet || list === value_types_1.ListType.Ordered || list === value_types_1.ListType.Checked || list === value_types_1.ListType.Unchecked) { cleanAttrs.list = list; } if (Number(header)) { cleanAttrs.header = Math.min(Number(header), 6); } if (array_1.find([value_types_1.AlignType.Center, value_types_1.AlignType.Right, value_types_1.AlignType.Justify, value_types_1.AlignType.Left], function(a) { return a === align; })) { cleanAttrs.align = align; } if (direction === value_types_1.DirectionType.Rtl) { cleanAttrs.direction = direction; } if (indent && Number(indent)) { cleanAttrs.indent = Math.min(Number(indent), 30); } if (mentions && mention) { var sanitizedMention = MentionSanitizer_1.MentionSanitizer.sanitize(mention, sanitizeOptions); if (Object.keys(sanitizedMention).length > 0) { cleanAttrs.mentions = !!mentions; cleanAttrs.mention = mention; } } return Object.keys(dirtyAttrs).reduce(function(cleaned, k) { if (sanitizedAttrs.indexOf(k) === -1) { cleaned[k] = dirtyAttrs[k]; } return cleaned; }, cleanAttrs); }; OpAttributeSanitizer2.sanitizeLinkUsingOptions = function(link, options) { var sanitizerFn = function() { return void 0; }; if (options && typeof options.urlSanitizer === "function") { sanitizerFn = options.urlSanitizer; } var result = sanitizerFn(link); return typeof result === "string" ? result : funcs_html_1.encodeLink(url.sanitize(link)); }; OpAttributeSanitizer2.IsValidHexColor = function(colorStr) { return !!colorStr.match(/^#([0-9A-F]{6}|[0-9A-F]{3})\$/i); }; OpAttributeSanitizer2.IsValidColorLiteral = function(colorStr) { return !!colorStr.match(/^[a-z]{1,50}\$/i); }; OpAttributeSanitizer2.IsValidRGBColor = function(colorStr) { var re = /^rgb\\(((0|25[0-5]|2[0-4]\\d|1\\d\\d|0?\\d?\\d),\\s*){2}(0|25[0-5]|2[0-4]\\d|1\\d\\d|0?\\d?\\d)\\)\$/i; return !!colorStr.match(re); }; OpAttributeSanitizer2.IsValidFontName = function(fontName) { return !!fontName.match(/^[a-z\\s0-9\\- ]{1,30}\$/i); }; OpAttributeSanitizer2.IsValidSize = function(size) { return !!size.match(/^[a-z0-9\\-]{1,20}\$/i); }; OpAttributeSanitizer2.IsValidWidth = function(width) { return !!width.match(/^[0-9]*(px|em|%)?\$/); }; OpAttributeSanitizer2.isValidTarget = function(target) { return !!target.match(/^[_a-zA-Z0-9\\-]{1,50}\$/); }; OpAttributeSanitizer2.IsValidRel = function(relStr) { return !!relStr.match(/^[a-zA-Z\\s\\-]{1,250}\$/i); }; OpAttributeSanitizer2.IsValidLang = function(lang) { if (typeof lang === "boolean") { return true; } return !!lang.match(/^[a-zA-Z\\s\\-\\\\\\/\\+]{1,50}\$/i); }; return OpAttributeSanitizer2; }(); exports2.OpAttributeSanitizer = OpAttributeSanitizer; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/string.js var require_string = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/string.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); function tokenizeWithNewLines(str) { var NewLine = "\\n"; if (str === NewLine) { return [str]; } var lines = str.split(NewLine); if (lines.length === 1) { return lines; } var lastIndex = lines.length - 1; return lines.reduce(function(pv, line, ind) { if (ind !== lastIndex) { if (line !== "") { pv = pv.concat(line, NewLine); } else { pv.push(NewLine); } } else if (line !== "") { pv.push(line); } return pv; }, []); } exports2.tokenizeWithNewLines = tokenizeWithNewLines; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/object.js var require_object = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/helpers/object.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); function assign(target) { var sources = []; for (var _i = 1; _i < arguments.length; _i++) { sources[_i - 1] = arguments[_i]; } if (target == null) { throw new TypeError("Cannot convert undefined or null to object"); } var to = Object(target); for (var index = 0; index < sources.length; index++) { var nextSource = sources[index]; if (nextSource != null) { for (var nextKey in nextSource) { if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { to[nextKey] = nextSource[nextKey]; } } } } return to; } exports2.assign = assign; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/InsertOpDenormalizer.js var require_InsertOpDenormalizer = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/InsertOpDenormalizer.js"(exports2) { "use strict"; var __importStar = exports2 && exports2.__importStar || function(mod2) { if (mod2 && mod2.__esModule) return mod2; var result = {}; if (mod2 != null) { for (var k in mod2) if (Object.hasOwnProperty.call(mod2, k)) result[k] = mod2[k]; } result["default"] = mod2; return result; }; Object.defineProperty(exports2, "__esModule", { value: true }); var value_types_1 = require_value_types(); var str = __importStar(require_string()); var obj = __importStar(require_object()); var InsertOpDenormalizer = function() { function InsertOpDenormalizer2() { } InsertOpDenormalizer2.denormalize = function(op) { if (!op || typeof op !== "object") { return []; } if (typeof op.insert === "object" || op.insert === value_types_1.NewLine) { return [op]; } var newlinedArray = str.tokenizeWithNewLines(op.insert + ""); if (newlinedArray.length === 1) { return [op]; } var nlObj = obj.assign({}, op, { insert: value_types_1.NewLine }); return newlinedArray.map(function(line) { if (line === value_types_1.NewLine) { return nlObj; } return obj.assign({}, op, { insert: line }); }); }; return InsertOpDenormalizer2; }(); exports2.InsertOpDenormalizer = InsertOpDenormalizer; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/InsertOpsConverter.js var require_InsertOpsConverter = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/InsertOpsConverter.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var DeltaInsertOp_1 = require_DeltaInsertOp(); var value_types_1 = require_value_types(); var InsertData_1 = require_InsertData(); var OpAttributeSanitizer_1 = require_OpAttributeSanitizer(); var InsertOpDenormalizer_1 = require_InsertOpDenormalizer(); var InsertOpsConverter = function() { function InsertOpsConverter2() { } InsertOpsConverter2.convert = function(deltaOps, options) { if (!Array.isArray(deltaOps)) { return []; } var denormalizedOps = [].concat.apply([], deltaOps.map(InsertOpDenormalizer_1.InsertOpDenormalizer.denormalize)); var results = []; var insertVal, attributes; for (var _i = 0, denormalizedOps_1 = denormalizedOps; _i < denormalizedOps_1.length; _i++) { var op = denormalizedOps_1[_i]; if (!op.insert) { continue; } insertVal = InsertOpsConverter2.convertInsertVal(op.insert, options); if (!insertVal) { continue; } attributes = OpAttributeSanitizer_1.OpAttributeSanitizer.sanitize(op.attributes, options); results.push(new DeltaInsertOp_1.DeltaInsertOp(insertVal, attributes)); } return results; }; InsertOpsConverter2.convertInsertVal = function(insertPropVal, sanitizeOptions) { if (typeof insertPropVal === "string") { return new InsertData_1.InsertDataQuill(value_types_1.DataType.Text, insertPropVal); } if (!insertPropVal || typeof insertPropVal !== "object") { return null; } var keys = Object.keys(insertPropVal); if (!keys.length) { return null; } return value_types_1.DataType.Image in insertPropVal ? new InsertData_1.InsertDataQuill(value_types_1.DataType.Image, OpAttributeSanitizer_1.OpAttributeSanitizer.sanitizeLinkUsingOptions(insertPropVal[value_types_1.DataType.Image] + "", sanitizeOptions)) : value_types_1.DataType.Video in insertPropVal ? new InsertData_1.InsertDataQuill(value_types_1.DataType.Video, OpAttributeSanitizer_1.OpAttributeSanitizer.sanitizeLinkUsingOptions(insertPropVal[value_types_1.DataType.Video] + "", sanitizeOptions)) : value_types_1.DataType.Formula in insertPropVal ? new InsertData_1.InsertDataQuill(value_types_1.DataType.Formula, insertPropVal[value_types_1.DataType.Formula]) : new InsertData_1.InsertDataCustom(keys[0], insertPropVal[keys[0]]); }; return InsertOpsConverter2; }(); exports2.InsertOpsConverter = InsertOpsConverter; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/OpToHtmlConverter.js var require_OpToHtmlConverter = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/OpToHtmlConverter.js"(exports2) { "use strict"; var __importStar = exports2 && exports2.__importStar || function(mod2) { if (mod2 && mod2.__esModule) return mod2; var result = {}; if (mod2 != null) { for (var k in mod2) if (Object.hasOwnProperty.call(mod2, k)) result[k] = mod2[k]; } result["default"] = mod2; return result; }; Object.defineProperty(exports2, "__esModule", { value: true }); var funcs_html_1 = require_funcs_html(); var value_types_1 = require_value_types(); var obj = __importStar(require_object()); var arr2 = __importStar(require_array()); var OpAttributeSanitizer_1 = require_OpAttributeSanitizer(); var DEFAULT_INLINE_FONTS = { serif: "font-family: Georgia, Times New Roman, serif", monospace: "font-family: Monaco, Courier New, monospace" }; exports2.DEFAULT_INLINE_STYLES = { font: function(value) { return DEFAULT_INLINE_FONTS[value] || "font-family:" + value; }, size: { small: "font-size: 0.75em", large: "font-size: 1.5em", huge: "font-size: 2.5em" }, indent: function(value, op) { var indentSize = parseInt(value, 10) * 3; var side = op.attributes["direction"] === "rtl" ? "right" : "left"; return "padding-" + side + ":" + indentSize + "em"; }, direction: function(value, op) { if (value === "rtl") { return "direction:rtl" + (op.attributes["align"] ? "" : "; text-align:inherit"); } else { return void 0; } } }; var OpToHtmlConverter = function() { function OpToHtmlConverter2(op, options) { this.op = op; this.options = obj.assign({}, { classPrefix: "ql", inlineStyles: void 0, encodeHtml: true, listItemTag: "li", paragraphTag: "p" }, options); } OpToHtmlConverter2.prototype.prefixClass = function(className) { if (!this.options.classPrefix) { return className + ""; } return this.options.classPrefix + "-" + className; }; OpToHtmlConverter2.prototype.getHtml = function() { var parts = this.getHtmlParts(); return parts.openingTag + parts.content + parts.closingTag; }; OpToHtmlConverter2.prototype.getHtmlParts = function() { var _this = this; if (this.op.isJustNewline() && !this.op.isContainerBlock()) { return { openingTag: "", closingTag: "", content: value_types_1.NewLine }; } var tags = this.getTags(), attrs = this.getTagAttributes(); if (!tags.length && attrs.length) { tags.push(this.options.textTag || "span"); } var beginTags = [], endTags = []; var imgTag = "img"; var isImageLink = function(tag2) { return tag2 === imgTag && !!_this.op.attributes.link; }; for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) { var tag = tags_1[_i]; if (isImageLink(tag)) { beginTags.push(funcs_html_1.makeStartTag("a", this.getLinkAttrs())); } beginTags.push(funcs_html_1.makeStartTag(tag, attrs)); endTags.push(tag === "img" ? "" : funcs_html_1.makeEndTag(tag)); if (isImageLink(tag)) { endTags.push(funcs_html_1.makeEndTag("a")); } attrs = []; } endTags.reverse(); return { openingTag: beginTags.join(""), content: this.getContent(), closingTag: endTags.join("") }; }; OpToHtmlConverter2.prototype.getContent = function() { if (this.op.isContainerBlock()) { return ""; } if (this.op.isMentions()) { return this.op.insert.value; } var content = this.op.isFormula() || this.op.isText() ? this.op.insert.value : ""; return this.options.encodeHtml && funcs_html_1.encodeHtml(content) || content; }; OpToHtmlConverter2.prototype.getCssClasses = function() { var attrs = this.op.attributes; if (this.options.inlineStyles) { return []; } var propsArr = ["indent", "align", "direction", "font", "size"]; if (this.options.allowBackgroundClasses) { propsArr.push("background"); } return (this.getCustomCssClasses() || []).concat(propsArr.filter(function(prop) { return !!attrs[prop]; }).filter(function(prop) { return prop === "background" ? OpAttributeSanitizer_1.OpAttributeSanitizer.IsValidColorLiteral(attrs[prop]) : true; }).map(function(prop) { return prop + "-" + attrs[prop]; }).concat(this.op.isFormula() ? "formula" : []).concat(this.op.isVideo() ? "video" : []).concat(this.op.isImage() ? "image" : []).map(this.prefixClass.bind(this))); }; OpToHtmlConverter2.prototype.getCssStyles = function() { var _this = this; var attrs = this.op.attributes; var propsArr = [["color"]]; if (!!this.options.inlineStyles || !this.options.allowBackgroundClasses) { propsArr.push(["background", "background-color"]); } if (this.options.inlineStyles) { propsArr = propsArr.concat([ ["indent"], ["align", "text-align"], ["direction"], ["font", "font-family"], ["size"] ]); } return (this.getCustomCssStyles() || []).concat(propsArr.filter(function(item) { return !!attrs[item[0]]; }).map(function(item) { var attribute = item[0]; var attrValue = attrs[attribute]; var attributeConverter = _this.options.inlineStyles && _this.options.inlineStyles[attribute] || exports2.DEFAULT_INLINE_STYLES[attribute]; if (typeof attributeConverter === "object") { return attributeConverter[attrValue]; } else if (typeof attributeConverter === "function") { var converterFn = attributeConverter; return converterFn(attrValue, _this.op); } else { return arr2.preferSecond(item) + ":" + attrValue; } })).filter(function(item) { return item !== void 0; }); }; OpToHtmlConverter2.prototype.getTagAttributes = function() { if (this.op.attributes.code && !this.op.isLink()) { return []; } var makeAttr = this.makeAttr.bind(this); var customTagAttributes = this.getCustomTagAttributes(); var customAttr = customTagAttributes ? Object.keys(this.getCustomTagAttributes()).map(function(k) { return makeAttr(k, customTagAttributes[k]); }) : []; var classes = this.getCssClasses(); var tagAttrs = classes.length ? customAttr.concat([makeAttr("class", classes.join(" "))]) : customAttr; if (this.op.isImage()) { this.op.attributes.width && (tagAttrs = tagAttrs.concat(makeAttr("width", this.op.attributes.width))); return tagAttrs.concat(makeAttr("src", this.op.insert.value)); } if (this.op.isACheckList()) { return tagAttrs.concat(makeAttr("data-checked", this.op.isCheckedList() ? "true" : "false")); } if (this.op.isFormula()) { return tagAttrs; } if (this.op.isVideo()) { return tagAttrs.concat(makeAttr("frameborder", "0"), makeAttr("allowfullscreen", "true"), makeAttr("src", this.op.insert.value)); } if (this.op.isMentions()) { var mention = this.op.attributes.mention; if (mention.class) { tagAttrs = tagAttrs.concat(makeAttr("class", mention.class)); } if (mention["end-point"] && mention.slug) { tagAttrs = tagAttrs.concat(makeAttr("href", mention["end-point"] + "/" + mention.slug)); } else { tagAttrs = tagAttrs.concat(makeAttr("href", "about:blank")); } if (mention.target) { tagAttrs = tagAttrs.concat(makeAttr("target", mention.target)); } return tagAttrs; } var styles = this.getCssStyles(); if (styles.length) { tagAttrs.push(makeAttr("style", styles.join(";"))); } if (this.op.isCodeBlock() && typeof this.op.attributes["code-block"] === "string") { return tagAttrs.concat(makeAttr("data-language", this.op.attributes["code-block"])); } if (this.op.isContainerBlock()) { return tagAttrs; } if (this.op.isLink()) { tagAttrs = tagAttrs.concat(this.getLinkAttrs()); } return tagAttrs; }; OpToHtmlConverter2.prototype.makeAttr = function(k, v) { return { key: k, value: v }; }; OpToHtmlConverter2.prototype.getLinkAttrs = function() { var tagAttrs = []; var targetForAll = OpAttributeSanitizer_1.OpAttributeSanitizer.isValidTarget(this.options.linkTarget || "") ? this.options.linkTarget : void 0; var relForAll = OpAttributeSanitizer_1.OpAttributeSanitizer.IsValidRel(this.options.linkRel || "") ? this.options.linkRel : void 0; var target = this.op.attributes.target || targetForAll; var rel = this.op.attributes.rel || relForAll; return tagAttrs.concat(this.makeAttr("href", this.op.attributes.link)).concat(target ? this.makeAttr("target", target) : []).concat(rel ? this.makeAttr("rel", rel) : []); }; OpToHtmlConverter2.prototype.getCustomTag = function(format) { if (this.options.customTag && typeof this.options.customTag === "function") { return this.options.customTag.apply(null, [format, this.op]); } }; OpToHtmlConverter2.prototype.getCustomTagAttributes = function() { if (this.options.customTagAttributes && typeof this.options.customTagAttributes === "function") { return this.options.customTagAttributes.apply(null, [this.op]); } }; OpToHtmlConverter2.prototype.getCustomCssClasses = function() { if (this.options.customCssClasses && typeof this.options.customCssClasses === "function") { var res = this.options.customCssClasses.apply(null, [this.op]); if (res) { return Array.isArray(res) ? res : [res]; } } }; OpToHtmlConverter2.prototype.getCustomCssStyles = function() { if (this.options.customCssStyles && typeof this.options.customCssStyles === "function") { var res = this.options.customCssStyles.apply(null, [this.op]); if (res) { return Array.isArray(res) ? res : [res]; } } }; OpToHtmlConverter2.prototype.getTags = function() { var _this = this; var attrs = this.op.attributes; if (!this.op.isText()) { return [ this.op.isVideo() ? "iframe" : this.op.isImage() ? "img" : "span" ]; } var positionTag = this.options.paragraphTag || "p"; var blocks = [ ["blockquote"], ["code-block", "pre"], ["list", this.options.listItemTag], ["header"], ["align", positionTag], ["direction", positionTag], ["indent", positionTag] ]; for (var _i = 0, blocks_1 = blocks; _i < blocks_1.length; _i++) { var item = blocks_1[_i]; var firstItem = item[0]; if (attrs[firstItem]) { var customTag = this.getCustomTag(firstItem); return customTag ? [customTag] : firstItem === "header" ? ["h" + attrs[firstItem]] : [arr2.preferSecond(item)]; } } if (this.op.isCustomTextBlock()) { var customTag = this.getCustomTag("renderAsBlock"); return customTag ? [customTag] : [positionTag]; } var customTagsMap = Object.keys(attrs).reduce(function(res, it) { var customTag2 = _this.getCustomTag(it); if (customTag2) { res[it] = customTag2; } return res; }, {}); var inlineTags = [ ["link", "a"], ["mentions", "a"], ["script"], ["bold", "strong"], ["italic", "em"], ["strike", "s"], ["underline", "u"], ["code"] ]; return inlineTags.filter(function(item2) { return !!attrs[item2[0]]; }).concat(Object.keys(customTagsMap).filter(function(t) { return !inlineTags.some(function(it) { return it[0] == t; }); }).map(function(t) { return [t, customTagsMap[t]]; })).map(function(item2) { return customTagsMap[item2[0]] ? customTagsMap[item2[0]] : item2[0] === "script" ? attrs[item2[0]] === value_types_1.ScriptType.Sub ? "sub" : "sup" : arr2.preferSecond(item2); }); }; return OpToHtmlConverter2; }(); exports2.OpToHtmlConverter = OpToHtmlConverter; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/group-types.js var require_group_types = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/group-types.js"(exports2) { "use strict"; var __extends = exports2 && exports2.__extends || function() { var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) { d.__proto__ = b; } || function(d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports2, "__esModule", { value: true }); var InlineGroup = function() { function InlineGroup2(ops) { this.ops = ops; } return InlineGroup2; }(); exports2.InlineGroup = InlineGroup; var SingleItem = function() { function SingleItem2(op) { this.op = op; } return SingleItem2; }(); var VideoItem = function(_super) { __extends(VideoItem2, _super); function VideoItem2() { return _super !== null && _super.apply(this, arguments) || this; } return VideoItem2; }(SingleItem); exports2.VideoItem = VideoItem; var BlotBlock = function(_super) { __extends(BlotBlock2, _super); function BlotBlock2() { return _super !== null && _super.apply(this, arguments) || this; } return BlotBlock2; }(SingleItem); exports2.BlotBlock = BlotBlock; var BlockGroup = function() { function BlockGroup2(op, ops) { this.op = op; this.ops = ops; } return BlockGroup2; }(); exports2.BlockGroup = BlockGroup; var ListGroup = function() { function ListGroup2(items) { this.items = items; } return ListGroup2; }(); exports2.ListGroup = ListGroup; var ListItem = function() { function ListItem2(item, innerList) { if (innerList === void 0) { innerList = null; } this.item = item; this.innerList = innerList; } return ListItem2; }(); exports2.ListItem = ListItem; var TableGroup = function() { function TableGroup2(rows) { this.rows = rows; } return TableGroup2; }(); exports2.TableGroup = TableGroup; var TableRow = function() { function TableRow2(cells) { this.cells = cells; } return TableRow2; }(); exports2.TableRow = TableRow; var TableCell = function() { function TableCell2(item) { this.item = item; } return TableCell2; }(); exports2.TableCell = TableCell; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/Grouper.js var require_Grouper = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/Grouper.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var DeltaInsertOp_1 = require_DeltaInsertOp(); var array_1 = require_array(); var group_types_1 = require_group_types(); var Grouper = function() { function Grouper2() { } Grouper2.pairOpsWithTheirBlock = function(ops) { var result = []; var canBeInBlock = function(op2) { return !(op2.isJustNewline() || op2.isCustomEmbedBlock() || op2.isVideo() || op2.isContainerBlock()); }; var isInlineData = function(op2) { return op2.isInline(); }; var lastInd = ops.length - 1; var opsSlice; for (var i = lastInd; i >= 0; i--) { var op = ops[i]; if (op.isVideo()) { result.push(new group_types_1.VideoItem(op)); } else if (op.isCustomEmbedBlock()) { result.push(new group_types_1.BlotBlock(op)); } else if (op.isContainerBlock()) { opsSlice = array_1.sliceFromReverseWhile(ops, i - 1, canBeInBlock); result.push(new group_types_1.BlockGroup(op, opsSlice.elements)); i = opsSlice.sliceStartsAt > -1 ? opsSlice.sliceStartsAt : i; } else { opsSlice = array_1.sliceFromReverseWhile(ops, i - 1, isInlineData); result.push(new group_types_1.InlineGroup(opsSlice.elements.concat(op))); i = opsSlice.sliceStartsAt > -1 ? opsSlice.sliceStartsAt : i; } } result.reverse(); return result; }; Grouper2.groupConsecutiveSameStyleBlocks = function(groups, blocksOf) { if (blocksOf === void 0) { blocksOf = { header: true, codeBlocks: true, blockquotes: true, customBlocks: true }; } return array_1.groupConsecutiveElementsWhile(groups, function(g, gPrev) { if (!(g instanceof group_types_1.BlockGroup) || !(gPrev instanceof group_types_1.BlockGroup)) { return false; } return blocksOf.codeBlocks && Grouper2.areBothCodeblocksWithSameLang(g, gPrev) || blocksOf.blockquotes && Grouper2.areBothBlockquotesWithSameAdi(g, gPrev) || blocksOf.header && Grouper2.areBothSameHeadersWithSameAdi(g, gPrev) || blocksOf.customBlocks && Grouper2.areBothCustomBlockWithSameAttr(g, gPrev); }); }; Grouper2.reduceConsecutiveSameStyleBlocksToOne = function(groups) { var newLineOp = DeltaInsertOp_1.DeltaInsertOp.createNewLineOp(); return groups.map(function(elm) { if (!Array.isArray(elm)) { if (elm instanceof group_types_1.BlockGroup && !elm.ops.length) { elm.ops.push(newLineOp); } return elm; } var groupsLastInd = elm.length - 1; elm[0].ops = array_1.flatten(elm.map(function(g, i) { if (!g.ops.length) { return [newLineOp]; } return g.ops.concat(i < groupsLastInd ? [newLineOp] : []); })); return elm[0]; }); }; Grouper2.areBothCodeblocksWithSameLang = function(g1, gOther) { return g1.op.isCodeBlock() && gOther.op.isCodeBlock() && g1.op.hasSameLangAs(gOther.op); }; Grouper2.areBothSameHeadersWithSameAdi = function(g1, gOther) { return g1.op.isSameHeaderAs(gOther.op) && g1.op.hasSameAdiAs(gOther.op); }; Grouper2.areBothBlockquotesWithSameAdi = function(g, gOther) { return g.op.isBlockquote() && gOther.op.isBlockquote() && g.op.hasSameAdiAs(gOther.op); }; Grouper2.areBothCustomBlockWithSameAttr = function(g, gOther) { return g.op.isCustomTextBlock() && gOther.op.isCustomTextBlock() && g.op.hasSameAttr(gOther.op); }; return Grouper2; }(); exports2.Grouper = Grouper; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/ListNester.js var require_ListNester = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/ListNester.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var group_types_1 = require_group_types(); var array_1 = require_array(); var ListNester = function() { function ListNester2() { } ListNester2.prototype.nest = function(groups) { var _this = this; var listBlocked = this.convertListBlocksToListGroups(groups); var groupedByListGroups = this.groupConsecutiveListGroups(listBlocked); var nested = array_1.flatten(groupedByListGroups.map(function(group2) { if (!Array.isArray(group2)) { return group2; } return _this.nestListSection(group2); })); var groupRootLists = array_1.groupConsecutiveElementsWhile(nested, function(curr, prev) { if (!(curr instanceof group_types_1.ListGroup && prev instanceof group_types_1.ListGroup)) { return false; } return curr.items[0].item.op.isSameListAs(prev.items[0].item.op); }); return groupRootLists.map(function(v) { if (!Array.isArray(v)) { return v; } var litems = v.map(function(g) { return g.items; }); return new group_types_1.ListGroup(array_1.flatten(litems)); }); }; ListNester2.prototype.convertListBlocksToListGroups = function(items) { var grouped = array_1.groupConsecutiveElementsWhile(items, function(g, gPrev) { return g instanceof group_types_1.BlockGroup && gPrev instanceof group_types_1.BlockGroup && g.op.isList() && gPrev.op.isList() && g.op.isSameListAs(gPrev.op) && g.op.hasSameIndentationAs(gPrev.op); }); return grouped.map(function(item) { if (!Array.isArray(item)) { if (item instanceof group_types_1.BlockGroup && item.op.isList()) { return new group_types_1.ListGroup([new group_types_1.ListItem(item)]); } return item; } return new group_types_1.ListGroup(item.map(function(g) { return new group_types_1.ListItem(g); })); }); }; ListNester2.prototype.groupConsecutiveListGroups = function(items) { return array_1.groupConsecutiveElementsWhile(items, function(curr, prev) { return curr instanceof group_types_1.ListGroup && prev instanceof group_types_1.ListGroup; }); }; ListNester2.prototype.nestListSection = function(sectionItems) { var _this = this; var indentGroups = this.groupByIndent(sectionItems); Object.keys(indentGroups).map(Number).sort().reverse().forEach(function(indent) { indentGroups[indent].forEach(function(lg) { var idx = sectionItems.indexOf(lg); if (_this.placeUnderParent(lg, sectionItems.slice(0, idx))) { sectionItems.splice(idx, 1); } }); }); return sectionItems; }; ListNester2.prototype.groupByIndent = function(items) { return items.reduce(function(pv, cv) { var indent = cv.items[0].item.op.attributes.indent; if (indent) { pv[indent] = pv[indent] || []; pv[indent].push(cv); } return pv; }, {}); }; ListNester2.prototype.placeUnderParent = function(target, items) { for (var i = items.length - 1; i >= 0; i--) { var elm = items[i]; if (target.items[0].item.op.hasHigherIndentThan(elm.items[0].item.op)) { var parent = elm.items[elm.items.length - 1]; if (parent.innerList) { parent.innerList.items = parent.innerList.items.concat(target.items); } else { parent.innerList = target; } return true; } } return false; }; return ListNester2; }(); exports2.ListNester = ListNester; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/TableGrouper.js var require_TableGrouper = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/grouper/TableGrouper.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var group_types_1 = require_group_types(); var array_1 = require_array(); var TableGrouper = function() { function TableGrouper2() { } TableGrouper2.prototype.group = function(groups) { var tableBlocked = this.convertTableBlocksToTableGroups(groups); return tableBlocked; }; TableGrouper2.prototype.convertTableBlocksToTableGroups = function(items) { var _this = this; var grouped = array_1.groupConsecutiveElementsWhile(items, function(g, gPrev) { return g instanceof group_types_1.BlockGroup && gPrev instanceof group_types_1.BlockGroup && g.op.isTable() && gPrev.op.isTable(); }); return grouped.map(function(item) { if (!Array.isArray(item)) { if (item instanceof group_types_1.BlockGroup && item.op.isTable()) { return new group_types_1.TableGroup([new group_types_1.TableRow([new group_types_1.TableCell(item)])]); } return item; } return new group_types_1.TableGroup(_this.convertTableBlocksToTableRows(item)); }); }; TableGrouper2.prototype.convertTableBlocksToTableRows = function(items) { var grouped = array_1.groupConsecutiveElementsWhile(items, function(g, gPrev) { return g instanceof group_types_1.BlockGroup && gPrev instanceof group_types_1.BlockGroup && g.op.isTable() && gPrev.op.isTable() && g.op.isSameTableRowAs(gPrev.op); }); return grouped.map(function(item) { return new group_types_1.TableRow(Array.isArray(item) ? item.map(function(it) { return new group_types_1.TableCell(it); }) : [new group_types_1.TableCell(item)]); }); }; return TableGrouper2; }(); exports2.TableGrouper = TableGrouper; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/QuillDeltaToHtmlConverter.js var require_QuillDeltaToHtmlConverter = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/QuillDeltaToHtmlConverter.js"(exports2) { "use strict"; var __importStar = exports2 && exports2.__importStar || function(mod2) { if (mod2 && mod2.__esModule) return mod2; var result = {}; if (mod2 != null) { for (var k in mod2) if (Object.hasOwnProperty.call(mod2, k)) result[k] = mod2[k]; } result["default"] = mod2; return result; }; Object.defineProperty(exports2, "__esModule", { value: true }); var InsertOpsConverter_1 = require_InsertOpsConverter(); var OpToHtmlConverter_1 = require_OpToHtmlConverter(); var Grouper_1 = require_Grouper(); var group_types_1 = require_group_types(); var ListNester_1 = require_ListNester(); var funcs_html_1 = require_funcs_html(); var obj = __importStar(require_object()); var value_types_1 = require_value_types(); var TableGrouper_1 = require_TableGrouper(); var BrTag = "
"; var QuillDeltaToHtmlConverter2 = function() { function QuillDeltaToHtmlConverter3(deltaOps, options) { this.rawDeltaOps = []; this.callbacks = {}; this.options = obj.assign({ paragraphTag: "p", textTag: "span", encodeHtml: true, classPrefix: "ql", inlineStyles: false, multiLineBlockquote: true, multiLineHeader: true, multiLineCodeblock: true, multiLineParagraph: true, multiLineCustomBlock: true, allowBackgroundClasses: false, linkTarget: "_blank" }, options, { orderedListTag: "ol", bulletListTag: "ul", listItemTag: "li" }); var inlineStyles; if (!this.options.inlineStyles) { inlineStyles = void 0; } else if (typeof this.options.inlineStyles === "object") { inlineStyles = this.options.inlineStyles; } else { inlineStyles = {}; } this.converterOptions = { encodeHtml: this.options.encodeHtml, classPrefix: this.options.classPrefix, inlineStyles, listItemTag: this.options.listItemTag, paragraphTag: this.options.paragraphTag, textTag: this.options.textTag, linkRel: this.options.linkRel, linkTarget: this.options.linkTarget, allowBackgroundClasses: this.options.allowBackgroundClasses, customTag: this.options.customTag, customTagAttributes: this.options.customTagAttributes, customCssClasses: this.options.customCssClasses, customCssStyles: this.options.customCssStyles }; this.rawDeltaOps = deltaOps; } QuillDeltaToHtmlConverter3.prototype._getListTag = function(op) { return op.isOrderedList() ? this.options.orderedListTag + "" : op.isBulletList() ? this.options.bulletListTag + "" : op.isCheckedList() ? this.options.bulletListTag + "" : op.isUncheckedList() ? this.options.bulletListTag + "" : ""; }; QuillDeltaToHtmlConverter3.prototype.getGroupedOps = function() { var deltaOps = InsertOpsConverter_1.InsertOpsConverter.convert(this.rawDeltaOps, this.options); var pairedOps = Grouper_1.Grouper.pairOpsWithTheirBlock(deltaOps); var groupedSameStyleBlocks = Grouper_1.Grouper.groupConsecutiveSameStyleBlocks(pairedOps, { blockquotes: !!this.options.multiLineBlockquote, header: !!this.options.multiLineHeader, codeBlocks: !!this.options.multiLineCodeblock, customBlocks: !!this.options.multiLineCustomBlock }); var groupedOps = Grouper_1.Grouper.reduceConsecutiveSameStyleBlocksToOne(groupedSameStyleBlocks); var tableGrouper = new TableGrouper_1.TableGrouper(); groupedOps = tableGrouper.group(groupedOps); var listNester = new ListNester_1.ListNester(); return listNester.nest(groupedOps); }; QuillDeltaToHtmlConverter3.prototype.convert = function() { var _this = this; var groups = this.getGroupedOps(); return groups.map(function(group2) { if (group2 instanceof group_types_1.ListGroup) { return _this._renderWithCallbacks(value_types_1.GroupType.List, group2, function() { return _this._renderList(group2); }); } else if (group2 instanceof group_types_1.TableGroup) { return _this._renderWithCallbacks(value_types_1.GroupType.Table, group2, function() { return _this._renderTable(group2); }); } else if (group2 instanceof group_types_1.BlockGroup) { var g = group2; return _this._renderWithCallbacks(value_types_1.GroupType.Block, group2, function() { return _this._renderBlock(g.op, g.ops); }); } else if (group2 instanceof group_types_1.BlotBlock) { return _this._renderCustom(group2.op, null); } else if (group2 instanceof group_types_1.VideoItem) { return _this._renderWithCallbacks(value_types_1.GroupType.Video, group2, function() { var g2 = group2; var converter = new OpToHtmlConverter_1.OpToHtmlConverter(g2.op, _this.converterOptions); return converter.getHtml(); }); } else { return _this._renderWithCallbacks(value_types_1.GroupType.InlineGroup, group2, function() { return _this._renderInlines(group2.ops, true); }); } }).join(""); }; QuillDeltaToHtmlConverter3.prototype._renderWithCallbacks = function(groupType, group2, myRenderFn) { var html = ""; var beforeCb = this.callbacks["beforeRender_cb"]; html = typeof beforeCb === "function" ? beforeCb.apply(null, [groupType, group2]) : ""; if (!html) { html = myRenderFn(); } var afterCb = this.callbacks["afterRender_cb"]; html = typeof afterCb === "function" ? afterCb.apply(null, [groupType, html]) : html; return html; }; QuillDeltaToHtmlConverter3.prototype._renderList = function(list) { var _this = this; var firstItem = list.items[0]; return funcs_html_1.makeStartTag(this._getListTag(firstItem.item.op)) + list.items.map(function(li) { return _this._renderListItem(li); }).join("") + funcs_html_1.makeEndTag(this._getListTag(firstItem.item.op)); }; QuillDeltaToHtmlConverter3.prototype._renderListItem = function(li) { li.item.op.attributes.indent = 0; var converter = new OpToHtmlConverter_1.OpToHtmlConverter(li.item.op, this.converterOptions); var parts = converter.getHtmlParts(); var liElementsHtml = this._renderInlines(li.item.ops, false); return parts.openingTag + liElementsHtml + (li.innerList ? this._renderList(li.innerList) : "") + parts.closingTag; }; QuillDeltaToHtmlConverter3.prototype._renderTable = function(table) { var _this = this; return funcs_html_1.makeStartTag("table") + funcs_html_1.makeStartTag("tbody") + table.rows.map(function(row) { return _this._renderTableRow(row); }).join("") + funcs_html_1.makeEndTag("tbody") + funcs_html_1.makeEndTag("table"); }; QuillDeltaToHtmlConverter3.prototype._renderTableRow = function(row) { var _this = this; return funcs_html_1.makeStartTag("tr") + row.cells.map(function(cell) { return _this._renderTableCell(cell); }).join("") + funcs_html_1.makeEndTag("tr"); }; QuillDeltaToHtmlConverter3.prototype._renderTableCell = function(cell) { var converter = new OpToHtmlConverter_1.OpToHtmlConverter(cell.item.op, this.converterOptions); var parts = converter.getHtmlParts(); var cellElementsHtml = this._renderInlines(cell.item.ops, false); return funcs_html_1.makeStartTag("td", { key: "data-row", value: cell.item.op.attributes.table }) + parts.openingTag + cellElementsHtml + parts.closingTag + funcs_html_1.makeEndTag("td"); }; QuillDeltaToHtmlConverter3.prototype._renderBlock = function(bop, ops) { var _this = this; var converter = new OpToHtmlConverter_1.OpToHtmlConverter(bop, this.converterOptions); var htmlParts = converter.getHtmlParts(); if (bop.isCodeBlock()) { return htmlParts.openingTag + funcs_html_1.encodeHtml(ops.map(function(iop) { return iop.isCustomEmbed() ? _this._renderCustom(iop, bop) : iop.insert.value; }).join("")) + htmlParts.closingTag; } var inlines = ops.map(function(op) { return _this._renderInline(op, bop); }).join(""); return htmlParts.openingTag + (inlines || BrTag) + htmlParts.closingTag; }; QuillDeltaToHtmlConverter3.prototype._renderInlines = function(ops, isInlineGroup) { var _this = this; if (isInlineGroup === void 0) { isInlineGroup = true; } var opsLen = ops.length - 1; var html = ops.map(function(op, i) { if (i > 0 && i === opsLen && op.isJustNewline()) { return ""; } return _this._renderInline(op, null); }).join(""); if (!isInlineGroup) { return html; } var startParaTag = funcs_html_1.makeStartTag(this.options.paragraphTag); var endParaTag = funcs_html_1.makeEndTag(this.options.paragraphTag); if (html === BrTag || this.options.multiLineParagraph) { return startParaTag + html + endParaTag; } return startParaTag + html.split(BrTag).map(function(v) { return v === "" ? BrTag : v; }).join(endParaTag + startParaTag) + endParaTag; }; QuillDeltaToHtmlConverter3.prototype._renderInline = function(op, contextOp) { if (op.isCustomEmbed()) { return this._renderCustom(op, contextOp); } var converter = new OpToHtmlConverter_1.OpToHtmlConverter(op, this.converterOptions); return converter.getHtml().replace(/\\n/g, BrTag); }; QuillDeltaToHtmlConverter3.prototype._renderCustom = function(op, contextOp) { var renderCb = this.callbacks["renderCustomOp_cb"]; if (typeof renderCb === "function") { return renderCb.apply(null, [op, contextOp]); } return ""; }; QuillDeltaToHtmlConverter3.prototype.beforeRender = function(cb) { if (typeof cb === "function") { this.callbacks["beforeRender_cb"] = cb; } }; QuillDeltaToHtmlConverter3.prototype.afterRender = function(cb) { if (typeof cb === "function") { this.callbacks["afterRender_cb"] = cb; } }; QuillDeltaToHtmlConverter3.prototype.renderCustomWith = function(cb) { this.callbacks["renderCustomOp_cb"] = cb; }; return QuillDeltaToHtmlConverter3; }(); exports2.QuillDeltaToHtmlConverter = QuillDeltaToHtmlConverter2; } }); // node_modules/quill-delta-to-html-cb/dist/commonjs/main.js var require_main = __commonJS({ "node_modules/quill-delta-to-html-cb/dist/commonjs/main.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); var QuillDeltaToHtmlConverter_1 = require_QuillDeltaToHtmlConverter(); exports2.QuillDeltaToHtmlConverter = QuillDeltaToHtmlConverter_1.QuillDeltaToHtmlConverter; var OpToHtmlConverter_1 = require_OpToHtmlConverter(); exports2.OpToHtmlConverter = OpToHtmlConverter_1.OpToHtmlConverter; var group_types_1 = require_group_types(); exports2.InlineGroup = group_types_1.InlineGroup; exports2.VideoItem = group_types_1.VideoItem; exports2.BlockGroup = group_types_1.BlockGroup; exports2.ListGroup = group_types_1.ListGroup; exports2.ListItem = group_types_1.ListItem; exports2.BlotBlock = group_types_1.BlotBlock; var DeltaInsertOp_1 = require_DeltaInsertOp(); exports2.DeltaInsertOp = DeltaInsertOp_1.DeltaInsertOp; var InsertData_1 = require_InsertData(); exports2.InsertDataQuill = InsertData_1.InsertDataQuill; exports2.InsertDataCustom = InsertData_1.InsertDataCustom; var value_types_1 = require_value_types(); exports2.NewLine = value_types_1.NewLine; exports2.ListType = value_types_1.ListType; exports2.ScriptType = value_types_1.ScriptType; exports2.DirectionType = value_types_1.DirectionType; exports2.AlignType = value_types_1.AlignType; exports2.DataType = value_types_1.DataType; exports2.GroupType = value_types_1.GroupType; } }); // 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 ? ( /* positive */ 0 ) : ( /* negative 0 */ 2147483648 ), buf, pos); else if (isNaN(val)) writeUint(2143289344, buf, pos); else if (val > 34028234663852886e22) writeUint((sign << 31 | 2139095040) >>> 0, buf, pos); else if (val < 11754943508222875e-54) writeUint((sign << 31 | Math.round(val / 1401298464324817e-60)) >>> 0, buf, pos); else { var exponent = Math.floor(Math.log(val) / Math.LN2), mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607; writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos); } } 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 ? ( /* positive */ 0 ) : ( /* negative 0 */ 2147483648 ), buf, pos + off1); } else if (isNaN(val)) { writeUint(0, buf, pos + off0); writeUint(2146959360, buf, pos + off1); } else if (val > 17976931348623157e292) { writeUint(0, buf, pos + off0); writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1); } else { var mantissa; if (val < 22250738585072014e-324) { mantissa = val / 5e-324; writeUint(mantissa >>> 0, buf, pos + off0); writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1); } else { var exponent = Math.floor(Math.log(val) / Math.LN2); if (exponent === 1024) exponent = 1023; mantissa = val * Math.pow(2, -exponent); writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0); writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1); } } } 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([]) : ( /* istanbul ignore next */ [] ); util.emptyObject = Object.freeze ? Object.freeze({}) : ( /* istanbul ignore next */ {} ); util.isInteger = Number.isInteger || /* istanbul ignore next */ 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 = /** * Checks if a property on a message is considered to be present. * @param {Object} obj Plain object or message instance * @param {string} prop Property name * @returns {boolean} \`true\` if considered to be present, otherwise \`false\` */ 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 : ( /* istanbul ignore next */ 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 = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long || /* istanbul ignore next */ 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: false would accurately preserve the behavior of // the original, but I'm guessing that was not intentional. // For an actual error subclass, this property would // be configurable. configurable: true }, toString: { value() { 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 || /* istanbul ignore next */ function Buffer_from(value, encoding) { return new Buffer2(value, encoding); }; util._Buffer_allocUnsafe = Buffer2.allocUnsafe || /* istanbul ignore next */ 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 || /* istanbul ignore next */ 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" : ( /* istanbul ignore next */ "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( /* endedByRPC */ true ); return void 0; } if (!(response instanceof responseCtor)) { try { response = responseCtor[self2.responseDelimited ? "decodeDelimited" : "decode"](response); } catch (err2) { self2.emit("error", err2, method); return callback(err2); } } self2.emit("data", response, method); return callback(null, response); } ); } catch (err) { self2.emit("error", err, method); setTimeout(function() { callback(err); }, 0); return void 0; } }; Service.prototype.end = function end(endedByRPC) { if (this.rpcImpl) { if (!endedByRPC) this.rpcImpl(null, null, null); this.rpcImpl = null; this.emit("end").off(); } return this; }; } }); // 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 = ( /** * Tests if the specified path is absolute. * @param {string} path Path to test * @returns {boolean} \`true\` if path is absolute */ path.isAbsolute = function isAbsolute2(path2) { return /^(?:\\/|\\w+:)/.test(path2); } ); var normalize = ( /** * Normalizes the specified path. * @param {string} path Path to normalize * @returns {string} Normalized path */ 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", // 0 "float", // 1 "int32", // 2 "uint32", // 3 "sint32", // 4 "fixed32", // 5 "sfixed32", // 6 "int64", // 7 "uint64", // 8 "sint64", // 9 "fixed64", // 10 "sfixed64", // 11 "bool", // 12 "string", // 13 "bytes" // 14 ]; 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([ /* double */ 1, /* float */ 5, /* int32 */ 0, /* uint32 */ 0, /* sint32 */ 0, /* fixed32 */ 5, /* sfixed32 */ 5, /* int64 */ 0, /* uint64 */ 0, /* sint64 */ 0, /* fixed64 */ 1, /* sfixed64 */ 1, /* bool */ 0, /* string */ 2, /* bytes */ 2 ]); types.defaults = bake([ /* double */ 0, /* float */ 0, /* int32 */ 0, /* uint32 */ 0, /* sint32 */ 0, /* fixed32 */ 0, /* sfixed32 */ 0, /* int64 */ 0, /* uint64 */ 0, /* sint64 */ 0, /* fixed64 */ 0, /* sfixed64 */ 0, /* bool */ false, /* string */ "", /* bytes */ util.emptyArray, /* message */ null ]); types.long = bake([ /* int64 */ 0, /* uint64 */ 0, /* sint64 */ 0, /* fixed64 */ 1, /* sfixed64 */ 1 ], 7); types.mapKey = bake([ /* int32 */ 0, /* uint32 */ 0, /* sint32 */ 0, /* fixed32 */ 5, /* sfixed32 */ 5, /* int64 */ 0, /* uint64 */ 0, /* sint64 */ 0, /* fixed64 */ 1, /* sfixed64 */ 1, /* bool */ 0, /* string */ 2 ], 2); types.packed = bake([ /* double */ 1, /* float */ 5, /* int32 */ 0, /* uint32 */ 0, /* sint32 */ 0, /* fixed32 */ 5, /* sfixed32 */ 5, /* int64 */ 0, /* uint64 */ 0, /* sint64 */ 0, /* fixed64 */ 1, /* sfixed64 */ 1, /* bool */ 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_object2(); ((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 : ( /* istanbul ignore next */ 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_object2(); ((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_object2(); ((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_object2(); ((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" && /* istanbul ignore next */ 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) || /* istanbul ignore next */ {}, "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 < /* initializes */ 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 < /* initializes */ 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} * @readonly */ fieldsById: { get: function() { if (this._fieldsById) return this._fieldsById; this._fieldsById = {}; for (var names = Object.keys(this.fields), i = 0; i < names.length; ++i) { var field = this.fields[names[i]], id = field.id; if (this._fieldsById[id]) throw Error("duplicate id " + id + " in " + this); this._fieldsById[id] = field; } return this._fieldsById; } }, /** * Fields of this message as an array for iteration. * @name Type#fieldsArray * @type {Field[]} * @readonly */ fieldsArray: { get: function() { return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields)); } }, /** * Oneofs of this message as an array for iteration. * @name Type#oneofsArray * @type {OneOf[]} * @readonly */ oneofsArray: { get: function() { return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs)); } }, /** * The registered constructor, if any registered, otherwise a generic constructor. * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor. * @name Type#ctor * @type {Constructor<{}>} */ ctor: { get: function() { return this._ctor || (this.ctor = Type2.generateConstructor(this)()); }, set: function(ctor) { var prototype = ctor.prototype; if (!(prototype instanceof Message)) { (ctor.prototype = new Message()).constructor = ctor; util.merge(ctor.prototype, prototype); } ctor.\$type = ctor.prototype.\$type = this; util.merge(ctor, Message, true); this._ctor = ctor; var i = 0; for (; i < /* initializes */ this.fieldsArray.length; ++i) this._fieldsArray[i].resolve(); var ctorProperties = {}; for (i = 0; i < /* initializes */ this.oneofsArray.length; ++i) ctorProperties[this._oneofsArray[i].resolve().name] = { get: util.oneOfGetter(this._oneofsArray[i].oneof), set: util.oneOfSetter(this._oneofsArray[i].oneof) }; if (i) Object.defineProperties(ctor.prototype, ctorProperties); } } }); Type2.generateConstructor = function generateConstructor(mtype) { var gen = util.codegen(["p"], mtype.name); for (var i = 0, field; i < mtype.fieldsArray.length; ++i) if ((field = mtype._fieldsArray[i]).map) gen("this%s={}", util.safeProp(field.name)); else if (field.repeated) gen("this%s=[]", util.safeProp(field.name)); return gen("if(p)for(var ks=Object.keys(p),i=0;i -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 (/* an extension field (implies not part of a oneof) */ object.extend !== void 0 && /* not already handled */ !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 < /* initializes */ 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 (/* an extension field */ object.extend !== void 0) { if (/* already handled */ 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 < /* initializes */ 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_object2 = __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, { /** * Reference to the root namespace. * @name ReflectionObject#root * @type {Root} * @readonly */ root: { get: function() { var ptr = this; while (ptr.parent !== null) ptr = ptr.parent; return ptr; } }, /** * Full name including leading dot. * @name ReflectionObject#fullName * @type {string} * @readonly */ 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 = /* istanbul ignore next */ 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_object2(); ((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 = ( /* initializes */ 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_object2(); 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-\${"855f368"}\`) || customElements.define(\`button-\${"855f368"}\`, 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-\${"855f368"}\`) || customElements.define(\`popupbox-\${"855f368"}\`, 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-\${"855f368"}\`) || customElements.define(\`toast-\${"855f368"}\`, 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-\${"855f368"}\`) || customElements.define(\`toast-container-\${"855f368"}\`, 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-855f368") || customElements.define("bilibili-entry-855f368", BilioldEntry); // src/core/userstatus.ts var userStatus = { /** 开发者模式 */ development: true, /** 主页 */ index: true, /** toastr */ toast: Toastconfig, /** 替换全局顶栏 */ header: true, /** 翻页评论区 */ comment: true, /** av */ av: true, /** 嵌入式播放器 */ player: true, /** WebRTC */ webRTC: false, /** 充电鸣谢 */ elecShow: true, /** 合作UP */ staff: false, /** bangumi */ bangumi: true, /** 解除限制 */ videoLimit: { /** 开关 */ status: false, /** 服务器类型 */ server: "内置", /** 东南亚(泰区)代理服务器 */ th: "api.global.bilibili.com", /** 台湾代理服务器 */ tw: "", /** 香港代理服务器 */ hk: "", /** 大陆代理服务器 */ cn: "" }, /** UPOS替换 */ uposReplace: { /** 东南亚(泰区) */ th: "ks3(金山)", /** 港澳台 */ gat: "不替换", /** 一般视频 */ nor: "不替换", /** 下载 */ download: "不替换" }, /** 强制显示bangumi分p */ bangumiEplist: false, /** 账户授权 */ accessKey: { /** access_key */ 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: "浏览器", /** User-Agent */ userAgent: "Bilibili Freedoooooom/MarkII", /** referer */ referer: "https://www.bilibili.com", /** 下载目录 */ filepath: "", /** aria2 */ aria2: { /** 服务器 */ server: "http://localhost", /** 端口 */ port: 6800, /** 令牌 */ token: "", /** 分片数目 */ split: 4, /** 分片大小 */ size: 20 }, ef2: { /** 稍后下载 */ delay: false, /** 静默下载 */ silence: false }, /** 点赞功能 */ like: false, /** 重构播放器脚本 */ bilibiliplayer: true, /** 检查播放器脚本更新 */ checkUpdate: true, /** 不登录1080P支持 */ show1080p: false, /** 调整顶栏banner样式 */ fullBannerCover: false, /** 原生播放器新版弹幕 */ dmproto: true, /** 普权弹幕换行 */ dmwrap: true, /** 弹幕格式 */ dmExtension: "xml", /** 合并已有弹幕 */ dmContact: false, /** 分集数据 */ episodeData: false, /** 港澳台新番时间表 */ timeLine: 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); } }); } /** 用户数据,不应直接使用,请使用\`addCallback\`用户数据回调代替 */ userStatus; /** 初始化标记 */ initialized = false; /** 更新CD */ updating; /** 回调栈 */ changes = {}; timer; /** * 监听设置改动 * @param key 设置键 * @param callback 设置项变动时执行的回调,新值将作为第一个参数传入 * @returns 用于取消监听的回调 */ bindChange(key, callback) { this.changes[key] || (this.changes[key] = []); const id = this.changes[key].push(callback); return () => { delete this.changes[key][id - 1]; }; } /** * 推送设置改动 * @param key 设置键 * @param newValue 新值 */ 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; } /** * av/BV互转 * @param input av或BV,可带av/BV前缀 * @returns 转化结果 */ 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; /** 参数对象。结果会格式化\`undefined\`\`null\`\`NaN\`等特殊值,但不会处理数字,以免丢失精度。 */ params = {}; /** 参数链(不含\`?\`) */ get param() { return Object.entries(this.params).reduce((s, d) => { return s += \`\${s ? "&" : ""}\${d[0]}=\${d[1]}\`; }, ""); } /** 提取URL参数 */ 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; }, {}); } /** 还原url链接 */ 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 }); } /** 净化url */ 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; } /** 净化URL */ location() { this.updateLocation(this.clear(location.href)); } /** 更新URL而不触发重定向 */ 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]); } /** 净化a标签 */ 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 */ html; /** 当前光标 */ pos = 0; /** Vnode */ vnode = []; /** 节点名栈 */ tagNames = []; /** Vnode栈 */ targets = []; /** innerText栈 */ text = ""; /** 引号栈 */ quote = ""; /** * 扫描html文本转化为Vnode * @param html html文本 */ 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 = ""; } /** 移除已扫描字符长度 默认1位 */ removeScanned(length = 1) { this.html = this.html.slice(length); } /** 处理TextContent */ 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; } } /** 生成 DocumentFragment(会过滤script标签,请稍后使用\`loadScript\`方法依次运行所有script) */ 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; } /** 根据vdom生成真DOM(过滤script标签) */ 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; } /** svg限定生成方法 */ 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 */ vdom; /** 初始化完成 */ initilized = false; /** * @param html 页面框架 */ constructor(html) { this.vdom = new VdomTool(html); Reflect.defineProperty(window, "_babelPolyfill", { configurable: true, set: () => true, get: () => void 0 }); } /** 重写页面 */ updateDom() { const title = document.title; this.vdom.replace(document.documentElement); Reflect.deleteProperty(window, "PlayerAgent"); Reflect.deleteProperty(window, "webpackJsonp"); 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